@momentum-design/components 0.129.9 → 0.129.11
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/browser/index.js +175 -175
- package/dist/browser/index.js.map +3 -3
- package/dist/components/accordion/accordion.component.d.ts +28 -27
- package/dist/components/accordion/accordion.component.js +24 -25
- package/dist/components/accordionbutton/accordionbutton.component.d.ts +31 -27
- package/dist/components/accordionbutton/accordionbutton.component.js +28 -25
- package/dist/components/accordiongroup/accordiongroup.component.d.ts +21 -22
- package/dist/components/accordiongroup/accordiongroup.component.js +21 -22
- package/dist/components/accordiongroup/accordiongroup.styles.js +5 -5
- package/dist/components/tooltip/tooltip.component.d.ts +9 -1
- package/dist/components/tooltip/tooltip.component.js +28 -17
- package/dist/components/tooltip/tooltip.constants.d.ts +5 -0
- package/dist/components/tooltip/tooltip.constants.js +6 -1
- package/dist/custom-elements.json +57 -57
- package/dist/react/accordion/index.d.ts +24 -25
- package/dist/react/accordion/index.js +24 -25
- package/dist/react/accordionbutton/index.d.ts +20 -21
- package/dist/react/accordionbutton/index.js +20 -21
- package/dist/react/accordiongroup/index.d.ts +11 -19
- package/dist/react/accordiongroup/index.js +11 -19
- package/dist/react/tooltip/index.d.ts +9 -1
- package/dist/react/tooltip/index.js +9 -1
- package/package.json +1 -1
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import type { CSSResult, PropertyValues } from 'lit';
|
|
2
2
|
import AccordionButton from '../accordionbutton/accordionbutton.component';
|
|
3
3
|
/**
|
|
4
|
-
* An accordion
|
|
4
|
+
* An accordion is a vertically stacked component with a header and expandable/collapsible body section.
|
|
5
|
+
* The header displays a prefix icon, header text, optional control slots (leading and trailing), and a dedicated expand/collapse button.
|
|
6
|
+
* Unlike `accordionbutton`, only the expand/collapse button is clickable and not the entire header.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* - Header
|
|
9
|
-
* - Leading
|
|
10
|
-
* - Trailing
|
|
8
|
+
* ## Header contains
|
|
9
|
+
* - Optional prefix icon
|
|
10
|
+
* - Header text (default H3, customizable via `data-aria-level`)
|
|
11
|
+
* - Leading slot for controls (placed after header text)
|
|
12
|
+
* - Trailing slot for controls (placed before expand/collapse button)
|
|
13
|
+
* - Expand/collapse button (automatically positioned at the end)
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
* - Default slot
|
|
15
|
+
* ## Body contains
|
|
16
|
+
* - Default slot for any content
|
|
14
17
|
*
|
|
15
|
-
* The accordion
|
|
16
|
-
*
|
|
17
|
-
* There are two sizes of accordion, one is small and the other is large.
|
|
18
|
-
* Small size has a padding of 1rem (16px) and large size has a padding of 1.5rem (24px) for the body section of accordion.
|
|
18
|
+
* The accordion supports different border styles through the `variant` attribute and different spacing through the `size` attribute.
|
|
19
|
+
* An accordion can be disabled, which prevents all interactions including the expand/collapse button and any slotted controls.
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* ## When to use
|
|
22
|
+
* - Use `mdc-accordion` when you need additional interactive controls (chips, badges, buttons, icons) in the header.
|
|
23
|
+
* - Use `mdc-accordionbutton` if you only need a simple clickable header without extra controls.
|
|
22
24
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* If an accordion is expanded by default, then the screen reader might loose focus when toggling the visibilty of the accordion.
|
|
25
|
+
* ## Accessibility
|
|
26
|
+
* - Always provide `open-button-aria-label` and `close-button-aria-label` for screen reader support
|
|
27
|
+
* - Adjust `data-aria-level` based on heading hierarchy in your page
|
|
28
|
+
* - Note: Screen readers may lose focus when toggling if accordion is expanded by default
|
|
28
29
|
*
|
|
29
30
|
* @tagname mdc-accordion
|
|
30
31
|
*
|
|
@@ -32,16 +33,14 @@ import AccordionButton from '../accordionbutton/accordionbutton.component';
|
|
|
32
33
|
* @dependency mdc-icon
|
|
33
34
|
* @dependency mdc-text
|
|
34
35
|
*
|
|
35
|
-
* @slot leading-controls - The leading controls slot of the accordion on the header section.
|
|
36
|
-
* @slot trailing-controls - The trailing controls slot of the accordion on the header section.
|
|
36
|
+
* @slot leading-controls - The leading controls slot of the accordion on the header section. Placed after the header text.
|
|
37
|
+
* @slot trailing-controls - The trailing controls slot of the accordion on the header section. Placed before the expand/collapse button.
|
|
37
38
|
* @slot default - The default slot contains the body section of the accordion. User can place anything inside this body slot.
|
|
38
39
|
*
|
|
39
|
-
* @event shown - (React: onShown) This event is triggered when the accordion is expanded.
|
|
40
|
+
* @event shown - (React: onShown) This event is triggered when the accordion is toggled (expanded or collapsed).
|
|
40
41
|
*
|
|
41
42
|
* @cssproperty --mdc-accordionbutton-border-color - The border color of the accordion.
|
|
42
|
-
* @cssproperty --mdc-accordionbutton-
|
|
43
|
-
* @cssproperty --mdc-accordionbutton-active-color - The active color of the accordion.
|
|
44
|
-
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled color of the accordion.
|
|
43
|
+
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled text color of the accordion.
|
|
45
44
|
*
|
|
46
45
|
* @csspart body-section - The body section of the accordion.
|
|
47
46
|
* @csspart header-section - The header section of the accordion.
|
|
@@ -55,11 +54,13 @@ declare class Accordion extends AccordionButton {
|
|
|
55
54
|
/** @internal */
|
|
56
55
|
trailingControlsSlot: Array<HTMLElement>;
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
57
|
+
* Accessible label for the expand/collapse button when the accordion is in collapsed state.
|
|
58
|
+
* Provides context to screen readers about the button's action to open the accordion.
|
|
59
59
|
*/
|
|
60
60
|
openButtonAriaLabel?: string;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Accessible label for the expand/collapse button when the accordion is in expanded state.
|
|
63
|
+
* Provides context to screen readers about the button's action to close the accordion.
|
|
63
64
|
*/
|
|
64
65
|
closeButtonAriaLabel?: string;
|
|
65
66
|
/**
|
|
@@ -15,30 +15,31 @@ import AccordionButton from '../accordionbutton/accordionbutton.component';
|
|
|
15
15
|
import { BUTTON_VARIANTS, ICON_BUTTON_SIZES } from '../button/button.constants';
|
|
16
16
|
import styles from './accordion.styles';
|
|
17
17
|
/**
|
|
18
|
-
* An accordion
|
|
18
|
+
* An accordion is a vertically stacked component with a header and expandable/collapsible body section.
|
|
19
|
+
* The header displays a prefix icon, header text, optional control slots (leading and trailing), and a dedicated expand/collapse button.
|
|
20
|
+
* Unlike `accordionbutton`, only the expand/collapse button is clickable and not the entire header.
|
|
19
21
|
*
|
|
20
|
-
*
|
|
21
|
-
* -
|
|
22
|
-
* - Header
|
|
23
|
-
* - Leading
|
|
24
|
-
* - Trailing
|
|
22
|
+
* ## Header contains
|
|
23
|
+
* - Optional prefix icon
|
|
24
|
+
* - Header text (default H3, customizable via `data-aria-level`)
|
|
25
|
+
* - Leading slot for controls (placed after header text)
|
|
26
|
+
* - Trailing slot for controls (placed before expand/collapse button)
|
|
27
|
+
* - Expand/collapse button (automatically positioned at the end)
|
|
25
28
|
*
|
|
26
|
-
*
|
|
27
|
-
* - Default slot
|
|
29
|
+
* ## Body contains
|
|
30
|
+
* - Default slot for any content
|
|
28
31
|
*
|
|
29
|
-
* The accordion
|
|
30
|
-
*
|
|
31
|
-
* There are two sizes of accordion, one is small and the other is large.
|
|
32
|
-
* Small size has a padding of 1rem (16px) and large size has a padding of 1.5rem (24px) for the body section of accordion.
|
|
32
|
+
* The accordion supports different border styles through the `variant` attribute and different spacing through the `size` attribute.
|
|
33
|
+
* An accordion can be disabled, which prevents all interactions including the expand/collapse button and any slotted controls.
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
35
|
+
* ## When to use
|
|
36
|
+
* - Use `mdc-accordion` when you need additional interactive controls (chips, badges, buttons, icons) in the header.
|
|
37
|
+
* - Use `mdc-accordionbutton` if you only need a simple clickable header without extra controls.
|
|
36
38
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* If an accordion is expanded by default, then the screen reader might loose focus when toggling the visibilty of the accordion.
|
|
39
|
+
* ## Accessibility
|
|
40
|
+
* - Always provide `open-button-aria-label` and `close-button-aria-label` for screen reader support
|
|
41
|
+
* - Adjust `data-aria-level` based on heading hierarchy in your page
|
|
42
|
+
* - Note: Screen readers may lose focus when toggling if accordion is expanded by default
|
|
42
43
|
*
|
|
43
44
|
* @tagname mdc-accordion
|
|
44
45
|
*
|
|
@@ -46,16 +47,14 @@ import styles from './accordion.styles';
|
|
|
46
47
|
* @dependency mdc-icon
|
|
47
48
|
* @dependency mdc-text
|
|
48
49
|
*
|
|
49
|
-
* @slot leading-controls - The leading controls slot of the accordion on the header section.
|
|
50
|
-
* @slot trailing-controls - The trailing controls slot of the accordion on the header section.
|
|
50
|
+
* @slot leading-controls - The leading controls slot of the accordion on the header section. Placed after the header text.
|
|
51
|
+
* @slot trailing-controls - The trailing controls slot of the accordion on the header section. Placed before the expand/collapse button.
|
|
51
52
|
* @slot default - The default slot contains the body section of the accordion. User can place anything inside this body slot.
|
|
52
53
|
*
|
|
53
|
-
* @event shown - (React: onShown) This event is triggered when the accordion is expanded.
|
|
54
|
+
* @event shown - (React: onShown) This event is triggered when the accordion is toggled (expanded or collapsed).
|
|
54
55
|
*
|
|
55
56
|
* @cssproperty --mdc-accordionbutton-border-color - The border color of the accordion.
|
|
56
|
-
* @cssproperty --mdc-accordionbutton-
|
|
57
|
-
* @cssproperty --mdc-accordionbutton-active-color - The active color of the accordion.
|
|
58
|
-
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled color of the accordion.
|
|
57
|
+
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled text color of the accordion.
|
|
59
58
|
*
|
|
60
59
|
* @csspart body-section - The body section of the accordion.
|
|
61
60
|
* @csspart header-section - The header section of the accordion.
|
|
@@ -6,28 +6,27 @@ import type { IconNames } from '../icon/icon.types';
|
|
|
6
6
|
import type { IconName, Variant } from './accordionbutton.types';
|
|
7
7
|
declare const AccordionButton_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
|
8
8
|
/**
|
|
9
|
-
* An accordion button
|
|
9
|
+
* An accordion button is a vertically stacked component with a clickable header and expandable/collapsible body section.
|
|
10
|
+
* The entire header is clickable to toggle the visibility of the body content.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
* - Header
|
|
12
|
+
* ## Header contains
|
|
13
|
+
* - Optional prefix icon
|
|
14
|
+
* - Header text (default H3, customizable via `data-aria-level`)
|
|
15
|
+
* - Expand/collapse arrow icon (visual indicator)
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
* - Default slot
|
|
17
|
+
* ## Body contains
|
|
18
|
+
* - Default slot for any content
|
|
17
19
|
*
|
|
18
|
-
* The accordion button
|
|
19
|
-
*
|
|
20
|
-
* There are two sizes of accordion, one is small and the other is large.
|
|
21
|
-
* Small size has a padding of 1rem (16px) and large size has a padding of 1.5rem (24px) for the body section of accordion.
|
|
20
|
+
* The accordion button supports different border styles through the `variant` attribute and different spacing through the `size` attribute.
|
|
21
|
+
* An accordion button can be disabled, which prevents the header from being clickable.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* ## When to use
|
|
24
|
+
* - Use `mdc-accordionbutton` for simple clickable headers without additional controls.
|
|
25
|
+
* - Use `mdc-accordion` instead if you need extra controls (chips, badges, icons) in the header.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* If an accordion button is expanded by default, then the screen reader might loose focus when toggling the visibilty of the accordion button.
|
|
27
|
+
* ## Accessibility
|
|
28
|
+
* - Adjust `data-aria-level` based on heading hierarchy in your page.
|
|
29
|
+
* - Note: Screen readers may lose focus when toggling if accordion button is expanded by default.
|
|
31
30
|
*
|
|
32
31
|
* @tagname mdc-accordionbutton
|
|
33
32
|
*
|
|
@@ -37,12 +36,12 @@ declare const AccordionButton_base: import("../../utils/mixins/index.types").Con
|
|
|
37
36
|
*
|
|
38
37
|
* @slot default - The default slot contains the body section of the accordion. User can place anything inside this body slot.
|
|
39
38
|
*
|
|
40
|
-
* @event shown - (React: onShown) This event is triggered when the accordion button is expanded.
|
|
39
|
+
* @event shown - (React: onShown) This event is triggered when the accordion button is toggled (expanded or collapsed).
|
|
41
40
|
*
|
|
42
41
|
* @cssproperty --mdc-accordionbutton-border-color - The border color of the accordion button.
|
|
43
|
-
* @cssproperty --mdc-accordionbutton-hover-color - The hover color of the accordion button.
|
|
44
|
-
* @cssproperty --mdc-accordionbutton-active-color - The active color of the accordion button.
|
|
45
|
-
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled color of the accordion button.
|
|
42
|
+
* @cssproperty --mdc-accordionbutton-hover-color - The hover background color of the accordion button header.
|
|
43
|
+
* @cssproperty --mdc-accordionbutton-active-color - The active background color of the accordion button header.
|
|
44
|
+
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled text color of the accordion button.
|
|
46
45
|
*
|
|
47
46
|
* @csspart body-section - The body section of the accordion button.
|
|
48
47
|
* @csspart header-button-section - The header button section of the accordion button.
|
|
@@ -53,31 +52,36 @@ declare const AccordionButton_base: import("../../utils/mixins/index.types").Con
|
|
|
53
52
|
*/
|
|
54
53
|
declare class AccordionButton extends AccordionButton_base {
|
|
55
54
|
/**
|
|
56
|
-
*
|
|
55
|
+
* Controls the spacing and padding of the accordion.
|
|
56
|
+
* - Small provides 1rem (16px) padding, large provides 1.5rem (24px) padding.
|
|
57
57
|
* @default 'small'
|
|
58
58
|
*/
|
|
59
59
|
size: Size;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Visual style variant of the accordion.
|
|
62
|
+
* - Default includes borders, borderless removes all border styling.
|
|
62
63
|
* @default 'default'
|
|
63
64
|
*/
|
|
64
65
|
variant: Variant;
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
+
* Specifies the heading level for accessibility purposes.
|
|
68
|
+
* Should match the heading hierarchy of the page (e.g., 2 for H2, 3 for H3).
|
|
67
69
|
* @default 3
|
|
68
70
|
*/
|
|
69
71
|
dataAriaLevel: number;
|
|
70
72
|
/**
|
|
71
|
-
*
|
|
73
|
+
* Controls whether the accordion body content is visible.
|
|
74
|
+
* - When true, the body section is shown; when false, it is hidden.
|
|
72
75
|
* @default false
|
|
73
76
|
*/
|
|
74
77
|
expanded: boolean;
|
|
75
78
|
/**
|
|
76
|
-
*
|
|
79
|
+
* Text content displayed in the accordion header.
|
|
77
80
|
*/
|
|
78
81
|
headerText?: string;
|
|
79
82
|
/**
|
|
80
|
-
*
|
|
83
|
+
* Icon displayed at the start of the accordion header, before the header text.
|
|
84
|
+
* Must be a valid icon name.
|
|
81
85
|
*/
|
|
82
86
|
prefixIcon?: IconNames;
|
|
83
87
|
/** @internal */
|
|
@@ -18,28 +18,27 @@ import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
|
|
18
18
|
import { DEFAULTS, ICON_NAME } from './accordionbutton.constants';
|
|
19
19
|
import styles from './accordionbutton.styles';
|
|
20
20
|
/**
|
|
21
|
-
* An accordion button
|
|
21
|
+
* An accordion button is a vertically stacked component with a clickable header and expandable/collapsible body section.
|
|
22
|
+
* The entire header is clickable to toggle the visibility of the body content.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
* - Header
|
|
24
|
+
* ## Header contains
|
|
25
|
+
* - Optional prefix icon
|
|
26
|
+
* - Header text (default H3, customizable via `data-aria-level`)
|
|
27
|
+
* - Expand/collapse arrow icon (visual indicator)
|
|
26
28
|
*
|
|
27
|
-
*
|
|
28
|
-
* - Default slot
|
|
29
|
+
* ## Body contains
|
|
30
|
+
* - Default slot for any content
|
|
29
31
|
*
|
|
30
|
-
* The accordion button
|
|
31
|
-
*
|
|
32
|
-
* There are two sizes of accordion, one is small and the other is large.
|
|
33
|
-
* Small size has a padding of 1rem (16px) and large size has a padding of 1.5rem (24px) for the body section of accordion.
|
|
32
|
+
* The accordion button supports different border styles through the `variant` attribute and different spacing through the `size` attribute.
|
|
33
|
+
* An accordion button can be disabled, which prevents the header from being clickable.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* ## When to use
|
|
36
|
+
* - Use `mdc-accordionbutton` for simple clickable headers without additional controls.
|
|
37
|
+
* - Use `mdc-accordion` instead if you need extra controls (chips, badges, icons) in the header.
|
|
37
38
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* If an accordion button is expanded by default, then the screen reader might loose focus when toggling the visibilty of the accordion button.
|
|
39
|
+
* ## Accessibility
|
|
40
|
+
* - Adjust `data-aria-level` based on heading hierarchy in your page.
|
|
41
|
+
* - Note: Screen readers may lose focus when toggling if accordion button is expanded by default.
|
|
43
42
|
*
|
|
44
43
|
* @tagname mdc-accordionbutton
|
|
45
44
|
*
|
|
@@ -49,12 +48,12 @@ import styles from './accordionbutton.styles';
|
|
|
49
48
|
*
|
|
50
49
|
* @slot default - The default slot contains the body section of the accordion. User can place anything inside this body slot.
|
|
51
50
|
*
|
|
52
|
-
* @event shown - (React: onShown) This event is triggered when the accordion button is expanded.
|
|
51
|
+
* @event shown - (React: onShown) This event is triggered when the accordion button is toggled (expanded or collapsed).
|
|
53
52
|
*
|
|
54
53
|
* @cssproperty --mdc-accordionbutton-border-color - The border color of the accordion button.
|
|
55
|
-
* @cssproperty --mdc-accordionbutton-hover-color - The hover color of the accordion button.
|
|
56
|
-
* @cssproperty --mdc-accordionbutton-active-color - The active color of the accordion button.
|
|
57
|
-
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled color of the accordion button.
|
|
54
|
+
* @cssproperty --mdc-accordionbutton-hover-color - The hover background color of the accordion button header.
|
|
55
|
+
* @cssproperty --mdc-accordionbutton-active-color - The active background color of the accordion button header.
|
|
56
|
+
* @cssproperty --mdc-accordionbutton-disabled-color - The disabled text color of the accordion button.
|
|
58
57
|
*
|
|
59
58
|
* @csspart body-section - The body section of the accordion button.
|
|
60
59
|
* @csspart header-button-section - The header button section of the accordion button.
|
|
@@ -67,22 +66,26 @@ class AccordionButton extends DisabledMixin(Component) {
|
|
|
67
66
|
constructor() {
|
|
68
67
|
super(...arguments);
|
|
69
68
|
/**
|
|
70
|
-
*
|
|
69
|
+
* Controls the spacing and padding of the accordion.
|
|
70
|
+
* - Small provides 1rem (16px) padding, large provides 1.5rem (24px) padding.
|
|
71
71
|
* @default 'small'
|
|
72
72
|
*/
|
|
73
73
|
this.size = DEFAULTS.SIZE;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Visual style variant of the accordion.
|
|
76
|
+
* - Default includes borders, borderless removes all border styling.
|
|
76
77
|
* @default 'default'
|
|
77
78
|
*/
|
|
78
79
|
this.variant = DEFAULTS.VARIANT;
|
|
79
80
|
/**
|
|
80
|
-
*
|
|
81
|
+
* Specifies the heading level for accessibility purposes.
|
|
82
|
+
* Should match the heading hierarchy of the page (e.g., 2 for H2, 3 for H3).
|
|
81
83
|
* @default 3
|
|
82
84
|
*/
|
|
83
85
|
this.dataAriaLevel = DEFAULTS.DATA_ARIA_LEVEL;
|
|
84
86
|
/**
|
|
85
|
-
*
|
|
87
|
+
* Controls whether the accordion body content is visible.
|
|
88
|
+
* - When true, the body section is shown; when false, it is hidden.
|
|
86
89
|
* @default false
|
|
87
90
|
*/
|
|
88
91
|
this.expanded = DEFAULTS.EXPANDED;
|
|
@@ -2,47 +2,46 @@ import type { CSSResult, PropertyValues } from 'lit';
|
|
|
2
2
|
import { Component } from '../../models';
|
|
3
3
|
import type { Size, Variant } from './accordiongroup.types';
|
|
4
4
|
/**
|
|
5
|
-
* An accordion group is a
|
|
6
|
-
*
|
|
7
|
-
* Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page.
|
|
5
|
+
* An accordion group is a container that manages multiple accordion or accordionbutton components as a unified set.
|
|
6
|
+
* It controls the visual styling, spacing, and expansion behavior of all child accordions.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* The group applies consistent `variant` and `size` attributes to all children automatically.
|
|
9
|
+
* By default, expanding one accordion collapses others (`allow-multiple` is false). Set `allow-multiple` to true to allow multiple expanded items.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
11
|
+
* ## Accepted children
|
|
12
|
+
* - Use `mdc-accordionbutton` children for simple clickable headers.
|
|
13
|
+
* - Use `mdc-accordion` children when you need additional controls (chips, badges, icons) in the headers.
|
|
14
|
+
* - Other elements in the slot are ignored.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
* - Large: Large size has a padding of 1.5rem (24px) for both heading and body sections.
|
|
19
|
-
*
|
|
20
|
-
* The variant and size will be applied to all accordions inside this accordion group.
|
|
21
|
-
* To show/expand more than one accordion at any given time, then set `allow-multiple` to `true`. By default, it's `false`.
|
|
22
|
-
*
|
|
23
|
-
* If you don't need any controls on your accordion heading, then it's advised to use `accordionbutton` component.
|
|
24
|
-
*
|
|
25
|
-
* If the first accordion of the accordion group is expanded by default, then the screen reader might loose focus when toggling the visibilty of the first accordion.
|
|
16
|
+
* ## Accessibility
|
|
17
|
+
* - Note: Screen readers may lose focus when toggling if the first accordion is expanded by default.
|
|
26
18
|
*
|
|
27
19
|
* @tagname mdc-accordiongroup
|
|
28
20
|
*
|
|
29
21
|
* @slot default - The default slot can contain the `accordion` or `accordionbutton` components.
|
|
30
22
|
*
|
|
31
|
-
* @cssproperty --mdc-accordiongroup-border-color - The border color
|
|
23
|
+
* @cssproperty --mdc-accordiongroup-items-border-color - The border color applied to all child accordion items and their separators.
|
|
32
24
|
*/
|
|
33
25
|
declare class AccordionGroup extends Component {
|
|
34
26
|
/**
|
|
35
|
-
*
|
|
27
|
+
* Controls the spacing and padding for all accordion items in the group.
|
|
28
|
+
* This size is applied to all child accordions.
|
|
29
|
+
* - Small provides 1rem (16px) padding, large provides 1.5rem (24px) padding.
|
|
36
30
|
* @default 'small'
|
|
37
31
|
*/
|
|
38
32
|
size: Size;
|
|
39
33
|
/**
|
|
40
|
-
*
|
|
34
|
+
* Visual style variant applied to all accordions in the group.
|
|
35
|
+
* - Stacked: accordions have 1.5rem gap between them.
|
|
36
|
+
* - Borderless: removes all borders from accordions and group.
|
|
37
|
+
* - Contained: accordions have continuous borders with no gaps.
|
|
41
38
|
* @default 'stacked'
|
|
42
39
|
*/
|
|
43
40
|
variant: Variant;
|
|
44
41
|
/**
|
|
45
|
-
*
|
|
42
|
+
* Controls whether multiple accordions can be expanded simultaneously.
|
|
43
|
+
* - When false, expanding one accordion automatically collapses others.
|
|
44
|
+
* - When true, multiple accordions can remain open at the same time.
|
|
46
45
|
* @default false
|
|
47
46
|
*/
|
|
48
47
|
allowMultiple: boolean;
|
|
@@ -15,49 +15,48 @@ import { Component } from '../../models';
|
|
|
15
15
|
import { DEFAULTS } from './accordiongroup.constants';
|
|
16
16
|
import styles from './accordiongroup.styles';
|
|
17
17
|
/**
|
|
18
|
-
* An accordion group is a
|
|
19
|
-
*
|
|
20
|
-
* Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page.
|
|
18
|
+
* An accordion group is a container that manages multiple accordion or accordionbutton components as a unified set.
|
|
19
|
+
* It controls the visual styling, spacing, and expansion behavior of all child accordions.
|
|
21
20
|
*
|
|
22
|
-
*
|
|
21
|
+
* The group applies consistent `variant` and `size` attributes to all children automatically.
|
|
22
|
+
* By default, expanding one accordion collapses others (`allow-multiple` is false). Set `allow-multiple` to true to allow multiple expanded items.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
27
|
-
* -
|
|
24
|
+
* ## Accepted children
|
|
25
|
+
* - Use `mdc-accordionbutton` children for simple clickable headers.
|
|
26
|
+
* - Use `mdc-accordion` children when you need additional controls (chips, badges, icons) in the headers.
|
|
27
|
+
* - Other elements in the slot are ignored.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
* -
|
|
31
|
-
* - Large: Large size has a padding of 1.5rem (24px) for both heading and body sections.
|
|
32
|
-
*
|
|
33
|
-
* The variant and size will be applied to all accordions inside this accordion group.
|
|
34
|
-
* To show/expand more than one accordion at any given time, then set `allow-multiple` to `true`. By default, it's `false`.
|
|
35
|
-
*
|
|
36
|
-
* If you don't need any controls on your accordion heading, then it's advised to use `accordionbutton` component.
|
|
37
|
-
*
|
|
38
|
-
* If the first accordion of the accordion group is expanded by default, then the screen reader might loose focus when toggling the visibilty of the first accordion.
|
|
29
|
+
* ## Accessibility
|
|
30
|
+
* - Note: Screen readers may lose focus when toggling if the first accordion is expanded by default.
|
|
39
31
|
*
|
|
40
32
|
* @tagname mdc-accordiongroup
|
|
41
33
|
*
|
|
42
34
|
* @slot default - The default slot can contain the `accordion` or `accordionbutton` components.
|
|
43
35
|
*
|
|
44
|
-
* @cssproperty --mdc-accordiongroup-border-color - The border color
|
|
36
|
+
* @cssproperty --mdc-accordiongroup-items-border-color - The border color applied to all child accordion items and their separators.
|
|
45
37
|
*/
|
|
46
38
|
class AccordionGroup extends Component {
|
|
47
39
|
constructor() {
|
|
48
40
|
super();
|
|
49
41
|
/**
|
|
50
|
-
*
|
|
42
|
+
* Controls the spacing and padding for all accordion items in the group.
|
|
43
|
+
* This size is applied to all child accordions.
|
|
44
|
+
* - Small provides 1rem (16px) padding, large provides 1.5rem (24px) padding.
|
|
51
45
|
* @default 'small'
|
|
52
46
|
*/
|
|
53
47
|
this.size = DEFAULTS.SIZE;
|
|
54
48
|
/**
|
|
55
|
-
*
|
|
49
|
+
* Visual style variant applied to all accordions in the group.
|
|
50
|
+
* - Stacked: accordions have 1.5rem gap between them.
|
|
51
|
+
* - Borderless: removes all borders from accordions and group.
|
|
52
|
+
* - Contained: accordions have continuous borders with no gaps.
|
|
56
53
|
* @default 'stacked'
|
|
57
54
|
*/
|
|
58
55
|
this.variant = DEFAULTS.VARIANT;
|
|
59
56
|
/**
|
|
60
|
-
*
|
|
57
|
+
* Controls whether multiple accordions can be expanded simultaneously.
|
|
58
|
+
* - When false, expanding one accordion automatically collapses others.
|
|
59
|
+
* - When true, multiple accordions can remain open at the same time.
|
|
61
60
|
* @default false
|
|
62
61
|
*/
|
|
63
62
|
this.allowMultiple = false;
|
|
@@ -2,7 +2,7 @@ import { css } from 'lit';
|
|
|
2
2
|
import { hostFocusRingStyles } from '../../utils/styles';
|
|
3
3
|
const styles = css `
|
|
4
4
|
:host {
|
|
5
|
-
--mdc-accordiongroup-border-color: var(--mds-color-theme-outline-secondary-normal);
|
|
5
|
+
--mdc-accordiongroup-items-border-color: var(--mds-color-theme-outline-secondary-normal);
|
|
6
6
|
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
@@ -12,7 +12,7 @@ const styles = css `
|
|
|
12
12
|
}
|
|
13
13
|
:host([variant='stacked']) ::slotted(mdc-accordion),
|
|
14
14
|
:host([variant='stacked']) ::slotted(mdc-accordionbutton) {
|
|
15
|
-
border: 1px solid var(--mdc-accordiongroup-border-color);
|
|
15
|
+
border: 1px solid var(--mdc-accordiongroup-items-border-color);
|
|
16
16
|
border-radius: 0.5rem;
|
|
17
17
|
}
|
|
18
18
|
:host([variant='stacked']) ::slotted(mdc-accordion:not[expanded]),
|
|
@@ -20,12 +20,12 @@ const styles = css `
|
|
|
20
20
|
border-bottom: none;
|
|
21
21
|
}
|
|
22
22
|
:host([variant='contained']) {
|
|
23
|
-
border: 1px solid var(--mdc-accordiongroup-border-color);
|
|
23
|
+
border: 1px solid var(--mdc-accordiongroup-items-border-color);
|
|
24
24
|
border-radius: 0.5rem;
|
|
25
25
|
}
|
|
26
26
|
:host([variant='contained']) ::slotted(mdc-accordion),
|
|
27
27
|
:host([variant='contained']) ::slotted(mdc-accordionbutton) {
|
|
28
|
-
border-bottom: 1px solid var(--mdc-accordiongroup-border-color);
|
|
28
|
+
border-bottom: 1px solid var(--mdc-accordiongroup-items-border-color);
|
|
29
29
|
}
|
|
30
30
|
:host([variant='contained']) ::slotted(mdc-accordion:first-child),
|
|
31
31
|
:host([variant='contained']) ::slotted(mdc-accordionbutton:first-child) {
|
|
@@ -42,7 +42,7 @@ const styles = css `
|
|
|
42
42
|
}
|
|
43
43
|
:host([variant='borderless']) ::slotted(mdc-accordion[expanded]),
|
|
44
44
|
:host([variant='borderless']) ::slotted(mdc-accordionbutton[expanded]) {
|
|
45
|
-
border-bottom: 1px solid var(--mdc-accordiongroup-border-color);
|
|
45
|
+
border-bottom: 1px solid var(--mdc-accordiongroup-items-border-color);
|
|
46
46
|
}
|
|
47
47
|
`;
|
|
48
48
|
export default [styles, ...hostFocusRingStyles()];
|
|
@@ -3,10 +3,18 @@ import type { CSSResult } from 'lit';
|
|
|
3
3
|
import Popover from '../popover/popover.component';
|
|
4
4
|
import type { TooltipType } from './tooltip.types';
|
|
5
5
|
/**
|
|
6
|
+
* A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
|
|
7
|
+
* Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
|
|
8
|
+
*
|
|
9
|
+
* Because of this, tooltips cannot contain content that can be focused or interacted with.
|
|
10
|
+
* When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
|
|
11
|
+
*
|
|
6
12
|
* A tooltip is triggered by mouse hover or by keyboard focus
|
|
7
13
|
* and will disappear upon mouse exit or focus change.
|
|
8
14
|
*
|
|
9
|
-
* Note:
|
|
15
|
+
* Note:
|
|
16
|
+
* - Tooltips cannot contain content that can be focused or interacted with.
|
|
17
|
+
* - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
|
|
10
18
|
*
|
|
11
19
|
* @tagname mdc-tooltip
|
|
12
20
|
*
|