material 3.9.0 → 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/index.d.ts +141 -4
- 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 +1 -0
- 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/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/datepicker.js +62 -84
- package/dist/components/datepicker/index.d.ts +313 -2
- package/dist/components/datepicker/render.js +22 -18
- 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/list/features/anatomy.js +25 -6
- package/dist/components/list/features/selection.js +30 -2
- package/dist/components/list/index.d.ts +299 -6
- package/dist/components/loading-indicator/index.d.ts +94 -3
- package/dist/components/menu/features/controller.js +2 -0
- package/dist/components/menu/index.d.ts +10 -6
- package/dist/components/menu/types.d.ts +5 -0
- 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/index.d.ts +158 -3
- package/dist/components/search/features/states.js +3 -3
- package/dist/components/search/features/structure.js +24 -4
- 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/index.d.ts +104 -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/index.d.ts +10 -3
- package/dist/components/switch/index.d.ts +190 -3
- 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/tabs.js +1 -0
- package/dist/components/text-field/config.js +3 -4
- 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/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 +4 -1
- package/dist/components/toolbar/index.d.ts +145 -6
- 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/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/css/bottom-sheet.css +1 -1
- package/dist/elements/css/button-group.css +1 -1
- package/dist/elements/css/button.css +1 -1
- package/dist/elements/css/datepicker.css +1 -1
- package/dist/elements/css/dialog.css +1 -1
- package/dist/elements/css/drawer.css +1 -1
- package/dist/elements/css/icon-button.css +1 -1
- package/dist/elements/css/list.css +1 -1
- package/dist/elements/css/menu.css +1 -1
- package/dist/elements/css/side-sheet.css +1 -1
- package/dist/elements/css/snackbar.css +1 -1
- package/dist/elements/css/text-field.css +1 -1
- package/dist/elements/css/timepicker.css +1 -1
- package/dist/elements/css/toolbar.css +1 -1
- package/dist/elements/datepicker.js +1 -0
- package/dist/elements/define.js +12 -1
- package/dist/elements/drawer.js +2 -0
- package/dist/elements/index.d.ts +3974 -107
- 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/snackbar.js +2 -0
- package/dist/elements/styles.js +15 -15
- package/dist/elements/text-field.js +2 -0
- package/dist/index.d.ts +78 -4
- package/dist/react/index.d.ts +106 -52
- package/dist/react/jsx.d.ts +49 -49
- package/dist/solid/index.d.ts +106 -52
- package/dist/solid/jsx.d.ts +51 -50
- 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/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 +5 -1
- 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 +9 -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 +19 -5
- package/src/styles/components/_menu.scss +1 -0
- 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 +4 -4
- 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 -12
- package/dist/components/bottom-app-bar/types.d.ts +0 -124
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +0 -7
- package/dist/components/bottom-sheet/types.d.ts +0 -100
- 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 -199
- 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 -300
- 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 -82
- package/dist/components/list/features/listbox.d.ts +0 -16
- 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 -144
- 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 -91
- package/dist/components/slider/slider.d.ts +0 -7
- package/dist/components/slider/types.d.ts +0 -218
- 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 -171
- 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 -304
- 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 -261
- package/dist/components/timepicker/timepicker.d.ts +0 -3
- package/dist/components/timepicker/types.d.ts +0 -258
- package/dist/components/toolbar/toolbar.d.ts +0 -8
- package/dist/components/toolbar/types.d.ts +0 -129
- 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 -66
- 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/datepicker.d.ts +0 -131
- 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 -92
- package/dist/elements/search.d.ts +0 -202
- package/dist/elements/select.d.ts +0 -119
- package/dist/elements/side-sheet.d.ts +0 -86
- 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 -98
- package/dist/elements/tabs.d.ts +0 -76
- package/dist/elements/text-field.d.ts +0 -170
- package/dist/elements/timepicker.d.ts +0 -148
- package/dist/elements/toolbar.d.ts +0 -98
- 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 -5
- 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 -5
- 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/vue/badge.d.ts +0 -4
- package/dist/vue/bottom-app-bar.d.ts +0 -5
- 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,3 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** Configuration for a radio option in the Radios component */
|
|
2
|
+
interface RadioOptionConfig {
|
|
3
|
+
/** Radio input value attribute */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Radio label text content */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the radio is initially disabled
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to position the label before the radio
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
labelBefore?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Configuration interface for the Radios component */
|
|
20
|
+
interface RadiosConfig {
|
|
21
|
+
/** Radio input name attribute used for grouping radios */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Array of radio option configurations */
|
|
24
|
+
options?: RadioOptionConfig[];
|
|
25
|
+
/** Initial selected value */
|
|
26
|
+
value?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Layout direction for radio buttons
|
|
29
|
+
* @default 'vertical'
|
|
30
|
+
*/
|
|
31
|
+
direction?: 'vertical' | 'horizontal';
|
|
32
|
+
/**
|
|
33
|
+
* Whether the entire group is initially disabled
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** A selection is required before submit. */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to enable ripple effect
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
ripple?: boolean;
|
|
44
|
+
/** Additional CSS classes to add to the radios component */
|
|
45
|
+
class?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Component prefix for class names
|
|
48
|
+
* @default 'mtrl'
|
|
49
|
+
*/
|
|
50
|
+
prefix?: string;
|
|
51
|
+
/** Component name used in class generation */
|
|
52
|
+
componentName?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Interface for a single radio in the Radios component */
|
|
56
|
+
interface RadioItem {
|
|
57
|
+
/** The radio container element */
|
|
58
|
+
element: HTMLElement;
|
|
59
|
+
/** The actual radio input element */
|
|
60
|
+
input: HTMLInputElement;
|
|
61
|
+
/** The label element */
|
|
62
|
+
label: HTMLLabelElement;
|
|
63
|
+
/** The radio option configuration */
|
|
64
|
+
config: RadioOptionConfig;
|
|
65
|
+
/** Destroys the radio and removes event listeners */
|
|
66
|
+
destroy: () => void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Selection or unknown-value clearing reported by the radio group. */
|
|
70
|
+
interface RadiosChangePayload {
|
|
71
|
+
/** Selected value, or null when nothing is selected: the value `getValue()` reads. */
|
|
72
|
+
value: string | null;
|
|
73
|
+
/** Native input change event; undefined for programmatic clearing. */
|
|
74
|
+
originalEvent: Event | undefined;
|
|
75
|
+
/** Selected option, or null when an unknown value clears selection. */
|
|
76
|
+
option: RadioOptionConfig | null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Group emitter events. */
|
|
80
|
+
interface RadiosEvents {
|
|
81
|
+
change: (payload: RadiosChangePayload) => void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Radios component interface */
|
|
85
|
+
interface RadiosComponent {
|
|
86
|
+
/** The radios container DOM element */
|
|
87
|
+
element: HTMLElement;
|
|
88
|
+
/** Array of radio items in the group */
|
|
89
|
+
radios: RadioItem[];
|
|
90
|
+
/** API for managing component lifecycle */
|
|
91
|
+
lifecycle: {
|
|
92
|
+
/** Destroys the component and cleans up resources */
|
|
93
|
+
destroy: () => void;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Gets a class name with the component's prefix
|
|
97
|
+
* @param name
|
|
98
|
+
*/
|
|
99
|
+
getClass: (name: string) => string;
|
|
100
|
+
/** Gets the selected value */
|
|
101
|
+
getValue: () => string | null;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the radios component value (selects a radio).
|
|
104
|
+
* @param value
|
|
105
|
+
*/
|
|
106
|
+
setValue: (value: string | null) => RadiosComponent;
|
|
107
|
+
/** Gets the selected radio option's configuration */
|
|
108
|
+
getSelected: () => RadioOptionConfig | null;
|
|
109
|
+
/**
|
|
110
|
+
* Adds a radio option to the radios component
|
|
111
|
+
* @param option
|
|
112
|
+
*/
|
|
113
|
+
addOption: (option: RadioOptionConfig) => RadiosComponent;
|
|
114
|
+
/**
|
|
115
|
+
* Removes a radio option from the radios component
|
|
116
|
+
* @param value
|
|
117
|
+
*/
|
|
118
|
+
removeOption: (value: string) => RadiosComponent;
|
|
119
|
+
/** Enables the radios component */
|
|
120
|
+
enable: () => RadiosComponent;
|
|
121
|
+
/** Disables the radios component */
|
|
122
|
+
disable: () => RadiosComponent;
|
|
123
|
+
/** Whether the whole group is disabled */
|
|
124
|
+
isDisabled: () => boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Enables a specific radio option
|
|
127
|
+
* @param value
|
|
128
|
+
*/
|
|
129
|
+
enableOption: (value: string) => RadiosComponent;
|
|
130
|
+
/**
|
|
131
|
+
* Disables a specific radio option
|
|
132
|
+
* @param value
|
|
133
|
+
*/
|
|
134
|
+
disableOption: (value: string) => RadiosComponent;
|
|
135
|
+
/** Destroys the radios component and all radio items */
|
|
136
|
+
destroy: () => void;
|
|
137
|
+
/**
|
|
138
|
+
* Adds an event listener to the radios component
|
|
139
|
+
* @param event
|
|
140
|
+
* @param handler
|
|
141
|
+
*/
|
|
142
|
+
on: <K extends keyof RadiosEvents>(event: K, handler: RadiosEvents[K]) => RadiosComponent;
|
|
143
|
+
/**
|
|
144
|
+
* Removes an event listener from the radios component
|
|
145
|
+
* @param event
|
|
146
|
+
* @param handler
|
|
147
|
+
*/
|
|
148
|
+
off: <K extends keyof RadiosEvents>(event: K, handler: RadiosEvents[K]) => RadiosComponent;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Creates a new Radios component
|
|
153
|
+
* @param config
|
|
154
|
+
*/
|
|
155
|
+
declare const createRadios: (config: RadiosConfig) => RadiosComponent;
|
|
156
|
+
export type { RadioOptionConfig, RadiosChangePayload, RadiosComponent, RadiosConfig, RadiosEvents };
|
|
157
|
+
export { createRadios, createRadios as default };
|
|
158
|
+
export { RADIO_DEFAULTS, RADIO_DIRECTIONS, RADIO_EVENTS, RADIO_STATES } from "./constants.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SEARCH_STATES, SEARCH_VIEW_MODES, SEARCH_CLASSES, SEARCH_ICONS, } from "../constants.js";
|
|
2
|
-
import { setHTML } from "../../../core/dom/html.js";
|
|
3
2
|
import { PREFIX } from "../../../core/config.js";
|
|
3
|
+
import { paintNamedIcon } from "./structure.js";
|
|
4
4
|
import { hideFromTopLayer, showInTopLayer, onModalEscape } from "../../../core/dom/layer.js";
|
|
5
5
|
import { activeElementOf } from "../../../core/dom/focus.js";
|
|
6
6
|
import { getCleanup } from "../../../core/compose/cleanup.js";
|
|
@@ -105,8 +105,8 @@ currentState = SEARCH_STATES.VIEW;
|
|
|
105
105
|
element.classList.remove(getClass(SEARCH_CLASSES.STATE_BAR));
|
|
106
106
|
element.classList.add(getClass(SEARCH_CLASSES.STATE_VIEW));
|
|
107
107
|
if (structure?.leadingIcon) {
|
|
108
|
-
setHTML(structure.leadingIcon, SEARCH_ICONS.BACK);
|
|
109
108
|
structure.leadingIcon.setAttribute("aria-label", "Go back");
|
|
109
|
+
paintNamedIcon(structure.leadingIcon, SEARCH_ICONS.BACK);
|
|
110
110
|
}
|
|
111
111
|
openSurface();
|
|
112
112
|
structure?.input.setAttribute("aria-expanded", "true");
|
|
@@ -130,8 +130,8 @@ cancelPendingFocus();
|
|
|
130
130
|
element.classList.remove(getClass(SEARCH_CLASSES.STATE_VIEW));
|
|
131
131
|
element.classList.add(getClass(SEARCH_CLASSES.STATE_BAR));
|
|
132
132
|
if (structure?.leadingIcon) {
|
|
133
|
-
setHTML(structure.leadingIcon, config.leadingIcon || SEARCH_ICONS.SEARCH);
|
|
134
133
|
structure.leadingIcon.setAttribute("aria-label", "Search");
|
|
134
|
+
paintNamedIcon(structure.leadingIcon, config.leadingIcon || SEARCH_ICONS.SEARCH);
|
|
135
135
|
}
|
|
136
136
|
closeSurface(restoreFocus);
|
|
137
137
|
structure?.input.setAttribute("aria-expanded", "false");
|
|
@@ -3,6 +3,23 @@ import { createElement } from "../../../core/dom/create.js";
|
|
|
3
3
|
import { setHTML } from "../../../core/dom/html.js";
|
|
4
4
|
import { PREFIX } from "../../../core/config.js";
|
|
5
5
|
import { processClassNames } from "../../../core/config/component.js";
|
|
6
|
+
import { decorativeIconsOn } from "../../../core/compose/features/icon-opt-in.js";
|
|
7
|
+
const libraryGlyph = (html) => html === SEARCH_ICONS.SEARCH || html === SEARCH_ICONS.BACK || html === SEARCH_ICONS.CLEAR;
|
|
8
|
+
export const paintNamedIcon = (host, html) => {
|
|
9
|
+
if (!decorativeIconsOn()) {
|
|
10
|
+
setHTML(host, html);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (libraryGlyph(html)) {
|
|
14
|
+
setHTML(host, html);
|
|
15
|
+
host.querySelector("svg")?.setAttribute("aria-hidden", "true");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const wrap = document.createElement("span");
|
|
19
|
+
wrap.setAttribute("aria-hidden", "true");
|
|
20
|
+
setHTML(wrap, html);
|
|
21
|
+
host.replaceChildren(wrap);
|
|
22
|
+
};
|
|
6
23
|
let searches = 0;
|
|
7
24
|
export const withStructure = (config) => (component) => {
|
|
8
25
|
const isDisabled = config.disabled === true;
|
|
@@ -63,13 +80,13 @@ const leadingIcon = createElement({
|
|
|
63
80
|
tag: "button",
|
|
64
81
|
className: getClass(SEARCH_CLASSES.LEADING_ICON),
|
|
65
82
|
container,
|
|
66
|
-
html: leadingIconHtml,
|
|
67
83
|
attributes: {
|
|
68
84
|
type: "button",
|
|
69
85
|
tabindex: isDisabled ? "-1" : "0",
|
|
70
86
|
"aria-label": isViewState ? "Go back" : "Search",
|
|
71
87
|
},
|
|
72
88
|
});
|
|
89
|
+
paintNamedIcon(leadingIcon, leadingIconHtml);
|
|
73
90
|
const inputWrapper = createElement({
|
|
74
91
|
tag: "div",
|
|
75
92
|
className: getClass(SEARCH_CLASSES.INPUT_WRAPPER),
|
|
@@ -113,13 +130,13 @@ clearButton = createElement({
|
|
|
113
130
|
tag: "button",
|
|
114
131
|
className: clearButtonClasses.join(" "),
|
|
115
132
|
container,
|
|
116
|
-
html: SEARCH_ICONS.CLEAR,
|
|
117
133
|
attributes: {
|
|
118
134
|
type: "button",
|
|
119
135
|
tabindex: isDisabled || !value ? "-1" : "0",
|
|
120
136
|
"aria-label": "Clear search",
|
|
121
137
|
},
|
|
122
138
|
});
|
|
139
|
+
paintNamedIcon(clearButton, SEARCH_ICONS.CLEAR);
|
|
123
140
|
}
|
|
124
141
|
const trailingContainer = createElement({
|
|
125
142
|
tag: "div",
|
|
@@ -141,9 +158,12 @@ Object.assign(attributes, item.ariaLabel ? { role: "img" } : { "aria-hidden": "t
|
|
|
141
158
|
const element = createElement({
|
|
142
159
|
tag: button ? "button" : "div",
|
|
143
160
|
className: getClass(avatar ? SEARCH_CLASSES.AVATAR : SEARCH_CLASSES.TRAILING_ICON),
|
|
144
|
-
html: item.content,
|
|
145
161
|
attributes,
|
|
146
162
|
});
|
|
163
|
+
if (button || item.ariaLabel)
|
|
164
|
+
paintNamedIcon(element, item.content);
|
|
165
|
+
else
|
|
166
|
+
setHTML(element, item.content);
|
|
147
167
|
if (item.onClick)
|
|
148
168
|
element.addEventListener("click", item.onClick);
|
|
149
169
|
return element;
|
|
@@ -163,7 +183,7 @@ trailing.set(config.trailingItems ?? []);
|
|
|
163
183
|
const setLeadingIcon = (html) => {
|
|
164
184
|
config.leadingIcon = html;
|
|
165
185
|
if (!component.element.classList.contains(getClass(SEARCH_CLASSES.STATE_VIEW)))
|
|
166
|
-
|
|
186
|
+
paintNamedIcon(leadingIcon, html);
|
|
167
187
|
};
|
|
168
188
|
let divider = null;
|
|
169
189
|
let contentArea = null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SEARCH_CLASSES, SEARCH_KEYS, SEARCH_ICONS } from "../constants.js";
|
|
2
2
|
import { createElement } from "../../../core/dom/create.js";
|
|
3
|
+
import { decorativeIconsOn } from "../../../core/compose/features/icon-opt-in.js";
|
|
3
4
|
export const withSuggestions = () => (component) => {
|
|
4
5
|
let highlightedIndex = -1;
|
|
5
6
|
const currentSuggestions = [];
|
|
@@ -45,11 +46,13 @@ role: "option",
|
|
|
45
46
|
tabindex: "-1",
|
|
46
47
|
},
|
|
47
48
|
});
|
|
49
|
+
const iconAttributes = decorativeIconsOn() && suggestion.text.trim() ? { "aria-hidden": "true" } : undefined;
|
|
48
50
|
if (suggestion.icon) {
|
|
49
51
|
createElement({
|
|
50
52
|
tag: "span",
|
|
51
53
|
className: getClass(SEARCH_CLASSES.SUGGESTION_ICON),
|
|
52
54
|
container: item,
|
|
55
|
+
attributes: iconAttributes,
|
|
53
56
|
html: suggestion.icon,
|
|
54
57
|
});
|
|
55
58
|
}
|
|
@@ -58,6 +61,7 @@ createElement({
|
|
|
58
61
|
tag: "span",
|
|
59
62
|
className: getClass(SEARCH_CLASSES.SUGGESTION_ICON),
|
|
60
63
|
container: item,
|
|
64
|
+
attributes: iconAttributes,
|
|
61
65
|
html: SEARCH_ICONS.HISTORY,
|
|
62
66
|
});
|
|
63
67
|
}
|
|
@@ -1,2 +1,255 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new Search component following Material Design 3 specifications
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
6
|
+
declare const createSearch: (config?: SearchConfig) => SearchComponent;
|
|
7
|
+
/** Search component state */
|
|
8
|
+
type SearchState = "bar" | "view";
|
|
9
|
+
|
|
10
|
+
/** Search view display mode */
|
|
11
|
+
type SearchViewMode = "docked" | "fullscreen";
|
|
12
|
+
|
|
13
|
+
/** Search variant, M3's style - 'contained': M3 Expressive. */
|
|
14
|
+
type SearchVariant = "contained" | "divided";
|
|
15
|
+
|
|
16
|
+
/** Valid event types for search component per MD3 spec: the names in {@link SearchEvents} */
|
|
17
|
+
type SearchEventType = keyof SearchEvents;
|
|
18
|
+
|
|
19
|
+
/** Trailing content item configuration */
|
|
20
|
+
interface SearchTrailingItem {
|
|
21
|
+
/** Unique identifier for the item */
|
|
22
|
+
id: string;
|
|
23
|
+
/** HTML content (icon SVG or avatar image). */
|
|
24
|
+
content: string;
|
|
25
|
+
/** Type of trailing content */
|
|
26
|
+
type: "icon" | "avatar";
|
|
27
|
+
/** Accessible label for the item */
|
|
28
|
+
ariaLabel?: string;
|
|
29
|
+
/** Click handler */
|
|
30
|
+
onClick?: (event: MouseEvent) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Search suggestion item */
|
|
34
|
+
interface SearchSuggestion {
|
|
35
|
+
/** Display text */
|
|
36
|
+
text: string;
|
|
37
|
+
/** Value to use when selected (defaults to text) */
|
|
38
|
+
value?: string;
|
|
39
|
+
/** Optional leading icon HTML. */
|
|
40
|
+
icon?: string;
|
|
41
|
+
/** A second line under the text: a two-line list item */
|
|
42
|
+
supportingText?: string;
|
|
43
|
+
/** Optional group identifier for dividers */
|
|
44
|
+
group?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Search event data */
|
|
48
|
+
interface SearchEvent {
|
|
49
|
+
/** The search component instance */
|
|
50
|
+
component: SearchComponent;
|
|
51
|
+
/** Current search value */
|
|
52
|
+
value: string;
|
|
53
|
+
/** Original DOM event if available */
|
|
54
|
+
originalEvent: Event | null;
|
|
55
|
+
/** Selected suggestion (for suggestionSelect event) */
|
|
56
|
+
suggestion?: SearchSuggestion;
|
|
57
|
+
/** Prevents default behavior */
|
|
58
|
+
preventDefault: () => void;
|
|
59
|
+
/** Whether default was prevented */
|
|
60
|
+
defaultPrevented: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** What `expand` and `collapse` carry: the search after the change. */
|
|
64
|
+
interface SearchStateEvent {
|
|
65
|
+
/** The search component instance */
|
|
66
|
+
component: SearchComponent;
|
|
67
|
+
/** The state after the change: `view` on expand, `bar` on collapse */
|
|
68
|
+
state: SearchState;
|
|
69
|
+
/** The view mode the search has */
|
|
70
|
+
viewMode: SearchViewMode;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The search's events and what each hands its listener. */
|
|
74
|
+
interface SearchEvents {
|
|
75
|
+
focus: (event: SearchEvent) => void;
|
|
76
|
+
blur: (event: SearchEvent) => void;
|
|
77
|
+
input: (event: SearchEvent) => void;
|
|
78
|
+
submit: (event: SearchEvent) => void;
|
|
79
|
+
clear: (event: SearchEvent) => void;
|
|
80
|
+
suggestionSelect: (event: SearchEvent) => void;
|
|
81
|
+
expand: (event: SearchStateEvent) => void;
|
|
82
|
+
collapse: (event: SearchStateEvent) => void;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Configuration options for the Search component */
|
|
86
|
+
interface SearchConfig {
|
|
87
|
+
/** Initial state: 'bar' (collapsed) or 'view' (expanded). */
|
|
88
|
+
initialState?: SearchState;
|
|
89
|
+
/** View mode when expanded: 'docked' or 'fullscreen'. */
|
|
90
|
+
viewMode?: SearchViewMode;
|
|
91
|
+
/** 'contained' (M3 Expressive) or 'divided' (baseline). */
|
|
92
|
+
variant?: SearchVariant;
|
|
93
|
+
/** Whether the search component is disabled */
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
/** Placeholder/supporting text. */
|
|
96
|
+
placeholder?: string;
|
|
97
|
+
/** Accessible name for the search input; the current placeholder is the fallback. */
|
|
98
|
+
ariaLabel?: string;
|
|
99
|
+
/** Initial input value */
|
|
100
|
+
value?: string;
|
|
101
|
+
/** Form field name. */
|
|
102
|
+
name?: string;
|
|
103
|
+
/** Custom leading icon HTML (replaces default search icon). */
|
|
104
|
+
leadingIcon?: string;
|
|
105
|
+
/** Trailing content items (icons, avatar) */
|
|
106
|
+
trailingItems?: SearchTrailingItem[];
|
|
107
|
+
/** Suggestions to display in view mode */
|
|
108
|
+
suggestions?: SearchSuggestion[] | string[];
|
|
109
|
+
/** Show clear button when input has value. */
|
|
110
|
+
showClearButton?: boolean;
|
|
111
|
+
/** Auto-expand to view on focus. */
|
|
112
|
+
expandOnFocus?: boolean;
|
|
113
|
+
/** Auto-collapse on blur (with delay). */
|
|
114
|
+
collapseOnBlur?: boolean;
|
|
115
|
+
/** Collapse delay in ms when collapseOnBlur is true. */
|
|
116
|
+
collapseDelay?: number;
|
|
117
|
+
/** Minimum width in pixels. */
|
|
118
|
+
minWidth?: number;
|
|
119
|
+
/** Maximum width in pixels. */
|
|
120
|
+
maxWidth?: number;
|
|
121
|
+
/** Full width mode (ignores min/max width) */
|
|
122
|
+
fullWidth?: boolean;
|
|
123
|
+
/** Additional CSS classes */
|
|
124
|
+
class?: string;
|
|
125
|
+
/** Component prefix for class names */
|
|
126
|
+
prefix?: string;
|
|
127
|
+
/** `submit` listener registered at creation. */
|
|
128
|
+
onSubmit?: SearchEvents["submit"];
|
|
129
|
+
/** `input` listener registered at creation. */
|
|
130
|
+
onInput?: SearchEvents["input"];
|
|
131
|
+
/** `clear` listener registered at creation. */
|
|
132
|
+
onClear?: SearchEvents["clear"];
|
|
133
|
+
/** `expand` listener registered at creation. */
|
|
134
|
+
onExpand?: SearchEvents["expand"];
|
|
135
|
+
/** `collapse` listener registered at creation. */
|
|
136
|
+
onCollapse?: SearchEvents["collapse"];
|
|
137
|
+
/** `suggestionSelect` listener registered at creation. */
|
|
138
|
+
onSuggestionSelect?: SearchEvents["suggestionSelect"];
|
|
139
|
+
/** Event handlers map */
|
|
140
|
+
on?: Partial<SearchEvents>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Search component public API interface */
|
|
144
|
+
interface SearchComponent {
|
|
145
|
+
/** The root element of the search component */
|
|
146
|
+
element: HTMLElement;
|
|
147
|
+
/** Sets the search input value. */
|
|
148
|
+
setValue: (value: string, triggerEvent?: boolean) => SearchComponent;
|
|
149
|
+
/** Gets the current search input value */
|
|
150
|
+
getValue: () => string;
|
|
151
|
+
/** Sets the placeholder/supporting text */
|
|
152
|
+
setPlaceholder: (text: string) => SearchComponent;
|
|
153
|
+
/** Gets the current placeholder text */
|
|
154
|
+
getPlaceholder: () => string;
|
|
155
|
+
/** Expands to search view */
|
|
156
|
+
expand: () => SearchComponent;
|
|
157
|
+
/** Collapses to search bar */
|
|
158
|
+
collapse: () => SearchComponent;
|
|
159
|
+
/** Gets the current state ('bar' or 'view') */
|
|
160
|
+
getState: () => SearchState;
|
|
161
|
+
/** Checks if currently expanded */
|
|
162
|
+
isExpanded: () => boolean;
|
|
163
|
+
/** Sets the view mode ('docked' or 'fullscreen') */
|
|
164
|
+
setViewMode: (mode: SearchViewMode) => SearchComponent;
|
|
165
|
+
/** Gets the current view mode */
|
|
166
|
+
getViewMode: () => SearchViewMode;
|
|
167
|
+
/** Sets the variant ('contained' or 'divided') */
|
|
168
|
+
setVariant: (variant: SearchVariant) => SearchComponent;
|
|
169
|
+
/** Gets the current variant */
|
|
170
|
+
getVariant: () => SearchVariant;
|
|
171
|
+
/** Focuses the search input */
|
|
172
|
+
focus: () => SearchComponent;
|
|
173
|
+
/** Blurs the search input */
|
|
174
|
+
blur: () => SearchComponent;
|
|
175
|
+
/** Clears the search input. */
|
|
176
|
+
clear: () => SearchComponent;
|
|
177
|
+
/** Submits the current search value */
|
|
178
|
+
submit: () => SearchComponent;
|
|
179
|
+
/** Sets the leading icon HTML */
|
|
180
|
+
setLeadingIcon: (iconHtml: string) => SearchComponent;
|
|
181
|
+
/** Adds a trailing item */
|
|
182
|
+
addTrailingItem: (item: SearchTrailingItem) => SearchComponent;
|
|
183
|
+
/** Removes a trailing item by id */
|
|
184
|
+
removeTrailingItem: (id: string) => SearchComponent;
|
|
185
|
+
/** Sets all trailing items */
|
|
186
|
+
setTrailingItems: (items: SearchTrailingItem[]) => SearchComponent;
|
|
187
|
+
/** Sets the suggestions list */
|
|
188
|
+
setSuggestions: (suggestions: SearchSuggestion[] | string[]) => SearchComponent;
|
|
189
|
+
/** Gets the current suggestions */
|
|
190
|
+
getSuggestions: () => SearchSuggestion[];
|
|
191
|
+
/** Clears all suggestions */
|
|
192
|
+
clearSuggestions: () => SearchComponent;
|
|
193
|
+
/** Enables the search component */
|
|
194
|
+
enable: () => SearchComponent;
|
|
195
|
+
/** Disables the search component */
|
|
196
|
+
disable: () => SearchComponent;
|
|
197
|
+
/** Checks if the component is disabled */
|
|
198
|
+
isDisabled: () => boolean;
|
|
199
|
+
/** Adds an event listener */
|
|
200
|
+
on: <K extends keyof SearchEvents>(event: K, handler: SearchEvents[K]) => SearchComponent;
|
|
201
|
+
/** Removes an event listener */
|
|
202
|
+
off: <K extends keyof SearchEvents>(event: K, handler: SearchEvents[K]) => SearchComponent;
|
|
203
|
+
/** Destroys the component and cleans up resources */
|
|
204
|
+
destroy: () => void;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Internal component structure references */
|
|
208
|
+
interface SearchStructure {
|
|
209
|
+
/** The bar and, when expanded, its results: what shows in the top layer while */
|
|
210
|
+
surface: HTMLElement;
|
|
211
|
+
/** Main container element */
|
|
212
|
+
container: HTMLElement;
|
|
213
|
+
/** Input element */
|
|
214
|
+
input: HTMLInputElement;
|
|
215
|
+
/** Input wrapper element */
|
|
216
|
+
inputWrapper: HTMLElement;
|
|
217
|
+
/** Leading icon container */
|
|
218
|
+
leadingIcon: HTMLElement;
|
|
219
|
+
/** Clear button element */
|
|
220
|
+
clearButton: HTMLElement | null;
|
|
221
|
+
/** Trailing items container */
|
|
222
|
+
trailingContainer: HTMLElement | null;
|
|
223
|
+
/** Header divider (view mode) */
|
|
224
|
+
divider: HTMLElement | null;
|
|
225
|
+
/** Suggestions container (view mode) */
|
|
226
|
+
suggestionsContainer: HTMLElement | null;
|
|
227
|
+
/** Suggestions list element */
|
|
228
|
+
suggestionsList: HTMLElement | null;
|
|
229
|
+
/** The live region that announces the suggestion count */
|
|
230
|
+
status: HTMLElement;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Internal search state */
|
|
234
|
+
interface SearchInternalState {
|
|
235
|
+
/** Current component state */
|
|
236
|
+
state: SearchState;
|
|
237
|
+
/** Current view mode */
|
|
238
|
+
viewMode: SearchViewMode;
|
|
239
|
+
/** Current input value */
|
|
240
|
+
value: string;
|
|
241
|
+
/** Current placeholder */
|
|
242
|
+
placeholder: string;
|
|
243
|
+
/** Whether input is focused */
|
|
244
|
+
isFocused: boolean;
|
|
245
|
+
/** Whether component is disabled */
|
|
246
|
+
isDisabled: boolean;
|
|
247
|
+
/** Current suggestions */
|
|
248
|
+
suggestions: SearchSuggestion[];
|
|
249
|
+
/** Currently highlighted suggestion index (-1 = none) */
|
|
250
|
+
highlightedIndex: number;
|
|
251
|
+
/** Trailing items */
|
|
252
|
+
trailingItems: SearchTrailingItem[];
|
|
253
|
+
}
|
|
254
|
+
export type { SearchComponent, SearchConfig, SearchEvent, SearchEventType, SearchEvents, SearchState, SearchStateEvent, SearchSuggestion, SearchTrailingItem, SearchVariant, SearchViewMode };
|
|
255
|
+
export { createSearch, createSearch as default };
|