@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
@@ -0,0 +1,168 @@
1
+ import { registerAdapter } from '@melodicdev/core/forms';
2
+ /** Register the forms adapter shared by ml-select and ml-autocomplete. */
3
+ export function registerListboxAdapter(tagName) {
4
+ registerAdapter((el) => el.tagName === tagName, {
5
+ inputEvent: 'ml:change',
6
+ blurEvent: 'focusout',
7
+ getValue: (el) => {
8
+ const e = el;
9
+ return e.multiple ? (e.values ?? []) : (e.value ?? '');
10
+ },
11
+ setValue: (el, value) => {
12
+ const e = el;
13
+ if (Array.isArray(value))
14
+ e.values = value;
15
+ else
16
+ e.value = value !== null && value !== undefined ? String(value) : '';
17
+ },
18
+ setDisabled: (el, disabled) => {
19
+ el.disabled = disabled;
20
+ }
21
+ });
22
+ }
23
+ export function areValuesEqual(left, right) {
24
+ if (left.length !== right.length)
25
+ return false;
26
+ for (let i = 0; i < left.length; i++) {
27
+ if (left[i] !== right[i])
28
+ return false;
29
+ }
30
+ return true;
31
+ }
32
+ /**
33
+ * Turn whatever was assigned to `values` into a de-duplicated string array.
34
+ * Accepts an array (non-strings dropped) or a comma-separated string.
35
+ */
36
+ export function normalizeValues(raw) {
37
+ let normalized = [];
38
+ if (typeof raw === 'string') {
39
+ normalized = raw
40
+ .split(',')
41
+ .map((value) => value.trim())
42
+ .filter((value) => value.length > 0);
43
+ }
44
+ else if (Array.isArray(raw)) {
45
+ normalized = raw.filter((value) => typeof value === 'string');
46
+ }
47
+ return Array.from(new Set(normalized));
48
+ }
49
+ /**
50
+ * Keeps `value`, `values` and `multiple` consistent.
51
+ *
52
+ * `onPropertyChange` fires BEFORE the new value is committed, so reading the
53
+ * changing property off the host returns the OLD value. Everything here works
54
+ * from the hook's `newValue` argument instead; reading the old state made
55
+ * toggling `multiple` run the wrong branch, made `value` writes in multiple
56
+ * mode lag one step behind, and never normalized `values` at all.
57
+ */
58
+ export class ListboxValueSync {
59
+ constructor(_host) {
60
+ this._host = _host;
61
+ this._syncing = false;
62
+ }
63
+ /** Call from the component's onPropertyChange. */
64
+ handlePropertyChange(name, newValue) {
65
+ if (this._syncing) {
66
+ return;
67
+ }
68
+ if (name === 'multiple') {
69
+ this.handleMultipleChange(!!newValue);
70
+ return;
71
+ }
72
+ if (name === 'values') {
73
+ this.handleValuesChange(newValue);
74
+ return;
75
+ }
76
+ if (name === 'value' && this._host.multiple && newValue) {
77
+ const next = Array.from(new Set([...normalizeValues(this._host.values), String(newValue)]));
78
+ if (!areValuesEqual(this._host.values, next)) {
79
+ this.write(() => {
80
+ this._host.values = next;
81
+ });
82
+ }
83
+ }
84
+ }
85
+ handleMultipleChange(multiple) {
86
+ const host = this._host;
87
+ const values = normalizeValues(host.values);
88
+ this.write(() => {
89
+ if (multiple) {
90
+ // Entering multiple mode: carry the single value over.
91
+ if (!values.length && host.value) {
92
+ host.values = [host.value];
93
+ }
94
+ return;
95
+ }
96
+ // Leaving multiple mode: keep the first selection as the value.
97
+ if (values.length) {
98
+ host.value = values[0] ?? '';
99
+ }
100
+ host.values = [];
101
+ host.search = '';
102
+ });
103
+ }
104
+ handleValuesChange(raw) {
105
+ const host = this._host;
106
+ const normalized = normalizeValues(raw);
107
+ // The incoming value itself cannot be replaced from inside the hook
108
+ // (the setter commits it right after), so a value that needs
109
+ // normalizing — a comma-separated string, duplicates, non-strings — is
110
+ // rewritten once it has landed.
111
+ const needsRewrite = !Array.isArray(raw) || !areValuesEqual(raw, normalized);
112
+ if (needsRewrite) {
113
+ queueMicrotask(() => {
114
+ if (host.values === raw) {
115
+ this.write(() => {
116
+ host.values = normalized;
117
+ });
118
+ }
119
+ });
120
+ }
121
+ // In single mode `values` is only a staging area (it is adopted when
122
+ // `multiple` turns on); mirror its first entry onto `value`.
123
+ if (!host.multiple && normalized.length) {
124
+ this.write(() => {
125
+ host.value = normalized[0];
126
+ });
127
+ }
128
+ }
129
+ write(fn) {
130
+ this._syncing = true;
131
+ try {
132
+ fn();
133
+ }
134
+ finally {
135
+ this._syncing = false;
136
+ }
137
+ }
138
+ }
139
+ // ── Option navigation ─────────────────────────────────────────────────────────
140
+ /** Index of the next enabled option after `from`, or -1 when there is none. */
141
+ export function findNextEnabledIndex(options, from) {
142
+ for (let index = from + 1; index < options.length; index++) {
143
+ if (!options[index].disabled)
144
+ return index;
145
+ }
146
+ return -1;
147
+ }
148
+ /** Index of the previous enabled option before `from`, or -1 when there is none. */
149
+ export function findPreviousEnabledIndex(options, from) {
150
+ for (let index = from - 1; index >= 0; index--) {
151
+ if (!options[index].disabled)
152
+ return index;
153
+ }
154
+ return -1;
155
+ }
156
+ export function findFirstEnabledIndex(options) {
157
+ return options.findIndex((option) => !option.disabled);
158
+ }
159
+ export function findLastEnabledIndex(options) {
160
+ return findPreviousEnabledIndex(options, options.length);
161
+ }
162
+ /** Scroll the option element with `id` into view inside its dropdown. */
163
+ export function scrollOptionIntoView(root, id) {
164
+ const optionEl = root?.getElementById(id);
165
+ if (optionEl && typeof optionEl.scrollIntoView === 'function') {
166
+ optionEl.scrollIntoView({ block: 'nearest' });
167
+ }
168
+ }
@@ -20,7 +20,7 @@ export const radioGroupStyles = () => css `
20
20
 
21
21
  .ml-radio-group__required {
22
22
  color: var(--ml-color-danger);
23
- margin-left: var(--ml-space-0-5);
23
+ margin-inline-start: var(--ml-space-0-5);
24
24
  }
25
25
 
26
26
  .ml-radio-group__options {
@@ -1 +1 @@
1
- {"version":3,"file":"radio.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDAkKvB,CAAC"}
1
+ {"version":3,"file":"radio.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDA6KvB,CAAC"}
@@ -156,9 +156,20 @@ export const radioStyles = () => css `
156
156
  .ml-radio__hint {
157
157
  display: block;
158
158
  margin-top: var(--ml-space-0-5);
159
- margin-left: calc(var(--ml-radio-circle-size, 1.25rem) + var(--ml-radio-gap, var(--ml-space-3)));
159
+ margin-inline-start: calc(var(--ml-radio-circle-size, 1.25rem) + var(--ml-radio-gap, var(--ml-space-3)));
160
160
  font-size: var(--ml-radio-hint-font-size, var(--ml-text-sm));
161
161
  color: var(--ml-radio-hint-color, var(--ml-color-text-muted));
162
162
  line-height: var(--ml-leading-tight);
163
163
  }
