@passui/react 0.1.47 → 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 -38
- 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 -310
- 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 -374
- 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
package/README.md
CHANGED
|
@@ -40,26 +40,28 @@ export function SaveButton() {
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Names follow shadcn (`Dialog`, `DialogContent`, `Card`, `CardHeader`), and
|
|
44
|
+
SwiftUI only where shadcn has none (`Stepper`, `SegmentedControl`). Each
|
|
45
|
+
component has its own subpath, such as `@passui/react/dialog` or
|
|
46
|
+
`@passui/react/stepper`, so a bundler keeps only what you import.
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
### Controls with a value
|
|
49
|
+
|
|
50
|
+
`Stepper`, `SloshSlider` and `WakeSlider` take their value from
|
|
51
|
+
`value` and `onChange`. `Stepper` supports fractional steps, disables its actions at the
|
|
52
|
+
bounds and rolls its digits unless Reduce Motion is on.
|
|
48
53
|
|
|
49
54
|
```tsx
|
|
50
55
|
import { useState } from "react";
|
|
51
|
-
import { Slider } from "@passui/react/slider";
|
|
52
56
|
import { Stepper } from "@passui/react/stepper";
|
|
53
|
-
import {
|
|
54
|
-
import { Divider } from "@passui/react/divider";
|
|
57
|
+
import { WakeSlider } from "@passui/react/wake-slider";
|
|
55
58
|
|
|
56
|
-
export function
|
|
57
|
-
const [volume, setVolume] = useState(50);
|
|
59
|
+
export function PrintSettings() {
|
|
58
60
|
const [copies, setCopies] = useState(1);
|
|
61
|
+
const [volume, setVolume] = useState(50);
|
|
59
62
|
|
|
60
63
|
return (
|
|
61
64
|
<section className="flex flex-col gap-4">
|
|
62
|
-
<Slider label="Volume" value={volume} onChange={setVolume} />
|
|
63
65
|
<Stepper
|
|
64
66
|
label="Copies"
|
|
65
67
|
labels={{ decrement: "Fewer copies", increment: "More copies" }}
|
|
@@ -68,87 +70,43 @@ export function DownloadSettings() {
|
|
|
68
70
|
min={1}
|
|
69
71
|
max={10}
|
|
70
72
|
/>
|
|
71
|
-
<
|
|
72
|
-
<ProgressView label="Downloading" value={42} max={100} />
|
|
73
|
+
<WakeSlider label="Volume" value={volume} onChange={setVolume} />
|
|
73
74
|
</section>
|
|
74
75
|
);
|
|
75
76
|
}
|
|
76
77
|
```
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
supports fractional steps and disables actions at its bounds. Slider keeps
|
|
80
|
-
native pointer and keyboard input. ProgressView omits `value` for indeterminate
|
|
81
|
-
progress and honors reduced motion. Divider is decorative by default; pass
|
|
82
|
-
`decorative={false}` to expose a semantic separator.
|
|
83
|
-
|
|
84
|
-
### Menus and disclosure groups
|
|
79
|
+
### Code, conversation and clipboard
|
|
85
80
|
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
top of `InlineDisclosure`.
|
|
81
|
+
`CodeBlock` takes plain source and, optionally, a highlighter's rendered
|
|
82
|
+
element, so no syntax engine enters Passui's dependency graph. `Conversation`
|
|
83
|
+
provides `Conversation.Messages` and `Conversation.Composer` for a message
|
|
84
|
+
thread. Every string, such as button names, comes from your app.
|
|
91
85
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export function Preferences() {
|
|
98
|
-
const [advanced, setAdvanced] = useState(false);
|
|
99
|
-
return (
|
|
100
|
-
<section>
|
|
101
|
-
<Menu
|
|
102
|
-
label="More options"
|
|
103
|
-
items={[{ label: "Refresh", onSelect: () => {} }]}
|
|
104
|
-
>
|
|
105
|
-
More
|
|
106
|
-
</Menu>
|
|
107
|
-
<DisclosureGroup
|
|
108
|
-
label="Advanced"
|
|
109
|
-
open={advanced}
|
|
110
|
-
onOpenChange={setAdvanced}
|
|
111
|
-
>
|
|
112
|
-
<p>Additional preferences</p>
|
|
113
|
-
</DisclosureGroup>
|
|
114
|
-
</section>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
```
|
|
86
|
+
`copyText` from `@passui/react/clipboard` returns `true` only after a
|
|
87
|
+
successful write and `false` if unavailable or denied. Call it from a user
|
|
88
|
+
action and show success only when it returns `true`; offer manual copying
|
|
89
|
+
otherwise. It adds no sound or haptic feedback.
|
|
118
90
|
|
|
119
91
|
### Icons and prop types
|
|
120
92
|
|
|
121
|
-
|
|
93
|
+
Icons live in `@passui/icons`, one entry point per icon:
|
|
122
94
|
|
|
123
95
|
```tsx
|
|
124
|
-
import {
|
|
125
|
-
import { SettingsIcon } from "@passui/
|
|
126
|
-
|
|
127
|
-
const settingsAction: IconButtonProps = {
|
|
128
|
-
label: "Settings",
|
|
129
|
-
variant: "ghost",
|
|
130
|
-
size: "icon-sm",
|
|
131
|
-
};
|
|
96
|
+
import { Button } from "@passui/react/button";
|
|
97
|
+
import { SettingsIcon } from "@passui/icons/settings";
|
|
132
98
|
|
|
133
99
|
export function SettingsButton() {
|
|
134
100
|
return (
|
|
135
|
-
<
|
|
101
|
+
<Button variant="ghost" size="icon-sm" aria-label="Settings">
|
|
136
102
|
<SettingsIcon />
|
|
137
|
-
</
|
|
103
|
+
</Button>
|
|
138
104
|
);
|
|
139
105
|
}
|
|
140
106
|
```
|
|
141
107
|
|
|
142
|
-
|
|
143
|
-
beside their
|
|
144
|
-
as that literal union (for example, `useState<"personal" | "team">("personal")`)
|
|
145
|
-
so selection callbacks retain the same choices. Existing root icon imports
|
|
146
|
-
continue to work. These additions have not been published yet.
|
|
147
|
-
|
|
148
|
-
Clipboard actions can use `copyText` from `@passui/react/clipboard`. It
|
|
149
|
-
returns `true` only after a successful write and `false` if unavailable or
|
|
150
|
-
denied. Call it from a user action and show success only when it returns
|
|
151
|
-
`true`; offer manual copying otherwise. It adds no sound or haptic feedback.
|
|
108
|
+
Props with fixed choices, such as `variant` and `size`, are string literal
|
|
109
|
+
unions exported beside their component, so editors suggest valid values.
|
|
152
110
|
|
|
153
111
|
See [Installation](https://passui.pherus.org/docs/installation) for the
|
|
154
112
|
root setup, and [Skills](https://passui.pherus.org/docs/skills) to give AI
|
|
@@ -194,41 +152,3 @@ your user npm configuration.
|
|
|
194
152
|
## License
|
|
195
153
|
|
|
196
154
|
[MIT](./LICENSE)
|
|
197
|
-
|
|
198
|
-
### Documentation and loading primitives
|
|
199
|
-
|
|
200
|
-
Import `Accordion`, `ComboBox`, `RadioGroup`, `Breadcrumb`, `Skeleton`,
|
|
201
|
-
`ContentUnavailableView`, `CodeBlock` and `KeyboardShortcut` from their kebab case
|
|
202
|
-
subpaths, such as `@passui/react/combo-box`. Each has a named props type and
|
|
203
|
-
interactive documentation. CodeBlock accepts plain source and optionally a
|
|
204
|
-
highlighter element, keeping syntax engines out of the library dependency graph.
|
|
205
|
-
Shared component styles come from the stylesheet import above.
|
|
206
|
-
|
|
207
|
-
Stepper places the spoken and rolling value beside its two action segments.
|
|
208
|
-
Its digit columns preserve carries and stop animating under Reduce Motion.
|
|
209
|
-
Compact desktop rows retain larger targets for coarse pointers. Import only
|
|
210
|
-
needed controls and icons through public entries; CSS is preserved while unused
|
|
211
|
-
JavaScript exports can be removed by the bundler.
|
|
212
|
-
|
|
213
|
-
### Search, selection and motion
|
|
214
|
-
|
|
215
|
-
`ComboBox` is a searchable `Picker` with optional `onCreate` and a localized
|
|
216
|
-
`createLabel`. `Command` composes grouped search actions; `CommandDialog` adds
|
|
217
|
-
modal focus handling. Shortcut hints are display only; your application owns the
|
|
218
|
-
actual keyboard bindings. Picker, compact calendar and time panels share one
|
|
219
|
-
glass surface that expands from its trigger and restores it after dismissal.
|
|
220
|
-
|
|
221
|
-
`TextField` and `SecureField` accept `labelPlacement="floating"`. SearchField
|
|
222
|
-
supports `collapsible` for a single pill that expands around its search icon.
|
|
223
|
-
`OneTimeCode` draws cells around one native input, preserving paste and code
|
|
224
|
-
autofill. Your application owns verification and supplies status feedback.
|
|
225
|
-
|
|
226
|
-
`SloshSlider` and `WakeSlider` take `label`, optional `value` or `defaultValue`,
|
|
227
|
-
and `onChange`. Values run from 0 to 100. Their React-only motion stops at rest
|
|
228
|
-
and respects Reduce Motion. Slosh has `viscosity`, `momentum` and `tilt`; Wake
|
|
229
|
-
has `bars` and `wake`. Their source attribution and MIT notice are included in
|
|
230
|
-
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). ProgressView remains read only
|
|
231
|
-
and shares the liquid fill without acquiring slider behavior.
|
|
232
|
-
|
|
233
|
-
`AspectRatio` clips images and videos to `ratio` without distorting them. The
|
|
234
|
-
documentation demonstrates equal-area crops in a stable stage.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -23,3 +23,32 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
23
23
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
24
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
25
|
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
# Vaul constants
|
|
28
|
+
|
|
29
|
+
Drawer and Sheet use the release curve (`cubic-bezier(0.32, 0.72, 0, 1)`) and the
|
|
30
|
+
page scale values (26 px top offset, 8 px radius) read from
|
|
31
|
+
[Vaul](https://github.com/emilkowalski/vaul) 1.1.2, provided under the MIT licence.
|
|
32
|
+
Passui does not bundle Vaul; the gesture engine is `@zag-js/drawer`.
|
|
33
|
+
|
|
34
|
+
## MIT License — Vaul
|
|
35
|
+
|
|
36
|
+
Copyright (c) 2023 Emil Kowalski
|
|
37
|
+
|
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
in the Software without restriction, including without limitation the rights
|
|
41
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
42
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
43
|
+
furnished to do so, subject to the following conditions:
|
|
44
|
+
|
|
45
|
+
The above copyright notice and this permission notice shall be included in all
|
|
46
|
+
copies or substantial portions of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as zagAccordion from "@zag-js/accordion";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
export interface AccordionProps extends Omit<zagAccordion.Props, "id" | "ids" | "onValueChange"> {
|
|
4
|
+
onValueChange?: (value: string[]) => void;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Stacked disclosures. Single by default, `multiple` lets several stay open. */
|
|
9
|
+
export declare function Accordion({ onValueChange, children, className, collapsible, ...props }: AccordionProps): import("react").JSX.Element;
|
|
10
|
+
export declare function AccordionItem({ value, disabled, className, ...props }: Omit<ComponentProps<"div">, "value"> & {
|
|
11
|
+
value: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
export declare function AccordionTrigger({ className, children, ...props }: ComponentProps<"button">): import("react").JSX.Element;
|
|
15
|
+
export declare function AccordionContent({ className, children, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "./lib/cx.js";
|
|
3
|
+
import * as zagAccordion from "@zag-js/accordion";
|
|
4
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
5
|
+
import { createContext, useContext, useId } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/accordion.tsx
|
|
8
|
+
const Context = createContext(null);
|
|
9
|
+
const ItemContext = createContext(null);
|
|
10
|
+
function useAccordion() {
|
|
11
|
+
const api = useContext(Context);
|
|
12
|
+
const item = useContext(ItemContext);
|
|
13
|
+
if (!api) throw new Error("Accordion parts must be used inside <Accordion>.");
|
|
14
|
+
return {
|
|
15
|
+
api,
|
|
16
|
+
item
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Stacked disclosures. Single by default, `multiple` lets several stay open. */
|
|
20
|
+
function Accordion({ onValueChange, children, className, collapsible = true, ...props }) {
|
|
21
|
+
const id = useId();
|
|
22
|
+
const service = useMachine(zagAccordion.machine, {
|
|
23
|
+
id,
|
|
24
|
+
collapsible,
|
|
25
|
+
onValueChange: ({ value }) => onValueChange?.(value),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
const api = zagAccordion.connect(service, normalizeProps);
|
|
29
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
30
|
+
value: api,
|
|
31
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
32
|
+
...api.getRootProps(),
|
|
33
|
+
"data-slot": "accordion",
|
|
34
|
+
className: cx("w-full", className),
|
|
35
|
+
children
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function AccordionItem({ value, disabled, className, ...props }) {
|
|
40
|
+
const { api } = useAccordion();
|
|
41
|
+
const item = {
|
|
42
|
+
value,
|
|
43
|
+
disabled
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ jsx(ItemContext.Provider, {
|
|
46
|
+
value: item,
|
|
47
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
48
|
+
...api.getItemProps(item),
|
|
49
|
+
"data-slot": "accordion-item",
|
|
50
|
+
className: cx("border-b border-separator last:border-b-0", className),
|
|
51
|
+
...props
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
56
|
+
const { api, item } = useAccordion();
|
|
57
|
+
if (!item) throw new Error("AccordionTrigger must be inside <AccordionItem>.");
|
|
58
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
59
|
+
className: "m-0 flex",
|
|
60
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
61
|
+
...api.getItemTriggerProps(item),
|
|
62
|
+
"data-slot": "accordion-trigger",
|
|
63
|
+
className: cx("flex flex-1 items-center justify-between gap-4 rounded-xl py-4 text-left text-subheadline font-semibold outline-none transition-colors hover:text-label-secondary focus-visible:ring-2 focus-visible:ring-accent/70 disabled:opacity-40 [&[data-state=open]>svg]:rotate-180", className),
|
|
64
|
+
...props,
|
|
65
|
+
children: [children, /* @__PURE__ */ jsx("svg", {
|
|
66
|
+
viewBox: "0 0 16 16",
|
|
67
|
+
className: "text-label-secondary spring-snappy size-4 shrink-0 transition-transform motion-reduce:transition-none",
|
|
68
|
+
fill: "none",
|
|
69
|
+
stroke: "currentColor",
|
|
70
|
+
strokeWidth: "2",
|
|
71
|
+
strokeLinecap: "round",
|
|
72
|
+
strokeLinejoin: "round",
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
children: /* @__PURE__ */ jsx("path", { d: "m4 6 4 4 4-4" })
|
|
75
|
+
})]
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function AccordionContent({ className, children, ...props }) {
|
|
80
|
+
const { api, item } = useAccordion();
|
|
81
|
+
if (!item) throw new Error("AccordionContent must be inside <AccordionItem>.");
|
|
82
|
+
return /* @__PURE__ */ jsx("div", {
|
|
83
|
+
...api.getItemContentProps(item),
|
|
84
|
+
"data-slot": "accordion-content",
|
|
85
|
+
className: "text-footnote text-label-secondary collapse-motion",
|
|
86
|
+
...props,
|
|
87
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: cx("pb-4", className),
|
|
89
|
+
children
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RenderProp } from "./lib/render.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
import * as dialog from "@zag-js/dialog";
|
|
4
|
+
export interface AlertDialogProps extends Omit<dialog.Props, "id" | "ids" | "role" | "modal" | "closeOnInteractOutside" | "initialFocusEl"> {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A dialog that waits for an answer. An outside press does nothing, Escape
|
|
9
|
+
* presses Cancel, and Cancel receives focus first.
|
|
10
|
+
*/
|
|
11
|
+
export declare function AlertDialog({ children, ...props }: AlertDialogProps): import("react").JSX.Element;
|
|
12
|
+
type PartProps<T extends "button" | "div" | "h2" | "p"> = ComponentProps<T> & {
|
|
13
|
+
/** Render your own element instead of the default one. */
|
|
14
|
+
render?: RenderProp;
|
|
15
|
+
};
|
|
16
|
+
export declare function AlertDialogTrigger({ render, ...props }: PartProps<"button">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
17
|
+
/** Confirms the question and closes. Style it with `className` or `render`. */
|
|
18
|
+
export declare function AlertDialogAction({ render, ...props }: PartProps<"button">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
19
|
+
/** Dismisses the question and closes. It receives focus when the dialog opens. */
|
|
20
|
+
export declare function AlertDialogCancel({ render, ...props }: PartProps<"button">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
21
|
+
export declare function AlertDialogContent({ className, render, ...props }: PartProps<"div">): import("react").JSX.Element | null;
|
|
22
|
+
export declare function AlertDialogHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
23
|
+
export declare function AlertDialogFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
24
|
+
export declare function AlertDialogTitle({ className, ...props }: ComponentProps<"h2">): import("react").JSX.Element;
|
|
25
|
+
export declare function AlertDialogDescription({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
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 { useWaterDrop } from "./lib/water-drop.js";
|
|
7
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
8
|
+
import { createContext, useContext, useId, useRef } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import * as dialog from "@zag-js/dialog";
|
|
11
|
+
// src/components/alert-dialog.tsx
|
|
12
|
+
const Context = createContext(null);
|
|
13
|
+
function useAlertDialog() {
|
|
14
|
+
const value = useContext(Context);
|
|
15
|
+
if (!value) throw new Error("AlertDialog parts must be used inside <AlertDialog>.");
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A dialog that waits for an answer. An outside press does nothing, Escape
|
|
20
|
+
* presses Cancel, and Cancel receives focus first.
|
|
21
|
+
*/
|
|
22
|
+
function AlertDialog({ children, ...props }) {
|
|
23
|
+
const id = useId();
|
|
24
|
+
const cancel = useRef(null);
|
|
25
|
+
const apiRef = useRef(null);
|
|
26
|
+
const service = useMachine(dialog.machine, {
|
|
27
|
+
id,
|
|
28
|
+
...props,
|
|
29
|
+
role: "alertdialog",
|
|
30
|
+
modal: true,
|
|
31
|
+
closeOnInteractOutside: false,
|
|
32
|
+
initialFocusEl: () => cancel.current,
|
|
33
|
+
onEscapeKeyDown(event) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
props.onEscapeKeyDown?.(event);
|
|
36
|
+
if (cancel.current) cancel.current.click();
|
|
37
|
+
else apiRef.current?.setOpen(false);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const api = dialog.connect(service, normalizeProps);
|
|
41
|
+
apiRef.current = api;
|
|
42
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
43
|
+
value: {
|
|
44
|
+
api,
|
|
45
|
+
cancel
|
|
46
|
+
},
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Full bleed hairline action cells, as in iOS alerts. */
|
|
51
|
+
const actionStyles = "h-9.5 px-3 text-footnote outline-none transition spring-snappy hover:bg-fill/50 active:bg-fill/80 focus-visible:bg-fill/60";
|
|
52
|
+
function AlertDialogTrigger({ render, ...props }) {
|
|
53
|
+
const { api } = useAlertDialog();
|
|
54
|
+
return renderPart("button", mergeProps({
|
|
55
|
+
...api.getTriggerProps(),
|
|
56
|
+
"data-slot": "alert-dialog-trigger"
|
|
57
|
+
}, props), render);
|
|
58
|
+
}
|
|
59
|
+
/** Confirms the question and closes. Style it with `className` or `render`. */
|
|
60
|
+
function AlertDialogAction({ render, ...props }) {
|
|
61
|
+
const { api } = useAlertDialog();
|
|
62
|
+
const { id: _id, ...closeProps } = api.getCloseTriggerProps();
|
|
63
|
+
return renderPart("button", mergeProps({
|
|
64
|
+
...closeProps,
|
|
65
|
+
"data-slot": "alert-dialog-action",
|
|
66
|
+
className: actionStyles + " font-semibold text-accent-text"
|
|
67
|
+
}, props), render);
|
|
68
|
+
}
|
|
69
|
+
/** Dismisses the question and closes. It receives focus when the dialog opens. */
|
|
70
|
+
function AlertDialogCancel({ render, ...props }) {
|
|
71
|
+
const { api, cancel } = useAlertDialog();
|
|
72
|
+
return renderPart("button", mergeProps({
|
|
73
|
+
...api.getCloseTriggerProps(),
|
|
74
|
+
ref: cancel,
|
|
75
|
+
"data-slot": "alert-dialog-cancel",
|
|
76
|
+
className: actionStyles
|
|
77
|
+
}, props), render);
|
|
78
|
+
}
|
|
79
|
+
function AlertDialogContent({ className, render, ...props }) {
|
|
80
|
+
const { api } = useAlertDialog();
|
|
81
|
+
const drop = useWaterDrop({
|
|
82
|
+
sourceId: api.getTriggerProps().id,
|
|
83
|
+
material: "glass-menu squircle [--squircle-radius:1.5rem]"
|
|
84
|
+
});
|
|
85
|
+
const { ref, mounted, attrs } = usePresence(api.open, drop);
|
|
86
|
+
if (!mounted) return null;
|
|
87
|
+
const state = {
|
|
88
|
+
...attrs,
|
|
89
|
+
"data-open": api.open ? "" : void 0
|
|
90
|
+
};
|
|
91
|
+
return /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx("div", {
|
|
92
|
+
...api.getBackdropProps(),
|
|
93
|
+
...state,
|
|
94
|
+
hidden: false,
|
|
95
|
+
"data-slot": "alert-dialog-overlay",
|
|
96
|
+
className: "ease-standard fixed inset-0 z-[60] bg-black/30 backdrop-blur-sm transition-opacity duration-(--duration-normal) data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none"
|
|
97
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
98
|
+
...api.getPositionerProps(),
|
|
99
|
+
className: "fixed inset-0 z-[60] flex items-center justify-center p-4",
|
|
100
|
+
children: renderPart("div", mergeProps({
|
|
101
|
+
...api.getContentProps(),
|
|
102
|
+
...state,
|
|
103
|
+
ref,
|
|
104
|
+
hidden: false,
|
|
105
|
+
"data-slot": "alert-dialog-content",
|
|
106
|
+
className: cx("relative grid w-[17.5rem] max-w-[calc(100vw-3rem)] gap-0 overflow-hidden glass-menu squircle morph-reset [--squircle-radius:1.5rem] text-center text-label outline-none transition spring-smooth data-ending-style:scale-[0.88] data-starting-style:scale-[0.88] data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none motion-reduce:data-ending-style:scale-100 motion-reduce:data-starting-style:scale-100", className)
|
|
107
|
+
}, props), render)
|
|
108
|
+
})] });
|
|
109
|
+
}
|
|
110
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
111
|
+
return /* @__PURE__ */ jsx("div", {
|
|
112
|
+
"data-slot": "alert-dialog-header",
|
|
113
|
+
className: cx("flex flex-col items-center gap-1 px-4 pt-5 pb-4", className),
|
|
114
|
+
...props
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
118
|
+
return /* @__PURE__ */ jsx("div", {
|
|
119
|
+
"data-slot": "alert-dialog-footer",
|
|
120
|
+
className: cx("flex divide-x divide-separator border-t border-separator [&>*]:min-w-0 [&>*]:flex-1", className),
|
|
121
|
+
...props
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
125
|
+
const { api } = useAlertDialog();
|
|
126
|
+
return /* @__PURE__ */ jsx("h2", {
|
|
127
|
+
...api.getTitleProps(),
|
|
128
|
+
"data-slot": "alert-dialog-title",
|
|
129
|
+
className: cx("text-headline font-semibold text-label", className),
|
|
130
|
+
...props
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
134
|
+
const { api } = useAlertDialog();
|
|
135
|
+
return /* @__PURE__ */ jsx("p", {
|
|
136
|
+
...api.getDescriptionProps(),
|
|
137
|
+
"data-slot": "alert-dialog-description",
|
|
138
|
+
className: cx("text-footnote text-label-secondary", className),
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger };
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export type AlertVariant = "default" | "destructive";
|
|
3
|
+
export type AlertProps = ComponentProps<"div"> & {
|
|
4
|
+
/** @default "default" */
|
|
5
|
+
variant?: AlertVariant;
|
|
6
|
+
};
|
|
7
|
+
/** An inline message. Put an icon first and it takes its own column. */
|
|
8
|
+
export declare function Alert({ variant, className, ...props }: AlertProps): import("react").JSX.Element;
|
|
9
|
+
export declare function AlertTitle({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
10
|
+
export declare function AlertDescription({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/alert.tsx
|
|
4
|
+
/** An inline message. Put an icon first and it takes its own column. */
|
|
5
|
+
function Alert({ variant = "default", className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
role: "alert",
|
|
8
|
+
"data-slot": "alert",
|
|
9
|
+
"data-variant": variant,
|
|
10
|
+
className: cx("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-2xl bg-fill/60 px-4 py-3 text-footnote has-[>svg]:grid-cols-[1rem_1fr] has-[>svg]:gap-x-3 [&>svg]:mt-0.5 [&>svg]:size-4", variant === "destructive" ? "bg-danger/10 text-danger [&>svg]:text-current" : "text-label [&>svg]:text-label-secondary", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function AlertTitle({ className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
"data-slot": "alert-title",
|
|
17
|
+
className: cx("col-start-2 font-semibold", className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function AlertDescription({ className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
"data-slot": "alert-description",
|
|
24
|
+
className: cx("col-start-2 text-footnote opacity-80", className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
2
|
type AmbientProps = ComponentPropsWithoutRef<"section"> & {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** The image whose colors glow behind the content. */
|
|
4
|
+
src?: string | null;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* Content with its image's colors glowing softly behind it, no card or
|
|
@@ -9,4 +9,4 @@ type AmbientProps = ComponentPropsWithoutRef<"section"> & {
|
|
|
9
9
|
* fades into the page, the way Apple lets a photo light its surroundings.
|
|
10
10
|
*/
|
|
11
11
|
export declare function Ambient({ src, className, children, ...props }: AmbientProps): import("react").JSX.Element;
|
|
12
|
-
export {};
|
|
12
|
+
export {};
|
package/dist/ambient.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/ambient.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Content with its image's colors glowing softly behind it, no card or
|
|
6
|
+
* edge: a blown-up, blurred copy of the image masked into a circle that
|
|
7
|
+
* fades into the page, the way Apple lets a photo light its surroundings.
|
|
8
|
+
*/
|
|
9
|
+
function Ambient({ src, className, children, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
11
|
+
"data-slot": "ambient",
|
|
12
|
+
className: cx("relative isolate", className),
|
|
13
|
+
...props,
|
|
14
|
+
children: [src && /* @__PURE__ */ jsx("img", {
|
|
15
|
+
"aria-hidden": true,
|
|
16
|
+
src,
|
|
17
|
+
alt: "",
|
|
18
|
+
className: cx("pointer-events-none absolute top-[38%] left-1/2 -z-10 size-[min(32rem,100vw)] -translate-x-1/2 -translate-y-1/2", "rounded-full object-cover opacity-20 blur-3xl", "dark:size-[min(20rem,80vw)] dark:opacity-15 dark:blur-2xl", "mask-[radial-gradient(closest-side,black_35%,transparent)]", "animate-in fade-in-0 zoom-in-90 duration-1000")
|
|
19
|
+
}), children]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { Ambient };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
2
|
export type PlatformOS = "ios" | "android" | "macos" | "windows" | "linux" | "unknown";
|
|
3
3
|
export declare function detectPlatform(userAgent: string, platform: string, maxTouchPoints: number): PlatformOS;
|
|
4
4
|
export declare function resolvePlatform(override: string | null, userAgent: string, platform: string, maxTouchPoints: number): PlatformOS;
|
|
5
5
|
export declare function PlatformScript({ nonce }: {
|
|
6
|
-
|
|
6
|
+
nonce?: string;
|
|
7
7
|
}): import("react").JSX.Element;
|
|
8
8
|
export declare function PlatformProvider({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
9
|
-
export declare function usePlatform(): PlatformOS;
|
|
9
|
+
export declare function usePlatform(): PlatformOS;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/appearance/platform.tsx
|
|
4
|
+
const PlatformContext = createContext("unknown");
|
|
5
|
+
function detectPlatform(userAgent, platform, maxTouchPoints) {
|
|
6
|
+
return resolvePlatform(null, userAgent, platform, maxTouchPoints);
|
|
7
|
+
}
|
|
8
|
+
function resolvePlatform(override, userAgent, platform, maxTouchPoints) {
|
|
9
|
+
if (override === "ios" || override === "android" || override === "macos" || override === "windows" || override === "linux" || override === "unknown") return override;
|
|
10
|
+
if (/android/i.test(userAgent)) return "android";
|
|
11
|
+
if (/iPhone|iPad|iPod/i.test(userAgent)) return "ios";
|
|
12
|
+
if (platform === "MacIntel" && maxTouchPoints > 1) return "ios";
|
|
13
|
+
if (/Mac/i.test(platform)) return "macos";
|
|
14
|
+
if (/Win/i.test(platform)) return "windows";
|
|
15
|
+
if (/Linux/i.test(platform)) return "linux";
|
|
16
|
+
return "unknown";
|
|
17
|
+
}
|
|
18
|
+
function initializePlatform(resolve, root, userAgent, platform, maxTouchPoints) {
|
|
19
|
+
root.setAttribute("data-os", resolve(root.getAttribute("data-os"), userAgent, platform, maxTouchPoints));
|
|
20
|
+
}
|
|
21
|
+
function PlatformScript({ nonce }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("script", {
|
|
23
|
+
dangerouslySetInnerHTML: { __html: `(${initializePlatform.toString()})(${resolvePlatform.toString()}, document.documentElement, navigator.userAgent, navigator.platform, navigator.maxTouchPoints)` },
|
|
24
|
+
nonce,
|
|
25
|
+
suppressHydrationWarning: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function PlatformProvider({ children }) {
|
|
29
|
+
const [platform, setPlatform] = useState("unknown");
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const resolved = resolvePlatform(document.documentElement.getAttribute("data-os"), navigator.userAgent, navigator.platform, navigator.maxTouchPoints);
|
|
32
|
+
document.documentElement.setAttribute("data-os", resolved);
|
|
33
|
+
setPlatform(resolved);
|
|
34
|
+
}, []);
|
|
35
|
+
return /* @__PURE__ */ jsx(PlatformContext.Provider, {
|
|
36
|
+
value: platform,
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function usePlatform() {
|
|
41
|
+
return useContext(PlatformContext);
|
|
42
|
+
}
|
|
43
|
+
export { PlatformProvider, PlatformScript, detectPlatform, resolvePlatform, usePlatform };
|