@momentum-design/components 0.123.2 → 0.123.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/dist/browser/index.js +203 -187
- package/dist/browser/index.js.map +3 -3
- package/dist/components/combobox/combobox.styles.js +4 -3
- package/dist/components/input/input.styles.js +11 -1
- package/dist/components/popover/popover.component.d.ts +2 -2
- package/dist/components/popover/popover.component.js +5 -5
- package/dist/components/popover/popover.constants.d.ts +1 -1
- package/dist/components/popover/popover.constants.js +1 -1
- package/dist/components/select/select.component.d.ts +5 -0
- package/dist/components/select/select.component.js +27 -12
- package/dist/components/select/select.constants.d.ts +4 -1
- package/dist/components/select/select.constants.js +4 -1
- package/dist/components/select/select.styles.js +9 -5
- package/dist/components/tooltip/tooltip.component.js +1 -1
- package/dist/custom-elements.json +1938 -1918
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
|
@@ -54,9 +54,6 @@ const styles = css `
|
|
|
54
54
|
:host([disabled])::part(combobox__button) {
|
|
55
55
|
border-inline-start-color: var(--mdc-combobox-text-color-disabled);
|
|
56
56
|
}
|
|
57
|
-
:host::part(mdc-input) {
|
|
58
|
-
width: calc(100% - 1.5rem);
|
|
59
|
-
}
|
|
60
57
|
:host::part(combobox__button-icon) {
|
|
61
58
|
--mdc-icon-fill-color: var(--mdc-combobox-icon-color);
|
|
62
59
|
}
|
|
@@ -66,6 +63,10 @@ const styles = css `
|
|
|
66
63
|
:host::part(no-result-text) {
|
|
67
64
|
pointer-events: none;
|
|
68
65
|
}
|
|
66
|
+
:host::part(input-text) {
|
|
67
|
+
/* 2rem is the complete width of dropdown button */
|
|
68
|
+
width: calc(100% - 2rem);
|
|
69
|
+
}
|
|
69
70
|
:host([disabled]) input,
|
|
70
71
|
:host([disabled]) mdc-input {
|
|
71
72
|
user-select: none;
|
|
@@ -20,7 +20,17 @@ const styles = [
|
|
|
20
20
|
|
|
21
21
|
:host::part(input-text),
|
|
22
22
|
::slotted(input) {
|
|
23
|
-
|
|
23
|
+
/* Unset default native input placeholder padding */
|
|
24
|
+
padding-block: unset;
|
|
25
|
+
padding-inline: unset;
|
|
26
|
+
|
|
27
|
+
/* Set midsize regular font family to native input text */
|
|
28
|
+
font-family: var(--mdc-themeprovider-font-family);
|
|
29
|
+
font-size: var(--mds-font-apps-body-midsize-regular-font-size);
|
|
30
|
+
font-weight: var(--mds-font-apps-body-midsize-regular-font-weight);
|
|
31
|
+
line-height: var(--mds-font-apps-body-midsize-regular-line-height);
|
|
32
|
+
text-decoration: var(--mds-font-apps-body-midsize-regular-text-decoration);
|
|
33
|
+
text-transform: var(--mds-font-apps-body-midsize-regular-text-case);
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
:host::part(input-container) {
|
|
@@ -253,9 +253,9 @@ declare class Popover extends Popover_base {
|
|
|
253
253
|
isBackdropInvisible?: boolean;
|
|
254
254
|
/**
|
|
255
255
|
* Changes the placement of popover to keep it in view when scrolling.
|
|
256
|
-
* @default
|
|
256
|
+
* @default false
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
disableFlip: boolean;
|
|
259
259
|
/**
|
|
260
260
|
* Changes the size of popover to keep it in view when scrolling.
|
|
261
261
|
* @default false
|
|
@@ -272,9 +272,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
272
272
|
this.isBackdropInvisible = DEFAULTS.IS_BACKDROP_INVISIBLE;
|
|
273
273
|
/**
|
|
274
274
|
* Changes the placement of popover to keep it in view when scrolling.
|
|
275
|
-
* @default
|
|
275
|
+
* @default false
|
|
276
276
|
*/
|
|
277
|
-
this.
|
|
277
|
+
this.disableFlip = DEFAULTS.DISABLE_FLIP;
|
|
278
278
|
/**
|
|
279
279
|
* Changes the size of popover to keep it in view when scrolling.
|
|
280
280
|
* @default false
|
|
@@ -613,7 +613,7 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
613
613
|
}),
|
|
614
614
|
];
|
|
615
615
|
let popoverOffset = this.offset;
|
|
616
|
-
if (this.
|
|
616
|
+
if (!this.disableFlip) {
|
|
617
617
|
middleware.push(flip({
|
|
618
618
|
boundary,
|
|
619
619
|
rootBoundary,
|
|
@@ -1023,9 +1023,9 @@ __decorate([
|
|
|
1023
1023
|
__metadata("design:type", Boolean)
|
|
1024
1024
|
], Popover.prototype, "isBackdropInvisible", void 0);
|
|
1025
1025
|
__decorate([
|
|
1026
|
-
property({ type: Boolean, reflect: true }),
|
|
1026
|
+
property({ type: Boolean, reflect: true, attribute: 'disable-flip' }),
|
|
1027
1027
|
__metadata("design:type", Boolean)
|
|
1028
|
-
], Popover.prototype, "
|
|
1028
|
+
], Popover.prototype, "disableFlip", void 0);
|
|
1029
1029
|
__decorate([
|
|
1030
1030
|
property({ type: Boolean, reflect: true }),
|
|
1031
1031
|
__metadata("design:type", Boolean)
|
|
@@ -47,7 +47,7 @@ declare const DEFAULTS: {
|
|
|
47
47
|
readonly HIDE_ON_CLICK_OUTSIDE: false;
|
|
48
48
|
readonly FOCUS_BACK: false;
|
|
49
49
|
readonly BACKDROP: false;
|
|
50
|
-
readonly
|
|
50
|
+
readonly DISABLE_FLIP: false;
|
|
51
51
|
readonly SIZE: false;
|
|
52
52
|
readonly DELAY: "0,0";
|
|
53
53
|
readonly ROLE: "dialog";
|
|
@@ -115,6 +115,11 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
|
115
115
|
* @default 1000
|
|
116
116
|
*/
|
|
117
117
|
popoverZIndex: number;
|
|
118
|
+
/**
|
|
119
|
+
* Determines whether the dropdown should flip its position when it hits the boundary.
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
disableFlip: boolean;
|
|
118
123
|
/**
|
|
119
124
|
* ID of the element where the backdrop will be appended to.
|
|
120
125
|
* This is useful to ensure that the backdrop is appended to the correct element in the DOM.
|
|
@@ -22,10 +22,10 @@ import { ROLE } from '../../utils/roles';
|
|
|
22
22
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
|
23
23
|
import { DEFAULTS as FORMFIELD_DEFAULTS, VALIDATION } from '../formfieldwrapper/formfieldwrapper.constants';
|
|
24
24
|
import { TAG_NAME as OPTION_TAG_NAME } from '../option/option.constants';
|
|
25
|
-
import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT } from '../popover/popover.constants';
|
|
25
|
+
import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from '../popover/popover.constants';
|
|
26
26
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
|
27
27
|
import { debounce } from '../../utils/debounce';
|
|
28
|
-
import { ARROW_ICON, LISTBOX_ID, TRIGGER_ID } from './select.constants';
|
|
28
|
+
import { ARROW_ICON, DEFAULTS, LISTBOX_ID, TRIGGER_ID } from './select.constants';
|
|
29
29
|
import styles from './select.styles';
|
|
30
30
|
/**
|
|
31
31
|
* The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
|
|
@@ -132,6 +132,11 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
|
|
|
132
132
|
* @default 1000
|
|
133
133
|
*/
|
|
134
134
|
this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
|
|
135
|
+
/**
|
|
136
|
+
* Determines whether the dropdown should flip its position when it hits the boundary.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
this.disableFlip = DEFAULTS.DISABLE_FLIP;
|
|
135
140
|
/** @internal */
|
|
136
141
|
this.displayPopover = false;
|
|
137
142
|
/** @internal */
|
|
@@ -554,28 +559,33 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
|
|
|
554
559
|
case KEYS.ENTER:
|
|
555
560
|
case KEYS.SPACE:
|
|
556
561
|
this.displayPopover = true;
|
|
562
|
+
event.preventDefault();
|
|
557
563
|
event.stopPropagation();
|
|
558
564
|
break;
|
|
559
565
|
case KEYS.HOME: {
|
|
560
566
|
this.displayPopover = true;
|
|
561
567
|
this.resetTabIndexAndSetFocusAfterUpdate(0);
|
|
568
|
+
event.preventDefault();
|
|
569
|
+
event.stopPropagation();
|
|
562
570
|
break;
|
|
563
571
|
}
|
|
564
572
|
case KEYS.END: {
|
|
565
573
|
this.displayPopover = true;
|
|
566
574
|
this.resetTabIndexAndSetFocusAfterUpdate(this.navItems.length - 1);
|
|
575
|
+
event.preventDefault();
|
|
576
|
+
event.stopPropagation();
|
|
567
577
|
break;
|
|
568
578
|
}
|
|
569
579
|
default: {
|
|
570
580
|
if (event.key.length === 1) {
|
|
571
581
|
this.displayPopover = true;
|
|
572
582
|
this.handleSelectedOptionByKeyInput(event.key);
|
|
583
|
+
event.preventDefault();
|
|
584
|
+
event.stopPropagation();
|
|
573
585
|
}
|
|
574
586
|
break;
|
|
575
587
|
}
|
|
576
588
|
}
|
|
577
|
-
event.preventDefault();
|
|
578
|
-
event.stopPropagation();
|
|
579
589
|
}
|
|
580
590
|
resetTabIndexAndSetFocusAfterUpdate(newOptionIndex) {
|
|
581
591
|
if (this.displayPopover) {
|
|
@@ -653,13 +663,13 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
|
|
|
653
663
|
>
|
|
654
664
|
${(_f = (_e = this.selectedOption) === null || _e === void 0 ? void 0 : _e.label) !== null && _f !== void 0 ? _f : this.placeholder}
|
|
655
665
|
</mdc-text>
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
666
|
+
</div>
|
|
667
|
+
<div part="icon-container">
|
|
668
|
+
<mdc-icon
|
|
669
|
+
size="1"
|
|
670
|
+
length-unit="rem"
|
|
671
|
+
name="${this.displayPopover ? ARROW_ICON.ARROW_UP : ARROW_ICON.ARROW_DOWN}"
|
|
672
|
+
></mdc-icon>
|
|
663
673
|
</div>
|
|
664
674
|
<input
|
|
665
675
|
id="${this.inputId}"
|
|
@@ -676,7 +686,7 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
|
|
|
676
686
|
aria-disabled="${ifDefined(this.disabled || this.softDisabled)}"
|
|
677
687
|
/>
|
|
678
688
|
<mdc-popover
|
|
679
|
-
trigger="
|
|
689
|
+
trigger="${TRIGGER.MANUAL}"
|
|
680
690
|
triggerid="${TRIGGER_ID}"
|
|
681
691
|
interactive
|
|
682
692
|
?visible="${this.displayPopover}"
|
|
@@ -689,6 +699,7 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
|
|
|
689
699
|
focus-trap
|
|
690
700
|
size
|
|
691
701
|
@keydown="${this.handleKeydownPopover}"
|
|
702
|
+
?disable-flip="${this.disableFlip}"
|
|
692
703
|
boundary="${ifDefined(this.boundary)}"
|
|
693
704
|
strategy="${ifDefined(this.strategy)}"
|
|
694
705
|
placement="${this.placement}"
|
|
@@ -729,6 +740,10 @@ __decorate([
|
|
|
729
740
|
property({ type: Number, reflect: true, attribute: 'popover-z-index' }),
|
|
730
741
|
__metadata("design:type", Number)
|
|
731
742
|
], Select.prototype, "popoverZIndex", void 0);
|
|
743
|
+
__decorate([
|
|
744
|
+
property({ type: Boolean, reflect: true, attribute: 'disable-flip' }),
|
|
745
|
+
__metadata("design:type", Boolean)
|
|
746
|
+
], Select.prototype, "disableFlip", void 0);
|
|
732
747
|
__decorate([
|
|
733
748
|
property({ type: String, reflect: true, attribute: 'backdrop-append-to' }),
|
|
734
749
|
__metadata("design:type", String)
|
|
@@ -6,4 +6,7 @@ declare const ARROW_ICON: {
|
|
|
6
6
|
};
|
|
7
7
|
declare const TRIGGER_ID = "select-base-triggerid";
|
|
8
8
|
declare const LISTBOX_ID = "select-listbox";
|
|
9
|
-
|
|
9
|
+
declare const DEFAULTS: {
|
|
10
|
+
readonly DISABLE_FLIP: false;
|
|
11
|
+
};
|
|
12
|
+
export { ARROW_ICON, DEFAULTS, TAG_NAME, TRIGGER_ID, LISTBOX_ID };
|
|
@@ -6,4 +6,7 @@ const ARROW_ICON = {
|
|
|
6
6
|
};
|
|
7
7
|
const TRIGGER_ID = 'select-base-triggerid';
|
|
8
8
|
const LISTBOX_ID = 'select-listbox';
|
|
9
|
-
|
|
9
|
+
const DEFAULTS = {
|
|
10
|
+
DISABLE_FLIP: false,
|
|
11
|
+
};
|
|
12
|
+
export { ARROW_ICON, DEFAULTS, TAG_NAME, TRIGGER_ID, LISTBOX_ID };
|
|
@@ -28,8 +28,10 @@ const styles = css `
|
|
|
28
28
|
z-index: -1;
|
|
29
29
|
}
|
|
30
30
|
:host::part(container) {
|
|
31
|
+
height: 2rem;
|
|
31
32
|
width: 100%;
|
|
32
33
|
position: relative;
|
|
34
|
+
display: flex;
|
|
33
35
|
}
|
|
34
36
|
:host ::slotted(mdc-selectlistbox) {
|
|
35
37
|
display: flex;
|
|
@@ -46,6 +48,7 @@ const styles = css `
|
|
|
46
48
|
gap: 0.375rem;
|
|
47
49
|
align-items: center;
|
|
48
50
|
user-select: none;
|
|
51
|
+
width: 100%;
|
|
49
52
|
}
|
|
50
53
|
:host::part(base-container):hover {
|
|
51
54
|
--mdc-select-background-color: var(--mds-color-theme-background-primary-hover);
|
|
@@ -54,8 +57,9 @@ const styles = css `
|
|
|
54
57
|
--mdc-select-background-color: var(--mds-color-theme-background-primary-active);
|
|
55
58
|
}
|
|
56
59
|
:host::part(base-text) {
|
|
57
|
-
height:
|
|
58
|
-
width
|
|
60
|
+
height: 100%;
|
|
61
|
+
/* 2rem is the complete width of dropdown icon */
|
|
62
|
+
width: calc(100% - 2rem);
|
|
59
63
|
color: var(--mdc-select-text-color);
|
|
60
64
|
overflow: hidden;
|
|
61
65
|
text-overflow: ellipsis;
|
|
@@ -68,9 +72,9 @@ const styles = css `
|
|
|
68
72
|
flex-shrink: 0;
|
|
69
73
|
}
|
|
70
74
|
:host::part(icon-container) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
padding: 0.5rem;
|
|
76
|
+
position: absolute;
|
|
77
|
+
inset-inline-end: 0%;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
/* Popover height, width & padding overrides */
|
|
@@ -58,7 +58,7 @@ class Tooltip extends Popover {
|
|
|
58
58
|
this.role = ROLE.TOOLTIP;
|
|
59
59
|
this.trigger = 'mouseenter focusin';
|
|
60
60
|
this.preventScroll = false;
|
|
61
|
-
this.
|
|
61
|
+
this.disableFlip = false;
|
|
62
62
|
this.preventScroll = false;
|
|
63
63
|
this.closeButton = false;
|
|
64
64
|
this.hideOnOutsideClick = false;
|