164
+
165
+ /*
166
+ * Forced colors (Windows High Contrast): box-shadow rings and background
167
+ * highlights are not painted there, so focus falls back to a real outline.
168
+ */
169
+ @media (forced-colors: active) {
170
+ .ml-radio__input:focus-visible + .ml-radio__circle {
171
+ outline: 2px solid Highlight;
172
+ outline-offset: 2px;
173
+ }
174
+ }
164
175
  `;
@@ -47,7 +47,7 @@ export const radioCardGroupStyles = () => css `
47
47
 
48
48
  .ml-radio-card-group__required {
49
49
  color: var(--ml-radio-card-group-required-color, var(--ml-color-danger));
50
- margin-left: var(--ml-space-0-5);
50
+ margin-inline-start: var(--ml-space-0-5);
51
51
  }
52
52
 
53
53
  .ml-radio-card-group__options {
@@ -1 +1 @@
1
- {"version":3,"file":"radio-card.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio-card-group/radio-card.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,iDA0M3B,CAAC"}
1
+ {"version":3,"file":"radio-card.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio-card-group/radio-card.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,iDAqN3B,CAAC"}
@@ -201,4 +201,15 @@ export const radioCardStyles = () => css `
201
201
  line-height: var(--ml-radio-card-detail-line-height, var(--ml-leading-tight));
202
202
  padding-top: var(--ml-space-0-5);
203
203
  }
204
+
205
+ /*
206
+ * Forced colors (Windows High Contrast): box-shadow rings and background
207
+ * highlights are not painted there, so focus falls back to a real outline.
208
+ */
209
+ @media (forced-colors: active) {
210
+ .ml-radio-card:focus-visible {
211
+ outline: 2px solid Highlight;
212
+ outline-offset: 2px;
213
+ }
214
+ }
204
215
  `;
@@ -69,12 +69,13 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
69
69
  private readonly _uid;
70
70
  private readonly _positioner;
71
71
  private _lastCloseTime;
72
- private _syncingValues;
72
+ /** Keeps value / values / multiple consistent (shared with ml-autocomplete). */
73
+ private readonly _valueSync;
73
74
  private _typeaheadBuffer;
74
75
  private _typeaheadLastTime;
75
76
  onCreate(): void;
76
77
  onDestroy(): void;
77
- onPropertyChange(name: string): void;
78
+ onPropertyChange(name: string, _: unknown, newValue: unknown): void;
78
79
  /** Get the currently selected option */
79
80
  get selectedOption(): SelectOption | undefined;
80
81
  /** Get the currently selected options (multi-select) */
@@ -85,6 +86,15 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
85
86
  get hasValue(): boolean;
86
87
  /** Unique id of the label element (for aria-labelledby) */
87
88
  get labelId(): string;
89
+ /** Unique id of the error element (for aria-describedby) */
90
+ get errorId(): string;
91
+ /** Unique id of the hint element (for aria-describedby) */
92
+ get hintId(): string;
93
+ /**
94
+ * Id of the message that describes the control, or undefined when there is
95
+ * none. The error replaces the hint visually, so it does here too.
96
+ */
97
+ get describedBy(): string | undefined;
88
98
  /** Unique id of the listbox element (for aria-controls) */
89
99
  get listboxId(): string;
90
100
  /** Unique id for the option at the given display index */
@@ -130,7 +140,5 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
130
140
  private findLastEnabledIndex;
131
141
  private getInitialFocusIndex;
132
142
  private getActiveOptions;
133
- private updateValues;
134
- private areValuesEqual;
135
143
  }
