material 3.8.2 → 3.10.0
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 +5 -5
- package/dist/components/badge/index.d.ts +167 -3
- package/dist/components/bottom-app-bar/constants.d.ts +16 -3
- package/dist/components/bottom-app-bar/index.d.ts +141 -4
- package/dist/components/bottom-sheet/config.js +1 -1
- package/dist/components/bottom-sheet/features/structure.js +10 -2
- package/dist/components/bottom-sheet/index.d.ts +114 -2
- package/dist/components/button/index.d.ts +10 -5
- package/dist/components/button-group/button-group.js +2 -1
- package/dist/components/button-group/config.js +9 -6
- package/dist/components/button-group/index.d.ts +250 -6
- package/dist/components/card/api.js +19 -0
- package/dist/components/card/index.d.ts +326 -5
- package/dist/components/carousel/features/slides.js +17 -7
- package/dist/components/carousel/index.d.ts +102 -3
- package/dist/components/checkbox/config.js +3 -2
- package/dist/components/checkbox/index.d.ts +217 -5
- package/dist/components/chips/chip/chip.js +4 -3
- package/dist/components/chips/index.d.ts +343 -3
- package/dist/components/datepicker/config.js +1 -1
- package/dist/components/datepicker/datepicker.js +74 -87
- package/dist/components/datepicker/index.d.ts +313 -2
- package/dist/components/datepicker/render.js +24 -20
- package/dist/components/datepicker/utils.js +66 -111
- package/dist/components/dialog/features.js +1 -1
- package/dist/components/dialog/index.d.ts +333 -3
- package/dist/components/divider/index.d.ts +99 -3
- package/dist/components/drawer/features/items.js +10 -2
- package/dist/components/drawer/index.d.ts +196 -3
- package/dist/components/extended-fab/index.d.ts +224 -2
- package/dist/components/fab/index.d.ts +183 -2
- package/dist/components/fab-menu/index.d.ts +106 -6
- package/dist/components/icon-button/index.d.ts +11 -4
- package/dist/components/index.js +1 -1
- package/dist/components/list/features/anatomy.js +25 -6
- package/dist/components/list/features/listbox.js +230 -0
- package/dist/components/list/features/selection.js +30 -2
- package/dist/components/list/index.d.ts +299 -4
- package/dist/components/list/index.js +1 -0
- package/dist/components/loading-indicator/index.d.ts +94 -3
- package/dist/components/menu/config.js +2 -2
- package/dist/components/menu/constants.d.ts +4 -4
- package/dist/components/menu/constants.js +1 -1
- package/dist/components/menu/features/controller.js +14 -1
- package/dist/components/menu/features/position.js +15 -8
- package/dist/components/menu/features/submenu.js +3 -0
- package/dist/components/menu/index.d.ts +10 -6
- package/dist/components/menu/types.d.ts +13 -1
- package/dist/components/navigation-bar/index.d.ts +70 -2
- package/dist/components/navigation-rail/index.d.ts +98 -2
- package/dist/components/progress/index.d.ts +9 -2
- package/dist/components/radios/config.js +1 -0
- package/dist/components/radios/index.d.ts +158 -3
- package/dist/components/radios/radio.js +2 -0
- package/dist/components/search/features/input.js +6 -1
- package/dist/components/search/features/states.js +3 -3
- package/dist/components/search/features/structure.js +27 -5
- package/dist/components/search/features/suggestions.js +4 -0
- package/dist/components/search/index.d.ts +255 -2
- package/dist/components/select/index.d.ts +252 -6
- package/dist/components/side-sheet/config.js +1 -1
- package/dist/components/side-sheet/features/structure.js +10 -2
- package/dist/components/side-sheet/index.d.ts +104 -2
- package/dist/components/slider/config.js +3 -2
- package/dist/components/slider/index.d.ts +236 -2
- package/dist/components/snackbar/api.js +26 -0
- package/dist/components/snackbar/constants.d.ts +4 -0
- package/dist/components/snackbar/constants.js +3 -1
- package/dist/components/snackbar/index.d.ts +215 -4
- package/dist/components/split-button/config.js +1 -1
- package/dist/components/split-button/index.d.ts +10 -3
- package/dist/components/switch/config.js +3 -2
- package/dist/components/switch/index.d.ts +190 -3
- package/dist/components/tabs/config.js +1 -0
- package/dist/components/tabs/index.d.ts +476 -12
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/responsive-legacy.js +65 -0
- package/dist/components/tabs/responsive.d.ts +7 -32
- package/dist/components/tabs/responsive.js +4 -63
- package/dist/components/tabs/tab.js +11 -5
- package/dist/components/tabs/tabs.js +1 -0
- package/dist/components/text-field/config.js +9 -5
- package/dist/components/text-field/features/field.js +61 -0
- package/dist/components/text-field/features/leading-icon.js +12 -45
- package/dist/components/text-field/features/prefix-text.js +6 -40
- package/dist/components/text-field/features/suffix-text.js +6 -40
- package/dist/components/text-field/index.d.ts +345 -3
- package/dist/components/timepicker/api.js +7 -8
- package/dist/components/timepicker/config.js +1 -1
- package/dist/components/timepicker/constants.d.ts +4 -4
- package/dist/components/timepicker/constants.js +2 -2
- package/dist/components/timepicker/index.d.ts +279 -5
- package/dist/components/timepicker/render.js +26 -6
- package/dist/components/timepicker/timepicker.js +0 -1
- package/dist/components/toolbar/config.js +1 -0
- package/dist/components/toolbar/constants.d.ts +4 -1
- package/dist/components/toolbar/constants.js +3 -0
- package/dist/components/toolbar/index.d.ts +145 -6
- package/dist/components/toolbar/toolbar.js +18 -3
- package/dist/components/tooltip/index.d.ts +155 -3
- package/dist/components/top-app-bar/index.d.ts +92 -5
- package/dist/core/canvas/index.d.ts +172 -5
- package/dist/core/compose/features/icon-opt-in.js +5 -0
- package/dist/core/compose/features/icon-slot.js +100 -0
- package/dist/core/compose/features/textinput.js +2 -0
- package/dist/core/compose/features/track.js +4 -0
- package/dist/core/compose/index.d.ts +744 -8
- package/dist/core/config/component.d.ts +5 -515
- package/dist/core/config/control-label.js +5 -0
- package/dist/core/dom/index.d.ts +245 -12
- package/dist/core/index.d.ts +93 -14
- package/dist/core/shapes/index.d.ts +286 -6
- package/dist/core/state/index.d.ts +98 -5
- package/dist/core/theme/index.d.ts +80 -4
- package/dist/core/utils/index.d.ts +98 -9
- package/dist/elements/bottom-sheet.js +3 -2
- package/dist/elements/css/badge.js +2 -2
- package/dist/elements/css/bottom-app-bar.js +2 -2
- package/dist/elements/css/bottom-sheet.css +1 -1
- package/dist/elements/css/bottom-sheet.js +2 -2
- package/dist/elements/css/button-group.css +1 -1
- package/dist/elements/css/button-group.js +2 -2
- package/dist/elements/css/button.css +1 -1
- package/dist/elements/css/button.js +2 -2
- package/dist/elements/css/card.js +2 -2
- package/dist/elements/css/carousel.js +2 -2
- package/dist/elements/css/checkbox.js +2 -2
- package/dist/elements/css/chips.js +2 -2
- package/dist/elements/css/datepicker.css +1 -1
- package/dist/elements/css/datepicker.js +2 -2
- package/dist/elements/css/dialog.css +1 -1
- package/dist/elements/css/dialog.js +2 -2
- package/dist/elements/css/divider.js +2 -2
- package/dist/elements/css/drawer.css +1 -1
- package/dist/elements/css/drawer.js +2 -2
- package/dist/elements/css/extended-fab.js +2 -2
- package/dist/elements/css/fab-menu.js +2 -2
- package/dist/elements/css/fab.js +2 -2
- package/dist/elements/css/icon-button.css +1 -1
- package/dist/elements/css/icon-button.js +2 -2
- package/dist/elements/css/list.css +1 -1
- package/dist/elements/css/list.js +2 -2
- package/dist/elements/css/loading-indicator.js +2 -2
- package/dist/elements/css/menu.css +1 -1
- package/dist/elements/css/menu.js +2 -2
- package/dist/elements/css/navigation-bar.js +2 -2
- package/dist/elements/css/navigation-rail.js +2 -2
- package/dist/elements/css/progress.js +2 -2
- package/dist/elements/css/radios.js +2 -2
- package/dist/elements/css/ripple.js +2 -2
- package/dist/elements/css/search.js +2 -2
- package/dist/elements/css/select.js +2 -2
- package/dist/elements/css/side-sheet.css +1 -1
- package/dist/elements/css/side-sheet.js +2 -2
- package/dist/elements/css/slider.js +2 -2
- package/dist/elements/css/snackbar.css +1 -1
- package/dist/elements/css/snackbar.js +2 -2
- package/dist/elements/css/split-button.js +2 -2
- package/dist/elements/css/switch.js +2 -2
- package/dist/elements/css/tabs.js +2 -2
- package/dist/elements/css/text-field.css +1 -1
- package/dist/elements/css/text-field.js +2 -2
- package/dist/elements/css/timepicker.css +1 -1
- package/dist/elements/css/timepicker.js +2 -2
- package/dist/elements/css/toolbar.css +1 -1
- package/dist/elements/css/toolbar.js +2 -2
- package/dist/elements/css/tooltip.js +2 -2
- package/dist/elements/css/top-app-bar.js +2 -2
- package/dist/elements/datepicker.js +2 -0
- package/dist/elements/define.js +12 -1
- package/dist/elements/drawer.js +2 -0
- package/dist/elements/index.d.ts +3946 -376
- package/dist/elements/menu.js +17 -3
- 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 +2 -2
- package/dist/elements/preupgrade/button.css +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/elements/preupgrade/list.css +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/elements/preupgrade.js +2 -3
- package/dist/elements/radios.js +5 -1
- package/dist/elements/search.js +19 -3
- package/dist/elements/sheet.js +16 -6
- package/dist/elements/side-sheet.js +5 -3
- package/dist/elements/snackbar.js +2 -0
- package/dist/elements/styles.js +39 -0
- package/dist/elements/switch.js +1 -0
- package/dist/elements/tabs.js +6 -0
- package/dist/elements/text-field.js +2 -0
- package/dist/elements/timepicker.js +1 -0
- package/dist/elements/toolbar.js +13 -1
- package/dist/index.d.ts +78 -4
- package/dist/react/index.d.ts +106 -52
- package/dist/react/jsx.d.ts +50 -49
- package/dist/solid/index.d.ts +106 -52
- package/dist/solid/jsx.d.ts +81 -76
- 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 +2 -2
- package/dist/styles/button-group.css +2 -2
- package/dist/styles/button.css +2 -2
- 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 +2 -2
- package/dist/styles/dialog.css +2 -2
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +2 -2
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +2 -2
- package/dist/styles/list.css +2 -2
- 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 +2 -2
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +2 -2
- 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 +2 -2
- package/dist/styles/timepicker.css +2 -2
- package/dist/styles/toolbar.css +2 -2
- 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/BottomAppBar.svelte.d.ts +1 -0
- package/dist/theme/2025.d.ts +3 -0
- package/dist/theme/2025.js +2 -0
- package/dist/theme/index.js +65 -17
- package/dist/theme/spec2025.d.ts +56 -0
- package/dist/theme/spec2025.js +37 -0
- package/dist/theme/vendor/dynamiccolor/color_spec_2025.js +846 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_color.d.ts +7 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_color.js +9 -5
- package/dist/theme/vendor/dynamiccolor/dynamic_scheme.d.ts +12 -0
- package/dist/theme/vendor/dynamiccolor/dynamic_scheme.js +13 -9
- package/dist/theme/vendor/dynamiccolor/spec_2025.js +263 -0
- package/dist/theme/vendor/dynamiccolor/spec_extensions.js +70 -0
- package/dist/theme/vendor/palettes/tonal_palette.d.ts +23 -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/index.d.ts +192 -53
- package/package.json +12 -3
- package/src/styles/abstract/_functions.scss +22 -1
- package/src/styles/abstract/_variables.scss +0 -2
- package/src/styles/base/_tokens.scss +12 -0
- package/src/styles/components/_bottom-sheet.scss +1 -0
- package/src/styles/components/_button-group.scss +9 -5
- package/src/styles/components/_button.scss +28 -12
- package/src/styles/components/_datepicker.scss +1 -0
- package/src/styles/components/_dialog.scss +1 -0
- package/src/styles/components/_drawer.scss +33 -65
- package/src/styles/components/_icon-button.scss +32 -33
- package/src/styles/components/_list.scss +54 -6
- package/src/styles/components/_menu.scss +65 -46
- package/src/styles/components/_side-sheet.scss +1 -0
- package/src/styles/components/_snackbar.scss +1 -0
- package/src/styles/components/_text-field.scss +17 -109
- package/src/styles/components/_timepicker.scss +2 -1
- package/src/styles/components/_toolbar.scss +23 -6
- package/src/styles/elements/_button-group.scss +17 -4
- package/src/styles/elements/_button.scss +3 -2
- package/src/styles/elements/_drawer.scss +2 -1
- package/src/styles/elements/_field.scss +25 -14
- package/src/styles/elements/_icon-button.scss +8 -3
- package/src/styles/elements/_list.scss +3 -2
- package/src/styles/elements/_text-field.scss +71 -47
- package/dist/components/badge/badge.d.ts +0 -7
- package/dist/components/badge/types.d.ts +0 -152
- package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +0 -6
- package/dist/components/bottom-app-bar/types.d.ts +0 -63
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +0 -7
- package/dist/components/bottom-sheet/types.d.ts +0 -98
- package/dist/components/button/button.d.ts +0 -7
- package/dist/components/button-group/button-group.d.ts +0 -7
- package/dist/components/button-group/types.d.ts +0 -227
- package/dist/components/card/card.d.ts +0 -7
- package/dist/components/card/content.d.ts +0 -22
- package/dist/components/card/types.d.ts +0 -272
- package/dist/components/carousel/carousel.d.ts +0 -4
- package/dist/components/carousel/types.d.ts +0 -81
- package/dist/components/checkbox/checkbox.d.ts +0 -8
- package/dist/components/checkbox/types.d.ts +0 -194
- package/dist/components/chips/chips.d.ts +0 -7
- package/dist/components/chips/factories.d.ts +0 -9
- package/dist/components/chips/types.d.ts +0 -304
- package/dist/components/datepicker/datepicker.d.ts +0 -7
- package/dist/components/datepicker/types.d.ts +0 -296
- package/dist/components/datepicker/types.js +0 -17
- package/dist/components/dialog/dialog.d.ts +0 -8
- package/dist/components/dialog/types.d.ts +0 -311
- package/dist/components/divider/config.d.ts +0 -43
- package/dist/components/divider/divider.d.ts +0 -7
- package/dist/components/divider/types.d.ts +0 -43
- package/dist/components/drawer/drawer.d.ts +0 -7
- package/dist/components/drawer/types.d.ts +0 -179
- package/dist/components/extended-fab/extended-fab.d.ts +0 -7
- package/dist/components/extended-fab/types.d.ts +0 -208
- package/dist/components/fab/fab.d.ts +0 -7
- package/dist/components/fab/types.d.ts +0 -168
- package/dist/components/fab-menu/fab-menu.d.ts +0 -8
- package/dist/components/fab-menu/types.d.ts +0 -91
- package/dist/components/icon-button/icon-button.d.ts +0 -7
- package/dist/components/index.d.ts +0 -81
- package/dist/components/list/list.d.ts +0 -7
- package/dist/components/list/types.d.ts +0 -257
- package/dist/components/loading-indicator/features/renderer.d.ts +0 -28
- package/dist/components/loading-indicator/loading-indicator.d.ts +0 -7
- package/dist/components/loading-indicator/types.d.ts +0 -53
- package/dist/components/menu/menu.d.ts +0 -7
- package/dist/components/navigation-bar/navigation-bar.d.ts +0 -3
- package/dist/components/navigation-bar/types.d.ts +0 -59
- package/dist/components/navigation-rail/navigation-rail.d.ts +0 -3
- package/dist/components/navigation-rail/types.d.ts +0 -87
- package/dist/components/progress/progress.d.ts +0 -7
- package/dist/components/radios/radios.d.ts +0 -7
- package/dist/components/radios/types.d.ts +0 -142
- package/dist/components/search/search.d.ts +0 -7
- package/dist/components/search/types.d.ts +0 -235
- package/dist/components/select/select.d.ts +0 -7
- package/dist/components/select/types.d.ts +0 -232
- package/dist/components/side-sheet/side-sheet.d.ts +0 -7
- package/dist/components/side-sheet/types.d.ts +0 -89
- package/dist/components/slider/slider.d.ts +0 -7
- package/dist/components/slider/types.d.ts +0 -213
- package/dist/components/snackbar/snackbar.d.ts +0 -9
- package/dist/components/snackbar/types.d.ts +0 -180
- package/dist/components/split-button/split-button.d.ts +0 -7
- package/dist/components/switch/switch.d.ts +0 -7
- package/dist/components/switch/types.d.ts +0 -166
- package/dist/components/tabs/indicator.d.ts +0 -44
- package/dist/components/tabs/tab.d.ts +0 -7
- package/dist/components/tabs/tabs.d.ts +0 -7
- package/dist/components/tabs/types.d.ts +0 -300
- package/dist/components/tabs/utils.d.ts +0 -46
- package/dist/components/text-field/features/trailing-icon.d.ts +0 -54
- package/dist/components/text-field/text-field.d.ts +0 -7
- package/dist/components/text-field/types.d.ts +0 -256
- package/dist/components/timepicker/timepicker.d.ts +0 -3
- package/dist/components/timepicker/types.d.ts +0 -254
- package/dist/components/toolbar/toolbar.d.ts +0 -8
- package/dist/components/toolbar/types.d.ts +0 -125
- package/dist/components/tooltip/tooltip.d.ts +0 -7
- package/dist/components/tooltip/types.d.ts +0 -137
- package/dist/components/top-app-bar/top-app-bar.d.ts +0 -7
- package/dist/components/top-app-bar/types.d.ts +0 -80
- package/dist/core/canvas/animation.d.ts +0 -20
- package/dist/core/canvas/drawing.d.ts +0 -67
- package/dist/core/canvas/resize.d.ts +0 -8
- package/dist/core/canvas/utils.d.ts +0 -62
- package/dist/core/compose/base.d.ts +0 -18
- package/dist/core/compose/features/badge.d.ts +0 -27
- package/dist/core/compose/features/checkable.d.ts +0 -33
- package/dist/core/compose/features/debounce.d.ts +0 -45
- package/dist/core/compose/features/disabled.d.ts +0 -26
- package/dist/core/compose/features/events.d.ts +0 -31
- package/dist/core/compose/features/index.d.ts +0 -34
- package/dist/core/compose/features/input.d.ts +0 -54
- package/dist/core/compose/features/lifecycle.d.ts +0 -41
- package/dist/core/compose/features/position.d.ts +0 -36
- package/dist/core/compose/features/ripple.d.ts +0 -35
- package/dist/core/compose/features/size.d.ts +0 -12
- package/dist/core/compose/features/style.d.ts +0 -11
- package/dist/core/compose/features/textinput.d.ts +0 -66
- package/dist/core/compose/features/textlabel.d.ts +0 -34
- package/dist/core/compose/features/throttle.d.ts +0 -38
- package/dist/core/compose/features/track.d.ts +0 -24
- package/dist/core/compose/features/variant.d.ts +0 -12
- package/dist/core/compose/features/withEvents.d.ts +0 -27
- package/dist/core/compose/pipe.d.ts +0 -55
- package/dist/core/compose/utils/type-guards.d.ts +0 -17
- package/dist/core/config.d.ts +0 -72
- package/dist/core/dom/attributes.d.ts +0 -34
- package/dist/core/dom/classes.d.ts +0 -29
- package/dist/core/dom/events.d.ts +0 -43
- package/dist/core/dom/focus.d.ts +0 -15
- package/dist/core/dom/html.d.ts +0 -16
- package/dist/core/dom/layer.d.ts +0 -57
- package/dist/core/dom/roving.d.ts +0 -18
- package/dist/core/shapes/cubic.d.ts +0 -45
- package/dist/core/shapes/material.d.ts +0 -131
- package/dist/core/shapes/polygon.d.ts +0 -38
- package/dist/core/state/events.d.ts +0 -25
- package/dist/core/state/store.d.ts +0 -60
- package/dist/core/theme/shape.d.ts +0 -5
- package/dist/core/theme/tokens.d.ts +0 -67
- package/dist/core/utils/background.d.ts +0 -13
- package/dist/core/utils/color.d.ts +0 -6
- package/dist/core/utils/object.d.ts +0 -11
- package/dist/core/utils/performance.d.ts +0 -32
- package/dist/core/utils/theme.d.ts +0 -17
- package/dist/core/utils/url.d.ts +0 -6
- package/dist/elements/badge.d.ts +0 -57
- package/dist/elements/bottom-app-bar.d.ts +0 -49
- package/dist/elements/bottom-sheet.d.ts +0 -107
- package/dist/elements/button-group.d.ts +0 -142
- package/dist/elements/button.d.ts +0 -101
- package/dist/elements/card.d.ts +0 -69
- package/dist/elements/carousel.d.ts +0 -119
- package/dist/elements/checkbox.d.ts +0 -97
- package/dist/elements/chips.d.ts +0 -126
- package/dist/elements/css/badge.d.ts +0 -1
- package/dist/elements/css/bottom-app-bar.d.ts +0 -1
- package/dist/elements/css/bottom-sheet.d.ts +0 -1
- package/dist/elements/css/button-group.d.ts +0 -1
- package/dist/elements/css/button.d.ts +0 -1
- package/dist/elements/css/card.d.ts +0 -1
- package/dist/elements/css/carousel.d.ts +0 -1
- package/dist/elements/css/checkbox.d.ts +0 -1
- package/dist/elements/css/chips.d.ts +0 -1
- package/dist/elements/css/datepicker.d.ts +0 -1
- package/dist/elements/css/dialog.d.ts +0 -1
- package/dist/elements/css/divider.d.ts +0 -1
- package/dist/elements/css/drawer.d.ts +0 -1
- package/dist/elements/css/extended-fab.d.ts +0 -1
- package/dist/elements/css/fab-menu.d.ts +0 -1
- package/dist/elements/css/fab.d.ts +0 -1
- package/dist/elements/css/icon-button.d.ts +0 -1
- package/dist/elements/css/list.d.ts +0 -1
- package/dist/elements/css/loading-indicator.d.ts +0 -1
- package/dist/elements/css/menu.d.ts +0 -1
- package/dist/elements/css/navigation-bar.d.ts +0 -1
- package/dist/elements/css/navigation-rail.d.ts +0 -1
- package/dist/elements/css/progress.d.ts +0 -1
- package/dist/elements/css/radios.d.ts +0 -1
- package/dist/elements/css/ripple.d.ts +0 -1
- package/dist/elements/css/search.d.ts +0 -1
- package/dist/elements/css/select.d.ts +0 -1
- package/dist/elements/css/side-sheet.d.ts +0 -1
- package/dist/elements/css/slider.d.ts +0 -1
- package/dist/elements/css/snackbar.d.ts +0 -1
- package/dist/elements/css/split-button.d.ts +0 -1
- package/dist/elements/css/switch.d.ts +0 -1
- package/dist/elements/css/tabs.d.ts +0 -1
- package/dist/elements/css/text-field.d.ts +0 -1
- package/dist/elements/css/timepicker.d.ts +0 -1
- package/dist/elements/css/toolbar.d.ts +0 -1
- package/dist/elements/css/tooltip.d.ts +0 -1
- package/dist/elements/css/top-app-bar.d.ts +0 -1
- package/dist/elements/datepicker.d.ts +0 -126
- package/dist/elements/dialog.d.ts +0 -101
- package/dist/elements/divider.d.ts +0 -52
- package/dist/elements/drawer.d.ts +0 -119
- package/dist/elements/extended-fab.d.ts +0 -97
- package/dist/elements/fab-menu.d.ts +0 -102
- package/dist/elements/fab.d.ts +0 -71
- package/dist/elements/list.d.ts +0 -127
- package/dist/elements/loading-indicator.d.ts +0 -47
- package/dist/elements/menu.d.ts +0 -144
- package/dist/elements/navigation-bar.d.ts +0 -104
- package/dist/elements/navigation-rail.d.ts +0 -145
- package/dist/elements/progress.d.ts +0 -87
- package/dist/elements/radios.d.ts +0 -91
- package/dist/elements/search.d.ts +0 -202
- package/dist/elements/select.d.ts +0 -119
- package/dist/elements/side-sheet.d.ts +0 -83
- package/dist/elements/slider.d.ts +0 -160
- package/dist/elements/snackbar.d.ts +0 -87
- package/dist/elements/split-button.d.ts +0 -87
- package/dist/elements/switch.d.ts +0 -94
- package/dist/elements/tabs.d.ts +0 -71
- package/dist/elements/text-field.d.ts +0 -170
- package/dist/elements/timepicker.d.ts +0 -143
- package/dist/elements/toolbar.d.ts +0 -90
- package/dist/elements/tooltip.d.ts +0 -75
- package/dist/elements/top-app-bar.d.ts +0 -60
- package/dist/react/badge.d.ts +0 -4
- package/dist/react/bottom-app-bar.d.ts +0 -4
- package/dist/react/bottom-sheet.d.ts +0 -4
- package/dist/react/button-group-item.d.ts +0 -3
- package/dist/react/button-group.d.ts +0 -7
- package/dist/react/button.d.ts +0 -5
- package/dist/react/card.d.ts +0 -4
- package/dist/react/carousel-item.d.ts +0 -3
- package/dist/react/carousel.d.ts +0 -4
- package/dist/react/checkbox.d.ts +0 -4
- package/dist/react/chip.d.ts +0 -3
- package/dist/react/chips.d.ts +0 -4
- package/dist/react/datepicker.d.ts +0 -4
- package/dist/react/dialog.d.ts +0 -7
- package/dist/react/divider.d.ts +0 -4
- package/dist/react/drawer-item.d.ts +0 -3
- package/dist/react/drawer.d.ts +0 -4
- package/dist/react/extended-fab.d.ts +0 -4
- package/dist/react/fab-menu-item.d.ts +0 -3
- package/dist/react/fab-menu.d.ts +0 -6
- package/dist/react/fab.d.ts +0 -4
- package/dist/react/icon-button.d.ts +0 -4
- package/dist/react/list-item.d.ts +0 -3
- package/dist/react/list.d.ts +0 -4
- package/dist/react/loading-indicator.d.ts +0 -4
- package/dist/react/menu-item.d.ts +0 -3
- package/dist/react/menu.d.ts +0 -4
- package/dist/react/navigation-bar-item.d.ts +0 -3
- package/dist/react/navigation-bar.d.ts +0 -4
- package/dist/react/navigation-rail-item.d.ts +0 -3
- package/dist/react/navigation-rail.d.ts +0 -4
- package/dist/react/progress.d.ts +0 -4
- package/dist/react/radio.d.ts +0 -3
- package/dist/react/radios.d.ts +0 -4
- package/dist/react/search-suggestion.d.ts +0 -3
- package/dist/react/search.d.ts +0 -4
- package/dist/react/select-option.d.ts +0 -3
- package/dist/react/select.d.ts +0 -6
- package/dist/react/side-sheet.d.ts +0 -4
- package/dist/react/slider.d.ts +0 -4
- package/dist/react/snackbar.d.ts +0 -7
- package/dist/react/split-button.d.ts +0 -7
- package/dist/react/switch.d.ts +0 -4
- package/dist/react/tab.d.ts +0 -3
- package/dist/react/tabs.d.ts +0 -7
- package/dist/react/text-field.d.ts +0 -4
- package/dist/react/timepicker.d.ts +0 -4
- package/dist/react/toolbar.d.ts +0 -5
- package/dist/react/tooltip.d.ts +0 -4
- package/dist/react/top-app-bar.d.ts +0 -4
- package/dist/solid/badge.d.ts +0 -4
- package/dist/solid/bottom-app-bar.d.ts +0 -4
- package/dist/solid/bottom-sheet.d.ts +0 -4
- package/dist/solid/button-group-item.d.ts +0 -3
- package/dist/solid/button-group.d.ts +0 -7
- package/dist/solid/button.d.ts +0 -5
- package/dist/solid/card.d.ts +0 -4
- package/dist/solid/carousel-item.d.ts +0 -3
- package/dist/solid/carousel.d.ts +0 -4
- package/dist/solid/checkbox.d.ts +0 -4
- package/dist/solid/chip.d.ts +0 -3
- package/dist/solid/chips.d.ts +0 -4
- package/dist/solid/datepicker.d.ts +0 -4
- package/dist/solid/dialog.d.ts +0 -7
- package/dist/solid/divider.d.ts +0 -4
- package/dist/solid/drawer-item.d.ts +0 -3
- package/dist/solid/drawer.d.ts +0 -4
- package/dist/solid/extended-fab.d.ts +0 -4
- package/dist/solid/fab-menu-item.d.ts +0 -3
- package/dist/solid/fab-menu.d.ts +0 -6
- package/dist/solid/fab.d.ts +0 -4
- package/dist/solid/icon-button.d.ts +0 -4
- package/dist/solid/list-item.d.ts +0 -3
- package/dist/solid/list.d.ts +0 -4
- package/dist/solid/loading-indicator.d.ts +0 -4
- package/dist/solid/menu-item.d.ts +0 -3
- package/dist/solid/menu.d.ts +0 -4
- package/dist/solid/navigation-bar-item.d.ts +0 -3
- package/dist/solid/navigation-bar.d.ts +0 -4
- package/dist/solid/navigation-rail-item.d.ts +0 -3
- package/dist/solid/navigation-rail.d.ts +0 -4
- package/dist/solid/progress.d.ts +0 -4
- package/dist/solid/radio.d.ts +0 -3
- package/dist/solid/radios.d.ts +0 -4
- package/dist/solid/search-suggestion.d.ts +0 -3
- package/dist/solid/search.d.ts +0 -4
- package/dist/solid/select-option.d.ts +0 -3
- package/dist/solid/select.d.ts +0 -6
- package/dist/solid/side-sheet.d.ts +0 -4
- package/dist/solid/slider.d.ts +0 -4
- package/dist/solid/snackbar.d.ts +0 -7
- package/dist/solid/split-button.d.ts +0 -7
- package/dist/solid/switch.d.ts +0 -4
- package/dist/solid/tab.d.ts +0 -3
- package/dist/solid/tabs.d.ts +0 -7
- package/dist/solid/text-field.d.ts +0 -4
- package/dist/solid/timepicker.d.ts +0 -4
- package/dist/solid/toolbar.d.ts +0 -5
- package/dist/solid/tooltip.d.ts +0 -4
- package/dist/solid/top-app-bar.d.ts +0 -4
- package/dist/styles/badge.d.ts +0 -1
- package/dist/styles/base-lite.d.ts +0 -1
- package/dist/styles/base.d.ts +0 -1
- package/dist/styles/bottom-app-bar.d.ts +0 -1
- package/dist/styles/bottom-sheet.d.ts +0 -1
- package/dist/styles/button-group.d.ts +0 -1
- package/dist/styles/button.d.ts +0 -1
- package/dist/styles/card.d.ts +0 -1
- package/dist/styles/carousel.d.ts +0 -1
- package/dist/styles/checkbox.d.ts +0 -1
- package/dist/styles/chips.d.ts +0 -1
- package/dist/styles/contrast.d.ts +0 -1
- package/dist/styles/datepicker.d.ts +0 -1
- package/dist/styles/dialog.d.ts +0 -1
- package/dist/styles/divider.d.ts +0 -1
- package/dist/styles/drawer.d.ts +0 -1
- package/dist/styles/extended-fab.d.ts +0 -1
- package/dist/styles/fab-menu.d.ts +0 -1
- package/dist/styles/fab.d.ts +0 -1
- package/dist/styles/icon-button.d.ts +0 -1
- package/dist/styles/list.d.ts +0 -1
- package/dist/styles/loading-indicator.d.ts +0 -1
- package/dist/styles/menu.d.ts +0 -1
- package/dist/styles/navigation-bar.d.ts +0 -1
- package/dist/styles/navigation-rail.d.ts +0 -1
- package/dist/styles/progress.d.ts +0 -1
- package/dist/styles/radios.d.ts +0 -1
- package/dist/styles/search.d.ts +0 -1
- package/dist/styles/select.d.ts +0 -1
- package/dist/styles/side-sheet.d.ts +0 -1
- package/dist/styles/slider.d.ts +0 -1
- package/dist/styles/snackbar.d.ts +0 -1
- package/dist/styles/split-button.d.ts +0 -1
- package/dist/styles/switch.d.ts +0 -1
- package/dist/styles/tabs.d.ts +0 -1
- package/dist/styles/text-field.d.ts +0 -1
- package/dist/styles/timepicker.d.ts +0 -1
- package/dist/styles/toolbar.d.ts +0 -1
- package/dist/styles/tooltip.d.ts +0 -1
- package/dist/styles/top-app-bar.d.ts +0 -1
- package/dist/styles/typography.d.ts +0 -1
- package/dist/styles/utilities.d.ts +0 -1
- package/dist/theme/roles.js +0 -68
- package/dist/theme/vendor/scheme/scheme_content.js +0 -30
- package/dist/theme/vendor/scheme/scheme_expressive.js +0 -30
- package/dist/theme/vendor/scheme/scheme_fidelity.js +0 -30
- package/dist/theme/vendor/scheme/scheme_monochrome.js +0 -30
- package/dist/theme/vendor/scheme/scheme_neutral.js +0 -30
- package/dist/theme/vendor/scheme/scheme_tonal_spot.js +0 -30
- package/dist/theme/vendor/scheme/scheme_vibrant.js +0 -30
- package/dist/vue/badge.d.ts +0 -4
- package/dist/vue/bottom-app-bar.d.ts +0 -4
- package/dist/vue/bottom-sheet.d.ts +0 -4
- package/dist/vue/button-group-item.d.ts +0 -3
- package/dist/vue/button-group.d.ts +0 -7
- package/dist/vue/button.d.ts +0 -5
- package/dist/vue/card.d.ts +0 -4
- package/dist/vue/carousel-item.d.ts +0 -3
- package/dist/vue/carousel.d.ts +0 -4
- package/dist/vue/checkbox.d.ts +0 -4
- package/dist/vue/chip.d.ts +0 -3
- package/dist/vue/chips.d.ts +0 -4
- package/dist/vue/create.d.ts +0 -73
- package/dist/vue/datepicker.d.ts +0 -4
- package/dist/vue/dialog.d.ts +0 -7
- package/dist/vue/divider.d.ts +0 -4
- package/dist/vue/drawer-item.d.ts +0 -3
- package/dist/vue/drawer.d.ts +0 -4
- package/dist/vue/extended-fab.d.ts +0 -4
- package/dist/vue/fab-menu-item.d.ts +0 -3
- package/dist/vue/fab-menu.d.ts +0 -6
- package/dist/vue/fab.d.ts +0 -4
- package/dist/vue/icon-button.d.ts +0 -4
- package/dist/vue/list-item.d.ts +0 -3
- package/dist/vue/list.d.ts +0 -4
- package/dist/vue/loading-indicator.d.ts +0 -4
- package/dist/vue/menu-item.d.ts +0 -3
- package/dist/vue/menu.d.ts +0 -4
- package/dist/vue/navigation-bar-item.d.ts +0 -3
- package/dist/vue/navigation-bar.d.ts +0 -4
- package/dist/vue/navigation-rail-item.d.ts +0 -3
- package/dist/vue/navigation-rail.d.ts +0 -4
- package/dist/vue/progress.d.ts +0 -4
- package/dist/vue/radio.d.ts +0 -3
- package/dist/vue/radios.d.ts +0 -4
- package/dist/vue/search-suggestion.d.ts +0 -3
- package/dist/vue/search.d.ts +0 -4
- package/dist/vue/select-option.d.ts +0 -3
- package/dist/vue/select.d.ts +0 -6
- package/dist/vue/side-sheet.d.ts +0 -4
- package/dist/vue/slider.d.ts +0 -4
- package/dist/vue/snackbar.d.ts +0 -7
- package/dist/vue/split-button.d.ts +0 -7
- package/dist/vue/switch.d.ts +0 -4
- package/dist/vue/tab.d.ts +0 -3
- package/dist/vue/tabs.d.ts +0 -7
- package/dist/vue/text-field.d.ts +0 -4
- package/dist/vue/timepicker.d.ts +0 -4
- package/dist/vue/toolbar.d.ts +0 -5
- package/dist/vue/tooltip.d.ts +0 -4
- package/dist/vue/top-app-bar.d.ts +0 -4
|
@@ -1,12 +1,476 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
2
|
+
import type { BadgeComponent } from "../badge/index.js";
|
|
3
|
+
import type { ButtonComponent } from "../button/types.js";
|
|
4
|
+
|
|
5
|
+
/** Tabs members read by these helpers; each one is checked before use */
|
|
6
|
+
interface TabsHost {
|
|
7
|
+
element?: HTMLElement;
|
|
8
|
+
tabs?: TabComponent[];
|
|
9
|
+
getTabs?: () => TabComponent[];
|
|
10
|
+
getActiveTab?: () => TabComponent | null;
|
|
11
|
+
setActiveTab?: (tabOrValue: TabComponent | string) => unknown;
|
|
12
|
+
handleTabClick?: (event: Event | null, tab: TabComponent) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Gets the active tab from a component
|
|
17
|
+
* @param component
|
|
18
|
+
*/
|
|
19
|
+
declare function getActiveTab(component: TabsHost): TabComponent | null;
|
|
20
|
+
|
|
21
|
+
/** A fresh id for a tab group, so two tablists can share tab values. */
|
|
22
|
+
declare function allocateTabsGroupId(): string;
|
|
23
|
+
|
|
24
|
+
/** A tab's element id within its group: `tab-<groupId>-<value>` for a value of `[A-Za-z0-9_-]`, and `tabx-<groupId>-<encoded value>` otherwise. */
|
|
25
|
+
declare const tabIdFor: (groupId: string, value: string) => string;
|
|
26
|
+
|
|
27
|
+
/** The panel id a group looks for when a page does not label its panels: `tabpanel-<groupId>-<value>`, or `tabpanelx-<groupId>-<encoded value>` for a value with other characters, as {@link tabIdFor} derives the tab's. */
|
|
28
|
+
declare const tabPanelIdFor: (groupId: string, value: string) => string;
|
|
29
|
+
|
|
30
|
+
/** Records a tab's value and group on its element: the value as `data-value`, which the panel lookup reads instead of parsing the id. */
|
|
31
|
+
declare function registerTab(element: HTMLElement, groupId: string, value: string): void;
|
|
32
|
+
|
|
33
|
+
/** The panel registered to a tab, or null. */
|
|
34
|
+
declare function findRegisteredPanel(tab: HTMLElement): HTMLElement | null;
|
|
35
|
+
|
|
36
|
+
/** Points a tab's `aria-controls` at its panel, and only at one that exists. */
|
|
37
|
+
declare function syncTabControls(element: HTMLElement): void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Updates tab panels based on active tab
|
|
41
|
+
* @param component
|
|
42
|
+
*/
|
|
43
|
+
declare function updateTabPanels(component: TabsHost): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Gives the tablist a single tab stop: the active tab, or the first enabled one when none is active.
|
|
47
|
+
* @param component
|
|
48
|
+
*/
|
|
49
|
+
declare function syncTabStops(component: TabsHost): void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sets up keyboard navigation for tabs.
|
|
53
|
+
* @param component
|
|
54
|
+
* @param options
|
|
55
|
+
*/
|
|
56
|
+
declare function setupKeyboardNavigation(component: TabsHost, options?: {
|
|
57
|
+
autoActivate?: boolean;
|
|
58
|
+
}): void;
|
|
59
|
+
|
|
60
|
+
/** Button methods the tab delegates to; each one is checked before use */
|
|
61
|
+
type TabButton = Partial<Pick<ButtonComponent, 'getValue' | 'setValue' | 'getText' | 'setText' | 'getIcon' | 'setIcon'>>;
|
|
62
|
+
|
|
63
|
+
/** Available tabs variants */
|
|
64
|
+
type TabsVariant = 'primary' | 'secondary';
|
|
65
|
+
|
|
66
|
+
/** Available tabs states */
|
|
67
|
+
type TabStates = 'active' | 'inactive' | 'disabled';
|
|
68
|
+
|
|
69
|
+
/** Configuration for the tab indicator */
|
|
70
|
+
interface IndicatorConfig {
|
|
71
|
+
/** Height of the indicator in pixels */
|
|
72
|
+
height?: number;
|
|
73
|
+
/** Width strategy for the indicator */
|
|
74
|
+
widthStrategy?: 'fixed' | 'dynamic' | 'content' | 'auto';
|
|
75
|
+
/** Fixed width in pixels (when using fixed strategy) */
|
|
76
|
+
fixedWidth?: number;
|
|
77
|
+
/** Animation duration in milliseconds */
|
|
78
|
+
animationDuration?: number;
|
|
79
|
+
/** Animation timing function */
|
|
80
|
+
animationTiming?: string;
|
|
81
|
+
/** Custom color for the indicator */
|
|
82
|
+
color?: string;
|
|
83
|
+
/** Whether the indicator shows; hide() and show() change it later */
|
|
84
|
+
visible?: boolean;
|
|
85
|
+
/** Tab variant (primary or secondary) */
|
|
86
|
+
variant?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Tab change event data interface */
|
|
90
|
+
interface TabChangeEventData {
|
|
91
|
+
/** The tab component that was activated */
|
|
92
|
+
tab: TabComponent;
|
|
93
|
+
/** The value of the activated tab, as `TabComponent.getValue()` returns it. */
|
|
94
|
+
value: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Events a single tab emits, and what each hands its handler. */
|
|
98
|
+
interface TabEvents {
|
|
99
|
+
click: (payload: ForwardedEventPayload<MouseEvent, HTMLElement>) => void;
|
|
100
|
+
focus: (event: FocusEvent) => void;
|
|
101
|
+
blur: (event: FocusEvent) => void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Events a tabs group emits. */
|
|
105
|
+
interface TabsEvents {
|
|
106
|
+
change: (event: TabChangeEventData) => void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Configuration interface for a single Tab */
|
|
110
|
+
interface TabConfig {
|
|
111
|
+
/** Id of the tab group this tab belongs to. */
|
|
112
|
+
groupId?: string;
|
|
113
|
+
/** Accessible name for a tab. */
|
|
114
|
+
ariaLabel?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Tab state that determines if it's the active destination
|
|
117
|
+
* @default 'inactive'
|
|
118
|
+
*/
|
|
119
|
+
state?: TabStates | string;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the tab is initially disabled
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
/** Initial tab text content (label) */
|
|
126
|
+
text?: string;
|
|
127
|
+
/** Initial tab icon HTML content. */
|
|
128
|
+
icon?: string;
|
|
129
|
+
/** Badge text or value to display (if applicable) */
|
|
130
|
+
badge?: string | number;
|
|
131
|
+
/** Badge configuration object */
|
|
132
|
+
badgeConfig?: {
|
|
133
|
+
variant?: string;
|
|
134
|
+
color?: string;
|
|
135
|
+
size?: string;
|
|
136
|
+
position?: string;
|
|
137
|
+
max?: number;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Icon size in pixels or other CSS units
|
|
141
|
+
* @default '24px'
|
|
142
|
+
*/
|
|
143
|
+
iconSize?: string;
|
|
144
|
+
/** Additional CSS classes to add to the tab */
|
|
145
|
+
class?: string;
|
|
146
|
+
/** Tab value attribute for identifying the selected tab */
|
|
147
|
+
value?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Whether to enable ripple effect
|
|
150
|
+
* @default true
|
|
151
|
+
*/
|
|
152
|
+
ripple?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Component prefix for class names
|
|
155
|
+
* @default 'mtrl'
|
|
156
|
+
*/
|
|
157
|
+
prefix?: string;
|
|
158
|
+
/** Component name used in class generation */
|
|
159
|
+
componentName?: string;
|
|
160
|
+
/** Ripple effect configuration */
|
|
161
|
+
rippleConfig?: {
|
|
162
|
+
/** How long, in milliseconds, a released wave lingers before it is removed */
|
|
163
|
+
duration?: number;
|
|
164
|
+
};
|
|
165
|
+
/** Variant of the tab */
|
|
166
|
+
variant?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Configuration interface for the Tabs component */
|
|
170
|
+
interface TabsConfig {
|
|
171
|
+
/** Accessible name for the tablist when it has no visible label. */
|
|
172
|
+
ariaLabel?: string;
|
|
173
|
+
/** Id for this tab group, used to build each tab's element id as `tab-<groupId>-<value>` and to find panels as `tabpanel-<groupId>-<value>`; a value with characters outside `[A-Za-z0-9_-]` gets a derived id instead (`tabIdFor`, `tabPanelIdFor`, The group id itself is not encoded: keep a pinned one to `[A-Za-z0-9_]` (generated ones are), or `tabIdFor("a-b", "c")` and `tabIdFor("a", "b-c")` coincide and a space makes an unsafe id. */
|
|
174
|
+
groupId?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Whether an arrow key also selects the tab it moves to.
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
autoActivate?: boolean;
|
|
180
|
+
/** A behaviour to apply to the group while it is created, e.g. */
|
|
181
|
+
responsive?: (tabs: TabsComponent) => void;
|
|
182
|
+
/**
|
|
183
|
+
* Tabs variant (primary or secondary)
|
|
184
|
+
* @default 'primary'
|
|
185
|
+
*/
|
|
186
|
+
variant?: TabsVariant | string;
|
|
187
|
+
/** Initial tabs to create */
|
|
188
|
+
tabs?: TabConfig[];
|
|
189
|
+
/**
|
|
190
|
+
* Whether to show the divider
|
|
191
|
+
* @default true
|
|
192
|
+
*/
|
|
193
|
+
showDivider?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Whether to enable horizontal scrolling
|
|
196
|
+
* @default true
|
|
197
|
+
*/
|
|
198
|
+
scrollable?: boolean;
|
|
199
|
+
/** Additional CSS classes for the container */
|
|
200
|
+
class?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Component prefix for class names
|
|
203
|
+
* @default 'mtrl'
|
|
204
|
+
*/
|
|
205
|
+
prefix?: string;
|
|
206
|
+
/** Event handlers registered when the tabs are created. */
|
|
207
|
+
on?: Partial<TabsEvents>;
|
|
208
|
+
/** Tab indicator configuration */
|
|
209
|
+
indicator?: IndicatorConfig;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Icon API interface for managing tab icons */
|
|
213
|
+
interface IconAPI {
|
|
214
|
+
/**
|
|
215
|
+
* Sets the icon HTML content
|
|
216
|
+
* @param html
|
|
217
|
+
*/
|
|
218
|
+
setIcon: (html: string) => IconAPI;
|
|
219
|
+
/** Gets the current icon HTML content */
|
|
220
|
+
getIcon: () => string;
|
|
221
|
+
/** Gets the icon DOM element */
|
|
222
|
+
getElement: () => HTMLElement | null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Text API interface for managing tab text */
|
|
226
|
+
interface TextAPI {
|
|
227
|
+
/**
|
|
228
|
+
* Sets the text content
|
|
229
|
+
* @param content
|
|
230
|
+
*/
|
|
231
|
+
setText: (content: string) => TextAPI;
|
|
232
|
+
/** Gets the current text content */
|
|
233
|
+
getText: () => string;
|
|
234
|
+
/** Gets the text DOM element */
|
|
235
|
+
getElement: () => HTMLElement | null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Tab component interface */
|
|
239
|
+
interface TabComponent {
|
|
240
|
+
/** The tab's DOM element */
|
|
241
|
+
element: HTMLElement;
|
|
242
|
+
/** The button the tab is built on */
|
|
243
|
+
button?: TabButton;
|
|
244
|
+
/** The tab's badge component, or `undefined`. */
|
|
245
|
+
badge?: BadgeComponent | undefined;
|
|
246
|
+
/** Gets a class name with the component's prefix */
|
|
247
|
+
getClass: (name: string) => string;
|
|
248
|
+
/** Gets the tab's value attribute */
|
|
249
|
+
getValue: () => string;
|
|
250
|
+
/** Sets the tab's value attribute */
|
|
251
|
+
setValue: (value: string) => TabComponent;
|
|
252
|
+
/** Activates the tab (sets active state) */
|
|
253
|
+
activate: () => TabComponent;
|
|
254
|
+
/** Deactivates the tab (sets inactive state) */
|
|
255
|
+
deactivate: () => TabComponent;
|
|
256
|
+
/** Checks if the tab is active */
|
|
257
|
+
isActive: () => boolean;
|
|
258
|
+
/** Enables the tab (removes disabled attribute) */
|
|
259
|
+
enable: () => TabComponent;
|
|
260
|
+
/** Disables the tab (adds disabled attribute) */
|
|
261
|
+
disable: () => TabComponent;
|
|
262
|
+
/** Whether the tab is disabled */
|
|
263
|
+
isDisabled: () => boolean;
|
|
264
|
+
/** Sets the tab's text content */
|
|
265
|
+
setText: (content: string) => TabComponent;
|
|
266
|
+
/** Sets the explicit accessible label; undefined restores text/value naming. */
|
|
267
|
+
setAriaLabel: (label: string | undefined) => TabComponent;
|
|
268
|
+
/** Gets the tab's text content */
|
|
269
|
+
getText: () => string;
|
|
270
|
+
/** Sets the tab's icon */
|
|
271
|
+
setIcon: (icon: string) => TabComponent;
|
|
272
|
+
/** Gets the tab's icon HTML content */
|
|
273
|
+
getIcon: () => string;
|
|
274
|
+
/** Sets the tab's badge */
|
|
275
|
+
setBadge: (content: string | number) => TabComponent;
|
|
276
|
+
/** Gets the tab's badge content */
|
|
277
|
+
getBadge: () => string;
|
|
278
|
+
/** Shows the tab's badge */
|
|
279
|
+
showBadge: () => TabComponent;
|
|
280
|
+
/** Hides the tab's badge */
|
|
281
|
+
hideBadge: () => TabComponent;
|
|
282
|
+
/** Gets the badge component instance, or `undefined`: it may not exist */
|
|
283
|
+
getBadgeComponent: () => BadgeComponent | undefined;
|
|
284
|
+
/** Updates the tab's layout style based on content */
|
|
285
|
+
updateLayoutStyle: () => void;
|
|
286
|
+
/**
|
|
287
|
+
* Adds an event listener to the tab.
|
|
288
|
+
* @param event
|
|
289
|
+
* @param handler
|
|
290
|
+
*/
|
|
291
|
+
on: <K extends keyof TabEvents>(event: K, handler: TabEvents[K]) => TabComponent;
|
|
292
|
+
/**
|
|
293
|
+
* Removes an event listener from the tab
|
|
294
|
+
* @param event
|
|
295
|
+
* @param handler
|
|
296
|
+
*/
|
|
297
|
+
off: <K extends keyof TabEvents>(event: K, handler: TabEvents[K]) => TabComponent;
|
|
298
|
+
/** Destroys the tab component and cleans up resources */
|
|
299
|
+
destroy: () => void;
|
|
300
|
+
/** API for managing disabled state */
|
|
301
|
+
disabled?: {
|
|
302
|
+
enable: () => void;
|
|
303
|
+
disable: () => void;
|
|
304
|
+
isDisabled: () => boolean;
|
|
305
|
+
};
|
|
306
|
+
/** API for managing component lifecycle */
|
|
307
|
+
lifecycle?: {
|
|
308
|
+
destroy: () => void;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** Tabs component interface */
|
|
313
|
+
interface TabsComponent {
|
|
314
|
+
/** Container element */
|
|
315
|
+
element: HTMLElement;
|
|
316
|
+
/**
|
|
317
|
+
* Gets a class name with the component's prefix
|
|
318
|
+
* @param name
|
|
319
|
+
*/
|
|
320
|
+
getClass: (name: string) => string;
|
|
321
|
+
/**
|
|
322
|
+
* Creates and adds a new tab to the tabs component
|
|
323
|
+
* @param config
|
|
324
|
+
*/
|
|
325
|
+
addTab: (config: TabConfig) => TabComponent;
|
|
326
|
+
/**
|
|
327
|
+
* Adds a pre-created tab to the tabs component
|
|
328
|
+
* @param tab
|
|
329
|
+
*/
|
|
330
|
+
add: (tab: TabComponent) => TabsComponent;
|
|
331
|
+
/** Gets all tabs in the container */
|
|
332
|
+
getTabs: () => TabComponent[];
|
|
333
|
+
/** Gets the active tab */
|
|
334
|
+
getActiveTab: () => TabComponent | null;
|
|
335
|
+
/** Reads the current model value without changing selection. */
|
|
336
|
+
getValue: () => string | null;
|
|
337
|
+
/** Gets the indicator component */
|
|
338
|
+
getIndicator?: () => TabIndicator;
|
|
339
|
+
/**
|
|
340
|
+
* Sets a tab as active.
|
|
341
|
+
* @param tabOrValue
|
|
342
|
+
*/
|
|
343
|
+
setActiveTab: (tabOrValue: TabComponent | string) => TabsComponent;
|
|
344
|
+
/**
|
|
345
|
+
* Removes a tab from the container
|
|
346
|
+
* @param tabOrValue
|
|
347
|
+
*/
|
|
348
|
+
removeTab: (tabOrValue: TabComponent | string) => TabsComponent;
|
|
349
|
+
/**
|
|
350
|
+
* Adds an event listener.
|
|
351
|
+
* @param event
|
|
352
|
+
* @param handler
|
|
353
|
+
*/
|
|
354
|
+
on: <K extends keyof TabsEvents>(event: K, handler: TabsEvents[K]) => TabsComponent;
|
|
355
|
+
/**
|
|
356
|
+
* Removes an event listener
|
|
357
|
+
* @param event
|
|
358
|
+
* @param handler
|
|
359
|
+
*/
|
|
360
|
+
off: <K extends keyof TabsEvents>(event: K, handler: TabsEvents[K]) => TabsComponent;
|
|
361
|
+
/**
|
|
362
|
+
* Emit one of the group's own events ({@link TabsEvents}), with its payload: the names and payloads `on` and `off` accept.
|
|
363
|
+
* @param event
|
|
364
|
+
* @param data
|
|
365
|
+
*/
|
|
366
|
+
emit?<K extends keyof TabsEvents>(event: K, data: Parameters<TabsEvents[K]>[0]): this;
|
|
367
|
+
/** Destroys the tabs component and all tabs */
|
|
368
|
+
destroy: () => void;
|
|
369
|
+
/** Activation handler shared by the component's click and keyboard paths. */
|
|
370
|
+
handleTabClick: (event: Event | null, tab: TabComponent) => void;
|
|
371
|
+
/** Scroll container owned by the scrollable feature. */
|
|
372
|
+
scrollContainer?: HTMLElement;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Creates a new Tab component following MD3 guidelines
|
|
377
|
+
* @param config
|
|
378
|
+
*/
|
|
379
|
+
/** Point a tab at its panel, but only when that panel exists. */
|
|
380
|
+
declare const createTab: (config?: TabConfig) => TabComponent;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Creates a new Tabs component following MD3 guidelines
|
|
384
|
+
* @param config
|
|
385
|
+
*/
|
|
386
|
+
declare const createTabs: (config?: TabsConfig) => TabsComponent;
|
|
387
|
+
|
|
388
|
+
/** Configuration for tab indicator */
|
|
389
|
+
interface TabIndicatorConfig {
|
|
390
|
+
/** Height of the indicator in pixels */
|
|
391
|
+
height?: number;
|
|
392
|
+
/** Width strategy - fixed size or dynamic based on tab width */
|
|
393
|
+
widthStrategy?: 'fixed' | 'dynamic' | 'content' | 'auto';
|
|
394
|
+
/** Fixed width in pixels when using fixed strategy */
|
|
395
|
+
fixedWidth?: number;
|
|
396
|
+
/** Animation duration in milliseconds */
|
|
397
|
+
animationDuration?: number;
|
|
398
|
+
/** Animation timing function */
|
|
399
|
+
animationTiming?: string;
|
|
400
|
+
/** Whether to show the indicator */
|
|
401
|
+
visible?: boolean;
|
|
402
|
+
/** CSS class prefix */
|
|
403
|
+
prefix?: string;
|
|
404
|
+
/** Custom color for the indicator */
|
|
405
|
+
color?: string;
|
|
406
|
+
/** Tabs variant (primary or secondary) */
|
|
407
|
+
variant?: string;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** Tab indicator API */
|
|
411
|
+
interface TabIndicator {
|
|
412
|
+
/** The indicator DOM element */
|
|
413
|
+
element: HTMLElement;
|
|
414
|
+
/** Move the indicator to a specific tab */
|
|
415
|
+
moveToTab: (tab: TabComponent, immediate?: boolean) => void;
|
|
416
|
+
/** Show the indicator */
|
|
417
|
+
show: () => void;
|
|
418
|
+
/** Hide the indicator */
|
|
419
|
+
hide: () => void;
|
|
420
|
+
/** Set indicator color */
|
|
421
|
+
setColor: (color: string) => void;
|
|
422
|
+
/** Update indicator position (e.g. */
|
|
423
|
+
update: () => void;
|
|
424
|
+
/** Destroy the indicator and clean up */
|
|
425
|
+
destroy: () => void;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Creates a tab indicator component
|
|
430
|
+
* @param config
|
|
431
|
+
*/
|
|
432
|
+
declare const createTabIndicator: (config?: TabIndicatorConfig) => TabIndicator;
|
|
433
|
+
|
|
434
|
+
/** Breakpoints for responsive behavior */
|
|
435
|
+
declare const RESPONSIVE_BREAKPOINTS: {
|
|
436
|
+
/** Small screens (mobile) */
|
|
437
|
+
SMALL: number;
|
|
438
|
+
/** Medium screens (tablet) */
|
|
439
|
+
MEDIUM: number;
|
|
440
|
+
/** Large screens (desktop) */
|
|
441
|
+
LARGE: number;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
/** Configuration for responsive behavior */
|
|
445
|
+
interface ResponsiveConfig {
|
|
446
|
+
/** Whether to enable responsive behavior */
|
|
447
|
+
responsive?: boolean;
|
|
448
|
+
/** Options for small screens */
|
|
449
|
+
smallScreen?: {
|
|
450
|
+
/**
|
|
451
|
+
* Layout below the small breakpoint: `icon-only` hides the labels of tabs that have an icon (the label still names the tab), `text-only` hides the icons of tabs that have a label, `icon-and-text` keeps every tab as built.
|
|
452
|
+
* @default 'icon-only'
|
|
453
|
+
*/
|
|
454
|
+
layout?: 'icon-only' | 'text-only' | 'icon-and-text';
|
|
455
|
+
};
|
|
456
|
+
/** Breakpoints. */
|
|
457
|
+
breakpoints?: {
|
|
458
|
+
small?: number;
|
|
459
|
+
medium?: number;
|
|
460
|
+
large?: number;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Enhances tabs with responsive behavior.
|
|
466
|
+
* @deprecated Pass `tabsResponsive(config)` from
|
|
467
|
+
* `material/components/tabs/responsive` as createTabs's `responsive` option
|
|
468
|
+
* instead: it takes this configuration and applies this behaviour. This
|
|
469
|
+
* function keeps working in 3.x and is removed in 4.0.
|
|
470
|
+
* @param tabs
|
|
471
|
+
* @param config
|
|
472
|
+
*/
|
|
473
|
+
declare const setupResponsiveBehavior: (tabs: TabsComponent, config?: ResponsiveConfig) => void;
|
|
474
|
+
export type { IndicatorConfig, ResponsiveConfig, TabChangeEventData, TabComponent, TabConfig, TabEvents, TabIndicator, TabsComponent, TabsConfig, TabsEvents, TabsVariant };
|
|
475
|
+
export { createTab, createTabs, createTabs as default, setupResponsiveBehavior, tabIdFor, tabPanelIdFor };
|
|
476
|
+
export { TABS_CLASSES, TABS_DEFAULTS, TABS_EVENTS, TAB_CLASSES, TAB_EVENTS, TAB_INDICATOR_WIDTH_STRATEGIES, TAB_STATES, TAB_VARIANTS } from "./constants.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import createTabs from "./tabs.js";
|
|
2
|
-
import { setupResponsiveBehavior } from "./responsive.js";
|
|
2
|
+
import { setupResponsiveBehavior } from "./responsive-legacy.js";
|
|
3
3
|
import { tabIdFor, tabPanelIdFor } from "./utils.js";
|
|
4
4
|
export { TAB_VARIANTS, TAB_STATES, TAB_INDICATOR_WIDTH_STRATEGIES, TAB_EVENTS, TABS_EVENTS, TABS_DEFAULTS, TABS_CLASSES, TAB_CLASSES, } from "./constants.js";
|
|
5
5
|
export { setupResponsiveBehavior };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const RESPONSIVE_BREAKPOINTS = {
|
|
2
|
+
SMALL: 600,
|
|
3
|
+
MEDIUM: 904,
|
|
4
|
+
LARGE: 1240
|
|
5
|
+
};
|
|
6
|
+
const LAYOUTS = ['icon-only', 'text-only', 'icon-and-text'];
|
|
7
|
+
const naturalLayout = (tab) => tab.getIcon() && tab.getText() ? 'icon-and-text' : tab.getIcon() ? 'icon-only' : 'text-only';
|
|
8
|
+
export const setupResponsiveBehavior = (tabs, config = {}) => {
|
|
9
|
+
if (config.responsive === false)
|
|
10
|
+
return;
|
|
11
|
+
const small = config.breakpoints?.small || RESPONSIVE_BREAKPOINTS.SMALL;
|
|
12
|
+
const smallLayout = config.smallScreen?.layout || 'icon-only';
|
|
13
|
+
let isSmall = false;
|
|
14
|
+
const layoutFor = (tab) => {
|
|
15
|
+
const natural = naturalLayout(tab);
|
|
16
|
+
if (!isSmall || natural !== 'icon-and-text' || smallLayout === 'icon-and-text')
|
|
17
|
+
return natural;
|
|
18
|
+
return smallLayout;
|
|
19
|
+
};
|
|
20
|
+
const apply = (tab) => {
|
|
21
|
+
const layout = layoutFor(tab);
|
|
22
|
+
for (const name of LAYOUTS) {
|
|
23
|
+
tab.element.classList.toggle(`${tab.getClass('tab')}--${name}`, name === layout);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const followed = new WeakSet();
|
|
27
|
+
const follow = (tab) => {
|
|
28
|
+
if (followed.has(tab))
|
|
29
|
+
return;
|
|
30
|
+
followed.add(tab);
|
|
31
|
+
const own = tab.updateLayoutStyle.bind(tab);
|
|
32
|
+
tab.updateLayoutStyle = () => {
|
|
33
|
+
own();
|
|
34
|
+
apply(tab);
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const updateLayout = () => {
|
|
38
|
+
isSmall = window.innerWidth < small;
|
|
39
|
+
tabs.getTabs().forEach(tab => {
|
|
40
|
+
follow(tab);
|
|
41
|
+
apply(tab);
|
|
42
|
+
});
|
|
43
|
+
tabs.element.classList.toggle(`${tabs.getClass('tabs')}--responsive-small`, isSmall);
|
|
44
|
+
};
|
|
45
|
+
updateLayout();
|
|
46
|
+
for (const method of ['addTab', 'add']) {
|
|
47
|
+
const original = tabs[method];
|
|
48
|
+
tabs[method] = (...args) => {
|
|
49
|
+
const result = original.apply(tabs, args);
|
|
50
|
+
updateLayout();
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const resizeObserver = new ResizeObserver(updateLayout);
|
|
55
|
+
resizeObserver.observe(document.body);
|
|
56
|
+
const host = tabs;
|
|
57
|
+
host._resizeObserver = resizeObserver;
|
|
58
|
+
const originalDestroy = tabs.destroy;
|
|
59
|
+
tabs.destroy = function () {
|
|
60
|
+
if (this._resizeObserver) {
|
|
61
|
+
this._resizeObserver.disconnect();
|
|
62
|
+
}
|
|
63
|
+
originalDestroy.call(this);
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Medium screens (tablet) */
|
|
7
|
-
MEDIUM: number;
|
|
8
|
-
/** Large screens (desktop) */
|
|
9
|
-
LARGE: number;
|
|
10
|
-
};
|
|
11
|
-
/** Configuration for responsive behavior */
|
|
12
|
-
export interface ResponsiveConfig {
|
|
13
|
-
/** Whether to enable responsive behavior */
|
|
14
|
-
responsive?: boolean;
|
|
15
|
-
/** Options for small screens */
|
|
16
|
-
smallScreen?: {
|
|
17
|
-
/**
|
|
18
|
-
* Layout below the small breakpoint: `icon-only` hides the labels of tabs that have an icon (the label still names the tab), `text-only` hides the icons of tabs that have a label, `icon-and-text` keeps every tab as built.
|
|
19
|
-
* @default 'icon-only'
|
|
20
|
-
*/
|
|
21
|
-
layout?: 'icon-only' | 'text-only' | 'icon-and-text';
|
|
22
|
-
};
|
|
23
|
-
/** Breakpoints. */
|
|
24
|
-
breakpoints?: {
|
|
25
|
-
small?: number;
|
|
26
|
-
medium?: number;
|
|
27
|
-
large?: number;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
1
|
+
import type { ResponsiveConfig } from "./index.js";
|
|
2
|
+
import type { TabsComponent } from "./index.js";
|
|
3
|
+
export type { ResponsiveConfig } from "./index.js";
|
|
4
|
+
/** The behaviour `tabsResponsive` builds, applied by `createTabs` while the group is created. */
|
|
5
|
+
export type TabsResponsive = (tabs: TabsComponent) => void;
|
|
30
6
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param tabs
|
|
7
|
+
* Creates the `responsive` option for `createTabs`.
|
|
33
8
|
* @param config
|
|
34
9
|
*/
|
|
35
|
-
export declare const
|
|
10
|
+
export declare const tabsResponsive: (config?: ResponsiveConfig) => TabsResponsive;
|
|
@@ -1,65 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
LARGE: 1240
|
|
5
|
-
};
|
|
6
|
-
const LAYOUTS = ['icon-only', 'text-only', 'icon-and-text'];
|
|
7
|
-
const naturalLayout = (tab) => tab.getIcon() && tab.getText() ? 'icon-and-text' : tab.getIcon() ? 'icon-only' : 'text-only';
|
|
8
|
-
export const setupResponsiveBehavior = (tabs, config = {}) => {
|
|
9
|
-
if (config.responsive === false)
|
|
1
|
+
import { setupResponsiveBehavior } from "./responsive-legacy.js";
|
|
2
|
+
export const tabsResponsive = (config = {}) => (tabs) => {
|
|
3
|
+
if (typeof window === 'undefined' || typeof ResizeObserver === 'undefined')
|
|
10
4
|
return;
|
|
11
|
-
|
|
12
|
-
const smallLayout = config.smallScreen?.layout || 'icon-only';
|
|
13
|
-
let isSmall = false;
|
|
14
|
-
const layoutFor = (tab) => {
|
|
15
|
-
const natural = naturalLayout(tab);
|
|
16
|
-
if (!isSmall || natural !== 'icon-and-text' || smallLayout === 'icon-and-text')
|
|
17
|
-
return natural;
|
|
18
|
-
return smallLayout;
|
|
19
|
-
};
|
|
20
|
-
const apply = (tab) => {
|
|
21
|
-
const layout = layoutFor(tab);
|
|
22
|
-
for (const name of LAYOUTS) {
|
|
23
|
-
tab.element.classList.toggle(`${tab.getClass('tab')}--${name}`, name === layout);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const followed = new WeakSet();
|
|
27
|
-
const follow = (tab) => {
|
|
28
|
-
if (followed.has(tab))
|
|
29
|
-
return;
|
|
30
|
-
followed.add(tab);
|
|
31
|
-
const own = tab.updateLayoutStyle.bind(tab);
|
|
32
|
-
tab.updateLayoutStyle = () => {
|
|
33
|
-
own();
|
|
34
|
-
apply(tab);
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const updateLayout = () => {
|
|
38
|
-
isSmall = window.innerWidth < small;
|
|
39
|
-
tabs.getTabs().forEach(tab => {
|
|
40
|
-
follow(tab);
|
|
41
|
-
apply(tab);
|
|
42
|
-
});
|
|
43
|
-
tabs.element.classList.toggle(`${tabs.getClass('tabs')}--responsive-small`, isSmall);
|
|
44
|
-
};
|
|
45
|
-
updateLayout();
|
|
46
|
-
for (const method of ['addTab', 'add']) {
|
|
47
|
-
const original = tabs[method];
|
|
48
|
-
tabs[method] = (...args) => {
|
|
49
|
-
const result = original.apply(tabs, args);
|
|
50
|
-
updateLayout();
|
|
51
|
-
return result;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const resizeObserver = new ResizeObserver(updateLayout);
|
|
55
|
-
resizeObserver.observe(document.body);
|
|
56
|
-
const host = tabs;
|
|
57
|
-
host._resizeObserver = resizeObserver;
|
|
58
|
-
const originalDestroy = tabs.destroy;
|
|
59
|
-
tabs.destroy = function () {
|
|
60
|
-
if (this._resizeObserver) {
|
|
61
|
-
this._resizeObserver.disconnect();
|
|
62
|
-
}
|
|
63
|
-
originalDestroy.call(this);
|
|
64
|
-
};
|
|
5
|
+
setupResponsiveBehavior(tabs, config);
|
|
65
6
|
};
|