@uh-design-system/component-library 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/component-library.cjs.js +2 -2
- package/dist/cjs/controlUtils-041de0fd.js +7 -0
- package/dist/cjs/ds-accordion_3.cjs.entry.js +28 -20
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +156 -0
- package/dist/cjs/ds-checkbox.cjs.entry.js +153 -0
- package/dist/cjs/ds-input-validity.cjs.entry.js +38 -0
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +9 -8
- package/dist/cjs/ds-link.cjs.entry.js +12 -9
- package/dist/cjs/ds-text-input.cjs.entry.js +30 -6
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
- package/dist/cjs/{index-bfa0f441.js → index-b1d61146.js} +116 -2
- package/dist/cjs/{linkUtils-695da37c.js → linkUtils-e911e899.js} +10 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/utils-c9113835.js +18 -0
- package/dist/collection/accessibility/accessibility.stories.js +10 -0
- package/dist/collection/accessibility/stories/ariaLabel.stories.js +19 -0
- package/dist/collection/accessibility/stories/ariaLabelledBy.stories.js +49 -0
- package/dist/collection/accessibility/stories/naming.stories.js +39 -0
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/00-foundations/icons/categories/information.js +4 -0
- package/dist/collection/components/00-foundations/typography/stories/typography.stories.js +195 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +11 -3
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +127 -63
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +23 -2
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +55 -8
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +98 -55
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +315 -0
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +429 -0
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.js +115 -0
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +37 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +38 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +445 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +89 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.js +47 -0
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +2 -2
- package/dist/collection/components/01-base-components/ds-icon/{ds-icon.stories.js → stories/ds-icon.stories.js} +12 -2
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.css +31 -0
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +114 -0
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +17 -0
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +21 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +109 -25
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +70 -10
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +6 -2
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +2 -2
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +12 -4
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +86 -20
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +27 -7
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.js → ds-link-with-arrow.examples.stories.js} +26 -3
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.js → ds-link-with-arrow.stories.js} +2 -4
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +37 -21
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +31 -6
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +29 -7
- package/dist/collection/components/01-base-components/ds-text-input/utils.js +0 -6
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/utils/controls/controlUtils.js +2 -0
- package/dist/collection/utils/link/linkUtils.js +9 -0
- package/dist/collection/utils/typography/typographyUtils.js +60 -0
- package/dist/collection/utils/utils.js +24 -6
- package/dist/component-library/component-library.css +1 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/controlUtils-9ca4087b.js +1 -0
- package/dist/component-library/ds-accordion_3.entry.js +1 -1
- package/dist/component-library/ds-checkbox-group.entry.js +1 -0
- package/dist/component-library/ds-checkbox.entry.js +1 -0
- package/dist/component-library/ds-input-validity.entry.js +1 -0
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
- package/dist/component-library/ds-link.entry.js +1 -1
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -1
- package/dist/component-library/index-aaccd233.js +2 -0
- package/dist/component-library/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +1 -1
- package/dist/component-library/utils-b5843ae1.js +1 -0
- package/dist/components/attributes.js +1 -80
- package/dist/components/controlUtils.js +4 -0
- package/dist/components/ds-accordion.js +8 -8
- package/dist/components/ds-button2.js +6 -3
- package/dist/components/ds-checkbox-group.d.ts +11 -0
- package/dist/components/ds-checkbox-group.js +206 -0
- package/dist/components/ds-checkbox.d.ts +11 -0
- package/dist/components/ds-checkbox.js +6 -0
- package/dist/components/ds-checkbox2.js +185 -0
- package/dist/components/ds-icon2.js +25 -5
- package/dist/components/ds-input-validity.d.ts +11 -0
- package/dist/components/ds-input-validity.js +6 -0
- package/dist/components/ds-input-validity2.js +59 -0
- package/dist/components/ds-link-with-arrow.js +11 -9
- package/dist/components/ds-link.js +16 -10
- package/dist/components/ds-text-input.js +31 -8
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index2.js +104 -4
- package/dist/components/index3.js +80 -0
- package/dist/components/linkUtils.js +10 -1
- package/dist/esm/component-library.js +3 -3
- package/dist/esm/controlUtils-9ca4087b.js +4 -0
- package/dist/esm/ds-accordion_3.entry.js +26 -18
- package/dist/esm/ds-checkbox-group.entry.js +152 -0
- package/dist/esm/ds-checkbox.entry.js +149 -0
- package/dist/esm/ds-input-validity.entry.js +34 -0
- package/dist/esm/ds-link-with-arrow.entry.js +9 -8
- package/dist/esm/ds-link.entry.js +12 -9
- package/dist/esm/ds-text-input.entry.js +30 -6
- package/dist/esm/ds-visually-hidden.entry.js +2 -2
- package/dist/esm/{index-42701395.js → index-aaccd233.js} +116 -3
- package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +10 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/utils-b5843ae1.js +15 -0
- package/dist/types/accessibility/accessibility.stories.d.ts +3 -0
- package/dist/types/accessibility/stories/ariaLabel.stories.d.ts +5 -0
- package/dist/types/accessibility/stories/ariaLabelledBy.stories.d.ts +4 -0
- package/dist/types/accessibility/stories/naming.stories.d.ts +4 -0
- package/dist/types/components/00-foundations/typography/{typography.stories.d.ts → stories/typography.stories.d.ts} +6 -3
- package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +3 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +7 -1
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +49 -0
- package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.d.ts +13 -0
- package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +56 -0
- package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-icon/{ds-icon.stories.d.ts → stories/ds-icon.stories.d.ts} +2 -1
- package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +12 -0
- package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +5 -2
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +2 -1
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +5 -0
- package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +0 -1
- package/dist/types/components.d.ts +148 -6
- package/dist/types/utils/controls/controlUtils.d.ts +2 -0
- package/dist/types/utils/link/linkUtils.d.ts +1 -0
- package/dist/types/utils/typography/typographyUtils.d.ts +6 -0
- package/dist/types/utils/utils.d.ts +10 -3
- package/package.json +3 -4
- package/dist/cjs/utils-8b73aa91.js +0 -10
- package/dist/collection/components/00-foundations/typography/typography.stories.js +0 -68
- package/dist/component-library/index-42701395.js +0 -2
- package/dist/component-library/utils-cca2a41a.js +0 -1
- package/dist/components/utils.js +0 -8
- package/dist/esm/utils-cca2a41a.js +0 -8
- /package/dist/cjs/{attributes-f7831329.js → attributes-5f5b58be.js} +0 -0
- /package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.js → ds-link-with-arrow.features.stories.js} +0 -0
- /package/dist/collection/utils/{attributes.js → attributes/attributes.js} +0 -0
- /package/dist/component-library/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
- /package/dist/esm/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
- /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.d.ts → ds-link-with-arrow.examples.stories.d.ts} +0 -0
- /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.d.ts → ds-link-with-arrow.features.stories.d.ts} +0 -0
- /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.d.ts → ds-link-with-arrow.stories.d.ts} +0 -0
- /package/dist/types/utils/{attributes.d.ts → attributes/attributes.d.ts} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { litTemplateResultToString } from "../../utils/utils";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Accessibility/aria-labelledby',
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
const howToAriaLabelledByDOM = html `
|
|
8
|
+
<div class="ds-sb-how-to-aria-labelled-by">
|
|
9
|
+
<div class="ds-sb-how-to-aria-labelled-by__card">
|
|
10
|
+
<h3 id="stu_1">Student 1</h3>
|
|
11
|
+
<p>Faculty of Science</p>
|
|
12
|
+
<ds-button id="button1" aria-labelledby="button1 stu_1" value="Add"></ds-button>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="ds-sb-how-to-aria-labelled-by__card">
|
|
15
|
+
<h3 id="stu_2">Student 2</h3>
|
|
16
|
+
<p>Faculty of Arts</p>
|
|
17
|
+
<ds-button id="button2" aria-labelledby="button2 stu_2" value="Add"></ds-button>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
21
|
+
export const HowToAriaLabelledBy = {
|
|
22
|
+
name: 'How to "aria-labelledby"',
|
|
23
|
+
parameters: {
|
|
24
|
+
docs: {
|
|
25
|
+
source: {
|
|
26
|
+
code: litTemplateResultToString(howToAriaLabelledByDOM),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
render: () => html `
|
|
31
|
+
<style>
|
|
32
|
+
.ds-sb-how-to-aria-labelled-by {
|
|
33
|
+
display: grid;
|
|
34
|
+
gap: 1rem;
|
|
35
|
+
grid-template-columns: 1fr;
|
|
36
|
+
|
|
37
|
+
@media (min-width: 60rem) {
|
|
38
|
+
grid-template-columns: 1fr 1fr;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.ds-sb-how-to-aria-labelled-by .ds-sb-how-to-aria-labelled-by__card {
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #f7f7f7;
|
|
44
|
+
outline: 1px solid;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
47
|
+
${howToAriaLabelledByDOM}
|
|
48
|
+
`,
|
|
49
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { litTemplateResultToString } from "../../utils/utils";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Accessibility/Naming',
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
const howNamingWorksDOM = html `
|
|
8
|
+
<div class="ds-sb-how-naming-works">
|
|
9
|
+
<div>
|
|
10
|
+
<ds-button value="Continue"></ds-button>
|
|
11
|
+
<!The button gets it's accessible name from its text content>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<ds-text-input type="text" label="First name"></ds-text-input>
|
|
15
|
+
<!The text input gets its accessible name from the label/for structure>
|
|
16
|
+
|
|
17
|
+
<ds-link href="#" text="Apply to University of Helsinki"></ds-link>
|
|
18
|
+
<!The link gets it's accessible name from its text content>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
21
|
+
export const HowNamingWorks = {
|
|
22
|
+
parameters: {
|
|
23
|
+
docs: {
|
|
24
|
+
source: {
|
|
25
|
+
code: litTemplateResultToString(howNamingWorksDOM)
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
render: () => html `
|
|
30
|
+
<style>
|
|
31
|
+
.ds-sb-how-naming-works {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: 1rem;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
${howNamingWorksDOM}
|
|
38
|
+
`,
|
|
39
|
+
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
"components/01-base-components/ds-checkbox/ds-checkbox.js",
|
|
4
|
+
"components/01-base-components/ds-checkbox-group/ds-checkbox-group.js",
|
|
3
5
|
"components/01-base-components/ds-accordion/ds-accordion.js",
|
|
4
6
|
"components/01-base-components/ds-button/ds-button.js",
|
|
5
7
|
"components/01-base-components/ds-icon/ds-icon.js",
|
|
8
|
+
"components/01-base-components/ds-input-validity/ds-input-validity.js",
|
|
6
9
|
"components/01-base-components/ds-link/ds-link.js",
|
|
7
10
|
"components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js",
|
|
8
11
|
"components/01-base-components/ds-text-input/ds-text-input.js",
|
|
@@ -49,6 +49,8 @@ import PieChartIcon from "@material-symbols/svg-700/sharp/pie_chart.svg";
|
|
|
49
49
|
import PieChartFillIcon from "@material-symbols/svg-700/sharp/pie_chart-fill.svg";
|
|
50
50
|
import TableIcon from "@material-symbols/svg-700/sharp/table.svg";
|
|
51
51
|
import TableFillIcon from "@material-symbols/svg-700/sharp/table-fill.svg";
|
|
52
|
+
import DSCheckSmall from "../../../../../custom-icons/check_small.svg";
|
|
53
|
+
import DSCheckIndeterminateSmall from "../../../../../custom-icons/check_indeterminate_small.svg";
|
|
52
54
|
export const icons = [
|
|
53
55
|
{ name: 'calendar_month', component: CalendarMonthIcon, category: category },
|
|
54
56
|
{ name: 'calendar_month_fill', component: CalendarMonthFillIcon, category: category },
|
|
@@ -100,4 +102,6 @@ export const icons = [
|
|
|
100
102
|
{ name: 'pie_chart_fill', component: PieChartFillIcon, category: category },
|
|
101
103
|
{ name: 'table', component: TableIcon, category: category },
|
|
102
104
|
{ name: 'table_fill', component: TableFillIcon, category: category },
|
|
105
|
+
{ name: 'ds_check_small', component: DSCheckSmall, category: category },
|
|
106
|
+
{ name: 'ds_check_indeterminate_small', component: DSCheckIndeterminateSmall, category: category },
|
|
103
107
|
];
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import "../_typography.scss";
|
|
2
|
+
import "../_base.scss";
|
|
3
|
+
import "../_headings.scss";
|
|
4
|
+
import "../_bodyText.scss";
|
|
5
|
+
import { getTypographyVariables, createCategorySection, categories, getHeadingVariables, headingSizes } from "../../../../utils/typography/typographyUtils";
|
|
6
|
+
import { html } from "lit";
|
|
7
|
+
import { formatAsPx, generateLoremIpsum, pxToRem } from "../../../../utils/utils";
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Foundations/Typography',
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const TokenClasses = {
|
|
13
|
+
argTypes: {
|
|
14
|
+
headingExample: {
|
|
15
|
+
name: 'Heading',
|
|
16
|
+
control: 'text',
|
|
17
|
+
},
|
|
18
|
+
textExample: {
|
|
19
|
+
name: 'Text',
|
|
20
|
+
control: 'text',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
headingExample: generateLoremIpsum(),
|
|
25
|
+
textExample: generateLoremIpsum({ paragraphs: 2, wordsPerParagraph: 20, consistent: true }),
|
|
26
|
+
},
|
|
27
|
+
render: ({ headingExample, textExample }) => html `
|
|
28
|
+
<div>
|
|
29
|
+
<h2>Heading styles</h2>
|
|
30
|
+
<div class="ds-heading--2xLarge">${headingExample}</div>
|
|
31
|
+
<div class="ds-heading--xLarge">${headingExample}</div>
|
|
32
|
+
<div class="ds-heading--large">${headingExample}</div>
|
|
33
|
+
<div class="ds-heading--medium">${headingExample}</div>
|
|
34
|
+
<div class="ds-heading--small">${headingExample}</div>
|
|
35
|
+
<div class="ds-heading--xSmall">${headingExample}</div>
|
|
36
|
+
|
|
37
|
+
<h2>Text Styles</h2>
|
|
38
|
+
<h3>Regular</h3>
|
|
39
|
+
<p class="ds-text--2xl-regular">${textExample} (2XL Regular)</p>
|
|
40
|
+
<p class="ds-text--xl-regular">${textExample} (XL Regular)</p>
|
|
41
|
+
<p class="ds-text--lg-regular">${textExample} (Large Regular)</p>
|
|
42
|
+
<p class="ds-text--md-regular">${textExample} (Medium Regular)</p>
|
|
43
|
+
<p class="ds-text--sm-regular">${textExample} (Small Regular)</p>
|
|
44
|
+
<p class="ds-text--xs-regular">${textExample} (XS Regular)</p>
|
|
45
|
+
<h3>SemiBold</h3>
|
|
46
|
+
<p class="ds-text--2xl-semibold">${textExample} (2XL Semibold)</p>
|
|
47
|
+
<p class="ds-text--xl-semibold">${textExample} (XL Semibold)</p>
|
|
48
|
+
<p class="ds-text--lg-semibold">${textExample} (Large Semibold)</p>
|
|
49
|
+
<p class="ds-text--md-semibold">${textExample} (Medium Semibold)</p>
|
|
50
|
+
<p class="ds-text--sm-semibold">${textExample} (Small Semibold)</p>
|
|
51
|
+
<p class="ds-text--xs-semibold">${textExample} (XS Semibold)</p>
|
|
52
|
+
<h3>Bold</h3>
|
|
53
|
+
<p class="ds-text--2xl-bold">${textExample} (2XL Bold)</p>
|
|
54
|
+
<p class="ds-text--xl-bold">${textExample} (XL Bold)</p>
|
|
55
|
+
<p class="ds-text--lg-bold">${textExample} (Large Bold)</p>
|
|
56
|
+
<p class="ds-text--md-bold">${textExample} (Medium Bold)</p>
|
|
57
|
+
<p class="ds-text--sm-bold">${textExample} (Small Bold)</p>
|
|
58
|
+
<p class="ds-text--xs-bold">${textExample} (XS Bold)</p>
|
|
59
|
+
|
|
60
|
+
<h2>Bodytext</h2>
|
|
61
|
+
<p class="ds-bodyText--2xLarge">${textExample} (2xLarge)</p>
|
|
62
|
+
<p class="ds-bodyText--xLarge">${textExample} (xLarge)</p>
|
|
63
|
+
<p class="ds-bodyText--large">${textExample} (large)</p>
|
|
64
|
+
<p class="ds-bodyText--medium">${textExample} (medium)</p>
|
|
65
|
+
<p class="ds-bodyText--small">${textExample} (small)</p>
|
|
66
|
+
|
|
67
|
+
<h2>Fontweight</h2>
|
|
68
|
+
<p class="ds-font--regular">${textExample} (Regular)</p>
|
|
69
|
+
<p class="ds-font--semibold">${textExample} (Semibold)</p>
|
|
70
|
+
<p class="ds-font--semibold-plus">${textExample} (SemiboldPlus)</p>
|
|
71
|
+
<p class="ds-font--bold">${textExample} (Bold)</p>
|
|
72
|
+
|
|
73
|
+
<h2>LetterSpacing</h2>
|
|
74
|
+
<p class="ds-tracking--xtight">${textExample} (xTight Spacing)</p>
|
|
75
|
+
<p class="ds-tracking--tight">${textExample} (Tight Spacing)</p>
|
|
76
|
+
<p class="ds-tracking--normal">${textExample} (Normal Spacing)</p>
|
|
77
|
+
<p class="ds-tracking--wide">${textExample} (Wide Spacing)</p>
|
|
78
|
+
<p class="ds-tracking--xwide">${textExample} (xWide Spacing)</p>
|
|
79
|
+
|
|
80
|
+
<h2>Lineheight</h2>
|
|
81
|
+
<p class="ds-leading--small">${textExample} (Small Line Height)</p>
|
|
82
|
+
<p class="ds-leading--medium">${textExample} (Medium Line Height)</p>
|
|
83
|
+
<p class="ds-leading--large">${textExample} (Large Line Height)</p>
|
|
84
|
+
<p class="ds-leading--xLarge">${textExample} (xLarge Line Height)</p>
|
|
85
|
+
</div>
|
|
86
|
+
`,
|
|
87
|
+
};
|
|
88
|
+
const renderTypography = () => {
|
|
89
|
+
const container = document.createElement('div');
|
|
90
|
+
const typographyVariables = getTypographyVariables();
|
|
91
|
+
const renderedCategories = new Set();
|
|
92
|
+
const categoryNames = [...new Set(Object.values(categories)), 'Other'];
|
|
93
|
+
categoryNames.forEach(category => {
|
|
94
|
+
const categoryTypo = typographyVariables.filter(spacing => spacing.category === category);
|
|
95
|
+
if (categoryTypo.length > 0) {
|
|
96
|
+
container.appendChild(createCategorySection(category, categoryTypo, renderedCategories));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return container;
|
|
100
|
+
};
|
|
101
|
+
export const Typography = {
|
|
102
|
+
parameters: {
|
|
103
|
+
docs: {
|
|
104
|
+
source: {
|
|
105
|
+
code: renderTypography().outerHTML,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
render: renderTypography,
|
|
110
|
+
};
|
|
111
|
+
const renderHeadingDetails = (size, heading) => {
|
|
112
|
+
const variables = getHeadingVariables(size, heading === 'desktop');
|
|
113
|
+
return html `
|
|
114
|
+
<style>
|
|
115
|
+
.ds-sb-heading__details__content {
|
|
116
|
+
display: grid;
|
|
117
|
+
gap: 0 1rem;
|
|
118
|
+
grid-template-columns: auto auto 1fr;
|
|
119
|
+
}
|
|
120
|
+
.ds-sb-heading__details__content span.ds-sb-heading__details__content__two-col {
|
|
121
|
+
grid-column: span 2;
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
124
|
+
<div>
|
|
125
|
+
<h4 class="ds-heading-xSmall">${heading}</h4>
|
|
126
|
+
<div class="ds-text--sm-regular ds-sb-heading__details__content">
|
|
127
|
+
<span class="ds-text--sm-regular">Family</span>
|
|
128
|
+
<span class="ds-text--sm-semibold ds-sb-heading__details__content__two-col">${variables['font-family']}</span>
|
|
129
|
+
|
|
130
|
+
<span class="ds-text--sm-regular">Size</span>
|
|
131
|
+
<span class="ds-text--sm-semibold">${formatAsPx(variables['font-size'])}</span>
|
|
132
|
+
<span class="ds-text--sm-semibold">${pxToRem(variables['font-size'])}</span>
|
|
133
|
+
|
|
134
|
+
<span class="ds-text--sm-regular">Line height</span>
|
|
135
|
+
<span class="ds-text--sm-semibold">${formatAsPx(variables['line-height'])}</span>
|
|
136
|
+
<span class="ds-text--sm-semibold">${pxToRem(variables['line-height'])}</span>
|
|
137
|
+
|
|
138
|
+
<span class="ds-text--sm-regular">Letter spacing</span>
|
|
139
|
+
<span class="ds-text--sm-semibold ds-sb-heading__details__content__two-col">${formatAsPx(variables['letter-spacing'])}</span>
|
|
140
|
+
|
|
141
|
+
<span class="ds-text--sm-regular">Font weight</span>
|
|
142
|
+
<span class="ds-text--sm-semibold ds-sb-heading__details__content__two-col">${variables['font-weight']}</span>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
};
|
|
147
|
+
const renderHeadingDetailsDesktop = (size) => renderHeadingDetails(size, 'desktop');
|
|
148
|
+
const renderHeadingDetailsMobile = (size) => renderHeadingDetails(size, 'mobile');
|
|
149
|
+
const renderHeading = (size) => {
|
|
150
|
+
return html `
|
|
151
|
+
<style>
|
|
152
|
+
.ds-sb-heading {
|
|
153
|
+
border-bottom: 1px solid #c0c0c0;
|
|
154
|
+
padding-bottom: 2em;
|
|
155
|
+
margin-bottom: 0.5em;
|
|
156
|
+
}
|
|
157
|
+
.ds-sb-heading div.ds-sb-heading__details {
|
|
158
|
+
display: grid;
|
|
159
|
+
grid-template-columns: 1fr;
|
|
160
|
+
gap: 2rem 0;
|
|
161
|
+
|
|
162
|
+
@media (min-width: 60rem) {
|
|
163
|
+
grid-template-columns: 1fr 1fr;
|
|
164
|
+
gap: 0 2rem;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
168
|
+
<div class="ds-sb-heading">
|
|
169
|
+
<h3 class="ds-heading--small">${size}</h3>
|
|
170
|
+
<div class="ds-sb-heading__details">
|
|
171
|
+
<div>${renderHeadingDetailsDesktop(size)} ${renderHeadingDetailsMobile(size)}</div>
|
|
172
|
+
<div>
|
|
173
|
+
<div class="ds-heading--${size}">${generateLoremIpsum()}</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
`;
|
|
178
|
+
};
|
|
179
|
+
export const Headings = {
|
|
180
|
+
parameters: {
|
|
181
|
+
docs: {
|
|
182
|
+
source: {
|
|
183
|
+
code: `
|
|
184
|
+
${headingSizes.map(size => `<div class="ds-heading--${size}">${generateLoremIpsum()}</div>`).join('\n')}
|
|
185
|
+
`
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
render: () => html `
|
|
190
|
+
<div>
|
|
191
|
+
<h2>Headings</h2>
|
|
192
|
+
${headingSizes.map(size => renderHeading(size))}
|
|
193
|
+
</div>
|
|
194
|
+
`,
|
|
195
|
+
};
|
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
position: relative;
|
|
21
21
|
width: 100%;
|
|
22
22
|
}
|
|
23
|
+
.ds-accordion__open-button:focus-visible {
|
|
24
|
+
box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
|
|
25
|
+
outline-color: var(--ds-borderColor-black);
|
|
26
|
+
outline-offset: var(--ds-borderWidth-thin);
|
|
27
|
+
outline-style: solid;
|
|
28
|
+
outline-width: var(--ds-borderWidth-thin);
|
|
29
|
+
}
|
|
23
30
|
.ds-accordion__open-button:hover:not(:focus-visible).ds-accordion--border-aligned::before, .ds-accordion__open-button:hover:not(:focus-visible).ds-accordion--border-aligned::after {
|
|
24
31
|
content: "";
|
|
25
32
|
position: absolute;
|
|
@@ -43,8 +50,6 @@
|
|
|
43
50
|
background: var(--ds-bgColor-transparent-onLight-active, rgba(0, 0, 0, 0.1490196078));
|
|
44
51
|
}
|
|
45
52
|
.ds-accordion__open-button:focus-visible {
|
|
46
|
-
box-shadow: 0 0 0 2px var(--ds-borderColor-black);
|
|
47
|
-
outline-color: var(--ds-borderColor-white);
|
|
48
53
|
z-index: 1;
|
|
49
54
|
}
|
|
50
55
|
.ds-accordion__open-button.ds-accordion--default {
|
|
@@ -70,6 +75,9 @@
|
|
|
70
75
|
:host(:first-child) .ds-accordion__open-button:not(.ds-accordion--hide-top-border) {
|
|
71
76
|
border-top: var(--ds-borderWidth-hairline) solid var(--ds-borderColor-light, #CCCCCC);
|
|
72
77
|
}
|
|
78
|
+
:host(:first-child) .ds-accordion__open-button:not(.ds-accordion--hide-top-border):focus-visible {
|
|
79
|
+
border-top-color: transparent;
|
|
80
|
+
}
|
|
73
81
|
.ds-accordion__open-button[aria-expanded=false] {
|
|
74
82
|
border-bottom: var(--ds-borderWidth-hairline) solid var(--ds-borderColor-light, #CCCCCC);
|
|
75
83
|
}
|
|
@@ -137,5 +145,5 @@
|
|
|
137
145
|
gap: var(--ds-spacing-2xSmall);
|
|
138
146
|
font-family: var(--ds-fontFamily-body);
|
|
139
147
|
letter-spacing: var(--ds-letterSpacing-wide);
|
|
140
|
-
width:
|
|
148
|
+
width: max-content;
|
|
141
149
|
}
|
|
@@ -43,18 +43,18 @@ export class DsAccordion {
|
|
|
43
43
|
render() {
|
|
44
44
|
const iconSize = this.variant === 'compact' ? '1.5rem' : '2rem';
|
|
45
45
|
const buttonSize = this.variant === 'compact' ? 'small' : 'medium';
|
|
46
|
-
return (h("div", { key: '
|
|
46
|
+
return (h("div", { key: '4ab62a504c68a926d59d2b4753aaf3a5b0ebd39d', class: classNames('ds-accordion', `ds-accordion--${this.variant}`, {
|
|
47
47
|
'ds-accordion--border-aligned': this.borderAligned
|
|
48
|
-
}), role: "presentation" }, h("div", { key: '
|
|
48
|
+
}), role: "presentation" }, h("div", { key: 'f98a24462b341c86d4a9ba71eff5d7b5ffbb2eb0', class: "ds-accordion__item" }, h("div", { key: '0da3c96376007d4b597e55ac54cb90de9a4788c7', role: "heading", "aria-level": this.headingLevel, class: "ds-accordion__title" }, h("button", { key: '98885f42ecad0aaf00ea736d147fd7838685f1d0', class: classNames('ds-accordion__open-button', `ds-accordion--${this.variant}`, {
|
|
49
49
|
'ds-accordion--border-aligned': this.borderAligned,
|
|
50
50
|
'ds-accordion--hide-top-border': this.hideTopBorder
|
|
51
|
-
}), onClick: this.handleClick, onKeyDown: this.handleKeyDown, "aria-expanded": this.isExpanded ? 'true' : 'false', "aria-controls": `${this.accordionId}-panel`, id: this.accordionId, ref: (el) => this.headerButtonRef = el }, h("span", { key: '
|
|
51
|
+
}), onClick: this.handleClick, onKeyDown: this.handleKeyDown, "aria-expanded": this.isExpanded ? 'true' : 'false', "aria-controls": `${this.accordionId}-panel`, id: this.accordionId, ref: (el) => this.headerButtonRef = el }, h("span", { key: '8f5ee7d3c251b0b34f9b57f74c2fb87ceb7266d3', class: "ds-accordion__icon", "aria-hidden": "true" }, this.isExpanded ?
|
|
52
52
|
h("ds-icon", { size: iconSize, hidden: true, name: "keyboard_arrow_up" })
|
|
53
|
-
: h("ds-icon", { size: iconSize, hidden: true, name: "keyboard_arrow_down" })), h("slot", { key: '
|
|
53
|
+
: h("ds-icon", { size: iconSize, hidden: true, name: "keyboard_arrow_down" })), h("slot", { key: 'a9b391fd0bba7055c68e3995bafbf07d4b069038', name: "header" }))), h("div", { key: '551a044a61152ab1799d519fcf9331eb29b428e2', id: `${this.accordionId}-panel`, role: "region", "aria-labelledby": this.accordionId, class: classNames('ds-accordion__panel', `ds-accordion__panel--${this.variant}`, {
|
|
54
54
|
'ds-accordion__panel--border-aligned': this.borderAligned,
|
|
55
55
|
'ds-accordion__panel--expanded': this.isExpanded
|
|
56
|
-
}), hidden: !this.isExpanded }, h("div", { key: '
|
|
57
|
-
h("ds-button", { key: '
|
|
56
|
+
}), hidden: !this.isExpanded }, h("div", { key: '455ab200c7febf67028a6ec2ef27eeeaa8bff6ae', class: "ds-accordion__content" }, h("slot", { key: '31af185bd1680cf70ba81ed7826f977d9620372a', name: "content" })), this.useCloseButton &&
|
|
57
|
+
h("ds-button", { key: 'fdeeae0f9e3c866a1f851a18fe2524afa92124d5', "aria-labelledby": `${this.accordionId}-close-button ${this.accordionId}`, id: `${this.accordionId}-close-button`, class: classNames('ds-accordion__close-button', `ds-accordion--${this.variant}`, {
|
|
58
58
|
'ds-accordion--border-aligned': this.borderAligned
|
|
59
59
|
}), fontWeight: 'semiBold', variant: 'supplementary', colour: 'black', icon: 'keyboard_arrow_up', iconPosition: 'start', onClick: this.handleClick, onKeyDown: this.handleKeyDown, value: this.closeButtonLabel, size: buttonSize, type: 'button' })))));
|
|
60
60
|
}
|