@passui/react 0.1.46 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -109
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/accordion.d.ts +15 -0
- package/dist/accordion.js +93 -0
- package/dist/alert-dialog.d.ts +26 -0
- package/dist/alert-dialog.js +142 -0
- package/dist/alert.d.ts +10 -0
- package/dist/alert.js +28 -0
- package/dist/{types/src/components/ambient/ambient.d.ts → ambient.d.ts} +4 -4
- package/dist/ambient.js +22 -0
- package/dist/{types/src/appearance → appearance}/platform.d.ts +3 -3
- package/dist/appearance/platform.js +43 -0
- package/dist/appearance/theme.d.ts +71 -0
- package/dist/appearance/theme.js +236 -0
- package/dist/appearance.d.ts +3 -0
- package/dist/appearance.js +3 -0
- package/dist/{types/src/components/aspect-ratio/aspect-ratio.d.ts → aspect-ratio.d.ts} +4 -4
- package/dist/aspect-ratio.js +17 -0
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.js +43 -0
- package/dist/badge.d.ts +8 -0
- package/dist/badge.js +21 -0
- package/dist/breadcrumb.d.ts +13 -0
- package/dist/breadcrumb.js +63 -0
- package/dist/button-group.d.ts +5 -0
- package/dist/button-group.js +14 -0
- package/dist/button.d.ts +21 -0
- package/dist/button.js +58 -0
- package/dist/calendar.d.ts +35 -0
- package/dist/calendar.js +225 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.js +54 -0
- package/dist/chart.d.ts +30 -0
- package/dist/chart.js +226 -0
- package/dist/checkbox.d.ts +13 -0
- package/dist/checkbox.js +53 -0
- package/dist/{types/src/lib/clipboard.d.ts → clipboard.d.ts} +1 -1
- package/dist/clipboard.js +16 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +10 -0
- package/dist/code-block.d.ts +34 -0
- package/dist/code-block.js +87 -0
- package/dist/collapsible.d.ts +13 -0
- package/dist/collapsible.js +49 -0
- package/dist/combobox.d.ts +25 -0
- package/dist/combobox.js +112 -0
- package/dist/command.d.ts +22 -0
- package/dist/command.js +129 -0
- package/dist/components/toast/toast-store.d.ts +60 -0
- package/dist/components/toast/toast-store.js +96 -0
- package/dist/{types/src/components → components}/toast/toaster.d.ts +4 -4
- package/dist/components/toast/toaster.js +345 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +2 -0
- package/dist/conversation.d.ts +48 -0
- package/dist/conversation.js +202 -0
- package/dist/date-time-picker.d.ts +50 -0
- package/dist/date-time-picker.js +235 -0
- package/dist/date.d.ts +50 -0
- package/dist/date.js +77 -0
- package/dist/dialog.d.ts +21 -0
- package/dist/dialog.js +113 -0
- package/dist/drawer.d.ts +30 -0
- package/dist/drawer.js +140 -0
- package/dist/dropdown-menu.d.ts +56 -0
- package/dist/dropdown-menu.js +295 -0
- package/dist/empty.d.ts +11 -0
- package/dist/empty.js +51 -0
- package/dist/field.d.ts +16 -0
- package/dist/field.js +47 -0
- package/{src/hooks/scroll/minimize-decision.ts → dist/hooks/scroll/minimize-decision.js} +3 -5
- package/dist/{types/src/hooks → hooks}/use-anchored-placement.d.ts +2 -2
- package/dist/hooks/use-anchored-placement.js +33 -0
- package/dist/{types/src/hooks → hooks}/use-minimize-on-scroll.d.ts +1 -1
- package/dist/hooks/use-minimize-on-scroll.js +59 -0
- package/dist/{types/src/hooks → hooks}/use-visual-viewport.d.ts +2 -2
- package/{src/hooks/use-visual-viewport.ts → dist/hooks/use-visual-viewport.js} +20 -35
- package/dist/hooks/viewport/types.d.ts +7 -0
- package/dist/hooks/viewport/viewport-metrics.js +13 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +80 -0
- package/dist/input-group.d.ts +17 -0
- package/dist/input-group.js +55 -0
- package/dist/input-otp.d.ts +13 -0
- package/dist/input-otp.js +36 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.js +14 -0
- package/dist/item.d.ts +49 -0
- package/dist/item.js +142 -0
- package/dist/kbd.d.ts +4 -0
- package/dist/kbd.js +86 -0
- package/dist/label.d.ts +3 -0
- package/dist/label.js +12 -0
- package/dist/labeled-content.d.ts +24 -0
- package/dist/labeled-content.js +41 -0
- package/dist/{types/src/lib/language.d.ts → language.d.ts} +1 -1
- package/dist/language.js +11 -0
- package/dist/layout.d.ts +24 -0
- package/dist/layout.js +36 -0
- package/dist/{types/src/lib → lib}/anchored-placement.d.ts +27 -27
- package/dist/lib/anchored-placement.js +42 -0
- package/dist/lib/calendar-month.js +90 -0
- package/dist/lib/cx.js +6 -0
- package/dist/lib/drawer.math.js +29 -0
- package/dist/lib/floating-layers.d.ts +3 -0
- package/dist/lib/floating-layers.js +25 -0
- package/dist/{types/src/lib → lib}/haptics.d.ts +1 -1
- package/dist/lib/haptics.js +13 -0
- package/dist/lib/liquid-step.js +33 -0
- package/dist/lib/page-scale.js +58 -0
- package/dist/lib/portal.js +12 -0
- package/dist/lib/presence.js +53 -0
- package/dist/lib/range-value.js +25 -0
- package/dist/lib/render.d.ts +8 -0
- package/dist/lib/render.js +42 -0
- package/dist/lib/rolling-digit.js +83 -0
- package/dist/{types/src/lib → lib}/screen-edges.d.ts +5 -5
- package/dist/lib/screen-edges.js +30 -0
- package/dist/lib/swipe-touch-action.js +34 -0
- package/dist/lib/visual-viewport.js +27 -0
- package/dist/lib/water-drop.js +412 -0
- package/dist/lib/wheel.js +125 -0
- package/dist/list.d.ts +26 -0
- package/dist/list.js +80 -0
- package/dist/locales.d.ts +18 -0
- package/dist/locales.js +36 -0
- package/dist/marker.d.ts +13 -0
- package/dist/marker.js +33 -0
- package/dist/motion/transitions.d.ts +170 -0
- package/dist/motion/transitions.js +156 -0
- package/dist/pagination.d.ts +30 -0
- package/dist/pagination.js +117 -0
- package/dist/popover.d.ts +26 -0
- package/dist/popover.js +101 -0
- package/dist/progress.d.ts +9 -0
- package/dist/progress.js +24 -0
- package/dist/questionnaire.d.ts +46 -0
- package/dist/questionnaire.js +133 -0
- package/dist/radio-group.d.ts +21 -0
- package/dist/radio-group.js +67 -0
- package/dist/search-field.d.ts +18 -0
- package/dist/search-field.js +45 -0
- package/dist/segmented-control.d.ts +16 -0
- package/dist/segmented-control.js +25 -0
- package/dist/select.d.ts +24 -0
- package/dist/select.js +107 -0
- package/dist/separator.d.ts +9 -0
- package/dist/separator.js +17 -0
- package/dist/{types/src/lib/shapes.d.ts → shapes.d.ts} +2 -2
- package/dist/shapes.js +65 -0
- package/dist/sheet.d.ts +24 -0
- package/dist/sheet.js +141 -0
- package/dist/sidebar.d.ts +32 -0
- package/dist/sidebar.js +85 -0
- package/dist/skeleton.d.ts +3 -0
- package/dist/skeleton.js +13 -0
- package/dist/slider.d.ts +9 -0
- package/dist/slider.js +42 -0
- package/dist/slosh-slider.d.ts +21 -0
- package/dist/slosh-slider.js +205 -0
- package/dist/spinner.d.ts +3 -0
- package/dist/spinner.js +20 -0
- package/dist/stat-tile.d.ts +20 -0
- package/dist/stat-tile.js +53 -0
- package/dist/stepper.d.ts +22 -0
- package/dist/stepper.js +98 -0
- package/dist/swatch-picker.d.ts +22 -0
- package/dist/swatch-picker.js +70 -0
- package/dist/switch.d.ts +10 -0
- package/dist/switch.js +44 -0
- package/dist/tab-bar.d.ts +15 -0
- package/dist/tab-bar.js +34 -0
- package/dist/{types/src/components/table/table.d.ts → table.d.ts} +3 -3
- package/dist/table.js +93 -0
- package/dist/tabs.d.ts +32 -0
- package/dist/tabs.js +131 -0
- package/dist/text.d.ts +25 -0
- package/dist/text.js +44 -0
- package/dist/textarea.d.ts +3 -0
- package/dist/textarea.js +13 -0
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +3 -0
- package/dist/toggle-group.d.ts +20 -0
- package/dist/toggle-group.js +68 -0
- package/dist/toggle.d.ts +24 -0
- package/dist/toggle.js +37 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tooltip.d.ts +21 -0
- package/dist/tooltip.js +61 -0
- package/dist/trace.d.ts +14 -0
- package/dist/trace.js +54 -0
- package/dist/{types/src/hooks/use-dismiss.d.ts → use-dismiss.d.ts} +3 -3
- package/dist/use-dismiss.js +38 -0
- package/dist/{types/src/hooks/use-media-query.d.ts → use-media-query.d.ts} +12 -12
- package/dist/use-media-query.js +56 -0
- package/dist/use-os.d.ts +12 -0
- package/dist/use-os.js +17 -0
- package/dist/wake-slider.d.ts +15 -0
- package/dist/wake-slider.js +174 -0
- package/package.json +122 -253
- package/src/styles/code-block.css +4 -0
- package/src/styles/globals.css +5 -0
- package/src/styles/motion-controls.css +10 -0
- package/src/styles/page-scale.css +27 -0
- package/src/styles/styles.css +4 -2
- package/dist/types/src/appearance/index.d.ts +0 -2
- package/dist/types/src/appearance/theme.d.ts +0 -71
- package/dist/types/src/components/accordion/accordion.d.ts +0 -23
- package/dist/types/src/components/ambient/index.d.ts +0 -1
- package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +0 -19
- package/dist/types/src/components/button/button-styles.d.ts +0 -12
- package/dist/types/src/components/button/button.d.ts +0 -32
- package/dist/types/src/components/button/icon-button.d.ts +0 -10
- package/dist/types/src/components/button/pending-spinner.d.ts +0 -5
- package/dist/types/src/components/button/use-pending-indicator.d.ts +0 -2
- package/dist/types/src/components/chip/chip.d.ts +0 -10
- package/dist/types/src/components/code-block/code-block.d.ts +0 -13
- package/dist/types/src/components/combo-box/combo-box.d.ts +0 -9
- package/dist/types/src/components/command/command.d.ts +0 -18
- package/dist/types/src/components/compact-date-picker/calendar-month.d.ts +0 -25
- package/dist/types/src/components/compact-date-picker/compact-date-picker.d.ts +0 -30
- package/dist/types/src/components/compact-time-picker/compact-time-picker.d.ts +0 -29
- package/dist/types/src/components/compact-time-picker/time-value.d.ts +0 -18
- package/dist/types/src/components/content-unavailable-view/content-unavailable-view.d.ts +0 -12
- package/dist/types/src/components/content-view/content-view.d.ts +0 -51
- package/dist/types/src/components/content-view/index.d.ts +0 -1
- package/dist/types/src/components/context-menu/conceal-menu-source.d.ts +0 -2
- package/dist/types/src/components/context-menu/context-menu-host.d.ts +0 -2
- package/dist/types/src/components/context-menu/context-menu-store.d.ts +0 -62
- package/dist/types/src/components/context-menu/menu-navigation.d.ts +0 -6
- package/dist/types/src/components/context-menu/menu-position.d.ts +0 -21
- package/dist/types/src/components/context-menu/menu-reveal.d.ts +0 -26
- package/dist/types/src/components/context-menu/use-context-menu.d.ts +0 -14
- package/dist/types/src/components/conversation/conversation.d.ts +0 -48
- package/dist/types/src/components/conversation/index.d.ts +0 -1
- package/dist/types/src/components/date-picker/date-picker.d.ts +0 -19
- package/dist/types/src/components/date-picker/date-value.d.ts +0 -2
- package/dist/types/src/components/dialog/dialog-host.d.ts +0 -6
- package/dist/types/src/components/dialog/dialog-store.d.ts +0 -23
- package/dist/types/src/components/dialog/dialog.d.ts +0 -33
- package/dist/types/src/components/dialog/index.d.ts +0 -1
- package/dist/types/src/components/disclosure-group/disclosure-group.d.ts +0 -18
- package/dist/types/src/components/divider/divider.d.ts +0 -9
- package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +0 -15
- package/dist/types/src/components/keyboard-shortcut/keyboard-shortcut.d.ts +0 -8
- package/dist/types/src/components/labeled-content/labeled-content.d.ts +0 -22
- package/dist/types/src/components/locale-switcher/index.d.ts +0 -1
- package/dist/types/src/components/locale-switcher/locale-switcher.d.ts +0 -13
- package/dist/types/src/components/menu/menu.d.ts +0 -16
- package/dist/types/src/components/morph/index.d.ts +0 -2
- package/dist/types/src/components/morph/morph.d.ts +0 -32
- package/dist/types/src/components/morph/use-morph-disclosure.d.ts +0 -13
- package/dist/types/src/components/one-time-code/one-time-code.d.ts +0 -26
- package/dist/types/src/components/picker/picker-trigger.d.ts +0 -3
- package/dist/types/src/components/picker/picker.d.ts +0 -46
- package/dist/types/src/components/popover/anchored-surface.d.ts +0 -17
- package/dist/types/src/components/popover/index.d.ts +0 -41
- package/dist/types/src/components/popover/popover-content.d.ts +0 -32
- package/dist/types/src/components/popover/popover-fit.d.ts +0 -21
- package/dist/types/src/components/popover/popover-root.d.ts +0 -22
- package/dist/types/src/components/popover/popover-trigger.d.ts +0 -23
- package/dist/types/src/components/profile-image/profile-image.d.ts +0 -9
- package/dist/types/src/components/progress-view/progress-view.d.ts +0 -13
- package/dist/types/src/components/progress-view/use-liquid-progress.d.ts +0 -3
- package/dist/types/src/components/radio-group/radio-group.d.ts +0 -20
- package/dist/types/src/components/search-field/expanding-search-field.d.ts +0 -5
- package/dist/types/src/components/search-field/search-field.d.ts +0 -9
- package/dist/types/src/components/search-list/search-list.d.ts +0 -22
- package/dist/types/src/components/section/section.d.ts +0 -18
- package/dist/types/src/components/secure-field/secure-field.d.ts +0 -4
- package/dist/types/src/components/segmented-control/segmented-control.d.ts +0 -25
- package/dist/types/src/components/sheet/modal-environment.d.ts +0 -2
- package/dist/types/src/components/sheet/sheet-portal.d.ts +0 -5
- package/dist/types/src/components/sheet/sheet.d.ts +0 -26
- package/dist/types/src/components/sheet/use-sheet-focus.d.ts +0 -3
- package/dist/types/src/components/sidebar/sidebar.d.ts +0 -24
- package/dist/types/src/components/skeleton/skeleton.d.ts +0 -9
- package/dist/types/src/components/slider/slider.d.ts +0 -17
- package/dist/types/src/components/slosh-slider/liquid-step.d.ts +0 -6
- package/dist/types/src/components/slosh-slider/slosh-slider.d.ts +0 -21
- package/dist/types/src/components/stat-tile/index.d.ts +0 -1
- package/dist/types/src/components/stat-tile/stat-tile.d.ts +0 -20
- package/dist/types/src/components/status-indicator/status-indicator.d.ts +0 -17
- package/dist/types/src/components/stepper/rolling-digit.d.ts +0 -11
- package/dist/types/src/components/stepper/stepper.d.ts +0 -22
- package/dist/types/src/components/swatch-picker/swatch-picker.d.ts +0 -22
- package/dist/types/src/components/tab-bar/tab-bar.d.ts +0 -43
- package/dist/types/src/components/tab-view/tab-view.d.ts +0 -27
- package/dist/types/src/components/text-editor/text-editor.d.ts +0 -9
- package/dist/types/src/components/text-field/text-field.d.ts +0 -33
- package/dist/types/src/components/toast/toast-store.d.ts +0 -52
- package/dist/types/src/components/toggle/toggle.d.ts +0 -22
- package/dist/types/src/components/tooltip/tooltip-host.d.ts +0 -7
- package/dist/types/src/components/view-controller/index.d.ts +0 -1
- package/dist/types/src/components/view-controller/view-controller.d.ts +0 -21
- package/dist/types/src/components/wake-slider/wake-slider.d.ts +0 -15
- package/dist/types/src/hooks/scroll/minimize-decision.d.ts +0 -2
- package/dist/types/src/hooks/use-anchored-disclosure.d.ts +0 -9
- package/dist/types/src/hooks/use-floating-dismiss.d.ts +0 -3
- package/dist/types/src/hooks/viewport/types.d.ts +0 -19
- package/dist/types/src/hooks/viewport/viewport-metrics.d.ts +0 -3
- package/dist/types/src/icons/icons.d.ts +0 -616
- package/dist/types/src/index.d.ts +0 -73
- package/dist/types/src/lib/class-names.d.ts +0 -2
- package/dist/types/src/lib/date.d.ts +0 -50
- package/dist/types/src/lib/floating-layers.d.ts +0 -8
- package/dist/types/src/lib/range-value.d.ts +0 -4
- package/dist/types/src/machines/popover.machine.d.ts +0 -30
- package/dist/types/src/motion/transitions.d.ts +0 -170
- package/src/appearance/index.ts +0 -2
- package/src/appearance/platform.tsx +0 -102
- package/src/appearance/theme.tsx +0 -467
- package/src/components/accordion/accordion.tsx +0 -70
- package/src/components/ambient/ambient.tsx +0 -35
- package/src/components/ambient/index.ts +0 -1
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -27
- package/src/components/breadcrumb/breadcrumb.tsx +0 -73
- package/src/components/button/button-styles.ts +0 -49
- package/src/components/button/button.tsx +0 -107
- package/src/components/button/icon-button.tsx +0 -33
- package/src/components/button/pending-spinner.tsx +0 -14
- package/src/components/button/use-pending-indicator.ts +0 -22
- package/src/components/chip/chip.tsx +0 -45
- package/src/components/code-block/code-block.tsx +0 -48
- package/src/components/combo-box/combo-box.tsx +0 -13
- package/src/components/command/command.tsx +0 -149
- package/src/components/compact-date-picker/calendar-month.ts +0 -109
- package/src/components/compact-date-picker/compact-date-picker.tsx +0 -337
- package/src/components/compact-time-picker/compact-time-picker.tsx +0 -321
- package/src/components/compact-time-picker/time-value.ts +0 -58
- package/src/components/content-unavailable-view/content-unavailable-view.tsx +0 -78
- package/src/components/content-view/content-view.tsx +0 -215
- package/src/components/content-view/index.ts +0 -1
- package/src/components/context-menu/conceal-menu-source.ts +0 -30
- package/src/components/context-menu/context-menu-host.tsx +0 -459
- package/src/components/context-menu/context-menu-store.ts +0 -167
- package/src/components/context-menu/menu-navigation.ts +0 -36
- package/src/components/context-menu/menu-position.ts +0 -38
- package/src/components/context-menu/menu-reveal.ts +0 -42
- package/src/components/context-menu/use-context-menu.ts +0 -73
- package/src/components/conversation/conversation.tsx +0 -309
- package/src/components/conversation/index.ts +0 -1
- package/src/components/date-picker/date-picker.tsx +0 -106
- package/src/components/date-picker/date-value.ts +0 -22
- package/src/components/dialog/dialog-host.tsx +0 -119
- package/src/components/dialog/dialog-store.ts +0 -66
- package/src/components/dialog/dialog.tsx +0 -211
- package/src/components/dialog/index.ts +0 -1
- package/src/components/disclosure-group/disclosure-group.tsx +0 -108
- package/src/components/divider/divider.tsx +0 -33
- package/src/components/inline-disclosure/inline-disclosure.tsx +0 -53
- package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +0 -32
- package/src/components/labeled-content/labeled-content.tsx +0 -84
- package/src/components/locale-switcher/index.ts +0 -1
- package/src/components/locale-switcher/locale-switcher.tsx +0 -311
- package/src/components/menu/menu.tsx +0 -85
- package/src/components/morph/index.ts +0 -2
- package/src/components/morph/morph.tsx +0 -258
- package/src/components/morph/use-morph-disclosure.ts +0 -27
- package/src/components/one-time-code/one-time-code.tsx +0 -234
- package/src/components/picker/picker-trigger.ts +0 -22
- package/src/components/picker/picker.tsx +0 -404
- package/src/components/popover/anchored-surface.tsx +0 -264
- package/src/components/popover/index.ts +0 -50
- package/src/components/popover/popover-content.tsx +0 -334
- package/src/components/popover/popover-fit.ts +0 -74
- package/src/components/popover/popover-root.tsx +0 -97
- package/src/components/popover/popover-trigger.tsx +0 -71
- package/src/components/profile-image/profile-image.tsx +0 -96
- package/src/components/progress-view/progress-view.tsx +0 -72
- package/src/components/progress-view/use-liquid-progress.ts +0 -43
- package/src/components/radio-group/radio-group.tsx +0 -86
- package/src/components/search-field/expanding-search-field.tsx +0 -197
- package/src/components/search-field/search-field.tsx +0 -66
- package/src/components/search-list/search-list.tsx +0 -276
- package/src/components/section/section.tsx +0 -75
- package/src/components/secure-field/secure-field.tsx +0 -8
- package/src/components/segmented-control/segmented-control.tsx +0 -157
- package/src/components/sheet/modal-environment.ts +0 -82
- package/src/components/sheet/sheet-portal.tsx +0 -62
- package/src/components/sheet/sheet.tsx +0 -165
- package/src/components/sheet/use-sheet-focus.ts +0 -109
- package/src/components/sidebar/sidebar.tsx +0 -102
- package/src/components/skeleton/skeleton.tsx +0 -38
- package/src/components/slider/slider.tsx +0 -134
- package/src/components/slosh-slider/liquid-step.ts +0 -43
- package/src/components/slosh-slider/slosh-slider.tsx +0 -294
- package/src/components/stat-tile/index.ts +0 -1
- package/src/components/stat-tile/stat-tile.tsx +0 -90
- package/src/components/status-indicator/status-indicator.tsx +0 -54
- package/src/components/stepper/rolling-digit.tsx +0 -91
- package/src/components/stepper/stepper.tsx +0 -136
- package/src/components/swatch-picker/swatch-picker.tsx +0 -138
- package/src/components/tab-bar/tab-bar.tsx +0 -182
- package/src/components/tab-view/tab-view.tsx +0 -155
- package/src/components/table/table.tsx +0 -151
- package/src/components/text-editor/text-editor.tsx +0 -42
- package/src/components/text-field/text-field.tsx +0 -200
- package/src/components/toast/toast-store.ts +0 -164
- package/src/components/toast/toaster.tsx +0 -407
- package/src/components/toggle/toggle.tsx +0 -320
- package/src/components/tooltip/tooltip-host.tsx +0 -178
- package/src/components/view-controller/index.ts +0 -1
- package/src/components/view-controller/view-controller.tsx +0 -75
- package/src/components/wake-slider/wake-slider.tsx +0 -260
- package/src/hooks/use-anchored-disclosure.ts +0 -23
- package/src/hooks/use-anchored-placement.ts +0 -40
- package/src/hooks/use-dismiss.ts +0 -44
- package/src/hooks/use-floating-dismiss.ts +0 -30
- package/src/hooks/use-media-query.ts +0 -94
- package/src/hooks/use-minimize-on-scroll.ts +0 -77
- package/src/hooks/viewport/types.ts +0 -19
- package/src/hooks/viewport/viewport-metrics.ts +0 -19
- package/src/icons/icons.tsx +0 -458
- package/src/index.ts +0 -107
- package/src/lib/anchored-placement.ts +0 -91
- package/src/lib/class-names.ts +0 -21
- package/src/lib/clipboard.ts +0 -15
- package/src/lib/date.ts +0 -86
- package/src/lib/floating-layers.ts +0 -53
- package/src/lib/haptics.ts +0 -23
- package/src/lib/language.ts +0 -16
- package/src/lib/range-value.ts +0 -38
- package/src/lib/screen-edges.ts +0 -44
- package/src/lib/shapes.ts +0 -59
- package/src/machines/popover.machine.ts +0 -51
- package/src/motion/transitions.ts +0 -97
- package/src/tokens.ts +0 -1
- /package/dist/{types/src/tokens.d.ts → tokens.js} +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export type ButtonVariant =
|
|
2
|
-
| "default"
|
|
3
|
-
| "destructive"
|
|
4
|
-
| "outline"
|
|
5
|
-
| "secondary"
|
|
6
|
-
| "ghost"
|
|
7
|
-
| "link"
|
|
8
|
-
| "accent";
|
|
9
|
-
|
|
10
|
-
/** Icon-only buttons use the same sizing contract as Button. */
|
|
11
|
-
export const iconButtonSizes = {
|
|
12
|
-
icon: "size-11 p-0 rounded-full",
|
|
13
|
-
"icon-xs": "size-8 p-0 rounded-full",
|
|
14
|
-
"icon-sm": "size-9 p-0 rounded-full",
|
|
15
|
-
"icon-lg": "size-12 p-0 rounded-full",
|
|
16
|
-
} as const;
|
|
17
|
-
|
|
18
|
-
export type IconButtonSize = keyof typeof iconButtonSizes;
|
|
19
|
-
|
|
20
|
-
export type ButtonSize =
|
|
21
|
-
| "default"
|
|
22
|
-
| "xs"
|
|
23
|
-
| "sm"
|
|
24
|
-
| "lg"
|
|
25
|
-
| "icon-full"
|
|
26
|
-
| IconButtonSize;
|
|
27
|
-
|
|
28
|
-
export const buttonVariants: Record<ButtonVariant, string> = {
|
|
29
|
-
default:
|
|
30
|
-
"bg-inverse text-on-inverse shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.18),0_6px_16px_-6px_rgb(0_0_0/0.35)] hover:brightness-[1.12]",
|
|
31
|
-
destructive:
|
|
32
|
-
"bg-danger text-background shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.18),0_6px_16px_-6px_rgb(0_0_0/0.35)] hover:brightness-[1.08]",
|
|
33
|
-
outline: "border border-separator bg-transparent text-label hover:bg-fill/60",
|
|
34
|
-
secondary:
|
|
35
|
-
"bg-elevated text-label shadow-[inset_0_0_0_0.5px_color-mix(in_srgb,var(--color-separator)_55%,transparent),0_1px_2px_rgb(40_30_0/0.06)] hover:bg-fill/60",
|
|
36
|
-
ghost: "bg-transparent text-label hover:bg-fill/80",
|
|
37
|
-
link: "bg-transparent text-accent-text underline-offset-4 hover:underline",
|
|
38
|
-
accent:
|
|
39
|
-
"bg-accent text-on-accent ring-1 ring-accent-text/25 shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_1px_2px_rgb(60_40_0/0.16),0_6px_16px_-6px_color-mix(in_srgb,var(--color-accent)_70%,transparent)] hover:brightness-[1.04]",
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const buttonSizes: Record<ButtonSize, string> = {
|
|
43
|
-
default: "h-11 px-5 text-subheadline rounded-full",
|
|
44
|
-
xs: "h-8 px-3 text-caption rounded-full",
|
|
45
|
-
sm: "h-9 px-4 text-subheadline rounded-full",
|
|
46
|
-
lg: "h-12 px-6 text-body rounded-full",
|
|
47
|
-
...iconButtonSizes,
|
|
48
|
-
"icon-full": "h-11 w-full px-5 text-subheadline rounded-full",
|
|
49
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, forwardRef } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
import { PendingSpinner } from "./pending-spinner";
|
|
4
|
-
import { usePendingIndicator } from "./use-pending-indicator";
|
|
5
|
-
import {
|
|
6
|
-
buttonSizes,
|
|
7
|
-
buttonVariants,
|
|
8
|
-
type ButtonSize,
|
|
9
|
-
type ButtonVariant,
|
|
10
|
-
} from "./button-styles";
|
|
11
|
-
|
|
12
|
-
export type { ButtonSize, ButtonVariant };
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Each variant has a little depth: a fine highlight along the top edge and
|
|
16
|
-
* a soft, layered shadow, like a well-made physical key.
|
|
17
|
-
*/
|
|
18
|
-
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
|
-
/**
|
|
20
|
-
* Visual emphasis: `default` (solid), `accent` (main action),
|
|
21
|
-
* `secondary` (quiet fill), `outline`, `ghost`, `link`, or `destructive`.
|
|
22
|
-
* @default "default"
|
|
23
|
-
*/
|
|
24
|
-
variant?: ButtonVariant;
|
|
25
|
-
/**
|
|
26
|
-
* Label sizes: `xs`, `sm`, `default`, `lg`.
|
|
27
|
-
* Icon sizes: `icon-xs`, `icon-sm`, `icon`, `icon-lg`, `icon-full`.
|
|
28
|
-
* Prefer IconButton for an icon with a built-in accessible label.
|
|
29
|
-
* @default "default"
|
|
30
|
-
*/
|
|
31
|
-
size?: ButtonSize;
|
|
32
|
-
/** Shows a delayed spinner, keeps the button's width, and prevents repeat presses.
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
isPending?: boolean;
|
|
36
|
-
/** Layout classes for the content wrapper, such as a full-width disclosure row. */
|
|
37
|
-
contentClassName?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Shares native button appearance with semantic links without nesting a button. */
|
|
41
|
-
export function buttonStyle({
|
|
42
|
-
variant = "default",
|
|
43
|
-
size = "default",
|
|
44
|
-
className,
|
|
45
|
-
}: Pick<ButtonProps, "variant" | "size" | "className"> = {}) {
|
|
46
|
-
return cn(
|
|
47
|
-
"group relative inline-flex shrink-0 items-center justify-center gap-2 overflow-hidden font-semibold tracking-[-0.005em] whitespace-nowrap select-none",
|
|
48
|
-
"transition-[background-color,filter,transform,box-shadow] duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] active:scale-[0.98]",
|
|
49
|
-
"disabled:pointer-events-none disabled:opacity-40 motion-reduce:transform-none motion-reduce:transition-none",
|
|
50
|
-
"focus-visible:ring-accent/70 focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none",
|
|
51
|
-
buttonSizes[size],
|
|
52
|
-
buttonVariants[variant],
|
|
53
|
-
className,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** A native button with Passui styling, pending feedback, and an HTMLButtonElement ref. */
|
|
58
|
-
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
59
|
-
function Button(
|
|
60
|
-
{
|
|
61
|
-
variant = "default",
|
|
62
|
-
size = "default",
|
|
63
|
-
isPending = false,
|
|
64
|
-
contentClassName,
|
|
65
|
-
disabled,
|
|
66
|
-
children,
|
|
67
|
-
className,
|
|
68
|
-
type = "button",
|
|
69
|
-
...props
|
|
70
|
-
},
|
|
71
|
-
ref,
|
|
72
|
-
) {
|
|
73
|
-
const showPendingIndicator = usePendingIndicator(isPending);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<button
|
|
77
|
-
ref={ref}
|
|
78
|
-
type={type}
|
|
79
|
-
className={buttonStyle({
|
|
80
|
-
variant,
|
|
81
|
-
size,
|
|
82
|
-
// pending is busy, not unavailable: keep full colour
|
|
83
|
-
className: cn(
|
|
84
|
-
"data-pending:cursor-progress data-pending:disabled:opacity-100",
|
|
85
|
-
className,
|
|
86
|
-
),
|
|
87
|
-
})}
|
|
88
|
-
{...props}
|
|
89
|
-
data-pending={isPending || undefined}
|
|
90
|
-
disabled={disabled || isPending}
|
|
91
|
-
aria-busy={isPending || props["aria-busy"]}
|
|
92
|
-
>
|
|
93
|
-
{/* the label keeps its space, so the width never jumps */}
|
|
94
|
-
<span
|
|
95
|
-
className={cn(
|
|
96
|
-
"inline-flex min-w-0 items-center justify-center gap-2 truncate transition-opacity duration-200",
|
|
97
|
-
showPendingIndicator && "opacity-0",
|
|
98
|
-
contentClassName,
|
|
99
|
-
)}
|
|
100
|
-
>
|
|
101
|
-
{children}
|
|
102
|
-
</span>
|
|
103
|
-
{showPendingIndicator && <PendingSpinner />}
|
|
104
|
-
</button>
|
|
105
|
-
);
|
|
106
|
-
},
|
|
107
|
-
);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
import { Button, type ButtonProps } from "./button";
|
|
4
|
-
import type { ButtonVariant, IconButtonSize } from "./button-styles";
|
|
5
|
-
|
|
6
|
-
export type { ButtonVariant, IconButtonSize };
|
|
7
|
-
|
|
8
|
-
export interface IconButtonProps extends Omit<ButtonProps, "size"> {
|
|
9
|
-
/** Icon-only actions must have an accessible name. */
|
|
10
|
-
label: string;
|
|
11
|
-
size?: IconButtonSize;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** An accessible icon-only presentation of Button, sharing its interaction behavior. */
|
|
15
|
-
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
16
|
-
function IconButton(
|
|
17
|
-
{ label, size = "icon", className, children, ...props },
|
|
18
|
-
ref,
|
|
19
|
-
) {
|
|
20
|
-
return (
|
|
21
|
-
<Button
|
|
22
|
-
ref={ref}
|
|
23
|
-
size={size}
|
|
24
|
-
aria-label={label}
|
|
25
|
-
data-tooltip={label}
|
|
26
|
-
className={cn("active:scale-[0.92]", className)}
|
|
27
|
-
{...props}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</Button>
|
|
31
|
-
);
|
|
32
|
-
},
|
|
33
|
-
);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centred over the button while it is pending: fades in, spins, and is
|
|
3
|
-
* sized from the text so it suits every button size.
|
|
4
|
-
*/
|
|
5
|
-
export function PendingSpinner() {
|
|
6
|
-
return (
|
|
7
|
-
<span
|
|
8
|
-
aria-hidden="true"
|
|
9
|
-
className="animate-in fade-in zoom-in-75 absolute inset-0 flex items-center justify-center duration-200 motion-reduce:animate-none"
|
|
10
|
-
>
|
|
11
|
-
<span className="size-[1.1em] animate-spin rounded-full border-2 border-current/25 border-t-current motion-reduce:animate-none" />
|
|
12
|
-
</span>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
const PENDING_INDICATOR_DELAY = 300;
|
|
4
|
-
|
|
5
|
-
export function schedulePendingIndicator(onShow: () => void) {
|
|
6
|
-
const timeout = setTimeout(onShow, PENDING_INDICATOR_DELAY);
|
|
7
|
-
return () => clearTimeout(timeout);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function usePendingIndicator(isPending: boolean) {
|
|
11
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setIsVisible(false);
|
|
15
|
-
|
|
16
|
-
if (!isPending) return;
|
|
17
|
-
|
|
18
|
-
return schedulePendingIndicator(() => setIsVisible(true));
|
|
19
|
-
}, [isPending]);
|
|
20
|
-
|
|
21
|
-
return isPending && isVisible;
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
|
|
4
|
-
export type ChipTone = "neutral" | "accent" | "public" | "family" | "friends";
|
|
5
|
-
export type ChipSize = "xs" | "sm" | "md";
|
|
6
|
-
|
|
7
|
-
const tones: Record<ChipTone, string> = {
|
|
8
|
-
neutral: "bg-fill text-label-secondary",
|
|
9
|
-
accent: "bg-elevated text-accent-text",
|
|
10
|
-
public: "bg-[#e8efff] text-[#2c55b8] dark:bg-[#1c2740] dark:text-[#a9c1ff]",
|
|
11
|
-
family: "bg-[#e3f3eb] text-[#24704f] dark:bg-[#15302a] dark:text-[#8fd6b6]",
|
|
12
|
-
friends: "bg-[#ede8ff] text-[#5a3fc0] dark:bg-[#26203f] dark:text-[#c3b5ff]",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const sizes: Record<ChipSize, string> = {
|
|
16
|
-
xs: "px-1 py-0 text-caption2",
|
|
17
|
-
sm: "px-1.5 py-0.5 text-caption2",
|
|
18
|
-
md: "px-2 py-0.5 text-caption",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
22
|
-
/** `neutral`, `accent`, `public`, `family`, or `friends`. @default "neutral" */
|
|
23
|
-
tone?: ChipTone;
|
|
24
|
-
/** `xs`, `sm`, or `md`. @default "sm" */
|
|
25
|
-
size?: ChipSize;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function Chip({
|
|
29
|
-
tone = "neutral",
|
|
30
|
-
size = "sm",
|
|
31
|
-
className,
|
|
32
|
-
...props
|
|
33
|
-
}: ChipProps) {
|
|
34
|
-
return (
|
|
35
|
-
<span
|
|
36
|
-
className={cn(
|
|
37
|
-
"inline-flex items-center gap-1 rounded-full font-semibold",
|
|
38
|
-
tones[tone],
|
|
39
|
-
sizes[size],
|
|
40
|
-
className,
|
|
41
|
-
)}
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Fragment, type ComponentProps, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
|
|
4
|
-
export type CodeBlockSize = "sm" | "md" | "lg";
|
|
5
|
-
|
|
6
|
-
export interface CodeBlockProps
|
|
7
|
-
extends Omit<ComponentProps<"div">, "children" | "size"> {
|
|
8
|
-
code: string;
|
|
9
|
-
/** Supply a highlighter's rendered pre/code element; source remains the fallback. */
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
/** Show a nonselectable line gutter. @default true */
|
|
12
|
-
lineNumbers?: boolean;
|
|
13
|
-
/** Code font size, padding and line gutter scale. @default "md" */
|
|
14
|
-
size?: CodeBlockSize;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Code presentation without shipping a highlighter or formatter to consumers. */
|
|
18
|
-
export function CodeBlock({
|
|
19
|
-
code,
|
|
20
|
-
children,
|
|
21
|
-
lineNumbers = true,
|
|
22
|
-
size = "md",
|
|
23
|
-
className,
|
|
24
|
-
...props
|
|
25
|
-
}: CodeBlockProps) {
|
|
26
|
-
const lines = code.split("\n");
|
|
27
|
-
return (
|
|
28
|
-
<div
|
|
29
|
-
{...props}
|
|
30
|
-
className={cn("passui-code-block", className)}
|
|
31
|
-
data-line-numbers={lineNumbers || undefined}
|
|
32
|
-
data-size={size}
|
|
33
|
-
>
|
|
34
|
-
{children ?? (
|
|
35
|
-
<pre>
|
|
36
|
-
<code>
|
|
37
|
-
{lines.map((line, index) => (
|
|
38
|
-
<Fragment key={line || index}>
|
|
39
|
-
<span className="line">{line || " "}</span>
|
|
40
|
-
{index < lines.length - 1 ? "\n" : null}
|
|
41
|
-
</Fragment>
|
|
42
|
-
))}
|
|
43
|
-
</code>
|
|
44
|
-
</pre>
|
|
45
|
-
)}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
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({
|
|
33
|
-
children,
|
|
34
|
-
className,
|
|
35
|
-
...props
|
|
36
|
-
}: CommandDialogProps) {
|
|
37
|
-
return (
|
|
38
|
-
<Sheet
|
|
39
|
-
{...props}
|
|
40
|
-
placement="center"
|
|
41
|
-
className={cn("max-w-lg rounded-3xl outline-none", className)}
|
|
42
|
-
>
|
|
43
|
-
<SearchList className="not-typeset flex min-h-0 flex-col">
|
|
44
|
-
{children}
|
|
45
|
-
</SearchList>
|
|
46
|
-
</Sheet>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function CommandInput({
|
|
51
|
-
className,
|
|
52
|
-
autoFocus,
|
|
53
|
-
ref: forwardedRef,
|
|
54
|
-
...props
|
|
55
|
-
}: ComponentProps<typeof SearchListField>) {
|
|
56
|
-
const input = useRef<HTMLInputElement>(null);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (autoFocus) input.current?.focus({ preventScroll: true });
|
|
59
|
-
}, [autoFocus]);
|
|
60
|
-
return (
|
|
61
|
-
<div className="border-separator/50 flex shrink-0 items-center gap-2 border-b px-4">
|
|
62
|
-
<SearchIcon size={17} className="text-label-tertiary shrink-0" />
|
|
63
|
-
<SearchListField
|
|
64
|
-
{...props}
|
|
65
|
-
ref={(node) => {
|
|
66
|
-
input.current = node;
|
|
67
|
-
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
68
|
-
else if (forwardedRef) forwardedRef.current = node;
|
|
69
|
-
}}
|
|
70
|
-
className={cn(
|
|
71
|
-
"min-h-12 rounded-none border-0 bg-transparent px-0 focus-visible:ring-0",
|
|
72
|
-
className,
|
|
73
|
-
)}
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function CommandList({
|
|
80
|
-
className,
|
|
81
|
-
...props
|
|
82
|
-
}: ComponentProps<typeof SearchListResults>) {
|
|
83
|
-
return (
|
|
84
|
-
<SearchListResults
|
|
85
|
-
{...props}
|
|
86
|
-
className={cn("max-h-[min(60svh,24rem)] p-1.5", className)}
|
|
87
|
-
/>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function CommandEmpty({
|
|
92
|
-
className,
|
|
93
|
-
...props
|
|
94
|
-
}: ComponentProps<typeof SearchListEmpty>) {
|
|
95
|
-
return (
|
|
96
|
-
<SearchListEmpty
|
|
97
|
-
{...props}
|
|
98
|
-
className={cn(
|
|
99
|
-
"text-footnote text-label-secondary px-3 py-8 text-center",
|
|
100
|
-
className,
|
|
101
|
-
)}
|
|
102
|
-
/>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function CommandShortcut({
|
|
107
|
-
className,
|
|
108
|
-
...props
|
|
109
|
-
}: ComponentProps<typeof KeyboardShortcut>) {
|
|
110
|
-
return (
|
|
111
|
-
<KeyboardShortcut
|
|
112
|
-
{...props}
|
|
113
|
-
className={cn(
|
|
114
|
-
"text-label-tertiary ms-auto border-0 bg-transparent",
|
|
115
|
-
className,
|
|
116
|
-
)}
|
|
117
|
-
/>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function CommandGroup({
|
|
122
|
-
className,
|
|
123
|
-
...props
|
|
124
|
-
}: ComponentProps<typeof SearchListGroup>) {
|
|
125
|
-
return (
|
|
126
|
-
<SearchListGroup
|
|
127
|
-
{...props}
|
|
128
|
-
className={cn(
|
|
129
|
-
"border-separator/50 not-first:mt-1 not-first:border-t not-first:pt-1",
|
|
130
|
-
className,
|
|
131
|
-
)}
|
|
132
|
-
/>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function CommandItem({
|
|
137
|
-
className,
|
|
138
|
-
...props
|
|
139
|
-
}: ComponentProps<typeof SearchListItem>) {
|
|
140
|
-
return (
|
|
141
|
-
<SearchListItem
|
|
142
|
-
{...props}
|
|
143
|
-
className={cn(
|
|
144
|
-
"[&>svg]:text-label-secondary [&>svg]:size-4 [&>svg]:shrink-0",
|
|
145
|
-
className,
|
|
146
|
-
)}
|
|
147
|
-
/>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/** A calendar day, with `month` counted from 1. */
|
|
2
|
-
export interface CalendarDay {
|
|
3
|
-
year: number;
|
|
4
|
-
month: number;
|
|
5
|
-
day: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** Reads `YYYY-MM-DD`; null for anything else, or a date that doesn't exist. */
|
|
9
|
-
export function parseDay(value: string): CalendarDay | null {
|
|
10
|
-
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
11
|
-
if (!match) return null;
|
|
12
|
-
const [year, month, day] = [
|
|
13
|
-
Number(match[1]),
|
|
14
|
-
Number(match[2]),
|
|
15
|
-
Number(match[3]),
|
|
16
|
-
];
|
|
17
|
-
const date = new Date(Date.UTC(year, month - 1, day));
|
|
18
|
-
const real =
|
|
19
|
-
date.getUTCFullYear() === year &&
|
|
20
|
-
date.getUTCMonth() === month - 1 &&
|
|
21
|
-
date.getUTCDate() === day;
|
|
22
|
-
return real ? { year, month, day } : null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function formatDay({ year, month, day }: CalendarDay): string {
|
|
26
|
-
const pad = (value: number, width: number) =>
|
|
27
|
-
String(value).padStart(width, "0");
|
|
28
|
-
return `${pad(year, 4)}-${pad(month, 2)}-${pad(day, 2)}`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Moves by whole days, across months and years. */
|
|
32
|
-
export function addDays(day: CalendarDay, count: number): CalendarDay {
|
|
33
|
-
const date = new Date(Date.UTC(day.year, day.month - 1, day.day + count));
|
|
34
|
-
return {
|
|
35
|
-
year: date.getUTCFullYear(),
|
|
36
|
-
month: date.getUTCMonth() + 1,
|
|
37
|
-
day: date.getUTCDate(),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Moves by months, keeping the day where the month allows (31 Jan + 1 is 28 or 29 Feb). */
|
|
42
|
-
export function addMonths(day: CalendarDay, count: number): CalendarDay {
|
|
43
|
-
const first = new Date(Date.UTC(day.year, day.month - 1 + count, 1));
|
|
44
|
-
const year = first.getUTCFullYear();
|
|
45
|
-
const month = first.getUTCMonth() + 1;
|
|
46
|
-
const last = new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
47
|
-
return { year, month, day: Math.min(day.day, last) };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The first day of the week where `locale` is used, 1 (Monday) to 7
|
|
52
|
-
* (Sunday), from the browser where it knows, else Monday except in the
|
|
53
|
-
* places that start on Sunday.
|
|
54
|
-
*/
|
|
55
|
-
export function firstWeekday(locale: string): number {
|
|
56
|
-
try {
|
|
57
|
-
const info = new Intl.Locale(locale) as Intl.Locale & {
|
|
58
|
-
getWeekInfo?: () => { firstDay: number };
|
|
59
|
-
weekInfo?: { firstDay: number };
|
|
60
|
-
};
|
|
61
|
-
const first = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;
|
|
62
|
-
if (first) return first;
|
|
63
|
-
const region = info.maximize().region ?? "";
|
|
64
|
-
return [
|
|
65
|
-
"US",
|
|
66
|
-
"CA",
|
|
67
|
-
"JP",
|
|
68
|
-
"KR",
|
|
69
|
-
"TW",
|
|
70
|
-
"BR",
|
|
71
|
-
"MX",
|
|
72
|
-
"IL",
|
|
73
|
-
"PH",
|
|
74
|
-
"IN",
|
|
75
|
-
].includes(region)
|
|
76
|
-
? 7
|
|
77
|
-
: 1;
|
|
78
|
-
} catch {
|
|
79
|
-
return 1;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** Six weeks covering `year`/`month`, starting on `firstDay` (1 to 7). */
|
|
84
|
-
export function monthGrid(
|
|
85
|
-
year: number,
|
|
86
|
-
month: number,
|
|
87
|
-
firstDay: number,
|
|
88
|
-
): Array<CalendarDay & { inMonth: boolean }> {
|
|
89
|
-
// getUTCDay counts Sunday as 0; weeks here count it as 7.
|
|
90
|
-
const weekday = new Date(Date.UTC(year, month - 1, 1)).getUTCDay() || 7;
|
|
91
|
-
const lead = (weekday - firstDay + 7) % 7;
|
|
92
|
-
const start = addDays({ year, month, day: 1 }, -lead);
|
|
93
|
-
return Array.from({ length: 42 }, (_, index) => {
|
|
94
|
-
const day = addDays(start, index);
|
|
95
|
-
return {
|
|
96
|
-
...day,
|
|
97
|
-
inMonth: day.month === month && day.year === year,
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** Whether `value` (`YYYY-MM-DD`) lies within the optional bounds. */
|
|
103
|
-
export function withinBounds(
|
|
104
|
-
value: string,
|
|
105
|
-
min?: string,
|
|
106
|
-
max?: string,
|
|
107
|
-
): boolean {
|
|
108
|
-
return (!min || value >= min) && (!max || value <= max);
|
|
109
|
-
}
|