136
144
  //# sourceMappingURL=select.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAwBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAMa,eAAgB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IAChE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,yCAAyC;IAClC,WAAW,SAAsB;IAExC,mCAAmC;IAC5B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,kBAAkB;IACX,I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AW,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEhD;IAED,iCAAiC;IAC1B,MAAM,QAAO,IAAI,CAQtB;IAEF,wBAAwB;IACjB,IAAI,QAAO,IAAI,CAGpB;IAEF,yBAAyB;IAClB,KAAK,QAAO,IAAI,CAGrB;IAEF,uBAAuB;IAChB,YAAY,GAAI,QAAQ,YAAY,KAAG,IAAI,CAkBhD;IAEF,0CAA0C;IAC1C,OAAO,CAAC,YAAY;IAapB,6BAA6B;IACtB,iBAAiB,GAAI,OAAO,KAAK,EAAE,QAAQ,YAAY,KAAG,IAAI,CAGnE;IAEK,eAAe,GAAI,OAAO,KAAK,EAAE,OAAO,MAAM,KAAG,IAAI,CAY1D;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAQ7C;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAK7C;IAEF,gEAAgE;IAChE,OAAO,CAAC,eAAe;IAuBvB,8EAA8E;IAC9E,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAIrB,iCAAiC;IACjC,OAAO,CAAC,SAAS;IAmFjB,wGAAwG;IACxG,OAAO,CAAC,eAAe;IAoCvB,sHAAsH;IACtH,OAAO,CAAC,kBAAkB;IAa1B,8EAA8E;IAC9E,OAAO,CAAC,2BAA2B;IAMnC,wCAAwC;IACxC,OAAO,CAAC,eAAe;IAevB,4CAA4C;IAC5C,OAAO,CAAC,mBAAmB;IAe3B,sCAAsC;IACtC,OAAO,CAAC,qBAAqB;IAI7B,qCAAqC;IACrC,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,cAAc;CAOtB"}
