mtrl 0.8.0-next.8 → 0.8.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 +112 -283
- package/dist/README.md +112 -283
- package/dist/components/badge/api.d.ts +1 -1
- package/dist/components/badge/api.js +162 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.js +18 -0
- package/dist/components/badge/config.d.ts +1 -1
- package/dist/components/badge/config.js +63 -0
- package/dist/components/badge/constants.js +20 -0
- package/dist/components/badge/features.d.ts +1 -1
- package/dist/components/badge/features.js +95 -0
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +1 -0
- package/dist/components/badge/types.js +1 -0
- package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +1 -1
- package/dist/components/bottom-app-bar/bottom-app-bar.js +91 -0
- package/dist/components/bottom-app-bar/config.d.ts +1 -1
- package/dist/components/bottom-app-bar/config.js +10 -0
- package/dist/components/bottom-app-bar/constants.js +13 -0
- package/dist/components/bottom-app-bar/index.d.ts +2 -2
- package/dist/components/bottom-app-bar/index.js +3 -0
- package/dist/components/bottom-app-bar/types.d.ts +1 -1
- package/dist/components/bottom-app-bar/types.js +1 -0
- package/dist/components/bottom-sheet/api.d.ts +43 -0
- package/dist/components/bottom-sheet/api.js +56 -0
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +24 -0
- package/dist/components/bottom-sheet/bottom-sheet.js +18 -0
- package/dist/components/bottom-sheet/config.d.ts +34 -0
- package/dist/components/bottom-sheet/config.js +19 -0
- package/dist/components/bottom-sheet/constants.d.ts +65 -0
- package/dist/components/bottom-sheet/constants.js +35 -0
- package/dist/components/bottom-sheet/features/drag.d.ts +32 -0
- package/dist/components/bottom-sheet/features/drag.js +71 -0
- package/dist/components/bottom-sheet/features/index.d.ts +3 -0
- package/dist/components/bottom-sheet/features/index.js +3 -0
- package/dist/components/bottom-sheet/features/state.d.ts +31 -0
- package/dist/components/bottom-sheet/features/state.js +82 -0
- package/dist/components/bottom-sheet/features/structure.d.ts +26 -0
- package/dist/components/bottom-sheet/features/structure.js +88 -0
- package/dist/components/bottom-sheet/index.d.ts +2 -0
- package/dist/components/bottom-sheet/index.js +1 -0
- package/dist/components/bottom-sheet/types.d.ts +116 -0
- package/dist/components/bottom-sheet/types.js +1 -0
- package/dist/components/button/api.d.ts +2 -2
- package/dist/components/button/api.js +265 -0
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +25 -0
- package/dist/components/button/config.d.ts +1 -1
- package/dist/components/button/config.js +51 -0
- package/dist/components/button/constants.js +35 -0
- package/dist/components/button/features/progress.d.ts +2 -2
- package/dist/components/button/features/progress.js +163 -0
- package/dist/components/button/features/toggle.d.ts +1 -1
- package/dist/components/button/features/toggle.js +33 -0
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.js +1 -0
- package/dist/components/button/types.d.ts +3 -3
- package/dist/components/button/types.js +1 -0
- package/dist/components/button-group/button-group.d.ts +1 -1
- package/dist/components/button-group/button-group.js +358 -0
- package/dist/components/button-group/config.d.ts +10 -10
- package/dist/components/button-group/config.js +123 -0
- package/dist/components/button-group/constants.d.ts +8 -0
- package/dist/components/button-group/constants.js +94 -0
- package/dist/components/button-group/index.d.ts +4 -4
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/button-group/types.d.ts +1 -1
- package/dist/components/button-group/types.js +1 -0
- package/dist/components/card/api.d.ts +1 -1
- package/dist/components/card/api.js +74 -0
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/card/card.js +20 -0
- package/dist/components/card/config.d.ts +1 -1
- package/dist/components/card/config.js +161 -0
- package/dist/components/card/constants.js +55 -0
- package/dist/components/card/content.d.ts +1 -1
- package/dist/components/card/content.js +195 -0
- package/dist/components/card/features.d.ts +1 -1
- package/dist/components/card/features.js +225 -0
- package/dist/components/card/index.d.ts +5 -5
- package/dist/components/card/index.js +4 -0
- package/dist/components/card/types.js +1 -0
- package/dist/components/carousel/api.d.ts +1 -1
- package/dist/components/carousel/api.js +46 -0
- package/dist/components/carousel/arrangement.js +61 -0
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/carousel.js +11 -0
- package/dist/components/carousel/config.d.ts +1 -1
- package/dist/components/carousel/config.js +40 -0
- package/dist/components/carousel/constants.js +23 -0
- package/dist/components/carousel/features/index.d.ts +2 -2
- package/dist/components/carousel/features/index.js +2 -0
- package/dist/components/carousel/features/scroll.d.ts +2 -2
- package/dist/components/carousel/features/scroll.js +345 -0
- package/dist/components/carousel/features/slides.d.ts +1 -1
- package/dist/components/carousel/features/slides.js +127 -0
- package/dist/components/carousel/index.d.ts +3 -3
- package/dist/components/carousel/index.js +2 -0
- package/dist/components/carousel/keylines.js +292 -0
- package/dist/components/carousel/strategy.d.ts +1 -1
- package/dist/components/carousel/strategy.js +207 -0
- package/dist/components/carousel/types.js +1 -0
- package/dist/components/checkbox/api.d.ts +1 -1
- package/dist/components/checkbox/api.js +82 -0
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +29 -0
- package/dist/components/checkbox/config.d.ts +1 -1
- package/dist/components/checkbox/config.js +44 -0
- package/dist/components/checkbox/constants.js +20 -0
- package/dist/components/checkbox/index.d.ts +3 -3
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/checkbox/types.js +1 -0
- package/dist/components/chips/api.d.ts +1 -1
- package/dist/components/chips/api.js +153 -0
- package/dist/components/chips/chip/api.d.ts +1 -1
- package/dist/components/chips/chip/api.js +186 -0
- package/dist/components/chips/chip/chip.d.ts +1 -1
- package/dist/components/chips/chip/chip.js +78 -0
- package/dist/components/chips/chip/config.d.ts +1 -1
- package/dist/components/chips/chip/config.js +53 -0
- package/dist/components/chips/chip/constants.js +18 -0
- package/dist/components/chips/chip/index.d.ts +2 -2
- package/dist/components/chips/chip/index.js +2 -0
- package/dist/components/chips/chip/types.d.ts +1 -1
- package/dist/components/chips/chip/types.js +1 -0
- package/dist/components/chips/chips.d.ts +1 -1
- package/dist/components/chips/chips.js +32 -0
- package/dist/components/chips/config.d.ts +1 -1
- package/dist/components/chips/config.js +82 -0
- package/dist/components/chips/constants.js +20 -0
- package/dist/components/chips/features/chip-items.d.ts +1 -1
- package/dist/components/chips/features/chip-items.js +17 -0
- package/dist/components/chips/features/container.d.ts +1 -1
- package/dist/components/chips/features/container.js +41 -0
- package/dist/components/chips/features/controller.d.ts +1 -1
- package/dist/components/chips/features/controller.js +309 -0
- package/dist/components/chips/features/dom.d.ts +2 -2
- package/dist/components/chips/features/dom.js +27 -0
- package/dist/components/chips/features/index.d.ts +5 -5
- package/dist/components/chips/features/index.js +5 -0
- package/dist/components/chips/features/label.d.ts +1 -1
- package/dist/components/chips/features/label.js +63 -0
- package/dist/components/chips/index.d.ts +3 -3
- package/dist/components/chips/index.js +2 -0
- package/dist/components/chips/schema.d.ts +1 -1
- package/dist/components/chips/schema.js +46 -0
- package/dist/components/chips/types.js +11 -0
- package/dist/components/datepicker/api.d.ts +1 -1
- package/dist/components/datepicker/api.js +180 -0
- package/dist/components/datepicker/config.d.ts +1 -1
- package/dist/components/datepicker/config.js +89 -0
- package/dist/components/datepicker/constants.js +50 -0
- package/dist/components/datepicker/datepicker.d.ts +1 -1
- package/dist/components/datepicker/datepicker.js +238 -0
- package/dist/components/datepicker/index.d.ts +3 -3
- package/dist/components/datepicker/index.js +2 -0
- package/dist/components/datepicker/render.js +290 -0
- package/dist/components/datepicker/types.js +18 -0
- package/dist/components/datepicker/utils.d.ts +1 -1
- package/dist/components/datepicker/utils.js +156 -0
- package/dist/components/dialog/api.d.ts +1 -1
- package/dist/components/dialog/api.js +106 -0
- package/dist/components/dialog/config.d.ts +2 -6
- package/dist/components/dialog/config.js +84 -0
- package/dist/components/dialog/constants.js +51 -0
- package/dist/components/dialog/dialog.d.ts +1 -1
- package/dist/components/dialog/dialog.js +25 -0
- package/dist/components/dialog/features.d.ts +1 -6
- package/dist/components/dialog/features.js +619 -0
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/dialog/types.d.ts +14 -3
- package/dist/components/dialog/types.js +1 -0
- package/dist/components/divider/config.js +9 -0
- package/dist/components/divider/constants.js +18 -0
- package/dist/components/divider/divider.d.ts +3 -3
- package/dist/components/divider/divider.js +11 -0
- package/dist/components/divider/features.d.ts +3 -3
- package/dist/components/divider/features.js +141 -0
- package/dist/components/divider/index.d.ts +3 -3
- package/dist/components/divider/index.js +2 -0
- package/dist/components/divider/types.d.ts +1 -1
- package/dist/components/divider/types.js +1 -0
- package/dist/components/drawer/api.d.ts +1 -1
- package/dist/components/drawer/api.js +73 -0
- package/dist/components/drawer/config.d.ts +3 -2
- package/dist/components/drawer/config.js +66 -0
- package/dist/components/drawer/constants.d.ts +2 -0
- package/dist/components/drawer/constants.js +46 -0
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +42 -0
- package/dist/components/drawer/features/headline.d.ts +1 -1
- package/dist/components/drawer/features/headline.js +36 -0
- package/dist/components/drawer/features/index.d.ts +3 -3
- package/dist/components/drawer/features/index.js +3 -0
- package/dist/components/drawer/features/items.d.ts +1 -1
- package/dist/components/drawer/features/items.js +215 -0
- package/dist/components/drawer/features/state.d.ts +2 -10
- package/dist/components/drawer/features/state.js +170 -0
- package/dist/components/drawer/index.d.ts +2 -2
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/drawer/types.d.ts +8 -2
- package/dist/components/drawer/types.js +1 -0
- package/dist/components/extended-fab/api.d.ts +1 -1
- package/dist/components/extended-fab/api.js +77 -0
- package/dist/components/extended-fab/config.d.ts +1 -1
- package/dist/components/extended-fab/config.js +73 -0
- package/dist/components/extended-fab/constants.d.ts +16 -4
- package/dist/components/extended-fab/constants.js +47 -0
- package/dist/components/extended-fab/extended-fab.d.ts +1 -1
- package/dist/components/extended-fab/extended-fab.js +59 -0
- package/dist/components/extended-fab/index.d.ts +2 -2
- package/dist/components/extended-fab/index.js +1 -0
- package/dist/components/extended-fab/types.d.ts +13 -6
- package/dist/components/extended-fab/types.js +1 -0
- package/dist/components/fab/api.d.ts +1 -1
- package/dist/components/fab/api.js +52 -0
- package/dist/components/fab/config.d.ts +1 -1
- package/dist/components/fab/config.js +53 -0
- package/dist/components/fab/constants.d.ts +18 -7
- package/dist/components/fab/constants.js +43 -0
- package/dist/components/fab/fab.d.ts +1 -1
- package/dist/components/fab/fab.js +17 -0
- package/dist/components/fab/index.d.ts +3 -3
- package/dist/components/fab/index.js +1 -0
- package/dist/components/fab/types.d.ts +10 -9
- package/dist/components/fab/types.js +1 -0
- package/dist/components/icon-button/api.d.ts +1 -1
- package/dist/components/icon-button/api.js +204 -0
- package/dist/components/icon-button/config.d.ts +1 -1
- package/dist/components/icon-button/config.js +91 -0
- package/dist/components/icon-button/constants.d.ts +21 -21
- package/dist/components/icon-button/constants.js +67 -0
- package/dist/components/icon-button/features/toggle.d.ts +1 -1
- package/dist/components/icon-button/features/toggle.js +122 -0
- package/dist/components/icon-button/icon-button.d.ts +1 -1
- package/dist/components/icon-button/icon-button.js +24 -0
- package/dist/components/icon-button/index.d.ts +4 -4
- package/dist/components/icon-button/index.js +2 -0
- package/dist/components/icon-button/types.d.ts +2 -2
- package/dist/components/icon-button/types.js +1 -0
- package/dist/components/index.d.ts +83 -69
- package/dist/components/index.js +41 -0
- package/dist/components/list/api.js +53 -0
- package/dist/components/list/config.d.ts +2 -2
- package/dist/components/list/config.js +80 -0
- package/dist/components/list/constants.js +35 -0
- package/dist/components/list/features/index.d.ts +2 -2
- package/dist/components/list/features/index.js +2 -0
- package/dist/components/list/features/renderer.js +120 -0
- package/dist/components/list/features/selection.js +160 -0
- package/dist/components/list/index.d.ts +3 -3
- package/dist/components/list/index.js +2 -0
- package/dist/components/list/list.js +19 -0
- package/dist/components/list/types.js +1 -0
- package/dist/components/loading-indicator/api.d.ts +14 -0
- package/dist/components/loading-indicator/api.js +122 -0
- package/dist/components/loading-indicator/config.d.ts +44 -0
- package/dist/components/loading-indicator/config.js +25 -0
- package/dist/components/loading-indicator/constants.d.ts +60 -0
- package/dist/components/loading-indicator/constants.js +32 -0
- package/dist/components/loading-indicator/features/motion.d.ts +22 -0
- package/dist/components/loading-indicator/features/motion.js +47 -0
- package/dist/components/loading-indicator/features/renderer.d.ts +29 -0
- package/dist/components/loading-indicator/features/renderer.js +115 -0
- package/dist/components/loading-indicator/index.d.ts +3 -0
- package/dist/components/loading-indicator/index.js +2 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts +9 -0
- package/dist/components/loading-indicator/loading-indicator.js +17 -0
- package/dist/components/loading-indicator/types.d.ts +65 -0
- package/dist/components/loading-indicator/types.js +1 -0
- package/dist/components/menu/api.d.ts +1 -1
- package/dist/components/menu/api.js +79 -0
- package/dist/components/menu/config.d.ts +1 -1
- package/dist/components/menu/config.js +82 -0
- package/dist/components/menu/constants.d.ts +32 -0
- package/dist/components/menu/constants.js +61 -0
- package/dist/components/menu/features/controller.d.ts +1 -1
- package/dist/components/menu/features/controller.js +542 -0
- package/dist/components/menu/features/index.d.ts +5 -5
- package/dist/components/menu/features/index.js +6 -0
- package/dist/components/menu/features/keyboard.d.ts +3 -1
- package/dist/components/menu/features/keyboard.js +296 -0
- package/dist/components/menu/features/opener.d.ts +1 -1
- package/dist/components/menu/features/opener.js +300 -0
- package/dist/components/menu/features/position.d.ts +1 -1
- package/dist/components/menu/features/position.js +276 -0
- package/dist/components/menu/features/registry.d.ts +37 -0
- package/dist/components/menu/features/registry.js +13 -0
- package/dist/components/menu/features/submenu.d.ts +1 -1
- package/dist/components/menu/features/submenu.js +386 -0
- package/dist/components/menu/features/tasks.d.ts +9 -0
- package/dist/components/menu/features/tasks.js +47 -0
- package/dist/components/menu/index.d.ts +3 -3
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menu/menu.d.ts +1 -1
- package/dist/components/menu/menu.js +25 -0
- package/dist/components/menu/types.d.ts +46 -3
- package/dist/components/menu/types.js +14 -0
- package/dist/components/navigation/api.d.ts +1 -1
- package/dist/components/navigation/api.js +117 -0
- package/dist/components/navigation/config.d.ts +1 -1
- package/dist/components/navigation/config.js +39 -0
- package/dist/components/navigation/constants.js +65 -0
- package/dist/components/navigation/features/controller.d.ts +1 -1
- package/dist/components/navigation/features/controller.js +173 -0
- package/dist/components/navigation/features/items.d.ts +2 -2
- package/dist/components/navigation/features/items.js +236 -0
- package/dist/components/navigation/index.d.ts +3 -3
- package/dist/components/navigation/index.js +2 -0
- package/dist/components/navigation/nav-item.d.ts +1 -1
- package/dist/components/navigation/nav-item.js +118 -0
- package/dist/components/navigation/navigation.d.ts +1 -1
- package/dist/components/navigation/navigation.js +52 -0
- package/dist/components/navigation/system/core.d.ts +1 -1
- package/dist/components/navigation/system/core.js +148 -0
- package/dist/components/navigation/system/events.d.ts +1 -1
- package/dist/components/navigation/system/events.js +126 -0
- package/dist/components/navigation/system/index.d.ts +2 -2
- package/dist/components/navigation/system/index.js +92 -0
- package/dist/components/navigation/system/mobile.d.ts +1 -1
- package/dist/components/navigation/system/mobile.js +139 -0
- package/dist/components/navigation/system/state.d.ts +1 -1
- package/dist/components/navigation/system/state.js +44 -0
- package/dist/components/navigation/system/types.js +1 -0
- package/dist/components/navigation/types.js +33 -0
- package/dist/components/navigation-rail/config.d.ts +2 -0
- package/dist/components/navigation-rail/config.js +15 -0
- package/dist/components/navigation-rail/constants.d.ts +14 -0
- package/dist/components/navigation-rail/constants.js +12 -0
- package/dist/components/navigation-rail/index.d.ts +2 -0
- package/dist/components/navigation-rail/index.js +1 -0
- package/dist/components/navigation-rail/navigation-rail.d.ts +7 -0
- package/dist/components/navigation-rail/navigation-rail.js +341 -0
- package/dist/components/navigation-rail/ripple.d.ts +2 -0
- package/dist/components/navigation-rail/ripple.js +41 -0
- package/dist/components/navigation-rail/types.d.ts +72 -0
- package/dist/components/navigation-rail/types.js +1 -0
- package/dist/components/progress/api.d.ts +3 -3
- package/dist/components/progress/api.js +205 -0
- package/dist/components/progress/config.d.ts +1 -1
- package/dist/components/progress/config.js +162 -0
- package/dist/components/progress/constants.d.ts +103 -84
- package/dist/components/progress/constants.js +110 -0
- package/dist/components/progress/features/canvas.d.ts +18 -29
- package/dist/components/progress/features/canvas.js +300 -0
- package/dist/components/progress/features/circular.d.ts +17 -7
- package/dist/components/progress/features/circular.js +71 -0
- package/dist/components/progress/features/colors.d.ts +16 -0
- package/dist/components/progress/features/colors.js +40 -0
- package/dist/components/progress/features/index.d.ts +4 -4
- package/dist/components/progress/features/index.js +4 -0
- package/dist/components/progress/features/linear.d.ts +23 -7
- package/dist/components/progress/features/linear.js +104 -0
- package/dist/components/progress/features/motion.d.ts +43 -0
- package/dist/components/progress/features/motion.js +105 -0
- package/dist/components/progress/features/resize-observer.js +40 -0
- package/dist/components/progress/features/state.d.ts +1 -1
- package/dist/components/progress/features/state.js +37 -0
- package/dist/components/progress/index.d.ts +2 -2
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.d.ts +1 -1
- package/dist/components/progress/progress.js +21 -0
- package/dist/components/progress/types.d.ts +19 -2
- package/dist/components/progress/types.js +1 -0
- package/dist/components/radios/api.d.ts +1 -1
- package/dist/components/radios/api.js +73 -0
- package/dist/components/radios/config.d.ts +1 -1
- package/dist/components/radios/config.js +28 -0
- package/dist/components/radios/constants.js +53 -0
- package/dist/components/radios/index.d.ts +3 -3
- package/dist/components/radios/index.js +2 -0
- package/dist/components/radios/radio.d.ts +1 -1
- package/dist/components/radios/radio.js +186 -0
- package/dist/components/radios/radios.d.ts +1 -1
- package/dist/components/radios/radios.js +21 -0
- package/dist/components/radios/types.js +1 -0
- package/dist/components/search/api.d.ts +1 -1
- package/dist/components/search/api.js +110 -0
- package/dist/components/search/config.d.ts +1 -1
- package/dist/components/search/config.js +66 -0
- package/dist/components/search/constants.js +84 -0
- package/dist/components/search/features/index.d.ts +4 -4
- package/dist/components/search/features/index.js +4 -0
- package/dist/components/search/features/input.d.ts +1 -1
- package/dist/components/search/features/input.js +245 -0
- package/dist/components/search/features/states.d.ts +1 -1
- package/dist/components/search/features/states.js +182 -0
- package/dist/components/search/features/structure.d.ts +1 -1
- package/dist/components/search/features/structure.js +165 -0
- package/dist/components/search/features/suggestions.d.ts +1 -1
- package/dist/components/search/features/suggestions.js +223 -0
- package/dist/components/search/index.d.ts +2 -2
- package/dist/components/search/index.js +1 -0
- package/dist/components/search/search.d.ts +1 -1
- package/dist/components/search/search.js +27 -0
- package/dist/components/search/types.js +1 -0
- package/dist/components/segmented-button/config.d.ts +1 -8
- package/dist/components/segmented-button/config.js +54 -0
- package/dist/components/segmented-button/constants.js +40 -0
- package/dist/components/segmented-button/index.d.ts +3 -3
- package/dist/components/segmented-button/index.js +2 -0
- package/dist/components/segmented-button/segment.d.ts +2 -1
- package/dist/components/segmented-button/segment.js +94 -0
- package/dist/components/segmented-button/segmented-button.d.ts +12 -1
- package/dist/components/segmented-button/segmented-button.js +195 -0
- package/dist/components/segmented-button/types.d.ts +11 -11
- package/dist/components/segmented-button/types.js +11 -0
- package/dist/components/select/api.d.ts +1 -1
- package/dist/components/select/api.js +89 -0
- package/dist/components/select/config.d.ts +1 -1
- package/dist/components/select/config.js +54 -0
- package/dist/components/select/constants.js +53 -0
- package/dist/components/select/features.d.ts +1 -1
- package/dist/components/select/features.js +246 -0
- package/dist/components/select/index.d.ts +3 -3
- package/dist/components/select/index.js +2 -0
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +26 -0
- package/dist/components/select/types.d.ts +21 -0
- package/dist/components/select/types.js +4 -0
- package/dist/components/side-sheet/api.d.ts +33 -0
- package/dist/components/side-sheet/api.js +50 -0
- package/dist/components/side-sheet/config.d.ts +34 -0
- package/dist/components/side-sheet/config.js +20 -0
- package/dist/components/side-sheet/constants.d.ts +60 -0
- package/dist/components/side-sheet/constants.js +32 -0
- package/dist/components/side-sheet/features/index.d.ts +2 -0
- package/dist/components/side-sheet/features/index.js +2 -0
- package/dist/components/side-sheet/features/state.d.ts +28 -0
- package/dist/components/side-sheet/features/state.js +67 -0
- package/dist/components/side-sheet/features/structure.d.ts +21 -0
- package/dist/components/side-sheet/features/structure.js +97 -0
- package/dist/components/side-sheet/index.d.ts +2 -0
- package/dist/components/side-sheet/index.js +1 -0
- package/dist/components/side-sheet/side-sheet.d.ts +24 -0
- package/dist/components/side-sheet/side-sheet.js +17 -0
- package/dist/components/side-sheet/types.d.ts +102 -0
- package/dist/components/side-sheet/types.js +1 -0
- package/dist/components/slider/api.d.ts +2 -2
- package/dist/components/slider/api.js +104 -0
- package/dist/components/slider/config.d.ts +1 -1
- package/dist/components/slider/config.js +106 -0
- package/dist/components/slider/constants.js +74 -0
- package/dist/components/slider/features/controller.d.ts +1 -1
- package/dist/components/slider/features/controller.js +291 -0
- package/dist/components/slider/features/dom.d.ts +2 -2
- package/dist/components/slider/features/dom.js +113 -0
- package/dist/components/slider/features/handlers.d.ts +1 -1
- package/dist/components/slider/features/handlers.js +389 -0
- package/dist/components/slider/features/index.d.ts +5 -5
- package/dist/components/slider/features/index.js +5 -0
- package/dist/components/slider/features/range.d.ts +1 -1
- package/dist/components/slider/features/range.js +70 -0
- package/dist/components/slider/features/states.d.ts +1 -1
- package/dist/components/slider/features/states.js +119 -0
- package/dist/components/slider/features/tracks.d.ts +13 -0
- package/dist/components/slider/features/tracks.js +174 -0
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/slider/slider.js +27 -0
- package/dist/components/slider/types.d.ts +4 -3
- package/dist/components/slider/types.js +2 -0
- package/dist/components/snackbar/api.d.ts +2 -2
- package/dist/components/snackbar/api.js +173 -0
- package/dist/components/snackbar/config.d.ts +26 -11
- package/dist/components/snackbar/config.js +33 -0
- package/dist/components/snackbar/constants.d.ts +73 -47
- package/dist/components/snackbar/constants.js +60 -0
- package/dist/components/snackbar/features.d.ts +17 -4
- package/dist/components/snackbar/features.js +125 -0
- package/dist/components/snackbar/index.d.ts +4 -4
- package/dist/components/snackbar/index.js +3 -0
- package/dist/components/snackbar/position.d.ts +3 -2
- package/dist/components/snackbar/position.js +24 -0
- package/dist/components/snackbar/queue.d.ts +1 -1
- package/dist/components/snackbar/queue.js +79 -0
- package/dist/components/snackbar/snackbar.d.ts +1 -1
- package/dist/components/snackbar/snackbar.js +25 -0
- package/dist/components/snackbar/types.d.ts +56 -57
- package/dist/components/snackbar/types.js +1 -0
- package/dist/components/split-button/api.d.ts +14 -0
- package/dist/components/split-button/api.js +122 -0
- package/dist/components/split-button/config.d.ts +40 -0
- package/dist/components/split-button/config.js +19 -0
- package/dist/components/split-button/constants.d.ts +67 -0
- package/dist/components/split-button/constants.js +35 -0
- package/dist/components/split-button/features/buttons.d.ts +7 -0
- package/dist/components/split-button/features/buttons.js +39 -0
- package/dist/components/split-button/features/menu.d.ts +7 -0
- package/dist/components/split-button/features/menu.js +19 -0
- package/dist/components/split-button/index.d.ts +3 -0
- package/dist/components/split-button/index.js +2 -0
- package/dist/components/split-button/split-button.d.ts +24 -0
- package/dist/components/split-button/split-button.js +21 -0
- package/dist/components/split-button/types.d.ts +116 -0
- package/dist/components/split-button/types.js +1 -0
- package/dist/components/switch/api.d.ts +1 -1
- package/dist/components/switch/api.js +91 -0
- package/dist/components/switch/config.d.ts +1 -1
- package/dist/components/switch/config.js +27 -0
- package/dist/components/switch/constants.js +39 -0
- package/dist/components/switch/features.d.ts +3 -3
- package/dist/components/switch/features.js +101 -0
- package/dist/components/switch/index.d.ts +5 -4
- package/dist/components/switch/index.js +3 -0
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +18 -0
- package/dist/components/switch/types.js +4 -0
- package/dist/components/tabs/api.d.ts +1 -1
- package/dist/components/tabs/api.js +98 -0
- package/dist/components/tabs/config.d.ts +2 -2
- package/dist/components/tabs/config.js +42 -0
- package/dist/components/tabs/constants.js +62 -0
- package/dist/components/tabs/features.d.ts +2 -2
- package/dist/components/tabs/features.js +179 -0
- package/dist/components/tabs/index.d.ts +10 -9
- package/dist/components/tabs/index.js +10 -0
- package/dist/components/tabs/indicator.d.ts +1 -1
- package/dist/components/tabs/indicator.js +134 -0
- package/dist/components/tabs/responsive.d.ts +1 -1
- package/dist/components/tabs/responsive.js +72 -0
- package/dist/components/tabs/scroll-indicators.d.ts +1 -1
- package/dist/components/tabs/scroll-indicators.js +83 -0
- package/dist/components/tabs/state.d.ts +2 -2
- package/dist/components/tabs/state.js +84 -0
- package/dist/components/tabs/tab-api.d.ts +2 -2
- package/dist/components/tabs/tab-api.js +139 -0
- package/dist/components/tabs/tab.d.ts +1 -1
- package/dist/components/tabs/tab.js +185 -0
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.js +22 -0
- package/dist/components/tabs/types.d.ts +2 -2
- package/dist/components/tabs/types.js +1 -0
- package/dist/components/tabs/utils.d.ts +1 -1
- package/dist/components/tabs/utils.js +67 -0
- package/dist/components/textfield/api.d.ts +2 -1
- package/dist/components/textfield/api.js +190 -0
- package/dist/components/textfield/config.d.ts +1 -1
- package/dist/components/textfield/config.js +21 -0
- package/dist/components/textfield/constants.js +63 -0
- package/dist/components/textfield/features/density.d.ts +1 -1
- package/dist/components/textfield/features/density.js +38 -0
- package/dist/components/textfield/features/error.d.ts +1 -1
- package/dist/components/textfield/features/error.js +35 -0
- package/dist/components/textfield/features/index.d.ts +14 -14
- package/dist/components/textfield/features/index.js +8 -0
- package/dist/components/textfield/features/leading-icon.d.ts +1 -1
- package/dist/components/textfield/features/leading-icon.js +55 -0
- package/dist/components/textfield/features/placement.d.ts +3 -1
- package/dist/components/textfield/features/placement.js +184 -0
- package/dist/components/textfield/features/prefix-text.d.ts +1 -1
- package/dist/components/textfield/features/prefix-text.js +38 -0
- package/dist/components/textfield/features/suffix-text.d.ts +1 -1
- package/dist/components/textfield/features/suffix-text.js +34 -0
- package/dist/components/textfield/features/supporting-text.d.ts +1 -1
- package/dist/components/textfield/features/supporting-text.js +58 -0
- package/dist/components/textfield/features/trailing-icon.d.ts +1 -1
- package/dist/components/textfield/features/trailing-icon.js +40 -0
- package/dist/components/textfield/index.d.ts +2 -2
- package/dist/components/textfield/index.js +1 -0
- package/dist/components/textfield/textfield.d.ts +1 -1
- package/dist/components/textfield/textfield.js +18 -0
- package/dist/components/textfield/types.js +18 -0
- package/dist/components/timepicker/api.d.ts +1 -1
- package/dist/components/timepicker/api.js +426 -0
- package/dist/components/timepicker/clockdial.d.ts +1 -1
- package/dist/components/timepicker/clockdial.js +277 -0
- package/dist/components/timepicker/config.d.ts +1 -1
- package/dist/components/timepicker/config.js +81 -0
- package/dist/components/timepicker/constants.js +135 -0
- package/dist/components/timepicker/index.d.ts +4 -4
- package/dist/components/timepicker/index.js +3 -0
- package/dist/components/timepicker/render.d.ts +1 -1
- package/dist/components/timepicker/render.js +476 -0
- package/dist/components/timepicker/timepicker.d.ts +1 -1
- package/dist/components/timepicker/timepicker.js +68 -0
- package/dist/components/timepicker/types.js +20 -0
- package/dist/components/timepicker/utils.d.ts +1 -1
- package/dist/components/timepicker/utils.js +131 -0
- package/dist/components/tooltip/api.d.ts +1 -1
- package/dist/components/tooltip/api.js +293 -0
- package/dist/components/tooltip/config.d.ts +1 -1
- package/dist/components/tooltip/config.js +38 -0
- package/dist/components/tooltip/constants.js +49 -0
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/tooltip/index.js +2 -0
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +31 -0
- package/dist/components/tooltip/types.js +23 -0
- package/dist/components/top-app-bar/config.d.ts +1 -1
- package/dist/components/top-app-bar/config.js +10 -0
- package/dist/components/top-app-bar/constants.js +33 -0
- package/dist/components/top-app-bar/index.d.ts +3 -3
- package/dist/components/top-app-bar/index.js +4 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts +2 -2
- package/dist/components/top-app-bar/top-app-bar.js +155 -0
- package/dist/components/top-app-bar/types.d.ts +1 -1
- package/dist/components/top-app-bar/types.js +1 -0
- package/dist/core/canvas/animation.js +36 -0
- package/dist/core/canvas/drawing.js +62 -0
- package/dist/core/canvas/index.d.ts +4 -4
- package/dist/core/canvas/index.js +4 -0
- package/dist/core/canvas/resize.js +35 -0
- package/dist/core/canvas/utils.d.ts +5 -4
- package/dist/core/canvas/utils.js +116 -0
- package/dist/core/compose/base.js +7 -0
- package/dist/core/compose/cleanup.d.ts +14 -0
- package/dist/core/compose/cleanup.js +51 -0
- package/dist/core/compose/component.d.ts +2 -0
- package/dist/core/compose/component.js +144 -0
- package/dist/core/compose/features/badge.d.ts +1 -1
- package/dist/core/compose/features/badge.js +20 -0
- package/dist/core/compose/features/checkable.d.ts +1 -1
- package/dist/core/compose/features/checkable.js +55 -0
- package/dist/core/compose/features/constants.js +36 -0
- package/dist/core/compose/features/debounce.d.ts +1 -1
- package/dist/core/compose/features/debounce.js +44 -0
- package/dist/core/compose/features/disabled.d.ts +1 -1
- package/dist/core/compose/features/disabled.js +63 -0
- package/dist/core/compose/features/events.d.ts +1 -1
- package/dist/core/compose/features/events.js +23 -0
- package/dist/core/compose/features/icon.d.ts +1 -1
- package/dist/core/compose/features/icon.js +70 -0
- package/dist/core/compose/features/index.d.ts +34 -34
- package/dist/core/compose/features/index.js +19 -0
- package/dist/core/compose/features/input.d.ts +1 -1
- package/dist/core/compose/features/input.js +67 -0
- package/dist/core/compose/features/lifecycle.d.ts +1 -1
- package/dist/core/compose/features/lifecycle.js +82 -0
- package/dist/core/compose/features/position.d.ts +1 -1
- package/dist/core/compose/features/position.js +36 -0
- package/dist/core/compose/features/ripple.d.ts +8 -8
- package/dist/core/compose/features/ripple.js +87 -0
- package/dist/core/compose/features/size.d.ts +1 -1
- package/dist/core/compose/features/size.js +7 -0
- package/dist/core/compose/features/style.d.ts +1 -1
- package/dist/core/compose/features/style.js +9 -0
- package/dist/core/compose/features/text.d.ts +1 -1
- package/dist/core/compose/features/text.js +47 -0
- package/dist/core/compose/features/textinput.d.ts +1 -1
- package/dist/core/compose/features/textinput.js +162 -0
- package/dist/core/compose/features/textlabel.d.ts +1 -1
- package/dist/core/compose/features/textlabel.js +44 -0
- package/dist/core/compose/features/throttle.d.ts +1 -1
- package/dist/core/compose/features/throttle.js +44 -0
- package/dist/core/compose/features/track.d.ts +1 -1
- package/dist/core/compose/features/track.js +23 -0
- package/dist/core/compose/features/variant.d.ts +1 -1
- package/dist/core/compose/features/variant.js +7 -0
- package/dist/core/compose/features/withEvents.d.ts +1 -1
- package/dist/core/compose/features/withEvents.js +46 -0
- package/dist/core/compose/index.d.ts +9 -9
- package/dist/core/compose/index.js +5 -0
- package/dist/core/compose/pipe.js +6 -0
- package/dist/core/compose/utils/type-guards.d.ts +1 -1
- package/dist/core/compose/utils/type-guards.js +10 -0
- package/dist/core/config/component.js +71 -0
- package/dist/core/config/global.d.ts +4 -2
- package/dist/core/config/global.js +15 -0
- package/dist/core/config.js +72 -0
- package/dist/core/dom/attributes.js +39 -0
- package/dist/core/dom/classes.js +207 -0
- package/dist/core/dom/create.js +250 -0
- package/dist/core/dom/events.js +82 -0
- package/dist/core/dom/index.d.ts +6 -6
- package/dist/core/dom/index.js +4 -0
- package/dist/core/dom/utils.d.ts +1 -1
- package/dist/core/dom/utils.js +45 -0
- package/dist/core/index.d.ts +20 -20
- package/dist/core/index.js +13 -0
- package/dist/core/shapes/cubic.d.ts +30 -0
- package/dist/core/shapes/cubic.js +62 -0
- package/dist/core/shapes/index.d.ts +6 -0
- package/dist/core/shapes/index.js +3 -0
- package/dist/core/shapes/material.d.ts +24 -0
- package/dist/core/shapes/material.js +119 -0
- package/dist/core/shapes/polygon.d.ts +35 -0
- package/dist/core/shapes/polygon.js +221 -0
- package/dist/core/state/disabled.js +26 -0
- package/dist/core/state/emitter.js +24 -0
- package/dist/core/state/events.js +32 -0
- package/dist/core/state/index.d.ts +10 -10
- package/dist/core/state/index.js +5 -0
- package/dist/core/state/lifecycle.js +51 -0
- package/dist/core/state/store.js +61 -0
- package/dist/core/utils/background.js +35 -0
- package/dist/core/utils/color.js +23 -0
- package/dist/core/utils/index.d.ts +6 -6
- package/dist/core/utils/index.js +8 -0
- package/dist/core/utils/mobile.js +63 -0
- package/dist/core/utils/object.js +21 -0
- package/dist/core/utils/performance.d.ts +5 -2
- package/dist/core/utils/performance.js +117 -0
- package/dist/core/utils/theme.js +78 -0
- package/dist/core/utils/validate.js +113 -0
- package/dist/index.cjs +12 -18
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -57
- package/dist/package.json +40 -11
- package/dist/styles/badge.css +2 -0
- package/dist/styles/badge.d.ts +1 -0
- package/dist/styles/badge.js +2 -0
- package/dist/styles/base.css +2 -0
- package/dist/styles/base.d.ts +1 -0
- package/dist/styles/base.js +2 -0
- package/dist/styles/bottom-app-bar.css +2 -0
- package/dist/styles/bottom-app-bar.d.ts +1 -0
- package/dist/styles/bottom-app-bar.js +2 -0
- package/dist/styles/bottom-sheet.css +2 -0
- package/dist/styles/bottom-sheet.d.ts +1 -0
- package/dist/styles/bottom-sheet.js +2 -0
- package/dist/styles/button-group.css +2 -0
- package/dist/styles/button-group.d.ts +1 -0
- package/dist/styles/button-group.js +3 -0
- package/dist/styles/button.css +2 -0
- package/dist/styles/button.d.ts +1 -0
- package/dist/styles/button.js +2 -0
- package/dist/styles/card.css +2 -0
- package/dist/styles/card.d.ts +1 -0
- package/dist/styles/card.js +2 -0
- package/dist/styles/carousel.css +2 -0
- package/dist/styles/carousel.d.ts +1 -0
- package/dist/styles/carousel.js +2 -0
- package/dist/styles/checkbox.css +2 -0
- package/dist/styles/checkbox.d.ts +1 -0
- package/dist/styles/checkbox.js +2 -0
- package/dist/styles/chips.css +2 -0
- package/dist/styles/chips.d.ts +1 -0
- package/dist/styles/chips.js +2 -0
- package/dist/styles/dialog.css +2 -0
- package/dist/styles/dialog.d.ts +1 -0
- package/dist/styles/dialog.js +3 -0
- package/dist/styles/divider.css +2 -0
- package/dist/styles/divider.d.ts +1 -0
- package/dist/styles/divider.js +2 -0
- package/dist/styles/drawer.css +2 -0
- package/dist/styles/drawer.d.ts +1 -0
- package/dist/styles/drawer.js +2 -0
- package/dist/styles/extended-fab.css +2 -0
- package/dist/styles/extended-fab.d.ts +1 -0
- package/dist/styles/extended-fab.js +2 -0
- package/dist/styles/fab.css +2 -0
- package/dist/styles/fab.d.ts +1 -0
- package/dist/styles/fab.js +2 -0
- package/dist/styles/icon-button.css +2 -0
- package/dist/styles/icon-button.d.ts +1 -0
- package/dist/styles/icon-button.js +2 -0
- package/dist/styles/list.css +2 -0
- package/dist/styles/list.d.ts +1 -0
- package/dist/styles/list.js +2 -0
- package/dist/styles/loading-indicator.css +2 -0
- package/dist/styles/loading-indicator.d.ts +1 -0
- package/dist/styles/loading-indicator.js +2 -0
- package/dist/styles/menu.css +2 -0
- package/dist/styles/menu.d.ts +1 -0
- package/dist/styles/menu.js +2 -0
- package/dist/styles/navigation-rail.css +2 -0
- package/dist/styles/navigation-rail.d.ts +1 -0
- package/dist/styles/navigation-rail.js +2 -0
- package/dist/styles/navigation.css +2 -0
- package/dist/styles/navigation.d.ts +1 -0
- package/dist/styles/navigation.js +2 -0
- package/dist/styles/progress.css +2 -0
- package/dist/styles/progress.d.ts +1 -0
- package/dist/styles/progress.js +2 -0
- package/dist/styles/radios.css +2 -0
- package/dist/styles/radios.d.ts +1 -0
- package/dist/styles/radios.js +2 -0
- package/dist/styles/search.css +2 -0
- package/dist/styles/search.d.ts +1 -0
- package/dist/styles/search.js +2 -0
- package/dist/styles/segmented-button.css +2 -0
- package/dist/styles/segmented-button.d.ts +1 -0
- package/dist/styles/segmented-button.js +2 -0
- package/dist/styles/select.css +2 -0
- package/dist/styles/select.d.ts +1 -0
- package/dist/styles/select.js +3 -0
- package/dist/styles/side-sheet.css +2 -0
- package/dist/styles/side-sheet.d.ts +1 -0
- package/dist/styles/side-sheet.js +2 -0
- package/dist/styles/slider.css +2 -0
- package/dist/styles/slider.d.ts +1 -0
- package/dist/styles/slider.js +2 -0
- package/dist/styles/snackbar.css +2 -0
- package/dist/styles/snackbar.d.ts +1 -0
- package/dist/styles/snackbar.js +3 -0
- package/dist/styles/split-button.css +2 -0
- package/dist/styles/split-button.d.ts +1 -0
- package/dist/styles/split-button.js +3 -0
- package/dist/styles/switch.css +2 -0
- package/dist/styles/switch.d.ts +1 -0
- package/dist/styles/switch.js +2 -0
- package/dist/styles/tabs.css +2 -0
- package/dist/styles/tabs.d.ts +1 -0
- package/dist/styles/tabs.js +3 -0
- package/dist/styles/textfield.css +2 -0
- package/dist/styles/textfield.d.ts +1 -0
- package/dist/styles/textfield.js +2 -0
- package/dist/styles/timepicker.css +2 -0
- package/dist/styles/timepicker.d.ts +1 -0
- package/dist/styles/timepicker.js +2 -0
- package/dist/styles/top-app-bar.css +2 -0
- package/dist/styles/top-app-bar.d.ts +1 -0
- package/dist/styles/top-app-bar.js +2 -0
- package/dist/styles/utilities.css +2 -0
- package/dist/styles/utilities.d.ts +1 -0
- package/dist/styles/utilities.js +2 -0
- package/dist/styles.css +2 -7
- package/dist/themes/autumn.css +2 -0
- package/dist/themes/baseline.css +2 -0
- package/dist/themes/brownbeige.css +2 -0
- package/dist/themes/browngreen.css +2 -0
- package/dist/themes/desert.css +2 -0
- package/dist/themes/forest.css +2 -0
- package/dist/themes/highcontrast.css +2 -0
- package/dist/themes/legacy.css +2 -0
- package/dist/themes/material.css +2 -0
- package/dist/themes/ocean.css +2 -0
- package/dist/themes/sageivory.css +2 -0
- package/dist/themes/spring.css +2 -0
- package/dist/themes/summer.css +2 -0
- package/dist/themes/sunset.css +2 -0
- package/dist/themes/tealcaramel.css +2 -0
- package/dist/themes/winter.css +2 -0
- package/package.json +44 -7
- package/src/styles/abstract/_variables.scss +18 -2
- package/src/styles/base/_document.scss +54 -0
- package/src/styles/components/_bottom-sheet.scss +167 -0
- package/src/styles/components/_button-group.scss +58 -38
- package/src/styles/components/_button.scss +9 -3
- package/src/styles/components/_card.scss +79 -20
- package/src/styles/components/_carousel.scss +3 -3
- package/src/styles/components/_chips.scss +2 -2
- package/src/styles/components/_dialog.scss +86 -22
- package/src/styles/components/_drawer.scss +85 -95
- package/src/styles/components/_extended-fab.scss +95 -111
- package/src/styles/components/_fab.scss +70 -87
- package/src/styles/components/_icon-button.scss +115 -104
- package/src/styles/components/_list.scss +2 -2
- package/src/styles/components/_loading-indicator.scss +41 -0
- package/src/styles/components/_menu.scss +324 -16
- package/src/styles/components/_navigation-rail.scss +307 -0
- package/src/styles/components/_navigation-system.scss +3 -1
- package/src/styles/components/_progress.scss +46 -53
- package/src/styles/components/_segmented-button.scss +71 -113
- package/src/styles/components/_side-sheet.scss +175 -0
- package/src/styles/components/_slider.scss +50 -20
- package/src/styles/components/_snackbar.scss +153 -167
- package/src/styles/components/_split-button.scss +229 -0
- package/src/styles/components/_textfield.scss +4 -1
- package/src/styles/main.scss +6 -51
- package/src/styles/themes/_baseline.scss +8 -0
- package/src/styles/utilities/_ripple.scss +12 -3
- package/dist/components/sheet/api.d.ts +0 -37
- package/dist/components/sheet/config.d.ts +0 -53
- package/dist/components/sheet/constants.d.ts +0 -136
- package/dist/components/sheet/features/content.d.ts +0 -6
- package/dist/components/sheet/features/gestures.d.ts +0 -6
- package/dist/components/sheet/features/index.d.ts +0 -5
- package/dist/components/sheet/features/position.d.ts +0 -7
- package/dist/components/sheet/features/state.d.ts +0 -6
- package/dist/components/sheet/features/title.d.ts +0 -6
- package/dist/components/sheet/index.d.ts +0 -3
- package/dist/components/sheet/sheet.d.ts +0 -8
- package/dist/components/sheet/types.d.ts +0 -250
- package/dist/components/slider/features/canvas.d.ts +0 -47
- package/dist/index.cjs.map +0 -269
- package/dist/index.js.map +0 -269
- package/src/styles/components/_sheet.scss +0 -236
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const withAPI = ({ lifecycle }) => (component) => ({
|
|
2
|
+
...component,
|
|
3
|
+
element: component.element,
|
|
4
|
+
addContent(contentElement) {
|
|
5
|
+
if (contentElement && contentElement.classList.contains(`${component.getClass('card')}-content`)) {
|
|
6
|
+
component.element.appendChild(contentElement);
|
|
7
|
+
}
|
|
8
|
+
return this;
|
|
9
|
+
},
|
|
10
|
+
setHeader(headerElement) {
|
|
11
|
+
if (headerElement && headerElement.classList.contains(`${component.getClass('card')}-header`)) {
|
|
12
|
+
const existingHeader = component.element.querySelector(`.${component.getClass('card')}-header`);
|
|
13
|
+
if (existingHeader) {
|
|
14
|
+
existingHeader.remove();
|
|
15
|
+
}
|
|
16
|
+
const mediaElement = component.element.querySelector(`.${component.getClass('card')}-media`);
|
|
17
|
+
if (mediaElement) {
|
|
18
|
+
const mediaElements = component.element.querySelectorAll(`.${component.getClass('card')}-media`);
|
|
19
|
+
const lastMedia = mediaElements[mediaElements.length - 1];
|
|
20
|
+
if (lastMedia.nextSibling) {
|
|
21
|
+
component.element.insertBefore(headerElement, lastMedia.nextSibling);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
component.element.appendChild(headerElement);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
component.element.insertBefore(headerElement, component.element.firstChild);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return this;
|
|
32
|
+
},
|
|
33
|
+
addMedia(mediaElement, position = 'top') {
|
|
34
|
+
if (mediaElement && mediaElement.classList.contains(`${component.getClass('card')}-media`)) {
|
|
35
|
+
if (position === 'top') {
|
|
36
|
+
component.element.insertBefore(mediaElement, component.element.firstChild);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
component.element.appendChild(mediaElement);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return this;
|
|
43
|
+
},
|
|
44
|
+
setActions(actionsElement) {
|
|
45
|
+
if (actionsElement && actionsElement.classList.contains(`${component.getClass('card')}-actions`)) {
|
|
46
|
+
const existingActions = component.element.querySelector(`.${component.getClass('card')}-actions`);
|
|
47
|
+
if (existingActions) {
|
|
48
|
+
existingActions.remove();
|
|
49
|
+
}
|
|
50
|
+
component.element.appendChild(actionsElement);
|
|
51
|
+
}
|
|
52
|
+
return this;
|
|
53
|
+
},
|
|
54
|
+
makeDraggable(dragStartCallback) {
|
|
55
|
+
component.element.setAttribute('draggable', 'true');
|
|
56
|
+
component.element.setAttribute('aria-grabbed', 'false');
|
|
57
|
+
component.element.addEventListener('dragstart', (e) => {
|
|
58
|
+
component.element.setAttribute('aria-grabbed', 'true');
|
|
59
|
+
if (typeof dragStartCallback === 'function')
|
|
60
|
+
dragStartCallback(e);
|
|
61
|
+
});
|
|
62
|
+
component.element.addEventListener('dragend', () => {
|
|
63
|
+
component.element.setAttribute('aria-grabbed', 'false');
|
|
64
|
+
});
|
|
65
|
+
return this;
|
|
66
|
+
},
|
|
67
|
+
focus() {
|
|
68
|
+
component.element.focus();
|
|
69
|
+
return this;
|
|
70
|
+
},
|
|
71
|
+
destroy() {
|
|
72
|
+
lifecycle.destroy();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { pipe } from "../../core/compose/index.js";
|
|
2
|
+
import { createBase, withElement } from "../../core/compose/component.js";
|
|
3
|
+
import { withEvents, withVariant, withRipple, withLifecycle } from "../../core/compose/features/index.js";
|
|
4
|
+
import { withAPI } from "./api.js";
|
|
5
|
+
import { createBaseConfig, getElementConfig, getApiConfig, withInteractiveBehavior, processInlineConfig, applyInlineConfiguration } from "./config.js";
|
|
6
|
+
import { withElevation } from "./features.js";
|
|
7
|
+
const createCard = (config = {}) => {
|
|
8
|
+
const processedConfig = processInlineConfig(config);
|
|
9
|
+
const baseConfig = createBaseConfig(processedConfig);
|
|
10
|
+
try {
|
|
11
|
+
const card = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withVariant(baseConfig), baseConfig.clickable ? withRipple(baseConfig) : (c) => c, withLifecycle(), withInteractiveBehavior, withElevation, comp => withAPI(getApiConfig(comp))(comp))(baseConfig);
|
|
12
|
+
applyInlineConfiguration(card, processedConfig);
|
|
13
|
+
return card;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error('Card creation error:', error instanceof Error ? error.message : String(error));
|
|
17
|
+
throw new Error(`Failed to create card: ${error instanceof Error ? error.message : String(error)}`);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default createCard;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createComponentConfig, createElementConfig, } from "../../core/config/component.js";
|
|
2
|
+
import { createCardHeader, createCardContent, createCardMedia, createCardActions, } from "./content.js";
|
|
3
|
+
import { CARD_VARIANTS, CARD_ELEVATIONS } from "./constants.js";
|
|
4
|
+
export const defaultConfig = {
|
|
5
|
+
variant: CARD_VARIANTS.ELEVATED,
|
|
6
|
+
interactive: false,
|
|
7
|
+
fullWidth: false,
|
|
8
|
+
clickable: false,
|
|
9
|
+
draggable: false,
|
|
10
|
+
};
|
|
11
|
+
export const processInlineConfig = (config) => {
|
|
12
|
+
const processedConfig = { ...config };
|
|
13
|
+
if (config.header) {
|
|
14
|
+
processedConfig.headerConfig = config.header;
|
|
15
|
+
}
|
|
16
|
+
if (config.content) {
|
|
17
|
+
processedConfig.contentConfig = config.content;
|
|
18
|
+
}
|
|
19
|
+
if (config.media) {
|
|
20
|
+
processedConfig.mediaConfig = config.media;
|
|
21
|
+
}
|
|
22
|
+
if (config.actions) {
|
|
23
|
+
processedConfig.actionsConfig = config.actions;
|
|
24
|
+
}
|
|
25
|
+
return processedConfig;
|
|
26
|
+
};
|
|
27
|
+
export const applyInlineConfiguration = (card, config) => {
|
|
28
|
+
if (config.mediaConfig &&
|
|
29
|
+
(!config.mediaConfig.position || config.mediaConfig.position === "top")) {
|
|
30
|
+
const mediaElement = createCardMedia({
|
|
31
|
+
...config.mediaConfig,
|
|
32
|
+
position: undefined,
|
|
33
|
+
});
|
|
34
|
+
card.addMedia(mediaElement, "top");
|
|
35
|
+
}
|
|
36
|
+
if (config.headerConfig) {
|
|
37
|
+
const headerElement = createCardHeader(config.headerConfig);
|
|
38
|
+
card.setHeader(headerElement);
|
|
39
|
+
}
|
|
40
|
+
if (config.contentConfig) {
|
|
41
|
+
const contentElement = createCardContent(config.contentConfig);
|
|
42
|
+
card.addContent(contentElement);
|
|
43
|
+
}
|
|
44
|
+
if (config.mediaConfig && config.mediaConfig.position === "bottom") {
|
|
45
|
+
const mediaElement = createCardMedia({
|
|
46
|
+
...config.mediaConfig,
|
|
47
|
+
position: undefined,
|
|
48
|
+
});
|
|
49
|
+
card.addMedia(mediaElement, "bottom");
|
|
50
|
+
}
|
|
51
|
+
if (config.actionsConfig) {
|
|
52
|
+
const actionsElement = createCardActions(config.actionsConfig);
|
|
53
|
+
card.setActions(actionsElement);
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(config.buttons) && config.buttons.length > 0) {
|
|
56
|
+
import("../button/index.js")
|
|
57
|
+
.then(({ default: createButton }) => {
|
|
58
|
+
const actionButtons = config.buttons.map((buttonConfig) => createButton(buttonConfig).element);
|
|
59
|
+
const actionsElement = createCardActions({
|
|
60
|
+
actions: actionButtons,
|
|
61
|
+
align: config.actionsConfig?.align || "end",
|
|
62
|
+
});
|
|
63
|
+
card.setActions(actionsElement);
|
|
64
|
+
})
|
|
65
|
+
.catch((error) => {
|
|
66
|
+
console.error("Error processing buttons:", error);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
export const createBaseConfig = (config = {}) => createComponentConfig(defaultConfig, config, "card");
|
|
71
|
+
export const getElementConfig = (config) => {
|
|
72
|
+
const isInteractive = config.interactive || config.clickable;
|
|
73
|
+
const defaultRole = isInteractive ? "button" : "region";
|
|
74
|
+
const ariaAttributes = {};
|
|
75
|
+
if (config.aria) {
|
|
76
|
+
Object.entries(config.aria).forEach(([key, value]) => {
|
|
77
|
+
if (value !== undefined) {
|
|
78
|
+
const attrName = key.startsWith("aria-") ? key : `aria-${key}`;
|
|
79
|
+
ariaAttributes[attrName] = value;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!ariaAttributes["role"] && !config.aria?.role) {
|
|
84
|
+
ariaAttributes["role"] = defaultRole;
|
|
85
|
+
}
|
|
86
|
+
if (isInteractive && !ariaAttributes["tabindex"]) {
|
|
87
|
+
ariaAttributes["tabindex"] = "0";
|
|
88
|
+
}
|
|
89
|
+
return createElementConfig(config, {
|
|
90
|
+
tag: "div",
|
|
91
|
+
className: [
|
|
92
|
+
config.class,
|
|
93
|
+
config.fullWidth ? `${config.prefix}-card--full-width` : null,
|
|
94
|
+
isInteractive ? `${config.prefix}-card--interactive` : null,
|
|
95
|
+
],
|
|
96
|
+
attributes: ariaAttributes,
|
|
97
|
+
forwardEvents: {
|
|
98
|
+
click: () => !!config.clickable,
|
|
99
|
+
mouseenter: () => !!isInteractive,
|
|
100
|
+
mouseleave: () => !!isInteractive,
|
|
101
|
+
keydown: () => !!isInteractive,
|
|
102
|
+
focus: () => !!isInteractive,
|
|
103
|
+
blur: () => !!isInteractive,
|
|
104
|
+
},
|
|
105
|
+
interactive: isInteractive,
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
export const getApiConfig = (comp) => ({
|
|
109
|
+
lifecycle: {
|
|
110
|
+
destroy: () => comp.lifecycle?.destroy?.(),
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
export const CARD_ELEVATION_LEVELS = CARD_ELEVATIONS;
|
|
114
|
+
export const withInteractiveBehavior = (comp) => {
|
|
115
|
+
const config = comp.config;
|
|
116
|
+
const isInteractive = config.interactive || config.clickable;
|
|
117
|
+
if (isInteractive) {
|
|
118
|
+
comp.element.addEventListener("mouseenter", () => {
|
|
119
|
+
if (config.variant === CARD_VARIANTS.ELEVATED) {
|
|
120
|
+
comp.element.style.setProperty(`--${config.prefix}-card-elevation`, String(CARD_ELEVATION_LEVELS.LEVEL2));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
comp.element.addEventListener("mouseleave", () => {
|
|
124
|
+
if (config.variant === CARD_VARIANTS.ELEVATED) {
|
|
125
|
+
comp.element.style.setProperty(`--${config.prefix}-card-elevation`, String(CARD_ELEVATION_LEVELS.LEVEL1));
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
comp.element.addEventListener("keydown", (e) => {
|
|
129
|
+
if ((e.key === "Enter" || e.key === " ") && config.clickable) {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
comp.element.click();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
comp.element.addEventListener("focus", () => {
|
|
135
|
+
comp.element.classList.add(`${comp.getClass("card")}--focused`);
|
|
136
|
+
});
|
|
137
|
+
comp.element.addEventListener("blur", () => {
|
|
138
|
+
comp.element.classList.remove(`${comp.getClass("card")}--focused`);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (config.draggable) {
|
|
142
|
+
comp.element.setAttribute("draggable", "true");
|
|
143
|
+
comp.element.addEventListener("dragstart", (e) => {
|
|
144
|
+
comp.element.style.setProperty(`--${config.prefix}-card-elevation`, String(CARD_ELEVATION_LEVELS.LEVEL4));
|
|
145
|
+
comp.element.classList.add(`${comp.getClass("card")}--dragging`);
|
|
146
|
+
comp.emit?.("dragstart", { event: e });
|
|
147
|
+
if (e.dataTransfer) {
|
|
148
|
+
const cardTitle = comp.element.querySelector(`.${comp.getClass("card")}-header-title`)
|
|
149
|
+
?.textContent || "Card";
|
|
150
|
+
e.dataTransfer.setData("text/plain", cardTitle);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
comp.element.addEventListener("dragend", (e) => {
|
|
154
|
+
comp.element.style.setProperty(`--${config.prefix}-card-elevation`, String(CARD_ELEVATION_LEVELS.LEVEL1));
|
|
155
|
+
comp.element.classList.remove(`${comp.getClass("card")}--dragging`);
|
|
156
|
+
comp.emit?.("dragend", { event: e });
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return comp;
|
|
160
|
+
};
|
|
161
|
+
export default defaultConfig;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const CARD_VARIANTS = {
|
|
2
|
+
ELEVATED: 'elevated',
|
|
3
|
+
FILLED: 'filled',
|
|
4
|
+
OUTLINED: 'outlined'
|
|
5
|
+
};
|
|
6
|
+
export const CARD_ELEVATIONS = {
|
|
7
|
+
LEVEL0: 0,
|
|
8
|
+
LEVEL1: 1,
|
|
9
|
+
LEVEL2: 2,
|
|
10
|
+
LEVEL4: 4
|
|
11
|
+
};
|
|
12
|
+
export const CARD_WIDTHS = {
|
|
13
|
+
SMALL: '344px',
|
|
14
|
+
MEDIUM: '480px',
|
|
15
|
+
LARGE: '624px',
|
|
16
|
+
FULL: '100%'
|
|
17
|
+
};
|
|
18
|
+
export const CARD_CORNER_RADIUS = {
|
|
19
|
+
SMALL: '8px',
|
|
20
|
+
MEDIUM: '12px',
|
|
21
|
+
LARGE: '16px'
|
|
22
|
+
};
|
|
23
|
+
export const CARD_ASPECT_RATIOS = {
|
|
24
|
+
SQUARE: '1:1',
|
|
25
|
+
STANDARD: '4:3',
|
|
26
|
+
WIDESCREEN: '16:9'
|
|
27
|
+
};
|
|
28
|
+
export const CARD_ACTION_ALIGNMENT = {
|
|
29
|
+
START: 'start',
|
|
30
|
+
CENTER: 'center',
|
|
31
|
+
END: 'end',
|
|
32
|
+
SPACE_BETWEEN: 'space-between'
|
|
33
|
+
};
|
|
34
|
+
export const CARD_MEDIA_POSITION = {
|
|
35
|
+
TOP: 'top',
|
|
36
|
+
BOTTOM: 'bottom'
|
|
37
|
+
};
|
|
38
|
+
export const CARD_CLASSES = {
|
|
39
|
+
ROOT: 'card',
|
|
40
|
+
HEADER: 'card-header',
|
|
41
|
+
TITLE: 'card-title',
|
|
42
|
+
SUBTITLE: 'card-subtitle',
|
|
43
|
+
AVATAR: 'card-avatar',
|
|
44
|
+
HEADER_ACTION: 'card-header-action',
|
|
45
|
+
CONTENT: 'card-content',
|
|
46
|
+
MEDIA: 'card-media',
|
|
47
|
+
ACTIONS: 'card-actions',
|
|
48
|
+
DRAGGABLE: 'card-draggable',
|
|
49
|
+
INTERACTIVE: 'card-interactive',
|
|
50
|
+
FULL_WIDTH: 'card-full-width',
|
|
51
|
+
CLICKABLE: 'card-clickable',
|
|
52
|
+
LOADING: 'card-loading',
|
|
53
|
+
EXPANDED: 'card-expanded',
|
|
54
|
+
ELEVATION_PREFIX: 'card-elevation-'
|
|
55
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardContentConfig, CardHeaderConfig, CardMediaConfig, CardActionsConfig } from
|
|
1
|
+
import { CardContentConfig, CardHeaderConfig, CardMediaConfig, CardActionsConfig } from "./types.js";
|
|
2
2
|
export declare const CARD_CONTENT_PADDING = true;
|
|
3
3
|
/**
|
|
4
4
|
* Creates a card content component
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { PREFIX } from "../../core/config.js";
|
|
2
|
+
import { pipe } from "../../core/compose/index.js";
|
|
3
|
+
import { createBase, withElement } from "../../core/compose/component.js";
|
|
4
|
+
import { createElement } from "../../core/dom/create.js";
|
|
5
|
+
export const CARD_CONTENT_PADDING = true;
|
|
6
|
+
export const createCardContent = (config = {}) => {
|
|
7
|
+
const baseConfig = {
|
|
8
|
+
...config,
|
|
9
|
+
componentName: 'card-content',
|
|
10
|
+
prefix: PREFIX
|
|
11
|
+
};
|
|
12
|
+
try {
|
|
13
|
+
const content = pipe(createBase, withElement({
|
|
14
|
+
tag: 'div',
|
|
15
|
+
componentName: 'card-content',
|
|
16
|
+
className: [
|
|
17
|
+
config.class,
|
|
18
|
+
config.padding === false ? `${PREFIX}-card-content--no-padding` : null
|
|
19
|
+
],
|
|
20
|
+
attributes: {
|
|
21
|
+
'role': 'region',
|
|
22
|
+
'style': 'display: block; color: inherit;'
|
|
23
|
+
}
|
|
24
|
+
}))(baseConfig);
|
|
25
|
+
if (config.html) {
|
|
26
|
+
content.element.innerHTML = config.html;
|
|
27
|
+
}
|
|
28
|
+
else if (config.text) {
|
|
29
|
+
content.element.innerHTML = `<p>${config.text}</p>`;
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(config.children)) {
|
|
32
|
+
config.children.forEach(child => {
|
|
33
|
+
if (child instanceof HTMLElement) {
|
|
34
|
+
content.element.appendChild(child);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return content.element;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('Card content creation error:', error instanceof Error ? error.message : String(error));
|
|
42
|
+
throw new Error(`Failed to create card content: ${error instanceof Error ? error.message : String(error)}`);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const createCardHeader = (config = {}) => {
|
|
46
|
+
const baseConfig = {
|
|
47
|
+
...config,
|
|
48
|
+
componentName: 'card-header',
|
|
49
|
+
prefix: PREFIX
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const header = pipe(createBase, withElement({
|
|
53
|
+
tag: 'div',
|
|
54
|
+
componentName: 'card-header',
|
|
55
|
+
className: config.class,
|
|
56
|
+
attributes: {
|
|
57
|
+
'role': 'heading',
|
|
58
|
+
'aria-level': '3'
|
|
59
|
+
}
|
|
60
|
+
}))(baseConfig);
|
|
61
|
+
const textContainer = createElement({
|
|
62
|
+
tag: 'div',
|
|
63
|
+
className: `${PREFIX}-card-header-text`,
|
|
64
|
+
container: header.element
|
|
65
|
+
});
|
|
66
|
+
if (config.title) {
|
|
67
|
+
createElement({
|
|
68
|
+
tag: 'h3',
|
|
69
|
+
className: `${PREFIX}-card-header-title`,
|
|
70
|
+
text: config.title,
|
|
71
|
+
container: textContainer,
|
|
72
|
+
attributes: {
|
|
73
|
+
id: `${header.element.id || 'card-header'}-title`
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const parentCard = header.element.closest(`.${PREFIX}-card`);
|
|
77
|
+
if (parentCard && !parentCard.hasAttribute('aria-labelledby')) {
|
|
78
|
+
parentCard.setAttribute('aria-labelledby', `${header.element.id || 'card-header'}-title`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (config.subtitle) {
|
|
82
|
+
createElement({
|
|
83
|
+
tag: 'h4',
|
|
84
|
+
className: `${PREFIX}-card-header-subtitle`,
|
|
85
|
+
text: config.subtitle,
|
|
86
|
+
container: textContainer
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (config.avatar) {
|
|
90
|
+
const avatarElement = typeof config.avatar === 'string'
|
|
91
|
+
? createElement({
|
|
92
|
+
tag: 'div',
|
|
93
|
+
className: `${PREFIX}-card-header-avatar`,
|
|
94
|
+
html: config.avatar
|
|
95
|
+
})
|
|
96
|
+
: config.avatar;
|
|
97
|
+
const avatarImg = avatarElement.querySelector('img');
|
|
98
|
+
if (avatarImg && !avatarImg.hasAttribute('alt')) {
|
|
99
|
+
avatarImg.setAttribute('alt', '');
|
|
100
|
+
avatarImg.setAttribute('aria-hidden', 'true');
|
|
101
|
+
}
|
|
102
|
+
header.element.insertBefore(avatarElement, header.element.firstChild);
|
|
103
|
+
}
|
|
104
|
+
if (config.action) {
|
|
105
|
+
const actionElement = typeof config.action === 'string'
|
|
106
|
+
? createElement({
|
|
107
|
+
tag: 'div',
|
|
108
|
+
className: `${PREFIX}-card-header-action`,
|
|
109
|
+
html: config.action
|
|
110
|
+
})
|
|
111
|
+
: config.action;
|
|
112
|
+
header.element.appendChild(actionElement);
|
|
113
|
+
}
|
|
114
|
+
return header.element;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error('Card header creation error:', error instanceof Error ? error.message : String(error));
|
|
118
|
+
throw new Error(`Failed to create card header: ${error instanceof Error ? error.message : String(error)}`);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export const createCardActions = (config = {}) => {
|
|
122
|
+
const baseConfig = {
|
|
123
|
+
...config,
|
|
124
|
+
componentName: 'card-actions',
|
|
125
|
+
prefix: PREFIX
|
|
126
|
+
};
|
|
127
|
+
try {
|
|
128
|
+
const actions = pipe(createBase, withElement({
|
|
129
|
+
tag: 'div',
|
|
130
|
+
componentName: 'card-actions',
|
|
131
|
+
className: [
|
|
132
|
+
config.class,
|
|
133
|
+
config.fullBleed ? `${PREFIX}-card-actions--full-bleed` : null,
|
|
134
|
+
config.vertical ? `${PREFIX}-card-actions--vertical` : null,
|
|
135
|
+
config.align ? `${PREFIX}-card-actions--${config.align}` : null
|
|
136
|
+
],
|
|
137
|
+
attributes: {
|
|
138
|
+
'role': 'group'
|
|
139
|
+
}
|
|
140
|
+
}))(baseConfig);
|
|
141
|
+
if (Array.isArray(config.actions)) {
|
|
142
|
+
config.actions.forEach((action, index) => {
|
|
143
|
+
if (action instanceof HTMLElement) {
|
|
144
|
+
if (!action.hasAttribute('aria-label') &&
|
|
145
|
+
!action.hasAttribute('aria-labelledby') &&
|
|
146
|
+
action.textContent?.trim() === '') {
|
|
147
|
+
action.setAttribute('aria-label', `Action ${index + 1}`);
|
|
148
|
+
}
|
|
149
|
+
actions.element.appendChild(action);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return actions.element;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
console.error('Card actions creation error:', error instanceof Error ? error.message : String(error));
|
|
157
|
+
throw new Error(`Failed to create card actions: ${error instanceof Error ? error.message : String(error)}`);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
export const createCardMedia = (config = {}) => {
|
|
161
|
+
const baseConfig = {
|
|
162
|
+
...config,
|
|
163
|
+
componentName: 'card-media',
|
|
164
|
+
prefix: PREFIX
|
|
165
|
+
};
|
|
166
|
+
try {
|
|
167
|
+
const media = pipe(createBase, withElement({
|
|
168
|
+
tag: 'div',
|
|
169
|
+
componentName: 'card-media',
|
|
170
|
+
className: [
|
|
171
|
+
config.class,
|
|
172
|
+
config.aspectRatio ? `${PREFIX}-card-media--${config.aspectRatio.replace(':', '-')}` : null,
|
|
173
|
+
config.contain ? `${PREFIX}-card-media--contain` : null
|
|
174
|
+
]
|
|
175
|
+
}))(baseConfig);
|
|
176
|
+
if (config.element instanceof HTMLElement) {
|
|
177
|
+
media.element.appendChild(config.element);
|
|
178
|
+
}
|
|
179
|
+
else if (config.src) {
|
|
180
|
+
const img = document.createElement('img');
|
|
181
|
+
img.src = config.src;
|
|
182
|
+
img.className = `${PREFIX}-card-media-img`;
|
|
183
|
+
img.alt = config.alt || '';
|
|
184
|
+
if (!config.alt) {
|
|
185
|
+
img.setAttribute('aria-hidden', 'true');
|
|
186
|
+
}
|
|
187
|
+
media.element.appendChild(img);
|
|
188
|
+
}
|
|
189
|
+
return media.element;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
console.error('Card media creation error:', error instanceof Error ? error.message : String(error));
|
|
193
|
+
throw new Error(`Failed to create card media: ${error instanceof Error ? error.message : String(error)}`);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseComponent, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from "./types";
|
|
1
|
+
import { BaseComponent, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from "./types.js";
|
|
2
2
|
interface LoadingConfig {
|
|
3
3
|
initialState?: boolean;
|
|
4
4
|
}
|