mtrl 0.10.4 → 0.10.6

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 (230) hide show
  1. package/README.md +15 -5
  2. package/dist/README.md +15 -5
  3. package/dist/components/bottom-app-bar/bottom-app-bar.js +2 -1
  4. package/dist/components/bottom-app-bar/index.d.ts +3 -1
  5. package/dist/components/button/api.js +3 -0
  6. package/dist/components/button/constants.d.ts +2 -0
  7. package/dist/components/button/index.d.ts +1 -0
  8. package/dist/components/button/types.d.ts +7 -1
  9. package/dist/components/button-group/button-group.js +25 -6
  10. package/dist/components/button-group/config.js +2 -2
  11. package/dist/components/button-group/constants.d.ts +8 -2
  12. package/dist/components/button-group/index.d.ts +1 -0
  13. package/dist/components/button-group/types.d.ts +5 -1
  14. package/dist/components/card/index.d.ts +21 -3
  15. package/dist/components/card/index.js +1 -1
  16. package/dist/components/card/types.d.ts +20 -4
  17. package/dist/components/carousel/api.d.ts +1 -0
  18. package/dist/components/carousel/api.js +4 -0
  19. package/dist/components/carousel/features/scroll.d.ts +1 -0
  20. package/dist/components/carousel/features/scroll.js +117 -2
  21. package/dist/components/carousel/types.d.ts +11 -0
  22. package/dist/components/checkbox/api.js +3 -0
  23. package/dist/components/checkbox/config.js +1 -0
  24. package/dist/components/checkbox/types.d.ts +8 -2
  25. package/dist/components/chips/types.d.ts +10 -2
  26. package/dist/components/datepicker/index.d.ts +3 -1
  27. package/dist/components/datepicker/index.js +1 -1
  28. package/dist/components/extended-fab/api.d.ts +2 -0
  29. package/dist/components/extended-fab/api.js +3 -0
  30. package/dist/components/extended-fab/config.d.ts +1 -0
  31. package/dist/components/extended-fab/config.js +1 -0
  32. package/dist/components/extended-fab/types.d.ts +2 -0
  33. package/dist/components/fab/api.d.ts +2 -0
  34. package/dist/components/fab/api.js +3 -0
  35. package/dist/components/fab/config.d.ts +1 -0
  36. package/dist/components/fab/config.js +1 -0
  37. package/dist/components/fab/constants.d.ts +2 -1
  38. package/dist/components/fab/types.d.ts +2 -0
  39. package/dist/components/fab-menu/fab-menu.js +2 -1
  40. package/dist/components/icon-button/api.js +3 -0
  41. package/dist/components/icon-button/constants.d.ts +2 -0
  42. package/dist/components/icon-button/types.d.ts +5 -0
  43. package/dist/components/index.d.ts +18 -5
  44. package/dist/components/index.js +2 -1
  45. package/dist/components/list/types.d.ts +5 -3
  46. package/dist/components/menu/features/keyboard.js +8 -5
  47. package/dist/components/menu/features/opener.js +1 -1
  48. package/dist/components/menu/index.d.ts +1 -0
  49. package/dist/components/navigation-rail/types.d.ts +2 -0
  50. package/dist/components/progress/features/canvas.js +1 -1
  51. package/dist/components/progress/features/colors.d.ts +2 -1
  52. package/dist/components/progress/features/colors.js +20 -10
  53. package/dist/components/radios/api.d.ts +1 -0
  54. package/dist/components/radios/api.js +3 -0
  55. package/dist/components/radios/constants.d.ts +9 -9
  56. package/dist/components/radios/radio.d.ts +1 -0
  57. package/dist/components/radios/radio.js +1 -0
  58. package/dist/components/radios/types.d.ts +10 -3
  59. package/dist/components/search/features/states.d.ts +2 -0
  60. package/dist/components/search/features/states.js +12 -1
  61. package/dist/components/search/features/structure.js +2 -0
  62. package/dist/components/search/types.d.ts +6 -6
  63. package/dist/components/segmented-button/config.js +2 -2
  64. package/dist/components/select/api.js +3 -0
  65. package/dist/components/select/constants.d.ts +1 -1
  66. package/dist/components/select/features.js +2 -0
  67. package/dist/components/select/index.d.ts +1 -0
  68. package/dist/components/select/types.d.ts +6 -0
  69. package/dist/components/split-button/types.d.ts +5 -1
  70. package/dist/components/switch/api.js +3 -0
  71. package/dist/components/switch/config.js +1 -0
  72. package/dist/components/switch/index.d.ts +6 -2
  73. package/dist/components/switch/index.js +1 -1
  74. package/dist/components/switch/types.d.ts +6 -2
  75. package/dist/components/tabs/config.js +2 -2
  76. package/dist/components/tabs/index.d.ts +36 -3
  77. package/dist/components/tabs/index.js +2 -1
  78. package/dist/components/tabs/tab.js +8 -1
  79. package/dist/components/tabs/types.d.ts +3 -1
  80. package/dist/components/tabs/utils.js +2 -1
  81. package/dist/components/textfield/api.d.ts +5 -0
  82. package/dist/components/textfield/api.js +209 -188
  83. package/dist/components/textfield/config.js +4 -3
  84. package/dist/components/textfield/constants.d.ts +24 -7
  85. package/dist/components/textfield/constants.js +9 -7
  86. package/dist/components/textfield/features/index.d.ts +3 -1
  87. package/dist/components/textfield/features/index.js +1 -0
  88. package/dist/components/textfield/features/leading-icon.js +1 -0
  89. package/dist/components/textfield/features/placement.js +15 -2
  90. package/dist/components/textfield/features/required.d.ts +33 -0
  91. package/dist/components/textfield/features/required.js +50 -0
  92. package/dist/components/textfield/features/supporting-text.js +43 -21
  93. package/dist/components/textfield/features/trailing-icon.d.ts +23 -1
  94. package/dist/components/textfield/features/trailing-icon.js +39 -5
  95. package/dist/components/textfield/index.d.ts +16 -1
  96. package/dist/components/textfield/index.js +1 -0
  97. package/dist/components/textfield/textfield.js +2 -2
  98. package/dist/components/textfield/types.d.ts +33 -3
  99. package/dist/components/timepicker/types.d.ts +2 -1
  100. package/dist/components/toolbar/toolbar.js +2 -1
  101. package/dist/components/tooltip/api.js +20 -18
  102. package/dist/components/tooltip/constants.d.ts +4 -1
  103. package/dist/components/top-app-bar/index.d.ts +3 -1
  104. package/dist/components/top-app-bar/top-app-bar.d.ts +2 -57
  105. package/dist/components/top-app-bar/top-app-bar.js +2 -1
  106. package/dist/core/compose/features/input.d.ts +9 -2
  107. package/dist/core/utils/theme.d.ts +6 -2
  108. package/dist/core/utils/theme.js +12 -19
  109. package/dist/elements/carousel.d.ts +5 -0
  110. package/dist/elements/carousel.js +1 -0
  111. package/dist/elements/css/textfield.js +1 -1
  112. package/dist/elements/define.d.ts +8 -0
  113. package/dist/elements/define.js +2 -1
  114. package/dist/elements/dialog.js +1 -1
  115. package/dist/elements/icon-button.d.ts +3 -2
  116. package/dist/elements/index.d.ts +15 -4
  117. package/dist/elements/index.js +2 -1
  118. package/dist/elements/preupgrade.css +1 -1
  119. package/dist/elements/textfield.d.ts +1 -1
  120. package/dist/elements/textfield.js +1 -1
  121. package/dist/index.cjs +0 -0
  122. package/dist/package.json +1 -1
  123. package/dist/react/dialog.d.ts +3 -0
  124. package/dist/react/dialog.js +3 -0
  125. package/dist/react/index.d.ts +4 -1
  126. package/dist/react/index.js +2 -1
  127. package/dist/solid/dialog.d.ts +3 -0
  128. package/dist/solid/dialog.js +3 -0
  129. package/dist/solid/index.d.ts +4 -1
  130. package/dist/solid/index.js +2 -1
  131. package/dist/styles/badge.css +1 -1
  132. package/dist/styles/base.css +2 -2
  133. package/dist/styles/bottom-app-bar.css +1 -1
  134. package/dist/styles/bottom-sheet.css +1 -1
  135. package/dist/styles/button-group.css +1 -1
  136. package/dist/styles/button.css +1 -1
  137. package/dist/styles/card.css +1 -1
  138. package/dist/styles/carousel.css +1 -1
  139. package/dist/styles/checkbox.css +1 -1
  140. package/dist/styles/chips.css +1 -1
  141. package/dist/styles/datepicker.css +1 -1
  142. package/dist/styles/dialog.css +1 -1
  143. package/dist/styles/divider.css +1 -1
  144. package/dist/styles/drawer.css +1 -1
  145. package/dist/styles/extended-fab.css +1 -1
  146. package/dist/styles/fab-menu.css +1 -1
  147. package/dist/styles/fab.css +1 -1
  148. package/dist/styles/icon-button.css +1 -1
  149. package/dist/styles/list.css +1 -1
  150. package/dist/styles/loading-indicator.css +1 -1
  151. package/dist/styles/menu.css +1 -1
  152. package/dist/styles/navigation-rail.css +1 -1
  153. package/dist/styles/progress.css +1 -1
  154. package/dist/styles/radios.css +1 -1
  155. package/dist/styles/search.css +1 -1
  156. package/dist/styles/segmented-button.css +1 -1
  157. package/dist/styles/select.css +1 -1
  158. package/dist/styles/side-sheet.css +1 -1
  159. package/dist/styles/slider.css +1 -1
  160. package/dist/styles/snackbar.css +1 -1
  161. package/dist/styles/split-button.css +1 -1
  162. package/dist/styles/switch.css +1 -1
  163. package/dist/styles/tabs.css +1 -1
  164. package/dist/styles/textfield.css +2 -2
  165. package/dist/styles/timepicker.css +1 -1
  166. package/dist/styles/toolbar.css +1 -1
  167. package/dist/styles/tooltip.css +1 -1
  168. package/dist/styles/top-app-bar.css +1 -1
  169. package/dist/styles/utilities.css +1 -1
  170. package/dist/styles.css +2 -2
  171. package/dist/svelte/Dialog.svelte +3 -0
  172. package/dist/svelte/index.d.ts +5 -1
  173. package/dist/svelte/index.js +5 -1
  174. package/dist/themes/autumn.css +2 -2
  175. package/dist/themes/baseline.css +2 -2
  176. package/dist/themes/brownbeige.css +2 -2
  177. package/dist/themes/browngreen.css +2 -2
  178. package/dist/themes/content.css +2 -2
  179. package/dist/themes/desert.css +2 -2
  180. package/dist/themes/expressive.css +2 -2
  181. package/dist/themes/fidelity.css +2 -2
  182. package/dist/themes/forest.css +2 -2
  183. package/dist/themes/fruit-salad.css +2 -2
  184. package/dist/themes/highcontrast.css +2 -2
  185. package/dist/themes/legacy.css +2 -2
  186. package/dist/themes/material.css +2 -2
  187. package/dist/themes/monochrome.css +2 -2
  188. package/dist/themes/neutral.css +2 -2
  189. package/dist/themes/ocean.css +2 -2
  190. package/dist/themes/rainbow.css +2 -2
  191. package/dist/themes/sageivory.css +2 -2
  192. package/dist/themes/spring.css +2 -2
  193. package/dist/themes/summer.css +2 -2
  194. package/dist/themes/sunset.css +2 -2
  195. package/dist/themes/tealcaramel.css +2 -2
  196. package/dist/themes/vibrant.css +2 -2
  197. package/dist/themes/winter.css +2 -2
  198. package/dist/vue/dialog.d.ts +3 -0
  199. package/dist/vue/dialog.js +3 -0
  200. package/dist/vue/index.d.ts +4 -1
  201. package/dist/vue/index.js +2 -1
  202. package/package.json +1 -1
  203. package/src/styles/abstract/_theme.scss +6 -6
  204. package/src/styles/abstract/_variables.scss +14 -4
  205. package/src/styles/components/_textfield.scss +61 -8
  206. package/src/styles/themes/_autumn.scss +173 -0
  207. package/src/styles/themes/_base-theme.scss +100 -12
  208. package/src/styles/themes/_baseline.scss +172 -0
  209. package/src/styles/themes/_brownbeige.scss +150 -0
  210. package/src/styles/themes/_browngreen.scss +183 -0
  211. package/src/styles/themes/_content.scss +148 -0
  212. package/src/styles/themes/_desert.scss +150 -0
  213. package/src/styles/themes/_expressive.scss +150 -0
  214. package/src/styles/themes/_fidelity.scss +148 -0
  215. package/src/styles/themes/_forest.scss +175 -0
  216. package/src/styles/themes/_fruit-salad.scss +150 -0
  217. package/src/styles/themes/_highcontrast.scss +74 -0
  218. package/src/styles/themes/_legacy.scss +181 -0
  219. package/src/styles/themes/_material.scss +181 -0
  220. package/src/styles/themes/_monochrome.scss +134 -0
  221. package/src/styles/themes/_neutral.scss +150 -0
  222. package/src/styles/themes/_ocean.scss +175 -0
  223. package/src/styles/themes/_rainbow.scss +150 -0
  224. package/src/styles/themes/_sageivory.scss +150 -0
  225. package/src/styles/themes/_spring.scss +171 -0
  226. package/src/styles/themes/_summer.scss +150 -0
  227. package/src/styles/themes/_sunset.scss +175 -0
  228. package/src/styles/themes/_tealcaramel.scss +150 -0
  229. package/src/styles/themes/_vibrant.scss +150 -0
  230. package/src/styles/themes/_winter.scss +181 -0
