material 3.7.3 → 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/NOTICE +223 -0
- package/README.md +6 -4
- 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 +126 -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 +103 -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 +6 -0
- package/dist/elements/fab-menu.d.ts +10 -0
- package/dist/elements/fab.d.ts +6 -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 +2 -2
- package/dist/styles/base.css +2 -2
- 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 +2 -2
- 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 +4 -0
- package/dist/theme/image.js +5 -0
- package/dist/theme/index.d.ts +43 -0
- package/dist/theme/index.js +32 -0
- package/dist/theme/roles.js +68 -0
- package/dist/theme/variants.d.ts +15 -0
- package/dist/theme/variants.js +17 -0
- package/dist/theme/vendor/contrast/contrast.js +72 -0
- package/dist/theme/vendor/dislike/dislike_analyzer.js +31 -0
- package/dist/theme/vendor/dynamiccolor/color_spec_2021.d.ts +64 -0
- package/dist/theme/vendor/dynamiccolor/color_spec_2021.js +663 -0
- package/dist/theme/vendor/dynamiccolor/contrast_curve.js +42 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_color.d.ts +63 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_color.js +264 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_scheme.d.ts +100 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_scheme.js +418 -0
- package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.d.ts +125 -0
- package/dist/theme/vendor/dynamiccolor/material_dynamic_colors.js +311 -0
- package/dist/theme/vendor/dynamiccolor/tone_delta_pair.js +27 -0
- package/dist/theme/vendor/dynamiccolor/variant.js +28 -0
- package/dist/theme/vendor/hct/cam16.js +249 -0
- package/dist/theme/vendor/hct/hct.d.ts +32 -0
- package/dist/theme/vendor/hct/hct.js +86 -0
- package/dist/theme/vendor/hct/hct_solver.js +390 -0
- package/dist/theme/vendor/hct/viewing_conditions.js +73 -0
- package/dist/theme/vendor/palettes/tonal_palette.js +114 -0
- package/dist/theme/vendor/quantize/lab_point_provider.js +31 -0
- package/dist/theme/vendor/quantize/quantizer_celebi.js +25 -0
- package/dist/theme/vendor/quantize/quantizer_map.js +31 -0
- package/dist/theme/vendor/quantize/quantizer_wsmeans.js +178 -0
- package/dist/theme/vendor/quantize/quantizer_wu.js +342 -0
- package/dist/theme/vendor/scheme/scheme_content.js +30 -0
- package/dist/theme/vendor/scheme/scheme_expressive.js +30 -0
- package/dist/theme/vendor/scheme/scheme_fidelity.js +30 -0
- package/dist/theme/vendor/scheme/scheme_monochrome.js +30 -0
- package/dist/theme/vendor/scheme/scheme_neutral.js +30 -0
- package/dist/theme/vendor/scheme/scheme_tonal_spot.js +30 -0
- package/dist/theme/vendor/scheme/scheme_vibrant.js +30 -0
- package/dist/theme/vendor/score/score.js +100 -0
- package/dist/theme/vendor/temperature/temperature_cache.js +198 -0
- package/dist/theme/vendor/utils/color_utils.js +173 -0
- package/dist/theme/vendor/utils/image_utils.js +72 -0
- package/dist/theme/vendor/utils/math_utils.js +75 -0
- package/dist/theme/vendor/utils/string_utils.js +61 -0
- package/dist/themes/autumn-contrast.css +2 -2
- package/dist/themes/autumn.css +2 -2
- package/dist/themes/baseline-contrast.css +2 -2
- package/dist/themes/baseline.css +2 -2
- package/dist/themes/brownbeige-contrast.css +2 -2
- package/dist/themes/brownbeige.css +2 -2
- package/dist/themes/content-contrast.css +2 -2
- package/dist/themes/content.css +2 -2
- package/dist/themes/desert-contrast.css +2 -2
- package/dist/themes/desert.css +2 -2
- package/dist/themes/expressive-contrast.css +2 -2
- package/dist/themes/expressive.css +2 -2
- package/dist/themes/fidelity-contrast.css +2 -2
- package/dist/themes/fidelity.css +2 -2
- package/dist/themes/forest-contrast.css +2 -2
- package/dist/themes/forest.css +2 -2
- package/dist/themes/fruit-salad-contrast.css +2 -2
- package/dist/themes/fruit-salad.css +2 -2
- package/dist/themes/highcontrast-contrast.css +2 -2
- package/dist/themes/highcontrast.css +2 -2
- package/dist/themes/monochrome-contrast.css +2 -2
- package/dist/themes/monochrome.css +2 -2
- package/dist/themes/neutral-contrast.css +2 -2
- package/dist/themes/neutral.css +2 -2
- package/dist/themes/ocean-contrast.css +2 -2
- package/dist/themes/ocean.css +2 -2
- package/dist/themes/rainbow-contrast.css +2 -2
- package/dist/themes/rainbow.css +2 -2
- package/dist/themes/sageivory-contrast.css +2 -2
- package/dist/themes/sageivory.css +2 -2
- package/dist/themes/spring-contrast.css +2 -2
- package/dist/themes/spring.css +2 -2
- package/dist/themes/summer-contrast.css +2 -2
- package/dist/themes/summer.css +2 -2
- package/dist/themes/sunset-contrast.css +2 -2
- package/dist/themes/sunset.css +2 -2
- package/dist/themes/tealcaramel-contrast.css +2 -2
- package/dist/themes/tealcaramel.css +2 -2
- package/dist/themes/vibrant-contrast.css +2 -2
- package/dist/themes/vibrant.css +2 -2
- package/dist/vue/create.d.ts +18 -0
- package/dist/vue/index.d.ts +1 -0
- package/package.json +14 -1
- package/src/styles/components/_menu.scss +14 -1
- package/src/styles/themes/_autumn.scss +20 -2
- package/src/styles/themes/_base-theme.scss +34 -24
- package/src/styles/themes/_baseline.scss +18 -0
- package/src/styles/themes/_brownbeige.scss +30 -2
- package/src/styles/themes/_content.scss +30 -2
- package/src/styles/themes/_desert.scss +30 -2
- package/src/styles/themes/_expressive.scss +30 -2
- package/src/styles/themes/_fidelity.scss +30 -2
- package/src/styles/themes/_forest.scss +20 -2
- package/src/styles/themes/_fruit-salad.scss +30 -2
- package/src/styles/themes/_highcontrast.scss +21 -2
- package/src/styles/themes/_monochrome.scss +30 -2
- package/src/styles/themes/_neutral.scss +30 -2
- package/src/styles/themes/_ocean.scss +20 -2
- package/src/styles/themes/_rainbow.scss +30 -2
- package/src/styles/themes/_sageivory.scss +30 -2
- package/src/styles/themes/_spring.scss +20 -2
- package/src/styles/themes/_summer.scss +30 -2
- package/src/styles/themes/_sunset.scss +20 -2
- package/src/styles/themes/_tealcaramel.scss +30 -2
- package/src/styles/themes/_vibrant.scss +30 -2
|
@@ -1,39 +1,69 @@
|
|
|
1
|
+
/** Default list item configuration */
|
|
1
2
|
export declare const LIST_DEFAULTS: {
|
|
3
|
+
/** Default collection name for API-connected lists */
|
|
2
4
|
readonly COLLECTION: "items";
|
|
5
|
+
/** Default API base URL */
|
|
3
6
|
readonly BASE_URL: "http://localhost:4000/api";
|
|
7
|
+
/** Default number of items per page */
|
|
4
8
|
readonly PAGE_SIZE: 20;
|
|
9
|
+
/** Default number of extra items to render above/below viewport */
|
|
5
10
|
readonly RENDER_BUFFER_SIZE: 5;
|
|
11
|
+
/** Default item height in pixels */
|
|
6
12
|
readonly ITEM_HEIGHT: 56;
|
|
7
13
|
};
|
|
14
|
+
/** List variants (m3.material.io lists) */
|
|
8
15
|
export declare const LIST_VARIANTS: {
|
|
9
16
|
readonly STANDARD: "standard";
|
|
10
17
|
readonly SEGMENTED: "segmented";
|
|
11
18
|
};
|
|
19
|
+
/** List types for rendering and behavior */
|
|
12
20
|
export declare const LIST_TYPES: {
|
|
21
|
+
/** Standard list with no selection */
|
|
13
22
|
readonly DEFAULT: "default";
|
|
23
|
+
/** List with single-select behavior */
|
|
14
24
|
readonly SINGLE_SELECT: "single-select";
|
|
25
|
+
/** List with multi-select behavior */
|
|
15
26
|
readonly MULTI_SELECT: "multi-select";
|
|
16
27
|
};
|
|
28
|
+
/** List selection modes */
|
|
17
29
|
export declare const LIST_SELECTION_MODES: {
|
|
30
|
+
/** No selection allowed */
|
|
18
31
|
readonly NONE: "none";
|
|
32
|
+
/** Only one item can be selected at a time */
|
|
19
33
|
readonly SINGLE: "single";
|
|
34
|
+
/** Multiple items can be selected */
|
|
20
35
|
readonly MULTIPLE: "multiple";
|
|
21
36
|
};
|
|
37
|
+
/** List events */
|
|
22
38
|
export declare const LIST_EVENTS: {
|
|
39
|
+
/** Fired when an item is selected */
|
|
23
40
|
readonly SELECT: "select";
|
|
41
|
+
/** Fired when items are loaded */
|
|
24
42
|
readonly LOAD: "load";
|
|
43
|
+
/** Fired when the list is scrolled */
|
|
25
44
|
readonly SCROLL: "scroll";
|
|
26
45
|
};
|
|
46
|
+
/** Scroll position options for scrollToItem method */
|
|
27
47
|
export declare const LIST_SCROLL_POSITIONS: {
|
|
48
|
+
/** Align item at the top of viewport */
|
|
28
49
|
readonly START: "start";
|
|
50
|
+
/** Center item in the viewport */
|
|
29
51
|
readonly CENTER: "center";
|
|
52
|
+
/** Align item at the bottom of viewport */
|
|
30
53
|
readonly END: "end";
|
|
31
54
|
};
|
|
55
|
+
/** CSS classes used in the list component */
|
|
32
56
|
export declare const LIST_CLASSES: {
|
|
57
|
+
/** Container element */
|
|
33
58
|
readonly CONTAINER: "list";
|
|
59
|
+
/** List element */
|
|
34
60
|
readonly LIST: "list";
|
|
61
|
+
/** List item */
|
|
35
62
|
readonly ITEM: "list__item";
|
|
63
|
+
/** Selected list item */
|
|
36
64
|
readonly SELECTED: "list__item--selected";
|
|
65
|
+
/** Loading indicator */
|
|
37
66
|
readonly LOADING: "list--loading";
|
|
67
|
+
/** Empty state */
|
|
38
68
|
readonly EMPTY: "list--empty";
|
|
39
69
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Material list anatomy for static data. */
|
|
1
2
|
export { default, default as createList } from "./list.js";
|
|
2
3
|
export { LIST_DEFAULTS, LIST_VARIANTS, LIST_TYPES, LIST_SELECTION_MODES, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_CLASSES, } from "./constants.js";
|
|
3
4
|
export type { ListConfig, ListVariant, ListItem, ListSlot, ListComponent, SelectEvent, LoadEvent, } from "./types.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { ListComponent, ListConfig, ListItem } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new List component The List component provides a simple way to render static arrays of data with Material item anatomy and built-in selection capabilities.
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
2
6
|
declare const createList: (config?: Partial<ListConfig<ListItem>>) => ListComponent<ListItem>;
|
|
3
7
|
export default createList;
|
|
@@ -1,37 +1,78 @@
|
|
|
1
1
|
import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
2
|
+
/** List variant types following Material Design 3 guidelines. */
|
|
2
3
|
export type ListVariant = 'standard' | 'segmented';
|
|
4
|
+
/** Configuration for the List component */
|
|
3
5
|
export interface ListConfig<T = unknown> {
|
|
6
|
+
/**
|
|
7
|
+
* The list's visual style.
|
|
8
|
+
* @default 'standard'
|
|
9
|
+
*/
|
|
4
10
|
variant?: ListVariant;
|
|
11
|
+
/** Static array of items to display */
|
|
5
12
|
items: T[];
|
|
13
|
+
/**
|
|
14
|
+
* Function to render an item
|
|
15
|
+
* @param item
|
|
16
|
+
* @param index
|
|
17
|
+
*/
|
|
6
18
|
renderItem?: (item: T, index: number) => HTMLElement;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to track item selection When true, clicked items will receive a selected class.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
7
23
|
trackSelection?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to allow multiple item selection
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
8
28
|
multiSelect?: boolean;
|
|
29
|
+
/** Initial selection state (array of item IDs) */
|
|
9
30
|
initialSelection?: (string | number)[];
|
|
31
|
+
/** ARIA label for accessibility */
|
|
10
32
|
ariaLabel?: string;
|
|
33
|
+
/** Additional CSS classes */
|
|
11
34
|
class?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Default animation behavior for scroll operations
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
12
39
|
animate?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Component name used in CSS class generation
|
|
42
|
+
* @default 'list'
|
|
43
|
+
*/
|
|
13
44
|
componentName?: string;
|
|
14
45
|
}
|
|
46
|
+
/** What the list reads off an item. */
|
|
47
|
+
/** Slot HTML uses the shared safe HTML sink; HTMLElement content is moved, not cloned. */
|
|
15
48
|
export interface ListSlot {
|
|
16
49
|
type: "icon" | "avatar" | "image" | "video" | "text" | "control" | "custom";
|
|
50
|
+
/** For `icon` and `avatar`, a string is markup. */
|
|
17
51
|
content: string | HTMLElement;
|
|
18
52
|
}
|
|
19
53
|
export interface ListItem {
|
|
54
|
+
/** Structural entries are rendered but never selectable. */
|
|
20
55
|
kind?: "item" | "divider" | "subheader";
|
|
56
|
+
/** Insets a divider to the text column (72px from the leading edge). */
|
|
21
57
|
inset?: boolean;
|
|
58
|
+
/** One headline line plus optional overline/supporting lines. */
|
|
22
59
|
lines?: 1 | 2 | 3;
|
|
23
60
|
overline?: string;
|
|
24
61
|
supportingText?: string;
|
|
25
62
|
leading?: ListSlot;
|
|
63
|
+
/** The slot at the row's end: text, an icon, or a control of the app's (a checkbox, a radio, a switch). */
|
|
26
64
|
trailing?: ListSlot;
|
|
65
|
+
/** Blocks user activation; programmatic selection is still allowed. */
|
|
27
66
|
disabled?: boolean;
|
|
28
67
|
id?: string | number;
|
|
29
68
|
text?: string;
|
|
30
69
|
title?: string;
|
|
31
70
|
headline?: string;
|
|
32
71
|
name?: string;
|
|
72
|
+
/** Selected at creation, which withSelection seeds its set from */
|
|
33
73
|
selected?: boolean;
|
|
34
74
|
}
|
|
75
|
+
/** What withRenderer installs at `component.list`. */
|
|
35
76
|
export interface ListRenderer<T = ListItem> {
|
|
36
77
|
getRows: () => ListRow<T>[];
|
|
37
78
|
onRender: (handler: () => void) => () => void;
|
|
@@ -78,7 +119,9 @@ export interface ListRow<T = ListItem> {
|
|
|
78
119
|
element: HTMLElement;
|
|
79
120
|
action?: HTMLButtonElement;
|
|
80
121
|
}
|
|
122
|
+
/** Where a scrolled-to item lands in the viewport */
|
|
81
123
|
export type ScrollPosition = "start" | "center" | "end";
|
|
124
|
+
/** What withSelection installs. */
|
|
82
125
|
export interface ListSelection<T = ListItem> {
|
|
83
126
|
getSelectedItems: () => T[];
|
|
84
127
|
getSelectedItemIds: () => string[];
|
|
@@ -88,6 +131,7 @@ export interface ListSelection<T = ListItem> {
|
|
|
88
131
|
clearSelection(): this;
|
|
89
132
|
setSelection(itemIds: (string | number)[]): this;
|
|
90
133
|
}
|
|
134
|
+
/** What a list feature needs from the component it is handed. */
|
|
91
135
|
export interface ListFeatureHost {
|
|
92
136
|
element: HTMLElement;
|
|
93
137
|
getClass: (name: string) => string;
|
|
@@ -101,44 +145,110 @@ export interface ListFeatureHost {
|
|
|
101
145
|
};
|
|
102
146
|
list?: ListRenderer;
|
|
103
147
|
}
|
|
148
|
+
/** Selection event data */
|
|
104
149
|
export interface SelectEvent<T = unknown> {
|
|
150
|
+
/** Selected item data */
|
|
105
151
|
item: T;
|
|
152
|
+
/** The item's id as a string, the `value` of the `<m-list>` element's */
|
|
106
153
|
value: string;
|
|
154
|
+
/** DOM element for the selected item */
|
|
107
155
|
element: HTMLElement;
|
|
156
|
+
/** Original DOM event */
|
|
108
157
|
originalEvent: Event;
|
|
158
|
+
/** Component instance */
|
|
109
159
|
component: ListComponent<T>;
|
|
160
|
+
/** Prevent default behavior */
|
|
110
161
|
preventDefault: () => void;
|
|
162
|
+
/** Whether default was prevented */
|
|
111
163
|
defaultPrevented: boolean;
|
|
112
164
|
}
|
|
165
|
+
/** Load event data */
|
|
113
166
|
export interface LoadEvent<T = unknown> {
|
|
167
|
+
/** Loaded items */
|
|
114
168
|
items: T[];
|
|
169
|
+
/** Whether the list is currently loading */
|
|
115
170
|
loading: boolean;
|
|
171
|
+
/** Whether there are more items to load */
|
|
116
172
|
hasNext: boolean;
|
|
173
|
+
/** Whether there are previous items */
|
|
117
174
|
hasPrev: boolean;
|
|
175
|
+
/** Component instance */
|
|
118
176
|
component: ListComponent<T>;
|
|
177
|
+
/** Prevent default behavior */
|
|
119
178
|
preventDefault?: () => void;
|
|
179
|
+
/** Whether default was prevented */
|
|
120
180
|
defaultPrevented?: boolean;
|
|
121
181
|
}
|
|
182
|
+
/** List component interface */
|
|
122
183
|
export interface ListComponent<T = unknown> {
|
|
184
|
+
/** Component's root DOM element */
|
|
123
185
|
element: HTMLElement;
|
|
186
|
+
/** Refreshes the list display */
|
|
124
187
|
refresh: () => Promise<ListComponent<T>>;
|
|
188
|
+
/** Gets all items in the list */
|
|
125
189
|
getAllItems: () => T[];
|
|
190
|
+
/** Gets all visible items (same as getAllItems for rendered lists) */
|
|
126
191
|
getVisibleItems: () => T[];
|
|
192
|
+
/**
|
|
193
|
+
* Scrolls to a specific item by ID
|
|
194
|
+
* @param itemId
|
|
195
|
+
* @param position
|
|
196
|
+
* @param animate
|
|
197
|
+
*/
|
|
127
198
|
scrollToItem: (itemId: string | number, position?: "start" | "center" | "end", animate?: boolean) => ListComponent<T>;
|
|
199
|
+
/**
|
|
200
|
+
* Scroll to a specific index in the list
|
|
201
|
+
* @param index
|
|
202
|
+
* @param position
|
|
203
|
+
* @param animate
|
|
204
|
+
*/
|
|
128
205
|
scrollToIndex: (index: number, position?: "start" | "center" | "end", animate?: boolean) => Promise<ListComponent<T>>;
|
|
206
|
+
/** Checks if the list is currently loading (always false for rendered lists) */
|
|
129
207
|
isLoading: () => boolean;
|
|
208
|
+
/** Checks if the list has more items to load (always false for rendered lists) */
|
|
130
209
|
hasNextPage: () => boolean;
|
|
210
|
+
/** Gets the currently selected items */
|
|
131
211
|
getSelectedItems: () => T[];
|
|
212
|
+
/** Gets the IDs of currently selected items */
|
|
132
213
|
getSelectedItemIds: () => string[];
|
|
214
|
+
/**
|
|
215
|
+
* Checks if an item is selected
|
|
216
|
+
* @param itemId
|
|
217
|
+
*/
|
|
133
218
|
isItemSelected: (itemId: string | number) => boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Selects an item
|
|
221
|
+
* @param itemId
|
|
222
|
+
*/
|
|
134
223
|
selectItem: (itemId: string | number) => ListComponent<T>;
|
|
224
|
+
/**
|
|
225
|
+
* Deselects an item
|
|
226
|
+
* @param itemId
|
|
227
|
+
*/
|
|
135
228
|
deselectItem: (itemId: string | number) => ListComponent<T>;
|
|
229
|
+
/** Clears all selections */
|
|
136
230
|
clearSelection: () => ListComponent<T>;
|
|
231
|
+
/**
|
|
232
|
+
* Sets the selection to the specified item IDs
|
|
233
|
+
* @param itemIds
|
|
234
|
+
*/
|
|
137
235
|
setSelection: (itemIds: (string | number)[]) => ListComponent<T>;
|
|
236
|
+
/**
|
|
237
|
+
* Adds an event listener to the list
|
|
238
|
+
* @param event
|
|
239
|
+
* @param handler
|
|
240
|
+
*/
|
|
138
241
|
on: <K extends keyof ListEvents<T>>(event: K, handler: ListEvents<T>[K]) => ListComponent<T>;
|
|
242
|
+
/**
|
|
243
|
+
* Removes an event listener from the list
|
|
244
|
+
* @param event
|
|
245
|
+
* @param handler
|
|
246
|
+
*/
|
|
139
247
|
off: <K extends keyof ListEvents<T>>(event: K, handler: ListEvents<T>[K]) => ListComponent<T>;
|
|
248
|
+
/** Destroys the component and cleans up resources */
|
|
140
249
|
destroy: () => void;
|
|
141
250
|
}
|
|
251
|
+
/** Event handlers for List */
|
|
142
252
|
export interface ListEvents<T = unknown> {
|
|
143
253
|
select: (event: SelectEvent<T>) => void;
|
|
144
254
|
load: (event: LoadEvent<T>) => void;
|
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
import type { MaterialShapeName } from "../../core/shapes/index.js";
|
|
2
|
+
/** Loading indicator measurements and timing (Compose Material 3 */
|
|
2
3
|
export declare const LOADING_INDICATOR_DEFAULTS: {
|
|
4
|
+
/** Container width and height */
|
|
3
5
|
readonly SIZE: 48;
|
|
6
|
+
/** The active indicator's diameter within a 48dp container */
|
|
4
7
|
readonly INDICATOR_SIZE: 38;
|
|
8
|
+
/** Smallest size the guidelines allow */
|
|
5
9
|
readonly MIN_SIZE: 24;
|
|
10
|
+
/** Largest size the guidelines allow */
|
|
6
11
|
readonly MAX_SIZE: 240;
|
|
12
|
+
/** Milliseconds between two shape morphs */
|
|
7
13
|
readonly MORPH_INTERVAL: 650;
|
|
14
|
+
/** Milliseconds for one full turn of the slow global rotation */
|
|
8
15
|
readonly ROTATION_DURATION: 4666;
|
|
16
|
+
/** Degrees each morph turns the shape */
|
|
9
17
|
readonly MORPH_ROTATION: 90;
|
|
18
|
+
/** Accessible name when none is given */
|
|
10
19
|
readonly LABEL: "Loading";
|
|
20
|
+
/** Outline samples per shape */
|
|
11
21
|
readonly SAMPLES: 360;
|
|
12
22
|
};
|
|
23
|
+
/** The morph spring (Compose: `spring(dampingRatio = 0.6f, stiffness = 200f, */
|
|
13
24
|
export declare const LOADING_INDICATOR_SPRING: {
|
|
14
25
|
readonly DAMPING: 0.6;
|
|
15
26
|
readonly STIFFNESS: 200;
|
|
16
27
|
readonly THRESHOLD: 0.1;
|
|
17
28
|
};
|
|
29
|
+
/** The shapes the indeterminate indicator morphs through, in order */
|
|
18
30
|
export declare const LOADING_INDICATOR_SHAPES: readonly MaterialShapeName[];
|
|
31
|
+
/** The shapes the determinate indicator morphs between as the value grows */
|
|
19
32
|
export declare const LOADING_INDICATOR_DETERMINATE_SHAPES: readonly MaterialShapeName[];
|
|
33
|
+
/** CSS class names used by the loading indicator, without the prefix */
|
|
20
34
|
export declare const LOADING_INDICATOR_CLASSES: {
|
|
21
35
|
readonly ROOT: "loading-indicator";
|
|
36
|
+
/** Drawn on a primary-container circle */
|
|
22
37
|
readonly CONTAINED: "loading-indicator--contained";
|
|
38
|
+
/** Shows a value rather than looping */
|
|
23
39
|
readonly DETERMINATE: "loading-indicator--determinate";
|
|
24
40
|
readonly CANVAS: "loading-indicator__canvas";
|
|
25
41
|
};
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { RadialProfile, MaterialShapeName } from "../../../core/shapes/index.js";
|
|
2
2
|
import { BaseComponent, LoadingIndicatorConfig } from "../types.js";
|
|
3
|
+
/** A frame: which morph, how far along it, and the rotation in degrees */
|
|
3
4
|
export interface Frame {
|
|
5
|
+
/** Index of the shape the morph starts from */
|
|
4
6
|
index: number;
|
|
7
|
+
/** 0 at the shape, 1 at the next; may overshoot */
|
|
5
8
|
progress: number;
|
|
9
|
+
/** Clockwise rotation in degrees */
|
|
6
10
|
rotation: number;
|
|
7
11
|
}
|
|
8
12
|
export interface Renderer {
|
|
13
|
+
/** Draws one frame with the given shape sequence */
|
|
9
14
|
draw: (shapes: readonly RadialProfile[], frame: Frame) => void;
|
|
15
|
+
/** Resizes the canvas to the element's size */
|
|
10
16
|
resize: (size: number) => void;
|
|
17
|
+
/** Re-reads the indicator colour from the element's computed style */
|
|
11
18
|
refreshColor: () => void;
|
|
19
|
+
/** The last frame drawn, redrawn on resize and theme change */
|
|
12
20
|
redraw: () => void;
|
|
21
|
+
/** Profiles for a shape sequence, cached per name */
|
|
13
22
|
profiles: (names: readonly MaterialShapeName[]) => RadialProfile[];
|
|
14
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Adds the canvas and the drawing routine
|
|
26
|
+
* @param config
|
|
27
|
+
*/
|
|
15
28
|
export declare const withRenderer: (config: LoadingIndicatorConfig) => (component: BaseComponent) => BaseComponent;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { LoadingIndicatorConfig, LoadingIndicatorComponent } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a loading indicator: the Material 3 expressive shape morph for waits under about five seconds.
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
2
6
|
declare const createLoadingIndicator: (config?: LoadingIndicatorConfig) => LoadingIndicatorComponent;
|
|
3
7
|
export default createLoadingIndicator;
|
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
import type { Renderer } from "./features/renderer.js";
|
|
2
|
+
/** Configuration options for the loading indicator */
|
|
2
3
|
export interface LoadingIndicatorConfig {
|
|
4
|
+
/** Width and height in pixels, 24 to 240 (default 48) */
|
|
3
5
|
size?: number;
|
|
6
|
+
/** Draws the indicator on a primary-container circle, for use over other */
|
|
4
7
|
contained?: boolean;
|
|
8
|
+
/** A value from 0 to 1 makes the indicator determinate: the shape morphs with the value instead of looping. */
|
|
5
9
|
value?: number | null;
|
|
10
|
+
/** Accessible name: what is loading (default "Loading") */
|
|
6
11
|
ariaLabel?: string;
|
|
12
|
+
/** Additional CSS classes */
|
|
7
13
|
class?: string;
|
|
14
|
+
/** Component prefix for CSS classes */
|
|
8
15
|
prefix?: string;
|
|
16
|
+
/** Component name for CSS classes */
|
|
9
17
|
componentName?: string;
|
|
10
18
|
}
|
|
19
|
+
/** Loading indicator public API */
|
|
11
20
|
export interface LoadingIndicatorComponent {
|
|
21
|
+
/** The root element */
|
|
12
22
|
element: HTMLElement;
|
|
23
|
+
/** The canvas the shapes are drawn on */
|
|
13
24
|
canvas: HTMLCanvasElement;
|
|
25
|
+
/** Sets a value from 0 to 1 (determinate) or null (indeterminate) */
|
|
14
26
|
setValue: (value: number | null) => LoadingIndicatorComponent;
|
|
27
|
+
/** The current value, or null when indeterminate */
|
|
15
28
|
getValue: () => number | null;
|
|
29
|
+
/** Sets the size in pixels, clamped to 24–240 */
|
|
16
30
|
setSize: (size: number) => LoadingIndicatorComponent;
|
|
31
|
+
/** The size in pixels */
|
|
17
32
|
getSize: () => number;
|
|
33
|
+
/** Sets the accessible name */
|
|
18
34
|
setLabel: (label: string) => LoadingIndicatorComponent;
|
|
35
|
+
/** Runs the indeterminate animation (it runs from creation) */
|
|
19
36
|
start: () => LoadingIndicatorComponent;
|
|
37
|
+
/** Freezes the indicator on its current frame */
|
|
20
38
|
stop: () => LoadingIndicatorComponent;
|
|
39
|
+
/** Whether the animation is running */
|
|
21
40
|
isRunning: () => boolean;
|
|
41
|
+
/** Stops the animation and removes the element */
|
|
22
42
|
destroy: () => void;
|
|
23
43
|
}
|
|
44
|
+
/** The component as it passes through the enhancers */
|
|
24
45
|
export interface BaseComponent {
|
|
25
46
|
element: HTMLElement;
|
|
26
47
|
getClass?: (name: string) => string;
|
|
@@ -1,61 +1,112 @@
|
|
|
1
|
+
/** Menu position options for alignment relative to opener element */
|
|
2
|
+
/** Menu variants The baseline menu is the original M3 design: square-ish corners, a surface-container container, and items that fill the width. */
|
|
1
3
|
export declare const MENU_VARIANTS: {
|
|
4
|
+
/** The original M3 menu (default, for compatibility) */
|
|
2
5
|
readonly BASELINE: "baseline";
|
|
6
|
+
/** The M3 expressive vertical menu */
|
|
3
7
|
readonly VERTICAL: "vertical";
|
|
4
8
|
};
|
|
9
|
+
/** Colour mappings for the vertical menu Standard is surface-based and carries lower emphasis; vibrant is tertiary-based, is more prominent, and should be used sparingly (m3.material.io menu guidelines, "Color options"). */
|
|
5
10
|
export declare const MENU_COLORS: {
|
|
6
11
|
readonly STANDARD: "standard";
|
|
7
12
|
readonly VIBRANT: "vibrant";
|
|
8
13
|
};
|
|
9
14
|
export declare const MENU_POSITION: {
|
|
15
|
+
/** Places menu below the opener, aligned to left edge */
|
|
10
16
|
readonly BOTTOM_START: "bottom-start";
|
|
17
|
+
/** Places menu below the opener, centered */
|
|
11
18
|
readonly BOTTOM: "bottom";
|
|
19
|
+
/** Places menu below the opener, aligned to right edge */
|
|
12
20
|
readonly BOTTOM_END: "bottom-end";
|
|
21
|
+
/** Places menu above the opener, aligned to left edge */
|
|
13
22
|
readonly TOP_START: "top-start";
|
|
23
|
+
/** Places menu above the opener, centered */
|
|
14
24
|
readonly TOP: "top";
|
|
25
|
+
/** Places menu above the opener, aligned to right edge */
|
|
15
26
|
readonly TOP_END: "top-end";
|
|
27
|
+
/** Places menu to the right of the opener, aligned to top edge */
|
|
16
28
|
readonly RIGHT_START: "right-start";
|
|
29
|
+
/** Places menu to the right of the opener, centered */
|
|
17
30
|
readonly RIGHT: "right";
|
|
31
|
+
/** Places menu to the right of the opener, aligned to bottom edge */
|
|
18
32
|
readonly RIGHT_END: "right-end";
|
|
33
|
+
/** Places menu to the left of the opener, aligned to top edge */
|
|
19
34
|
readonly LEFT_START: "left-start";
|
|
35
|
+
/** Places menu to the left of the opener, centered */
|
|
20
36
|
readonly LEFT: "left";
|
|
37
|
+
/** Places menu to the left of the opener, aligned to bottom edge */
|
|
21
38
|
readonly LEFT_END: "left-end";
|
|
22
39
|
};
|
|
40
|
+
/** Default configuration values for menus */
|
|
23
41
|
export declare const MENU_DEFAULTS: {
|
|
42
|
+
/** Default variant; the baseline menu, so existing menus are untouched */
|
|
24
43
|
readonly VARIANT: "baseline";
|
|
44
|
+
/** Default colour mapping for the vertical variant */
|
|
25
45
|
readonly COLOR: "standard";
|
|
46
|
+
/** Default menu position */
|
|
26
47
|
readonly POSITION: "bottom-start";
|
|
48
|
+
/** Default offset from the opener (in pixels) */
|
|
27
49
|
readonly OFFSET: 0;
|
|
50
|
+
/** Close menu when an item is selected */
|
|
28
51
|
readonly CLOSE_ON_SELECT: true;
|
|
52
|
+
/** Close menu when clicking outside */
|
|
29
53
|
readonly CLOSE_ON_CLICK_OUTSIDE: true;
|
|
54
|
+
/** Close menu when escape key is pressed */
|
|
30
55
|
readonly CLOSE_ON_ESCAPE: true;
|
|
56
|
+
/** Open submenus on hover */
|
|
31
57
|
readonly OPEN_SUBMENU_ON_HOVER: true;
|
|
58
|
+
/** Automatically flip menu position to stay in viewport */
|
|
32
59
|
readonly AUTO_FLIP: true;
|
|
33
60
|
};
|
|
61
|
+
/** Interaction types for menu opening/closing */
|
|
34
62
|
export declare const MENU_INTERACTION_TYPES: {
|
|
63
|
+
/** Interaction via mouse or touch */
|
|
35
64
|
readonly MOUSE: "mouse";
|
|
65
|
+
/** Interaction via keyboard */
|
|
36
66
|
readonly KEYBOARD: "keyboard";
|
|
37
67
|
};
|
|
68
|
+
/** Menu item types */
|
|
38
69
|
export declare const MENU_ITEM_TYPES: {
|
|
70
|
+
/** Standard interactive menu item */
|
|
39
71
|
readonly ITEM: "item";
|
|
72
|
+
/** Non-interactive dividing line */
|
|
40
73
|
readonly DIVIDER: "divider";
|
|
41
74
|
};
|
|
75
|
+
/** Menu event names */
|
|
42
76
|
export declare const MENU_EVENTS: {
|
|
77
|
+
/** Fired when the menu is opened */
|
|
43
78
|
readonly OPEN: "open";
|
|
79
|
+
/** Fired when the menu is closed */
|
|
44
80
|
readonly CLOSE: "close";
|
|
81
|
+
/** Fired when a menu item is selected */
|
|
45
82
|
readonly SELECT: "select";
|
|
46
83
|
};
|
|
84
|
+
/** CSS classes for menu elements */
|
|
47
85
|
export declare const MENU_CLASSES: {
|
|
86
|
+
/** Menu container */
|
|
48
87
|
readonly CONTAINER: "menu";
|
|
88
|
+
/** Visible menu */
|
|
49
89
|
readonly VISIBLE: "menu--visible";
|
|
90
|
+
/** Menu inner container */
|
|
50
91
|
readonly INNER: "menu__inner";
|
|
92
|
+
/** Individual menu item */
|
|
51
93
|
readonly ITEM: "menu__item";
|
|
94
|
+
/** Disabled menu item */
|
|
52
95
|
readonly ITEM_DISABLED: "menu__item--disabled";
|
|
96
|
+
/** Selected menu item */
|
|
53
97
|
readonly ITEM_SELECTED: "menu__item--selected";
|
|
98
|
+
/** Menu item with submenu */
|
|
54
99
|
readonly ITEM_HAS_SUBMENU: "menu__item--has-submenu";
|
|
100
|
+
/** Divider */
|
|
55
101
|
readonly DIVIDER: "menu__divider";
|
|
102
|
+
/** Item icon */
|
|
56
103
|
readonly ITEM_ICON: "menu__item-icon";
|
|
104
|
+
/** Item text */
|
|
57
105
|
readonly ITEM_TEXT: "menu__item-text";
|
|
106
|
+
/** Item keyboard shortcut */
|
|
58
107
|
readonly ITEM_SHORTCUT: "menu__item-shortcut";
|
|
108
|
+
/** Submenu indicator */
|
|
59
109
|
readonly SUBMENU_INDICATOR: "menu__submenu-indicator";
|
|
110
|
+
/** Dense/compact variant */
|
|
60
111
|
readonly DENSE: "menu--dense";
|
|
61
112
|
};
|
|
@@ -283,7 +283,7 @@ void component.element.getBoundingClientRect();
|
|
|
283
283
|
component.element.classList.add(`${component.getClass("menu--visible")}`);
|
|
284
284
|
if (!listbox)
|
|
285
285
|
focusTimer = tasks.setTimeout(() => {
|
|
286
|
-
component.keyboard?.handleInitialFocus(component.element, interactionType);
|
|
286
|
+
component.keyboard?.handleInitialFocus(component.element, interactionType, event);
|
|
287
287
|
}, 100);
|
|
288
288
|
window.addEventListener("resize", handleWindowResize, {
|
|
289
289
|
passive: true,
|
|
@@ -55,17 +55,22 @@ tasks.clearTimeout(typeaheadTimeout);
|
|
|
55
55
|
typeaheadTimeout = null;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
const handleInitialFocus = (menuElement, interactionType) => {
|
|
58
|
+
const handleInitialFocus = (menuElement, interactionType, openingEvent) => {
|
|
59
59
|
resetTypeahead();
|
|
60
60
|
const items = menuItems(menuElement);
|
|
61
|
+
const last = openingEvent instanceof KeyboardEvent &&
|
|
62
|
+
(openingEvent.key === "ArrowUp" || openingEvent.key === "Up");
|
|
63
|
+
const target = last
|
|
64
|
+
? [...items].reverse().find((item) => !item.classList.contains(component.getClass("menu__item--disabled"))) ?? items[items.length - 1]
|
|
65
|
+
: items[0];
|
|
61
66
|
items.forEach((item) => item.setAttribute("tabindex", "-1"));
|
|
62
|
-
|
|
67
|
+
target?.setAttribute("tabindex", "0");
|
|
63
68
|
const focused = activeElementOf(menuElement);
|
|
64
69
|
if (focused !== menuElement && menuElement.contains(focused) ||
|
|
65
70
|
focused?.closest(`.${component.getClass("menu--submenu")}`)?.getAttribute("data-owner") === menuElement.id)
|
|
66
71
|
return;
|
|
67
72
|
if (interactionType === "keyboard" && items.length > 0) {
|
|
68
|
-
|
|
73
|
+
target.focus();
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
76
|
menuElement.setAttribute("tabindex", "-1");
|
|
@@ -162,6 +162,8 @@ case "Enter":
|
|
|
162
162
|
case " ":
|
|
163
163
|
case "ArrowDown":
|
|
164
164
|
case "Down":
|
|
165
|
+
case "ArrowUp":
|
|
166
|
+
case "Up":
|
|
165
167
|
e.preventDefault();
|
|
166
168
|
if (!isOpen) {
|
|
167
169
|
component.menu.open(e, "keyboard");
|
|
@@ -173,22 +175,6 @@ e.preventDefault();
|
|
|
173
175
|
component.menu.close(e);
|
|
174
176
|
}
|
|
175
177
|
break;
|
|
176
|
-
case "ArrowUp":
|
|
177
|
-
case "Up":
|
|
178
|
-
e.preventDefault();
|
|
179
|
-
if (!isOpen) {
|
|
180
|
-
component.menu.open(e, "keyboard");
|
|
181
|
-
tasks.setTimeout(() => {
|
|
182
|
-
const items = component.element.querySelectorAll(`.${component.getClass("menu__item")}:not(.${component.getClass("menu__item--disabled")})`);
|
|
183
|
-
if (items.length > 0) {
|
|
184
|
-
items.forEach((item) => item.setAttribute("tabindex", "-1"));
|
|
185
|
-
const lastItem = items[items.length - 1];
|
|
186
|
-
lastItem.setAttribute("tabindex", "0");
|
|
187
|
-
lastItem.focus();
|
|
188
|
-
}
|
|
189
|
-
}, 100);
|
|
190
|
-
}
|
|
191
|
-
break;
|
|
192
178
|
}
|
|
193
179
|
};
|
|
194
180
|
const handleOpenerBlur = (e) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** Menu component module The Menu component provides a Material Design 3 compliant dropdown menu system with support for nested menus, keyboard navigation, and accessibility. */
|
|
1
2
|
export { default, default as createMenu } from "./menu.js";
|
|
2
3
|
export type { MenuEvents } from "./types.js";
|
|
3
4
|
export type { MenuConfig, MenuVariant, MenuComponent, MenuItem, MenuDivider, MenuGap, MenuContent, MenuEvent, MenuSelectEvent, MenuPosition } from "./types.js";
|
|
5
|
+
/** Constants for menu position values - use these instead of string literals for better code completion and type safety. */
|
|
4
6
|
export { MENU_POSITION, MENU_DEFAULTS, MENU_INTERACTION_TYPES, MENU_ITEM_TYPES, MENU_EVENTS, MENU_CLASSES } from "./constants.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { OnDemandMenu } from "./on-demand.js";
|
|
2
2
|
export declare const MENU: unique symbol;
|
|
3
|
+
/** What an owner of an inner menu carries. */
|
|
3
4
|
export interface MenuOwner {
|
|
4
5
|
[MENU]?: OnDemandMenu;
|
|
5
6
|
}
|
|
7
|
+
/** The menu inside a select or a split button, if it has one. */
|
|
6
8
|
export declare const innerMenu: (owner: object) => OnDemandMenu | undefined;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { EventCallback } from "../../core/state/emitter.js";
|
|
2
2
|
import type { MenuConfig, MenuContent, MenuEvents, MenuPosition } from "./types.js";
|
|
3
|
+
/** createMenu's configuration, except the items, which setItems may replace. */
|
|
3
4
|
type MenuSettings = Omit<MenuConfig, "items">;
|
|
5
|
+
/** The menu a select or a split button holds before the chunk arrives: the operations the two components reach on their own inner menu. */
|
|
4
6
|
export interface OnDemandMenu {
|
|
5
7
|
readonly element: HTMLElement;
|
|
8
|
+
/** Starts the load without opening the menu, from the intent to open it. */
|
|
6
9
|
preload(): void;
|
|
10
|
+
/** Runs once the real menu exists, after an open that waited for it. */
|
|
7
11
|
whenReady(callback: () => void): void;
|
|
8
12
|
open(event?: Event, interactionType?: "mouse" | "keyboard"): OnDemandMenu;
|
|
9
13
|
close(event?: Event, restoreFocus?: boolean, skipAnimation?: boolean): OnDemandMenu;
|
|
@@ -17,5 +21,10 @@ export interface OnDemandMenu {
|
|
|
17
21
|
on(event: string, handler: EventCallback): OnDemandMenu;
|
|
18
22
|
destroy(): void;
|
|
19
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* A stand-in for the menu, replaced by it when the chunk lands
|
|
26
|
+
* @param settings
|
|
27
|
+
* @param items
|
|
28
|
+
*/
|
|
20
29
|
export declare const createOnDemandMenu: (settings: MenuSettings, items: MenuContent[]) => OnDemandMenu;
|
|
21
30
|
export {};
|