@windmorph/react 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,393 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { onDemand, usePreloadOnIntent } from "../../utils/load-on-demand.js";
|
|
4
|
+
import { Button } from "../button/Button.js";
|
|
5
|
+
import { TooltipTrigger } from "../tooltip/tooltip-trigger.js";
|
|
6
|
+
import { LazyTooltip } from "../tooltip/lazy-tooltip.js";
|
|
7
|
+
import { IconButton } from "../icon-button/IconButton.js";
|
|
8
|
+
import { DomDirectionLocale } from "../../primitives/DomDirectionLocale.js";
|
|
9
|
+
import { ariaFlag, pickDescriptionAria, splitRootProps } from "../../utils/root-props.js";
|
|
10
|
+
import { COMPACT_WINDOW, useMediaQuery } from "./use-media-query.js";
|
|
11
|
+
import { OptionPopover } from "../select/option-list.js";
|
|
12
|
+
import { CalendarGrid } from "./CalendarGrid.js";
|
|
13
|
+
import { ChoiceButton, ShortcutIconButton, useMonthSwipe, usePickerKeys } from "./calendar-parts.js";
|
|
14
|
+
import { DateInput } from "./DateInput.js";
|
|
15
|
+
import { datePickerStyles, dockedDatePickerStyles } from "./date-picker-styles.js";
|
|
16
|
+
import { ArrowDropDownIcon, CalendarIcon, CheckIcon, ChevronLeftIcon, ChevronRightIcon } from "./picker-icons.js";
|
|
17
|
+
import { useRef, useState } from "react";
|
|
18
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { useCalendar, useDateFormatter, useDialog, useLocale } from "react-aria";
|
|
20
|
+
import { useCalendarState, useOverlayTriggerState } from "react-stately";
|
|
21
|
+
import { useControlledState } from "react-stately/useControlledState";
|
|
22
|
+
import { createCalendar, getLocalTimeZone, toCalendarDate } from "@internationalized/date";
|
|
23
|
+
//#region src/components/date-picker/DateField.tsx
|
|
24
|
+
/**
|
|
25
|
+
* The full-screen modal picker a {@link DateField} opens on compact windows, loaded with
|
|
26
|
+
* `import()`: a field on a wider window never needs it.
|
|
27
|
+
*/
|
|
28
|
+
const compactDialog = onDemand(() => import("./CompactDateDialog.js").then((module) => module.CompactDateDialog));
|
|
29
|
+
/**
|
|
30
|
+
* M3 docked date picker: an outlined date field you can type in (no input mask; the
|
|
31
|
+
* locale's format as helper text), whose calendar button opens a calendar just below it
|
|
32
|
+
* with month and year menus, previous / next month and year buttons, the days of the
|
|
33
|
+
* months around the shown one, and Cancel / OK. On compact windows (below 600px) the
|
|
34
|
+
* button opens the modal {@link DatePicker} in a full-screen {@link PickerDialog} instead,
|
|
35
|
+
* as M3 recommends there: the 360px docked calendar doesn't fit a phone. That picker's
|
|
36
|
+
* code loads on demand, only on a compact window: when the browser is next idle, or as soon
|
|
37
|
+
* as the pointer or focus reaches the field, so it's in before the first press.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <DateField label="Date" value={date} onChange={setDate} />
|
|
41
|
+
*/
|
|
42
|
+
function DateField(props) {
|
|
43
|
+
return /* @__PURE__ */ jsx(DomDirectionLocale, { children: (directionRef) => /* @__PURE__ */ jsx(DateFieldInner, {
|
|
44
|
+
...props,
|
|
45
|
+
directionRef
|
|
46
|
+
}) });
|
|
47
|
+
}
|
|
48
|
+
function DateFieldInner({ label, value: valueProp, defaultValue, onChange, min, max, isDateUnavailable, yearRange = [1900, 2100], open, defaultOpen, onOpenChange, supportingText, invalid: invalidProp, errorMessage, required: requiredProp, disabled, readOnly: readOnlyProp, "aria-describedby": describedBy, "aria-details": details, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-readonly": ariaReadonly, name, id, calendarIcon, density, labels = {}, ref, inputRef, className, style, classNames, directionRef, ...rest }) {
|
|
49
|
+
const { root, rest: aria } = splitRootProps(rest, { wrapper: true });
|
|
50
|
+
const invalid = invalidProp ?? ariaFlag(ariaInvalid);
|
|
51
|
+
const required = requiredProp ?? ariaFlag(ariaRequired);
|
|
52
|
+
const readOnly = readOnlyProp ?? ariaFlag(ariaReadonly);
|
|
53
|
+
const data = {
|
|
54
|
+
...root,
|
|
55
|
+
...pickDescriptionAria(aria),
|
|
56
|
+
...describedBy !== void 0 && { "aria-describedby": describedBy },
|
|
57
|
+
...details !== void 0 && { "aria-details": details }
|
|
58
|
+
};
|
|
59
|
+
const [value, setValue] = useControlledState(valueProp, defaultValue ?? null, onChange);
|
|
60
|
+
const overlay = useOverlayTriggerState({
|
|
61
|
+
isOpen: open,
|
|
62
|
+
defaultOpen,
|
|
63
|
+
onOpenChange
|
|
64
|
+
});
|
|
65
|
+
const fieldRef = useRef(null);
|
|
66
|
+
const popoverRef = useRef(null);
|
|
67
|
+
const compact = useMediaQuery(COMPACT_WINDOW);
|
|
68
|
+
usePreloadOnIntent(fieldRef, compactDialog.preload, compact);
|
|
69
|
+
const [compactOpened, setCompactOpened] = useState(compact && overlay.isOpen);
|
|
70
|
+
if (compact && overlay.isOpen && !compactOpened) setCompactOpened(true);
|
|
71
|
+
const { root: rootClassName, calendar, menuButton, weekday, day, item, ...fieldClassNames } = classNames ?? {};
|
|
72
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DateInput, {
|
|
73
|
+
ref: (element) => {
|
|
74
|
+
fieldRef.current = element;
|
|
75
|
+
directionRef(element);
|
|
76
|
+
if (typeof ref === "function") ref(element);
|
|
77
|
+
else if (ref) ref.current = element;
|
|
78
|
+
},
|
|
79
|
+
inputRef,
|
|
80
|
+
label,
|
|
81
|
+
value,
|
|
82
|
+
onCommit: setValue,
|
|
83
|
+
min,
|
|
84
|
+
max,
|
|
85
|
+
isDateUnavailable,
|
|
86
|
+
labels,
|
|
87
|
+
supportingText,
|
|
88
|
+
invalid,
|
|
89
|
+
errorMessage,
|
|
90
|
+
required,
|
|
91
|
+
disabled,
|
|
92
|
+
readOnly,
|
|
93
|
+
name,
|
|
94
|
+
id,
|
|
95
|
+
style,
|
|
96
|
+
data,
|
|
97
|
+
className: cn(rootClassName, className),
|
|
98
|
+
classNames: fieldClassNames,
|
|
99
|
+
density,
|
|
100
|
+
trailingIcon: /* @__PURE__ */ jsx(IconButton, {
|
|
101
|
+
variant: "standard",
|
|
102
|
+
icon: calendarIcon ?? /* @__PURE__ */ jsx(CalendarIcon, {}),
|
|
103
|
+
"aria-label": labels.openCalendar ?? "Open calendar",
|
|
104
|
+
"aria-haspopup": "dialog",
|
|
105
|
+
"aria-expanded": overlay.isOpen,
|
|
106
|
+
disabled: disabled || readOnly,
|
|
107
|
+
onPress: overlay.open
|
|
108
|
+
})
|
|
109
|
+
}), compact ? compactOpened && /* @__PURE__ */ jsx(compactDialog.Component, {
|
|
110
|
+
open: overlay.isOpen,
|
|
111
|
+
onOpenChange: overlay.setOpen,
|
|
112
|
+
value,
|
|
113
|
+
onCommit: setValue,
|
|
114
|
+
min,
|
|
115
|
+
max,
|
|
116
|
+
isDateUnavailable,
|
|
117
|
+
yearRange,
|
|
118
|
+
labels,
|
|
119
|
+
classNames: {
|
|
120
|
+
calendar,
|
|
121
|
+
menuButton,
|
|
122
|
+
weekday,
|
|
123
|
+
day,
|
|
124
|
+
item
|
|
125
|
+
}
|
|
126
|
+
}) : /* @__PURE__ */ jsx(OptionPopover, {
|
|
127
|
+
state: overlay,
|
|
128
|
+
triggerRef: fieldRef,
|
|
129
|
+
popoverRef,
|
|
130
|
+
children: /* @__PURE__ */ jsx(DockedCalendar, {
|
|
131
|
+
value,
|
|
132
|
+
onCommit: (date) => {
|
|
133
|
+
setValue(date);
|
|
134
|
+
overlay.close();
|
|
135
|
+
},
|
|
136
|
+
onCancel: overlay.close,
|
|
137
|
+
min,
|
|
138
|
+
max,
|
|
139
|
+
isDateUnavailable,
|
|
140
|
+
yearRange,
|
|
141
|
+
labels,
|
|
142
|
+
className: calendar,
|
|
143
|
+
classNames: {
|
|
144
|
+
menuButton,
|
|
145
|
+
weekday,
|
|
146
|
+
day,
|
|
147
|
+
item
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
})] });
|
|
151
|
+
}
|
|
152
|
+
/** The dropdown calendar of a {@link DateField}. */
|
|
153
|
+
function DockedCalendar({ value, onCommit, onCancel, min: minValue, max: maxValue, isDateUnavailable, yearRange, labels, className, classNames }) {
|
|
154
|
+
const { locale } = useLocale();
|
|
155
|
+
const [draft, setDraft] = useState(value);
|
|
156
|
+
const state = useCalendarState({
|
|
157
|
+
value: draft,
|
|
158
|
+
onChange: (date) => setDraft(date),
|
|
159
|
+
minValue,
|
|
160
|
+
maxValue,
|
|
161
|
+
isDateUnavailable,
|
|
162
|
+
autoFocus: true,
|
|
163
|
+
locale,
|
|
164
|
+
createCalendar
|
|
165
|
+
});
|
|
166
|
+
const { calendarProps, prevButtonProps, nextButtonProps } = useCalendar({}, state);
|
|
167
|
+
const panelRef = useRef(null);
|
|
168
|
+
const { dialogProps } = useDialog({ "aria-label": labels.calendar ?? "Choose a date" }, panelRef);
|
|
169
|
+
const [view, setView] = useState("days");
|
|
170
|
+
const [focusList, setFocusList] = useState(false);
|
|
171
|
+
const monthRef = useRef(null);
|
|
172
|
+
const yearRef = useRef(null);
|
|
173
|
+
const styles = dockedDatePickerStyles();
|
|
174
|
+
const grid = datePickerStyles({ docked: true });
|
|
175
|
+
const { swipeProps, slideKey, slideDirection } = useMonthSwipe(state);
|
|
176
|
+
const shortMonth = useDateFormatter({ month: "short" });
|
|
177
|
+
const longMonth = useDateFormatter({ month: "long" });
|
|
178
|
+
const yearFormat = useDateFormatter({ year: "numeric" });
|
|
179
|
+
const shown = state.focusedDate;
|
|
180
|
+
const at = (date) => date.toDate(getLocalTimeZone());
|
|
181
|
+
const min = minValue ? toCalendarDate(minValue) : void 0;
|
|
182
|
+
const max = maxValue ? toCalendarDate(maxValue) : void 0;
|
|
183
|
+
const firstYear = Math.max(yearRange[0], min?.year ?? -Infinity);
|
|
184
|
+
const lastYear = Math.min(yearRange[1], max?.year ?? Infinity);
|
|
185
|
+
const openList = (next, byKeyboard) => {
|
|
186
|
+
setFocusList(byKeyboard);
|
|
187
|
+
setView(view === next ? "days" : next);
|
|
188
|
+
};
|
|
189
|
+
const pick = (date, menu) => {
|
|
190
|
+
state.setFocusedDate(date);
|
|
191
|
+
setView("days");
|
|
192
|
+
(menu === "months" ? monthRef : yearRef).current?.focus();
|
|
193
|
+
};
|
|
194
|
+
const onKeyDownCapture = usePickerKeys(state, {
|
|
195
|
+
onConfirm: () => onCommit(state.focusedDate),
|
|
196
|
+
onMonthMenu: () => openList("months", true),
|
|
197
|
+
onYearMenu: () => openList("years", true)
|
|
198
|
+
});
|
|
199
|
+
const monthOutside = (month) => {
|
|
200
|
+
const date = shown.set({
|
|
201
|
+
month,
|
|
202
|
+
day: 1
|
|
203
|
+
});
|
|
204
|
+
const last = date.add({ months: 1 }).subtract({ days: 1 });
|
|
205
|
+
return max !== void 0 && date.compare(max) > 0 || min !== void 0 && last.compare(min) < 0;
|
|
206
|
+
};
|
|
207
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
208
|
+
...dialogProps,
|
|
209
|
+
ref: panelRef,
|
|
210
|
+
onKeyDownCapture,
|
|
211
|
+
"data-view": view,
|
|
212
|
+
className: styles.panel({ class: className }),
|
|
213
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
214
|
+
...calendarProps,
|
|
215
|
+
className: styles.calendar(),
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ jsxs("div", {
|
|
218
|
+
className: styles.header(),
|
|
219
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
220
|
+
className: styles.group(),
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ jsx(ShortcutIconButton, {
|
|
223
|
+
icon: /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
224
|
+
label: labels.previousMonth ?? "Previous month",
|
|
225
|
+
tooltip: labels.previousMonthTooltip ?? "Previous month (Page Up)",
|
|
226
|
+
onPress: prevButtonProps.onPress,
|
|
227
|
+
disabled: view !== "days" || prevButtonProps.isDisabled
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ jsx(MenuButton, {
|
|
230
|
+
buttonRef: monthRef,
|
|
231
|
+
label: `${longMonth.format(at(shown))}, ${labels.chooseMonth ?? "Choose a month"}`,
|
|
232
|
+
tooltip: labels.monthMenuTooltip ?? "Choose a month (Shift+M)",
|
|
233
|
+
open: view === "months",
|
|
234
|
+
disabled: view === "years",
|
|
235
|
+
styles,
|
|
236
|
+
className: classNames.menuButton,
|
|
237
|
+
onPress: () => openList("months", false),
|
|
238
|
+
children: shortMonth.format(at(shown))
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ jsx(ShortcutIconButton, {
|
|
241
|
+
icon: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
|
|
242
|
+
label: labels.nextMonth ?? "Next month",
|
|
243
|
+
tooltip: labels.nextMonthTooltip ?? "Next month (Page Down)",
|
|
244
|
+
onPress: nextButtonProps.onPress,
|
|
245
|
+
disabled: view !== "days" || nextButtonProps.isDisabled
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
249
|
+
className: styles.group(),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx(ShortcutIconButton, {
|
|
252
|
+
icon: /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
253
|
+
label: labels.previousYear ?? "Previous year",
|
|
254
|
+
tooltip: labels.previousYearTooltip ?? "Previous year (Shift+Page Up)",
|
|
255
|
+
onPress: () => state.setFocusedDate(shown.subtract({ years: 1 })),
|
|
256
|
+
disabled: view !== "days" || shown.year <= firstYear
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsx(MenuButton, {
|
|
259
|
+
buttonRef: yearRef,
|
|
260
|
+
label: `${yearFormat.format(at(shown))}, ${labels.chooseYear ?? "Choose a year"}`,
|
|
261
|
+
tooltip: labels.yearMenuTooltip ?? "Choose a year (Shift+Y)",
|
|
262
|
+
open: view === "years",
|
|
263
|
+
disabled: view === "months",
|
|
264
|
+
styles,
|
|
265
|
+
className: classNames.menuButton,
|
|
266
|
+
onPress: () => openList("years", false),
|
|
267
|
+
children: yearFormat.format(at(shown))
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ jsx(ShortcutIconButton, {
|
|
270
|
+
icon: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
|
|
271
|
+
label: labels.nextYear ?? "Next year",
|
|
272
|
+
tooltip: labels.nextYearTooltip ?? "Next year (Shift+Page Down)",
|
|
273
|
+
onPress: () => state.setFocusedDate(shown.add({ years: 1 })),
|
|
274
|
+
disabled: view !== "days" || shown.year >= lastYear
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})]
|
|
278
|
+
}),
|
|
279
|
+
view === "days" && /* @__PURE__ */ jsx("div", {
|
|
280
|
+
...swipeProps,
|
|
281
|
+
className: grid.swipe({ class: styles.view() }),
|
|
282
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
283
|
+
"data-direction": slideDirection,
|
|
284
|
+
className: grid.slide(),
|
|
285
|
+
children: /* @__PURE__ */ jsx(CalendarGrid, {
|
|
286
|
+
state,
|
|
287
|
+
styles: grid,
|
|
288
|
+
classNames
|
|
289
|
+
})
|
|
290
|
+
}, slideKey)
|
|
291
|
+
}),
|
|
292
|
+
view === "months" && /* @__PURE__ */ jsx(ChoiceList, {
|
|
293
|
+
label: labels.monthList ?? "Month",
|
|
294
|
+
autoFocus: focusList,
|
|
295
|
+
styles,
|
|
296
|
+
children: Array.from({ length: 12 }, (_, i) => i + 1).map((month) => /* @__PURE__ */ jsxs(ChoiceButton, {
|
|
297
|
+
selected: month === shown.month,
|
|
298
|
+
disabled: monthOutside(month),
|
|
299
|
+
steps: LIST_STEPS,
|
|
300
|
+
className: styles.item({ class: classNames.item }),
|
|
301
|
+
onPick: () => pick(shown.set({ month }), "months"),
|
|
302
|
+
children: [/* @__PURE__ */ jsx(Check, {
|
|
303
|
+
selected: month === shown.month,
|
|
304
|
+
styles
|
|
305
|
+
}), longMonth.format(at(shown.set({
|
|
306
|
+
month,
|
|
307
|
+
day: 1
|
|
308
|
+
})))]
|
|
309
|
+
}, month))
|
|
310
|
+
}),
|
|
311
|
+
view === "years" && /* @__PURE__ */ jsx(ChoiceList, {
|
|
312
|
+
label: labels.yearList ?? "Year",
|
|
313
|
+
autoFocus: focusList,
|
|
314
|
+
styles,
|
|
315
|
+
children: Array.from({ length: yearRange[1] - yearRange[0] + 1 }, (_, i) => yearRange[0] + i).map((year) => /* @__PURE__ */ jsxs(ChoiceButton, {
|
|
316
|
+
selected: year === shown.year,
|
|
317
|
+
disabled: year < firstYear || year > lastYear,
|
|
318
|
+
steps: LIST_STEPS,
|
|
319
|
+
className: styles.item({ class: classNames.item }),
|
|
320
|
+
onPick: () => pick(shown.set({ year }), "years"),
|
|
321
|
+
children: [/* @__PURE__ */ jsx(Check, {
|
|
322
|
+
selected: year === shown.year,
|
|
323
|
+
styles
|
|
324
|
+
}), year]
|
|
325
|
+
}, year))
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
329
|
+
className: styles.actions(),
|
|
330
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
331
|
+
variant: "text",
|
|
332
|
+
onPress: onCancel,
|
|
333
|
+
children: labels.cancel ?? "Cancel"
|
|
334
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
335
|
+
variant: "text",
|
|
336
|
+
onPress: () => onCommit(draft),
|
|
337
|
+
children: labels.ok ?? "OK"
|
|
338
|
+
})]
|
|
339
|
+
})]
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
/** One option per row. */
|
|
343
|
+
const LIST_STEPS = {
|
|
344
|
+
ArrowUp: -1,
|
|
345
|
+
ArrowDown: 1
|
|
346
|
+
};
|
|
347
|
+
function MenuButton({ buttonRef, label, tooltip, open, disabled, styles, className, onPress, children }) {
|
|
348
|
+
return /* @__PURE__ */ jsxs(TooltipTrigger, { children: [/* @__PURE__ */ jsx(Button, {
|
|
349
|
+
ref: buttonRef,
|
|
350
|
+
variant: "text",
|
|
351
|
+
"aria-label": label,
|
|
352
|
+
"aria-expanded": open,
|
|
353
|
+
"data-menu-open": open || void 0,
|
|
354
|
+
disabled,
|
|
355
|
+
onPress,
|
|
356
|
+
className: styles.menuButton({ class: className }),
|
|
357
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
358
|
+
className: "inline-flex items-center gap-[8px]",
|
|
359
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
360
|
+
"aria-hidden": "true",
|
|
361
|
+
className: "inline-flex size-[20px] items-center justify-center",
|
|
362
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
363
|
+
"data-open": open || void 0,
|
|
364
|
+
className: styles.menuIcon(),
|
|
365
|
+
children: /* @__PURE__ */ jsx(ArrowDropDownIcon, {})
|
|
366
|
+
})
|
|
367
|
+
})]
|
|
368
|
+
})
|
|
369
|
+
}), /* @__PURE__ */ jsx(LazyTooltip, { children: tooltip })] });
|
|
370
|
+
}
|
|
371
|
+
function ChoiceList({ label, autoFocus, styles, children }) {
|
|
372
|
+
return /* @__PURE__ */ jsx("div", {
|
|
373
|
+
role: "radiogroup",
|
|
374
|
+
"aria-label": label,
|
|
375
|
+
className: styles.list(),
|
|
376
|
+
ref: (element) => {
|
|
377
|
+
const selected = element?.querySelector("[aria-checked=\"true\"]");
|
|
378
|
+
selected?.scrollIntoView?.({ block: "center" });
|
|
379
|
+
if (autoFocus) selected?.focus({ preventScroll: true });
|
|
380
|
+
},
|
|
381
|
+
children
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function Check({ selected, styles }) {
|
|
385
|
+
return /* @__PURE__ */ jsx("span", {
|
|
386
|
+
className: styles.check(),
|
|
387
|
+
children: selected && /* @__PURE__ */ jsx(CheckIcon, {})
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
391
|
+
export { DateField };
|
|
392
|
+
|
|
393
|
+
//# sourceMappingURL=DateField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateField.js","names":[],"sources":["../../../src/components/date-picker/DateField.tsx"],"sourcesContent":["'use client';\n\nimport {\n createCalendar,\n getLocalTimeZone,\n toCalendarDate,\n type CalendarDate,\n type DateValue,\n} from '@internationalized/date';\nimport {\n useRef,\n useState,\n type AriaAttributes,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { useCalendar, useDateFormatter, useDialog, useLocale } from 'react-aria';\nimport { useCalendarState, useOverlayTriggerState } from 'react-stately';\nimport { useControlledState } from 'react-stately/useControlledState';\nimport { DomDirectionLocale } from '../../primitives/DomDirectionLocale';\nimport { cn } from '../../utils/cn';\nimport {\n ariaFlag,\n pickDescriptionAria,\n splitRootProps,\n type WrapperRootDOMProps,\n} from '../../utils/root-props';\nimport { Button } from '../button/Button';\nimport { IconButton } from '../icon-button/IconButton';\nimport type { Density } from '../../tokens/density';\nimport { OptionPopover } from '../select/option-list';\nimport type { TextFieldClassNames } from '../text-field/TextField';\nimport { LazyTooltip } from '../tooltip/lazy-tooltip';\nimport { onDemand, usePreloadOnIntent } from '../../utils/load-on-demand';\nimport { TooltipTrigger } from '../tooltip/tooltip-trigger';\nimport { CalendarGrid } from './CalendarGrid';\nimport { ChoiceButton, ShortcutIconButton, useMonthSwipe, usePickerKeys } from './calendar-parts';\nimport { DateInput, type DateInputLabels } from './DateInput';\nimport type { CompactDateDialogProps } from './CompactDateDialog';\nimport { COMPACT_WINDOW, useMediaQuery } from './use-media-query';\nimport { datePickerStyles, dockedDatePickerStyles } from './date-picker-styles';\nimport {\n ArrowDropDownIcon,\n CalendarIcon,\n CheckIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n} from './picker-icons';\n\n/** Words of a {@link DateField}, for localisation. */\nexport interface DateFieldLabels extends DateInputLabels {\n /** The calendar icon button. @default \"Open calendar\" */\n openCalendar: string;\n /** Name of the dropdown calendar. @default \"Choose a date\" */\n calendar: string;\n /** The previous month button. @default \"Previous month\" */\n previousMonth: string;\n /** The next month button. @default \"Next month\" */\n nextMonth: string;\n /** Tooltip of the previous month button. @default \"Previous month (Page Up)\" */\n previousMonthTooltip: string;\n /** Tooltip of the next month button. @default \"Next month (Page Down)\" */\n nextMonthTooltip: string;\n /** The previous year button. @default \"Previous year\" */\n previousYear: string;\n /** The next year button. @default \"Next year\" */\n nextYear: string;\n /** Tooltip of the previous year button. @default \"Previous year (Shift+Page Up)\" */\n previousYearTooltip: string;\n /** Tooltip of the next year button. @default \"Next year (Shift+Page Down)\" */\n nextYearTooltip: string;\n /** Added to the month menu button's name. @default \"Choose a month\" */\n chooseMonth: string;\n /** Added to the year menu button's name. @default \"Choose a year\" */\n chooseYear: string;\n /** Tooltip of the month menu button. @default \"Choose a month (Shift+M)\" */\n monthMenuTooltip: string;\n /** Tooltip of the year menu button. @default \"Choose a year (Shift+Y)\" */\n yearMenuTooltip: string;\n /** Name of the month list. @default \"Month\" */\n monthList: string;\n /** Name of the year list. @default \"Year\" */\n yearList: string;\n /** The calendar's dismissing action. @default \"Cancel\" */\n cancel: string;\n /** The calendar's confirming action. @default \"OK\" */\n ok: string;\n}\n\nexport interface DateFieldClassNames extends Omit<\n TextFieldClassNames,\n 'leadingIcon' | 'prefix' | 'suffix' | 'counter'\n> {\n /** The text field's root; `className` goes here too. */\n root?: string;\n /** The `<input>`. */\n input?: string;\n /**\n * The calendar's panel: the dropdown panel, or on compact windows the full-screen\n * dialog's surface.\n */\n calendar?: string;\n /**\n * The calendar's month and year menu buttons (on compact windows, the modal picker's one\n * month and year button).\n */\n menuButton?: string;\n /** The calendar's weekday names. */\n weekday?: string;\n /** Each day of the calendar. */\n day?: string;\n /** Each month or year in the calendar's month and year lists. */\n item?: string;\n}\n\nexport interface DateFieldProps extends WrapperRootDOMProps {\n /** The field's label, e.g. \"Date of birth\". */\n label: ReactNode;\n /** The date (controlled); `null` for none. */\n value?: CalendarDate | null;\n /** Initial date when uncontrolled. @default null */\n defaultValue?: CalendarDate | null;\n /** A date was typed and committed, or picked and confirmed; `null` when cleared. */\n onChange?: (value: CalendarDate | null) => void;\n /** Earliest date allowed; earlier days are disabled. */\n min?: DateValue;\n /** Latest date allowed; later days are disabled. */\n max?: DateValue;\n /** Returns `true` for a day that can't be picked (it shows disabled). */\n isDateUnavailable?: (date: DateValue) => boolean;\n /** First and last years of the year menu; years outside min / max are disabled. @default [1900, 2100] */\n yearRange?: [number, number];\n /** Whether the dropdown calendar is open (controlled). */\n open?: boolean;\n /** Whether the dropdown calendar starts open when uncontrolled. @default false */\n defaultOpen?: boolean;\n /** Called when the dropdown calendar opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Helper text below the field. @default the locale's format, such as \"MM/DD/YYYY\" in en-US */\n supportingText?: ReactNode;\n /** Marks the field invalid, with `errorMessage` below it. */\n invalid?: boolean;\n /** Error text shown below the field while it's invalid, in place of `supportingText`. */\n errorMessage?: ReactNode;\n /** The field must have a date. @default false */\n required?: boolean;\n /** The field and its calendar button can't be used. @default false */\n disabled?: boolean;\n /** The date can be read and focused but not changed. @default false */\n readOnly?: boolean;\n /**\n * More description for the `<input>`, after the supporting or error text: the ids of\n * elements such as a hint that the date must come after another field's.\n */\n 'aria-describedby'?: string;\n /** The id of an element with more details about the `<input>`. */\n 'aria-details'?: string;\n /** Read as `invalid` when that's left out, for a form library that sets the attribute. */\n 'aria-invalid'?: AriaAttributes['aria-invalid'];\n /** Read as `required` when that's left out, for a form library that sets the attribute. */\n 'aria-required'?: AriaAttributes['aria-required'];\n /** Read as `readOnly` when that's left out, for a form library that sets the attribute. */\n 'aria-readonly'?: AriaAttributes['aria-readonly'];\n /** Form field name; the input submits the typed text. */\n name?: string;\n /** The `<input>`'s id, for a `<label for>` or an error summary's link. */\n id?: string;\n /** Icon of the button that opens the calendar. */\n calendarIcon?: ReactElement;\n /**\n * Web density of the typed field, `0` to `-3`: each step takes 4px off it (56px at 0, 44px\n * at -3). The calendar keeps its size: M3 doesn't make date pickers denser, since their 48px\n * day targets are part of their accessibility. Left out, the field takes the density of the\n * nearest `ThemeProvider` or `ThemeScope`.\n * @default 0\n */\n density?: Density;\n /** Words the field and its calendar show and announce, with English defaults. */\n labels?: Partial<DateFieldLabels>;\n /** The text field's root. */\n ref?: Ref<HTMLDivElement>;\n /** The `<input>`. */\n inputRef?: Ref<HTMLInputElement>;\n /** Classes for the root element, merged with `classNames.root`; consumer classes win. */\n className?: string;\n /** Inline styles for the root element. */\n style?: CSSProperties;\n /** Classes for each part, by slot. */\n classNames?: DateFieldClassNames;\n /** `data-*` attributes go to the root. */\n [data: `data-${string}`]: string | number | boolean | undefined;\n}\n\n/**\n * The full-screen modal picker a {@link DateField} opens on compact windows, loaded with\n * `import()`: a field on a wider window never needs it.\n */\nconst compactDialog = onDemand<CompactDateDialogProps>(() =>\n import('./CompactDateDialog').then((module) => module.CompactDateDialog),\n);\n\n/**\n * M3 docked date picker: an outlined date field you can type in (no input mask; the\n * locale's format as helper text), whose calendar button opens a calendar just below it\n * with month and year menus, previous / next month and year buttons, the days of the\n * months around the shown one, and Cancel / OK. On compact windows (below 600px) the\n * button opens the modal {@link DatePicker} in a full-screen {@link PickerDialog} instead,\n * as M3 recommends there: the 360px docked calendar doesn't fit a phone. That picker's\n * code loads on demand, only on a compact window: when the browser is next idle, or as soon\n * as the pointer or focus reaches the field, so it's in before the first press.\n *\n * @example\n * <DateField label=\"Date\" value={date} onChange={setDate} />\n */\nexport function DateField(props: DateFieldProps) {\n return (\n <DomDirectionLocale>\n {(directionRef) => <DateFieldInner {...props} directionRef={directionRef} />}\n </DomDirectionLocale>\n );\n}\n\nfunction DateFieldInner({\n label,\n value: valueProp,\n defaultValue,\n onChange,\n min,\n max,\n isDateUnavailable,\n yearRange = [1900, 2100],\n open,\n defaultOpen,\n onOpenChange,\n supportingText,\n invalid: invalidProp,\n errorMessage,\n required: requiredProp,\n disabled,\n readOnly: readOnlyProp,\n 'aria-describedby': describedBy,\n 'aria-details': details,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-readonly': ariaReadonly,\n name,\n id,\n calendarIcon,\n density,\n labels = {},\n ref,\n inputRef,\n className,\n style,\n classNames,\n directionRef,\n ...rest\n}: DateFieldProps & { directionRef: (element: HTMLElement | null) => void }) {\n const { root, rest: aria } = splitRootProps(rest, { wrapper: true });\n const invalid = invalidProp ?? ariaFlag(ariaInvalid);\n const required = requiredProp ?? ariaFlag(ariaRequired);\n const readOnly = readOnlyProp ?? ariaFlag(ariaReadonly);\n // The text field splits them again: the description reaches its `<input>`, after its own.\n const data = {\n ...root,\n ...pickDescriptionAria(aria),\n ...(describedBy !== undefined && { 'aria-describedby': describedBy }),\n ...(details !== undefined && { 'aria-details': details }),\n };\n const [value, setValue] = useControlledState(valueProp, defaultValue ?? null, onChange);\n const overlay = useOverlayTriggerState({ isOpen: open, defaultOpen, onOpenChange });\n const fieldRef = useRef<HTMLDivElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n // M3: \"On compact breakpoints … a full-screen modal date picker is recommended\". Below\n // 600px the docked calendar's header was cut off and its day targets overlapped.\n const compact = useMediaQuery(COMPACT_WINDOW);\n usePreloadOnIntent(fieldRef, compactDialog.preload, compact);\n // Mounted from the first open on, so it can play its exit; the module is usually in by\n // then, and if not it opens as it arrives, taking focus as it would have.\n const [compactOpened, setCompactOpened] = useState(compact && overlay.isOpen);\n if (compact && overlay.isOpen && !compactOpened) setCompactOpened(true);\n const {\n root: rootClassName,\n calendar,\n menuButton,\n weekday,\n day,\n item,\n ...fieldClassNames\n } = classNames ?? {};\n return (\n <>\n <DateInput\n ref={(element) => {\n fieldRef.current = element;\n directionRef(element);\n if (typeof ref === 'function') ref(element);\n else if (ref) ref.current = element;\n }}\n inputRef={inputRef}\n label={label}\n value={value}\n onCommit={setValue}\n min={min}\n max={max}\n isDateUnavailable={isDateUnavailable}\n labels={labels}\n supportingText={supportingText}\n invalid={invalid}\n errorMessage={errorMessage}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n name={name}\n id={id}\n style={style}\n data={data}\n className={cn(rootClassName, className)}\n classNames={fieldClassNames}\n density={density}\n trailingIcon={\n <IconButton\n variant=\"standard\"\n icon={calendarIcon ?? <CalendarIcon />}\n aria-label={labels.openCalendar ?? 'Open calendar'}\n aria-haspopup=\"dialog\"\n aria-expanded={overlay.isOpen}\n disabled={disabled || readOnly}\n onPress={overlay.open}\n />\n }\n />\n {compact ? (\n compactOpened && (\n <compactDialog.Component\n open={overlay.isOpen}\n onOpenChange={overlay.setOpen}\n value={value}\n onCommit={setValue}\n min={min}\n max={max}\n isDateUnavailable={isDateUnavailable}\n yearRange={yearRange}\n labels={labels}\n classNames={{ calendar, menuButton, weekday, day, item }}\n />\n )\n ) : (\n <OptionPopover state={overlay} triggerRef={fieldRef} popoverRef={popoverRef}>\n <DockedCalendar\n value={value}\n onCommit={(date) => {\n setValue(date);\n overlay.close();\n }}\n onCancel={overlay.close}\n min={min}\n max={max}\n isDateUnavailable={isDateUnavailable}\n yearRange={yearRange}\n labels={labels}\n className={calendar}\n classNames={{ menuButton, weekday, day, item }}\n />\n </OptionPopover>\n )}\n </>\n );\n}\n\ntype View = 'days' | 'months' | 'years';\n\n/** The dropdown calendar of a {@link DateField}. */\nfunction DockedCalendar({\n value,\n onCommit,\n onCancel,\n min: minValue,\n max: maxValue,\n isDateUnavailable,\n yearRange,\n labels,\n className,\n classNames,\n}: {\n value: CalendarDate | null;\n onCommit: (date: CalendarDate | null) => void;\n onCancel: () => void;\n min: DateValue | undefined;\n max: DateValue | undefined;\n isDateUnavailable: ((date: DateValue) => boolean) | undefined;\n yearRange: [number, number];\n labels: Partial<DateFieldLabels>;\n className: string | undefined;\n classNames: Pick<DateFieldClassNames, 'menuButton' | 'weekday' | 'day' | 'item'>;\n}) {\n const { locale } = useLocale();\n const [draft, setDraft] = useState(value);\n const state = useCalendarState({\n value: draft,\n onChange: (date) => setDraft(date as CalendarDate),\n minValue,\n maxValue,\n isDateUnavailable,\n autoFocus: true,\n locale,\n createCalendar,\n });\n const { calendarProps, prevButtonProps, nextButtonProps } = useCalendar({}, state);\n const panelRef = useRef<HTMLDivElement>(null);\n const { dialogProps } = useDialog({ 'aria-label': labels.calendar ?? 'Choose a date' }, panelRef);\n const [view, setView] = useState<View>('days');\n const [focusList, setFocusList] = useState(false);\n const monthRef = useRef<HTMLButtonElement>(null);\n const yearRef = useRef<HTMLButtonElement>(null);\n const styles = dockedDatePickerStyles();\n const grid = datePickerStyles({ docked: true });\n const { swipeProps, slideKey, slideDirection } = useMonthSwipe(state);\n const shortMonth = useDateFormatter({ month: 'short' });\n const longMonth = useDateFormatter({ month: 'long' });\n const yearFormat = useDateFormatter({ year: 'numeric' });\n const shown = state.focusedDate;\n const at = (date: CalendarDate) => date.toDate(getLocalTimeZone());\n const min = minValue ? toCalendarDate(minValue) : undefined;\n const max = maxValue ? toCalendarDate(maxValue) : undefined;\n const firstYear = Math.max(yearRange[0], min?.year ?? -Infinity);\n const lastYear = Math.min(yearRange[1], max?.year ?? Infinity);\n\n const openList = (next: View, byKeyboard: boolean) => {\n setFocusList(byKeyboard);\n setView(view === next ? 'days' : next);\n };\n const pick = (date: CalendarDate, menu: View) => {\n state.setFocusedDate(date);\n setView('days');\n (menu === 'months' ? monthRef : yearRef).current?.focus();\n };\n const onKeyDownCapture = usePickerKeys(state, {\n onConfirm: () => onCommit(state.focusedDate),\n onMonthMenu: () => openList('months', true),\n onYearMenu: () => openList('years', true),\n });\n const monthOutside = (month: number) => {\n const date = shown.set({ month, day: 1 });\n const last = date.add({ months: 1 }).subtract({ days: 1 });\n return (\n (max !== undefined && date.compare(max) > 0) || (min !== undefined && last.compare(min) < 0)\n );\n };\n\n return (\n <div\n {...dialogProps}\n ref={panelRef}\n onKeyDownCapture={onKeyDownCapture}\n data-view={view}\n className={styles.panel({ class: className })}\n >\n <div {...calendarProps} className={styles.calendar()}>\n <div className={styles.header()}>\n <div className={styles.group()}>\n <ShortcutIconButton\n icon={<ChevronLeftIcon />}\n label={labels.previousMonth ?? 'Previous month'}\n tooltip={labels.previousMonthTooltip ?? 'Previous month (Page Up)'}\n onPress={prevButtonProps.onPress as () => void}\n disabled={view !== 'days' || prevButtonProps.isDisabled}\n />\n <MenuButton\n buttonRef={monthRef}\n label={`${longMonth.format(at(shown))}, ${labels.chooseMonth ?? 'Choose a month'}`}\n tooltip={labels.monthMenuTooltip ?? 'Choose a month (Shift+M)'}\n open={view === 'months'}\n disabled={view === 'years'}\n styles={styles}\n className={classNames.menuButton}\n onPress={() => openList('months', false)}\n >\n {shortMonth.format(at(shown))}\n </MenuButton>\n <ShortcutIconButton\n icon={<ChevronRightIcon />}\n label={labels.nextMonth ?? 'Next month'}\n tooltip={labels.nextMonthTooltip ?? 'Next month (Page Down)'}\n onPress={nextButtonProps.onPress as () => void}\n disabled={view !== 'days' || nextButtonProps.isDisabled}\n />\n </div>\n <div className={styles.group()}>\n <ShortcutIconButton\n icon={<ChevronLeftIcon />}\n label={labels.previousYear ?? 'Previous year'}\n tooltip={labels.previousYearTooltip ?? 'Previous year (Shift+Page Up)'}\n onPress={() => state.setFocusedDate(shown.subtract({ years: 1 }))}\n disabled={view !== 'days' || shown.year <= firstYear}\n />\n <MenuButton\n buttonRef={yearRef}\n label={`${yearFormat.format(at(shown))}, ${labels.chooseYear ?? 'Choose a year'}`}\n tooltip={labels.yearMenuTooltip ?? 'Choose a year (Shift+Y)'}\n open={view === 'years'}\n disabled={view === 'months'}\n styles={styles}\n className={classNames.menuButton}\n onPress={() => openList('years', false)}\n >\n {yearFormat.format(at(shown))}\n </MenuButton>\n <ShortcutIconButton\n icon={<ChevronRightIcon />}\n label={labels.nextYear ?? 'Next year'}\n tooltip={labels.nextYearTooltip ?? 'Next year (Shift+Page Down)'}\n onPress={() => state.setFocusedDate(shown.add({ years: 1 }))}\n disabled={view !== 'days' || shown.year >= lastYear}\n />\n </div>\n </div>\n {view === 'days' && (\n <div {...swipeProps} className={grid.swipe({ class: styles.view() })}>\n <div key={slideKey} data-direction={slideDirection} className={grid.slide()}>\n <CalendarGrid state={state} styles={grid} classNames={classNames} />\n </div>\n </div>\n )}\n {view === 'months' && (\n <ChoiceList label={labels.monthList ?? 'Month'} autoFocus={focusList} styles={styles}>\n {Array.from({ length: 12 }, (_, i) => i + 1).map((month) => (\n <ChoiceButton\n key={month}\n selected={month === shown.month}\n disabled={monthOutside(month)}\n steps={LIST_STEPS}\n className={styles.item({ class: classNames.item })}\n onPick={() => pick(shown.set({ month }), 'months')}\n >\n <Check selected={month === shown.month} styles={styles} />\n {longMonth.format(at(shown.set({ month, day: 1 })))}\n </ChoiceButton>\n ))}\n </ChoiceList>\n )}\n {view === 'years' && (\n <ChoiceList label={labels.yearList ?? 'Year'} autoFocus={focusList} styles={styles}>\n {Array.from(\n { length: yearRange[1] - yearRange[0] + 1 },\n (_, i) => yearRange[0] + i,\n ).map((year) => (\n <ChoiceButton\n key={year}\n selected={year === shown.year}\n disabled={year < firstYear || year > lastYear}\n steps={LIST_STEPS}\n className={styles.item({ class: classNames.item })}\n onPick={() => pick(shown.set({ year }), 'years')}\n >\n <Check selected={year === shown.year} styles={styles} />\n {year}\n </ChoiceButton>\n ))}\n </ChoiceList>\n )}\n </div>\n <div className={styles.actions()}>\n <Button variant=\"text\" onPress={onCancel}>\n {labels.cancel ?? 'Cancel'}\n </Button>\n <Button variant=\"text\" onPress={() => onCommit(draft)}>\n {labels.ok ?? 'OK'}\n </Button>\n </div>\n </div>\n );\n}\n\n/** One option per row. */\nconst LIST_STEPS = { ArrowUp: -1, ArrowDown: 1 };\n\nfunction MenuButton({\n buttonRef,\n label,\n tooltip,\n open,\n disabled,\n styles,\n className,\n onPress,\n children,\n}: {\n buttonRef: Ref<HTMLButtonElement>;\n label: string;\n tooltip: string;\n open: boolean;\n disabled: boolean;\n styles: ReturnType<typeof dockedDatePickerStyles>;\n className: string | undefined;\n onPress: () => void;\n children: string;\n}) {\n return (\n <TooltipTrigger>\n <Button\n ref={buttonRef}\n variant=\"text\"\n aria-label={label}\n aria-expanded={open}\n // M3 menus: while its list is open the button looks the same, plus a pressed state.\n data-menu-open={open || undefined}\n disabled={disabled}\n onPress={onPress}\n className={styles.menuButton({ class: className })}\n >\n {/* The drop-down arrow trails the label here, which Button's one leading icon can't do. */}\n <span className=\"inline-flex items-center gap-[8px]\">\n {children}\n <span aria-hidden=\"true\" className=\"inline-flex size-[20px] items-center justify-center\">\n <span data-open={open || undefined} className={styles.menuIcon()}>\n <ArrowDropDownIcon />\n </span>\n </span>\n </span>\n </Button>\n <LazyTooltip>{tooltip}</LazyTooltip>\n </TooltipTrigger>\n );\n}\n\nfunction ChoiceList({\n label,\n autoFocus,\n styles,\n children,\n}: {\n label: string;\n autoFocus: boolean;\n styles: ReturnType<typeof dockedDatePickerStyles>;\n children: ReactNode;\n}) {\n return (\n <div\n role=\"radiogroup\"\n aria-label={label}\n className={styles.list()}\n ref={(element) => {\n const selected = element?.querySelector<HTMLElement>('[aria-checked=\"true\"]');\n selected?.scrollIntoView?.({ block: 'center' });\n if (autoFocus) selected?.focus({ preventScroll: true });\n }}\n >\n {children}\n </div>\n );\n}\n\nfunction Check({\n selected,\n styles,\n}: {\n selected: boolean;\n styles: ReturnType<typeof dockedDatePickerStyles>;\n}) {\n return <span className={styles.check()}>{selected && <CheckIcon />}</span>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuMA,MAAM,gBAAgB,eACpB,OAAO,yBAAsB,CAAC,MAAM,WAAW,OAAO,iBAAiB,CACzE;;;;;;;;;;;;;;AAeA,SAAgB,UAAU,OAA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AA,CACL;EACF,CAAA,CAAA;;AAET;;AAGA,MAAM,aAAa;CAAE,SAAS;CAAI,WAAW;AAAE;AAE/C,SAAS,WAAW,EAClB,WACA,OACA,SACA,MACA,UACA,QACA,WACA,SACA,YAWC;CACD,OACE,qBAAC,gBAAD,EAAA,UAAA,CACE,oBAAC,QAAD;EACE,KAAK;EACL,SAAQ;EACR,cAAY;EACZ,iBAAe;EAEf,kBAAgB,QAAQ,KAAA;EACd;EACD;EACT,WAAW,OAAO,WAAW,EAAE,OAAO,UAAU,CAAC;EAGjD,UAAA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACG,UACD,oBAAC,QAAD;IAAM,eAAY;IAAO,WAAU;IACjC,UAAA,oBAAC,QAAD;KAAM,aAAW,QAAQ,KAAA;KAAW,WAAW,OAAO,SAAS;KAC7D,UAAA,oBAAC,mBAAD,CAAoB,CAAA;IAChB,CAAA;GACF,CAAA,CACF;;CACA,CAAA,GACR,oBAAC,aAAD,EAAA,UAAc,QAAqB,CAAA,CACrB,EAAA,CAAA;AAEpB;AAEA,SAAS,WAAW,EAClB,OACA,WACA,QACA,YAMC;CACD,OACE,oBAAC,OAAD;EACE,MAAK;EACL,cAAY;EACZ,WAAW,OAAO,KAAK;EACvB,MAAM,YAAY;GAChB,MAAM,WAAW,SAAS,cAA2B,yBAAuB;GAC5E,UAAU,iBAAiB,EAAE,OAAO,SAAS,CAAC;GAC9C,IAAI,WAAW,UAAU,MAAM,EAAE,eAAe,KAAK,CAAC;EACxD;EAEC;CACE,CAAA;AAET;AAEA,SAAS,MAAM,EACb,UACA,UAIC;CACD,OAAO,oBAAC,QAAD;EAAM,WAAW,OAAO,MAAM;EAAI,UAAA,YAAY,oBAAC,WAAD,CAAY,CAAA;CAAQ,CAAA;AAC3E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../text-field/TextField.js";
|
|
2
|
+
import { CSSProperties, ReactNode, Ref } from "react";
|
|
3
|
+
import { CalendarDate, DateValue } from "@internationalized/date";
|
|
4
|
+
//#region src/components/date-picker/DateInput.d.ts
|
|
5
|
+
/** Words of a typed date field, for localisation. */
|
|
6
|
+
export interface DateInputLabels {
|
|
7
|
+
/**
|
|
8
|
+
* The format hint shown below the field and as its placeholder.
|
|
9
|
+
* @default the locale's format, such as "MM/DD/YYYY" in en-US
|
|
10
|
+
*/
|
|
11
|
+
dateFormatHint: string;
|
|
12
|
+
/** Error when the text isn't a date. @default "Enter a date as {hint}" */
|
|
13
|
+
invalidDate: string;
|
|
14
|
+
/** Error for a date before `min` or after `max`. @default "Date out of range" */
|
|
15
|
+
dateOutOfRange: string;
|
|
16
|
+
/** Error for a date `isDateUnavailable` turns away. @default "Date not available" */
|
|
17
|
+
dateUnavailable: string;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//# sourceMappingURL=DateInput.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { TextField } from "../text-field/TextField.js";
|
|
3
|
+
import { dateFormat, parseDate } from "./date-format.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useLocale } from "react-aria";
|
|
7
|
+
import { toCalendarDate } from "@internationalized/date";
|
|
8
|
+
//#region src/components/date-picker/DateInput.tsx
|
|
9
|
+
/**
|
|
10
|
+
* A typed date, as the M3 date input asks: an outlined text field with no input mask that
|
|
11
|
+
* reads dashes, spaces, slashes or dots between the parts and an optional leading zero,
|
|
12
|
+
* reformats on Enter or blur, shows the locale's format below as its helper text, and
|
|
13
|
+
* says in the supporting text why a date can't be used.
|
|
14
|
+
*/
|
|
15
|
+
function DateInput({ label, value, onCommit, onEnter, min: minValue, max: maxValue, isDateUnavailable, labels = {}, supportingText, trailingIcon, required, disabled, readOnly, name, id, autoFocus, invalid, errorMessage, className, style, data, classNames, density, ref, inputRef }) {
|
|
16
|
+
const { locale } = useLocale();
|
|
17
|
+
const format = dateFormat(locale);
|
|
18
|
+
const hint = labels.dateFormatHint ?? format.hint;
|
|
19
|
+
const show = (date) => date ? format.format(date) : "";
|
|
20
|
+
const [text, setText] = useState(() => show(value));
|
|
21
|
+
const [error, setError] = useState(null);
|
|
22
|
+
const [shown, setShown] = useState(value?.toString());
|
|
23
|
+
if (value?.toString() !== shown) {
|
|
24
|
+
setShown(value?.toString());
|
|
25
|
+
setText(show(value));
|
|
26
|
+
setError(null);
|
|
27
|
+
}
|
|
28
|
+
const problem = (date) => {
|
|
29
|
+
const min = minValue && toCalendarDate(minValue);
|
|
30
|
+
const max = maxValue && toCalendarDate(maxValue);
|
|
31
|
+
if (min && date.compare(min) < 0 || max && date.compare(max) > 0) return labels.dateOutOfRange ?? "Date out of range";
|
|
32
|
+
if (isDateUnavailable?.(date)) return labels.dateUnavailable ?? "Date not available";
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
/** Reads the text; returns the date (or `null` when empty), or `undefined` when unusable. */
|
|
36
|
+
const commit = () => {
|
|
37
|
+
if (text.trim() === "") {
|
|
38
|
+
setError(null);
|
|
39
|
+
if (value) onCommit(null);
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const date = parseDate(text, format.order);
|
|
43
|
+
if (!date) {
|
|
44
|
+
setError(labels.invalidDate ?? `Enter a date as ${hint}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const reason = problem(date);
|
|
48
|
+
if (reason) {
|
|
49
|
+
setError(reason);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
setError(null);
|
|
53
|
+
setText(format.format(date));
|
|
54
|
+
if (date.toString() !== value?.toString()) onCommit(date);
|
|
55
|
+
return date;
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
58
|
+
...data,
|
|
59
|
+
...id !== void 0 && { id },
|
|
60
|
+
ref,
|
|
61
|
+
style,
|
|
62
|
+
inputRef,
|
|
63
|
+
variant: "outlined",
|
|
64
|
+
...density !== void 0 && { density },
|
|
65
|
+
label,
|
|
66
|
+
value: text,
|
|
67
|
+
onChange: (next) => {
|
|
68
|
+
setText(next);
|
|
69
|
+
if (error) setError(null);
|
|
70
|
+
},
|
|
71
|
+
onBlur: () => commit(),
|
|
72
|
+
onKeyDown: (event) => {
|
|
73
|
+
if (event.key !== "Enter") {
|
|
74
|
+
event.continuePropagation();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const date = commit();
|
|
78
|
+
if (date !== void 0) onEnter?.(date);
|
|
79
|
+
},
|
|
80
|
+
placeholder: hint,
|
|
81
|
+
supportingText: supportingText ?? hint,
|
|
82
|
+
invalid: invalid || error !== null,
|
|
83
|
+
errorMessage: error ?? errorMessage,
|
|
84
|
+
inputMode: "decimal",
|
|
85
|
+
autoComplete: "off",
|
|
86
|
+
autoFocus,
|
|
87
|
+
required,
|
|
88
|
+
disabled,
|
|
89
|
+
readOnly,
|
|
90
|
+
name,
|
|
91
|
+
trailingIcon,
|
|
92
|
+
className,
|
|
93
|
+
classNames
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { DateInput };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=DateInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInput.js","names":[],"sources":["../../../src/components/date-picker/DateInput.tsx"],"sourcesContent":["'use client';\n\nimport { toCalendarDate, type CalendarDate, type DateValue } from '@internationalized/date';\nimport { useState, type CSSProperties, type ReactNode, type Ref } from 'react';\nimport { useLocale } from 'react-aria';\nimport type { Density } from '../../tokens/density';\nimport { TextField, type TextFieldClassNames } from '../text-field/TextField';\nimport { dateFormat, parseDate } from './date-format';\n\n/** Words of a typed date field, for localisation. */\nexport interface DateInputLabels {\n /**\n * The format hint shown below the field and as its placeholder.\n * @default the locale's format, such as \"MM/DD/YYYY\" in en-US\n */\n dateFormatHint: string;\n /** Error when the text isn't a date. @default \"Enter a date as {hint}\" */\n invalidDate: string;\n /** Error for a date before `min` or after `max`. @default \"Date out of range\" */\n dateOutOfRange: string;\n /** Error for a date `isDateUnavailable` turns away. @default \"Date not available\" */\n dateUnavailable: string;\n}\n\nexport interface DateInputProps {\n label: ReactNode;\n value: CalendarDate | null;\n /** A date was typed and committed (Enter or leaving the field); `null` when cleared. */\n onCommit: (value: CalendarDate | null) => void;\n /** Enter was pressed and the text is a valid date (or empty). */\n onEnter?: (value: CalendarDate | null) => void;\n min?: DateValue | undefined;\n max?: DateValue | undefined;\n isDateUnavailable?: ((date: DateValue) => boolean) | undefined;\n labels?: Partial<DateInputLabels> | undefined;\n /** Replaces the format hint below the field. */\n supportingText?: ReactNode;\n trailingIcon?: ReactNode;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n name?: string | undefined;\n id?: string | undefined;\n autoFocus?: boolean | undefined;\n invalid?: boolean | undefined;\n errorMessage?: ReactNode;\n className?: string | undefined;\n style?: CSSProperties | undefined;\n /** `data-*` attributes for the root. */\n data?: Record<string, unknown> | undefined;\n classNames?: TextFieldClassNames | undefined;\n /** The field's own density; left out, it inherits the theme's. */\n density?: Density | undefined;\n ref?: Ref<HTMLDivElement> | undefined;\n inputRef?: Ref<HTMLInputElement> | undefined;\n}\n\n/**\n * A typed date, as the M3 date input asks: an outlined text field with no input mask that\n * reads dashes, spaces, slashes or dots between the parts and an optional leading zero,\n * reformats on Enter or blur, shows the locale's format below as its helper text, and\n * says in the supporting text why a date can't be used.\n */\nexport function DateInput({\n label,\n value,\n onCommit,\n onEnter,\n min: minValue,\n max: maxValue,\n isDateUnavailable,\n labels = {},\n supportingText,\n trailingIcon,\n required,\n disabled,\n readOnly,\n name,\n id,\n autoFocus,\n invalid,\n errorMessage,\n className,\n style,\n data,\n classNames,\n density,\n ref,\n inputRef,\n}: DateInputProps) {\n const { locale } = useLocale();\n const format = dateFormat(locale);\n const hint = labels.dateFormatHint ?? format.hint;\n const show = (date: CalendarDate | null) => (date ? format.format(date) : '');\n const [text, setText] = useState(() => show(value));\n const [error, setError] = useState<string | null>(null);\n // A new value from outside (the calendar, a reset) replaces what is typed.\n const [shown, setShown] = useState(value?.toString());\n if (value?.toString() !== shown) {\n setShown(value?.toString());\n setText(show(value));\n setError(null);\n }\n\n const problem = (date: CalendarDate) => {\n const min = minValue && toCalendarDate(minValue);\n const max = maxValue && toCalendarDate(maxValue);\n if ((min && date.compare(min) < 0) || (max && date.compare(max) > 0)) {\n return labels.dateOutOfRange ?? 'Date out of range';\n }\n if (isDateUnavailable?.(date)) return labels.dateUnavailable ?? 'Date not available';\n return null;\n };\n\n /** Reads the text; returns the date (or `null` when empty), or `undefined` when unusable. */\n const commit = (): CalendarDate | null | undefined => {\n if (text.trim() === '') {\n setError(null);\n if (value) onCommit(null);\n return null;\n }\n const date = parseDate(text, format.order);\n if (!date) {\n setError(labels.invalidDate ?? `Enter a date as ${hint}`);\n return undefined;\n }\n const reason = problem(date);\n if (reason) {\n setError(reason);\n return undefined;\n }\n setError(null);\n setText(format.format(date));\n if (date.toString() !== value?.toString()) onCommit(date);\n return date;\n };\n\n return (\n <TextField\n {...data}\n {...(id !== undefined && { id })}\n ref={ref}\n style={style}\n inputRef={inputRef as Ref<HTMLInputElement | HTMLTextAreaElement>}\n variant=\"outlined\"\n {...(density !== undefined && { density })}\n label={label}\n value={text}\n onChange={(next) => {\n setText(next);\n if (error) setError(null);\n }}\n onBlur={() => commit()}\n onKeyDown={(event) => {\n if (event.key !== 'Enter') {\n event.continuePropagation();\n return;\n }\n const date = commit();\n if (date !== undefined) onEnter?.(date);\n }}\n placeholder={hint}\n supportingText={supportingText ?? hint}\n invalid={invalid || error !== null}\n errorMessage={error ?? errorMessage}\n inputMode=\"decimal\"\n autoComplete=\"off\"\n autoFocus={autoFocus}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n name={name}\n trailingIcon={trailingIcon}\n className={className}\n classNames={classNames}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+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