@uh-design-system/component-library 0.2.4 → 0.4.0
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/attributes-f7831329.js +78 -0
- package/dist/cjs/component-library.cjs.js +3 -3
- package/dist/cjs/{ds-accordion_2.cjs.entry.js → ds-accordion_3.cjs.entry.js} +419 -241
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +47 -0
- package/dist/cjs/ds-link.cjs.entry.js +54 -0
- package/dist/cjs/ds-text-input.cjs.entry.js +12 -16
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +20 -0
- package/dist/cjs/{index-fd4f6cd2.js → index-bfa0f441.js} +17 -11
- package/dist/cjs/linkUtils-695da37c.js +16 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/utils-8b73aa91.js +10 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/00-foundations/icons/categories/arrows.js +6 -0
- package/dist/collection/components/00-foundations/icons/categories/information.js +12 -0
- package/dist/collection/components/00-foundations/icons/categories/media.js +4 -0
- package/dist/collection/components/00-foundations/icons/categories/social.js +17 -0
- package/dist/collection/components/00-foundations/icons/iconList.js +2 -0
- package/dist/collection/components/00-foundations/typography/stories/typography.stories.js +110 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +101 -82
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +41 -9
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +15 -0
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +1 -1
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +10 -1
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +168 -104
- 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 +6 -0
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +13 -7
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.css +5 -1
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +8 -5
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js +2 -2
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +224 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +281 -0
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +53 -0
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +73 -0
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +72 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +208 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +161 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.js +33 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.js +19 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.js +40 -0
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +72 -48
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +44 -4
- package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.examples.stories.js → stories/ds-text-input.examples.stories.js} +13 -0
- package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.features.stories.js → stories/ds-text-input.features.stories.js} +18 -4
- package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.stories.js → stories/ds-text-input.stories.js} +2 -2
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/introduction/introduction.stories.js +9 -0
- package/dist/collection/utils/link/linkUtils.js +11 -0
- package/dist/collection/utils/typography/typographyUtils.js +21 -0
- package/dist/collection/utils/utils.js +5 -0
- package/dist/component-library/attributes-9419ac39.js +1 -0
- package/dist/component-library/component-library.css +1 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/ds-accordion_3.entry.js +1 -0
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -0
- package/dist/component-library/ds-link.entry.js +1 -0
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -0
- package/dist/component-library/{index-4200d514.js → index-42701395.js} +2 -2
- package/dist/component-library/linkUtils-3d1b28cf.js +1 -0
- package/dist/component-library/utils-cca2a41a.js +1 -0
- package/dist/components/attributes.js +154 -0
- package/dist/components/ds-accordion.js +31 -12
- package/dist/components/ds-button2.js +6 -78
- package/dist/components/ds-icon2.js +320 -231
- package/dist/components/ds-link-with-arrow.d.ts +11 -0
- package/dist/components/ds-link-with-arrow.js +78 -0
- package/dist/components/ds-link.d.ts +11 -0
- package/dist/components/ds-link.js +90 -0
- package/dist/components/ds-text-input.js +11 -13
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index2.js +7 -10
- package/dist/components/linkUtils.js +13 -0
- package/dist/components/utils.js +8 -0
- package/dist/esm/attributes-9419ac39.js +75 -0
- package/dist/esm/component-library.js +4 -4
- package/dist/esm/{ds-accordion_2.entry.js → ds-accordion_3.entry.js} +419 -242
- package/dist/esm/ds-link-with-arrow.entry.js +43 -0
- package/dist/esm/ds-link.entry.js +50 -0
- package/dist/esm/ds-text-input.entry.js +8 -12
- package/dist/esm/ds-visually-hidden.entry.js +16 -0
- package/dist/esm/{index-4200d514.js → index-42701395.js} +17 -11
- package/dist/esm/linkUtils-3d1b28cf.js +13 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/utils-cca2a41a.js +8 -0
- package/dist/types/components/00-foundations/icons/categories/social.d.ts +5 -0
- package/dist/types/components/00-foundations/typography/stories/typography.stories.d.ts +9 -0
- package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +2 -0
- package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +1 -0
- 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 +1 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +3 -0
- package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +25 -0
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.examples.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +18 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +2 -0
- package/dist/types/components/01-base-components/ds-text-input/{ds-text-input.examples.stories.d.ts → stories/ds-text-input.examples.stories.d.ts} +2 -1
- package/dist/types/components/01-base-components/ds-text-input/{ds-text-input.features.stories.d.ts → stories/ds-text-input.features.stories.d.ts} +4 -1
- package/dist/types/components/01-base-components/ds-text-input/{ds-text-input.stories.d.ts → stories/ds-text-input.stories.d.ts} +1 -1
- package/dist/types/components.d.ts +66 -2
- package/dist/types/introduction/introduction.stories.d.ts +10 -0
- package/dist/types/utils/link/linkUtils.d.ts +2 -0
- package/dist/types/utils/typography/typographyUtils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -4
- package/dist/cjs/ds-button_2.cjs.entry.js +0 -170
- package/dist/component-library/ds-accordion_2.entry.js +0 -1
- package/dist/component-library/ds-button_2.entry.js +0 -1
- package/dist/components/index3.js +0 -80
- package/dist/esm/ds-button_2.entry.js +0 -165
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import "../_typography.scss";
|
|
2
|
+
import "../_base.scss";
|
|
3
|
+
import "../_headings.scss";
|
|
4
|
+
import "../_bodyText.scss";
|
|
5
|
+
import { getTypographyVariables, createCategorySection, categories } from "../../../../utils/typography/typographyUtils";
|
|
6
|
+
import { html } from "lit";
|
|
7
|
+
import { generateLoremIpsum } 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
|
+
};
|
|
@@ -1,130 +1,149 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--ds-breakpoint-xSmall: 20rem;
|
|
3
|
+
--ds-breakpoint-small: 30rem;
|
|
4
|
+
--ds-breakpoint-medium: 60rem;
|
|
5
|
+
--ds-breakpoint-large: 75rem;
|
|
6
|
+
--ds-breakpoint-xLarge: 90rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.ds-accordion__open-button {
|
|
2
|
-
color: var(--ds-textColor-default
|
|
10
|
+
color: var(--ds-textColor-default);
|
|
11
|
+
outline: var(--ds-borderWidth-thick) solid transparent;
|
|
12
|
+
fill: var(--ds-textColor-default);
|
|
13
|
+
position: relative;
|
|
3
14
|
all: unset;
|
|
15
|
+
align-items: flex-start;
|
|
4
16
|
box-sizing: border-box;
|
|
5
17
|
display: flex;
|
|
6
18
|
flex-direction: row;
|
|
7
|
-
gap:
|
|
19
|
+
gap: var(--ds-spacing-2xSmall);
|
|
20
|
+
position: relative;
|
|
8
21
|
width: 100%;
|
|
9
22
|
}
|
|
10
|
-
.ds-accordion__open-button:
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
.ds-accordion__open-button:focus-visible, .ds-accordion__open-button:focus-within {
|
|
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);
|
|
13
29
|
}
|
|
14
|
-
.ds-accordion__open-button:hover.ds-accordion--border-aligned {
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
31
|
+
content: "";
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
width: var(--ds-spacing-small);
|
|
35
|
+
height: 100%;
|
|
17
36
|
}
|
|
18
|
-
.ds-accordion__open-button:
|
|
19
|
-
|
|
37
|
+
.ds-accordion__open-button:hover:not(:focus-visible).ds-accordion--border-aligned::before {
|
|
38
|
+
left: calc(var(--ds-spacing-small) * -1);
|
|
20
39
|
}
|
|
21
|
-
.ds-accordion__open-button:
|
|
22
|
-
|
|
23
|
-
margin-inline: 0;
|
|
40
|
+
.ds-accordion__open-button:hover:not(:focus-visible).ds-accordion--border-aligned::after {
|
|
41
|
+
right: calc(var(--ds-spacing-small) * -1);
|
|
24
42
|
}
|
|
25
|
-
.ds-accordion__open-button:
|
|
43
|
+
.ds-accordion__open-button:hover {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
.ds-accordion__open-button:hover, .ds-accordion__open-button:hover::before, .ds-accordion__open-button:hover::after {
|
|
26
47
|
background: var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843));
|
|
27
|
-
box-shadow: 0px 0px 0px 1px var(--ds-palette-black);
|
|
28
48
|
}
|
|
29
|
-
.ds-accordion__open-button:
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
.ds-accordion__open-button:active, .ds-accordion__open-button:active::before, .ds-accordion__open-button:active::after {
|
|
50
|
+
background: var(--ds-bgColor-transparent-onLight-active, rgba(0, 0, 0, 0.1490196078));
|
|
51
|
+
}
|
|
52
|
+
.ds-accordion__open-button:focus-visible {
|
|
53
|
+
z-index: 1;
|
|
32
54
|
}
|
|
33
55
|
.ds-accordion__open-button.ds-accordion--default {
|
|
34
|
-
padding:
|
|
56
|
+
padding: var(--ds-spacing-small) var(--ds-spacing-small) var(--ds-spacing-xSmall) var(--ds-spacing-small);
|
|
35
57
|
font-family: var(--ds-fontFamily-body);
|
|
36
58
|
font-size: var(--ds-fontSize-18);
|
|
37
|
-
font-weight:
|
|
38
|
-
line-height:
|
|
59
|
+
font-weight: var(--ds-fontWeight-semibold);
|
|
60
|
+
line-height: var(--ds-lineHeight-large);
|
|
39
61
|
letter-spacing: var(--letterSpacing-wide);
|
|
40
62
|
}
|
|
41
63
|
.ds-accordion__open-button.ds-accordion--compact {
|
|
42
64
|
font-size: var(--ds-fontSize-16);
|
|
43
|
-
padding:
|
|
44
|
-
line-height:
|
|
45
|
-
font-weight:
|
|
65
|
+
padding: var(--ds-spacing-xSmall) var(--ds-spacing-small) var(--ds-spacing-xSmall) var(--ds-spacing-small);
|
|
66
|
+
line-height: var(--ds-lineHeight-large);
|
|
67
|
+
font-weight: var(--ds-fontWeight-semibold);
|
|
46
68
|
}
|
|
47
|
-
.ds-accordion__open-button.ds-accordion--border-aligned {
|
|
48
|
-
padding-inline: 0;
|
|
69
|
+
.ds-accordion__open-button.ds-accordion--border-aligned:not(:focus-visible) {
|
|
49
70
|
padding-inline: 0;
|
|
50
|
-
margin-inline:
|
|
71
|
+
margin-inline: var(--ds-spacing-small);
|
|
72
|
+
position: relative;
|
|
73
|
+
width: calc(100% - var(--ds-spacing-large));
|
|
74
|
+
}
|
|
75
|
+
:host(:first-child) .ds-accordion__open-button:not(.ds-accordion--hide-top-border) {
|
|
76
|
+
border-top: var(--ds-borderWidth-hairline) solid var(--ds-borderColor-light, #CCCCCC);
|
|
77
|
+
}
|
|
78
|
+
:host(:first-child) .ds-accordion__open-button:not(.ds-accordion--hide-top-border):focus-visible {
|
|
79
|
+
border-top-color: transparent;
|
|
51
80
|
}
|
|
52
81
|
.ds-accordion__open-button[aria-expanded=false] {
|
|
53
|
-
border-bottom:
|
|
82
|
+
border-bottom: var(--ds-borderWidth-hairline) solid var(--ds-borderColor-light, #CCCCCC);
|
|
54
83
|
}
|
|
55
84
|
|
|
85
|
+
.ds-accordion__panel--border-aligned {
|
|
86
|
+
position: relative;
|
|
87
|
+
width: calc(100% - 32px);
|
|
88
|
+
}
|
|
89
|
+
.ds-accordion__panel--border-aligned::before {
|
|
90
|
+
display: inline-block;
|
|
91
|
+
content: " ";
|
|
92
|
+
position: absolute;
|
|
93
|
+
bottom: -1px;
|
|
94
|
+
height: 1px;
|
|
95
|
+
left: 0px;
|
|
96
|
+
background: var(--ds-palette-white);
|
|
97
|
+
width: var(--ds-spacing-small);
|
|
98
|
+
}
|
|
99
|
+
.ds-accordion__panel--border-aligned::after {
|
|
100
|
+
display: inline-block;
|
|
101
|
+
content: " ";
|
|
102
|
+
position: absolute;
|
|
103
|
+
bottom: -1px;
|
|
104
|
+
height: 1px;
|
|
105
|
+
right: 0px;
|
|
106
|
+
background: var(--ds-palette-white);
|
|
107
|
+
width: var(--ds-spacing-small);
|
|
108
|
+
}
|
|
56
109
|
.ds-accordion__panel--expanded {
|
|
57
|
-
|
|
110
|
+
display: block;
|
|
111
|
+
border-bottom: var(--ds-borderWidth-hairline) solid var(--ds-borderColor-light, #CCCCCC);
|
|
112
|
+
padding-inline: var(--ds-spacing-small);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
::slotted([slot=header]) {
|
|
116
|
+
color: var(--ds-textColor-default);
|
|
58
117
|
}
|
|
59
118
|
|
|
60
119
|
.ds-accordion__content {
|
|
61
120
|
color: var(--ds-textColor-default, #1A1A1A);
|
|
62
121
|
font-family: var(--ds-fontFamily-body);
|
|
63
|
-
padding:
|
|
122
|
+
padding-block: var(--ds-spacing-small);
|
|
64
123
|
}
|
|
65
124
|
.ds-accordion__content .ds-accordion--default {
|
|
66
|
-
font-size: var(--ds-fontSize-
|
|
67
|
-
font-weight:
|
|
68
|
-
line-height:
|
|
125
|
+
font-size: var(--ds-fontSize-16);
|
|
126
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
127
|
+
line-height: var(--ds-lineHeight-xLarge);
|
|
69
128
|
letter-spacing: var(--ds-letterSpacing-wide);
|
|
70
129
|
}
|
|
130
|
+
@media (min-width: 30rem) {
|
|
131
|
+
.ds-accordion__content .ds-accordion--default {
|
|
132
|
+
font-size: var(--ds-fontSize-18);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
71
135
|
.ds-accordion__content .ds-accordion--compact {
|
|
72
136
|
font-size: var(--fontSize-16);
|
|
73
|
-
font-weight:
|
|
74
|
-
line-height:
|
|
137
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
138
|
+
line-height: var(--ds-lineHeight-large);
|
|
75
139
|
letter-spacing: var(--letterSpacing-wide);
|
|
76
140
|
}
|
|
77
141
|
|
|
78
142
|
.ds-accordion__close-button {
|
|
79
|
-
color: var(--ds-textColor-default, #1A1A1A);
|
|
80
|
-
all: unset;
|
|
81
|
-
border-bottom: 1px solid var(--ds-borderColor-light, #CCCCCC);
|
|
82
143
|
display: flex;
|
|
83
144
|
flex-direction: row;
|
|
84
|
-
gap:
|
|
145
|
+
gap: var(--ds-spacing-2xSmall);
|
|
85
146
|
font-family: var(--ds-fontFamily-body);
|
|
86
147
|
letter-spacing: var(--ds-letterSpacing-wide);
|
|
87
|
-
width:
|
|
88
|
-
}
|
|
89
|
-
.ds-accordion__close-button:hover {
|
|
90
|
-
cursor: pointer;
|
|
91
|
-
background: var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843));
|
|
92
|
-
}
|
|
93
|
-
.ds-accordion__close-button:hover.ds-accordion--border-aligned {
|
|
94
|
-
padding-inline: 16px;
|
|
95
|
-
margin-inline: 0;
|
|
96
|
-
}
|
|
97
|
-
.ds-accordion__close-button:active {
|
|
98
|
-
background: var(--ds-bgColor-transparent-onLight-active, rgba(0, 0, 0, 0.1490196078));
|
|
99
|
-
}
|
|
100
|
-
.ds-accordion__close-button:active.ds-accordion--border-aligned {
|
|
101
|
-
padding-inline: 16px;
|
|
102
|
-
margin-inline: 0;
|
|
103
|
-
}
|
|
104
|
-
.ds-accordion__close-button:focus {
|
|
105
|
-
background: var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843));
|
|
106
|
-
box-shadow: 0px 0px 0px 1px var(--ds-palette-black);
|
|
107
|
-
}
|
|
108
|
-
.ds-accordion__close-button:focus.ds-accordion--border-aligned {
|
|
109
|
-
padding-inline: 16px;
|
|
110
|
-
margin-inline: 0;
|
|
111
|
-
}
|
|
112
|
-
.ds-accordion__close-button.ds-accordion--default {
|
|
113
|
-
padding: 16px;
|
|
114
|
-
font-family: var(--ds-fontFamily-body);
|
|
115
|
-
font-size: var(--ds-fontSize-18);
|
|
116
|
-
font-weight: 600;
|
|
117
|
-
line-height: 27px;
|
|
118
|
-
letter-spacing: var(--letterSpacing-wide);
|
|
119
|
-
}
|
|
120
|
-
.ds-accordion__close-button.ds-accordion--compact {
|
|
121
|
-
font-size: var(--ds-fontSize-16);
|
|
122
|
-
padding: 12px 16px 12px 16px;
|
|
123
|
-
line-height: 24px;
|
|
124
|
-
font-weight: 600;
|
|
125
|
-
}
|
|
126
|
-
.ds-accordion__close-button.ds-accordion--border-aligned {
|
|
127
|
-
padding-inline: 0;
|
|
128
|
-
padding-inline: 0;
|
|
129
|
-
margin-inline: 16px;
|
|
148
|
+
width: max-content;
|
|
130
149
|
}
|
|
@@ -8,10 +8,16 @@ export class DsAccordion {
|
|
|
8
8
|
headingLevel = 2;
|
|
9
9
|
useCloseButton = false;
|
|
10
10
|
closeButtonLabel = 'Close';
|
|
11
|
-
|
|
11
|
+
hideTopBorder = false;
|
|
12
|
+
isExpanded = false;
|
|
12
13
|
host;
|
|
13
14
|
headerButtonRef;
|
|
14
15
|
shouldMoveFocus = false;
|
|
16
|
+
componentWillLoad() {
|
|
17
|
+
if (this.openByDefault) {
|
|
18
|
+
this.isExpanded = true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
15
21
|
watchHandler(isExpanded) {
|
|
16
22
|
if (!isExpanded && this.shouldMoveFocus && this.headerButtonRef) {
|
|
17
23
|
this.headerButtonRef.focus();
|
|
@@ -35,16 +41,22 @@ export class DsAccordion {
|
|
|
35
41
|
}
|
|
36
42
|
};
|
|
37
43
|
render() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
const iconSize = this.variant === 'compact' ? '1.5rem' : '2rem';
|
|
45
|
+
const buttonSize = this.variant === 'compact' ? 'small' : 'medium';
|
|
46
|
+
return (h("div", { key: '830fb0965ea8904b662280b775a159528d7ddc03', class: classNames('ds-accordion', `ds-accordion--${this.variant}`, {
|
|
41
47
|
'ds-accordion--border-aligned': this.borderAligned
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
h("
|
|
48
|
+
}), role: "presentation" }, h("div", { key: 'a3d6e538dda9513bfb578379cced370be686ce62', class: "ds-accordion__item" }, h("div", { key: '7c7819bf62cdffb9ac4a8c4f7b1609b31efcdd68', role: "heading", "aria-level": this.headingLevel, class: "ds-accordion__title" }, h("button", { key: '2e2a9fdfced241b23bdcfb444777cdd2fd0a764c', class: classNames('ds-accordion__open-button', `ds-accordion--${this.variant}`, {
|
|
49
|
+
'ds-accordion--border-aligned': this.borderAligned,
|
|
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: 'eca6297dd43b58849c8b46f66034ec51bb20bf1e', class: "ds-accordion__icon", "aria-hidden": "true" }, this.isExpanded ?
|
|
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: '9ddb913b968b8bbbe47d4be341766503fdcf4df7', name: "header" }))), h("div", { key: '21cee953529ccd21487b7ac0001aac10bf3d563e', id: `${this.accordionId}-panel`, role: "region", "aria-labelledby": this.accordionId, class: classNames('ds-accordion__panel', `ds-accordion__panel--${this.variant}`, {
|
|
54
|
+
'ds-accordion__panel--border-aligned': this.borderAligned,
|
|
55
|
+
'ds-accordion__panel--expanded': this.isExpanded
|
|
56
|
+
}), hidden: !this.isExpanded }, h("div", { key: 'a9d5dfdbf190936156b0b37b6ef2b877741f6ae1', class: "ds-accordion__content" }, h("slot", { key: '34ca29ec15581a470fe2c740fceea9fcdc7cb64a', name: "content" })), this.useCloseButton &&
|
|
57
|
+
h("ds-button", { key: '1dfa2fad990fc6651a620efd8b3169346bb08648', "aria-labelledby": `${this.accordionId}-close-button ${this.accordionId}`, id: `${this.accordionId}-close-button`, class: classNames('ds-accordion__close-button', `ds-accordion--${this.variant}`, {
|
|
46
58
|
'ds-accordion--border-aligned': this.borderAligned
|
|
47
|
-
}),
|
|
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' })))));
|
|
48
60
|
}
|
|
49
61
|
static get is() { return "ds-accordion"; }
|
|
50
62
|
static get encapsulation() { return "shadow"; }
|
|
@@ -199,6 +211,26 @@ export class DsAccordion {
|
|
|
199
211
|
"attribute": "close-button-label",
|
|
200
212
|
"reflect": false,
|
|
201
213
|
"defaultValue": "'Close'"
|
|
214
|
+
},
|
|
215
|
+
"hideTopBorder": {
|
|
216
|
+
"type": "boolean",
|
|
217
|
+
"mutable": false,
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "boolean",
|
|
220
|
+
"resolved": "boolean",
|
|
221
|
+
"references": {}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": ""
|
|
228
|
+
},
|
|
229
|
+
"getter": false,
|
|
230
|
+
"setter": false,
|
|
231
|
+
"attribute": "hide-top-border",
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"defaultValue": "false"
|
|
202
234
|
}
|
|
203
235
|
};
|
|
204
236
|
}
|
|
@@ -41,3 +41,18 @@ export const MultipleAccordions = {
|
|
|
41
41
|
</ds-accordion>
|
|
42
42
|
`,
|
|
43
43
|
};
|
|
44
|
+
export const LongTitles = {
|
|
45
|
+
render: () => html `
|
|
46
|
+
<ds-accordion accordion-id="ac-1">
|
|
47
|
+
<div slot="header">${generateLoremIpsum({ paragraphs: 2, wordsPerParagraph: 20, consistent: true })}</div>
|
|
48
|
+
<div slot="content">${exampleContent}</div>
|
|
49
|
+
</ds-accordion>
|
|
50
|
+
<ds-accordion accordion-id="ac-2">
|
|
51
|
+
<div slot="header">${generateLoremIpsum({ paragraphs: 3, wordsPerParagraph: 30, consistent: true })}</div>
|
|
52
|
+
<div slot="content">
|
|
53
|
+
<p>${generateLoremIpsum({ paragraphs: 5, wordsPerParagraph: 20 })}</p>
|
|
54
|
+
<p>${generateLoremIpsum({ paragraphs: 8, wordsPerParagraph: 30 })}</p>
|
|
55
|
+
</div>
|
|
56
|
+
</ds-accordion>
|
|
57
|
+
`,
|
|
58
|
+
};
|
|
@@ -42,7 +42,7 @@ WithCloseButton.args = {
|
|
|
42
42
|
useCloseButton: true,
|
|
43
43
|
};
|
|
44
44
|
WithCloseButton.render = (args) => html `
|
|
45
|
-
<ds-accordion use-close-button="${args.useCloseButton}">
|
|
45
|
+
<ds-accordion use-close-button="${args.useCloseButton}" open-by-default="true">
|
|
46
46
|
<div slot="header">${exampleHeader}</div>
|
|
47
47
|
<div slot="content">${exampleContent}</div>
|
|
48
48
|
</ds-accordion>
|
package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js
CHANGED
|
@@ -41,6 +41,12 @@ const meta = {
|
|
|
41
41
|
},
|
|
42
42
|
name: 'Custom id for accordion element'
|
|
43
43
|
},
|
|
44
|
+
hideTopBorder: {
|
|
45
|
+
control: {
|
|
46
|
+
type: 'boolean'
|
|
47
|
+
},
|
|
48
|
+
name: 'Hide top border'
|
|
49
|
+
},
|
|
44
50
|
},
|
|
45
51
|
};
|
|
46
52
|
const exampleHeader = generateLoremIpsum();
|
|
@@ -53,7 +59,8 @@ Default.args = {
|
|
|
53
59
|
borderAligned: false,
|
|
54
60
|
openByDefault: false,
|
|
55
61
|
headingLevel: 2,
|
|
56
|
-
accordionId: 'dsaccordion'
|
|
62
|
+
accordionId: 'dsaccordion',
|
|
63
|
+
hideTopBorder: false,
|
|
57
64
|
};
|
|
58
65
|
Default.render = (args) => html `
|
|
59
66
|
<ds-accordion
|
|
@@ -63,6 +70,7 @@ Default.render = (args) => html `
|
|
|
63
70
|
open-by-default="${args.openByDefault}"
|
|
64
71
|
heading-level="${args.headingLevel}"
|
|
65
72
|
accordion-id="${args.accordionId}"
|
|
73
|
+
hide-top-border="${args.hideTopBorder}"
|
|
66
74
|
>
|
|
67
75
|
<div slot="header">${exampleHeader}</div>
|
|
68
76
|
<div slot="content">${exampleContent}</div>
|
|
@@ -92,6 +100,7 @@ Playground.render = (args) => {
|
|
|
92
100
|
open-by-default="${args.openByDefault}"
|
|
93
101
|
heading-level="${args.headingLevel}"
|
|
94
102
|
accordion-id="${args.accordionId}-${index + 1}"
|
|
103
|
+
hide-top-border="${args.hideTopBorder}"
|
|
95
104
|
>
|
|
96
105
|
<div slot="header">${args.Header}</div>
|
|
97
106
|
<div slot="content">${args.Content}</div>
|