@momentum-design/components 0.100.0 → 0.100.2
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 +1440 -1210
- package/dist/browser/index.js.map +4 -4
- package/dist/components/accordion/accordion.component.d.ts +74 -0
- package/dist/components/accordion/accordion.component.js +128 -0
- package/dist/components/accordion/accordion.constants.d.ts +2 -0
- package/dist/components/accordion/accordion.constants.js +3 -0
- package/dist/components/accordion/accordion.styles.d.ts +2 -0
- package/dist/components/accordion/accordion.styles.js +17 -0
- package/dist/components/accordion/index.d.ts +10 -0
- package/dist/components/accordion/index.js +7 -0
- package/dist/components/accordionbutton/accordionbutton.component.d.ts +119 -0
- package/dist/components/accordionbutton/accordionbutton.component.js +238 -0
- package/dist/components/accordionbutton/accordionbutton.constants.d.ts +17 -0
- package/dist/components/accordionbutton/accordionbutton.constants.js +19 -0
- package/dist/components/accordionbutton/accordionbutton.styles.d.ts +2 -0
- package/dist/components/accordionbutton/accordionbutton.styles.js +121 -0
- package/dist/components/accordionbutton/accordionbutton.types.d.ts +8 -0
- package/dist/components/accordionbutton/accordionbutton.types.js +1 -0
- package/dist/components/accordionbutton/index.d.ts +10 -0
- package/dist/components/accordionbutton/index.js +7 -0
- package/dist/components/accordiongroup/accordiongroup.component.d.ts +71 -0
- package/dist/components/accordiongroup/accordiongroup.component.js +132 -0
- package/dist/components/accordiongroup/accordiongroup.constants.d.ts +15 -0
- package/dist/components/accordiongroup/accordiongroup.constants.js +16 -0
- package/dist/components/accordiongroup/accordiongroup.styles.d.ts +2 -0
- package/dist/components/accordiongroup/accordiongroup.styles.js +48 -0
- package/dist/components/accordiongroup/accordiongroup.types.d.ts +5 -0
- package/dist/components/accordiongroup/accordiongroup.types.js +1 -0
- package/dist/components/accordiongroup/index.d.ts +7 -0
- package/dist/components/accordiongroup/index.js +4 -0
- package/dist/components/animation/animation.component.d.ts +1 -0
- package/dist/components/animation/animation.component.js +9 -0
- package/dist/components/cardcheckbox/cardcheckbox.component.js +3 -3
- package/dist/components/cardradio/cardradio.component.js +3 -3
- package/dist/components/dialog/dialog.component.js +5 -0
- package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +1 -0
- package/dist/components/icon/icon.component.d.ts +2 -1
- package/dist/components/icon/icon.component.js +9 -1
- package/dist/components/linksimple/linksimple.component.js +11 -11
- package/dist/components/listitem/listitem.component.js +6 -6
- package/dist/components/listitem/listitem.events.js +3 -1
- package/dist/components/menubar/menubar.component.d.ts +9 -0
- package/dist/components/menubar/menubar.component.js +38 -4
- package/dist/components/menuitem/menuitem.component.js +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +12 -12
- package/dist/components/menuitemradio/menuitemradio.component.js +13 -13
- package/dist/components/menupopover/menupopover.component.d.ts +30 -12
- package/dist/components/menupopover/menupopover.component.js +231 -179
- package/dist/components/menupopover/menupopover.utils.d.ts +2 -2
- package/dist/components/menupopover/menupopover.utils.js +2 -2
- package/dist/components/navmenuitem/navmenuitem.component.js +1 -1
- package/dist/components/popover/popover.component.d.ts +29 -9
- package/dist/components/popover/popover.component.js +277 -212
- package/dist/components/popover/popover.constants.d.ts +1 -0
- package/dist/components/popover/popover.constants.js +1 -0
- package/dist/components/popover/popover.types.d.ts +19 -6
- package/dist/components/popover/popover.utils.d.ts +7 -2
- package/dist/components/popover/popover.utils.js +19 -8
- package/dist/components/select/select.component.js +2 -0
- package/dist/components/select/select.styles.js +1 -1
- package/dist/components/select/select.types.d.ts +5 -1
- package/dist/components/sidenavigation/sidenavigation.component.js +1 -1
- package/dist/components/spinner/spinner.component.d.ts +1 -1
- package/dist/components/spinner/spinner.component.js +1 -1
- package/dist/components/tablist/tablist.component.d.ts +1 -0
- package/dist/components/tablist/tablist.component.js +284 -273
- package/dist/components/textarea/textarea.component.d.ts +2 -2
- package/dist/components/textarea/textarea.component.js +2 -2
- package/dist/components/tooltip/tooltip.component.d.ts +1 -1
- package/dist/components/tooltip/tooltip.component.js +14 -15
- package/dist/custom-elements.json +7364 -6056
- package/dist/index.d.ts +10 -7
- package/dist/index.js +10 -7
- package/dist/react/accordion/index.d.ts +53 -0
- package/dist/react/accordion/index.js +61 -0
- package/dist/react/accordionbutton/index.d.ts +50 -0
- package/dist/react/accordionbutton/index.js +58 -0
- package/dist/react/accordiongroup/index.d.ts +30 -0
- package/dist/react/accordiongroup/index.js +39 -0
- package/dist/react/coachmark/index.d.ts +12 -4
- package/dist/react/index.d.ts +9 -6
- package/dist/react/index.js +9 -6
- package/dist/react/menupopover/index.d.ts +12 -4
- package/dist/react/popover/index.d.ts +12 -4
- package/dist/react/toggletip/index.d.ts +12 -4
- package/dist/react/tooltip/index.d.ts +12 -4
- package/dist/utils/keys.d.ts +1 -0
- package/dist/utils/keys.js +1 -0
- package/dist/utils/roles.d.ts +2 -0
- package/dist/utils/roles.js +2 -0
- package/package.json +2 -2
@@ -0,0 +1,121 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFocusRingStyles } from '../../utils/styles';
|
3
|
+
const styles = css `
|
4
|
+
:host {
|
5
|
+
--mdc-accordionbutton-border-color: var(--mds-color-theme-outline-secondary-normal);
|
6
|
+
--mdc-accordionbutton-hover-color: var(--mds-color-theme-background-primary-hover);
|
7
|
+
--mdc-accordionbutton-active-color: var(--mds-color-theme-background-primary-active);
|
8
|
+
--mdc-accordionbutton-disabled-color: var(--mds-color-theme-text-primary-disabled);
|
9
|
+
|
10
|
+
display: flex;
|
11
|
+
flex-direction: column;
|
12
|
+
justify-content: flex-start;
|
13
|
+
width: 100%;
|
14
|
+
}
|
15
|
+
|
16
|
+
:host::part(header-section) {
|
17
|
+
width: 100%;
|
18
|
+
cursor: pointer;
|
19
|
+
user-select: none;
|
20
|
+
display: flex;
|
21
|
+
}
|
22
|
+
|
23
|
+
:host::part(header-button-section) {
|
24
|
+
display: flex;
|
25
|
+
width: 100%;
|
26
|
+
justify-content: space-between;
|
27
|
+
align-items: center;
|
28
|
+
}
|
29
|
+
|
30
|
+
:host::part(body-section) {
|
31
|
+
width: 100%;
|
32
|
+
}
|
33
|
+
|
34
|
+
:host([variant='default'][expanded])::part(header-section) {
|
35
|
+
border-radius: 0.5rem 0.5rem 0 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
:host::part(header-section):hover {
|
39
|
+
background-color: var(--mdc-accordionbutton-hover-color);
|
40
|
+
}
|
41
|
+
|
42
|
+
:host::part(header-section):active {
|
43
|
+
background-color: var(--mdc-accordionbutton-active-color);
|
44
|
+
}
|
45
|
+
|
46
|
+
:host([disabled])::part(header-section) {
|
47
|
+
color: var(--mdc-accordionbutton-disabled-color);
|
48
|
+
}
|
49
|
+
|
50
|
+
:host([disabled][expanded])::part(header-section) {
|
51
|
+
border-bottom: unset;
|
52
|
+
}
|
53
|
+
|
54
|
+
:host([disabled])::part(header-section):active,
|
55
|
+
:host([disabled])::part(header-section):hover {
|
56
|
+
background-color: unset;
|
57
|
+
}
|
58
|
+
|
59
|
+
:host([size='small'])::part(header-section),
|
60
|
+
:host([size='small'])::part(body-section) {
|
61
|
+
padding: 1rem;
|
62
|
+
}
|
63
|
+
|
64
|
+
:host([size='large'])::part(header-section),
|
65
|
+
:host([size='large'])::part(body-section) {
|
66
|
+
padding: 1.5rem;
|
67
|
+
}
|
68
|
+
|
69
|
+
:host::part(leading-header),
|
70
|
+
:host::part(trailing-header) {
|
71
|
+
display: flex;
|
72
|
+
flex-direction: row;
|
73
|
+
gap: 0.5rem;
|
74
|
+
align-items: center;
|
75
|
+
}
|
76
|
+
|
77
|
+
:host::part(trailing-header__icon) {
|
78
|
+
padding: 0.25rem;
|
79
|
+
}
|
80
|
+
|
81
|
+
:host([variant='default']) {
|
82
|
+
border: 1px solid var(--mdc-accordionbutton-border-color);
|
83
|
+
border-radius: 0.5rem;
|
84
|
+
}
|
85
|
+
|
86
|
+
:host([expanded])::part(header-section) {
|
87
|
+
border-bottom: 1px solid var(--mdc-accordionbutton-border-color);
|
88
|
+
border-radius: 0.5rem 0.5rem 0 0;
|
89
|
+
}
|
90
|
+
|
91
|
+
:host(:is([variant='default'], [variant='stacked']):not([expanded]))::part(header-section) {
|
92
|
+
border-radius: 0.5rem;
|
93
|
+
}
|
94
|
+
|
95
|
+
:host([variant='contained'])::part(header-section) {
|
96
|
+
border-radius: inherit;
|
97
|
+
}
|
98
|
+
|
99
|
+
:host([variant='default'])::part(header-section) {
|
100
|
+
border-radius: 0.5rem;
|
101
|
+
}
|
102
|
+
|
103
|
+
:host([variant='borderless']) {
|
104
|
+
border: none;
|
105
|
+
border-radius: 0;
|
106
|
+
}
|
107
|
+
|
108
|
+
:host([variant='borderless'])::part(header-section) {
|
109
|
+
border-radius: 0;
|
110
|
+
}
|
111
|
+
|
112
|
+
:host([variant='borderless']:not([expanded]))::part(header-section) {
|
113
|
+
border-bottom: 1px solid var(--mdc-accordionbutton-border-color);
|
114
|
+
border-radius: 0;
|
115
|
+
}
|
116
|
+
|
117
|
+
:host([variant='default']:not([expanded]))::part(header-section) {
|
118
|
+
border-bottom: none;
|
119
|
+
}
|
120
|
+
`;
|
121
|
+
export default [styles, ...hostFocusRingStyles(true)];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ValueOf } from '../../utils/types';
|
2
|
+
import { ICON_NAME, VARIANT } from './accordionbutton.constants';
|
3
|
+
type Variant = ValueOf<typeof VARIANT>;
|
4
|
+
type IconName = ValueOf<typeof ICON_NAME>;
|
5
|
+
interface Events {
|
6
|
+
onShownEvent: Event;
|
7
|
+
}
|
8
|
+
export type { Variant, IconName, Events };
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import '../button';
|
2
|
+
import '../icon';
|
3
|
+
import '../text';
|
4
|
+
import AccordionButton from './accordionbutton.component';
|
5
|
+
declare global {
|
6
|
+
interface HTMLElementTagNameMap {
|
7
|
+
['mdc-accordionbutton']: AccordionButton;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
export default AccordionButton;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import type { CSSResult, PropertyValues } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
import type { Size, Variant } from './accordiongroup.types';
|
4
|
+
/**
|
5
|
+
* An accordion group is a vertically stacked set of interactive headings that each contain a header and body content.
|
6
|
+
* Each heading of the accordion acts as a control that enable users to expand or hide their associated body sections of content.
|
7
|
+
* Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page.
|
8
|
+
*
|
9
|
+
* - Default Slot: The accordion group component only accepts, `accordion` and `accordionbutton` components as the children, rest are ignored.
|
10
|
+
*
|
11
|
+
* There are three types of variants:
|
12
|
+
* - Stacked - Each accordion will have a gap of 1.5rem (24px).
|
13
|
+
* - Borderless - Each accordion will not have any border and the group will also not have any border.
|
14
|
+
* - Contained - Each accordion will have no gap in between them and the border of the entire accordiongroup will be continuous.
|
15
|
+
*
|
16
|
+
* There are two types of sizes:
|
17
|
+
* - Small: Small size has a padding of 1rem (16px) for both heading and body sections.
|
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
|
+
* @tagname mdc-accordiongroup
|
26
|
+
*
|
27
|
+
* @slot default - The default slot can contain the `accordion` or `accordionbutton` components.
|
28
|
+
*
|
29
|
+
* @cssproperty --mdc-accordiongroup-border-color - The border color of the entire accordiongroup
|
30
|
+
*/
|
31
|
+
declare class AccordionGroup extends Component {
|
32
|
+
/**
|
33
|
+
* The size of the accordion item.
|
34
|
+
* @default 'small'
|
35
|
+
*/
|
36
|
+
size: Size;
|
37
|
+
/**
|
38
|
+
* The variant of the accordion item. Based on the variant, the styling of the accordion gets changed.
|
39
|
+
* @default 'stacked'
|
40
|
+
*/
|
41
|
+
variant: Variant;
|
42
|
+
/**
|
43
|
+
* If true, multiple accordion items can be visible at the same time.
|
44
|
+
* @default false
|
45
|
+
*/
|
46
|
+
allowMultiple: boolean;
|
47
|
+
/** @internal */
|
48
|
+
private accordionItems;
|
49
|
+
/** @internal */
|
50
|
+
private accordionButtonItems;
|
51
|
+
constructor();
|
52
|
+
/**
|
53
|
+
* Handles the 'shown' event for accordion items.
|
54
|
+
* If `allowMultiple` is false, ensures that only one accordion item
|
55
|
+
* remains expanded by collapsing all other expanded items when a new item is expanded.
|
56
|
+
*
|
57
|
+
* @param event - The event object from the 'shown' event.
|
58
|
+
*/
|
59
|
+
private handleAccordionExpanded;
|
60
|
+
/**
|
61
|
+
* Sets the given attribute on all child accordion or accordionbutton components.
|
62
|
+
*
|
63
|
+
* @param attributeName - The name of the attribute to set.
|
64
|
+
* @param attributeValue - The value to set the attribute to.
|
65
|
+
*/
|
66
|
+
private setChildrenAccordionAttributes;
|
67
|
+
updated(changedProperties: PropertyValues): void;
|
68
|
+
render(): import("lit-html").TemplateResult<1>;
|
69
|
+
static styles: Array<CSSResult>;
|
70
|
+
}
|
71
|
+
export default AccordionGroup;
|
@@ -0,0 +1,132 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html } from 'lit';
|
11
|
+
import { property, queryAssignedElements } from 'lit/decorators.js';
|
12
|
+
import { TAG_NAME as ACCORDION_TAGNAME } from '../accordion/accordion.constants';
|
13
|
+
import { TAG_NAME as ACCORDIONBUTTON_TAGNAME } from '../accordionbutton/accordionbutton.constants';
|
14
|
+
import { Component } from '../../models';
|
15
|
+
import { DEFAULTS } from './accordiongroup.constants';
|
16
|
+
import styles from './accordiongroup.styles';
|
17
|
+
/**
|
18
|
+
* An accordion group is a vertically stacked set of interactive headings that each contain a header and body content.
|
19
|
+
* Each heading of the accordion acts as a control that enable users to expand or hide their associated body sections of content.
|
20
|
+
* Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page.
|
21
|
+
*
|
22
|
+
* - Default Slot: The accordion group component only accepts, `accordion` and `accordionbutton` components as the children, rest are ignored.
|
23
|
+
*
|
24
|
+
* There are three types of variants:
|
25
|
+
* - Stacked - Each accordion will have a gap of 1.5rem (24px).
|
26
|
+
* - Borderless - Each accordion will not have any border and the group will also not have any border.
|
27
|
+
* - Contained - Each accordion will have no gap in between them and the border of the entire accordiongroup will be continuous.
|
28
|
+
*
|
29
|
+
* There are two types of sizes:
|
30
|
+
* - Small: Small size has a padding of 1rem (16px) for both heading and body sections.
|
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
|
+
* @tagname mdc-accordiongroup
|
39
|
+
*
|
40
|
+
* @slot default - The default slot can contain the `accordion` or `accordionbutton` components.
|
41
|
+
*
|
42
|
+
* @cssproperty --mdc-accordiongroup-border-color - The border color of the entire accordiongroup
|
43
|
+
*/
|
44
|
+
class AccordionGroup extends Component {
|
45
|
+
constructor() {
|
46
|
+
super();
|
47
|
+
/**
|
48
|
+
* The size of the accordion item.
|
49
|
+
* @default 'small'
|
50
|
+
*/
|
51
|
+
this.size = DEFAULTS.SIZE;
|
52
|
+
/**
|
53
|
+
* The variant of the accordion item. Based on the variant, the styling of the accordion gets changed.
|
54
|
+
* @default 'stacked'
|
55
|
+
*/
|
56
|
+
this.variant = DEFAULTS.VARIANT;
|
57
|
+
/**
|
58
|
+
* If true, multiple accordion items can be visible at the same time.
|
59
|
+
* @default false
|
60
|
+
*/
|
61
|
+
this.allowMultiple = false;
|
62
|
+
this.addEventListener('shown', this.handleAccordionExpanded);
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Handles the 'shown' event for accordion items.
|
66
|
+
* If `allowMultiple` is false, ensures that only one accordion item
|
67
|
+
* remains expanded by collapsing all other expanded items when a new item is expanded.
|
68
|
+
*
|
69
|
+
* @param event - The event object from the 'shown' event.
|
70
|
+
*/
|
71
|
+
handleAccordionExpanded(event) {
|
72
|
+
if (this.allowMultiple)
|
73
|
+
return;
|
74
|
+
[...this.accordionItems, ...this.accordionButtonItems].forEach(accordionItem => {
|
75
|
+
if (accordionItem !== event.target && accordionItem.hasAttribute('expanded')) {
|
76
|
+
accordionItem.toggleAttribute('expanded');
|
77
|
+
}
|
78
|
+
});
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Sets the given attribute on all child accordion or accordionbutton components.
|
82
|
+
*
|
83
|
+
* @param attributeName - The name of the attribute to set.
|
84
|
+
* @param attributeValue - The value to set the attribute to.
|
85
|
+
*/
|
86
|
+
setChildrenAccordionAttributes(attributeName, attributeValue) {
|
87
|
+
[...this.accordionItems].forEach(accordion => {
|
88
|
+
accordion.setAttribute(attributeName, attributeValue);
|
89
|
+
});
|
90
|
+
[...this.accordionButtonItems].forEach(accordion => {
|
91
|
+
accordion.setAttribute(attributeName, attributeValue);
|
92
|
+
});
|
93
|
+
}
|
94
|
+
updated(changedProperties) {
|
95
|
+
super.updated(changedProperties);
|
96
|
+
if (changedProperties.has('size')) {
|
97
|
+
if (!this.size)
|
98
|
+
this.size = DEFAULTS.SIZE;
|
99
|
+
this.setChildrenAccordionAttributes('size', this.size);
|
100
|
+
}
|
101
|
+
if (changedProperties.has('variant')) {
|
102
|
+
if (!this.variant)
|
103
|
+
this.variant = DEFAULTS.VARIANT;
|
104
|
+
this.setChildrenAccordionAttributes('variant', this.variant);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
render() {
|
108
|
+
return html ` <slot></slot> `;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
AccordionGroup.styles = [...Component.styles, ...styles];
|
112
|
+
__decorate([
|
113
|
+
property({ type: String, reflect: true }),
|
114
|
+
__metadata("design:type", String)
|
115
|
+
], AccordionGroup.prototype, "size", void 0);
|
116
|
+
__decorate([
|
117
|
+
property({ type: String, reflect: true }),
|
118
|
+
__metadata("design:type", String)
|
119
|
+
], AccordionGroup.prototype, "variant", void 0);
|
120
|
+
__decorate([
|
121
|
+
property({ type: Boolean, reflect: true, attribute: 'allow-multiple' }),
|
122
|
+
__metadata("design:type", Object)
|
123
|
+
], AccordionGroup.prototype, "allowMultiple", void 0);
|
124
|
+
__decorate([
|
125
|
+
queryAssignedElements({ selector: ACCORDION_TAGNAME }),
|
126
|
+
__metadata("design:type", Array)
|
127
|
+
], AccordionGroup.prototype, "accordionItems", void 0);
|
128
|
+
__decorate([
|
129
|
+
queryAssignedElements({ selector: ACCORDIONBUTTON_TAGNAME }),
|
130
|
+
__metadata("design:type", Array)
|
131
|
+
], AccordionGroup.prototype, "accordionButtonItems", void 0);
|
132
|
+
export default AccordionGroup;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
declare const TAG_NAME: "mdc-accordiongroup";
|
2
|
+
declare const SIZE: {
|
3
|
+
readonly SMALL: "small";
|
4
|
+
readonly LARGE: "large";
|
5
|
+
};
|
6
|
+
declare const VARIANT: {
|
7
|
+
readonly BORDERLESS: "borderless";
|
8
|
+
readonly CONTAINED: "contained";
|
9
|
+
readonly STACKED: "stacked";
|
10
|
+
};
|
11
|
+
declare const DEFAULTS: {
|
12
|
+
readonly SIZE: "small";
|
13
|
+
readonly VARIANT: "stacked";
|
14
|
+
};
|
15
|
+
export { DEFAULTS, SIZE, VARIANT, TAG_NAME };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
const TAG_NAME = utils.constructTagName('accordiongroup');
|
3
|
+
const SIZE = {
|
4
|
+
SMALL: 'small',
|
5
|
+
LARGE: 'large',
|
6
|
+
};
|
7
|
+
const VARIANT = {
|
8
|
+
BORDERLESS: 'borderless',
|
9
|
+
CONTAINED: 'contained',
|
10
|
+
STACKED: 'stacked',
|
11
|
+
};
|
12
|
+
const DEFAULTS = {
|
13
|
+
SIZE: SIZE.SMALL,
|
14
|
+
VARIANT: VARIANT.STACKED,
|
15
|
+
};
|
16
|
+
export { DEFAULTS, SIZE, VARIANT, TAG_NAME };
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFocusRingStyles } from '../../utils/styles';
|
3
|
+
const styles = css `
|
4
|
+
:host {
|
5
|
+
--mdc-accordiongroup-border-color: var(--mds-color-theme-outline-secondary-normal);
|
6
|
+
|
7
|
+
display: flex;
|
8
|
+
flex-direction: column;
|
9
|
+
}
|
10
|
+
:host([variant='stacked']) {
|
11
|
+
row-gap: 1.5rem;
|
12
|
+
}
|
13
|
+
:host([variant='stacked']) ::slotted(mdc-accordion),
|
14
|
+
:host([variant='stacked']) ::slotted(mdc-accordionbutton) {
|
15
|
+
border: 1px solid var(--mdc-accordiongroup-border-color);
|
16
|
+
border-radius: 0.5rem;
|
17
|
+
}
|
18
|
+
:host([variant='stacked']) ::slotted(mdc-accordion:not[expanded]),
|
19
|
+
:host([variant='stacked']) ::slotted(mdc-accordionbutton:not[expanded]) {
|
20
|
+
border-bottom: none;
|
21
|
+
}
|
22
|
+
:host([variant='contained']) {
|
23
|
+
border: 1px solid var(--mdc-accordiongroup-border-color);
|
24
|
+
border-radius: 0.5rem;
|
25
|
+
}
|
26
|
+
:host([variant='contained']) ::slotted(mdc-accordion),
|
27
|
+
:host([variant='contained']) ::slotted(mdc-accordionbutton) {
|
28
|
+
border-bottom: 1px solid var(--mdc-accordiongroup-border-color);
|
29
|
+
}
|
30
|
+
:host([variant='contained']) ::slotted(mdc-accordion:first-child),
|
31
|
+
:host([variant='contained']) ::slotted(mdc-accordionbutton:first-child) {
|
32
|
+
border-radius: 0.5rem 0.5rem 0 0;
|
33
|
+
}
|
34
|
+
:host([variant='contained']) ::slotted(mdc-accordion:last-child),
|
35
|
+
:host([variant='contained']) ::slotted(mdc-accordionbutton:last-child) {
|
36
|
+
border-bottom: none;
|
37
|
+
border-radius: 0 0 0.5rem 0.5rem;
|
38
|
+
}
|
39
|
+
:host([variant='contained']) ::slotted(mdc-accordion[expanded]:last-child),
|
40
|
+
:host([variant='contained']) ::slotted(mdc-accordionbutton[expanded]:last-child) {
|
41
|
+
border-radius: inherit;
|
42
|
+
}
|
43
|
+
:host([variant='borderless']) ::slotted(mdc-accordion[expanded]),
|
44
|
+
:host([variant='borderless']) ::slotted(mdc-accordionbutton[expanded]) {
|
45
|
+
border-bottom: 1px solid var(--mdc-accordiongroup-border-color);
|
46
|
+
}
|
47
|
+
`;
|
48
|
+
export default [styles, ...hostFocusRingStyles()];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -147,6 +147,15 @@ class Animation extends Component {
|
|
147
147
|
this.role = this.ariaLabel || this.ariaLabelledBy ? 'img' : null;
|
148
148
|
}
|
149
149
|
}
|
150
|
+
disconnectedCallback() {
|
151
|
+
super.disconnectedCallback();
|
152
|
+
// Clean up the lottie instance when the component is removed from the DOM
|
153
|
+
if (this.lottieInstance) {
|
154
|
+
this.lottieInstance.removeEventListener('complete', this.onCompleteHandler);
|
155
|
+
this.lottieInstance.destroy();
|
156
|
+
this.lottieInstance = undefined;
|
157
|
+
}
|
158
|
+
}
|
150
159
|
render() {
|
151
160
|
return html `<div aria-hidden="true" ${ref(this.containerRef)}></div>`;
|
152
161
|
}
|
@@ -77,9 +77,9 @@ class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
77
77
|
* @default 'check'
|
78
78
|
*/
|
79
79
|
this.selectionType = DEFAULTS.SELECTION_TYPE;
|
80
|
-
this.addEventListener('click', this.toggleChecked);
|
81
|
-
this.addEventListener('keydown', this.toggleOnEnter);
|
82
|
-
this.addEventListener('keyup', this.toggleOnSpace);
|
80
|
+
this.addEventListener('click', this.toggleChecked.bind(this));
|
81
|
+
this.addEventListener('keydown', this.toggleOnEnter.bind(this));
|
82
|
+
this.addEventListener('keyup', this.toggleOnSpace.bind(this));
|
83
83
|
}
|
84
84
|
connectedCallback() {
|
85
85
|
super.connectedCallback();
|
@@ -77,9 +77,9 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
77
77
|
* @default ''
|
78
78
|
*/
|
79
79
|
this.name = '';
|
80
|
-
this.addEventListener('click', this.toggleChecked);
|
81
|
-
this.addEventListener('keydown', this.toggleOnEnter);
|
82
|
-
this.addEventListener('keyup', this.toggleOnSpace);
|
80
|
+
this.addEventListener('click', this.toggleChecked.bind(this));
|
81
|
+
this.addEventListener('keydown', this.toggleOnEnter.bind(this));
|
82
|
+
this.addEventListener('keyup', this.toggleOnSpace.bind(this));
|
83
83
|
}
|
84
84
|
connectedCallback() {
|
85
85
|
super.connectedCallback();
|
@@ -307,6 +307,11 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
|
|
307
307
|
*/
|
308
308
|
createBackdrop() {
|
309
309
|
var _a;
|
310
|
+
// Remove existing backdrop if present
|
311
|
+
if (this.backdropElement && this.backdropElement.parentElement) {
|
312
|
+
this.backdropElement.parentElement.removeChild(this.backdropElement);
|
313
|
+
this.backdropElement = null;
|
314
|
+
}
|
310
315
|
const backdrop = document.createElement('div');
|
311
316
|
backdrop.classList.add('dialog-backdrop');
|
312
317
|
const styleElement = document.createElement('style');
|
@@ -11,6 +11,7 @@ const styles = [
|
|
11
11
|
:host([disabled]),
|
12
12
|
:host([disabled]) .mdc-label,
|
13
13
|
:host([disabled]) .mdc-help-text,
|
14
|
+
:host([disabled])::part(required-indicator),
|
14
15
|
:host([disabled][help-text-type='error']) .mdc-help-text,
|
15
16
|
:host([disabled][help-text-type='success']) .mdc-help-text,
|
16
17
|
:host([disabled][help-text-type='warning']) .mdc-help-text,
|
@@ -74,7 +74,7 @@ declare class Icon extends Component {
|
|
74
74
|
*/
|
75
75
|
ariaLabelledBy: string | null;
|
76
76
|
private readonly iconProviderContext;
|
77
|
-
private abortController
|
77
|
+
private abortController?;
|
78
78
|
constructor();
|
79
79
|
/**
|
80
80
|
* Parse the icon string to an html element, set the attributes and
|
@@ -110,6 +110,7 @@ declare class Icon extends Component {
|
|
110
110
|
private updateSize;
|
111
111
|
private get computedIconSize();
|
112
112
|
updated(changedProperties: Map<string, any>): void;
|
113
|
+
disconnectedCallback(): void;
|
113
114
|
render(): import("lit-html").TemplateResult<1>;
|
114
115
|
static styles: Array<CSSResult>;
|
115
116
|
}
|
@@ -113,7 +113,8 @@ class Icon extends Component {
|
|
113
113
|
// (directly passing the abortcontroller to the fetch request per reference
|
114
114
|
// will not work due to JS call-by-sharing behavior)
|
115
115
|
const renewSignal = () => {
|
116
|
-
|
116
|
+
var _a;
|
117
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
117
118
|
this.abortController = new AbortController();
|
118
119
|
return this.abortController.signal;
|
119
120
|
};
|
@@ -219,6 +220,13 @@ class Icon extends Component {
|
|
219
220
|
this.updateSize();
|
220
221
|
}
|
221
222
|
}
|
223
|
+
disconnectedCallback() {
|
224
|
+
var _a;
|
225
|
+
super.disconnectedCallback();
|
226
|
+
// abort the fetch request when the component is disconnected
|
227
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
228
|
+
this.abortController = undefined; // reset the abort controller
|
229
|
+
}
|
222
230
|
render() {
|
223
231
|
return html ` ${this.iconData} `;
|
224
232
|
}
|
@@ -66,24 +66,24 @@ class Linksimple extends DisabledMixin(TabIndexMixin(Component)) {
|
|
66
66
|
* @internal
|
67
67
|
*/
|
68
68
|
this.prevTabindex = 0;
|
69
|
-
this.handleNavigation = (e) => {
|
70
|
-
if ((e.type === 'click' || (e instanceof KeyboardEvent && e.key === 'Enter')) && this.href) {
|
71
|
-
if (this.disabled)
|
72
|
-
return;
|
73
|
-
window.open(this.href, this.target, this.rel);
|
74
|
-
}
|
75
|
-
};
|
76
69
|
}
|
77
70
|
connectedCallback() {
|
78
71
|
super.connectedCallback();
|
79
72
|
this.setAttribute('role', 'link');
|
80
|
-
this.addEventListener('click', this.handleNavigation);
|
81
|
-
this.addEventListener('keydown', this.handleNavigation);
|
73
|
+
this.addEventListener('click', this.handleNavigation.bind(this));
|
74
|
+
this.addEventListener('keydown', this.handleNavigation.bind(this));
|
82
75
|
}
|
83
76
|
disconnectedCallback() {
|
84
77
|
super.disconnectedCallback();
|
85
|
-
this.removeEventListener('click', this.handleNavigation);
|
86
|
-
this.removeEventListener('keydown', this.handleNavigation);
|
78
|
+
this.removeEventListener('click', this.handleNavigation.bind(this));
|
79
|
+
this.removeEventListener('keydown', this.handleNavigation.bind(this));
|
80
|
+
}
|
81
|
+
handleNavigation(e) {
|
82
|
+
if ((e.type === 'click' || (e instanceof KeyboardEvent && e.key === 'Enter')) && this.href) {
|
83
|
+
if (this.disabled)
|
84
|
+
return;
|
85
|
+
window.open(this.href, this.target, this.rel);
|
86
|
+
}
|
87
87
|
}
|
88
88
|
/**
|
89
89
|
* Sets or removes `aria-disabled` and updates `tabIndex` to reflect
|
@@ -83,12 +83,12 @@ class ListItem extends DisabledMixin(TabIndexMixin(Component)) {
|
|
83
83
|
* @default 'top'
|
84
84
|
*/
|
85
85
|
this.tooltipPlacement = DEFAULTS.TOOLTIP_PLACEMENT;
|
86
|
-
this.addEventListener('keydown', this.handleKeyDown);
|
87
|
-
this.addEventListener('focusin', this.displayTooltipForLongText);
|
88
|
-
this.addEventListener('mouseenter', this.displayTooltipForLongText);
|
89
|
-
this.addEventListener('focusout', this.hideTooltipOnLeave);
|
90
|
-
this.addEventListener('mouseout', this.hideTooltipOnLeave);
|
91
|
-
this.addEventListener('click', this.handleClick);
|
86
|
+
this.addEventListener('keydown', this.handleKeyDown.bind(this));
|
87
|
+
this.addEventListener('focusin', this.displayTooltipForLongText.bind(this));
|
88
|
+
this.addEventListener('mouseenter', this.displayTooltipForLongText.bind(this));
|
89
|
+
this.addEventListener('focusout', this.hideTooltipOnLeave.bind(this));
|
90
|
+
this.addEventListener('mouseout', this.hideTooltipOnLeave.bind(this));
|
91
|
+
this.addEventListener('click', this.handleClick.bind(this));
|
92
92
|
}
|
93
93
|
connectedCallback() {
|
94
94
|
super.connectedCallback();
|
@@ -32,7 +32,9 @@ export class ListItemEventManager {
|
|
32
32
|
static onCreatedListItem(instance) {
|
33
33
|
// Use setTimeout to ensure the event is dispatched after the component is fully initialized
|
34
34
|
// Inherited Element might execute its own lifecycle methods
|
35
|
-
setTimeout(() =>
|
35
|
+
setTimeout(() => {
|
36
|
+
this.dispatchListItemEvent('created', instance);
|
37
|
+
}, 0);
|
36
38
|
}
|
37
39
|
/**
|
38
40
|
* Custom event that is fired when the popover is destroyed.
|