@passui/react 0.1.16 → 0.1.19
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 +102 -1
- 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/ambient/ambient.d.ts +12 -0
- package/dist/types/src/components/ambient/index.d.ts +1 -0
- package/dist/types/src/components/button/button-styles.d.ts +12 -0
- package/dist/types/src/components/button/button.d.ts +30 -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/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-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 +22 -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 +21 -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 +13 -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/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/picker/picker-trigger.d.ts +2 -0
- package/dist/types/src/components/picker/picker.d.ts +37 -0
- package/dist/types/src/components/popover/popover-fit.d.ts +21 -0
- package/dist/types/src/components/popover/popover.d.ts +14 -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/search-field/search-field.d.ts +2 -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 +18 -0
- package/dist/types/src/components/slider/slider.d.ts +14 -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/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 +18 -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/hooks/scroll/minimize-decision.d.ts +2 -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 +58 -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 +192 -40
- package/src/appearance/platform.tsx +10 -47
- package/src/appearance/theme.tsx +42 -142
- package/src/components/ambient/ambient.tsx +2 -10
- package/src/components/button/button-styles.ts +13 -31
- package/src/components/button/button.tsx +19 -14
- 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/compact-date-picker/calendar-month.ts +13 -57
- package/src/components/compact-date-picker/compact-date-picker.tsx +44 -123
- package/src/components/compact-time-picker/compact-time-picker.tsx +46 -130
- package/src/components/compact-time-picker/time-value.ts +4 -16
- 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 +125 -195
- package/src/components/context-menu/context-menu-store.ts +3 -11
- 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 +13 -54
- 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 +31 -76
- package/src/components/dialog/dialog-store.ts +1 -3
- package/src/components/dialog/dialog.tsx +23 -80
- package/src/components/disclosure-group/disclosure-group.tsx +70 -0
- package/src/components/divider/divider.tsx +31 -0
- package/src/components/inline-disclosure/inline-disclosure.tsx +49 -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/picker/picker-trigger.ts +10 -0
- package/src/components/picker/picker.tsx +72 -203
- package/src/components/popover/popover-fit.ts +69 -0
- package/src/components/popover/popover.tsx +94 -77
- package/src/components/profile-image/profile-image.tsx +6 -28
- package/src/components/progress-view/progress-view.tsx +65 -0
- package/src/components/search-field/search-field.tsx +27 -25
- package/src/components/search-list/search-list.tsx +43 -69
- 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 +27 -30
- package/src/components/slider/slider.tsx +76 -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/stepper.tsx +80 -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 +11 -40
- package/src/components/toast/toast-store.ts +9 -30
- package/src/components/toast/toaster.tsx +90 -104
- package/src/components/toggle/toggle.tsx +28 -24
- package/src/components/tooltip/tooltip-host.tsx +71 -69
- package/src/components/view-controller/view-controller.tsx +4 -21
- package/src/hooks/scroll/minimize-decision.ts +1 -5
- package/src/hooks/use-anchored-placement.ts +4 -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 +167 -121
- package/src/index.ts +9 -1
- package/src/lib/anchored-placement.ts +5 -15
- 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/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,46 +0,0 @@
|
|
|
1
|
-
import { toast } from "@passui/react"
|
|
2
|
-
import { Button } from "@passui/react/button"
|
|
3
|
-
import { Dialog } from "@passui/react/dialog"
|
|
4
|
-
import { TextField } from "@passui/react/text-field"
|
|
5
|
-
import { useState } from "react"
|
|
6
|
-
|
|
7
|
-
export function DialogForm() {
|
|
8
|
-
const [open, setOpen] = useState(false)
|
|
9
|
-
const [name, setName] = useState("Pass console")
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<Button
|
|
14
|
-
variant="secondary"
|
|
15
|
-
onClick={() => setOpen(true)}
|
|
16
|
-
>
|
|
17
|
-
Rename project
|
|
18
|
-
</Button>
|
|
19
|
-
<Dialog
|
|
20
|
-
open={open}
|
|
21
|
-
onOpenChange={setOpen}
|
|
22
|
-
title="Rename project"
|
|
23
|
-
onSubmit={(event) => {
|
|
24
|
-
event.preventDefault()
|
|
25
|
-
setOpen(false)
|
|
26
|
-
toast.success(`Renamed to ${name}`)
|
|
27
|
-
}}
|
|
28
|
-
footer={
|
|
29
|
-
<Dialog.Actions
|
|
30
|
-
submitLabel="Rename"
|
|
31
|
-
cancelLabel="Cancel"
|
|
32
|
-
disabled={!name.trim()}
|
|
33
|
-
/>
|
|
34
|
-
}
|
|
35
|
-
>
|
|
36
|
-
<TextField
|
|
37
|
-
label="Name"
|
|
38
|
-
value={name}
|
|
39
|
-
onChange={(event) =>
|
|
40
|
-
setName(event.target.value)
|
|
41
|
-
}
|
|
42
|
-
/>
|
|
43
|
-
</Dialog>
|
|
44
|
-
</>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Button } from "@passui/react/button"
|
|
2
|
-
import { Dialog } from "@passui/react/dialog"
|
|
3
|
-
import { TextField } from "@passui/react/text-field"
|
|
4
|
-
import { useState } from "react"
|
|
5
|
-
|
|
6
|
-
export function DialogInline() {
|
|
7
|
-
const [open, setOpen] = useState(false)
|
|
8
|
-
const [email, setEmail] = useState("")
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="flex w-full max-w-sm flex-col gap-2 rounded-4xl bg-elevated p-2 ring-1 ring-separator/60">
|
|
12
|
-
<Button
|
|
13
|
-
variant="ghost"
|
|
14
|
-
className="self-start"
|
|
15
|
-
onClick={() => setOpen(!open)}
|
|
16
|
-
>
|
|
17
|
-
{open ? "Cancel" : "Add a recovery email"}
|
|
18
|
-
</Button>
|
|
19
|
-
<Dialog
|
|
20
|
-
open={open}
|
|
21
|
-
onOpenChange={setOpen}
|
|
22
|
-
presentation="inline"
|
|
23
|
-
title="Recovery email"
|
|
24
|
-
description="We only use it if you lose access."
|
|
25
|
-
onSubmit={(event) => {
|
|
26
|
-
event.preventDefault()
|
|
27
|
-
setOpen(false)
|
|
28
|
-
}}
|
|
29
|
-
footer={
|
|
30
|
-
<Dialog.Actions
|
|
31
|
-
submitLabel="Add"
|
|
32
|
-
cancelLabel="Cancel"
|
|
33
|
-
disabled={!email}
|
|
34
|
-
/>
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<TextField
|
|
38
|
-
label="Email"
|
|
39
|
-
type="email"
|
|
40
|
-
value={email}
|
|
41
|
-
onChange={(event) =>
|
|
42
|
-
setEmail(event.target.value)
|
|
43
|
-
}
|
|
44
|
-
/>
|
|
45
|
-
</Dialog>
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { LabeledContent, Section, toast } from "@passui/react"
|
|
2
|
-
import { Button } from "@passui/react/button"
|
|
3
|
-
import { Dialog } from "@passui/react/dialog"
|
|
4
|
-
import { useState } from "react"
|
|
5
|
-
|
|
6
|
-
export function DialogShowcase() {
|
|
7
|
-
const [open, setOpen] = useState(false)
|
|
8
|
-
const [pending, setPending] = useState(false)
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="w-full max-w-sm">
|
|
12
|
-
<Section title="Devices">
|
|
13
|
-
<LabeledContent
|
|
14
|
-
label="iPad mini"
|
|
15
|
-
description="Last used 3 weeks ago"
|
|
16
|
-
>
|
|
17
|
-
<Button
|
|
18
|
-
variant="ghost"
|
|
19
|
-
size="sm"
|
|
20
|
-
className="text-danger"
|
|
21
|
-
onClick={() => setOpen(true)}
|
|
22
|
-
>
|
|
23
|
-
Sign out
|
|
24
|
-
</Button>
|
|
25
|
-
</LabeledContent>
|
|
26
|
-
</Section>
|
|
27
|
-
<Dialog
|
|
28
|
-
open={open}
|
|
29
|
-
onOpenChange={setOpen}
|
|
30
|
-
title="Sign out of iPad mini?"
|
|
31
|
-
description="It will need your password or a passkey to sign back in."
|
|
32
|
-
footer={
|
|
33
|
-
<Dialog.Actions
|
|
34
|
-
submitLabel="Sign out"
|
|
35
|
-
cancelLabel="Cancel"
|
|
36
|
-
tone="destructive"
|
|
37
|
-
pending={pending}
|
|
38
|
-
onConfirm={() => {
|
|
39
|
-
setPending(true)
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
setPending(false)
|
|
42
|
-
setOpen(false)
|
|
43
|
-
toast.success(
|
|
44
|
-
"Signed out of iPad mini"
|
|
45
|
-
)
|
|
46
|
-
}, 900)
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
}
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Button } from "@passui/react/button"
|
|
2
|
-
import { Dialog } from "@passui/react/dialog"
|
|
3
|
-
import { useState } from "react"
|
|
4
|
-
|
|
5
|
-
export function DialogUsage() {
|
|
6
|
-
const [open, setOpen] = useState(false)
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
<Button
|
|
11
|
-
variant="secondary"
|
|
12
|
-
onClick={() => setOpen(true)}
|
|
13
|
-
>
|
|
14
|
-
Sign out
|
|
15
|
-
</Button>
|
|
16
|
-
<Dialog
|
|
17
|
-
open={open}
|
|
18
|
-
onOpenChange={setOpen}
|
|
19
|
-
title="Sign out of Pass?"
|
|
20
|
-
description="You can sign back in at any time."
|
|
21
|
-
footer={
|
|
22
|
-
<Dialog.Actions
|
|
23
|
-
submitLabel="Sign out"
|
|
24
|
-
cancelLabel="Cancel"
|
|
25
|
-
onConfirm={() => setOpen(false)}
|
|
26
|
-
/>
|
|
27
|
-
}
|
|
28
|
-
/>
|
|
29
|
-
</>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { LabeledContent, Section } from "@passui/react"
|
|
2
|
-
import { Toggle } from "@passui/react/toggle"
|
|
3
|
-
import { useState } from "react"
|
|
4
|
-
|
|
5
|
-
export function LabeledContentDescriptions() {
|
|
6
|
-
const [alerts, setAlerts] = useState(true)
|
|
7
|
-
const [digest, setDigest] = useState(false)
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<div className="w-full max-w-sm">
|
|
11
|
-
<Section title="Email">
|
|
12
|
-
<LabeledContent
|
|
13
|
-
label="Sign-in alerts"
|
|
14
|
-
description="When a new device signs in to your account."
|
|
15
|
-
>
|
|
16
|
-
<Toggle
|
|
17
|
-
label="Sign-in alerts"
|
|
18
|
-
labelHidden
|
|
19
|
-
checked={alerts}
|
|
20
|
-
onChange={setAlerts}
|
|
21
|
-
/>
|
|
22
|
-
</LabeledContent>
|
|
23
|
-
<LabeledContent
|
|
24
|
-
label="Weekly digest"
|
|
25
|
-
description="A summary of activity every Monday."
|
|
26
|
-
>
|
|
27
|
-
<Toggle
|
|
28
|
-
label="Weekly digest"
|
|
29
|
-
labelHidden
|
|
30
|
-
checked={digest}
|
|
31
|
-
onChange={setDigest}
|
|
32
|
-
/>
|
|
33
|
-
</LabeledContent>
|
|
34
|
-
</Section>
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LabeledContent,
|
|
3
|
-
Section,
|
|
4
|
-
SegmentedControl,
|
|
5
|
-
} from "@passui/react"
|
|
6
|
-
import { TextField } from "@passui/react/text-field"
|
|
7
|
-
import { useState } from "react"
|
|
8
|
-
|
|
9
|
-
export function LabeledContentShowcase() {
|
|
10
|
-
const [density, setDensity] = useState("comfortable")
|
|
11
|
-
const [signature, setSignature] = useState(
|
|
12
|
-
"Sent from Passui"
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div className="w-full max-w-md">
|
|
17
|
-
<Section title="Mail">
|
|
18
|
-
<LabeledContent
|
|
19
|
-
label="Density"
|
|
20
|
-
description="How much fits on screen."
|
|
21
|
-
wide
|
|
22
|
-
>
|
|
23
|
-
<SegmentedControl
|
|
24
|
-
label="Density"
|
|
25
|
-
value={density}
|
|
26
|
-
onChange={setDensity}
|
|
27
|
-
options={[
|
|
28
|
-
{
|
|
29
|
-
value: "compact",
|
|
30
|
-
label: "Compact",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
value: "comfortable",
|
|
34
|
-
label: "Comfortable",
|
|
35
|
-
},
|
|
36
|
-
]}
|
|
37
|
-
/>
|
|
38
|
-
</LabeledContent>
|
|
39
|
-
<LabeledContent label="Signature" stacked>
|
|
40
|
-
<TextField
|
|
41
|
-
label="Signature"
|
|
42
|
-
value={signature}
|
|
43
|
-
onChange={(event) =>
|
|
44
|
-
setSignature(event.target.value)
|
|
45
|
-
}
|
|
46
|
-
/>
|
|
47
|
-
</LabeledContent>
|
|
48
|
-
<LabeledContent label="Account">
|
|
49
|
-
aiko@example.com
|
|
50
|
-
</LabeledContent>
|
|
51
|
-
</Section>
|
|
52
|
-
</div>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { LabeledContent } from "@passui/react"
|
|
2
|
-
import { Toggle } from "@passui/react/toggle"
|
|
3
|
-
import { useState } from "react"
|
|
4
|
-
|
|
5
|
-
export function LabeledContentUsage() {
|
|
6
|
-
const [previews, setPreviews] = useState(true)
|
|
7
|
-
return (
|
|
8
|
-
<div className="w-full max-w-sm rounded-3xl border border-separator/60 bg-elevated">
|
|
9
|
-
<LabeledContent
|
|
10
|
-
label="Show previews"
|
|
11
|
-
description="Shows the first lines of each note."
|
|
12
|
-
>
|
|
13
|
-
<Toggle
|
|
14
|
-
label="Show previews"
|
|
15
|
-
labelHidden
|
|
16
|
-
checked={previews}
|
|
17
|
-
onChange={setPreviews}
|
|
18
|
-
/>
|
|
19
|
-
</LabeledContent>
|
|
20
|
-
</div>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Chip, LabeledContent, Section } from "@passui/react"
|
|
2
|
-
|
|
3
|
-
export function LabeledContentValues() {
|
|
4
|
-
return (
|
|
5
|
-
<div className="w-full max-w-sm">
|
|
6
|
-
<Section
|
|
7
|
-
title="Account"
|
|
8
|
-
footer="Contact support to change your account ID."
|
|
9
|
-
>
|
|
10
|
-
<LabeledContent label="Account ID">
|
|
11
|
-
<span className="font-mono text-footnote text-label-secondary">
|
|
12
|
-
pass_7f3a9c
|
|
13
|
-
</span>
|
|
14
|
-
</LabeledContent>
|
|
15
|
-
<LabeledContent label="Plan">
|
|
16
|
-
<Chip tone="accent">Family</Chip>
|
|
17
|
-
</LabeledContent>
|
|
18
|
-
<LabeledContent label="Member since">
|
|
19
|
-
<span className="text-subheadline text-label-secondary">
|
|
20
|
-
March 2024
|
|
21
|
-
</span>
|
|
22
|
-
</LabeledContent>
|
|
23
|
-
</Section>
|
|
24
|
-
</div>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LabeledContent,
|
|
3
|
-
Section,
|
|
4
|
-
SegmentedControl,
|
|
5
|
-
} from "@passui/react"
|
|
6
|
-
import { TextField } from "@passui/react/text-field"
|
|
7
|
-
import { useState } from "react"
|
|
8
|
-
|
|
9
|
-
export function LabeledContentWide() {
|
|
10
|
-
const [theme, setTheme] = useState("system")
|
|
11
|
-
const [nickname, setNickname] = useState("Aiko")
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className="w-full max-w-md">
|
|
15
|
-
<Section title="Profile">
|
|
16
|
-
<LabeledContent label="Appearance" wide>
|
|
17
|
-
<SegmentedControl
|
|
18
|
-
label="Appearance"
|
|
19
|
-
value={theme}
|
|
20
|
-
onChange={setTheme}
|
|
21
|
-
options={[
|
|
22
|
-
{
|
|
23
|
-
value: "system",
|
|
24
|
-
label: "System",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
value: "light",
|
|
28
|
-
label: "Light",
|
|
29
|
-
},
|
|
30
|
-
{ value: "dark", label: "Dark" },
|
|
31
|
-
]}
|
|
32
|
-
/>
|
|
33
|
-
</LabeledContent>
|
|
34
|
-
<LabeledContent label="Nickname" stacked>
|
|
35
|
-
<TextField
|
|
36
|
-
label="Nickname"
|
|
37
|
-
value={nickname}
|
|
38
|
-
onChange={(event) =>
|
|
39
|
-
setNickname(event.target.value)
|
|
40
|
-
}
|
|
41
|
-
/>
|
|
42
|
-
</LabeledContent>
|
|
43
|
-
</Section>
|
|
44
|
-
</div>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { LabeledContentValues } from "./examples/labeled-content-values"
|
|
2
|
-
import { LabeledContentWide } from "./examples/labeled-content-wide"
|
|
3
|
-
import { LabeledContentDescriptions } from "./examples/labeled-content-descriptions"
|
|
4
|
-
import { defineDocs } from "../../docs/types"
|
|
5
|
-
import { Toggle } from "../toggle/toggle"
|
|
6
|
-
import { LabeledContentShowcase } from "./examples/labeled-content-showcase"
|
|
7
|
-
import { LabeledContentUsage } from "./examples/labeled-content-usage"
|
|
8
|
-
import { LabeledContent } from "./labeled-content"
|
|
9
|
-
|
|
10
|
-
type DemoProps = {
|
|
11
|
-
label: string
|
|
12
|
-
description?: string
|
|
13
|
-
stacked?: boolean
|
|
14
|
-
wide?: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const labeledContentDocs = defineDocs<DemoProps>()({
|
|
18
|
-
slug: "labeled-content",
|
|
19
|
-
name: "LabeledContent",
|
|
20
|
-
importPath: "@passui/react",
|
|
21
|
-
controls: {
|
|
22
|
-
label: {
|
|
23
|
-
kind: "text",
|
|
24
|
-
default: "Show previews",
|
|
25
|
-
required: true,
|
|
26
|
-
},
|
|
27
|
-
description: {
|
|
28
|
-
kind: "text",
|
|
29
|
-
default: "Shows the first lines of each note.",
|
|
30
|
-
},
|
|
31
|
-
stacked: { kind: "boolean", default: false },
|
|
32
|
-
wide: { kind: "boolean", default: false },
|
|
33
|
-
},
|
|
34
|
-
render: (values) => (
|
|
35
|
-
<div className="w-full max-w-sm rounded-3xl border border-separator/60 bg-elevated">
|
|
36
|
-
<LabeledContent {...values}>
|
|
37
|
-
<Toggle
|
|
38
|
-
label={values.label}
|
|
39
|
-
labelHidden
|
|
40
|
-
checked
|
|
41
|
-
onChange={() => {}}
|
|
42
|
-
/>
|
|
43
|
-
</LabeledContent>
|
|
44
|
-
</div>
|
|
45
|
-
),
|
|
46
|
-
childrenSnippet: () => ({
|
|
47
|
-
imports: [
|
|
48
|
-
'import { useState } from "react"',
|
|
49
|
-
'import { Toggle } from "@passui/react/toggle"',
|
|
50
|
-
],
|
|
51
|
-
setup: ["const [on, setOn] = useState(true)"],
|
|
52
|
-
children:
|
|
53
|
-
'<Toggle label="Show previews" labelHidden checked={on} onChange={setOn} />',
|
|
54
|
-
}),
|
|
55
|
-
usage: LabeledContentUsage,
|
|
56
|
-
showcase: LabeledContentShowcase,
|
|
57
|
-
examples: [
|
|
58
|
-
{
|
|
59
|
-
id: "descriptions",
|
|
60
|
-
component: LabeledContentDescriptions,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
id: "wide",
|
|
64
|
-
component: LabeledContentWide,
|
|
65
|
-
playground: { wide: true },
|
|
66
|
-
},
|
|
67
|
-
{ id: "values", component: LabeledContentValues },
|
|
68
|
-
],
|
|
69
|
-
})
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { LocaleSwitcher } from "@passui/react/locale-switcher"
|
|
2
|
-
import { useState } from "react"
|
|
3
|
-
|
|
4
|
-
export function LocaleSwitcherNativeNames() {
|
|
5
|
-
const [locale, setLocale] = useState("en")
|
|
6
|
-
|
|
7
|
-
// a transformed frame holds the fixed switcher on this page
|
|
8
|
-
return (
|
|
9
|
-
<div className="relative h-80 w-full max-w-sm transform-gpu overflow-hidden rounded-4xl bg-fill/40">
|
|
10
|
-
<p className="p-6 text-footnote text-label-secondary">
|
|
11
|
-
Current: {locale}
|
|
12
|
-
</p>
|
|
13
|
-
<LocaleSwitcher
|
|
14
|
-
label="Change language"
|
|
15
|
-
locales={[
|
|
16
|
-
"en",
|
|
17
|
-
"fr",
|
|
18
|
-
"de",
|
|
19
|
-
"es",
|
|
20
|
-
"pt",
|
|
21
|
-
"ja",
|
|
22
|
-
"zh",
|
|
23
|
-
]}
|
|
24
|
-
locale={locale}
|
|
25
|
-
onSelect={setLocale}
|
|
26
|
-
storageKey="docs-locale-switcher-native-names"
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LocaleSwitcher } from "@passui/react/locale-switcher"
|
|
2
|
-
import { useState } from "react"
|
|
3
|
-
|
|
4
|
-
const greetings: Record<
|
|
5
|
-
string,
|
|
6
|
-
{ title: string; body: string }
|
|
7
|
-
> = {
|
|
8
|
-
en: {
|
|
9
|
-
title: "Welcome back",
|
|
10
|
-
body: "Pick up where you left off.",
|
|
11
|
-
},
|
|
12
|
-
fr: {
|
|
13
|
-
title: "Bon retour",
|
|
14
|
-
body: "Reprenez là où vous vous êtes arrêté.",
|
|
15
|
-
},
|
|
16
|
-
ja: {
|
|
17
|
-
title: "おかえりなさい",
|
|
18
|
-
body: "前回の続きから始めましょう。",
|
|
19
|
-
},
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function LocaleSwitcherShowcase() {
|
|
23
|
-
const [locale, setLocale] = useState("en")
|
|
24
|
-
const text = greetings[locale]
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div
|
|
28
|
-
lang={locale}
|
|
29
|
-
className="relative flex h-72 w-full max-w-sm transform-gpu flex-col items-center justify-center gap-2 overflow-hidden rounded-sheet bg-background p-8 text-center shadow-sm ring-1 ring-separator/60"
|
|
30
|
-
>
|
|
31
|
-
<h2 className="text-title2 font-bold text-label">
|
|
32
|
-
{text.title}
|
|
33
|
-
</h2>
|
|
34
|
-
<p className="text-callout text-label-secondary">
|
|
35
|
-
{text.body}
|
|
36
|
-
</p>
|
|
37
|
-
<LocaleSwitcher
|
|
38
|
-
label="Change language"
|
|
39
|
-
locales={["en", "fr", "ja"]}
|
|
40
|
-
locale={locale}
|
|
41
|
-
onSelect={setLocale}
|
|
42
|
-
storageKey="docs-locale-switcher-showcase"
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { LocaleSwitcher } from "@passui/react/locale-switcher"
|
|
2
|
-
import { useState } from "react"
|
|
3
|
-
|
|
4
|
-
const copy = {
|
|
5
|
-
en: { title: "Sign in", button: "Continue" },
|
|
6
|
-
fr: { title: "Connexion", button: "Continuer" },
|
|
7
|
-
zh: { title: "登录", button: "继续" },
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type Locale = keyof typeof copy
|
|
11
|
-
|
|
12
|
-
export function LocaleSwitcherTranslatedPage() {
|
|
13
|
-
const [locale, setLocale] = useState<Locale>("fr")
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div
|
|
17
|
-
lang={locale}
|
|
18
|
-
className="relative flex h-64 w-full max-w-sm transform-gpu flex-col items-center justify-center gap-4 overflow-hidden rounded-4xl bg-elevated shadow-sm ring-1 ring-separator/60"
|
|
19
|
-
>
|
|
20
|
-
<h2 className="text-title2 font-bold text-label">
|
|
21
|
-
{copy[locale].title}
|
|
22
|
-
</h2>
|
|
23
|
-
<span className="rounded-full bg-inverse px-5 py-2 text-subheadline font-semibold text-on-inverse">
|
|
24
|
-
{copy[locale].button}
|
|
25
|
-
</span>
|
|
26
|
-
<LocaleSwitcher
|
|
27
|
-
label="Change language"
|
|
28
|
-
locales={["en", "fr", "zh"] as Locale[]}
|
|
29
|
-
locale={locale}
|
|
30
|
-
onSelect={setLocale}
|
|
31
|
-
storageKey="docs-locale-switcher-translated-page"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LocaleSwitcher } from "@passui/react/locale-switcher"
|
|
2
|
-
import { useState } from "react"
|
|
3
|
-
|
|
4
|
-
export function LocaleSwitcherUsage() {
|
|
5
|
-
const [locale, setLocale] = useState("en")
|
|
6
|
-
|
|
7
|
-
// In an app it floats over the whole screen; here a transformed
|
|
8
|
-
// frame holds it, since a fixed element sits inside such a frame.
|
|
9
|
-
return (
|
|
10
|
-
<div className="relative h-48 w-full max-w-sm transform-gpu overflow-hidden rounded-4xl bg-fill/40">
|
|
11
|
-
<LocaleSwitcher
|
|
12
|
-
label="Change language"
|
|
13
|
-
locales={["en", "fr", "zh"]}
|
|
14
|
-
locale={locale}
|
|
15
|
-
onSelect={setLocale}
|
|
16
|
-
storageKey="docs-locale-switcher-usage"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { LocaleSwitcherTranslatedPage } from "./examples/locale-switcher-translated-page"
|
|
2
|
-
import { LocaleSwitcherNativeNames } from "./examples/locale-switcher-native-names"
|
|
3
|
-
import { useState } from "react"
|
|
4
|
-
import { defineDocs } from "../../docs/types"
|
|
5
|
-
import { LocaleSwitcherShowcase } from "./examples/locale-switcher-showcase"
|
|
6
|
-
import { LocaleSwitcherUsage } from "./examples/locale-switcher-usage"
|
|
7
|
-
import { LocaleSwitcher } from "./locale-switcher"
|
|
8
|
-
|
|
9
|
-
// The locales list is an array, so the playground offers a few sets.
|
|
10
|
-
type DemoProps = {
|
|
11
|
-
label: string
|
|
12
|
-
locales: "en-fr-zh" | "en-ja" | "en-de-es-pt"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const sets = {
|
|
16
|
-
"en-fr-zh": ["en", "fr", "zh"],
|
|
17
|
-
"en-ja": ["en", "ja"],
|
|
18
|
-
"en-de-es-pt": ["en", "de", "es", "pt"],
|
|
19
|
-
} as const
|
|
20
|
-
|
|
21
|
-
function LocaleSwitcherDemo({ label, locales }: DemoProps) {
|
|
22
|
-
const [locale, setLocale] = useState<string>("en")
|
|
23
|
-
return (
|
|
24
|
-
<div className="flex flex-col items-center gap-2 text-center">
|
|
25
|
-
<p className="text-headline font-semibold text-label">
|
|
26
|
-
Current language: {locale}
|
|
27
|
-
</p>
|
|
28
|
-
<p className="text-footnote text-label-secondary">
|
|
29
|
-
The switcher floats in the bottom corner. Drag
|
|
30
|
-
it to another corner.
|
|
31
|
-
</p>
|
|
32
|
-
<LocaleSwitcher
|
|
33
|
-
key={locales}
|
|
34
|
-
label={label}
|
|
35
|
-
locales={sets[locales]}
|
|
36
|
-
locale={locale}
|
|
37
|
-
onSelect={setLocale}
|
|
38
|
-
storageKey="passui-docs-locale-switcher"
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const localeSwitcherDocs = defineDocs<DemoProps>()({
|
|
45
|
-
slug: "locale-switcher",
|
|
46
|
-
name: "LocaleSwitcher",
|
|
47
|
-
importPath: "@passui/react/locale-switcher",
|
|
48
|
-
controls: {
|
|
49
|
-
label: {
|
|
50
|
-
kind: "text",
|
|
51
|
-
default: "Change language",
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
locales: {
|
|
55
|
-
kind: "select",
|
|
56
|
-
options: {
|
|
57
|
-
"en-fr-zh": true,
|
|
58
|
-
"en-ja": true,
|
|
59
|
-
"en-de-es-pt": true,
|
|
60
|
-
},
|
|
61
|
-
default: "en-fr-zh",
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
render: (values) => <LocaleSwitcherDemo {...values} />,
|
|
65
|
-
childrenSnippet: ({ locales }) => ({
|
|
66
|
-
imports: ['import { useState } from "react"'],
|
|
67
|
-
setup: ['const [locale, setLocale] = useState("en")'],
|
|
68
|
-
omit: ["locales"],
|
|
69
|
-
extraProps: { storageKey: "locale-switcher" },
|
|
70
|
-
expressionProps: {
|
|
71
|
-
locales: JSON.stringify(sets[locales]),
|
|
72
|
-
locale: "locale",
|
|
73
|
-
onSelect: "setLocale",
|
|
74
|
-
},
|
|
75
|
-
children: "",
|
|
76
|
-
}),
|
|
77
|
-
usage: LocaleSwitcherUsage,
|
|
78
|
-
showcase: LocaleSwitcherShowcase,
|
|
79
|
-
examples: [
|
|
80
|
-
{
|
|
81
|
-
id: "native-names",
|
|
82
|
-
component: LocaleSwitcherNativeNames,
|
|
83
|
-
playground: { locales: "en-de-es-pt" },
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: "translated-page",
|
|
87
|
-
component: LocaleSwitcherTranslatedPage,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
previewHeight: 320,
|
|
91
|
-
})
|