Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(panel): Add component tokens #10822

Merged
merged 16 commits into from
Nov 21, 2024
Merged
8 changes: 1 addition & 7 deletions packages/calcite-components/.stylelintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// @ts-check

// ⚠️ AUTO-GENERATED CODE - DO NOT EDIT
const customFunctions = [
"get-trailing-text-input-padding",
"medium-modular-scale",
"modular-scale",
"scale-duration",
"small-modular-scale"
];
const customFunctions = [];
// ⚠️ END OF AUTO-GENERATED CODE

const scssPatternRules = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ describe("calcite-dialog", () => {
},
"--calcite-dialog-footer-space": {
shadowSelector: `.${CSS.panel}`,
targetProp: "--calcite-panel-footer-padding",
targetProp: "--calcite-panel-footer-space",
},
"--calcite-dialog-offset-x": {
shadowSelector: `.${CSS.dialog}`,
Expand Down
4 changes: 2 additions & 2 deletions packages/calcite-components/src/components/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@

calcite-panel {
--calcite-panel-content-space: var(--calcite-dialog-content-space, var(--calcite-internal-dialog-content-padding));
--calcite-panel-footer-padding: var(--calcite-dialog-footer-space);
--calcite-panel-header-border-block-end: var(--calcite-border-width-sm) solid var(--calcite-dialog-border-color);
--calcite-panel-footer-space: var(--calcite-dialog-footer-space);
--calcite-panel-border-color: var(--calcite-dialog-border-color);
--calcite-panel-background-color: var(--calcite-dialog-background-color);
}

Expand Down
119 changes: 111 additions & 8 deletions packages/calcite-components/src/components/panel/panel.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,15 +667,118 @@ describe("calcite-panel", () => {
});

describe("theme", () => {
themed(html`<calcite-panel collapsible closable>scrolling content</calcite-panel>`, {
"--calcite-panel-content-space": {
shadowSelector: `.${CSS.contentWrapper}`,
targetProp: "padding",
themed(
html`<calcite-panel heading="Terms and conditions" description="Something great about this" closable collapsible>
<calcite-action text="banana" text-enabled icon="banana" slot="header-menu-actions"></calcite-action>
<calcite-action text="measure" text-enabled icon="measure" slot="header-menu-actions"></calcite-action>
<calcite-action text="Layers" icon="question" slot="header-actions-end"></calcite-action>
<div slot="content-top">To continue, you must agree to the terms</div>
<calcite-label slot="content-bottom" layout="inline-space-between" style="--calcite-label-margin-bottom: 0">
<calcite-checkbox></calcite-checkbox>I agree to the terms
</calcite-label>
<p>
Curabitur mauris quam, tempor sit amet massa sed, mattis blandit diam. Proin dignissim leo vitae quam
fringilla viverra. Ut eget gravida magna, et tincidunt dui. Nullam a finibus ante, eu dignissim eros. Aenean
sodales sollicitudin dui in fermentum. Fusce egestas erat nec eros sodales ornare. Ut malesuada est tortor,
vitae semper turpis rutrum at. Donec suscipit, nulla in euismod luctus, nulla sapien interdum tortor, a
iaculis elit mi sed lectus. Morbi in congue metus, non imperdiet ex. Nunc et neque tempor, porttitor est sed,
vestibulum risus. Integer non erat libero.
</p>
<p>
Cras sagittis vel neque sed efficitur. Vestibulum mattis diam eget urna condimentum tempus. Donec malesuada
velit sit amet metus faucibus pharetra. Sed sit amet massa facilisis, porttitor nunc vitae, sollicitudin
mauris. Nullam nec rhoncus augue. Praesent rhoncus varius sapien, sit amet porttitor nisl varius eu.
Pellentesque at eros eget metus dignissim lacinia. Sed sed justo eget sapien ultrices commodo. Donec eget
pretium urna. Vestibulum ut tortor ut quam viverra dictum. Morbi ut turpis velit. Phasellus maximus lacus
nunc, ac consequat est varius in. Nullam facilisis, purus ut aliquet condimentum, est tortor accumsan justo,
at sagittis urna dolor eget lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus.
</p>
<p>
Curabitur mauris quam, tempor sit amet massa sed, mattis blandit diam. Proin dignissim leo vitae quam
fringilla viverra. Ut eget gravida magna, et tincidunt dui. Nullam a finibus ante, eu dignissim eros. Aenean
sodales sollicitudin dui in fermentum. Fusce egestas erat nec eros sodales ornare. Ut malesuada est tortor,
vitae semper turpis rutrum at. Donec suscipit, nulla in euismod luctus, nulla sapien interdum tortor, a
iaculis elit mi sed lectus. Morbi in congue metus, non imperdiet ex. Nunc et neque tempor, porttitor est sed,
vestibulum risus. Integer non erat libero.
</p>
<calcite-button slot="footer-end"> I'm done </calcite-button>
</calcite-panel>`,
{
"--calcite-panel-corner-radius": {
shadowSelector: `.${CSS.container}`,
targetProp: "borderRadius",
},
"--calcite-panel-heading-text-color": {
shadowSelector: `.${CSS.heading}`,
targetProp: "color",
},
"--calcite-panel-description-text-color": {
shadowSelector: `.${CSS.description}`,
targetProp: "color",
},
"--calcite-panel-background-color": {
shadowSelector: `.${CSS.contentWrapper}`,
targetProp: "backgroundColor",
},
"--calcite-panel-header-background-color": {
shadowSelector: `.${CSS.header}`,
targetProp: "backgroundColor",
},
"--calcite-panel-footer-background-color": {
shadowSelector: `.${CSS.footer}`,
targetProp: "backgroundColor",
},
"--calcite-panel-border-color": [
{
shadowSelector: `.${CSS.header}`,
targetProp: "borderBlockEndColor",
},
{
shadowSelector: `.${CSS.contentTop}`,
targetProp: "borderBlockStartColor",
},
{
shadowSelector: `.${CSS.contentBottom}`,
targetProp: "borderBlockStartColor",
},
{
shadowSelector: `.${CSS.footer}`,
targetProp: "borderBlockStartColor",
},
],
"--calcite-panel-space": {
shadowSelector: `.${CSS.contentWrapper}`,
targetProp: "padding",
},
"--calcite-panel-footer-space": {
shadowSelector: `.${CSS.footer}`,
targetProp: "padding",
},
"--calcite-panel-content-space": {
shadowSelector: `.${CSS.contentWrapper}`,
targetProp: "padding",
},
},
"--calcite-panel-background-color": {
shadowSelector: `.${CSS.contentWrapper}`,
targetProp: "backgroundColor",
);
themed(
html`<calcite-panel heading="Terms and conditions" description="Something great about this" closable collapsible>
<div slot="header-content">Custom header content</div>
<p>
Curabitur mauris quam, tempor sit amet massa sed, mattis blandit diam. Proin dignissim leo vitae quam
fringilla viverra. Ut eget gravida magna, et tincidunt dui. Nullam a finibus ante, eu dignissim eros. Aenean
sodales sollicitudin dui in fermentum. Fusce egestas erat nec eros sodales ornare. Ut malesuada est tortor,
vitae semper turpis rutrum at. Donec suscipit, nulla in euismod luctus, nulla sapien interdum tortor, a
iaculis elit mi sed lectus. Morbi in congue metus, non imperdiet ex. Nunc et neque tempor, porttitor est sed,
vestibulum risus. Integer non erat libero.
</p>
<calcite-button slot="footer-end"> I'm done </calcite-button>
</calcite-panel>`,
{
"--calcite-panel-header-content-space": {
shadowSelector: `.${CSS.headerSlottedContent}`,
targetProp: "padding",
},
},
});
);
});
});
Loading
Loading