@momentum-design/components 0.131.1 → 0.131.3
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 +186 -181
- package/dist/browser/index.js.map +3 -3
- package/dist/components/timepicker/index.d.ts +1 -0
- package/dist/components/timepicker/index.js +1 -0
- package/dist/components/timepicker/timepicker.component.d.ts +1 -0
- package/dist/components/timepicker/timepicker.component.js +3 -3
- package/dist/components/timepicker/timepicker.styles.js +7 -1
- package/dist/custom-elements.json +5 -1
- package/dist/react/timepicker/index.d.ts +1 -0
- package/dist/react/timepicker/index.js +1 -0
- package/dist/utils/controllers/DepthManager.d.ts +4 -2
- package/dist/utils/controllers/DepthManager.js +23 -14
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ declare const TimePicker_base: import("../../utils/mixins/index.types").Construc
|
|
|
43
43
|
* @cssproperty --mdc-timepicker-border-color - Border color of the timepicker input.
|
|
44
44
|
* @cssproperty --mdc-timepicker-text-color - Text color of the timepicker input.
|
|
45
45
|
* @cssproperty --mdc-timepicker-width - Width of the timepicker component.
|
|
46
|
+
* @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.
|
|
46
47
|
*
|
|
47
48
|
* @csspart label - The label element.
|
|
48
49
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
@@ -55,6 +55,7 @@ import styles from './timepicker.styles';
|
|
|
55
55
|
* @cssproperty --mdc-timepicker-border-color - Border color of the timepicker input.
|
|
56
56
|
* @cssproperty --mdc-timepicker-text-color - Text color of the timepicker input.
|
|
57
57
|
* @cssproperty --mdc-timepicker-width - Width of the timepicker component.
|
|
58
|
+
* @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.
|
|
58
59
|
*
|
|
59
60
|
* @csspart label - The label element.
|
|
60
61
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
@@ -881,15 +882,14 @@ class TimePicker extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
|
881
882
|
}}"
|
|
882
883
|
exportparts="popover-content"
|
|
883
884
|
>
|
|
884
|
-
<
|
|
885
|
+
<mdc-selectlistbox
|
|
885
886
|
id="${LISTBOX_ID}"
|
|
886
887
|
part="listbox"
|
|
887
|
-
role="listbox"
|
|
888
888
|
aria-label="${this.localeTimeOptionsLabel}"
|
|
889
889
|
@keydown="${this.handleListboxKeydown}"
|
|
890
890
|
>
|
|
891
891
|
${this.renderTimeOptions()}
|
|
892
|
-
</
|
|
892
|
+
</mdc-selectlistbox>
|
|
893
893
|
</mdc-popover>
|
|
894
894
|
</div>
|
|
895
895
|
${this.helpText ? this.renderHelperText() : nothing}
|
|
@@ -7,6 +7,7 @@ const styles = css `
|
|
|
7
7
|
--mdc-timepicker-border-color: var(--mds-color-theme-outline-input-normal);
|
|
8
8
|
--mdc-timepicker-width: fit-content;
|
|
9
9
|
--mdc-timepicker-listbox-width: 100%;
|
|
10
|
+
--mdc-timepicker-listbox-height: 15rem;
|
|
10
11
|
|
|
11
12
|
display: flex;
|
|
12
13
|
flex-direction: column;
|
|
@@ -130,9 +131,14 @@ const styles = css `
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
/* Popover height, width & padding overrides */
|
|
134
|
+
:host mdc-popover {
|
|
135
|
+
--mdc-popover-max-width: var(--mdc-timepicker-listbox-width);
|
|
136
|
+
--mdc-popover-max-height: var(--mdc-timepicker-listbox-height);
|
|
137
|
+
min-width: max-content;
|
|
138
|
+
}
|
|
133
139
|
:host mdc-popover::part(popover-content) {
|
|
134
140
|
max-height: var(--mdc-popover-max-height);
|
|
135
|
-
min-width:
|
|
141
|
+
min-width: auto;
|
|
136
142
|
padding: 0.75rem 0.5rem;
|
|
137
143
|
}
|
|
138
144
|
|
|
@@ -45324,6 +45324,10 @@
|
|
|
45324
45324
|
"description": "Width of the timepicker component.",
|
|
45325
45325
|
"name": "--mdc-timepicker-width"
|
|
45326
45326
|
},
|
|
45327
|
+
{
|
|
45328
|
+
"description": "The max-height of the dropdown listbox. Default shows ~6 items.",
|
|
45329
|
+
"name": "--mdc-timepicker-listbox-height"
|
|
45330
|
+
},
|
|
45327
45331
|
{
|
|
45328
45332
|
"description": "Font size for the label text.",
|
|
45329
45333
|
"name": "--mdc-label-font-size",
|
|
@@ -46502,7 +46506,7 @@
|
|
|
46502
46506
|
"module": "/src/components/formfieldwrapper/formfieldwrapper.component"
|
|
46503
46507
|
},
|
|
46504
46508
|
"tagName": "mdc-timepicker",
|
|
46505
|
-
"jsDoc": "/**\n * mdc-timepicker is a component that allows users to select a specific time\n * or enter a time manually. It supports both 12-hour and 24-hour formats.\n *\n * The component consists of:\n * - label - describes the time picker field\n * - input field - made up of 2-3 spinbuttons (hours, minutes, optional AM/PM period)\n * - dropdown arrow button - opens a flyout menu with predefined time intervals\n * - helper text - displayed below the input field\n *\n * Users can input values by:\n * - Manually entering numbers/characters in spinbuttons\n * - Navigating using arrow keys to increment/decrement values\n * - Selecting a predefined time from the dropdown menu\n *\n * @tagname mdc-timepicker\n *\n * @dependency mdc-button\n * @dependency mdc-icon\n * @dependency mdc-option\n * @dependency mdc-popover\n * @dependency mdc-text\n * @dependency mdc-toggletip\n *\n * @event input - (React: onInput) This event is dispatched when the time value changes.\n * @event change - (React: onChange) This event is dispatched when the time value is committed.\n * @event focus - (React: onFocus) This event is dispatched when the timepicker receives focus.\n * @event blur - (React: onBlur) This event is dispatched when the timepicker loses focus.\n *\n * @slot label - Slot for the label element.\n * @slot toggletip - Slot for the toggletip info icon button.\n * @slot help-icon - Slot for the helper/validation icon.\n * @slot help-text - Slot for the helper/validation text.\n *\n * @cssproperty --mdc-timepicker-background-color - Background color of the timepicker input.\n * @cssproperty --mdc-timepicker-border-color - Border color of the timepicker input.\n * @cssproperty --mdc-timepicker-text-color - Text color of the timepicker input.\n * @cssproperty --mdc-timepicker-width - Width of the timepicker component.\n *\n * @csspart label - The label element.\n * @csspart label-text - The container for the label and required indicator elements.\n * @csspart required-indicator - The required indicator element.\n * @csspart info-icon-btn - The info icon button element.\n * @csspart label-toggletip - The toggletip element.\n * @csspart help-text - The helper/validation text element.\n * @csspart helper-icon - The helper/validation icon element.\n * @csspart help-text-container - The container for helper/validation elements.\n * @csspart container - The outer container for the input and popover.\n * @csspart base-container - The input container with border and background.\n * @csspart spinbutton-group - The container for spinbutton elements.\n * @csspart spinbutton - A spinbutton input element.\n * @csspart separator - The colon separator between spinbuttons.\n * @csspart period - The AM/PM period spinbutton.\n * @csspart icon-container - The dropdown arrow button container.\n * @csspart native-input - The hidden native input for form participation.\n * @csspart listbox - The dropdown list container.\n */",
|
|
46509
|
+
"jsDoc": "/**\n * mdc-timepicker is a component that allows users to select a specific time\n * or enter a time manually. It supports both 12-hour and 24-hour formats.\n *\n * The component consists of:\n * - label - describes the time picker field\n * - input field - made up of 2-3 spinbuttons (hours, minutes, optional AM/PM period)\n * - dropdown arrow button - opens a flyout menu with predefined time intervals\n * - helper text - displayed below the input field\n *\n * Users can input values by:\n * - Manually entering numbers/characters in spinbuttons\n * - Navigating using arrow keys to increment/decrement values\n * - Selecting a predefined time from the dropdown menu\n *\n * @tagname mdc-timepicker\n *\n * @dependency mdc-button\n * @dependency mdc-icon\n * @dependency mdc-option\n * @dependency mdc-popover\n * @dependency mdc-text\n * @dependency mdc-toggletip\n *\n * @event input - (React: onInput) This event is dispatched when the time value changes.\n * @event change - (React: onChange) This event is dispatched when the time value is committed.\n * @event focus - (React: onFocus) This event is dispatched when the timepicker receives focus.\n * @event blur - (React: onBlur) This event is dispatched when the timepicker loses focus.\n *\n * @slot label - Slot for the label element.\n * @slot toggletip - Slot for the toggletip info icon button.\n * @slot help-icon - Slot for the helper/validation icon.\n * @slot help-text - Slot for the helper/validation text.\n *\n * @cssproperty --mdc-timepicker-background-color - Background color of the timepicker input.\n * @cssproperty --mdc-timepicker-border-color - Border color of the timepicker input.\n * @cssproperty --mdc-timepicker-text-color - Text color of the timepicker input.\n * @cssproperty --mdc-timepicker-width - Width of the timepicker component.\n * @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.\n *\n * @csspart label - The label element.\n * @csspart label-text - The container for the label and required indicator elements.\n * @csspart required-indicator - The required indicator element.\n * @csspart info-icon-btn - The info icon button element.\n * @csspart label-toggletip - The toggletip element.\n * @csspart help-text - The helper/validation text element.\n * @csspart helper-icon - The helper/validation icon element.\n * @csspart help-text-container - The container for helper/validation elements.\n * @csspart container - The outer container for the input and popover.\n * @csspart base-container - The input container with border and background.\n * @csspart spinbutton-group - The container for spinbutton elements.\n * @csspart spinbutton - A spinbutton input element.\n * @csspart separator - The colon separator between spinbuttons.\n * @csspart period - The AM/PM period spinbutton.\n * @csspart icon-container - The dropdown arrow button container.\n * @csspart native-input - The hidden native input for form participation.\n * @csspart listbox - The dropdown list container.\n */",
|
|
46506
46510
|
"customElement": true
|
|
46507
46511
|
}
|
|
46508
46512
|
],
|
|
@@ -39,6 +39,7 @@ import type { Events } from '../../components/timepicker/timepicker.types';
|
|
|
39
39
|
* @cssproperty --mdc-timepicker-border-color - Border color of the timepicker input.
|
|
40
40
|
* @cssproperty --mdc-timepicker-text-color - Text color of the timepicker input.
|
|
41
41
|
* @cssproperty --mdc-timepicker-width - Width of the timepicker component.
|
|
42
|
+
* @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.
|
|
42
43
|
*
|
|
43
44
|
* @csspart label - The label element.
|
|
44
45
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
@@ -40,6 +40,7 @@ import { TAG_NAME } from '../../components/timepicker/timepicker.constants';
|
|
|
40
40
|
* @cssproperty --mdc-timepicker-border-color - Border color of the timepicker input.
|
|
41
41
|
* @cssproperty --mdc-timepicker-text-color - Text color of the timepicker input.
|
|
42
42
|
* @cssproperty --mdc-timepicker-width - Width of the timepicker component.
|
|
43
|
+
* @cssproperty --mdc-timepicker-listbox-height - The max-height of the dropdown listbox. Default shows ~6 items.
|
|
43
44
|
*
|
|
44
45
|
* @csspart label - The label element.
|
|
45
46
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
@@ -153,7 +153,7 @@ export declare class DepthManager implements ReactiveController {
|
|
|
153
153
|
* Removes one or more elements from the stack without popping others.
|
|
154
154
|
*
|
|
155
155
|
* It notifies the elements on the stack which were removed and those which changed position.
|
|
156
|
-
* Items removed in
|
|
156
|
+
* Items removed in batch, notify moved items only once.
|
|
157
157
|
*
|
|
158
158
|
* @param elements - Popover instance
|
|
159
159
|
* @returns undefined when the element was not found, the removed element otherwise
|
|
@@ -183,7 +183,9 @@ export declare class DepthManager implements ReactiveController {
|
|
|
183
183
|
* Gets the z-index of the element in the stack
|
|
184
184
|
* @param element - The element to get the z-index of
|
|
185
185
|
*
|
|
186
|
-
* @returns The z-index of the element if found, otherwise returns
|
|
186
|
+
* @returns The z-index of the element if found, otherwise returns BASE_Z_INDEX as a safe fallback.
|
|
187
|
+
* This prevents a visual flash where the overlay renders behind the page content
|
|
188
|
+
* on the first render cycle, before `pushHost()` runs in `updated()`.
|
|
187
189
|
*/
|
|
188
190
|
getItemZIndex(element: StackedOverlayComponent): number;
|
|
189
191
|
/**
|
|
@@ -126,16 +126,20 @@ export class DepthManager {
|
|
|
126
126
|
* @returns The item if it was in the stack, undefined otherwise
|
|
127
127
|
*/
|
|
128
128
|
popItem(item) {
|
|
129
|
-
if (this.has(item)) {
|
|
130
|
-
|
|
131
|
-
this.popUntil((it, idx) => {
|
|
132
|
-
// This can handle the case when multiple overlays share the same trigger (id), e.g.: tooltip, etc.
|
|
133
|
-
if (it !== item && it.triggerID === item.triggerID)
|
|
134
|
-
return 'skip';
|
|
135
|
-
return idx !== untilItemIdx;
|
|
136
|
-
});
|
|
129
|
+
if (!this.has(item)) {
|
|
130
|
+
return undefined;
|
|
137
131
|
}
|
|
138
|
-
|
|
132
|
+
const itemIdx = elementStack.indexOf(item);
|
|
133
|
+
const toRemove = [];
|
|
134
|
+
for (let i = elementStack.length - 1; i >= itemIdx; i -= 1) {
|
|
135
|
+
const it = elementStack[i];
|
|
136
|
+
// Skip siblings that share the same trigger (e.g.: tooltip + popover on same trigger)
|
|
137
|
+
if (it === item || it.triggerID !== item.triggerID) {
|
|
138
|
+
toRemove.push(it);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
this.remove(toRemove);
|
|
142
|
+
return item;
|
|
139
143
|
}
|
|
140
144
|
/**
|
|
141
145
|
* Removes the last element from the stack
|
|
@@ -181,7 +185,7 @@ export class DepthManager {
|
|
|
181
185
|
* Removes one or more elements from the stack without popping others.
|
|
182
186
|
*
|
|
183
187
|
* It notifies the elements on the stack which were removed and those which changed position.
|
|
184
|
-
* Items removed in
|
|
188
|
+
* Items removed in batch, notify moved items only once.
|
|
185
189
|
*
|
|
186
190
|
* @param elements - Popover instance
|
|
187
191
|
* @returns undefined when the element was not found, the removed element otherwise
|
|
@@ -190,10 +194,13 @@ export class DepthManager {
|
|
|
190
194
|
var _a, _b;
|
|
191
195
|
const removedElements = elements.filter(el => elementStack.includes(el));
|
|
192
196
|
const updateStackFrom = removedElements.reduce((idx, el) => Math.min(idx, elementStack.indexOf(el)), Infinity);
|
|
193
|
-
// Remove elements from the stack
|
|
197
|
+
// Remove all elements from the stack first, before any notifications,
|
|
198
|
+
// to prevent re-entrant mutations from corrupting indices.
|
|
194
199
|
removedElements.forEach(el => {
|
|
195
|
-
var _a;
|
|
196
200
|
elementStack.splice(elementStack.indexOf(el), 1);
|
|
201
|
+
});
|
|
202
|
+
removedElements.forEach(el => {
|
|
203
|
+
var _a;
|
|
197
204
|
(_a = el === null || el === void 0 ? void 0 : el.onComponentStackChanged) === null || _a === void 0 ? void 0 : _a.call(el, 'removed');
|
|
198
205
|
});
|
|
199
206
|
// Notify elements about the move
|
|
@@ -234,11 +241,13 @@ export class DepthManager {
|
|
|
234
241
|
* Gets the z-index of the element in the stack
|
|
235
242
|
* @param element - The element to get the z-index of
|
|
236
243
|
*
|
|
237
|
-
* @returns The z-index of the element if found, otherwise returns
|
|
244
|
+
* @returns The z-index of the element if found, otherwise returns BASE_Z_INDEX as a safe fallback.
|
|
245
|
+
* This prevents a visual flash where the overlay renders behind the page content
|
|
246
|
+
* on the first render cycle, before `pushHost()` runs in `updated()`.
|
|
238
247
|
*/
|
|
239
248
|
getItemZIndex(element) {
|
|
240
249
|
const depth = this.getElementDepth(element);
|
|
241
|
-
return depth >= 0 ? BASE_Z_INDEX + depth * NUMBER_OF_Z_INDEX_LEVELS_PER_ELEMENT :
|
|
250
|
+
return depth >= 0 ? BASE_Z_INDEX + depth * NUMBER_OF_Z_INDEX_LEVELS_PER_ELEMENT : BASE_Z_INDEX;
|
|
242
251
|
}
|
|
243
252
|
/**
|
|
244
253
|
* Checks if host is at the top of the stack
|