@windmorph/react 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/NOTICE +23 -0
- package/README.md +149 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +112 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/app-bar/AppBarItems.js +23 -0
- package/dist/components/app-bar/AppBarItems.js.map +1 -0
- package/dist/components/app-bar/TopAppBar.d.ts +89 -0
- package/dist/components/app-bar/TopAppBar.js +103 -0
- package/dist/components/app-bar/TopAppBar.js.map +1 -0
- package/dist/components/app-bar/app-bar-styles.d.ts +280 -0
- package/dist/components/app-bar/app-bar-styles.js +142 -0
- package/dist/components/app-bar/app-bar-styles.js.map +1 -0
- package/dist/components/app-bar/app-bar-tokens.d.ts +7 -0
- package/dist/components/app-bar/app-bar-tokens.js +64 -0
- package/dist/components/app-bar/app-bar-tokens.js.map +1 -0
- package/dist/components/app-bar/use-app-bar-scroll.d.ts +6 -0
- package/dist/components/app-bar/use-app-bar-scroll.js +139 -0
- package/dist/components/app-bar/use-app-bar-scroll.js.map +1 -0
- package/dist/components/autocomplete/Autocomplete.d.ts +142 -0
- package/dist/components/autocomplete/Autocomplete.js +284 -0
- package/dist/components/autocomplete/Autocomplete.js.map +1 -0
- package/dist/components/badge/Badge.d.ts +71 -0
- package/dist/components/badge/Badge.js +72 -0
- package/dist/components/badge/Badge.js.map +1 -0
- package/dist/components/badge/badge-styles.d.ts +100 -0
- package/dist/components/badge/badge-styles.js +43 -0
- package/dist/components/badge/badge-styles.js.map +1 -0
- package/dist/components/badge/badge-tokens.d.ts +7 -0
- package/dist/components/badge/badge-tokens.js +40 -0
- package/dist/components/badge/badge-tokens.js.map +1 -0
- package/dist/components/button/Button.d.ts +91 -0
- package/dist/components/button/Button.js +96 -0
- package/dist/components/button/Button.js.map +1 -0
- package/dist/components/button/ButtonContext.d.ts +30 -0
- package/dist/components/button/ButtonContext.js +18 -0
- package/dist/components/button/ButtonContext.js.map +1 -0
- package/dist/components/button/DensityZeroButtons.js +25 -0
- package/dist/components/button/DensityZeroButtons.js.map +1 -0
- package/dist/components/button/button-pending.d.ts +10 -0
- package/dist/components/button/button-pending.js +166 -0
- package/dist/components/button/button-pending.js.map +1 -0
- package/dist/components/button/button-styles.d.ts +216 -0
- package/dist/components/button/button-styles.js +199 -0
- package/dist/components/button/button-styles.js.map +1 -0
- package/dist/components/button/button-tokens.d.ts +10 -0
- package/dist/components/button/button-tokens.js +257 -0
- package/dist/components/button/button-tokens.js.map +1 -0
- package/dist/components/button/connected-shapes.js +152 -0
- package/dist/components/button/connected-shapes.js.map +1 -0
- package/dist/components/card/Card.d.ts +60 -0
- package/dist/components/card/Card.js +69 -0
- package/dist/components/card/Card.js.map +1 -0
- package/dist/components/card/card-styles.d.ts +42 -0
- package/dist/components/card/card-styles.js +64 -0
- package/dist/components/card/card-styles.js.map +1 -0
- package/dist/components/card/card-tokens.d.ts +7 -0
- package/dist/components/card/card-tokens.js +84 -0
- package/dist/components/card/card-tokens.js.map +1 -0
- package/dist/components/carousel/Carousel.d.ts +124 -0
- package/dist/components/carousel/Carousel.js +387 -0
- package/dist/components/carousel/Carousel.js.map +1 -0
- package/dist/components/carousel/carousel-keylines.js +486 -0
- package/dist/components/carousel/carousel-keylines.js.map +1 -0
- package/dist/components/carousel/carousel-press-area.js +35 -0
- package/dist/components/carousel/carousel-press-area.js.map +1 -0
- package/dist/components/carousel/carousel-styles.d.ts +188 -0
- package/dist/components/carousel/carousel-styles.js +116 -0
- package/dist/components/carousel/carousel-styles.js.map +1 -0
- package/dist/components/carousel/carousel-tokens.d.ts +7 -0
- package/dist/components/carousel/carousel-tokens.js +18 -0
- package/dist/components/carousel/carousel-tokens.js.map +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +78 -0
- package/dist/components/checkbox/Checkbox.js +77 -0
- package/dist/components/checkbox/Checkbox.js.map +1 -0
- package/dist/components/checkbox/checkbox-box.js +34 -0
- package/dist/components/checkbox/checkbox-box.js.map +1 -0
- package/dist/components/checkbox/checkbox-styles.d.ts +100 -0
- package/dist/components/checkbox/checkbox-styles.js +54 -0
- package/dist/components/checkbox/checkbox-styles.js.map +1 -0
- package/dist/components/checkbox/checkbox-tokens.d.ts +7 -0
- package/dist/components/checkbox/checkbox-tokens.js +41 -0
- package/dist/components/checkbox/checkbox-tokens.js.map +1 -0
- package/dist/components/chip/Chip.d.ts +171 -0
- package/dist/components/chip/Chip.js +348 -0
- package/dist/components/chip/Chip.js.map +1 -0
- package/dist/components/chip/ChipSet.d.ts +70 -0
- package/dist/components/chip/ChipSet.js +198 -0
- package/dist/components/chip/ChipSet.js.map +1 -0
- package/dist/components/chip/chip-styles.d.ts +263 -0
- package/dist/components/chip/chip-styles.js +360 -0
- package/dist/components/chip/chip-styles.js.map +1 -0
- package/dist/components/chip/chip-tokens.d.ts +13 -0
- package/dist/components/chip/chip-tokens.js +185 -0
- package/dist/components/chip/chip-tokens.js.map +1 -0
- package/dist/components/date-picker/CalendarGrid.js +94 -0
- package/dist/components/date-picker/CalendarGrid.js.map +1 -0
- package/dist/components/date-picker/CompactDateDialog.js +63 -0
- package/dist/components/date-picker/CompactDateDialog.js.map +1 -0
- package/dist/components/date-picker/DateField.d.ts +161 -0
- package/dist/components/date-picker/DateField.js +393 -0
- package/dist/components/date-picker/DateField.js.map +1 -0
- package/dist/components/date-picker/DateInput.d.ts +20 -0
- package/dist/components/date-picker/DateInput.js +99 -0
- package/dist/components/date-picker/DateInput.js.map +1 -0
- package/dist/components/date-picker/DatePicker.d.ts +165 -0
- package/dist/components/date-picker/DatePicker.js +492 -0
- package/dist/components/date-picker/DatePicker.js.map +1 -0
- package/dist/components/date-picker/PickerDialog.d.ts +121 -0
- package/dist/components/date-picker/PickerDialog.js +161 -0
- package/dist/components/date-picker/PickerDialog.js.map +1 -0
- package/dist/components/date-picker/calendar-parts.js +141 -0
- package/dist/components/date-picker/calendar-parts.js.map +1 -0
- package/dist/components/date-picker/date-format.js +72 -0
- package/dist/components/date-picker/date-format.js.map +1 -0
- package/dist/components/date-picker/date-picker-styles.d.ts +247 -0
- package/dist/components/date-picker/date-picker-styles.js +163 -0
- package/dist/components/date-picker/date-picker-styles.js.map +1 -0
- package/dist/components/date-picker/date-picker-tokens.d.ts +7 -0
- package/dist/components/date-picker/date-picker-tokens.js +104 -0
- package/dist/components/date-picker/date-picker-tokens.js.map +1 -0
- package/dist/components/date-picker/picker-dialog-context.js +8 -0
- package/dist/components/date-picker/picker-dialog-context.js.map +1 -0
- package/dist/components/date-picker/picker-dialog-styles.d.ts +95 -0
- package/dist/components/date-picker/picker-dialog-styles.js +57 -0
- package/dist/components/date-picker/picker-dialog-styles.js.map +1 -0
- package/dist/components/date-picker/picker-icons.js +24 -0
- package/dist/components/date-picker/picker-icons.js.map +1 -0
- package/dist/components/date-picker/use-media-query.js +21 -0
- package/dist/components/date-picker/use-media-query.js.map +1 -0
- package/dist/components/date-picker/use-size-transform.js +62 -0
- package/dist/components/date-picker/use-size-transform.js.map +1 -0
- package/dist/components/date-picker/use-view-exit.js +68 -0
- package/dist/components/date-picker/use-view-exit.js.map +1 -0
- package/dist/components/dialog/Dialog.d.ts +267 -0
- package/dist/components/dialog/Dialog.js +521 -0
- package/dist/components/dialog/Dialog.js.map +1 -0
- package/dist/components/dialog/dialog-styles.d.ts +335 -0
- package/dist/components/dialog/dialog-styles.js +377 -0
- package/dist/components/dialog/dialog-styles.js.map +1 -0
- package/dist/components/dialog/dialog-tokens.d.ts +7 -0
- package/dist/components/dialog/dialog-tokens.js +57 -0
- package/dist/components/dialog/dialog-tokens.js.map +1 -0
- package/dist/components/divider/Divider.d.ts +59 -0
- package/dist/components/divider/Divider.js +53 -0
- package/dist/components/divider/Divider.js.map +1 -0
- package/dist/components/divider/divider-styles.d.ts +90 -0
- package/dist/components/divider/divider-styles.js +66 -0
- package/dist/components/divider/divider-styles.js.map +1 -0
- package/dist/components/divider/divider-tokens.d.ts +7 -0
- package/dist/components/divider/divider-tokens.js +16 -0
- package/dist/components/divider/divider-tokens.js.map +1 -0
- package/dist/components/fab/Fab.d.ts +130 -0
- package/dist/components/fab/Fab.js +137 -0
- package/dist/components/fab/Fab.js.map +1 -0
- package/dist/components/fab/FabTooltip.js +36 -0
- package/dist/components/fab/FabTooltip.js.map +1 -0
- package/dist/components/fab/fab-styles.d.ts +286 -0
- package/dist/components/fab/fab-styles.js +131 -0
- package/dist/components/fab/fab-styles.js.map +1 -0
- package/dist/components/fab/fab-tokens.d.ts +12 -0
- package/dist/components/fab/fab-tokens.js +105 -0
- package/dist/components/fab/fab-tokens.js.map +1 -0
- package/dist/components/fab-menu/FabMenu.d.ts +156 -0
- package/dist/components/fab-menu/FabMenu.js +291 -0
- package/dist/components/fab-menu/FabMenu.js.map +1 -0
- package/dist/components/fab-menu/fab-menu-stagger.js +51 -0
- package/dist/components/fab-menu/fab-menu-stagger.js.map +1 -0
- package/dist/components/fab-menu/fab-menu-styles.d.ts +166 -0
- package/dist/components/fab-menu/fab-menu-styles.js +107 -0
- package/dist/components/fab-menu/fab-menu-styles.js.map +1 -0
- package/dist/components/fab-menu/fab-menu-tokens.d.ts +7 -0
- package/dist/components/fab-menu/fab-menu-tokens.js +120 -0
- package/dist/components/fab-menu/fab-menu-tokens.js.map +1 -0
- package/dist/components/icon-button/IconButton.d.ts +125 -0
- package/dist/components/icon-button/IconButton.js +112 -0
- package/dist/components/icon-button/IconButton.js.map +1 -0
- package/dist/components/icon-button/icon-button-styles.d.ts +217 -0
- package/dist/components/icon-button/icon-button-styles.js +244 -0
- package/dist/components/icon-button/icon-button-styles.js.map +1 -0
- package/dist/components/icon-button/icon-button-tokens.d.ts +11 -0
- package/dist/components/icon-button/icon-button-tokens.js +215 -0
- package/dist/components/icon-button/icon-button-tokens.js.map +1 -0
- package/dist/components/list/List.d.ts +265 -0
- package/dist/components/list/List.js +1386 -0
- package/dist/components/list/List.js.map +1 -0
- package/dist/components/list/ListMedia.d.ts +88 -0
- package/dist/components/list/ListMedia.js +132 -0
- package/dist/components/list/ListMedia.js.map +1 -0
- package/dist/components/list/list-styles.d.ts +375 -0
- package/dist/components/list/list-styles.js +220 -0
- package/dist/components/list/list-styles.js.map +1 -0
- package/dist/components/list/list-tokens.d.ts +7 -0
- package/dist/components/list/list-tokens.js +92 -0
- package/dist/components/list/list-tokens.js.map +1 -0
- package/dist/components/loading-indicator/LoadingIndicator.d.ts +65 -0
- package/dist/components/loading-indicator/LoadingIndicator.js +92 -0
- package/dist/components/loading-indicator/LoadingIndicator.js.map +1 -0
- package/dist/components/loading-indicator/lazy-loading-indicator.js +25 -0
- package/dist/components/loading-indicator/lazy-loading-indicator.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator-frames.js +149 -0
- package/dist/components/loading-indicator/loading-indicator-frames.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator-styles.d.ts +36 -0
- package/dist/components/loading-indicator/loading-indicator-styles.js +22 -0
- package/dist/components/loading-indicator/loading-indicator-styles.js.map +1 -0
- package/dist/components/loading-indicator/loading-indicator-tokens.d.ts +7 -0
- package/dist/components/loading-indicator/loading-indicator-tokens.js +44 -0
- package/dist/components/loading-indicator/loading-indicator-tokens.js.map +1 -0
- package/dist/components/menu/Menu.d.ts +215 -0
- package/dist/components/menu/Menu.js +715 -0
- package/dist/components/menu/Menu.js.map +1 -0
- package/dist/components/menu/menu-styles.d.ts +354 -0
- package/dist/components/menu/menu-styles.js +219 -0
- package/dist/components/menu/menu-styles.js.map +1 -0
- package/dist/components/menu/menu-tokens.d.ts +7 -0
- package/dist/components/menu/menu-tokens.js +93 -0
- package/dist/components/menu/menu-tokens.js.map +1 -0
- package/dist/components/menu/menu-trigger.d.ts +51 -0
- package/dist/components/menu/menu-trigger.js +100 -0
- package/dist/components/menu/menu-trigger.js.map +1 -0
- package/dist/components/menu/use-reveal-entering.js +42 -0
- package/dist/components/menu/use-reveal-entering.js.map +1 -0
- package/dist/components/navigation/NavItem.d.ts +54 -0
- package/dist/components/navigation/NavItem.js +182 -0
- package/dist/components/navigation/NavItem.js.map +1 -0
- package/dist/components/navigation/NavigationBar.d.ts +64 -0
- package/dist/components/navigation/NavigationBar.js +121 -0
- package/dist/components/navigation/NavigationBar.js.map +1 -0
- package/dist/components/navigation/NavigationRail.d.ts +91 -0
- package/dist/components/navigation/NavigationRail.js +285 -0
- package/dist/components/navigation/NavigationRail.js.map +1 -0
- package/dist/components/navigation/nav-item-styles.d.ts +190 -0
- package/dist/components/navigation/nav-item-styles.js +123 -0
- package/dist/components/navigation/nav-item-styles.js.map +1 -0
- package/dist/components/navigation/navigation-styles.d.ts +239 -0
- package/dist/components/navigation/navigation-styles.js +134 -0
- package/dist/components/navigation/navigation-styles.js.map +1 -0
- package/dist/components/navigation/navigation-tokens.d.ts +9 -0
- package/dist/components/navigation/navigation-tokens.js +114 -0
- package/dist/components/navigation/navigation-tokens.js.map +1 -0
- package/dist/components/navigation/use-hide-on-scroll.js +115 -0
- package/dist/components/navigation/use-hide-on-scroll.js.map +1 -0
- package/dist/components/navigation/use-item-arrow-keys.js +37 -0
- package/dist/components/navigation/use-item-arrow-keys.js.map +1 -0
- package/dist/components/navigation/use-rail-item-morph.js +61 -0
- package/dist/components/navigation/use-rail-item-morph.js.map +1 -0
- package/dist/components/progress/ProgressIndicator.d.ts +95 -0
- package/dist/components/progress/ProgressIndicator.js +426 -0
- package/dist/components/progress/ProgressIndicator.js.map +1 -0
- package/dist/components/progress/progress-geometry.js +285 -0
- package/dist/components/progress/progress-geometry.js.map +1 -0
- package/dist/components/progress/progress-styles.d.ts +81 -0
- package/dist/components/progress/progress-styles.js +43 -0
- package/dist/components/progress/progress-styles.js.map +1 -0
- package/dist/components/progress/progress-tokens.d.ts +7 -0
- package/dist/components/progress/progress-tokens.js +39 -0
- package/dist/components/progress/progress-tokens.js.map +1 -0
- package/dist/components/pull-to-refresh/PullToRefresh.d.ts +94 -0
- package/dist/components/pull-to-refresh/PullToRefresh.js +395 -0
- package/dist/components/pull-to-refresh/PullToRefresh.js.map +1 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-math.js +37 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-math.js.map +1 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-styles.d.ts +53 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-styles.js +14 -0
- package/dist/components/pull-to-refresh/pull-to-refresh-styles.js.map +1 -0
- package/dist/components/radio/RadioGroup.d.ts +121 -0
- package/dist/components/radio/RadioGroup.js +163 -0
- package/dist/components/radio/RadioGroup.js.map +1 -0
- package/dist/components/radio/radio-ring.js +21 -0
- package/dist/components/radio/radio-ring.js.map +1 -0
- package/dist/components/radio/radio-styles.d.ts +155 -0
- package/dist/components/radio/radio-styles.js +60 -0
- package/dist/components/radio/radio-styles.js.map +1 -0
- package/dist/components/radio/radio-tokens.d.ts +7 -0
- package/dist/components/radio/radio-tokens.js +31 -0
- package/dist/components/radio/radio-tokens.js.map +1 -0
- package/dist/components/search/SearchAppBar.d.ts +45 -0
- package/dist/components/search/SearchAppBar.js +61 -0
- package/dist/components/search/SearchAppBar.js.map +1 -0
- package/dist/components/search/SearchBar.d.ts +147 -0
- package/dist/components/search/SearchBar.js +412 -0
- package/dist/components/search/SearchBar.js.map +1 -0
- package/dist/components/search/search-styles.d.ts +243 -0
- package/dist/components/search/search-styles.js +143 -0
- package/dist/components/search/search-styles.js.map +1 -0
- package/dist/components/search/search-tokens.d.ts +9 -0
- package/dist/components/search/search-tokens.js +70 -0
- package/dist/components/search/search-tokens.js.map +1 -0
- package/dist/components/select/Select.d.ts +187 -0
- package/dist/components/select/Select.js +319 -0
- package/dist/components/select/Select.js.map +1 -0
- package/dist/components/select/field-shell.d.ts +29 -0
- package/dist/components/select/field-shell.js +135 -0
- package/dist/components/select/field-shell.js.map +1 -0
- package/dist/components/select/option-list.d.ts +81 -0
- package/dist/components/select/option-list.js +291 -0
- package/dist/components/select/option-list.js.map +1 -0
- package/dist/components/select/search-list.js +135 -0
- package/dist/components/select/search-list.js.map +1 -0
- package/dist/components/select/selection-cap.js +30 -0
- package/dist/components/select/selection-cap.js.map +1 -0
- package/dist/components/sheet/BottomSheet.d.ts +154 -0
- package/dist/components/sheet/BottomSheet.js +442 -0
- package/dist/components/sheet/BottomSheet.js.map +1 -0
- package/dist/components/sheet/SheetTrigger.d.ts +25 -0
- package/dist/components/sheet/SheetTrigger.js +46 -0
- package/dist/components/sheet/SheetTrigger.js.map +1 -0
- package/dist/components/sheet/SideSheet.d.ts +139 -0
- package/dist/components/sheet/SideSheet.js +289 -0
- package/dist/components/sheet/SideSheet.js.map +1 -0
- package/dist/components/sheet/bottom-sheet-gesture.js +30 -0
- package/dist/components/sheet/bottom-sheet-gesture.js.map +1 -0
- package/dist/components/sheet/lazy-bottom-sheet.js +33 -0
- package/dist/components/sheet/lazy-bottom-sheet.js.map +1 -0
- package/dist/components/sheet/sheet-gesture.js +48 -0
- package/dist/components/sheet/sheet-gesture.js.map +1 -0
- package/dist/components/sheet/sheet-icons.js +31 -0
- package/dist/components/sheet/sheet-icons.js.map +1 -0
- package/dist/components/sheet/sheet-settle.js +58 -0
- package/dist/components/sheet/sheet-settle.js.map +1 -0
- package/dist/components/sheet/sheet-styles.d.ts +312 -0
- package/dist/components/sheet/sheet-styles.js +229 -0
- package/dist/components/sheet/sheet-styles.js.map +1 -0
- package/dist/components/sheet/sheet-tokens.d.ts +12 -0
- package/dist/components/sheet/sheet-tokens.js +115 -0
- package/dist/components/sheet/sheet-tokens.js.map +1 -0
- package/dist/components/sheet/side-swipe-gesture.js +22 -0
- package/dist/components/sheet/side-swipe-gesture.js.map +1 -0
- package/dist/components/sheet/use-peek-inert.js +32 -0
- package/dist/components/sheet/use-peek-inert.js.map +1 -0
- package/dist/components/sheet/use-side-swipe.js +174 -0
- package/dist/components/sheet/use-side-swipe.js.map +1 -0
- package/dist/components/slider/Slider.d.ts +129 -0
- package/dist/components/slider/Slider.js +295 -0
- package/dist/components/slider/Slider.js.map +1 -0
- package/dist/components/slider/slider-geometry.js +138 -0
- package/dist/components/slider/slider-geometry.js.map +1 -0
- package/dist/components/slider/slider-styles.d.ts +133 -0
- package/dist/components/slider/slider-styles.js +97 -0
- package/dist/components/slider/slider-styles.js.map +1 -0
- package/dist/components/slider/slider-tokens.d.ts +7 -0
- package/dist/components/slider/slider-tokens.js +66 -0
- package/dist/components/slider/slider-tokens.js.map +1 -0
- package/dist/components/slider/use-touch-track.js +138 -0
- package/dist/components/slider/use-touch-track.js.map +1 -0
- package/dist/components/snackbar/Snackbar.d.ts +96 -0
- package/dist/components/snackbar/Snackbar.js +253 -0
- package/dist/components/snackbar/Snackbar.js.map +1 -0
- package/dist/components/snackbar/snackbar-state.d.ts +58 -0
- package/dist/components/snackbar/snackbar-state.js +73 -0
- package/dist/components/snackbar/snackbar-state.js.map +1 -0
- package/dist/components/snackbar/snackbar-styles.d.ts +109 -0
- package/dist/components/snackbar/snackbar-styles.js +67 -0
- package/dist/components/snackbar/snackbar-styles.js.map +1 -0
- package/dist/components/snackbar/snackbar-tokens.d.ts +7 -0
- package/dist/components/snackbar/snackbar-tokens.js +54 -0
- package/dist/components/snackbar/snackbar-tokens.js.map +1 -0
- package/dist/components/split-button/SplitButton.d.ts +109 -0
- package/dist/components/split-button/SplitButton.js +195 -0
- package/dist/components/split-button/SplitButton.js.map +1 -0
- package/dist/components/split-button/split-button-styles.d.ts +214 -0
- package/dist/components/split-button/split-button-styles.js +164 -0
- package/dist/components/split-button/split-button-styles.js.map +1 -0
- package/dist/components/split-button/split-button-tokens.d.ts +7 -0
- package/dist/components/split-button/split-button-tokens.js +36 -0
- package/dist/components/split-button/split-button-tokens.js.map +1 -0
- package/dist/components/switch/Switch.d.ts +82 -0
- package/dist/components/switch/Switch.js +165 -0
- package/dist/components/switch/Switch.js.map +1 -0
- package/dist/components/switch/switch-styles.d.ts +96 -0
- package/dist/components/switch/switch-styles.js +68 -0
- package/dist/components/switch/switch-styles.js.map +1 -0
- package/dist/components/switch/switch-thumb.js +41 -0
- package/dist/components/switch/switch-thumb.js.map +1 -0
- package/dist/components/switch/switch-tokens.d.ts +7 -0
- package/dist/components/switch/switch-tokens.js +78 -0
- package/dist/components/switch/switch-tokens.js.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +120 -0
- package/dist/components/tabs/Tabs.js +346 -0
- package/dist/components/tabs/Tabs.js.map +1 -0
- package/dist/components/tabs/tabs-styles.d.ts +198 -0
- package/dist/components/tabs/tabs-styles.js +99 -0
- package/dist/components/tabs/tabs-styles.js.map +1 -0
- package/dist/components/tabs/tabs-tokens.d.ts +7 -0
- package/dist/components/tabs/tabs-tokens.js +121 -0
- package/dist/components/tabs/tabs-tokens.js.map +1 -0
- package/dist/components/text-field/TextField.d.ts +175 -0
- package/dist/components/text-field/TextField.js +250 -0
- package/dist/components/text-field/TextField.js.map +1 -0
- package/dist/components/text-field/text-field-styles.d.ts +252 -0
- package/dist/components/text-field/text-field-styles.js +209 -0
- package/dist/components/text-field/text-field-styles.js.map +1 -0
- package/dist/components/text-field/text-field-tokens.d.ts +7 -0
- package/dist/components/text-field/text-field-tokens.js +177 -0
- package/dist/components/text-field/text-field-tokens.js.map +1 -0
- package/dist/components/time-picker/TimePicker.d.ts +142 -0
- package/dist/components/time-picker/TimePicker.js +700 -0
- package/dist/components/time-picker/TimePicker.js.map +1 -0
- package/dist/components/time-picker/time-picker-styles.d.ts +175 -0
- package/dist/components/time-picker/time-picker-styles.js +112 -0
- package/dist/components/time-picker/time-picker-styles.js.map +1 -0
- package/dist/components/time-picker/time-picker-tokens.d.ts +7 -0
- package/dist/components/time-picker/time-picker-tokens.js +86 -0
- package/dist/components/time-picker/time-picker-tokens.js.map +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +209 -0
- package/dist/components/toolbar/Toolbar.js +282 -0
- package/dist/components/toolbar/Toolbar.js.map +1 -0
- package/dist/components/toolbar/toolbar-styles.d.ts +403 -0
- package/dist/components/toolbar/toolbar-styles.js +253 -0
- package/dist/components/toolbar/toolbar-styles.js.map +1 -0
- package/dist/components/toolbar/toolbar-tokens.d.ts +27 -0
- package/dist/components/toolbar/toolbar-tokens.js +117 -0
- package/dist/components/toolbar/toolbar-tokens.js.map +1 -0
- package/dist/components/toolbar/use-toolbar-scroll-expansion.d.ts +56 -0
- package/dist/components/toolbar/use-toolbar-scroll-expansion.js +86 -0
- package/dist/components/toolbar/use-toolbar-scroll-expansion.js.map +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +131 -0
- package/dist/components/tooltip/Tooltip.js +388 -0
- package/dist/components/tooltip/Tooltip.js.map +1 -0
- package/dist/components/tooltip/lazy-tooltip.js +35 -0
- package/dist/components/tooltip/lazy-tooltip.js.map +1 -0
- package/dist/components/tooltip/tooltip-placement.d.ts +16 -0
- package/dist/components/tooltip/tooltip-placement.js +14 -0
- package/dist/components/tooltip/tooltip-placement.js.map +1 -0
- package/dist/components/tooltip/tooltip-styles.d.ts +142 -0
- package/dist/components/tooltip/tooltip-styles.js +81 -0
- package/dist/components/tooltip/tooltip-styles.js.map +1 -0
- package/dist/components/tooltip/tooltip-tokens.d.ts +9 -0
- package/dist/components/tooltip/tooltip-tokens.js +72 -0
- package/dist/components/tooltip/tooltip-tokens.js.map +1 -0
- package/dist/components/tooltip/tooltip-trigger.d.ts +42 -0
- package/dist/components/tooltip/tooltip-trigger.js +115 -0
- package/dist/components/tooltip/tooltip-trigger.js.map +1 -0
- package/dist/composites/button-group/ButtonGroup.d.ts +116 -0
- package/dist/composites/button-group/ButtonGroup.js +270 -0
- package/dist/composites/button-group/ButtonGroup.js.map +1 -0
- package/dist/composites/button-group/button-group-styles.d.ts +73 -0
- package/dist/composites/button-group/button-group-styles.js +87 -0
- package/dist/composites/button-group/button-group-styles.js.map +1 -0
- package/dist/composites/button-group/lazy-overflow-menu.js +43 -0
- package/dist/composites/button-group/lazy-overflow-menu.js.map +1 -0
- package/dist/composites/button-group/overflow-menu-list.js +26 -0
- package/dist/composites/button-group/overflow-menu-list.js.map +1 -0
- package/dist/composites/button-group/use-overflow.js +75 -0
- package/dist/composites/button-group/use-overflow.js.map +1 -0
- package/dist/composites/button-group/use-press-expansion.js +155 -0
- package/dist/composites/button-group/use-press-expansion.js.map +1 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +136 -0
- package/dist/motion/get-m3-spring.d.ts +6 -0
- package/dist/motion/get-m3-spring.js +10 -0
- package/dist/motion/get-m3-spring.js.map +1 -0
- package/dist/motion/reduced-motion.js +19 -0
- package/dist/motion/reduced-motion.js.map +1 -0
- package/dist/motion/use-m3-spring.d.ts +13 -0
- package/dist/motion/use-m3-spring.js +22 -0
- package/dist/motion/use-m3-spring.js.map +1 -0
- package/dist/next/NextRouterProvider.d.ts +13 -0
- package/dist/next/NextRouterProvider.js +26 -0
- package/dist/next/NextRouterProvider.js.map +1 -0
- package/dist/next/get-theme-from-cookies.d.ts +32 -0
- package/dist/next/get-theme-from-cookies.js +27 -0
- package/dist/next/get-theme-from-cookies.js.map +1 -0
- package/dist/next/navigation-guard.d.ts +30 -0
- package/dist/next/navigation-guard.js +68 -0
- package/dist/next/navigation-guard.js.map +1 -0
- package/dist/next.d.ts +5 -0
- package/dist/next.js +5 -0
- package/dist/primitives/ButtonBase.d.ts +115 -0
- package/dist/primitives/ButtonBase.js +231 -0
- package/dist/primitives/ButtonBase.js.map +1 -0
- package/dist/primitives/DomDirectionLocale.d.ts +18 -0
- package/dist/primitives/DomDirectionLocale.js +28 -0
- package/dist/primitives/DomDirectionLocale.js.map +1 -0
- package/dist/primitives/Field.d.ts +50 -0
- package/dist/primitives/Field.js +74 -0
- package/dist/primitives/Field.js.map +1 -0
- package/dist/primitives/IconFaces.js +23 -0
- package/dist/primitives/IconFaces.js.map +1 -0
- package/dist/primitives/Overlay.d.ts +39 -0
- package/dist/primitives/Overlay.js +86 -0
- package/dist/primitives/Overlay.js.map +1 -0
- package/dist/primitives/SelectionControl.d.ts +55 -0
- package/dist/primitives/SelectionControl.js +58 -0
- package/dist/primitives/SelectionControl.js.map +1 -0
- package/dist/primitives/Surface.d.ts +123 -0
- package/dist/primitives/Surface.js +68 -0
- package/dist/primitives/Surface.js.map +1 -0
- package/dist/primitives/ToolbarContext.js +12 -0
- package/dist/primitives/ToolbarContext.js.map +1 -0
- package/dist/primitives/TouchTarget.d.ts +14 -0
- package/dist/primitives/TouchTarget.js +20 -0
- package/dist/primitives/TouchTarget.js.map +1 -0
- package/dist/primitives/TriggerContext.d.ts +34 -0
- package/dist/primitives/TriggerContext.js +24 -0
- package/dist/primitives/TriggerContext.js.map +1 -0
- package/dist/primitives/hidden-input-focus.js +27 -0
- package/dist/primitives/hidden-input-focus.js.map +1 -0
- package/dist/primitives/icon-faces-styles.d.ts +9 -0
- package/dist/primitives/icon-faces-styles.js +45 -0
- package/dist/primitives/icon-faces-styles.js.map +1 -0
- package/dist/primitives/locale-with-direction.d.ts +9 -0
- package/dist/primitives/locale-with-direction.js +17 -0
- package/dist/primitives/locale-with-direction.js.map +1 -0
- package/dist/primitives/morph-path.d.ts +25 -0
- package/dist/primitives/morph-path.js +38 -0
- package/dist/primitives/morph-path.js.map +1 -0
- package/dist/primitives/selection-control-styles.d.ts +54 -0
- package/dist/primitives/selection-control-styles.js +44 -0
- package/dist/primitives/selection-control-styles.js.map +1 -0
- package/dist/primitives/use-m3-interaction.d.ts +51 -0
- package/dist/primitives/use-m3-interaction.js +149 -0
- package/dist/primitives/use-m3-interaction.js.map +1 -0
- package/dist/primitives/use-m3-morph.d.ts +18 -0
- package/dist/primitives/use-m3-morph.js +36 -0
- package/dist/primitives/use-m3-morph.js.map +1 -0
- package/dist/primitives/use-presence.d.ts +19 -0
- package/dist/primitives/use-presence.js +37 -0
- package/dist/primitives/use-presence.js.map +1 -0
- package/dist/primitives.d.ts +36 -0
- package/dist/primitives.js +34 -0
- package/dist/shapes/corner-rounding.d.ts +13 -0
- package/dist/shapes/corner-rounding.js +18 -0
- package/dist/shapes/corner-rounding.js.map +1 -0
- package/dist/shapes/cubic.d.ts +52 -0
- package/dist/shapes/cubic.js +189 -0
- package/dist/shapes/cubic.js.map +1 -0
- package/dist/shapes/feature-mapping.js +80 -0
- package/dist/shapes/feature-mapping.js.map +1 -0
- package/dist/shapes/features.d.ts +23 -0
- package/dist/shapes/features.js +82 -0
- package/dist/shapes/features.js.map +1 -0
- package/dist/shapes/float-mapping.js +65 -0
- package/dist/shapes/float-mapping.js.map +1 -0
- package/dist/shapes/generated/material-shape-path-record.d.ts +11 -0
- package/dist/shapes/generated/material-shape-path-record.js +48 -0
- package/dist/shapes/generated/material-shape-path-record.js.map +1 -0
- package/dist/shapes/generated/material-shape-paths.d.ts +78 -0
- package/dist/shapes/generated/material-shape-paths.js +218 -0
- package/dist/shapes/generated/material-shape-paths.js.map +1 -0
- package/dist/shapes/mask.d.ts +14 -0
- package/dist/shapes/mask.js +24 -0
- package/dist/shapes/mask.js.map +1 -0
- package/dist/shapes/material-shapes.d.ts +11 -0
- package/dist/shapes/material-shapes.js +250 -0
- package/dist/shapes/material-shapes.js.map +1 -0
- package/dist/shapes/morph.d.ts +25 -0
- package/dist/shapes/morph.js +97 -0
- package/dist/shapes/morph.js.map +1 -0
- package/dist/shapes/path.d.ts +33 -0
- package/dist/shapes/path.js +47 -0
- package/dist/shapes/path.js.map +1 -0
- package/dist/shapes/point.d.ts +28 -0
- package/dist/shapes/point.js +103 -0
- package/dist/shapes/point.js.map +1 -0
- package/dist/shapes/polygon-measure.js +140 -0
- package/dist/shapes/polygon-measure.js.map +1 -0
- package/dist/shapes/rounded-polygon.d.ts +44 -0
- package/dist/shapes/rounded-polygon.js +278 -0
- package/dist/shapes/rounded-polygon.js.map +1 -0
- package/dist/shapes/shape-path.d.ts +15 -0
- package/dist/shapes/shapes.d.ts +53 -0
- package/dist/shapes/shapes.js +171 -0
- package/dist/shapes/shapes.js.map +1 -0
- package/dist/styles/generated/components.css +710 -0
- package/dist/styles/generated/theme.css +247 -0
- package/dist/styles/generated/themes.css +3361 -0
- package/dist/styles/generated/tokens.css +284 -0
- package/dist/styles/styles.css +15 -0
- package/dist/styles/utilities.css +283 -0
- package/dist/styles.compiled.css +2 -0
- package/dist/theme/ThemeProvider.d.ts +72 -0
- package/dist/theme/ThemeProvider.js +144 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/ThemeScope.d.ts +32 -0
- package/dist/theme/ThemeScope.js +67 -0
- package/dist/theme/ThemeScope.js.map +1 -0
- package/dist/theme/ThemeScript.d.ts +26 -0
- package/dist/theme/ThemeScript.js +44 -0
- package/dist/theme/ThemeScript.js.map +1 -0
- package/dist/theme/context.d.ts +32 -0
- package/dist/theme/context.js +47 -0
- package/dist/theme/context.js.map +1 -0
- package/dist/theme/create-theme.d.ts +60 -0
- package/dist/theme/create-theme.js +47 -0
- package/dist/theme/create-theme.js.map +1 -0
- package/dist/theme/css.js +54 -0
- package/dist/theme/css.js.map +1 -0
- package/dist/theme/parse-palettes.js +40 -0
- package/dist/theme/parse-palettes.js.map +1 -0
- package/dist/theme/scheme.d.ts +6 -0
- package/dist/theme/scheme.js +118 -0
- package/dist/theme/scheme.js.map +1 -0
- package/dist/theme/state.d.ts +38 -0
- package/dist/theme/state.js +93 -0
- package/dist/theme/state.js.map +1 -0
- package/dist/theme/storage.js +21 -0
- package/dist/theme/storage.js.map +1 -0
- package/dist/tokens/breakpoints.d.ts +15 -0
- package/dist/tokens/breakpoints.js +16 -0
- package/dist/tokens/breakpoints.js.map +1 -0
- package/dist/tokens/color.d.ts +104 -0
- package/dist/tokens/color.js +147 -0
- package/dist/tokens/color.js.map +1 -0
- package/dist/tokens/component.d.ts +110 -0
- package/dist/tokens/component.js +67 -0
- package/dist/tokens/component.js.map +1 -0
- package/dist/tokens/density.d.ts +20 -0
- package/dist/tokens/density.js +27 -0
- package/dist/tokens/density.js.map +1 -0
- package/dist/tokens/elevation.d.ts +44 -0
- package/dist/tokens/elevation.js +45 -0
- package/dist/tokens/elevation.js.map +1 -0
- package/dist/tokens/motion.d.ts +79 -0
- package/dist/tokens/motion.js +126 -0
- package/dist/tokens/motion.js.map +1 -0
- package/dist/tokens/shape.d.ts +22 -0
- package/dist/tokens/shape.js +22 -0
- package/dist/tokens/shape.js.map +1 -0
- package/dist/tokens/spring-velocity.d.ts +19 -0
- package/dist/tokens/spring-velocity.js +44 -0
- package/dist/tokens/spring-velocity.js.map +1 -0
- package/dist/tokens/state.d.ts +18 -0
- package/dist/tokens/state.js +19 -0
- package/dist/tokens/state.js.map +1 -0
- package/dist/tokens/typography.d.ts +64 -0
- package/dist/tokens/typography.js +60 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/tokens/z-index.d.ts +17 -0
- package/dist/tokens/z-index.js +18 -0
- package/dist/tokens/z-index.js.map +1 -0
- package/dist/utils/announce.js +51 -0
- package/dist/utils/announce.js.map +1 -0
- package/dist/utils/assert-collection-children.js +26 -0
- package/dist/utils/assert-collection-children.js.map +1 -0
- package/dist/utils/closed-by.d.ts +9 -0
- package/dist/utils/closed-by.js +12 -0
- package/dist/utils/closed-by.js.map +1 -0
- package/dist/utils/cn.d.ts +31 -0
- package/dist/utils/cn.js +37 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/composite-keys.js +32 -0
- package/dist/utils/composite-keys.js.map +1 -0
- package/dist/utils/focus-visible.js +14 -0
- package/dist/utils/focus-visible.js.map +1 -0
- package/dist/utils/focus.js +51 -0
- package/dist/utils/focus.js.map +1 -0
- package/dist/utils/focusable-disabled.js +12 -0
- package/dist/utils/focusable-disabled.js.map +1 -0
- package/dist/utils/keep-pressed-in-place.d.ts +60 -0
- package/dist/utils/keep-pressed-in-place.js +127 -0
- package/dist/utils/keep-pressed-in-place.js.map +1 -0
- package/dist/utils/load-on-demand.js +111 -0
- package/dist/utils/load-on-demand.js.map +1 -0
- package/dist/utils/merge-data-tokens.d.ts +9 -0
- package/dist/utils/merge-data-tokens.js +15 -0
- package/dist/utils/merge-data-tokens.js.map +1 -0
- package/dist/utils/natural-size.js +53 -0
- package/dist/utils/natural-size.js.map +1 -0
- package/dist/utils/nearest-reveal.js +28 -0
- package/dist/utils/nearest-reveal.js.map +1 -0
- package/dist/utils/placement.js +14 -0
- package/dist/utils/placement.js.map +1 -0
- package/dist/utils/radio-group-keys.js +74 -0
- package/dist/utils/radio-group-keys.js.map +1 -0
- package/dist/utils/rendered-description.js +17 -0
- package/dist/utils/rendered-description.js.map +1 -0
- package/dist/utils/root-props.d.ts +103 -0
- package/dist/utils/root-props.js +51 -0
- package/dist/utils/root-props.js.map +1 -0
- package/dist/utils/search.d.ts +11 -0
- package/dist/utils/search.js +18 -0
- package/dist/utils/search.js.map +1 -0
- package/dist/utils/shortcut.js +20 -0
- package/dist/utils/shortcut.js.map +1 -0
- package/dist/utils/split-data-attributes.d.ts +12 -0
- package/dist/utils/split-data-attributes.js +20 -0
- package/dist/utils/split-data-attributes.js.map +1 -0
- package/dist/utils/toolbar-keys.js +28 -0
- package/dist/utils/toolbar-keys.js.map +1 -0
- package/dist/utils/tv.d.ts +7 -0
- package/dist/utils/tv.js +9 -0
- package/dist/utils/tv.js.map +1 -0
- package/dist/utils/typeahead.js +64 -0
- package/dist/utils/typeahead.js.map +1 -0
- package/dist/utils/warn-once.js +30 -0
- package/dist/utils/warn-once.js.map +1 -0
- package/dist/vendor/material-color-utilities/blend/blend.js +88 -0
- package/dist/vendor/material-color-utilities/blend/blend.js.map +1 -0
- package/dist/vendor/material-color-utilities/contrast/contrast.js +131 -0
- package/dist/vendor/material-color-utilities/contrast/contrast.js.map +1 -0
- package/dist/vendor/material-color-utilities/dislike/dislike_analyzer.js +58 -0
- package/dist/vendor/material-color-utilities/dislike/dislike_analyzer.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/color_spec_2021.js +620 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/color_spec_2021.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/color_spec_2025.js +786 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/color_spec_2025.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/contrast_curve.js +59 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/contrast_curve.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/dynamic_color.js +420 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/dynamic_color.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/dynamic_scheme.js +701 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/dynamic_scheme.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/material_dynamic_colors.js +374 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/material_dynamic_colors.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/tone_delta_pair.js +65 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/tone_delta_pair.js.map +1 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/variant.js +38 -0
- package/dist/vendor/material-color-utilities/dynamiccolor/variant.js.map +1 -0
- package/dist/vendor/material-color-utilities/hct/cam16.js +309 -0
- package/dist/vendor/material-color-utilities/hct/cam16.js.map +1 -0
- package/dist/vendor/material-color-utilities/hct/hct.js +148 -0
- package/dist/vendor/material-color-utilities/hct/hct.js.map +1 -0
- package/dist/vendor/material-color-utilities/hct/hct_solver.js +660 -0
- package/dist/vendor/material-color-utilities/hct/hct_solver.js.map +1 -0
- package/dist/vendor/material-color-utilities/hct/viewing_conditions.js +117 -0
- package/dist/vendor/material-color-utilities/hct/viewing_conditions.js.map +1 -0
- package/dist/vendor/material-color-utilities/index.js +51 -0
- package/dist/vendor/material-color-utilities/index.js.map +1 -0
- package/dist/vendor/material-color-utilities/palettes/core_palette.js +22 -0
- package/dist/vendor/material-color-utilities/palettes/core_palette.js.map +1 -0
- package/dist/vendor/material-color-utilities/palettes/tonal_palette.js +134 -0
- package/dist/vendor/material-color-utilities/palettes/tonal_palette.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme.js +21 -0
- package/dist/vendor/material-color-utilities/scheme/scheme.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_android.js +21 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_android.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_content.js +22 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_content.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_expressive.js +38 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_expressive.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_fidelity.js +22 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_fidelity.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_fruit_salad.js +22 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_fruit_salad.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_monochrome.js +22 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_monochrome.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_neutral.js +36 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_neutral.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_rainbow.js +22 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_rainbow.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_tonal_spot.js +41 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_tonal_spot.js.map +1 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_vibrant.js +39 -0
- package/dist/vendor/material-color-utilities/scheme/scheme_vibrant.js.map +1 -0
- package/dist/vendor/material-color-utilities/score/score.js +115 -0
- package/dist/vendor/material-color-utilities/score/score.js.map +1 -0
- package/dist/vendor/material-color-utilities/temperature/temperature_cache.js +227 -0
- package/dist/vendor/material-color-utilities/temperature/temperature_cache.js.map +1 -0
- package/dist/vendor/material-color-utilities/utils/color_utils.js +246 -0
- package/dist/vendor/material-color-utilities/utils/color_utils.js.map +1 -0
- package/dist/vendor/material-color-utilities/utils/image_utils.js +21 -0
- package/dist/vendor/material-color-utilities/utils/image_utils.js.map +1 -0
- package/dist/vendor/material-color-utilities/utils/math_utils.js +119 -0
- package/dist/vendor/material-color-utilities/utils/math_utils.js.map +1 -0
- package/dist/vendor/material-color-utilities/utils/string_utils.js +74 -0
- package/dist/vendor/material-color-utilities/utils/string_utils.js.map +1 -0
- package/dist/vendor/material-color-utilities/utils/theme_utils.js +24 -0
- package/dist/vendor/material-color-utilities/utils/theme_utils.js.map +1 -0
- package/package.json +114 -3
|
@@ -0,0 +1,1386 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { densityAttribute } from "../../tokens/density.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { useM3Interaction } from "../../primitives/use-m3-interaction.js";
|
|
5
|
+
import { TouchTarget } from "../../primitives/TouchTarget.js";
|
|
6
|
+
import { mergeDataTokens } from "../../utils/merge-data-tokens.js";
|
|
7
|
+
import { warnOnce } from "../../utils/warn-once.js";
|
|
8
|
+
import { DomDirectionLocale } from "../../primitives/DomDirectionLocale.js";
|
|
9
|
+
import { FOCUSABLE_DISABLED_OPTIONS } from "../../utils/focusable-disabled.js";
|
|
10
|
+
import { assertCollectionChildren } from "../../utils/assert-collection-children.js";
|
|
11
|
+
import { useNearestReveal } from "../../utils/nearest-reveal.js";
|
|
12
|
+
import { splitRootProps } from "../../utils/root-props.js";
|
|
13
|
+
import { preventHiddenInputScroll } from "../../primitives/hidden-input-focus.js";
|
|
14
|
+
import { CheckboxBox } from "../checkbox/checkbox-box.js";
|
|
15
|
+
import { RadioRing } from "../radio/radio-ring.js";
|
|
16
|
+
import { switchStyles } from "../switch/switch-styles.js";
|
|
17
|
+
import { CheckIcon, CloseIcon, SwitchThumb, thumbGeometry } from "../switch/switch-thumb.js";
|
|
18
|
+
import { useKeepPressedInPlace } from "../../utils/keep-pressed-in-place.js";
|
|
19
|
+
import { listStyles } from "./list-styles.js";
|
|
20
|
+
import { ListMediaContext } from "./ListMedia.js";
|
|
21
|
+
import { Children, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
22
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { VisuallyHidden, mergeProps, mergeRefs, useButton, useCheckbox, useFocusRing, useGridList, useGridListItem, useGridListSection, useHover, useLink, useListBox, useListBoxSection, useObjectRef, useOption, useRadio, useRadioGroup, useTree, useTreeItem } from "react-aria";
|
|
24
|
+
import { useListState, useRadioGroupState, useToggleState, useTreeState } from "react-stately";
|
|
25
|
+
//#region src/components/list/List.tsx
|
|
26
|
+
/**
|
|
27
|
+
* A `ListItem` renders itself only in a plain or radio list, which hand it its place through
|
|
28
|
+
* context. Interactive lists read its props through `getCollectionNode` and never render it.
|
|
29
|
+
*/
|
|
30
|
+
function ListItemElement(props) {
|
|
31
|
+
const entry = useContext(ListEntryContext);
|
|
32
|
+
const radio = useContext(RadioListContext);
|
|
33
|
+
const plain = useContext(StaticListContext);
|
|
34
|
+
if (!entry) return null;
|
|
35
|
+
if (radio) return /* @__PURE__ */ jsx(RadioListItem, {
|
|
36
|
+
item: props,
|
|
37
|
+
radio,
|
|
38
|
+
position: entry.position
|
|
39
|
+
});
|
|
40
|
+
if (plain) return /* @__PURE__ */ jsx(StaticListItem, {
|
|
41
|
+
item: props,
|
|
42
|
+
list: plain,
|
|
43
|
+
entry
|
|
44
|
+
});
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Describes the item to React Stately's collection builder, as its `Item` does: the
|
|
49
|
+
* headline is the item's content, and `childItems` are its nested items.
|
|
50
|
+
*/
|
|
51
|
+
ListItemElement.getCollectionNode = function* getCollectionNode(props) {
|
|
52
|
+
const rendered = props.children;
|
|
53
|
+
const textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
|
|
54
|
+
if (!textValue) warnOnce("list-item-text-value", "[@windmorph/react] A ListItem whose headline is not plain text needs a textValue for type-ahead.");
|
|
55
|
+
const children = listItems(props.childItems);
|
|
56
|
+
yield {
|
|
57
|
+
type: "item",
|
|
58
|
+
props,
|
|
59
|
+
rendered,
|
|
60
|
+
textValue,
|
|
61
|
+
"aria-label": props["aria-label"],
|
|
62
|
+
hasChildNodes: children.length > 0,
|
|
63
|
+
*childNodes() {
|
|
64
|
+
for (const element of children) yield {
|
|
65
|
+
type: "item",
|
|
66
|
+
element
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* An item of a {@link List}. Like React Stately's collection `Item`, the list reads its
|
|
73
|
+
* props; identify it with a React `key`.
|
|
74
|
+
*/
|
|
75
|
+
const ListItem = ListItemElement;
|
|
76
|
+
/**
|
|
77
|
+
* A `ListSection` renders itself only in a plain list: its subheader, and its items, each
|
|
78
|
+
* told through context that it sits in this section and where. Interactive lists read it
|
|
79
|
+
* through `getCollectionNode`. It never needs its type compared, so a section created in a
|
|
80
|
+
* Server Component (whose type reaches the client as a lazy client reference) renders the
|
|
81
|
+
* same as one created in the browser.
|
|
82
|
+
*/
|
|
83
|
+
function ListSectionElement(props) {
|
|
84
|
+
const entry = useContext(ListEntryContext);
|
|
85
|
+
const plain = useContext(StaticListContext);
|
|
86
|
+
if (useContext(RadioListContext)) throw new Error("[@windmorph/react] List: a radio list can't hold ListSections. Use one radio list per group, or a list with selectionMode=\"single\".");
|
|
87
|
+
const register = plain?.registerSection;
|
|
88
|
+
const index = entry?.index;
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
if (register == null || index == null || entry?.inSection) return void 0;
|
|
91
|
+
return register(index);
|
|
92
|
+
}, [
|
|
93
|
+
register,
|
|
94
|
+
index,
|
|
95
|
+
entry?.inSection
|
|
96
|
+
]);
|
|
97
|
+
if (!plain || !entry) return null;
|
|
98
|
+
const items = listItems(props.children);
|
|
99
|
+
return /* @__PURE__ */ jsx(StaticSection, {
|
|
100
|
+
section: props,
|
|
101
|
+
variant: plain.variant,
|
|
102
|
+
classNames: plain.classNames,
|
|
103
|
+
children: items.map((item, itemIndex) => /* @__PURE__ */ jsx(ListEntryContext, {
|
|
104
|
+
value: {
|
|
105
|
+
index: itemIndex,
|
|
106
|
+
position: position(itemIndex, items.length),
|
|
107
|
+
inSection: true,
|
|
108
|
+
disabled: plain.isKeyDisabled(item.key)
|
|
109
|
+
},
|
|
110
|
+
children: item
|
|
111
|
+
}, item.key ?? itemIndex))
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** Describes the section to React Stately's collection builder, as its `Section` does. */
|
|
115
|
+
ListSectionElement.getCollectionNode = function* getCollectionNode(props) {
|
|
116
|
+
const children = listItems(props.children);
|
|
117
|
+
yield {
|
|
118
|
+
type: "section",
|
|
119
|
+
props,
|
|
120
|
+
rendered: props.title,
|
|
121
|
+
"aria-label": props["aria-label"],
|
|
122
|
+
hasChildNodes: true,
|
|
123
|
+
*childNodes() {
|
|
124
|
+
for (const element of children) yield {
|
|
125
|
+
type: "item",
|
|
126
|
+
element
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A labelled group of items in a {@link List}, under a subheader (`title`). Identify it with
|
|
133
|
+
* a React `key`, like its items. Arrow keys move across sections as through one list.
|
|
134
|
+
* Sections go in static, action (grid) and selection (list box) lists, not in radio lists
|
|
135
|
+
* or lists with `childItems`.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* <List aria-label="Settings" onAction={open}>
|
|
139
|
+
* <ListSection key="network" title="Network">
|
|
140
|
+
* <ListItem key="wifi">Wi‑Fi</ListItem>
|
|
141
|
+
* </ListSection>
|
|
142
|
+
* </List>
|
|
143
|
+
*/
|
|
144
|
+
const ListSection = ListSectionElement;
|
|
145
|
+
const ListOptionsContext = createContext({});
|
|
146
|
+
/**
|
|
147
|
+
* M3 Expressive list: items with a headline, optional overline and supporting text, and
|
|
148
|
+
* leading and trailing content, flush (standard) or segmented into rounded groups.
|
|
149
|
+
*
|
|
150
|
+
* With `selectionMode` it is a list box of options (`listbox` / `option`), and selected items
|
|
151
|
+
* show a check. With `onAction` or links it is an interactive grid list, where ← / → reach
|
|
152
|
+
* trailing controls. Items with `childItems` expand and collapse (a tree grid). Interactive
|
|
153
|
+
* items get state layers and morph their corners on hover, focus, press and selection, and
|
|
154
|
+
* ↑ / ↓ move between them, wrapping at the ends. Otherwise it is a plain `ul`.
|
|
155
|
+
*
|
|
156
|
+
* Items can lead with M3's image or video thumbnail (`ListItemImage`, `ListItemVideo`),
|
|
157
|
+
* limit their lines (`headlineLines`, `supportingTextLines`), and standard lists can draw
|
|
158
|
+
* `dividers`.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* <List variant="segmented" aria-label="Settings" onAction={open}>
|
|
162
|
+
* <ListItem key="wifi" leading={<WifiIcon />} supportingText="Connected">Wi‑Fi</ListItem>
|
|
163
|
+
* <ListItem key="bluetooth" leading={<BluetoothIcon />}>Bluetooth</ListItem>
|
|
164
|
+
* </List>
|
|
165
|
+
*/
|
|
166
|
+
function List({ density, ...props }) {
|
|
167
|
+
const { headlineLines, supportingTextLines, dividers, selectionIndicator, classNames } = props;
|
|
168
|
+
if (dividers != null && props.variant === "segmented") throw new Error("[@windmorph/react] List: dividers are for standard lists; segmented items are already apart.");
|
|
169
|
+
return /* @__PURE__ */ jsx(ListOptionsContext, {
|
|
170
|
+
value: {
|
|
171
|
+
headlineLines,
|
|
172
|
+
supportingTextLines,
|
|
173
|
+
dividers,
|
|
174
|
+
selectionIndicator
|
|
175
|
+
},
|
|
176
|
+
children: /* @__PURE__ */ jsx(ListMediaContext, {
|
|
177
|
+
value: classNames?.media,
|
|
178
|
+
children: /* @__PURE__ */ jsx(ListBody, {
|
|
179
|
+
...props,
|
|
180
|
+
...densityAttribute(density)
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const RADIO_ITEM_ERROR = "[@windmorph/react] List: every item of a radio list (one with value, defaultValue or onChange) needs a value, and none can have a control or an href.";
|
|
186
|
+
const CONTROL_ERROR = "[@windmorph/react] List: switch and checkbox items (control) can't be in a list with onAction, links, selectionMode or childItems. Put them in their own list, or put a Switch in an item's trailing content.";
|
|
187
|
+
const EXPANDABLE_SECTIONS_ERROR = "[@windmorph/react] List: a list with childItems can't hold ListSections; nest the groups as expandable items instead.";
|
|
188
|
+
/**
|
|
189
|
+
* Picks the list's kind from its own props and its top-level entries' props; it never looks
|
|
190
|
+
* at an entry's element type. A plain or radio list renders its entries, which place
|
|
191
|
+
* themselves through context (`ListEntryContext`); an interactive list hands them to React
|
|
192
|
+
* Stately's collection builder, which reads each through its `getCollectionNode`.
|
|
193
|
+
*/
|
|
194
|
+
function ListBody(props) {
|
|
195
|
+
const entries = listItems(props.children);
|
|
196
|
+
if (props.value !== void 0 || props.defaultValue !== void 0 || props.onChange !== void 0) return /* @__PURE__ */ jsx(RadioList, {
|
|
197
|
+
...props,
|
|
198
|
+
entries
|
|
199
|
+
});
|
|
200
|
+
const selectable = props.selectionMode != null && props.selectionMode !== "none";
|
|
201
|
+
const expandable = entries.some((entry) => listItems(entry.props.childItems).length > 0);
|
|
202
|
+
if (!(props.onAction != null || selectable || expandable)) return /* @__PURE__ */ jsx(StaticList, {
|
|
203
|
+
...props,
|
|
204
|
+
entries
|
|
205
|
+
});
|
|
206
|
+
return /* @__PURE__ */ jsx(InteractiveList, {
|
|
207
|
+
...props,
|
|
208
|
+
expandable
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function itemLines(item) {
|
|
212
|
+
const extra = Number(item.overline != null) + Number(item.supportingText != null);
|
|
213
|
+
return extra === 2 ? 3 : extra === 1 ? 2 : 1;
|
|
214
|
+
}
|
|
215
|
+
function itemStylesOptions(item, variant, interactive, options) {
|
|
216
|
+
const headlineLines = item.headlineLines ?? options.headlineLines;
|
|
217
|
+
const supportingTextLines = item.supportingTextLines ?? options.supportingTextLines;
|
|
218
|
+
return {
|
|
219
|
+
variant,
|
|
220
|
+
interactive,
|
|
221
|
+
lines: itemLines(item),
|
|
222
|
+
...item.verticalAlignment && { align: item.verticalAlignment },
|
|
223
|
+
...options.dividers && { dividers: options.dividers },
|
|
224
|
+
...headlineLines && { headlineLines },
|
|
225
|
+
...supportingTextLines && { supportingTextLines }
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function itemStyles(item, variant, interactive, options) {
|
|
229
|
+
return listStyles(itemStylesOptions(item, variant, interactive, options));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The component tokens' hooks (`list-tokens.ts`), on a list's root and on each item, so an
|
|
233
|
+
* item's own state (`data-selected`) picks its colours. On the root, any set the app passed
|
|
234
|
+
* (`props`) follows the list's own.
|
|
235
|
+
*/
|
|
236
|
+
function tokenAttributes(variant, props) {
|
|
237
|
+
return {
|
|
238
|
+
"data-tokens": mergeDataTokens("md-comp-list", props),
|
|
239
|
+
"data-variant": variant ?? "standard"
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/** An item's token hooks and its `data-slot`. */
|
|
243
|
+
function itemAttributes(variant) {
|
|
244
|
+
return {
|
|
245
|
+
...tokenAttributes(variant),
|
|
246
|
+
"data-slot": "item"
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function position(index, count) {
|
|
250
|
+
if (count === 1) return "only";
|
|
251
|
+
if (index === 0) return "first";
|
|
252
|
+
return index === count - 1 ? "last" : "middle";
|
|
253
|
+
}
|
|
254
|
+
function ItemContent({ item, styles, classNames, ids, control, controlPlacement, headline, sideClassName, end, textHidden }) {
|
|
255
|
+
const leading = controlPlacement === "start" ? control : null;
|
|
256
|
+
const trailing = controlPlacement === "end" ? control : end;
|
|
257
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
258
|
+
(item.leading != null || leading != null) && /* @__PURE__ */ jsxs("span", {
|
|
259
|
+
ref: (cell) => hideDecorativeIcons(cell),
|
|
260
|
+
"data-slot": "leading",
|
|
261
|
+
className: styles.leading({ class: cn(sideClassName, classNames?.leading) }),
|
|
262
|
+
children: [leading, item.leading]
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsxs("span", {
|
|
265
|
+
"aria-hidden": textHidden || void 0,
|
|
266
|
+
className: styles.text({ class: classNames?.text }),
|
|
267
|
+
children: [
|
|
268
|
+
item.overline != null && /* @__PURE__ */ jsx("span", {
|
|
269
|
+
id: ids?.overline,
|
|
270
|
+
"data-slot": "overline",
|
|
271
|
+
className: styles.overline({ class: classNames?.overline }),
|
|
272
|
+
children: item.overline
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsx("span", {
|
|
275
|
+
id: ids?.headline,
|
|
276
|
+
"data-slot": "headline",
|
|
277
|
+
className: styles.headline({ class: classNames?.headline }),
|
|
278
|
+
children: headline ? headline(item.children) : item.children
|
|
279
|
+
}),
|
|
280
|
+
item.supportingText != null && /* @__PURE__ */ jsx("span", {
|
|
281
|
+
id: ids?.supporting,
|
|
282
|
+
"data-slot": "supporting",
|
|
283
|
+
className: styles.supporting({ class: classNames?.supportingText }),
|
|
284
|
+
children: item.supportingText
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
}),
|
|
288
|
+
(item.trailing != null || trailing != null) && /* @__PURE__ */ jsxs("span", {
|
|
289
|
+
ref: (cell) => hideDecorativeIcons(cell),
|
|
290
|
+
"data-slot": "trailing",
|
|
291
|
+
className: styles.trailing({ class: cn(sideClassName, classNames?.trailing) }),
|
|
292
|
+
children: [item.trailing, trailing]
|
|
293
|
+
})
|
|
294
|
+
] });
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Hides the bare icons of an item's leading or trailing content from assistive tech: an
|
|
298
|
+
* `<svg>` child with no name of its own (`aria-label`, `aria-labelledby`, `role`, `<title>`)
|
|
299
|
+
* is decorative, since the item's text names the item, and would otherwise be listed as an
|
|
300
|
+
* unnamed image. A ref callback, so it also reaches icons that components render; it runs
|
|
301
|
+
* on every render (no layout reads), so a replaced icon is hidden too.
|
|
302
|
+
*/
|
|
303
|
+
function hideDecorativeIcons(cell) {
|
|
304
|
+
if (!cell) return;
|
|
305
|
+
for (const svg of cell.querySelectorAll(":scope > svg")) {
|
|
306
|
+
if (svg.hasAttribute("aria-label") || svg.hasAttribute("aria-labelledby") || svg.hasAttribute("role") || svg.querySelector(":scope > title")) continue;
|
|
307
|
+
svg.setAttribute("aria-hidden", "true");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const StaticListContext = createContext(null);
|
|
311
|
+
const ListEntryContext = createContext(null);
|
|
312
|
+
/**
|
|
313
|
+
* The positions of a plain list's top-level entries: each run of items between sections is
|
|
314
|
+
* its own group. Sections are known once they've told the list (`registerSection`); before
|
|
315
|
+
* that (the server render and the first client render) every entry counts as an item.
|
|
316
|
+
*/
|
|
317
|
+
function entryPositions(count, sections) {
|
|
318
|
+
const positions = [];
|
|
319
|
+
let start = 0;
|
|
320
|
+
for (let index = 0; index <= count; index += 1) {
|
|
321
|
+
if (index < count && !sections.has(index)) continue;
|
|
322
|
+
for (let item = start; item < index; item += 1) positions[item] = position(item - start, index - start);
|
|
323
|
+
if (index < count) positions[index] = "only";
|
|
324
|
+
start = index + 1;
|
|
325
|
+
}
|
|
326
|
+
return positions;
|
|
327
|
+
}
|
|
328
|
+
function StaticList({ variant, disabled, classNames, className, style, ref, entries, ...rest }) {
|
|
329
|
+
const { root: data } = splitRootProps(rest);
|
|
330
|
+
const rootTokens = tokenAttributes(variant, data);
|
|
331
|
+
const { "aria-label": label, "aria-labelledby": labelledBy } = rest;
|
|
332
|
+
const root = listStyles({ variant }).root({ class: cn(classNames?.root, className) });
|
|
333
|
+
const [sections, setSections] = useState(() => /* @__PURE__ */ new Set());
|
|
334
|
+
const registerSection = useCallback((index) => {
|
|
335
|
+
setSections((current) => current.has(index) ? current : new Set(current).add(index));
|
|
336
|
+
return () => setSections((current) => {
|
|
337
|
+
const next = new Set(current);
|
|
338
|
+
next.delete(index);
|
|
339
|
+
return next;
|
|
340
|
+
});
|
|
341
|
+
}, []);
|
|
342
|
+
const disabledKeys = rest.disabledKeys;
|
|
343
|
+
const list = useMemo(() => {
|
|
344
|
+
const keys = new Set(disabledKeys ?? []);
|
|
345
|
+
return {
|
|
346
|
+
variant,
|
|
347
|
+
classNames,
|
|
348
|
+
isKeyDisabled: (key) => Boolean(disabled) || key != null && keys.has(key),
|
|
349
|
+
registerSection
|
|
350
|
+
};
|
|
351
|
+
}, [
|
|
352
|
+
variant,
|
|
353
|
+
classNames,
|
|
354
|
+
disabled,
|
|
355
|
+
disabledKeys,
|
|
356
|
+
registerSection
|
|
357
|
+
]);
|
|
358
|
+
const positions = entryPositions(entries.length, sections);
|
|
359
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
360
|
+
...data,
|
|
361
|
+
...rootTokens,
|
|
362
|
+
id: rest.id,
|
|
363
|
+
ref,
|
|
364
|
+
style,
|
|
365
|
+
"aria-label": label,
|
|
366
|
+
"aria-labelledby": labelledBy,
|
|
367
|
+
onKeyDown: onLinkArrowKeys,
|
|
368
|
+
className: root,
|
|
369
|
+
children: /* @__PURE__ */ jsx(StaticListContext, {
|
|
370
|
+
value: list,
|
|
371
|
+
children: entries.map((entry, index) => /* @__PURE__ */ jsx(ListEntryContext, {
|
|
372
|
+
value: {
|
|
373
|
+
index,
|
|
374
|
+
position: positions[index],
|
|
375
|
+
inSection: false,
|
|
376
|
+
disabled: list.isKeyDisabled(entry.key)
|
|
377
|
+
},
|
|
378
|
+
children: entry
|
|
379
|
+
}, entry.key ?? index))
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
/** An item of a plain list: a link, a switch or checkbox, or a plain row. */
|
|
384
|
+
function StaticListItem({ item, list, entry }) {
|
|
385
|
+
const options = useContext(ListOptionsContext);
|
|
386
|
+
if (entry.inSection && listItems(item.childItems).length > 0) throw new Error(EXPANDABLE_SECTIONS_ERROR);
|
|
387
|
+
const { variant, classNames } = list;
|
|
388
|
+
const isDisabled = Boolean(entry.disabled || item.disabled);
|
|
389
|
+
if (item.href != null) return /* @__PURE__ */ jsx(LinkItem, {
|
|
390
|
+
item,
|
|
391
|
+
variant,
|
|
392
|
+
classNames,
|
|
393
|
+
position: entry.position,
|
|
394
|
+
isDisabled
|
|
395
|
+
});
|
|
396
|
+
if (item.control != null) return /* @__PURE__ */ jsx("li", {
|
|
397
|
+
"data-list-entry": "",
|
|
398
|
+
children: /* @__PURE__ */ jsx(ToggleItem, {
|
|
399
|
+
item,
|
|
400
|
+
control: item.control,
|
|
401
|
+
variant,
|
|
402
|
+
classNames,
|
|
403
|
+
position: entry.position,
|
|
404
|
+
listDisabled: isDisabled
|
|
405
|
+
})
|
|
406
|
+
});
|
|
407
|
+
const styles = itemStyles(item, variant, false, options);
|
|
408
|
+
return /* @__PURE__ */ jsx("li", {
|
|
409
|
+
"data-list-entry": "",
|
|
410
|
+
"data-shape": "rest",
|
|
411
|
+
"data-position": entry.position,
|
|
412
|
+
...itemAttributes(variant),
|
|
413
|
+
className: styles.item({ class: cn(classNames?.item, item.className) }),
|
|
414
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
415
|
+
className: styles.cell(),
|
|
416
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
417
|
+
item,
|
|
418
|
+
styles,
|
|
419
|
+
classNames
|
|
420
|
+
})
|
|
421
|
+
})
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Arrow keys between a list's links (M3: "navigate within the list using arrow keys"):
|
|
426
|
+
* ↑ / ↓ move focus to the previous or next link, wrapping at the ends, and Home / End to
|
|
427
|
+
* the first and last. Each link stays a real anchor and a Tab stop; disabled items have no
|
|
428
|
+
* link and are skipped.
|
|
429
|
+
*/
|
|
430
|
+
function onLinkArrowKeys(event) {
|
|
431
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
432
|
+
if (![
|
|
433
|
+
"ArrowUp",
|
|
434
|
+
"ArrowDown",
|
|
435
|
+
"Home",
|
|
436
|
+
"End"
|
|
437
|
+
].includes(event.key)) return;
|
|
438
|
+
const links = [...event.currentTarget.querySelectorAll("a[href][data-list-link]")];
|
|
439
|
+
const index = links.indexOf(event.target);
|
|
440
|
+
if (index === -1) return;
|
|
441
|
+
const last = links.length - 1;
|
|
442
|
+
const target = event.key === "Home" ? 0 : event.key === "End" ? last : event.key === "ArrowDown" ? index === last ? 0 : index + 1 : index === 0 ? last : index - 1;
|
|
443
|
+
event.preventDefault();
|
|
444
|
+
links[target].focus();
|
|
445
|
+
}
|
|
446
|
+
/** The collection's top-level nodes as groups: each section, and each run of items. */
|
|
447
|
+
function groupNodes(collection) {
|
|
448
|
+
const groups = [];
|
|
449
|
+
for (const node of collection) {
|
|
450
|
+
if (node.type === "section") {
|
|
451
|
+
const items = [...collection.getChildren(node.key)].filter((child) => child.type === "item");
|
|
452
|
+
groups.push({
|
|
453
|
+
section: node,
|
|
454
|
+
items
|
|
455
|
+
});
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
const last = groups.at(-1);
|
|
459
|
+
if (last?.section === null) last.items.push(node);
|
|
460
|
+
else groups.push({
|
|
461
|
+
section: null,
|
|
462
|
+
items: [node]
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
return groups;
|
|
466
|
+
}
|
|
467
|
+
/** The name of a section's group: its `aria-label`, else its subheader. */
|
|
468
|
+
function sectionNaming(section, headingId) {
|
|
469
|
+
return section["aria-label"] != null ? { "aria-label": section["aria-label"] } : { "aria-labelledby": headingId };
|
|
470
|
+
}
|
|
471
|
+
/** A section of a plain list: a subheader and a nested list named by it. */
|
|
472
|
+
function StaticSection({ section, variant, classNames, children }) {
|
|
473
|
+
const headingId = useId();
|
|
474
|
+
const styles = listStyles({
|
|
475
|
+
variant,
|
|
476
|
+
titled: section.title != null
|
|
477
|
+
});
|
|
478
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
479
|
+
"data-slot": "section",
|
|
480
|
+
className: styles.section({ class: cn(classNames?.section, section.className) }),
|
|
481
|
+
children: [section.title != null && /* @__PURE__ */ jsx("div", {
|
|
482
|
+
id: headingId,
|
|
483
|
+
className: styles.subheader({ class: classNames?.subheader }),
|
|
484
|
+
children: section.title
|
|
485
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
486
|
+
...sectionNaming(section, headingId),
|
|
487
|
+
className: styles.group(),
|
|
488
|
+
children
|
|
489
|
+
})]
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
function InteractiveList(props) {
|
|
493
|
+
return /* @__PURE__ */ jsx(DomDirectionLocale, { children: (directionRef) => /* @__PURE__ */ jsx(CollectionList, {
|
|
494
|
+
...props,
|
|
495
|
+
directionRef
|
|
496
|
+
}) });
|
|
497
|
+
}
|
|
498
|
+
/** Material Symbols "check" and "expand_more" (Apache-2.0). */
|
|
499
|
+
function CheckIcon20() {
|
|
500
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
501
|
+
viewBox: "0 -960 960 960",
|
|
502
|
+
fill: "currentColor",
|
|
503
|
+
"aria-hidden": "true",
|
|
504
|
+
focusable: "false",
|
|
505
|
+
children: /* @__PURE__ */ jsx("path", { d: "M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" })
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function ExpandMoreIcon() {
|
|
509
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
510
|
+
viewBox: "0 -960 960 960",
|
|
511
|
+
"aria-hidden": "true",
|
|
512
|
+
focusable: "false",
|
|
513
|
+
children: /* @__PURE__ */ jsx("path", { d: "M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z" })
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* A grid list (`onAction`, links), a list box (selection) or a tree grid (`childItems`),
|
|
518
|
+
* from React Aria's collection hooks. Arrow keys wrap at the ends, as M3 asks.
|
|
519
|
+
*/
|
|
520
|
+
function CollectionList({ expandable, variant, disabled, deselectable = true, classNames, className, style, ref, directionRef, ...rest }) {
|
|
521
|
+
const { root: data, rest: ariaProps } = splitRootProps(rest);
|
|
522
|
+
assertCollectionChildren(rest.children, "List", "ListItem elements");
|
|
523
|
+
const scan = useCollectionScan(rest.children);
|
|
524
|
+
if (scan.items.some((item) => item.control != null)) throw new Error(CONTROL_ERROR);
|
|
525
|
+
if (expandable && scan.sectioned) throw new Error(EXPANDABLE_SECTIONS_ERROR);
|
|
526
|
+
const selectable = rest.selectionMode != null && rest.selectionMode !== "none";
|
|
527
|
+
const kind = expandable ? "tree" : selectable && rest.onAction == null && !scan.items.some((item) => item.href != null) ? "listbox" : "grid";
|
|
528
|
+
const disabledKeys = new Set(rest.disabledKeys ?? []);
|
|
529
|
+
for (const [key, item] of scan.entries) if (disabled || item.disabled) disabledKeys.add(key);
|
|
530
|
+
const root = {
|
|
531
|
+
options: {
|
|
532
|
+
...ariaProps,
|
|
533
|
+
disabledKeys: disabledKeys.size > 0 ? disabledKeys : rest.disabledKeys,
|
|
534
|
+
disallowEmptySelection: !deselectable,
|
|
535
|
+
...FOCUSABLE_DISABLED_OPTIONS,
|
|
536
|
+
shouldFocusWrap: true
|
|
537
|
+
},
|
|
538
|
+
listRef: ref,
|
|
539
|
+
directionRef,
|
|
540
|
+
data: {
|
|
541
|
+
...data,
|
|
542
|
+
...tokenAttributes(variant, data)
|
|
543
|
+
},
|
|
544
|
+
style,
|
|
545
|
+
className: listStyles({ variant }).root({ class: cn(classNames?.root, className) }),
|
|
546
|
+
variant,
|
|
547
|
+
classNames
|
|
548
|
+
};
|
|
549
|
+
if (kind === "tree") return /* @__PURE__ */ jsx(TreeList, { ...root });
|
|
550
|
+
if (kind === "listbox") return /* @__PURE__ */ jsx(ListBoxList, { ...root });
|
|
551
|
+
return /* @__PURE__ */ jsx(GridList, { ...root });
|
|
552
|
+
}
|
|
553
|
+
function GridList({ options, listRef, directionRef, data, style, className, variant, classNames }) {
|
|
554
|
+
const rootRef = useObjectRef(listRef);
|
|
555
|
+
const state = useListState(options);
|
|
556
|
+
const { gridProps } = useGridList(options, state, rootRef);
|
|
557
|
+
useNearestReveal(rootRef);
|
|
558
|
+
return /* @__PURE__ */ jsx("div", {
|
|
559
|
+
...mergeProps(data, gridProps),
|
|
560
|
+
ref: (element) => {
|
|
561
|
+
rootRef.current = element;
|
|
562
|
+
directionRef(element);
|
|
563
|
+
},
|
|
564
|
+
style,
|
|
565
|
+
className,
|
|
566
|
+
children: groupNodes(state.collection).map((group) => {
|
|
567
|
+
const rows = group.items.map((node, index) => /* @__PURE__ */ jsx(GridListRow, {
|
|
568
|
+
node,
|
|
569
|
+
state,
|
|
570
|
+
variant,
|
|
571
|
+
classNames,
|
|
572
|
+
position: position(index, group.items.length)
|
|
573
|
+
}, node.key));
|
|
574
|
+
return group.section ? /* @__PURE__ */ jsx(GridListSection, {
|
|
575
|
+
node: group.section,
|
|
576
|
+
state,
|
|
577
|
+
variant,
|
|
578
|
+
classNames,
|
|
579
|
+
children: rows
|
|
580
|
+
}, group.section.key) : rows;
|
|
581
|
+
})
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* A section of a grid list: a row group named by its subheader, a header row holding a row
|
|
586
|
+
* header (React Aria's `GridListSection` structure), then the items' rows.
|
|
587
|
+
*/
|
|
588
|
+
function GridListSection({ node, state, variant, classNames, children }) {
|
|
589
|
+
const ref = useRef(null);
|
|
590
|
+
const section = node.props;
|
|
591
|
+
const { rowProps, rowHeaderProps, rowGroupProps } = useGridListSection({ "aria-label": section["aria-label"] }, state, ref);
|
|
592
|
+
const styles = listStyles({
|
|
593
|
+
variant,
|
|
594
|
+
titled: section.title != null
|
|
595
|
+
});
|
|
596
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
597
|
+
...rowGroupProps,
|
|
598
|
+
...section["aria-label"] != null && { "aria-labelledby": void 0 },
|
|
599
|
+
ref,
|
|
600
|
+
className: styles.section({ class: cn(classNames?.section, section.className) }),
|
|
601
|
+
children: [section.title != null && /* @__PURE__ */ jsx("div", {
|
|
602
|
+
...rowProps,
|
|
603
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
604
|
+
...rowHeaderProps,
|
|
605
|
+
className: styles.subheader({ class: classNames?.subheader }),
|
|
606
|
+
children: section.title
|
|
607
|
+
})
|
|
608
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
609
|
+
role: "presentation",
|
|
610
|
+
className: styles.group(),
|
|
611
|
+
children
|
|
612
|
+
})]
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/** Compose's shape precedence: pressed, then selected or focused (16px), then hovered (12px). */
|
|
616
|
+
function shapeOf(state) {
|
|
617
|
+
if (state.isPressed && !state.isDisabled || state.isSelected || state.isFocusVisible) return "active";
|
|
618
|
+
return state.isHovered && !state.isDisabled ? "hovered" : "rest";
|
|
619
|
+
}
|
|
620
|
+
/** The check a selected item shows at its end, when the list selects and shows it. */
|
|
621
|
+
function useSelectionCheck(styles, selectable, className) {
|
|
622
|
+
const { selectionIndicator = true } = useContext(ListOptionsContext);
|
|
623
|
+
if (!selectable || !selectionIndicator) return null;
|
|
624
|
+
return /* @__PURE__ */ jsx("span", {
|
|
625
|
+
"aria-hidden": "true",
|
|
626
|
+
"data-selection-indicator": "",
|
|
627
|
+
className: styles.selectionIndicator({ class: className }),
|
|
628
|
+
children: /* @__PURE__ */ jsx(CheckIcon20, {})
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
function GridListRow({ node, state, variant, classNames, position: itemPosition }) {
|
|
632
|
+
const item = node.props;
|
|
633
|
+
const ref = useRef(null);
|
|
634
|
+
const { rowProps: ownRowProps, gridCellProps, descriptionProps, isPressed, isSelected } = useGridListItem({ node }, state, ref);
|
|
635
|
+
const isDisabled = state.disabledKeys.has(node.key);
|
|
636
|
+
const rowProps = isDisabled ? focusOnly(ownRowProps) : ownRowProps;
|
|
637
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
638
|
+
const { interactionProps, dataAttributes } = useM3Interaction({
|
|
639
|
+
isDisabled,
|
|
640
|
+
isPressed
|
|
641
|
+
}, ref);
|
|
642
|
+
const shape = shapeOf({
|
|
643
|
+
isPressed,
|
|
644
|
+
isSelected,
|
|
645
|
+
isFocusVisible: dataAttributes["data-focus-visible"] != null,
|
|
646
|
+
isHovered,
|
|
647
|
+
isDisabled
|
|
648
|
+
});
|
|
649
|
+
const styles = itemStyles(item, variant, true, useContext(ListOptionsContext));
|
|
650
|
+
const check = useSelectionCheck(styles, state.selectionManager.selectionMode !== "none", classNames?.selectionIndicator);
|
|
651
|
+
return /* @__PURE__ */ jsx("div", {
|
|
652
|
+
...mergeProps(rowProps, hoverProps, interactionProps),
|
|
653
|
+
...dataAttributes,
|
|
654
|
+
"aria-disabled": isDisabled || void 0,
|
|
655
|
+
ref,
|
|
656
|
+
"data-selected": isSelected || void 0,
|
|
657
|
+
"data-shape": shape,
|
|
658
|
+
"data-position": itemPosition,
|
|
659
|
+
...itemAttributes(variant),
|
|
660
|
+
className: styles.item({ class: cn(classNames?.item, item.className) }),
|
|
661
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
662
|
+
...gridCellProps,
|
|
663
|
+
className: styles.cell(),
|
|
664
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
665
|
+
item,
|
|
666
|
+
styles,
|
|
667
|
+
classNames,
|
|
668
|
+
ids: { supporting: descriptionProps.id },
|
|
669
|
+
end: check
|
|
670
|
+
})
|
|
671
|
+
})
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
const FOCUSABLE = "a[href], button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])";
|
|
675
|
+
/**
|
|
676
|
+
* A disabled item's props: its role, ARIA, id, tab index and focus handlers, but no press, key
|
|
677
|
+
* or pointer handlers, so it takes focus (APG) and does nothing else.
|
|
678
|
+
*/
|
|
679
|
+
function focusOnly(props) {
|
|
680
|
+
return Object.fromEntries(Object.entries(props).filter(([name]) => !/^on[A-Z]/.test(name) || name === "onFocus" || name === "onBlur"));
|
|
681
|
+
}
|
|
682
|
+
/** A list box of options: M3's single- and multi-select lists on the web. */
|
|
683
|
+
function ListBoxList({ options, listRef, directionRef, data, style, className, variant, classNames }) {
|
|
684
|
+
const rootRef = useObjectRef(listRef);
|
|
685
|
+
const listBoxOptions = options;
|
|
686
|
+
const state = useListState(listBoxOptions);
|
|
687
|
+
const { listBoxProps } = useListBox(listBoxOptions, state, rootRef);
|
|
688
|
+
useNearestReveal(rootRef);
|
|
689
|
+
return /* @__PURE__ */ jsx("div", {
|
|
690
|
+
...mergeProps(data, listBoxProps),
|
|
691
|
+
ref: (element) => {
|
|
692
|
+
rootRef.current = element;
|
|
693
|
+
directionRef(element);
|
|
694
|
+
},
|
|
695
|
+
style,
|
|
696
|
+
className,
|
|
697
|
+
children: groupNodes(state.collection).map((group) => {
|
|
698
|
+
const rows = group.items.map((node, index) => /* @__PURE__ */ jsx(OptionRow, {
|
|
699
|
+
node,
|
|
700
|
+
state,
|
|
701
|
+
variant,
|
|
702
|
+
classNames,
|
|
703
|
+
position: position(index, group.items.length)
|
|
704
|
+
}, node.key));
|
|
705
|
+
return group.section ? /* @__PURE__ */ jsx(ListBoxSection, {
|
|
706
|
+
node: group.section,
|
|
707
|
+
variant,
|
|
708
|
+
classNames,
|
|
709
|
+
children: rows
|
|
710
|
+
}, group.section.key) : rows;
|
|
711
|
+
})
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
/** A section of a list box: a subheader and a group of options named by it. */
|
|
715
|
+
function ListBoxSection({ node, variant, classNames, children }) {
|
|
716
|
+
const section = node.props;
|
|
717
|
+
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
718
|
+
heading: section.title,
|
|
719
|
+
"aria-label": section["aria-label"]
|
|
720
|
+
});
|
|
721
|
+
const styles = listStyles({
|
|
722
|
+
variant,
|
|
723
|
+
titled: section.title != null
|
|
724
|
+
});
|
|
725
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
726
|
+
...itemProps,
|
|
727
|
+
className: styles.section({ class: cn(classNames?.section, section.className) }),
|
|
728
|
+
children: [section.title != null && /* @__PURE__ */ jsx("div", {
|
|
729
|
+
...headingProps,
|
|
730
|
+
className: styles.subheader({ class: classNames?.subheader }),
|
|
731
|
+
children: section.title
|
|
732
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
733
|
+
...groupProps,
|
|
734
|
+
...section["aria-label"] != null && { "aria-labelledby": void 0 },
|
|
735
|
+
className: styles.group(),
|
|
736
|
+
children
|
|
737
|
+
})]
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function OptionRow({ node, state, variant, classNames, position: itemPosition }) {
|
|
741
|
+
const item = node.props;
|
|
742
|
+
const ref = useRef(null);
|
|
743
|
+
const { optionProps: ownOptionProps, isPressed, isSelected } = useOption({ key: node.key }, state, ref);
|
|
744
|
+
const isDisabled = state.disabledKeys.has(node.key);
|
|
745
|
+
const optionProps = isDisabled ? {
|
|
746
|
+
...focusOnly(ownOptionProps),
|
|
747
|
+
"aria-disabled": true
|
|
748
|
+
} : ownOptionProps;
|
|
749
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
750
|
+
const { interactionProps, dataAttributes } = useM3Interaction({
|
|
751
|
+
isDisabled,
|
|
752
|
+
isPressed
|
|
753
|
+
}, ref);
|
|
754
|
+
const shape = shapeOf({
|
|
755
|
+
isPressed,
|
|
756
|
+
isSelected,
|
|
757
|
+
isFocusVisible: dataAttributes["data-focus-visible"] != null,
|
|
758
|
+
isHovered,
|
|
759
|
+
isDisabled
|
|
760
|
+
});
|
|
761
|
+
const styles = itemStyles(item, variant, true, useContext(ListOptionsContext));
|
|
762
|
+
const check = useSelectionCheck(styles, true, classNames?.selectionIndicator);
|
|
763
|
+
useEffect(() => {
|
|
764
|
+
if (process.env.NODE_ENV === "production") return;
|
|
765
|
+
const nested = ref.current?.querySelector(FOCUSABLE);
|
|
766
|
+
if (nested) console.warn("[@windmorph/react] List: an item of a selection list is one option and must not hold buttons, links or fields. Give the list onAction to keep separate trailing actions.", nested);
|
|
767
|
+
});
|
|
768
|
+
return /* @__PURE__ */ jsx("div", {
|
|
769
|
+
...mergeProps(optionProps, hoverProps, interactionProps),
|
|
770
|
+
...dataAttributes,
|
|
771
|
+
"aria-labelledby": void 0,
|
|
772
|
+
"aria-describedby": void 0,
|
|
773
|
+
ref,
|
|
774
|
+
"data-selected": isSelected || void 0,
|
|
775
|
+
"data-shape": shape,
|
|
776
|
+
"data-position": itemPosition,
|
|
777
|
+
...itemAttributes(variant),
|
|
778
|
+
className: styles.item({ class: cn(classNames?.item, item.className) }),
|
|
779
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
780
|
+
className: styles.cell(),
|
|
781
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
782
|
+
item,
|
|
783
|
+
styles,
|
|
784
|
+
classNames,
|
|
785
|
+
end: check
|
|
786
|
+
})
|
|
787
|
+
})
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
/** A tree grid: items with `childItems` expand and collapse to show their nested items. */
|
|
791
|
+
function TreeList({ options, listRef, directionRef, data, style, className, variant, classNames }) {
|
|
792
|
+
const rootRef = useObjectRef(listRef);
|
|
793
|
+
const treeOptions = options;
|
|
794
|
+
const state = useTreeState(treeOptions);
|
|
795
|
+
const { gridProps } = useTree(treeOptions, state, rootRef);
|
|
796
|
+
const { shown, onExited, version } = useRowPresence([...state.collection.getKeys()].map((key) => state.collection.getItem(key)).filter((node) => node?.type === "item"));
|
|
797
|
+
const { capture, release } = useKeepPressedInPlace("[role=row]", version, shown.some((row) => row.exiting));
|
|
798
|
+
const reveal = listStyles({ variant });
|
|
799
|
+
return /* @__PURE__ */ jsx("div", {
|
|
800
|
+
...mergeProps(data, gridProps, {
|
|
801
|
+
onPointerDownCapture: capture,
|
|
802
|
+
onKeyDownCapture: capture,
|
|
803
|
+
onPointerUpCapture: release,
|
|
804
|
+
onKeyUpCapture: release,
|
|
805
|
+
onClickCapture: (event) => {
|
|
806
|
+
if (event.detail === 0) capture(event);
|
|
807
|
+
release();
|
|
808
|
+
}
|
|
809
|
+
}),
|
|
810
|
+
ref: (element) => {
|
|
811
|
+
rootRef.current = element;
|
|
812
|
+
directionRef(element);
|
|
813
|
+
},
|
|
814
|
+
style,
|
|
815
|
+
className,
|
|
816
|
+
children: shown.map((row) => /* @__PURE__ */ jsx(TreeRowReveal, {
|
|
817
|
+
row,
|
|
818
|
+
onExited,
|
|
819
|
+
className: reveal.reveal(),
|
|
820
|
+
clipClassName: reveal.revealClip(),
|
|
821
|
+
children: row.exiting ? /* @__PURE__ */ jsx(TreeRowGhost, {
|
|
822
|
+
node: row.node,
|
|
823
|
+
selectable: state.selectionManager.selectionMode !== "none",
|
|
824
|
+
variant,
|
|
825
|
+
classNames,
|
|
826
|
+
position: row.position
|
|
827
|
+
}) : /* @__PURE__ */ jsx(TreeRow, {
|
|
828
|
+
node: row.node,
|
|
829
|
+
state,
|
|
830
|
+
variant,
|
|
831
|
+
classNames,
|
|
832
|
+
position: row.position
|
|
833
|
+
})
|
|
834
|
+
}, row.node.key))
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
/** Whether the reader asks for reduced motion (read on a change, never on the server). */
|
|
838
|
+
const prefersReducedMotion = () => typeof window !== "undefined" && (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false);
|
|
839
|
+
/**
|
|
840
|
+
* The rows to render: the tree's visible rows, plus rows that just left it (a collapsed
|
|
841
|
+
* item's nested rows) in their old place until their closing transition ends. Rows added
|
|
842
|
+
* after the first render are marked to open in.
|
|
843
|
+
*/
|
|
844
|
+
function useRowPresence(rows) {
|
|
845
|
+
const live = (node, index, appear) => ({
|
|
846
|
+
node,
|
|
847
|
+
position: position(index, rows.length),
|
|
848
|
+
appear,
|
|
849
|
+
exiting: false
|
|
850
|
+
});
|
|
851
|
+
const keys = rows.map((node) => node.key);
|
|
852
|
+
const [presence, setPresence] = useState(() => ({
|
|
853
|
+
keys,
|
|
854
|
+
shown: rows.map((node, index) => live(node, index, false))
|
|
855
|
+
}));
|
|
856
|
+
let { shown } = presence;
|
|
857
|
+
if (keys.length !== presence.keys.length || keys.some((key, i) => key !== presence.keys[i])) {
|
|
858
|
+
const indexOf = new Map(rows.map((node, index) => [node.key, index]));
|
|
859
|
+
const before = new Map(shown.map((row) => [row.node.key, row]));
|
|
860
|
+
const next = [];
|
|
861
|
+
let cursor = 0;
|
|
862
|
+
const takeUpTo = (end) => {
|
|
863
|
+
for (; cursor <= end; cursor += 1) {
|
|
864
|
+
const node = rows[cursor];
|
|
865
|
+
const previous = before.get(node.key);
|
|
866
|
+
next.push(live(node, cursor, previous ? previous.appear : true));
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
for (const row of shown) {
|
|
870
|
+
const index = indexOf.get(row.node.key);
|
|
871
|
+
if (index === void 0) next.push({
|
|
872
|
+
...row,
|
|
873
|
+
exiting: true
|
|
874
|
+
});
|
|
875
|
+
else if (index >= cursor) takeUpTo(index);
|
|
876
|
+
}
|
|
877
|
+
takeUpTo(rows.length - 1);
|
|
878
|
+
shown = next.some((row) => !row.exiting && !before.has(row.node.key)) && next.some((row) => row.exiting) && prefersReducedMotion() ? next.filter((row) => !row.exiting) : next;
|
|
879
|
+
setPresence({
|
|
880
|
+
keys,
|
|
881
|
+
shown
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
const onExited = useCallback((key) => setPresence((current) => ({
|
|
885
|
+
...current,
|
|
886
|
+
shown: current.shown.filter((row) => !(row.exiting && row.node.key === key))
|
|
887
|
+
})), []);
|
|
888
|
+
const current = new Map(rows.map((node) => [node.key, node]));
|
|
889
|
+
return {
|
|
890
|
+
shown: shown.map((row) => row.exiting ? row : {
|
|
891
|
+
...row,
|
|
892
|
+
node: current.get(row.node.key)
|
|
893
|
+
}),
|
|
894
|
+
onExited,
|
|
895
|
+
/** Changes whenever the rows shown change. */
|
|
896
|
+
version: presence
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* A tree row's wrapper, which opens its height and fades it in when the row appears, and
|
|
901
|
+
* closes it when the row leaves, then lets it go. Nothing in a leaving row can be focused
|
|
902
|
+
* or read.
|
|
903
|
+
*/
|
|
904
|
+
function TreeRowReveal({ row, onExited, className, clipClassName, children }) {
|
|
905
|
+
const ref = useRef(null);
|
|
906
|
+
const { exiting, node } = row;
|
|
907
|
+
useEffect(() => {
|
|
908
|
+
if (!exiting) return;
|
|
909
|
+
const transitions = ref.current?.getAnimations?.() ?? [];
|
|
910
|
+
if (transitions.length === 0) {
|
|
911
|
+
onExited(node.key);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
let current = true;
|
|
915
|
+
Promise.allSettled(transitions.map((transition) => transition.finished)).then(() => {
|
|
916
|
+
if (current) onExited(node.key);
|
|
917
|
+
});
|
|
918
|
+
return () => {
|
|
919
|
+
current = false;
|
|
920
|
+
};
|
|
921
|
+
}, [
|
|
922
|
+
exiting,
|
|
923
|
+
node.key,
|
|
924
|
+
onExited
|
|
925
|
+
]);
|
|
926
|
+
return /* @__PURE__ */ jsx("div", {
|
|
927
|
+
ref,
|
|
928
|
+
"data-appear": row.appear || void 0,
|
|
929
|
+
"data-exiting": exiting || void 0,
|
|
930
|
+
inert: exiting || void 0,
|
|
931
|
+
className,
|
|
932
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
933
|
+
className: clipClassName,
|
|
934
|
+
children
|
|
935
|
+
})
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
/** A leaving row's picture while it closes: the row at rest, hidden from assistive tech. */
|
|
939
|
+
function TreeRowGhost({ node, selectable, variant, classNames, position: itemPosition }) {
|
|
940
|
+
const item = node.props;
|
|
941
|
+
const options = useContext(ListOptionsContext);
|
|
942
|
+
const styles = listStyles({
|
|
943
|
+
...itemStylesOptions(item, variant, true, options),
|
|
944
|
+
nested: node.level > 0
|
|
945
|
+
});
|
|
946
|
+
const check = useSelectionCheck(styles, selectable, classNames?.selectionIndicator);
|
|
947
|
+
const chevron = node.hasChildNodes && /* @__PURE__ */ jsx("span", {
|
|
948
|
+
className: styles.expand({ class: classNames?.expandButton }),
|
|
949
|
+
children: /* @__PURE__ */ jsx(ExpandMoreIcon, {})
|
|
950
|
+
});
|
|
951
|
+
return /* @__PURE__ */ jsx("div", {
|
|
952
|
+
"aria-hidden": "true",
|
|
953
|
+
style: { "--m3-list-level": node.level },
|
|
954
|
+
"data-shape": "rest",
|
|
955
|
+
"data-position": itemPosition,
|
|
956
|
+
...itemAttributes(variant),
|
|
957
|
+
className: styles.item({ class: cn(classNames?.item, item.className) }),
|
|
958
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
959
|
+
className: styles.cell(),
|
|
960
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
961
|
+
item,
|
|
962
|
+
styles,
|
|
963
|
+
classNames,
|
|
964
|
+
end: check || chevron ? /* @__PURE__ */ jsxs(Fragment$1, { children: [check, chevron] }) : null
|
|
965
|
+
})
|
|
966
|
+
})
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* React Aria's tree item reads a row's siblings (for `aria-posinset` and `aria-setsize`)
|
|
971
|
+
* through `collection.getChildren` and each sibling's `nextKey`, which React Stately's
|
|
972
|
+
* `TreeCollection` doesn't provide: its `nextKey` and `index` follow the visible rows, as
|
|
973
|
+
* keyboard navigation needs. While the row's hook runs, this gives the collection the
|
|
974
|
+
* nested items' own order, and the returned function restores it. React Aria keys its
|
|
975
|
+
* per-list data by the state object, so the state itself has to be the one patched.
|
|
976
|
+
*/
|
|
977
|
+
function withSiblingOrder(state, node) {
|
|
978
|
+
const collection = state.collection;
|
|
979
|
+
const visibleItem = collection.getItem.bind(collection);
|
|
980
|
+
const siblingsOf = (parentKey) => (parentKey == null ? [...collection] : [...visibleItem(parentKey)?.childNodes ?? []]).filter((sibling) => sibling.type === "item");
|
|
981
|
+
const inSiblingOrder = (item) => {
|
|
982
|
+
const siblings = siblingsOf(item.parentKey);
|
|
983
|
+
const index = siblings.findIndex((sibling) => sibling.key === item.key);
|
|
984
|
+
return {
|
|
985
|
+
...item,
|
|
986
|
+
index,
|
|
987
|
+
nextKey: siblings[index + 1]?.key ?? null
|
|
988
|
+
};
|
|
989
|
+
};
|
|
990
|
+
collection.getItem = (key) => {
|
|
991
|
+
const item = visibleItem(key);
|
|
992
|
+
return item ? inSiblingOrder(item) : null;
|
|
993
|
+
};
|
|
994
|
+
collection.getChildren = (key) => siblingsOf(key).map(inSiblingOrder);
|
|
995
|
+
return {
|
|
996
|
+
node: inSiblingOrder(node),
|
|
997
|
+
restore: () => {
|
|
998
|
+
delete collection.getItem;
|
|
999
|
+
delete collection.getChildren;
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
function ExpandButton({ props, className }) {
|
|
1004
|
+
const ref = useRef(null);
|
|
1005
|
+
const { buttonProps, isPressed } = useButton(props, ref);
|
|
1006
|
+
const { interactionProps, dataAttributes } = useM3Interaction({
|
|
1007
|
+
isDisabled: props.isDisabled,
|
|
1008
|
+
isPressed
|
|
1009
|
+
}, ref);
|
|
1010
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
1011
|
+
...mergeProps(buttonProps, interactionProps),
|
|
1012
|
+
...dataAttributes,
|
|
1013
|
+
ref,
|
|
1014
|
+
className,
|
|
1015
|
+
children: [/* @__PURE__ */ jsx(TouchTarget, { className: "h-[min(48px,calc(56px+var(--md-sys-density,0)*4px))]" }), /* @__PURE__ */ jsx(ExpandMoreIcon, {})]
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
function TreeRow({ node, state, variant, classNames, position: itemPosition }) {
|
|
1019
|
+
const item = node.props;
|
|
1020
|
+
const ref = useRef(null);
|
|
1021
|
+
const siblingOrder = withSiblingOrder(state, node);
|
|
1022
|
+
const { rowProps, gridCellProps, descriptionProps, expandButtonProps, isPressed, isSelected } = useTreeItem({
|
|
1023
|
+
node: siblingOrder.node,
|
|
1024
|
+
hasChildItems: node.hasChildNodes
|
|
1025
|
+
}, state, ref);
|
|
1026
|
+
siblingOrder.restore();
|
|
1027
|
+
const isDisabled = state.disabledKeys.has(node.key);
|
|
1028
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
1029
|
+
const { interactionProps, dataAttributes } = useM3Interaction({
|
|
1030
|
+
isDisabled,
|
|
1031
|
+
isPressed
|
|
1032
|
+
}, ref);
|
|
1033
|
+
const shape = shapeOf({
|
|
1034
|
+
isPressed,
|
|
1035
|
+
isSelected,
|
|
1036
|
+
isFocusVisible: dataAttributes["data-focus-visible"] != null,
|
|
1037
|
+
isHovered,
|
|
1038
|
+
isDisabled
|
|
1039
|
+
});
|
|
1040
|
+
const options = useContext(ListOptionsContext);
|
|
1041
|
+
const styles = listStyles({
|
|
1042
|
+
...itemStylesOptions(item, variant, true, options),
|
|
1043
|
+
nested: node.level > 0
|
|
1044
|
+
});
|
|
1045
|
+
const check = useSelectionCheck(styles, state.selectionManager.selectionMode !== "none", classNames?.selectionIndicator);
|
|
1046
|
+
const end = check != null || node.hasChildNodes ? /* @__PURE__ */ jsxs(Fragment$1, { children: [check, node.hasChildNodes && /* @__PURE__ */ jsx(ExpandButton, {
|
|
1047
|
+
props: {
|
|
1048
|
+
...expandButtonProps,
|
|
1049
|
+
isDisabled
|
|
1050
|
+
},
|
|
1051
|
+
className: styles.expand({ class: classNames?.expandButton })
|
|
1052
|
+
})] }) : null;
|
|
1053
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1054
|
+
...mergeProps(isDisabled ? focusOnly(rowProps) : rowProps, hoverProps, interactionProps),
|
|
1055
|
+
...dataAttributes,
|
|
1056
|
+
"aria-disabled": isDisabled || void 0,
|
|
1057
|
+
ref,
|
|
1058
|
+
style: { "--m3-list-level": node.level },
|
|
1059
|
+
"data-selected": isSelected || void 0,
|
|
1060
|
+
"data-shape": shape,
|
|
1061
|
+
"data-position": itemPosition,
|
|
1062
|
+
...itemAttributes(variant),
|
|
1063
|
+
className: styles.item({ class: cn(classNames?.item, item.className) }),
|
|
1064
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1065
|
+
...gridCellProps,
|
|
1066
|
+
className: styles.cell(),
|
|
1067
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
1068
|
+
item,
|
|
1069
|
+
styles,
|
|
1070
|
+
classNames,
|
|
1071
|
+
ids: { supporting: descriptionProps.id },
|
|
1072
|
+
end
|
|
1073
|
+
})
|
|
1074
|
+
})
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* The items of an interactive list's collection, as React Stately's collection builder reads
|
|
1079
|
+
* them (each entry describes itself through `getCollectionNode`), top-level and in sections,
|
|
1080
|
+
* and whether it has sections. The list picks its kind and its disabled keys from these.
|
|
1081
|
+
*/
|
|
1082
|
+
function useCollectionScan(children) {
|
|
1083
|
+
const { collection } = useListState({ children });
|
|
1084
|
+
return useMemo(() => {
|
|
1085
|
+
const entries = [];
|
|
1086
|
+
let sectioned = false;
|
|
1087
|
+
for (const node of collection) if (node.type === "section") {
|
|
1088
|
+
sectioned = true;
|
|
1089
|
+
for (const child of collection.getChildren(node.key)) if (child.type === "item") entries.push([child.key, child.props]);
|
|
1090
|
+
} else if (node.type === "item") entries.push([node.key, node.props]);
|
|
1091
|
+
return {
|
|
1092
|
+
entries,
|
|
1093
|
+
items: entries.map(([, item]) => item),
|
|
1094
|
+
sectioned
|
|
1095
|
+
};
|
|
1096
|
+
}, [collection]);
|
|
1097
|
+
}
|
|
1098
|
+
/** Ids that name an item that is a control (its headline) and describe it (the rest). */
|
|
1099
|
+
function useItemIds(item) {
|
|
1100
|
+
const id = useId();
|
|
1101
|
+
const ids = {
|
|
1102
|
+
headline: `${id}-headline`,
|
|
1103
|
+
...item.overline != null && { overline: `${id}-overline` },
|
|
1104
|
+
...item.supportingText != null && { supporting: `${id}-supporting` }
|
|
1105
|
+
};
|
|
1106
|
+
const described = [ids.overline, ids.supporting].filter(Boolean).join(" ");
|
|
1107
|
+
return {
|
|
1108
|
+
ids,
|
|
1109
|
+
naming: {
|
|
1110
|
+
...item["aria-label"] != null ? { "aria-label": item["aria-label"] } : { "aria-labelledby": ids.headline },
|
|
1111
|
+
...described && { "aria-describedby": described }
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
/** A switch or checkbox item: a visually hidden native input, the item as its label. */
|
|
1116
|
+
function ToggleItem({ item, control, listDisabled, ...view }) {
|
|
1117
|
+
const inputRef = useRef(null);
|
|
1118
|
+
const { ids, naming } = useItemIds(item);
|
|
1119
|
+
const isDisabled = Boolean(listDisabled || item.disabled);
|
|
1120
|
+
const options = {
|
|
1121
|
+
...naming,
|
|
1122
|
+
children: item.children,
|
|
1123
|
+
isSelected: item.checked,
|
|
1124
|
+
defaultSelected: item.defaultChecked,
|
|
1125
|
+
onChange: item.onCheckedChange,
|
|
1126
|
+
isDisabled,
|
|
1127
|
+
name: item.name,
|
|
1128
|
+
value: item.value
|
|
1129
|
+
};
|
|
1130
|
+
const state = useToggleState(options);
|
|
1131
|
+
const { inputProps, labelProps, isSelected, isPressed } = useCheckbox(options, state, inputRef);
|
|
1132
|
+
return /* @__PURE__ */ jsx(ControlItem, {
|
|
1133
|
+
...view,
|
|
1134
|
+
item,
|
|
1135
|
+
ids,
|
|
1136
|
+
kind: control,
|
|
1137
|
+
inputProps: control === "switch" ? {
|
|
1138
|
+
...inputProps,
|
|
1139
|
+
role: "switch"
|
|
1140
|
+
} : inputProps,
|
|
1141
|
+
inputRef,
|
|
1142
|
+
labelProps,
|
|
1143
|
+
isSelected,
|
|
1144
|
+
isDisabled,
|
|
1145
|
+
isPressed,
|
|
1146
|
+
placement: item.controlPlacement ?? (control === "switch" ? "end" : "start")
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
function RadioList({ variant, classNames, className, style, ref, value, defaultValue, onChange, name, required, disabled, controlPlacement = "start", entries, ...rest }) {
|
|
1150
|
+
const { root: data } = splitRootProps(rest);
|
|
1151
|
+
const { "aria-label": label, "aria-labelledby": labelledBy } = rest;
|
|
1152
|
+
const options = {
|
|
1153
|
+
id: rest.id,
|
|
1154
|
+
"aria-label": label,
|
|
1155
|
+
"aria-labelledby": labelledBy,
|
|
1156
|
+
value,
|
|
1157
|
+
defaultValue,
|
|
1158
|
+
onChange,
|
|
1159
|
+
name,
|
|
1160
|
+
isRequired: required,
|
|
1161
|
+
isDisabled: disabled
|
|
1162
|
+
};
|
|
1163
|
+
const state = useRadioGroupState(options);
|
|
1164
|
+
const { radioGroupProps } = useRadioGroup(options, state);
|
|
1165
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1166
|
+
...mergeProps(data, radioGroupProps),
|
|
1167
|
+
...tokenAttributes(variant, data),
|
|
1168
|
+
ref,
|
|
1169
|
+
style,
|
|
1170
|
+
className: listStyles({ variant }).root({ class: cn(classNames?.root, className) }),
|
|
1171
|
+
children: /* @__PURE__ */ jsx(RadioListContext, {
|
|
1172
|
+
value: {
|
|
1173
|
+
state,
|
|
1174
|
+
variant,
|
|
1175
|
+
classNames,
|
|
1176
|
+
controlPlacement
|
|
1177
|
+
},
|
|
1178
|
+
children: entries.map((entry, index) => /* @__PURE__ */ jsx(ListEntryContext, {
|
|
1179
|
+
value: {
|
|
1180
|
+
index,
|
|
1181
|
+
position: position(index, entries.length),
|
|
1182
|
+
inSection: false,
|
|
1183
|
+
disabled: false
|
|
1184
|
+
},
|
|
1185
|
+
children: entry
|
|
1186
|
+
}, entry.key ?? index))
|
|
1187
|
+
})
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
const RadioListContext = createContext(null);
|
|
1191
|
+
/** An item of a radio list: a radio button with the item's `value`. */
|
|
1192
|
+
function RadioListItem({ item, radio, position: itemPosition }) {
|
|
1193
|
+
if (item.value == null || item.control != null || item.href != null) throw new Error(RADIO_ITEM_ERROR);
|
|
1194
|
+
return /* @__PURE__ */ jsx(RadioItem, {
|
|
1195
|
+
item,
|
|
1196
|
+
state: radio.state,
|
|
1197
|
+
variant: radio.variant,
|
|
1198
|
+
classNames: radio.classNames,
|
|
1199
|
+
position: itemPosition,
|
|
1200
|
+
placement: item.controlPlacement ?? radio.controlPlacement
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
function RadioItem({ item, state, placement, ...view }) {
|
|
1204
|
+
const inputRef = useRef(null);
|
|
1205
|
+
const { ids, naming } = useItemIds(item);
|
|
1206
|
+
const { inputProps, labelProps, isSelected, isDisabled, isPressed } = useRadio({
|
|
1207
|
+
...naming,
|
|
1208
|
+
children: item.children,
|
|
1209
|
+
value: item.value ?? "",
|
|
1210
|
+
isDisabled: item.disabled
|
|
1211
|
+
}, state, inputRef);
|
|
1212
|
+
return /* @__PURE__ */ jsx(ControlItem, {
|
|
1213
|
+
...view,
|
|
1214
|
+
item,
|
|
1215
|
+
ids,
|
|
1216
|
+
kind: "radio",
|
|
1217
|
+
inputProps,
|
|
1218
|
+
inputRef,
|
|
1219
|
+
labelProps,
|
|
1220
|
+
isSelected,
|
|
1221
|
+
isDisabled,
|
|
1222
|
+
isPressed,
|
|
1223
|
+
placement
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* An item that is a switch, checkbox or radio button (Compose's toggleable and selectable
|
|
1228
|
+
* `ListItem`s): the item is the input's `<label>`, so pressing anywhere on it changes it,
|
|
1229
|
+
* with the list item's state layer, shapes and selected colours. The drawn control only
|
|
1230
|
+
* shows the state.
|
|
1231
|
+
*/
|
|
1232
|
+
function ControlItem({ item, ids, kind, inputProps, inputRef, labelProps, isSelected, isDisabled, isPressed, placement, variant, classNames, position: itemPosition }) {
|
|
1233
|
+
const ref = useRef(null);
|
|
1234
|
+
const hiddenInputRef = useMemo(() => mergeRefs(inputRef, preventHiddenInputScroll), [inputRef]);
|
|
1235
|
+
const { interactionProps, dataAttributes, state } = useM3Interaction({
|
|
1236
|
+
isDisabled,
|
|
1237
|
+
isPressed,
|
|
1238
|
+
isSelected,
|
|
1239
|
+
within: true
|
|
1240
|
+
}, ref);
|
|
1241
|
+
const shape = isPressed && !isDisabled || isSelected || state.isFocusVisible ? "active" : state.isHovered && !isDisabled ? "hovered" : "rest";
|
|
1242
|
+
const styles = itemStyles(item, variant, true, useContext(ListOptionsContext));
|
|
1243
|
+
const controlState = {
|
|
1244
|
+
"data-checked": isSelected || void 0,
|
|
1245
|
+
"data-disabled": isDisabled || void 0
|
|
1246
|
+
};
|
|
1247
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
1248
|
+
...mergeProps(labelProps, interactionProps),
|
|
1249
|
+
...dataAttributes,
|
|
1250
|
+
ref,
|
|
1251
|
+
"data-shape": shape,
|
|
1252
|
+
"data-position": itemPosition,
|
|
1253
|
+
...itemAttributes(variant),
|
|
1254
|
+
className: styles.item({ class: cn(classNames?.item, item.className) }),
|
|
1255
|
+
children: [/* @__PURE__ */ jsx(VisuallyHidden, {
|
|
1256
|
+
elementType: "span",
|
|
1257
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
1258
|
+
...inputProps,
|
|
1259
|
+
ref: hiddenInputRef
|
|
1260
|
+
})
|
|
1261
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1262
|
+
className: styles.cell(),
|
|
1263
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
1264
|
+
item,
|
|
1265
|
+
styles,
|
|
1266
|
+
classNames,
|
|
1267
|
+
ids,
|
|
1268
|
+
controlPlacement: placement,
|
|
1269
|
+
textHidden: true,
|
|
1270
|
+
control: /* @__PURE__ */ jsxs("span", {
|
|
1271
|
+
...controlState,
|
|
1272
|
+
"aria-hidden": "true",
|
|
1273
|
+
className: styles.control({ class: classNames?.control }),
|
|
1274
|
+
children: [
|
|
1275
|
+
kind === "radio" && /* @__PURE__ */ jsx(RadioRing, {}),
|
|
1276
|
+
kind === "checkbox" && /* @__PURE__ */ jsx(CheckboxBox, {}),
|
|
1277
|
+
kind === "switch" && /* @__PURE__ */ jsx(SwitchTrack, {
|
|
1278
|
+
selected: isSelected,
|
|
1279
|
+
icons: item.switchIcons
|
|
1280
|
+
})
|
|
1281
|
+
]
|
|
1282
|
+
})
|
|
1283
|
+
})
|
|
1284
|
+
})]
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
/** A switch's track and thumb, at rest (the item, not the switch, takes the interaction). */
|
|
1288
|
+
function SwitchTrack({ selected, icons }) {
|
|
1289
|
+
const styles = switchStyles();
|
|
1290
|
+
const icon = icons ? selected ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CloseIcon, {}) : null;
|
|
1291
|
+
const { size, center } = thumbGeometry(selected, false, Boolean(icon));
|
|
1292
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1293
|
+
"data-tokens": "md-comp-switch",
|
|
1294
|
+
"data-slot": "track",
|
|
1295
|
+
className: styles.control(),
|
|
1296
|
+
style: {
|
|
1297
|
+
"--m3-thumb-size": `${size}px`,
|
|
1298
|
+
"--m3-thumb-center": `${center}px`
|
|
1299
|
+
},
|
|
1300
|
+
children: /* @__PURE__ */ jsx(SwitchThumb, {
|
|
1301
|
+
styles,
|
|
1302
|
+
icon
|
|
1303
|
+
})
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* The `ListItem` elements, flattened from arrays, with the keys they were given. `Children`
|
|
1308
|
+
* also unwraps lazy elements, which a server component's items can arrive as (Next's dev
|
|
1309
|
+
* server sends some that way), so they're never dropped from the server render.
|
|
1310
|
+
*/
|
|
1311
|
+
function listItems(children) {
|
|
1312
|
+
const items = [];
|
|
1313
|
+
Children.forEach(children, (node) => {
|
|
1314
|
+
if (isValidElement(node)) items.push(node);
|
|
1315
|
+
});
|
|
1316
|
+
return items;
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* A link item: the item holds a real `<a>` on its headline, whose overlay covers the whole
|
|
1320
|
+
* item, so the item is the link (the browser's link menu and modified clicks included)
|
|
1321
|
+
* while buttons in its leading or trailing content stay separate controls, never nested in
|
|
1322
|
+
* the link. The link is named by the headline and described by the overline and supporting
|
|
1323
|
+
* text. React Aria's `useLink` routes a plain click through the `RouterProvider`; a disabled
|
|
1324
|
+
* item has no `href`.
|
|
1325
|
+
*/
|
|
1326
|
+
function LinkItem({ item, variant, classNames, position: itemPosition, isDisabled }) {
|
|
1327
|
+
const itemRef = useRef(null);
|
|
1328
|
+
const linkRef = useRef(null);
|
|
1329
|
+
const { ids, naming } = useItemIds(item);
|
|
1330
|
+
const href = isDisabled ? void 0 : item.href;
|
|
1331
|
+
const { linkProps, isPressed } = useLink({
|
|
1332
|
+
href,
|
|
1333
|
+
target: item.target,
|
|
1334
|
+
isDisabled,
|
|
1335
|
+
elementType: "a"
|
|
1336
|
+
}, linkRef);
|
|
1337
|
+
const { focusProps, isFocusVisible } = useFocusRing();
|
|
1338
|
+
const current = Boolean(item.current);
|
|
1339
|
+
const { interactionProps, dataAttributes, state } = useM3Interaction({
|
|
1340
|
+
isDisabled,
|
|
1341
|
+
isPressed,
|
|
1342
|
+
isSelected: current
|
|
1343
|
+
}, itemRef);
|
|
1344
|
+
const shape = isPressed && !isDisabled || current || isFocusVisible ? "active" : state.isHovered && !isDisabled ? "hovered" : "rest";
|
|
1345
|
+
const styles = itemStyles(item, variant, true, useContext(ListOptionsContext));
|
|
1346
|
+
const rel = item.rel ?? (item.target === "_blank" ? "noopener noreferrer" : void 0);
|
|
1347
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1348
|
+
...interactionProps,
|
|
1349
|
+
...dataAttributes,
|
|
1350
|
+
"data-focused": isFocusVisible || void 0,
|
|
1351
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
1352
|
+
ref: itemRef,
|
|
1353
|
+
"data-list-entry": "",
|
|
1354
|
+
"data-shape": shape,
|
|
1355
|
+
"data-position": itemPosition,
|
|
1356
|
+
...itemAttributes(variant),
|
|
1357
|
+
className: styles.item({ class: cn("relative", classNames?.item, item.className) }),
|
|
1358
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1359
|
+
className: styles.cell(),
|
|
1360
|
+
children: /* @__PURE__ */ jsx(ItemContent, {
|
|
1361
|
+
item,
|
|
1362
|
+
styles,
|
|
1363
|
+
classNames,
|
|
1364
|
+
ids,
|
|
1365
|
+
sideClassName: styles.raised(),
|
|
1366
|
+
headline: (children) => /* @__PURE__ */ jsx("a", {
|
|
1367
|
+
...mergeProps(linkProps, focusProps),
|
|
1368
|
+
...naming,
|
|
1369
|
+
ref: linkRef,
|
|
1370
|
+
href,
|
|
1371
|
+
target: item.target,
|
|
1372
|
+
rel,
|
|
1373
|
+
download: item.download,
|
|
1374
|
+
"aria-current": current ? "page" : void 0,
|
|
1375
|
+
"data-list-link": "",
|
|
1376
|
+
className: styles.link(),
|
|
1377
|
+
children
|
|
1378
|
+
})
|
|
1379
|
+
})
|
|
1380
|
+
})
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
//#endregion
|
|
1384
|
+
export { List, ListItem, ListSection };
|
|
1385
|
+
|
|
1386
|
+
//# sourceMappingURL=List.js.map
|