@passui/react 0.1.46 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -109
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/accordion.d.ts +15 -0
- package/dist/accordion.js +93 -0
- package/dist/alert-dialog.d.ts +26 -0
- package/dist/alert-dialog.js +142 -0
- package/dist/alert.d.ts +10 -0
- package/dist/alert.js +28 -0
- package/dist/{types/src/components/ambient/ambient.d.ts → ambient.d.ts} +4 -4
- package/dist/ambient.js +22 -0
- package/dist/{types/src/appearance → appearance}/platform.d.ts +3 -3
- package/dist/appearance/platform.js +43 -0
- package/dist/appearance/theme.d.ts +71 -0
- package/dist/appearance/theme.js +236 -0
- package/dist/appearance.d.ts +3 -0
- package/dist/appearance.js +3 -0
- package/dist/{types/src/components/aspect-ratio/aspect-ratio.d.ts → aspect-ratio.d.ts} +4 -4
- package/dist/aspect-ratio.js +17 -0
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.js +43 -0
- package/dist/badge.d.ts +8 -0
- package/dist/badge.js +21 -0
- package/dist/breadcrumb.d.ts +13 -0
- package/dist/breadcrumb.js +63 -0
- package/dist/button-group.d.ts +5 -0
- package/dist/button-group.js +14 -0
- package/dist/button.d.ts +21 -0
- package/dist/button.js +58 -0
- package/dist/calendar.d.ts +35 -0
- package/dist/calendar.js +225 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.js +54 -0
- package/dist/chart.d.ts +30 -0
- package/dist/chart.js +226 -0
- package/dist/checkbox.d.ts +13 -0
- package/dist/checkbox.js +53 -0
- package/dist/{types/src/lib/clipboard.d.ts → clipboard.d.ts} +1 -1
- package/dist/clipboard.js +16 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +10 -0
- package/dist/code-block.d.ts +34 -0
- package/dist/code-block.js +87 -0
- package/dist/collapsible.d.ts +13 -0
- package/dist/collapsible.js +49 -0
- package/dist/combobox.d.ts +25 -0
- package/dist/combobox.js +112 -0
- package/dist/command.d.ts +22 -0
- package/dist/command.js +129 -0
- package/dist/components/toast/toast-store.d.ts +60 -0
- package/dist/components/toast/toast-store.js +96 -0
- package/dist/{types/src/components → components}/toast/toaster.d.ts +4 -4
- package/dist/components/toast/toaster.js +345 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +2 -0
- package/dist/conversation.d.ts +48 -0
- package/dist/conversation.js +202 -0
- package/dist/date-time-picker.d.ts +50 -0
- package/dist/date-time-picker.js +235 -0
- package/dist/date.d.ts +50 -0
- package/dist/date.js +77 -0
- package/dist/dialog.d.ts +21 -0
- package/dist/dialog.js +113 -0
- package/dist/drawer.d.ts +30 -0
- package/dist/drawer.js +140 -0
- package/dist/dropdown-menu.d.ts +56 -0
- package/dist/dropdown-menu.js +295 -0
- package/dist/empty.d.ts +11 -0
- package/dist/empty.js +51 -0
- package/dist/field.d.ts +16 -0
- package/dist/field.js +47 -0
- package/{src/hooks/scroll/minimize-decision.ts → dist/hooks/scroll/minimize-decision.js} +3 -5
- package/dist/{types/src/hooks → hooks}/use-anchored-placement.d.ts +2 -2
- package/dist/hooks/use-anchored-placement.js +33 -0
- package/dist/{types/src/hooks → hooks}/use-minimize-on-scroll.d.ts +1 -1
- package/dist/hooks/use-minimize-on-scroll.js +59 -0
- package/dist/{types/src/hooks → hooks}/use-visual-viewport.d.ts +2 -2
- package/{src/hooks/use-visual-viewport.ts → dist/hooks/use-visual-viewport.js} +20 -35
- package/dist/hooks/viewport/types.d.ts +7 -0
- package/dist/hooks/viewport/viewport-metrics.js +13 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +80 -0
- package/dist/input-group.d.ts +17 -0
- package/dist/input-group.js +55 -0
- package/dist/input-otp.d.ts +13 -0
- package/dist/input-otp.js +36 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.js +14 -0
- package/dist/item.d.ts +49 -0
- package/dist/item.js +142 -0
- package/dist/kbd.d.ts +4 -0
- package/dist/kbd.js +86 -0
- package/dist/label.d.ts +3 -0
- package/dist/label.js +12 -0
- package/dist/labeled-content.d.ts +24 -0
- package/dist/labeled-content.js +41 -0
- package/dist/{types/src/lib/language.d.ts → language.d.ts} +1 -1
- package/dist/language.js +11 -0
- package/dist/layout.d.ts +24 -0
- package/dist/layout.js +36 -0
- package/dist/{types/src/lib → lib}/anchored-placement.d.ts +27 -27
- package/dist/lib/anchored-placement.js +42 -0
- package/dist/lib/calendar-month.js +90 -0
- package/dist/lib/cx.js +6 -0
- package/dist/lib/drawer.math.js +29 -0
- package/dist/lib/floating-layers.d.ts +3 -0
- package/dist/lib/floating-layers.js +25 -0
- package/dist/{types/src/lib → lib}/haptics.d.ts +1 -1
- package/dist/lib/haptics.js +13 -0
- package/dist/lib/liquid-step.js +33 -0
- package/dist/lib/page-scale.js +58 -0
- package/dist/lib/portal.js +12 -0
- package/dist/lib/presence.js +53 -0
- package/dist/lib/range-value.js +25 -0
- package/dist/lib/render.d.ts +8 -0
- package/dist/lib/render.js +42 -0
- package/dist/lib/rolling-digit.js +83 -0
- package/dist/{types/src/lib → lib}/screen-edges.d.ts +5 -5
- package/dist/lib/screen-edges.js +30 -0
- package/dist/lib/swipe-touch-action.js +34 -0
- package/dist/lib/visual-viewport.js +27 -0
- package/dist/lib/water-drop.js +412 -0
- package/dist/lib/wheel.js +125 -0
- package/dist/list.d.ts +26 -0
- package/dist/list.js +80 -0
- package/dist/locales.d.ts +18 -0
- package/dist/locales.js +36 -0
- package/dist/marker.d.ts +13 -0
- package/dist/marker.js +33 -0
- package/dist/motion/transitions.d.ts +170 -0
- package/dist/motion/transitions.js +156 -0
- package/dist/pagination.d.ts +30 -0
- package/dist/pagination.js +117 -0
- package/dist/popover.d.ts +26 -0
- package/dist/popover.js +101 -0
- package/dist/progress.d.ts +9 -0
- package/dist/progress.js +24 -0
- package/dist/questionnaire.d.ts +46 -0
- package/dist/questionnaire.js +133 -0
- package/dist/radio-group.d.ts +21 -0
- package/dist/radio-group.js +67 -0
- package/dist/search-field.d.ts +18 -0
- package/dist/search-field.js +45 -0
- package/dist/segmented-control.d.ts +16 -0
- package/dist/segmented-control.js +25 -0
- package/dist/select.d.ts +24 -0
- package/dist/select.js +107 -0
- package/dist/separator.d.ts +9 -0
- package/dist/separator.js +17 -0
- package/dist/{types/src/lib/shapes.d.ts → shapes.d.ts} +2 -2
- package/dist/shapes.js +65 -0
- package/dist/sheet.d.ts +24 -0
- package/dist/sheet.js +141 -0
- package/dist/sidebar.d.ts +32 -0
- package/dist/sidebar.js +85 -0
- package/dist/skeleton.d.ts +3 -0
- package/dist/skeleton.js +13 -0
- package/dist/slider.d.ts +9 -0
- package/dist/slider.js +42 -0
- package/dist/slosh-slider.d.ts +21 -0
- package/dist/slosh-slider.js +205 -0
- package/dist/spinner.d.ts +3 -0
- package/dist/spinner.js +20 -0
- package/dist/stat-tile.d.ts +20 -0
- package/dist/stat-tile.js +53 -0
- package/dist/stepper.d.ts +22 -0
- package/dist/stepper.js +98 -0
- package/dist/swatch-picker.d.ts +22 -0
- package/dist/swatch-picker.js +70 -0
- package/dist/switch.d.ts +10 -0
- package/dist/switch.js +44 -0
- package/dist/tab-bar.d.ts +15 -0
- package/dist/tab-bar.js +34 -0
- package/dist/{types/src/components/table/table.d.ts → table.d.ts} +3 -3
- package/dist/table.js +93 -0
- package/dist/tabs.d.ts +32 -0
- package/dist/tabs.js +131 -0
- package/dist/text.d.ts +25 -0
- package/dist/text.js +44 -0
- package/dist/textarea.d.ts +3 -0
- package/dist/textarea.js +13 -0
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +3 -0
- package/dist/toggle-group.d.ts +20 -0
- package/dist/toggle-group.js +68 -0
- package/dist/toggle.d.ts +24 -0
- package/dist/toggle.js +37 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tooltip.d.ts +21 -0
- package/dist/tooltip.js +61 -0
- package/dist/trace.d.ts +14 -0
- package/dist/trace.js +54 -0
- package/dist/{types/src/hooks/use-dismiss.d.ts → use-dismiss.d.ts} +3 -3
- package/dist/use-dismiss.js +38 -0
- package/dist/{types/src/hooks/use-media-query.d.ts → use-media-query.d.ts} +12 -12
- package/dist/use-media-query.js +56 -0
- package/dist/use-os.d.ts +12 -0
- package/dist/use-os.js +17 -0
- package/dist/wake-slider.d.ts +15 -0
- package/dist/wake-slider.js +174 -0
- package/package.json +122 -253
- package/src/styles/code-block.css +4 -0
- package/src/styles/globals.css +5 -0
- package/src/styles/motion-controls.css +10 -0
- package/src/styles/page-scale.css +27 -0
- package/src/styles/styles.css +4 -2
- package/dist/types/src/appearance/index.d.ts +0 -2
- package/dist/types/src/appearance/theme.d.ts +0 -71
- package/dist/types/src/components/accordion/accordion.d.ts +0 -23
- package/dist/types/src/components/ambient/index.d.ts +0 -1
- package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +0 -19
- package/dist/types/src/components/button/button-styles.d.ts +0 -12
- package/dist/types/src/components/button/button.d.ts +0 -32
- package/dist/types/src/components/button/icon-button.d.ts +0 -10
- package/dist/types/src/components/button/pending-spinner.d.ts +0 -5
- package/dist/types/src/components/button/use-pending-indicator.d.ts +0 -2
- package/dist/types/src/components/chip/chip.d.ts +0 -10
- package/dist/types/src/components/code-block/code-block.d.ts +0 -13
- package/dist/types/src/components/combo-box/combo-box.d.ts +0 -9
- package/dist/types/src/components/command/command.d.ts +0 -18
- package/dist/types/src/components/compact-date-picker/calendar-month.d.ts +0 -25
- package/dist/types/src/components/compact-date-picker/compact-date-picker.d.ts +0 -30
- package/dist/types/src/components/compact-time-picker/compact-time-picker.d.ts +0 -29
- package/dist/types/src/components/compact-time-picker/time-value.d.ts +0 -18
- package/dist/types/src/components/content-unavailable-view/content-unavailable-view.d.ts +0 -12
- package/dist/types/src/components/content-view/content-view.d.ts +0 -51
- package/dist/types/src/components/content-view/index.d.ts +0 -1
- package/dist/types/src/components/context-menu/conceal-menu-source.d.ts +0 -2
- package/dist/types/src/components/context-menu/context-menu-host.d.ts +0 -2
- package/dist/types/src/components/context-menu/context-menu-store.d.ts +0 -62
- package/dist/types/src/components/context-menu/menu-navigation.d.ts +0 -6
- package/dist/types/src/components/context-menu/menu-position.d.ts +0 -21
- package/dist/types/src/components/context-menu/menu-reveal.d.ts +0 -26
- package/dist/types/src/components/context-menu/use-context-menu.d.ts +0 -14
- package/dist/types/src/components/conversation/conversation.d.ts +0 -48
- package/dist/types/src/components/conversation/index.d.ts +0 -1
- package/dist/types/src/components/date-picker/date-picker.d.ts +0 -19
- package/dist/types/src/components/date-picker/date-value.d.ts +0 -2
- package/dist/types/src/components/dialog/dialog-host.d.ts +0 -6
- package/dist/types/src/components/dialog/dialog-store.d.ts +0 -23
- package/dist/types/src/components/dialog/dialog.d.ts +0 -33
- package/dist/types/src/components/dialog/index.d.ts +0 -1
- package/dist/types/src/components/disclosure-group/disclosure-group.d.ts +0 -18
- package/dist/types/src/components/divider/divider.d.ts +0 -9
- package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +0 -15
- package/dist/types/src/components/keyboard-shortcut/keyboard-shortcut.d.ts +0 -8
- package/dist/types/src/components/labeled-content/labeled-content.d.ts +0 -22
- package/dist/types/src/components/locale-switcher/index.d.ts +0 -1
- package/dist/types/src/components/locale-switcher/locale-switcher.d.ts +0 -13
- package/dist/types/src/components/menu/menu.d.ts +0 -16
- package/dist/types/src/components/morph/index.d.ts +0 -2
- package/dist/types/src/components/morph/morph.d.ts +0 -32
- package/dist/types/src/components/morph/use-morph-disclosure.d.ts +0 -13
- package/dist/types/src/components/one-time-code/one-time-code.d.ts +0 -26
- package/dist/types/src/components/picker/picker-trigger.d.ts +0 -3
- package/dist/types/src/components/picker/picker.d.ts +0 -46
- package/dist/types/src/components/popover/anchored-surface.d.ts +0 -17
- package/dist/types/src/components/popover/index.d.ts +0 -41
- package/dist/types/src/components/popover/popover-content.d.ts +0 -32
- package/dist/types/src/components/popover/popover-fit.d.ts +0 -21
- package/dist/types/src/components/popover/popover-root.d.ts +0 -22
- package/dist/types/src/components/popover/popover-trigger.d.ts +0 -23
- package/dist/types/src/components/profile-image/profile-image.d.ts +0 -9
- package/dist/types/src/components/progress-view/progress-view.d.ts +0 -13
- package/dist/types/src/components/progress-view/use-liquid-progress.d.ts +0 -3
- package/dist/types/src/components/radio-group/radio-group.d.ts +0 -20
- package/dist/types/src/components/search-field/expanding-search-field.d.ts +0 -5
- package/dist/types/src/components/search-field/search-field.d.ts +0 -9
- package/dist/types/src/components/search-list/search-list.d.ts +0 -22
- package/dist/types/src/components/section/section.d.ts +0 -18
- package/dist/types/src/components/secure-field/secure-field.d.ts +0 -4
- package/dist/types/src/components/segmented-control/segmented-control.d.ts +0 -25
- package/dist/types/src/components/sheet/modal-environment.d.ts +0 -2
- package/dist/types/src/components/sheet/sheet-portal.d.ts +0 -5
- package/dist/types/src/components/sheet/sheet.d.ts +0 -26
- package/dist/types/src/components/sheet/use-sheet-focus.d.ts +0 -3
- package/dist/types/src/components/sidebar/sidebar.d.ts +0 -24
- package/dist/types/src/components/skeleton/skeleton.d.ts +0 -9
- package/dist/types/src/components/slider/slider.d.ts +0 -17
- package/dist/types/src/components/slosh-slider/liquid-step.d.ts +0 -6
- package/dist/types/src/components/slosh-slider/slosh-slider.d.ts +0 -21
- package/dist/types/src/components/stat-tile/index.d.ts +0 -1
- package/dist/types/src/components/stat-tile/stat-tile.d.ts +0 -20
- package/dist/types/src/components/status-indicator/status-indicator.d.ts +0 -17
- package/dist/types/src/components/stepper/rolling-digit.d.ts +0 -11
- package/dist/types/src/components/stepper/stepper.d.ts +0 -22
- package/dist/types/src/components/swatch-picker/swatch-picker.d.ts +0 -22
- package/dist/types/src/components/tab-bar/tab-bar.d.ts +0 -43
- package/dist/types/src/components/tab-view/tab-view.d.ts +0 -27
- package/dist/types/src/components/text-editor/text-editor.d.ts +0 -9
- package/dist/types/src/components/text-field/text-field.d.ts +0 -33
- package/dist/types/src/components/toast/toast-store.d.ts +0 -52
- package/dist/types/src/components/toggle/toggle.d.ts +0 -22
- package/dist/types/src/components/tooltip/tooltip-host.d.ts +0 -7
- package/dist/types/src/components/view-controller/index.d.ts +0 -1
- package/dist/types/src/components/view-controller/view-controller.d.ts +0 -21
- package/dist/types/src/components/wake-slider/wake-slider.d.ts +0 -15
- package/dist/types/src/hooks/scroll/minimize-decision.d.ts +0 -2
- package/dist/types/src/hooks/use-anchored-disclosure.d.ts +0 -9
- package/dist/types/src/hooks/use-floating-dismiss.d.ts +0 -3
- package/dist/types/src/hooks/viewport/types.d.ts +0 -19
- package/dist/types/src/hooks/viewport/viewport-metrics.d.ts +0 -3
- package/dist/types/src/icons/icons.d.ts +0 -616
- package/dist/types/src/index.d.ts +0 -73
- package/dist/types/src/lib/class-names.d.ts +0 -2
- package/dist/types/src/lib/date.d.ts +0 -50
- package/dist/types/src/lib/floating-layers.d.ts +0 -8
- package/dist/types/src/lib/range-value.d.ts +0 -4
- package/dist/types/src/machines/popover.machine.d.ts +0 -30
- package/dist/types/src/motion/transitions.d.ts +0 -170
- package/src/appearance/index.ts +0 -2
- package/src/appearance/platform.tsx +0 -102
- package/src/appearance/theme.tsx +0 -467
- package/src/components/accordion/accordion.tsx +0 -70
- package/src/components/ambient/ambient.tsx +0 -35
- package/src/components/ambient/index.ts +0 -1
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -27
- package/src/components/breadcrumb/breadcrumb.tsx +0 -73
- package/src/components/button/button-styles.ts +0 -49
- package/src/components/button/button.tsx +0 -107
- package/src/components/button/icon-button.tsx +0 -33
- package/src/components/button/pending-spinner.tsx +0 -14
- package/src/components/button/use-pending-indicator.ts +0 -22
- package/src/components/chip/chip.tsx +0 -45
- package/src/components/code-block/code-block.tsx +0 -48
- package/src/components/combo-box/combo-box.tsx +0 -13
- package/src/components/command/command.tsx +0 -149
- package/src/components/compact-date-picker/calendar-month.ts +0 -109
- package/src/components/compact-date-picker/compact-date-picker.tsx +0 -337
- package/src/components/compact-time-picker/compact-time-picker.tsx +0 -321
- package/src/components/compact-time-picker/time-value.ts +0 -58
- package/src/components/content-unavailable-view/content-unavailable-view.tsx +0 -78
- package/src/components/content-view/content-view.tsx +0 -215
- package/src/components/content-view/index.ts +0 -1
- package/src/components/context-menu/conceal-menu-source.ts +0 -30
- package/src/components/context-menu/context-menu-host.tsx +0 -459
- package/src/components/context-menu/context-menu-store.ts +0 -167
- package/src/components/context-menu/menu-navigation.ts +0 -36
- package/src/components/context-menu/menu-position.ts +0 -38
- package/src/components/context-menu/menu-reveal.ts +0 -42
- package/src/components/context-menu/use-context-menu.ts +0 -73
- package/src/components/conversation/conversation.tsx +0 -309
- package/src/components/conversation/index.ts +0 -1
- package/src/components/date-picker/date-picker.tsx +0 -106
- package/src/components/date-picker/date-value.ts +0 -22
- package/src/components/dialog/dialog-host.tsx +0 -119
- package/src/components/dialog/dialog-store.ts +0 -66
- package/src/components/dialog/dialog.tsx +0 -211
- package/src/components/dialog/index.ts +0 -1
- package/src/components/disclosure-group/disclosure-group.tsx +0 -108
- package/src/components/divider/divider.tsx +0 -33
- package/src/components/inline-disclosure/inline-disclosure.tsx +0 -53
- package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +0 -32
- package/src/components/labeled-content/labeled-content.tsx +0 -84
- package/src/components/locale-switcher/index.ts +0 -1
- package/src/components/locale-switcher/locale-switcher.tsx +0 -311
- package/src/components/menu/menu.tsx +0 -85
- package/src/components/morph/index.ts +0 -2
- package/src/components/morph/morph.tsx +0 -258
- package/src/components/morph/use-morph-disclosure.ts +0 -27
- package/src/components/one-time-code/one-time-code.tsx +0 -234
- package/src/components/picker/picker-trigger.ts +0 -22
- package/src/components/picker/picker.tsx +0 -404
- package/src/components/popover/anchored-surface.tsx +0 -264
- package/src/components/popover/index.ts +0 -50
- package/src/components/popover/popover-content.tsx +0 -334
- package/src/components/popover/popover-fit.ts +0 -74
- package/src/components/popover/popover-root.tsx +0 -97
- package/src/components/popover/popover-trigger.tsx +0 -71
- package/src/components/profile-image/profile-image.tsx +0 -96
- package/src/components/progress-view/progress-view.tsx +0 -72
- package/src/components/progress-view/use-liquid-progress.ts +0 -43
- package/src/components/radio-group/radio-group.tsx +0 -86
- package/src/components/search-field/expanding-search-field.tsx +0 -197
- package/src/components/search-field/search-field.tsx +0 -66
- package/src/components/search-list/search-list.tsx +0 -276
- package/src/components/section/section.tsx +0 -75
- package/src/components/secure-field/secure-field.tsx +0 -8
- package/src/components/segmented-control/segmented-control.tsx +0 -157
- package/src/components/sheet/modal-environment.ts +0 -82
- package/src/components/sheet/sheet-portal.tsx +0 -62
- package/src/components/sheet/sheet.tsx +0 -165
- package/src/components/sheet/use-sheet-focus.ts +0 -109
- package/src/components/sidebar/sidebar.tsx +0 -102
- package/src/components/skeleton/skeleton.tsx +0 -38
- package/src/components/slider/slider.tsx +0 -134
- package/src/components/slosh-slider/liquid-step.ts +0 -43
- package/src/components/slosh-slider/slosh-slider.tsx +0 -294
- package/src/components/stat-tile/index.ts +0 -1
- package/src/components/stat-tile/stat-tile.tsx +0 -90
- package/src/components/status-indicator/status-indicator.tsx +0 -54
- package/src/components/stepper/rolling-digit.tsx +0 -91
- package/src/components/stepper/stepper.tsx +0 -136
- package/src/components/swatch-picker/swatch-picker.tsx +0 -138
- package/src/components/tab-bar/tab-bar.tsx +0 -182
- package/src/components/tab-view/tab-view.tsx +0 -155
- package/src/components/table/table.tsx +0 -151
- package/src/components/text-editor/text-editor.tsx +0 -42
- package/src/components/text-field/text-field.tsx +0 -200
- package/src/components/toast/toast-store.ts +0 -164
- package/src/components/toast/toaster.tsx +0 -407
- package/src/components/toggle/toggle.tsx +0 -320
- package/src/components/tooltip/tooltip-host.tsx +0 -178
- package/src/components/view-controller/index.ts +0 -1
- package/src/components/view-controller/view-controller.tsx +0 -75
- package/src/components/wake-slider/wake-slider.tsx +0 -260
- package/src/hooks/use-anchored-disclosure.ts +0 -23
- package/src/hooks/use-anchored-placement.ts +0 -40
- package/src/hooks/use-dismiss.ts +0 -44
- package/src/hooks/use-floating-dismiss.ts +0 -30
- package/src/hooks/use-media-query.ts +0 -94
- package/src/hooks/use-minimize-on-scroll.ts +0 -77
- package/src/hooks/viewport/types.ts +0 -19
- package/src/hooks/viewport/viewport-metrics.ts +0 -19
- package/src/icons/icons.tsx +0 -458
- package/src/index.ts +0 -107
- package/src/lib/anchored-placement.ts +0 -91
- package/src/lib/class-names.ts +0 -21
- package/src/lib/clipboard.ts +0 -15
- package/src/lib/date.ts +0 -86
- package/src/lib/floating-layers.ts +0 -53
- package/src/lib/haptics.ts +0 -23
- package/src/lib/language.ts +0 -16
- package/src/lib/range-value.ts +0 -38
- package/src/lib/screen-edges.ts +0 -44
- package/src/lib/shapes.ts +0 -59
- package/src/machines/popover.machine.ts +0 -51
- package/src/motion/transitions.ts +0 -97
- package/src/tokens.ts +0 -1
- /package/dist/{types/src/tokens.d.ts → tokens.js} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type StepperSize = "sm" | "md" | "lg";
|
|
2
|
+
export interface StepperProps {
|
|
3
|
+
value: number;
|
|
4
|
+
onChange: (value: number) => void;
|
|
5
|
+
label: string;
|
|
6
|
+
/** Localized accessible names for each action. */
|
|
7
|
+
labels: {
|
|
8
|
+
decrement: string;
|
|
9
|
+
increment: string;
|
|
10
|
+
};
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
step?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Formats the displayed value. */
|
|
17
|
+
formatValue?: (value: number) => string;
|
|
18
|
+
/** Label, output and +/- button scale. @default "md" */
|
|
19
|
+
size?: StepperSize;
|
|
20
|
+
}
|
|
21
|
+
/** Discrete increments with disabled boundary actions and a spoken value. */
|
|
22
|
+
export declare function Stepper({ value, onChange, label, labels, min, max, step, disabled, className, formatValue, size }: StepperProps): import("react").JSX.Element;
|
package/dist/stepper.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { clampRange, stepRange } from "./lib/range-value.js";
|
|
3
|
+
import { RollingDigit } from "./lib/rolling-digit.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/stepper.tsx
|
|
8
|
+
const labelText = {
|
|
9
|
+
sm: "min-w-0 text-footnote text-label",
|
|
10
|
+
md: "min-w-0 text-subheadline text-label",
|
|
11
|
+
lg: "min-w-0 text-body text-label"
|
|
12
|
+
};
|
|
13
|
+
const outputText = {
|
|
14
|
+
sm: "text-footnote tabular-nums text-label",
|
|
15
|
+
md: "text-subheadline tabular-nums text-label",
|
|
16
|
+
lg: "text-body tabular-nums text-label"
|
|
17
|
+
};
|
|
18
|
+
const buttonSizes = {
|
|
19
|
+
sm: {
|
|
20
|
+
size: "icon-sm",
|
|
21
|
+
cls: "size-7! rounded-none! text-subheadline text-accent-text [@media(pointer:coarse)]:size-10!"
|
|
22
|
+
},
|
|
23
|
+
md: {
|
|
24
|
+
size: "icon",
|
|
25
|
+
cls: "size-8! rounded-none! text-title3 text-accent-text [@media(pointer:coarse)]:size-11!"
|
|
26
|
+
},
|
|
27
|
+
lg: {
|
|
28
|
+
size: "icon-lg",
|
|
29
|
+
cls: "size-9! rounded-none! text-title2 text-accent-text [@media(pointer:coarse)]:size-12!"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/** Discrete increments with disabled boundary actions and a spoken value. */
|
|
33
|
+
function Stepper({ value, onChange, label, labels, min = 0, max = 100, step = 1, disabled = false, className, formatValue, size = "md" }) {
|
|
34
|
+
const id = useId();
|
|
35
|
+
const upper = Math.max(min, max);
|
|
36
|
+
const current = clampRange(value, min, upper);
|
|
37
|
+
const decrement = stepRange(current, -1, min, upper, step > 0 ? step : 1);
|
|
38
|
+
const increment = stepRange(current, 1, min, upper, step > 0 ? step : 1);
|
|
39
|
+
const displayed = formatValue?.(current) ?? String(current);
|
|
40
|
+
const digits = displayed.replace(/[^0-9]/g, "");
|
|
41
|
+
let digitIndex = 0;
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
"data-slot": "stepper",
|
|
44
|
+
className: cx("flex min-w-0 items-center justify-between gap-3", className),
|
|
45
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
46
|
+
id,
|
|
47
|
+
className: labelText[size],
|
|
48
|
+
children: label
|
|
49
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "flex shrink-0 items-center gap-3",
|
|
51
|
+
children: [/* @__PURE__ */ jsxs("output", {
|
|
52
|
+
"aria-live": "polite",
|
|
53
|
+
"aria-labelledby": id,
|
|
54
|
+
className: outputText[size],
|
|
55
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
className: "inline-flex items-center",
|
|
58
|
+
children: Array.from(displayed).map((character) => {
|
|
59
|
+
if (!/[0-9]/.test(character)) return /* @__PURE__ */ jsx("span", { children: character }, `sep-${character}`);
|
|
60
|
+
const prefix = digits.slice(0, ++digitIndex);
|
|
61
|
+
const place = digits.length - digitIndex;
|
|
62
|
+
return /* @__PURE__ */ jsx(RollingDigit, {
|
|
63
|
+
count: Number(prefix),
|
|
64
|
+
place
|
|
65
|
+
}, `place-${place}`);
|
|
66
|
+
})
|
|
67
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "sr-only",
|
|
69
|
+
children: displayed
|
|
70
|
+
})]
|
|
71
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: "divide-separator bg-fill flex items-center divide-x overflow-hidden rounded-lg",
|
|
73
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
74
|
+
type: "button",
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
size: buttonSizes[size].size,
|
|
77
|
+
"aria-label": labels.decrement,
|
|
78
|
+
"aria-describedby": id,
|
|
79
|
+
disabled: disabled || decrement === current,
|
|
80
|
+
onClick: () => onChange(decrement),
|
|
81
|
+
className: buttonSizes[size].cls,
|
|
82
|
+
children: "−"
|
|
83
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
84
|
+
type: "button",
|
|
85
|
+
variant: "ghost",
|
|
86
|
+
size: buttonSizes[size].size,
|
|
87
|
+
"aria-label": labels.increment,
|
|
88
|
+
"aria-describedby": id,
|
|
89
|
+
disabled: disabled || increment === current,
|
|
90
|
+
onClick: () => onChange(increment),
|
|
91
|
+
className: buttonSizes[size].cls,
|
|
92
|
+
children: "+"
|
|
93
|
+
})]
|
|
94
|
+
})]
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export { Stepper };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SwatchPickerOption<T extends string> {
|
|
2
|
+
value: T;
|
|
3
|
+
label: string;
|
|
4
|
+
/** Swatch background color. */
|
|
5
|
+
color: string;
|
|
6
|
+
/** Color of the selected checkmark. */
|
|
7
|
+
ink: string;
|
|
8
|
+
}
|
|
9
|
+
export type SwatchPickerSize = "sm" | "md" | "lg";
|
|
10
|
+
export interface SwatchPickerProps<T extends string> {
|
|
11
|
+
value: T;
|
|
12
|
+
options: ReadonlyArray<SwatchPickerOption<T>>;
|
|
13
|
+
onChange: (value: T) => void;
|
|
14
|
+
/** Accessible name for the group. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Custom classes for the swatch container. */
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Swatch diameter, check icon and caption scale. @default "md" */
|
|
19
|
+
size?: SwatchPickerSize;
|
|
20
|
+
}
|
|
21
|
+
/** Colour swatches with a check on the chosen one, built on `RadioGroup` so keyboard and form behaviour match. */
|
|
22
|
+
export declare function SwatchPicker<T extends string>({ value, options, onChange, label, className, size }: SwatchPickerProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "./lib/cx.js";
|
|
3
|
+
import { RadioGroup, RadioGroupItem } from "./radio-group.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { CheckIcon } from "@passui/icons/check";
|
|
6
|
+
// src/components/swatch-picker.tsx
|
|
7
|
+
const swatchSizes = {
|
|
8
|
+
sm: "size-6",
|
|
9
|
+
md: "size-8",
|
|
10
|
+
lg: "size-10"
|
|
11
|
+
};
|
|
12
|
+
const checkSizes = {
|
|
13
|
+
sm: 13,
|
|
14
|
+
md: 16,
|
|
15
|
+
lg: 19
|
|
16
|
+
};
|
|
17
|
+
const captionText = {
|
|
18
|
+
sm: "text-caption2",
|
|
19
|
+
md: "text-caption2",
|
|
20
|
+
lg: "text-caption"
|
|
21
|
+
};
|
|
22
|
+
const fieldsetGaps = {
|
|
23
|
+
sm: "gap-2",
|
|
24
|
+
md: "gap-3",
|
|
25
|
+
lg: "gap-4"
|
|
26
|
+
};
|
|
27
|
+
const labelGaps = {
|
|
28
|
+
sm: "gap-1",
|
|
29
|
+
md: "gap-1.5",
|
|
30
|
+
lg: "gap-2"
|
|
31
|
+
};
|
|
32
|
+
/** Colour swatches with a check on the chosen one, built on `RadioGroup` so keyboard and form behaviour match. */
|
|
33
|
+
function SwatchPicker({ value, options, onChange, label, className, size = "md" }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(RadioGroup, {
|
|
35
|
+
"aria-label": label,
|
|
36
|
+
value,
|
|
37
|
+
onValueChange: (next) => {
|
|
38
|
+
if (!next) return;
|
|
39
|
+
onChange(next);
|
|
40
|
+
},
|
|
41
|
+
className,
|
|
42
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
43
|
+
className: cx("flex flex-wrap", fieldsetGaps[size]),
|
|
44
|
+
children: options.map((option) => {
|
|
45
|
+
const selected = option.value === value;
|
|
46
|
+
return /* @__PURE__ */ jsxs(RadioGroupItem, {
|
|
47
|
+
value: option.value,
|
|
48
|
+
bare: true,
|
|
49
|
+
className: cx("flex flex-col items-center", labelGaps[size]),
|
|
50
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: cx("ring-offset-elevated duration-fast group-focus-within:ring-accent flex items-center justify-center rounded-full ring-offset-1 transition-[box-shadow,transform] group-focus-within:ring-2 group-active:scale-95", swatchSizes[size], selected ? "ring-label/70 ring-[1.5px]" : "group-hover:ring-separator ring-0 group-hover:ring-[1.5px]"),
|
|
52
|
+
style: { background: option.color },
|
|
53
|
+
children: selected && /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "passui-swatch-check",
|
|
55
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {
|
|
56
|
+
size: checkSizes[size],
|
|
57
|
+
strokeWidth: 2.6,
|
|
58
|
+
style: { color: option.ink }
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: cx(captionText[size], selected ? "text-label font-semibold" : "text-label-tertiary"),
|
|
63
|
+
children: option.label
|
|
64
|
+
})]
|
|
65
|
+
}, option.value);
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export { SwatchPicker };
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as zagSwitch from "@zag-js/switch";
|
|
3
|
+
export interface SwitchProps extends Omit<zagSwitch.Props, "id" | "ids" | "onCheckedChange"> {
|
|
4
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
"aria-label"?: string;
|
|
8
|
+
}
|
|
9
|
+
/** An on or off switch. Renders a native hidden checkbox with `role="switch"`. */
|
|
10
|
+
export declare function Switch({ onCheckedChange, children, className, "aria-label": ariaLabel, ...props }: SwitchProps): import("react").JSX.Element;
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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 zagSwitch from "@zag-js/switch";
|
|
7
|
+
// src/components/switch.tsx
|
|
8
|
+
/** An on or off switch. Renders a native hidden checkbox with `role="switch"`. */
|
|
9
|
+
function Switch({ onCheckedChange, children, className, "aria-label": ariaLabel, ...props }) {
|
|
10
|
+
const id = useId();
|
|
11
|
+
const service = useMachine(zagSwitch.machine, {
|
|
12
|
+
id,
|
|
13
|
+
onCheckedChange: ({ checked }) => onCheckedChange?.(checked),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
const api = zagSwitch.connect(service, normalizeProps);
|
|
17
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
18
|
+
...api.getRootProps(),
|
|
19
|
+
"data-slot": "switch",
|
|
20
|
+
className: cx("group inline-flex cursor-pointer items-center gap-2.5 text-footnote data-disabled:cursor-not-allowed data-disabled:opacity-40", className),
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("input", {
|
|
23
|
+
...api.getHiddenInputProps(),
|
|
24
|
+
role: "switch",
|
|
25
|
+
"aria-label": ariaLabel
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsx("span", {
|
|
28
|
+
...api.getControlProps(),
|
|
29
|
+
"data-slot": "switch-control",
|
|
30
|
+
className: "bg-fill spring-smooth group-focus-within:ring-accent/70 data-[state=checked]:bg-success inline-flex h-8 w-13 shrink-0 items-center rounded-full p-0.5 shadow-[inset_0_0_0_0.5px_var(--color-separator)] transition group-focus-within:ring-2 motion-reduce:transition-none",
|
|
31
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
32
|
+
...api.getThumbProps(),
|
|
33
|
+
"data-slot": "switch-thumb",
|
|
34
|
+
className: "spring-bouncy block size-7 origin-left rounded-full bg-white shadow-[0_2px_6px_rgb(0_0_0/0.25)] transition-[transform,width] group-active:w-8.5 data-[state=checked]:origin-right data-[state=checked]:translate-x-5 group-active:data-[state=checked]:translate-x-3.5 motion-reduce:transition-none"
|
|
35
|
+
})
|
|
36
|
+
}),
|
|
37
|
+
children ? /* @__PURE__ */ jsx("span", {
|
|
38
|
+
...api.getLabelProps(),
|
|
39
|
+
children
|
|
40
|
+
}) : null
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export { Switch };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export type TabBarProps = ComponentProps<"nav"> & {
|
|
3
|
+
/** Shrinks to icons only, like iOS 26 while you scroll down. Pair with `useMinimizeOnScroll`. */
|
|
4
|
+
minimized?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/** The bottom tab bar: a floating glass capsule of destinations. */
|
|
7
|
+
export declare function TabBar({ minimized, className, ...props }: TabBarProps): import("react").JSX.Element;
|
|
8
|
+
export type TabBarItemProps = Omit<ComponentProps<"button">, "children"> & {
|
|
9
|
+
icon: ReactNode;
|
|
10
|
+
/** The visible name. Always kept for assistive technology, even when minimized. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** The current destination. */
|
|
13
|
+
active?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function TabBarItem({ icon, label, active, className, ...props }: TabBarItemProps): import("react").JSX.Element;
|
package/dist/tab-bar.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/tab-bar.tsx
|
|
4
|
+
/** The bottom tab bar: a floating glass capsule of destinations. */
|
|
5
|
+
function TabBar({ minimized, className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
7
|
+
"data-slot": "tab-bar",
|
|
8
|
+
"data-minimized": minimized || void 0,
|
|
9
|
+
className: cx("glass spring-smooth mx-auto flex w-fit items-stretch gap-0.5 rounded-full p-1.5 shadow-floating transition-[padding,gap] motion-reduce:transition-none data-[minimized]:gap-0 data-[minimized]:p-1", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function TabBarItem({ icon, label, active, className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
15
|
+
type: "button",
|
|
16
|
+
"data-slot": "tab-bar-item",
|
|
17
|
+
"aria-current": active ? "page" : void 0,
|
|
18
|
+
"aria-label": label,
|
|
19
|
+
className: cx("group spring-snappy text-caption text-label-secondary hover:text-label focus-visible:ring-accent/70 aria-[current=page]:text-accent-text relative isolate flex min-w-18 flex-col items-center justify-center gap-0.5 rounded-full px-4 py-1.5 font-medium outline-none transition focus-visible:ring-2 active:scale-[0.94] motion-reduce:transition-none [&_svg]:size-6", "in-data-[minimized]:min-w-11 in-data-[minimized]:py-2.5", className),
|
|
20
|
+
...props,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
className: "glass-lens spring-smooth absolute inset-0 -z-10 scale-75 rounded-full opacity-0 transition group-aria-[current=page]:scale-100 group-aria-[current=page]:opacity-100 motion-reduce:transition-none"
|
|
25
|
+
}),
|
|
26
|
+
icon,
|
|
27
|
+
/* @__PURE__ */ jsx("span", {
|
|
28
|
+
className: "in-data-[minimized]:hidden",
|
|
29
|
+
children: label
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export { TabBar, TabBarItem };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
export type TableSize = "sm" | "md" | "lg";
|
|
3
3
|
declare function Table({ className, size, ...props }: React.ComponentProps<"table"> & {
|
|
4
|
-
|
|
4
|
+
/** Row height, cell padding and text scale. @default "md" */ size?: TableSize;
|
|
5
5
|
}): React.JSX.Element;
|
|
6
6
|
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
7
7
|
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
@@ -10,4 +10,4 @@ declare function TableRow({ className, ...props }: React.ComponentProps<"tr">):
|
|
|
10
10
|
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
11
11
|
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
12
12
|
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
13
|
-
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow
|
|
13
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/table.tsx
|
|
5
|
+
const tableText = {
|
|
6
|
+
sm: "text-footnote text-label",
|
|
7
|
+
md: "text-subheadline text-label",
|
|
8
|
+
lg: "text-body text-label"
|
|
9
|
+
};
|
|
10
|
+
const headCell = {
|
|
11
|
+
sm: "h-8 px-2 text-start align-middle text-caption2 font-semibold whitespace-nowrap",
|
|
12
|
+
md: "h-8.5 px-3 text-start align-middle text-footnote font-semibold whitespace-nowrap",
|
|
13
|
+
lg: "h-9.5 px-4 text-start align-middle text-subheadline font-semibold whitespace-nowrap"
|
|
14
|
+
};
|
|
15
|
+
const bodyCell = {
|
|
16
|
+
sm: "px-2 py-1.5 align-middle whitespace-nowrap",
|
|
17
|
+
md: "px-3 py-2.5 align-middle whitespace-nowrap",
|
|
18
|
+
lg: "px-4 py-3.5 align-middle whitespace-nowrap"
|
|
19
|
+
};
|
|
20
|
+
const captionText = {
|
|
21
|
+
sm: "mt-3 text-caption2 text-label-secondary",
|
|
22
|
+
md: "mt-4 text-footnote text-label-secondary",
|
|
23
|
+
lg: "mt-5 text-subheadline text-label-secondary"
|
|
24
|
+
};
|
|
25
|
+
const TableSizeContext = createContext("md");
|
|
26
|
+
const useTableSize = () => useContext(TableSizeContext);
|
|
27
|
+
function Table({ className, size = "md", ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
"data-slot": "table-container",
|
|
30
|
+
className: "relative w-full overflow-x-auto",
|
|
31
|
+
children: /* @__PURE__ */ jsx(TableSizeContext, {
|
|
32
|
+
value: size,
|
|
33
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
34
|
+
"data-slot": "table",
|
|
35
|
+
className: cx("w-full", tableText[size], className),
|
|
36
|
+
...props
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function TableHeader({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
43
|
+
"data-slot": "table-header",
|
|
44
|
+
className: cx("[&_tr]:border-separator [&_tr]:border-b", className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function TableBody({ className, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
50
|
+
"data-slot": "table-body",
|
|
51
|
+
className: cx("[&_tr:last-child]:border-0", className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function TableFooter({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
57
|
+
"data-slot": "table-footer",
|
|
58
|
+
className: cx("border-separator bg-fill/50 border-t font-semibold [&>tr]:last:border-b-0", className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function TableRow({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
64
|
+
"data-slot": "table-row",
|
|
65
|
+
className: cx("border-separator duration-fast hover:bg-fill/50 has-aria-expanded:bg-fill/50 border-b transition-colors", "data-[state=selected]:bg-accent-soft/60", className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function TableHead({ className, ...props }) {
|
|
70
|
+
const size = useTableSize();
|
|
71
|
+
return /* @__PURE__ */ jsx("th", {
|
|
72
|
+
"data-slot": "table-head",
|
|
73
|
+
className: cx(headCell[size], "text-label-secondary has-[[role=checkbox]]:pe-0", className),
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function TableCell({ className, ...props }) {
|
|
78
|
+
const size = useTableSize();
|
|
79
|
+
return /* @__PURE__ */ jsx("td", {
|
|
80
|
+
"data-slot": "table-cell",
|
|
81
|
+
className: cx(bodyCell[size], "has-[[role=checkbox]]:pe-0", className),
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function TableCaption({ className, ...props }) {
|
|
86
|
+
const size = useTableSize();
|
|
87
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
88
|
+
"data-slot": "table-caption",
|
|
89
|
+
className: cx(captionText[size], className),
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import * as zagTabs from "@zag-js/tabs";
|
|
3
|
+
/**
|
|
4
|
+
* `glass` is the pill with a gliding lens, `line` is quiet text over an
|
|
5
|
+
* underline, `solid` is a filled track with a raised thumb (a segmented
|
|
6
|
+
* control), and `pill` is bare text with a soft accent chip behind the
|
|
7
|
+
* selection. Every variant also runs vertically with `orientation="vertical"`.
|
|
8
|
+
*/
|
|
9
|
+
export type TabsVariant = "glass" | "line" | "solid" | "pill";
|
|
10
|
+
/**
|
|
11
|
+
* Which theme role colors the selection. `neutral` keeps the quiet glass,
|
|
12
|
+
* `accent` follows the app's chosen accent, `primary` is the inverse ink used
|
|
13
|
+
* by primary buttons.
|
|
14
|
+
*/
|
|
15
|
+
export type TabsTone = "neutral" | "accent" | "primary";
|
|
16
|
+
export interface TabsProps extends Omit<zagTabs.Props, "id" | "ids" | "onValueChange"> {
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
/** The look of the tab strip. @default "glass" */
|
|
19
|
+
variant?: TabsVariant;
|
|
20
|
+
/** The theme role that colors the selection. @default "neutral" */
|
|
21
|
+
tone?: TabsTone;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function Tabs({ onValueChange, variant, tone, children, className, ...props }: TabsProps): import("react").JSX.Element;
|
|
26
|
+
export declare function TabsList({ className, children, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
27
|
+
export declare function TabsTrigger({ value, disabled, className, ...props }: Omit<ComponentProps<"button">, "value"> & {
|
|
28
|
+
value: string;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
export declare function TabsContent({ value, className, ...props }: Omit<ComponentProps<"div">, "value"> & {
|
|
31
|
+
value: string;
|
|
32
|
+
}): import("react").JSX.Element;
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "./lib/cx.js";
|
|
3
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
4
|
+
import { createContext, useContext, useId } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as zagTabs from "@zag-js/tabs";
|
|
7
|
+
// src/components/tabs.tsx
|
|
8
|
+
const listStyles = {
|
|
9
|
+
glass: "glass w-fit gap-1 rounded-full p-1",
|
|
10
|
+
line: "w-full gap-5 border-b border-separator/60 data-[orientation=vertical]:w-auto data-[orientation=vertical]:gap-1 data-[orientation=vertical]:border-s data-[orientation=vertical]:border-b-0",
|
|
11
|
+
solid: "bg-fill/70 w-fit gap-0.5 rounded-xl p-0.5",
|
|
12
|
+
pill: "w-fit gap-1"
|
|
13
|
+
};
|
|
14
|
+
const indicatorStyles = {
|
|
15
|
+
glass: "glass-lens rounded-full",
|
|
16
|
+
line: "bg-accent rounded-full top-auto! -bottom-px h-0.5! data-[orientation=vertical]:top-(--top)! data-[orientation=vertical]:bottom-auto! data-[orientation=vertical]:-left-px data-[orientation=vertical]:h-(--height)! data-[orientation=vertical]:w-0.5!",
|
|
17
|
+
solid: "bg-elevated rounded-[10px] shadow-[0_1px_2px_rgb(0_0_0/0.12),0_0_0_0.5px_var(--color-separator)]",
|
|
18
|
+
pill: "bg-accent-soft rounded-full"
|
|
19
|
+
};
|
|
20
|
+
const triggerStyles = {
|
|
21
|
+
glass: "h-7.5 rounded-full px-3 font-semibold transition spring-snappy active:scale-[0.96]",
|
|
22
|
+
line: "h-9 rounded-md px-0.5 font-medium transition-colors data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-3",
|
|
23
|
+
solid: "h-7 rounded-[10px] px-3 font-medium transition spring-snappy active:scale-[0.96]",
|
|
24
|
+
pill: "h-7.5 rounded-full px-3 font-medium transition spring-snappy active:scale-[0.96]"
|
|
25
|
+
};
|
|
26
|
+
/** Indicator fill and the selected label for each tone; `null` keeps the variant's own look. */
|
|
27
|
+
const toneStyles = {
|
|
28
|
+
accent: {
|
|
29
|
+
glass: {
|
|
30
|
+
indicator: "bg-accent rounded-full",
|
|
31
|
+
selected: "data-selected:text-on-accent"
|
|
32
|
+
},
|
|
33
|
+
solid: {
|
|
34
|
+
indicator: "bg-accent rounded-[10px]",
|
|
35
|
+
selected: "data-selected:text-on-accent"
|
|
36
|
+
},
|
|
37
|
+
pill: {
|
|
38
|
+
indicator: "bg-accent rounded-full",
|
|
39
|
+
selected: "data-selected:text-on-accent"
|
|
40
|
+
},
|
|
41
|
+
line: {
|
|
42
|
+
indicator: indicatorStyles.line,
|
|
43
|
+
selected: "data-selected:text-accent-text"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
primary: {
|
|
47
|
+
glass: {
|
|
48
|
+
indicator: "bg-inverse rounded-full",
|
|
49
|
+
selected: "data-selected:text-on-inverse"
|
|
50
|
+
},
|
|
51
|
+
solid: {
|
|
52
|
+
indicator: "bg-inverse rounded-[10px]",
|
|
53
|
+
selected: "data-selected:text-on-inverse"
|
|
54
|
+
},
|
|
55
|
+
pill: {
|
|
56
|
+
indicator: "bg-inverse rounded-full",
|
|
57
|
+
selected: "data-selected:text-on-inverse"
|
|
58
|
+
},
|
|
59
|
+
line: {
|
|
60
|
+
indicator: indicatorStyles.line.replace("bg-accent", "bg-inverse"),
|
|
61
|
+
selected: "data-selected:text-label"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const Context = createContext(null);
|
|
66
|
+
function useTabs() {
|
|
67
|
+
const ctx = useContext(Context);
|
|
68
|
+
if (!ctx) throw new Error("Tabs parts must be used inside <Tabs>.");
|
|
69
|
+
return ctx;
|
|
70
|
+
}
|
|
71
|
+
function Tabs({ onValueChange, variant = "glass", tone = "neutral", children, className, ...props }) {
|
|
72
|
+
const id = useId();
|
|
73
|
+
const service = useMachine(zagTabs.machine, {
|
|
74
|
+
id,
|
|
75
|
+
onValueChange: ({ value }) => onValueChange?.(value),
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
const api = zagTabs.connect(service, normalizeProps);
|
|
79
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
80
|
+
value: {
|
|
81
|
+
api,
|
|
82
|
+
variant,
|
|
83
|
+
tone
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
86
|
+
...api.getRootProps(),
|
|
87
|
+
"data-slot": "tabs",
|
|
88
|
+
"data-tone": tone,
|
|
89
|
+
className: cx("flex flex-col gap-3 data-[orientation=vertical]:flex-row", className),
|
|
90
|
+
children
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function TabsList({ className, children, ...props }) {
|
|
95
|
+
const { api, variant, tone } = useTabs();
|
|
96
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
97
|
+
...api.getListProps(),
|
|
98
|
+
"data-slot": "tabs-list",
|
|
99
|
+
"data-variant": variant,
|
|
100
|
+
className: cx("relative inline-flex items-center data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", listStyles[variant], className),
|
|
101
|
+
...props,
|
|
102
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
103
|
+
...api.getIndicatorProps(),
|
|
104
|
+
"aria-hidden": "true",
|
|
105
|
+
"data-slot": "tabs-indicator",
|
|
106
|
+
className: cx("spring-smooth absolute z-0 left-(--left) top-(--top) h-(--height) w-(--width) transition-[left,top,width,height] motion-reduce:transition-none", tone === "neutral" ? indicatorStyles[variant] : toneStyles[tone][variant].indicator)
|
|
107
|
+
}), children]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function TabsTrigger({ value, disabled, className, ...props }) {
|
|
111
|
+
const { api, variant, tone } = useTabs();
|
|
112
|
+
return /* @__PURE__ */ jsx("button", {
|
|
113
|
+
...api.getTriggerProps({
|
|
114
|
+
value,
|
|
115
|
+
disabled
|
|
116
|
+
}),
|
|
117
|
+
"data-slot": "tabs-trigger",
|
|
118
|
+
className: cx("relative z-10 inline-flex items-center justify-center gap-2 whitespace-nowrap text-footnote text-label-secondary outline-none hover:text-label focus-visible:ring-2 focus-visible:ring-accent/70 disabled:opacity-40 motion-reduce:transition-none", triggerStyles[variant], tone === "neutral" ? variant === "pill" ? "data-selected:text-accent-text" : "data-selected:text-label" : toneStyles[tone][variant].selected, className),
|
|
119
|
+
...props
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function TabsContent({ value, className, ...props }) {
|
|
123
|
+
const { api } = useTabs();
|
|
124
|
+
return /* @__PURE__ */ jsx("div", {
|
|
125
|
+
...api.getContentProps({ value }),
|
|
126
|
+
"data-slot": "tabs-content",
|
|
127
|
+
className: cx("outline-none", className),
|
|
128
|
+
...props
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/** Apple's Dynamic Type styles, from the smallest caption to a screen title. */
|
|
3
|
+
export type TextSize = "caption2" | "caption" | "footnote" | "subheadline" | "callout" | "body" | "headline" | "title3" | "title2" | "title" | "large-title";
|
|
4
|
+
/** The theme role that colors the text. */
|
|
5
|
+
export type TextTone = "default" | "secondary" | "tertiary" | "accent" | "success" | "warning" | "danger";
|
|
6
|
+
export type TextWeight = "normal" | "medium" | "semibold" | "bold";
|
|
7
|
+
export type TextElement = "p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "strong" | "em" | "small";
|
|
8
|
+
export type TextProps = Omit<ComponentProps<"p">, "color"> & {
|
|
9
|
+
/** The element to render, so a heading keeps its place in the outline. @default "p" */
|
|
10
|
+
as?: TextElement;
|
|
11
|
+
/** A Dynamic Type style. @default "subheadline" */
|
|
12
|
+
size?: TextSize;
|
|
13
|
+
/** The theme role that colors it. @default "default" */
|
|
14
|
+
tone?: TextTone;
|
|
15
|
+
/** @default "normal" */
|
|
16
|
+
weight?: TextWeight;
|
|
17
|
+
/** Cuts it to one line with an ellipsis. @default false */
|
|
18
|
+
truncate?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Text set in the theme's type scale and roles, so words on a page follow the
|
|
22
|
+
* app's text size and colors without raw sizes or hex values. Pick the element
|
|
23
|
+
* with `as`; the style and the element are separate choices.
|
|
24
|
+
*/
|
|
25
|
+
export declare function Text({ as, size, tone, weight, truncate, className, ...props }: TextProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
// src/components/text.tsx
|
|
4
|
+
const sizes = {
|
|
5
|
+
caption2: "text-caption2 leading-caption2",
|
|
6
|
+
caption: "text-caption leading-caption",
|
|
7
|
+
footnote: "text-footnote leading-footnote",
|
|
8
|
+
subheadline: "text-subheadline leading-subheadline",
|
|
9
|
+
callout: "text-callout leading-callout",
|
|
10
|
+
body: "text-body leading-body",
|
|
11
|
+
headline: "text-headline leading-headline",
|
|
12
|
+
title3: "text-title3 leading-title3",
|
|
13
|
+
title2: "text-title2 leading-title2",
|
|
14
|
+
title: "text-title leading-title",
|
|
15
|
+
"large-title": "text-large-title leading-large-title"
|
|
16
|
+
};
|
|
17
|
+
const tones = {
|
|
18
|
+
default: "text-label",
|
|
19
|
+
secondary: "text-label-secondary",
|
|
20
|
+
tertiary: "text-label-tertiary",
|
|
21
|
+
accent: "text-accent-text",
|
|
22
|
+
success: "text-success",
|
|
23
|
+
warning: "text-warning",
|
|
24
|
+
danger: "text-danger"
|
|
25
|
+
};
|
|
26
|
+
const weights = {
|
|
27
|
+
normal: "font-normal",
|
|
28
|
+
medium: "font-medium",
|
|
29
|
+
semibold: "font-semibold",
|
|
30
|
+
bold: "font-bold"
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Text set in the theme's type scale and roles, so words on a page follow the
|
|
34
|
+
* app's text size and colors without raw sizes or hex values. Pick the element
|
|
35
|
+
* with `as`; the style and the element are separate choices.
|
|
36
|
+
*/
|
|
37
|
+
function Text({ as = "p", size = "subheadline", tone = "default", weight = "normal", truncate, className, ...props }) {
|
|
38
|
+
return createElement(as, {
|
|
39
|
+
"data-slot": "text",
|
|
40
|
+
className: cx("m-0", sizes[size], tones[tone], weights[weight], truncate && "truncate", className),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export { Text };
|