@momentum-design/components 0.84.3 → 0.84.4
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/README.md +8 -3
- package/dist/browser/index.js +2233 -2291
- package/dist/browser/index.js.map +4 -4
- package/dist/components/alertchip/alertchip.component.d.ts +1 -1
- package/dist/components/alertchip/alertchip.component.js +2 -2
- package/dist/components/alertchip/alertchip.styles.js +22 -23
- package/dist/components/alertchip/alertchip.types.d.ts +1 -1
- package/dist/components/animation/animation.component.js +1 -1
- package/dist/components/animation/animation.styles.js +8 -5
- package/dist/components/appheader/appheader.component.js +12 -13
- package/dist/components/appheader/appheader.styles.js +0 -1
- package/dist/components/avatar/avatar.component.js +3 -16
- package/dist/components/avatar/avatar.constants.d.ts +1 -1
- package/dist/components/avatar/avatar.constants.js +1 -1
- package/dist/components/avatar/avatar.styles.js +129 -122
- package/dist/components/avatar/avatar.types.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.js +1 -1
- package/dist/components/avatarbutton/avatarbutton.component.d.ts +2 -2
- package/dist/components/avatarbutton/avatarbutton.component.js +2 -2
- package/dist/components/avatarbutton/avatarbutton.styles.js +34 -30
- package/dist/components/badge/badge.styles.js +9 -7
- package/dist/components/brandvisual/brandvisual.component.js +4 -4
- package/dist/components/bullet/bullet.component.d.ts +1 -1
- package/dist/components/bullet/bullet.component.js +2 -2
- package/dist/components/bullet/bullet.styles.js +3 -3
- package/dist/components/button/button.component.js +10 -4
- package/dist/components/button/button.utils.js +1 -1
- package/dist/components/buttongroup/buttongroup.component.js +1 -1
- package/dist/components/buttongroup/buttongroup.styles.js +68 -68
- package/dist/components/buttonlink/buttonlink.component.d.ts +5 -5
- package/dist/components/buttonlink/buttonlink.component.js +9 -9
- package/dist/components/buttonsimple/buttonsimple.component.js +2 -2
- package/dist/components/buttonsimple/buttonsimple.constants.d.ts +1 -1
- package/dist/components/buttonsimple/buttonsimple.constants.js +1 -1
- package/dist/components/buttonsimple/buttonsimple.styles.js +62 -57
- package/dist/components/card/card.component.d.ts +6 -6
- package/dist/components/card/card.component.js +15 -16
- package/dist/components/card/card.styles.js +24 -22
- package/dist/components/cardbutton/cardbutton.component.js +9 -12
- package/dist/components/cardbutton/cardbutton.styles.js +1 -1
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +6 -6
- package/dist/components/cardcheckbox/cardcheckbox.component.js +30 -29
- package/dist/components/cardcheckbox/cardcheckbox.styles.js +10 -10
- package/dist/components/cardradio/cardradio.component.d.ts +12 -12
- package/dist/components/cardradio/cardradio.component.js +27 -30
- package/dist/components/cardradio/cardradio.styles.js +8 -8
- package/dist/components/checkbox/checkbox.component.js +7 -9
- package/dist/components/checkbox/checkbox.styles.js +62 -60
- package/dist/components/chip/chip.component.d.ts +1 -1
- package/dist/components/chip/chip.component.js +6 -11
- package/dist/components/chip/chip.styles.js +4 -2
- package/dist/components/dialog/dialog.component.js +28 -29
- package/dist/components/dialog/dialog.styles.js +10 -12
- package/dist/components/divider/divider.component.js +6 -8
- package/dist/components/divider/divider.constants.d.ts +1 -1
- package/dist/components/divider/divider.constants.js +1 -1
- package/dist/components/divider/divider.styles.js +5 -20
- package/dist/components/filterchip/filterchip.styles.js +4 -2
- package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -4
- package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +19 -17
- package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +2 -1
- package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +4 -4
- package/dist/components/icon/icon.component.js +7 -7
- package/dist/components/icon/icon.utils.d.ts +1 -1
- package/dist/components/icon/icon.utils.js +7 -7
- package/dist/components/iconprovider/iconprovider.component.js +7 -7
- package/dist/components/input/input.component.d.ts +5 -5
- package/dist/components/input/input.component.js +64 -62
- package/dist/components/input/input.styles.js +128 -117
- package/dist/components/inputchip/inputchip.component.js +14 -19
- package/dist/components/inputchip/inputchip.styles.js +5 -3
- package/dist/components/link/link.component.d.ts +1 -1
- package/dist/components/link/link.component.js +4 -8
- package/dist/components/link/link.constants.d.ts +1 -1
- package/dist/components/link/link.constants.js +1 -1
- package/dist/components/link/link.styles.js +12 -12
- package/dist/components/linksimple/linksimple.component.js +2 -4
- package/dist/components/linksimple/linksimple.styles.js +59 -57
- package/dist/components/list/list.component.js +12 -9
- package/dist/components/listitem/listitem.component.js +15 -11
- package/dist/components/listitem/listitem.styles.js +11 -6
- package/dist/components/marker/marker.component.js +1 -1
- package/dist/components/marker/marker.styles.js +2 -2
- package/dist/components/menubar/menubar.component.d.ts +19 -19
- package/dist/components/menubar/menubar.component.js +19 -19
- package/dist/components/menuitem/menuitem.component.js +15 -15
- package/dist/components/menuitem/menuitem.styles.js +3 -2
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +4 -11
- package/dist/components/menuitemradio/menuitemradio.component.js +1 -1
- package/dist/components/menupopover/menupopover.component.js +11 -11
- package/dist/components/menupopover/menupopover.utils.d.ts +1 -1
- package/dist/components/menupopover/menupopover.utils.js +3 -8
- package/dist/components/navitem/navitem.component.js +11 -19
- package/dist/components/navitem/navitem.styles.js +147 -143
- package/dist/components/navitemlist/navitemlist.component.js +2 -2
- package/dist/components/optgroup/optgroup.component.js +12 -9
- package/dist/components/option/option.component.js +11 -11
- package/dist/components/option/option.styles.js +1 -1
- package/dist/components/popover/popover.component.js +4 -4
- package/dist/components/popover/popover.stack.js +1 -1
- package/dist/components/popover/popover.styles.js +0 -1
- package/dist/components/popover/popover.utils.js +3 -4
- package/dist/components/presence/presence.component.d.ts +4 -4
- package/dist/components/presence/presence.component.js +4 -4
- package/dist/components/progressbar/progressbar.component.js +3 -4
- package/dist/components/progressbar/progressbar.styles.js +77 -71
- package/dist/components/progressspinner/progressspiner.utils.js +4 -4
- package/dist/components/progressspinner/progressspinner.component.js +38 -37
- package/dist/components/progressspinner/progressspinner.styles.js +1 -1
- package/dist/components/radio/radio.component.d.ts +41 -41
- package/dist/components/radio/radio.component.js +84 -83
- package/dist/components/radio/radio.styles.js +77 -75
- package/dist/components/radiogroup/radiogroup.component.js +1 -1
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +2 -2
- package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -6
- package/dist/components/searchfield/searchfield.component.js +23 -17
- package/dist/components/searchfield/searchfield.styles.js +11 -13
- package/dist/components/select/select.component.js +20 -23
- package/dist/components/select/select.styles.js +9 -9
- package/dist/components/sidenavigation/sidenavigation.component.d.ts +6 -6
- package/dist/components/sidenavigation/sidenavigation.component.js +39 -29
- package/dist/components/sidenavigation/sidenavigation.context.js +5 -5
- package/dist/components/sidenavigation/sidenavigation.styles.js +53 -53
- package/dist/components/skeleton/skeleton.component.js +1 -4
- package/dist/components/skeleton/skeleton.constants.d.ts +1 -1
- package/dist/components/skeleton/skeleton.constants.js +1 -1
- package/dist/components/skeleton/skeleton.styles.js +4 -4
- package/dist/components/spinner/spinner.component.d.ts +7 -7
- package/dist/components/spinner/spinner.component.js +9 -9
- package/dist/components/spinner/spinner.styles.js +58 -53
- package/dist/components/staticcheckbox/staticcheckbox.component.js +10 -8
- package/dist/components/staticcheckbox/staticcheckbox.styles.js +52 -51
- package/dist/components/staticradio/staticradio.component.d.ts +8 -8
- package/dist/components/staticradio/staticradio.component.js +10 -11
- package/dist/components/staticradio/staticradio.styles.js +77 -75
- package/dist/components/statictoggle/statictoggle.component.d.ts +3 -3
- package/dist/components/statictoggle/statictoggle.component.js +3 -3
- package/dist/components/statictoggle/statictoggle.styles.js +71 -68
- package/dist/components/tab/tab.component.d.ts +1 -1
- package/dist/components/tab/tab.component.js +2 -2
- package/dist/components/tab/tab.styles.js +247 -245
- package/dist/components/tablist/tablist.component.js +11 -15
- package/dist/components/tablist/tablist.styles.js +27 -25
- package/dist/components/tablist/tablist.types.d.ts +1 -1
- package/dist/components/tablist/tablist.utils.js +4 -4
- package/dist/components/text/fonts.styles.js +49 -49
- package/dist/components/text/text.component.js +21 -11
- package/dist/components/text/text.types.d.ts +1 -1
- package/dist/components/textarea/textarea.component.d.ts +31 -31
- package/dist/components/textarea/textarea.component.js +54 -61
- package/dist/components/textarea/textarea.styles.js +123 -122
- package/dist/components/themeprovider/themeprovider.component.js +1 -1
- package/dist/components/themeprovider/themeprovider.styles.js +4 -4
- package/dist/components/toggle/toggle.component.d.ts +35 -35
- package/dist/components/toggle/toggle.component.js +62 -63
- package/dist/components/toggle/toggle.styles.js +77 -69
- package/dist/components/toggletip/toggletip.component.d.ts +7 -7
- package/dist/components/toggletip/toggletip.component.js +3 -2
- package/dist/components/tooltip/tooltip.component.js +1 -1
- package/dist/components/tooltip/tooltip.styles.js +0 -1
- package/dist/components/virtualizedlist/virtualizedlist.component.js +6 -14
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +1 -1
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +14 -11
- package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -4
- package/dist/custom-elements.json +514 -514
- package/dist/index.js +1 -0
- package/dist/models/component/index.d.ts +1 -1
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
- package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
- package/dist/utils/mixins/FocusTrapMixin.js +12 -12
- package/dist/utils/mixins/IconNameMixin.d.ts +1 -1
- package/dist/utils/mixins/MenuMixin.js +23 -23
- package/dist/utils/mixins/PreventScrollMixin.d.ts +1 -1
- package/dist/utils/styles/index.js +12 -12
- package/package.json +1 -1
@@ -56,9 +56,9 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
56
56
|
constructor() {
|
57
57
|
super(...arguments);
|
58
58
|
/**
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
* Determines whether the toggle is active or inactive.
|
60
|
+
* @default false
|
61
|
+
*/
|
62
62
|
this.checked = false;
|
63
63
|
/**
|
64
64
|
* Determines toggle size in rem (height is specified here).
|
@@ -68,10 +68,10 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
68
68
|
*/
|
69
69
|
this.size = DEFAULTS.SIZE;
|
70
70
|
/**
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
* Automatically focus on the element when the page loads.
|
72
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
73
|
+
* @default false
|
74
|
+
*/
|
75
75
|
this.autofocus = false;
|
76
76
|
}
|
77
77
|
connectedCallback() {
|
@@ -80,9 +80,9 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
80
80
|
this.helpTextType = undefined;
|
81
81
|
}
|
82
82
|
/** @internal
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
* Resets the checkbox to its initial state.
|
84
|
+
* The checked property is set to false.
|
85
|
+
*/
|
86
86
|
formResetCallback() {
|
87
87
|
this.checked = false;
|
88
88
|
}
|
@@ -93,11 +93,11 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
93
93
|
}
|
94
94
|
}
|
95
95
|
/**
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
* Manages the required state of the checkbox.
|
97
|
+
* If the checkbox is not checked and the required property is set, then the checkbox is invalid.
|
98
|
+
* If the validationMessage is set, it will be used as the custom validity message.
|
99
|
+
* If the validationMessage is not set, it will clear the custom validity message.
|
100
|
+
*/
|
101
101
|
manageRequired() {
|
102
102
|
if (!this.checked && this.required) {
|
103
103
|
if (this.validationMessage) {
|
@@ -113,10 +113,10 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
113
113
|
}
|
114
114
|
}
|
115
115
|
/**
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
* Updates the form value to reflect the current state of the toggle.
|
117
|
+
* If toggle is switched on, the value is set to either the user-provided value or 'isActive' if no value is provided.
|
118
|
+
* If toggle is switched off, the value is set to null.
|
119
|
+
*/
|
120
120
|
setFormValue() {
|
121
121
|
let actualValue = null;
|
122
122
|
if (this.checked) {
|
@@ -129,19 +129,19 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
129
129
|
this.internals.setFormValue(actualValue);
|
130
130
|
}
|
131
131
|
/**
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
* Toggles the state of the toggle element.
|
133
|
+
* If the element is not disabled, then the checked property is toggled.
|
134
|
+
*/
|
135
135
|
toggleState() {
|
136
136
|
if (!this.disabled) {
|
137
137
|
this.checked = !this.checked;
|
138
138
|
}
|
139
139
|
}
|
140
140
|
/**
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
141
|
+
* Handles the keydown event on the toggle element.
|
142
|
+
* When the user presses Enter, the form is submitted.
|
143
|
+
* @param event - The keyboard event.
|
144
|
+
*/
|
145
145
|
handleKeyDown(event) {
|
146
146
|
var _a;
|
147
147
|
if (event.key === 'Enter') {
|
@@ -149,21 +149,21 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
149
149
|
}
|
150
150
|
}
|
151
151
|
/**
|
152
|
-
|
153
|
-
|
154
|
-
|
152
|
+
* Toggles the state of the toggle element.
|
153
|
+
* and dispatch the new change event.
|
154
|
+
*/
|
155
155
|
handleChange(event) {
|
156
156
|
this.toggleState();
|
157
157
|
const EventConstructor = event.constructor;
|
158
158
|
this.dispatchEvent(new EventConstructor(event.type, event));
|
159
159
|
}
|
160
160
|
/**
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
161
|
+
* Sets the size attribute for the toggle component.
|
162
|
+
* If the provided size is not included in the TOGGLE_SIZE,
|
163
|
+
* it defaults to the value specified in DEFAULTS.SIZE.
|
164
|
+
*
|
165
|
+
* @param size - The size to set.
|
166
|
+
*/
|
167
167
|
setToggleSize(size) {
|
168
168
|
this.setAttribute('size', Object.values(TOGGLE_SIZE).includes(size) ? size : DEFAULTS.SIZE);
|
169
169
|
}
|
@@ -179,34 +179,33 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
179
179
|
render() {
|
180
180
|
var _a;
|
181
181
|
return html `
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
${this.renderHelperText()}
|
182
|
+
<mdc-statictoggle
|
183
|
+
?checked="${this.checked}"
|
184
|
+
?disabled="${this.disabled}"
|
185
|
+
size="${this.size}"
|
186
|
+
class="mdc-focus-ring"
|
187
|
+
part="container"
|
188
|
+
>
|
189
|
+
<input
|
190
|
+
id="${this.id}"
|
191
|
+
type="checkbox"
|
192
|
+
part="toggle-input"
|
193
|
+
role="${ROLE.CHECKBOX}"
|
194
|
+
?autofocus="${this.autofocus}"
|
195
|
+
?required="${this.required}"
|
196
|
+
name="${ifDefined(this.name)}"
|
197
|
+
value="${ifDefined(this.value)}"
|
198
|
+
.checked="${this.checked}"
|
199
|
+
aria-checked="${this.checked}"
|
200
|
+
.disabled="${this.disabled}"
|
201
|
+
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
202
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
203
|
+
tabindex="${this.disabled ? -1 : 0}"
|
204
|
+
@change="${this.handleChange}"
|
205
|
+
@keydown="${this.handleKeyDown}"
|
206
|
+
/>
|
207
|
+
</mdc-statictoggle>
|
208
|
+
${this.renderLabel()} ${this.renderHelperText()}
|
210
209
|
`;
|
211
210
|
}
|
212
211
|
}
|
@@ -1,86 +1,94 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
|
3
|
-
const styles = [
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
const styles = [
|
4
|
+
hostFitContentStyles,
|
5
|
+
css `
|
6
|
+
:host {
|
7
|
+
--mdc-toggle-width: 3rem;
|
8
|
+
--mdc-toggle-height: 1.5rem;
|
9
|
+
--mdc-toggle-width-compact: 2rem;
|
10
|
+
--mdc-toggle-height-compact: 1rem;
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
--mdc-toggle-label-lineheight: var(--mds-font-lineheight-body-midsize);
|
13
|
+
--mdc-toggle-label-fontsize: var(--mds-font-size-body-midsize);
|
14
|
+
--mdc-toggle-label-fontweight: 400;
|
15
|
+
--mdc-toggle-label-color-disabled: var(--mds-color-theme-text-primary-disabled);
|
16
|
+
--mdc-toggle-help-text-color: var(--mds-color-theme-text-secondary-normal);
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
--mdc-toggle-active-hover-color: var(--mds-color-theme-control-active-hover);
|
19
|
+
--mdc-toggle-active-pressed-color: var(--mds-color-theme-control-active-pressed);
|
20
|
+
--mdc-toggle-inactive-hover-color: var(--mds-color-theme-control-inactive-hover);
|
21
|
+
--mdc-toggle-inactive-pressed-color: var(--mds-color-theme-control-inactive-pressed);
|
22
|
+
}
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
:host([label]),
|
25
|
+
:host([help-text]) {
|
26
|
+
display: grid;
|
27
|
+
grid-template-rows: auto auto;
|
28
|
+
grid-template-columns: auto auto;
|
29
|
+
column-gap: 0.75rem;
|
30
|
+
row-gap: 0.25rem;
|
31
|
+
}
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
:host([help-text='']) {
|
34
|
+
grid-template-rows: auto;
|
35
|
+
row-gap: 0rem;
|
36
|
+
}
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
:host::part(toggle-input) {
|
39
|
+
margin: 0;
|
40
|
+
padding: 0;
|
41
|
+
position: absolute;
|
42
|
+
opacity: 0.1%;
|
43
|
+
overflow: visible;
|
44
|
+
z-index: 1;
|
45
|
+
width: var(--mdc-toggle-width);
|
46
|
+
height: var(--mdc-toggle-height);
|
47
|
+
}
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
.mdc-label-text,
|
50
|
+
.mdc-help-text {
|
51
|
+
font-size: var(--mdc-toggle-label-fontsize);
|
52
|
+
font-weight: var(--mdc-toggle-label-fontweight);
|
53
|
+
line-height: var(--mdc-toggle-label-lineheight);
|
54
|
+
grid-column: 2;
|
55
|
+
}
|
52
56
|
|
53
|
-
|
54
|
-
|
55
|
-
|
57
|
+
.mdc-label,
|
58
|
+
:host::part(toggle-input) {
|
59
|
+
cursor: pointer;
|
60
|
+
}
|
56
61
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
:host([disabled]) .mdc-label,
|
63
|
+
:host([disabled])::part(toggle-input) {
|
64
|
+
cursor: default;
|
65
|
+
}
|
61
66
|
|
62
|
-
|
63
|
-
|
64
|
-
|
67
|
+
.mdc-help-text {
|
68
|
+
color: var(--mdc-toggle-help-text-color);
|
69
|
+
}
|
65
70
|
|
66
|
-
|
67
|
-
|
68
|
-
|
71
|
+
:host(:hover:not([disabled]))::part(container) {
|
72
|
+
background-color: var(--mdc-toggle-inactive-hover-color);
|
73
|
+
}
|
69
74
|
|
70
|
-
|
71
|
-
|
72
|
-
|
75
|
+
:host(:active:not([disabled]))::part(container) {
|
76
|
+
background-color: var(--mdc-toggle-inactive-pressed-color);
|
77
|
+
}
|
73
78
|
|
74
|
-
|
75
|
-
|
76
|
-
|
79
|
+
:host(:hover:not([disabled])[checked])::part(container) {
|
80
|
+
background-color: var(--mdc-toggle-active-hover-color);
|
81
|
+
}
|
77
82
|
|
78
|
-
|
79
|
-
|
80
|
-
|
83
|
+
:host(:active:not([disabled])[checked])::part(container) {
|
84
|
+
background-color: var(--mdc-toggle-active-pressed-color);
|
85
|
+
}
|
81
86
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
87
|
+
:host([disabled]) .mdc-label-text,
|
88
|
+
:host([disabled]) .mdc-help-text {
|
89
|
+
color: var(--mdc-toggle-label-color-disabled);
|
90
|
+
}
|
91
|
+
`,
|
92
|
+
...hostFocusRingStyles(true),
|
93
|
+
];
|
86
94
|
export default styles;
|
@@ -41,13 +41,13 @@ declare class ToggleTip extends Popover {
|
|
41
41
|
/** @internal */
|
42
42
|
currentAnnouncement: string;
|
43
43
|
/**
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
* Set this attribute with the id of the element in the DOM, to which announcement
|
45
|
+
* elements will be appended.
|
46
|
+
* If an id is provided, the announcement elements will be appended to this element.
|
47
|
+
* If id is not provided, a visually hidden div element will be created in the DOM.
|
48
|
+
*
|
49
|
+
* Please refer to the `mdc-screenreaderannouncer` component for more details.
|
50
|
+
*/
|
51
51
|
screenreaderAnnouncerIdentity?: string;
|
52
52
|
/**
|
53
53
|
* The placement of the popover.
|
@@ -94,7 +94,7 @@ class ToggleTip extends Popover {
|
|
94
94
|
*/
|
95
95
|
getToggleTipText() {
|
96
96
|
var _a, _b;
|
97
|
-
return ((_b = (_a = this.defaultSlotNodes) === null || _a === void 0 ? void 0 : _a.map((node) => node.textContent).join(' ')) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
97
|
+
return (((_b = (_a = this.defaultSlotNodes) === null || _a === void 0 ? void 0 : _a.map((node) => node.textContent).join(' ')) === null || _b === void 0 ? void 0 : _b.trim()) || '');
|
98
98
|
}
|
99
99
|
/**
|
100
100
|
* Updates the placement attribute if it is not a valid placement.
|
@@ -120,7 +120,8 @@ class ToggleTip extends Popover {
|
|
120
120
|
<mdc-screenreaderannouncer
|
121
121
|
identity="${ifDefined(this.screenreaderAnnouncerIdentity)}"
|
122
122
|
announcement="${this.currentAnnouncement}"
|
123
|
-
delay="300"
|
123
|
+
delay="300"
|
124
|
+
>
|
124
125
|
</mdc-screenreaderannouncer>
|
125
126
|
`;
|
126
127
|
}
|
@@ -71,7 +71,7 @@ class Tooltip extends Popover {
|
|
71
71
|
*/
|
72
72
|
getTooltipText() {
|
73
73
|
var _a, _b;
|
74
|
-
return (((_b = (_a = this.defaultSlotNodes) === null || _a === void 0 ? void 0 : _a.map(
|
74
|
+
return (((_b = (_a = this.defaultSlotNodes) === null || _a === void 0 ? void 0 : _a.map(node => node.textContent).join(' ')) === null || _b === void 0 ? void 0 : _b.trim()) || '');
|
75
75
|
}
|
76
76
|
/**
|
77
77
|
* Sets the type attribute for the tooltip component.
|
@@ -11,8 +11,8 @@ import { html } from 'lit';
|
|
11
11
|
import { VirtualizerController } from '@tanstack/lit-virtual';
|
12
12
|
import { property } from 'lit/decorators.js';
|
13
13
|
import { createRef, ref } from 'lit/directives/ref.js';
|
14
|
-
import styles from './virtualizedlist.styles';
|
15
14
|
import { Component } from '../../models';
|
15
|
+
import styles from './virtualizedlist.styles';
|
16
16
|
import { DEFAULTS } from './virtualizedlist.constants';
|
17
17
|
/**
|
18
18
|
* `mdc-virtualizedlist` component for creating custom virtualized lists.
|
@@ -121,22 +121,14 @@ class VirtualizedList extends Component {
|
|
121
121
|
this.setlistdata({ virtualItems, measureElement, listStyle });
|
122
122
|
}
|
123
123
|
}
|
124
|
-
return html `<div
|
125
|
-
|
126
|
-
|
127
|
-
>
|
128
|
-
<slot></slot>
|
129
|
-
</div>`;
|
124
|
+
return html `<div part="container" style="height: ${getTotalSize()}px;">
|
125
|
+
<slot></slot>
|
126
|
+
</div>`;
|
130
127
|
}
|
131
128
|
render() {
|
132
|
-
return html `<div
|
133
|
-
${ref(this.scrollElementRef)}
|
134
|
-
part="scroll"
|
135
|
-
@scroll=${this.onscroll && this.onscroll}
|
136
|
-
>
|
129
|
+
return html `<div ${ref(this.scrollElementRef)} part="scroll" @scroll=${this.onscroll && this.onscroll}>
|
137
130
|
${this.virtualizerController ? this.getVirtualizedListWrapper(this.virtualizerController) : html ``}
|
138
|
-
</div>
|
139
|
-
`;
|
131
|
+
</div> `;
|
140
132
|
}
|
141
133
|
}
|
142
134
|
VirtualizedList.styles = [...Component.styles, ...styles];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CSSResult, PropertyValues, TemplateResult } from 'lit';
|
2
|
-
import { VirtualizerProps } from './virtualizedlist.types';
|
3
2
|
import { Component } from '../../models';
|
3
|
+
import { VirtualizerProps } from './virtualizedlist.types';
|
4
4
|
declare class VirtualizedWrapper extends Component {
|
5
5
|
onscroll: ((this: GlobalEventHandlers, ev: Event) => void) | null;
|
6
6
|
virtualizerProps: VirtualizerProps;
|
@@ -17,9 +17,7 @@ class VirtualizedWrapper extends Component {
|
|
17
17
|
super();
|
18
18
|
this.virtualizerProps = { count: 100, estimateSize: () => 100, overscan: 60 };
|
19
19
|
this.list = html ``;
|
20
|
-
this.listItemTexts = new Array(this.virtualizerProps.count)
|
21
|
-
.fill(true)
|
22
|
-
.map((_, index) => `list item number ${index}`);
|
20
|
+
this.listItemTexts = new Array(this.virtualizerProps.count).fill(true).map((_, index) => `list item number ${index}`);
|
23
21
|
this.onscroll = null;
|
24
22
|
this.setListData = this.setListData.bind(this);
|
25
23
|
}
|
@@ -44,18 +42,23 @@ class VirtualizedWrapper extends Component {
|
|
44
42
|
}
|
45
43
|
setListData({ virtualItems, measureElement, listStyle }) {
|
46
44
|
if (virtualItems) {
|
47
|
-
this.list = html `<ul style="margin: 0;${styleMap(listStyle)}"
|
48
|
-
|
45
|
+
this.list = html `<ul style="margin: 0;${styleMap(listStyle)}">
|
46
|
+
${virtualItems.map((virtualItem) => html `<li role="listitem" key=${virtualItem.key} data-index=${virtualItem.index} ref=${ref(measureElement)}>
|
47
|
+
${this.listItemTexts[virtualItem.index]}
|
48
|
+
</li>`)}
|
49
|
+
</ul>`;
|
49
50
|
}
|
50
51
|
}
|
51
52
|
render() {
|
52
53
|
return html `
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
<div style="height: 500px; width: 500px;">
|
55
|
+
<mdc-virtualizedlist
|
56
|
+
.onscroll=${this.onscroll}
|
57
|
+
.virtualizerProps=${this.virtualizerProps}
|
58
|
+
.setlistdata=${this.setListData}
|
59
|
+
>${this.list}</mdc-virtualizedlist
|
60
|
+
>
|
61
|
+
</div>
|
59
62
|
`;
|
60
63
|
}
|
61
64
|
}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
const styles = [
|
3
3
|
css `
|
4
|
-
|
4
|
+
:host::part(scroll) {
|
5
5
|
height: 100%;
|
6
6
|
width: 100%;
|
7
7
|
overflow-y: auto;
|
8
|
-
|
9
|
-
|
8
|
+
}
|
9
|
+
:host::part(container) {
|
10
10
|
position: relative;
|
11
11
|
width: 100%;
|
12
|
-
|
12
|
+
}
|
13
13
|
`,
|
14
14
|
];
|
15
15
|
export default styles;
|