@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,71 @@
|
|
|
1
|
+
import { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from "react";
|
|
2
|
+
type ValueObject = {
|
|
3
|
+
[themeName: string]: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Props for the useTheme hook
|
|
7
|
+
* @author la niina
|
|
8
|
+
*/
|
|
9
|
+
export type UseThemeProps = {
|
|
10
|
+
/** List of all available theme names */
|
|
11
|
+
themes: Array<string>;
|
|
12
|
+
/** Forced theme name for the current page */
|
|
13
|
+
forcedTheme?: string | undefined;
|
|
14
|
+
/** Update the theme */
|
|
15
|
+
setTheme: Dispatch<SetStateAction<string>>;
|
|
16
|
+
/** Active theme name */
|
|
17
|
+
theme?: string | undefined;
|
|
18
|
+
/** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
|
|
19
|
+
systemTheme?: SystemTheme | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type SystemTheme = "dark" | "light";
|
|
22
|
+
export type Attribute = `data-${string}` | "class";
|
|
23
|
+
export interface ThemeProviderProps extends PropsWithChildren {
|
|
24
|
+
/** List of all available theme names */
|
|
25
|
+
themes?: Array<string> | undefined;
|
|
26
|
+
/** Forced theme name for the current page */
|
|
27
|
+
forcedTheme?: string | undefined;
|
|
28
|
+
/** Whether to switch between dark and light themes based on prefers-color-scheme */
|
|
29
|
+
enableSystem?: boolean | undefined;
|
|
30
|
+
/** Disable all CSS transitions when switching themes */
|
|
31
|
+
disableTransitionOnChange?: boolean | undefined;
|
|
32
|
+
/** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
|
|
33
|
+
enableColorScheme?: boolean | undefined;
|
|
34
|
+
/** Key used to store theme setting in localStorage */
|
|
35
|
+
storageKey?: string | undefined;
|
|
36
|
+
/** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
|
|
37
|
+
defaultTheme?: string | undefined;
|
|
38
|
+
/** HTML attribute modified based on the active theme. Accepts `class`, `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.), or an array which could include both */
|
|
39
|
+
attribute?: Attribute | Array<Attribute> | undefined;
|
|
40
|
+
/** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
|
|
41
|
+
value?: ValueObject | undefined;
|
|
42
|
+
/** Nonce string to pass to the inline script for CSP headers */
|
|
43
|
+
nonce?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Hook to access the theme context
|
|
47
|
+
* @returns {UseThemeProps} theme context
|
|
48
|
+
* @example
|
|
49
|
+
* const { theme, setTheme } = useTheme()
|
|
50
|
+
*/
|
|
51
|
+
export declare const useTheme: () => UseThemeProps;
|
|
52
|
+
/**
|
|
53
|
+
* Theme provider component is used to wrap your app &
|
|
54
|
+
* provide theme context to all components. It can be used to switch
|
|
55
|
+
* between themes.
|
|
56
|
+
* @author la niina
|
|
57
|
+
* @param {ThemeProviderProps} props
|
|
58
|
+
* @returns {ReactNode} children
|
|
59
|
+
* @example
|
|
60
|
+
* <ThemeProvider attribute="class" disableTransitionOnChange>
|
|
61
|
+
* <App />
|
|
62
|
+
* </ThemeProvider>
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <ThemeProvider themes={["light", "queer", "dark", "system"]} defaultTheme="light">
|
|
66
|
+
* <App />
|
|
67
|
+
* </ThemeProvider>
|
|
68
|
+
*/
|
|
69
|
+
export declare const ThemeProvider: (props: ThemeProviderProps) => ReactNode;
|
|
70
|
+
export declare const script: (attribute: Attribute | Array<Attribute>, storageKey: string, defaultTheme: string, forcedTheme: string | undefined, themes: Array<string>, value: ValueObject | undefined, enableSystem: boolean, enableColorScheme: boolean) => void;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/appearance/theme.tsx
|
|
5
|
+
const colorSchemes = ["light", "dark"];
|
|
6
|
+
const MEDIA = "(prefers-color-scheme: dark)";
|
|
7
|
+
const isServer = typeof window === "undefined";
|
|
8
|
+
const ThemeContext = createContext(void 0);
|
|
9
|
+
const defaultContext = {
|
|
10
|
+
setTheme: () => {},
|
|
11
|
+
themes: []
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Hook to access the theme context
|
|
15
|
+
* @returns {UseThemeProps} theme context
|
|
16
|
+
* @example
|
|
17
|
+
* const { theme, setTheme } = useTheme()
|
|
18
|
+
*/
|
|
19
|
+
const useTheme = () => useContext(ThemeContext) ?? defaultContext;
|
|
20
|
+
/**
|
|
21
|
+
* Theme provider component is used to wrap your app &
|
|
22
|
+
* provide theme context to all components. It can be used to switch
|
|
23
|
+
* between themes.
|
|
24
|
+
* @author la niina
|
|
25
|
+
* @param {ThemeProviderProps} props
|
|
26
|
+
* @returns {ReactNode} children
|
|
27
|
+
* @example
|
|
28
|
+
* <ThemeProvider attribute="class" disableTransitionOnChange>
|
|
29
|
+
* <App />
|
|
30
|
+
* </ThemeProvider>
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <ThemeProvider themes={["light", "queer", "dark", "system"]} defaultTheme="light">
|
|
34
|
+
* <App />
|
|
35
|
+
* </ThemeProvider>
|
|
36
|
+
*/
|
|
37
|
+
const ThemeProvider = (props) => {
|
|
38
|
+
if (useContext(ThemeContext)) return props.children;
|
|
39
|
+
return /* @__PURE__ */ jsx(Theme, { ...props });
|
|
40
|
+
};
|
|
41
|
+
const defaultThemes = ["light", "dark"];
|
|
42
|
+
const Theme = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme = true, storageKey = "theme", themes = defaultThemes, defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce }) => {
|
|
43
|
+
const [theme, setThemeState] = useState(() => getTheme(storageKey, defaultTheme));
|
|
44
|
+
const applyClassAttribute = useCallback((name, attrValues) => {
|
|
45
|
+
const d = document.documentElement;
|
|
46
|
+
d.classList.remove(...attrValues);
|
|
47
|
+
if (name) d.classList.add(name);
|
|
48
|
+
}, []);
|
|
49
|
+
const applyDataAttribute = useCallback((attr, name) => {
|
|
50
|
+
const d = document.documentElement;
|
|
51
|
+
if (name) d.setAttribute(attr, name);
|
|
52
|
+
else d.removeAttribute(attr);
|
|
53
|
+
}, []);
|
|
54
|
+
const applyAttributesToDOM = useCallback((resolved) => {
|
|
55
|
+
const attributeList = Array.isArray(attribute) ? attribute : [attribute];
|
|
56
|
+
const attrValues = value ? Object.values(value) : themes;
|
|
57
|
+
const name = value ? value[resolved] : resolved;
|
|
58
|
+
for (const attr of attributeList) if (attr === "class") applyClassAttribute(name, attrValues);
|
|
59
|
+
else if (attr.startsWith("data-")) applyDataAttribute(attr, name);
|
|
60
|
+
}, [
|
|
61
|
+
attribute,
|
|
62
|
+
themes,
|
|
63
|
+
value,
|
|
64
|
+
applyClassAttribute,
|
|
65
|
+
applyDataAttribute
|
|
66
|
+
]);
|
|
67
|
+
const applyColorScheme = useCallback((resolved) => {
|
|
68
|
+
if (!enableColorScheme) return;
|
|
69
|
+
const fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : null;
|
|
70
|
+
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
|
|
71
|
+
document.documentElement.style.colorScheme = colorScheme || "";
|
|
72
|
+
}, [enableColorScheme, defaultTheme]);
|
|
73
|
+
const applyTheme = useCallback((nextTheme) => {
|
|
74
|
+
if (!nextTheme) return;
|
|
75
|
+
const resolved = nextTheme === "system" && enableSystem ? getSystemTheme() : nextTheme;
|
|
76
|
+
const enable = disableTransitionOnChange ? disableAnimation() : null;
|
|
77
|
+
applyAttributesToDOM(resolved);
|
|
78
|
+
applyColorScheme(resolved);
|
|
79
|
+
enable?.();
|
|
80
|
+
}, [
|
|
81
|
+
enableSystem,
|
|
82
|
+
disableTransitionOnChange,
|
|
83
|
+
applyAttributesToDOM,
|
|
84
|
+
applyColorScheme
|
|
85
|
+
]);
|
|
86
|
+
const setTheme = useCallback((newValue) => {
|
|
87
|
+
const newTheme = typeof newValue === "function" ? newValue(theme ?? "") : newValue;
|
|
88
|
+
setThemeState(newTheme);
|
|
89
|
+
try {
|
|
90
|
+
localStorage.setItem(storageKey, newTheme);
|
|
91
|
+
} catch {
|
|
92
|
+
console.error("Failed to save theme to localStorage");
|
|
93
|
+
}
|
|
94
|
+
}, [theme, storageKey]);
|
|
95
|
+
const handleMediaQuery = useCallback((_event) => {
|
|
96
|
+
if (theme === "system" && enableSystem && !forcedTheme) applyTheme("system");
|
|
97
|
+
}, [
|
|
98
|
+
applyTheme,
|
|
99
|
+
enableSystem,
|
|
100
|
+
forcedTheme,
|
|
101
|
+
theme
|
|
102
|
+
]);
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
if (isServer) return;
|
|
105
|
+
const media = window.matchMedia(MEDIA);
|
|
106
|
+
media.addEventListener("change", handleMediaQuery);
|
|
107
|
+
handleMediaQuery(media);
|
|
108
|
+
return () => media.removeEventListener("change", handleMediaQuery);
|
|
109
|
+
}, [handleMediaQuery]);
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
if (isServer) return;
|
|
112
|
+
const handleStorage = (e) => {
|
|
113
|
+
if (e.key !== storageKey) return;
|
|
114
|
+
const newTheme = e.newValue || defaultTheme;
|
|
115
|
+
setTheme(newTheme);
|
|
116
|
+
};
|
|
117
|
+
window.addEventListener("storage", handleStorage);
|
|
118
|
+
return () => window.removeEventListener("storage", handleStorage);
|
|
119
|
+
}, [
|
|
120
|
+
defaultTheme,
|
|
121
|
+
setTheme,
|
|
122
|
+
storageKey
|
|
123
|
+
]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
applyTheme(forcedTheme ?? theme);
|
|
126
|
+
}, [
|
|
127
|
+
applyTheme,
|
|
128
|
+
forcedTheme,
|
|
129
|
+
theme
|
|
130
|
+
]);
|
|
131
|
+
const providerValue = useMemo(() => ({
|
|
132
|
+
theme,
|
|
133
|
+
setTheme,
|
|
134
|
+
forcedTheme,
|
|
135
|
+
themes: enableSystem ? [...themes, "system"] : themes,
|
|
136
|
+
systemTheme: enableSystem ? getSystemTheme() : void 0
|
|
137
|
+
}), [
|
|
138
|
+
theme,
|
|
139
|
+
forcedTheme,
|
|
140
|
+
enableSystem,
|
|
141
|
+
themes,
|
|
142
|
+
setTheme
|
|
143
|
+
]);
|
|
144
|
+
return /* @__PURE__ */ jsxs(ThemeContext.Provider, {
|
|
145
|
+
value: providerValue,
|
|
146
|
+
children: [/* @__PURE__ */ jsx(ThemeScript, {
|
|
147
|
+
forcedTheme,
|
|
148
|
+
storageKey,
|
|
149
|
+
attribute,
|
|
150
|
+
enableSystem,
|
|
151
|
+
enableColorScheme,
|
|
152
|
+
defaultTheme,
|
|
153
|
+
value,
|
|
154
|
+
themes,
|
|
155
|
+
nonce
|
|
156
|
+
}), children]
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
const ThemeScript = memo(({ forcedTheme, storageKey, attribute, enableSystem, enableColorScheme, defaultTheme, value, themes, nonce }) => {
|
|
160
|
+
const scriptArgs = JSON.stringify([
|
|
161
|
+
attribute,
|
|
162
|
+
storageKey,
|
|
163
|
+
defaultTheme,
|
|
164
|
+
forcedTheme,
|
|
165
|
+
themes,
|
|
166
|
+
value,
|
|
167
|
+
enableSystem,
|
|
168
|
+
enableColorScheme
|
|
169
|
+
]).slice(1, -1);
|
|
170
|
+
return /* @__PURE__ */ jsx("script", {
|
|
171
|
+
dangerouslySetInnerHTML: { __html: `(${script.toString()})(${scriptArgs})` },
|
|
172
|
+
nonce,
|
|
173
|
+
suppressHydrationWarning: true
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
ThemeScript.displayName = "ThemeScript";
|
|
177
|
+
const getTheme = (key, fallback) => {
|
|
178
|
+
if (isServer) return fallback;
|
|
179
|
+
let theme;
|
|
180
|
+
try {
|
|
181
|
+
theme = localStorage.getItem(key) || void 0;
|
|
182
|
+
} catch {}
|
|
183
|
+
return theme || fallback;
|
|
184
|
+
};
|
|
185
|
+
const disableAnimation = () => {
|
|
186
|
+
const css = document.createElement("style");
|
|
187
|
+
css.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"));
|
|
188
|
+
document.head.appendChild(css);
|
|
189
|
+
return () => {
|
|
190
|
+
window.getComputedStyle(document.body);
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
document.head.removeChild(css);
|
|
193
|
+
}, 1);
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
const getSystemTheme = (e) => {
|
|
197
|
+
if (isServer) return "light";
|
|
198
|
+
return (e ?? window.matchMedia(MEDIA)).matches ? "dark" : "light";
|
|
199
|
+
};
|
|
200
|
+
const script = (attribute, storageKey, defaultTheme, forcedTheme, themes, value, enableSystem, enableColorScheme) => {
|
|
201
|
+
const el = document.documentElement;
|
|
202
|
+
const systemThemes = ["light", "dark"];
|
|
203
|
+
const attributes = Array.isArray(attribute) ? attribute : [attribute];
|
|
204
|
+
const attrValues = value ? Object.values(value) : themes;
|
|
205
|
+
function applyClassAttr(name) {
|
|
206
|
+
el.classList.remove(...attrValues);
|
|
207
|
+
if (name) el.classList.add(name);
|
|
208
|
+
}
|
|
209
|
+
function applyDataAttr(attr, name) {
|
|
210
|
+
if (name) el.setAttribute(attr, name);
|
|
211
|
+
else el.removeAttribute(attr);
|
|
212
|
+
}
|
|
213
|
+
function updateDOM(theme) {
|
|
214
|
+
const name = value ? value[theme] : theme;
|
|
215
|
+
for (const attr of attributes) if (attr === "class") applyClassAttr(name);
|
|
216
|
+
else if (attr.startsWith("data-")) applyDataAttr(attr, name);
|
|
217
|
+
setColorScheme(theme);
|
|
218
|
+
}
|
|
219
|
+
function setColorScheme(theme) {
|
|
220
|
+
if (!enableColorScheme) return;
|
|
221
|
+
const fallback = systemThemes.includes(defaultTheme) ? defaultTheme : null;
|
|
222
|
+
const colorScheme = systemThemes.includes(theme) ? theme : fallback;
|
|
223
|
+
el.style.colorScheme = colorScheme || "";
|
|
224
|
+
}
|
|
225
|
+
function resolveSystemTheme() {
|
|
226
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
227
|
+
}
|
|
228
|
+
if (forcedTheme) updateDOM(forcedTheme === "system" && enableSystem ? resolveSystemTheme() : forcedTheme);
|
|
229
|
+
else try {
|
|
230
|
+
const themeName = localStorage.getItem(storageKey) || defaultTheme;
|
|
231
|
+
updateDOM(enableSystem && themeName === "system" ? resolveSystemTheme() : themeName);
|
|
232
|
+
} catch {
|
|
233
|
+
updateDOM(defaultTheme);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
export { ThemeProvider, script, useTheme };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PlatformOS, PlatformProvider, PlatformScript, detectPlatform, resolvePlatform, usePlatform } from "./appearance/platform.js";
|
|
2
|
+
import { Attribute, SystemTheme, ThemeProvider, ThemeProviderProps, UseThemeProps, script, useTheme } from "./appearance/theme.js";
|
|
3
|
+
export { Attribute, PlatformOS, PlatformProvider, PlatformScript, SystemTheme, ThemeProvider, ThemeProviderProps, UseThemeProps, detectPlatform, resolvePlatform, script, usePlatform, useTheme };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PlatformProvider, PlatformScript, detectPlatform, resolvePlatform, usePlatform } from "./appearance/platform.js";
|
|
2
|
+
import { ThemeProvider, script, useTheme } from "./appearance/theme.js";
|
|
3
|
+
export { PlatformProvider, PlatformScript, ThemeProvider, detectPlatform, resolvePlatform, script, usePlatform, useTheme };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** Width divided by height. @default 1.3333333333333333 */
|
|
4
|
+
ratio?: number;
|
|
5
5
|
}
|
|
6
6
|
/** A crop frame: size its geometry, while images cover without distortion. */
|
|
7
|
-
export declare function AspectRatio({ ratio, className, style, ...props }: AspectRatioProps): import("react").JSX.Element;
|
|
7
|
+
export declare function AspectRatio({ ratio, className, style, ...props }: AspectRatioProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/aspect-ratio.tsx
|
|
4
|
+
/** A crop frame: size its geometry, while images cover without distortion. */
|
|
5
|
+
function AspectRatio({ ratio = 4 / 3, className, style, ...props }) {
|
|
6
|
+
const aspect = Number.isFinite(ratio) && ratio > 0 ? ratio : 4 / 3;
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
"data-slot": "aspect-ratio",
|
|
9
|
+
...props,
|
|
10
|
+
className: cx("relative w-full overflow-hidden [&>img]:size-full [&>img]:object-cover [&>video]:size-full [&>video]:object-cover", className),
|
|
11
|
+
style: {
|
|
12
|
+
aspectRatio: aspect,
|
|
13
|
+
...style
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { AspectRatio };
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export declare function Avatar({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
3
|
+
/** The photo. It stays invisible until loaded, and the fallback shows if it fails. */
|
|
4
|
+
export declare function AvatarImage({ className, alt, ...props }: ComponentProps<"img">): import("react").JSX.Element | null;
|
|
5
|
+
export declare function AvatarFallback({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element | null;
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { createContext, useContext, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/avatar.tsx
|
|
5
|
+
const Context = createContext(() => {});
|
|
6
|
+
const StatusContext = createContext("loading");
|
|
7
|
+
function Avatar({ className, ...props }) {
|
|
8
|
+
const [status, setStatus] = useState("loading");
|
|
9
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
10
|
+
value: setStatus,
|
|
11
|
+
children: /* @__PURE__ */ jsx(StatusContext.Provider, {
|
|
12
|
+
value: status,
|
|
13
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
14
|
+
"data-slot": "avatar",
|
|
15
|
+
className: cx("relative flex size-10 shrink-0 overflow-hidden rounded-full bg-fill", className),
|
|
16
|
+
...props
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** The photo. It stays invisible until loaded, and the fallback shows if it fails. */
|
|
22
|
+
function AvatarImage({ className, alt = "", ...props }) {
|
|
23
|
+
const report = useContext(Context);
|
|
24
|
+
const status = useContext(StatusContext);
|
|
25
|
+
if (!props.src || status === "error") return null;
|
|
26
|
+
return /* @__PURE__ */ jsx("img", {
|
|
27
|
+
alt,
|
|
28
|
+
"data-slot": "avatar-image",
|
|
29
|
+
onLoad: () => report("loaded"),
|
|
30
|
+
onError: () => report("error"),
|
|
31
|
+
className: cx("absolute inset-0 size-full object-cover transition-opacity duration-(--duration-fast)", status !== "loaded" && "opacity-0", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function AvatarFallback({ className, ...props }) {
|
|
36
|
+
if (useContext(StatusContext) === "loaded") return null;
|
|
37
|
+
return /* @__PURE__ */ jsx("span", {
|
|
38
|
+
"data-slot": "avatar-fallback",
|
|
39
|
+
className: cx("absolute inset-0 flex items-center justify-center text-footnote font-medium text-label-secondary", className),
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export type BadgeVariant = "default" | "secondary" | "destructive" | "outline" | "success" | "warning";
|
|
3
|
+
export type BadgeProps = ComponentProps<"span"> & {
|
|
4
|
+
/** Colour role. @default "default" */
|
|
5
|
+
variant?: BadgeVariant;
|
|
6
|
+
};
|
|
7
|
+
/** A small status label. */
|
|
8
|
+
export declare function Badge({ variant, className, ...props }: BadgeProps): import("react").JSX.Element;
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/badge.tsx
|
|
4
|
+
const variants = {
|
|
5
|
+
default: "bg-accent text-on-accent",
|
|
6
|
+
secondary: "bg-fill text-label",
|
|
7
|
+
destructive: "bg-danger/15 text-danger",
|
|
8
|
+
outline: "text-label shadow-[inset_0_0_0_0.5px_var(--color-separator)]",
|
|
9
|
+
success: "bg-success/15 text-success",
|
|
10
|
+
warning: "bg-warning/15 text-warning"
|
|
11
|
+
};
|
|
12
|
+
/** A small status label. */
|
|
13
|
+
function Badge({ variant = "default", className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("span", {
|
|
15
|
+
"data-slot": "badge",
|
|
16
|
+
"data-variant": variant,
|
|
17
|
+
className: cx("inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-full px-2.5 py-0.5 text-caption font-semibold [&_svg]:size-3 [&_svg]:pointer-events-none", variants[variant], className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { Badge };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RenderProp } from "./lib/render.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
export declare function Breadcrumb(props: ComponentProps<"nav">): import("react").JSX.Element;
|
|
4
|
+
export declare function BreadcrumbList({ className, ...props }: ComponentProps<"ol">): import("react").JSX.Element;
|
|
5
|
+
export declare function BreadcrumbItem({ className, ...props }: ComponentProps<"li">): import("react").JSX.Element;
|
|
6
|
+
/** A link. Pass `render` to use your router's link element. */
|
|
7
|
+
export declare function BreadcrumbLink({ className, render, ...props }: ComponentProps<"a"> & {
|
|
8
|
+
render?: RenderProp;
|
|
9
|
+
}): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
10
|
+
export declare function BreadcrumbPage({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
11
|
+
export declare function BreadcrumbSeparator({ children, className, ...props }: ComponentProps<"li">): import("react").JSX.Element;
|
|
12
|
+
/** Stands in for the crumbs that were folded away. Wrap it in a menu trigger to reveal them. */
|
|
13
|
+
export declare function BreadcrumbEllipsis({ children, className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { mergeProps, renderPart } from "./lib/render.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/breadcrumb.tsx
|
|
5
|
+
function Breadcrumb(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
7
|
+
"aria-label": "Breadcrumb",
|
|
8
|
+
"data-slot": "breadcrumb",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function BreadcrumbList({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
14
|
+
"data-slot": "breadcrumb-list",
|
|
15
|
+
className: cx("m-0 flex list-none flex-wrap items-center gap-1.5 p-0 text-footnote text-label-secondary", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("li", {
|
|
21
|
+
"data-slot": "breadcrumb-item",
|
|
22
|
+
className: cx("inline-flex items-center gap-1.5", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** A link. Pass `render` to use your router's link element. */
|
|
27
|
+
function BreadcrumbLink({ className, render, ...props }) {
|
|
28
|
+
return renderPart("a", mergeProps({
|
|
29
|
+
"data-slot": "breadcrumb-link",
|
|
30
|
+
className: "transition-colors hover:text-label"
|
|
31
|
+
}, {
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}), render);
|
|
35
|
+
}
|
|
36
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx("span", {
|
|
38
|
+
"aria-current": "page",
|
|
39
|
+
"data-slot": "breadcrumb-page",
|
|
40
|
+
className: cx("font-medium text-label", className),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function BreadcrumbSeparator({ children = "/", className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("li", {
|
|
46
|
+
role: "presentation",
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
"data-slot": "breadcrumb-separator",
|
|
49
|
+
className: cx("text-label-tertiary", className),
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Stands in for the crumbs that were folded away. Wrap it in a menu trigger to reveal them. */
|
|
55
|
+
function BreadcrumbEllipsis({ children = "…", className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("span", {
|
|
57
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
58
|
+
className: cx("text-label-secondary flex h-6 items-center", className),
|
|
59
|
+
...props,
|
|
60
|
+
children
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/** Fuses neighbouring buttons into one segmented control, squaring the inner corners. */
|
|
3
|
+
export declare function ButtonGroup({ orientation, className, ...props }: ComponentProps<"div"> & {
|
|
4
|
+
orientation?: "horizontal" | "vertical";
|
|
5
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/button-group.tsx
|
|
4
|
+
/** Fuses neighbouring buttons into one segmented control, squaring the inner corners. */
|
|
5
|
+
function ButtonGroup({ orientation = "horizontal", className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
role: "group",
|
|
8
|
+
"data-slot": "button-group",
|
|
9
|
+
"data-orientation": orientation,
|
|
10
|
+
className: cx("flex w-fit items-stretch *:focus-visible:z-10 data-[orientation=horizontal]:*:not-first:rounded-l-none data-[orientation=horizontal]:*:not-last:rounded-r-none data-[orientation=vertical]:flex-col data-[orientation=vertical]:*:not-first:rounded-t-none data-[orientation=vertical]:*:not-last:rounded-b-none", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { ButtonGroup };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export type ButtonVariant = "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "accent";
|
|
3
|
+
export type ButtonSize = "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
4
|
+
export interface ButtonStyleProps {
|
|
5
|
+
/** Visual emphasis. @default "default" */
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
/** Label sizes `xs`, `sm`, `default`, `lg`, and square icon sizes. @default "default" */
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Button classes for other elements, such as a link that looks like a button. */
|
|
12
|
+
export declare function buttonVariants({ variant, size, className }?: ButtonStyleProps): string;
|
|
13
|
+
export type ButtonProps = ComponentProps<"button"> & ButtonStyleProps & {
|
|
14
|
+
/** Disables the button, marks it busy and shows a spinner while work runs. */
|
|
15
|
+
isPending?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A native button. State is plain CSS (`:hover`, `:active`, `:focus-visible`,
|
|
19
|
+
* `:disabled`); `data-variant` and `data-size` are there for your own styling.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Button({ variant, size, className, type, isPending, children, disabled, ...props }: ButtonProps): import("react").JSX.Element;
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cx } from "./lib/cx.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/button.tsx
|
|
4
|
+
const base = "relative inline-flex shrink-0 select-none items-center justify-center gap-2 whitespace-nowrap rounded-full font-semibold tracking-[-0.005em] outline-none transition spring-snappy [-webkit-tap-highlight-color:transparent] active:scale-[0.96] disabled:pointer-events-none disabled:opacity-40 focus-visible:ring-2 focus-visible:ring-accent/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background motion-reduce:transition-none motion-reduce:active:scale-100 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5";
|
|
5
|
+
const variants = {
|
|
6
|
+
default: "bg-inverse text-on-inverse shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.18),0_6px_16px_-6px_rgb(0_0_0/0.35)] hover:brightness-[1.12]",
|
|
7
|
+
destructive: "bg-danger text-background shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.18),0_6px_16px_-6px_rgb(0_0_0/0.35)] hover:brightness-[1.08]",
|
|
8
|
+
outline: "text-label shadow-[inset_0_0_0_1px_var(--color-separator)] hover:bg-fill/60",
|
|
9
|
+
secondary: "bg-elevated text-label shadow-[inset_0_0_0_0.5px_color-mix(in_srgb,var(--color-separator)_55%,transparent),0_1px_2px_rgb(40_30_0/0.06)] hover:bg-fill/60",
|
|
10
|
+
ghost: "text-label hover:bg-fill/80",
|
|
11
|
+
link: "text-accent-text underline-offset-4 hover:underline",
|
|
12
|
+
accent: "bg-accent text-on-accent ring-1 ring-accent-text/25 shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_1px_2px_rgb(60_40_0/0.16),0_6px_16px_-6px_color-mix(in_srgb,var(--color-accent)_70%,transparent)] hover:brightness-[1.04]"
|
|
13
|
+
};
|
|
14
|
+
const sizes = {
|
|
15
|
+
default: "h-8.5 px-4 text-footnote",
|
|
16
|
+
xs: "h-6.5 px-2.5 text-caption",
|
|
17
|
+
sm: "h-7.5 px-3 text-footnote",
|
|
18
|
+
lg: "h-9.5 px-5 text-subheadline",
|
|
19
|
+
icon: "size-8.5",
|
|
20
|
+
"icon-xs": "size-6.5",
|
|
21
|
+
"icon-sm": "size-7.5",
|
|
22
|
+
"icon-lg": "size-9.5"
|
|
23
|
+
};
|
|
24
|
+
/** Button classes for other elements, such as a link that looks like a button. */
|
|
25
|
+
function buttonVariants({ variant = "default", size = "default", className } = {}) {
|
|
26
|
+
return cx(base, variants[variant], sizes[size], className);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A native button. State is plain CSS (`:hover`, `:active`, `:focus-visible`,
|
|
30
|
+
* `:disabled`); `data-variant` and `data-size` are there for your own styling.
|
|
31
|
+
*/
|
|
32
|
+
function Button({ variant = "default", size = "default", className, type = "button", isPending, children, disabled, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
34
|
+
"data-slot": "button",
|
|
35
|
+
"data-variant": variant,
|
|
36
|
+
"data-size": size,
|
|
37
|
+
type,
|
|
38
|
+
className: buttonVariants({
|
|
39
|
+
variant,
|
|
40
|
+
size,
|
|
41
|
+
className
|
|
42
|
+
}),
|
|
43
|
+
disabled: disabled || isPending,
|
|
44
|
+
"aria-busy": isPending || void 0,
|
|
45
|
+
...props,
|
|
46
|
+
children: [isPending ? /* @__PURE__ */ jsx("svg", {
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
viewBox: "0 0 24 24",
|
|
49
|
+
fill: "none",
|
|
50
|
+
stroke: "currentColor",
|
|
51
|
+
strokeWidth: "2.5",
|
|
52
|
+
strokeLinecap: "round",
|
|
53
|
+
className: "size-4 animate-spin",
|
|
54
|
+
children: /* @__PURE__ */ jsx("path", { d: "M12 3a9 9 0 1 0 9 9" })
|
|
55
|
+
}) : null, children]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A chosen span of days, as `YYYY-MM-DD`. `to` is empty while the span is open. */
|
|
2
|
+
export interface DateRange {
|
|
3
|
+
from: string;
|
|
4
|
+
to: string;
|
|
5
|
+
}
|
|
6
|
+
interface CalendarBase {
|
|
7
|
+
/** Names the grid for assistive technology. */
|
|
8
|
+
label: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
/** Earliest and latest selectable day, as `YYYY-MM-DD`. */
|
|
11
|
+
min?: string;
|
|
12
|
+
max?: string;
|
|
13
|
+
labels: {
|
|
14
|
+
previousMonth: string;
|
|
15
|
+
nextMonth: string;
|
|
16
|
+
};
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export type CalendarProps = CalendarBase & ({
|
|
20
|
+
mode?: "single";
|
|
21
|
+
/** `YYYY-MM-DD`, or "" when nothing is chosen. */
|
|
22
|
+
value: string;
|
|
23
|
+
onValueChange: (value: string) => void;
|
|
24
|
+
} | {
|
|
25
|
+
mode: "range";
|
|
26
|
+
value: DateRange;
|
|
27
|
+
onValueChange: (value: DateRange) => void;
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* An inline month calendar for one day or a range, on the locale's own week.
|
|
31
|
+
* Arrow keys move by day and week, Page Up and Page Down by month, Home and
|
|
32
|
+
* End to the week's edges.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Calendar(props: CalendarProps): import("react").JSX.Element;
|
|
35
|
+
export {};
|