material 3.8.0 → 3.8.1
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 +1 -1
- package/dist/components/badge/badge.d.ts +4 -0
- package/dist/components/badge/constants.d.ts +4 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/types.d.ts +102 -0
- package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +4 -0
- package/dist/components/bottom-app-bar/constants.d.ts +3 -0
- package/dist/components/bottom-app-bar/types.d.ts +42 -0
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +4 -0
- package/dist/components/bottom-sheet/constants.d.ts +9 -0
- package/dist/components/bottom-sheet/types.d.ts +52 -0
- package/dist/components/button/button.d.ts +4 -0
- package/dist/components/button/constants.d.ts +20 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/types.d.ts +190 -0
- package/dist/components/button-group/button-group.d.ts +4 -0
- package/dist/components/button-group/constants.d.ts +54 -0
- package/dist/components/button-group/index.d.ts +1 -0
- package/dist/components/button-group/types.d.ts +125 -0
- package/dist/components/card/card.d.ts +4 -0
- package/dist/components/card/constants.d.ts +11 -0
- package/dist/components/card/content.d.ts +16 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/types.d.ts +123 -0
- package/dist/components/carousel/carousel.d.ts +1 -0
- package/dist/components/carousel/constants.d.ts +10 -0
- package/dist/components/carousel/types.d.ts +16 -0
- package/dist/components/checkbox/checkbox.d.ts +5 -0
- package/dist/components/checkbox/constants.d.ts +13 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/types.d.ts +94 -0
- package/dist/components/chips/chips.d.ts +4 -0
- package/dist/components/chips/constants.d.ts +1 -0
- package/dist/components/chips/factories.d.ts +4 -0
- package/dist/components/chips/types.d.ts +140 -0
- package/dist/components/datepicker/constants.d.ts +38 -0
- package/dist/components/datepicker/datepicker.d.ts +2 -0
- package/dist/components/datepicker/types.d.ts +139 -0
- package/dist/components/dialog/constants.d.ts +45 -0
- package/dist/components/dialog/dialog.d.ts +5 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/types.d.ts +196 -0
- package/dist/components/divider/config.d.ts +30 -0
- package/dist/components/divider/constants.d.ts +15 -0
- package/dist/components/divider/divider.d.ts +4 -0
- package/dist/components/divider/types.d.ts +27 -0
- package/dist/components/drawer/constants.d.ts +39 -0
- package/dist/components/drawer/drawer.d.ts +4 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/types.d.ts +109 -0
- package/dist/components/extended-fab/constants.d.ts +32 -0
- package/dist/components/extended-fab/extended-fab.d.ts +4 -0
- package/dist/components/extended-fab/types.d.ts +123 -0
- package/dist/components/fab/constants.d.ts +26 -0
- package/dist/components/fab/fab.d.ts +4 -0
- package/dist/components/fab/types.d.ts +100 -0
- package/dist/components/fab-menu/constants.d.ts +9 -0
- package/dist/components/fab-menu/fab-menu.d.ts +4 -0
- package/dist/components/fab-menu/types.d.ts +41 -0
- package/dist/components/icon-button/constants.d.ts +34 -0
- package/dist/components/icon-button/icon-button.d.ts +4 -0
- package/dist/components/icon-button/types.d.ts +157 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/list/constants.d.ts +30 -0
- package/dist/components/list/index.d.ts +1 -0
- package/dist/components/list/list.d.ts +4 -0
- package/dist/components/list/types.d.ts +110 -0
- package/dist/components/loading-indicator/constants.d.ts +16 -0
- package/dist/components/loading-indicator/features/renderer.d.ts +13 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts +4 -0
- package/dist/components/loading-indicator/types.d.ts +21 -0
- package/dist/components/menu/constants.d.ts +51 -0
- package/dist/components/menu/features/controller.js +1 -1
- package/dist/components/menu/features/keyboard.js +8 -3
- package/dist/components/menu/features/opener.js +2 -16
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/inner.d.ts +2 -0
- package/dist/components/menu/menu.d.ts +4 -0
- package/dist/components/menu/on-demand.d.ts +9 -0
- package/dist/components/menu/types.d.ts +185 -1
- package/dist/components/navigation-bar/navigation-bar.d.ts +1 -0
- package/dist/components/navigation-bar/types.d.ts +12 -0
- package/dist/components/navigation-rail/constants.d.ts +2 -0
- package/dist/components/navigation-rail/navigation-rail.d.ts +1 -0
- package/dist/components/navigation-rail/types.d.ts +18 -0
- package/dist/components/progress/constants.d.ts +37 -0
- package/dist/components/progress/progress.d.ts +4 -0
- package/dist/components/progress/types.d.ts +136 -0
- package/dist/components/radios/constants.d.ts +14 -0
- package/dist/components/radios/radios.d.ts +4 -0
- package/dist/components/radios/types.d.ts +89 -0
- package/dist/components/search/constants.d.ts +34 -0
- package/dist/components/search/search.d.ts +4 -0
- package/dist/components/search/types.d.ts +109 -0
- package/dist/components/select/constants.d.ts +46 -0
- package/dist/components/select/features.js +9 -1
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/select.d.ts +4 -0
- package/dist/components/select/types.d.ts +95 -0
- package/dist/components/side-sheet/constants.d.ts +9 -0
- package/dist/components/side-sheet/side-sheet.d.ts +4 -0
- package/dist/components/side-sheet/types.d.ts +51 -0
- package/dist/components/slider/constants.d.ts +62 -0
- package/dist/components/slider/slider.d.ts +4 -0
- package/dist/components/slider/types.d.ts +78 -0
- package/dist/components/snackbar/constants.d.ts +37 -0
- package/dist/components/snackbar/snackbar.d.ts +5 -0
- package/dist/components/snackbar/types.d.ts +67 -0
- package/dist/components/split-button/api.js +13 -3
- package/dist/components/split-button/constants.d.ts +13 -0
- package/dist/components/split-button/split-button.d.ts +4 -0
- package/dist/components/split-button/types.d.ts +50 -0
- package/dist/components/switch/constants.d.ts +34 -0
- package/dist/components/switch/switch.d.ts +4 -0
- package/dist/components/switch/types.d.ts +55 -0
- package/dist/components/tabs/constants.d.ts +49 -0
- package/dist/components/tabs/indicator.d.ts +22 -0
- package/dist/components/tabs/responsive.d.ts +17 -0
- package/dist/components/tabs/tab.d.ts +5 -0
- package/dist/components/tabs/tabs.d.ts +4 -0
- package/dist/components/tabs/types.d.ts +170 -0
- package/dist/components/tabs/utils.d.ts +24 -0
- package/dist/components/text-field/constants.d.ts +61 -0
- package/dist/components/text-field/features/trailing-icon.d.ts +25 -0
- package/dist/components/text-field/text-field.d.ts +4 -0
- package/dist/components/text-field/types.d.ts +84 -0
- package/dist/components/timepicker/constants.d.ts +61 -0
- package/dist/components/timepicker/types.d.ts +145 -0
- package/dist/components/toolbar/constants.d.ts +8 -0
- package/dist/components/toolbar/toolbar.d.ts +4 -0
- package/dist/components/toolbar/types.d.ts +75 -0
- package/dist/components/tooltip/constants.d.ts +43 -0
- package/dist/components/tooltip/tooltip.d.ts +4 -0
- package/dist/components/tooltip/types.d.ts +78 -0
- package/dist/components/top-app-bar/constants.d.ts +29 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts +4 -0
- package/dist/components/top-app-bar/types.d.ts +55 -0
- package/dist/core/canvas/animation.d.ts +6 -0
- package/dist/core/canvas/drawing.d.ts +47 -0
- package/dist/core/canvas/index.d.ts +1 -0
- package/dist/core/canvas/resize.d.ts +7 -0
- package/dist/core/canvas/utils.d.ts +39 -0
- package/dist/core/compose/base.d.ts +9 -0
- package/dist/core/compose/cleanup.d.ts +2 -0
- package/dist/core/compose/component.d.ts +13 -0
- package/dist/core/compose/features/badge.d.ts +10 -0
- package/dist/core/compose/features/checkable.d.ts +13 -0
- package/dist/core/compose/features/debounce.d.ts +19 -0
- package/dist/core/compose/features/disabled.d.ts +11 -0
- package/dist/core/compose/features/events.d.ts +19 -0
- package/dist/core/compose/features/icon.d.ts +20 -0
- package/dist/core/compose/features/input.d.ts +31 -0
- package/dist/core/compose/features/lifecycle.d.ts +16 -0
- package/dist/core/compose/features/position.d.ts +13 -0
- package/dist/core/compose/features/ripple.d.ts +17 -0
- package/dist/core/compose/features/size.d.ts +5 -0
- package/dist/core/compose/features/style.d.ts +5 -0
- package/dist/core/compose/features/text.d.ts +20 -0
- package/dist/core/compose/features/textinput.d.ts +39 -0
- package/dist/core/compose/features/textlabel.d.ts +18 -0
- package/dist/core/compose/features/throttle.d.ts +18 -0
- package/dist/core/compose/features/track.d.ts +12 -0
- package/dist/core/compose/features/variant.d.ts +5 -0
- package/dist/core/compose/features/withEvents.d.ts +12 -0
- package/dist/core/compose/pipe.d.ts +12 -0
- package/dist/core/compose/utils/type-guards.d.ts +5 -0
- package/dist/core/config/component.d.ts +17 -0
- package/dist/core/config/global.d.ts +15 -0
- package/dist/core/config.d.ts +34 -0
- package/dist/core/dom/attributes.d.ts +25 -0
- package/dist/core/dom/classes.d.ts +24 -0
- package/dist/core/dom/create.d.ts +47 -0
- package/dist/core/dom/events.d.ts +26 -0
- package/dist/core/dom/focus.d.ts +11 -0
- package/dist/core/dom/html.d.ts +6 -0
- package/dist/core/dom/layer.d.ts +36 -0
- package/dist/core/dom/roving.d.ts +7 -0
- package/dist/core/navigation/destinations.d.ts +10 -0
- package/dist/core/shapes/cubic.d.ts +8 -0
- package/dist/core/shapes/material.d.ts +45 -0
- package/dist/core/shapes/polygon.d.ts +11 -0
- package/dist/core/state/emitter.d.ts +19 -0
- package/dist/core/state/events.d.ts +17 -0
- package/dist/core/state/store.d.ts +40 -0
- package/dist/core/theme/shape.d.ts +3 -0
- package/dist/core/theme/tokens.d.ts +6 -0
- package/dist/core/utils/background.d.ts +7 -0
- package/dist/core/utils/color.d.ts +5 -0
- package/dist/core/utils/index.d.ts +9 -0
- package/dist/core/utils/mobile.d.ts +10 -0
- package/dist/core/utils/object.d.ts +9 -0
- package/dist/core/utils/performance.d.ts +20 -0
- package/dist/core/utils/theme.d.ts +8 -0
- package/dist/core/utils/url.d.ts +3 -0
- package/dist/elements/adapter.d.ts +24 -0
- package/dist/elements/badge.d.ts +4 -0
- package/dist/elements/bottom-app-bar.d.ts +4 -0
- package/dist/elements/bottom-sheet.d.ts +6 -0
- package/dist/elements/button-group.d.ts +8 -0
- package/dist/elements/button.d.ts +5 -0
- package/dist/elements/card.d.ts +4 -0
- package/dist/elements/carousel.d.ts +5 -0
- package/dist/elements/checkbox.d.ts +4 -0
- package/dist/elements/chips.d.ts +9 -0
- package/dist/elements/css/menu.css +1 -1
- package/dist/elements/css/menu.js +1 -1
- package/dist/elements/datepicker.d.ts +6 -0
- package/dist/elements/define.d.ts +48 -0
- package/dist/elements/dialog.d.ts +5 -0
- package/dist/elements/divider.d.ts +4 -0
- package/dist/elements/drawer.d.ts +6 -0
- package/dist/elements/extended-fab.d.ts +5 -0
- package/dist/elements/fab-menu.d.ts +10 -0
- package/dist/elements/fab.d.ts +5 -0
- package/dist/elements/icon-button.d.ts +6 -0
- package/dist/elements/index.d.ts +4 -0
- package/dist/elements/list.d.ts +8 -0
- package/dist/elements/loading-indicator.d.ts +4 -0
- package/dist/elements/menu.d.ts +12 -0
- package/dist/elements/navigation-bar.d.ts +6 -0
- package/dist/elements/navigation-rail.d.ts +10 -0
- 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/progress.d.ts +4 -0
- package/dist/elements/radios.d.ts +5 -0
- package/dist/elements/search.d.ts +15 -0
- package/dist/elements/select.d.ts +6 -0
- package/dist/elements/side-sheet.d.ts +5 -0
- package/dist/elements/slider.d.ts +7 -0
- package/dist/elements/snackbar.d.ts +4 -0
- package/dist/elements/split-button.d.ts +8 -0
- package/dist/elements/styles.d.ts +11 -0
- package/dist/elements/switch.d.ts +5 -0
- package/dist/elements/tabs.d.ts +6 -0
- package/dist/elements/text-field.d.ts +9 -0
- package/dist/elements/timepicker.d.ts +9 -0
- package/dist/elements/toolbar.d.ts +4 -0
- package/dist/elements/tooltip.d.ts +4 -0
- package/dist/elements/top-app-bar.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/react/create.d.ts +15 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/jsx.d.ts +3 -0
- package/dist/solid/create.d.ts +16 -0
- package/dist/solid/index.d.ts +1 -0
- package/dist/solid/jsx.d.ts +4 -0
- package/dist/ssr/index.d.ts +3 -0
- package/dist/ssr/solid.d.ts +1 -0
- package/dist/ssr/svelte.d.ts +1 -0
- package/dist/ssr/vue.d.ts +1 -0
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base-lite.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 +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +2 -2
- 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 +1 -1
- package/dist/styles/tooltip.css +1 -1
- 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/runtime.d.ts +21 -0
- package/dist/theme/image.d.ts +2 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/variants.d.ts +6 -0
- package/dist/theme/vendor/dynamiccolor/color_spec_2021.d.ts +1 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_color.d.ts +39 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_scheme.d.ts +13 -0
- package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.d.ts +1 -0
- package/dist/theme/vendor/hct/hct.d.ts +9 -0
- 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 +18 -0
- package/dist/vue/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/styles/components/_menu.scss +14 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { AssistChipConfig, FilterChipConfig, InputChipConfig, SuggestionChipConfig, ChipComponent } from "./types.js";
|
|
2
|
+
/** Action chip; flat and outlined by default. */
|
|
2
3
|
export declare const createAssistChip: (config: AssistChipConfig) => ChipComponent;
|
|
4
|
+
/** Toggleable filter; selected chips show a checkmark. */
|
|
3
5
|
export declare const createFilterChip: (config: FilterChipConfig) => ChipComponent;
|
|
6
|
+
/** Selectable input token with an optional independent removal action. */
|
|
4
7
|
export declare const createInputChip: (config: InputChipConfig) => ChipComponent;
|
|
8
|
+
/** Suggested action; flat and outlined by default. */
|
|
5
9
|
export declare const createSuggestionChip: (config: SuggestionChipConfig) => ChipComponent;
|
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
import type { EventCallback } from "../../core/state/emitter.js";
|
|
2
2
|
import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
3
3
|
export type ChipType = "assist" | "filter" | "input" | "suggestion";
|
|
4
|
+
/** Shared chip options. */
|
|
4
5
|
export interface ChipConfig {
|
|
5
6
|
type?: ChipType;
|
|
6
7
|
label?: string;
|
|
8
|
+
/** Accessible name for the primary focus target. */
|
|
7
9
|
ariaLabel?: string;
|
|
8
10
|
value?: string;
|
|
9
11
|
disabled?: boolean;
|
|
12
|
+
/** In a single-select set, selecting this chip replaces the previous selection; the last selected config wins. */
|
|
10
13
|
selected?: boolean;
|
|
14
|
+
/** Elevated styling is supported by assist, filter and suggestion chips. */
|
|
11
15
|
elevated?: boolean;
|
|
16
|
+
/** Markup (HTML). */
|
|
12
17
|
leadingIcon?: string;
|
|
18
|
+
/** Markup (HTML). */
|
|
13
19
|
icon?: string;
|
|
20
|
+
/** Markup (HTML). */
|
|
14
21
|
trailingIcon?: string;
|
|
22
|
+
/** Decorative avatar for an input chip; takes precedence over leadingIcon. */
|
|
15
23
|
avatar?: string;
|
|
24
|
+
/** Called when an input chip is removed, from its remove button or with Backspace or Delete. */
|
|
16
25
|
onRemove?: ChipEvents["remove"];
|
|
17
26
|
removeLabel?: string;
|
|
27
|
+
/** Filter chips: gives the trailing icon its own button, which calls this (the m3.material.io chips' trailing icon that "can be used to open a menu or remove the chip"). */
|
|
18
28
|
onTrailingClick?: ChipEvents["trailing"];
|
|
29
|
+
/** The trailing button's accessible name; "{label} options" for a menu, "Remove {label}" otherwise. */
|
|
19
30
|
trailingLabel?: string;
|
|
31
|
+
/** The trailing button opens a menu: aria-haspopup="menu", and a drop-down arrow unless trailingIcon is set. */
|
|
20
32
|
trailingMenu?: boolean;
|
|
33
|
+
/** Same payload as a `click` listener. */
|
|
21
34
|
onClick?: ChipEvents["click"];
|
|
35
|
+
/** Same payload as a `change` listener: `{ selected, chip, value }`. */
|
|
22
36
|
onChange?: ChipEvents["change"];
|
|
37
|
+
/** Called with the chip when the user toggles a selectable chip, not when a `selectionRequired` set refuses the click. */
|
|
23
38
|
onSelect?: (chip: ChipComponent) => void;
|
|
24
39
|
class?: string;
|
|
25
40
|
prefix?: string;
|
|
@@ -27,9 +42,13 @@ export interface ChipConfig {
|
|
|
27
42
|
ripple?: boolean;
|
|
28
43
|
}
|
|
29
44
|
export interface ChipOptions extends ChipConfig {
|
|
45
|
+
/** Selection belongs to the chips container. */
|
|
30
46
|
managedSelection?: boolean;
|
|
47
|
+
/** Notify the owning set when a chip becomes selected. */
|
|
31
48
|
onSelected?: (chip: ChipComponent) => void;
|
|
49
|
+
/** The owning set removes the chip, once its `remove` listeners have run. */
|
|
32
50
|
onRemoved?: (chip: ChipComponent) => void;
|
|
51
|
+
/** The chip is a cell of a chip set's grid: the root is a `gridcell`, and a one-action chip's cell is its focus target. */
|
|
33
52
|
cell?: boolean;
|
|
34
53
|
}
|
|
35
54
|
type NamedChipConfig = Omit<ChipConfig, "type" | "text" | "selected" | "avatar" | "onRemove" | "removeLabel" | "onChange" | "onSelect" | "onTrailingClick" | "trailingLabel" | "trailingMenu"> & {
|
|
@@ -42,6 +61,7 @@ export type InputChipConfig = Omit<FilterChipConfig, "elevated" | "onTrailingCli
|
|
|
42
61
|
export interface ChipChangePayload {
|
|
43
62
|
selected: boolean;
|
|
44
63
|
chip: ChipComponent;
|
|
64
|
+
/** The chip's value, as `getValue()` returns it; every model event carries it */
|
|
45
65
|
value: string | null;
|
|
46
66
|
}
|
|
47
67
|
export interface ChipEvents {
|
|
@@ -51,11 +71,15 @@ export interface ChipEvents {
|
|
|
51
71
|
blur: (payload: ForwardedEventPayload<FocusEvent, HTMLElement>) => void;
|
|
52
72
|
change: (payload: ChipChangePayload) => void;
|
|
53
73
|
remove: (chip: ChipComponent) => void;
|
|
74
|
+
/** A filter chip's trailing button was activated. */
|
|
54
75
|
trailing: (chip: ChipComponent) => void;
|
|
55
76
|
}
|
|
77
|
+
/** Shared API. */
|
|
56
78
|
export interface ChipComponent {
|
|
57
79
|
element: HTMLElement;
|
|
80
|
+
/** Native primary action. */
|
|
58
81
|
action: HTMLButtonElement;
|
|
82
|
+
/** A filter chip's trailing button, when it has one (`onTrailingClick`): anchor a menu to it and keep its aria-expanded in step. */
|
|
59
83
|
trailingAction?: HTMLButtonElement;
|
|
60
84
|
getType: () => ChipType;
|
|
61
85
|
getValue: () => string | null;
|
|
@@ -65,6 +89,7 @@ export interface ChipComponent {
|
|
|
65
89
|
isDisabled: () => boolean;
|
|
66
90
|
setLabel: (label: string) => ChipComponent;
|
|
67
91
|
getLabel: () => string;
|
|
92
|
+
/** Alias of setLabel for chips-container consumers. */
|
|
68
93
|
setText: (text: string) => ChipComponent;
|
|
69
94
|
getText: () => string;
|
|
70
95
|
setIcon: (icon: string) => ChipComponent;
|
|
@@ -72,6 +97,7 @@ export interface ChipComponent {
|
|
|
72
97
|
setLeadingIcon: (icon: string) => ChipComponent;
|
|
73
98
|
setTrailingIcon: (icon: string) => ChipComponent;
|
|
74
99
|
isSelected: () => boolean;
|
|
100
|
+
/** Selects or deselects this chip silently. */
|
|
75
101
|
setSelected: (selected: boolean) => ChipComponent;
|
|
76
102
|
toggleSelected: () => ChipComponent;
|
|
77
103
|
focus: () => ChipComponent;
|
|
@@ -80,27 +106,67 @@ export interface ChipComponent {
|
|
|
80
106
|
off: <K extends keyof ChipEvents>(event: K, handler: ChipEvents[K]) => ChipComponent;
|
|
81
107
|
addClass: (...classes: string[]) => ChipComponent;
|
|
82
108
|
}
|
|
109
|
+
/** Configuration interface for the Chips component */
|
|
83
110
|
export interface ChipsConfig {
|
|
111
|
+
/**
|
|
112
|
+
* Array of chip configurations to initialize
|
|
113
|
+
* @default []
|
|
114
|
+
*/
|
|
84
115
|
chips?: ChipConfig[];
|
|
116
|
+
/**
|
|
117
|
+
* Whether the chip set is horizontally scrollable
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
85
120
|
scrollable?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the chip set is vertically stacked
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
86
125
|
vertical?: boolean;
|
|
126
|
+
/** Additional CSS classes */
|
|
87
127
|
class?: string;
|
|
128
|
+
/** CSS selector for filtering behavior */
|
|
88
129
|
selector?: string | null;
|
|
130
|
+
/**
|
|
131
|
+
* Whether several chips can be selected at once.
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
89
134
|
multiSelect?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the set keeps at least one chip selected: deselecting the last selected chip is refused, and a refused click emits no `change`, on the chip or on the set.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
90
139
|
selectionRequired?: boolean;
|
|
140
|
+
/** Same payload as an `on("change")` listener. */
|
|
91
141
|
onChange?: ChipsEvents["change"];
|
|
142
|
+
/**
|
|
143
|
+
* Component prefix for class names
|
|
144
|
+
* @default 'mtrl'
|
|
145
|
+
*/
|
|
92
146
|
prefix?: string;
|
|
147
|
+
/** Label text for the chips container */
|
|
93
148
|
label?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Position of the label (start or end)
|
|
151
|
+
* @default 'start'
|
|
152
|
+
*/
|
|
94
153
|
labelPosition?: "start" | "end";
|
|
154
|
+
/** Schema definition for the component structure */
|
|
95
155
|
schema?: unknown;
|
|
156
|
+
/** Event handlers for component events */
|
|
96
157
|
on?: Partial<ChipsEvents>;
|
|
97
158
|
}
|
|
159
|
+
/** Chips component interface */
|
|
160
|
+
/** What a chips feature needs from the component it is handed. */
|
|
98
161
|
export interface ChipsFeatureComponent {
|
|
99
162
|
element: HTMLElement;
|
|
100
163
|
getClass: (name: string) => string;
|
|
101
164
|
emit?: (event: string, data: unknown) => unknown;
|
|
165
|
+
/** withDom builds this; the controller appends chips to it */
|
|
102
166
|
chipContainer?: HTMLElement;
|
|
167
|
+
/** withChipItems keeps the live chips here. */
|
|
103
168
|
chipInstances: ChipComponent[];
|
|
169
|
+
/** withContainer installs this whole, so the members are not optional in it */
|
|
104
170
|
layout?: {
|
|
105
171
|
isVertical: () => boolean;
|
|
106
172
|
isScrollable: () => boolean;
|
|
@@ -110,52 +176,126 @@ export interface ChipsFeatureComponent {
|
|
|
110
176
|
destroy: () => void;
|
|
111
177
|
};
|
|
112
178
|
}
|
|
179
|
+
/** The handlers the chips controller keeps per event name. */
|
|
113
180
|
export type ChipsEventListeners = Record<string, EventCallback[]>;
|
|
181
|
+
/** The payload of the chips set's `change`. */
|
|
114
182
|
export interface ChipsChangeEvent {
|
|
183
|
+
/** The selection in the `value` property's shape: a string or null for a single-select set, an array for a multi-select one. */
|
|
115
184
|
value: string | string[] | null;
|
|
185
|
+
/** The values of the selected chips, in chip order (a chip without a value gives null) */
|
|
116
186
|
selected: (string | null)[];
|
|
187
|
+
/** The value of the chip the user toggled; null for a change made by a method */
|
|
117
188
|
changed: string | null;
|
|
118
189
|
}
|
|
190
|
+
/** A chip joined the set; `value` is the selection after insertion. */
|
|
119
191
|
export interface ChipsAddEvent {
|
|
120
192
|
value: string | string[] | null;
|
|
121
193
|
chip: ChipComponent;
|
|
122
194
|
}
|
|
195
|
+
/** A chip left the set; `value` is the remaining selection. */
|
|
123
196
|
export interface ChipsRemoveEvent extends ChipsAddEvent {
|
|
197
|
+
/** The selection after removal, in the same shape as the set's `getValue()`. */
|
|
124
198
|
value: string | string[] | null;
|
|
199
|
+
/** The removed chip's value, captured before destruction. */
|
|
125
200
|
chipValue: string | null;
|
|
126
201
|
}
|
|
202
|
+
/** Events emitted by the chips container's controller. */
|
|
127
203
|
export interface ChipsEvents {
|
|
204
|
+
/** The selection after the change. */
|
|
128
205
|
change: (event: ChipsChangeEvent) => void;
|
|
206
|
+
/** The newly created chip and the selection after insertion. */
|
|
129
207
|
add: (event: ChipsAddEvent) => void;
|
|
208
|
+
/** The removed chip and the selection after removal. */
|
|
130
209
|
remove: (event: ChipsRemoveEvent) => void;
|
|
131
210
|
}
|
|
132
211
|
export interface ChipsComponent {
|
|
212
|
+
/** The chips container's DOM element */
|
|
133
213
|
element: HTMLElement;
|
|
214
|
+
/**
|
|
215
|
+
* Adds a new chip to the chips container.
|
|
216
|
+
* @param chipConfig
|
|
217
|
+
*/
|
|
134
218
|
addChip: (chipConfig: ChipConfig) => ChipsComponent;
|
|
219
|
+
/**
|
|
220
|
+
* Removes a chip from the chips container
|
|
221
|
+
* @param chipOrIndex
|
|
222
|
+
*/
|
|
135
223
|
removeChip: (chipOrIndex: ChipComponent | number) => ChipsComponent;
|
|
224
|
+
/** Gets all chip instances in the set */
|
|
136
225
|
getChips: () => ChipComponent[];
|
|
226
|
+
/** Gets currently selected chips */
|
|
137
227
|
getSelectedChips: () => ChipComponent[];
|
|
228
|
+
/** Gets the values of selected chips */
|
|
138
229
|
getSelectedValues: () => (string | null)[];
|
|
230
|
+
/** Gets the current value - form field compatibility */
|
|
139
231
|
getValue: () => string | string[] | null;
|
|
232
|
+
/**
|
|
233
|
+
* Sets the value by selecting chips by value, without a change event - form field compatibility
|
|
234
|
+
* @param values
|
|
235
|
+
*/
|
|
140
236
|
setValue: (values: string | string[] | null | undefined) => ChipsComponent;
|
|
237
|
+
/**
|
|
238
|
+
* Selects chips by their values
|
|
239
|
+
* @param values
|
|
240
|
+
* @param triggerEvent
|
|
241
|
+
*/
|
|
141
242
|
selectByValue: (values: string | string[], triggerEvent?: boolean) => ChipsComponent;
|
|
243
|
+
/** Clears all selections. */
|
|
142
244
|
clearSelection: () => ChipsComponent;
|
|
245
|
+
/**
|
|
246
|
+
* Sets the scrollable state of the chips container
|
|
247
|
+
* @param isScrollable
|
|
248
|
+
*/
|
|
143
249
|
setScrollable: (isScrollable: boolean) => ChipsComponent;
|
|
250
|
+
/**
|
|
251
|
+
* Sets the vertical layout state
|
|
252
|
+
* @param isVertical
|
|
253
|
+
*/
|
|
144
254
|
setVertical: (isVertical: boolean) => ChipsComponent;
|
|
255
|
+
/**
|
|
256
|
+
* Sets the label text
|
|
257
|
+
* @param text
|
|
258
|
+
*/
|
|
145
259
|
setLabel: (text: string) => ChipsComponent;
|
|
260
|
+
/** Gets the label text */
|
|
146
261
|
getLabel: () => string;
|
|
262
|
+
/**
|
|
263
|
+
* Sets the label position
|
|
264
|
+
* @param position
|
|
265
|
+
*/
|
|
147
266
|
setLabelPosition: (position: "start" | "end") => ChipsComponent;
|
|
267
|
+
/** Gets the label position */
|
|
148
268
|
getLabelPosition: () => string;
|
|
269
|
+
/**
|
|
270
|
+
* Scrolls to a specific chip.
|
|
271
|
+
* @param chipOrIndex
|
|
272
|
+
*/
|
|
149
273
|
scrollToChip: (chipOrIndex: ChipComponent | number) => ChipsComponent;
|
|
274
|
+
/** Enables keyboard navigation between chips in the set */
|
|
150
275
|
enableKeyboardNavigation: () => ChipsComponent;
|
|
276
|
+
/** Turns keyboard navigation between the chips on and off: while disabled, */
|
|
151
277
|
keyboard: {
|
|
278
|
+
/** Moves focus with the arrows, Home and End again */
|
|
152
279
|
enable: () => void;
|
|
280
|
+
/** Stops moving focus with the arrows, Home and End */
|
|
153
281
|
disable: () => void;
|
|
154
282
|
};
|
|
283
|
+
/** Destroys the chips container and all contained chips */
|
|
155
284
|
destroy: () => void;
|
|
285
|
+
/**
|
|
286
|
+
* Adds an event listener to the chips container
|
|
287
|
+
* @param event
|
|
288
|
+
* @param handler
|
|
289
|
+
*/
|
|
156
290
|
on: <K extends keyof ChipsEvents>(event: K, handler: ChipsEvents[K]) => ChipsComponent;
|
|
291
|
+
/**
|
|
292
|
+
* Removes an event listener from the chips container
|
|
293
|
+
* @param event
|
|
294
|
+
* @param handler
|
|
295
|
+
*/
|
|
157
296
|
off: <K extends keyof ChipsEvents>(event: K, handler: ChipsEvents[K]) => ChipsComponent;
|
|
158
297
|
}
|
|
298
|
+
/** Registers ChipConfig with the global defaults map, so `setComponentDefaults("chip", ...)` is typed without core importing anything from this component. */
|
|
159
299
|
declare module "../../core/config/global" {
|
|
160
300
|
interface ComponentConfigMap {
|
|
161
301
|
chip?: Partial<ChipConfig>;
|
|
@@ -1,45 +1,83 @@
|
|
|
1
|
+
/** DatePicker variants */
|
|
1
2
|
export declare const DATEPICKER_VARIANTS: {
|
|
3
|
+
/** Docked datepicker appears inline on the page */
|
|
2
4
|
readonly DOCKED: "docked";
|
|
5
|
+
/** Modal datepicker appears in a dialog overlay */
|
|
3
6
|
readonly MODAL: "modal";
|
|
7
|
+
/** Modal with input field for entering dates */
|
|
4
8
|
readonly MODAL_INPUT: "modal-input";
|
|
5
9
|
};
|
|
10
|
+
/** DatePicker views */
|
|
6
11
|
export declare const DATEPICKER_VIEWS: {
|
|
12
|
+
/** Daily calendar grid view */
|
|
7
13
|
readonly DAY: "day";
|
|
14
|
+
/** Month selection view */
|
|
8
15
|
readonly MONTH: "month";
|
|
16
|
+
/** Year selection view */
|
|
9
17
|
readonly YEAR: "year";
|
|
10
18
|
};
|
|
19
|
+
/** DatePicker selection modes */
|
|
11
20
|
export declare const DATEPICKER_SELECTION_MODES: {
|
|
21
|
+
/** Select a single date */
|
|
12
22
|
readonly SINGLE: "single";
|
|
23
|
+
/** Select a date range */
|
|
13
24
|
readonly RANGE: "range";
|
|
14
25
|
};
|
|
26
|
+
/** Day names for the calendar */
|
|
15
27
|
export declare const DAY_NAMES: string[];
|
|
28
|
+
/** Month names for the calendar */
|
|
16
29
|
export declare const MONTH_NAMES: string[];
|
|
30
|
+
/** Month names abbreviated */
|
|
17
31
|
export declare const MONTH_NAMES_SHORT: string[];
|
|
32
|
+
/** Default format for displaying dates */
|
|
18
33
|
export declare const DEFAULT_DATE_FORMAT = "MM/DD/YYYY";
|
|
34
|
+
/** DatePicker CSS class names */
|
|
19
35
|
export declare const DATEPICKER_CLASSES: {
|
|
36
|
+
/** Root container class */
|
|
20
37
|
readonly ROOT: "datepicker";
|
|
38
|
+
/** Class for the input field */
|
|
21
39
|
readonly INPUT: "datepicker__input";
|
|
40
|
+
/** Class for the calendar container */
|
|
22
41
|
readonly CALENDAR: "datepicker__calendar";
|
|
42
|
+
/** Class for the header section */
|
|
23
43
|
readonly HEADER: "datepicker__header";
|
|
44
|
+
/** Class for the month/year navigation */
|
|
24
45
|
readonly NAVIGATION: "datepicker__navigation";
|
|
46
|
+
/** Class for the day names row */
|
|
25
47
|
readonly WEEKDAYS: "datepicker__weekdays";
|
|
48
|
+
/** Class for the days grid */
|
|
26
49
|
readonly DAYS: "datepicker__days";
|
|
50
|
+
/** Class for individual day cells */
|
|
27
51
|
readonly DAY: "datepicker__day";
|
|
52
|
+
/** Class for today's date */
|
|
28
53
|
readonly TODAY: "datepicker__day--today";
|
|
54
|
+
/** Class for selected date */
|
|
29
55
|
readonly SELECTED: "datepicker__day--selected";
|
|
56
|
+
/** Class for disabled dates */
|
|
30
57
|
readonly DISABLED: "datepicker__day--disabled";
|
|
58
|
+
/** Class for dates outside the current month */
|
|
31
59
|
readonly OUTSIDE_MONTH: "datepicker__day--outside";
|
|
60
|
+
/** Class for first date in a range */
|
|
32
61
|
readonly RANGE_START: "datepicker__cell--range-start";
|
|
62
|
+
/** Class for last date in a range */
|
|
33
63
|
readonly RANGE_END: "datepicker__cell--range-end";
|
|
64
|
+
/** Class for dates between start and end in a range */
|
|
34
65
|
readonly RANGE_MIDDLE: "datepicker__cell--range";
|
|
35
66
|
};
|
|
67
|
+
/** DatePicker events */
|
|
36
68
|
export declare const DATEPICKER_EVENTS: {
|
|
69
|
+
/** Fired when the selected date changes */
|
|
37
70
|
readonly CHANGE: "change";
|
|
71
|
+
/** Fired when the datepicker opens */
|
|
38
72
|
readonly OPEN: "open";
|
|
73
|
+
/** Fired when the datepicker closes */
|
|
39
74
|
readonly CLOSE: "close";
|
|
75
|
+
/** Fired when a day is clicked/focused */
|
|
40
76
|
readonly SELECT: "select";
|
|
77
|
+
/** Fired when the view changes (day/month/year) */
|
|
41
78
|
readonly VIEW_CHANGE: "viewChange";
|
|
42
79
|
};
|
|
80
|
+
/** Internal SVG assets; accessible names are on their buttons. */
|
|
43
81
|
export declare const DATEPICKER_ICONS: {
|
|
44
82
|
readonly calendar: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM5 10h14v10H5V10Zm0-4h14v2H5V6Zm2 6h4v4H7v-4Z\"/></svg>";
|
|
45
83
|
readonly edit: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"m3 17.25 11.06-11.06 3.75 3.75L6.75 21H3v-3.75ZM20.71 7.04l-1.83 1.83-3.75-3.75 1.83-1.83a1 1 0 0 1 1.41 0l2.34 2.34a1 1 0 0 1 0 1.41Z\"/></svg>";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { DatePickerComponent, DatePickerConfig, DatePickerValueOf } from "./types.js";
|
|
2
|
+
/** M3 calendar/input modes share a draft; modal acceptance is the commit boundary. */
|
|
3
|
+
/** The value's type follows a literal selectionMode: `'range'` makes it a pair, the default a date. */
|
|
2
4
|
declare const createDatePicker: <M extends string = "single">(config?: DatePickerConfig & {
|
|
3
5
|
selectionMode?: M;
|
|
4
6
|
}) => DatePickerComponent<DatePickerValueOf<M>>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
2
2
|
import type { NormalizedEvent } from "../../core/utils/mobile.js";
|
|
3
|
+
/** Value returned by the API, including complete ranges and empty selections. */
|
|
3
4
|
export type DatePickerValue = Date | [
|
|
4
5
|
Date,
|
|
5
6
|
Date
|
|
6
7
|
] | null;
|
|
8
|
+
/** The value as the selection mode shapes it: a range is a pair, a single date a date; an unknown mode, either. */
|
|
7
9
|
export type DatePickerValueOf<M> = M extends "range" ? [
|
|
8
10
|
Date,
|
|
9
11
|
Date
|
|
10
12
|
] | null : M extends "single" ? Date | null : DatePickerValue;
|
|
13
|
+
/** What setValue and `value` take: a date, a range as a pair, or as { start, end }. */
|
|
11
14
|
export type DatePickerInput = Date | string | [
|
|
12
15
|
Date | string,
|
|
13
16
|
Date | string
|
|
@@ -15,21 +18,27 @@ export type DatePickerInput = Date | string | [
|
|
|
15
18
|
start: Date | string;
|
|
16
19
|
end: Date | string;
|
|
17
20
|
};
|
|
21
|
+
/** One shape whatever committed the value: a range's `value` is the pair, and `rangeEndDate` its end, kept for compatibility (null otherwise). */
|
|
18
22
|
export interface DatePickerChangePayload<V = DatePickerValue> {
|
|
19
23
|
value: V;
|
|
20
24
|
rangeEndDate: Date | null;
|
|
21
25
|
formattedValue: string;
|
|
26
|
+
/** The value as ISO 8601 text, the `value` of the `<m-datepicker>` element's */
|
|
22
27
|
iso: string;
|
|
23
28
|
}
|
|
29
|
+
/** Visibility events carry the committed value, including complete ranges. */
|
|
24
30
|
export interface DatePickerVisibilityPayload<V = DatePickerValue> {
|
|
25
31
|
value: V;
|
|
26
32
|
}
|
|
33
|
+
/** Normalized touch-end event emitted by the interactive root. */
|
|
27
34
|
export type DatePickerTapPayload = NormalizedEvent;
|
|
35
|
+
/** Horizontal swipe emitted by the interactive root. */
|
|
28
36
|
export interface DatePickerSwipePayload {
|
|
29
37
|
direction: "left" | "right";
|
|
30
38
|
deltaX: number;
|
|
31
39
|
deltaY: number;
|
|
32
40
|
}
|
|
41
|
+
/** Events emitted by the picker API, calendar selections and interactive root. */
|
|
33
42
|
export interface DatePickerEvents<V = DatePickerValue> {
|
|
34
43
|
change: (payload: DatePickerChangePayload<V>) => void;
|
|
35
44
|
open: (payload: DatePickerVisibilityPayload<V>) => void;
|
|
@@ -39,38 +48,95 @@ export interface DatePickerEvents<V = DatePickerValue> {
|
|
|
39
48
|
tap: (payload: DatePickerTapPayload) => void;
|
|
40
49
|
swipe: (payload: DatePickerSwipePayload) => void;
|
|
41
50
|
}
|
|
51
|
+
/** DatePicker variant types */
|
|
42
52
|
export type DatePickerVariant = 'docked' | 'modal' | 'modal-input' | 'fullscreen';
|
|
53
|
+
/** DatePicker view types */
|
|
43
54
|
export type DatePickerView = 'day' | 'month' | 'year';
|
|
55
|
+
/** DatePicker selection mode types */
|
|
44
56
|
export type DatePickerSelectionMode = 'single' | 'range';
|
|
57
|
+
/** Day names for the calendar */
|
|
45
58
|
export declare const DAY_NAMES: string[];
|
|
59
|
+
/** Month names for the calendar */
|
|
46
60
|
export declare const MONTH_NAMES: string[];
|
|
61
|
+
/** Month names abbreviated */
|
|
47
62
|
export declare const MONTH_NAMES_SHORT: string[];
|
|
63
|
+
/** CSS class name for today's date */
|
|
48
64
|
export declare const TODAY_CLASS = "datepicker__day--today";
|
|
65
|
+
/** CSS class name for selected date */
|
|
49
66
|
export declare const SELECTED_CLASS = "datepicker__day--selected";
|
|
67
|
+
/** CSS class name for dates outside the current month */
|
|
50
68
|
export declare const OUTSIDE_MONTH_CLASS = "datepicker__day--outside";
|
|
69
|
+
/** CSS class for the first date in a range */
|
|
51
70
|
export declare const RANGE_START_CLASS = "datepicker__cell--range-start";
|
|
71
|
+
/** CSS class for the last date in a range */
|
|
52
72
|
export declare const RANGE_END_CLASS = "datepicker__cell--range-end";
|
|
73
|
+
/** CSS class for dates between start and end in a range */
|
|
53
74
|
export declare const RANGE_MIDDLE_CLASS = "datepicker__cell--range";
|
|
75
|
+
/** Configuration interface for the DatePicker component */
|
|
54
76
|
export interface DatePickerConfig {
|
|
77
|
+
/** Name of the committed form input. */
|
|
55
78
|
name?: string;
|
|
79
|
+
/**
|
|
80
|
+
* DatePicker variant that determines display style
|
|
81
|
+
* @default 'docked'
|
|
82
|
+
*/
|
|
56
83
|
variant?: DatePickerVariant | string;
|
|
84
|
+
/**
|
|
85
|
+
* Whether the datepicker is initially disabled
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
57
88
|
disabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Initial view to display (day, month, year)
|
|
91
|
+
* @default 'day'
|
|
92
|
+
*/
|
|
58
93
|
initialView?: DatePickerView | string;
|
|
94
|
+
/**
|
|
95
|
+
* Selection mode for the datepicker (single or range)
|
|
96
|
+
* @default 'single'
|
|
97
|
+
*/
|
|
59
98
|
selectionMode?: DatePickerSelectionMode | string;
|
|
99
|
+
/** Initial selected date(s) */
|
|
60
100
|
value?: DatePickerInput;
|
|
101
|
+
/** The value shows and cannot change: no typing, no calendar. */
|
|
61
102
|
readOnly?: boolean;
|
|
103
|
+
/** A date is required: on the input for forms, and checkValidity(). */
|
|
62
104
|
required?: boolean;
|
|
105
|
+
/** The supporting text under the field. */
|
|
63
106
|
supportingText?: string;
|
|
107
|
+
/** Minimum selectable date */
|
|
64
108
|
minDate?: Date | string;
|
|
109
|
+
/** Maximum selectable date */
|
|
65
110
|
maxDate?: Date | string;
|
|
111
|
+
/**
|
|
112
|
+
* Format for displaying dates
|
|
113
|
+
* @default 'MM/DD/YYYY'
|
|
114
|
+
*/
|
|
66
115
|
dateFormat?: string;
|
|
116
|
+
/** Label text for the datepicker */
|
|
67
117
|
label?: string;
|
|
118
|
+
/** Placeholder text for the input field */
|
|
68
119
|
placeholder?: string;
|
|
120
|
+
/** Additional CSS classes to add to the datepicker */
|
|
69
121
|
class?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Component prefix for class names
|
|
124
|
+
* @default 'mtrl'
|
|
125
|
+
*/
|
|
70
126
|
prefix?: string;
|
|
127
|
+
/** Component name used in class generation */
|
|
71
128
|
componentName?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Whether to enable animation effects
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
72
133
|
animate?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Whether pointer or Space selection also closes the picker.
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
73
138
|
closeOnSelect?: boolean;
|
|
139
|
+
/** Array of dates to highlight or disable */
|
|
74
140
|
specialDates?: Array<{
|
|
75
141
|
date: Date | string;
|
|
76
142
|
highlight?: boolean;
|
|
@@ -78,62 +144,134 @@ export interface DatePickerConfig {
|
|
|
78
144
|
tooltip?: string;
|
|
79
145
|
}>;
|
|
80
146
|
}
|
|
147
|
+
/** Date object with additional properties for rendering */
|
|
81
148
|
export interface CalendarDate {
|
|
149
|
+
/** JavaScript Date object */
|
|
82
150
|
date: Date;
|
|
151
|
+
/** Day of the month (1-31) */
|
|
83
152
|
day: number;
|
|
153
|
+
/** Whether the date is in the current month being displayed */
|
|
84
154
|
isCurrentMonth: boolean;
|
|
155
|
+
/** Whether the date is today */
|
|
85
156
|
isToday: boolean;
|
|
157
|
+
/** Whether the date is selected */
|
|
86
158
|
isSelected: boolean;
|
|
159
|
+
/** Whether the date is disabled */
|
|
87
160
|
isDisabled: boolean;
|
|
161
|
+
/** Whether the date is the first date in a range */
|
|
88
162
|
isRangeStart?: boolean;
|
|
163
|
+
/** Whether the date is the last date in a range */
|
|
89
164
|
isRangeEnd?: boolean;
|
|
165
|
+
/** Whether the date is between start and end in a range */
|
|
90
166
|
isRangeMiddle?: boolean;
|
|
91
167
|
}
|
|
168
|
+
/** Calendar API interface for managing calendar navigation */
|
|
92
169
|
export interface CalendarAPI {
|
|
170
|
+
/** Updates the calendar view to display a specific month/year */
|
|
93
171
|
goToDate: (date: Date) => void;
|
|
172
|
+
/** Moves to the next month */
|
|
94
173
|
nextMonth: () => void;
|
|
174
|
+
/** Moves to the previous month */
|
|
95
175
|
prevMonth: () => void;
|
|
176
|
+
/** Moves to the next year */
|
|
96
177
|
nextYear: () => void;
|
|
178
|
+
/** Moves to the previous year */
|
|
97
179
|
prevYear: () => void;
|
|
180
|
+
/** Switches to day selection view */
|
|
98
181
|
showDayView: () => void;
|
|
182
|
+
/** Switches to month selection view */
|
|
99
183
|
showMonthView: () => void;
|
|
184
|
+
/** Switches to year selection view */
|
|
100
185
|
showYearView: () => void;
|
|
186
|
+
/** Gets the current calendar view */
|
|
101
187
|
getCurrentView: () => string;
|
|
102
188
|
}
|
|
189
|
+
/** DatePicker component interface */
|
|
103
190
|
export interface DatePickerComponent<V = DatePickerValue> {
|
|
191
|
+
/** The datepicker's main DOM element */
|
|
104
192
|
element: HTMLElement;
|
|
193
|
+
/** The input field DOM element */
|
|
105
194
|
input: HTMLInputElement;
|
|
195
|
+
/** API for managing calendar and selected dates */
|
|
106
196
|
calendar: CalendarAPI;
|
|
197
|
+
/** API for managing disabled state */
|
|
107
198
|
disabled: {
|
|
199
|
+
/** Enables the datepicker */
|
|
108
200
|
enable: () => void;
|
|
201
|
+
/** Disables the datepicker */
|
|
109
202
|
disable: () => void;
|
|
203
|
+
/** Checks if the datepicker is disabled */
|
|
110
204
|
isDisabled: () => boolean;
|
|
111
205
|
};
|
|
206
|
+
/** API for managing component lifecycle */
|
|
112
207
|
lifecycle: {
|
|
208
|
+
/** Destroys the component and cleans up resources */
|
|
113
209
|
destroy: () => void;
|
|
114
210
|
};
|
|
211
|
+
/**
|
|
212
|
+
* Gets a class name with the component's prefix
|
|
213
|
+
* @param name
|
|
214
|
+
*/
|
|
115
215
|
getClass: (name: string) => string;
|
|
216
|
+
/** Opens the datepicker dropdown/modal. */
|
|
116
217
|
open: () => DatePickerComponent<V>;
|
|
218
|
+
/** Closes the datepicker dropdown/modal. */
|
|
117
219
|
close: () => DatePickerComponent<V>;
|
|
220
|
+
/** Whether the dropdown or modal is open */
|
|
118
221
|
isOpen: () => boolean;
|
|
222
|
+
/** Gets the selected date(s) */
|
|
119
223
|
getValue: () => V;
|
|
224
|
+
/**
|
|
225
|
+
* Sets the selected date(s).
|
|
226
|
+
* @param value
|
|
227
|
+
*/
|
|
120
228
|
setValue: (value: DatePickerInput) => DatePickerComponent<V>;
|
|
229
|
+
/** Read-only: the value shows and cannot change */
|
|
121
230
|
setReadOnly: (readOnly: boolean) => DatePickerComponent<V>;
|
|
231
|
+
/** Whether the picker is read-only */
|
|
122
232
|
isReadOnly: () => boolean;
|
|
233
|
+
/** Whether a date is required */
|
|
123
234
|
setRequired: (required: boolean) => DatePickerComponent<V>;
|
|
235
|
+
/** False when a date is required and missing. */
|
|
124
236
|
checkValidity: () => boolean;
|
|
237
|
+
/** As checkValidity(), and shows the error on the field when false */
|
|
125
238
|
reportValidity: () => boolean;
|
|
239
|
+
/** The supporting text; empty or null shows the date format */
|
|
126
240
|
setSupportingText: (text: string | null) => DatePickerComponent<V>;
|
|
241
|
+
/** Gets the formatted date string based on the selected date(s) */
|
|
127
242
|
getFormattedValue: () => string;
|
|
243
|
+
/** Clears the selected date(s). */
|
|
128
244
|
clear: () => DatePickerComponent<V>;
|
|
245
|
+
/** Enables the datepicker */
|
|
129
246
|
enable: () => DatePickerComponent<V>;
|
|
247
|
+
/** Disables the datepicker */
|
|
130
248
|
disable: () => DatePickerComponent<V>;
|
|
249
|
+
/**
|
|
250
|
+
* Sets the minimum selectable date
|
|
251
|
+
* @param date
|
|
252
|
+
*/
|
|
131
253
|
setMinDate: (date: Date | string) => DatePickerComponent<V>;
|
|
254
|
+
/**
|
|
255
|
+
* Sets the maximum selectable date
|
|
256
|
+
* @param date
|
|
257
|
+
*/
|
|
132
258
|
setMaxDate: (date: Date | string) => DatePickerComponent<V>;
|
|
259
|
+
/** Destroys the datepicker component and cleans up resources */
|
|
133
260
|
destroy: () => void;
|
|
261
|
+
/**
|
|
262
|
+
* Adds an event listener to the datepicker
|
|
263
|
+
* @param event
|
|
264
|
+
* @param handler
|
|
265
|
+
*/
|
|
134
266
|
on: <K extends keyof DatePickerEvents<V>>(event: K, handler: DatePickerEvents<V>[K]) => DatePickerComponent<V>;
|
|
267
|
+
/**
|
|
268
|
+
* Removes an event listener from the datepicker
|
|
269
|
+
* @param event
|
|
270
|
+
* @param handler
|
|
271
|
+
*/
|
|
135
272
|
off: <K extends keyof DatePickerEvents<V>>(event: K, handler: DatePickerEvents<V>[K]) => DatePickerComponent<V>;
|
|
136
273
|
}
|
|
274
|
+
/** Internal calendar view model. */
|
|
137
275
|
export interface DatePickerState {
|
|
138
276
|
selectedDate: Date | null;
|
|
139
277
|
rangeEndDate: Date | null;
|
|
@@ -152,6 +290,7 @@ export interface DatePickerState {
|
|
|
152
290
|
label: string;
|
|
153
291
|
specialDates: NonNullable<DatePickerConfig["specialDates"]>;
|
|
154
292
|
isAllowed(date: Date): boolean;
|
|
293
|
+
/** Full screen: the first month of the rendered list, and how many follow. */
|
|
155
294
|
listStart?: Date;
|
|
156
295
|
listLength?: number;
|
|
157
296
|
}
|