@passui/react 0.1.17 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -1
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/dist/types/src/appearance/index.d.ts +2 -0
- package/dist/types/src/appearance/platform.d.ts +9 -0
- package/dist/types/src/appearance/theme.d.ts +71 -0
- package/dist/types/src/components/accordion/accordion.d.ts +19 -0
- package/dist/types/src/components/ambient/ambient.d.ts +12 -0
- package/dist/types/src/components/ambient/index.d.ts +1 -0
- package/dist/types/src/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +16 -0
- package/dist/types/src/components/button/button-styles.d.ts +12 -0
- package/dist/types/src/components/button/button.d.ts +32 -0
- package/dist/types/src/components/button/icon-button.d.ts +10 -0
- package/dist/types/src/components/button/pending-spinner.d.ts +5 -0
- package/dist/types/src/components/button/use-pending-indicator.d.ts +2 -0
- package/dist/types/src/components/chip/chip.d.ts +7 -0
- package/dist/types/src/components/code-block/code-block.d.ts +10 -0
- package/dist/types/src/components/combo-box/combo-box.d.ts +9 -0
- package/dist/types/src/components/command/command.d.ts +18 -0
- package/dist/types/src/components/compact-date-picker/calendar-month.d.ts +25 -0
- package/dist/types/src/components/compact-date-picker/compact-date-picker.d.ts +27 -0
- package/dist/types/src/components/compact-time-picker/compact-time-picker.d.ts +26 -0
- package/dist/types/src/components/compact-time-picker/time-value.d.ts +18 -0
- package/dist/types/src/components/content-unavailable-view/content-unavailable-view.d.ts +9 -0
- package/dist/types/src/components/content-view/content-view.d.ts +48 -0
- package/dist/types/src/components/content-view/index.d.ts +1 -0
- package/dist/types/src/components/context-menu/conceal-menu-source.d.ts +2 -0
- package/dist/types/src/components/context-menu/context-menu-host.d.ts +2 -0
- package/dist/types/src/components/context-menu/context-menu-store.d.ts +57 -0
- package/dist/types/src/components/context-menu/menu-navigation.d.ts +6 -0
- package/dist/types/src/components/context-menu/menu-position.d.ts +21 -0
- package/dist/types/src/components/context-menu/menu-reveal.d.ts +17 -0
- package/dist/types/src/components/context-menu/use-context-menu.d.ts +14 -0
- package/dist/types/src/components/conversation/conversation.d.ts +43 -0
- package/dist/types/src/components/conversation/index.d.ts +1 -0
- package/dist/types/src/components/date-picker/date-picker.d.ts +16 -0
- package/dist/types/src/components/date-picker/date-value.d.ts +2 -0
- package/dist/types/src/components/dialog/dialog-host.d.ts +6 -0
- package/dist/types/src/components/dialog/dialog-store.d.ts +23 -0
- package/dist/types/src/components/dialog/dialog.d.ts +30 -0
- package/dist/types/src/components/dialog/index.d.ts +1 -0
- package/dist/types/src/components/disclosure-group/disclosure-group.d.ts +15 -0
- package/dist/types/src/components/divider/divider.d.ts +9 -0
- package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +15 -0
- package/dist/types/src/components/keyboard-shortcut/keyboard-shortcut.d.ts +5 -0
- package/dist/types/src/components/labeled-content/labeled-content.d.ts +19 -0
- package/dist/types/src/components/locale-switcher/index.d.ts +1 -0
- package/dist/types/src/components/locale-switcher/locale-switcher.d.ts +10 -0
- package/dist/types/src/components/menu/menu.d.ts +16 -0
- package/dist/types/src/components/one-time-code/one-time-code.d.ts +18 -0
- package/dist/types/src/components/picker/picker-trigger.d.ts +2 -0
- package/dist/types/src/components/picker/picker.d.ts +43 -0
- package/dist/types/src/components/popover/anchored-surface.d.ts +13 -0
- package/dist/types/src/components/popover/popover-fit.d.ts +21 -0
- package/dist/types/src/components/popover/popover.d.ts +18 -0
- package/dist/types/src/components/profile-image/profile-image.d.ts +4 -0
- package/dist/types/src/components/progress-view/progress-view.d.ts +13 -0
- package/dist/types/src/components/progress-view/use-liquid-progress.d.ts +3 -0
- package/dist/types/src/components/radio-group/radio-group.d.ts +17 -0
- package/dist/types/src/components/search-field/expanding-search-field.d.ts +5 -0
- package/dist/types/src/components/search-field/search-field.d.ts +6 -0
- package/dist/types/src/components/search-list/search-list.d.ts +19 -0
- package/dist/types/src/components/section/section.d.ts +15 -0
- package/dist/types/src/components/secure-field/secure-field.d.ts +4 -0
- package/dist/types/src/components/segmented-control/segmented-control.d.ts +20 -0
- package/dist/types/src/components/sheet/modal-environment.d.ts +2 -0
- package/dist/types/src/components/sheet/sheet-portal.d.ts +5 -0
- package/dist/types/src/components/sheet/sheet.d.ts +21 -0
- package/dist/types/src/components/sheet/use-sheet-focus.d.ts +3 -0
- package/dist/types/src/components/sidebar/sidebar.d.ts +19 -0
- package/dist/types/src/components/skeleton/skeleton.d.ts +6 -0
- package/dist/types/src/components/slider/slider.d.ts +14 -0
- package/dist/types/src/components/slosh-slider/liquid-step.d.ts +6 -0
- package/dist/types/src/components/slosh-slider/slosh-slider.d.ts +18 -0
- package/dist/types/src/components/stat-tile/index.d.ts +1 -0
- package/dist/types/src/components/stat-tile/stat-tile.d.ts +15 -0
- package/dist/types/src/components/status-indicator/status-indicator.d.ts +14 -0
- package/dist/types/src/components/stepper/rolling-digit.d.ts +11 -0
- package/dist/types/src/components/stepper/stepper.d.ts +19 -0
- package/dist/types/src/components/swatch-picker/swatch-picker.d.ts +17 -0
- package/dist/types/src/components/tab-bar/tab-bar.d.ts +40 -0
- package/dist/types/src/components/tab-view/tab-view.d.ts +24 -0
- package/dist/types/src/components/table/table.d.ts +10 -0
- package/dist/types/src/components/text-editor/text-editor.d.ts +2 -0
- package/dist/types/src/components/text-field/text-field.d.ts +20 -0
- package/dist/types/src/components/toast/toast-store.d.ts +47 -0
- package/dist/types/src/components/toast/toaster.d.ts +10 -0
- package/dist/types/src/components/toggle/toggle.d.ts +17 -0
- package/dist/types/src/components/tooltip/tooltip-host.d.ts +6 -0
- package/dist/types/src/components/view-controller/index.d.ts +1 -0
- package/dist/types/src/components/view-controller/view-controller.d.ts +21 -0
- package/dist/types/src/components/wake-slider/wake-slider.d.ts +12 -0
- package/dist/types/src/hooks/scroll/minimize-decision.d.ts +2 -0
- package/dist/types/src/hooks/use-anchored-disclosure.d.ts +9 -0
- package/dist/types/src/hooks/use-anchored-placement.d.ts +7 -0
- package/dist/types/src/hooks/use-dismiss.d.ts +9 -0
- package/dist/types/src/hooks/use-floating-dismiss.d.ts +3 -0
- package/dist/types/src/hooks/use-media-query.d.ts +21 -0
- package/dist/types/src/hooks/use-minimize-on-scroll.d.ts +6 -0
- package/dist/types/src/hooks/use-visual-viewport.d.ts +4 -0
- package/dist/types/src/hooks/viewport/types.d.ts +19 -0
- package/dist/types/src/hooks/viewport/viewport-metrics.d.ts +3 -0
- package/dist/types/src/icons/icons.d.ts +612 -0
- package/dist/types/src/index.d.ts +71 -0
- package/dist/types/src/lib/anchored-placement.d.ts +39 -0
- package/dist/types/src/lib/class-names.d.ts +2 -0
- package/dist/types/src/lib/clipboard.d.ts +6 -0
- package/dist/types/src/lib/date.d.ts +50 -0
- package/dist/types/src/lib/floating-layers.d.ts +8 -0
- package/dist/types/src/lib/haptics.d.ts +8 -0
- package/dist/types/src/lib/language.d.ts +4 -0
- package/dist/types/src/lib/range-value.d.ts +4 -0
- package/dist/types/src/lib/screen-edges.d.ts +12 -0
- package/dist/types/src/lib/shapes.d.ts +17 -0
- package/dist/types/src/motion/transitions.d.ts +97 -0
- package/dist/types/src/tokens.d.ts +1 -0
- package/package.json +248 -40
- package/src/appearance/platform.tsx +10 -47
- package/src/appearance/theme.tsx +42 -142
- package/src/components/accordion/accordion.tsx +48 -0
- package/src/components/ambient/ambient.tsx +2 -10
- package/src/components/aspect-ratio/aspect-ratio.tsx +22 -0
- package/src/components/breadcrumb/breadcrumb.tsx +53 -0
- package/src/components/button/button-styles.ts +13 -31
- package/src/components/button/button.tsx +24 -15
- package/src/components/button/icon-button.tsx +14 -56
- package/src/components/button/use-pending-indicator.ts +2 -7
- package/src/components/chip/chip.tsx +8 -13
- package/src/components/code-block/code-block.tsx +41 -0
- package/src/components/combo-box/combo-box.tsx +13 -0
- package/src/components/command/command.tsx +119 -0
- package/src/components/compact-date-picker/calendar-month.ts +13 -57
- package/src/components/compact-date-picker/compact-date-picker.tsx +72 -195
- package/src/components/compact-time-picker/compact-time-picker.tsx +74 -195
- package/src/components/compact-time-picker/time-value.ts +4 -16
- package/src/components/content-unavailable-view/content-unavailable-view.tsx +37 -0
- package/src/components/content-view/content-view.tsx +13 -56
- package/src/components/context-menu/conceal-menu-source.ts +1 -4
- package/src/components/context-menu/context-menu-host.tsx +132 -198
- package/src/components/context-menu/context-menu-store.ts +5 -14
- package/src/components/context-menu/menu-navigation.ts +29 -0
- package/src/components/context-menu/menu-position.ts +6 -27
- package/src/components/context-menu/menu-reveal.ts +14 -52
- package/src/components/context-menu/use-context-menu.ts +6 -30
- package/src/components/conversation/conversation.tsx +26 -72
- package/src/components/date-picker/date-picker.tsx +8 -37
- package/src/components/date-picker/date-value.ts +5 -30
- package/src/components/dialog/dialog-host.tsx +37 -76
- package/src/components/dialog/dialog-store.ts +16 -7
- package/src/components/dialog/dialog.tsx +23 -80
- package/src/components/disclosure-group/disclosure-group.tsx +79 -0
- package/src/components/divider/divider.tsx +31 -0
- package/src/components/inline-disclosure/inline-disclosure.tsx +49 -0
- package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +17 -0
- package/src/components/labeled-content/labeled-content.tsx +24 -18
- package/src/components/locale-switcher/locale-switcher.tsx +20 -70
- package/src/components/menu/menu.tsx +68 -0
- package/src/components/one-time-code/one-time-code.tsx +168 -0
- package/src/components/picker/picker-trigger.ts +10 -0
- package/src/components/picker/picker.tsx +165 -283
- package/src/components/popover/anchored-surface.tsx +223 -0
- package/src/components/popover/popover-fit.ts +69 -0
- package/src/components/popover/popover.tsx +209 -63
- package/src/components/profile-image/profile-image.tsx +6 -28
- package/src/components/progress-view/progress-view.tsx +70 -0
- package/src/components/progress-view/use-liquid-progress.ts +43 -0
- package/src/components/radio-group/radio-group.tsx +63 -0
- package/src/components/search-field/expanding-search-field.tsx +183 -0
- package/src/components/search-field/search-field.tsx +25 -7
- package/src/components/search-list/search-list.tsx +58 -75
- package/src/components/section/section.tsx +18 -17
- package/src/components/secure-field/secure-field.tsx +5 -7
- package/src/components/segmented-control/segmented-control.tsx +20 -29
- package/src/components/sheet/modal-environment.ts +16 -54
- package/src/components/sheet/sheet-portal.tsx +10 -42
- package/src/components/sheet/sheet.tsx +17 -25
- package/src/components/sheet/use-sheet-focus.ts +15 -51
- package/src/components/sidebar/sidebar.tsx +44 -38
- package/src/components/skeleton/skeleton.tsx +19 -0
- package/src/components/slider/slider.tsx +76 -0
- package/src/components/slosh-slider/liquid-step.ts +42 -0
- package/src/components/slosh-slider/slosh-slider.tsx +251 -0
- package/src/components/stat-tile/stat-tile.tsx +9 -30
- package/src/components/status-indicator/status-indicator.tsx +12 -19
- package/src/components/stepper/rolling-digit.tsx +77 -0
- package/src/components/stepper/stepper.tsx +101 -0
- package/src/components/swatch-picker/swatch-picker.tsx +19 -15
- package/src/components/tab-bar/tab-bar.tsx +59 -59
- package/src/components/tab-view/tab-view.tsx +52 -57
- package/src/components/table/table.tsx +14 -62
- package/src/components/text-editor/text-editor.tsx +2 -12
- package/src/components/text-field/text-field.tsx +53 -44
- package/src/components/toast/toast-store.ts +9 -30
- package/src/components/toast/toaster.tsx +90 -104
- package/src/components/toggle/toggle.tsx +165 -44
- package/src/components/tooltip/tooltip-host.tsx +70 -67
- package/src/components/view-controller/view-controller.tsx +4 -21
- package/src/components/wake-slider/wake-slider.tsx +237 -0
- package/src/hooks/scroll/minimize-decision.ts +1 -5
- package/src/hooks/use-anchored-disclosure.ts +23 -0
- package/src/hooks/use-anchored-placement.ts +7 -14
- package/src/hooks/use-dismiss.ts +5 -23
- package/src/hooks/use-floating-dismiss.ts +28 -0
- package/src/hooks/use-media-query.ts +12 -31
- package/src/hooks/use-minimize-on-scroll.ts +10 -34
- package/src/hooks/use-visual-viewport.ts +5 -14
- package/src/hooks/viewport/viewport-metrics.ts +4 -16
- package/src/icons/icons.tsx +229 -183
- package/src/index.ts +27 -1
- package/src/lib/anchored-placement.ts +12 -18
- package/src/lib/class-names.ts +1 -2
- package/src/lib/clipboard.ts +14 -0
- package/src/lib/date.ts +4 -15
- package/src/lib/floating-layers.ts +18 -8
- package/src/lib/haptics.ts +1 -3
- package/src/lib/language.ts +2 -7
- package/src/lib/range-value.ts +32 -0
- package/src/lib/screen-edges.ts +2 -6
- package/src/lib/shapes.ts +5 -20
- package/src/motion/transitions.ts +18 -12
- package/src/styles/code-block.css +33 -0
- package/src/styles/motion-controls.css +189 -0
- package/src/styles/styles.css +3 -0
- package/src/components/ambient/ambient.docs.tsx +0 -68
- package/src/components/ambient/examples/ambient-images.tsx +0 -30
- package/src/components/ambient/examples/ambient-now-playing.tsx +0 -55
- package/src/components/ambient/examples/ambient-showcase.tsx +0 -33
- package/src/components/ambient/examples/ambient-usage.tsx +0 -19
- package/src/components/button/button.docs.tsx +0 -116
- package/src/components/button/examples/button-disabled.tsx +0 -19
- package/src/components/button/examples/button-icon.tsx +0 -39
- package/src/components/button/examples/button-link.tsx +0 -12
- package/src/components/button/examples/button-pending.tsx +0 -27
- package/src/components/button/examples/button-showcase.tsx +0 -115
- package/src/components/button/examples/button-sizes.tsx +0 -12
- package/src/components/button/examples/button-usage.tsx +0 -12
- package/src/components/button/examples/button-variants.tsx +0 -15
- package/src/components/button/examples/button-with-icon.tsx +0 -32
- package/src/components/button/examples/icon-button-player.tsx +0 -38
- package/src/components/button/examples/icon-button-showcase.tsx +0 -83
- package/src/components/button/examples/icon-button-usage.tsx +0 -11
- package/src/components/button/examples/icon-button-variants.tsx +0 -39
- package/src/components/button/icon-button.docs.tsx +0 -68
- package/src/components/chip/chip.docs.tsx +0 -37
- package/src/components/chip/examples/chip-in-rows.tsx +0 -19
- package/src/components/chip/examples/chip-showcase.tsx +0 -51
- package/src/components/chip/examples/chip-tones.tsx +0 -13
- package/src/components/chip/examples/chip-usage.tsx +0 -5
- package/src/components/compact-date-picker/compact-date-picker.docs.tsx +0 -81
- package/src/components/compact-date-picker/examples/compact-date-picker-showcase.tsx +0 -35
- package/src/components/compact-date-picker/examples/compact-date-picker-usage.tsx +0 -22
- package/src/components/compact-time-picker/compact-time-picker.docs.tsx +0 -80
- package/src/components/compact-time-picker/examples/compact-time-picker-showcase.tsx +0 -31
- package/src/components/compact-time-picker/examples/compact-time-picker-usage.tsx +0 -21
- package/src/components/content-view/content-view.docs.tsx +0 -61
- package/src/components/content-view/examples/content-view-header-action.tsx +0 -33
- package/src/components/content-view/examples/content-view-showcase.tsx +0 -65
- package/src/components/content-view/examples/content-view-stats.tsx +0 -35
- package/src/components/content-view/examples/content-view-usage.tsx +0 -14
- package/src/components/context-menu/context-menu.docs.tsx +0 -92
- package/src/components/context-menu/examples/context-menu-checked.tsx +0 -37
- package/src/components/context-menu/examples/context-menu-list.tsx +0 -85
- package/src/components/context-menu/examples/context-menu-showcase.tsx +0 -56
- package/src/components/context-menu/examples/context-menu-toolbar.tsx +0 -63
- package/src/components/context-menu/examples/context-menu-usage.tsx +0 -24
- package/src/components/conversation/conversation.docs.tsx +0 -88
- package/src/components/conversation/examples/conversation-composer.tsx +0 -36
- package/src/components/conversation/examples/conversation-days.tsx +0 -48
- package/src/components/conversation/examples/conversation-showcase.tsx +0 -71
- package/src/components/conversation/examples/conversation-usage.tsx +0 -28
- package/src/components/date-picker/date-picker.docs.tsx +0 -88
- package/src/components/date-picker/examples/date-picker-locales.tsx +0 -41
- package/src/components/date-picker/examples/date-picker-past-only.tsx +0 -29
- package/src/components/date-picker/examples/date-picker-showcase.tsx +0 -49
- package/src/components/date-picker/examples/date-picker-usage.tsx +0 -22
- package/src/components/dialog/dialog.docs.tsx +0 -114
- package/src/components/dialog/examples/dialog-confirm.tsx +0 -24
- package/src/components/dialog/examples/dialog-form.tsx +0 -46
- package/src/components/dialog/examples/dialog-inline.tsx +0 -48
- package/src/components/dialog/examples/dialog-showcase.tsx +0 -53
- package/src/components/dialog/examples/dialog-usage.tsx +0 -31
- package/src/components/labeled-content/examples/labeled-content-descriptions.tsx +0 -37
- package/src/components/labeled-content/examples/labeled-content-showcase.tsx +0 -54
- package/src/components/labeled-content/examples/labeled-content-usage.tsx +0 -22
- package/src/components/labeled-content/examples/labeled-content-values.tsx +0 -26
- package/src/components/labeled-content/examples/labeled-content-wide.tsx +0 -46
- package/src/components/labeled-content/labeled-content.docs.tsx +0 -69
- package/src/components/locale-switcher/examples/locale-switcher-native-names.tsx +0 -30
- package/src/components/locale-switcher/examples/locale-switcher-showcase.tsx +0 -46
- package/src/components/locale-switcher/examples/locale-switcher-translated-page.tsx +0 -35
- package/src/components/locale-switcher/examples/locale-switcher-usage.tsx +0 -20
- package/src/components/locale-switcher/locale-switcher.docs.tsx +0 -91
- package/src/components/picker/examples/picker-details.tsx +0 -44
- package/src/components/picker/examples/picker-searchable.tsx +0 -48
- package/src/components/picker/examples/picker-showcase.tsx +0 -66
- package/src/components/picker/examples/picker-usage.tsx +0 -20
- package/src/components/picker/picker.docs.tsx +0 -68
- package/src/components/popover/examples/popover-help.tsx +0 -57
- package/src/components/popover/examples/popover-menu.tsx +0 -51
- package/src/components/popover/examples/popover-showcase.tsx +0 -61
- package/src/components/popover/examples/popover-usage.tsx +0 -31
- package/src/components/popover/popover.docs.tsx +0 -84
- package/src/components/profile-image/examples/profile-image-fallbacks.tsx +0 -29
- package/src/components/profile-image/examples/profile-image-group.tsx +0 -34
- package/src/components/profile-image/examples/profile-image-showcase.tsx +0 -30
- package/src/components/profile-image/examples/profile-image-usage.tsx +0 -14
- package/src/components/profile-image/profile-image.docs.tsx +0 -81
- package/src/components/search-field/examples/search-field-filter.tsx +0 -53
- package/src/components/search-field/examples/search-field-showcase.tsx +0 -56
- package/src/components/search-field/examples/search-field-toolbar.tsx +0 -27
- package/src/components/search-field/examples/search-field-usage.tsx +0 -18
- package/src/components/search-field/search-field.docs.tsx +0 -58
- package/src/components/search-list/examples/search-list-dropdown.tsx +0 -53
- package/src/components/search-list/examples/search-list-groups.tsx +0 -64
- package/src/components/search-list/examples/search-list-showcase.tsx +0 -67
- package/src/components/search-list/examples/search-list-usage.tsx +0 -27
- package/src/components/search-list/search-list.docs.tsx +0 -87
- package/src/components/section/examples/section-actions.tsx +0 -35
- package/src/components/section/examples/section-groups.tsx +0 -41
- package/src/components/section/examples/section-showcase.tsx +0 -63
- package/src/components/section/examples/section-usage.tsx +0 -19
- package/src/components/section/section.docs.tsx +0 -51
- package/src/components/secure-field/examples/secure-field-new-password.tsx +0 -56
- package/src/components/secure-field/examples/secure-field-reveal.tsx +0 -20
- package/src/components/secure-field/examples/secure-field-showcase.tsx +0 -62
- package/src/components/secure-field/examples/secure-field-usage.tsx +0 -19
- package/src/components/secure-field/secure-field.docs.tsx +0 -72
- package/src/components/segmented-control/examples/segmented-control-overflow.tsx +0 -28
- package/src/components/segmented-control/examples/segmented-control-showcase.tsx +0 -59
- package/src/components/segmented-control/examples/segmented-control-usage.tsx +0 -20
- package/src/components/segmented-control/examples/segmented-control-views.tsx +0 -32
- package/src/components/segmented-control/segmented-control.docs.tsx +0 -61
- package/src/components/sheet/examples/sheet-choices.tsx +0 -58
- package/src/components/sheet/examples/sheet-share.tsx +0 -51
- package/src/components/sheet/examples/sheet-showcase.tsx +0 -74
- package/src/components/sheet/examples/sheet-usage.tsx +0 -32
- package/src/components/sheet/sheet.docs.tsx +0 -75
- package/src/components/sidebar/examples/sidebar-groups.tsx +0 -133
- package/src/components/sidebar/examples/sidebar-showcase.tsx +0 -123
- package/src/components/sidebar/examples/sidebar-unread.tsx +0 -66
- package/src/components/sidebar/examples/sidebar-usage.tsx +0 -52
- package/src/components/sidebar/sidebar.docs.tsx +0 -135
- package/src/components/stat-tile/examples/stat-tile-filters.tsx +0 -32
- package/src/components/stat-tile/examples/stat-tile-grid.tsx +0 -21
- package/src/components/stat-tile/examples/stat-tile-showcase.tsx +0 -52
- package/src/components/stat-tile/examples/stat-tile-usage.tsx +0 -13
- package/src/components/stat-tile/stat-tile.docs.tsx +0 -60
- package/src/components/status-indicator/examples/status-indicator-live.tsx +0 -34
- package/src/components/status-indicator/examples/status-indicator-showcase.tsx +0 -39
- package/src/components/status-indicator/examples/status-indicator-states.tsx +0 -17
- package/src/components/status-indicator/examples/status-indicator-usage.tsx +0 -9
- package/src/components/status-indicator/status-indicator.docs.tsx +0 -43
- package/src/components/swatch-picker/examples/swatch-picker-accents.tsx +0 -42
- package/src/components/swatch-picker/examples/swatch-picker-labels.tsx +0 -45
- package/src/components/swatch-picker/examples/swatch-picker-showcase.tsx +0 -70
- package/src/components/swatch-picker/examples/swatch-picker-usage.tsx +0 -39
- package/src/components/swatch-picker/swatch-picker.docs.tsx +0 -60
- package/src/components/tab-bar/examples/tab-bar-five-tabs.tsx +0 -66
- package/src/components/tab-bar/examples/tab-bar-minimize.tsx +0 -71
- package/src/components/tab-bar/examples/tab-bar-showcase.tsx +0 -82
- package/src/components/tab-bar/examples/tab-bar-usage.tsx +0 -54
- package/src/components/tab-bar/tab-bar.docs.tsx +0 -136
- package/src/components/tab-view/examples/tab-view-keyboard.tsx +0 -39
- package/src/components/tab-view/examples/tab-view-settings.tsx +0 -56
- package/src/components/tab-view/examples/tab-view-showcase.tsx +0 -53
- package/src/components/tab-view/examples/tab-view-usage.tsx +0 -23
- package/src/components/tab-view/tab-view.docs.tsx +0 -77
- package/src/components/table/examples/table-empty.tsx +0 -53
- package/src/components/table/examples/table-invoices.tsx +0 -102
- package/src/components/table/examples/table-selection.tsx +0 -150
- package/src/components/table/examples/table-showcase.tsx +0 -115
- package/src/components/table/examples/table-usage.tsx +0 -67
- package/src/components/table/examples/table-wide.tsx +0 -75
- package/src/components/table/table.docs.tsx +0 -131
- package/src/components/text-editor/examples/text-editor-comment.tsx +0 -48
- package/src/components/text-editor/examples/text-editor-count.tsx +0 -38
- package/src/components/text-editor/examples/text-editor-showcase.tsx +0 -58
- package/src/components/text-editor/examples/text-editor-usage.tsx +0 -25
- package/src/components/text-editor/text-editor.docs.tsx +0 -61
- package/src/components/text-field/examples/text-field-icons.tsx +0 -72
- package/src/components/text-field/examples/text-field-showcase.tsx +0 -50
- package/src/components/text-field/examples/text-field-usage.tsx +0 -18
- package/src/components/text-field/examples/text-field-validation.tsx +0 -27
- package/src/components/text-field/text-field.docs.tsx +0 -118
- package/src/components/toast/examples/toast-action.tsx +0 -32
- package/src/components/toast/examples/toast-promise.tsx +0 -45
- package/src/components/toast/examples/toast-showcase.tsx +0 -49
- package/src/components/toast/examples/toast-usage.tsx +0 -13
- package/src/components/toast/toast.docs.tsx +0 -79
- package/src/components/toggle/examples/toggle-checkboxes.tsx +0 -43
- package/src/components/toggle/examples/toggle-settings.tsx +0 -31
- package/src/components/toggle/examples/toggle-showcase.tsx +0 -59
- package/src/components/toggle/examples/toggle-usage.tsx +0 -13
- package/src/components/toggle/toggle.docs.tsx +0 -69
- package/src/components/tooltip/examples/tooltip-icon-buttons.tsx +0 -27
- package/src/components/tooltip/examples/tooltip-shortcuts.tsx +0 -38
- package/src/components/tooltip/examples/tooltip-showcase.tsx +0 -44
- package/src/components/tooltip/examples/tooltip-usage.tsx +0 -13
- package/src/components/tooltip/tooltip.docs.tsx +0 -56
- package/src/components/view-controller/examples/view-controller-action.tsx +0 -27
- package/src/components/view-controller/examples/view-controller-settings.tsx +0 -31
- package/src/components/view-controller/examples/view-controller-showcase.tsx +0 -45
- package/src/components/view-controller/examples/view-controller-usage.tsx +0 -19
- package/src/components/view-controller/view-controller.docs.tsx +0 -71
- package/src/docs/index.ts +0 -3
- package/src/docs/registry.ts +0 -113
- package/src/docs/snippet.ts +0 -17
- package/src/docs/types.ts +0 -180
|
@@ -2,12 +2,7 @@ import { type ButtonHTMLAttributes, forwardRef } from "react"
|
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
3
|
import { PendingSpinner } from "./pending-spinner"
|
|
4
4
|
import { usePendingIndicator } from "./use-pending-indicator"
|
|
5
|
-
import {
|
|
6
|
-
buttonSizes,
|
|
7
|
-
buttonVariants,
|
|
8
|
-
type ButtonSize,
|
|
9
|
-
type ButtonVariant,
|
|
10
|
-
} from "./button-styles"
|
|
5
|
+
import { buttonSizes, buttonVariants, type ButtonSize, type ButtonVariant } from "./button-styles"
|
|
11
6
|
|
|
12
7
|
export type { ButtonSize, ButtonVariant }
|
|
13
8
|
|
|
@@ -15,11 +10,26 @@ export type { ButtonSize, ButtonVariant }
|
|
|
15
10
|
* Each variant has a little depth: a fine highlight along the top edge and
|
|
16
11
|
* a soft, layered shadow, like a well-made physical key.
|
|
17
12
|
*/
|
|
18
|
-
export interface ButtonProps
|
|
19
|
-
|
|
13
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
|
+
/**
|
|
15
|
+
* Visual emphasis: `default` (solid), `accent` (main action),
|
|
16
|
+
* `secondary` (quiet fill), `outline`, `ghost`, `link`, or `destructive`.
|
|
17
|
+
* @default "default"
|
|
18
|
+
*/
|
|
20
19
|
variant?: ButtonVariant
|
|
20
|
+
/**
|
|
21
|
+
* Label sizes: `xs`, `sm`, `default`, `lg`.
|
|
22
|
+
* Icon sizes: `icon-xs`, `icon-sm`, `icon`, `icon-lg`, `icon-full`.
|
|
23
|
+
* Prefer IconButton for an icon with a built-in accessible label.
|
|
24
|
+
* @default "default"
|
|
25
|
+
*/
|
|
21
26
|
size?: ButtonSize
|
|
27
|
+
/** Shows a delayed spinner, keeps the button's width, and prevents repeat presses.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
22
30
|
isPending?: boolean
|
|
31
|
+
/** Layout classes for the content wrapper, such as a full-width disclosure row. */
|
|
32
|
+
contentClassName?: string
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
/** Shares native button appearance with semantic links without nesting a button. */
|
|
@@ -39,14 +49,13 @@ export function buttonStyle({
|
|
|
39
49
|
)
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
ButtonProps
|
|
45
|
-
>(function Button(
|
|
52
|
+
/** A native button with Passui styling, pending feedback, and an HTMLButtonElement ref. */
|
|
53
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
46
54
|
{
|
|
47
55
|
variant = "default",
|
|
48
56
|
size = "default",
|
|
49
57
|
isPending = false,
|
|
58
|
+
contentClassName,
|
|
50
59
|
disabled,
|
|
51
60
|
children,
|
|
52
61
|
className,
|
|
@@ -55,8 +64,7 @@ export const Button = forwardRef<
|
|
|
55
64
|
},
|
|
56
65
|
ref
|
|
57
66
|
) {
|
|
58
|
-
const showPendingIndicator =
|
|
59
|
-
usePendingIndicator(isPending)
|
|
67
|
+
const showPendingIndicator = usePendingIndicator(isPending)
|
|
60
68
|
|
|
61
69
|
return (
|
|
62
70
|
<button
|
|
@@ -80,7 +88,8 @@ export const Button = forwardRef<
|
|
|
80
88
|
<span
|
|
81
89
|
className={cn(
|
|
82
90
|
"inline-flex items-center justify-center gap-2 transition-opacity duration-200",
|
|
83
|
-
showPendingIndicator && "opacity-0"
|
|
91
|
+
showPendingIndicator && "opacity-0",
|
|
92
|
+
contentClassName
|
|
84
93
|
)}
|
|
85
94
|
>
|
|
86
95
|
{children}
|
|
@@ -1,73 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forwardRef } from "react"
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
buttonVariants,
|
|
7
|
-
iconButtonSizes,
|
|
8
|
-
type ButtonVariant,
|
|
9
|
-
type IconButtonSize,
|
|
10
|
-
} from "./button-styles"
|
|
3
|
+
import { Button, type ButtonProps } from "./button"
|
|
4
|
+
import type { ButtonVariant, IconButtonSize } from "./button-styles"
|
|
11
5
|
|
|
12
|
-
export type { IconButtonSize }
|
|
6
|
+
export type { ButtonVariant, IconButtonSize }
|
|
13
7
|
|
|
14
|
-
export interface IconButtonProps
|
|
15
|
-
|
|
16
|
-
/** Required: icon-only buttons need an accessible name. */
|
|
8
|
+
export interface IconButtonProps extends Omit<ButtonProps, "size"> {
|
|
9
|
+
/** Icon-only actions must have an accessible name. */
|
|
17
10
|
label: string
|
|
18
|
-
variant?: ButtonVariant
|
|
19
11
|
size?: IconButtonSize
|
|
20
|
-
isPending?: boolean
|
|
21
12
|
}
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
>(function IconButton(
|
|
27
|
-
{
|
|
28
|
-
label,
|
|
29
|
-
variant = "default",
|
|
30
|
-
size = "icon",
|
|
31
|
-
isPending = false,
|
|
32
|
-
disabled,
|
|
33
|
-
children,
|
|
34
|
-
className,
|
|
35
|
-
type = "button",
|
|
36
|
-
...props
|
|
37
|
-
},
|
|
14
|
+
/** An accessible icon-only presentation of Button, sharing its interaction behavior. */
|
|
15
|
+
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(
|
|
16
|
+
{ label, size = "icon", className, children, ...props },
|
|
38
17
|
ref
|
|
39
18
|
) {
|
|
40
|
-
const showPendingIndicator =
|
|
41
|
-
usePendingIndicator(isPending)
|
|
42
|
-
|
|
43
19
|
return (
|
|
44
|
-
<
|
|
20
|
+
<Button
|
|
45
21
|
ref={ref}
|
|
46
|
-
|
|
22
|
+
size={size}
|
|
47
23
|
aria-label={label}
|
|
48
24
|
data-tooltip={label}
|
|
49
|
-
className={cn(
|
|
50
|
-
"relative",
|
|
51
|
-
"group inline-flex shrink-0 items-center justify-center rounded-full transition-[background-color,filter,transform,box-shadow] duration-fast ease-standard active:scale-[0.92] disabled:pointer-events-none disabled:opacity-40 data-pending:cursor-progress data-pending:disabled:opacity-100",
|
|
52
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
53
|
-
iconButtonSizes[size],
|
|
54
|
-
buttonVariants[variant],
|
|
55
|
-
className
|
|
56
|
-
)}
|
|
25
|
+
className={cn("active:scale-[0.92]", className)}
|
|
57
26
|
{...props}
|
|
58
|
-
data-pending={isPending || undefined}
|
|
59
|
-
disabled={disabled || isPending}
|
|
60
|
-
aria-busy={isPending || props["aria-busy"]}
|
|
61
27
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"inline-flex items-center justify-center transition-opacity duration-200",
|
|
65
|
-
showPendingIndicator && "opacity-0"
|
|
66
|
-
)}
|
|
67
|
-
>
|
|
68
|
-
{children}
|
|
69
|
-
</span>
|
|
70
|
-
{showPendingIndicator && <PendingSpinner />}
|
|
71
|
-
</button>
|
|
28
|
+
{children}
|
|
29
|
+
</Button>
|
|
72
30
|
)
|
|
73
31
|
})
|
|
@@ -3,10 +3,7 @@ import { useEffect, useState } from "react"
|
|
|
3
3
|
const PENDING_INDICATOR_DELAY = 300
|
|
4
4
|
|
|
5
5
|
export function schedulePendingIndicator(onShow: () => void) {
|
|
6
|
-
const timeout = setTimeout(
|
|
7
|
-
onShow,
|
|
8
|
-
PENDING_INDICATOR_DELAY
|
|
9
|
-
)
|
|
6
|
+
const timeout = setTimeout(onShow, PENDING_INDICATOR_DELAY)
|
|
10
7
|
return () => clearTimeout(timeout)
|
|
11
8
|
}
|
|
12
9
|
|
|
@@ -18,9 +15,7 @@ export function usePendingIndicator(isPending: boolean) {
|
|
|
18
15
|
|
|
19
16
|
if (!isPending) return
|
|
20
17
|
|
|
21
|
-
return schedulePendingIndicator(() =>
|
|
22
|
-
setIsVisible(true)
|
|
23
|
-
)
|
|
18
|
+
return schedulePendingIndicator(() => setIsVisible(true))
|
|
24
19
|
}, [isPending])
|
|
25
20
|
|
|
26
21
|
return isPending && isVisible
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "react"
|
|
2
2
|
import { cn } from "../../lib/class-names"
|
|
3
3
|
|
|
4
|
-
export type ChipTone =
|
|
5
|
-
| "neutral"
|
|
6
|
-
| "accent"
|
|
7
|
-
| "public"
|
|
8
|
-
| "family"
|
|
9
|
-
| "friends"
|
|
4
|
+
export type ChipTone = "neutral" | "accent" | "public" | "family" | "friends"
|
|
10
5
|
|
|
11
6
|
const tones: Record<ChipTone, string> = {
|
|
12
7
|
neutral: "bg-fill text-label-secondary",
|
|
13
8
|
accent: "bg-elevated text-accent-text",
|
|
14
9
|
public: "bg-[#e8efff] text-[#2c55b8] dark:bg-[#1c2740] dark:text-[#a9c1ff]",
|
|
15
10
|
family: "bg-[#e3f3eb] text-[#24704f] dark:bg-[#15302a] dark:text-[#8fd6b6]",
|
|
16
|
-
friends:
|
|
17
|
-
"bg-[#ede8ff] text-[#5a3fc0] dark:bg-[#26203f] dark:text-[#c3b5ff]",
|
|
11
|
+
friends: "bg-[#ede8ff] text-[#5a3fc0] dark:bg-[#26203f] dark:text-[#c3b5ff]",
|
|
18
12
|
}
|
|
19
13
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
15
|
+
/** `neutral`, `accent`, `public`, `family`, or `friends`. @default "neutral" */
|
|
16
|
+
tone?: ChipTone
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function Chip({ tone = "neutral", className, ...props }: ChipProps) {
|
|
25
20
|
return (
|
|
26
21
|
<span
|
|
27
22
|
className={cn(
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Fragment, type ComponentProps, type ReactNode } from "react"
|
|
2
|
+
import { cn } from "../../lib/class-names"
|
|
3
|
+
|
|
4
|
+
export interface CodeBlockProps extends Omit<ComponentProps<"div">, "children"> {
|
|
5
|
+
code: string
|
|
6
|
+
/** Supply a highlighter's rendered pre/code element; source remains the fallback. */
|
|
7
|
+
children?: ReactNode
|
|
8
|
+
/** Show a nonselectable line gutter. @default true */
|
|
9
|
+
lineNumbers?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Code presentation without shipping a highlighter or formatter to consumers. */
|
|
13
|
+
export function CodeBlock({
|
|
14
|
+
code,
|
|
15
|
+
children,
|
|
16
|
+
lineNumbers = true,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: CodeBlockProps) {
|
|
20
|
+
const lines = code.split("\n")
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
{...props}
|
|
24
|
+
className={cn("passui-code-block", className)}
|
|
25
|
+
data-line-numbers={lineNumbers || undefined}
|
|
26
|
+
>
|
|
27
|
+
{children ?? (
|
|
28
|
+
<pre>
|
|
29
|
+
<code>
|
|
30
|
+
{lines.map((line, index) => (
|
|
31
|
+
<Fragment key={`${index}-${line}`}>
|
|
32
|
+
<span className="line">{line || " "}</span>
|
|
33
|
+
{index < lines.length - 1 ? "\n" : null}
|
|
34
|
+
</Fragment>
|
|
35
|
+
))}
|
|
36
|
+
</code>
|
|
37
|
+
</pre>
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Picker, type PickerOption, type PickerProps } from "../picker/picker"
|
|
2
|
+
|
|
3
|
+
export interface ComboBoxOption<T extends string> extends PickerOption<T> {}
|
|
4
|
+
export interface ComboBoxProps<T extends string>
|
|
5
|
+
extends Omit<PickerProps<T>, "searchable" | "options"> {
|
|
6
|
+
options: readonly ComboBoxOption<T>[]
|
|
7
|
+
emptyLabel: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** A searchable Picker, with optional creation from the person's typed query. */
|
|
11
|
+
export function ComboBox<T extends string>(props: ComboBoxProps<T>) {
|
|
12
|
+
return <Picker {...props} searchable />
|
|
13
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type ComponentProps, useEffect, useRef } from "react"
|
|
2
|
+
import { SearchIcon } from "../../icons/icons"
|
|
3
|
+
import { cn } from "../../lib/class-names"
|
|
4
|
+
import { KeyboardShortcut } from "../keyboard-shortcut/keyboard-shortcut"
|
|
5
|
+
import {
|
|
6
|
+
SearchList,
|
|
7
|
+
SearchListField,
|
|
8
|
+
SearchListResults,
|
|
9
|
+
SearchListEmpty,
|
|
10
|
+
SearchListGroup,
|
|
11
|
+
SearchListItem,
|
|
12
|
+
} from "../search-list/search-list"
|
|
13
|
+
import { Sheet, type SheetProps } from "../sheet/sheet"
|
|
14
|
+
|
|
15
|
+
export interface CommandProps extends ComponentProps<typeof SearchList> {}
|
|
16
|
+
export interface CommandDialogProps extends Omit<SheetProps, "placement"> {}
|
|
17
|
+
|
|
18
|
+
/** An inline command palette. SearchList owns filtering and keyboard selection. */
|
|
19
|
+
export function Command({ className, ...props }: CommandProps) {
|
|
20
|
+
return (
|
|
21
|
+
<SearchList
|
|
22
|
+
{...props}
|
|
23
|
+
className={cn(
|
|
24
|
+
"not-typeset glass-menu flex min-h-0 w-full flex-col overflow-hidden rounded-3xl",
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A modal command palette with Sheet's focus isolation and restoration. */
|
|
32
|
+
export function CommandDialog({ children, className, ...props }: CommandDialogProps) {
|
|
33
|
+
return (
|
|
34
|
+
<Sheet
|
|
35
|
+
{...props}
|
|
36
|
+
placement="center"
|
|
37
|
+
className={cn("max-w-lg rounded-3xl outline-none", className)}
|
|
38
|
+
>
|
|
39
|
+
<SearchList className="not-typeset flex min-h-0 flex-col">{children}</SearchList>
|
|
40
|
+
</Sheet>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function CommandInput({
|
|
45
|
+
className,
|
|
46
|
+
autoFocus,
|
|
47
|
+
ref: forwardedRef,
|
|
48
|
+
...props
|
|
49
|
+
}: ComponentProps<typeof SearchListField>) {
|
|
50
|
+
const input = useRef<HTMLInputElement>(null)
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (autoFocus) input.current?.focus({ preventScroll: true })
|
|
53
|
+
}, [autoFocus])
|
|
54
|
+
return (
|
|
55
|
+
<div className="flex shrink-0 items-center gap-2 border-b border-separator/50 px-4">
|
|
56
|
+
<SearchIcon size={17} className="shrink-0 text-label-tertiary" />
|
|
57
|
+
<SearchListField
|
|
58
|
+
{...props}
|
|
59
|
+
ref={(node) => {
|
|
60
|
+
input.current = node
|
|
61
|
+
if (typeof forwardedRef === "function") forwardedRef(node)
|
|
62
|
+
else if (forwardedRef) forwardedRef.current = node
|
|
63
|
+
}}
|
|
64
|
+
className={cn(
|
|
65
|
+
"min-h-12 rounded-none border-0 bg-transparent px-0 focus-visible:ring-0",
|
|
66
|
+
className
|
|
67
|
+
)}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function CommandList({ className, ...props }: ComponentProps<typeof SearchListResults>) {
|
|
74
|
+
return (
|
|
75
|
+
<SearchListResults {...props} className={cn("max-h-[min(60svh,24rem)] p-1.5", className)} />
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function CommandEmpty({ className, ...props }: ComponentProps<typeof SearchListEmpty>) {
|
|
80
|
+
return (
|
|
81
|
+
<SearchListEmpty
|
|
82
|
+
{...props}
|
|
83
|
+
className={cn("px-3 py-8 text-center text-footnote text-label-secondary", className)}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function CommandShortcut({ className, ...props }: ComponentProps<typeof KeyboardShortcut>) {
|
|
89
|
+
return (
|
|
90
|
+
<KeyboardShortcut
|
|
91
|
+
{...props}
|
|
92
|
+
className={cn("ms-auto border-0 bg-transparent text-label-tertiary", className)}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function CommandGroup({ className, ...props }: ComponentProps<typeof SearchListGroup>) {
|
|
98
|
+
return (
|
|
99
|
+
<SearchListGroup
|
|
100
|
+
{...props}
|
|
101
|
+
className={cn(
|
|
102
|
+
"border-separator/50 not-first:mt-1 not-first:border-t not-first:pt-1",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function CommandItem({ className, ...props }: ComponentProps<typeof SearchListItem>) {
|
|
110
|
+
return (
|
|
111
|
+
<SearchListItem
|
|
112
|
+
{...props}
|
|
113
|
+
className={cn(
|
|
114
|
+
"[&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-label-secondary",
|
|
115
|
+
className
|
|
116
|
+
)}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
@@ -9,11 +9,7 @@ export interface CalendarDay {
|
|
|
9
9
|
export function parseDay(value: string): CalendarDay | null {
|
|
10
10
|
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value)
|
|
11
11
|
if (!match) return null
|
|
12
|
-
const [year, month, day] = [
|
|
13
|
-
Number(match[1]),
|
|
14
|
-
Number(match[2]),
|
|
15
|
-
Number(match[3]),
|
|
16
|
-
]
|
|
12
|
+
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])]
|
|
17
13
|
const date = new Date(Date.UTC(year, month - 1, day))
|
|
18
14
|
const real =
|
|
19
15
|
date.getUTCFullYear() === year &&
|
|
@@ -22,24 +18,14 @@ export function parseDay(value: string): CalendarDay | null {
|
|
|
22
18
|
return real ? { year, month, day } : null
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
export function formatDay({
|
|
26
|
-
|
|
27
|
-
month,
|
|
28
|
-
day,
|
|
29
|
-
}: CalendarDay): string {
|
|
30
|
-
const pad = (value: number, width: number) =>
|
|
31
|
-
String(value).padStart(width, "0")
|
|
21
|
+
export function formatDay({ year, month, day }: CalendarDay): string {
|
|
22
|
+
const pad = (value: number, width: number) => String(value).padStart(width, "0")
|
|
32
23
|
return `${pad(year, 4)}-${pad(month, 2)}-${pad(day, 2)}`
|
|
33
24
|
}
|
|
34
25
|
|
|
35
26
|
/** Moves by whole days, across months and years. */
|
|
36
|
-
export function addDays(
|
|
37
|
-
day
|
|
38
|
-
count: number
|
|
39
|
-
): CalendarDay {
|
|
40
|
-
const date = new Date(
|
|
41
|
-
Date.UTC(day.year, day.month - 1, day.day + count)
|
|
42
|
-
)
|
|
27
|
+
export function addDays(day: CalendarDay, count: number): CalendarDay {
|
|
28
|
+
const date = new Date(Date.UTC(day.year, day.month - 1, day.day + count))
|
|
43
29
|
return {
|
|
44
30
|
year: date.getUTCFullYear(),
|
|
45
31
|
month: date.getUTCMonth() + 1,
|
|
@@ -48,18 +34,11 @@ export function addDays(
|
|
|
48
34
|
}
|
|
49
35
|
|
|
50
36
|
/** Moves by months, keeping the day where the month allows (31 Jan + 1 is 28 or 29 Feb). */
|
|
51
|
-
export function addMonths(
|
|
52
|
-
day
|
|
53
|
-
count: number
|
|
54
|
-
): CalendarDay {
|
|
55
|
-
const first = new Date(
|
|
56
|
-
Date.UTC(day.year, day.month - 1 + count, 1)
|
|
57
|
-
)
|
|
37
|
+
export function addMonths(day: CalendarDay, count: number): CalendarDay {
|
|
38
|
+
const first = new Date(Date.UTC(day.year, day.month - 1 + count, 1))
|
|
58
39
|
const year = first.getUTCFullYear()
|
|
59
40
|
const month = first.getUTCMonth() + 1
|
|
60
|
-
const last = new Date(
|
|
61
|
-
Date.UTC(year, month, 0)
|
|
62
|
-
).getUTCDate()
|
|
41
|
+
const last = new Date(Date.UTC(year, month, 0)).getUTCDate()
|
|
63
42
|
return { year, month, day: Math.min(day.day, last) }
|
|
64
43
|
}
|
|
65
44
|
|
|
@@ -70,31 +49,14 @@ export function addMonths(
|
|
|
70
49
|
*/
|
|
71
50
|
export function firstWeekday(locale: string): number {
|
|
72
51
|
try {
|
|
73
|
-
const info = new Intl.Locale(
|
|
74
|
-
locale
|
|
75
|
-
) as Intl.Locale & {
|
|
52
|
+
const info = new Intl.Locale(locale) as Intl.Locale & {
|
|
76
53
|
getWeekInfo?: () => { firstDay: number }
|
|
77
54
|
weekInfo?: { firstDay: number }
|
|
78
55
|
}
|
|
79
|
-
const first =
|
|
80
|
-
info.getWeekInfo?.().firstDay ??
|
|
81
|
-
info.weekInfo?.firstDay
|
|
56
|
+
const first = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay
|
|
82
57
|
if (first) return first
|
|
83
58
|
const region = info.maximize().region ?? ""
|
|
84
|
-
return [
|
|
85
|
-
"US",
|
|
86
|
-
"CA",
|
|
87
|
-
"JP",
|
|
88
|
-
"KR",
|
|
89
|
-
"TW",
|
|
90
|
-
"BR",
|
|
91
|
-
"MX",
|
|
92
|
-
"IL",
|
|
93
|
-
"PH",
|
|
94
|
-
"IN",
|
|
95
|
-
].includes(region)
|
|
96
|
-
? 7
|
|
97
|
-
: 1
|
|
59
|
+
return ["US", "CA", "JP", "KR", "TW", "BR", "MX", "IL", "PH", "IN"].includes(region) ? 7 : 1
|
|
98
60
|
} catch {
|
|
99
61
|
return 1
|
|
100
62
|
}
|
|
@@ -107,9 +69,7 @@ export function monthGrid(
|
|
|
107
69
|
firstDay: number
|
|
108
70
|
): Array<CalendarDay & { inMonth: boolean }> {
|
|
109
71
|
// getUTCDay counts Sunday as 0; weeks here count it as 7.
|
|
110
|
-
const weekday =
|
|
111
|
-
new Date(Date.UTC(year, month - 1, 1)).getUTCDay() ||
|
|
112
|
-
7
|
|
72
|
+
const weekday = new Date(Date.UTC(year, month - 1, 1)).getUTCDay() || 7
|
|
113
73
|
const lead = (weekday - firstDay + 7) % 7
|
|
114
74
|
const start = addDays({ year, month, day: 1 }, -lead)
|
|
115
75
|
return Array.from({ length: 42 }, (_, index) => {
|
|
@@ -122,10 +82,6 @@ export function monthGrid(
|
|
|
122
82
|
}
|
|
123
83
|
|
|
124
84
|
/** Whether `value` (`YYYY-MM-DD`) lies within the optional bounds. */
|
|
125
|
-
export function withinBounds(
|
|
126
|
-
value: string,
|
|
127
|
-
min?: string,
|
|
128
|
-
max?: string
|
|
129
|
-
): boolean {
|
|
85
|
+
export function withinBounds(value: string, min?: string, max?: string): boolean {
|
|
130
86
|
return (!min || value >= min) && (!max || value <= max)
|
|
131
87
|
}
|