material 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/components/badge/config.d.ts +2 -2
- package/dist/components/button/features/toggle.d.ts +1 -1
- package/dist/components/button/types.d.ts +5 -5
- package/dist/components/button-group/button-group.d.ts +1 -1
- package/dist/components/button-group/constants.d.ts +1 -1
- package/dist/components/button-group/index.d.ts +1 -1
- package/dist/components/button-group/types.d.ts +2 -2
- package/dist/components/card/types.d.ts +5 -5
- package/dist/components/carousel/features/scroll.js +33 -33
- package/dist/components/carousel/keylines.d.ts +8 -5
- package/dist/components/carousel/keylines.js +23 -21
- package/dist/components/carousel/types.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts +4 -4
- package/dist/components/chips/types.d.ts +12 -12
- package/dist/components/datepicker/datepicker.d.ts +1 -1
- package/dist/components/datepicker/types.d.ts +11 -11
- package/dist/components/datepicker/utils.d.ts +1 -1
- package/dist/components/dialog/types.d.ts +1 -1
- package/dist/components/drawer/types.d.ts +1 -1
- package/dist/components/extended-fab/types.d.ts +3 -3
- package/dist/components/fab/types.d.ts +2 -3
- package/dist/components/fab-menu/types.d.ts +1 -1
- package/dist/components/icon-button/types.d.ts +4 -5
- package/dist/components/list/types.d.ts +1 -1
- package/dist/components/menu/features/loader.d.ts +1 -1
- package/dist/components/menu/types.d.ts +3 -3
- package/dist/components/navigation-bar/types.d.ts +1 -1
- package/dist/components/navigation-rail/types.d.ts +2 -2
- package/dist/components/progress/types.d.ts +1 -1
- package/dist/components/radios/types.d.ts +1 -1
- package/dist/components/search/types.d.ts +5 -5
- package/dist/components/select/constants.d.ts +1 -1
- package/dist/components/select/types.d.ts +1 -1
- package/dist/components/slider/config.d.ts +1 -1
- package/dist/components/slider/features/axis.d.ts +1 -1
- package/dist/components/slider/features/controller.d.ts +14 -14
- package/dist/components/slider/types.d.ts +1 -1
- package/dist/components/snackbar/types.d.ts +1 -1
- package/dist/components/switch/features.d.ts +1 -1
- package/dist/components/switch/types.d.ts +5 -5
- package/dist/components/tabs/features.d.ts +1 -1
- package/dist/components/tabs/responsive.d.ts +1 -1
- package/dist/components/tabs/types.d.ts +7 -8
- package/dist/components/tabs/utils.d.ts +5 -5
- package/dist/components/text-field/constants.d.ts +1 -1
- package/dist/components/text-field/features/counter.d.ts +1 -1
- package/dist/components/text-field/features/field.d.ts +1 -1
- package/dist/components/text-field/features/required.d.ts +1 -1
- package/dist/components/text-field/features/trailing-icon.d.ts +2 -2
- package/dist/components/text-field/types.d.ts +8 -8
- package/dist/components/timepicker/dial.d.ts +2 -2
- package/dist/components/timepicker/types.d.ts +9 -9
- package/dist/components/timepicker/utils.d.ts +2 -2
- package/dist/core/compose/features/constants.d.ts +1 -1
- package/dist/core/compose/features/events.d.ts +1 -1
- package/dist/core/config/component.d.ts +1 -1
- package/dist/core/dom/create.d.ts +2 -2
- package/dist/core/dom/layer.d.ts +1 -1
- package/dist/core/state/emitter.d.ts +1 -1
- package/dist/core/theme/shape.d.ts +1 -1
- package/dist/core/theme/tokens.d.ts +1 -1
- package/dist/core/utils/attributes.d.ts +2 -2
- package/dist/core/utils/theme.d.ts +1 -1
- package/dist/elements/adapter.d.ts +12 -1
- package/dist/elements/button.d.ts +1 -1
- package/dist/elements/css/icon-button.css +1 -1
- package/dist/elements/css/icon-button.js +1 -1
- package/dist/elements/css/toolbar.css +1 -1
- package/dist/elements/css/toolbar.js +1 -1
- package/dist/elements/css/tooltip.css +1 -1
- package/dist/elements/css/tooltip.js +1 -1
- package/dist/elements/define.d.ts +20 -4
- package/dist/elements/define.js +2 -0
- package/dist/elements/icon-button.d.ts +6 -1
- package/dist/elements/icon-button.js +1 -0
- package/dist/elements/navigation-bar.d.ts +1 -1
- package/dist/elements/navigation-rail.d.ts +1 -1
- package/dist/elements/preupgrade/badge.css +1 -1
- package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
- package/dist/elements/preupgrade/bottom-sheet.css +1 -1
- package/dist/elements/preupgrade/button-group.css +1 -1
- package/dist/elements/preupgrade/button.css +1 -1
- package/dist/elements/preupgrade/card.css +1 -1
- package/dist/elements/preupgrade/carousel.css +1 -1
- package/dist/elements/preupgrade/checkbox.css +1 -1
- package/dist/elements/preupgrade/chips.css +1 -1
- package/dist/elements/preupgrade/datepicker.css +1 -1
- package/dist/elements/preupgrade/dialog.css +1 -1
- package/dist/elements/preupgrade/divider.css +1 -1
- package/dist/elements/preupgrade/drawer.css +1 -1
- package/dist/elements/preupgrade/extended-fab.css +1 -1
- package/dist/elements/preupgrade/fab-menu.css +1 -1
- package/dist/elements/preupgrade/fab.css +1 -1
- package/dist/elements/preupgrade/icon-button.css +1 -1
- package/dist/elements/preupgrade/list.css +1 -1
- package/dist/elements/preupgrade/loading-indicator.css +1 -1
- package/dist/elements/preupgrade/menu.css +1 -1
- package/dist/elements/preupgrade/navigation-bar.css +1 -1
- package/dist/elements/preupgrade/navigation-rail.css +1 -1
- package/dist/elements/preupgrade/progress.css +1 -1
- package/dist/elements/preupgrade/radios.css +1 -1
- package/dist/elements/preupgrade/search.css +1 -1
- package/dist/elements/preupgrade/select.css +1 -1
- package/dist/elements/preupgrade/side-sheet.css +1 -1
- package/dist/elements/preupgrade/slider.css +1 -1
- package/dist/elements/preupgrade/snackbar.css +1 -1
- package/dist/elements/preupgrade/split-button.css +1 -1
- package/dist/elements/preupgrade/switch.css +1 -1
- package/dist/elements/preupgrade/tabs.css +1 -1
- package/dist/elements/preupgrade/text-field.css +1 -1
- package/dist/elements/preupgrade/timepicker.css +1 -1
- package/dist/elements/preupgrade/toolbar.css +1 -1
- package/dist/elements/preupgrade/tooltip.css +1 -1
- package/dist/elements/preupgrade/top-app-bar.css +1 -1
- package/dist/elements/preupgrade.css +1 -1
- package/dist/elements/styles.d.ts +5 -4
- package/dist/elements/timepicker.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/package.json +1 -1
- package/dist/react/create.d.ts +1 -1
- package/dist/react/create.js +4 -1
- package/dist/solid/create.d.ts +2 -2
- package/dist/solid/create.js +6 -4
- package/dist/ssr/index.js +13 -13
- package/dist/ssr/react.js +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/contrast.css +1 -1
- package/dist/styles/datepicker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +2 -2
- package/dist/styles/list.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-bar.css +1 -1
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +2 -2
- package/dist/styles/tooltip.css +2 -2
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/svelte/Badge.svelte +1 -1
- package/dist/svelte/BottomAppBar.svelte +1 -1
- package/dist/svelte/BottomSheet.svelte +1 -1
- package/dist/svelte/Button.svelte +1 -1
- package/dist/svelte/ButtonGroup.svelte +1 -1
- package/dist/svelte/Card.svelte +1 -1
- package/dist/svelte/Carousel.svelte +1 -1
- package/dist/svelte/Checkbox.svelte +1 -1
- package/dist/svelte/Chips.svelte +1 -1
- package/dist/svelte/Datepicker.svelte +1 -1
- package/dist/svelte/Dialog.svelte +1 -1
- package/dist/svelte/Divider.svelte +1 -1
- package/dist/svelte/Drawer.svelte +1 -1
- package/dist/svelte/ExtendedFab.svelte +1 -1
- package/dist/svelte/Fab.svelte +1 -1
- package/dist/svelte/FabMenu.svelte +1 -1
- package/dist/svelte/IconButton.svelte +1 -1
- package/dist/svelte/List.svelte +1 -1
- package/dist/svelte/LoadingIndicator.svelte +1 -1
- package/dist/svelte/Menu.svelte +1 -1
- package/dist/svelte/NavigationBar.svelte +1 -1
- package/dist/svelte/NavigationRail.svelte +1 -1
- package/dist/svelte/Progress.svelte +1 -1
- package/dist/svelte/Radios.svelte +1 -1
- package/dist/svelte/Search.svelte +1 -1
- package/dist/svelte/Select.svelte +1 -1
- package/dist/svelte/SideSheet.svelte +1 -1
- package/dist/svelte/Slider.svelte +1 -1
- package/dist/svelte/Snackbar.svelte +1 -1
- package/dist/svelte/SplitButton.svelte +1 -1
- package/dist/svelte/Switch.svelte +1 -1
- package/dist/svelte/Tabs.svelte +1 -1
- package/dist/svelte/TextField.svelte +1 -1
- package/dist/svelte/Timepicker.svelte +1 -1
- package/dist/svelte/Toolbar.svelte +1 -1
- package/dist/svelte/Tooltip.svelte +1 -1
- package/dist/svelte/TopAppBar.svelte +1 -1
- package/dist/svelte/runtime.d.ts +2 -2
- package/dist/svelte/runtime.js +4 -1
- package/dist/themes/autumn-contrast.css +1 -1
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline-contrast.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige-contrast.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/content-contrast.css +1 -1
- package/dist/themes/content.css +1 -1
- package/dist/themes/desert-contrast.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/expressive-contrast.css +1 -1
- package/dist/themes/expressive.css +1 -1
- package/dist/themes/fidelity-contrast.css +1 -1
- package/dist/themes/fidelity.css +1 -1
- package/dist/themes/forest-contrast.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/fruit-salad-contrast.css +1 -1
- package/dist/themes/fruit-salad.css +1 -1
- package/dist/themes/highcontrast-contrast.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/monochrome-contrast.css +1 -1
- package/dist/themes/monochrome.css +1 -1
- package/dist/themes/neutral-contrast.css +1 -1
- package/dist/themes/neutral.css +1 -1
- package/dist/themes/ocean-contrast.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/rainbow-contrast.css +1 -1
- package/dist/themes/rainbow.css +1 -1
- package/dist/themes/sageivory-contrast.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring-contrast.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer-contrast.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset-contrast.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel-contrast.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/vibrant-contrast.css +1 -1
- package/dist/themes/vibrant.css +1 -1
- package/dist/vue/create.d.ts +2 -2
- package/dist/vue/create.js +4 -1
- package/package.json +1 -1
- package/src/styles/abstract/_mixins.scss +4 -4
- package/src/styles/abstract/_theme.scss +1 -1
- package/src/styles/abstract/_variables.scss +7 -7
- package/src/styles/base/_foundation.scss +1 -1
- package/src/styles/base/_typescale-tokens.scss +1 -1
- package/src/styles/base/_typography.scss +1 -1
- package/src/styles/components/_bottom-sheet.scss +1 -1
- package/src/styles/components/_button.scss +1 -1
- package/src/styles/components/_checkbox.scss +5 -5
- package/src/styles/components/_chips.scss +9 -9
- package/src/styles/components/_datepicker.scss +8 -9
- package/src/styles/components/_dialog.scss +1 -1
- package/src/styles/components/_drawer.scss +1 -1
- package/src/styles/components/_fab-menu.scss +1 -1
- package/src/styles/components/_icon-button.scss +50 -13
- package/src/styles/components/_menu.scss +0 -1
- package/src/styles/components/_navigation-bar.scss +1 -1
- package/src/styles/components/_radios.scss +3 -3
- package/src/styles/components/_search.scss +7 -7
- package/src/styles/components/_select.scss +2 -2
- package/src/styles/components/_side-sheet.scss +2 -2
- package/src/styles/components/_slider.scss +6 -6
- package/src/styles/components/_switch.scss +5 -5
- package/src/styles/components/_tabs.scss +15 -15
- package/src/styles/components/_text-field.scss +20 -21
- package/src/styles/components/_timepicker.scss +6 -6
- package/src/styles/components/_toolbar.scss +48 -0
- package/src/styles/components/_tooltip.scss +35 -74
- package/src/styles/elements/_field.scss +2 -2
- package/src/styles/themes/_autumn.scss +3 -3
- package/src/styles/themes/_base-theme.scss +2 -2
- package/src/styles/themes/_baseline.scss +5 -5
- package/src/styles/themes/_forest.scss +3 -3
- package/src/styles/themes/_ocean.scss +3 -3
- package/src/styles/themes/_spring.scss +3 -3
- package/src/styles/themes/_sunset.scss +3 -3
- package/src/styles/utilities/_ripple.scss +1 -1
package/README.md
CHANGED
|
@@ -94,10 +94,10 @@ What a bundler keeps, minified and gzipped (kB is 1,000 bytes), measured from th
|
|
|
94
94
|
| `createButton` from `material`, with code splitting: the initial chunks (the progress indicator loads on demand) | 7.4 kB |
|
|
95
95
|
| `createButton`, without code splitting (the progress indicator included) | 13.7 kB |
|
|
96
96
|
| `createButton`, `createTextField` and `createCheckbox`, without code splitting | 19.9 kB |
|
|
97
|
-
| Everything the root exports (`export * from 'material'`), without code splitting | 127.
|
|
97
|
+
| Everything the root exports (`export * from 'material'`), without code splitting | 127.1 kB |
|
|
98
98
|
| `material/styles/base` | 2.9 kB |
|
|
99
99
|
| `material/styles/base` and `material/styles/button` | 5.2 kB |
|
|
100
|
-
| `material/styles`, the full stylesheet | 62.
|
|
100
|
+
| `material/styles`, the full stylesheet | 62.7 kB |
|
|
101
101
|
<!-- /sizes -->
|
|
102
102
|
|
|
103
103
|
`material` publishes ESM only, so bundlers drop what you do not import. Each component's page on [md3.io/components](https://md3.io/components/) gives its size.
|
|
@@ -615,7 +615,7 @@ export declare const getApiConfig: (comp: {
|
|
|
615
615
|
* A badge is a count, and a count of nothing is not news -- so an empty label
|
|
616
616
|
* and a zero are both hidden. The setter has always done this; creation did
|
|
617
617
|
* not, so `createBadge({ label: 0 })` was visible while `setLabel(0)` on the
|
|
618
|
-
* same badge hid it. One rule now, used by both.
|
|
618
|
+
* same badge hid it. One rule now, used by both.
|
|
619
619
|
*/
|
|
620
620
|
export declare const isEmptyBadgeLabel: (formattedLabel: string) => boolean;
|
|
621
621
|
/**
|
|
@@ -624,7 +624,7 @@ export declare const isEmptyBadgeLabel: (formattedLabel: string) => boolean;
|
|
|
624
624
|
* Asked of the same value the formatter reads, rather than of its type. Both
|
|
625
625
|
* callers used to require `typeof label === "number"`, so `"1250"` with a max
|
|
626
626
|
* of 999 rendered "999+" without the overflow class that 1250 received --
|
|
627
|
-
* the formatter has always used `Number(label)`.
|
|
627
|
+
* the formatter has always used `Number(label)`.
|
|
628
628
|
*/
|
|
629
629
|
export declare const isBadgeOverflow: (label: string | number, max?: number) => boolean;
|
|
630
630
|
export declare const formatBadgeLabel: (label: string | number, max?: number) => string;
|
|
@@ -31,7 +31,7 @@ export interface ToggleComponent {
|
|
|
31
31
|
* `--selected` classes drive the selected colours and the shape swap.
|
|
32
32
|
*
|
|
33
33
|
* Emits a `change` event with `{ selected, value }` when the user toggles it;
|
|
34
|
-
* `value` is the button's value, as `getValue()` returns it
|
|
34
|
+
* `value` is the button's value, as `getValue()` returns it.
|
|
35
35
|
* With `toggleOnClick: false` the click does nothing and a container
|
|
36
36
|
* (button group) drives the state through `setSelected`.
|
|
37
37
|
*
|
|
@@ -187,7 +187,7 @@ export interface ButtonEventPayload<E extends Event = Event> {
|
|
|
187
187
|
/** The same DOM event as `event`; both names have always been provided. */
|
|
188
188
|
originalEvent: E;
|
|
189
189
|
}
|
|
190
|
-
/** A toggle button's `change
|
|
190
|
+
/** A toggle button's `change`. */
|
|
191
191
|
export interface ButtonChangePayload {
|
|
192
192
|
/** Whether the button is now selected */
|
|
193
193
|
selected: boolean;
|
|
@@ -199,7 +199,7 @@ export interface ButtonChangePayload {
|
|
|
199
199
|
*
|
|
200
200
|
* `on` and `off` are generic over these keys, so a misspelled event name is a
|
|
201
201
|
* compile error rather than a listener that never fires, and a handler's
|
|
202
|
-
* payload is typed rather than `any`.
|
|
202
|
+
* payload is typed rather than `any`.
|
|
203
203
|
*
|
|
204
204
|
* Native forwarding and toggle selection are reported here. `mount` and `unmount` are *not* here: the lifecycle
|
|
205
205
|
* feature keeps its own emitter and exposes them as `lifecycle.onMount` and
|
|
@@ -208,7 +208,7 @@ export interface ButtonChangePayload {
|
|
|
208
208
|
export interface ButtonEvents {
|
|
209
209
|
/**
|
|
210
210
|
* A toggle button's selected state changed on a click. `value` is the
|
|
211
|
-
* button's value (`getValue()`), as every model event carries
|
|
211
|
+
* button's value (`getValue()`), as every model event carries;
|
|
212
212
|
* `selected` is the toggled state.
|
|
213
213
|
*/
|
|
214
214
|
change: (payload: ButtonChangePayload) => void;
|
|
@@ -300,7 +300,7 @@ export interface ButtonComponent {
|
|
|
300
300
|
* @returns The button component for chaining
|
|
301
301
|
*/
|
|
302
302
|
disable: () => ButtonComponent;
|
|
303
|
-
/** Whether the button is disabled
|
|
303
|
+
/** Whether the button is disabled */
|
|
304
304
|
isDisabled: () => boolean;
|
|
305
305
|
/**
|
|
306
306
|
* Sets the button's text content
|
|
@@ -445,7 +445,7 @@ export interface ButtonComponent {
|
|
|
445
445
|
/**
|
|
446
446
|
* Registers ButtonConfig with the global defaults map, so
|
|
447
447
|
* `setComponentDefaults("button", ...)` is typed without core
|
|
448
|
-
* importing anything from this component.
|
|
448
|
+
* importing anything from this component.
|
|
449
449
|
*/
|
|
450
450
|
declare module "../../core/config/global" {
|
|
451
451
|
interface ComponentConfigMap {
|
|
@@ -5,7 +5,7 @@ import { ButtonGroupConfig, ButtonGroupComponent } from "./types.js";
|
|
|
5
5
|
* The Button Group component provides a container for grouping related action buttons.
|
|
6
6
|
* A standard group holds related actions, each button acting on its own; a
|
|
7
7
|
* connected group (`kind: "connected"`, with `selection`) is M3's replacement for
|
|
8
|
-
* the segmented button, which material 3.0.0 removed
|
|
8
|
+
* the segmented button, which material 3.0.0 removed.
|
|
9
9
|
*
|
|
10
10
|
* Per Material Design 3 specifications:
|
|
11
11
|
* - Standard groups space their buttons (18/12/8/8/8dp by size) and a
|
|
@@ -73,7 +73,7 @@ export declare const BUTTON_GROUP_SIZES: {
|
|
|
73
73
|
/**
|
|
74
74
|
* Material 3 button group tokens per size (dp): container height, button
|
|
75
75
|
* icon size, standard between-space, connected inner corner and its shape
|
|
76
|
-
* scale step (
|
|
76
|
+
* scale step (m3.material.io button group specs; ButtonGroupSmallTokens.kt and
|
|
77
77
|
* ConnectedButtonGroupSmallTokens.kt for the s size)
|
|
78
78
|
*/
|
|
79
79
|
export declare const BUTTON_GROUP_SIZE_TOKENS: {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The Button Group component provides a container for grouping related action buttons.
|
|
5
5
|
* A standard group holds related actions, each button acting on its own; a
|
|
6
6
|
* connected group (`kind: "connected"`, with `selection`) is M3's replacement for
|
|
7
|
-
* the segmented button, which material 3.0.0 removed
|
|
7
|
+
* the segmented button, which material 3.0.0 removed.
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
@@ -123,7 +123,7 @@ interface ButtonGroupItemBase extends Omit<ButtonConfig, "variant"> {
|
|
|
123
123
|
*
|
|
124
124
|
* Expressed as a union rather than a flat required field, because requiring
|
|
125
125
|
* it on text items too is over-broad -- it would make 67 call sites in this
|
|
126
|
-
* component's own tests pass a label that duplicates the text.
|
|
126
|
+
* component's own tests pass a label that duplicates the text.
|
|
127
127
|
*/
|
|
128
128
|
export type ButtonGroupItemConfig = (ButtonGroupItemBase & {
|
|
129
129
|
text: string;
|
|
@@ -287,7 +287,7 @@ export interface ButtonGroupComponent {
|
|
|
287
287
|
* @returns The ButtonGroupComponent for chaining
|
|
288
288
|
*/
|
|
289
289
|
disable: () => ButtonGroupComponent;
|
|
290
|
-
/** Whether the whole group is disabled
|
|
290
|
+
/** Whether the whole group is disabled */
|
|
291
291
|
isDisabled: () => boolean;
|
|
292
292
|
/**
|
|
293
293
|
* Enables a specific button by index
|
|
@@ -63,14 +63,14 @@ export interface CardConfig {
|
|
|
63
63
|
/**
|
|
64
64
|
* The hover and press states and their elevation, for a card the app
|
|
65
65
|
* makes interactive itself. Not a control: no role of button and no tab
|
|
66
|
-
* stop; `clickable` is
|
|
66
|
+
* stop; `clickable` is.
|
|
67
67
|
*/
|
|
68
68
|
interactive?: boolean;
|
|
69
69
|
/** Whether the card should take full width */
|
|
70
70
|
fullWidth?: boolean;
|
|
71
71
|
/**
|
|
72
72
|
* A card that acts on activation: a button (role, tab stop, Enter and
|
|
73
|
-
* Space click it) with the ripple
|
|
73
|
+
* Space click it) with the ripple
|
|
74
74
|
*/
|
|
75
75
|
clickable?: boolean;
|
|
76
76
|
/** Whether the card is draggable */
|
|
@@ -290,7 +290,7 @@ export interface CardComponentConfig extends CardConfig {
|
|
|
290
290
|
prefix: string;
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
|
-
* The card's events
|
|
293
|
+
* The card's events. A clickable card forwards `click`; an
|
|
294
294
|
* interactive one `mouseenter`, `mouseleave`, `keydown`, `focus` and `blur`;
|
|
295
295
|
* a draggable one emits `dragstart` and `dragend`.
|
|
296
296
|
*/
|
|
@@ -321,7 +321,7 @@ export interface CardEvents extends TouchEvents {
|
|
|
321
321
|
* @category Components
|
|
322
322
|
*/
|
|
323
323
|
export interface CardComponent extends BaseComponent {
|
|
324
|
-
/** Subscribes to one of the card's events
|
|
324
|
+
/** Subscribes to one of the card's events */
|
|
325
325
|
on: <K extends keyof CardEvents>(event: K, handler: CardEvents[K]) => CardComponent;
|
|
326
326
|
/** Removes a handler added with `on` */
|
|
327
327
|
off: <K extends keyof CardEvents>(event: K, handler: CardEvents[K]) => CardComponent;
|
|
@@ -506,7 +506,7 @@ export interface ApiOptions {
|
|
|
506
506
|
/**
|
|
507
507
|
* Registers CardConfig with the global defaults map, so
|
|
508
508
|
* `setComponentDefaults("card", ...)` is typed without core
|
|
509
|
-
* importing anything from this component.
|
|
509
|
+
* importing anything from this component.
|
|
510
510
|
*/
|
|
511
511
|
declare module "../../core/config/global" {
|
|
512
512
|
interface ComponentConfigMap {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CAROUSEL_DEFAULTS, CAROUSEL_EVENTS, CAROUSEL_VARIANTS } from "../constants.js";
|
|
2
2
|
import { resolveLayoutDefaults } from "../config.js";
|
|
3
3
|
import { cornerToken } from "../../../core/theme/shape.js";
|
|
4
|
-
import { multiBrowseKeylines, heroKeylines,
|
|
4
|
+
import { multiBrowseKeylines, heroKeylines, cappedKeylines, fullScreenKeylines, } from "../keylines.js";
|
|
5
5
|
import { createStrategy, keylinesForScrollOffset, snapPositionOffset, maxScrollOffset, placeItem, } from "../strategy.js";
|
|
6
6
|
const FLING_VELOCITY = 0.4;
|
|
7
7
|
const DRAG_THRESHOLD = 4;
|
|
@@ -74,25 +74,16 @@ export const withScroll = (config) => (component) => {
|
|
|
74
74
|
return best;
|
|
75
75
|
};
|
|
76
76
|
const buildKeylines = (size) => {
|
|
77
|
-
const uniform = reduceMotion?.matches === true;
|
|
78
77
|
const preferred = config.itemWidth ?? CAROUSEL_DEFAULTS.ITEM_WIDTH;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
? uncontainedKeylines(size, Math.min(max ?? size, size), gap, rules)
|
|
85
|
-
: heroKeylines(size, max, gap, count, variant === CAROUSEL_VARIANTS.HERO_CENTER, rules);
|
|
86
|
-
}
|
|
87
|
-
case CAROUSEL_VARIANTS.UNCONTAINED:
|
|
88
|
-
return uncontainedKeylines(size, preferred, gap, rules);
|
|
89
|
-
case CAROUSEL_VARIANTS.FULL_SCREEN:
|
|
90
|
-
return fullScreenKeylines(size, gap, rules);
|
|
91
|
-
default:
|
|
92
|
-
return uniform
|
|
93
|
-
? uncontainedKeylines(size, preferred, gap, rules)
|
|
94
|
-
: multiBrowseKeylines(size, preferred, gap, count, rules);
|
|
78
|
+
if (variant === CAROUSEL_VARIANTS.FULL_SCREEN)
|
|
79
|
+
return fullScreenKeylines(size, gap, rules);
|
|
80
|
+
if (reduceMotion?.matches === true) {
|
|
81
|
+
const itemSize = variant.startsWith("hero") ? Math.min(config.itemWidth ?? size, size) : preferred;
|
|
82
|
+
return cappedKeylines(size, itemSize, gap, rules);
|
|
95
83
|
}
|
|
84
|
+
return variant.startsWith("hero")
|
|
85
|
+
? heroKeylines(size, config.itemWidth ?? null, gap, count, variant === CAROUSEL_VARIANTS.HERO_CENTER, rules)
|
|
86
|
+
: multiBrowseKeylines(size, preferred, gap, count, rules);
|
|
96
87
|
};
|
|
97
88
|
const build = () => {
|
|
98
89
|
count = slideElements.length;
|
|
@@ -102,15 +93,17 @@ export const withScroll = (config) => (component) => {
|
|
|
102
93
|
strategy = null;
|
|
103
94
|
return;
|
|
104
95
|
}
|
|
105
|
-
const
|
|
106
|
-
strategy =
|
|
96
|
+
const isUncontained = variant === CAROUSEL_VARIANTS.UNCONTAINED;
|
|
97
|
+
strategy = isUncontained
|
|
98
|
+
? { itemSize: config.itemWidth ?? CAROUSEL_DEFAULTS.ITEM_WIDTH, gap, valid: true }
|
|
99
|
+
: createStrategy(buildKeylines(containerSize), containerSize, gap, padding, padding);
|
|
107
100
|
if (!strategy.valid) {
|
|
108
101
|
strategy = null;
|
|
109
102
|
return;
|
|
110
103
|
}
|
|
111
104
|
const unit = strategy.itemSize + strategy.gap;
|
|
112
|
-
scrollOffsetAtStart = -snapPositionOffset(strategy, 0, count);
|
|
113
|
-
snapPositions = slideElements.map((_, i) => i * unit - snapPositionOffset(strategy, i, count) - scrollOffsetAtStart);
|
|
105
|
+
scrollOffsetAtStart = isUncontained ? 0 : -snapPositionOffset(strategy, 0, count);
|
|
106
|
+
snapPositions = slideElements.map((_, i) => isUncontained ? i * unit : i * unit - snapPositionOffset(strategy, i, count) - scrollOffsetAtStart);
|
|
114
107
|
const scrollRange = Math.max(0, snapPositions[count - 1] ?? 0);
|
|
115
108
|
track.style[vertical ? "height" : "width"] = `${containerSize + scrollRange}px`;
|
|
116
109
|
track.style[vertical ? "width" : "height"] = "";
|
|
@@ -133,18 +126,27 @@ export const withScroll = (config) => (component) => {
|
|
|
133
126
|
if (!strategy)
|
|
134
127
|
return;
|
|
135
128
|
const position = scrollPosition();
|
|
136
|
-
const
|
|
137
|
-
const keylines = keylinesForScrollOffset(strategy, scrollOffset, maxScrollOffset(strategy, count));
|
|
129
|
+
const isUncontained = variant === CAROUSEL_VARIANTS.UNCONTAINED;
|
|
138
130
|
const itemSize = strategy.itemSize;
|
|
131
|
+
const unit = itemSize + strategy.gap;
|
|
132
|
+
const scrollOffset = position + scrollOffsetAtStart;
|
|
133
|
+
const keylines = isUncontained ? null : keylinesForScrollOffset(strategy, scrollOffset, maxScrollOffset(strategy, count));
|
|
139
134
|
const fadeRange = strategy.maxItemSize - strategy.minItemSize;
|
|
140
135
|
for (let i = 0; i < count; i++) {
|
|
141
136
|
const el = slideElements[i];
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
let start = padding + i * unit;
|
|
138
|
+
let inset = 0;
|
|
139
|
+
let fade = 1;
|
|
140
|
+
let offscreen = false;
|
|
141
|
+
if (!isUncontained) {
|
|
142
|
+
const placement = placeItem(strategy, keylines, i, scrollOffset);
|
|
143
|
+
const visible = Math.max(0, Math.min(itemSize, placement.size));
|
|
144
|
+
start = placement.center - itemSize / 2 + position;
|
|
145
|
+
offscreen = placement.center + visible / 2 < -itemSize || placement.center - visible / 2 > containerSize + itemSize;
|
|
146
|
+
inset = Math.max(0, (itemSize - visible) / 2);
|
|
147
|
+
if (fadeRange > 0)
|
|
148
|
+
fade = Math.min(1, Math.max(0, (visible - strategy.minItemSize) / fadeRange));
|
|
149
|
+
}
|
|
148
150
|
const style = offscreen
|
|
149
151
|
? "hidden"
|
|
150
152
|
: `${Math.round(start * 100) / 100}|${Math.round(inset * 100) / 100}|${fade.toFixed(3)}`;
|
|
@@ -157,9 +159,7 @@ export const withScroll = (config) => (component) => {
|
|
|
157
159
|
}
|
|
158
160
|
el.style.visibility = "";
|
|
159
161
|
el.style.transform = vertical ? `translate3d(0, ${start}px, 0)` : `translate3d(${start}px, 0, 0)`;
|
|
160
|
-
el.style.clipPath = vertical
|
|
161
|
-
? `inset(${inset}px 0 round ${corner})`
|
|
162
|
-
: `inset(0 ${inset}px round ${corner})`;
|
|
162
|
+
el.style.clipPath = inset > 0 ? (vertical ? `inset(${inset}px 0 round ${corner})` : `inset(0 ${inset}px round ${corner})`) : "";
|
|
163
163
|
el.style.setProperty(`--${config.prefix}-carousel-fade`, fade.toFixed(3));
|
|
164
164
|
}
|
|
165
165
|
if (pending !== null) {
|
|
@@ -53,13 +53,16 @@ export declare const multiBrowseKeylines: (containerSize: number, preferredItemS
|
|
|
53
53
|
* centred variant places the large item between two small ones.
|
|
54
54
|
*/
|
|
55
55
|
export declare const heroKeylines: (containerSize: number, maxItemSize: number | null, gap: number, count: number, centered: boolean, rules: KeylineRules) => KeylineList;
|
|
56
|
+
/** Capped uniform keyline for contained variants under prefers-reduced-motion: reduce */
|
|
57
|
+
export declare const cappedKeylines: (containerSize: number, itemSize: number, gap: number, rules: KeylineRules) => KeylineList;
|
|
56
58
|
/**
|
|
57
|
-
* Uncontained:
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* Uncontained: all items are a single uniform size and flow past the
|
|
60
|
+
* edge of the container without changing size (Material Design 3
|
|
61
|
+
* Carousel guidelines & specs: m3.material.io/components/carousel/guidelines).
|
|
62
|
+
* How much of the trailing item is cut off is determined by the container
|
|
63
|
+
* width and scroll position.
|
|
61
64
|
*/
|
|
62
|
-
export declare const uncontainedKeylines: (containerSize: number, itemSize: number, gap: number,
|
|
65
|
+
export declare const uncontainedKeylines: (containerSize: number, itemSize: number, gap: number, _rules?: KeylineRules) => KeylineList;
|
|
63
66
|
/** Full-screen: one item fills the container edge to edge */
|
|
64
67
|
export declare const fullScreenKeylines: (containerSize: number, gap: number, rules: KeylineRules) => KeylineList;
|
|
65
68
|
export {};
|
|
@@ -249,32 +249,34 @@ export const heroKeylines = (containerSize, maxItemSize, gap, count, centered, r
|
|
|
249
249
|
const alignment = shouldCenter && count >= itemCount(arrangement) ? 'center' : 'start';
|
|
250
250
|
return fromArrangement(arrangement, containerSize, gap, rules.anchorSize, rules.anchorSize, alignment);
|
|
251
251
|
};
|
|
252
|
-
const
|
|
253
|
-
let medium = Math.max(remaining * 1.5, minimum);
|
|
254
|
-
if (medium > largeSize * threshold)
|
|
255
|
-
medium = Math.max(remaining * 1.2, minimum);
|
|
256
|
-
return medium;
|
|
257
|
-
};
|
|
258
|
-
export const uncontainedKeylines = (containerSize, itemSize, gap, rules) => {
|
|
252
|
+
export const cappedKeylines = (containerSize, itemSize, gap, rules) => {
|
|
259
253
|
if (containerSize <= 0 || itemSize <= 0)
|
|
260
254
|
return [];
|
|
261
255
|
const large = Math.min(itemSize, containerSize);
|
|
262
256
|
const largeCount = Math.max(1, Math.floor((containerSize + gap) / (large + gap)));
|
|
263
257
|
const remaining = Math.max(0, containerSize - largeCount * (large + gap));
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
258
|
+
let medium = Math.max(remaining * 1.5, rules.anchorSize);
|
|
259
|
+
if (medium > large * rules.mediumLargeThreshold)
|
|
260
|
+
medium = Math.max(remaining * 1.2, rules.anchorSize);
|
|
261
|
+
return fromArrangement({ priority: 0, smallSize: 0, smallCount: 0, mediumSize: medium, mediumCount: remaining > 0 ? 1 : 0, largeSize: large, largeCount }, containerSize, gap, Math.max(Math.min(rules.anchorSize, itemSize), medium * 0.5), rules.anchorSize, 'start');
|
|
262
|
+
};
|
|
263
|
+
export const uncontainedKeylines = (containerSize, itemSize, gap, _rules) => {
|
|
264
|
+
if (containerSize <= 0 || itemSize <= 0)
|
|
265
|
+
return [];
|
|
266
|
+
const large = Math.min(itemSize, containerSize);
|
|
267
|
+
const count = Math.max(1, Math.ceil((containerSize + gap) / (large + gap)));
|
|
268
|
+
return Array.from({ length: count }, (_, i) => {
|
|
269
|
+
const offset = large / 2 + i * (large + gap);
|
|
270
|
+
return {
|
|
271
|
+
size: large,
|
|
272
|
+
offset,
|
|
273
|
+
unadjustedOffset: offset,
|
|
274
|
+
isFocal: true,
|
|
275
|
+
isAnchor: false,
|
|
276
|
+
isPivot: i === 0,
|
|
277
|
+
cutoff: Math.max(0, offset + large / 2 - containerSize),
|
|
278
|
+
};
|
|
279
|
+
});
|
|
278
280
|
};
|
|
279
281
|
export const fullScreenKeylines = (containerSize, gap, rules) => {
|
|
280
282
|
if (containerSize <= 0)
|
|
@@ -1,7 +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, as `getValue()` returns it; every model event carries it
|
|
4
|
+
/** The current item's index, as `getValue()` returns it; every model event carries it */
|
|
5
5
|
value: number;
|
|
6
6
|
}
|
|
7
7
|
/** Events emitted by the scroll feature and forwarded from the root. */
|
|
@@ -62,7 +62,7 @@ export interface CheckboxConfig {
|
|
|
62
62
|
labelPosition?: CheckboxLabelPosition | string;
|
|
63
63
|
/**
|
|
64
64
|
* Error state: the outline, the selected container and the state layers
|
|
65
|
-
* take the error role, and the input is marked `aria-invalid`.
|
|
65
|
+
* take the error role, and the input is marked `aria-invalid`.
|
|
66
66
|
* @default false
|
|
67
67
|
*/
|
|
68
68
|
error?: boolean;
|
|
@@ -71,7 +71,7 @@ export interface CheckboxConfig {
|
|
|
71
71
|
*/
|
|
72
72
|
ariaLabel?: string;
|
|
73
73
|
/**
|
|
74
|
-
* Whether Enter toggles as Space does. Off for a checkbox
|
|
74
|
+
* Whether Enter toggles as Space does. Off for a checkbox.
|
|
75
75
|
* @internal
|
|
76
76
|
*/
|
|
77
77
|
enterToggles?: boolean;
|
|
@@ -221,7 +221,7 @@ export interface CheckboxComponent {
|
|
|
221
221
|
* @returns Checkbox component for method chaining
|
|
222
222
|
*/
|
|
223
223
|
disable: () => CheckboxComponent;
|
|
224
|
-
/** Whether the checkbox is disabled
|
|
224
|
+
/** Whether the checkbox is disabled */
|
|
225
225
|
isDisabled: () => boolean;
|
|
226
226
|
/**
|
|
227
227
|
* Destroys the checkbox component and cleans up resources
|
|
@@ -297,7 +297,7 @@ export type ApiComponent = BaseComponent & Required<Pick<BaseComponent, "checkab
|
|
|
297
297
|
/**
|
|
298
298
|
* Registers CheckboxConfig with the global defaults map, so
|
|
299
299
|
* `setComponentDefaults("checkbox", ...)` is typed without core
|
|
300
|
-
* importing anything from this component.
|
|
300
|
+
* importing anything from this component.
|
|
301
301
|
*/
|
|
302
302
|
declare module "../../core/config/global" {
|
|
303
303
|
interface ComponentConfigMap {
|
|
@@ -24,7 +24,7 @@ export interface ChipConfig {
|
|
|
24
24
|
* Delete. Input chips are always removable (m3.material.io chips): on its own the
|
|
25
25
|
* chip then leaves the page; in a set, the set removes it and emits `remove`. It
|
|
26
26
|
* used to be a request the owner had to act on, and without it there was no
|
|
27
|
-
* remove button.
|
|
27
|
+
* remove button. It and every `remove` listener run first, with the chip
|
|
28
28
|
* still in the set and on the page; the removal follows.
|
|
29
29
|
*/
|
|
30
30
|
onRemove?: ChipEvents["remove"];
|
|
@@ -32,7 +32,7 @@ export interface ChipConfig {
|
|
|
32
32
|
/**
|
|
33
33
|
* Filter chips: gives the trailing icon its own button, which calls this (the
|
|
34
34
|
* m3.material.io chips' trailing icon that "can be used to open a menu or remove
|
|
35
|
-
* the chip"). The chip's own action is unaffected.
|
|
35
|
+
* the chip"). The chip's own action is unaffected.
|
|
36
36
|
*/
|
|
37
37
|
onTrailingClick?: ChipEvents["trailing"];
|
|
38
38
|
/** The trailing button's accessible name; "{label} options" for a menu, "Remove {label}" otherwise. */
|
|
@@ -70,7 +70,7 @@ export interface ChipConfig {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @internal What the chip set passes a chip on top of its config; not part of
|
|
73
|
-
* ChipConfig, so apps cannot set it
|
|
73
|
+
* ChipConfig, so apps cannot set it.
|
|
74
74
|
*/
|
|
75
75
|
export interface ChipOptions extends ChipConfig {
|
|
76
76
|
/** Selection belongs to the chips container. */
|
|
@@ -80,7 +80,7 @@ export interface ChipOptions extends ChipConfig {
|
|
|
80
80
|
/** The owning set removes the chip, once its `remove` listeners have run. */
|
|
81
81
|
onRemoved?: (chip: ChipComponent) => void;
|
|
82
82
|
/**
|
|
83
|
-
* The chip is a cell of a chip set's grid
|
|
83
|
+
* The chip is a cell of a chip set's grid: the root is a
|
|
84
84
|
* `gridcell`, and a one-action chip's cell is its focus target.
|
|
85
85
|
*/
|
|
86
86
|
cell?: boolean;
|
|
@@ -95,7 +95,7 @@ export type InputChipConfig = Omit<FilterChipConfig, "elevated" | "onTrailingCli
|
|
|
95
95
|
export interface ChipChangePayload {
|
|
96
96
|
selected: boolean;
|
|
97
97
|
chip: ChipComponent;
|
|
98
|
-
/** The chip's value, as `getValue()` returns it; every model event carries it
|
|
98
|
+
/** The chip's value, as `getValue()` returns it; every model event carries it */
|
|
99
99
|
value: string | null;
|
|
100
100
|
}
|
|
101
101
|
export interface ChipEvents {
|
|
@@ -105,7 +105,7 @@ export interface ChipEvents {
|
|
|
105
105
|
blur: (payload: ForwardedEventPayload<FocusEvent, HTMLElement>) => void;
|
|
106
106
|
change: (payload: ChipChangePayload) => void;
|
|
107
107
|
remove: (chip: ChipComponent) => void;
|
|
108
|
-
/** A filter chip's trailing button was activated
|
|
108
|
+
/** A filter chip's trailing button was activated. */
|
|
109
109
|
trailing: (chip: ChipComponent) => void;
|
|
110
110
|
}
|
|
111
111
|
/** Shared API. Selection setters are inert on assist and suggestion chips. */
|
|
@@ -115,7 +115,7 @@ export interface ChipComponent {
|
|
|
115
115
|
action: HTMLButtonElement;
|
|
116
116
|
/**
|
|
117
117
|
* A filter chip's trailing button, when it has one (`onTrailingClick`): anchor a
|
|
118
|
-
* menu to it and keep its aria-expanded in step.
|
|
118
|
+
* menu to it and keep its aria-expanded in step.
|
|
119
119
|
*/
|
|
120
120
|
trailingAction?: HTMLButtonElement;
|
|
121
121
|
getType: () => ChipType;
|
|
@@ -173,7 +173,7 @@ export interface ChipsConfig {
|
|
|
173
173
|
selector?: string | null;
|
|
174
174
|
/**
|
|
175
175
|
* Whether several chips can be selected at once. Multi-select is the default, as
|
|
176
|
-
* Material's chip groups are (single-select is opt-in).
|
|
176
|
+
* Material's chip groups are (single-select is opt-in).
|
|
177
177
|
* @default true
|
|
178
178
|
*/
|
|
179
179
|
multiSelect?: boolean;
|
|
@@ -181,7 +181,7 @@ export interface ChipsConfig {
|
|
|
181
181
|
* Whether the set keeps at least one chip selected: deselecting the last selected
|
|
182
182
|
* chip is refused, and a refused click emits no `change`, on the chip or on the set.
|
|
183
183
|
* Off by default, as in Material; single-select sets used to
|
|
184
|
-
* enforce it without a way to opt out.
|
|
184
|
+
* enforce it without a way to opt out.
|
|
185
185
|
* @default false
|
|
186
186
|
*/
|
|
187
187
|
selectionRequired?: boolean;
|
|
@@ -344,7 +344,7 @@ export interface ChipsComponent {
|
|
|
344
344
|
/**
|
|
345
345
|
* Selects chips by their values
|
|
346
346
|
* @param values - Value or array of values to select
|
|
347
|
-
* @param triggerEvent - Emits `change` when true; silent by default
|
|
347
|
+
* @param triggerEvent - Emits `change` when true; silent by default
|
|
348
348
|
* @returns The chips instance for chaining
|
|
349
349
|
*/
|
|
350
350
|
selectByValue: (values: string | string[], triggerEvent?: boolean) => ChipsComponent;
|
|
@@ -401,7 +401,7 @@ export interface ChipsComponent {
|
|
|
401
401
|
enableKeyboardNavigation: () => ChipsComponent;
|
|
402
402
|
/**
|
|
403
403
|
* Turns keyboard navigation between the chips on and off: while disabled,
|
|
404
|
-
* the arrows, Home and End no longer move focus in the set
|
|
404
|
+
* the arrows, Home and End no longer move focus in the set
|
|
405
405
|
*/
|
|
406
406
|
keyboard: {
|
|
407
407
|
/** Moves focus with the arrows, Home and End again */
|
|
@@ -431,7 +431,7 @@ export interface ChipsComponent {
|
|
|
431
431
|
/**
|
|
432
432
|
* Registers ChipConfig with the global defaults map, so
|
|
433
433
|
* `setComponentDefaults("chip", ...)` is typed without core
|
|
434
|
-
* importing anything from this component.
|
|
434
|
+
* importing anything from this component.
|
|
435
435
|
*/
|
|
436
436
|
declare module "../../core/config/global" {
|
|
437
437
|
interface ComponentConfigMap {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DatePickerComponent, DatePickerConfig, DatePickerValueOf } from "./types.js";
|
|
2
2
|
/** M3 calendar/input modes share a draft; modal acceptance is the commit boundary. */
|
|
3
3
|
/**
|
|
4
|
-
* The value's type follows a literal selectionMode
|
|
4
|
+
* The value's type follows a literal selectionMode: `'range'` makes
|
|
5
5
|
* it a pair, the default a date.
|
|
6
6
|
*/
|
|
7
7
|
declare const createDatePicker: <M extends string = "single">(config?: DatePickerConfig & {
|
|
@@ -3,17 +3,17 @@ import type { NormalizedEvent } from "../../core/utils/mobile.js";
|
|
|
3
3
|
/** Value returned by the API, including complete ranges and empty selections. */
|
|
4
4
|
export type DatePickerValue = Date | [Date, Date] | null;
|
|
5
5
|
/**
|
|
6
|
-
* The value as the selection mode shapes it
|
|
6
|
+
* The value as the selection mode shapes it: a range is a pair, a
|
|
7
7
|
* single date a date; an unknown mode, either.
|
|
8
8
|
*/
|
|
9
9
|
export type DatePickerValueOf<M> = M extends "range" ? [Date, Date] | null : M extends "single" ? Date | null : DatePickerValue;
|
|
10
|
-
/** What setValue and `value` take: a date, a range as a pair, or as { start, end }
|
|
10
|
+
/** What setValue and `value` take: a date, a range as a pair, or as { start, end }. */
|
|
11
11
|
export type DatePickerInput = Date | string | [Date | string, Date | string] | {
|
|
12
12
|
start: Date | string;
|
|
13
13
|
end: Date | string;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* One shape whatever committed the value
|
|
16
|
+
* One shape whatever committed the value: a range's `value` is the
|
|
17
17
|
* pair, and `rangeEndDate` its end, kept for compatibility (null otherwise).
|
|
18
18
|
* The docked calendar sent the start as the value and the end apart.
|
|
19
19
|
*/
|
|
@@ -23,7 +23,7 @@ export interface DatePickerChangePayload<V = DatePickerValue> {
|
|
|
23
23
|
formattedValue: string;
|
|
24
24
|
/**
|
|
25
25
|
* The value as ISO 8601 text, the `value` of the `<m-datepicker>` element's
|
|
26
|
-
* `change`: a date (`2026-09-10`), a `start/end` interval, or ""
|
|
26
|
+
* `change`: a date (`2026-09-10`), a `start/end` interval, or ""
|
|
27
27
|
*/
|
|
28
28
|
iso: string;
|
|
29
29
|
}
|
|
@@ -141,11 +141,11 @@ export interface DatePickerConfig {
|
|
|
141
141
|
* Accepts a Date object, Date string, or two dates for range selection
|
|
142
142
|
*/
|
|
143
143
|
value?: DatePickerInput;
|
|
144
|
-
/** The value shows and cannot change: no typing, no calendar
|
|
144
|
+
/** The value shows and cannot change: no typing, no calendar. */
|
|
145
145
|
readOnly?: boolean;
|
|
146
|
-
/** A date is required: on the input for forms, and checkValidity()
|
|
146
|
+
/** A date is required: on the input for forms, and checkValidity(). */
|
|
147
147
|
required?: boolean;
|
|
148
|
-
/** The supporting text under the field. Default: the date format
|
|
148
|
+
/** The supporting text under the field. Default: the date format. */
|
|
149
149
|
supportingText?: string;
|
|
150
150
|
/**
|
|
151
151
|
* Minimum selectable date
|
|
@@ -310,11 +310,11 @@ export interface DatePickerComponent<V = DatePickerValue> {
|
|
|
310
310
|
* @returns The datepicker component for chaining
|
|
311
311
|
*/
|
|
312
312
|
setValue: (value: DatePickerInput) => DatePickerComponent<V>;
|
|
313
|
-
/** Read-only: the value shows and cannot change
|
|
313
|
+
/** Read-only: the value shows and cannot change */
|
|
314
314
|
setReadOnly: (readOnly: boolean) => DatePickerComponent<V>;
|
|
315
315
|
/** Whether the picker is read-only */
|
|
316
316
|
isReadOnly: () => boolean;
|
|
317
|
-
/** Whether a date is required
|
|
317
|
+
/** Whether a date is required */
|
|
318
318
|
setRequired: (required: boolean) => DatePickerComponent<V>;
|
|
319
319
|
/**
|
|
320
320
|
* False when a date is required and missing. A dialog variant's input is
|
|
@@ -323,7 +323,7 @@ export interface DatePickerComponent<V = DatePickerValue> {
|
|
|
323
323
|
checkValidity: () => boolean;
|
|
324
324
|
/** As checkValidity(), and shows the error on the field when false */
|
|
325
325
|
reportValidity: () => boolean;
|
|
326
|
-
/** The supporting text; empty or null shows the date format
|
|
326
|
+
/** The supporting text; empty or null shows the date format */
|
|
327
327
|
setSupportingText: (text: string | null) => DatePickerComponent<V>;
|
|
328
328
|
/**
|
|
329
329
|
* Gets the formatted date string based on the selected date(s)
|
|
@@ -395,7 +395,7 @@ export interface DatePickerState {
|
|
|
395
395
|
label: string;
|
|
396
396
|
specialDates: NonNullable<DatePickerConfig["specialDates"]>;
|
|
397
397
|
isAllowed(date: Date): boolean;
|
|
398
|
-
/** Full screen: the first month of the rendered list, and how many follow.
|
|
398
|
+
/** Full screen: the first month of the rendered list, and how many follow. */
|
|
399
399
|
listStart?: Date;
|
|
400
400
|
listLength?: number;
|
|
401
401
|
}
|
|
@@ -79,6 +79,6 @@ export declare const addMonths: (date: Date, months: number) => Date;
|
|
|
79
79
|
export declare const addYears: (date: Date, years: number) => Date;
|
|
80
80
|
/**
|
|
81
81
|
* A value as ISO 8601 text, the `<m-datepicker>` element's value: a date
|
|
82
|
-
* (`2026-09-10`), a `start/end` interval, or ""
|
|
82
|
+
* (`2026-09-10`), a `start/end` interval, or "".
|
|
83
83
|
*/
|
|
84
84
|
export declare const toIsoValue: (value: Date | [Date, Date] | null, end?: Date | null) => string;
|
|
@@ -618,7 +618,7 @@ export interface DialogConfirmOptions {
|
|
|
618
618
|
/**
|
|
619
619
|
* Registers DialogConfig with the global defaults map, so
|
|
620
620
|
* `setComponentDefaults("dialog", ...)` is typed without core
|
|
621
|
-
* importing anything from this component.
|
|
621
|
+
* importing anything from this component.
|
|
622
622
|
*/
|
|
623
623
|
declare module "../../core/config/global" {
|
|
624
624
|
interface ComponentConfigMap {
|
|
@@ -42,7 +42,7 @@ export interface DrawerItemConfig {
|
|
|
42
42
|
export interface DrawerSelectEvent {
|
|
43
43
|
/** The selected item's id */
|
|
44
44
|
id: string;
|
|
45
|
-
/** The id again, as the `value` of the `<m-drawer>` element's `change`
|
|
45
|
+
/** The id again, as the `value` of the `<m-drawer>` element's `change` */
|
|
46
46
|
value: string;
|
|
47
47
|
/** The selected item's label */
|
|
48
48
|
label: string;
|