@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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { RenderProp } from "./lib/render.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import * as menu from "@zag-js/menu";
|
|
4
|
+
type Placement = NonNullable<menu.Props["positioning"]>["placement"];
|
|
5
|
+
export interface DropdownMenuProps extends Omit<menu.Props, "id" | "ids" | "positioning"> {
|
|
6
|
+
/** Where the menu sits against its trigger. Defaults to `bottom-start`. */
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** Owns the open state, highlight and typeahead. Renders no element of its own. */
|
|
11
|
+
export declare function DropdownMenu({ children, placement, ...props }: DropdownMenuProps): import("react").JSX.Element;
|
|
12
|
+
/** A menu that opens at the pointer on right click or long press, instead of on a trigger. */
|
|
13
|
+
export declare function ContextMenu({ children, placement, ...props }: DropdownMenuProps): import("react").JSX.Element;
|
|
14
|
+
/** The region that answers to a right click or long press. Renders a `div` by default. */
|
|
15
|
+
export declare function ContextMenuTrigger({ render, ...props }: PartProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
16
|
+
/** A nested menu. Put a `DropdownMenuSubTrigger` and `DropdownMenuSubContent` inside. */
|
|
17
|
+
export declare function DropdownMenuSub({ children, placement, ...props }: DropdownMenuProps): import("react").JSX.Element;
|
|
18
|
+
type PartProps<T extends "button" | "div"> = ComponentProps<T> & {
|
|
19
|
+
/** Render your own element instead of the default one. */
|
|
20
|
+
render?: RenderProp;
|
|
21
|
+
};
|
|
22
|
+
export declare function DropdownMenuTrigger({ render, ...props }: PartProps<"button">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
23
|
+
/** The floating list. Mounts only while open or leaving. */
|
|
24
|
+
export declare function DropdownMenuContent(props: PartProps<"div">): import("react").JSX.Element;
|
|
25
|
+
export declare function DropdownMenuSubContent(props: PartProps<"div">): import("react").JSX.Element;
|
|
26
|
+
export interface DropdownMenuItemProps extends Omit<ComponentProps<"div">, "onSelect"> {
|
|
27
|
+
/** Identifies the item for typeahead and `onSelect` on the menu. Defaults to a generated id. */
|
|
28
|
+
value?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** Set false to keep the menu open after this item is chosen. */
|
|
31
|
+
closeOnSelect?: boolean;
|
|
32
|
+
/** Runs when the item is chosen by pointer or keyboard. */
|
|
33
|
+
onSelect?: () => void;
|
|
34
|
+
render?: RenderProp;
|
|
35
|
+
}
|
|
36
|
+
export declare function DropdownMenuItem({ value, disabled, closeOnSelect, onSelect, className, render, ...props }: DropdownMenuItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
37
|
+
export interface DropdownMenuCheckboxItemProps extends Omit<DropdownMenuItemProps, "onSelect"> {
|
|
38
|
+
checked: boolean;
|
|
39
|
+
onCheckedChange: (checked: boolean) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare function DropdownMenuCheckboxItem({ value, checked, onCheckedChange, disabled, closeOnSelect, className, render, children, ...props }: DropdownMenuCheckboxItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
42
|
+
export interface DropdownMenuRadioGroupProps extends ComponentProps<"div"> {
|
|
43
|
+
value?: string;
|
|
44
|
+
onValueChange?: (value: string) => void;
|
|
45
|
+
}
|
|
46
|
+
export declare function DropdownMenuRadioGroup({ value, onValueChange, ...props }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
47
|
+
export declare function DropdownMenuRadioItem({ value, disabled, closeOnSelect, className, render, children, ...props }: Omit<DropdownMenuItemProps, "onSelect"> & {
|
|
48
|
+
value: string;
|
|
49
|
+
}): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
50
|
+
export declare function DropdownMenuGroup({ children, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
51
|
+
export declare function DropdownMenuLabel({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
52
|
+
export declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
53
|
+
export declare function DropdownMenuShortcut({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
54
|
+
/** The item that opens a submenu. Place it inside `DropdownMenuSub`. */
|
|
55
|
+
export declare function DropdownMenuSubTrigger({ className, render, children, ...props }: PartProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "./lib/cx.js";
|
|
3
|
+
import { Portal } from "./lib/portal.js";
|
|
4
|
+
import { usePresence } from "./lib/presence.js";
|
|
5
|
+
import { mergeProps, renderPart } from "./lib/render.js";
|
|
6
|
+
import { positionerSide, useAnchorFollow, useTriggerAnchor, useWaterDrop } from "./lib/water-drop.js";
|
|
7
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
8
|
+
import { createContext, useContext, useEffect, useId, useRef } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import * as menu from "@zag-js/menu";
|
|
11
|
+
// src/components/dropdown-menu.tsx
|
|
12
|
+
const Context = createContext(null);
|
|
13
|
+
/** The menu a submenu opens from, so its trigger can be wired as an item. */
|
|
14
|
+
const ParentContext = createContext(null);
|
|
15
|
+
function useMenu() {
|
|
16
|
+
const ctx = useContext(Context);
|
|
17
|
+
if (!ctx) throw new Error("DropdownMenu parts must be used inside <DropdownMenu>.");
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
const RadioContext = createContext(null);
|
|
21
|
+
function useMenuMachine(props, placement, onTrigger = false) {
|
|
22
|
+
const id = useId();
|
|
23
|
+
const point = useRef(null);
|
|
24
|
+
const anchor = useTriggerAnchor(placement ?? "", 6);
|
|
25
|
+
const service = useMachine(menu.machine, {
|
|
26
|
+
id,
|
|
27
|
+
positioning: {
|
|
28
|
+
placement,
|
|
29
|
+
offset: { mainAxis: 6 },
|
|
30
|
+
...onTrigger && { getAnchorRect: anchor.getAnchorRect }
|
|
31
|
+
},
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
const api = menu.connect(service, normalizeProps);
|
|
35
|
+
useAnchorFollow(anchor, onTrigger && api.open, positionerSide(api.getPositionerProps()), api.reposition);
|
|
36
|
+
return {
|
|
37
|
+
service,
|
|
38
|
+
api,
|
|
39
|
+
point
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Owns the open state, highlight and typeahead. Renders no element of its own. */
|
|
43
|
+
function DropdownMenu({ children, placement = "bottom-start", ...props }) {
|
|
44
|
+
const ctx = useMenuMachine(props, placement, true);
|
|
45
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
46
|
+
value: ctx,
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** A menu that opens at the pointer on right click or long press, instead of on a trigger. */
|
|
51
|
+
function ContextMenu({ children, placement = "bottom-start", ...props }) {
|
|
52
|
+
const ctx = useMenuMachine(props, placement);
|
|
53
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
54
|
+
value: ctx,
|
|
55
|
+
children
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** The region that answers to a right click or long press. Renders a `div` by default. */
|
|
59
|
+
function ContextMenuTrigger({ render, ...props }) {
|
|
60
|
+
const { api, point } = useMenu();
|
|
61
|
+
const base = api.getContextTriggerProps();
|
|
62
|
+
const remember = (event) => {
|
|
63
|
+
point.current = {
|
|
64
|
+
x: event.clientX,
|
|
65
|
+
y: event.clientY
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
return renderPart("div", mergeProps({
|
|
69
|
+
...base,
|
|
70
|
+
"data-slot": "context-menu-trigger",
|
|
71
|
+
onPointerDown(event) {
|
|
72
|
+
remember(event);
|
|
73
|
+
base.onPointerDown?.(event);
|
|
74
|
+
},
|
|
75
|
+
onContextMenu(event) {
|
|
76
|
+
remember(event);
|
|
77
|
+
base.onContextMenu?.(event);
|
|
78
|
+
}
|
|
79
|
+
}, props), render);
|
|
80
|
+
}
|
|
81
|
+
/** A nested menu. Put a `DropdownMenuSubTrigger` and `DropdownMenuSubContent` inside. */
|
|
82
|
+
function DropdownMenuSub({ children, placement = "right-start", ...props }) {
|
|
83
|
+
const parent = useMenu();
|
|
84
|
+
const ctx = useMenuMachine(props, placement);
|
|
85
|
+
const { setParent } = ctx.api;
|
|
86
|
+
const { setChild } = parent.api;
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
setParent(parent.service);
|
|
89
|
+
setChild(ctx.service);
|
|
90
|
+
}, [
|
|
91
|
+
setParent,
|
|
92
|
+
setChild,
|
|
93
|
+
parent.service,
|
|
94
|
+
ctx.service
|
|
95
|
+
]);
|
|
96
|
+
return /* @__PURE__ */ jsx(ParentContext.Provider, {
|
|
97
|
+
value: parent,
|
|
98
|
+
children: /* @__PURE__ */ jsx(Context.Provider, {
|
|
99
|
+
value: ctx,
|
|
100
|
+
children
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function DropdownMenuTrigger({ render, ...props }) {
|
|
105
|
+
const { api } = useMenu();
|
|
106
|
+
return renderPart("button", mergeProps({
|
|
107
|
+
...api.getTriggerProps(),
|
|
108
|
+
"data-slot": "dropdown-menu-trigger"
|
|
109
|
+
}, props), render);
|
|
110
|
+
}
|
|
111
|
+
function Panel({ className, render, slot, ...props }) {
|
|
112
|
+
const { api, point } = useMenu();
|
|
113
|
+
const drop = useWaterDrop({
|
|
114
|
+
sourceId: api.getTriggerProps().id,
|
|
115
|
+
point: () => point.current,
|
|
116
|
+
material: "liquid-glass-dense squircle [--squircle-radius:1.25rem]"
|
|
117
|
+
});
|
|
118
|
+
const { ref, mounted, attrs } = usePresence(api.open, drop);
|
|
119
|
+
if (!mounted) return null;
|
|
120
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx("div", {
|
|
121
|
+
...api.getPositionerProps(),
|
|
122
|
+
className: "z-[70]",
|
|
123
|
+
children: renderPart("div", mergeProps({
|
|
124
|
+
...api.getContentProps(),
|
|
125
|
+
...attrs,
|
|
126
|
+
ref,
|
|
127
|
+
hidden: false,
|
|
128
|
+
"data-slot": slot,
|
|
129
|
+
className: cx("min-w-44 max-h-(--available-height,24rem) overflow-y-auto liquid-glass-dense squircle morph-reset [--squircle-radius:1.25rem] p-1 text-label outline-none transition spring-smooth origin-(--transform-origin,center) data-ending-style:scale-[0.88] data-starting-style:scale-[0.88] data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:origin-top data-[side=top]:origin-bottom motion-reduce:transition-none motion-reduce:data-ending-style:scale-100 motion-reduce:data-starting-style:scale-100", className)
|
|
130
|
+
}, props), render)
|
|
131
|
+
}) });
|
|
132
|
+
}
|
|
133
|
+
/** The floating list. Mounts only while open or leaving. */
|
|
134
|
+
function DropdownMenuContent(props) {
|
|
135
|
+
return /* @__PURE__ */ jsx(Panel, {
|
|
136
|
+
slot: "dropdown-menu-content",
|
|
137
|
+
...props
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function DropdownMenuSubContent(props) {
|
|
141
|
+
return /* @__PURE__ */ jsx(Panel, {
|
|
142
|
+
slot: "dropdown-menu-sub-content",
|
|
143
|
+
...props
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const itemClass = "relative flex cursor-default select-none items-center gap-2 rounded-xl px-2.5 py-1.5 text-footnote outline-none transition-colors duration-(--duration-instant) data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-accent/15";
|
|
147
|
+
/** Calls `onSelect` when Zag selects the element with this id. */
|
|
148
|
+
function useSelect(id, onSelect) {
|
|
149
|
+
const { api } = useMenu();
|
|
150
|
+
const latest = useRef(onSelect);
|
|
151
|
+
latest.current = onSelect;
|
|
152
|
+
const add = useRef(api.addItemListener);
|
|
153
|
+
add.current = api.addItemListener;
|
|
154
|
+
useEffect(() => add.current({
|
|
155
|
+
id,
|
|
156
|
+
onSelect: () => latest.current?.()
|
|
157
|
+
}), [id]);
|
|
158
|
+
}
|
|
159
|
+
function DropdownMenuItem({ value, disabled, closeOnSelect, onSelect, className, render, ...props }) {
|
|
160
|
+
const { api } = useMenu();
|
|
161
|
+
const generated = useId();
|
|
162
|
+
const itemValue = value ?? generated;
|
|
163
|
+
useSelect(api.getItemState({ value: itemValue }).id, onSelect);
|
|
164
|
+
return renderPart("div", mergeProps({
|
|
165
|
+
...api.getItemProps({
|
|
166
|
+
value: itemValue,
|
|
167
|
+
disabled,
|
|
168
|
+
closeOnSelect
|
|
169
|
+
}),
|
|
170
|
+
"data-slot": "dropdown-menu-item",
|
|
171
|
+
className: cx(itemClass, className)
|
|
172
|
+
}, props), render);
|
|
173
|
+
}
|
|
174
|
+
function OptionBody({ checked, children }) {
|
|
175
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
className: "text-accent-text inline-flex size-4 items-center justify-center",
|
|
178
|
+
children: checked ? "✓" : null
|
|
179
|
+
}), children] });
|
|
180
|
+
}
|
|
181
|
+
function DropdownMenuCheckboxItem({ value, checked, onCheckedChange, disabled, closeOnSelect, className, render, children, ...props }) {
|
|
182
|
+
const { api } = useMenu();
|
|
183
|
+
const generated = useId();
|
|
184
|
+
const itemValue = value ?? generated;
|
|
185
|
+
return renderPart("div", mergeProps({
|
|
186
|
+
...api.getOptionItemProps({
|
|
187
|
+
type: "checkbox",
|
|
188
|
+
value: itemValue,
|
|
189
|
+
checked,
|
|
190
|
+
onCheckedChange,
|
|
191
|
+
disabled,
|
|
192
|
+
closeOnSelect
|
|
193
|
+
}),
|
|
194
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
195
|
+
className: cx(itemClass, className),
|
|
196
|
+
children: /* @__PURE__ */ jsx(OptionBody, {
|
|
197
|
+
checked,
|
|
198
|
+
children
|
|
199
|
+
})
|
|
200
|
+
}, props), render);
|
|
201
|
+
}
|
|
202
|
+
function DropdownMenuRadioGroup({ value, onValueChange, ...props }) {
|
|
203
|
+
const { api } = useMenu();
|
|
204
|
+
const id = useId();
|
|
205
|
+
return /* @__PURE__ */ jsx(RadioContext.Provider, {
|
|
206
|
+
value: {
|
|
207
|
+
value,
|
|
208
|
+
onValueChange: onValueChange ?? (() => {})
|
|
209
|
+
},
|
|
210
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
211
|
+
...api.getItemGroupProps({ id }),
|
|
212
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
213
|
+
...props
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function DropdownMenuRadioItem({ value, disabled, closeOnSelect, className, render, children, ...props }) {
|
|
218
|
+
const { api } = useMenu();
|
|
219
|
+
const radio = useContext(RadioContext);
|
|
220
|
+
const checked = radio?.value === value;
|
|
221
|
+
return renderPart("div", mergeProps({
|
|
222
|
+
...api.getOptionItemProps({
|
|
223
|
+
type: "radio",
|
|
224
|
+
value,
|
|
225
|
+
checked,
|
|
226
|
+
onCheckedChange: () => radio?.onValueChange(value),
|
|
227
|
+
disabled,
|
|
228
|
+
closeOnSelect
|
|
229
|
+
}),
|
|
230
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
231
|
+
className: cx(itemClass, className),
|
|
232
|
+
children: /* @__PURE__ */ jsx(OptionBody, {
|
|
233
|
+
checked,
|
|
234
|
+
children
|
|
235
|
+
})
|
|
236
|
+
}, props), render);
|
|
237
|
+
}
|
|
238
|
+
function DropdownMenuGroup({ children, ...props }) {
|
|
239
|
+
const { api } = useMenu();
|
|
240
|
+
const id = useId();
|
|
241
|
+
return /* @__PURE__ */ jsx(GroupContext.Provider, {
|
|
242
|
+
value: id,
|
|
243
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
244
|
+
...api.getItemGroupProps({ id }),
|
|
245
|
+
"data-slot": "dropdown-menu-group",
|
|
246
|
+
...props,
|
|
247
|
+
children
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const GroupContext = createContext(void 0);
|
|
252
|
+
function DropdownMenuLabel({ className, ...props }) {
|
|
253
|
+
const { api } = useMenu();
|
|
254
|
+
const group = useContext(GroupContext);
|
|
255
|
+
const label = group ? api.getItemGroupLabelProps({ htmlFor: group }) : {};
|
|
256
|
+
return /* @__PURE__ */ jsx("div", {
|
|
257
|
+
...label,
|
|
258
|
+
"data-slot": "dropdown-menu-label",
|
|
259
|
+
className: cx("px-2.5 py-1.5 text-footnote font-semibold text-label-secondary", className),
|
|
260
|
+
...props
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
264
|
+
const { api } = useMenu();
|
|
265
|
+
return /* @__PURE__ */ jsx("div", {
|
|
266
|
+
...api.getSeparatorProps(),
|
|
267
|
+
"data-slot": "dropdown-menu-separator",
|
|
268
|
+
className: cx("-mx-1 my-1 h-px bg-separator", className),
|
|
269
|
+
...props
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
273
|
+
return /* @__PURE__ */ jsx("span", {
|
|
274
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
275
|
+
className: cx("ms-auto ps-4 text-caption tracking-widest text-label-tertiary", className),
|
|
276
|
+
...props
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/** The item that opens a submenu. Place it inside `DropdownMenuSub`. */
|
|
280
|
+
function DropdownMenuSubTrigger({ className, render, children, ...props }) {
|
|
281
|
+
const parent = useContext(ParentContext);
|
|
282
|
+
const { api } = useMenu();
|
|
283
|
+
if (!parent) throw new Error("DropdownMenuSubTrigger must be used inside <DropdownMenuSub>.");
|
|
284
|
+
return renderPart("div", mergeProps({
|
|
285
|
+
...parent.api.getTriggerItemProps(api),
|
|
286
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
287
|
+
className: cx(itemClass, className),
|
|
288
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [children, /* @__PURE__ */ jsx("span", {
|
|
289
|
+
"aria-hidden": "true",
|
|
290
|
+
className: "text-label-tertiary ms-auto",
|
|
291
|
+
children: "›"
|
|
292
|
+
})] })
|
|
293
|
+
}, props), render);
|
|
294
|
+
}
|
|
295
|
+
export { ContextMenu, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
package/dist/empty.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/** A focused empty or unavailable state. Compose it from the parts below. */
|
|
3
|
+
export declare function Empty({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
4
|
+
/** Groups the media, title and description. */
|
|
5
|
+
export declare function EmptyHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
6
|
+
/** A decorative glyph above the title. Hidden from assistive technology. */
|
|
7
|
+
export declare function EmptyMedia({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
8
|
+
export declare function EmptyTitle({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
9
|
+
export declare function EmptyDescription({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
10
|
+
/** The next actions, such as buttons. */
|
|
11
|
+
export declare function EmptyContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
package/dist/empty.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/empty.tsx
|
|
4
|
+
/** A focused empty or unavailable state. Compose it from the parts below. */
|
|
5
|
+
function Empty({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "empty",
|
|
8
|
+
className: cx("flex flex-col items-center gap-3 px-6 py-10 text-center", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** Groups the media, title and description. */
|
|
13
|
+
function EmptyHeader({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
"data-slot": "empty-header",
|
|
16
|
+
className: cx("flex max-w-sm flex-col items-center gap-1.5", className),
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** A decorative glyph above the title. Hidden from assistive technology. */
|
|
21
|
+
function EmptyMedia({ className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("span", {
|
|
23
|
+
"data-slot": "empty-media",
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
className: cx("text-label-tertiary mb-1 flex items-center justify-center [&_svg]:size-8", className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function EmptyTitle({ className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("p", {
|
|
31
|
+
"data-slot": "empty-title",
|
|
32
|
+
className: cx("text-headline text-label font-semibold", className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function EmptyDescription({ className, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx("p", {
|
|
38
|
+
"data-slot": "empty-description",
|
|
39
|
+
className: cx("text-footnote text-label-secondary", className),
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** The next actions, such as buttons. */
|
|
44
|
+
function EmptyContent({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", {
|
|
46
|
+
"data-slot": "empty-content",
|
|
47
|
+
className: cx("flex flex-wrap justify-center gap-2", className),
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
|
package/dist/field.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Label } from "./label.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
/** Groups several fields, such as a form section. */
|
|
4
|
+
export declare function FieldGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
5
|
+
export type FieldProps = ComponentProps<"div"> & {
|
|
6
|
+
/** Lay the label and control out in a row, as for a switch. @default "vertical" */
|
|
7
|
+
orientation?: "vertical" | "horizontal";
|
|
8
|
+
/** Mark the field invalid so its text turns to the danger colour. */
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** One labelled control with optional description and error. */
|
|
12
|
+
export declare function Field({ orientation, invalid, className, ...props }: FieldProps): import("react").JSX.Element;
|
|
13
|
+
export declare function FieldLabel({ className, ...props }: ComponentProps<typeof Label>): import("react").JSX.Element;
|
|
14
|
+
export declare function FieldDescription({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
15
|
+
/** An error message. Render it only when there is an error. */
|
|
16
|
+
export declare function FieldError({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
package/dist/field.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { Label } from "./label.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/field.tsx
|
|
5
|
+
/** Groups several fields, such as a form section. */
|
|
6
|
+
function FieldGroup({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
"data-slot": "field-group",
|
|
9
|
+
className: cx("flex w-full flex-col gap-5", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/** One labelled control with optional description and error. */
|
|
14
|
+
function Field({ orientation = "vertical", invalid, className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
role: "group",
|
|
17
|
+
"data-slot": "field",
|
|
18
|
+
"data-orientation": orientation,
|
|
19
|
+
"data-invalid": invalid ? "" : void 0,
|
|
20
|
+
className: cx("group flex w-full gap-2 data-[orientation=horizontal]:flex-row data-[orientation=horizontal]:items-center data-[orientation=vertical]:flex-col", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function FieldLabel({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
26
|
+
"data-slot": "field-label",
|
|
27
|
+
className: cx("group-data-[invalid]:text-danger", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function FieldDescription({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("p", {
|
|
33
|
+
"data-slot": "field-description",
|
|
34
|
+
className: cx("text-footnote text-label-secondary", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** An error message. Render it only when there is an error. */
|
|
39
|
+
function FieldError({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx("p", {
|
|
41
|
+
role: "alert",
|
|
42
|
+
"data-slot": "field-error",
|
|
43
|
+
className: cx("text-footnote font-medium text-danger", className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { Field, FieldDescription, FieldError, FieldGroup, FieldLabel };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
// src/hooks/scroll/minimize-decision.ts
|
|
1
2
|
/** Programmatic restoration does not collapse chrome; reaching the top always restores it. */
|
|
2
|
-
|
|
3
|
-
top: number,
|
|
4
|
-
anchor: number,
|
|
5
|
-
userDriven: boolean,
|
|
6
|
-
): boolean | null {
|
|
3
|
+
function minimizeDecision(top, anchor, userDriven) {
|
|
7
4
|
if (top < 24) return false;
|
|
8
5
|
if (!userDriven) return null;
|
|
9
6
|
const delta = top - anchor;
|
|
@@ -11,3 +8,4 @@ export function minimizeDecision(
|
|
|
11
8
|
if (delta > 12) return true;
|
|
12
9
|
return null;
|
|
13
10
|
}
|
|
11
|
+
export { minimizeDecision };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnchoredPlacement } from "../lib/anchored-placement.js";
|
|
2
2
|
/**
|
|
3
3
|
* Places a panel of `width` and `needed` height under its anchor and
|
|
4
4
|
* keeps it there: re-places while the viewport resizes or anything
|
|
5
5
|
* scrolls, so it never hangs off the screen.
|
|
6
6
|
*/
|
|
7
|
-
export declare function useAnchoredPlacement(anchor: HTMLElement, width: number, needed: number, overlap?: boolean): AnchoredPlacement;
|
|
7
|
+
export declare function useAnchoredPlacement(anchor: HTMLElement, width: number, needed: number, overlap?: boolean): AnchoredPlacement;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { placeAnchored } from "../lib/anchored-placement.js";
|
|
2
|
+
import { useLayoutEffect, useState } from "react";
|
|
3
|
+
// src/hooks/use-anchored-placement.ts
|
|
4
|
+
/**
|
|
5
|
+
* Places a panel of `width` and `needed` height under its anchor and
|
|
6
|
+
* keeps it there: re-places while the viewport resizes or anything
|
|
7
|
+
* scrolls, so it never hangs off the screen.
|
|
8
|
+
*/
|
|
9
|
+
function useAnchoredPlacement(anchor, width, needed, overlap = false) {
|
|
10
|
+
const [placement, setPlacement] = useState(() => placeAnchored(anchor, width, needed, 6, overlap));
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
|
+
const replace = () => setPlacement(placeAnchored(anchor, width, needed, 6, overlap));
|
|
13
|
+
replace();
|
|
14
|
+
const viewport = window.visualViewport;
|
|
15
|
+
viewport?.addEventListener("resize", replace);
|
|
16
|
+
viewport?.addEventListener("scroll", replace);
|
|
17
|
+
window.addEventListener("resize", replace);
|
|
18
|
+
window.addEventListener("scroll", replace, true);
|
|
19
|
+
return () => {
|
|
20
|
+
viewport?.removeEventListener("resize", replace);
|
|
21
|
+
viewport?.removeEventListener("scroll", replace);
|
|
22
|
+
window.removeEventListener("resize", replace);
|
|
23
|
+
window.removeEventListener("scroll", replace, true);
|
|
24
|
+
};
|
|
25
|
+
}, [
|
|
26
|
+
anchor,
|
|
27
|
+
width,
|
|
28
|
+
needed,
|
|
29
|
+
overlap
|
|
30
|
+
]);
|
|
31
|
+
return placement;
|
|
32
|
+
}
|
|
33
|
+
export { useAnchoredPlacement };
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* back up or reach the top: iOS 26's `tabBarMinimizeBehavior(.onScrollDown)`.
|
|
4
4
|
* Listens to every scroll container, since each screen scrolls its own pane.
|
|
5
5
|
*/
|
|
6
|
-
export declare function useMinimizeOnScroll(): readonly [boolean, import("react").Dispatch<import("react").SetStateAction<boolean>>];
|
|
6
|
+
export declare function useMinimizeOnScroll(): readonly [boolean, import("react").Dispatch<import("react").SetStateAction<boolean>>];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { minimizeDecision } from "./scroll/minimize-decision.js";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
// src/hooks/use-minimize-on-scroll.ts
|
|
4
|
+
/**
|
|
5
|
+
* Minimized while you scroll down through content, restored when you scroll
|
|
6
|
+
* back up or reach the top: iOS 26's `tabBarMinimizeBehavior(.onScrollDown)`.
|
|
7
|
+
* Listens to every scroll container, since each screen scrolls its own pane.
|
|
8
|
+
*/
|
|
9
|
+
function useMinimizeOnScroll() {
|
|
10
|
+
const [minimized, setMinimized] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const anchors = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
let intent = null;
|
|
14
|
+
const onIntent = () => {
|
|
15
|
+
intent = performance.now();
|
|
16
|
+
};
|
|
17
|
+
const onKey = (event) => {
|
|
18
|
+
if ([
|
|
19
|
+
"ArrowDown",
|
|
20
|
+
"ArrowUp",
|
|
21
|
+
"PageDown",
|
|
22
|
+
"PageUp",
|
|
23
|
+
"Home",
|
|
24
|
+
"End",
|
|
25
|
+
" "
|
|
26
|
+
].includes(event.key)) onIntent();
|
|
27
|
+
};
|
|
28
|
+
const onPointer = (event) => {
|
|
29
|
+
if (event.buttons === 1) onIntent();
|
|
30
|
+
};
|
|
31
|
+
const onScroll = (event) => {
|
|
32
|
+
const pane = event.target instanceof Element ? event.target : document.scrollingElement;
|
|
33
|
+
if (!pane || pane.closest("[role=dialog], [data-floating-layer]") || pane.scrollHeight <= pane.clientHeight + 1) return;
|
|
34
|
+
const top = pane.scrollTop;
|
|
35
|
+
const userDriven = intent !== null && performance.now() - intent < 2e3;
|
|
36
|
+
const anchor = anchors.get(pane) ?? 0;
|
|
37
|
+
const next = minimizeDecision(top, anchor, userDriven);
|
|
38
|
+
if (next !== null) setMinimized(next);
|
|
39
|
+
if (next !== null || !userDriven) anchors.set(pane, top);
|
|
40
|
+
};
|
|
41
|
+
document.addEventListener("touchmove", onIntent, { passive: true });
|
|
42
|
+
document.addEventListener("wheel", onIntent, { passive: true });
|
|
43
|
+
document.addEventListener("pointermove", onPointer, { passive: true });
|
|
44
|
+
document.addEventListener("keydown", onKey);
|
|
45
|
+
document.addEventListener("scroll", onScroll, {
|
|
46
|
+
capture: true,
|
|
47
|
+
passive: true
|
|
48
|
+
});
|
|
49
|
+
return () => {
|
|
50
|
+
document.removeEventListener("scroll", onScroll, { capture: true });
|
|
51
|
+
document.removeEventListener("touchmove", onIntent);
|
|
52
|
+
document.removeEventListener("wheel", onIntent);
|
|
53
|
+
document.removeEventListener("pointermove", onPointer);
|
|
54
|
+
document.removeEventListener("keydown", onKey);
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
return [minimized, setMinimized];
|
|
58
|
+
}
|
|
59
|
+
export { useMinimizeOnScroll };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { ViewportMetrics } from "./viewport/types";
|
|
1
|
+
import { ViewportMetrics } from "./viewport/types.js";
|
|
3
2
|
/** Measures once per frame, including Android resize and Safari viewport panning. */
|
|
4
3
|
export declare function useVisualViewport(): ViewportMetrics | null;
|
|
4
|
+
export type { ViewportMetrics };
|