@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/src/appearance/theme.tsx
DELETED
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
createContext,
|
|
4
|
-
memo,
|
|
5
|
-
useCallback,
|
|
6
|
-
useContext,
|
|
7
|
-
useEffect,
|
|
8
|
-
useMemo,
|
|
9
|
-
useState,
|
|
10
|
-
} from "react";
|
|
11
|
-
import type {
|
|
12
|
-
Dispatch,
|
|
13
|
-
PropsWithChildren,
|
|
14
|
-
ReactNode,
|
|
15
|
-
SetStateAction,
|
|
16
|
-
} from "react";
|
|
17
|
-
|
|
18
|
-
type ValueObject = {
|
|
19
|
-
[themeName: string]: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Props for the useTheme hook
|
|
24
|
-
* @author la niina
|
|
25
|
-
*/
|
|
26
|
-
export type UseThemeProps = {
|
|
27
|
-
/** List of all available theme names */
|
|
28
|
-
themes: Array<string>;
|
|
29
|
-
/** Forced theme name for the current page */
|
|
30
|
-
forcedTheme?: string | undefined;
|
|
31
|
-
/** Update the theme */
|
|
32
|
-
setTheme: Dispatch<SetStateAction<string>>;
|
|
33
|
-
/** Active theme name */
|
|
34
|
-
theme?: string | undefined;
|
|
35
|
-
/** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
|
|
36
|
-
systemTheme?: SystemTheme | undefined;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type SystemTheme = "dark" | "light";
|
|
40
|
-
|
|
41
|
-
export type Attribute = `data-${string}` | "class";
|
|
42
|
-
|
|
43
|
-
export interface ThemeProviderProps extends PropsWithChildren {
|
|
44
|
-
/** List of all available theme names */
|
|
45
|
-
themes?: Array<string> | undefined;
|
|
46
|
-
/** Forced theme name for the current page */
|
|
47
|
-
forcedTheme?: string | undefined;
|
|
48
|
-
/** Whether to switch between dark and light themes based on prefers-color-scheme */
|
|
49
|
-
enableSystem?: boolean | undefined;
|
|
50
|
-
/** Disable all CSS transitions when switching themes */
|
|
51
|
-
disableTransitionOnChange?: boolean | undefined;
|
|
52
|
-
/** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
|
|
53
|
-
enableColorScheme?: boolean | undefined;
|
|
54
|
-
/** Key used to store theme setting in localStorage */
|
|
55
|
-
storageKey?: string | undefined;
|
|
56
|
-
/** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
|
|
57
|
-
defaultTheme?: string | undefined;
|
|
58
|
-
/** 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 */
|
|
59
|
-
attribute?: Attribute | Array<Attribute> | undefined;
|
|
60
|
-
/** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
|
|
61
|
-
value?: ValueObject | undefined;
|
|
62
|
-
/** Nonce string to pass to the inline script for CSP headers */
|
|
63
|
-
nonce?: string | undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const colorSchemes = ["light", "dark"];
|
|
67
|
-
const MEDIA = "(prefers-color-scheme: dark)";
|
|
68
|
-
const isServer = typeof window === "undefined";
|
|
69
|
-
const ThemeContext = createContext<UseThemeProps | undefined>(undefined);
|
|
70
|
-
const defaultContext: UseThemeProps = {
|
|
71
|
-
setTheme: () => {
|
|
72
|
-
/* no-op */
|
|
73
|
-
},
|
|
74
|
-
themes: [],
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Hook to access the theme context
|
|
79
|
-
* @returns {UseThemeProps} theme context
|
|
80
|
-
* @example
|
|
81
|
-
* const { theme, setTheme } = useTheme()
|
|
82
|
-
*/
|
|
83
|
-
export const useTheme = (): UseThemeProps =>
|
|
84
|
-
useContext(ThemeContext) ?? defaultContext;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Theme provider component is used to wrap your app &
|
|
88
|
-
* provide theme context to all components. It can be used to switch
|
|
89
|
-
* between themes.
|
|
90
|
-
* @author la niina
|
|
91
|
-
* @param {ThemeProviderProps} props
|
|
92
|
-
* @returns {ReactNode} children
|
|
93
|
-
* @example
|
|
94
|
-
* <ThemeProvider attribute="class" disableTransitionOnChange>
|
|
95
|
-
* <App />
|
|
96
|
-
* </ThemeProvider>
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* <ThemeProvider themes={["light", "queer", "dark", "system"]} defaultTheme="light">
|
|
100
|
-
* <App />
|
|
101
|
-
* </ThemeProvider>
|
|
102
|
-
*/
|
|
103
|
-
export const ThemeProvider = (props: ThemeProviderProps): ReactNode => {
|
|
104
|
-
const context = useContext(ThemeContext);
|
|
105
|
-
// Ignore nested context providers, just passthrough children
|
|
106
|
-
if (context) {
|
|
107
|
-
return props.children;
|
|
108
|
-
}
|
|
109
|
-
return <Theme {...props} />;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const defaultThemes = ["light", "dark"];
|
|
113
|
-
const Theme = ({
|
|
114
|
-
forcedTheme,
|
|
115
|
-
disableTransitionOnChange = false,
|
|
116
|
-
enableSystem = true,
|
|
117
|
-
enableColorScheme = true,
|
|
118
|
-
storageKey = "theme",
|
|
119
|
-
themes = defaultThemes,
|
|
120
|
-
defaultTheme = enableSystem ? "system" : "light",
|
|
121
|
-
attribute = "data-theme",
|
|
122
|
-
value,
|
|
123
|
-
children,
|
|
124
|
-
nonce,
|
|
125
|
-
}: ThemeProviderProps) => {
|
|
126
|
-
const [theme, setThemeState] = useState(() =>
|
|
127
|
-
getTheme(storageKey, defaultTheme),
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
const applyClassAttribute = useCallback(
|
|
131
|
-
(name: string | undefined, attrValues: Array<string>) => {
|
|
132
|
-
const d = document.documentElement;
|
|
133
|
-
d.classList.remove(...attrValues);
|
|
134
|
-
if (name) {
|
|
135
|
-
d.classList.add(name);
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
[],
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const applyDataAttribute = useCallback(
|
|
142
|
-
(attr: string, name: string | undefined) => {
|
|
143
|
-
const d = document.documentElement;
|
|
144
|
-
if (name) {
|
|
145
|
-
d.setAttribute(attr, name);
|
|
146
|
-
} else {
|
|
147
|
-
d.removeAttribute(attr);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
[],
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
const applyAttributesToDOM = useCallback(
|
|
154
|
-
(resolved: string) => {
|
|
155
|
-
const attributeList = Array.isArray(attribute) ? attribute : [attribute];
|
|
156
|
-
const attrValues = value ? Object.values(value) : themes;
|
|
157
|
-
const name = value ? value[resolved] : resolved;
|
|
158
|
-
|
|
159
|
-
for (const attr of attributeList) {
|
|
160
|
-
if (attr === "class") {
|
|
161
|
-
applyClassAttribute(name, attrValues);
|
|
162
|
-
} else if (attr.startsWith("data-")) {
|
|
163
|
-
applyDataAttribute(attr, name);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
[attribute, themes, value, applyClassAttribute, applyDataAttribute],
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const applyColorScheme = useCallback(
|
|
171
|
-
(resolved: string) => {
|
|
172
|
-
if (!enableColorScheme) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const fallback = colorSchemes.includes(defaultTheme)
|
|
176
|
-
? defaultTheme
|
|
177
|
-
: null;
|
|
178
|
-
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
|
|
179
|
-
document.documentElement.style.colorScheme = colorScheme || "";
|
|
180
|
-
},
|
|
181
|
-
[enableColorScheme, defaultTheme],
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
// apply selected theme function (light, dark, system)
|
|
185
|
-
const applyTheme = useCallback(
|
|
186
|
-
(nextTheme: string | undefined) => {
|
|
187
|
-
if (!nextTheme) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const resolved =
|
|
191
|
-
nextTheme === "system" && enableSystem ? getSystemTheme() : nextTheme;
|
|
192
|
-
const enable = disableTransitionOnChange ? disableAnimation() : null;
|
|
193
|
-
applyAttributesToDOM(resolved);
|
|
194
|
-
applyColorScheme(resolved);
|
|
195
|
-
enable?.();
|
|
196
|
-
},
|
|
197
|
-
[
|
|
198
|
-
enableSystem,
|
|
199
|
-
disableTransitionOnChange,
|
|
200
|
-
applyAttributesToDOM,
|
|
201
|
-
applyColorScheme,
|
|
202
|
-
],
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
// Set theme state and save to local storage
|
|
206
|
-
const setTheme = useCallback(
|
|
207
|
-
(newValue: SetStateAction<string>) => {
|
|
208
|
-
const newTheme =
|
|
209
|
-
typeof newValue === "function" ? newValue(theme ?? "") : newValue;
|
|
210
|
-
setThemeState(newTheme);
|
|
211
|
-
|
|
212
|
-
// Save to storage
|
|
213
|
-
try {
|
|
214
|
-
localStorage.setItem(storageKey, newTheme);
|
|
215
|
-
} catch {
|
|
216
|
-
// localStorage might not be available
|
|
217
|
-
console.error("Failed to save theme to localStorage");
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
[theme, storageKey],
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
const handleMediaQuery = useCallback(
|
|
224
|
-
(_event: MediaQueryListEvent | MediaQueryList) => {
|
|
225
|
-
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
226
|
-
applyTheme("system");
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
[applyTheme, enableSystem, forcedTheme, theme],
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
// Always listen to System preference
|
|
233
|
-
React.useEffect(() => {
|
|
234
|
-
if (isServer) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const media = window.matchMedia(MEDIA);
|
|
239
|
-
// Intentionally use deprecated listener methods to support iOS 13 and older browsers
|
|
240
|
-
media.addEventListener("change", handleMediaQuery);
|
|
241
|
-
handleMediaQuery(media);
|
|
242
|
-
return () => media.removeEventListener("change", handleMediaQuery);
|
|
243
|
-
}, [handleMediaQuery]);
|
|
244
|
-
|
|
245
|
-
// localStorage event handling, allow to sync theme changes between tabs
|
|
246
|
-
React.useEffect(() => {
|
|
247
|
-
if (isServer) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const handleStorage = (e: StorageEvent) => {
|
|
252
|
-
if (e.key !== storageKey) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
256
|
-
const newTheme = e.newValue || defaultTheme;
|
|
257
|
-
setTheme(newTheme);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
window.addEventListener("storage", handleStorage);
|
|
261
|
-
return () => window.removeEventListener("storage", handleStorage);
|
|
262
|
-
}, [defaultTheme, setTheme, storageKey]);
|
|
263
|
-
|
|
264
|
-
// Whenever theme or forcedTheme changes, apply it
|
|
265
|
-
useEffect(() => {
|
|
266
|
-
applyTheme(forcedTheme ?? theme);
|
|
267
|
-
}, [applyTheme, forcedTheme, theme]);
|
|
268
|
-
|
|
269
|
-
const providerValue = useMemo(
|
|
270
|
-
() => ({
|
|
271
|
-
theme,
|
|
272
|
-
setTheme,
|
|
273
|
-
forcedTheme,
|
|
274
|
-
themes: enableSystem ? [...themes, "system"] : themes,
|
|
275
|
-
systemTheme: enableSystem
|
|
276
|
-
? (getSystemTheme() as "dark" | "light" | undefined)
|
|
277
|
-
: undefined,
|
|
278
|
-
}),
|
|
279
|
-
[theme, forcedTheme, enableSystem, themes, setTheme],
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
return (
|
|
283
|
-
<ThemeContext.Provider value={providerValue}>
|
|
284
|
-
<ThemeScript
|
|
285
|
-
{...{
|
|
286
|
-
forcedTheme,
|
|
287
|
-
storageKey,
|
|
288
|
-
attribute,
|
|
289
|
-
enableSystem,
|
|
290
|
-
enableColorScheme,
|
|
291
|
-
defaultTheme,
|
|
292
|
-
value,
|
|
293
|
-
themes,
|
|
294
|
-
nonce,
|
|
295
|
-
}}
|
|
296
|
-
/>
|
|
297
|
-
{children}
|
|
298
|
-
</ThemeContext.Provider>
|
|
299
|
-
);
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
const ThemeScript = memo(
|
|
303
|
-
({
|
|
304
|
-
forcedTheme,
|
|
305
|
-
storageKey,
|
|
306
|
-
attribute,
|
|
307
|
-
enableSystem,
|
|
308
|
-
enableColorScheme,
|
|
309
|
-
defaultTheme,
|
|
310
|
-
value,
|
|
311
|
-
themes,
|
|
312
|
-
nonce,
|
|
313
|
-
}: Omit<ThemeProviderProps, "children"> & {
|
|
314
|
-
defaultTheme: string;
|
|
315
|
-
}) => {
|
|
316
|
-
const scriptArgs = JSON.stringify([
|
|
317
|
-
attribute,
|
|
318
|
-
storageKey,
|
|
319
|
-
defaultTheme,
|
|
320
|
-
forcedTheme,
|
|
321
|
-
themes,
|
|
322
|
-
value,
|
|
323
|
-
enableSystem,
|
|
324
|
-
enableColorScheme,
|
|
325
|
-
]).slice(1, -1);
|
|
326
|
-
|
|
327
|
-
return (
|
|
328
|
-
<script
|
|
329
|
-
// Run the theme bootstrap with serialized provider configuration before first paint.
|
|
330
|
-
dangerouslySetInnerHTML={{
|
|
331
|
-
__html: `(${script.toString()})(${scriptArgs})`,
|
|
332
|
-
}}
|
|
333
|
-
nonce={nonce}
|
|
334
|
-
suppressHydrationWarning
|
|
335
|
-
/>
|
|
336
|
-
);
|
|
337
|
-
},
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
ThemeScript.displayName = "ThemeScript";
|
|
341
|
-
|
|
342
|
-
// Helpers
|
|
343
|
-
const getTheme = (key: string, fallback?: string) => {
|
|
344
|
-
if (isServer) {
|
|
345
|
-
return fallback;
|
|
346
|
-
}
|
|
347
|
-
let theme: string | undefined;
|
|
348
|
-
try {
|
|
349
|
-
theme = localStorage.getItem(key) || undefined;
|
|
350
|
-
} catch {
|
|
351
|
-
// localStorage might not be available
|
|
352
|
-
}
|
|
353
|
-
return theme || fallback;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
const disableAnimation = () => {
|
|
357
|
-
const css = document.createElement("style");
|
|
358
|
-
css.appendChild(
|
|
359
|
-
document.createTextNode(
|
|
360
|
-
"*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}",
|
|
361
|
-
),
|
|
362
|
-
);
|
|
363
|
-
document.head.appendChild(css);
|
|
364
|
-
|
|
365
|
-
return () => {
|
|
366
|
-
// Force restyle
|
|
367
|
-
window.getComputedStyle(document.body);
|
|
368
|
-
// Wait for next tick before removing
|
|
369
|
-
setTimeout(() => {
|
|
370
|
-
document.head.removeChild(css);
|
|
371
|
-
}, 1);
|
|
372
|
-
};
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
const getSystemTheme = (e?: MediaQueryList | MediaQueryListEvent) => {
|
|
376
|
-
if (isServer) {
|
|
377
|
-
return "light";
|
|
378
|
-
}
|
|
379
|
-
const event = e ?? window.matchMedia(MEDIA);
|
|
380
|
-
const isDark = event.matches;
|
|
381
|
-
const systemTheme = isDark ? "dark" : "light";
|
|
382
|
-
return systemTheme;
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
/*
|
|
386
|
-
This file is adapted from next-themes to work with tanstack start.
|
|
387
|
-
next-themes can be found at https://github.com/pacocoursey/next-themes under the MIT license.
|
|
388
|
-
*/
|
|
389
|
-
|
|
390
|
-
export const script = (
|
|
391
|
-
attribute: Attribute | Array<Attribute>,
|
|
392
|
-
storageKey: string,
|
|
393
|
-
defaultTheme: string,
|
|
394
|
-
forcedTheme: string | undefined,
|
|
395
|
-
themes: Array<string>,
|
|
396
|
-
value: ValueObject | undefined,
|
|
397
|
-
enableSystem: boolean,
|
|
398
|
-
enableColorScheme: boolean,
|
|
399
|
-
) => {
|
|
400
|
-
const el = document.documentElement;
|
|
401
|
-
const systemThemes = ["light", "dark"];
|
|
402
|
-
const attributes = Array.isArray(attribute) ? attribute : [attribute];
|
|
403
|
-
const attrValues = value ? Object.values(value) : themes;
|
|
404
|
-
|
|
405
|
-
function applyClassAttr(name: string | undefined) {
|
|
406
|
-
el.classList.remove(...attrValues);
|
|
407
|
-
if (name) {
|
|
408
|
-
el.classList.add(name);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function applyDataAttr(attr: string, name: string | undefined) {
|
|
413
|
-
if (name) {
|
|
414
|
-
el.setAttribute(attr, name);
|
|
415
|
-
} else {
|
|
416
|
-
el.removeAttribute(attr);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function updateDOM(theme: string) {
|
|
421
|
-
const name = value ? value[theme] : theme;
|
|
422
|
-
|
|
423
|
-
for (const attr of attributes) {
|
|
424
|
-
if (attr === "class") {
|
|
425
|
-
applyClassAttr(name);
|
|
426
|
-
} else if (attr.startsWith("data-")) {
|
|
427
|
-
applyDataAttr(attr, name);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
setColorScheme(theme);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
function setColorScheme(theme: string) {
|
|
435
|
-
if (!enableColorScheme) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const fallback = systemThemes.includes(defaultTheme) ? defaultTheme : null;
|
|
440
|
-
const colorScheme = systemThemes.includes(theme) ? theme : fallback;
|
|
441
|
-
el.style.colorScheme = colorScheme || "";
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
function resolveSystemTheme() {
|
|
445
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
446
|
-
? "dark"
|
|
447
|
-
: "light";
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (forcedTheme) {
|
|
451
|
-
const resolvedForcedTheme =
|
|
452
|
-
forcedTheme === "system" && enableSystem
|
|
453
|
-
? resolveSystemTheme()
|
|
454
|
-
: forcedTheme;
|
|
455
|
-
updateDOM(resolvedForcedTheme);
|
|
456
|
-
} else {
|
|
457
|
-
try {
|
|
458
|
-
const themeName = localStorage.getItem(storageKey) || defaultTheme;
|
|
459
|
-
const isSystem = enableSystem && themeName === "system";
|
|
460
|
-
const theme = isSystem ? resolveSystemTheme() : themeName;
|
|
461
|
-
updateDOM(theme);
|
|
462
|
-
} catch {
|
|
463
|
-
// localStorage might not be available
|
|
464
|
-
updateDOM(defaultTheme);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
DisclosureGroup,
|
|
4
|
-
type DisclosureGroupSize,
|
|
5
|
-
} from "../disclosure-group/disclosure-group";
|
|
6
|
-
import { cn } from "../../lib/class-names";
|
|
7
|
-
|
|
8
|
-
export type AccordionSize = DisclosureGroupSize;
|
|
9
|
-
|
|
10
|
-
const containerRadius: Record<AccordionSize, string> = {
|
|
11
|
-
sm: "rounded-xl",
|
|
12
|
-
md: "rounded-2xl",
|
|
13
|
-
lg: "rounded-3xl",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export interface AccordionItem {
|
|
17
|
-
/** Stable value used to identify the expanded item. */
|
|
18
|
-
value: string;
|
|
19
|
-
title: string;
|
|
20
|
-
content: ReactNode;
|
|
21
|
-
description?: string;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface AccordionProps {
|
|
26
|
-
items: readonly AccordionItem[];
|
|
27
|
-
/** The expanded item, or `null` when all items are closed. */
|
|
28
|
-
value: string | null;
|
|
29
|
-
/** Selecting the open item reports `null`, so every item can collapse. */
|
|
30
|
-
onValueChange: (value: string | null) => void;
|
|
31
|
-
/** Density passed through to each DisclosureGroup. @default "md" */
|
|
32
|
-
size?: AccordionSize;
|
|
33
|
-
className?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** A single-open, collapsible accordion with labelled animated content regions. */
|
|
37
|
-
export function Accordion({
|
|
38
|
-
items,
|
|
39
|
-
value,
|
|
40
|
-
onValueChange,
|
|
41
|
-
size = "md",
|
|
42
|
-
className,
|
|
43
|
-
}: AccordionProps) {
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={cn(
|
|
47
|
-
"flex w-full min-w-0 flex-col overflow-hidden",
|
|
48
|
-
containerRadius[size],
|
|
49
|
-
"border-separator/60 bg-elevated border",
|
|
50
|
-
className,
|
|
51
|
-
)}
|
|
52
|
-
>
|
|
53
|
-
{items.map((item, index) => (
|
|
54
|
-
<DisclosureGroup
|
|
55
|
-
key={item.value}
|
|
56
|
-
label={item.title}
|
|
57
|
-
description={item.description}
|
|
58
|
-
open={value === item.value}
|
|
59
|
-
disabled={item.disabled}
|
|
60
|
-
size={size}
|
|
61
|
-
triggerClassName="rounded-none"
|
|
62
|
-
onOpenChange={(open) => onValueChange(open ? item.value : null)}
|
|
63
|
-
className={cn(index > 0 && "border-separator/60 border-t")}
|
|
64
|
-
>
|
|
65
|
-
{item.content}
|
|
66
|
-
</DisclosureGroup>
|
|
67
|
-
))}
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
|
|
4
|
-
type AmbientProps = ComponentPropsWithoutRef<"section"> & {
|
|
5
|
-
/** The image whose colors glow behind the content. */
|
|
6
|
-
src?: string | null;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Content with its image's colors glowing softly behind it, no card or
|
|
11
|
-
* edge: a blown-up, blurred copy of the image masked into a circle that
|
|
12
|
-
* fades into the page, the way Apple lets a photo light its surroundings.
|
|
13
|
-
*/
|
|
14
|
-
export function Ambient({ src, className, children, ...props }: AmbientProps) {
|
|
15
|
-
return (
|
|
16
|
-
<section className={cn("relative isolate", className)} {...props}>
|
|
17
|
-
{src && (
|
|
18
|
-
<img
|
|
19
|
-
aria-hidden
|
|
20
|
-
src={src}
|
|
21
|
-
alt=""
|
|
22
|
-
className={cn(
|
|
23
|
-
"pointer-events-none absolute top-[38%] left-1/2 -z-10 size-[min(32rem,100vw)] -translate-x-1/2 -translate-y-1/2",
|
|
24
|
-
"rounded-full object-cover opacity-20 blur-3xl",
|
|
25
|
-
// on a dark page the same light blooms far wider, so it shrinks and dims
|
|
26
|
-
"dark:size-[min(20rem,80vw)] dark:opacity-15 dark:blur-2xl",
|
|
27
|
-
"mask-[radial-gradient(closest-side,black_35%,transparent)]",
|
|
28
|
-
"animate-in fade-in-0 zoom-in-90 duration-1000",
|
|
29
|
-
)}
|
|
30
|
-
/>
|
|
31
|
-
)}
|
|
32
|
-
{children}
|
|
33
|
-
</section>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ambient";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
|
|
4
|
-
export interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/** Width divided by height. @default 1.3333333333333333 */
|
|
6
|
-
ratio?: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** A crop frame: size its geometry, while images cover without distortion. */
|
|
10
|
-
export function AspectRatio({
|
|
11
|
-
ratio = 4 / 3,
|
|
12
|
-
className,
|
|
13
|
-
style,
|
|
14
|
-
...props
|
|
15
|
-
}: AspectRatioProps) {
|
|
16
|
-
const aspect = Number.isFinite(ratio) && ratio > 0 ? ratio : 4 / 3;
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
{...props}
|
|
20
|
-
className={cn(
|
|
21
|
-
"relative w-full overflow-hidden [&>img]:size-full [&>img]:object-cover [&>video]:size-full [&>video]:object-cover",
|
|
22
|
-
className,
|
|
23
|
-
)}
|
|
24
|
-
style={{ aspectRatio: aspect, ...style }}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../lib/class-names";
|
|
3
|
-
|
|
4
|
-
export type BreadcrumbSize = "sm" | "md";
|
|
5
|
-
|
|
6
|
-
const sizes: Record<BreadcrumbSize, string> = {
|
|
7
|
-
sm: "text-caption",
|
|
8
|
-
md: "text-footnote",
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export interface BreadcrumbItem {
|
|
12
|
-
label: string;
|
|
13
|
-
href?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface BreadcrumbProps {
|
|
16
|
-
label: string;
|
|
17
|
-
items: readonly BreadcrumbItem[];
|
|
18
|
-
className?: string;
|
|
19
|
-
/** Integrate a client router without nesting interactive elements. */
|
|
20
|
-
renderLink?: (item: BreadcrumbItem & { href: string }) => ReactNode;
|
|
21
|
-
/** Text scale. @default "md" */
|
|
22
|
-
size?: BreadcrumbSize;
|
|
23
|
-
}
|
|
24
|
-
/** Ancestors stay links; the final item identifies the current page. */
|
|
25
|
-
export function Breadcrumb({
|
|
26
|
-
label,
|
|
27
|
-
items,
|
|
28
|
-
className,
|
|
29
|
-
renderLink,
|
|
30
|
-
size = "md",
|
|
31
|
-
}: BreadcrumbProps) {
|
|
32
|
-
return (
|
|
33
|
-
<nav aria-label={label} className={cn("not-typeset", className)}>
|
|
34
|
-
<ol
|
|
35
|
-
className={cn(
|
|
36
|
-
"text-label-secondary m-0 flex list-none flex-wrap items-center gap-x-2 gap-y-1 p-0",
|
|
37
|
-
sizes[size],
|
|
38
|
-
)}
|
|
39
|
-
>
|
|
40
|
-
{items.map((item, index) => (
|
|
41
|
-
<li
|
|
42
|
-
key={item.label}
|
|
43
|
-
className="m-0 flex min-w-0 items-center gap-2 p-0"
|
|
44
|
-
>
|
|
45
|
-
{index > 0 && (
|
|
46
|
-
<span aria-hidden="true" className="text-label-tertiary">
|
|
47
|
-
/
|
|
48
|
-
</span>
|
|
49
|
-
)}
|
|
50
|
-
{index === items.length - 1 ? (
|
|
51
|
-
<span aria-current="page" className="text-label font-medium">
|
|
52
|
-
{item.label}
|
|
53
|
-
</span>
|
|
54
|
-
) : item.href ? (
|
|
55
|
-
(renderLink?.({ ...item, href: item.href }) ?? (
|
|
56
|
-
<a
|
|
57
|
-
href={item.href}
|
|
58
|
-
className={cn(
|
|
59
|
-
"hover:text-label focus-visible:outline-accent-text rounded-sm focus-visible:outline-2",
|
|
60
|
-
)}
|
|
61
|
-
>
|
|
62
|
-
{item.label}
|
|
63
|
-
</a>
|
|
64
|
-
))
|
|
65
|
-
) : (
|
|
66
|
-
<span>{item.label}</span>
|
|
67
|
-
)}
|
|
68
|
-
</li>
|
|
69
|
-
))}
|
|
70
|
-
</ol>
|
|
71
|
-
</nav>
|
|
72
|
-
);
|
|
73
|
-
}
|