1
+ {"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,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,IAAI,CAK7C;IAEF,gEAAgE;IAChE,OAAO,CAAC,eAAe;IAuBvB,8EAA8E;IAC9E,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAIrB,iCAAiC;IACjC,OAAO,CAAC,SAAS;IAmFjB,wGAAwG;IACxG,OAAO,CAAC,eAAe;IAoCvB,sHAAsH;IACtH,OAAO,CAAC,kBAAkB;IAa1B,8EAA8E;IAC9E,OAAO,CAAC,2BAA2B;IAKnC,wCAAwC;IACxC,OAAO,CAAC,eAAe;IAQvB,4CAA4C;IAC5C,OAAO,CAAC,mBAAmB;IAQ3B,sCAAsC;IACtC,OAAO,CAAC,qBAAqB;IAI7B,qCAAqC;IACrC,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,gBAAgB;CAGxB"}
@@ -5,27 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { MelodicComponent } from '@melodicdev/core';
8
- import { registerAdapter } from '@melodicdev/core/forms';
9
8
  import { OverlayPositioner } from '../../../utils/overlay/index.js';
10
9
  import { newID } from '../../../functions/index.js';
10
+ import { ListboxValueSync, registerListboxAdapter, findNextEnabledIndex, findPreviousEnabledIndex, findFirstEnabledIndex as firstEnabledIndex, findLastEnabledIndex as lastEnabledIndex, scrollOptionIntoView } from '../listbox-core/index.js';
11
11
  import { selectTemplate } from './select.template.js';
12
12
  import { selectStyles } from './select.styles.js';
13
- registerAdapter((el) => el.tagName === 'ML-SELECT', {
14
- inputEvent: 'ml:change',
15
- blurEvent: 'focusout',
16
- getValue: (el) => {
17
- const e = el;
18
- return e.multiple ? (e.values ?? []) : (e.value ?? '');
19
- },
20
- setValue: (el, value) => {
21
- const e = el;
22
- if (Array.isArray(value))
23
- e.values = value;
24
- else
25
- e.value = value !== null && value !== undefined ? String(value) : '';
26
- },
27
- setDisabled: (el, disabled) => { el.disabled = disabled; }
28
- });
13
+ registerListboxAdapter('ML-SELECT');
29
14
  /** Idle time after which the typeahead buffer resets (matches native select behavior) */
30
15
  const TYPEAHEAD_RESET_MS = 700;
31
16
  /**
@@ -100,7 +85,8 @@ let SelectComponent = class SelectComponent {
100
85
  matchTriggerWidth: true
101
86
  }));
102
87
  this._lastCloseTime = 0;
103
- this._syncingValues = false;
88
+ /** Keeps value / values / multiple consistent (shared with ml-autocomplete). */
89
+ this._valueSync = new ListboxValueSync(this);
104
90
  this._typeaheadBuffer = '';
105
91
  this._typeaheadLastTime = 0;
106
92
  /** Unique id for the option at the given display index */
@@ -117,6 +103,11 @@ let SelectComponent = class SelectComponent {
117
103
  else if (Date.now() - this._lastCloseTime > 150) {
118
104
  this.open();
119
105
  }
106
+ // In multiple mode the search input is the combobox (and the only tab
107
+ // stop), so a click anywhere on the trigger must land focus there.
108
+ if (this.multiple) {
109
+ this.elementRef.shadowRoot?.querySelector('.ml-select__search')?.focus();
110
+ }
120
111
  };
121
112
  /** Open the dropdown */
