@melodicdev/components 4.0.1 → 4.1.0
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 +4 -4
- package/assets/fonts/phosphor/phosphor.css +5 -25
- package/assets/melodic-components.css +50 -25
- package/assets/melodic-components.js +5370 -4233
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.css +1 -21
- package/assets/melodic-components.min.js +1808 -26662
- package/lib/components/data-display/calendar-view/calendar-view.styles.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.styles.js +14 -0
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +43 -2
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +94 -8
- package/lib/components/data-display/data-grid/data-grid.styles.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.styles.js +17 -0
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +19 -10
- package/lib/components/data-display/data-grid/index.d.ts +1 -0
- package/lib/components/data-display/data-grid/index.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.js +1 -1
- package/lib/components/data-display/table/index.d.ts +1 -0
- package/lib/components/data-display/table/index.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.d.ts +16 -0
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +28 -3
- package/lib/components/data-display/table/table.styles.d.ts.map +1 -1
- package/lib/components/data-display/table/table.styles.js +7 -1
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +8 -6
- package/lib/components/data-display/table-core/index.d.ts +2 -2
- package/lib/components/data-display/table-core/index.d.ts.map +1 -1
- package/lib/components/data-display/table-core/index.js +1 -1
- package/lib/components/data-display/table-core/table-core.d.ts +16 -2
- package/lib/components/data-display/table-core/table-core.d.ts.map +1 -1
- package/lib/components/data-display/table-core/table-core.js +32 -5
- package/lib/components/data-display/tag/tag.styles.d.ts.map +1 -1
- package/lib/components/data-display/tag/tag.styles.js +11 -4
- package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.styles.js +11 -0
- package/lib/components/feedback/toast/index.d.ts +1 -0
- package/lib/components/feedback/toast/index.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.styles.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.styles.js +20 -0
- package/lib/components/feedback/toast/toast.component.d.ts +16 -0
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +63 -5
- package/lib/components/feedback/toast/toast.service.d.ts +14 -0
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +41 -0
- package/lib/components/feedback/toast/toast.styles.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.styles.js +6 -0
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +14 -4
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +40 -96
- package/lib/components/forms/autocomplete/autocomplete.styles.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.styles.js +22 -6
- package/lib/components/forms/autocomplete/autocomplete.template.js +7 -1
- package/lib/components/forms/button/button.styles.d.ts.map +1 -1
- package/lib/components/forms/button/button.styles.js +11 -0
- package/lib/components/forms/button-group/button-group-item.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group-item.styles.js +11 -0
- package/lib/components/forms/button-group/button-group.styles.js +2 -2
- package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.styles.js +13 -2
- package/lib/components/forms/date-picker/calendar.component.d.ts +20 -7
- package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.component.js +88 -13
- package/lib/components/forms/date-picker/calendar.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.styles.js +19 -0
- package/lib/components/forms/date-picker/date-picker.component.d.ts +2 -3
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +70 -18
- package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.styles.js +12 -1
- package/lib/components/forms/date-time-picker/date-time-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-time-picker/date-time-picker.styles.js +12 -1
- package/lib/components/forms/date-time-picker/tz-utils.d.ts.map +1 -1
- package/lib/components/forms/date-time-picker/tz-utils.js +24 -3
- package/lib/components/forms/file-upload/file-upload-item.styles.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload-item.styles.js +13 -1
- package/lib/components/forms/file-upload/file-upload.styles.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.styles.js +11 -0
- package/lib/components/forms/form-field/form-field.component.d.ts +18 -1
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +55 -16
- package/lib/components/forms/form-field/form-field.styles.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.styles.js +15 -2
- package/lib/components/forms/input/input.styles.d.ts.map +1 -1
- package/lib/components/forms/input/input.styles.js +12 -1
- package/lib/components/forms/listbox-core/index.d.ts +3 -0
- package/lib/components/forms/listbox-core/index.d.ts.map +1 -0
- package/lib/components/forms/listbox-core/index.js +2 -0
- package/lib/components/forms/listbox-core/listbox-core.d.ts +57 -0
- package/lib/components/forms/listbox-core/listbox-core.d.ts.map +1 -0
- package/lib/components/forms/listbox-core/listbox-core.js +168 -0
- package/lib/components/forms/radio/radio-group.styles.js +1 -1
- package/lib/components/forms/radio/radio.styles.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.styles.js +12 -1
- package/lib/components/forms/radio-card-group/radio-card-group.styles.js +1 -1
- package/lib/components/forms/radio-card-group/radio-card.styles.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card.styles.js +11 -0
- package/lib/components/forms/select/select.component.d.ts +12 -4
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +41 -110
- package/lib/components/forms/select/select.styles.d.ts.map +1 -1
- package/lib/components/forms/select/select.styles.js +23 -6
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +25 -9
- package/lib/components/forms/slider/slider.component.js +1 -1
- package/lib/components/forms/slider/slider.styles.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.styles.js +11 -0
- package/lib/components/forms/slider/slider.template.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.template.js +5 -1
- package/lib/components/forms/textarea/textarea.styles.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.styles.js +13 -2
- package/lib/components/forms/time-picker/time-picker.component.d.ts +1 -2
- package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.component.js +8 -17
- package/lib/components/forms/time-picker/time-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.styles.js +23 -3
- package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.styles.js +13 -2
- package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
- package/lib/components/foundation/card/card.styles.js +11 -0
- package/lib/components/foundation/container/container.styles.js +4 -4
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +5 -3
- package/lib/components/navigation/sidebar/sidebar-item.styles.js +4 -4
- package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar.styles.js +5 -5
- package/lib/components/navigation/sidebar/sidebar.template.js +2 -2
- package/lib/components/navigation/steps/step.styles.js +3 -3
- package/lib/components/navigation/steps/steps.styles.js +3 -3
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +4 -1
- package/lib/components/navigation/tabs/tabs.styles.js +8 -8
- package/lib/components/overlays/dialog/dialog.component.d.ts +15 -2
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +33 -1
- package/lib/components/overlays/dialog/dialog.service.d.ts +8 -2
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +1 -0
- package/lib/components/overlays/dialog/index.d.ts +1 -0
- package/lib/components/overlays/dialog/index.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.d.ts +18 -3
- package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.js +59 -16
- package/lib/components/overlays/dropdown/dropdown-item.styles.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.styles.js +12 -0
- package/lib/components/overlays/popover/popover.component.d.ts +12 -0
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +28 -1
- package/lib/components/overlays/popover/popover.template.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.template.js +2 -0
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +8 -5
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +10 -3
- package/lib/components/sections/app-shell/app-shell.styles.js +1 -1
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +22 -3
- package/lib/theme/presets/base.preset.d.ts.map +1 -1
- package/lib/theme/presets/base.preset.js +17 -0
- package/lib/theme/presets/dark.preset.d.ts +8 -0
- package/lib/theme/presets/dark.preset.d.ts.map +1 -1
- package/lib/theme/presets/dark.preset.js +9 -0
- package/lib/theme/presets/light.preset.d.ts +6 -0
- package/lib/theme/presets/light.preset.d.ts.map +1 -1
- package/lib/theme/presets/light.preset.js +7 -0
- package/lib/theme/tokens/all-tokens.d.ts +10 -0
- package/lib/theme/tokens/all-tokens.d.ts.map +1 -1
- package/lib/theme/tokens/colors.tokens.d.ts +8 -0
- package/lib/theme/tokens/colors.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/colors.tokens.js +11 -0
- package/lib/theme/tokens/transitions.tokens.d.ts +1 -0
- package/lib/theme/tokens/transitions.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/transitions.tokens.js +3 -0
- package/lib/theme/tokens/typography.tokens.d.ts +1 -0
- package/lib/theme/tokens/typography.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/typography.tokens.js +1 -0
- package/lib/utils/accessibility/cross-root-aria.d.ts +16 -8
- package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -1
- package/lib/utils/accessibility/cross-root-aria.js +58 -22
- package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.js +9 -19
- package/lib/utils/accessibility/focus-utils.d.ts +10 -1
- package/lib/utils/accessibility/focus-utils.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-utils.js +48 -14
- package/lib/utils/accessibility/index.d.ts +2 -1
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -1
- package/lib/utils/positioning/compute-position.d.ts +6 -1
- package/lib/utils/positioning/compute-position.d.ts.map +1 -1
- package/lib/utils/positioning/compute-position.js +3 -2
- package/lib/utils/positioning/middlewares/flip.middleware.js +2 -51
- package/package.json +8 -5
- package/assets/fonts/phosphor/Phosphor-Bold.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Bold.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Bold.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Fill.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Fill.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Fill.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Light.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Light.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Light.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Thin.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Thin.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Thin.woff +0 -0
- package/assets/fonts/phosphor/Phosphor.svg +0 -3056
- package/assets/fonts/phosphor/Phosphor.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor.woff +0 -0
|
@@ -28,40 +28,93 @@ function formatDisplayDate(iso, locale) {
|
|
|
28
28
|
if (!match)
|
|
29
29
|
return iso ?? '';
|
|
30
30
|
const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
|
31
|
-
return
|
|
31
|
+
return dateFormatter(locale).format(date);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Short numeric date formatter for `locale` (the browser's when empty).
|
|
35
|
+
* An unknown or malformed locale tag falls back to the browser's instead of
|
|
36
|
+
* throwing out of the render.
|
|
37
|
+
*/
|
|
38
|
+
function dateFormatter(locale) {
|
|
39
|
+
const options = { year: 'numeric', month: '2-digit', day: '2-digit' };
|
|
40
|
+
try {
|
|
41
|
+
return new Intl.DateTimeFormat(locale || undefined, options);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return new Intl.DateTimeFormat(undefined, options);
|
|
45
|
+
}
|
|
32
46
|
}
|
|
33
47
|
/** Order of the numeric parts in `locale`'s short date format. */
|
|
34
48
|
function localeDateOrder(locale) {
|
|
35
|
-
const parts =
|
|
49
|
+
const parts = dateFormatter(locale).formatToParts(new Date(2001, 1, 3));
|
|
36
50
|
return parts
|
|
37
51
|
.filter((part) => part.type === 'year' || part.type === 'month' || part.type === 'day')
|
|
38
52
|
.map((part) => part.type);
|
|
39
53
|
}
|
|
40
54
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
55
|
+
* Map every Unicode decimal digit to ASCII and drop bidi control marks, so
|
|
56
|
+
* text in the locale's own numbering system (`٠٣/٠٢/٢٠٠١`) parses.
|
|
57
|
+
*/
|
|
58
|
+
function normalizeDateText(text) {
|
|
59
|
+
return text
|
|
60
|
+
.replace(/[\u200e\u200f\u061c]/g, '')
|
|
61
|
+
.replace(/\p{Nd}/gu, (digit) => {
|
|
62
|
+
if (digit >= '0' && digit <= '9')
|
|
63
|
+
return digit;
|
|
64
|
+
// Decimal-digit blocks are contiguous runs of ten starting at zero.
|
|
65
|
+
const code = digit.codePointAt(0);
|
|
66
|
+
for (let zero = code; zero > code - 10; zero--) {
|
|
67
|
+
if (!/\p{Nd}/u.test(String.fromCodePoint(zero - 1))) {
|
|
68
|
+
return String(code - zero);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return digit;
|
|
72
|
+
})
|
|
73
|
+
.trim();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse typed text into an ISO date (YYYY-MM-DD). Returns null when invalid.
|
|
77
|
+
*
|
|
78
|
+
* Accepts `YYYY-MM-DD` and the locale's own short date — whatever
|
|
79
|
+
* `formatDisplayDate` produces must parse back, or simply re-committing the
|
|
80
|
+
* field's own text reverts it. That includes formats whose separators are not
|
|
81
|
+
* a single `/`, `.` or `-` (`2001. 02. 03.` in ko-KR / hu-HU), trailing
|
|
82
|
+
* literals (`03.02.2001 г.` in bg) and non-ASCII digits (ar-EG).
|
|
43
83
|
*/
|
|
44
84
|
function parseDateInput(text, locale) {
|
|
45
|
-
const trimmed = text
|
|
85
|
+
const trimmed = normalizeDateText(text);
|
|
46
86
|
let year;
|
|
47
87
|
let month;
|
|
48
88
|
let day;
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
year = Number(
|
|
52
|
-
month = Number(
|
|
53
|
-
day = Number(
|
|
89
|
+
const iso = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(trimmed);
|
|
90
|
+
if (iso) {
|
|
91
|
+
year = Number(iso[1]);
|
|
92
|
+
month = Number(iso[2]);
|
|
93
|
+
day = Number(iso[3]);
|
|
54
94
|
}
|
|
55
95
|
else {
|
|
56
|
-
//
|
|
57
|
-
// a user typing 03/02/2001 in en-GB means 3 February.
|
|
58
|
-
|
|
59
|
-
if (!
|
|
96
|
+
// Three numeric groups in the locale's own order rather than assuming
|
|
97
|
+
// MM/DD/YYYY — a user typing 03/02/2001 in en-GB means 3 February.
|
|
98
|
+
const groups = trimmed.match(/\d+/g);
|
|
99
|
+
if (!groups || groups.length !== 3 || groups.some((group) => group.length > 4))
|
|
60
100
|
return null;
|
|
101
|
+
// Whatever sits between/around the numbers must be punctuation or
|
|
102
|
+
// the locale's own literal text — not stray words or signs.
|
|
103
|
+
const literalChars = new Set();
|
|
104
|
+
for (const part of dateFormatter(locale).formatToParts(new Date(2001, 1, 3))) {
|
|
105
|
+
if (part.type === 'literal') {
|
|
106
|
+
for (const char of normalizeDateText(part.value))
|
|
107
|
+
literalChars.add(char);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const char of trimmed.replace(/\d+/g, '')) {
|
|
111
|
+
if (!/[\s./,-]/.test(char) && !literalChars.has(char))
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
61
114
|
const order = localeDateOrder(locale);
|
|
62
115
|
const values = { year: 0, month: 0, day: 0 };
|
|
63
116
|
order.forEach((part, index) => {
|
|
64
|
-
values[part] = Number(
|
|
117
|
+
values[part] = Number(groups[index]);
|
|
65
118
|
});
|
|
66
119
|
year = values.year;
|
|
67
120
|
month = values.month;
|
|
@@ -80,7 +133,7 @@ function parseDateInput(text, locale) {
|
|
|
80
133
|
/**
|
|
81
134
|
* ml-date-picker - Date input with calendar dropdown
|
|
82
135
|
*
|
|
83
|
-
* Users can type a date directly into the input (
|
|
136
|
+
* Users can type a date directly into the input (the locale's short date or `YYYY-MM-DD`)
|
|
84
137
|
* or pick from the custom calendar popover. The input is a plain text field so
|
|
85
138
|
* the native browser date picker never competes with the custom calendar.
|
|
86
139
|
* `value` is always the ISO date (`YYYY-MM-DD`).
|
|
@@ -113,8 +166,7 @@ let DatePickerComponent = class DatePickerComponent {
|
|
|
113
166
|
this.required = false;
|
|
114
167
|
/**
|
|
115
168
|
* BCP 47 locale for the displayed and accepted date format. Defaults to
|
|
116
|
-
* the
|
|
117
|
-
* hardcoded MM/DD/YYYY.
|
|
169
|
+
* the browser's locale — the format used to be hardcoded MM/DD/YYYY.
|
|
118
170
|
*/
|
|
119
171
|
this.locale = '';
|
|
120
172
|
/** Minimum selectable date (YYYY-MM-DD) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/date-picker.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"date-picker.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/date-picker.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,iDAkP5B,CAAC"}
|
|
@@ -78,7 +78,7 @@ export const datePickerStyles = () => css `
|
|
|
78
78
|
|
|
79
79
|
.ml-date-picker__required {
|
|
80
80
|
color: var(--ml-date-picker-required-color, var(--ml-color-danger));
|
|
81
|
-
margin-
|
|
81
|
+
margin-inline-start: var(--ml-space-0-5);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/* Trigger wrapper */
|
|
@@ -230,4 +230,15 @@ export const datePickerStyles = () => css `
|
|
|
230
230
|
.ml-date-picker__error {
|
|
231
231
|
color: var(--ml-date-picker-error-color, var(--ml-color-danger));
|
|
232
232
|
}
|
|
233
|
+
|
|
234
|
+
/*
|
|
235
|
+
* Forced colors (Windows High Contrast): box-shadow rings and background
|
|
236
|
+
* highlights are not painted there, so focus falls back to a real outline.
|
|
237
|
+
*/
|
|
238
|
+
@media (forced-colors: active) {
|
|
239
|
+
.ml-date-picker__trigger:focus-within {
|
|
240
|
+
outline: 2px solid Highlight;
|
|
241
|
+
outline-offset: 2px;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
233
244
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time-picker.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-time-picker/date-time-picker.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"date-time-picker.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-time-picker/date-time-picker.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,iDAgLhC,CAAC"}
|
|
@@ -72,7 +72,7 @@ export const dateTimePickerStyles = () => css `
|
|
|
72
72
|
|
|
73
73
|
.ml-date-time-picker__required {
|
|
74
74
|
color: var(--ml-date-time-picker-required-color, var(--ml-color-danger));
|
|
75
|
-
margin-
|
|
75
|
+
margin-inline-start: var(--ml-space-0-5);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/* Unified row -- acts as the single input border */
|
|
@@ -164,4 +164,15 @@ export const dateTimePickerStyles = () => css `
|
|
|
164
164
|
.ml-date-time-picker__error {
|
|
165
165
|
color: var(--ml-date-time-picker-error-color, var(--ml-color-danger));
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* Forced colors (Windows High Contrast): box-shadow rings and background
|
|
170
|
+
* highlights are not painted there, so focus falls back to a real outline.
|
|
171
|
+
*/
|
|
172
|
+
@media (forced-colors: active) {
|
|
173
|
+
.ml-date-time-picker__row:focus-within {
|
|
174
|
+
outline: 2px solid Highlight;
|
|
175
|
+
outline-offset: 2px;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
167
178
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tz-utils.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-time-picker/tz-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tz-utils.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-time-picker/tz-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAMvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAoCD,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgCrE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM3E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,mBAAmB,GACzB,MAAM,CAWR;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI9E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,GAAE,mBAA6B,GAAG;IACvF,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACd,CAYA"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* VTIMEZONE behavior and the default in major calendar apps.
|
|
17
17
|
*/
|
|
18
18
|
const NAIVE_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2})?$/;
|
|
19
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
19
20
|
const UTC_RE = /(?:Z|[+-]\d{2}:?\d{2})$/;
|
|
20
21
|
export function isUtcIsoString(value) {
|
|
21
22
|
return !!value && UTC_RE.test(value);
|
|
@@ -67,9 +68,29 @@ export function naiveToUtcIso(naive, timeZone) {
|
|
|
67
68
|
const naiveAsUtc = new Date(`${padded}Z`);
|
|
68
69
|
if (Number.isNaN(naiveAsUtc.getTime()))
|
|
69
70
|
return '';
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// The zone's offset has to be the one in force at the REAL instant, which
|
|
72
|
+
// is what we are solving for. Reading it at `naiveAsUtc` (the wall clock
|
|
73
|
+
// misread as UTC) is off by the zone's own offset, so for several hours
|
|
74
|
+
// around every DST transition it picked the wrong side of the change and
|
|
75
|
+
// the result was an hour out.
|
|
76
|
+
//
|
|
77
|
+
// Probe a day either side — far enough to bracket any transition near the
|
|
78
|
+
// wall clock — to get the offset before and after, then keep the
|
|
79
|
+
// candidate(s) that actually round-trip to the requested wall clock.
|
|
80
|
+
const naiveMs = naiveAsUtc.getTime();
|
|
81
|
+
const before = getZoneOffsetMs(new Date(naiveMs - DAY_MS), timeZone);
|
|
82
|
+
const after = getZoneOffsetMs(new Date(naiveMs + DAY_MS), timeZone);
|
|
83
|
+
const candidates = (before === after ? [before] : [before, after])
|
|
84
|
+
.map((offset) => ({ offset, instant: naiveMs - offset }))
|
|
85
|
+
.filter(({ offset, instant }) => getZoneOffsetMs(new Date(instant), timeZone) === offset)
|
|
86
|
+
.map(({ instant }) => instant);
|
|
87
|
+
if (candidates.length > 0) {
|
|
88
|
+
// Two matches = fall-back ambiguity: the first occurrence wins.
|
|
89
|
+
return new Date(Math.min(...candidates)).toISOString();
|
|
90
|
+
}
|
|
91
|
+
// No match = spring-forward gap (the wall clock does not exist). Applying
|
|
92
|
+
// the pre-transition offset lands on the post-jump wall clock.
|
|
93
|
+
return new Date(naiveMs - before).toISOString();
|
|
73
94
|
}
|
|
74
95
|
/**
|
|
75
96
|
* Convert a UTC instant (Date or ISO string) to a naive wall-clock string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload-item.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/file-upload/file-upload-item.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"file-upload-item.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/file-upload/file-upload-item.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,iDAsLhC,CAAC"}
|
|
@@ -116,7 +116,7 @@ export const fileUploadItemStyles = () => css `
|
|
|
116
116
|
font-weight: var(--ml-font-medium);
|
|
117
117
|
color: var(--ml-color-text-secondary);
|
|
118
118
|
min-width: 32px;
|
|
119
|
-
text-align:
|
|
119
|
+
text-align: end;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/* Status row */
|
|
@@ -169,4 +169,16 @@ export const fileUploadItemStyles = () => css `
|
|
|
169
169
|
.ml-file-item--complete {
|
|
170
170
|
border-color: var(--ml-color-success);
|
|
171
171
|
}
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
* Forced colors (Windows High Contrast): box-shadow rings and background
|
|
175
|
+
* highlights are not painted there, so focus falls back to a real outline.
|
|
176
|
+
*/
|
|
177
|
+
@media (forced-colors: active) {
|
|
178
|
+
.ml-file-item__remove:focus-visible,
|
|
179
|
+
.ml-file-item__retry:focus-visible {
|
|
180
|
+
outline: 2px solid Highlight;
|
|
181
|
+
outline-offset: 2px;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
172
184
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/file-upload/file-upload.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"file-upload.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/file-upload/file-upload.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,iDAgM5B,CAAC"}
|
|
@@ -180,4 +180,15 @@ export const fileUploadStyles = () => css `
|
|
|
180
180
|
border-color: var(--ml-file-upload-disabled-border-color, var(--ml-color-border));
|
|
181
181
|
background-color: var(--ml-file-upload-disabled-bg, var(--ml-color-input-disabled-bg));
|
|
182
182
|
}
|
|
183
|
+
|
|
184
|
+
/*
|
|
185
|
+
* Forced colors (Windows High Contrast): box-shadow rings and background
|
|
186
|
+
* highlights are not painted there, so focus falls back to a real outline.
|
|
187
|
+
*/
|
|
188
|
+
@media (forced-colors: active) {
|
|
189
|
+
.ml-file-upload__dropzone:focus-visible {
|
|
190
|
+
outline: 2px solid Highlight;
|
|
191
|
+
outline-offset: 2px;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
183
194
|
`;
|
|
@@ -53,8 +53,25 @@ export declare class FormFieldComponent implements IElementRef, OnCreate, OnRend
|
|
|
53
53
|
private _control;
|
|
54
54
|
private _controlResolved;
|
|
55
55
|
private connectSlottedControl;
|
|
56
|
-
/**
|
|
56
|
+
/** The rendered error/hint elements that describe the control. */
|
|
57
|
+
private getDescribers;
|
|
58
|
+
/** Describe the control with the hint/error across the shadow boundary. */
|
|
57
59
|
private syncDescription;
|
|
60
|
+
/** ARIA attributes this field has put on a nested (shadow) control. */
|
|
61
|
+
private readonly _innerOwned;
|
|
62
|
+
private _innerControl;
|
|
63
|
+
/**
|
|
64
|
+
* Mirror the field's ARIA state onto the element that actually takes
|
|
65
|
+
* focus. For a slotted `<ml-input>` / `<ml-select>` that is a control
|
|
66
|
+
* inside the component's own shadow root; ARIA on the host element alone
|
|
67
|
+
* is not announced when focus is on the inner control.
|
|
68
|
+
*
|
|
69
|
+
* The inner control belongs to another component, which may manage the
|
|
70
|
+
* same attributes itself — so only ever add our state, and only remove
|
|
71
|
+
* what we added.
|
|
72
|
+
*/
|
|
73
|
+
private syncInnerControl;
|
|
74
|
+
private syncOwnedAttribute;
|
|
58
75
|
/**
|
|
59
76
|
* Focus the slotted control when the label is clicked. `<label for=…>` can
|
|
60
77
|
* only target an element in the same tree, so the label's `for` never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAKlE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAMa,kBAAmB,YAAW,WAAW,EAAE,QAAQ,EAAE,QAAQ;IAClE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,wCAAwC;IACjC,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,yBAAyB;IAClB,WAAW,EAAE,oBAAoB,CAAc;IAEtD,qBAAqB;IACd,QAAQ,UAAS;IAExB,+BAA+B;IACxB,QAAQ,UAAS;IAExB,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6D;IAEtF,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,WAAW,IAAI,MAAM,CAM/B;IAEM,QAAQ,IAAI,IAAI;IAIhB,QAAQ,IAAI,IAAI;IAOhB,gBAAgB,QAAO,IAAI,CAGhC;IAEF;;;sCAGkC;IAClC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,qBAAqB;IAyC7B,kEAAkE;IAClE,OAAO,CAAC,aAAa;IAOrB,2EAA2E;IAC3E,OAAO,CAAC,eAAe;IAIvB,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,aAAa,CAA4B;IAEjD;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,kBAAkB;IAY1B;;;;OAIG;IACI,gBAAgB,GAAI,OAAO,KAAK,KAAG,IAAI,CAG5C;IAEF,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;CAqCvB"}
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
8
|
import { formFieldTemplate } from './form-field.template.js';
|
|
9
9
|
import { formFieldStyles } from './form-field.styles.js';
|
|
10
|
+
import { setCrossRootDescription, getFocusableControl } from '../../../utils/accessibility/cross-root-aria.js';
|
|
10
11
|
/**
|
|
11
12
|
* ml-form-field - Wrapper component that adds label, hint, and error to any form control
|
|
12
13
|
*
|
|
@@ -55,6 +56,9 @@ let FormFieldComponent = class FormFieldComponent {
|
|
|
55
56
|
* doesn't re-assign the slot). */
|
|
56
57
|
this._control = null;
|
|
57
58
|
this._controlResolved = false;
|
|
59
|
+
/** ARIA attributes this field has put on a nested (shadow) control. */
|
|
60
|
+
this._innerOwned = new Set();
|
|
61
|
+
this._innerControl = null;
|
|
58
62
|
/**
|
|
59
63
|
* Focus the slotted control when the label is clicked. `<label for=…>` can
|
|
60
64
|
* only target an element in the same tree, so the label's `for` never
|
|
@@ -111,13 +115,14 @@ let FormFieldComponent = class FormFieldComponent {
|
|
|
111
115
|
control.id = this.fieldId;
|
|
112
116
|
}
|
|
113
117
|
// The hint and error live in THIS component's shadow root while the
|
|
114
|
-
// control is in the light DOM, so an `aria-describedby` IDREF
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
+
// control is in the light DOM, so neither an `aria-describedby` IDREF
|
|
119
|
+
// nor an element reference from the control can reach them (references
|
|
120
|
+
// only resolve into the same or an ancestor tree). Their text is
|
|
121
|
+
// carried on the control as `aria-description` instead.
|
|
118
122
|
this.syncDescription(control);
|
|
119
123
|
this.syncAttribute(control, 'aria-invalid', this.error ? 'true' : null);
|
|
120
124
|
this.syncAttribute(control, 'aria-required', this.required ? 'true' : null);
|
|
125
|
+
this.syncInnerControl(control);
|
|
121
126
|
// Mirror the field's disabled state onto the control, in BOTH
|
|
122
127
|
// directions — it used to be set to true and never cleared, so a field
|
|
123
128
|
// that started disabled could never be re-enabled.
|
|
@@ -128,23 +133,57 @@ let FormFieldComponent = class FormFieldComponent {
|
|
|
128
133
|
this.syncAttribute(control, 'aria-disabled', this.disabled ? 'true' : null);
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
|
-
/**
|
|
132
|
-
|
|
136
|
+
/** The rendered error/hint elements that describe the control. */
|
|
137
|
+
getDescribers() {
|
|
133
138
|
const root = this.elementRef.shadowRoot;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
return [this.error ? root?.getElementById(this.errorId) : null, this.hint ? root?.getElementById(this.hintId) : null].filter((element) => element !== null && element !== undefined);
|
|
140
|
+
}
|
|
141
|
+
/** Describe the control with the hint/error across the shadow boundary. */
|
|
142
|
+
syncDescription(control) {
|
|
143
|
+
setCrossRootDescription(control, this.getDescribers());
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Mirror the field's ARIA state onto the element that actually takes
|
|
147
|
+
* focus. For a slotted `<ml-input>` / `<ml-select>` that is a control
|
|
148
|
+
* inside the component's own shadow root; ARIA on the host element alone
|
|
149
|
+
* is not announced when focus is on the inner control.
|
|
150
|
+
*
|
|
151
|
+
* The inner control belongs to another component, which may manage the
|
|
152
|
+
* same attributes itself — so only ever add our state, and only remove
|
|
153
|
+
* what we added.
|
|
154
|
+
*/
|
|
155
|
+
syncInnerControl(control) {
|
|
156
|
+
const inner = getFocusableControl(control);
|
|
157
|
+
const target = inner !== control ? inner : null;
|
|
158
|
+
if (this._innerControl && this._innerControl !== target) {
|
|
159
|
+
for (const name of this._innerOwned) {
|
|
160
|
+
this._innerControl.removeAttribute(name);
|
|
161
|
+
}
|
|
162
|
+
this._innerOwned.clear();
|
|
163
|
+
}
|
|
164
|
+
this._innerControl = target;
|
|
165
|
+
if (!target) {
|
|
139
166
|
return;
|
|
140
167
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const description = describers
|
|
144
|
-
.map((element) => element.textContent?.trim() ?? '')
|
|
168
|
+
const description = this.getDescribers()
|
|
169
|
+
.map((element) => element.textContent?.replace(/\s+/g, ' ').trim() ?? '')
|
|
145
170
|
.filter(Boolean)
|
|
146
171
|
.join('. ');
|
|
147
|
-
this.
|
|
172
|
+
this.syncOwnedAttribute(target, 'aria-description', description || null);
|
|
173
|
+
this.syncOwnedAttribute(target, 'aria-invalid', this.error ? 'true' : null);
|
|
174
|
+
this.syncOwnedAttribute(target, 'aria-required', this.required ? 'true' : null);
|
|
175
|
+
}
|
|
176
|
+
syncOwnedAttribute(target, name, value) {
|
|
177
|
+
if (value !== null) {
|
|
178
|
+
if (target.getAttribute(name) !== value) {
|
|
179
|
+
target.setAttribute(name, value);
|
|
180
|
+
}
|
|
181
|
+
this._innerOwned.add(name);
|
|
182
|
+
}
|
|
183
|
+
else if (this._innerOwned.has(name)) {
|
|
184
|
+
target.removeAttribute(name);
|
|
185
|
+
this._innerOwned.delete(name);
|
|
186
|
+
}
|
|
148
187
|
}
|
|
149
188
|
syncAttribute(el, name, value) {
|
|
150
189
|
if (value === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"form-field.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,iDA0O3B,CAAC"}
|
|
@@ -72,7 +72,7 @@ export const formFieldStyles = () => css `
|
|
|
72
72
|
grid-column: 1;
|
|
73
73
|
grid-row: 1;
|
|
74
74
|
padding-top: var(--ml-form-field-horizontal-label-padding-top, var(--ml-space-2-5));
|
|
75
|
-
text-align:
|
|
75
|
+
text-align: end;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
.ml-form-field--horizontal .ml-form-field__control {
|
|
@@ -96,7 +96,7 @@ export const formFieldStyles = () => css `
|
|
|
96
96
|
|
|
97
97
|
.ml-form-field__required {
|
|
98
98
|
color: var(--ml-form-field-required-color, var(--ml-color-danger));
|
|
99
|
-
margin-
|
|
99
|
+
margin-inline-start: var(--ml-space-0-5);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/* Control wrapper */
|
|
@@ -220,4 +220,17 @@ export const formFieldStyles = () => css `
|
|
|
220
220
|
.ml-form-field--horizontal.ml-form-field--lg .ml-form-field__label {
|
|
221
221
|
padding-top: var(--ml-space-3-5);
|
|
222
222
|
}
|
|
223
|
+
|
|
224
|
+
/*
|
|
225
|
+
* Forced colors (Windows High Contrast): box-shadow rings and background
|
|
226
|
+
* highlights are not painted there, so focus falls back to a real outline.
|
|
227
|
+
*/
|
|
228
|
+
@media (forced-colors: active) {
|
|
229
|
+
::slotted(input:focus),
|
|
230
|
+
::slotted(select:focus),
|
|
231
|
+
::slotted(textarea:focus) {
|
|
232
|
+
outline: 2px solid Highlight;
|
|
233
|
+
outline-offset: 2px;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
223
236
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/input/input.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"input.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/input/input.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDAsMvB,CAAC"}
|
|
@@ -77,7 +77,7 @@ export const inputStyles = () => css `
|
|
|
77
77
|
|
|
78
78
|
.ml-input__required {
|
|
79
79
|
color: var(--ml-input-required-color, var(--ml-color-danger));
|
|
80
|
-
margin-
|
|
80
|
+
margin-inline-start: var(--ml-space-0-5);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.ml-input__wrapper {
|
|
@@ -186,4 +186,15 @@ export const inputStyles = () => css `
|
|
|
186
186
|
color: var(--ml-input-addon-color, var(--ml-color-text-muted));
|
|
187
187
|
flex-shrink: 0;
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
/*
|
|
191
|
+
* Forced colors (Windows High Contrast): box-shadow rings and background
|
|
192
|
+
* highlights are not painted there, so focus falls back to a real outline.
|
|
193
|
+
*/
|
|
194
|
+
@media (forced-colors: active) {
|
|
195
|
+
.ml-input--focused .ml-input__wrapper {
|
|
196
|
+
outline: 2px solid Highlight;
|
|
197
|
+
outline-offset: 2px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
189
200
|
`;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ListboxValueSync, registerListboxAdapter, areValuesEqual, normalizeValues, findNextEnabledIndex, findPreviousEnabledIndex, findFirstEnabledIndex, findLastEnabledIndex, scrollOptionIntoView } from './listbox-core.js';
|
|
2
|
+
export type { ListboxValueHost, ListboxOptionLike } from './listbox-core.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/listbox-core/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// INTERNAL shared core for ml-select / ml-autocomplete — not exported from the package root.
|
|
2
|
+
export { ListboxValueSync, registerListboxAdapter, areValuesEqual, normalizeValues, findNextEnabledIndex, findPreviousEnabledIndex, findFirstEnabledIndex, findLastEnabledIndex, scrollOptionIntoView } from './listbox-core.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListboxCore — shared internals for ml-select and ml-autocomplete.
|
|
3
|
+
*
|
|
4
|
+
* Both components keep a single `value`, a multi `values` array and a
|
|
5
|
+
* `multiple` flag in step with each other, register the same forms adapter and
|
|
6
|
+
* walk their option list the same way. That logic used to be copied into each
|
|
7
|
+
* component — and the copies shared the same bug.
|
|
8
|
+
*
|
|
9
|
+
* INTERNAL: not exported from the package root — implementation detail only.
|
|
10
|
+
*/
|
|
11
|
+
/** The component state the value sync reads and writes. */
|
|
12
|
+
export interface ListboxValueHost {
|
|
13
|
+
multiple: boolean;
|
|
14
|
+
value: string;
|
|
15
|
+
values: string[];
|
|
16
|
+
search: string;
|
|
17
|
+
}
|
|
18
|
+
/** Minimal option shape needed for keyboard navigation. */
|
|
19
|
+
export interface ListboxOptionLike {
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Register the forms adapter shared by ml-select and ml-autocomplete. */
|
|
23
|
+
export declare function registerListboxAdapter(tagName: string): void;
|
|
24
|
+
export declare function areValuesEqual(left: readonly string[], right: readonly string[]): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Turn whatever was assigned to `values` into a de-duplicated string array.
|
|
27
|
+
* Accepts an array (non-strings dropped) or a comma-separated string.
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeValues(raw: unknown): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Keeps `value`, `values` and `multiple` consistent.
|
|
32
|
+
*
|
|
33
|
+
* `onPropertyChange` fires BEFORE the new value is committed, so reading the
|
|
34
|
+
* changing property off the host returns the OLD value. Everything here works
|
|
35
|
+
* from the hook's `newValue` argument instead; reading the old state made
|
|
36
|
+
* toggling `multiple` run the wrong branch, made `value` writes in multiple
|
|
37
|
+
* mode lag one step behind, and never normalized `values` at all.
|
|
38
|
+
*/
|
|
39
|
+
export declare class ListboxValueSync {
|
|
40
|
+
private readonly _host;
|
|
41
|
+
private _syncing;
|
|
42
|
+
constructor(_host: ListboxValueHost);
|
|
43
|
+
/** Call from the component's onPropertyChange. */
|
|
44
|
+
handlePropertyChange(name: string, newValue: unknown): void;
|
|
45
|
+
private handleMultipleChange;
|
|
46
|
+
private handleValuesChange;
|
|
47
|
+
private write;
|
|
48
|
+
}
|
|
49
|
+
/** Index of the next enabled option after `from`, or -1 when there is none. */
|
|
50
|
+
export declare function findNextEnabledIndex(options: readonly ListboxOptionLike[], from: number): number;
|
|
51
|
+
/** Index of the previous enabled option before `from`, or -1 when there is none. */
|
|
52
|
+
export declare function findPreviousEnabledIndex(options: readonly ListboxOptionLike[], from: number): number;
|
|
53
|
+
export declare function findFirstEnabledIndex(options: readonly ListboxOptionLike[]): number;
|
|
54
|
+
export declare function findLastEnabledIndex(options: readonly ListboxOptionLike[]): number;
|
|
55
|
+
/** Scroll the option element with `id` into view inside its dropdown. */
|
|
56
|
+
export declare function scrollOptionIntoView(root: ShadowRoot | null | undefined, id: string): void;
|
|
57
|
+
//# sourceMappingURL=listbox-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listbox-core.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/listbox-core/listbox-core.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAiB5D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAMzF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAWtD;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAgB;IAGhB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAS;gBAEI,KAAK,EAAE,gBAAgB;IAEpD,kDAAkD;IAC3C,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAyBlE,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,kBAAkB;IA4B1B,OAAO,CAAC,KAAK;CAQb;AAID,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhG;AAED,oFAAoF;AACpF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpG;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,CAEnF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,CAElF;AAED,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAK1F"}
|