@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.
Files changed (210) hide show
  1. package/README.md +4 -4
  2. package/assets/fonts/phosphor/phosphor.css +5 -25
  3. package/assets/melodic-components.css +50 -25
  4. package/assets/melodic-components.js +5370 -4233
  5. package/assets/melodic-components.js.map +1 -1
  6. package/assets/melodic-components.min.css +1 -21
  7. package/assets/melodic-components.min.js +1808 -26662
  8. package/lib/components/data-display/calendar-view/calendar-view.styles.d.ts.map +1 -1
  9. package/lib/components/data-display/calendar-view/calendar-view.styles.js +14 -0
  10. package/lib/components/data-display/data-grid/data-grid.component.d.ts +43 -2
  11. package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
  12. package/lib/components/data-display/data-grid/data-grid.component.js +94 -8
  13. package/lib/components/data-display/data-grid/data-grid.styles.d.ts.map +1 -1
  14. package/lib/components/data-display/data-grid/data-grid.styles.js +17 -0
  15. package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
  16. package/lib/components/data-display/data-grid/data-grid.template.js +19 -10
  17. package/lib/components/data-display/data-grid/index.d.ts +1 -0
  18. package/lib/components/data-display/data-grid/index.d.ts.map +1 -1
  19. package/lib/components/data-display/list/list-item.styles.js +1 -1
  20. package/lib/components/data-display/table/index.d.ts +1 -0
  21. package/lib/components/data-display/table/index.d.ts.map +1 -1
  22. package/lib/components/data-display/table/table.component.d.ts +16 -0
  23. package/lib/components/data-display/table/table.component.d.ts.map +1 -1
  24. package/lib/components/data-display/table/table.component.js +28 -3
  25. package/lib/components/data-display/table/table.styles.d.ts.map +1 -1
  26. package/lib/components/data-display/table/table.styles.js +7 -1
  27. package/lib/components/data-display/table/table.template.d.ts.map +1 -1
  28. package/lib/components/data-display/table/table.template.js +8 -6
  29. package/lib/components/data-display/table-core/index.d.ts +2 -2
  30. package/lib/components/data-display/table-core/index.d.ts.map +1 -1
  31. package/lib/components/data-display/table-core/index.js +1 -1
  32. package/lib/components/data-display/table-core/table-core.d.ts +16 -2
  33. package/lib/components/data-display/table-core/table-core.d.ts.map +1 -1
  34. package/lib/components/data-display/table-core/table-core.js +32 -5
  35. package/lib/components/data-display/tag/tag.styles.d.ts.map +1 -1
  36. package/lib/components/data-display/tag/tag.styles.js +11 -4
  37. package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
  38. package/lib/components/feedback/alert/alert.styles.js +11 -0
  39. package/lib/components/feedback/toast/index.d.ts +1 -0
  40. package/lib/components/feedback/toast/index.d.ts.map +1 -1
  41. package/lib/components/feedback/toast/toast-container.styles.d.ts.map +1 -1
  42. package/lib/components/feedback/toast/toast-container.styles.js +20 -0
  43. package/lib/components/feedback/toast/toast.component.d.ts +16 -0
  44. package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
  45. package/lib/components/feedback/toast/toast.component.js +63 -5
  46. package/lib/components/feedback/toast/toast.service.d.ts +14 -0
  47. package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
  48. package/lib/components/feedback/toast/toast.service.js +41 -0
  49. package/lib/components/feedback/toast/toast.styles.d.ts.map +1 -1
  50. package/lib/components/feedback/toast/toast.styles.js +6 -0
  51. package/lib/components/feedback/toast/toast.template.js +1 -1
  52. package/lib/components/forms/autocomplete/autocomplete.component.d.ts +14 -4
  53. package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
  54. package/lib/components/forms/autocomplete/autocomplete.component.js +40 -96
  55. package/lib/components/forms/autocomplete/autocomplete.styles.d.ts.map +1 -1
  56. package/lib/components/forms/autocomplete/autocomplete.styles.js +22 -6
  57. package/lib/components/forms/autocomplete/autocomplete.template.js +7 -1
  58. package/lib/components/forms/button/button.styles.d.ts.map +1 -1
  59. package/lib/components/forms/button/button.styles.js +11 -0
  60. package/lib/components/forms/button-group/button-group-item.styles.d.ts.map +1 -1
  61. package/lib/components/forms/button-group/button-group-item.styles.js +11 -0
  62. package/lib/components/forms/button-group/button-group.styles.js +2 -2
  63. package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
  64. package/lib/components/forms/checkbox/checkbox.styles.js +13 -2
  65. package/lib/components/forms/date-picker/calendar.component.d.ts +20 -7
  66. package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
  67. package/lib/components/forms/date-picker/calendar.component.js +88 -13
  68. package/lib/components/forms/date-picker/calendar.styles.d.ts.map +1 -1
  69. package/lib/components/forms/date-picker/calendar.styles.js +19 -0
  70. package/lib/components/forms/date-picker/date-picker.component.d.ts +2 -3
  71. package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
  72. package/lib/components/forms/date-picker/date-picker.component.js +70 -18
  73. package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
  74. package/lib/components/forms/date-picker/date-picker.styles.js +12 -1
  75. package/lib/components/forms/date-time-picker/date-time-picker.styles.d.ts.map +1 -1
  76. package/lib/components/forms/date-time-picker/date-time-picker.styles.js +12 -1
  77. package/lib/components/forms/date-time-picker/tz-utils.d.ts.map +1 -1
  78. package/lib/components/forms/date-time-picker/tz-utils.js +24 -3
  79. package/lib/components/forms/file-upload/file-upload-item.styles.d.ts.map +1 -1
  80. package/lib/components/forms/file-upload/file-upload-item.styles.js +13 -1
  81. package/lib/components/forms/file-upload/file-upload.styles.d.ts.map +1 -1
  82. package/lib/components/forms/file-upload/file-upload.styles.js +11 -0
  83. package/lib/components/forms/form-field/form-field.component.d.ts +18 -1
  84. package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
  85. package/lib/components/forms/form-field/form-field.component.js +55 -16
  86. package/lib/components/forms/form-field/form-field.styles.d.ts.map +1 -1
  87. package/lib/components/forms/form-field/form-field.styles.js +15 -2
  88. package/lib/components/forms/input/input.styles.d.ts.map +1 -1
  89. package/lib/components/forms/input/input.styles.js +12 -1
  90. package/lib/components/forms/listbox-core/index.d.ts +3 -0
  91. package/lib/components/forms/listbox-core/index.d.ts.map +1 -0
  92. package/lib/components/forms/listbox-core/index.js +2 -0
  93. package/lib/components/forms/listbox-core/listbox-core.d.ts +57 -0
  94. package/lib/components/forms/listbox-core/listbox-core.d.ts.map +1 -0
  95. package/lib/components/forms/listbox-core/listbox-core.js +168 -0
  96. package/lib/components/forms/radio/radio-group.styles.js +1 -1
  97. package/lib/components/forms/radio/radio.styles.d.ts.map +1 -1
  98. package/lib/components/forms/radio/radio.styles.js +12 -1
  99. package/lib/components/forms/radio-card-group/radio-card-group.styles.js +1 -1
  100. package/lib/components/forms/radio-card-group/radio-card.styles.d.ts.map +1 -1
  101. package/lib/components/forms/radio-card-group/radio-card.styles.js +11 -0
  102. package/lib/components/forms/select/select.component.d.ts +12 -4
  103. package/lib/components/forms/select/select.component.d.ts.map +1 -1
  104. package/lib/components/forms/select/select.component.js +41 -110
  105. package/lib/components/forms/select/select.styles.d.ts.map +1 -1
  106. package/lib/components/forms/select/select.styles.js +23 -6
  107. package/lib/components/forms/select/select.template.d.ts.map +1 -1
  108. package/lib/components/forms/select/select.template.js +25 -9
  109. package/lib/components/forms/slider/slider.component.js +1 -1
  110. package/lib/components/forms/slider/slider.styles.d.ts.map +1 -1
  111. package/lib/components/forms/slider/slider.styles.js +11 -0
  112. package/lib/components/forms/slider/slider.template.d.ts.map +1 -1
  113. package/lib/components/forms/slider/slider.template.js +5 -1
  114. package/lib/components/forms/textarea/textarea.styles.d.ts.map +1 -1
  115. package/lib/components/forms/textarea/textarea.styles.js +13 -2
  116. package/lib/components/forms/time-picker/time-picker.component.d.ts +1 -2
  117. package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
  118. package/lib/components/forms/time-picker/time-picker.component.js +8 -17
  119. package/lib/components/forms/time-picker/time-picker.styles.d.ts.map +1 -1
  120. package/lib/components/forms/time-picker/time-picker.styles.js +23 -3
  121. package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
  122. package/lib/components/forms/toggle/toggle.styles.js +13 -2
  123. package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
  124. package/lib/components/foundation/card/card.styles.js +11 -0
  125. package/lib/components/foundation/container/container.styles.js +4 -4
  126. package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
  127. package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +5 -3
  128. package/lib/components/navigation/sidebar/sidebar-item.styles.js +4 -4
  129. package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
  130. package/lib/components/navigation/sidebar/sidebar.styles.js +5 -5
  131. package/lib/components/navigation/sidebar/sidebar.template.js +2 -2
  132. package/lib/components/navigation/steps/step.styles.js +3 -3
  133. package/lib/components/navigation/steps/steps.styles.js +3 -3
  134. package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
  135. package/lib/components/navigation/tabs/tabs.component.js +4 -1
  136. package/lib/components/navigation/tabs/tabs.styles.js +8 -8
  137. package/lib/components/overlays/dialog/dialog.component.d.ts +15 -2
  138. package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
  139. package/lib/components/overlays/dialog/dialog.component.js +33 -1
  140. package/lib/components/overlays/dialog/dialog.service.d.ts +8 -2
  141. package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
  142. package/lib/components/overlays/dialog/dialog.service.js +1 -0
  143. package/lib/components/overlays/dialog/index.d.ts +1 -0
  144. package/lib/components/overlays/dialog/index.d.ts.map +1 -1
  145. package/lib/components/overlays/drawer/drawer.component.d.ts +18 -3
  146. package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
  147. package/lib/components/overlays/drawer/drawer.component.js +59 -16
  148. package/lib/components/overlays/dropdown/dropdown-item.styles.d.ts.map +1 -1
  149. package/lib/components/overlays/dropdown/dropdown-item.styles.js +12 -0
  150. package/lib/components/overlays/popover/popover.component.d.ts +12 -0
  151. package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
  152. package/lib/components/overlays/popover/popover.component.js +28 -1
  153. package/lib/components/overlays/popover/popover.template.d.ts.map +1 -1
  154. package/lib/components/overlays/popover/popover.template.js +2 -0
  155. package/lib/components/overlays/tooltip/tooltip.component.d.ts +8 -5
  156. package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
  157. package/lib/components/overlays/tooltip/tooltip.component.js +10 -3
  158. package/lib/components/sections/app-shell/app-shell.styles.js +1 -1
  159. package/lib/directives/tooltip.directive.d.ts.map +1 -1
  160. package/lib/directives/tooltip.directive.js +22 -3
  161. package/lib/theme/presets/base.preset.d.ts.map +1 -1
  162. package/lib/theme/presets/base.preset.js +17 -0
  163. package/lib/theme/presets/dark.preset.d.ts +8 -0
  164. package/lib/theme/presets/dark.preset.d.ts.map +1 -1
  165. package/lib/theme/presets/dark.preset.js +9 -0
  166. package/lib/theme/presets/light.preset.d.ts +6 -0
  167. package/lib/theme/presets/light.preset.d.ts.map +1 -1
  168. package/lib/theme/presets/light.preset.js +7 -0
  169. package/lib/theme/tokens/all-tokens.d.ts +10 -0
  170. package/lib/theme/tokens/all-tokens.d.ts.map +1 -1
  171. package/lib/theme/tokens/colors.tokens.d.ts +8 -0
  172. package/lib/theme/tokens/colors.tokens.d.ts.map +1 -1
  173. package/lib/theme/tokens/colors.tokens.js +11 -0
  174. package/lib/theme/tokens/transitions.tokens.d.ts +1 -0
  175. package/lib/theme/tokens/transitions.tokens.d.ts.map +1 -1
  176. package/lib/theme/tokens/transitions.tokens.js +3 -0
  177. package/lib/theme/tokens/typography.tokens.d.ts +1 -0
  178. package/lib/theme/tokens/typography.tokens.d.ts.map +1 -1
  179. package/lib/theme/tokens/typography.tokens.js +1 -0
  180. package/lib/utils/accessibility/cross-root-aria.d.ts +16 -8
  181. package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -1
  182. package/lib/utils/accessibility/cross-root-aria.js +58 -22
  183. package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
  184. package/lib/utils/accessibility/focus-trap.js +9 -19
  185. package/lib/utils/accessibility/focus-utils.d.ts +10 -1
  186. package/lib/utils/accessibility/focus-utils.d.ts.map +1 -1
  187. package/lib/utils/accessibility/focus-utils.js +48 -14
  188. package/lib/utils/accessibility/index.d.ts +2 -1
  189. package/lib/utils/accessibility/index.d.ts.map +1 -1
  190. package/lib/utils/accessibility/index.js +1 -1
  191. package/lib/utils/positioning/compute-position.d.ts +6 -1
  192. package/lib/utils/positioning/compute-position.d.ts.map +1 -1
  193. package/lib/utils/positioning/compute-position.js +3 -2
  194. package/lib/utils/positioning/middlewares/flip.middleware.js +2 -51
  195. package/package.json +8 -5
  196. package/assets/fonts/phosphor/Phosphor-Bold.svg +0 -3057
  197. package/assets/fonts/phosphor/Phosphor-Bold.ttf +0 -0
  198. package/assets/fonts/phosphor/Phosphor-Bold.woff +0 -0
  199. package/assets/fonts/phosphor/Phosphor-Fill.svg +0 -3057
  200. package/assets/fonts/phosphor/Phosphor-Fill.ttf +0 -0
  201. package/assets/fonts/phosphor/Phosphor-Fill.woff +0 -0
  202. package/assets/fonts/phosphor/Phosphor-Light.svg +0 -3057
  203. package/assets/fonts/phosphor/Phosphor-Light.ttf +0 -0
  204. package/assets/fonts/phosphor/Phosphor-Light.woff +0 -0
  205. package/assets/fonts/phosphor/Phosphor-Thin.svg +0 -3057
  206. package/assets/fonts/phosphor/Phosphor-Thin.ttf +0 -0
  207. package/assets/fonts/phosphor/Phosphor-Thin.woff +0 -0
  208. package/assets/fonts/phosphor/Phosphor.svg +0 -3056
  209. package/assets/fonts/phosphor/Phosphor.ttf +0 -0
  210. 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 new Intl.DateTimeFormat(locale || undefined, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(date);
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 = new Intl.DateTimeFormat(locale || undefined, { year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(new Date(2001, 1, 3));
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
- * Parse typed text into an ISO date (YYYY-MM-DD).
42
- * Accepts `YYYY-MM-DD`, `MM/DD/YYYY`, and `M/D/YYYY`. Returns null when invalid.
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.trim();
85
+ const trimmed = normalizeDateText(text);
46
86
  let year;
47
87
  let month;
48
88
  let day;
49
- let match = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(trimmed);
50
- if (match) {
51
- year = Number(match[1]);
52
- month = Number(match[2]);
53
- day = Number(match[3]);
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
- // Accept the locale's own part order rather than assuming MM/DD/YYYY —
57
- // a user typing 03/02/2001 in en-GB means 3 February.
58
- match = /^(\d{1,4})[/.-](\d{1,2})[/.-](\d{1,4})$/.exec(trimmed);
59
- if (!match)
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(match[index + 1]);
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 (`MM/DD/YYYY` or `YYYY-MM-DD`)
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 document's `lang`, then the browser's — the format used to be
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,iDAuO5B,CAAC"}
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-left: var(--ml-space-0-5);
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,iDAqKhC,CAAC"}
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-left: var(--ml-space-0-5);
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;AAKvE,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,CAQrE;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"}
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
- const offset = getZoneOffsetMs(naiveAsUtc, timeZone);
71
- const real = new Date(naiveAsUtc.getTime() - offset);
72
- return real.toISOString();
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,iDA0KhC,CAAC"}
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: right;
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,iDAqL5B,CAAC"}
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
- /** Point the control at the hint/error elements across the shadow boundary. */
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;AAIlE;;;;;;;;;;;;;;;;;;;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;IAwC7B,+EAA+E;IAC/E,OAAO,CAAC,eAAe;IAwBvB;;;;OAIG;IACI,gBAAgB,GAAI,OAAO,KAAK,KAAG,IAAI,CAG5C;IAEF,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;CAqCvB"}
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 between
115
- // them never resolves. Element references do cross the boundary, so use
116
- // `ariaDescribedByElements` where the browser supports it and fall back
117
- // to copying the text into `aria-description`.
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
- /** Point the control at the hint/error elements across the shadow boundary. */
132
- syncDescription(control) {
136
+ /** The rendered error/hint elements that describe the control. */
137
+ getDescribers() {
133
138
  const root = this.elementRef.shadowRoot;
134
- const describers = [this.error ? root?.getElementById(this.errorId) : null, this.hint ? root?.getElementById(this.hintId) : null].filter((element) => element !== null && element !== undefined);
135
- const reflected = control;
136
- if ('ariaDescribedByElements' in reflected) {
137
- reflected.ariaDescribedByElements = describers.length > 0 ? describers : null;
138
- this.syncAttribute(control, 'aria-description', null);
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
- // No element-reference support: carry the text itself. An IDREF here
142
- // would point at nothing.
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.syncAttribute(control, 'aria-description', description || null);
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,iDA6N3B,CAAC"}
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: right;
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-left: var(--ml-space-0-5);
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,iDA2LvB,CAAC"}
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-left: var(--ml-space-0-5);
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"}