@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,264 +0,0 @@
|
|
|
1
|
-
import { springs } from "@passui/tokens/motion";
|
|
2
|
-
import { useMediaQuery } from "../../hooks/use-media-query";
|
|
3
|
-
import {
|
|
4
|
-
forwardRef,
|
|
5
|
-
type HTMLAttributes,
|
|
6
|
-
useLayoutEffect,
|
|
7
|
-
useRef,
|
|
8
|
-
useState,
|
|
9
|
-
} from "react";
|
|
10
|
-
import { useAnchoredPlacement } from "../../hooks/use-anchored-placement";
|
|
11
|
-
import { FLOATING_LAYER } from "../../hooks/use-dismiss";
|
|
12
|
-
import { useFloatingDismiss } from "../../hooks/use-floating-dismiss";
|
|
13
|
-
import { cn } from "../../lib/class-names";
|
|
14
|
-
import { registerFloatingLayer } from "../../lib/floating-layers";
|
|
15
|
-
import { concealMenuSource } from "../context-menu/conceal-menu-source";
|
|
16
|
-
import { menuSurfaceReveal } from "../context-menu/menu-reveal";
|
|
17
|
-
|
|
18
|
-
interface AnchoredSurfaceProps extends HTMLAttributes<HTMLDivElement> {
|
|
19
|
-
open: boolean;
|
|
20
|
-
onExited: () => void;
|
|
21
|
-
anchor: HTMLElement;
|
|
22
|
-
width: number;
|
|
23
|
-
needed: number;
|
|
24
|
-
onClose: (restoreFocus: boolean) => void;
|
|
25
|
-
contentClassName?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Shared material and lifetime for portaled
|
|
30
|
-
* pickers; their content owns
|
|
31
|
-
* selection.
|
|
32
|
-
* */
|
|
33
|
-
export const AnchoredSurface = forwardRef<HTMLDivElement, AnchoredSurfaceProps>(
|
|
34
|
-
function AnchoredSurface(
|
|
35
|
-
{
|
|
36
|
-
open: present,
|
|
37
|
-
onExited: remove,
|
|
38
|
-
anchor,
|
|
39
|
-
width,
|
|
40
|
-
needed,
|
|
41
|
-
onClose,
|
|
42
|
-
children,
|
|
43
|
-
className,
|
|
44
|
-
contentClassName,
|
|
45
|
-
...props
|
|
46
|
-
},
|
|
47
|
-
forwardedRef,
|
|
48
|
-
) {
|
|
49
|
-
const root = useRef<HTMLDivElement>(null);
|
|
50
|
-
const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
51
|
-
const material = useRef<HTMLDivElement>(null);
|
|
52
|
-
const content = useRef<HTMLDivElement>(null);
|
|
53
|
-
const animated = useRef<{
|
|
54
|
-
values: number[];
|
|
55
|
-
velocities: number[];
|
|
56
|
-
opacity: number;
|
|
57
|
-
materialOpacity: number;
|
|
58
|
-
} | null>(null);
|
|
59
|
-
const placement = useAnchoredPlacement(anchor, width, needed, true);
|
|
60
|
-
const [geometry, setGeometry] = useState<{
|
|
61
|
-
source: ReturnType<typeof menuSurfaceReveal>;
|
|
62
|
-
width: number;
|
|
63
|
-
height: number;
|
|
64
|
-
radius: number;
|
|
65
|
-
} | null>(null);
|
|
66
|
-
|
|
67
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: Placement can move without resizing; remeasure the source-relative reveal.
|
|
68
|
-
useLayoutEffect(() => {
|
|
69
|
-
const panel = root.current;
|
|
70
|
-
if (!panel || !present) return;
|
|
71
|
-
const measure = () => {
|
|
72
|
-
const target = panel.getBoundingClientRect();
|
|
73
|
-
const source = anchor.getBoundingClientRect();
|
|
74
|
-
const radius =
|
|
75
|
-
Number.parseFloat(getComputedStyle(panel).borderTopLeftRadius) || 0;
|
|
76
|
-
const reveal = menuSurfaceReveal(source, target);
|
|
77
|
-
setGeometry((current) =>
|
|
78
|
-
current &&
|
|
79
|
-
current.width === target.width &&
|
|
80
|
-
current.height === target.height &&
|
|
81
|
-
current.radius === radius &&
|
|
82
|
-
current.source.x === reveal.x &&
|
|
83
|
-
current.source.y === reveal.y &&
|
|
84
|
-
current.source.width === reveal.width &&
|
|
85
|
-
current.source.height === reveal.height
|
|
86
|
-
? current
|
|
87
|
-
: {
|
|
88
|
-
source: reveal,
|
|
89
|
-
width: target.width,
|
|
90
|
-
height: target.height,
|
|
91
|
-
radius,
|
|
92
|
-
},
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
measure();
|
|
96
|
-
const observer = new ResizeObserver(measure);
|
|
97
|
-
observer.observe(panel);
|
|
98
|
-
return () => observer.disconnect();
|
|
99
|
-
}, [
|
|
100
|
-
anchor,
|
|
101
|
-
present,
|
|
102
|
-
placement.left,
|
|
103
|
-
placement.top,
|
|
104
|
-
placement.bottom,
|
|
105
|
-
placement.width,
|
|
106
|
-
]);
|
|
107
|
-
|
|
108
|
-
useLayoutEffect(() => {
|
|
109
|
-
if (!root.current) return;
|
|
110
|
-
const unregister = registerFloatingLayer(root.current, anchor);
|
|
111
|
-
return unregister;
|
|
112
|
-
}, [anchor]);
|
|
113
|
-
|
|
114
|
-
useLayoutEffect(() => {
|
|
115
|
-
if (!present) return;
|
|
116
|
-
const restore = concealMenuSource(anchor, false);
|
|
117
|
-
return () => {
|
|
118
|
-
restore();
|
|
119
|
-
};
|
|
120
|
-
}, [anchor, present]);
|
|
121
|
-
|
|
122
|
-
useLayoutEffect(() => {
|
|
123
|
-
if (!geometry || !material.current || !content.current) {
|
|
124
|
-
if (!present) remove?.();
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const pane = material.current;
|
|
128
|
-
const body = content.current;
|
|
129
|
-
const source = [
|
|
130
|
-
geometry.source.x,
|
|
131
|
-
geometry.source.y,
|
|
132
|
-
geometry.source.width,
|
|
133
|
-
geometry.source.height,
|
|
134
|
-
geometry.source.borderRadius,
|
|
135
|
-
];
|
|
136
|
-
const target = present
|
|
137
|
-
? [0, 0, geometry.width, geometry.height, geometry.radius]
|
|
138
|
-
: source;
|
|
139
|
-
const state = animated.current ?? {
|
|
140
|
-
values: [...source],
|
|
141
|
-
velocities: source.map(() => 0),
|
|
142
|
-
opacity: 0,
|
|
143
|
-
materialOpacity: 1,
|
|
144
|
-
};
|
|
145
|
-
animated.current = state;
|
|
146
|
-
let frame = 0;
|
|
147
|
-
let previous = 0;
|
|
148
|
-
const paint = () => {
|
|
149
|
-
const [x, y, width, height, radius] = state.values;
|
|
150
|
-
pane.style.transform = `translate(${x}px, ${y}px)`;
|
|
151
|
-
pane.style.width = `${Math.max(0, width)}px`;
|
|
152
|
-
pane.style.height = `${Math.max(0, height)}px`;
|
|
153
|
-
pane.style.borderRadius = `${Math.max(0, radius)}px`;
|
|
154
|
-
pane.style.opacity = String(state.materialOpacity);
|
|
155
|
-
body.style.opacity = String(state.opacity);
|
|
156
|
-
};
|
|
157
|
-
const tick = (now: number) => {
|
|
158
|
-
const dt = previous ? Math.min(0.032, (now - previous) / 1000) : 1 / 60;
|
|
159
|
-
previous = now;
|
|
160
|
-
const { stiffness, damping, mass } = springs.smooth;
|
|
161
|
-
let resting = true;
|
|
162
|
-
for (let index = 0; index < target.length; index++) {
|
|
163
|
-
state.velocities[index] +=
|
|
164
|
-
(((target[index] - state.values[index]) * stiffness -
|
|
165
|
-
state.velocities[index] * damping) /
|
|
166
|
-
mass) *
|
|
167
|
-
dt;
|
|
168
|
-
state.values[index] += state.velocities[index] * dt;
|
|
169
|
-
if (
|
|
170
|
-
Math.abs(target[index] - state.values[index]) > 0.05 ||
|
|
171
|
-
Math.abs(state.velocities[index]) > 0.05
|
|
172
|
-
)
|
|
173
|
-
resting = false;
|
|
174
|
-
}
|
|
175
|
-
const progress = Math.max(
|
|
176
|
-
0,
|
|
177
|
-
Math.min(
|
|
178
|
-
1,
|
|
179
|
-
1 -
|
|
180
|
-
Math.abs(geometry.height - state.values[3]) /
|
|
181
|
-
Math.max(1, Math.abs(geometry.height - source[3])),
|
|
182
|
-
),
|
|
183
|
-
);
|
|
184
|
-
const opacity = present ? Math.max(0, (progress - 0.25) / 0.75) : 0;
|
|
185
|
-
state.opacity += (opacity - state.opacity) * (1 - Math.exp(-dt / 0.04));
|
|
186
|
-
state.materialOpacity +=
|
|
187
|
-
((present ? 1 : 0) - state.materialOpacity) *
|
|
188
|
-
(1 - Math.exp(-dt / 0.04));
|
|
189
|
-
paint();
|
|
190
|
-
if (
|
|
191
|
-
resting &&
|
|
192
|
-
Math.abs(opacity - state.opacity) < 0.01 &&
|
|
193
|
-
Math.abs((present ? 1 : 0) - state.materialOpacity) < 0.01
|
|
194
|
-
) {
|
|
195
|
-
state.values = [...target];
|
|
196
|
-
state.velocities.fill(0);
|
|
197
|
-
state.opacity = present ? 1 : 0;
|
|
198
|
-
state.materialOpacity = present ? 1 : 0;
|
|
199
|
-
paint();
|
|
200
|
-
if (!present) remove?.();
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
frame = requestAnimationFrame(tick);
|
|
204
|
-
};
|
|
205
|
-
if (reducedMotion) {
|
|
206
|
-
state.values = [...target];
|
|
207
|
-
state.velocities.fill(0);
|
|
208
|
-
state.opacity = present ? 1 : 0;
|
|
209
|
-
state.materialOpacity = present ? 1 : 0;
|
|
210
|
-
paint();
|
|
211
|
-
if (!present) remove?.();
|
|
212
|
-
} else {
|
|
213
|
-
paint();
|
|
214
|
-
frame = requestAnimationFrame(tick);
|
|
215
|
-
}
|
|
216
|
-
return () => cancelAnimationFrame(frame);
|
|
217
|
-
}, [geometry, present, remove, reducedMotion]);
|
|
218
|
-
|
|
219
|
-
useFloatingDismiss(root, anchor, (restore) => {
|
|
220
|
-
if (present) onClose(restore);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
return (
|
|
224
|
-
<div
|
|
225
|
-
{...props}
|
|
226
|
-
ref={(node) => {
|
|
227
|
-
root.current = node;
|
|
228
|
-
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
229
|
-
else if (forwardedRef) forwardedRef.current = node;
|
|
230
|
-
}}
|
|
231
|
-
{...{ [FLOATING_LAYER]: "" }}
|
|
232
|
-
inert={!present}
|
|
233
|
-
className={cn(
|
|
234
|
-
"fixed isolate z-[80] flex min-w-0 flex-col rounded-3xl outline-none",
|
|
235
|
-
!present && "pointer-events-none",
|
|
236
|
-
className,
|
|
237
|
-
)}
|
|
238
|
-
style={{
|
|
239
|
-
left: placement.left,
|
|
240
|
-
top: placement.top,
|
|
241
|
-
bottom: placement.bottom,
|
|
242
|
-
width: placement.width,
|
|
243
|
-
maxHeight: placement.maxHeight ?? 420,
|
|
244
|
-
}}
|
|
245
|
-
>
|
|
246
|
-
<div
|
|
247
|
-
ref={material}
|
|
248
|
-
aria-hidden="true"
|
|
249
|
-
className="glass-menu pointer-events-none absolute top-0 left-0 -z-10"
|
|
250
|
-
/>
|
|
251
|
-
<div
|
|
252
|
-
ref={content}
|
|
253
|
-
style={{ opacity: 0 }}
|
|
254
|
-
className={cn(
|
|
255
|
-
"flex min-h-0 flex-col overflow-y-auto overscroll-contain",
|
|
256
|
-
contentClassName,
|
|
257
|
-
)}
|
|
258
|
-
>
|
|
259
|
-
{children}
|
|
260
|
-
</div>
|
|
261
|
-
</div>
|
|
262
|
-
);
|
|
263
|
-
},
|
|
264
|
-
);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Popover — a glass surface that springs open from its trigger.
|
|
3
|
-
*
|
|
4
|
-
* Compound API (the only API):
|
|
5
|
-
*
|
|
6
|
-
* ```tsx
|
|
7
|
-
* <Popover>
|
|
8
|
-
* <Popover.Trigger render={(props) => <Button {...props}>Open</Button>} />
|
|
9
|
-
* <Popover.Content origin="top-left" className="top-full left-0 mt-2 w-64 p-4">
|
|
10
|
-
* …content…
|
|
11
|
-
* </Popover.Content>
|
|
12
|
-
* </Popover>
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* The `Popover.Trigger` clones its child (or uses a `render` prop) and wires
|
|
16
|
-
* up aria-haspopup, aria-expanded, aria-controls, click + keyboard toggling.
|
|
17
|
-
* The `Popover.Content` portals out of the authored layout, morphs its glass
|
|
18
|
-
* surface from the trigger's rect, and keeps itself inside the viewport as
|
|
19
|
-
* it resizes or scrolls. `origin` picks the corner it grows from; pass
|
|
20
|
-
* `placement="center"` for a modal center-screen variant.
|
|
21
|
-
*
|
|
22
|
-
* State is driven by a small pure machine (`popover.machine.ts`) that
|
|
23
|
-
* translates directly to a Rust enum — see the architecture plan.
|
|
24
|
-
*/
|
|
25
|
-
export { PopoverRoot as Root } from "./popover-root";
|
|
26
|
-
export {
|
|
27
|
-
PopoverTrigger as Trigger,
|
|
28
|
-
type PopoverTriggerRenderProps,
|
|
29
|
-
} from "./popover-trigger";
|
|
30
|
-
export {
|
|
31
|
-
PopoverContent as Content,
|
|
32
|
-
type PopoverOrigin,
|
|
33
|
-
} from "./popover-content";
|
|
34
|
-
|
|
35
|
-
import { PopoverRoot } from "./popover-root";
|
|
36
|
-
import { PopoverTrigger } from "./popover-trigger";
|
|
37
|
-
import { PopoverContent } from "./popover-content";
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Compound Popover. Use as `<Popover>` with `.Trigger` and `.Content` parts,
|
|
41
|
-
* or import `Root` / `Trigger` / `Content` directly from the barrel.
|
|
42
|
-
*/
|
|
43
|
-
export const Popover = Object.assign(PopoverRoot, {
|
|
44
|
-
Trigger: PopoverTrigger,
|
|
45
|
-
Content: PopoverContent,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export type { PopoverRootProps } from "./popover-root";
|
|
49
|
-
export type { PopoverTriggerProps } from "./popover-trigger";
|
|
50
|
-
export type { PopoverContentProps } from "./popover-content";
|
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
2
|
-
import { type ReactNode, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
-
import { concealMenuSource } from "../context-menu/conceal-menu-source";
|
|
4
|
-
import {
|
|
5
|
-
menuSurfaceExit,
|
|
6
|
-
menuSurfaceReveal,
|
|
7
|
-
type MenuRect,
|
|
8
|
-
} from "../context-menu/menu-reveal";
|
|
9
|
-
import { useSheetFocus } from "../sheet/use-sheet-focus";
|
|
10
|
-
import { SheetPortal } from "../sheet/sheet-portal";
|
|
11
|
-
import { cn } from "../../lib/class-names";
|
|
12
|
-
import { screenEdges } from "../../lib/screen-edges";
|
|
13
|
-
import { fluidCollapse, fluidOvershoot } from "../../motion/transitions";
|
|
14
|
-
import { fitPopover, type PopoverFit } from "./popover-fit";
|
|
15
|
-
import { usePopover } from "./popover-root";
|
|
16
|
-
|
|
17
|
-
export type PopoverOrigin = "top-left" | "top-right";
|
|
18
|
-
|
|
19
|
-
export interface PopoverContentProps {
|
|
20
|
-
children: ReactNode;
|
|
21
|
-
className?: string;
|
|
22
|
-
/** Accessible name (used when there is no labelledBy). */
|
|
23
|
-
label?: string;
|
|
24
|
-
/** ID of a visible heading inside the content. */
|
|
25
|
-
labelledBy?: string;
|
|
26
|
-
/** Allow tapping outside to close. Escape always closes. */
|
|
27
|
-
dismissOnOutsidePress?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Where the content rests once expanded:
|
|
30
|
-
* - "anchor" positions relative to the trigger (default)
|
|
31
|
-
* - "center" floats in the middle of the viewport (modal)
|
|
32
|
-
*/
|
|
33
|
-
placement?: "anchor" | "center";
|
|
34
|
-
/**
|
|
35
|
-
* Which corner the popover grows from when placement="anchor".
|
|
36
|
-
* top-left: panel's left edge aligns to the trigger's left.
|
|
37
|
-
* top-right: panel's right edge aligns to the trigger's right.
|
|
38
|
-
* @default "top-left"
|
|
39
|
-
*/
|
|
40
|
-
origin?: PopoverOrigin;
|
|
41
|
-
/**
|
|
42
|
-
* ARIA role for the panel. Use "menu" for action menus, "dialog"
|
|
43
|
-
* (the default) for free-form content, "tooltip" for tips.
|
|
44
|
-
* @default "dialog"
|
|
45
|
-
*/
|
|
46
|
-
role?: "dialog" | "menu" | "tooltip";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function PopoverContent({
|
|
50
|
-
children,
|
|
51
|
-
className,
|
|
52
|
-
label,
|
|
53
|
-
labelledBy,
|
|
54
|
-
dismissOnOutsidePress = true,
|
|
55
|
-
placement = "anchor",
|
|
56
|
-
origin = "top-left",
|
|
57
|
-
role = "dialog",
|
|
58
|
-
}: PopoverContentProps) {
|
|
59
|
-
const { state, send, triggerRef, contentId } = usePopover();
|
|
60
|
-
const panel = useRef<HTMLDivElement>(null);
|
|
61
|
-
const reducedMotion = useReducedMotion();
|
|
62
|
-
const [settled, setSettled] = useState(false);
|
|
63
|
-
const [material, setMaterial] = useState({ width: 0, height: 0, radius: 0 });
|
|
64
|
-
const [fit, setFit] = useState<PopoverFit>({
|
|
65
|
-
shiftX: 0,
|
|
66
|
-
shiftY: 0,
|
|
67
|
-
maxWidth: 0,
|
|
68
|
-
above: false,
|
|
69
|
-
});
|
|
70
|
-
const [reveal, setReveal] = useState<ReturnType<
|
|
71
|
-
typeof menuSurfaceReveal
|
|
72
|
-
> | null>(null);
|
|
73
|
-
|
|
74
|
-
useSheetFocus(panel, () => send("CLOSE"));
|
|
75
|
-
|
|
76
|
-
// Measure panel + trigger rects, compute the reveal (initial morph state)
|
|
77
|
-
// and the viewport fit (so the panel stays on screen as it resizes).
|
|
78
|
-
useLayoutEffect(() => {
|
|
79
|
-
const surface = panel.current;
|
|
80
|
-
const source = triggerRef.current;
|
|
81
|
-
if (!surface) return;
|
|
82
|
-
|
|
83
|
-
const refit = () => {
|
|
84
|
-
const panelRect = surface.getBoundingClientRect();
|
|
85
|
-
const radius =
|
|
86
|
-
Number.parseFloat(getComputedStyle(surface).borderTopLeftRadius) || 0;
|
|
87
|
-
setMaterial((prev) =>
|
|
88
|
-
prev.width === panelRect.width &&
|
|
89
|
-
prev.height === panelRect.height &&
|
|
90
|
-
prev.radius === radius
|
|
91
|
-
? prev
|
|
92
|
-
: { width: panelRect.width, height: panelRect.height, radius },
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const visualViewport = window.visualViewport;
|
|
96
|
-
const offsetLeft = visualViewport?.offsetLeft ?? 0;
|
|
97
|
-
const offsetTop = visualViewport?.offsetTop ?? 0;
|
|
98
|
-
const edges = screenEdges();
|
|
99
|
-
const trigger = source?.getBoundingClientRect();
|
|
100
|
-
const next = fitPopover(
|
|
101
|
-
{
|
|
102
|
-
left: panelRect.left,
|
|
103
|
-
top: panelRect.top,
|
|
104
|
-
width: panelRect.width,
|
|
105
|
-
height: panelRect.height,
|
|
106
|
-
},
|
|
107
|
-
trigger ? { top: trigger.top, bottom: trigger.bottom } : undefined,
|
|
108
|
-
{
|
|
109
|
-
viewport: {
|
|
110
|
-
width: offsetLeft + (visualViewport?.width ?? window.innerWidth),
|
|
111
|
-
height: offsetTop + (visualViewport?.height ?? window.innerHeight),
|
|
112
|
-
},
|
|
113
|
-
edges: {
|
|
114
|
-
...edges,
|
|
115
|
-
left: offsetLeft + edges.left,
|
|
116
|
-
top: offsetTop + edges.top,
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
trigger ? -trigger.height : 6,
|
|
120
|
-
origin,
|
|
121
|
-
);
|
|
122
|
-
setFit((current) => {
|
|
123
|
-
if (
|
|
124
|
-
current.shiftX === next.shiftX &&
|
|
125
|
-
current.shiftY === next.shiftY &&
|
|
126
|
-
current.maxWidth === next.maxWidth &&
|
|
127
|
-
current.maxHeight === next.maxHeight &&
|
|
128
|
-
current.above === next.above
|
|
129
|
-
)
|
|
130
|
-
return current;
|
|
131
|
-
return next;
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
const sourceArg: MenuRect | undefined =
|
|
135
|
-
trigger && trigger.width > 0 && trigger.height > 0
|
|
136
|
-
? {
|
|
137
|
-
left: trigger.left,
|
|
138
|
-
top: trigger.top,
|
|
139
|
-
width: trigger.width,
|
|
140
|
-
height: trigger.height,
|
|
141
|
-
}
|
|
142
|
-
: undefined;
|
|
143
|
-
setReveal(
|
|
144
|
-
menuSurfaceReveal(sourceArg, {
|
|
145
|
-
left: panelRect.left,
|
|
146
|
-
top: panelRect.top,
|
|
147
|
-
width: next.maxWidth || panelRect.width,
|
|
148
|
-
height: next.maxHeight
|
|
149
|
-
? Math.min(next.maxHeight, panelRect.height)
|
|
150
|
-
: panelRect.height,
|
|
151
|
-
radius,
|
|
152
|
-
}),
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
refit();
|
|
157
|
-
let frame = 0;
|
|
158
|
-
const schedule = () => {
|
|
159
|
-
cancelAnimationFrame(frame);
|
|
160
|
-
frame = requestAnimationFrame(refit);
|
|
161
|
-
};
|
|
162
|
-
const observer = new ResizeObserver(schedule);
|
|
163
|
-
observer.observe(surface);
|
|
164
|
-
if (source) observer.observe(source);
|
|
165
|
-
const viewport = window.visualViewport;
|
|
166
|
-
viewport?.addEventListener("resize", schedule);
|
|
167
|
-
viewport?.addEventListener("scroll", schedule);
|
|
168
|
-
window.addEventListener("resize", schedule);
|
|
169
|
-
window.addEventListener("scroll", schedule, true);
|
|
170
|
-
return () => {
|
|
171
|
-
observer.disconnect();
|
|
172
|
-
cancelAnimationFrame(frame);
|
|
173
|
-
viewport?.removeEventListener("resize", schedule);
|
|
174
|
-
viewport?.removeEventListener("scroll", schedule);
|
|
175
|
-
window.removeEventListener("resize", schedule);
|
|
176
|
-
window.removeEventListener("scroll", schedule, true);
|
|
177
|
-
};
|
|
178
|
-
}, [triggerRef, origin]);
|
|
179
|
-
|
|
180
|
-
// Conceal the trigger while the surface is morphing.
|
|
181
|
-
useLayoutEffect(() => {
|
|
182
|
-
const source = triggerRef.current;
|
|
183
|
-
if (!source) return;
|
|
184
|
-
const restore = concealMenuSource(source, false);
|
|
185
|
-
return () => {
|
|
186
|
-
restore();
|
|
187
|
-
};
|
|
188
|
-
}, [triggerRef]);
|
|
189
|
-
|
|
190
|
-
const anchored = placement === "anchor";
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
<AnimatePresence>
|
|
194
|
-
{state !== "closed" && (
|
|
195
|
-
<SheetPortal>
|
|
196
|
-
{placement === "center" && (
|
|
197
|
-
<motion.div
|
|
198
|
-
aria-hidden="true"
|
|
199
|
-
className="fixed inset-0 z-[75] bg-black/30 backdrop-blur-md"
|
|
200
|
-
initial={{ opacity: 0 }}
|
|
201
|
-
animate={{ opacity: 1 }}
|
|
202
|
-
exit={{ opacity: 0 }}
|
|
203
|
-
transition={reducedMotion ? { duration: 0 } : { duration: 0.18 }}
|
|
204
|
-
onClick={dismissOnOutsidePress ? () => send("CLOSE") : undefined}
|
|
205
|
-
/>
|
|
206
|
-
)}
|
|
207
|
-
<motion.div
|
|
208
|
-
ref={panel}
|
|
209
|
-
id={contentId}
|
|
210
|
-
role={role}
|
|
211
|
-
aria-modal={placement === "center" || undefined}
|
|
212
|
-
aria-label={labelledBy ? undefined : label}
|
|
213
|
-
aria-labelledby={labelledBy}
|
|
214
|
-
tabIndex={-1}
|
|
215
|
-
data-state={state}
|
|
216
|
-
className={cn(
|
|
217
|
-
"relative isolate flex flex-col outline-none",
|
|
218
|
-
anchored
|
|
219
|
-
? cn(
|
|
220
|
-
"rounded-5xl absolute z-40",
|
|
221
|
-
"[&>:not([data-popover-surface])]:opacity-[var(--popover-content-opacity)]",
|
|
222
|
-
)
|
|
223
|
-
: "rounded-5xl fixed z-[76] max-h-[92%] w-full max-w-[560px] p-6",
|
|
224
|
-
settled && anchored ? "overflow-hidden" : undefined,
|
|
225
|
-
className,
|
|
226
|
-
)}
|
|
227
|
-
style={
|
|
228
|
-
anchored
|
|
229
|
-
? {
|
|
230
|
-
transformOrigin:
|
|
231
|
-
origin === "top-left"
|
|
232
|
-
? `0% ${fit.above ? "100%" : "0%"}`
|
|
233
|
-
: `100% ${fit.above ? "100%" : "0%"}`,
|
|
234
|
-
translate: `${fit.shiftX}px ${fit.shiftY}px`,
|
|
235
|
-
maxWidth: fit.maxWidth || undefined,
|
|
236
|
-
maxHeight: fit.maxHeight,
|
|
237
|
-
overflowY:
|
|
238
|
-
fit.maxHeight !== undefined && settled
|
|
239
|
-
? "auto"
|
|
240
|
-
: undefined,
|
|
241
|
-
}
|
|
242
|
-
: undefined
|
|
243
|
-
}
|
|
244
|
-
initial={
|
|
245
|
-
anchored
|
|
246
|
-
? { "--popover-content-opacity": reducedMotion ? 1 : 0 }
|
|
247
|
-
: { opacity: 0 }
|
|
248
|
-
}
|
|
249
|
-
animate={
|
|
250
|
-
anchored ? { "--popover-content-opacity": 1 } : { opacity: 1 }
|
|
251
|
-
}
|
|
252
|
-
exit={
|
|
253
|
-
anchored
|
|
254
|
-
? {
|
|
255
|
-
"--popover-content-opacity": 0,
|
|
256
|
-
transition: { duration: reducedMotion ? 0 : 0.06 },
|
|
257
|
-
}
|
|
258
|
-
: { opacity: 0 }
|
|
259
|
-
}
|
|
260
|
-
transition={
|
|
261
|
-
anchored
|
|
262
|
-
? reducedMotion
|
|
263
|
-
? { duration: 0 }
|
|
264
|
-
: { duration: 0.16, delay: 0.06 }
|
|
265
|
-
: reducedMotion
|
|
266
|
-
? { duration: 0 }
|
|
267
|
-
: { duration: 0.16, delay: 0.06 }
|
|
268
|
-
}
|
|
269
|
-
>
|
|
270
|
-
{/* The morphing glass surface — starts at the trigger's rect
|
|
271
|
-
and grows to fill the panel, with the fluid overshoot bounce. */}
|
|
272
|
-
<motion.div
|
|
273
|
-
key={reveal ? "surface" : "measure"}
|
|
274
|
-
aria-hidden="true"
|
|
275
|
-
data-popover-surface=""
|
|
276
|
-
onAnimationComplete={() => {
|
|
277
|
-
if (state === "opening") send("OPENED");
|
|
278
|
-
if (state === "closing") send("CLOSED");
|
|
279
|
-
if (reveal) setSettled(true);
|
|
280
|
-
}}
|
|
281
|
-
className="glass-menu rounded-5xl pointer-events-none absolute top-0 left-0 -z-10"
|
|
282
|
-
style={{ width: "100%", height: "100%" }}
|
|
283
|
-
initial={reducedMotion || !reveal ? { opacity: 0 } : reveal}
|
|
284
|
-
animate={
|
|
285
|
-
material.width > 0
|
|
286
|
-
? {
|
|
287
|
-
x: 0,
|
|
288
|
-
y: 0,
|
|
289
|
-
width: material.width,
|
|
290
|
-
height: fit.maxHeight
|
|
291
|
-
? Math.min(material.height, fit.maxHeight)
|
|
292
|
-
: material.height,
|
|
293
|
-
opacity: 1,
|
|
294
|
-
borderRadius: material.radius,
|
|
295
|
-
}
|
|
296
|
-
: undefined
|
|
297
|
-
}
|
|
298
|
-
exit={
|
|
299
|
-
reducedMotion || !reveal
|
|
300
|
-
? { opacity: 0 }
|
|
301
|
-
: {
|
|
302
|
-
...menuSurfaceExit(reveal),
|
|
303
|
-
transition: fluidCollapse,
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
transition={
|
|
307
|
-
reducedMotion
|
|
308
|
-
? { duration: 0 }
|
|
309
|
-
: { ...fluidOvershoot, opacity: { duration: 0.16 } }
|
|
310
|
-
}
|
|
311
|
-
/>
|
|
312
|
-
{/* Content fades in after the surface arrives. */}
|
|
313
|
-
<motion.div
|
|
314
|
-
initial={reducedMotion ? false : { opacity: 0 }}
|
|
315
|
-
animate={reducedMotion ? undefined : { opacity: 1 }}
|
|
316
|
-
exit={
|
|
317
|
-
reducedMotion
|
|
318
|
-
? undefined
|
|
319
|
-
: { opacity: 0, transition: { duration: 0.12 } }
|
|
320
|
-
}
|
|
321
|
-
transition={
|
|
322
|
-
reducedMotion
|
|
323
|
-
? { duration: 0 }
|
|
324
|
-
: { duration: 0.16, delay: 0.06 }
|
|
325
|
-
}
|
|
326
|
-
>
|
|
327
|
-
{state !== "closing" && children}
|
|
328
|
-
</motion.div>
|
|
329
|
-
</motion.div>
|
|
330
|
-
</SheetPortal>
|
|
331
|
-
)}
|
|
332
|
-
</AnimatePresence>
|
|
333
|
-
);
|
|
334
|
-
}
|