@passui/react 0.1.17 → 0.1.20
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 +140 -1
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/dist/types/src/appearance/index.d.ts +2 -0
- package/dist/types/src/appearance/platform.d.ts +9 -0
- package/dist/types/src/appearance/theme.d.ts +71 -0
- package/dist/types/src/components/accordion/accordion.d.ts +19 -0
- package/dist/types/src/components/ambient/ambient.d.ts +12 -0
- package/dist/types/src/components/ambient/index.d.ts +1 -0
- package/dist/types/src/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/types/src/components/breadcrumb/breadcrumb.d.ts +16 -0
- package/dist/types/src/components/button/button-styles.d.ts +12 -0
- package/dist/types/src/components/button/button.d.ts +32 -0
- package/dist/types/src/components/button/icon-button.d.ts +10 -0
- package/dist/types/src/components/button/pending-spinner.d.ts +5 -0
- package/dist/types/src/components/button/use-pending-indicator.d.ts +2 -0
- package/dist/types/src/components/chip/chip.d.ts +7 -0
- package/dist/types/src/components/code-block/code-block.d.ts +10 -0
- package/dist/types/src/components/combo-box/combo-box.d.ts +9 -0
- package/dist/types/src/components/command/command.d.ts +18 -0
- package/dist/types/src/components/compact-date-picker/calendar-month.d.ts +25 -0
- package/dist/types/src/components/compact-date-picker/compact-date-picker.d.ts +27 -0
- package/dist/types/src/components/compact-time-picker/compact-time-picker.d.ts +26 -0
- package/dist/types/src/components/compact-time-picker/time-value.d.ts +18 -0
- package/dist/types/src/components/content-unavailable-view/content-unavailable-view.d.ts +9 -0
- package/dist/types/src/components/content-view/content-view.d.ts +48 -0
- package/dist/types/src/components/content-view/index.d.ts +1 -0
- package/dist/types/src/components/context-menu/conceal-menu-source.d.ts +2 -0
- package/dist/types/src/components/context-menu/context-menu-host.d.ts +2 -0
- package/dist/types/src/components/context-menu/context-menu-store.d.ts +57 -0
- package/dist/types/src/components/context-menu/menu-navigation.d.ts +6 -0
- package/dist/types/src/components/context-menu/menu-position.d.ts +21 -0
- package/dist/types/src/components/context-menu/menu-reveal.d.ts +17 -0
- package/dist/types/src/components/context-menu/use-context-menu.d.ts +14 -0
- package/dist/types/src/components/conversation/conversation.d.ts +43 -0
- package/dist/types/src/components/conversation/index.d.ts +1 -0
- package/dist/types/src/components/date-picker/date-picker.d.ts +16 -0
- package/dist/types/src/components/date-picker/date-value.d.ts +2 -0
- package/dist/types/src/components/dialog/dialog-host.d.ts +6 -0
- package/dist/types/src/components/dialog/dialog-store.d.ts +23 -0
- package/dist/types/src/components/dialog/dialog.d.ts +30 -0
- package/dist/types/src/components/dialog/index.d.ts +1 -0
- package/dist/types/src/components/disclosure-group/disclosure-group.d.ts +15 -0
- package/dist/types/src/components/divider/divider.d.ts +9 -0
- package/dist/types/src/components/inline-disclosure/inline-disclosure.d.ts +15 -0
- package/dist/types/src/components/keyboard-shortcut/keyboard-shortcut.d.ts +5 -0
- package/dist/types/src/components/labeled-content/labeled-content.d.ts +19 -0
- package/dist/types/src/components/locale-switcher/index.d.ts +1 -0
- package/dist/types/src/components/locale-switcher/locale-switcher.d.ts +10 -0
- package/dist/types/src/components/menu/menu.d.ts +16 -0
- package/dist/types/src/components/one-time-code/one-time-code.d.ts +18 -0
- package/dist/types/src/components/picker/picker-trigger.d.ts +2 -0
- package/dist/types/src/components/picker/picker.d.ts +43 -0
- package/dist/types/src/components/popover/anchored-surface.d.ts +13 -0
- package/dist/types/src/components/popover/popover-fit.d.ts +21 -0
- package/dist/types/src/components/popover/popover.d.ts +18 -0
- package/dist/types/src/components/profile-image/profile-image.d.ts +4 -0
- package/dist/types/src/components/progress-view/progress-view.d.ts +13 -0
- package/dist/types/src/components/progress-view/use-liquid-progress.d.ts +3 -0
- package/dist/types/src/components/radio-group/radio-group.d.ts +17 -0
- package/dist/types/src/components/search-field/expanding-search-field.d.ts +5 -0
- package/dist/types/src/components/search-field/search-field.d.ts +6 -0
- package/dist/types/src/components/search-list/search-list.d.ts +19 -0
- package/dist/types/src/components/section/section.d.ts +15 -0
- package/dist/types/src/components/secure-field/secure-field.d.ts +4 -0
- package/dist/types/src/components/segmented-control/segmented-control.d.ts +20 -0
- package/dist/types/src/components/sheet/modal-environment.d.ts +2 -0
- package/dist/types/src/components/sheet/sheet-portal.d.ts +5 -0
- package/dist/types/src/components/sheet/sheet.d.ts +21 -0
- package/dist/types/src/components/sheet/use-sheet-focus.d.ts +3 -0
- package/dist/types/src/components/sidebar/sidebar.d.ts +19 -0
- package/dist/types/src/components/skeleton/skeleton.d.ts +6 -0
- package/dist/types/src/components/slider/slider.d.ts +14 -0
- package/dist/types/src/components/slosh-slider/liquid-step.d.ts +6 -0
- package/dist/types/src/components/slosh-slider/slosh-slider.d.ts +18 -0
- package/dist/types/src/components/stat-tile/index.d.ts +1 -0
- package/dist/types/src/components/stat-tile/stat-tile.d.ts +15 -0
- package/dist/types/src/components/status-indicator/status-indicator.d.ts +14 -0
- package/dist/types/src/components/stepper/rolling-digit.d.ts +11 -0
- package/dist/types/src/components/stepper/stepper.d.ts +19 -0
- package/dist/types/src/components/swatch-picker/swatch-picker.d.ts +17 -0
- package/dist/types/src/components/tab-bar/tab-bar.d.ts +40 -0
- package/dist/types/src/components/tab-view/tab-view.d.ts +24 -0
- package/dist/types/src/components/table/table.d.ts +10 -0
- package/dist/types/src/components/text-editor/text-editor.d.ts +2 -0
- package/dist/types/src/components/text-field/text-field.d.ts +20 -0
- package/dist/types/src/components/toast/toast-store.d.ts +47 -0
- package/dist/types/src/components/toast/toaster.d.ts +10 -0
- package/dist/types/src/components/toggle/toggle.d.ts +17 -0
- package/dist/types/src/components/tooltip/tooltip-host.d.ts +6 -0
- package/dist/types/src/components/view-controller/index.d.ts +1 -0
- package/dist/types/src/components/view-controller/view-controller.d.ts +21 -0
- package/dist/types/src/components/wake-slider/wake-slider.d.ts +12 -0
- package/dist/types/src/hooks/scroll/minimize-decision.d.ts +2 -0
- package/dist/types/src/hooks/use-anchored-disclosure.d.ts +9 -0
- package/dist/types/src/hooks/use-anchored-placement.d.ts +7 -0
- package/dist/types/src/hooks/use-dismiss.d.ts +9 -0
- package/dist/types/src/hooks/use-floating-dismiss.d.ts +3 -0
- package/dist/types/src/hooks/use-media-query.d.ts +21 -0
- package/dist/types/src/hooks/use-minimize-on-scroll.d.ts +6 -0
- package/dist/types/src/hooks/use-visual-viewport.d.ts +4 -0
- package/dist/types/src/hooks/viewport/types.d.ts +19 -0
- package/dist/types/src/hooks/viewport/viewport-metrics.d.ts +3 -0
- package/dist/types/src/icons/icons.d.ts +612 -0
- package/dist/types/src/index.d.ts +71 -0
- package/dist/types/src/lib/anchored-placement.d.ts +39 -0
- package/dist/types/src/lib/class-names.d.ts +2 -0
- package/dist/types/src/lib/clipboard.d.ts +6 -0
- package/dist/types/src/lib/date.d.ts +50 -0
- package/dist/types/src/lib/floating-layers.d.ts +8 -0
- package/dist/types/src/lib/haptics.d.ts +8 -0
- package/dist/types/src/lib/language.d.ts +4 -0
- package/dist/types/src/lib/range-value.d.ts +4 -0
- package/dist/types/src/lib/screen-edges.d.ts +12 -0
- package/dist/types/src/lib/shapes.d.ts +17 -0
- package/dist/types/src/motion/transitions.d.ts +97 -0
- package/dist/types/src/tokens.d.ts +1 -0
- package/package.json +248 -40
- package/src/appearance/platform.tsx +10 -47
- package/src/appearance/theme.tsx +42 -142
- package/src/components/accordion/accordion.tsx +48 -0
- package/src/components/ambient/ambient.tsx +2 -10
- package/src/components/aspect-ratio/aspect-ratio.tsx +22 -0
- package/src/components/breadcrumb/breadcrumb.tsx +53 -0
- package/src/components/button/button-styles.ts +13 -31
- package/src/components/button/button.tsx +24 -15
- package/src/components/button/icon-button.tsx +14 -56
- package/src/components/button/use-pending-indicator.ts +2 -7
- package/src/components/chip/chip.tsx +8 -13
- package/src/components/code-block/code-block.tsx +41 -0
- package/src/components/combo-box/combo-box.tsx +13 -0
- package/src/components/command/command.tsx +119 -0
- package/src/components/compact-date-picker/calendar-month.ts +13 -57
- package/src/components/compact-date-picker/compact-date-picker.tsx +72 -195
- package/src/components/compact-time-picker/compact-time-picker.tsx +74 -195
- package/src/components/compact-time-picker/time-value.ts +4 -16
- package/src/components/content-unavailable-view/content-unavailable-view.tsx +37 -0
- package/src/components/content-view/content-view.tsx +13 -56
- package/src/components/context-menu/conceal-menu-source.ts +1 -4
- package/src/components/context-menu/context-menu-host.tsx +132 -198
- package/src/components/context-menu/context-menu-store.ts +5 -14
- package/src/components/context-menu/menu-navigation.ts +29 -0
- package/src/components/context-menu/menu-position.ts +6 -27
- package/src/components/context-menu/menu-reveal.ts +14 -52
- package/src/components/context-menu/use-context-menu.ts +6 -30
- package/src/components/conversation/conversation.tsx +26 -72
- package/src/components/date-picker/date-picker.tsx +8 -37
- package/src/components/date-picker/date-value.ts +5 -30
- package/src/components/dialog/dialog-host.tsx +37 -76
- package/src/components/dialog/dialog-store.ts +16 -7
- package/src/components/dialog/dialog.tsx +23 -80
- package/src/components/disclosure-group/disclosure-group.tsx +79 -0
- package/src/components/divider/divider.tsx +31 -0
- package/src/components/inline-disclosure/inline-disclosure.tsx +49 -0
- package/src/components/keyboard-shortcut/keyboard-shortcut.tsx +17 -0
- package/src/components/labeled-content/labeled-content.tsx +24 -18
- package/src/components/locale-switcher/locale-switcher.tsx +20 -70
- package/src/components/menu/menu.tsx +68 -0
- package/src/components/one-time-code/one-time-code.tsx +168 -0
- package/src/components/picker/picker-trigger.ts +10 -0
- package/src/components/picker/picker.tsx +165 -283
- package/src/components/popover/anchored-surface.tsx +223 -0
- package/src/components/popover/popover-fit.ts +69 -0
- package/src/components/popover/popover.tsx +209 -63
- package/src/components/profile-image/profile-image.tsx +6 -28
- package/src/components/progress-view/progress-view.tsx +70 -0
- package/src/components/progress-view/use-liquid-progress.ts +43 -0
- package/src/components/radio-group/radio-group.tsx +63 -0
- package/src/components/search-field/expanding-search-field.tsx +183 -0
- package/src/components/search-field/search-field.tsx +25 -7
- package/src/components/search-list/search-list.tsx +58 -75
- package/src/components/section/section.tsx +18 -17
- package/src/components/secure-field/secure-field.tsx +5 -7
- package/src/components/segmented-control/segmented-control.tsx +20 -29
- package/src/components/sheet/modal-environment.ts +16 -54
- package/src/components/sheet/sheet-portal.tsx +10 -42
- package/src/components/sheet/sheet.tsx +17 -25
- package/src/components/sheet/use-sheet-focus.ts +15 -51
- package/src/components/sidebar/sidebar.tsx +44 -38
- package/src/components/skeleton/skeleton.tsx +19 -0
- package/src/components/slider/slider.tsx +76 -0
- package/src/components/slosh-slider/liquid-step.ts +42 -0
- package/src/components/slosh-slider/slosh-slider.tsx +251 -0
- package/src/components/stat-tile/stat-tile.tsx +9 -30
- package/src/components/status-indicator/status-indicator.tsx +12 -19
- package/src/components/stepper/rolling-digit.tsx +77 -0
- package/src/components/stepper/stepper.tsx +101 -0
- package/src/components/swatch-picker/swatch-picker.tsx +19 -15
- package/src/components/tab-bar/tab-bar.tsx +59 -59
- package/src/components/tab-view/tab-view.tsx +52 -57
- package/src/components/table/table.tsx +14 -62
- package/src/components/text-editor/text-editor.tsx +2 -12
- package/src/components/text-field/text-field.tsx +53 -44
- package/src/components/toast/toast-store.ts +9 -30
- package/src/components/toast/toaster.tsx +90 -104
- package/src/components/toggle/toggle.tsx +165 -44
- package/src/components/tooltip/tooltip-host.tsx +70 -67
- package/src/components/view-controller/view-controller.tsx +4 -21
- package/src/components/wake-slider/wake-slider.tsx +237 -0
- package/src/hooks/scroll/minimize-decision.ts +1 -5
- package/src/hooks/use-anchored-disclosure.ts +23 -0
- package/src/hooks/use-anchored-placement.ts +7 -14
- package/src/hooks/use-dismiss.ts +5 -23
- package/src/hooks/use-floating-dismiss.ts +28 -0
- package/src/hooks/use-media-query.ts +12 -31
- package/src/hooks/use-minimize-on-scroll.ts +10 -34
- package/src/hooks/use-visual-viewport.ts +5 -14
- package/src/hooks/viewport/viewport-metrics.ts +4 -16
- package/src/icons/icons.tsx +229 -183
- package/src/index.ts +27 -1
- package/src/lib/anchored-placement.ts +12 -18
- package/src/lib/class-names.ts +1 -2
- package/src/lib/clipboard.ts +14 -0
- package/src/lib/date.ts +4 -15
- package/src/lib/floating-layers.ts +18 -8
- package/src/lib/haptics.ts +1 -3
- package/src/lib/language.ts +2 -7
- package/src/lib/range-value.ts +32 -0
- package/src/lib/screen-edges.ts +2 -6
- package/src/lib/shapes.ts +5 -20
- package/src/motion/transitions.ts +18 -12
- package/src/styles/code-block.css +33 -0
- package/src/styles/motion-controls.css +189 -0
- package/src/styles/styles.css +3 -0
- package/src/components/ambient/ambient.docs.tsx +0 -68
- package/src/components/ambient/examples/ambient-images.tsx +0 -30
- package/src/components/ambient/examples/ambient-now-playing.tsx +0 -55
- package/src/components/ambient/examples/ambient-showcase.tsx +0 -33
- package/src/components/ambient/examples/ambient-usage.tsx +0 -19
- package/src/components/button/button.docs.tsx +0 -116
- package/src/components/button/examples/button-disabled.tsx +0 -19
- package/src/components/button/examples/button-icon.tsx +0 -39
- package/src/components/button/examples/button-link.tsx +0 -12
- package/src/components/button/examples/button-pending.tsx +0 -27
- package/src/components/button/examples/button-showcase.tsx +0 -115
- package/src/components/button/examples/button-sizes.tsx +0 -12
- package/src/components/button/examples/button-usage.tsx +0 -12
- package/src/components/button/examples/button-variants.tsx +0 -15
- package/src/components/button/examples/button-with-icon.tsx +0 -32
- package/src/components/button/examples/icon-button-player.tsx +0 -38
- package/src/components/button/examples/icon-button-showcase.tsx +0 -83
- package/src/components/button/examples/icon-button-usage.tsx +0 -11
- package/src/components/button/examples/icon-button-variants.tsx +0 -39
- package/src/components/button/icon-button.docs.tsx +0 -68
- package/src/components/chip/chip.docs.tsx +0 -37
- package/src/components/chip/examples/chip-in-rows.tsx +0 -19
- package/src/components/chip/examples/chip-showcase.tsx +0 -51
- package/src/components/chip/examples/chip-tones.tsx +0 -13
- package/src/components/chip/examples/chip-usage.tsx +0 -5
- package/src/components/compact-date-picker/compact-date-picker.docs.tsx +0 -81
- package/src/components/compact-date-picker/examples/compact-date-picker-showcase.tsx +0 -35
- package/src/components/compact-date-picker/examples/compact-date-picker-usage.tsx +0 -22
- package/src/components/compact-time-picker/compact-time-picker.docs.tsx +0 -80
- package/src/components/compact-time-picker/examples/compact-time-picker-showcase.tsx +0 -31
- package/src/components/compact-time-picker/examples/compact-time-picker-usage.tsx +0 -21
- package/src/components/content-view/content-view.docs.tsx +0 -61
- package/src/components/content-view/examples/content-view-header-action.tsx +0 -33
- package/src/components/content-view/examples/content-view-showcase.tsx +0 -65
- package/src/components/content-view/examples/content-view-stats.tsx +0 -35
- package/src/components/content-view/examples/content-view-usage.tsx +0 -14
- package/src/components/context-menu/context-menu.docs.tsx +0 -92
- package/src/components/context-menu/examples/context-menu-checked.tsx +0 -37
- package/src/components/context-menu/examples/context-menu-list.tsx +0 -85
- package/src/components/context-menu/examples/context-menu-showcase.tsx +0 -56
- package/src/components/context-menu/examples/context-menu-toolbar.tsx +0 -63
- package/src/components/context-menu/examples/context-menu-usage.tsx +0 -24
- package/src/components/conversation/conversation.docs.tsx +0 -88
- package/src/components/conversation/examples/conversation-composer.tsx +0 -36
- package/src/components/conversation/examples/conversation-days.tsx +0 -48
- package/src/components/conversation/examples/conversation-showcase.tsx +0 -71
- package/src/components/conversation/examples/conversation-usage.tsx +0 -28
- package/src/components/date-picker/date-picker.docs.tsx +0 -88
- package/src/components/date-picker/examples/date-picker-locales.tsx +0 -41
- package/src/components/date-picker/examples/date-picker-past-only.tsx +0 -29
- package/src/components/date-picker/examples/date-picker-showcase.tsx +0 -49
- package/src/components/date-picker/examples/date-picker-usage.tsx +0 -22
- package/src/components/dialog/dialog.docs.tsx +0 -114
- package/src/components/dialog/examples/dialog-confirm.tsx +0 -24
- package/src/components/dialog/examples/dialog-form.tsx +0 -46
- package/src/components/dialog/examples/dialog-inline.tsx +0 -48
- package/src/components/dialog/examples/dialog-showcase.tsx +0 -53
- package/src/components/dialog/examples/dialog-usage.tsx +0 -31
- package/src/components/labeled-content/examples/labeled-content-descriptions.tsx +0 -37
- package/src/components/labeled-content/examples/labeled-content-showcase.tsx +0 -54
- package/src/components/labeled-content/examples/labeled-content-usage.tsx +0 -22
- package/src/components/labeled-content/examples/labeled-content-values.tsx +0 -26
- package/src/components/labeled-content/examples/labeled-content-wide.tsx +0 -46
- package/src/components/labeled-content/labeled-content.docs.tsx +0 -69
- package/src/components/locale-switcher/examples/locale-switcher-native-names.tsx +0 -30
- package/src/components/locale-switcher/examples/locale-switcher-showcase.tsx +0 -46
- package/src/components/locale-switcher/examples/locale-switcher-translated-page.tsx +0 -35
- package/src/components/locale-switcher/examples/locale-switcher-usage.tsx +0 -20
- package/src/components/locale-switcher/locale-switcher.docs.tsx +0 -91
- package/src/components/picker/examples/picker-details.tsx +0 -44
- package/src/components/picker/examples/picker-searchable.tsx +0 -48
- package/src/components/picker/examples/picker-showcase.tsx +0 -66
- package/src/components/picker/examples/picker-usage.tsx +0 -20
- package/src/components/picker/picker.docs.tsx +0 -68
- package/src/components/popover/examples/popover-help.tsx +0 -57
- package/src/components/popover/examples/popover-menu.tsx +0 -51
- package/src/components/popover/examples/popover-showcase.tsx +0 -61
- package/src/components/popover/examples/popover-usage.tsx +0 -31
- package/src/components/popover/popover.docs.tsx +0 -84
- package/src/components/profile-image/examples/profile-image-fallbacks.tsx +0 -29
- package/src/components/profile-image/examples/profile-image-group.tsx +0 -34
- package/src/components/profile-image/examples/profile-image-showcase.tsx +0 -30
- package/src/components/profile-image/examples/profile-image-usage.tsx +0 -14
- package/src/components/profile-image/profile-image.docs.tsx +0 -81
- package/src/components/search-field/examples/search-field-filter.tsx +0 -53
- package/src/components/search-field/examples/search-field-showcase.tsx +0 -56
- package/src/components/search-field/examples/search-field-toolbar.tsx +0 -27
- package/src/components/search-field/examples/search-field-usage.tsx +0 -18
- package/src/components/search-field/search-field.docs.tsx +0 -58
- package/src/components/search-list/examples/search-list-dropdown.tsx +0 -53
- package/src/components/search-list/examples/search-list-groups.tsx +0 -64
- package/src/components/search-list/examples/search-list-showcase.tsx +0 -67
- package/src/components/search-list/examples/search-list-usage.tsx +0 -27
- package/src/components/search-list/search-list.docs.tsx +0 -87
- package/src/components/section/examples/section-actions.tsx +0 -35
- package/src/components/section/examples/section-groups.tsx +0 -41
- package/src/components/section/examples/section-showcase.tsx +0 -63
- package/src/components/section/examples/section-usage.tsx +0 -19
- package/src/components/section/section.docs.tsx +0 -51
- package/src/components/secure-field/examples/secure-field-new-password.tsx +0 -56
- package/src/components/secure-field/examples/secure-field-reveal.tsx +0 -20
- package/src/components/secure-field/examples/secure-field-showcase.tsx +0 -62
- package/src/components/secure-field/examples/secure-field-usage.tsx +0 -19
- package/src/components/secure-field/secure-field.docs.tsx +0 -72
- package/src/components/segmented-control/examples/segmented-control-overflow.tsx +0 -28
- package/src/components/segmented-control/examples/segmented-control-showcase.tsx +0 -59
- package/src/components/segmented-control/examples/segmented-control-usage.tsx +0 -20
- package/src/components/segmented-control/examples/segmented-control-views.tsx +0 -32
- package/src/components/segmented-control/segmented-control.docs.tsx +0 -61
- package/src/components/sheet/examples/sheet-choices.tsx +0 -58
- package/src/components/sheet/examples/sheet-share.tsx +0 -51
- package/src/components/sheet/examples/sheet-showcase.tsx +0 -74
- package/src/components/sheet/examples/sheet-usage.tsx +0 -32
- package/src/components/sheet/sheet.docs.tsx +0 -75
- package/src/components/sidebar/examples/sidebar-groups.tsx +0 -133
- package/src/components/sidebar/examples/sidebar-showcase.tsx +0 -123
- package/src/components/sidebar/examples/sidebar-unread.tsx +0 -66
- package/src/components/sidebar/examples/sidebar-usage.tsx +0 -52
- package/src/components/sidebar/sidebar.docs.tsx +0 -135
- package/src/components/stat-tile/examples/stat-tile-filters.tsx +0 -32
- package/src/components/stat-tile/examples/stat-tile-grid.tsx +0 -21
- package/src/components/stat-tile/examples/stat-tile-showcase.tsx +0 -52
- package/src/components/stat-tile/examples/stat-tile-usage.tsx +0 -13
- package/src/components/stat-tile/stat-tile.docs.tsx +0 -60
- package/src/components/status-indicator/examples/status-indicator-live.tsx +0 -34
- package/src/components/status-indicator/examples/status-indicator-showcase.tsx +0 -39
- package/src/components/status-indicator/examples/status-indicator-states.tsx +0 -17
- package/src/components/status-indicator/examples/status-indicator-usage.tsx +0 -9
- package/src/components/status-indicator/status-indicator.docs.tsx +0 -43
- package/src/components/swatch-picker/examples/swatch-picker-accents.tsx +0 -42
- package/src/components/swatch-picker/examples/swatch-picker-labels.tsx +0 -45
- package/src/components/swatch-picker/examples/swatch-picker-showcase.tsx +0 -70
- package/src/components/swatch-picker/examples/swatch-picker-usage.tsx +0 -39
- package/src/components/swatch-picker/swatch-picker.docs.tsx +0 -60
- package/src/components/tab-bar/examples/tab-bar-five-tabs.tsx +0 -66
- package/src/components/tab-bar/examples/tab-bar-minimize.tsx +0 -71
- package/src/components/tab-bar/examples/tab-bar-showcase.tsx +0 -82
- package/src/components/tab-bar/examples/tab-bar-usage.tsx +0 -54
- package/src/components/tab-bar/tab-bar.docs.tsx +0 -136
- package/src/components/tab-view/examples/tab-view-keyboard.tsx +0 -39
- package/src/components/tab-view/examples/tab-view-settings.tsx +0 -56
- package/src/components/tab-view/examples/tab-view-showcase.tsx +0 -53
- package/src/components/tab-view/examples/tab-view-usage.tsx +0 -23
- package/src/components/tab-view/tab-view.docs.tsx +0 -77
- package/src/components/table/examples/table-empty.tsx +0 -53
- package/src/components/table/examples/table-invoices.tsx +0 -102
- package/src/components/table/examples/table-selection.tsx +0 -150
- package/src/components/table/examples/table-showcase.tsx +0 -115
- package/src/components/table/examples/table-usage.tsx +0 -67
- package/src/components/table/examples/table-wide.tsx +0 -75
- package/src/components/table/table.docs.tsx +0 -131
- package/src/components/text-editor/examples/text-editor-comment.tsx +0 -48
- package/src/components/text-editor/examples/text-editor-count.tsx +0 -38
- package/src/components/text-editor/examples/text-editor-showcase.tsx +0 -58
- package/src/components/text-editor/examples/text-editor-usage.tsx +0 -25
- package/src/components/text-editor/text-editor.docs.tsx +0 -61
- package/src/components/text-field/examples/text-field-icons.tsx +0 -72
- package/src/components/text-field/examples/text-field-showcase.tsx +0 -50
- package/src/components/text-field/examples/text-field-usage.tsx +0 -18
- package/src/components/text-field/examples/text-field-validation.tsx +0 -27
- package/src/components/text-field/text-field.docs.tsx +0 -118
- package/src/components/toast/examples/toast-action.tsx +0 -32
- package/src/components/toast/examples/toast-promise.tsx +0 -45
- package/src/components/toast/examples/toast-showcase.tsx +0 -49
- package/src/components/toast/examples/toast-usage.tsx +0 -13
- package/src/components/toast/toast.docs.tsx +0 -79
- package/src/components/toggle/examples/toggle-checkboxes.tsx +0 -43
- package/src/components/toggle/examples/toggle-settings.tsx +0 -31
- package/src/components/toggle/examples/toggle-showcase.tsx +0 -59
- package/src/components/toggle/examples/toggle-usage.tsx +0 -13
- package/src/components/toggle/toggle.docs.tsx +0 -69
- package/src/components/tooltip/examples/tooltip-icon-buttons.tsx +0 -27
- package/src/components/tooltip/examples/tooltip-shortcuts.tsx +0 -38
- package/src/components/tooltip/examples/tooltip-showcase.tsx +0 -44
- package/src/components/tooltip/examples/tooltip-usage.tsx +0 -13
- package/src/components/tooltip/tooltip.docs.tsx +0 -56
- package/src/components/view-controller/examples/view-controller-action.tsx +0 -27
- package/src/components/view-controller/examples/view-controller-settings.tsx +0 -31
- package/src/components/view-controller/examples/view-controller-showcase.tsx +0 -45
- package/src/components/view-controller/examples/view-controller-usage.tsx +0 -19
- package/src/components/view-controller/view-controller.docs.tsx +0 -71
- package/src/docs/index.ts +0 -3
- package/src/docs/registry.ts +0 -113
- package/src/docs/snippet.ts +0 -17
- package/src/docs/types.ts +0 -180
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
useContext,
|
|
4
|
-
useEffect,
|
|
5
|
-
useState,
|
|
6
|
-
type PropsWithChildren,
|
|
7
|
-
} from "react"
|
|
1
|
+
import { createContext, useContext, useEffect, useState, type PropsWithChildren } from "react"
|
|
8
2
|
|
|
9
|
-
export type PlatformOS =
|
|
10
|
-
| "ios"
|
|
11
|
-
| "android"
|
|
12
|
-
| "macos"
|
|
13
|
-
| "windows"
|
|
14
|
-
| "linux"
|
|
15
|
-
| "unknown"
|
|
3
|
+
export type PlatformOS = "ios" | "android" | "macos" | "windows" | "linux" | "unknown"
|
|
16
4
|
|
|
17
5
|
const PlatformContext = createContext<PlatformOS>("unknown")
|
|
18
6
|
|
|
@@ -21,12 +9,7 @@ export function detectPlatform(
|
|
|
21
9
|
platform: string,
|
|
22
10
|
maxTouchPoints: number
|
|
23
11
|
): PlatformOS {
|
|
24
|
-
return resolvePlatform(
|
|
25
|
-
null,
|
|
26
|
-
userAgent,
|
|
27
|
-
platform,
|
|
28
|
-
maxTouchPoints
|
|
29
|
-
)
|
|
12
|
+
return resolvePlatform(null, userAgent, platform, maxTouchPoints)
|
|
30
13
|
}
|
|
31
14
|
|
|
32
15
|
export function resolvePlatform(
|
|
@@ -48,8 +31,7 @@ export function resolvePlatform(
|
|
|
48
31
|
|
|
49
32
|
if (/android/i.test(userAgent)) return "android"
|
|
50
33
|
if (/iPhone|iPad|iPod/i.test(userAgent)) return "ios"
|
|
51
|
-
if (platform === "MacIntel" && maxTouchPoints > 1)
|
|
52
|
-
return "ios"
|
|
34
|
+
if (platform === "MacIntel" && maxTouchPoints > 1) return "ios"
|
|
53
35
|
if (/Mac/i.test(platform)) return "macos"
|
|
54
36
|
if (/Win/i.test(platform)) return "windows"
|
|
55
37
|
if (/Linux/i.test(platform)) return "linux"
|
|
@@ -65,20 +47,11 @@ function initializePlatform(
|
|
|
65
47
|
) {
|
|
66
48
|
root.setAttribute(
|
|
67
49
|
"data-os",
|
|
68
|
-
resolve(
|
|
69
|
-
root.getAttribute("data-os"),
|
|
70
|
-
userAgent,
|
|
71
|
-
platform,
|
|
72
|
-
maxTouchPoints
|
|
73
|
-
)
|
|
50
|
+
resolve(root.getAttribute("data-os"), userAgent, platform, maxTouchPoints)
|
|
74
51
|
)
|
|
75
52
|
}
|
|
76
53
|
|
|
77
|
-
export function PlatformScript({
|
|
78
|
-
nonce,
|
|
79
|
-
}: {
|
|
80
|
-
nonce?: string
|
|
81
|
-
}) {
|
|
54
|
+
export function PlatformScript({ nonce }: { nonce?: string }) {
|
|
82
55
|
return (
|
|
83
56
|
<script
|
|
84
57
|
// Run the library's platform bootstrap before first paint.
|
|
@@ -91,11 +64,8 @@ export function PlatformScript({
|
|
|
91
64
|
)
|
|
92
65
|
}
|
|
93
66
|
|
|
94
|
-
export function PlatformProvider({
|
|
95
|
-
|
|
96
|
-
}: PropsWithChildren) {
|
|
97
|
-
const [platform, setPlatform] =
|
|
98
|
-
useState<PlatformOS>("unknown")
|
|
67
|
+
export function PlatformProvider({ children }: PropsWithChildren) {
|
|
68
|
+
const [platform, setPlatform] = useState<PlatformOS>("unknown")
|
|
99
69
|
|
|
100
70
|
useEffect(() => {
|
|
101
71
|
const resolved = resolvePlatform(
|
|
@@ -104,18 +74,11 @@ export function PlatformProvider({
|
|
|
104
74
|
navigator.platform,
|
|
105
75
|
navigator.maxTouchPoints
|
|
106
76
|
)
|
|
107
|
-
document.documentElement.setAttribute(
|
|
108
|
-
"data-os",
|
|
109
|
-
resolved
|
|
110
|
-
)
|
|
77
|
+
document.documentElement.setAttribute("data-os", resolved)
|
|
111
78
|
setPlatform(resolved)
|
|
112
79
|
}, [])
|
|
113
80
|
|
|
114
|
-
return
|
|
115
|
-
<PlatformContext.Provider value={platform}>
|
|
116
|
-
{children}
|
|
117
|
-
</PlatformContext.Provider>
|
|
118
|
-
)
|
|
81
|
+
return <PlatformContext.Provider value={platform}>{children}</PlatformContext.Provider>
|
|
119
82
|
}
|
|
120
83
|
|
|
121
84
|
export function usePlatform() {
|
package/src/appearance/theme.tsx
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
-
import {
|
|
3
|
-
|
|
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"
|
|
2
|
+
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useState } from "react"
|
|
3
|
+
import type { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from "react"
|
|
17
4
|
|
|
18
5
|
type ValueObject = {
|
|
19
6
|
[themeName: string]: string
|
|
@@ -40,8 +27,7 @@ export type SystemTheme = "dark" | "light"
|
|
|
40
27
|
|
|
41
28
|
export type Attribute = `data-${string}` | "class"
|
|
42
29
|
|
|
43
|
-
export interface ThemeProviderProps
|
|
44
|
-
extends PropsWithChildren {
|
|
30
|
+
export interface ThemeProviderProps extends PropsWithChildren {
|
|
45
31
|
/** List of all available theme names */
|
|
46
32
|
themes?: Array<string> | undefined
|
|
47
33
|
/** Forced theme name for the current page */
|
|
@@ -67,9 +53,7 @@ export interface ThemeProviderProps
|
|
|
67
53
|
const colorSchemes = ["light", "dark"]
|
|
68
54
|
const MEDIA = "(prefers-color-scheme: dark)"
|
|
69
55
|
const isServer = typeof window === "undefined"
|
|
70
|
-
const ThemeContext = createContext<UseThemeProps | undefined>(
|
|
71
|
-
undefined
|
|
72
|
-
)
|
|
56
|
+
const ThemeContext = createContext<UseThemeProps | undefined>(undefined)
|
|
73
57
|
const defaultContext: UseThemeProps = {
|
|
74
58
|
setTheme: () => {
|
|
75
59
|
/* no-op */
|
|
@@ -83,8 +67,7 @@ const defaultContext: UseThemeProps = {
|
|
|
83
67
|
* @example
|
|
84
68
|
* const { theme, setTheme } = useTheme()
|
|
85
69
|
*/
|
|
86
|
-
export const useTheme = (): UseThemeProps =>
|
|
87
|
-
useContext(ThemeContext) ?? defaultContext
|
|
70
|
+
export const useTheme = (): UseThemeProps => useContext(ThemeContext) ?? defaultContext
|
|
88
71
|
|
|
89
72
|
/**
|
|
90
73
|
* Theme provider component is used to wrap your app &
|
|
@@ -103,9 +86,7 @@ export const useTheme = (): UseThemeProps =>
|
|
|
103
86
|
* <App />
|
|
104
87
|
* </ThemeProvider>
|
|
105
88
|
*/
|
|
106
|
-
export const ThemeProvider = (
|
|
107
|
-
props: ThemeProviderProps
|
|
108
|
-
): ReactNode => {
|
|
89
|
+
export const ThemeProvider = (props: ThemeProviderProps): ReactNode => {
|
|
109
90
|
const context = useContext(ThemeContext)
|
|
110
91
|
// Ignore nested context providers, just passthrough children
|
|
111
92
|
if (context) {
|
|
@@ -128,15 +109,10 @@ const Theme = ({
|
|
|
128
109
|
children,
|
|
129
110
|
nonce,
|
|
130
111
|
}: ThemeProviderProps) => {
|
|
131
|
-
const [theme, setThemeState] = useState(() =>
|
|
132
|
-
getTheme(storageKey, defaultTheme)
|
|
133
|
-
)
|
|
112
|
+
const [theme, setThemeState] = useState(() => getTheme(storageKey, defaultTheme))
|
|
134
113
|
|
|
135
114
|
const applyClassAttribute = useCallback(
|
|
136
|
-
(
|
|
137
|
-
name: string | undefined,
|
|
138
|
-
attrValues: Array<string>
|
|
139
|
-
) => {
|
|
115
|
+
(name: string | undefined, attrValues: Array<string>) => {
|
|
140
116
|
const d = document.documentElement
|
|
141
117
|
d.classList.remove(...attrValues)
|
|
142
118
|
if (name) {
|
|
@@ -146,26 +122,19 @@ const Theme = ({
|
|
|
146
122
|
[]
|
|
147
123
|
)
|
|
148
124
|
|
|
149
|
-
const applyDataAttribute = useCallback(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
[]
|
|
159
|
-
)
|
|
125
|
+
const applyDataAttribute = useCallback((attr: string, name: string | undefined) => {
|
|
126
|
+
const d = document.documentElement
|
|
127
|
+
if (name) {
|
|
128
|
+
d.setAttribute(attr, name)
|
|
129
|
+
} else {
|
|
130
|
+
d.removeAttribute(attr)
|
|
131
|
+
}
|
|
132
|
+
}, [])
|
|
160
133
|
|
|
161
134
|
const applyAttributesToDOM = useCallback(
|
|
162
135
|
(resolved: string) => {
|
|
163
|
-
const attributeList = Array.isArray(attribute)
|
|
164
|
-
|
|
165
|
-
: [attribute]
|
|
166
|
-
const attrValues = value
|
|
167
|
-
? Object.values(value)
|
|
168
|
-
: themes
|
|
136
|
+
const attributeList = Array.isArray(attribute) ? attribute : [attribute]
|
|
137
|
+
const attrValues = value ? Object.values(value) : themes
|
|
169
138
|
const name = value ? value[resolved] : resolved
|
|
170
139
|
|
|
171
140
|
for (const attr of attributeList) {
|
|
@@ -176,13 +145,7 @@ const Theme = ({
|
|
|
176
145
|
}
|
|
177
146
|
}
|
|
178
147
|
},
|
|
179
|
-
[
|
|
180
|
-
attribute,
|
|
181
|
-
themes,
|
|
182
|
-
value,
|
|
183
|
-
applyClassAttribute,
|
|
184
|
-
applyDataAttribute,
|
|
185
|
-
]
|
|
148
|
+
[attribute, themes, value, applyClassAttribute, applyDataAttribute]
|
|
186
149
|
)
|
|
187
150
|
|
|
188
151
|
const applyColorScheme = useCallback(
|
|
@@ -190,18 +153,9 @@ const Theme = ({
|
|
|
190
153
|
if (!enableColorScheme) {
|
|
191
154
|
return
|
|
192
155
|
}
|
|
193
|
-
const fallback = colorSchemes.includes(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
? defaultTheme
|
|
197
|
-
: null
|
|
198
|
-
const colorScheme = colorSchemes.includes(
|
|
199
|
-
resolved
|
|
200
|
-
)
|
|
201
|
-
? resolved
|
|
202
|
-
: fallback
|
|
203
|
-
document.documentElement.style.colorScheme =
|
|
204
|
-
colorScheme || ""
|
|
156
|
+
const fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : null
|
|
157
|
+
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback
|
|
158
|
+
document.documentElement.style.colorScheme = colorScheme || ""
|
|
205
159
|
},
|
|
206
160
|
[enableColorScheme, defaultTheme]
|
|
207
161
|
)
|
|
@@ -212,32 +166,19 @@ const Theme = ({
|
|
|
212
166
|
if (!nextTheme) {
|
|
213
167
|
return
|
|
214
168
|
}
|
|
215
|
-
const resolved =
|
|
216
|
-
|
|
217
|
-
? getSystemTheme()
|
|
218
|
-
: nextTheme
|
|
219
|
-
const enable = disableTransitionOnChange
|
|
220
|
-
? disableAnimation()
|
|
221
|
-
: null
|
|
169
|
+
const resolved = nextTheme === "system" && enableSystem ? getSystemTheme() : nextTheme
|
|
170
|
+
const enable = disableTransitionOnChange ? disableAnimation() : null
|
|
222
171
|
applyAttributesToDOM(resolved)
|
|
223
172
|
applyColorScheme(resolved)
|
|
224
173
|
enable?.()
|
|
225
174
|
},
|
|
226
|
-
[
|
|
227
|
-
enableSystem,
|
|
228
|
-
disableTransitionOnChange,
|
|
229
|
-
applyAttributesToDOM,
|
|
230
|
-
applyColorScheme,
|
|
231
|
-
]
|
|
175
|
+
[enableSystem, disableTransitionOnChange, applyAttributesToDOM, applyColorScheme]
|
|
232
176
|
)
|
|
233
177
|
|
|
234
178
|
// Set theme state and save to local storage
|
|
235
179
|
const setTheme = useCallback(
|
|
236
180
|
(newValue: SetStateAction<string>) => {
|
|
237
|
-
const newTheme =
|
|
238
|
-
typeof newValue === "function"
|
|
239
|
-
? newValue(theme ?? "")
|
|
240
|
-
: newValue
|
|
181
|
+
const newTheme = typeof newValue === "function" ? newValue(theme ?? "") : newValue
|
|
241
182
|
setThemeState(newTheme)
|
|
242
183
|
|
|
243
184
|
// Save to storage
|
|
@@ -245,9 +186,7 @@ const Theme = ({
|
|
|
245
186
|
localStorage.setItem(storageKey, newTheme)
|
|
246
187
|
} catch {
|
|
247
188
|
// localStorage might not be available
|
|
248
|
-
console.error(
|
|
249
|
-
"Failed to save theme to localStorage"
|
|
250
|
-
)
|
|
189
|
+
console.error("Failed to save theme to localStorage")
|
|
251
190
|
}
|
|
252
191
|
},
|
|
253
192
|
[theme, storageKey]
|
|
@@ -255,11 +194,7 @@ const Theme = ({
|
|
|
255
194
|
|
|
256
195
|
const handleMediaQuery = useCallback(
|
|
257
196
|
(_event: MediaQueryListEvent | MediaQueryList) => {
|
|
258
|
-
if (
|
|
259
|
-
theme === "system" &&
|
|
260
|
-
enableSystem &&
|
|
261
|
-
!forcedTheme
|
|
262
|
-
) {
|
|
197
|
+
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
263
198
|
applyTheme("system")
|
|
264
199
|
}
|
|
265
200
|
},
|
|
@@ -276,11 +211,7 @@ const Theme = ({
|
|
|
276
211
|
// Intentionally use deprecated listener methods to support iOS 13 and older browsers
|
|
277
212
|
media.addEventListener("change", handleMediaQuery)
|
|
278
213
|
handleMediaQuery(media)
|
|
279
|
-
return () =>
|
|
280
|
-
media.removeEventListener(
|
|
281
|
-
"change",
|
|
282
|
-
handleMediaQuery
|
|
283
|
-
)
|
|
214
|
+
return () => media.removeEventListener("change", handleMediaQuery)
|
|
284
215
|
}, [handleMediaQuery])
|
|
285
216
|
|
|
286
217
|
// localStorage event handling, allow to sync theme changes between tabs
|
|
@@ -299,11 +230,7 @@ const Theme = ({
|
|
|
299
230
|
}
|
|
300
231
|
|
|
301
232
|
window.addEventListener("storage", handleStorage)
|
|
302
|
-
return () =>
|
|
303
|
-
window.removeEventListener(
|
|
304
|
-
"storage",
|
|
305
|
-
handleStorage
|
|
306
|
-
)
|
|
233
|
+
return () => window.removeEventListener("storage", handleStorage)
|
|
307
234
|
}, [defaultTheme, setTheme, storageKey])
|
|
308
235
|
|
|
309
236
|
// Whenever theme or forcedTheme changes, apply it
|
|
@@ -316,14 +243,9 @@ const Theme = ({
|
|
|
316
243
|
theme,
|
|
317
244
|
setTheme,
|
|
318
245
|
forcedTheme,
|
|
319
|
-
themes: enableSystem
|
|
320
|
-
? [...themes, "system"]
|
|
321
|
-
: themes,
|
|
246
|
+
themes: enableSystem ? [...themes, "system"] : themes,
|
|
322
247
|
systemTheme: enableSystem
|
|
323
|
-
? (getSystemTheme() as
|
|
324
|
-
| "dark"
|
|
325
|
-
| "light"
|
|
326
|
-
| undefined)
|
|
248
|
+
? (getSystemTheme() as "dark" | "light" | undefined)
|
|
327
249
|
: undefined,
|
|
328
250
|
}),
|
|
329
251
|
[theme, forcedTheme, enableSystem, themes, setTheme]
|
|
@@ -422,9 +344,7 @@ const disableAnimation = () => {
|
|
|
422
344
|
}
|
|
423
345
|
}
|
|
424
346
|
|
|
425
|
-
const getSystemTheme = (
|
|
426
|
-
e?: MediaQueryList | MediaQueryListEvent
|
|
427
|
-
) => {
|
|
347
|
+
const getSystemTheme = (e?: MediaQueryList | MediaQueryListEvent) => {
|
|
428
348
|
if (isServer) {
|
|
429
349
|
return "light"
|
|
430
350
|
}
|
|
@@ -451,9 +371,7 @@ export const script = (
|
|
|
451
371
|
) => {
|
|
452
372
|
const el = document.documentElement
|
|
453
373
|
const systemThemes = ["light", "dark"]
|
|
454
|
-
const attributes = Array.isArray(attribute)
|
|
455
|
-
? attribute
|
|
456
|
-
: [attribute]
|
|
374
|
+
const attributes = Array.isArray(attribute) ? attribute : [attribute]
|
|
457
375
|
const attrValues = value ? Object.values(value) : themes
|
|
458
376
|
|
|
459
377
|
function applyClassAttr(name: string | undefined) {
|
|
@@ -463,10 +381,7 @@ export const script = (
|
|
|
463
381
|
}
|
|
464
382
|
}
|
|
465
383
|
|
|
466
|
-
function applyDataAttr(
|
|
467
|
-
attr: string,
|
|
468
|
-
name: string | undefined
|
|
469
|
-
) {
|
|
384
|
+
function applyDataAttr(attr: string, name: string | undefined) {
|
|
470
385
|
if (name) {
|
|
471
386
|
el.setAttribute(attr, name)
|
|
472
387
|
} else {
|
|
@@ -493,39 +408,24 @@ export const script = (
|
|
|
493
408
|
return
|
|
494
409
|
}
|
|
495
410
|
|
|
496
|
-
const fallback = systemThemes.includes(defaultTheme)
|
|
497
|
-
|
|
498
|
-
: null
|
|
499
|
-
const colorScheme = systemThemes.includes(theme)
|
|
500
|
-
? theme
|
|
501
|
-
: fallback
|
|
411
|
+
const fallback = systemThemes.includes(defaultTheme) ? defaultTheme : null
|
|
412
|
+
const colorScheme = systemThemes.includes(theme) ? theme : fallback
|
|
502
413
|
el.style.colorScheme = colorScheme || ""
|
|
503
414
|
}
|
|
504
415
|
|
|
505
416
|
function resolveSystemTheme() {
|
|
506
|
-
return window.matchMedia(
|
|
507
|
-
"(prefers-color-scheme: dark)"
|
|
508
|
-
).matches
|
|
509
|
-
? "dark"
|
|
510
|
-
: "light"
|
|
417
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
|
|
511
418
|
}
|
|
512
419
|
|
|
513
420
|
if (forcedTheme) {
|
|
514
421
|
const resolvedForcedTheme =
|
|
515
|
-
forcedTheme === "system" && enableSystem
|
|
516
|
-
? resolveSystemTheme()
|
|
517
|
-
: forcedTheme
|
|
422
|
+
forcedTheme === "system" && enableSystem ? resolveSystemTheme() : forcedTheme
|
|
518
423
|
updateDOM(resolvedForcedTheme)
|
|
519
424
|
} else {
|
|
520
425
|
try {
|
|
521
|
-
const themeName =
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const isSystem =
|
|
525
|
-
enableSystem && themeName === "system"
|
|
526
|
-
const theme = isSystem
|
|
527
|
-
? resolveSystemTheme()
|
|
528
|
-
: themeName
|
|
426
|
+
const themeName = localStorage.getItem(storageKey) || defaultTheme
|
|
427
|
+
const isSystem = enableSystem && themeName === "system"
|
|
428
|
+
const theme = isSystem ? resolveSystemTheme() : themeName
|
|
529
429
|
updateDOM(theme)
|
|
530
430
|
} catch {
|
|
531
431
|
// localStorage might not be available
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import { DisclosureGroup } from "../disclosure-group/disclosure-group"
|
|
3
|
+
import { cn } from "../../lib/class-names"
|
|
4
|
+
|
|
5
|
+
export interface AccordionItem {
|
|
6
|
+
/** Stable value used to identify the expanded item. */
|
|
7
|
+
value: string
|
|
8
|
+
title: string
|
|
9
|
+
content: ReactNode
|
|
10
|
+
description?: string
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AccordionProps {
|
|
15
|
+
items: readonly AccordionItem[]
|
|
16
|
+
/** The expanded item, or `null` when all items are closed. */
|
|
17
|
+
value: string | null
|
|
18
|
+
/** Selecting the open item reports `null`, so every item can collapse. */
|
|
19
|
+
onValueChange: (value: string | null) => void
|
|
20
|
+
className?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A single-open, collapsible accordion with labelled animated content regions. */
|
|
24
|
+
export function Accordion({ items, value, onValueChange, className }: AccordionProps) {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className={cn(
|
|
28
|
+
"flex w-full min-w-0 flex-col overflow-hidden rounded-2xl border border-separator/60 bg-elevated",
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
{items.map((item, index) => (
|
|
33
|
+
<DisclosureGroup
|
|
34
|
+
key={item.value}
|
|
35
|
+
label={item.title}
|
|
36
|
+
description={item.description}
|
|
37
|
+
open={value === item.value}
|
|
38
|
+
disabled={item.disabled}
|
|
39
|
+
triggerClassName="rounded-none"
|
|
40
|
+
onOpenChange={(open) => onValueChange(open ? item.value : null)}
|
|
41
|
+
className={cn(index > 0 && "border-t border-separator/60")}
|
|
42
|
+
>
|
|
43
|
+
{item.content}
|
|
44
|
+
</DisclosureGroup>
|
|
45
|
+
))}
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -11,17 +11,9 @@ type AmbientProps = ComponentPropsWithoutRef<"section"> & {
|
|
|
11
11
|
* edge: a blown-up, blurred copy of the image masked into a circle that
|
|
12
12
|
* fades into the page, the way Apple lets a photo light its surroundings.
|
|
13
13
|
*/
|
|
14
|
-
export function Ambient({
|
|
15
|
-
src,
|
|
16
|
-
className,
|
|
17
|
-
children,
|
|
18
|
-
...props
|
|
19
|
-
}: AmbientProps) {
|
|
14
|
+
export function Ambient({ src, className, children, ...props }: AmbientProps) {
|
|
20
15
|
return (
|
|
21
|
-
<section
|
|
22
|
-
className={cn("relative isolate", className)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
16
|
+
<section className={cn("relative isolate", className)} {...props}>
|
|
25
17
|
{src && (
|
|
26
18
|
<img
|
|
27
19
|
aria-hidden
|
|
@@ -0,0 +1,22 @@
|
|
|
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({ ratio = 4 / 3, className, style, ...props }: AspectRatioProps) {
|
|
11
|
+
const aspect = Number.isFinite(ratio) && ratio > 0 ? ratio : 4 / 3
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
{...props}
|
|
15
|
+
className={cn(
|
|
16
|
+
"relative w-full overflow-hidden [&>img]:size-full [&>img]:object-cover [&>video]:size-full [&>video]:object-cover",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
style={{ aspectRatio: aspect, ...style }}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import { cn } from "../../lib/class-names"
|
|
3
|
+
|
|
4
|
+
export interface BreadcrumbItem {
|
|
5
|
+
label: string
|
|
6
|
+
href?: string
|
|
7
|
+
}
|
|
8
|
+
export interface BreadcrumbProps {
|
|
9
|
+
label: string
|
|
10
|
+
items: readonly BreadcrumbItem[]
|
|
11
|
+
className?: string
|
|
12
|
+
/** Integrate a client router without nesting interactive elements. */
|
|
13
|
+
renderLink?: (item: BreadcrumbItem & { href: string }) => ReactNode
|
|
14
|
+
}
|
|
15
|
+
/** Ancestors stay links; the final item identifies the current page. */
|
|
16
|
+
export function Breadcrumb({ label, items, className, renderLink }: BreadcrumbProps) {
|
|
17
|
+
return (
|
|
18
|
+
<nav aria-label={label} className={cn("not-typeset", className)}>
|
|
19
|
+
<ol className="m-0 flex list-none flex-wrap items-center gap-x-2 gap-y-1 p-0 text-footnote text-label-secondary">
|
|
20
|
+
{items.map((item, index) => (
|
|
21
|
+
<li
|
|
22
|
+
key={`${index}-${item.label}`}
|
|
23
|
+
className="m-0 flex min-w-0 items-center gap-2 p-0"
|
|
24
|
+
>
|
|
25
|
+
{index > 0 && (
|
|
26
|
+
<span aria-hidden="true" className="text-label-tertiary">
|
|
27
|
+
/
|
|
28
|
+
</span>
|
|
29
|
+
)}
|
|
30
|
+
{index === items.length - 1 ? (
|
|
31
|
+
<span aria-current="page" className="font-medium text-label">
|
|
32
|
+
{item.label}
|
|
33
|
+
</span>
|
|
34
|
+
) : item.href ? (
|
|
35
|
+
(renderLink?.({ ...item, href: item.href }) ?? (
|
|
36
|
+
<a
|
|
37
|
+
href={item.href}
|
|
38
|
+
className={cn(
|
|
39
|
+
"rounded-sm hover:text-label focus-visible:outline-2 focus-visible:outline-accent-text"
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
{item.label}
|
|
43
|
+
</a>
|
|
44
|
+
))
|
|
45
|
+
) : (
|
|
46
|
+
<span>{item.label}</span>
|
|
47
|
+
)}
|
|
48
|
+
</li>
|
|
49
|
+
))}
|
|
50
|
+
</ol>
|
|
51
|
+
</nav>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -7,30 +7,24 @@ export type ButtonVariant =
|
|
|
7
7
|
| "link"
|
|
8
8
|
| "accent"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| "icon-full"
|
|
10
|
+
/** Icon-only buttons use the same sizing contract as Button. */
|
|
11
|
+
export const iconButtonSizes = {
|
|
12
|
+
icon: "size-11 p-0 rounded-full",
|
|
13
|
+
"icon-xs": "size-8 p-0 rounded-full",
|
|
14
|
+
"icon-sm": "size-9 p-0 rounded-full",
|
|
15
|
+
"icon-lg": "size-12 p-0 rounded-full",
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export type IconButtonSize = keyof typeof iconButtonSizes
|
|
20
19
|
|
|
21
|
-
export type
|
|
22
|
-
| "icon"
|
|
23
|
-
| "icon-xs"
|
|
24
|
-
| "icon-sm"
|
|
25
|
-
| "icon-lg"
|
|
20
|
+
export type ButtonSize = "default" | "xs" | "sm" | "lg" | "icon-full" | IconButtonSize
|
|
26
21
|
|
|
27
22
|
export const buttonVariants: Record<ButtonVariant, string> = {
|
|
28
23
|
default:
|
|
29
24
|
"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]",
|
|
30
25
|
destructive:
|
|
31
26
|
"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]",
|
|
32
|
-
outline:
|
|
33
|
-
"border border-separator bg-transparent text-label hover:bg-fill/60",
|
|
27
|
+
outline: "border border-separator bg-transparent text-label hover:bg-fill/60",
|
|
34
28
|
secondary:
|
|
35
29
|
"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",
|
|
36
30
|
ghost: "bg-transparent text-label hover:bg-fill/80",
|
|
@@ -43,18 +37,6 @@ export const buttonSizes: Record<ButtonSize, string> = {
|
|
|
43
37
|
xs: "h-8 px-3 text-caption rounded-full",
|
|
44
38
|
sm: "h-9 px-4 text-subheadline rounded-full",
|
|
45
39
|
lg: "h-12 px-6 text-body rounded-full",
|
|
46
|
-
|
|
47
|
-
"icon-
|
|
48
|
-
"icon-sm": "size-9 p-0 rounded-full",
|
|
49
|
-
"icon-lg": "size-12 p-0 rounded-full",
|
|
50
|
-
"icon-full":
|
|
51
|
-
"h-11 w-full px-5 text-subheadline rounded-full",
|
|
40
|
+
...iconButtonSizes,
|
|
41
|
+
"icon-full": "h-11 w-full px-5 text-subheadline rounded-full",
|
|
52
42
|
}
|
|
53
|
-
|
|
54
|
-
export const iconButtonSizes: Record<IconButtonSize, string> =
|
|
55
|
-
{
|
|
56
|
-
icon: "size-11",
|
|
57
|
-
"icon-xs": "size-8",
|
|
58
|
-
"icon-sm": "size-9",
|
|
59
|
-
"icon-lg": "size-12",
|
|
60
|
-
}
|