@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,51 +1,35 @@
|
|
|
1
|
+
import { viewportMetrics } from "./viewport/viewport-metrics.js";
|
|
1
2
|
import { useLayoutEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import type { ViewportMetrics } from "./viewport/types";
|
|
4
|
-
export type { ViewportMetrics } from "./viewport/types";
|
|
5
|
-
|
|
3
|
+
// src/hooks/use-visual-viewport.ts
|
|
6
4
|
/** Measures once per frame, including Android resize and Safari viewport panning. */
|
|
7
|
-
|
|
8
|
-
const [metrics, setMetrics] = useState
|
|
5
|
+
function useVisualViewport() {
|
|
6
|
+
const [metrics, setMetrics] = useState(null);
|
|
9
7
|
useLayoutEffect(() => {
|
|
10
8
|
const viewport = window.visualViewport;
|
|
11
9
|
let baseline = {
|
|
12
10
|
width: window.innerWidth,
|
|
13
|
-
height: window.innerHeight
|
|
11
|
+
height: window.innerHeight
|
|
14
12
|
};
|
|
15
13
|
let frame = 0;
|
|
16
14
|
const measure = () => {
|
|
17
15
|
cancelAnimationFrame(frame);
|
|
18
16
|
frame = requestAnimationFrame(() => {
|
|
19
|
-
const
|
|
20
|
-
const editing = !!active?.matches(
|
|
21
|
-
"input:not([type=button]):not([type=checkbox]):not([type=radio]), textarea, [contenteditable=true]",
|
|
22
|
-
);
|
|
17
|
+
const editing = !!document.activeElement?.matches("input:not([type=button]):not([type=checkbox]):not([type=radio]), textarea, [contenteditable=true]");
|
|
23
18
|
const width = viewport?.width ?? window.innerWidth;
|
|
24
19
|
const height = viewport?.height ?? window.innerHeight;
|
|
25
|
-
if (Math.abs(baseline.width - width) > 80 || !editing)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
baseline,
|
|
40
|
-
);
|
|
41
|
-
setMetrics((previous) =>
|
|
42
|
-
previous &&
|
|
43
|
-
Object.entries(next).every(
|
|
44
|
-
([key, value]) => previous[key as keyof ViewportMetrics] === value,
|
|
45
|
-
)
|
|
46
|
-
? previous
|
|
47
|
-
: next,
|
|
48
|
-
);
|
|
20
|
+
if (Math.abs(baseline.width - width) > 80 || !editing) baseline = {
|
|
21
|
+
width,
|
|
22
|
+
height: window.innerHeight
|
|
23
|
+
};
|
|
24
|
+
const next = viewportMetrics({
|
|
25
|
+
width,
|
|
26
|
+
height,
|
|
27
|
+
layoutHeight: window.innerHeight,
|
|
28
|
+
top: viewport?.offsetTop ?? 0,
|
|
29
|
+
left: viewport?.offsetLeft ?? 0,
|
|
30
|
+
editing
|
|
31
|
+
}, baseline);
|
|
32
|
+
setMetrics((previous) => previous && Object.entries(next).every(([key, value]) => previous[key] === value) ? previous : next);
|
|
49
33
|
});
|
|
50
34
|
};
|
|
51
35
|
measure();
|
|
@@ -65,3 +49,4 @@ export function useVisualViewport(): ViewportMetrics | null {
|
|
|
65
49
|
}, []);
|
|
66
50
|
return metrics;
|
|
67
51
|
}
|
|
52
|
+
export { useVisualViewport };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/hooks/viewport/viewport-metrics.ts
|
|
2
|
+
/** A resized WebView and Safari's overlaid keyboard share one visible rectangle. */
|
|
3
|
+
function viewportMetrics(input, baseline) {
|
|
4
|
+
const visibleHeight = Math.min(input.height, Math.max(0, input.layoutHeight - input.top));
|
|
5
|
+
return {
|
|
6
|
+
width: input.width,
|
|
7
|
+
height: visibleHeight,
|
|
8
|
+
top: input.top,
|
|
9
|
+
left: input.left,
|
|
10
|
+
keyboardOpen: input.editing && baseline.height - visibleHeight > 120
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { viewportMetrics };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { PlatformOS, PlatformProvider, PlatformScript, detectPlatform, resolvePlatform, usePlatform } from "./appearance/platform.js";
|
|
2
|
+
import { Attribute, SystemTheme, ThemeProvider, ThemeProviderProps, UseThemeProps, script, useTheme } from "./appearance/theme.js";
|
|
3
|
+
import "./appearance.js";
|
|
4
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionProps, AccordionTrigger } from "./accordion.js";
|
|
5
|
+
import { Alert, AlertDescription, AlertProps, AlertTitle, AlertVariant } from "./alert.js";
|
|
6
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogProps, AlertDialogTitle, AlertDialogTrigger } from "./alert-dialog.js";
|
|
7
|
+
import { AspectRatio, AspectRatioProps } from "./aspect-ratio.js";
|
|
8
|
+
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
9
|
+
import { Badge, BadgeProps, BadgeVariant } from "./badge.js";
|
|
10
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./breadcrumb.js";
|
|
11
|
+
import { Button, ButtonProps, ButtonSize, ButtonStyleProps, ButtonVariant, buttonVariants } from "./button.js";
|
|
12
|
+
import { ButtonGroup } from "./button-group.js";
|
|
13
|
+
import { Calendar, CalendarProps, DateRange } from "./calendar.js";
|
|
14
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js";
|
|
15
|
+
import { Chart, ChartProps, ChartSeries, ChartType } from "./chart.js";
|
|
16
|
+
import { Checkbox, CheckboxProps } from "./checkbox.js";
|
|
17
|
+
import { CodeBlock, CodeBlockProps, CodeBlockSize } from "./code-block.js";
|
|
18
|
+
import { Collapsible, CollapsibleContent, CollapsibleProps, CollapsibleTrigger } from "./collapsible.js";
|
|
19
|
+
import { Combobox, ComboboxItem, ComboboxProps } from "./combobox.js";
|
|
20
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandItemProps, CommandList, CommandShortcut } from "./command.js";
|
|
21
|
+
import "./context-menu.js";
|
|
22
|
+
import { Conversation, ConversationMessage, ConversationSize } from "./conversation.js";
|
|
23
|
+
import { DateTimePicker, DateTimePickerProps } from "./date-time-picker.js";
|
|
24
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogProps, DialogTitle, DialogTrigger } from "./dialog.js";
|
|
25
|
+
import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHandle, DrawerHeader, DrawerProps, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
26
|
+
import { ContextMenu, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
27
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
|
|
28
|
+
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldProps } from "./field.js";
|
|
29
|
+
import { Input, inputStyles } from "./input.js";
|
|
30
|
+
import { InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "./input-group.js";
|
|
31
|
+
import { InputOTP, InputOTPProps } from "./input-otp.js";
|
|
32
|
+
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemGroupProps, ItemMedia, ItemMediaProps, ItemProps, ItemSize, ItemTitle } from "./item.js";
|
|
33
|
+
import { Kbd, KbdGroup } from "./kbd.js";
|
|
34
|
+
import { Label } from "./label.js";
|
|
35
|
+
import { LabeledContent, LabeledContentProps, LabeledContentSize } from "./labeled-content.js";
|
|
36
|
+
import { List, ListItem, ListItemProps, ListSection, ListSectionProps } from "./list.js";
|
|
37
|
+
import { Marker, MarkerProps, MarkerVariant } from "./marker.js";
|
|
38
|
+
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationLinkProps, PaginationNext, PaginationPrevious, PaginationSize, PaginationTone, pageRange } from "./pagination.js";
|
|
39
|
+
import { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverProps, PopoverTitle, PopoverTrigger } from "./popover.js";
|
|
40
|
+
import { Progress, ProgressProps } from "./progress.js";
|
|
41
|
+
import { Answers, Question, QuestionOption, Questionnaire, QuestionnaireProps } from "./questionnaire.js";
|
|
42
|
+
import { RadioGroup, RadioGroupItem, RadioGroupItemProps, RadioGroupProps } from "./radio-group.js";
|
|
43
|
+
import { SearchField, SearchFieldProps, SearchFieldSize } from "./search-field.js";
|
|
44
|
+
import { SegmentedControl, SegmentedControlProps, SegmentedOption } from "./segmented-control.js";
|
|
45
|
+
import { Select, SelectItem, SelectProps } from "./select.js";
|
|
46
|
+
import { Separator, SeparatorProps } from "./separator.js";
|
|
47
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetProps, SheetSide, SheetTitle, SheetTrigger } from "./sheet.js";
|
|
48
|
+
import { Sidebar, SidebarGroup, SidebarGroupLabel, SidebarGroupLabelProps, SidebarMenu, SidebarMenuButton, SidebarMenuButtonProps, SidebarMenuItem, SidebarSize } from "./sidebar.js";
|
|
49
|
+
import { Skeleton } from "./skeleton.js";
|
|
50
|
+
import { Slider, SliderProps } from "./slider.js";
|
|
51
|
+
import { SloshSlider, SloshSliderProps, SloshSliderSize } from "./slosh-slider.js";
|
|
52
|
+
import { Spinner } from "./spinner.js";
|
|
53
|
+
import { StatTileTone } from "./stat-tile.js";
|
|
54
|
+
import { Stepper, StepperProps, StepperSize } from "./stepper.js";
|
|
55
|
+
import { SwatchPicker, SwatchPickerOption, SwatchPickerProps, SwatchPickerSize } from "./swatch-picker.js";
|
|
56
|
+
import { Switch, SwitchProps } from "./switch.js";
|
|
57
|
+
import { TabBar, TabBarItem, TabBarItemProps, TabBarProps } from "./tab-bar.js";
|
|
58
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSize } from "./table.js";
|
|
59
|
+
import { Tabs, TabsContent, TabsList, TabsProps, TabsTone, TabsTrigger, TabsVariant } from "./tabs.js";
|
|
60
|
+
import { Text, TextElement, TextProps, TextSize, TextTone, TextWeight } from "./text.js";
|
|
61
|
+
import { Textarea } from "./textarea.js";
|
|
62
|
+
import { Toast, ToastAction, ToastInput, ToastOptions, ToastSize, ToastTone, toast } from "./components/toast/toast-store.js";
|
|
63
|
+
import { Toaster } from "./components/toast/toaster.js";
|
|
64
|
+
import { Toggle, ToggleProps, ToggleSize, ToggleVariant, toggleVariants } from "./toggle.js";
|
|
65
|
+
import { ToggleGroup, ToggleGroupItem, ToggleGroupItemProps, ToggleGroupProps } from "./toggle-group.js";
|
|
66
|
+
import { Tooltip, TooltipContent, TooltipProps, TooltipTrigger } from "./tooltip.js";
|
|
67
|
+
import { Trace, TraceItem, TraceItemProps, TraceStatus } from "./trace.js";
|
|
68
|
+
import { WakeSlider, WakeSliderProps, WakeSliderSize } from "./wake-slider.js";
|
|
69
|
+
import { useAnchoredPlacement } from "./hooks/use-anchored-placement.js";
|
|
70
|
+
import { useDismiss } from "./use-dismiss.js";
|
|
71
|
+
import { Breakpoint, BreakpointQuery, MediaQueryInput, PointerPrecision, useIsMobile, useMediaQuery } from "./use-media-query.js";
|
|
72
|
+
import { useMinimizeOnScroll } from "./hooks/use-minimize-on-scroll.js";
|
|
73
|
+
import { useOS } from "./use-os.js";
|
|
74
|
+
import { useVisualViewport } from "./hooks/use-visual-viewport.js";
|
|
75
|
+
import { ViewportMetrics } from "./hooks/viewport/types.js";
|
|
76
|
+
import { AnchoredPlacement, PlacementFrame, placeAnchored, placeInViewport } from "./lib/anchored-placement.js";
|
|
77
|
+
import { cn } from "./cn.js";
|
|
78
|
+
import { copyText } from "./clipboard.js";
|
|
79
|
+
import { FLOATING_LAYER, registerFloatingLayer } from "./lib/floating-layers.js";
|
|
80
|
+
import { HapticKind, haptic, setHapticPlayer } from "./lib/haptics.js";
|
|
81
|
+
import { ScreenEdges, screenEdges } from "./lib/screen-edges.js";
|
|
82
|
+
import { FloatingPanelSide, contentCrossfade, floatingPanelMotion, fluidCollapse, fluidOvershoot, popoverMotion, riseMotion, spring, zoomReveal } from "./motion/transitions.js";
|
|
83
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
84
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionProps, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogProps, AlertDialogTitle, AlertDialogTrigger, AlertProps, AlertTitle, AlertVariant, AnchoredPlacement, AnimatePresence, Answers, AspectRatio, AspectRatioProps, Attribute, Avatar, AvatarFallback, AvatarImage, Badge, BadgeProps, BadgeVariant, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Breakpoint, BreakpointQuery, Button, ButtonGroup, ButtonProps, ButtonSize, ButtonStyleProps, ButtonVariant, Calendar, CalendarProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chart, ChartProps, ChartSeries, ChartType, Checkbox, CheckboxProps, CodeBlock, CodeBlockProps, CodeBlockSize, Collapsible, CollapsibleContent, CollapsibleProps, CollapsibleTrigger, Combobox, ComboboxItem, ComboboxProps, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandItemProps, CommandList, CommandShortcut, ContextMenu, DropdownMenuCheckboxItem as ContextMenuCheckboxItem, DropdownMenuContent as ContextMenuContent, DropdownMenuGroup as ContextMenuGroup, DropdownMenuItem as ContextMenuItem, DropdownMenuLabel as ContextMenuLabel, DropdownMenuRadioGroup as ContextMenuRadioGroup, DropdownMenuRadioItem as ContextMenuRadioItem, DropdownMenuSeparator as ContextMenuSeparator, DropdownMenuShortcut as ContextMenuShortcut, DropdownMenuSub as ContextMenuSub, DropdownMenuSubContent as ContextMenuSubContent, DropdownMenuSubTrigger as ContextMenuSubTrigger, ContextMenuTrigger, Conversation, ConversationMessage, ConversationSize, DateRange, DateTimePicker, DateTimePickerProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogProps, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHandle, DrawerHeader, DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemProps, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuProps, DropdownMenuRadioGroup, DropdownMenuRadioGroupProps, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FLOATING_LAYER, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldProps, FloatingPanelSide, HapticKind, Input, InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPProps, Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemGroupProps, ItemMedia, ItemMediaProps, ItemProps, ItemSize, ItemTitle, Kbd, KbdGroup, Label, LabeledContent, LabeledContentProps, LabeledContentSize, List, ListItem, ListItemProps, ListSection, ListSectionProps, Marker, MarkerProps, MarkerVariant, MediaQueryInput, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationLinkProps, PaginationNext, PaginationPrevious, PaginationSize, PaginationTone, PlacementFrame, PlatformOS, PlatformProvider, PlatformScript, PointerPrecision, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverProps, PopoverTitle, PopoverTrigger, Progress, ProgressProps, Question, QuestionOption, Questionnaire, QuestionnaireProps, RadioGroup, RadioGroupItem, RadioGroupItemProps, RadioGroupProps, ScreenEdges, SearchField, SearchFieldProps, SearchFieldSize, SegmentedControl, SegmentedControlProps, SegmentedOption, Select, SelectItem, SelectProps, Separator, SeparatorProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetProps, SheetSide, SheetTitle, SheetTrigger, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarGroupLabelProps, SidebarMenu, SidebarMenuButton, SidebarMenuButtonProps, SidebarMenuItem, SidebarSize, Skeleton, Slider, SliderProps, SloshSlider, SloshSliderProps, SloshSliderSize, Spinner, type StatTileTone, Stepper, StepperProps, StepperSize, SwatchPicker, SwatchPickerOption, SwatchPickerProps, SwatchPickerSize, Switch, SwitchProps, SystemTheme, TabBar, TabBarItem, TabBarItemProps, TabBarProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSize, Tabs, TabsContent, TabsList, TabsProps, TabsTone, TabsTrigger, TabsVariant, Text, TextElement, TextProps, TextSize, TextTone, TextWeight, Textarea, ThemeProvider, ThemeProviderProps, type Toast, type ToastAction, type ToastInput, type ToastOptions, type ToastSize, type ToastTone, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps, ToggleGroupProps, ToggleProps, ToggleSize, ToggleVariant, Tooltip, TooltipContent, TooltipProps, TooltipTrigger, Trace, TraceItem, TraceItemProps, TraceStatus, UseThemeProps, type ViewportMetrics, WakeSlider, WakeSliderProps, WakeSliderSize, buttonVariants, cn, contentCrossfade, copyText, detectPlatform, floatingPanelMotion, fluidCollapse, fluidOvershoot, haptic, inputStyles, motion, pageRange, placeAnchored, placeInViewport, popoverMotion, registerFloatingLayer, resolvePlatform, riseMotion, screenEdges, script, setHapticPlayer, spring, toast, toggleVariants, useAnchoredPlacement, useDismiss, useIsMobile, useMediaQuery, useMinimizeOnScroll, useOS, usePlatform, useTheme, useVisualViewport, zoomReveal };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./accordion.js";
|
|
2
|
+
import { Alert, AlertDescription, AlertTitle } from "./alert.js";
|
|
3
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "./alert-dialog.js";
|
|
4
|
+
import { PlatformProvider, PlatformScript, detectPlatform, resolvePlatform, usePlatform } from "./appearance/platform.js";
|
|
5
|
+
import { ThemeProvider, script, useTheme } from "./appearance/theme.js";
|
|
6
|
+
import { AspectRatio } from "./aspect-ratio.js";
|
|
7
|
+
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
8
|
+
import { Badge } from "./badge.js";
|
|
9
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./breadcrumb.js";
|
|
10
|
+
import { Button, buttonVariants } from "./button.js";
|
|
11
|
+
import { ButtonGroup } from "./button-group.js";
|
|
12
|
+
import { Calendar } from "./calendar.js";
|
|
13
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js";
|
|
14
|
+
import { Chart } from "./chart.js";
|
|
15
|
+
import { Checkbox } from "./checkbox.js";
|
|
16
|
+
import { CodeBlock } from "./code-block.js";
|
|
17
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
|
|
18
|
+
import { Combobox } from "./combobox.js";
|
|
19
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut } from "./command.js";
|
|
20
|
+
import { Conversation } from "./conversation.js";
|
|
21
|
+
import { DateTimePicker } from "./date-time-picker.js";
|
|
22
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./dialog.js";
|
|
23
|
+
import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHandle, DrawerHeader, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
24
|
+
import { ContextMenu, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
25
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
|
|
26
|
+
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from "./field.js";
|
|
27
|
+
import { Input, inputStyles } from "./input.js";
|
|
28
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "./input-group.js";
|
|
29
|
+
import { InputOTP } from "./input-otp.js";
|
|
30
|
+
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from "./item.js";
|
|
31
|
+
import { Kbd, KbdGroup } from "./kbd.js";
|
|
32
|
+
import { Label } from "./label.js";
|
|
33
|
+
import { LabeledContent } from "./labeled-content.js";
|
|
34
|
+
import { List, ListItem, ListSection } from "./list.js";
|
|
35
|
+
import { Marker } from "./marker.js";
|
|
36
|
+
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, pageRange } from "./pagination.js";
|
|
37
|
+
import { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "./popover.js";
|
|
38
|
+
import { Progress } from "./progress.js";
|
|
39
|
+
import { Questionnaire } from "./questionnaire.js";
|
|
40
|
+
import { RadioGroup, RadioGroupItem } from "./radio-group.js";
|
|
41
|
+
import { SearchField } from "./search-field.js";
|
|
42
|
+
import { SegmentedControl } from "./segmented-control.js";
|
|
43
|
+
import { Select } from "./select.js";
|
|
44
|
+
import { Separator } from "./separator.js";
|
|
45
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./sheet.js";
|
|
46
|
+
import { Sidebar, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "./sidebar.js";
|
|
47
|
+
import { Skeleton } from "./skeleton.js";
|
|
48
|
+
import { Slider } from "./slider.js";
|
|
49
|
+
import { SloshSlider } from "./slosh-slider.js";
|
|
50
|
+
import { Spinner } from "./spinner.js";
|
|
51
|
+
import { Stepper } from "./stepper.js";
|
|
52
|
+
import { SwatchPicker } from "./swatch-picker.js";
|
|
53
|
+
import { Switch } from "./switch.js";
|
|
54
|
+
import { TabBar, TabBarItem } from "./tab-bar.js";
|
|
55
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./table.js";
|
|
56
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.js";
|
|
57
|
+
import { Text } from "./text.js";
|
|
58
|
+
import { Textarea } from "./textarea.js";
|
|
59
|
+
import { Toggle, toggleVariants } from "./toggle.js";
|
|
60
|
+
import { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
|
61
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
62
|
+
import { Trace, TraceItem } from "./trace.js";
|
|
63
|
+
import { WakeSlider } from "./wake-slider.js";
|
|
64
|
+
import { useAnchoredPlacement } from "./hooks/use-anchored-placement.js";
|
|
65
|
+
import { toast } from "./components/toast/toast-store.js";
|
|
66
|
+
import { useDismiss } from "./use-dismiss.js";
|
|
67
|
+
import { Toaster } from "./components/toast/toaster.js";
|
|
68
|
+
import { useIsMobile, useMediaQuery } from "./use-media-query.js";
|
|
69
|
+
import { useMinimizeOnScroll } from "./hooks/use-minimize-on-scroll.js";
|
|
70
|
+
import { useOS } from "./use-os.js";
|
|
71
|
+
import { useVisualViewport } from "./hooks/use-visual-viewport.js";
|
|
72
|
+
import { placeAnchored, placeInViewport } from "./lib/anchored-placement.js";
|
|
73
|
+
import { cn } from "./cn.js";
|
|
74
|
+
import { copyText } from "./clipboard.js";
|
|
75
|
+
import { FLOATING_LAYER, registerFloatingLayer } from "./lib/floating-layers.js";
|
|
76
|
+
import { haptic, setHapticPlayer } from "./lib/haptics.js";
|
|
77
|
+
import { screenEdges } from "./lib/screen-edges.js";
|
|
78
|
+
import { contentCrossfade, floatingPanelMotion, fluidCollapse, fluidOvershoot, popoverMotion, riseMotion, spring, zoomReveal } from "./motion/transitions.js";
|
|
79
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
80
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnimatePresence, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chart, Checkbox, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut, ContextMenu, DropdownMenuCheckboxItem as ContextMenuCheckboxItem, DropdownMenuContent as ContextMenuContent, DropdownMenuGroup as ContextMenuGroup, DropdownMenuItem as ContextMenuItem, DropdownMenuLabel as ContextMenuLabel, DropdownMenuRadioGroup as ContextMenuRadioGroup, DropdownMenuRadioItem as ContextMenuRadioItem, DropdownMenuSeparator as ContextMenuSeparator, DropdownMenuShortcut as ContextMenuShortcut, DropdownMenuSub as ContextMenuSub, DropdownMenuSubContent as ContextMenuSubContent, DropdownMenuSubTrigger as ContextMenuSubTrigger, ContextMenuTrigger, Conversation, DateTimePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHandle, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FLOATING_LAYER, Field, FieldDescription, FieldError, FieldGroup, FieldLabel, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle, Kbd, KbdGroup, Label, LabeledContent, List, ListItem, ListSection, Marker, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PlatformProvider, PlatformScript, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, Questionnaire, RadioGroup, RadioGroupItem, SearchField, SegmentedControl, Select, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Skeleton, Slider, SloshSlider, Spinner, Stepper, SwatchPicker, Switch, TabBar, TabBarItem, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipTrigger, Trace, TraceItem, WakeSlider, buttonVariants, cn, contentCrossfade, copyText, detectPlatform, floatingPanelMotion, fluidCollapse, fluidOvershoot, haptic, inputStyles, motion, pageRange, placeAnchored, placeInViewport, popoverMotion, registerFloatingLayer, resolvePlatform, riseMotion, screenEdges, script, setHapticPlayer, spring, toast, toggleVariants, useAnchoredPlacement, useDismiss, useIsMobile, useMediaQuery, useMinimizeOnScroll, useOS, usePlatform, useTheme, useVisualViewport, zoomReveal };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ButtonProps } from "./button.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
/** Wraps an input with leading or trailing addons. The group draws the surface and focus ring. */
|
|
4
|
+
export declare function InputGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
5
|
+
/** The input inside a group: no surface of its own. */
|
|
6
|
+
export declare function InputGroupInput({ className, ...props }: ComponentProps<"input">): import("react").JSX.Element;
|
|
7
|
+
export type InputGroupAddonProps = ComponentProps<"div"> & {
|
|
8
|
+
/** `block-start` and `block-end` span the full width above or below the field. @default "start" */
|
|
9
|
+
align?: "start" | "end" | "block-start" | "block-end";
|
|
10
|
+
};
|
|
11
|
+
export declare function InputGroupAddon({ align, className, ...props }: InputGroupAddonProps): import("react").JSX.Element;
|
|
12
|
+
/** Plain text beside the field, such as a protocol, a unit or a count. */
|
|
13
|
+
export declare function InputGroupText({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
14
|
+
/** A compact button inside the group, ghost by default. */
|
|
15
|
+
export declare function InputGroupButton({ variant, size, ...props }: ButtonProps): import("react").JSX.Element;
|
|
16
|
+
/** A growing textarea inside the group, with no surface of its own. */
|
|
17
|
+
export declare function InputGroupTextarea({ className, ...props }: ComponentProps<"textarea">): import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/input-group.tsx
|
|
5
|
+
/** Wraps an input with leading or trailing addons. The group draws the surface and focus ring. */
|
|
6
|
+
function InputGroup({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
role: "group",
|
|
9
|
+
"data-slot": "input-group",
|
|
10
|
+
className: cx("control-field flex h-8.5 w-full min-w-0 items-center gap-2 rounded-xl px-2.5 text-footnote has-[[data-align^=block]]:h-auto has-[[data-align^=block]]:flex-col has-[[data-align^=block]]:items-stretch has-[textarea]:h-auto has-[textarea]:flex-wrap has-[:disabled]:opacity-40 has-[[aria-invalid=true]]:shadow-[inset_0_0_0_1.5px_var(--color-danger)]", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** The input inside a group: no surface of its own. */
|
|
15
|
+
function InputGroupInput({ className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("input", {
|
|
17
|
+
"data-slot": "input-group-input",
|
|
18
|
+
className: cx("h-full min-w-0 flex-1 bg-transparent text-label outline-none placeholder:text-label-tertiary", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function InputGroupAddon({ align = "start", className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx("div", {
|
|
24
|
+
"data-slot": "input-group-addon",
|
|
25
|
+
"data-align": align,
|
|
26
|
+
className: cx("flex shrink-0 items-center gap-1 text-label-secondary data-[align=end]:order-last data-[align=block-start]:order-first data-[align=block-start]:w-full data-[align=block-start]:justify-between data-[align=block-start]:pt-2 data-[align=block-end]:order-last data-[align=block-end]:w-full data-[align=block-end]:justify-between data-[align=block-end]:pb-2 [&_svg:not([class*='size-'])]:size-3.5", className),
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Plain text beside the field, such as a protocol, a unit or a count. */
|
|
31
|
+
function InputGroupText({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("span", {
|
|
33
|
+
"data-slot": "input-group-text",
|
|
34
|
+
className: cx("text-footnote text-label-secondary whitespace-nowrap", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** A compact button inside the group, ghost by default. */
|
|
39
|
+
function InputGroupButton({ variant = "ghost", size = "xs", ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
"data-slot": "input-group-button",
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** A growing textarea inside the group, with no surface of its own. */
|
|
48
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
50
|
+
"data-slot": "input-group-textarea",
|
|
51
|
+
className: cx("field-sizing-content min-h-16 w-full flex-1 resize-none bg-transparent py-2 text-label outline-none placeholder:text-label-tertiary", className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as pin from "@zag-js/pin-input";
|
|
2
|
+
export interface InputOTPProps extends Omit<pin.Props, "id" | "ids" | "value" | "defaultValue" | "onValueChange" | "onValueComplete"> {
|
|
3
|
+
/** Number of slots. @default 6 */
|
|
4
|
+
length?: number;
|
|
5
|
+
/** The code so far, as a string. */
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
|
+
onComplete?: (value: string) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A one time code field with one box per character. Paste and autofill fill every box. */
|
|
13
|
+
export declare function InputOTP({ length, value, defaultValue, onValueChange, onComplete, className, ...props }: InputOTPProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "./lib/cx.js";
|
|
3
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as pin from "@zag-js/pin-input";
|
|
7
|
+
// src/components/input-otp.tsx
|
|
8
|
+
const split = (v, length) => v === void 0 ? void 0 : Array.from({ length }, (_, i) => v[i] ?? "");
|
|
9
|
+
/** A one time code field with one box per character. Paste and autofill fill every box. */
|
|
10
|
+
function InputOTP({ length = 6, value, defaultValue, onValueChange, onComplete, className, ...props }) {
|
|
11
|
+
const id = useId();
|
|
12
|
+
const service = useMachine(pin.machine, {
|
|
13
|
+
id,
|
|
14
|
+
otp: true,
|
|
15
|
+
value: split(value, length),
|
|
16
|
+
defaultValue: split(defaultValue, length) ?? Array.from({ length }, () => ""),
|
|
17
|
+
onValueChange: ({ valueAsString }) => onValueChange?.(valueAsString),
|
|
18
|
+
onValueComplete: ({ valueAsString }) => onComplete?.(valueAsString),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
const api = pin.connect(service, normalizeProps);
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
...api.getRootProps(),
|
|
24
|
+
"data-slot": "input-otp",
|
|
25
|
+
className: cx("flex items-center gap-2", className),
|
|
26
|
+
children: [/* @__PURE__ */ jsx("input", { ...api.getHiddenInputProps() }), /* @__PURE__ */ jsx("div", {
|
|
27
|
+
...api.getControlProps(),
|
|
28
|
+
className: "flex gap-2",
|
|
29
|
+
children: Array.from({ length }, (_, index) => /* @__PURE__ */ jsx("input", {
|
|
30
|
+
...api.getInputProps({ index }),
|
|
31
|
+
className: "bg-fill/60 text-headline text-label focus:ring-accent/70 aria-invalid:ring-danger/70 size-9.5 rounded-xl text-center font-semibold transition outline-none focus:ring-2 disabled:opacity-40 aria-invalid:ring-2"
|
|
32
|
+
}, index))
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { InputOTP };
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export declare const inputStyles = "control-field h-8.5 w-full min-w-0 rounded-xl px-3 text-footnote text-label placeholder:text-label-tertiary disabled:pointer-events-none disabled:opacity-40 aria-invalid:shadow-[inset_0_0_0_1.5px_var(--color-danger)] file:border-0 file:bg-transparent file:text-subheadline file:font-medium motion-reduce:transition-none";
|
|
3
|
+
/** A native text input. */
|
|
4
|
+
export declare function Input({ className, type, ...props }: ComponentProps<"input">): import("react").JSX.Element;
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/input.tsx
|
|
4
|
+
const inputStyles = "control-field h-8.5 w-full min-w-0 rounded-xl px-3 text-footnote text-label placeholder:text-label-tertiary disabled:pointer-events-none disabled:opacity-40 aria-invalid:shadow-[inset_0_0_0_1.5px_var(--color-danger)] file:border-0 file:bg-transparent file:text-subheadline file:font-medium motion-reduce:transition-none";
|
|
5
|
+
/** A native text input. */
|
|
6
|
+
function Input({ className, type = "text", ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("input", {
|
|
8
|
+
type,
|
|
9
|
+
"data-slot": "input",
|
|
10
|
+
className: cx(inputStyles, className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { Input, inputStyles };
|
package/dist/item.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RenderProp } from "./lib/render.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
/** Row height and text scale for a whole group: `sm` is dense, `lg` is roomy. */
|
|
4
|
+
export type ItemSize = "sm" | "md" | "lg";
|
|
5
|
+
export interface ItemGroupProps extends Omit<ComponentProps<"section">, "title"> {
|
|
6
|
+
/** Optional group heading, which also names the list for assistive technology. */
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
/** Supporting text below the grouped rows. */
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
/** Row height, title and footer scale. @default "md" */
|
|
11
|
+
size?: ItemSize;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A titled, inset group of rows with a footer note, as in iOS Settings. Rows
|
|
15
|
+
* share one rounded plate with hairlines between them.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ItemGroup({ title, footer, size, className, children, ...props }: ItemGroupProps): import("react").JSX.Element;
|
|
18
|
+
export interface ItemProps extends Omit<ComponentProps<"div">, "children"> {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** Shows the disclosure chevron, for rows that open something. */
|
|
21
|
+
chevron?: boolean;
|
|
22
|
+
/** Makes the whole row your own element, such as a router link or a button. */
|
|
23
|
+
render?: RenderProp;
|
|
24
|
+
/** Content revealed under the row, such as a form. The row becomes its toggle. */
|
|
25
|
+
panel?: ReactNode;
|
|
26
|
+
/** Whether the panel is open, when you control it. */
|
|
27
|
+
open?: boolean;
|
|
28
|
+
/** Whether the panel starts open. @default false */
|
|
29
|
+
defaultOpen?: boolean;
|
|
30
|
+
onOpenChange?: (open: boolean) => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One row. Compose it from `ItemMedia`, `ItemContent` and `ItemActions`. With
|
|
34
|
+
* `render` the whole row presses like iOS; with `panel` it opens to reveal
|
|
35
|
+
* content, such as inputs, under the row.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Item({ chevron, render, panel, open, defaultOpen, onOpenChange, className, children, ...props }: ItemProps): import("react").JSX.Element;
|
|
38
|
+
export interface ItemMediaProps extends ComponentProps<"span"> {
|
|
39
|
+
/** `icon` is a small accent glyph; `image` is a rounded thumbnail. @default "icon" */
|
|
40
|
+
variant?: "icon" | "image";
|
|
41
|
+
}
|
|
42
|
+
/** The icon or image at the start of a row. The hairline insets past it. */
|
|
43
|
+
export declare function ItemMedia({ variant, className, ...props }: ItemMediaProps): import("react").JSX.Element;
|
|
44
|
+
/** Holds the title and description, taking the room the media and actions leave. */
|
|
45
|
+
export declare function ItemContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
46
|
+
export declare function ItemTitle({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
47
|
+
export declare function ItemDescription({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
48
|
+
/** A value, switch, badge or button at the end of a row. */
|
|
49
|
+
export declare function ItemActions({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
package/dist/item.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { mergeProps, renderPart } from "./lib/render.js";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/item.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A titled, inset group of rows with a footer note, as in iOS Settings. Rows
|
|
8
|
+
* share one rounded plate with hairlines between them.
|
|
9
|
+
*/
|
|
10
|
+
function ItemGroup({ title, footer, size = "md", className, children, ...props }) {
|
|
11
|
+
const id = useId();
|
|
12
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
13
|
+
"data-slot": "item-group",
|
|
14
|
+
"data-size": size,
|
|
15
|
+
className: cx("group/item-group flex flex-col gap-1.5", className),
|
|
16
|
+
...props,
|
|
17
|
+
children: [
|
|
18
|
+
title ? /* @__PURE__ */ jsx("h3", {
|
|
19
|
+
id: `${id}-title`,
|
|
20
|
+
className: "text-footnote text-label-secondary group-data-[size=lg]/item-group:text-subheadline group-data-[size=sm]/item-group:text-caption m-0 px-4 font-normal",
|
|
21
|
+
children: title
|
|
22
|
+
}) : null,
|
|
23
|
+
/* @__PURE__ */ jsx("div", {
|
|
24
|
+
role: "list",
|
|
25
|
+
"aria-labelledby": title ? `${id}-title` : void 0,
|
|
26
|
+
className: "inset-group squircle divide-separator/60 border-separator/60 divide-y border [--squircle-radius:1.25rem]",
|
|
27
|
+
children
|
|
28
|
+
}),
|
|
29
|
+
footer ? /* @__PURE__ */ jsx("p", {
|
|
30
|
+
className: "text-footnote text-label-secondary group-data-[size=lg]/item-group:text-subheadline group-data-[size=sm]/item-group:text-caption m-0 px-4",
|
|
31
|
+
children: footer
|
|
32
|
+
}) : null
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const chevronClass = "text-label-tertiary size-4 shrink-0 transition-transform duration-(--duration-fast) motion-reduce:transition-none";
|
|
37
|
+
function Chevron({ className }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
39
|
+
viewBox: "0 0 16 16",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
className: cx(chevronClass, className),
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeWidth: "2",
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round",
|
|
47
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 3 5 5-5 5" })
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const rowClass = "relative flex w-full items-center gap-3 px-4 text-left text-label outline-none min-h-11 py-2 group-data-[size=sm]/item-group:min-h-9 group-data-[size=sm]/item-group:py-1.5 group-data-[size=lg]/item-group:min-h-14 group-data-[size=lg]/item-group:py-3";
|
|
51
|
+
const pressClass = "hover:bg-fill/70 active:bg-fill focus-visible:ring-accent/70 transition-colors duration-(--duration-instant) focus-visible:ring-2 focus-visible:ring-inset disabled:pointer-events-none disabled:opacity-40 aria-disabled:pointer-events-none aria-disabled:opacity-40 motion-reduce:transition-none";
|
|
52
|
+
/**
|
|
53
|
+
* One row. Compose it from `ItemMedia`, `ItemContent` and `ItemActions`. With
|
|
54
|
+
* `render` the whole row presses like iOS; with `panel` it opens to reveal
|
|
55
|
+
* content, such as inputs, under the row.
|
|
56
|
+
*/
|
|
57
|
+
function Item({ chevron, render, panel, open, defaultOpen = false, onOpenChange, className, children, ...props }) {
|
|
58
|
+
const id = useId();
|
|
59
|
+
const [inner, setInner] = useState(defaultOpen);
|
|
60
|
+
const expanded = open ?? inner;
|
|
61
|
+
const toggle = () => {
|
|
62
|
+
setInner(!expanded);
|
|
63
|
+
onOpenChange?.(!expanded);
|
|
64
|
+
};
|
|
65
|
+
const state = expanded ? "open" : "closed";
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
"data-slot": "item",
|
|
68
|
+
role: "listitem",
|
|
69
|
+
className: cx("group/item relative", className),
|
|
70
|
+
...props,
|
|
71
|
+
children: panel !== void 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
id: `${id}-trigger`,
|
|
74
|
+
"aria-expanded": expanded,
|
|
75
|
+
"aria-controls": `${id}-panel`,
|
|
76
|
+
"data-state": state,
|
|
77
|
+
onClick: toggle,
|
|
78
|
+
className: cx(rowClass, pressClass),
|
|
79
|
+
children: [children, /* @__PURE__ */ jsx(Chevron, { className: cx("group-hover/item:translate-x-0.5", expanded && "rotate-90 group-hover/item:translate-x-0") })]
|
|
80
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
81
|
+
id: `${id}-panel`,
|
|
82
|
+
role: "region",
|
|
83
|
+
"aria-labelledby": `${id}-trigger`,
|
|
84
|
+
"data-state": state,
|
|
85
|
+
inert: !expanded,
|
|
86
|
+
className: cx("spring-smooth grid transition-[grid-template-rows] motion-reduce:transition-none", expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
87
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "min-h-0 overflow-hidden",
|
|
89
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: cx("flex flex-col gap-3 px-4 pt-2 pb-4 transition-opacity duration-(--duration-fast) motion-reduce:transition-none", !expanded && "opacity-0"),
|
|
91
|
+
children: panel
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})] }) : render ? renderPart("a", mergeProps({
|
|
95
|
+
className: cx(rowClass, pressClass),
|
|
96
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [children, chevron ? /* @__PURE__ */ jsx(Chevron, { className: "group-hover/item:translate-x-0.5" }) : null] })
|
|
97
|
+
}, {}), render) : /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
className: rowClass,
|
|
99
|
+
children: [children, chevron ? /* @__PURE__ */ jsx(Chevron, {}) : null]
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** The icon or image at the start of a row. The hairline insets past it. */
|
|
104
|
+
function ItemMedia({ variant = "icon", className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx("span", {
|
|
106
|
+
"data-slot": "item-media",
|
|
107
|
+
"data-variant": variant,
|
|
108
|
+
className: cx("flex shrink-0 items-center justify-center", variant === "icon" ? "text-accent-text size-8 [&_svg]:size-5" : "size-10 overflow-hidden rounded-xl [&_img]:size-full [&_img]:object-cover", className),
|
|
109
|
+
...props
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/** Holds the title and description, taking the room the media and actions leave. */
|
|
113
|
+
function ItemContent({ className, ...props }) {
|
|
114
|
+
return /* @__PURE__ */ jsx("div", {
|
|
115
|
+
"data-slot": "item-content",
|
|
116
|
+
className: cx("flex min-w-0 flex-1 flex-col", className),
|
|
117
|
+
...props
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function ItemTitle({ className, ...props }) {
|
|
121
|
+
return /* @__PURE__ */ jsx("div", {
|
|
122
|
+
"data-slot": "item-title",
|
|
123
|
+
className: cx("text-body truncate group-data-[size=sm]/item-group:text-subheadline", className),
|
|
124
|
+
...props
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function ItemDescription({ className, ...props }) {
|
|
128
|
+
return /* @__PURE__ */ jsx("div", {
|
|
129
|
+
"data-slot": "item-description",
|
|
130
|
+
className: cx("text-footnote text-label-secondary -mt-0.5 line-clamp-2 group-data-[size=sm]/item-group:text-caption", className),
|
|
131
|
+
...props
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/** A value, switch, badge or button at the end of a row. */
|
|
135
|
+
function ItemActions({ className, ...props }) {
|
|
136
|
+
return /* @__PURE__ */ jsx("div", {
|
|
137
|
+
"data-slot": "item-actions",
|
|
138
|
+
className: cx("text-body text-label-secondary flex shrink-0 items-center gap-2 group-data-[size=sm]/item-group:text-subheadline", className),
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
export { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle };
|
package/dist/kbd.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/** A keyboard key cap. Pass `Mod`, `Alt`, `Shift` and friends and the platform's own symbol shows. */
|
|
3
|
+
export declare function Kbd({ className, children, ...props }: ComponentProps<"kbd">): import("react").JSX.Element;
|
|
4
|
+
export declare function KbdGroup({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|