@passui/react 0.1.47 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -109
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/accordion.d.ts +15 -0
- package/dist/accordion.js +93 -0
- package/dist/alert-dialog.d.ts +26 -0
- package/dist/alert-dialog.js +142 -0
- package/dist/alert.d.ts +10 -0
- package/dist/alert.js +28 -0
- package/dist/{types/src/components/ambient/ambient.d.ts → ambient.d.ts} +4 -4
- package/dist/ambient.js +22 -0
- package/dist/{types/src/appearance → appearance}/platform.d.ts +3 -3
- package/dist/appearance/platform.js +43 -0
- package/dist/appearance/theme.d.ts +71 -0
- package/dist/appearance/theme.js +236 -0
- package/dist/appearance.d.ts +3 -0
- package/dist/appearance.js +3 -0
- package/dist/{types/src/components/aspect-ratio/aspect-ratio.d.ts → aspect-ratio.d.ts} +4 -4
- package/dist/aspect-ratio.js +17 -0
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.js +43 -0
- package/dist/badge.d.ts +8 -0
- package/dist/badge.js +21 -0
- package/dist/breadcrumb.d.ts +13 -0
- package/dist/breadcrumb.js +63 -0
- package/dist/button-group.d.ts +5 -0
- package/dist/button-group.js +14 -0
- package/dist/button.d.ts +21 -0
- package/dist/button.js +58 -0
- package/dist/calendar.d.ts +35 -0
- package/dist/calendar.js +225 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.js +54 -0
- package/dist/chart.d.ts +30 -0
- package/dist/chart.js +226 -0
- package/dist/checkbox.d.ts +13 -0
- package/dist/checkbox.js +53 -0
- package/dist/{types/src/lib/clipboard.d.ts → clipboard.d.ts} +1 -1
- package/dist/clipboard.js +16 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +10 -0
- package/dist/code-block.d.ts +34 -0
- package/dist/code-block.js +87 -0
- package/dist/collapsible.d.ts +13 -0
- package/dist/collapsible.js +49 -0
- package/dist/combobox.d.ts +25 -0
- package/dist/combobox.js +112 -0
- package/dist/command.d.ts +22 -0
- package/dist/command.js +129 -0
- package/dist/components/toast/toast-store.d.ts +60 -0
- package/dist/components/toast/toast-store.js +96 -0
- package/dist/{types/src/components → components}/toast/toaster.d.ts +4 -4
- package/dist/components/toast/toaster.js +345 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +2 -0
- package/dist/conversation.d.ts +48 -0
- package/dist/conversation.js +202 -0
- package/dist/date-time-picker.d.ts +50 -0
- package/dist/date-time-picker.js +235 -0
- package/dist/date.d.ts +50 -0
- package/dist/date.js +77 -0
- package/dist/dialog.d.ts +21 -0
- package/dist/dialog.js +113 -0
- package/dist/drawer.d.ts +30 -0
- package/dist/drawer.js +140 -0
- package/dist/dropdown-menu.d.ts +56 -0
- package/dist/dropdown-menu.js +295 -0
- package/dist/empty.d.ts +11 -0
- package/dist/empty.js +51 -0
- package/dist/field.d.ts +16 -0
- package/dist/field.js +47 -0
- package/{src/hooks/scroll/minimize-decision.ts → dist/hooks/scroll/minimize-decision.js} +3 -5
- package/dist/{types/src/hooks → hooks}/use-anchored-placement.d.ts +2 -2
- package/dist/hooks/use-anchored-placement.js +33 -0
- package/dist/{types/src/hooks → hooks}/use-minimize-on-scroll.d.ts +1 -1
- package/dist/hooks/use-minimize-on-scroll.js +59 -0
- package/dist/{types/src/hooks → hooks}/use-visual-viewport.d.ts +2 -2
- package/{src/hooks/use-visual-viewport.ts → dist/hooks/use-visual-viewport.js} +20 -35
- package/dist/hooks/viewport/types.d.ts +7 -0
- package/dist/hooks/viewport/viewport-metrics.js +13 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +80 -0
- package/dist/input-group.d.ts +17 -0
- package/dist/input-group.js +55 -0
- package/dist/input-otp.d.ts +13 -0
- package/dist/input-otp.js +36 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.js +14 -0
- package/dist/item.d.ts +49 -0
- package/dist/item.js +142 -0
- package/dist/kbd.d.ts +4 -0
- package/dist/kbd.js +86 -0
- package/dist/label.d.ts +3 -0
- package/dist/label.js +12 -0
- package/dist/labeled-content.d.ts +24 -0
- package/dist/labeled-content.js +41 -0
- package/dist/{types/src/lib/language.d.ts → language.d.ts} +1 -1
- package/dist/language.js +11 -0
- package/dist/layout.d.ts +24 -0
- package/dist/layout.js +36 -0
- package/dist/{types/src/lib → lib}/anchored-placement.d.ts +27 -27
- package/dist/lib/anchored-placement.js +42 -0
- package/dist/lib/calendar-month.js +90 -0
- package/dist/lib/cx.js +6 -0
- package/dist/lib/drawer.math.js +29 -0
- package/dist/lib/floating-layers.d.ts +3 -0
- package/dist/lib/floating-layers.js +25 -0
- package/dist/{types/src/lib → lib}/haptics.d.ts +1 -1
- package/dist/lib/haptics.js +13 -0
- package/dist/lib/liquid-step.js +33 -0
- package/dist/lib/page-scale.js +58 -0
- package/dist/lib/portal.js +12 -0
- package/dist/lib/presence.js +53 -0
- package/dist/lib/range-value.js +25 -0
- package/dist/lib/render.d.ts +8 -0
- package/dist/lib/render.js +42 -0
- package/dist/lib/rolling-digit.js +83 -0
- package/dist/{types/src/lib → lib}/screen-edges.d.ts +5 -5
- package/dist/lib/screen-edges.js +30 -0
- package/dist/lib/swipe-touch-action.js +34 -0
- package/dist/lib/visual-viewport.js +27 -0
- package/dist/lib/water-drop.js +412 -0
- package/dist/lib/wheel.js +125 -0
- package/dist/list.d.ts +26 -0
- package/dist/list.js +80 -0
- package/dist/locales.d.ts +18 -0
- package/dist/locales.js +36 -0
- package/dist/marker.d.ts +13 -0
- package/dist/marker.js +33 -0
- package/dist/motion/transitions.d.ts +170 -0
- package/dist/motion/transitions.js +156 -0
- package/dist/pagination.d.ts +30 -0
- package/dist/pagination.js +117 -0
- package/dist/popover.d.ts +26 -0
- package/dist/popover.js +101 -0
- package/dist/progress.d.ts +9 -0
- package/dist/progress.js +24 -0
- package/dist/questionnaire.d.ts +46 -0
- package/dist/questionnaire.js +133 -0
- package/dist/radio-group.d.ts +21 -0
- package/dist/radio-group.js +67 -0
- package/dist/search-field.d.ts +18 -0
- package/dist/search-field.js +45 -0
- package/dist/segmented-control.d.ts +16 -0
- package/dist/segmented-control.js +25 -0
- package/dist/select.d.ts +24 -0
- package/dist/select.js +107 -0
- package/dist/separator.d.ts +9 -0
- package/dist/separator.js +17 -0
- package/dist/{types/src/lib/shapes.d.ts → shapes.d.ts} +2 -2
- package/dist/shapes.js +65 -0
- package/dist/sheet.d.ts +24 -0
- package/dist/sheet.js +141 -0
- package/dist/sidebar.d.ts +32 -0
- package/dist/sidebar.js +85 -0
- package/dist/skeleton.d.ts +3 -0
- package/dist/skeleton.js +13 -0
- package/dist/slider.d.ts +9 -0
- package/dist/slider.js +42 -0
- package/dist/slosh-slider.d.ts +21 -0
- package/dist/slosh-slider.js +205 -0
- package/dist/spinner.d.ts +3 -0
- package/dist/spinner.js +20 -0
- package/dist/stat-tile.d.ts +20 -0
- package/dist/stat-tile.js +53 -0
- package/dist/stepper.d.ts +22 -0
- package/dist/stepper.js +98 -0
- package/dist/swatch-picker.d.ts +22 -0
- package/dist/swatch-picker.js +70 -0
- package/dist/switch.d.ts +10 -0
- package/dist/switch.js +44 -0
- package/dist/tab-bar.d.ts +15 -0
- package/dist/tab-bar.js +34 -0
- package/dist/{types/src/components/table/table.d.ts → table.d.ts} +3 -3
- package/dist/table.js +93 -0
- package/dist/tabs.d.ts +32 -0
- package/dist/tabs.js +131 -0
- package/dist/text.d.ts +25 -0
- package/dist/text.js +44 -0
- package/dist/textarea.d.ts +3 -0
- package/dist/textarea.js +13 -0
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +3 -0
- package/dist/toggle-group.d.ts +20 -0
- package/dist/toggle-group.js +68 -0
- package/dist/toggle.d.ts +24 -0
- package/dist/toggle.js +37 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tooltip.d.ts +21 -0
- package/dist/tooltip.js +61 -0
- package/dist/trace.d.ts +14 -0
- package/dist/trace.js +54 -0
- package/dist/{types/src/hooks/use-dismiss.d.ts → use-dismiss.d.ts} +3 -3
- package/dist/use-dismiss.js +38 -0
- package/dist/{types/src/hooks/use-media-query.d.ts → use-media-query.d.ts} +12 -12
- package/dist/use-media-query.js +56 -0
- package/dist/use-os.d.ts +12 -0
- package/dist/use-os.js +17 -0
- package/dist/wake-slider.d.ts +15 -0
- package/dist/wake-slider.js +174 -0
- package/package.json +122 -253
- package/src/styles/code-block.css +4 -0
- package/src/styles/globals.css +5 -0
- package/src/styles/motion-controls.css +10 -0
- package/src/styles/page-scale.css +27 -0
- package/src/styles/styles.css +4 -2
- package/dist/types/src/appearance/index.d.ts +0 -2
- package/dist/types/src/appearance/theme.d.ts +0 -71
- package/dist/types/src/components/accordion/accordion.d.ts +0 -23
- package/dist/types/src/components/ambient/index.d.ts +0 -1
- package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +0 -19
- package/dist/types/src/components/button/button-styles.d.ts +0 -12
- package/dist/types/src/components/button/button.d.ts +0 -32
- package/dist/types/src/components/button/icon-button.d.ts +0 -10
- package/dist/types/src/components/button/pending-spinner.d.ts +0 -5
- package/dist/types/src/components/button/use-pending-indicator.d.ts +0 -2
- package/dist/types/src/components/chip/chip.d.ts +0 -10
- package/dist/types/src/components/code-block/code-block.d.ts +0 -13
- package/dist/types/src/components/combo-box/combo-box.d.ts +0 -9
- package/dist/types/src/components/command/command.d.ts +0 -18
- package/dist/types/src/components/compact-date-picker/calendar-month.d.ts +0 -25
- package/dist/types/src/components/compact-date-picker/compact-date-picker.d.ts +0 -30
- package/dist/types/src/components/compact-time-picker/compact-time-picker.d.ts +0 -29
- package/dist/types/src/components/compact-time-picker/time-value.d.ts +0 -18
- package/dist/types/src/components/content-unavailable-view/content-unavailable-view.d.ts +0 -12
- package/dist/types/src/components/content-view/content-view.d.ts +0 -51
- package/dist/types/src/components/content-view/index.d.ts +0 -1
- package/dist/types/src/components/context-menu/conceal-menu-source.d.ts +0 -2
- package/dist/types/src/components/context-menu/context-menu-host.d.ts +0 -2
- package/dist/types/src/components/context-menu/context-menu-store.d.ts +0 -62
- package/dist/types/src/components/context-menu/menu-navigation.d.ts +0 -6
- package/dist/types/src/components/context-menu/menu-position.d.ts +0 -21
- package/dist/types/src/components/context-menu/menu-reveal.d.ts +0 -26
- package/dist/types/src/components/context-menu/use-context-menu.d.ts +0 -14
- package/dist/types/src/components/conversation/conversation.d.ts +0 -48
- package/dist/types/src/components/conversation/index.d.ts +0 -1
- package/dist/types/src/components/date-picker/date-picker.d.ts +0 -19
- package/dist/types/src/components/date-picker/date-value.d.ts +0 -2
- package/dist/types/src/components/dialog/dialog-host.d.ts +0 -6
- package/dist/types/src/components/dialog/dialog-store.d.ts +0 -23
- package/dist/types/src/components/dialog/dialog.d.ts +0 -33
- package/dist/types/src/components/dialog/index.d.ts +0 -1
- package/dist/types/src/components/disclosure-group/disclosure-group.d.ts +0 -18
- package/dist/types/src/components/divider/divider.d.ts +0 -9
- package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +0 -15
- package/dist/types/src/components/keyboard-shortcut/keyboard-shortcut.d.ts +0 -8
- package/dist/types/src/components/labeled-content/labeled-content.d.ts +0 -22
- package/dist/types/src/components/locale-switcher/index.d.ts +0 -1
- package/dist/types/src/components/locale-switcher/locale-switcher.d.ts +0 -13
- package/dist/types/src/components/menu/menu.d.ts +0 -16
- package/dist/types/src/components/morph/index.d.ts +0 -2
- package/dist/types/src/components/morph/morph.d.ts +0 -32
- package/dist/types/src/components/morph/use-morph-disclosure.d.ts +0 -13
- package/dist/types/src/components/one-time-code/one-time-code.d.ts +0 -26
- package/dist/types/src/components/picker/picker-trigger.d.ts +0 -3
- package/dist/types/src/components/picker/picker.d.ts +0 -46
- package/dist/types/src/components/popover/anchored-surface.d.ts +0 -17
- package/dist/types/src/components/popover/index.d.ts +0 -41
- package/dist/types/src/components/popover/popover-content.d.ts +0 -38
- package/dist/types/src/components/popover/popover-root.d.ts +0 -22
- package/dist/types/src/components/popover/popover-trigger.d.ts +0 -23
- package/dist/types/src/components/profile-image/profile-image.d.ts +0 -9
- package/dist/types/src/components/progress-view/progress-view.d.ts +0 -13
- package/dist/types/src/components/progress-view/use-liquid-progress.d.ts +0 -3
- package/dist/types/src/components/radio-group/radio-group.d.ts +0 -20
- package/dist/types/src/components/search-field/expanding-search-field.d.ts +0 -5
- package/dist/types/src/components/search-field/search-field.d.ts +0 -9
- package/dist/types/src/components/search-list/search-list.d.ts +0 -22
- package/dist/types/src/components/section/section.d.ts +0 -18
- package/dist/types/src/components/secure-field/secure-field.d.ts +0 -4
- package/dist/types/src/components/segmented-control/segmented-control.d.ts +0 -25
- package/dist/types/src/components/sheet/modal-environment.d.ts +0 -2
- package/dist/types/src/components/sheet/sheet-portal.d.ts +0 -5
- package/dist/types/src/components/sheet/sheet.d.ts +0 -26
- package/dist/types/src/components/sheet/use-sheet-focus.d.ts +0 -3
- package/dist/types/src/components/sidebar/sidebar.d.ts +0 -24
- package/dist/types/src/components/skeleton/skeleton.d.ts +0 -9
- package/dist/types/src/components/slider/slider.d.ts +0 -17
- package/dist/types/src/components/slosh-slider/liquid-step.d.ts +0 -6
- package/dist/types/src/components/slosh-slider/slosh-slider.d.ts +0 -21
- package/dist/types/src/components/stat-tile/index.d.ts +0 -1
- package/dist/types/src/components/stat-tile/stat-tile.d.ts +0 -20
- package/dist/types/src/components/status-indicator/status-indicator.d.ts +0 -17
- package/dist/types/src/components/stepper/rolling-digit.d.ts +0 -11
- package/dist/types/src/components/stepper/stepper.d.ts +0 -22
- package/dist/types/src/components/swatch-picker/swatch-picker.d.ts +0 -22
- package/dist/types/src/components/tab-bar/tab-bar.d.ts +0 -43
- package/dist/types/src/components/tab-view/tab-view.d.ts +0 -27
- package/dist/types/src/components/text-editor/text-editor.d.ts +0 -9
- package/dist/types/src/components/text-field/text-field.d.ts +0 -33
- package/dist/types/src/components/toast/toast-store.d.ts +0 -52
- package/dist/types/src/components/toggle/toggle.d.ts +0 -22
- package/dist/types/src/components/tooltip/tooltip-host.d.ts +0 -7
- package/dist/types/src/components/view-controller/index.d.ts +0 -1
- package/dist/types/src/components/view-controller/view-controller.d.ts +0 -21
- package/dist/types/src/components/wake-slider/wake-slider.d.ts +0 -15
- package/dist/types/src/hooks/scroll/minimize-decision.d.ts +0 -2
- package/dist/types/src/hooks/use-anchored-disclosure.d.ts +0 -9
- package/dist/types/src/hooks/use-floating-dismiss.d.ts +0 -3
- package/dist/types/src/hooks/viewport/types.d.ts +0 -19
- package/dist/types/src/hooks/viewport/viewport-metrics.d.ts +0 -3
- package/dist/types/src/icons/icons.d.ts +0 -616
- package/dist/types/src/index.d.ts +0 -73
- package/dist/types/src/lib/class-names.d.ts +0 -2
- package/dist/types/src/lib/date.d.ts +0 -50
- package/dist/types/src/lib/floating-layers.d.ts +0 -8
- package/dist/types/src/lib/range-value.d.ts +0 -4
- package/dist/types/src/machines/popover.machine.d.ts +0 -30
- package/dist/types/src/motion/transitions.d.ts +0 -170
- package/src/appearance/index.ts +0 -2
- package/src/appearance/platform.tsx +0 -102
- package/src/appearance/theme.tsx +0 -467
- package/src/components/accordion/accordion.tsx +0 -70
- package/src/components/ambient/ambient.tsx +0 -35
- package/src/components/ambient/index.ts +0 -1
- package/src/components/aspect-ratio/aspect-ratio.tsx +0 -27
- package/src/components/breadcrumb/breadcrumb.tsx +0 -73
- package/src/components/button/button-styles.ts +0 -49
- package/src/components/button/button.tsx +0 -107
- package/src/components/button/icon-button.tsx +0 -33
- package/src/components/button/pending-spinner.tsx +0 -14
- package/src/components/button/use-pending-indicator.ts +0 -22
- package/src/components/chip/chip.tsx +0 -45
- package/src/components/code-block/code-block.tsx +0 -48
- package/src/components/combo-box/combo-box.tsx +0 -13
- package/src/components/command/command.tsx +0 -149
- package/src/components/compact-date-picker/calendar-month.ts +0 -109
- package/src/components/compact-date-picker/compact-date-picker.tsx +0 -337
- package/src/components/compact-time-picker/compact-time-picker.tsx +0 -321
- package/src/components/compact-time-picker/time-value.ts +0 -58
- package/src/components/content-unavailable-view/content-unavailable-view.tsx +0 -78
- package/src/components/content-view/content-view.tsx +0 -215
- package/src/components/content-view/index.ts +0 -1
- package/src/components/context-menu/conceal-menu-source.ts +0 -30
- package/src/components/context-menu/context-menu-host.tsx +0 -459
- package/src/components/context-menu/context-menu-store.ts +0 -167
- package/src/components/context-menu/menu-navigation.ts +0 -36
- package/src/components/context-menu/menu-position.ts +0 -38
- package/src/components/context-menu/menu-reveal.ts +0 -42
- package/src/components/context-menu/use-context-menu.ts +0 -73
- package/src/components/conversation/conversation.tsx +0 -309
- package/src/components/conversation/index.ts +0 -1
- package/src/components/date-picker/date-picker.tsx +0 -106
- package/src/components/date-picker/date-value.ts +0 -22
- package/src/components/dialog/dialog-host.tsx +0 -119
- package/src/components/dialog/dialog-store.ts +0 -66
- package/src/components/dialog/dialog.tsx +0 -211
- package/src/components/dialog/index.ts +0 -1
- package/src/components/disclosure-group/disclosure-group.tsx +0 -108
- package/src/components/divider/divider.tsx +0 -33
- package/src/components/inline-disclosure/inline-disclosure.tsx +0 -53
- package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +0 -32
- package/src/components/labeled-content/labeled-content.tsx +0 -84
- package/src/components/locale-switcher/index.ts +0 -1
- package/src/components/locale-switcher/locale-switcher.tsx +0 -310
- package/src/components/menu/menu.tsx +0 -85
- package/src/components/morph/index.ts +0 -2
- package/src/components/morph/morph.tsx +0 -258
- package/src/components/morph/use-morph-disclosure.ts +0 -27
- package/src/components/one-time-code/one-time-code.tsx +0 -234
- package/src/components/picker/picker-trigger.ts +0 -22
- package/src/components/picker/picker.tsx +0 -404
- package/src/components/popover/anchored-surface.tsx +0 -264
- package/src/components/popover/index.ts +0 -50
- package/src/components/popover/popover-content.tsx +0 -374
- package/src/components/popover/popover-root.tsx +0 -97
- package/src/components/popover/popover-trigger.tsx +0 -71
- package/src/components/profile-image/profile-image.tsx +0 -96
- package/src/components/progress-view/progress-view.tsx +0 -72
- package/src/components/progress-view/use-liquid-progress.ts +0 -43
- package/src/components/radio-group/radio-group.tsx +0 -86
- package/src/components/search-field/expanding-search-field.tsx +0 -197
- package/src/components/search-field/search-field.tsx +0 -66
- package/src/components/search-list/search-list.tsx +0 -276
- package/src/components/section/section.tsx +0 -75
- package/src/components/secure-field/secure-field.tsx +0 -8
- package/src/components/segmented-control/segmented-control.tsx +0 -157
- package/src/components/sheet/modal-environment.ts +0 -82
- package/src/components/sheet/sheet-portal.tsx +0 -62
- package/src/components/sheet/sheet.tsx +0 -165
- package/src/components/sheet/use-sheet-focus.ts +0 -109
- package/src/components/sidebar/sidebar.tsx +0 -102
- package/src/components/skeleton/skeleton.tsx +0 -38
- package/src/components/slider/slider.tsx +0 -134
- package/src/components/slosh-slider/liquid-step.ts +0 -43
- package/src/components/slosh-slider/slosh-slider.tsx +0 -294
- package/src/components/stat-tile/index.ts +0 -1
- package/src/components/stat-tile/stat-tile.tsx +0 -90
- package/src/components/status-indicator/status-indicator.tsx +0 -54
- package/src/components/stepper/rolling-digit.tsx +0 -91
- package/src/components/stepper/stepper.tsx +0 -136
- package/src/components/swatch-picker/swatch-picker.tsx +0 -138
- package/src/components/tab-bar/tab-bar.tsx +0 -182
- package/src/components/tab-view/tab-view.tsx +0 -155
- package/src/components/table/table.tsx +0 -151
- package/src/components/text-editor/text-editor.tsx +0 -42
- package/src/components/text-field/text-field.tsx +0 -200
- package/src/components/toast/toast-store.ts +0 -164
- package/src/components/toast/toaster.tsx +0 -407
- package/src/components/toggle/toggle.tsx +0 -320
- package/src/components/tooltip/tooltip-host.tsx +0 -178
- package/src/components/view-controller/index.ts +0 -1
- package/src/components/view-controller/view-controller.tsx +0 -75
- package/src/components/wake-slider/wake-slider.tsx +0 -260
- package/src/hooks/use-anchored-disclosure.ts +0 -23
- package/src/hooks/use-anchored-placement.ts +0 -40
- package/src/hooks/use-dismiss.ts +0 -44
- package/src/hooks/use-floating-dismiss.ts +0 -30
- package/src/hooks/use-media-query.ts +0 -94
- package/src/hooks/use-minimize-on-scroll.ts +0 -77
- package/src/hooks/viewport/types.ts +0 -19
- package/src/hooks/viewport/viewport-metrics.ts +0 -19
- package/src/icons/icons.tsx +0 -458
- package/src/index.ts +0 -107
- package/src/lib/anchored-placement.ts +0 -91
- package/src/lib/class-names.ts +0 -21
- package/src/lib/clipboard.ts +0 -15
- package/src/lib/date.ts +0 -86
- package/src/lib/floating-layers.ts +0 -53
- package/src/lib/haptics.ts +0 -23
- package/src/lib/language.ts +0 -16
- package/src/lib/range-value.ts +0 -38
- package/src/lib/screen-edges.ts +0 -44
- package/src/lib/shapes.ts +0 -59
- package/src/machines/popover.machine.ts +0 -51
- package/src/motion/transitions.ts +0 -97
- package/src/tokens.ts +0 -1
- /package/dist/{types/src/tokens.d.ts → tokens.js} +0 -0
package/dist/calendar.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { addDays, addMonths, firstWeekday, formatDay, monthGrid, parseDay, withinBounds } from "./lib/calendar-month.js";
|
|
3
|
+
import { cx } from "./lib/cx.js";
|
|
4
|
+
import { Wheel } from "./lib/wheel.js";
|
|
5
|
+
import { useId, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDownIcon } from "@passui/icons/chevron-down";
|
|
8
|
+
import { ChevronLeftIcon } from "@passui/icons/chevron-left";
|
|
9
|
+
import { ChevronRightIcon } from "@passui/icons/chevron-right";
|
|
10
|
+
// src/components/calendar.tsx
|
|
11
|
+
const today = () => {
|
|
12
|
+
const now = /* @__PURE__ */ new Date();
|
|
13
|
+
return {
|
|
14
|
+
year: now.getFullYear(),
|
|
15
|
+
month: now.getMonth() + 1,
|
|
16
|
+
day: now.getDate()
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/** Whole years offered by the month and year wheels around `now`, widened to the bounds. */
|
|
20
|
+
function yearSpan(now, min, max) {
|
|
21
|
+
const from = parseDay(min ?? "")?.year ?? now - 100;
|
|
22
|
+
const to = parseDay(max ?? "")?.year ?? now + 50;
|
|
23
|
+
return Array.from({ length: Math.max(1, to - from + 1) }, (_, i) => from + i);
|
|
24
|
+
}
|
|
25
|
+
const cell = "relative mx-auto flex size-8.5 items-center justify-center rounded-full text-footnote tabular-nums outline-none transition-colors duration-(--duration-fast) focus-visible:ring-2 focus-visible:ring-accent/70 disabled:pointer-events-none disabled:opacity-30 motion-reduce:transition-none";
|
|
26
|
+
/**
|
|
27
|
+
* An inline month calendar for one day or a range, on the locale's own week.
|
|
28
|
+
* Arrow keys move by day and week, Page Up and Page Down by month, Home and
|
|
29
|
+
* End to the week's edges.
|
|
30
|
+
*/
|
|
31
|
+
function Calendar(props) {
|
|
32
|
+
const { label, locale, min, max, labels, className } = props;
|
|
33
|
+
const range = props.mode === "range";
|
|
34
|
+
const selected = range ? props.value.from : props.value;
|
|
35
|
+
const to = range ? props.value.to : "";
|
|
36
|
+
const start = parseDay(selected) ?? today();
|
|
37
|
+
const [focus, setFocus] = useState(start);
|
|
38
|
+
const [hover, setHover] = useState("");
|
|
39
|
+
const [jumping, setJumping] = useState(false);
|
|
40
|
+
const grid = useRef(null);
|
|
41
|
+
const headingId = useId();
|
|
42
|
+
const first = firstWeekday(locale);
|
|
43
|
+
const days = useMemo(() => monthGrid(focus.year, focus.month, first), [
|
|
44
|
+
focus.year,
|
|
45
|
+
focus.month,
|
|
46
|
+
first
|
|
47
|
+
]);
|
|
48
|
+
const monthTitle = new Intl.DateTimeFormat(locale, {
|
|
49
|
+
month: "long",
|
|
50
|
+
year: "numeric",
|
|
51
|
+
timeZone: "UTC"
|
|
52
|
+
}).format(new Date(Date.UTC(focus.year, focus.month - 1, 1)));
|
|
53
|
+
const weekdays = Array.from({ length: 7 }, (_, index) => new Intl.DateTimeFormat(locale, {
|
|
54
|
+
weekday: "short",
|
|
55
|
+
timeZone: "UTC"
|
|
56
|
+
}).format(new Date(Date.UTC(2024, 0, (first - 1 + index) % 7 + 1))));
|
|
57
|
+
const todayValue = formatDay(today());
|
|
58
|
+
const monthOptions = useMemo(() => Array.from({ length: 12 }, (_, index) => ({
|
|
59
|
+
value: index + 1,
|
|
60
|
+
label: new Intl.DateTimeFormat(locale, {
|
|
61
|
+
month: "long",
|
|
62
|
+
timeZone: "UTC"
|
|
63
|
+
}).format(new Date(Date.UTC(2024, index, 1)))
|
|
64
|
+
})), [locale]);
|
|
65
|
+
const yearOptions = useMemo(() => {
|
|
66
|
+
const years = yearSpan(today().year, min, max);
|
|
67
|
+
if (!years.includes(focus.year)) years.push(focus.year);
|
|
68
|
+
const plain = new Intl.NumberFormat(locale, { useGrouping: false });
|
|
69
|
+
return years.sort((a, b) => a - b).map((year) => ({
|
|
70
|
+
value: year,
|
|
71
|
+
label: plain.format(year)
|
|
72
|
+
}));
|
|
73
|
+
}, [
|
|
74
|
+
locale,
|
|
75
|
+
min,
|
|
76
|
+
max,
|
|
77
|
+
focus.year
|
|
78
|
+
]);
|
|
79
|
+
const field = (name) => new Intl.DisplayNames([locale], { type: "dateTimeField" }).of(name) ?? name;
|
|
80
|
+
/** Position of a day within its week, 0 for the locale's first day. */
|
|
81
|
+
const weekIndex = (day) => ((new Date(Date.UTC(day.year, day.month - 1, day.day)).getUTCDay() || 7) - first + 7) % 7;
|
|
82
|
+
const move = (next) => {
|
|
83
|
+
setFocus(next);
|
|
84
|
+
requestAnimationFrame(() => grid.current?.querySelector(`[data-day="${formatDay(next)}"]`)?.focus());
|
|
85
|
+
};
|
|
86
|
+
const pick = (value) => {
|
|
87
|
+
if (!withinBounds(value, min, max)) return;
|
|
88
|
+
if (props.mode !== "range") {
|
|
89
|
+
props.onValueChange(value);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (!(props.value.from && !props.value.to)) props.onValueChange({
|
|
93
|
+
from: value,
|
|
94
|
+
to: ""
|
|
95
|
+
});
|
|
96
|
+
else if (value < props.value.from) props.onValueChange({
|
|
97
|
+
from: value,
|
|
98
|
+
to: ""
|
|
99
|
+
});
|
|
100
|
+
else props.onValueChange({
|
|
101
|
+
from: props.value.from,
|
|
102
|
+
to: value
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
const onKeyDown = (event) => {
|
|
106
|
+
const next = (() => {
|
|
107
|
+
switch (event.key) {
|
|
108
|
+
case "ArrowLeft": return addDays(focus, -1);
|
|
109
|
+
case "ArrowRight": return addDays(focus, 1);
|
|
110
|
+
case "ArrowUp": return addDays(focus, -7);
|
|
111
|
+
case "ArrowDown": return addDays(focus, 7);
|
|
112
|
+
case "PageUp": return addMonths(focus, -1);
|
|
113
|
+
case "PageDown": return addMonths(focus, 1);
|
|
114
|
+
case "Home": return addDays(focus, -weekIndex(focus));
|
|
115
|
+
case "End": return addDays(focus, 6 - weekIndex(focus));
|
|
116
|
+
default: return null;
|
|
117
|
+
}
|
|
118
|
+
})();
|
|
119
|
+
if (!next) return;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
move(next);
|
|
122
|
+
};
|
|
123
|
+
const edge = range && props.value.from && !props.value.to ? hover : to;
|
|
124
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
"data-slot": "calendar",
|
|
126
|
+
className: cx("w-[17.5rem]", className),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsxs("div", {
|
|
129
|
+
className: "mb-2 flex items-center justify-between",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
"aria-label": labels.previousMonth,
|
|
134
|
+
disabled: jumping,
|
|
135
|
+
onClick: () => setFocus(addMonths(focus, -1)),
|
|
136
|
+
className: "text-label-secondary hover:bg-fill/80 hover:text-label focus-visible:ring-accent/70 flex size-7.5 items-center justify-center rounded-full outline-none focus-visible:ring-2 disabled:opacity-0",
|
|
137
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 14 })
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ jsxs("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
id: headingId,
|
|
142
|
+
"aria-live": "polite",
|
|
143
|
+
"aria-expanded": jumping,
|
|
144
|
+
onClick: () => setJumping(!jumping),
|
|
145
|
+
className: "text-footnote text-label hover:bg-fill/80 focus-visible:ring-accent/70 flex h-7.5 items-center gap-1 rounded-full px-3 font-semibold outline-none focus-visible:ring-2",
|
|
146
|
+
children: [monthTitle, /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
147
|
+
size: 12,
|
|
148
|
+
className: cx("text-label-secondary spring-snappy transition-transform motion-reduce:transition-none", jumping && "rotate-180")
|
|
149
|
+
})]
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ jsx("button", {
|
|
152
|
+
type: "button",
|
|
153
|
+
"aria-label": labels.nextMonth,
|
|
154
|
+
disabled: jumping,
|
|
155
|
+
onClick: () => setFocus(addMonths(focus, 1)),
|
|
156
|
+
className: "text-label-secondary hover:bg-fill/80 hover:text-label focus-visible:ring-accent/70 flex size-7.5 items-center justify-center rounded-full outline-none focus-visible:ring-2 disabled:opacity-0",
|
|
157
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { size: 14 })
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
jumping ? /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
className: "flex min-h-[15.5rem] items-center justify-center gap-2",
|
|
163
|
+
onKeyDown: (event) => {
|
|
164
|
+
if (event.key !== "Escape") return;
|
|
165
|
+
event.stopPropagation();
|
|
166
|
+
setJumping(false);
|
|
167
|
+
},
|
|
168
|
+
children: [/* @__PURE__ */ jsx(Wheel, {
|
|
169
|
+
label: field("month"),
|
|
170
|
+
options: monthOptions,
|
|
171
|
+
value: focus.month,
|
|
172
|
+
onValueChange: (month) => setFocus(addMonths(focus, month - focus.month)),
|
|
173
|
+
className: "w-32"
|
|
174
|
+
}), /* @__PURE__ */ jsx(Wheel, {
|
|
175
|
+
label: field("year"),
|
|
176
|
+
options: yearOptions,
|
|
177
|
+
value: focus.year,
|
|
178
|
+
onValueChange: (year) => setFocus(addMonths(focus, (year - focus.year) * 12)),
|
|
179
|
+
className: "w-24"
|
|
180
|
+
})]
|
|
181
|
+
}) : null,
|
|
182
|
+
/* @__PURE__ */ jsx("div", {
|
|
183
|
+
ref: grid,
|
|
184
|
+
hidden: jumping,
|
|
185
|
+
onMouseLeave: () => setHover(""),
|
|
186
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
187
|
+
"aria-labelledby": headingId,
|
|
188
|
+
"aria-label": label,
|
|
189
|
+
onKeyDown,
|
|
190
|
+
className: "w-full table-fixed border-collapse",
|
|
191
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: weekdays.map((name) => /* @__PURE__ */ jsx("th", {
|
|
192
|
+
scope: "col",
|
|
193
|
+
className: "text-caption text-label-tertiary py-1 text-center font-medium",
|
|
194
|
+
children: name
|
|
195
|
+
}, name)) }) }), /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ jsx("tr", { children: days.slice(week * 7, week * 7 + 7).map((day) => {
|
|
196
|
+
const value = formatDay(day);
|
|
197
|
+
const isStart = value === selected;
|
|
198
|
+
const isEnd = range && value === to;
|
|
199
|
+
const inSpan = range && !!selected && !!edge && value > selected && value < edge;
|
|
200
|
+
const blocked = !withinBounds(value, min, max);
|
|
201
|
+
return /* @__PURE__ */ jsx("td", {
|
|
202
|
+
className: cx("p-0", inSpan && "bg-accent-soft/70"),
|
|
203
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
204
|
+
type: "button",
|
|
205
|
+
"data-day": value,
|
|
206
|
+
"data-today": value === todayValue || void 0,
|
|
207
|
+
"aria-pressed": isStart || isEnd,
|
|
208
|
+
"data-selected": isStart || isEnd || void 0,
|
|
209
|
+
"data-outside": !day.inMonth || void 0,
|
|
210
|
+
tabIndex: day.year === focus.year && day.month === focus.month && day.day === focus.day ? 0 : -1,
|
|
211
|
+
disabled: blocked,
|
|
212
|
+
onClick: () => pick(value),
|
|
213
|
+
onFocus: () => setFocus(day),
|
|
214
|
+
onMouseEnter: () => setHover(value),
|
|
215
|
+
className: cx(cell, !day.inMonth && "text-label-tertiary", day.inMonth && "text-label", value === todayValue && "text-accent-text font-semibold", !(isStart || isEnd) && "hover:bg-fill/80", (isStart || isEnd) && "bg-accent text-on-accent font-semibold"),
|
|
216
|
+
children: day.day
|
|
217
|
+
})
|
|
218
|
+
}, value);
|
|
219
|
+
}) }, week)) })]
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
export { Calendar };
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/** A grouped surface. Compose with the header, content and footer parts. */
|
|
3
|
+
export declare function Card({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
4
|
+
export declare function CardHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
5
|
+
export declare function CardTitle({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
6
|
+
export declare function CardDescription({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
7
|
+
export declare function CardAction({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
8
|
+
export declare function CardContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
9
|
+
export declare function CardFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
package/dist/card.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/card.tsx
|
|
4
|
+
/** A grouped surface. Compose with the header, content and footer parts. */
|
|
5
|
+
function Card({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
"data-slot": "card",
|
|
8
|
+
className: cx("card-surface squircle flex flex-col gap-4 py-5 text-label [--squircle-radius:1.5rem]", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function CardHeader({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
"data-slot": "card-header",
|
|
15
|
+
className: cx("grid auto-rows-min items-start gap-1 px-5 has-data-[slot=card-action]:grid-cols-[1fr_auto]", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function CardTitle({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
"data-slot": "card-title",
|
|
22
|
+
className: cx("text-headline font-semibold leading-tight", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function CardDescription({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
"data-slot": "card-description",
|
|
29
|
+
className: cx("text-footnote text-label-secondary", className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function CardAction({ className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx("div", {
|
|
35
|
+
"data-slot": "card-action",
|
|
36
|
+
className: cx("col-start-2 row-span-2 row-start-1 self-start", className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function CardContent({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "card-content",
|
|
43
|
+
className: cx("px-5", className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function CardFooter({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
"data-slot": "card-footer",
|
|
50
|
+
className: cx("flex items-center px-5", className),
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
package/dist/chart.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/** `bar` compares values, `line` follows a trend, `area` is a line with its weight filled in. */
|
|
3
|
+
export type ChartType = "bar" | "line" | "area";
|
|
4
|
+
export interface ChartSeries {
|
|
5
|
+
/** The key of the value in each data row. */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Names the series in the tooltip and legend. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Any CSS colour. Defaults to the accent, then success, warning and danger. */
|
|
10
|
+
color?: string;
|
|
11
|
+
}
|
|
12
|
+
export type ChartProps = Omit<ComponentProps<"div">, "children"> & {
|
|
13
|
+
/** One row per point on the x axis. */
|
|
14
|
+
data: Array<Record<string, string | number>>;
|
|
15
|
+
/** The key holding each row's x label. */
|
|
16
|
+
xKey: string;
|
|
17
|
+
series: ChartSeries[];
|
|
18
|
+
/** Names the chart for assistive technology. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** @default "line" */
|
|
21
|
+
type?: ChartType;
|
|
22
|
+
/** Formats a value for the axis and the tooltip. */
|
|
23
|
+
format?: (value: number) => string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A responsive SVG chart for one or more series. Bars grow and lines draw on
|
|
27
|
+
* first paint, a tooltip follows the pointer to the nearest point, and a
|
|
28
|
+
* hidden table carries the same numbers for screen readers.
|
|
29
|
+
*/
|
|
30
|
+
export declare function Chart({ data, xKey, series, label, type, format, className, ...props }: ChartProps): import("react").JSX.Element;
|
package/dist/chart.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "./lib/cx.js";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/chart.tsx
|
|
6
|
+
const palette = [
|
|
7
|
+
"var(--color-accent)",
|
|
8
|
+
"var(--color-success)",
|
|
9
|
+
"var(--color-warning)",
|
|
10
|
+
"var(--color-danger)"
|
|
11
|
+
];
|
|
12
|
+
const W = 480;
|
|
13
|
+
const H = 220;
|
|
14
|
+
const pad = {
|
|
15
|
+
top: 12,
|
|
16
|
+
right: 12,
|
|
17
|
+
bottom: 26,
|
|
18
|
+
left: 40
|
|
19
|
+
};
|
|
20
|
+
/** The smallest round number above `max`, so gridlines fall on friendly values. */
|
|
21
|
+
function niceMax(max) {
|
|
22
|
+
if (max <= 0) return 1;
|
|
23
|
+
const magnitude = 10 ** Math.floor(Math.log10(max));
|
|
24
|
+
return ([
|
|
25
|
+
1,
|
|
26
|
+
2,
|
|
27
|
+
2.5,
|
|
28
|
+
5,
|
|
29
|
+
10
|
|
30
|
+
].find((n) => n * magnitude >= max) ?? 10) * magnitude;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A responsive SVG chart for one or more series. Bars grow and lines draw on
|
|
34
|
+
* first paint, a tooltip follows the pointer to the nearest point, and a
|
|
35
|
+
* hidden table carries the same numbers for screen readers.
|
|
36
|
+
*/
|
|
37
|
+
function Chart({ data, xKey, series, label, type = "line", format = (value) => value.toLocaleString(), className, ...props }) {
|
|
38
|
+
const id = useId();
|
|
39
|
+
const [hover, setHover] = useState(null);
|
|
40
|
+
const top = niceMax(Math.max(...data.flatMap((row) => series.map((s) => Number(row[s.key]) || 0))));
|
|
41
|
+
const innerW = W - pad.left - pad.right;
|
|
42
|
+
const innerH = H - pad.top - pad.bottom;
|
|
43
|
+
const band = innerW / Math.max(data.length, 1);
|
|
44
|
+
const x = (index) => type === "bar" ? pad.left + band * index + band / 2 : pad.left + (data.length === 1 ? innerW / 2 : innerW * index / (data.length - 1));
|
|
45
|
+
const y = (value) => pad.top + innerH - value / top * innerH;
|
|
46
|
+
const color = (index) => series[index]?.color ?? palette[index % palette.length];
|
|
47
|
+
const ticks = [
|
|
48
|
+
0,
|
|
49
|
+
.25,
|
|
50
|
+
.5,
|
|
51
|
+
.75,
|
|
52
|
+
1
|
|
53
|
+
].map((t) => t * top);
|
|
54
|
+
const barW = Math.min(28, band / series.length * .7);
|
|
55
|
+
const move = (event) => {
|
|
56
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
57
|
+
const at = (event.clientX - rect.left) / rect.width * W;
|
|
58
|
+
const index = type === "bar" ? Math.floor((at - pad.left) / band) : Math.round((at - pad.left) / innerW * (data.length - 1));
|
|
59
|
+
setHover(Math.min(Math.max(index, 0), data.length - 1));
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
"data-slot": "chart",
|
|
63
|
+
className: cx("relative flex w-full flex-col gap-2", className),
|
|
64
|
+
...props,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
67
|
+
viewBox: `0 0 ${W} ${H}`,
|
|
68
|
+
role: "img",
|
|
69
|
+
"aria-label": label,
|
|
70
|
+
className: "h-auto w-full touch-pan-y overflow-visible",
|
|
71
|
+
onPointerMove: move,
|
|
72
|
+
onPointerLeave: () => setHover(null),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("defs", { children: series.map((s, index) => /* @__PURE__ */ jsxs("linearGradient", {
|
|
75
|
+
id: `${id}-${s.key}`,
|
|
76
|
+
x1: "0",
|
|
77
|
+
x2: "0",
|
|
78
|
+
y1: "0",
|
|
79
|
+
y2: "1",
|
|
80
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
81
|
+
offset: "0",
|
|
82
|
+
stopColor: color(index),
|
|
83
|
+
stopOpacity: "0.35"
|
|
84
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
85
|
+
offset: "1",
|
|
86
|
+
stopColor: color(index),
|
|
87
|
+
stopOpacity: "0"
|
|
88
|
+
})]
|
|
89
|
+
}, s.key)) }),
|
|
90
|
+
ticks.map((tick) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
91
|
+
x1: pad.left,
|
|
92
|
+
x2: W - pad.right,
|
|
93
|
+
y1: y(tick),
|
|
94
|
+
y2: y(tick),
|
|
95
|
+
stroke: "var(--color-separator)",
|
|
96
|
+
strokeOpacity: tick === 0 ? 1 : .5,
|
|
97
|
+
strokeDasharray: tick === 0 ? void 0 : "3 4"
|
|
98
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
99
|
+
x: pad.left - 8,
|
|
100
|
+
y: y(tick),
|
|
101
|
+
textAnchor: "end",
|
|
102
|
+
dominantBaseline: "middle",
|
|
103
|
+
className: "fill-label-tertiary text-[10px]",
|
|
104
|
+
children: format(tick)
|
|
105
|
+
})] }, tick)),
|
|
106
|
+
data.map((row, index) => /* @__PURE__ */ jsx("text", {
|
|
107
|
+
x: x(index),
|
|
108
|
+
y: 212,
|
|
109
|
+
textAnchor: "middle",
|
|
110
|
+
className: "fill-label-tertiary text-[10px]",
|
|
111
|
+
children: row[xKey]
|
|
112
|
+
}, String(row[xKey]))),
|
|
113
|
+
hover !== null ? /* @__PURE__ */ jsx("line", {
|
|
114
|
+
x1: x(hover),
|
|
115
|
+
x2: x(hover),
|
|
116
|
+
y1: pad.top,
|
|
117
|
+
y2: pad.top + innerH,
|
|
118
|
+
stroke: "var(--color-label-tertiary)",
|
|
119
|
+
strokeOpacity: "0.5"
|
|
120
|
+
}) : null,
|
|
121
|
+
series.map((s, si) => {
|
|
122
|
+
const points = data.map((row, index) => [x(index), y(Number(row[s.key]) || 0)]);
|
|
123
|
+
if (type === "bar") return /* @__PURE__ */ jsx("g", { children: points.map(([px, py], index) => /* @__PURE__ */ jsx("rect", {
|
|
124
|
+
x: px - barW * series.length / 2 + si * barW,
|
|
125
|
+
y: py,
|
|
126
|
+
width: barW - 2,
|
|
127
|
+
height: pad.top + innerH - py,
|
|
128
|
+
rx: 4,
|
|
129
|
+
fill: color(si),
|
|
130
|
+
opacity: hover === null || hover === index ? 1 : .45,
|
|
131
|
+
className: "spring-smooth origin-bottom transition-opacity motion-reduce:animate-none",
|
|
132
|
+
style: {
|
|
133
|
+
transformBox: "fill-box",
|
|
134
|
+
animation: `passui-grow var(--spring-smooth-duration) var(--spring-smooth) ${index * 40}ms backwards`
|
|
135
|
+
}
|
|
136
|
+
}, index)) }, s.key);
|
|
137
|
+
const line = points.map(([px, py], index) => `${index ? "L" : "M"}${px},${py}`).join(" ");
|
|
138
|
+
const first = points[0];
|
|
139
|
+
const last = points[points.length - 1];
|
|
140
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
141
|
+
type === "area" && first && last ? /* @__PURE__ */ jsx("path", {
|
|
142
|
+
d: `${line} L${last[0]},${pad.top + innerH} L${first[0]},${pad.top + innerH} Z`,
|
|
143
|
+
fill: `url(#${id}-${s.key})`,
|
|
144
|
+
className: "motion-reduce:animate-none",
|
|
145
|
+
style: { animation: "passui-fade-in 700ms ease-out backwards" }
|
|
146
|
+
}) : null,
|
|
147
|
+
/* @__PURE__ */ jsx("path", {
|
|
148
|
+
d: line,
|
|
149
|
+
fill: "none",
|
|
150
|
+
stroke: color(si),
|
|
151
|
+
strokeWidth: "2.5",
|
|
152
|
+
strokeLinecap: "round",
|
|
153
|
+
strokeLinejoin: "round",
|
|
154
|
+
pathLength: 1,
|
|
155
|
+
strokeDasharray: 1,
|
|
156
|
+
className: "motion-reduce:animate-none",
|
|
157
|
+
style: { animation: "passui-draw 900ms var(--ease-standard) forwards" }
|
|
158
|
+
}),
|
|
159
|
+
hover !== null && points[hover] ? /* @__PURE__ */ jsx("circle", {
|
|
160
|
+
cx: points[hover][0],
|
|
161
|
+
cy: points[hover][1],
|
|
162
|
+
r: "4.5",
|
|
163
|
+
fill: "var(--color-background)",
|
|
164
|
+
stroke: color(si),
|
|
165
|
+
strokeWidth: "2.5"
|
|
166
|
+
}) : null
|
|
167
|
+
] }, s.key);
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
}),
|
|
171
|
+
hover !== null && data[hover] ? /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
role: "presentation",
|
|
173
|
+
className: "liquid-glass-dense squircle text-caption text-label pointer-events-none absolute top-0 z-10 -translate-x-1/2 px-2.5 py-1.5 [--squircle-radius:0.75rem]",
|
|
174
|
+
style: { left: `${x(hover) / W * 100}%` },
|
|
175
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
176
|
+
className: "text-label-secondary font-medium",
|
|
177
|
+
children: data[hover][xKey]
|
|
178
|
+
}), series.map((s, index) => /* @__PURE__ */ jsxs("div", {
|
|
179
|
+
className: "flex items-center gap-1.5",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx("span", {
|
|
182
|
+
className: "size-2 rounded-full",
|
|
183
|
+
style: { background: color(index) }
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "text-label-secondary",
|
|
187
|
+
children: s.label
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ jsx("span", {
|
|
190
|
+
className: "ms-auto ps-3 font-semibold tabular-nums",
|
|
191
|
+
children: format(Number(data[hover][s.key]) || 0)
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
}, s.key))]
|
|
195
|
+
}) : null,
|
|
196
|
+
series.length > 1 ? /* @__PURE__ */ jsx("ul", {
|
|
197
|
+
className: "text-caption text-label-secondary m-0 flex list-none flex-wrap gap-x-4 gap-y-1 p-0",
|
|
198
|
+
children: series.map((s, index) => /* @__PURE__ */ jsxs("li", {
|
|
199
|
+
className: "flex items-center gap-1.5",
|
|
200
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
201
|
+
className: "size-2 rounded-full",
|
|
202
|
+
style: { background: color(index) }
|
|
203
|
+
}), s.label]
|
|
204
|
+
}, s.key))
|
|
205
|
+
}) : null,
|
|
206
|
+
/* @__PURE__ */ jsxs("table", {
|
|
207
|
+
className: "sr-only",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsx("caption", { children: label }),
|
|
210
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
211
|
+
scope: "col",
|
|
212
|
+
children: xKey
|
|
213
|
+
}), series.map((s) => /* @__PURE__ */ jsx("th", {
|
|
214
|
+
scope: "col",
|
|
215
|
+
children: s.label
|
|
216
|
+
}, s.key))] }) }),
|
|
217
|
+
/* @__PURE__ */ jsx("tbody", { children: data.map((row) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
218
|
+
scope: "row",
|
|
219
|
+
children: row[xKey]
|
|
220
|
+
}), series.map((s) => /* @__PURE__ */ jsx("td", { children: row[s.key] }, s.key))] }, String(row[xKey]))) })
|
|
221
|
+
]
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
export { Chart };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as checkbox from "@zag-js/checkbox";
|
|
3
|
+
export interface CheckboxProps extends Omit<checkbox.Props, "id" | "ids" | "checked" | "defaultChecked" | "onCheckedChange"> {
|
|
4
|
+
checked?: boolean | "indeterminate";
|
|
5
|
+
defaultChecked?: boolean | "indeterminate";
|
|
6
|
+
onCheckedChange?: (checked: boolean | "indeterminate") => void;
|
|
7
|
+
/** The label beside the box. Optional, so a bare box can sit in a table cell. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
"aria-label"?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A tick box. Renders a native hidden checkbox, so it submits with its form. */
|
|
13
|
+
export declare function Checkbox({ checked, defaultChecked, onCheckedChange, children, className, "aria-label": ariaLabel, ...props }: CheckboxProps): import("react").JSX.Element;
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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 checkbox from "@zag-js/checkbox";
|
|
7
|
+
// src/components/checkbox.tsx
|
|
8
|
+
/** A tick box. Renders a native hidden checkbox, so it submits with its form. */
|
|
9
|
+
function Checkbox({ checked, defaultChecked, onCheckedChange, children, className, "aria-label": ariaLabel, ...props }) {
|
|
10
|
+
const id = useId();
|
|
11
|
+
const service = useMachine(checkbox.machine, {
|
|
12
|
+
id,
|
|
13
|
+
checked,
|
|
14
|
+
defaultChecked,
|
|
15
|
+
onCheckedChange: ({ checked: next }) => onCheckedChange?.(next),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
const api = checkbox.connect(service, normalizeProps);
|
|
19
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
20
|
+
...api.getRootProps(),
|
|
21
|
+
"data-slot": "checkbox",
|
|
22
|
+
className: cx("group inline-flex cursor-pointer items-center gap-2.5 text-footnote data-disabled:cursor-not-allowed data-disabled:opacity-40", className),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx("input", {
|
|
25
|
+
...api.getHiddenInputProps(),
|
|
26
|
+
"aria-label": ariaLabel
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ jsx("span", {
|
|
29
|
+
...api.getControlProps(),
|
|
30
|
+
"data-slot": "checkbox-control",
|
|
31
|
+
className: "bg-fill text-on-accent spring-snappy group-focus-within:ring-accent/70 data-[state=checked]:bg-accent data-[state=indeterminate]:bg-accent inline-flex size-5.5 shrink-0 items-center justify-center rounded-lg shadow-[inset_0_0_0_0.5px_var(--color-separator)] transition group-focus-within:ring-2 group-active:scale-90 motion-reduce:transition-none motion-reduce:group-active:scale-100",
|
|
32
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
33
|
+
...api.getIndicatorProps(),
|
|
34
|
+
hidden: false,
|
|
35
|
+
viewBox: "0 0 16 16",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: "currentColor",
|
|
38
|
+
strokeWidth: "2.25",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round",
|
|
41
|
+
className: "spring-bouncy size-3.5 scale-0 transition-transform group-data-[state=checked]:scale-100 group-data-[state=indeterminate]:scale-100",
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
children: api.indeterminate ? /* @__PURE__ */ jsx("path", { d: "M4 8h8" }) : /* @__PURE__ */ jsx("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
children ? /* @__PURE__ */ jsx("span", {
|
|
47
|
+
...api.getLabelProps(),
|
|
48
|
+
children
|
|
49
|
+
}) : null
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export { Checkbox };
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* the write. Returns false when unavailable or denied, so the app can offer
|
|
4
4
|
* manual copying. This helper never reads the clipboard or adds feedback.
|
|
5
5
|
*/
|
|
6
|
-
export declare function copyText(text: string): Promise<boolean>;
|
|
6
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/lib/clipboard.ts
|
|
2
|
+
/**
|
|
3
|
+
* Copies text after a user action. Returns true only after the browser confirms
|
|
4
|
+
* the write. Returns false when unavailable or denied, so the app can offer
|
|
5
|
+
* manual copying. This helper never reads the clipboard or adds feedback.
|
|
6
|
+
*/
|
|
7
|
+
async function copyText(text) {
|
|
8
|
+
try {
|
|
9
|
+
if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) return false;
|
|
10
|
+
await navigator.clipboard.writeText(text);
|
|
11
|
+
return true;
|
|
12
|
+
} catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export { copyText };
|
package/dist/cn.d.ts
ADDED
package/dist/cn.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { textStyles } from "@passui/tokens/typography";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
|
+
// src/lib/class-names.ts
|
|
5
|
+
const textStyleClasses = Object.keys(textStyles).map((name) => `text-${name.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`)}`);
|
|
6
|
+
const twMerge = extendTailwindMerge({ extend: { classGroups: { "font-size": textStyleClasses } } });
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
export { cn };
|