@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
@@ -78,15 +78,15 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
78
78
|
*/
|
79
79
|
getAllValidOptions() {
|
80
80
|
var _a;
|
81
|
-
return ((_a = this.optionsList) === null || _a === void 0 ? void 0 : _a.map(
|
81
|
+
return (((_a = this.optionsList) === null || _a === void 0 ? void 0 : _a.map(option => {
|
82
82
|
if (option.tagName.toLowerCase() === OPTION_TAG_NAME) {
|
83
83
|
return option;
|
84
84
|
}
|
85
85
|
if (option.tagName.toLowerCase() === OPTION_GROUP_TAG_NAME) {
|
86
|
-
return Array.from(option.children).filter(
|
86
|
+
return Array.from(option.children).filter(optgroup => optgroup.tagName.toLowerCase() === OPTION_TAG_NAME);
|
87
87
|
}
|
88
88
|
return [];
|
89
|
-
}).flat()) || [];
|
89
|
+
}).flat()) || []);
|
90
90
|
}
|
91
91
|
handlePopoverOpen() {
|
92
92
|
this.displayPopover = true;
|
@@ -106,7 +106,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
106
106
|
updateTabIndexForAllOptions(selectedOption) {
|
107
107
|
var _a;
|
108
108
|
let isTabIndexSet = false;
|
109
|
-
this.getAllValidOptions().forEach(
|
109
|
+
this.getAllValidOptions().forEach(option => {
|
110
110
|
if (option === selectedOption) {
|
111
111
|
this.setSelectedValue(option);
|
112
112
|
isTabIndexSet = true;
|
@@ -209,7 +209,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
209
209
|
var _a;
|
210
210
|
switch (event.key) {
|
211
211
|
case KEYS.TAB: {
|
212
|
-
const focusedOptionIndex = this.getAllValidOptions().findIndex(
|
212
|
+
const focusedOptionIndex = this.getAllValidOptions().findIndex(option => option === event.target);
|
213
213
|
this.setFocusAndTabIndex(focusedOptionIndex);
|
214
214
|
event.preventDefault();
|
215
215
|
break;
|
@@ -285,7 +285,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
285
285
|
*/
|
286
286
|
handleOptionsNavigation(event) {
|
287
287
|
const options = this.getAllValidOptions();
|
288
|
-
const currentIndex = options.findIndex(
|
288
|
+
const currentIndex = options.findIndex(option => option === event.target);
|
289
289
|
const newIndex = this.getNewIndexBasedOnKey(event.key, currentIndex, options.length);
|
290
290
|
if (newIndex !== -1) {
|
291
291
|
this.setFocusAndTabIndex(newIndex);
|
@@ -316,11 +316,11 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
316
316
|
}
|
317
317
|
if (key === KEYS.PAGE_DOWN) {
|
318
318
|
// Jumps visual focus down 10 options (or to last option).
|
319
|
-
return
|
319
|
+
return currentIndex + 10 > optionsLength ? optionsLength - 1 : currentIndex + 10;
|
320
320
|
}
|
321
321
|
if (key === KEYS.PAGE_UP) {
|
322
322
|
// Jumps visual focus up 10 options (or to first option).
|
323
|
-
return
|
323
|
+
return currentIndex - 10 < 0 ? 0 : currentIndex - 10;
|
324
324
|
}
|
325
325
|
return -1;
|
326
326
|
}
|
@@ -328,12 +328,12 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
328
328
|
var _a, _b, _c, _d, _e;
|
329
329
|
const options = this.getAllValidOptions();
|
330
330
|
if (target) {
|
331
|
-
const currentIndex = options.findIndex(
|
331
|
+
const currentIndex = options.findIndex(option => option === target);
|
332
332
|
this.activeDescendant = (_b = (_a = options[currentIndex]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
333
333
|
}
|
334
334
|
else {
|
335
335
|
// If no target is provided, find the option with tabindex="0" or the first option
|
336
|
-
const focusedOption = options.find(
|
336
|
+
const focusedOption = options.find(option => option.getAttribute('tabindex') === '0');
|
337
337
|
this.activeDescendant = (_e = (_c = focusedOption === null || focusedOption === void 0 ? void 0 : focusedOption.id) !== null && _c !== void 0 ? _c : (_d = options[0]) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : '';
|
338
338
|
}
|
339
339
|
}
|
@@ -359,8 +359,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
359
359
|
this.displayPopover = true;
|
360
360
|
// Find the currently selected option or the first option
|
361
361
|
const options = this.getAllValidOptions();
|
362
|
-
const selectedOption = options.find(
|
363
|
-
const focusedOption = options.find(
|
362
|
+
const selectedOption = options.find(option => option.hasAttribute('selected'));
|
363
|
+
const focusedOption = options.find(option => option.getAttribute('tabindex') === '0');
|
364
364
|
// Set activeDescendant to the selected/focused option or first option
|
365
365
|
this.activeDescendant = (_b = (_a = (selectedOption || focusedOption || options[0])) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
366
366
|
}
|
@@ -375,7 +375,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
375
375
|
*/
|
376
376
|
firstUpdated() {
|
377
377
|
const options = this.getAllValidOptions();
|
378
|
-
const selectedOptionIndex = options.findIndex(
|
378
|
+
const selectedOptionIndex = options.findIndex(option => option === null || option === void 0 ? void 0 : option.hasAttribute('selected'));
|
379
379
|
if (selectedOptionIndex !== -1) {
|
380
380
|
this.setSelectedValue(options[selectedOptionIndex]);
|
381
381
|
this.updateTabIndexForAllOptions(options[selectedOptionIndex]);
|
@@ -426,8 +426,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
426
426
|
* @returns An array of `TemplateResult` representing the option elements.
|
427
427
|
*/
|
428
428
|
getOptionsContentFromSlot() {
|
429
|
-
return this.getAllValidOptions()
|
430
|
-
.map((option) => {
|
429
|
+
return this.getAllValidOptions().map(option => {
|
431
430
|
var _a, _b;
|
432
431
|
return html `
|
433
432
|
<option
|
@@ -439,7 +438,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
439
438
|
>
|
440
439
|
${option.textContent}
|
441
440
|
</option>
|
442
|
-
|
441
|
+
`;
|
443
442
|
});
|
444
443
|
}
|
445
444
|
/**
|
@@ -470,9 +469,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
470
469
|
@hidden="${this.handlePopoverClose}"
|
471
470
|
style="--mdc-popover-max-width: 100%; --mdc-popover-max-height: ${this.height};"
|
472
471
|
>
|
473
|
-
|
474
|
-
|
475
|
-
</mdc-popover>
|
472
|
+
<slot @click="${this.handleOptionsClick}"></slot>
|
473
|
+
</mdc-popover>
|
476
474
|
`;
|
477
475
|
}
|
478
476
|
updated(changedProperties) {
|
@@ -503,14 +501,14 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
503
501
|
class="${this.disabled ? '' : 'mdc-focus-ring'}"
|
504
502
|
role="${ROLE.COMBOBOX}"
|
505
503
|
aria-activedescendant="${ifDefined(this.activeDescendant || undefined)}"
|
506
|
-
aria-controls="${
|
504
|
+
aria-controls="${ifDefined(this.displayPopover ? 'options-popover' : undefined)}"
|
507
505
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
508
506
|
aria-labelledby="${this.label ? FORMFIELD_DEFAULTS.HEADING_ID : ''}"
|
509
507
|
aria-expanded="${this.displayPopover ? 'true' : 'false'}"
|
510
508
|
aria-required="${this.required ? 'true' : 'false'}"
|
511
509
|
aria-invalid="${this.helpTextType === VALIDATION.ERROR ? 'true' : 'false'}"
|
512
510
|
>
|
513
|
-
|
511
|
+
${this.selectedIcon
|
514
512
|
? html `<mdc-icon length-unit="rem" size="1" name="${this.selectedIcon}" part="selected-icon"></mdc-icon>`
|
515
513
|
: nothing}
|
516
514
|
<mdc-text
|
@@ -524,8 +522,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
524
522
|
<mdc-icon size="1" length-unit="rem" name="${this.baseIconName}"></mdc-icon>
|
525
523
|
</div>
|
526
524
|
</div>
|
527
|
-
${this.getNativeSelect()}
|
528
|
-
${this.getPopoverContent()}
|
525
|
+
${this.getNativeSelect()} ${this.getPopoverContent()}
|
529
526
|
</div>
|
530
527
|
${this.renderHelperText()}
|
531
528
|
`;
|
@@ -79,12 +79,12 @@ const styles = css `
|
|
79
79
|
}
|
80
80
|
:host([disabled])::part(base-container),
|
81
81
|
:host([readonly])::part(base-container),
|
82
|
-
:host([help-text-type=
|
83
|
-
:host([help-text-type=
|
84
|
-
:host([help-text-type=
|
85
|
-
:host([help-text-type=
|
86
|
-
:host([help-text-type=
|
87
|
-
:host([help-text-type=
|
82
|
+
:host([help-text-type='success'][disabled])::part(base-container),
|
83
|
+
:host([help-text-type='error'][disabled])::part(base-container),
|
84
|
+
:host([help-text-type='warning'][disabled])::part(base-container),
|
85
|
+
:host([help-text-type='success'][readonly])::part(base-container),
|
86
|
+
:host([help-text-type='error'][readonly])::part(base-container),
|
87
|
+
:host([help-text-type='warning'][readonly])::part(base-container) {
|
88
88
|
border-color: var(--mdc-select-disabled-border-color);
|
89
89
|
background: var(--mdc-select-disabled-background-color);
|
90
90
|
}
|
@@ -98,13 +98,13 @@ const styles = css `
|
|
98
98
|
:host([disabled])::part(base-text) {
|
99
99
|
color: var(--mdc-select-disabled-text-color);
|
100
100
|
}
|
101
|
-
:host([help-text-type=
|
101
|
+
:host([help-text-type='success'])::part(base-container) {
|
102
102
|
border-color: var(--mdc-select-success-border-color);
|
103
103
|
}
|
104
|
-
:host([help-text-type=
|
104
|
+
:host([help-text-type='error'])::part(base-container) {
|
105
105
|
border-color: var(--mdc-select-error-border-color);
|
106
106
|
}
|
107
|
-
:host([help-text-type=
|
107
|
+
:host([help-text-type='warning'])::part(base-container) {
|
108
108
|
border-color: var(--mdc-select-warning-border-color);
|
109
109
|
}
|
110
110
|
`;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CSSResult } from 'lit';
|
2
2
|
import { Provider } from '../../models';
|
3
|
-
import SideNavigationContext from './sidenavigation.context';
|
4
3
|
import type { SideNavigationVariant } from './sidenavigation.types';
|
4
|
+
import SideNavigationContext from './sidenavigation.context';
|
5
5
|
/**
|
6
6
|
* The `mdc-sidenavigation` component provides a vertically stacked navigation experience,
|
7
7
|
* typically used in layouts with persistent or collapsible sidebars.
|
@@ -90,11 +90,11 @@ declare class SideNavigation extends Provider<SideNavigationContext> {
|
|
90
90
|
*/
|
91
91
|
parentNavTooltipText?: string;
|
92
92
|
/**
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
93
|
+
* Toggles between true and false when it's variant is flexible.
|
94
|
+
* @default true
|
95
|
+
*
|
96
|
+
* @internal
|
97
|
+
*/
|
98
98
|
private flexibleExpanded;
|
99
99
|
/**
|
100
100
|
* Direction of the arrow icon, if applicable.
|
@@ -9,13 +9,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property, state } from 'lit/decorators.js';
|
12
|
-
import styles from './sidenavigation.styles';
|
13
12
|
import { Component, Provider } from '../../models';
|
14
|
-
import SideNavigationContext from './sidenavigation.context';
|
15
|
-
import { DEFAULTS, VARIANTS } from './sidenavigation.constants';
|
16
13
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
17
14
|
import { DIRECTIONS, DIVIDER_VARIANT, DIVIDER_ORIENTATION } from '../divider/divider.constants';
|
18
15
|
import { ROLE } from '../../utils/roles';
|
16
|
+
import { DEFAULTS, VARIANTS } from './sidenavigation.constants';
|
17
|
+
import SideNavigationContext from './sidenavigation.context';
|
18
|
+
import styles from './sidenavigation.styles';
|
19
19
|
/**
|
20
20
|
* The `mdc-sidenavigation` component provides a vertically stacked navigation experience,
|
21
21
|
* typically used in layouts with persistent or collapsible sidebars.
|
@@ -87,11 +87,11 @@ class SideNavigation extends Provider {
|
|
87
87
|
*/
|
88
88
|
this.customerName = '';
|
89
89
|
/**
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
* Toggles between true and false when it's variant is flexible.
|
91
|
+
* @default true
|
92
|
+
*
|
93
|
+
* @internal
|
94
|
+
*/
|
95
95
|
this.flexibleExpanded = this.variant === DEFAULTS.VARIANT;
|
96
96
|
/**
|
97
97
|
* Direction of the arrow icon, if applicable.
|
@@ -148,9 +148,9 @@ class SideNavigation extends Provider {
|
|
148
148
|
* Is called on every re-render, see Provider class
|
149
149
|
*/
|
150
150
|
updateContext() {
|
151
|
-
if (this.context.value.variant !== this.variant
|
152
|
-
|
153
|
-
|
151
|
+
if (this.context.value.variant !== this.variant ||
|
152
|
+
this.context.value.expanded !== this.expanded ||
|
153
|
+
this.context.value.parentNavTooltipText !== this.parentNavTooltipText) {
|
154
154
|
this.context.value.variant = this.variant;
|
155
155
|
this.context.value.expanded = this.expanded;
|
156
156
|
this.context.value.parentNavTooltipText = this.parentNavTooltipText;
|
@@ -186,30 +186,40 @@ class SideNavigation extends Provider {
|
|
186
186
|
return html ``;
|
187
187
|
}
|
188
188
|
return html `
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
189
|
+
<div part="side-navigation-container" id="side-nav-container">
|
190
|
+
<div part="scrollable-section">
|
191
|
+
<slot name="scrollable-section"></slot>
|
192
|
+
</div>
|
193
|
+
<mdc-divider variant="gradient" part="separator"></mdc-divider>
|
194
|
+
<div part="fixed-section">
|
195
|
+
<slot name="fixed-section"></slot>
|
196
|
+
<div part="brand-logo-container">
|
197
|
+
<slot name="brand-logo"></slot>
|
198
|
+
${this.expanded
|
199
|
+
? html `<mdc-text type=${TYPE.BODY_MIDSIZE_MEDIUM} tagname=${VALID_TEXT_TAGS.SPAN} part="label"
|
200
|
+
>${this.customerName}</mdc-text
|
201
|
+
>`
|
202
|
+
: nothing}
|
201
203
|
</div>
|
202
204
|
</div>
|
203
|
-
|
205
|
+
</div>
|
206
|
+
${this.variant === VARIANTS.FLEXIBLE
|
207
|
+
? html `<mdc-divider
|
204
208
|
orientation=${DIVIDER_ORIENTATION.VERTICAL}
|
205
209
|
variant=${DIVIDER_VARIANT.GRADIENT}
|
206
210
|
arrow-direction=${this.arrowDirection}
|
207
211
|
button-position=${DIRECTIONS.POSITIVE}
|
208
|
-
>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
212
|
+
>
|
213
|
+
<mdc-button
|
214
|
+
aria-label=${(_a = this.grabberBtnAriaLabel) !== null && _a !== void 0 ? _a : ''}
|
215
|
+
@click=${this.toggleSideNavigation}
|
216
|
+
aria-expanded="${!!this.expanded}"
|
217
|
+
aria-controls="side-nav-container"
|
218
|
+
part="grabber-btn"
|
219
|
+
></mdc-button>
|
220
|
+
</mdc-divider>`
|
221
|
+
: nothing}
|
222
|
+
`;
|
213
223
|
}
|
214
224
|
}
|
215
225
|
SideNavigation.styles = [...Component.styles, ...styles];
|
@@ -15,9 +15,9 @@ class SideNavigationContext {
|
|
15
15
|
if (!id)
|
16
16
|
return false;
|
17
17
|
const siblings = Array.from((_b = (_a = navItem === null || navItem === void 0 ? void 0 : navItem.parentElement) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []);
|
18
|
-
return siblings.some(
|
19
|
-
|
20
|
-
|
18
|
+
return siblings.some(sibling => sibling !== navItem &&
|
19
|
+
sibling.tagName.toLowerCase() === MENUPOPOVER_TAGNAME &&
|
20
|
+
sibling.getAttribute('triggerid') === id);
|
21
21
|
}
|
22
22
|
getParentNavItems(navItem) {
|
23
23
|
if (!navItem)
|
@@ -55,7 +55,7 @@ class SideNavigationContext {
|
|
55
55
|
this.currentActiveNavItem.removeAttribute('aria-current');
|
56
56
|
this.currentActiveNavItem.removeAttribute('active');
|
57
57
|
const previousParents = this.getParentNavItems(this.currentActiveNavItem);
|
58
|
-
previousParents.forEach(
|
58
|
+
previousParents.forEach(parent => {
|
59
59
|
parent.removeAttribute('tooltip-text');
|
60
60
|
parent.removeAttribute('active');
|
61
61
|
});
|
@@ -67,7 +67,7 @@ class SideNavigationContext {
|
|
67
67
|
navItem.setAttribute('aria-current', 'page');
|
68
68
|
navItem.setAttribute('active', '');
|
69
69
|
const newParents = this.getParentNavItems(navItem);
|
70
|
-
newParents.forEach(
|
70
|
+
newParents.forEach(parent => {
|
71
71
|
parent.setAttribute('tooltip-text', this.parentNavTooltipText || '');
|
72
72
|
parent.setAttribute('tooltip-placement', POPOVER_PLACEMENT.BOTTOM);
|
73
73
|
parent.setAttribute('active', '');
|
@@ -1,68 +1,68 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
const styles = css `
|
3
|
-
:host {
|
4
|
-
|
5
|
-
|
3
|
+
:host {
|
4
|
+
--mdc-sidenavigation-expanded-width: 15rem;
|
5
|
+
--mdc-sidenavigation-collapsed-width: 4.5rem;
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
}
|
7
|
+
display: flex;
|
8
|
+
height: 100%;
|
9
|
+
}
|
10
10
|
|
11
|
-
:host([expanded]) {
|
12
|
-
|
13
|
-
}
|
11
|
+
:host([expanded]) {
|
12
|
+
width: var(--mdc-sidenavigation-expanded-width);
|
13
|
+
}
|
14
14
|
|
15
|
-
:host(:not([expanded])) {
|
16
|
-
|
17
|
-
}
|
15
|
+
:host(:not([expanded])) {
|
16
|
+
width: var(--mdc-sidenavigation-collapsed-width);
|
17
|
+
}
|
18
18
|
|
19
|
-
:host::part(side-navigation-container) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
19
|
+
:host::part(side-navigation-container) {
|
20
|
+
display: flex;
|
21
|
+
flex-direction: column;
|
22
|
+
width: 100%;
|
23
|
+
}
|
24
24
|
|
25
|
-
:host::part(scrollable-section) {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
25
|
+
:host::part(scrollable-section) {
|
26
|
+
flex-grow: 1;
|
27
|
+
overflow: auto;
|
28
|
+
padding: 1rem 0;
|
29
|
+
min-height: 0;
|
30
|
+
}
|
31
31
|
|
32
|
-
:host::part(fixed-section) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
32
|
+
:host::part(fixed-section) {
|
33
|
+
flex-shrink: 0;
|
34
|
+
display: flex;
|
35
|
+
flex-direction: column;
|
36
|
+
align-items: flex-start;
|
37
|
+
padding-bottom: 1rem;
|
38
|
+
gap: 0.5rem;
|
39
|
+
}
|
40
40
|
|
41
|
-
:host::part(brand-logo-container) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
41
|
+
:host::part(brand-logo-container) {
|
42
|
+
display: flex;
|
43
|
+
align-items: center;
|
44
|
+
width: 100%;
|
45
|
+
gap: 0.5rem;
|
46
|
+
border-radius: 1.25rem;
|
47
|
+
}
|
48
48
|
|
49
|
-
:host(:dir(ltr))::part(brand-logo-container) {
|
50
|
-
|
51
|
-
}
|
49
|
+
:host(:dir(ltr))::part(brand-logo-container) {
|
50
|
+
padding: 0.5rem 0rem 0.5rem 1.5rem;
|
51
|
+
}
|
52
52
|
|
53
|
-
:host(:dir(rtl))::part(brand-logo-container) {
|
54
|
-
|
55
|
-
}
|
53
|
+
:host(:dir(rtl))::part(brand-logo-container) {
|
54
|
+
padding: 0.5rem 1.5rem 0.5rem 0rem;
|
55
|
+
}
|
56
56
|
|
57
|
-
::slotted([slot=
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
57
|
+
::slotted([slot='brand-logo']) {
|
58
|
+
width: 1.5rem;
|
59
|
+
height: 1.5rem;
|
60
|
+
flex-shrink: 0;
|
61
|
+
aspect-ratio: 1 / 1;
|
62
|
+
}
|
63
63
|
|
64
|
-
:host::part(separator) {
|
65
|
-
|
66
|
-
}
|
64
|
+
:host::part(separator) {
|
65
|
+
margin-bottom: 0.75rem;
|
66
|
+
}
|
67
67
|
`;
|
68
68
|
export default [styles];
|
@@ -75,10 +75,7 @@ class Skeleton extends Component {
|
|
75
75
|
/**
|
76
76
|
* Styles associated with this component.
|
77
77
|
*/
|
78
|
-
Skeleton.styles = [
|
79
|
-
...Component.styles,
|
80
|
-
styles,
|
81
|
-
];
|
78
|
+
Skeleton.styles = [...Component.styles, styles];
|
82
79
|
__decorate([
|
83
80
|
property({ type: String, reflect: true }),
|
84
81
|
__metadata("design:type", String)
|
@@ -11,19 +11,19 @@ const styles = css `
|
|
11
11
|
width: var(--mdc-skeleton-width);
|
12
12
|
}
|
13
13
|
|
14
|
-
:host([variant=
|
14
|
+
:host([variant='rectangular']) {
|
15
15
|
border-radius: 0.25rem;
|
16
16
|
}
|
17
17
|
|
18
|
-
:host([variant=
|
18
|
+
:host([variant='rounded']) {
|
19
19
|
border-radius: 0.5rem;
|
20
20
|
}
|
21
21
|
|
22
|
-
:host([variant=
|
22
|
+
:host([variant='circular']) {
|
23
23
|
border-radius: 50%;
|
24
24
|
}
|
25
25
|
|
26
|
-
:host([variant=
|
26
|
+
:host([variant='button']) {
|
27
27
|
border-radius: 1.25rem;
|
28
28
|
}
|
29
29
|
|
@@ -60,13 +60,13 @@ declare class Spinner extends Component {
|
|
60
60
|
*/
|
61
61
|
ariaLabel: string | null;
|
62
62
|
/**
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
63
|
+
* There are 2 variants of spinner: default and button. Their coloring is different.
|
64
|
+
* - **Standalone (Default)**: Track has a blue color.
|
65
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
66
|
+
* To ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s
|
67
|
+
* icon or label text.
|
68
|
+
* @default standalone
|
69
|
+
*/
|
70
70
|
variant: SpinnerVariant;
|
71
71
|
updated(changedProperties: Map<string, any>): void;
|
72
72
|
render(): import("lit-html").TemplateResult<1>;
|
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { html } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
|
-
import styles from './spinner.styles';
|
13
12
|
import { Component } from '../../models';
|
14
|
-
import { DEFAULTS } from './spinner.constants';
|
15
13
|
import { ROLE } from '../../utils/roles';
|
14
|
+
import styles from './spinner.styles';
|
15
|
+
import { DEFAULTS } from './spinner.constants';
|
16
16
|
/**
|
17
17
|
* `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning
|
18
18
|
* it's best for cases where the progress or duration of a process is variable or unknown.
|
@@ -74,13 +74,13 @@ class Spinner extends Component {
|
|
74
74
|
*/
|
75
75
|
this.ariaLabel = null;
|
76
76
|
/**
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
77
|
+
* There are 2 variants of spinner: default and button. Their coloring is different.
|
78
|
+
* - **Standalone (Default)**: Track has a blue color.
|
79
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
80
|
+
* To ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s
|
81
|
+
* icon or label text.
|
82
|
+
* @default standalone
|
83
|
+
*/
|
84
84
|
this.variant = DEFAULTS.VARIANT;
|
85
85
|
}
|
86
86
|
updated(changedProperties) {
|