@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
|
@@ -22,15 +22,12 @@ type SearchState = {
|
|
|
22
22
|
const SearchContext = createContext<SearchState | null>(null)
|
|
23
23
|
function useSearch() {
|
|
24
24
|
const search = useContext(SearchContext)
|
|
25
|
-
if (!search)
|
|
26
|
-
throw new Error(
|
|
27
|
-
"Search list controls need a SearchList parent"
|
|
28
|
-
)
|
|
25
|
+
if (!search) throw new Error("Search list controls need a SearchList parent")
|
|
29
26
|
return search
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
export function SearchList({
|
|
33
|
-
loop
|
|
30
|
+
loop = true,
|
|
34
31
|
open = true,
|
|
35
32
|
onKeyDown,
|
|
36
33
|
className,
|
|
@@ -40,10 +37,12 @@ export function SearchList({
|
|
|
40
37
|
open?: boolean
|
|
41
38
|
}) {
|
|
42
39
|
const [query, setQuery] = useState("")
|
|
40
|
+
const updateQuery = useCallback((next: string) => {
|
|
41
|
+
setQuery(next)
|
|
42
|
+
setActive("")
|
|
43
|
+
}, [])
|
|
43
44
|
const [active, setActive] = useState("")
|
|
44
|
-
const [results, setResults] = useState<
|
|
45
|
-
Record<string, boolean>
|
|
46
|
-
>({})
|
|
45
|
+
const [results, setResults] = useState<Record<string, boolean>>({})
|
|
47
46
|
const listId = useId()
|
|
48
47
|
const ref = useRef<HTMLDivElement>(null)
|
|
49
48
|
const register = useCallback(
|
|
@@ -59,20 +58,20 @@ export function SearchList({
|
|
|
59
58
|
}),
|
|
60
59
|
[]
|
|
61
60
|
)
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!open) return
|
|
63
|
+
const available = Object.keys(results).filter((id) => results[id])
|
|
64
|
+
if (!available.includes(active)) setActive(available[0] ?? "")
|
|
65
|
+
}, [open, results, active])
|
|
62
66
|
return (
|
|
63
67
|
<SearchContext
|
|
64
68
|
value={{
|
|
65
69
|
query,
|
|
66
|
-
setQuery:
|
|
67
|
-
setQuery(next)
|
|
68
|
-
setActive("")
|
|
69
|
-
},
|
|
70
|
+
setQuery: updateQuery,
|
|
70
71
|
active,
|
|
71
72
|
listId,
|
|
72
73
|
open,
|
|
73
|
-
visible:
|
|
74
|
-
Object.values(results).filter(Boolean)
|
|
75
|
-
.length,
|
|
74
|
+
visible: Object.values(results).filter(Boolean).length,
|
|
76
75
|
register,
|
|
77
76
|
}}
|
|
78
77
|
>
|
|
@@ -82,39 +81,35 @@ export function SearchList({
|
|
|
82
81
|
className={cn("relative", className)}
|
|
83
82
|
onKeyDown={(event) => {
|
|
84
83
|
onKeyDown?.(event)
|
|
85
|
-
if (event.defaultPrevented || !open)
|
|
86
|
-
return
|
|
84
|
+
if (event.defaultPrevented || !open || event.nativeEvent.isComposing) return
|
|
87
85
|
const items = Array.from(
|
|
88
86
|
ref.current?.querySelectorAll<HTMLButtonElement>(
|
|
89
87
|
"[data-search-result]:not([hidden]):not(:disabled)"
|
|
90
88
|
) ?? []
|
|
91
89
|
)
|
|
92
|
-
if (!items.length) return
|
|
93
|
-
const index = items.findIndex(
|
|
94
|
-
(item) => item.id === active
|
|
95
|
-
)
|
|
90
|
+
if (!items.length || event.altKey || event.ctrlKey || event.metaKey) return
|
|
91
|
+
const index = items.findIndex((item) => item.id === active)
|
|
96
92
|
if (event.key === "Enter") {
|
|
93
|
+
if (
|
|
94
|
+
event.target instanceof HTMLElement &&
|
|
95
|
+
event.target.closest("button, a")
|
|
96
|
+
)
|
|
97
|
+
return
|
|
97
98
|
event.preventDefault()
|
|
98
99
|
;(items[index] ?? items[0])?.click()
|
|
99
100
|
return
|
|
100
101
|
}
|
|
101
|
-
if (
|
|
102
|
-
event.key !== "ArrowDown" &&
|
|
103
|
-
event.key !== "ArrowUp"
|
|
104
|
-
)
|
|
105
|
-
return
|
|
102
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return
|
|
106
103
|
event.preventDefault()
|
|
104
|
+
const delta = event.key === "ArrowDown" ? 1 : -1
|
|
107
105
|
const next =
|
|
108
106
|
index < 0
|
|
109
|
-
?
|
|
107
|
+
? delta === 1
|
|
110
108
|
? 0
|
|
111
109
|
: items.length - 1
|
|
112
|
-
:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
: -1) +
|
|
116
|
-
items.length) %
|
|
117
|
-
items.length
|
|
110
|
+
: loop
|
|
111
|
+
? (index + delta + items.length) % items.length
|
|
112
|
+
: Math.max(0, Math.min(items.length - 1, index + delta))
|
|
118
113
|
const item = items[next]
|
|
119
114
|
if (!item) return
|
|
120
115
|
setActive(item.id)
|
|
@@ -136,21 +131,18 @@ export function SearchListField({
|
|
|
136
131
|
onValueChange?: (value: string) => void
|
|
137
132
|
}) {
|
|
138
133
|
const search = useSearch()
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (value !== undefined) search.setQuery(value)
|
|
136
|
+
}, [value, search.setQuery])
|
|
139
137
|
return (
|
|
140
138
|
<input
|
|
141
139
|
{...props}
|
|
142
140
|
role="combobox"
|
|
143
141
|
aria-autocomplete="list"
|
|
144
142
|
aria-expanded={search.open}
|
|
145
|
-
aria-controls={search.listId}
|
|
146
|
-
aria-activedescendant={
|
|
147
|
-
|
|
148
|
-
? search.active
|
|
149
|
-
: undefined
|
|
150
|
-
}
|
|
151
|
-
aria-label={
|
|
152
|
-
props["aria-label"] ?? props.placeholder
|
|
153
|
-
}
|
|
143
|
+
aria-controls={search.open ? search.listId : undefined}
|
|
144
|
+
aria-activedescendant={search.open && search.active ? search.active : undefined}
|
|
145
|
+
aria-label={props["aria-label"] ?? props.placeholder}
|
|
154
146
|
value={value ?? search.query}
|
|
155
147
|
onChange={(event) => {
|
|
156
148
|
search.setQuery(event.target.value)
|
|
@@ -163,10 +155,7 @@ export function SearchListField({
|
|
|
163
155
|
/>
|
|
164
156
|
)
|
|
165
157
|
}
|
|
166
|
-
export function SearchListResults({
|
|
167
|
-
className,
|
|
168
|
-
...props
|
|
169
|
-
}: ComponentProps<"div">) {
|
|
158
|
+
export function SearchListResults({ className, ...props }: ComponentProps<"div">) {
|
|
170
159
|
const search = useSearch()
|
|
171
160
|
return (
|
|
172
161
|
<div
|
|
@@ -178,42 +167,34 @@ export function SearchListResults({
|
|
|
178
167
|
/>
|
|
179
168
|
)
|
|
180
169
|
}
|
|
181
|
-
export function SearchListEmpty(
|
|
182
|
-
props: ComponentProps<"div">
|
|
183
|
-
) {
|
|
170
|
+
export function SearchListEmpty(props: ComponentProps<"div">) {
|
|
184
171
|
const search = useSearch()
|
|
185
|
-
return search.visible ? null :
|
|
186
|
-
<div {...props} role="status" />
|
|
187
|
-
)
|
|
172
|
+
return search.visible ? null : <div {...props} role="status" />
|
|
188
173
|
}
|
|
189
174
|
export function SearchListGroup({
|
|
190
175
|
heading,
|
|
191
176
|
children,
|
|
192
177
|
className,
|
|
193
178
|
...props
|
|
194
|
-
}: ComponentProps<"
|
|
179
|
+
}: ComponentProps<"div"> & {
|
|
195
180
|
heading?: React.ReactNode
|
|
196
181
|
}) {
|
|
197
182
|
const id = useId()
|
|
198
183
|
return (
|
|
199
|
-
|
|
184
|
+
// biome-ignore lint/a11y/useSemanticElements: Listbox option groups are not form fieldsets.
|
|
185
|
+
<div
|
|
200
186
|
{...props}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
className
|
|
204
|
-
)}
|
|
187
|
+
role="group"
|
|
188
|
+
className={cn("not-has-[[data-search-result]:not([hidden])]:hidden", className)}
|
|
205
189
|
aria-labelledby={heading ? id : undefined}
|
|
206
190
|
>
|
|
207
191
|
{heading && (
|
|
208
|
-
<
|
|
209
|
-
id={id}
|
|
210
|
-
className="px-2 py-2 text-caption font-medium text-label-tertiary"
|
|
211
|
-
>
|
|
192
|
+
<div id={id} className="px-2 py-2 text-caption font-medium text-label-tertiary">
|
|
212
193
|
{heading}
|
|
213
|
-
</
|
|
194
|
+
</div>
|
|
214
195
|
)}
|
|
215
196
|
{children}
|
|
216
|
-
</
|
|
197
|
+
</div>
|
|
217
198
|
)
|
|
218
199
|
}
|
|
219
200
|
export function SearchListItem({
|
|
@@ -229,18 +210,16 @@ export function SearchListItem({
|
|
|
229
210
|
}) {
|
|
230
211
|
const search = useSearch()
|
|
231
212
|
const id = useId()
|
|
232
|
-
const haystack = [value, ...keywords]
|
|
233
|
-
.join(" ")
|
|
234
|
-
.toLocaleLowerCase()
|
|
213
|
+
const haystack = [value, ...keywords].join(" ").toLocaleLowerCase()
|
|
235
214
|
const visible = search.query
|
|
236
215
|
.toLocaleLowerCase()
|
|
237
216
|
.trim()
|
|
238
217
|
.split(/\s+/)
|
|
239
218
|
.every((word) => haystack.includes(word))
|
|
240
219
|
useEffect(() => {
|
|
241
|
-
search.register(id, visible)
|
|
220
|
+
search.register(id, visible && !props.disabled)
|
|
242
221
|
return () => search.register(id, null)
|
|
243
|
-
}, [id, visible, search.register])
|
|
222
|
+
}, [id, visible, props.disabled, search.register])
|
|
244
223
|
return (
|
|
245
224
|
<button
|
|
246
225
|
{...props}
|
|
@@ -251,15 +230,19 @@ export function SearchListItem({
|
|
|
251
230
|
hidden={!visible}
|
|
252
231
|
data-search-result=""
|
|
253
232
|
aria-selected={search.active === id}
|
|
254
|
-
data-selected={
|
|
255
|
-
search.active === id ? "true" : undefined
|
|
256
|
-
}
|
|
233
|
+
data-selected={search.active === id ? "true" : undefined}
|
|
257
234
|
className={cn(
|
|
258
|
-
"flex w-full items-center gap-2 rounded-
|
|
235
|
+
"flex min-h-9 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-subheadline text-label hover:bg-fill aria-selected:bg-fill [@media(pointer:coarse)]:min-h-11",
|
|
259
236
|
className
|
|
260
237
|
)}
|
|
261
|
-
onMouseDown={(event) =>
|
|
262
|
-
|
|
238
|
+
onMouseDown={(event) => {
|
|
239
|
+
props.onMouseDown?.(event)
|
|
240
|
+
if (!event.defaultPrevented) event.preventDefault()
|
|
241
|
+
}}
|
|
242
|
+
onClick={(event) => {
|
|
243
|
+
props.onClick?.(event)
|
|
244
|
+
if (!event.defaultPrevented) onSelect?.(value)
|
|
245
|
+
}}
|
|
263
246
|
/>
|
|
264
247
|
)
|
|
265
248
|
}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useId, type HTMLAttributes, type ReactNode } from "react"
|
|
2
|
+
import { cn } from "../../lib/class-names"
|
|
3
|
+
|
|
4
|
+
export interface SectionProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Optional group heading and accessible name. */
|
|
6
|
+
title?: string
|
|
7
|
+
/** Supporting text below the grouped rows. */
|
|
8
|
+
footer?: ReactNode
|
|
9
|
+
/** Rows, typically LabeledContent. */
|
|
10
|
+
children?: ReactNode
|
|
11
|
+
}
|
|
2
12
|
|
|
3
13
|
/**
|
|
4
14
|
* A titled, inset group of rows with an optional footer, as in iOS Settings
|
|
5
15
|
* and SwiftUI's grouped `List` with `Section(header:footer:)`. Rows are
|
|
6
16
|
* usually `LabeledContent`; dividers between them come for free.
|
|
7
17
|
*/
|
|
8
|
-
export function Section({
|
|
9
|
-
|
|
10
|
-
footer,
|
|
11
|
-
children,
|
|
12
|
-
}: {
|
|
13
|
-
/** iOS groups can stand without a header. */
|
|
14
|
-
title?: string
|
|
15
|
-
footer?: ReactNode
|
|
16
|
-
children?: ReactNode
|
|
17
|
-
}) {
|
|
18
|
+
export function Section({ title, footer, children, className, ...props }: SectionProps) {
|
|
19
|
+
const headingId = useId()
|
|
18
20
|
return (
|
|
19
21
|
<section
|
|
20
|
-
aria-
|
|
21
|
-
className="flex flex-col gap-2"
|
|
22
|
+
aria-labelledby={title ? headingId : undefined}
|
|
23
|
+
className={cn("flex flex-col gap-2", className)}
|
|
24
|
+
{...props}
|
|
22
25
|
>
|
|
23
26
|
{title && (
|
|
24
|
-
<h2 className="px-4 text-footnote font-medium text-label-tertiary">
|
|
27
|
+
<h2 id={headingId} className="px-4 text-footnote font-medium text-label-tertiary">
|
|
25
28
|
{title}
|
|
26
29
|
</h2>
|
|
27
30
|
)}
|
|
@@ -32,9 +35,7 @@ export function Section({
|
|
|
32
35
|
</div>
|
|
33
36
|
) : null}
|
|
34
37
|
{footer && (
|
|
35
|
-
<
|
|
36
|
-
{footer}
|
|
37
|
-
</p>
|
|
38
|
+
<div className="px-4 text-caption leading-snug text-label-tertiary">{footer}</div>
|
|
38
39
|
)}
|
|
39
40
|
</section>
|
|
40
41
|
)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TextField,
|
|
3
|
-
type TextFieldProps,
|
|
4
|
-
} from "../text-field/text-field"
|
|
1
|
+
import { TextField, type TextFieldProps } from "../text-field/text-field"
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/** TextField's native input props, with the password type managed by SecureField. */
|
|
4
|
+
export type SecureFieldProps = Omit<TextFieldProps, "type">
|
|
5
|
+
|
|
6
|
+
export function SecureField(props: SecureFieldProps) {
|
|
9
7
|
return <TextField {...props} type="password" />
|
|
10
8
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { motion } from "motion/react"
|
|
2
|
-
import {
|
|
3
|
-
useId,
|
|
4
|
-
useLayoutEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from "react"
|
|
1
|
+
import { motion, useReducedMotion } from "motion/react"
|
|
2
|
+
import { useId, useLayoutEffect, useRef, useState } from "react"
|
|
8
3
|
import { cn } from "../../lib/class-names"
|
|
9
4
|
import { haptic } from "../../lib/haptics"
|
|
10
5
|
import { spring } from "../../motion/transitions"
|
|
11
6
|
import { Picker } from "../picker/picker"
|
|
12
7
|
|
|
8
|
+
export interface SegmentedControlProps<T extends string> {
|
|
9
|
+
/** Value of the selected segment. */
|
|
10
|
+
value: T
|
|
11
|
+
/** The choices, in display order. */
|
|
12
|
+
options: ReadonlyArray<{ value: T; label: string }>
|
|
13
|
+
/** Called with the selected segment's value. */
|
|
14
|
+
onChange: (value: NoInfer<T>) => void
|
|
15
|
+
/** Accessible name for the group and its compact picker. */
|
|
16
|
+
label: string
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
/**
|
|
14
20
|
* Mutually exclusive choices with a sliding selection, as on Apple
|
|
15
21
|
* platforms. When the labels can't all fit the space it is given (a long
|
|
@@ -21,13 +27,9 @@ export function SegmentedControl<T extends string>({
|
|
|
21
27
|
options,
|
|
22
28
|
onChange,
|
|
23
29
|
label,
|
|
24
|
-
}: {
|
|
25
|
-
value: T
|
|
26
|
-
options: Array<{ value: T; label: string }>
|
|
27
|
-
onChange: (value: T) => void
|
|
28
|
-
label: string
|
|
29
|
-
}) {
|
|
30
|
+
}: SegmentedControlProps<T>) {
|
|
30
31
|
const id = useId()
|
|
32
|
+
const reducedMotion = useReducedMotion()
|
|
31
33
|
const frame = useRef<HTMLDivElement>(null)
|
|
32
34
|
const measure = useRef<HTMLDivElement>(null)
|
|
33
35
|
const [fits, setFits] = useState(true)
|
|
@@ -36,10 +38,7 @@ export function SegmentedControl<T extends string>({
|
|
|
36
38
|
const box = frame.current
|
|
37
39
|
const natural = measure.current
|
|
38
40
|
if (!box || !natural) return
|
|
39
|
-
const check = () =>
|
|
40
|
-
setFits(
|
|
41
|
-
natural.offsetWidth <= box.clientWidth + 0.5
|
|
42
|
-
)
|
|
41
|
+
const check = () => setFits(natural.offsetWidth <= box.clientWidth + 0.5)
|
|
43
42
|
check()
|
|
44
43
|
const observer = new ResizeObserver(check)
|
|
45
44
|
observer.observe(box)
|
|
@@ -56,22 +55,16 @@ export function SegmentedControl<T extends string>({
|
|
|
56
55
|
className="pointer-events-none invisible absolute top-0 flex w-max p-[3px] text-footnote font-semibold"
|
|
57
56
|
>
|
|
58
57
|
{options.map((option) => (
|
|
59
|
-
<span
|
|
60
|
-
key={option.value}
|
|
61
|
-
className="min-w-[64px] px-3 py-1 whitespace-nowrap"
|
|
62
|
-
>
|
|
58
|
+
<span key={option.value} className="min-w-[64px] px-3 py-1 whitespace-nowrap">
|
|
63
59
|
{option.label}
|
|
64
60
|
</span>
|
|
65
61
|
))}
|
|
66
62
|
</div>
|
|
67
63
|
{fits ? (
|
|
68
64
|
<fieldset className="flex w-full rounded-lg bg-fill p-[3px] shadow-[inset_0_1px_2px_rgb(40_30_0/0.06)]">
|
|
69
|
-
<legend className="sr-only">
|
|
70
|
-
{label}
|
|
71
|
-
</legend>
|
|
65
|
+
<legend className="sr-only">{label}</legend>
|
|
72
66
|
{options.map((option) => {
|
|
73
|
-
const selected =
|
|
74
|
-
option.value === value
|
|
67
|
+
const selected = option.value === value
|
|
75
68
|
return (
|
|
76
69
|
<label
|
|
77
70
|
key={option.value}
|
|
@@ -97,9 +90,7 @@ export function SegmentedControl<T extends string>({
|
|
|
97
90
|
<motion.span
|
|
98
91
|
layoutId={`segment-${id}`}
|
|
99
92
|
className="absolute inset-0 -z-10 rounded-md bg-elevated shadow-[0_0_0_0.5px_rgb(0_0_0/0.06),0_1px_2px_rgb(0_0_0/0.08),0_3px_8px_-2px_rgb(0_0_0/0.10)]"
|
|
100
|
-
transition={
|
|
101
|
-
spring.snappy
|
|
102
|
-
}
|
|
93
|
+
transition={reducedMotion ? { duration: 0 } : spring.snappy}
|
|
103
94
|
/>
|
|
104
95
|
)}
|
|
105
96
|
{option.label}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FLOATING_LAYER,
|
|
3
|
-
ownsFloatingLayer,
|
|
4
|
-
} from "../../lib/floating-layers"
|
|
1
|
+
import { FLOATING_LAYER, ownsFloatingLayer } from "../../lib/floating-layers"
|
|
5
2
|
|
|
6
3
|
const surfaces: HTMLElement[] = []
|
|
7
4
|
const isolated = new Map<HTMLElement, boolean>()
|
|
@@ -9,8 +6,7 @@ let overflow = ""
|
|
|
9
6
|
let overflowPriority = ""
|
|
10
7
|
|
|
11
8
|
function restoreBackground() {
|
|
12
|
-
for (const [element, inert] of isolated)
|
|
13
|
-
element.inert = inert
|
|
9
|
+
for (const [element, inert] of isolated) element.inert = inert
|
|
14
10
|
isolated.clear()
|
|
15
11
|
}
|
|
16
12
|
|
|
@@ -19,11 +15,8 @@ function isolateBackground() {
|
|
|
19
15
|
const surface = surfaces.at(-1)
|
|
20
16
|
if (!surface) return
|
|
21
17
|
const roots = [surface.parentElement ?? surface]
|
|
22
|
-
for (const layer of document.querySelectorAll<HTMLElement>(
|
|
23
|
-
|
|
24
|
-
)) {
|
|
25
|
-
if (ownsFloatingLayer(surface, layer))
|
|
26
|
-
roots.push(layer)
|
|
18
|
+
for (const layer of document.querySelectorAll<HTMLElement>(`[${FLOATING_LAYER}]`)) {
|
|
19
|
+
if (ownsFloatingLayer(surface, layer)) roots.push(layer)
|
|
27
20
|
}
|
|
28
21
|
const visit = (parent: HTMLElement) => {
|
|
29
22
|
for (const child of parent.children) {
|
|
@@ -31,9 +24,7 @@ function isolateBackground() {
|
|
|
31
24
|
if (roots.includes(child)) continue
|
|
32
25
|
if (roots.some((root) => child.contains(root))) {
|
|
33
26
|
visit(child)
|
|
34
|
-
} else if (
|
|
35
|
-
!child.matches("script, style, link")
|
|
36
|
-
) {
|
|
27
|
+
} else if (!child.matches("script, style, link")) {
|
|
37
28
|
isolated.set(child, child.inert)
|
|
38
29
|
child.inert = true
|
|
39
30
|
}
|
|
@@ -43,43 +34,26 @@ function isolateBackground() {
|
|
|
43
34
|
}
|
|
44
35
|
|
|
45
36
|
/** Keeps nested sheets and their portaled controls above an inactive background. */
|
|
46
|
-
export function enterModalEnvironment(
|
|
47
|
-
surface: HTMLElement
|
|
48
|
-
): () => void {
|
|
37
|
+
export function enterModalEnvironment(surface: HTMLElement): () => void {
|
|
49
38
|
if (!surfaces.length) {
|
|
50
|
-
overflow =
|
|
51
|
-
|
|
52
|
-
overflowPriority =
|
|
53
|
-
document.body.style.getPropertyPriority(
|
|
54
|
-
"overflow"
|
|
55
|
-
)
|
|
39
|
+
overflow = document.body.style.getPropertyValue("overflow")
|
|
40
|
+
overflowPriority = document.body.style.getPropertyPriority("overflow")
|
|
56
41
|
document.body.style.setProperty("overflow", "hidden")
|
|
57
42
|
}
|
|
58
43
|
surfaces.push(surface)
|
|
59
44
|
isolateBackground()
|
|
60
|
-
const preventBackgroundScroll = (
|
|
61
|
-
event: WheelEvent | TouchEvent
|
|
62
|
-
) => {
|
|
45
|
+
const preventBackgroundScroll = (event: WheelEvent | TouchEvent) => {
|
|
63
46
|
if (surfaces.at(-1) !== surface) return
|
|
64
47
|
const target = event.target
|
|
65
48
|
if (
|
|
66
49
|
target instanceof Element &&
|
|
67
|
-
(surface.contains(target) ||
|
|
68
|
-
ownsFloatingLayer(surface, target))
|
|
50
|
+
(surface.contains(target) || ownsFloatingLayer(surface, target))
|
|
69
51
|
)
|
|
70
52
|
return
|
|
71
53
|
event.preventDefault()
|
|
72
54
|
}
|
|
73
|
-
document.addEventListener(
|
|
74
|
-
|
|
75
|
-
preventBackgroundScroll,
|
|
76
|
-
{ passive: false }
|
|
77
|
-
)
|
|
78
|
-
document.addEventListener(
|
|
79
|
-
"touchmove",
|
|
80
|
-
preventBackgroundScroll,
|
|
81
|
-
{ passive: false }
|
|
82
|
-
)
|
|
55
|
+
document.addEventListener("wheel", preventBackgroundScroll, { passive: false })
|
|
56
|
+
document.addEventListener("touchmove", preventBackgroundScroll, { passive: false })
|
|
83
57
|
const observer = new MutationObserver(() => {
|
|
84
58
|
if (surfaces.at(-1) === surface) isolateBackground()
|
|
85
59
|
})
|
|
@@ -89,25 +63,13 @@ export function enterModalEnvironment(
|
|
|
89
63
|
})
|
|
90
64
|
return () => {
|
|
91
65
|
observer.disconnect()
|
|
92
|
-
document.removeEventListener(
|
|
93
|
-
|
|
94
|
-
preventBackgroundScroll
|
|
95
|
-
)
|
|
96
|
-
document.removeEventListener(
|
|
97
|
-
"touchmove",
|
|
98
|
-
preventBackgroundScroll
|
|
99
|
-
)
|
|
66
|
+
document.removeEventListener("wheel", preventBackgroundScroll)
|
|
67
|
+
document.removeEventListener("touchmove", preventBackgroundScroll)
|
|
100
68
|
surfaces.splice(surfaces.indexOf(surface), 1)
|
|
101
69
|
isolateBackground()
|
|
102
70
|
if (!surfaces.length) {
|
|
103
|
-
if (overflow)
|
|
104
|
-
|
|
105
|
-
"overflow",
|
|
106
|
-
overflow,
|
|
107
|
-
overflowPriority
|
|
108
|
-
)
|
|
109
|
-
else
|
|
110
|
-
document.body.style.removeProperty("overflow")
|
|
71
|
+
if (overflow) document.body.style.setProperty("overflow", overflow, overflowPriority)
|
|
72
|
+
else document.body.style.removeProperty("overflow")
|
|
111
73
|
}
|
|
112
74
|
}
|
|
113
75
|
}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ReactNode,
|
|
3
|
-
useLayoutEffect,
|
|
4
|
-
useRef,
|
|
5
|
-
useState,
|
|
6
|
-
} from "react"
|
|
1
|
+
import { type ReactNode, useLayoutEffect, useRef, useState } from "react"
|
|
7
2
|
import { createPortal } from "react-dom"
|
|
8
3
|
|
|
9
4
|
/** Escape transformed page layers while retaining the source's scoped appearance. */
|
|
10
|
-
export function SheetPortal({
|
|
11
|
-
children,
|
|
12
|
-
}: {
|
|
13
|
-
children: ReactNode
|
|
14
|
-
}) {
|
|
5
|
+
export function SheetPortal({ children }: { children: ReactNode }) {
|
|
15
6
|
const source = useRef<HTMLSpanElement>(null)
|
|
16
|
-
const [host, setHost] = useState<HTMLDivElement | null>(
|
|
17
|
-
null
|
|
18
|
-
)
|
|
7
|
+
const [host, setHost] = useState<HTMLDivElement | null>(null)
|
|
19
8
|
useLayoutEffect(() => {
|
|
20
9
|
const marker = source.current
|
|
21
10
|
if (!marker) return
|
|
@@ -23,20 +12,12 @@ export function SheetPortal({
|
|
|
23
12
|
const layer = document.createElement("div")
|
|
24
13
|
layer.dataset.passuiOverlay = ""
|
|
25
14
|
layer.style.display = "contents"
|
|
26
|
-
const attributes = [
|
|
27
|
-
"data-theme",
|
|
28
|
-
"data-accent",
|
|
29
|
-
"data-os",
|
|
30
|
-
"dir",
|
|
31
|
-
]
|
|
15
|
+
const attributes = ["data-theme", "data-accent", "data-os", "dir"]
|
|
32
16
|
let properties = new Set<string>()
|
|
33
17
|
const inherit = () => {
|
|
34
18
|
for (const name of attributes) {
|
|
35
|
-
const value = marker
|
|
36
|
-
|
|
37
|
-
?.getAttribute(name)
|
|
38
|
-
if (value === null || value === undefined)
|
|
39
|
-
layer.removeAttribute(name)
|
|
19
|
+
const value = marker.closest(`[${name}]`)?.getAttribute(name)
|
|
20
|
+
if (value === null || value === undefined) layer.removeAttribute(name)
|
|
40
21
|
else layer.setAttribute(name, value)
|
|
41
22
|
}
|
|
42
23
|
const computed = getComputedStyle(marker)
|
|
@@ -44,14 +25,9 @@ export function SheetPortal({
|
|
|
44
25
|
for (const name of computed) {
|
|
45
26
|
if (!name.startsWith("--")) continue
|
|
46
27
|
next.add(name)
|
|
47
|
-
layer.style.setProperty(
|
|
48
|
-
name,
|
|
49
|
-
computed.getPropertyValue(name)
|
|
50
|
-
)
|
|
28
|
+
layer.style.setProperty(name, computed.getPropertyValue(name))
|
|
51
29
|
}
|
|
52
|
-
for (const name of properties)
|
|
53
|
-
if (!next.has(name))
|
|
54
|
-
layer.style.removeProperty(name)
|
|
30
|
+
for (const name of properties) if (!next.has(name)) layer.style.removeProperty(name)
|
|
55
31
|
properties = next
|
|
56
32
|
layer.style.colorScheme = computed.colorScheme
|
|
57
33
|
layer.style.fontFamily = computed.fontFamily
|
|
@@ -61,18 +37,10 @@ export function SheetPortal({
|
|
|
61
37
|
document.body.appendChild(layer)
|
|
62
38
|
setHost(layer)
|
|
63
39
|
const observer = new MutationObserver(inherit)
|
|
64
|
-
for (
|
|
65
|
-
let ancestor = marker.parentElement;
|
|
66
|
-
ancestor;
|
|
67
|
-
ancestor = ancestor.parentElement
|
|
68
|
-
) {
|
|
40
|
+
for (let ancestor = marker.parentElement; ancestor; ancestor = ancestor.parentElement) {
|
|
69
41
|
observer.observe(ancestor, {
|
|
70
42
|
attributes: true,
|
|
71
|
-
attributeFilter: [
|
|
72
|
-
...attributes,
|
|
73
|
-
"style",
|
|
74
|
-
"class",
|
|
75
|
-
],
|
|
43
|
+
attributeFilter: [...attributes, "style", "class"],
|
|
76
44
|
})
|
|
77
45
|
}
|
|
78
46
|
return () => {
|