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,34 +1,62 @@
|
|
|
1
|
+
/** Search component state */
|
|
1
2
|
export type SearchState = "bar" | "view";
|
|
3
|
+
/** Search view display mode */
|
|
2
4
|
export type SearchViewMode = "docked" | "fullscreen";
|
|
5
|
+
/** Search variant, M3's style - 'contained': M3 Expressive. */
|
|
3
6
|
export type SearchVariant = "contained" | "divided";
|
|
7
|
+
/** Valid event types for search component per MD3 spec: the names in {@link SearchEvents} */
|
|
4
8
|
export type SearchEventType = keyof SearchEvents;
|
|
9
|
+
/** Trailing content item configuration */
|
|
5
10
|
export interface SearchTrailingItem {
|
|
11
|
+
/** Unique identifier for the item */
|
|
6
12
|
id: string;
|
|
13
|
+
/** HTML content (icon SVG or avatar image). */
|
|
7
14
|
content: string;
|
|
15
|
+
/** Type of trailing content */
|
|
8
16
|
type: "icon" | "avatar";
|
|
17
|
+
/** Accessible label for the item */
|
|
9
18
|
ariaLabel?: string;
|
|
19
|
+
/** Click handler */
|
|
10
20
|
onClick?: (event: MouseEvent) => void;
|
|
11
21
|
}
|
|
22
|
+
/** Search suggestion item */
|
|
12
23
|
export interface SearchSuggestion {
|
|
24
|
+
/** Display text */
|
|
13
25
|
text: string;
|
|
26
|
+
/** Value to use when selected (defaults to text) */
|
|
14
27
|
value?: string;
|
|
28
|
+
/** Optional leading icon HTML. */
|
|
15
29
|
icon?: string;
|
|
30
|
+
/** A second line under the text: a two-line list item */
|
|
16
31
|
supportingText?: string;
|
|
32
|
+
/** Optional group identifier for dividers */
|
|
17
33
|
group?: string;
|
|
18
34
|
}
|
|
35
|
+
/** Search event data */
|
|
19
36
|
export interface SearchEvent {
|
|
37
|
+
/** The search component instance */
|
|
20
38
|
component: SearchComponent;
|
|
39
|
+
/** Current search value */
|
|
21
40
|
value: string;
|
|
41
|
+
/** Original DOM event if available */
|
|
22
42
|
originalEvent: Event | null;
|
|
43
|
+
/** Selected suggestion (for suggestionSelect event) */
|
|
23
44
|
suggestion?: SearchSuggestion;
|
|
45
|
+
/** Prevents default behavior */
|
|
24
46
|
preventDefault: () => void;
|
|
47
|
+
/** Whether default was prevented */
|
|
25
48
|
defaultPrevented: boolean;
|
|
26
49
|
}
|
|
50
|
+
/** What `expand` and `collapse` carry: the search after the change. */
|
|
27
51
|
export interface SearchStateEvent {
|
|
52
|
+
/** The search component instance */
|
|
28
53
|
component: SearchComponent;
|
|
54
|
+
/** The state after the change: `view` on expand, `bar` on collapse */
|
|
29
55
|
state: SearchState;
|
|
56
|
+
/** The view mode the search has */
|
|
30
57
|
viewMode: SearchViewMode;
|
|
31
58
|
}
|
|
59
|
+
/** The search's events and what each hands its listener. */
|
|
32
60
|
export interface SearchEvents {
|
|
33
61
|
focus: (event: SearchEvent) => void;
|
|
34
62
|
blur: (event: SearchEvent) => void;
|
|
@@ -39,88 +67,169 @@ export interface SearchEvents {
|
|
|
39
67
|
expand: (event: SearchStateEvent) => void;
|
|
40
68
|
collapse: (event: SearchStateEvent) => void;
|
|
41
69
|
}
|
|
70
|
+
/** Configuration options for the Search component */
|
|
42
71
|
export interface SearchConfig {
|
|
72
|
+
/** Initial state: 'bar' (collapsed) or 'view' (expanded). */
|
|
43
73
|
initialState?: SearchState;
|
|
74
|
+
/** View mode when expanded: 'docked' or 'fullscreen'. */
|
|
44
75
|
viewMode?: SearchViewMode;
|
|
76
|
+
/** 'contained' (M3 Expressive) or 'divided' (baseline). */
|
|
45
77
|
variant?: SearchVariant;
|
|
78
|
+
/** Whether the search component is disabled */
|
|
46
79
|
disabled?: boolean;
|
|
80
|
+
/** Placeholder/supporting text. */
|
|
47
81
|
placeholder?: string;
|
|
82
|
+
/** Accessible name for the search input; the current placeholder is the fallback. */
|
|
48
83
|
ariaLabel?: string;
|
|
84
|
+
/** Initial input value */
|
|
49
85
|
value?: string;
|
|
86
|
+
/** Form field name. */
|
|
50
87
|
name?: string;
|
|
88
|
+
/** Custom leading icon HTML (replaces default search icon). */
|
|
51
89
|
leadingIcon?: string;
|
|
90
|
+
/** Trailing content items (icons, avatar) */
|
|
52
91
|
trailingItems?: SearchTrailingItem[];
|
|
92
|
+
/** Suggestions to display in view mode */
|
|
53
93
|
suggestions?: SearchSuggestion[] | string[];
|
|
94
|
+
/** Show clear button when input has value. */
|
|
54
95
|
showClearButton?: boolean;
|
|
96
|
+
/** Auto-expand to view on focus. */
|
|
55
97
|
expandOnFocus?: boolean;
|
|
98
|
+
/** Auto-collapse on blur (with delay). */
|
|
56
99
|
collapseOnBlur?: boolean;
|
|
100
|
+
/** Collapse delay in ms when collapseOnBlur is true. */
|
|
57
101
|
collapseDelay?: number;
|
|
102
|
+
/** Minimum width in pixels. */
|
|
58
103
|
minWidth?: number;
|
|
104
|
+
/** Maximum width in pixels. */
|
|
59
105
|
maxWidth?: number;
|
|
106
|
+
/** Full width mode (ignores min/max width) */
|
|
60
107
|
fullWidth?: boolean;
|
|
108
|
+
/** Additional CSS classes */
|
|
61
109
|
class?: string;
|
|
110
|
+
/** Component prefix for class names */
|
|
62
111
|
prefix?: string;
|
|
112
|
+
/** `submit` listener registered at creation. */
|
|
63
113
|
onSubmit?: SearchEvents["submit"];
|
|
114
|
+
/** `input` listener registered at creation. */
|
|
64
115
|
onInput?: SearchEvents["input"];
|
|
116
|
+
/** `clear` listener registered at creation. */
|
|
65
117
|
onClear?: SearchEvents["clear"];
|
|
118
|
+
/** `expand` listener registered at creation. */
|
|
66
119
|
onExpand?: SearchEvents["expand"];
|
|
120
|
+
/** `collapse` listener registered at creation. */
|
|
67
121
|
onCollapse?: SearchEvents["collapse"];
|
|
122
|
+
/** `suggestionSelect` listener registered at creation. */
|
|
68
123
|
onSuggestionSelect?: SearchEvents["suggestionSelect"];
|
|
124
|
+
/** Event handlers map */
|
|
69
125
|
on?: Partial<SearchEvents>;
|
|
70
126
|
}
|
|
127
|
+
/** Search component public API interface */
|
|
71
128
|
export interface SearchComponent {
|
|
129
|
+
/** The root element of the search component */
|
|
72
130
|
element: HTMLElement;
|
|
131
|
+
/** Sets the search input value. */
|
|
73
132
|
setValue: (value: string, triggerEvent?: boolean) => SearchComponent;
|
|
133
|
+
/** Gets the current search input value */
|
|
74
134
|
getValue: () => string;
|
|
135
|
+
/** Sets the placeholder/supporting text */
|
|
75
136
|
setPlaceholder: (text: string) => SearchComponent;
|
|
137
|
+
/** Gets the current placeholder text */
|
|
76
138
|
getPlaceholder: () => string;
|
|
139
|
+
/** Expands to search view */
|
|
77
140
|
expand: () => SearchComponent;
|
|
141
|
+
/** Collapses to search bar */
|
|
78
142
|
collapse: () => SearchComponent;
|
|
143
|
+
/** Gets the current state ('bar' or 'view') */
|
|
79
144
|
getState: () => SearchState;
|
|
145
|
+
/** Checks if currently expanded */
|
|
80
146
|
isExpanded: () => boolean;
|
|
147
|
+
/** Sets the view mode ('docked' or 'fullscreen') */
|
|
81
148
|
setViewMode: (mode: SearchViewMode) => SearchComponent;
|
|
149
|
+
/** Gets the current view mode */
|
|
82
150
|
getViewMode: () => SearchViewMode;
|
|
151
|
+
/** Sets the variant ('contained' or 'divided') */
|
|
83
152
|
setVariant: (variant: SearchVariant) => SearchComponent;
|
|
153
|
+
/** Gets the current variant */
|
|
84
154
|
getVariant: () => SearchVariant;
|
|
155
|
+
/** Focuses the search input */
|
|
85
156
|
focus: () => SearchComponent;
|
|
157
|
+
/** Blurs the search input */
|
|
86
158
|
blur: () => SearchComponent;
|
|
159
|
+
/** Clears the search input. */
|
|
87
160
|
clear: () => SearchComponent;
|
|
161
|
+
/** Submits the current search value */
|
|
88
162
|
submit: () => SearchComponent;
|
|
163
|
+
/** Sets the leading icon HTML */
|
|
89
164
|
setLeadingIcon: (iconHtml: string) => SearchComponent;
|
|
165
|
+
/** Adds a trailing item */
|
|
90
166
|
addTrailingItem: (item: SearchTrailingItem) => SearchComponent;
|
|
167
|
+
/** Removes a trailing item by id */
|
|
91
168
|
removeTrailingItem: (id: string) => SearchComponent;
|
|
169
|
+
/** Sets all trailing items */
|
|
92
170
|
setTrailingItems: (items: SearchTrailingItem[]) => SearchComponent;
|
|
171
|
+
/** Sets the suggestions list */
|
|
93
172
|
setSuggestions: (suggestions: SearchSuggestion[] | string[]) => SearchComponent;
|
|
173
|
+
/** Gets the current suggestions */
|
|
94
174
|
getSuggestions: () => SearchSuggestion[];
|
|
175
|
+
/** Clears all suggestions */
|
|
95
176
|
clearSuggestions: () => SearchComponent;
|
|
177
|
+
/** Enables the search component */
|
|
96
178
|
enable: () => SearchComponent;
|
|
179
|
+
/** Disables the search component */
|
|
97
180
|
disable: () => SearchComponent;
|
|
181
|
+
/** Checks if the component is disabled */
|
|
98
182
|
isDisabled: () => boolean;
|
|
183
|
+
/** Adds an event listener */
|
|
99
184
|
on: <K extends keyof SearchEvents>(event: K, handler: SearchEvents[K]) => SearchComponent;
|
|
185
|
+
/** Removes an event listener */
|
|
100
186
|
off: <K extends keyof SearchEvents>(event: K, handler: SearchEvents[K]) => SearchComponent;
|
|
187
|
+
/** Destroys the component and cleans up resources */
|
|
101
188
|
destroy: () => void;
|
|
102
189
|
}
|
|
190
|
+
/** Internal component structure references */
|
|
103
191
|
export interface SearchStructure {
|
|
192
|
+
/** The bar and, when expanded, its results: what shows in the top layer while */
|
|
104
193
|
surface: HTMLElement;
|
|
194
|
+
/** Main container element */
|
|
105
195
|
container: HTMLElement;
|
|
196
|
+
/** Input element */
|
|
106
197
|
input: HTMLInputElement;
|
|
198
|
+
/** Input wrapper element */
|
|
107
199
|
inputWrapper: HTMLElement;
|
|
200
|
+
/** Leading icon container */
|
|
108
201
|
leadingIcon: HTMLElement;
|
|
202
|
+
/** Clear button element */
|
|
109
203
|
clearButton: HTMLElement | null;
|
|
204
|
+
/** Trailing items container */
|
|
110
205
|
trailingContainer: HTMLElement | null;
|
|
206
|
+
/** Header divider (view mode) */
|
|
111
207
|
divider: HTMLElement | null;
|
|
208
|
+
/** Suggestions container (view mode) */
|
|
112
209
|
suggestionsContainer: HTMLElement | null;
|
|
210
|
+
/** Suggestions list element */
|
|
113
211
|
suggestionsList: HTMLElement | null;
|
|
212
|
+
/** The live region that announces the suggestion count */
|
|
114
213
|
status: HTMLElement;
|
|
115
214
|
}
|
|
215
|
+
/** Internal search state */
|
|
116
216
|
export interface SearchInternalState {
|
|
217
|
+
/** Current component state */
|
|
117
218
|
state: SearchState;
|
|
219
|
+
/** Current view mode */
|
|
118
220
|
viewMode: SearchViewMode;
|
|
221
|
+
/** Current input value */
|
|
119
222
|
value: string;
|
|
223
|
+
/** Current placeholder */
|
|
120
224
|
placeholder: string;
|
|
225
|
+
/** Whether input is focused */
|
|
121
226
|
isFocused: boolean;
|
|
227
|
+
/** Whether component is disabled */
|
|
122
228
|
isDisabled: boolean;
|
|
229
|
+
/** Current suggestions */
|
|
123
230
|
suggestions: SearchSuggestion[];
|
|
231
|
+
/** Currently highlighted suggestion index (-1 = none) */
|
|
124
232
|
highlightedIndex: number;
|
|
233
|
+
/** Trailing items */
|
|
125
234
|
trailingItems: SearchTrailingItem[];
|
|
126
235
|
}
|
|
@@ -1,53 +1,99 @@
|
|
|
1
|
+
/** Select variants */
|
|
1
2
|
export declare const SELECT_VARIANTS: {
|
|
3
|
+
/** Filled select field with solid background */
|
|
2
4
|
readonly FILLED: "filled";
|
|
5
|
+
/** Outlined select field with border */
|
|
3
6
|
readonly OUTLINED: "outlined";
|
|
4
7
|
};
|
|
8
|
+
/** Select menu placement options */
|
|
5
9
|
export declare const SELECT_PLACEMENT: {
|
|
10
|
+
/** Menu appears below the select field, aligned to the left edge */
|
|
6
11
|
readonly BOTTOM_START: "bottom-start";
|
|
12
|
+
/** Menu appears below the select field, centered */
|
|
7
13
|
readonly BOTTOM: "bottom";
|
|
14
|
+
/** Menu appears below the select field, aligned to the right edge */
|
|
8
15
|
readonly BOTTOM_END: "bottom-end";
|
|
16
|
+
/** Menu appears above the select field, aligned to the left edge */
|
|
9
17
|
readonly TOP_START: "top-start";
|
|
18
|
+
/** Menu appears above the select field, centered */
|
|
10
19
|
readonly TOP: "top";
|
|
20
|
+
/** Menu appears above the select field, aligned to the right edge */
|
|
11
21
|
readonly TOP_END: "top-end";
|
|
12
22
|
};
|
|
23
|
+
/** Select interaction types */
|
|
13
24
|
export declare const SELECT_INTERACTION: {
|
|
25
|
+
/** Interaction via mouse or touch */
|
|
14
26
|
readonly MOUSE: "mouse";
|
|
27
|
+
/** Interaction via keyboard */
|
|
15
28
|
readonly KEYBOARD: "keyboard";
|
|
16
29
|
};
|
|
30
|
+
/** Select event names */
|
|
17
31
|
export declare const SELECT_EVENTS: {
|
|
32
|
+
/** Fired when selected option changes */
|
|
18
33
|
readonly CHANGE: "change";
|
|
34
|
+
/** Fired when options menu opens */
|
|
19
35
|
readonly OPEN: "open";
|
|
36
|
+
/** Fired when options menu closes */
|
|
20
37
|
readonly CLOSE: "close";
|
|
21
38
|
};
|
|
39
|
+
/** Default icons for select */
|
|
22
40
|
export declare const SELECT_ICONS: {
|
|
41
|
+
/** Dropdown arrow icon */
|
|
23
42
|
readonly DROPDOWN: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 10l5 5 5-5z\"/></svg>";
|
|
43
|
+
/** Checkmark icon for selected item */
|
|
24
44
|
readonly CHECKMARK: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\"/></svg>";
|
|
25
45
|
};
|
|
46
|
+
/** Default configuration values */
|
|
26
47
|
export declare const SELECT_DEFAULTS: {
|
|
48
|
+
/** Default variant */
|
|
27
49
|
readonly VARIANT: "filled";
|
|
50
|
+
/** Default menu placement */
|
|
28
51
|
readonly PLACEMENT: "bottom-start";
|
|
52
|
+
/** Default label */
|
|
29
53
|
readonly LABEL: "Select";
|
|
54
|
+
/** Default value */
|
|
30
55
|
readonly VALUE: "";
|
|
56
|
+
/** Whether the select is required by default */
|
|
31
57
|
readonly REQUIRED: false;
|
|
58
|
+
/** Whether the select is disabled by default */
|
|
32
59
|
readonly DISABLED: false;
|
|
60
|
+
/** Default supporting text */
|
|
33
61
|
readonly SUPPORTING_TEXT: "";
|
|
62
|
+
/** Whether in error state by default */
|
|
34
63
|
readonly ERROR: false;
|
|
35
64
|
};
|
|
65
|
+
/** CSS classes for select elements */
|
|
36
66
|
export declare const SELECT_CLASSES: {
|
|
67
|
+
/** Container element */
|
|
37
68
|
readonly CONTAINER: "select";
|
|
69
|
+
/** The text field (the key is two words; the value is select__text-field) */
|
|
38
70
|
readonly TEXT_FIELD: "select__text-field";
|
|
71
|
+
/** Dropdown icon */
|
|
39
72
|
readonly DROPDOWN_ICON: "select__dropdown-icon";
|
|
73
|
+
/** Menu container */
|
|
40
74
|
readonly MENU: "select__menu";
|
|
75
|
+
/** Menu item */
|
|
41
76
|
readonly MENU_ITEM: "select__menu-item";
|
|
77
|
+
/** Selected menu item */
|
|
42
78
|
readonly MENU_ITEM_SELECTED: "select__menu-item--selected";
|
|
79
|
+
/** Disabled menu item */
|
|
43
80
|
readonly MENU_ITEM_DISABLED: "select__menu-item--disabled";
|
|
81
|
+
/** Menu item checkmark */
|
|
44
82
|
readonly MENU_ITEM_CHECKMARK: "select__menu-item-checkmark";
|
|
83
|
+
/** Menu item icon */
|
|
45
84
|
readonly MENU_ITEM_ICON: "select__menu-item-icon";
|
|
85
|
+
/** Menu item text */
|
|
46
86
|
readonly MENU_ITEM_TEXT: "select__menu-item-text";
|
|
87
|
+
/** Filled variant */
|
|
47
88
|
readonly FILLED: "select--filled";
|
|
89
|
+
/** Outlined variant */
|
|
48
90
|
readonly OUTLINED: "select--outlined";
|
|
91
|
+
/** Open state */
|
|
49
92
|
readonly OPEN: "select--open";
|
|
93
|
+
/** Disabled state */
|
|
50
94
|
readonly DISABLED: "select--disabled";
|
|
95
|
+
/** Required state */
|
|
51
96
|
readonly REQUIRED: "select--required";
|
|
97
|
+
/** Error state */
|
|
52
98
|
readonly ERROR: "select--error";
|
|
53
99
|
};
|
|
@@ -88,12 +88,14 @@ const setupCombobox = (component, textField, menu, state, choose, prefix) => {
|
|
|
88
88
|
const input = textField.input;
|
|
89
89
|
const field = textField.element;
|
|
90
90
|
const activeClass = `${prefix}-menu__item--active`;
|
|
91
|
+
const keyboardClass = `${prefix}-menu__item--keyboard-active`;
|
|
91
92
|
const TYPEAHEAD_DELAY = 500;
|
|
92
93
|
const PAGE = 10;
|
|
93
94
|
input.setAttribute("role", "combobox");
|
|
94
95
|
input.setAttribute("aria-haspopup", "listbox");
|
|
95
96
|
input.setAttribute("aria-expanded", "false");
|
|
96
97
|
let active = null;
|
|
98
|
+
let keyboard = false;
|
|
97
99
|
let pending = "selected";
|
|
98
100
|
let buffer = "";
|
|
99
101
|
let bufferTimer = null;
|
|
@@ -105,7 +107,10 @@ const optionFor = (element) => element
|
|
|
105
107
|
: undefined;
|
|
106
108
|
const setActive = (element) => {
|
|
107
109
|
active = element;
|
|
108
|
-
options().forEach((option) =>
|
|
110
|
+
options().forEach((option) => {
|
|
111
|
+
option.classList.toggle(activeClass, option === element);
|
|
112
|
+
option.classList.toggle(keyboardClass, option === element && keyboard);
|
|
113
|
+
});
|
|
109
114
|
if (element) {
|
|
110
115
|
input.setAttribute("aria-activedescendant", element.id);
|
|
111
116
|
element.scrollIntoView?.({ block: "nearest" });
|
|
@@ -197,6 +202,7 @@ queued = "";
|
|
|
197
202
|
input.addEventListener("keydown", (e) => {
|
|
198
203
|
if (input.disabled)
|
|
199
204
|
return;
|
|
205
|
+
keyboard = true;
|
|
200
206
|
const isOpen = menu.isOpen();
|
|
201
207
|
const list = enabled();
|
|
202
208
|
const index = active ? list.indexOf(active) : -1;
|
|
@@ -297,12 +303,14 @@ typeahead(e.key);
|
|
|
297
303
|
}
|
|
298
304
|
});
|
|
299
305
|
field.addEventListener("mousedown", (e) => {
|
|
306
|
+
keyboard = false;
|
|
300
307
|
if (input.disabled || menu.element.contains(e.target) || e.target === input)
|
|
301
308
|
return;
|
|
302
309
|
e.preventDefault();
|
|
303
310
|
input.focus();
|
|
304
311
|
});
|
|
305
312
|
field.addEventListener("click", (e) => {
|
|
313
|
+
keyboard = false;
|
|
306
314
|
if (input.disabled || menu.element.contains(e.target))
|
|
307
315
|
return;
|
|
308
316
|
if (menu.isOpen())
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** Select Component Module The Select component provides a dropdown select control, combining a text field and menu for a complete selection interface. */
|
|
1
2
|
export { default, default as createSelect } from "./select.js";
|
|
2
3
|
export type { SelectEvents } from "./types.js";
|
|
3
4
|
export type { SelectConfig, SelectVariant, SelectComponent, SelectOption, SelectEvent, SelectChangeEvent } from "./types.js";
|
|
5
|
+
/** Constants for select configuration */
|
|
4
6
|
export { SELECT_VARIANTS, SELECT_PLACEMENT, SELECT_INTERACTION, SELECT_EVENTS, SELECT_ICONS, SELECT_DEFAULTS, SELECT_CLASSES } from "./constants.js";
|
|
@@ -1,88 +1,181 @@
|
|
|
1
1
|
import type { MenuColor, MenuVariant } from "../menu/types.js";
|
|
2
2
|
import type { MenuOwner } from "../menu/inner.js";
|
|
3
3
|
import type { TextFieldComponent } from "../text-field/types.js";
|
|
4
|
+
/** Available Select variants */
|
|
4
5
|
export type SelectVariant = "filled" | "outlined";
|
|
6
|
+
/** Select variant constants */
|
|
5
7
|
export declare const SELECT_VARIANTS: {
|
|
6
8
|
readonly FILLED: "filled";
|
|
7
9
|
readonly OUTLINED: "outlined";
|
|
8
10
|
};
|
|
11
|
+
/** Select option interface */
|
|
9
12
|
export interface SelectOption {
|
|
13
|
+
/** Unique identifier for the option */
|
|
10
14
|
id: string;
|
|
15
|
+
/** Display text for the option */
|
|
11
16
|
text: string;
|
|
17
|
+
/** Whether the option is disabled */
|
|
12
18
|
disabled?: boolean;
|
|
19
|
+
/** Optional icon to display with the option. */
|
|
13
20
|
icon?: string;
|
|
21
|
+
/** Whether this option has a submenu */
|
|
14
22
|
hasSubmenu?: boolean;
|
|
23
|
+
/** Optional array of submenu options */
|
|
15
24
|
submenu?: SelectOption[];
|
|
25
|
+
/** Additional data associated with the option */
|
|
16
26
|
data?: unknown;
|
|
17
27
|
}
|
|
28
|
+
/** Configuration interface for the Select component */
|
|
18
29
|
export interface SelectConfig {
|
|
30
|
+
/** Array of options to display in the select menu */
|
|
19
31
|
options?: SelectOption[];
|
|
32
|
+
/** Currently selected value (option id) */
|
|
20
33
|
value?: string;
|
|
34
|
+
/** Visual variant (filled, outlined) */
|
|
21
35
|
variant?: SelectVariant | string;
|
|
36
|
+
/** Density level (default, compact) */
|
|
22
37
|
density?: "default" | "compact" | string;
|
|
38
|
+
/** Label text */
|
|
23
39
|
label?: string;
|
|
40
|
+
/** Accessible name for the focused input; the visible label is the fallback. */
|
|
24
41
|
ariaLabel?: string;
|
|
42
|
+
/** Input name attribute */
|
|
25
43
|
name?: string;
|
|
44
|
+
/** Whether select is required */
|
|
26
45
|
required?: boolean;
|
|
46
|
+
/** Options handed to the select's menu. */
|
|
27
47
|
menu?: {
|
|
48
|
+
/** Where the menu is mounted and positioned against; document.body for a menu that escapes a clipping container */
|
|
28
49
|
container?: HTMLElement | null;
|
|
50
|
+
/** The menu's max height (a CSS length); the list scrolls inside it */
|
|
29
51
|
maxHeight?: string;
|
|
52
|
+
/** Whether the menu flips above the field when there is no room below */
|
|
30
53
|
autoFlip?: boolean;
|
|
54
|
+
/** The menu's variant: 'vertical' is the M3 expressive menu, items apart in a rounded container */
|
|
31
55
|
variant?: MenuVariant;
|
|
56
|
+
/** The vertical variant's colour mapping */
|
|
32
57
|
color?: MenuColor;
|
|
33
58
|
};
|
|
59
|
+
/** `"top"` renders the menu next to the field, in the field's own tree (a shadow root included), and shows it in the browser's top layer: above every z-index and outside any clipping ancestor. */
|
|
34
60
|
layer?: "top";
|
|
61
|
+
/** Whether select is disabled */
|
|
35
62
|
disabled?: boolean;
|
|
63
|
+
/** Supporting text content */
|
|
36
64
|
supportingText?: string;
|
|
65
|
+
/** Whether supporting text indicates an error */
|
|
37
66
|
error?: boolean;
|
|
67
|
+
/** Menu placement relative to the text field */
|
|
38
68
|
placement?: string;
|
|
69
|
+
/** Additional CSS classes */
|
|
39
70
|
class?: string;
|
|
71
|
+
/** Prefix for class names */
|
|
40
72
|
prefix?: string;
|
|
73
|
+
/** Component name */
|
|
41
74
|
componentName?: string;
|
|
75
|
+
/** Event callbacks */
|
|
42
76
|
on?: {
|
|
77
|
+
/** Called when the select value changes */
|
|
43
78
|
change?: (event: SelectChangeEvent) => void;
|
|
79
|
+
/** Called when the select menu opens */
|
|
44
80
|
open?: (event: SelectEvent) => void;
|
|
81
|
+
/** Called when the select menu closes */
|
|
45
82
|
close?: (event: SelectEvent) => void;
|
|
46
83
|
};
|
|
47
84
|
}
|
|
85
|
+
/** Select component interface */
|
|
48
86
|
export interface SelectComponent {
|
|
87
|
+
/** The root element of the select */
|
|
49
88
|
element: HTMLElement;
|
|
89
|
+
/** The text field component */
|
|
50
90
|
textField: TextFieldComponent;
|
|
91
|
+
/** Gets the select's current value (selected option id) */
|
|
51
92
|
getValue: () => string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the select's value (by option id)
|
|
95
|
+
* @param value
|
|
96
|
+
*/
|
|
52
97
|
setValue: (value: string | null | undefined) => SelectComponent;
|
|
98
|
+
/** Clears the current selection */
|
|
53
99
|
clear: () => SelectComponent;
|
|
100
|
+
/** Gets the select's current displayed text */
|
|
54
101
|
getText: () => string;
|
|
102
|
+
/** Gets the selected option object */
|
|
55
103
|
getSelectedOption: () => SelectOption | null;
|
|
104
|
+
/** Gets all available options */
|
|
56
105
|
getOptions: () => SelectOption[];
|
|
106
|
+
/**
|
|
107
|
+
* Sets new options
|
|
108
|
+
* @param options
|
|
109
|
+
*/
|
|
57
110
|
setOptions: (options: SelectOption[]) => SelectComponent;
|
|
111
|
+
/**
|
|
112
|
+
* Opens the select menu.
|
|
113
|
+
* @param interactionType
|
|
114
|
+
*/
|
|
58
115
|
open: (interactionType?: "mouse" | "keyboard") => SelectComponent;
|
|
116
|
+
/** Closes the select menu. */
|
|
59
117
|
close: () => SelectComponent;
|
|
118
|
+
/** Checks if the menu is open */
|
|
60
119
|
isOpen: () => boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Sets the density of the select
|
|
122
|
+
* @param density
|
|
123
|
+
*/
|
|
61
124
|
setDensity: (density: "default" | "compact" | string) => SelectComponent;
|
|
125
|
+
/** Gets the current density setting */
|
|
62
126
|
getDensity: () => string;
|
|
127
|
+
/**
|
|
128
|
+
* Adds an event listener
|
|
129
|
+
* @param event
|
|
130
|
+
* @param handler
|
|
131
|
+
*/
|
|
63
132
|
on: <T extends keyof SelectEvents>(event: T, handler: SelectEvents[T]) => SelectComponent;
|
|
133
|
+
/**
|
|
134
|
+
* Removes an event listener
|
|
135
|
+
* @param event
|
|
136
|
+
* @param handler
|
|
137
|
+
*/
|
|
64
138
|
off: <T extends keyof SelectEvents>(event: T, handler: SelectEvents[T]) => SelectComponent;
|
|
139
|
+
/** Enables the select */
|
|
65
140
|
enable: () => SelectComponent;
|
|
141
|
+
/** Disables the select */
|
|
66
142
|
disable: () => SelectComponent;
|
|
143
|
+
/** Whether the select is disabled */
|
|
67
144
|
isDisabled: () => boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Sets the error state on the select
|
|
147
|
+
* @param error
|
|
148
|
+
* @param message
|
|
149
|
+
*/
|
|
68
150
|
setError: (error: boolean, message?: string) => SelectComponent;
|
|
151
|
+
/** Clears the error state on the select */
|
|
69
152
|
clearError: () => SelectComponent;
|
|
153
|
+
/** Destroys the select component */
|
|
70
154
|
destroy: () => void;
|
|
71
155
|
}
|
|
156
|
+
/** What `open` and `close` carry. */
|
|
72
157
|
export interface SelectEvent {
|
|
158
|
+
/** The select component */
|
|
73
159
|
select: SelectComponent;
|
|
160
|
+
/** Original DOM event if available */
|
|
74
161
|
originalEvent?: Event;
|
|
75
162
|
}
|
|
163
|
+
/** Select change event interface */
|
|
76
164
|
export interface SelectChangeEvent extends SelectEvent {
|
|
165
|
+
/** The selected option id */
|
|
77
166
|
value: string | null;
|
|
167
|
+
/** The selected option text */
|
|
78
168
|
text: string;
|
|
169
|
+
/** The complete selected option object */
|
|
79
170
|
option: SelectOption;
|
|
80
171
|
}
|
|
172
|
+
/** Select events interface for type-checking */
|
|
81
173
|
export interface SelectEvents {
|
|
82
174
|
change: (event: SelectChangeEvent) => void;
|
|
83
175
|
open: (event: SelectEvent) => void;
|
|
84
176
|
close: (event: SelectEvent) => void;
|
|
85
177
|
}
|
|
178
|
+
/** API options interface */
|
|
86
179
|
export interface ApiOptions {
|
|
87
180
|
select: {
|
|
88
181
|
getValue: () => string | null;
|
|
@@ -108,6 +201,7 @@ export interface ApiOptions {
|
|
|
108
201
|
destroy: () => void;
|
|
109
202
|
};
|
|
110
203
|
}
|
|
204
|
+
/** Select controller added by the menu feature */
|
|
111
205
|
export interface SelectController {
|
|
112
206
|
getValue: () => string | null;
|
|
113
207
|
setValue: (value: string | null | undefined) => BaseComponent;
|
|
@@ -120,6 +214,7 @@ export interface SelectController {
|
|
|
120
214
|
close: (event?: Event) => BaseComponent;
|
|
121
215
|
isOpen: () => boolean;
|
|
122
216
|
}
|
|
217
|
+
/** Base component interface */
|
|
123
218
|
export interface BaseComponent extends MenuOwner {
|
|
124
219
|
element: HTMLElement;
|
|
125
220
|
textField?: TextFieldComponent;
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
+
/** Side sheet variants. */
|
|
1
2
|
export declare const SIDE_SHEET_VARIANTS: {
|
|
2
3
|
readonly STANDARD: "standard";
|
|
3
4
|
readonly MODAL: "modal";
|
|
4
5
|
};
|
|
6
|
+
/** Which edge the sheet is docked to. */
|
|
5
7
|
export declare const SIDE_SHEET_POSITIONS: {
|
|
6
8
|
readonly START: "start";
|
|
7
9
|
readonly END: "end";
|
|
8
10
|
};
|
|
11
|
+
/** Defaults, from the M3 side sheet specs and the Android implementation. */
|
|
9
12
|
export declare const SIDE_SHEET_DEFAULTS: {
|
|
10
13
|
readonly VARIANT: "modal";
|
|
14
|
+
/** Side sheets dock to the trailing edge unless told otherwise */
|
|
11
15
|
readonly POSITION: "end";
|
|
16
|
+
/** The width the Android implementation uses for a standard sheet */
|
|
12
17
|
readonly WIDTH: 256;
|
|
18
|
+
/** m3.material.io side sheet specs, container maximum width */
|
|
13
19
|
readonly MAX_WIDTH: 400;
|
|
20
|
+
/** A modal sheet offers a way out of itself */
|
|
14
21
|
readonly CLOSE_BUTTON: true;
|
|
15
22
|
readonly CLOSE_ON_SCRIM_CLICK: true;
|
|
16
23
|
readonly CLOSE_ON_ESCAPE: true;
|
|
17
24
|
};
|
|
25
|
+
/** Class names, without the prefix. */
|
|
18
26
|
export declare const SIDE_SHEET_CLASSES: {
|
|
19
27
|
readonly ROOT: "side-sheet";
|
|
20
28
|
readonly SCRIM: "side-sheet__scrim";
|
|
@@ -26,6 +34,7 @@ export declare const SIDE_SHEET_CLASSES: {
|
|
|
26
34
|
readonly CONTENT: "side-sheet__content";
|
|
27
35
|
readonly ACTIONS: "side-sheet__actions";
|
|
28
36
|
};
|
|
37
|
+
/** Events the sheet emits. */
|
|
29
38
|
export declare const SIDE_SHEET_EVENTS: {
|
|
30
39
|
readonly OPEN: "open";
|
|
31
40
|
readonly CLOSE: "close";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { SideSheetConfig, SideSheetComponent } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a side sheet: a surface docked to a vertical edge, holding content that supports the page rather than replacing it.
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
2
6
|
declare const createSideSheet: (config?: SideSheetConfig) => SideSheetComponent;
|
|
3
7
|
export default createSideSheet;
|