@@ -1,6 +1,7 @@
1
1
  import type { ForwardedEventPayload } from "../../core/dom/index.js";
2
2
  /** Current item reported by programmatic navigation or native scrolling. */
3
3
  export interface CarouselChangePayload {
4
+ /** The current item's index. In 1.0 the payload carries it as `value`, and `index` is gone. */
4
5
  index: number;
5
6
  }
6
7
  /** Events emitted by the scroll feature and forwarded from the root. */
@@ -43,6 +44,14 @@ export interface CarouselConfig {
43
44
  cornerRadius?: number;
44
45
  /** Snap to items after scrolling; on by default except for uncontained layouts */
45
46
  snap?: boolean;
47
+ /**
48
+ * Scroll horizontal carousels with a vertical mouse wheel; false by default.
49
+ * Normalized deltas accumulate per gesture and glide to directional snap points.
50
+ * One notch advances at least one item; momentum can pass several whole items.
51
+ * At either edge the page scrolls.
52
+ * Horizontal trackpad gestures, zoom and vertical layouts stay native.
53
+ */
54
+ wheel?: boolean;
46
55
  initialSlide?: number;
47
56
  minSmallItemWidth?: number;
48
57
  maxSmallItemWidth?: number;
@@ -64,6 +73,8 @@ export interface CarouselComponent {
64
73
  goTo: (index: number) => CarouselComponent;
65
74
  getCurrentSlide: () => number;
66
75
  getVariant: () => CarouselVariant;
76
+ /** Enable or disable vertical mouse wheel scrolling in place. */
77
+ setWheel: (on: boolean) => CarouselComponent;
67
78
  addSlide: (slide: CarouselSlide, index?: number) => CarouselComponent;
68
79
  removeSlide: (index: number) => CarouselComponent;
69
80
  destroy: () => void;
@@ -76,6 +76,9 @@ export const withAPI = ({ disabled, lifecycle, checkable }) => (component) => ({
76
76
  disabled.enable();
77
77
  return this;
78
78
  },
79
+ isDisabled() {
80
+ return disabled.isDisabled();
81
+ },
79
82
  disable() {
80
83
  disabled.disable();
81
84
  return this;
@@ -43,6 +43,7 @@ export const getApiConfig = (comp) => ({
43
43
  disabled: {
44
44
  enable: comp.disabled.enable,
45
45
  disable: comp.disabled.disable,
46
+ isDisabled: comp.disabled.isDisabled,
46
47
  },
47
48
  lifecycle: {
48
49
  destroy: comp.lifecycle.destroy,
@@ -6,6 +6,8 @@ import type { EventCallback } from "../../core/state/emitter.js";
6
6
  * @remarks
7
7
  * - filled: Checkbox with filled background when checked (default)
8
8
  * - outlined: Checkbox with outline only, for less visual emphasis
9
+ * @deprecated The type of the deprecated `variant` option, which has no effect: M3 has one
10
+ * checkbox style (FLO-94, FLO-265). Removed in 1.0.
9
11
  */
10
12
  export type CheckboxVariant = "filled" | "outlined";
11
13
  /**
@@ -104,13 +106,13 @@ export interface CheckboxConfig {
104
106
  */
105
107
  componentName?: string;
106
108
  }
107
- /** A checked-state change from the native input or a programmatic setter. */
109
+ /** A checked-state change from native input activation. Public setters are silent. */
108
110
  export interface CheckboxChangePayload {
109
111
  /** The new checked state. */
110
112
  checked: boolean;
111
113
  /** The input's HTML value attribute, not the boolean checked state. */
112
114
  value: string;
113
- /** Present for input-driven changes; absent for check/uncheck/toggle/setValue. */
115
+ /** The original native change event, when supplied by the emitter. */
114
116
  nativeEvent?: Event;
115
117
  }
116
118
  /** Events emitted by the checkbox API. DOM clicks/focus are not forwarded. */
@@ -231,6 +233,8 @@ export interface CheckboxComponent {
231
233
  * @returns Checkbox component for method chaining
232
234
  */
233
235
  disable: () => CheckboxComponent;
236
+ /** Whether the checkbox is disabled (FLO-384) */
237
+ isDisabled: () => boolean;
234
238
  /**
235
239
  * Destroys the checkbox component and cleans up resources
236
240
  * Removes event listeners and DOM references
@@ -246,6 +250,7 @@ export interface ApiOptions {
246
250
  disabled: {
247
251
  enable: () => void;
248
252
  disable: () => void;
253
+ isDisabled: () => boolean;
249
254
  };
250
255
  lifecycle: {
251
256
  destroy: () => void;
@@ -278,6 +283,7 @@ export interface BaseComponent {
278
283
  disabled?: {
279
284
  enable: () => void;
280
285
  disable: () => void;
286
+ isDisabled: () => boolean;
281
287
  };
282
288
  lifecycle?: {
283
289
  destroy: () => void;
@@ -36,18 +36,24 @@ export interface ChipConfig {
36
36
  trailingLabel?: string;
37
37
  /** The trailing button opens a menu: aria-haspopup="menu", and a drop-down arrow unless trailingIcon is set. */
38
38
  trailingMenu?: boolean;
39
+ /** In 1.0 a chip's `onClick` receives the `click` payload, `{ event, originalEvent, element }`, not the chip. */
39
40
  onClick?: (chip: ChipComponent) => void;
41
+ /** In 1.0 a chip's `onChange` receives one object, `{ selected, chip, value }`, the `change` payload. */
40
42
  onChange?: (selected: boolean, chip: ChipComponent) => void;
41
43
  onSelect?: (chip: ChipComponent) => void;
42
44
  class?: string;
43
45
  prefix?: string;
44
46
  componentName?: string;
45
47
  ripple?: boolean;
46
- /** @internal Selection belongs to the chips container. */
48
+ /**
49
+ * @internal Selection belongs to the chips container.
50
+ * @deprecated Not for apps: moves out of ChipConfig in 1.0.0 (FLO-381).
51
+ */
47
52
  managedSelection?: boolean;
48
53
  /**
49
54
  * @internal The chip is a cell of a chip set's grid (FLO-261): the root is a
50
55
  * `gridcell`, and a one-action chip's cell is its focus target.
56
+ * @deprecated Not for apps: moves out of ChipConfig in 1.0.0 (FLO-381).
51
57
  */
52
58
  cell?: boolean;
53
59
  }
@@ -148,7 +154,9 @@ export interface ChipsConfig {
148
154
  */
149
155
  selectionRequired?: boolean;
150
156
  /**
151
- * Callback function when chip selection changes
157
+ * Callback function when chip selection changes.
158
+ * In 1.0 it receives one object, `{ value, selected, changed }` (no array, no
159
+ * second argument), and also hears `selectByValue(values, true)`.
152
160
  */
153
161
  onChange?: (event: ChipsChangeEvent, changedValue: string | null) => void;
154
162
  /**
@@ -1,3 +1,5 @@
1
1
  export { default } from "./datepicker.js";
2
2
  export type { DatePickerConfig, DatePickerComponent, DatePickerEvents, DatePickerValue, DatePickerValueOf, DatePickerInput, DatePickerChangePayload, DatePickerVisibilityPayload, DatePickerTapPayload, DatePickerSwipePayload, DatePickerVariant, DatePickerView, DatePickerSelectionMode, } from "./types.js";
3
- export { DEFAULT_DATE_FORMAT } from "./types.js";
3
+ export {
4
+ /** @deprecated Internal, no replacement: removed from mtrl/components/datepicker in 1.0.0 (FLO-381). */
5
+ DEFAULT_DATE_FORMAT, } from "./types.js";
@@ -1,2 +1,2 @@
1
1
  export { default } from "./datepicker.js";
2
- export { DEFAULT_DATE_FORMAT } from "./types.js";
2
+ export { DEFAULT_DATE_FORMAT, } from "./types.js";
@@ -17,6 +17,8 @@ interface ApiOptions {
17
17
  enable: () => void;
18
18
  /** Disables the component */
19
19
  disable: () => void;
20
+ /** Whether the component is disabled */
21
+ isDisabled: () => boolean;
20
22
  };
21
23
  /**
22
24
  * Lifecycle management API
@@ -10,6 +10,9 @@ export const withAPI = ({ disabled, lifecycle, text, className }) => (component)
10
10
  disabled.enable();
11
11
  return this;
12
12
  },
13
+ isDisabled() {
14
+ return disabled.isDisabled();
15
+ },
13
16
  disable() {
14
17
  disabled.disable();
15
18
  return this;
@@ -587,6 +587,7 @@ export declare const getApiConfig: (comp: Pick<ExtendedFabComponent, "disabled"
587
587
  disabled: {
588
588
  enable: () => void;
589
589
  disable: () => void;
590
+ isDisabled: () => boolean;
590
591
  };
591
592
  lifecycle: {
592
593
  destroy: () => void;
@@ -60,6 +60,7 @@ export const getApiConfig = (comp) => ({
60
60
  disabled: {
61
61
  enable: () => comp.disabled.enable(),
62
62
  disable: () => comp.disabled.disable(),
63
+ isDisabled: () => comp.disabled.isDisabled(),
63
64
  },
64
65
  lifecycle: {
65
66
  destroy: () => comp.lifecycle.destroy(),
@@ -526,6 +526,8 @@ export interface ExtendedFabComponent {
526
526
  * ```
527
527
  */
528
528
  disable: () => ExtendedFabComponent;
529
+ /** Whether the extended FAB is disabled (FLO-384) */
530
+ isDisabled: () => boolean;
529
531
  /**
530
532
  * Sets the Extended FAB's icon
531
533
  *
@@ -16,6 +16,8 @@ interface ApiOptions {
16
16
  enable: () => void;
17
17
  /** Disables the component */
18
18
  disable: () => void;
19
+ /** Whether the component is disabled */
20
+ isDisabled: () => boolean;
19
21
  };
20
22
  /**
21
23
  * Lifecycle management API
@@ -10,6 +10,9 @@ export const withAPI = ({ disabled, lifecycle, className }) => (component) => ({
10
10
  disabled.enable();
11
11
  return this;
12
12
  },
13
+ isDisabled() {
14
+ return disabled.isDisabled();
15
+ },
13
16
  disable() {
14
17
  disabled.disable();
15
18
  return this;
@@ -587,6 +587,7 @@ export declare const getApiConfig: (comp: Pick<FabComponent, "disabled" | "lifec
587
587
  disabled: {
588
588
  enable: () => void;
589
589
  disable: () => void;
590
+ isDisabled: () => boolean;
590
591
  };
591
592
  lifecycle: {
592
593
  destroy: () => void;
@@ -45,6 +45,7 @@ export const getApiConfig = (comp) => ({
45
45
  disabled: {
46
46
  enable: () => comp.disabled.enable(),
47
47
  disable: () => comp.disabled.disable(),
48
+ isDisabled: () => comp.disabled.isDisabled(),
48
49
  },
49
50
  lifecycle: {
50
51
  destroy: () => comp.lifecycle.destroy(),
@@ -53,7 +53,7 @@ export declare const FAB_CLASSES: {
53
53
  readonly ICON: "fab__icon";
54
54
  /** Applied when FAB is lowered (pressed state) */
55
55
  readonly LOWERED: "fab--lowered";
56
- /** Applied to small FABs */
56
+ /** @deprecated Applied to small FABs; the small size is deprecated (FAB_SIZES.SMALL). Removed in 1.0. */
57
57
  readonly SMALL: "fab--small";
58
58
  /** Applied to medium FABs */
59
59
  readonly MEDIUM: "fab--medium";
@@ -72,6 +72,7 @@ export declare const FAB_TYPES: {
72
72
  * Default icon sizes based on FAB size
73
73
  */
74
74
  export declare const FAB_ICON_SIZES: {
75
+ /** @deprecated The small FAB's icon size; the small size is deprecated (FAB_SIZES.SMALL). Removed in 1.0. */
75
76
  readonly SMALL: "24px";
76
77
  readonly DEFAULT: "24px";
77
78
  readonly MEDIUM: "28px";
@@ -462,6 +462,8 @@ export interface FabComponent {
462
462
  * ```
463
463
  */
464
464
  disable: () => FabComponent;
465
+ /** Whether the FAB is disabled (FLO-384) */
466
+ isDisabled: () => boolean;
465
467
  /**
466
468
  * Sets the FAB's icon
467
469
  *
@@ -1,3 +1,4 @@
1
+ import { processClassNames } from "../../core/config/component.js";
1
2
  import { pipe } from "../../core/compose/pipe.js";
2
3
  import { createBase, withElement } from "../../core/compose/component.js";
3
4
  import { withEvents, withLifecycle } from "../../core/compose/features/index.js";
@@ -27,7 +28,7 @@ const createFabMenu = (config) => {
27
28
  `${block}--${color}`,
28
29
  `${block}--${size}`,
29
30
  placement !== "none" ? `${block}--${placement}` : "",
30
- settings.class ?? "",
31
+ processClassNames(settings.className || ""),
31
32
  ].filter(Boolean),
32
33
  }), withLifecycle())(settings);
33
34
  const resources = getCleanup(component);
@@ -109,6 +109,9 @@ export const withAPI = ({ disabled, lifecycle, toggleState }) => (component) =>
109
109
  disabled.enable();
110
110
  return iconButtonComponent;
111
111
  },
112
+ isDisabled() {
113
+ return disabled.isDisabled();
114
+ },
112
115
  disable() {
113
116
  disabled.disable();
114
117
  return iconButtonComponent;
@@ -115,7 +115,9 @@ export declare const ICON_BUTTON_CLASSES: {
115
115
  */
116
116
  export declare const DEFAULT_RIPPLE_CONFIG: {
117
117
  readonly DURATION: 450;
118
+ /** @deprecated Has no effect: the option it is the default of is never applied (FLO-268). Removed in 1.0. */
118
119
  readonly TIMING: "cubic-bezier(0.4, 0.0, 0.2, 1)";
120
+ /** @deprecated Has no effect: the option it is the default of is never applied (FLO-268). Removed in 1.0. */
119
121
  readonly OPACITY: [string, string];
120
122
  };
121
123
  /**
@@ -74,6 +74,9 @@ export interface IconButtonConfig extends BaseComponentConfig {
74
74
  * Whether the IconButton supports toggle (selection) behavior
75
75
  * When true, the button can be selected/unselected
76
76
  *
77
+ * A click emits `change`. The DOM `toggle` event the button also dispatches
78
+ * is deprecated and removed in 1.0: listen to `change`.
79
+ *
77
80
  * @default false
78
81
  */
79
82
  toggle?: boolean;
@@ -310,6 +313,8 @@ export interface IconButtonComponent {
310
313
  * @returns The IconButton component for chaining
311
314
  */
312
315
  disable: () => IconButtonComponent;
316
+ /** Whether the icon button is disabled (FLO-384) */
317
+ isDisabled: () => boolean;
313
318
  /**
314
319
  * Sets the IconButton's icon
315
320
  * @param icon - Icon HTML content
@@ -49,19 +49,26 @@ export { clearSnackbars } from "./snackbar/index.js";
49
49
  export { default as createSwitch } from "./switch/index.js";
50
50
  export { default as createTabs } from "./tabs/index.js";
51
51
  export { createTab } from "./tabs/tab.js";
52
- export { default as createTextfield } from "./textfield/index.js";
52
+ export { default as createTextField } from "./textfield/index.js";
53
+ export {
54
+ /** @deprecated Use createTextField: M3 writes "text field" as two words. Removed in 1.0 (FLO-383). */
55
+ default as createTextfield, } from "./textfield/index.js";
53
56
  export { default as createTimePicker } from "./timepicker/index.js";
54
57
  export { default as createToolbar } from "./toolbar/index.js";
55
58
  export { default as createTopAppBar } from "./top-app-bar/index.js";
56
59
  export { default as createTooltip } from "./tooltip/index.js";
57
60
  export { createCardContent, createCardHeader, createCardActions, createCardMedia, } from "./card/content.js";
58
61
  export type { BadgeConfig, BadgeComponent } from "./badge/types.js";
59
- export type { BottomAppBarConfig, BottomAppBar } from "./bottom-app-bar/types.js";
62
+ export type { BottomAppBarConfig, BottomAppBar as BottomAppBarComponent,
63
+ /** @deprecated Use BottomAppBarComponent, the name every component type has. Removed in 1.0 (FLO-383). */
64
+ BottomAppBar, } from "./bottom-app-bar/types.js";
60
65
  export type { BottomSheetConfig, BottomSheetComponent, BottomSheetVariant, BottomSheetState, BottomSheetStateEvent, BottomSheetEventHandlers, } from "./bottom-sheet/types.js";
61
66
  export type { SideSheetConfig, SideSheetComponent, SideSheetVariant, SideSheetPosition, SideSheetEventHandlers, } from "./side-sheet/types.js";
62
67
  export type { ButtonConfig, ButtonComponent, ButtonVariant, } from "./button/types.js";
63
68
  export type { ButtonGroupConfig, ButtonGroupComponent, ButtonGroupItemConfig, ButtonGroupEvent, ButtonGroupEventType, ButtonGroupVariant, ButtonGroupOrientation, ButtonGroupDensity, } from "./button-group/types.js";
64
- export type { CardSchema } from "./card/types.js";
69
+ export type { CardSchema as CardConfig,
70
+ /** @deprecated Use CardConfig. Removed in 1.0 (FLO-383). */
71
+ CardSchema, } from "./card/types.js";
65
72
  export type { CarouselConfig, CarouselComponent } from "./carousel/types.js";
66
73
  export type { CheckboxConfig, CheckboxComponent } from "./checkbox/types.js";
67
74
  export type { ChipConfig, ChipComponent, ChipType, ChipEvents, ChipChangePayload, AssistChipConfig, FilterChipConfig, InputChipConfig, SuggestionChipConfig, ChipsConfig, ChipsComponent, } from "./chips/types.js";
@@ -86,9 +93,15 @@ export type { SliderConfig, SliderComponent, SliderEvent, } from "./slider/types
86
93
  export type { SnackbarConfig, SnackbarComponent } from "./snackbar/types.js";
87
94
  export type { SwitchConfig, SwitchComponent } from "./switch/types.js";
88
95
  export type { TabsConfig, TabsComponent, TabConfig, TabComponent, } from "./tabs/types.js";
89
- export type { TextfieldConfig, TextfieldComponent } from "./textfield/types.js";
96
+ export type { TextfieldConfig as TextFieldConfig, TextfieldComponent as TextFieldComponent,
97
+ /** @deprecated Use TextFieldConfig: M3 writes "text field" as two words. Removed in 1.0 (FLO-383). */
98
+ TextfieldConfig,
99
+ /** @deprecated Use TextFieldComponent: M3 writes "text field" as two words. Removed in 1.0 (FLO-383). */
100
+ TextfieldComponent, } from "./textfield/types.js";
90
101
  export type { TimePickerConfig, TimePickerComponent } from "./timepicker/types.js";
91
102
  export type { FabMenuConfig, FabMenuComponent, FabMenuEvents, FabMenuItem } from "./fab-menu/types.js";
92
103
  export type { ToolbarConfig, ToolbarComponent, ToolbarEvents, ToolbarItem, } from "./toolbar/types.js";
93
- export type { TopAppBarConfig, TopAppBar } from "./top-app-bar/types.js";
104
+ export type { TopAppBarConfig, TopAppBar as TopAppBarComponent,
105
+ /** @deprecated Use TopAppBarComponent, the name every component type has. Removed in 1.0 (FLO-383). */
106
+ TopAppBar, } from "./top-app-bar/types.js";
94
107
  export type { TooltipConfig, TooltipComponent } from "./tooltip/types.js";
@@ -33,7 +33,8 @@ export { clearSnackbars } from "./snackbar/index.js";
33
33
  export { default as createSwitch } from "./switch/index.js";
34
34
  export { default as createTabs } from "./tabs/index.js";
35
35
  export { createTab } from "./tabs/tab.js";
36
- export { default as createTextfield } from "./textfield/index.js";
36
+ export { default as createTextField } from "./textfield/index.js";
37
+ export { default as createTextfield, } from "./textfield/index.js";
37
38
  export { default as createTimePicker } from "./timepicker/index.js";
38
39
  export { default as createToolbar } from "./toolbar/index.js";
39
40
  export { default as createTopAppBar } from "./top-app-bar/index.js";
@@ -1,3 +1,4 @@
1
+ import type { ForwardedEventPayload } from "../../core/dom/index.js";
1
2
  /**
2
3
  * Configuration for the List component
3
4
  * @interface ListConfig
@@ -375,8 +376,9 @@ export interface ListComponent<T = unknown> {
375
376
  export interface ListEvents<T = unknown> {
376
377
  select: (event: SelectEvent<T>) => void;
377
378
  load: (event: LoadEvent<T>) => void;
378
- scroll: (event: {
379
- originalEvent: Event;
380
- component: ListComponent<T>;
379
+ scroll: (event: ForwardedEventPayload<Event, HTMLElement> & {
380
+ /** @deprecated Never sent: the root's scroll is forwarded without it. Removed in 1.0 (FLO-380, FLO-384). */
381
+ component?: ListComponent<T>;
381
382
  }) => void;
383
+ keydown: (event: ForwardedEventPayload<KeyboardEvent, HTMLElement>) => void;
382
384
  }
@@ -41,11 +41,11 @@ export const createKeyboardNavigation = (component) => {
41
41
  return null;
42
42
  const level = parseInt(menuElement.getAttribute("data-level") || "1", 10);
43
43
  const owner = component.element.id;
44
- const ownerFilter = owner ? `[data-owner="${owner}"]` : "";
45
44
  const scope = level <= 1
46
45
  ? component.element
47
- : menuElement.getRootNode().querySelector(`.${component.getClass("menu--submenu")}${ownerFilter}[data-level="${level - 1}"]`);
48
- return ((scope ?? component.element).querySelector(`.${component.getClass("menu__item")}[data-id="${parentId}"]`) ?? null);
46
+ : Array.from(menuElement.getRootNode().querySelectorAll(`.${component.getClass("menu--submenu")}`)).find((candidate) => (!owner || candidate.getAttribute("data-owner") === owner) &&
47
+ candidate.getAttribute("data-level") === String(level - 1));
48
+ return Array.from((scope ?? component.element).querySelectorAll(`.${component.getClass("menu__item")}`)).find((candidate) => candidate.getAttribute("data-id") === parentId) ?? null;
49
49
  };
50
50
  const menuItems = (menuElement) => Array.from(menuElement.querySelectorAll(`.${component.getClass("menu__item")}`));
51
51
  const resetTypeahead = () => {
@@ -59,8 +59,11 @@ export const createKeyboardNavigation = (component) => {
59
59
  resetTypeahead();
60
60
  const items = menuItems(menuElement);
61
61
  items.forEach((item) => item.setAttribute("tabindex", "-1"));
62
- if (items.length > 0)
63
- items[0].setAttribute("tabindex", "0");
62
+ items[0]?.setAttribute("tabindex", "0");
63
+ const focused = activeElementOf(menuElement);
64
+ if (focused !== menuElement && menuElement.contains(focused) ||
65
+ focused?.closest(`.${component.getClass("menu--submenu")}`)?.getAttribute("data-owner") === menuElement.id)
66
+ return;
64
67
  if (interactionType === "keyboard" && items.length > 0) {
65
68
  items[0].focus();
66
69
  return;
@@ -50,7 +50,7 @@ const withOpener = (config) => (component) => {
50
50
  };
51
51
  const determineActiveClass = (element) => {
52
52
  const classPrefix = component.getClass("").split("-")[0];
53
- if (element.tagName === "BUTTON") {
53
+ if (element.tagName === "BUTTON" && element.classList.contains(`${classPrefix}-button`)) {
54
54
  return `${classPrefix}-button--active`;
55
55
  }
56
56
  else if (element.classList.contains(`${classPrefix}-chip`)) {
@@ -8,6 +8,7 @@
8
8
  * @category Components
9
9
  */
10
10
  export { default } from "./menu.js";
11
+ export type { MenuEvents } from "./types.js";
11
12
  export type { MenuConfig, MenuComponent, MenuItem, MenuDivider, MenuGap, MenuContent, MenuEvent, MenuSelectEvent, MenuPosition } from "./types.js";
12
13
  /**
13
14
  * Constants for menu position values - use these instead of string literals
@@ -50,7 +50,9 @@ export interface NavigationRailConfig extends BaseComponentConfig {
50
50
  header?: HTMLElement;
51
51
  ripple?: boolean;
52
52
  onSelect?: (event: NavigationRailSelectEvent) => void;
53
+ /** In 1.0 it receives `{ expanded: true }`, the object an `expand` listener receives. */
53
54
  onExpand?: () => void;
55
+ /** In 1.0 it receives `{ expanded: false }`, the object a `collapse` listener receives. */
54
56
  onCollapse?: () => void;
55
57
  }
56
58
  export interface NavigationRailComponent {
@@ -45,7 +45,7 @@ export const withCanvas = (config) => (component) => {
45
45
  const strokeWidth = () => getStrokeWidth(currentThickness);
46
46
  const max = () => component.state?.max ?? config.max ?? 100;
47
47
  const isIndeterminate = () => component.state?.indeterminate ?? config.indeterminate ?? false;
48
- const colors = createColors(() => draw(animationTime));
48
+ const colors = createColors(component.element, () => draw(animationTime));
49
49
  const measure = () => {
50
50
  if (!context)
51
51
  return;
@@ -6,10 +6,11 @@ export interface ProgressColors {
6
6
  }
7
7
  /**
8
8
  * Keeps the palette for one indicator, refreshed when the theme changes.
9
+ * @param element - the indicator's element, where its theme is read
9
10
  * @param onChange - called after the colours change, to redraw
10
11
  * @returns the palette getter and a cleanup function
11
12
  */
12
- export declare const createColors: (onChange: () => void) => {
13
+ export declare const createColors: (element: Element, onChange: () => void) => {
13
14
  get: () => ProgressColors;
14
15
  refresh: () => void;
15
16
  destroy: () => void;
@@ -7,27 +7,34 @@ const FALLBACKS = {
7
7
  stop: "#6750A4",
8
8
  buffer: "#EADDFF",
9
9
  };
10
- const read = () => ({
11
- indicator: getThemeColor(PROGRESS_COLORS.INDICATOR, { fallback: FALLBACKS.indicator }),
12
- track: getThemeColor(PROGRESS_COLORS.TRACK, { fallback: FALLBACKS.track }),
13
- stop: getThemeColor(PROGRESS_COLORS.STOP, { fallback: FALLBACKS.stop }),
14
- buffer: getThemeColor(PROGRESS_COLORS.BUFFER, { fallback: FALLBACKS.buffer }),
10
+ const read = (element) => ({
11
+ indicator: getThemeColor(PROGRESS_COLORS.INDICATOR, { element, fallback: FALLBACKS.indicator }),
12
+ track: getThemeColor(PROGRESS_COLORS.TRACK, { element, fallback: FALLBACKS.track }),
13
+ stop: getThemeColor(PROGRESS_COLORS.STOP, { element, fallback: FALLBACKS.stop }),
14
+ buffer: getThemeColor(PROGRESS_COLORS.BUFFER, { element, fallback: FALLBACKS.buffer }),
15
15
  });
16
- export const createColors = (onChange) => {
16
+ export const createColors = (element, onChange) => {
17
17
  let colors = FALLBACKS;
18
18
  let read_ = false;
19
19
  const refresh = () => {
20
+ if (!element.isConnected)
21
+ return;
20
22
  try {
21
- colors = read();
23
+ colors = read(element);
22
24
  read_ = true;
23
25
  }
24
26
  catch {
25
27
  }
26
28
  };
27
- const offThemeChange = onThemeChange(() => {
29
+ const update = () => {
28
30
  refresh();
29
31
  onChange();
30
- });
32
+ };
33
+ const offThemeChange = onThemeChange(update);
34
+ const observer = typeof ResizeObserver !== "undefined"
35
+ ? new ResizeObserver(update)
36
+ : null;
37
+ observer?.observe(element);
31
38
  return {
32
39
  get: () => {
33
40
  if (!read_)
@@ -35,6 +42,9 @@ export const createColors = (onChange) => {
35
42
  return colors;
36
43
  },
37
44
  refresh,
38
- destroy: offThemeChange,
45
+ destroy: () => {
46
+ observer?.disconnect();
47
+ offThemeChange();
48
+ },
39
49
  };
40
50
  };
@@ -19,6 +19,7 @@ interface ComponentWithRadio {
19
19
  removeOption: (value: string) => void;
20
20
  enable: () => void;
21
21
  disable: () => void;
22
+ isDisabled: () => boolean;
22
23
  enableOption: (value: string) => void;
23
24
  disableOption: (value: string) => void;
24
25
  getClass: (name: string) => string;
@@ -24,6 +24,9 @@ export const withAPI = ({ lifecycle }) => (component) => {
24
24
  component.enable();
25
25
  return this;
26
26
  },
27
+ isDisabled() {
28
+ return component.isDisabled();
29
+ },
27
30
  disable() {
28
31
  component.disable();
29
32
  return this;
@@ -21,8 +21,8 @@ export declare const RADIO_DIRECTIONS: {
21
21
  readonly HORIZONTAL: "horizontal";
22
22
  };
23
23
  /**
24
- * @deprecated Read by nothing: the component builds its class names itself
25
- * and has one size and variant (FLO-266).
24
+ * @deprecated Read only by `RADIO_DEFAULTS`, which the component does not read:
25
+ * it builds its class names itself and has one size and variant (FLO-266).
26
26
  */
27
27
  export declare const RADIO_VARIANTS: {
28
28
  /** Standard radio button */
@@ -33,8 +33,8 @@ export declare const RADIO_VARIANTS: {
33
33
  readonly OUTLINED: "outlined";
34
34
  };
35
35
  /**
36
- * @deprecated Read by nothing: the component builds its class names itself
37
- * and has one size and variant (FLO-266).
36
+ * @deprecated Read only by `RADIO_DEFAULTS`, which the component does not read:
37
+ * it builds its class names itself and has one size and variant (FLO-266).
38
38
  */
39
39
  export declare const RADIO_LABEL_POSITIONS: {
40
40
  /** Label to the right of the radio (default) */
@@ -43,8 +43,8 @@ export declare const RADIO_LABEL_POSITIONS: {
43
43
  readonly LEFT: "left";
44
44
  };
45
45
  /**
46
- * @deprecated Read by nothing: the component builds its class names itself
47
- * and has one size and variant (FLO-266).
46
+ * @deprecated Read only by `RADIO_DEFAULTS`, which the component does not read:
47
+ * it builds its class names itself and has one size and variant (FLO-266).
48
48
  */
49
49
  export declare const RADIO_SIZES: {
50
50
  /** Small radio button */
@@ -69,13 +69,13 @@ export declare const RADIO_EVENTS: {
69
69
  * Default configuration values
70
70
  */
71
71
  export declare const RADIO_DEFAULTS: {
72
- /** Default radio variant */
72
+ /** @deprecated The radios have no variant option; nothing reads this. Removed in 1.0. */
73
73
  readonly VARIANT: "standard";
74
74
  /** Default radio direction */
75
75
  readonly DIRECTION: "vertical";
76
- /** Default label position */
76
+ /** @deprecated The radios have no label position option; nothing reads this. Removed in 1.0. */
77
77
  readonly LABEL_POSITION: "right";
78
- /** Default radio size */
78
+ /** @deprecated The radios have no size option; nothing reads this. Removed in 1.0. */
79
79
  readonly SIZE: "medium";
80
80
  };
81
81
  /**
@@ -18,6 +18,7 @@ export declare const withRadio: (config: RadiosConfig) => <C extends RadioHost>(
18
18
  addOption: (option: RadioOptionConfig) => C;
19
19
  removeOption: (value: string) => C;
20
20
  enable: () => C;
21
+ isDisabled: () => boolean;
21
22
  disable: () => C;
22
23
  enableOption: (value: string) => C;
23
24
  disableOption: (value: string) => C;
@@ -131,6 +131,7 @@ export const withRadio = (config) => (component) => {
131
131
  });
132
132
  return component;
133
133
  },
134
+ isDisabled: () => component.element.classList.contains(`${radiosClass}--disabled`),
134
135
  disable: () => {
135
136
  component.element.classList.add(`${radiosClass}--disabled`);
136
137
  radios.forEach(radio => {