122
113
  this.open = () => {
@@ -188,54 +179,8 @@ let SelectComponent = class SelectComponent {
188
179
  this.stopPositioning();
189
180
  this.getDropdownEl()?.removeEventListener('toggle', this._handlePopoverToggle);
190
181
  }
191
- onPropertyChange(name) {
192
- if (this._syncingValues) {
193
- return;
194
- }
195
- if (name === 'multiple') {
196
- if (this.multiple) {
197
- if (!this.values.length && this.value) {
198
- this.updateValues([this.value]);
199
- }
200
- return;
201
- }
202
- if (this.values.length) {
203
- this.value = this.values[0] ?? '';
204
- }
205
- this.updateValues([]);
206
- this.search = '';
207
- return;
208
- }
209
- if (name === 'values') {
210
- const rawValues = this.values;
211
- let normalized = [];
212
- if (typeof rawValues === 'string') {
213
- normalized = rawValues
214
- .split(',')
215
- .map((value) => value.trim())
216
- .filter((value) => value.length > 0);
217
- }
218
- else if (Array.isArray(rawValues)) {
219
- normalized = rawValues.filter((value) => typeof value === 'string');
220
- }
221
- normalized = Array.from(new Set(normalized));
222
- if (!this.areValuesEqual(this.values, normalized)) {
223
- this.updateValues(normalized);
224
- }
225
- if (!this.multiple) {
226
- this.value = normalized[0] ?? '';
227
- this.updateValues([]);
228
- }
229
- return;
230
- }
231
- if (name === 'value' && this.multiple) {
232
- if (this.value) {
233
- const nextValues = Array.from(new Set([...this.values, this.value]));
234
- if (!this.areValuesEqual(this.values, nextValues)) {
235
- this.updateValues(nextValues);
236
- }
237
- }
238
- }
182
+ onPropertyChange(name, _, newValue) {
183
+ this._valueSync.handlePropertyChange(name, newValue);
239
184
  }
240
185
  /** Get the currently selected option */
241
186
  get selectedOption() {
@@ -272,6 +217,25 @@ let SelectComponent = class SelectComponent {
272
217
  get labelId() {
273
218
  return `ml-select-label-${this._uid}`;
274
219
  }
220
+ /** Unique id of the error element (for aria-describedby) */
221
+ get errorId() {
222
+ return `ml-select-error-${this._uid}`;
223
+ }
224
+ /** Unique id of the hint element (for aria-describedby) */
225
+ get hintId() {
226
+ return `ml-select-hint-${this._uid}`;
227
+ }
228
+ /**
229
+ * Id of the message that describes the control, or undefined when there is
230
+ * none. The error replaces the hint visually, so it does here too.
231
+ */
232
+ get describedBy() {
233
+ if (this.error)
234
+ return this.errorId;
235
+ if (this.hint)
236
+ return this.hintId;
237
+ return undefined;
238
+ }
275
239
  /** Unique id of the listbox element (for aria-controls) */
276
240
  get listboxId() {
277
241
  return `ml-select-listbox-${this._uid}`;
@@ -447,50 +411,31 @@ let SelectComponent = class SelectComponent {
447
411
  scrollFocusedOptionIntoView() {
448
412
  if (this.focusedIndex < 0)
449
413
  return;
450
- const optionEl = this.elementRef.shadowRoot?.getElementById(this.optionId(this.focusedIndex));
451
- optionEl?.scrollIntoView({ block: 'nearest' });
414
+ scrollOptionIntoView(this.elementRef.shadowRoot, this.optionId(this.focusedIndex));
452
415
  }
453
416
  /** Move focus to next enabled option */
454
417
  focusNextOption() {
455
- const startIndex = this.focusedIndex;
456
- let index = startIndex + 1;
457
- const options = this.getActiveOptions();
458
- while (index < options.length) {
459
- if (!options[index].disabled) {
460
- this.focusedIndex = index;
461
- this.scrollFocusedOptionIntoView();
462
- return;
463
- }
464
- index++;
418
+ const index = findNextEnabledIndex(this.getActiveOptions(), this.focusedIndex);
419
+ if (index >= 0) {
420
+ this.focusedIndex = index;
421
+ this.scrollFocusedOptionIntoView();
465
422
  }
466
423
  }
467
424
  /** Move focus to previous enabled option */
468
425
  focusPreviousOption() {
469
- const startIndex = this.focusedIndex;
470
- let index = startIndex - 1;
471
- const options = this.getActiveOptions();
472
- while (index >= 0) {
473
- if (!options[index].disabled) {
474
- this.focusedIndex = index;
475
- this.scrollFocusedOptionIntoView();
476
- return;
477
- }
478
- index--;
426
+ const index = findPreviousEnabledIndex(this.getActiveOptions(), this.focusedIndex);
427
+ if (index >= 0) {
428
+ this.focusedIndex = index;
429
+ this.scrollFocusedOptionIntoView();
479
430
  }
480
431
  }
481
432
  /** Find first enabled option index */
482
433
  findFirstEnabledIndex() {
483
- return this.getActiveOptions().findIndex((opt) => !opt.disabled);
434
+ return firstEnabledIndex(this.getActiveOptions());
484
435
  }
485
436
  /** Find last enabled option index */
486
437
  findLastEnabledIndex() {
487
- const options = this.getActiveOptions();
488
- for (let i = options.length - 1; i >= 0; i--) {
489
- if (!options[i].disabled) {
490
- return i;
491
- }
492
- }
493
- return -1;
438
+ return lastEnabledIndex(this.getActiveOptions());
494
439
  }
495
440
  getInitialFocusIndex() {
496
441
  const options = this.getActiveOptions();
@@ -511,20 +456,6 @@ let SelectComponent = class SelectComponent {
511
456
  getActiveOptions() {
512
457
  return this.filteredOptions;
513
458
  }
514
- updateValues(values) {
515
- this._syncingValues = true;
516
- this.values = values;
517
- this._syncingValues = false;
518
- }
519
- areValuesEqual(left, right) {
520
- if (left.length !== right.length)
521
- return false;
522
- for (let i = 0; i < left.length; i++) {
523
- if (left[i] !== right[i])
524
- return false;
525
- }
526
- return true;
527
- }
528
459
  };
529
460
  SelectComponent = __decorate([
530
461
  MelodicComponent({
@@ -1 +1 @@
1
- {"version":3,"file":"select.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,iDAibxB,CAAC"}
1
+ {"version":3,"file":"select.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,iDAkcxB,CAAC"}
@@ -119,7 +119,7 @@ export const selectStyles = () => css `
119
119
 
120
120
  .ml-select__required {
121
121
  color: var(--ml-select-required-color, var(--ml-color-danger));
122
- margin-left: var(--ml-space-0-5);
122
+ margin-inline-start: var(--ml-space-0-5);
123
123
  }
124
124
 
125
125
  .ml-select__trigger {
@@ -139,7 +139,7 @@ export const selectStyles = () => css `
139
139
  font-family: var(--ml-select-font-family, var(--ml-font-sans));
140
140
  font-size: var(--ml-select-font-size, var(--ml-text-sm));
141
141
  cursor: pointer;
142
- text-align: left;
142
+ text-align: start;
143
143
  transition:
144
144
  border-color var(--ml-select-transition-duration, var(--ml-duration-150)) var(--ml-select-transition-easing, var(--ml-ease-in-out)),
145
145
  box-shadow var(--ml-select-transition-duration, var(--ml-duration-150)) var(--ml-select-transition-easing, var(--ml-ease-in-out));
@@ -257,15 +257,15 @@ export const selectStyles = () => css `
257
257
  height: 14px;
258
258
  border-radius: var(--ml-select-tag-border-radius, var(--ml-radius-full));
259
259
  object-fit: cover;
260
- margin-left: -2px;
260
+ margin-inline-start: -2px;
261
261
  }
262
262
 
263
263
  .ml-select__tag-remove {
264
264
  border: none;
265
265
  background: transparent;
266
266
  padding: 2px;
267
- margin-left: var(--ml-space-0-5);
268
- margin-right: -4px;
267
+ margin-inline-start: var(--ml-space-0-5);
268
+ margin-inline-end: -4px;
269
269
  color: var(--ml-select-tag-remove-color, var(--ml-color-text-secondary));
270
270
  cursor: pointer;
271
271
  display: inline-flex;
@@ -387,7 +387,7 @@ export const selectStyles = () => css `
387
387
  .ml-select__option-check {
388
388
  flex-shrink: 0;
389
389
  color: var(--ml-select-option-check-color, var(--ml-color-primary));
390
- margin-left: auto;
390
+ margin-inline-start: auto;
391
391
  }
392
392
 
393
393
  .ml-select__hint,
@@ -432,4 +432,21 @@ export const selectStyles = () => css `
432
432
  .ml-select--disabled {
433
433
  pointer-events: none;
434
434
  }
435
+
436
+ /*
437
+ * Forced colors (Windows High Contrast): box-shadow rings and background
438
+ * highlights are not painted there, so focus falls back to a real outline.
439
+ */
440
+ @media (forced-colors: active) {
441
+ .ml-select__trigger:focus,
442
+ .ml-select__trigger:focus-within {
443
+ outline: 2px solid Highlight;
444
+ outline-offset: 2px;
445
+ }
446
+
447
+ .ml-select__option--focused {
448
+ outline: 2px solid Highlight;
449
+ outline-offset: -2px;
450
+ }
451
+ }
435
452
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"select.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,6CAwEhD"}
1
+ {"version":3,"file":"select.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,6CA4EhD"}
@@ -22,13 +22,17 @@ export function selectTemplate(c) {
22
22
  <div class="ml-select__control">
23
23
  <div
24
24
  class="ml-select__trigger"
25
- role="combobox"
26
- tabindex=${c.disabled ? '-1' : '0'}
27
- aria-haspopup="listbox"
28
- aria-expanded=${c.isOpen}
29
- aria-controls=${c.listboxId}
30
- aria-activedescendant=${c.activeDescendant}
31
- aria-labelledby=${c.label ? c.labelId : undefined}
25
+ role=${c.multiple ? undefined : 'combobox'}
26
+ tabindex=${c.multiple ? undefined : c.disabled ? '-1' : '0'}
27
+ aria-haspopup=${c.multiple ? undefined : 'listbox'}
28
+ aria-expanded=${c.multiple ? undefined : String(c.isOpen)}
29
+ aria-controls=${c.multiple ? undefined : c.listboxId}
30
+ aria-activedescendant=${c.multiple ? undefined : c.activeDescendant}
31
+ aria-labelledby=${!c.multiple && c.label ? c.labelId : undefined}
32
+ aria-describedby=${c.multiple ? undefined : c.describedBy}
33
+ aria-invalid=${!c.multiple && c.error ? 'true' : undefined}
34
+ aria-required=${!c.multiple && c.required ? 'true' : undefined}
35
+ aria-disabled=${!c.multiple && c.disabled ? 'true' : undefined}
32
36
  @click=${c.toggle}
33
37
  >
34
38
  <span class="ml-select__value">
@@ -54,7 +58,7 @@ export function selectTemplate(c) {
54
58
  </div>
55
59
  </div>
56
60
 
57
- ${when(!!c.error, () => html `<span class="ml-select__error">${c.error}</span>`, () => html `${when(!!c.hint, () => html `<span class="ml-select__hint">${c.hint}</span>`)}`)}
61
+ ${when(!!c.error, () => html `<span id=${c.errorId} class="ml-select__error">${c.error}</span>`, () => html `${when(!!c.hint, () => html `<span id=${c.hintId} class="ml-select__hint">${c.hint}</span>`)}`)}
58
62
  </div>
59
63
  `;
60
64
  }
@@ -85,8 +89,20 @@ function renderMultiValue(c) {
85
89
  <input
86
90
  class="ml-select__search"
87
91
  type="text"
92
+ role="combobox"
93
+ aria-haspopup="listbox"
94
+ aria-autocomplete="list"
95
+ aria-expanded=${String(c.isOpen)}
96
+ aria-controls=${c.listboxId}
97
+ aria-activedescendant=${c.activeDescendant}
98
+ aria-labelledby=${c.label ? c.labelId : undefined}
99
+ aria-describedby=${c.describedBy}
100
+ aria-invalid=${c.error ? 'true' : undefined}
101
+ aria-required=${c.required ? 'true' : undefined}
88
102
  placeholder=${c.values.length ? '' : c.placeholder}
89
- aria-label=${c.placeholder || 'Search'}
103
+ aria-label=${c.label ? undefined : c.placeholder || 'Search'}
104
+ aria-disabled=${c.disabled ? 'true' : undefined}
105
+ tabindex=${c.disabled ? '-1' : undefined}
90
106
  .value=${c.search}
91
107
  @input=${c.handleSearchInput}
92
108
  @click=${c.handleSearchClick}
@@ -82,7 +82,7 @@ let SliderComponent = class SliderComponent {
82
82
  // Derive it from the same token that sizes the thumb so themed thumb
83
83
  // sizes keep the fill aligned.
84
84
  const p = this.ratio;
85
- return `calc(${p * 100}% + ${0.5 - p} * var(--ml-slider-thumb-size))`;
85
+ return `calc(${p * 100}% + ${0.5 - p} * var(--ml-slider-thumb-size, 20px))`;
86
86
  }
87
87
  };
88
88
  SliderComponent = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"slider.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/slider/slider.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,iDAoNxB,CAAC"}
1
+ {"version":3,"file":"slider.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/slider/slider.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,iDA+NxB,CAAC"}