@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
package/README.md
CHANGED
|
@@ -40,6 +40,105 @@ export function SaveButton() {
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
### Numeric controls and separators
|
|
44
|
+
|
|
45
|
+
`Slider`, `Stepper`, `ProgressView`, and `Divider` provide native foundations
|
|
46
|
+
for settings, quantity adjustments, task progress, and layout separation.
|
|
47
|
+
They have individual subpath exports and named TypeScript props.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { useState } from "react"
|
|
51
|
+
import { Slider } from "@passui/react/slider"
|
|
52
|
+
import { Stepper } from "@passui/react/stepper"
|
|
53
|
+
import { ProgressView } from "@passui/react/progress-view"
|
|
54
|
+
import { Divider } from "@passui/react/divider"
|
|
55
|
+
|
|
56
|
+
export function DownloadSettings() {
|
|
57
|
+
const [volume, setVolume] = useState(50)
|
|
58
|
+
const [copies, setCopies] = useState(1)
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<section className="flex flex-col gap-4">
|
|
62
|
+
<Slider label="Volume" value={volume} onChange={setVolume} />
|
|
63
|
+
<Stepper
|
|
64
|
+
label="Copies"
|
|
65
|
+
labels={{ decrement: "Fewer copies", increment: "More copies" }}
|
|
66
|
+
value={copies}
|
|
67
|
+
onChange={setCopies}
|
|
68
|
+
min={1}
|
|
69
|
+
max={10}
|
|
70
|
+
/>
|
|
71
|
+
<Divider />
|
|
72
|
+
<ProgressView label="Downloading" value={42} max={100} />
|
|
73
|
+
</section>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Both numeric controls are controlled: the parent owns their value. Stepper
|
|
79
|
+
supports fractional steps and disables actions at its bounds. Slider keeps
|
|
80
|
+
native pointer and keyboard input. ProgressView omits `value` for indeterminate
|
|
81
|
+
progress and honors reduced motion. Divider is decorative by default; pass
|
|
82
|
+
`decorative={false}` to expose a semantic separator.
|
|
83
|
+
|
|
84
|
+
### Menus and disclosure groups
|
|
85
|
+
|
|
86
|
+
`Menu` turns the existing `ContextMenuHost` into a declarative button. Mount
|
|
87
|
+
the host once at the app root, then supply menu items wherever an action
|
|
88
|
+
button belongs. Its placement and keyboard behavior are shared with context
|
|
89
|
+
menus. `DisclosureGroup` provides a controlled, accessible expansion row on
|
|
90
|
+
top of `InlineDisclosure`.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { useState } from "react"
|
|
94
|
+
import { Menu } from "@passui/react/menu"
|
|
95
|
+
import { DisclosureGroup } from "@passui/react/disclosure-group"
|
|
96
|
+
|
|
97
|
+
export function Preferences() {
|
|
98
|
+
const [advanced, setAdvanced] = useState(false)
|
|
99
|
+
return (
|
|
100
|
+
<section>
|
|
101
|
+
<Menu label="More options" items={[{ label: "Refresh", onSelect: () => {} }]}>
|
|
102
|
+
More
|
|
103
|
+
</Menu>
|
|
104
|
+
<DisclosureGroup label="Advanced" open={advanced} onOpenChange={setAdvanced}>
|
|
105
|
+
<p>Additional preferences</p>
|
|
106
|
+
</DisclosureGroup>
|
|
107
|
+
</section>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Icons and prop types
|
|
113
|
+
|
|
114
|
+
On this development branch, React icons have a dedicated entry point:
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { IconButton, type IconButtonProps } from "@passui/react/icon-button"
|
|
118
|
+
import { SettingsIcon } from "@passui/react/icons"
|
|
119
|
+
|
|
120
|
+
const settingsAction: IconButtonProps = {
|
|
121
|
+
label: "Settings",
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
size: "icon-sm",
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function SettingsButton() {
|
|
127
|
+
return <IconButton {...settingsAction}><SettingsIcon /></IconButton>
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Hover a prop for its choices and defaults. Named props types are exported
|
|
132
|
+
beside their controls. For a fixed set of picker values, keep your state
|
|
133
|
+
as that literal union (for example, `useState<"personal" | "team">("personal")`)
|
|
134
|
+
so selection callbacks retain the same choices. Existing root icon imports
|
|
135
|
+
continue to work. These additions have not been published yet.
|
|
136
|
+
|
|
137
|
+
Clipboard actions can use `copyText` from `@passui/react/clipboard`. It
|
|
138
|
+
returns `true` only after a successful write and `false` if unavailable or
|
|
139
|
+
denied. Call it from a user action and show success only when it returns
|
|
140
|
+
`true`; offer manual copying otherwise. It adds no sound or haptic feedback.
|
|
141
|
+
|
|
43
142
|
See [Installation](https://passui.pherus.org/docs/installation) for the
|
|
44
143
|
root setup, and [Skills](https://passui.pherus.org/docs/skills) to give AI
|
|
45
144
|
agents Passui's rules.
|
|
@@ -57,7 +156,9 @@ bun run test
|
|
|
57
156
|
bun run publish:check
|
|
58
157
|
```
|
|
59
158
|
|
|
60
|
-
The package exports
|
|
159
|
+
The package exports explicit declaration types for editors and TypeScript/TSX
|
|
160
|
+
source for bundlers. `bun run build` generates the declarations before packing.
|
|
161
|
+
Your app's bundler must
|
|
61
162
|
process those files and its stylesheet through Tailwind CSS 4.
|
|
62
163
|
|
|
63
164
|
The GitHub Actions `publish.yml` workflow publishes from `main` using
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
export type PlatformOS = "ios" | "android" | "macos" | "windows" | "linux" | "unknown";
|
|
3
|
+
export declare function detectPlatform(userAgent: string, platform: string, maxTouchPoints: number): PlatformOS;
|
|
4
|
+
export declare function resolvePlatform(override: string | null, userAgent: string, platform: string, maxTouchPoints: number): PlatformOS;
|
|
5
|
+
export declare function PlatformScript({ nonce }: {
|
|
6
|
+
nonce?: string;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export declare function PlatformProvider({ children }: PropsWithChildren): import("react").JSX.Element;
|
|
9
|
+
export declare function usePlatform(): PlatformOS;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from "react";
|
|
2
|
+
type ValueObject = {
|
|
3
|
+
[themeName: string]: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Props for the useTheme hook
|
|
7
|
+
* @author la niina
|
|
8
|
+
*/
|
|
9
|
+
export type UseThemeProps = {
|
|
10
|
+
/** List of all available theme names */
|
|
11
|
+
themes: Array<string>;
|
|
12
|
+
/** Forced theme name for the current page */
|
|
13
|
+
forcedTheme?: string | undefined;
|
|
14
|
+
/** Update the theme */
|
|
15
|
+
setTheme: Dispatch<SetStateAction<string>>;
|
|
16
|
+
/** Active theme name */
|
|
17
|
+
theme?: string | undefined;
|
|
18
|
+
/** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
|
|
19
|
+
systemTheme?: SystemTheme | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type SystemTheme = "dark" | "light";
|
|
22
|
+
export type Attribute = `data-${string}` | "class";
|
|
23
|
+
export interface ThemeProviderProps extends PropsWithChildren {
|
|
24
|
+
/** List of all available theme names */
|
|
25
|
+
themes?: Array<string> | undefined;
|
|
26
|
+
/** Forced theme name for the current page */
|
|
27
|
+
forcedTheme?: string | undefined;
|
|
28
|
+
/** Whether to switch between dark and light themes based on prefers-color-scheme */
|
|
29
|
+
enableSystem?: boolean | undefined;
|
|
30
|
+
/** Disable all CSS transitions when switching themes */
|
|
31
|
+
disableTransitionOnChange?: boolean | undefined;
|
|
32
|
+
/** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
|
|
33
|
+
enableColorScheme?: boolean | undefined;
|
|
34
|
+
/** Key used to store theme setting in localStorage */
|
|
35
|
+
storageKey?: string | undefined;
|
|
36
|
+
/** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
|
|
37
|
+
defaultTheme?: string | undefined;
|
|
38
|
+
/** HTML attribute modified based on the active theme. Accepts `class`, `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.), or an array which could include both */
|
|
39
|
+
attribute?: Attribute | Array<Attribute> | undefined;
|
|
40
|
+
/** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
|
|
41
|
+
value?: ValueObject | undefined;
|
|
42
|
+
/** Nonce string to pass to the inline script for CSP headers */
|
|
43
|
+
nonce?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Hook to access the theme context
|
|
47
|
+
* @returns {UseThemeProps} theme context
|
|
48
|
+
* @example
|
|
49
|
+
* const { theme, setTheme } = useTheme()
|
|
50
|
+
*/
|
|
51
|
+
export declare const useTheme: () => UseThemeProps;
|
|
52
|
+
/**
|
|
53
|
+
* Theme provider component is used to wrap your app &
|
|
54
|
+
* provide theme context to all components. It can be used to switch
|
|
55
|
+
* between themes.
|
|
56
|
+
* @author la niina
|
|
57
|
+
* @param {ThemeProviderProps} props
|
|
58
|
+
* @returns {ReactNode} children
|
|
59
|
+
* @example
|
|
60
|
+
* <ThemeProvider attribute="class" disableTransitionOnChange>
|
|
61
|
+
* <App />
|
|
62
|
+
* </ThemeProvider>
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <ThemeProvider themes={["light", "queer", "dark", "system"]} defaultTheme="light">
|
|
66
|
+
* <App />
|
|
67
|
+
* </ThemeProvider>
|
|
68
|
+
*/
|
|
69
|
+
export declare const ThemeProvider: (props: ThemeProviderProps) => ReactNode;
|
|
70
|
+
export declare const script: (attribute: Attribute | Array<Attribute>, storageKey: string, defaultTheme: string, forcedTheme: string | undefined, themes: Array<string>, value: ValueObject | undefined, enableSystem: boolean, enableColorScheme: boolean) => void;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
type AmbientProps = ComponentPropsWithoutRef<"section"> & {
|
|
3
|
+
/** The image whose colors glow behind the content. */
|
|
4
|
+
src?: string | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Content with its image's colors glowing softly behind it, no card or
|
|
8
|
+
* edge: a blown-up, blurred copy of the image masked into a circle that
|
|
9
|
+
* fades into the page, the way Apple lets a photo light its surroundings.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Ambient({ src, className, children, ...props }: AmbientProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ambient";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ButtonVariant = "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "accent";
|
|
2
|
+
/** Icon-only buttons use the same sizing contract as Button. */
|
|
3
|
+
export declare const iconButtonSizes: {
|
|
4
|
+
readonly icon: "size-11 p-0 rounded-full";
|
|
5
|
+
readonly "icon-xs": "size-8 p-0 rounded-full";
|
|
6
|
+
readonly "icon-sm": "size-9 p-0 rounded-full";
|
|
7
|
+
readonly "icon-lg": "size-12 p-0 rounded-full";
|
|
8
|
+
};
|
|
9
|
+
export type IconButtonSize = keyof typeof iconButtonSizes;
|
|
10
|
+
export type ButtonSize = "default" | "xs" | "sm" | "lg" | "icon-full" | IconButtonSize;
|
|
11
|
+
export declare const buttonVariants: Record<ButtonVariant, string>;
|
|
12
|
+
export declare const buttonSizes: Record<ButtonSize, string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
import { type ButtonSize, type ButtonVariant } from "./button-styles";
|
|
3
|
+
export type { ButtonSize, ButtonVariant };
|
|
4
|
+
/**
|
|
5
|
+
* Each variant has a little depth: a fine highlight along the top edge and
|
|
6
|
+
* a soft, layered shadow, like a well-made physical key.
|
|
7
|
+
*/
|
|
8
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
/**
|
|
10
|
+
* Visual emphasis: `default` (solid), `accent` (main action),
|
|
11
|
+
* `secondary` (quiet fill), `outline`, `ghost`, `link`, or `destructive`.
|
|
12
|
+
* @default "default"
|
|
13
|
+
*/
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
/**
|
|
16
|
+
* Label sizes: `xs`, `sm`, `default`, `lg`.
|
|
17
|
+
* Icon sizes: `icon-xs`, `icon-sm`, `icon`, `icon-lg`, `icon-full`.
|
|
18
|
+
* Prefer IconButton for an icon with a built-in accessible label.
|
|
19
|
+
* @default "default"
|
|
20
|
+
*/
|
|
21
|
+
size?: ButtonSize;
|
|
22
|
+
/** Shows a delayed spinner, keeps the button's width, and prevents repeat presses.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
isPending?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Shares native button appearance with semantic links without nesting a button. */
|
|
28
|
+
export declare function buttonStyle({ variant, size, className, }?: Pick<ButtonProps, "variant" | "size" | "className">): string;
|
|
29
|
+
/** A native button with Passui styling, pending feedback, and an HTMLButtonElement ref. */
|
|
30
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ButtonProps } from "./button";
|
|
2
|
+
import type { ButtonVariant, IconButtonSize } from "./button-styles";
|
|
3
|
+
export type { ButtonVariant, IconButtonSize };
|
|
4
|
+
export interface IconButtonProps extends Omit<ButtonProps, "size"> {
|
|
5
|
+
/** Icon-only actions must have an accessible name. */
|
|
6
|
+
label: string;
|
|
7
|
+
size?: IconButtonSize;
|
|
8
|
+
}
|
|
9
|
+
/** An accessible icon-only presentation of Button, sharing its interaction behavior. */
|
|
10
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type ChipTone = "neutral" | "accent" | "public" | "family" | "friends";
|
|
3
|
+
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/** `neutral`, `accent`, `public`, `family`, or `friends`. @default "neutral" */
|
|
5
|
+
tone?: ChipTone;
|
|
6
|
+
}
|
|
7
|
+
export declare function Chip({ tone, className, ...props }: ChipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** A calendar day, with `month` counted from 1. */
|
|
2
|
+
export interface CalendarDay {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
day: number;
|
|
6
|
+
}
|
|
7
|
+
/** Reads `YYYY-MM-DD`; null for anything else, or a date that doesn't exist. */
|
|
8
|
+
export declare function parseDay(value: string): CalendarDay | null;
|
|
9
|
+
export declare function formatDay({ year, month, day }: CalendarDay): string;
|
|
10
|
+
/** Moves by whole days, across months and years. */
|
|
11
|
+
export declare function addDays(day: CalendarDay, count: number): CalendarDay;
|
|
12
|
+
/** Moves by months, keeping the day where the month allows (31 Jan + 1 is 28 or 29 Feb). */
|
|
13
|
+
export declare function addMonths(day: CalendarDay, count: number): CalendarDay;
|
|
14
|
+
/**
|
|
15
|
+
* The first day of the week where `locale` is used, 1 (Monday) to 7
|
|
16
|
+
* (Sunday), from the browser where it knows, else Monday except in the
|
|
17
|
+
* places that start on Sunday.
|
|
18
|
+
*/
|
|
19
|
+
export declare function firstWeekday(locale: string): number;
|
|
20
|
+
/** Six weeks covering `year`/`month`, starting on `firstDay` (1 to 7). */
|
|
21
|
+
export declare function monthGrid(year: number, month: number, firstDay: number): Array<CalendarDay & {
|
|
22
|
+
inMonth: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
/** Whether `value` (`YYYY-MM-DD`) lies within the optional bounds. */
|
|
25
|
+
export declare function withinBounds(value: string, min?: string, max?: string): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface CompactDatePickerProps {
|
|
2
|
+
/** `YYYY-MM-DD`, or "" when no date is chosen. */
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
/** Names the button and the calendar for assistive technology. */
|
|
6
|
+
label: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
min?: string;
|
|
9
|
+
max?: string;
|
|
10
|
+
/** Shown when no date is chosen. */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
labels: {
|
|
13
|
+
previousMonth: string;
|
|
14
|
+
nextMonth: string;
|
|
15
|
+
/** Offers to remove the date, for optional dates. */
|
|
16
|
+
clear?: string;
|
|
17
|
+
};
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Prevents opening the date panel. @default false */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A date as a compact button that opens a month calendar, like SwiftUI's
|
|
24
|
+
* compact DatePicker: for dates on a calendar, such as an event or an
|
|
25
|
+
* invoice. For dates people know by heart, like a birthday, use DatePicker.
|
|
26
|
+
*/
|
|
27
|
+
export declare function CompactDatePicker({ value, onChange, label, locale, min, max, placeholder, labels, className, disabled, }: CompactDatePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface CompactTimePickerProps {
|
|
2
|
+
/** `HH:MM` on a 24 hour clock, or "" when no time is chosen. */
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
/** Names the button and the panel for assistive technology. */
|
|
6
|
+
label: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
/** Minutes offered, in steps; an exact time already chosen is kept. */
|
|
9
|
+
minuteStep?: number;
|
|
10
|
+
/** Shown when no time is chosen. */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
labels: {
|
|
13
|
+
hour: string;
|
|
14
|
+
minute: string;
|
|
15
|
+
period: string;
|
|
16
|
+
};
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Prevents opening the time panel. @default false */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A time as a compact button that opens columns of hours and minutes,
|
|
23
|
+
* like SwiftUI's compact DatePicker for times, on the clock the locale
|
|
24
|
+
* reads (12 hours with AM and PM, or 24).
|
|
25
|
+
*/
|
|
26
|
+
export declare function CompactTimePicker({ value, onChange, label, locale, minuteStep, placeholder, labels, className, disabled, }: CompactTimePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** A time of day on a 24 hour clock. */
|
|
2
|
+
export interface TimeOfDay {
|
|
3
|
+
hour: number;
|
|
4
|
+
minute: number;
|
|
5
|
+
}
|
|
6
|
+
/** Reads `HH:MM` (24 hour); null for anything else. */
|
|
7
|
+
export declare function parseTime(value: string): TimeOfDay | null;
|
|
8
|
+
export declare function formatTime({ hour, minute }: TimeOfDay): string;
|
|
9
|
+
/** Whether people where `locale` is used read time on a 12 hour clock. */
|
|
10
|
+
export declare function usesTwelveHours(locale: string): boolean;
|
|
11
|
+
/** The hour as shown on a 12 hour clock (12, 1 to 11) and whether it's after noon. */
|
|
12
|
+
export declare function toTwelveHours(hour: number): {
|
|
13
|
+
hour: number;
|
|
14
|
+
pm: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function fromTwelveHours(hour: number, pm: boolean): number;
|
|
17
|
+
/** Minutes offered in steps of `step`, keeping `current` when it falls between them. */
|
|
18
|
+
export declare function minuteChoices(step: number, current?: number): number[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
export type ContentViewVariant = keyof typeof variants;
|
|
3
|
+
export type ContentViewHeadingLevel = "h1" | "h2" | "h3";
|
|
4
|
+
type ContentViewProps = ComponentPropsWithoutRef<"section"> & {
|
|
5
|
+
variant?: ContentViewVariant;
|
|
6
|
+
};
|
|
7
|
+
type RowProps = ComponentPropsWithoutRef<"div">;
|
|
8
|
+
type SectionProps = ComponentPropsWithoutRef<"section">;
|
|
9
|
+
type HeaderProps = PropsWithChildren<{
|
|
10
|
+
heading: string;
|
|
11
|
+
p?: string;
|
|
12
|
+
pClassName?: string;
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
action?: ReactNode;
|
|
15
|
+
actionClassName?: string;
|
|
16
|
+
as?: ContentViewHeadingLevel;
|
|
17
|
+
className?: string;
|
|
18
|
+
}>;
|
|
19
|
+
type H1Props = ComponentPropsWithoutRef<"h1">;
|
|
20
|
+
type H2Props = ComponentPropsWithoutRef<"h2">;
|
|
21
|
+
type PProps = ComponentPropsWithoutRef<"p">;
|
|
22
|
+
type SpanProps = ComponentPropsWithoutRef<"span">;
|
|
23
|
+
type SubProps = ComponentPropsWithoutRef<"sub">;
|
|
24
|
+
declare const variants: {
|
|
25
|
+
readonly elevated: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function ContentView({ variant, className, children, ...props }: ContentViewProps): import("react").JSX.Element;
|
|
28
|
+
export declare namespace ContentView {
|
|
29
|
+
export { Row };
|
|
30
|
+
export { Section };
|
|
31
|
+
export { Header };
|
|
32
|
+
export { Divider };
|
|
33
|
+
export { H1 };
|
|
34
|
+
export { H2 };
|
|
35
|
+
export { P };
|
|
36
|
+
export { Span };
|
|
37
|
+
export { Sub };
|
|
38
|
+
}
|
|
39
|
+
declare function Row({ className, children, ...props }: RowProps): import("react").JSX.Element;
|
|
40
|
+
declare function Section({ className, children, ...props }: SectionProps): import("react").JSX.Element;
|
|
41
|
+
declare function Header({ heading, p, pClassName, icon, action, actionClassName, as: Tag, className, children, }: HeaderProps): import("react").JSX.Element;
|
|
42
|
+
declare function Divider(): import("react").JSX.Element;
|
|
43
|
+
declare function H1({ className, children, ...props }: H1Props): import("react").JSX.Element;
|
|
44
|
+
declare function H2({ className, children, ...props }: H2Props): import("react").JSX.Element;
|
|
45
|
+
declare function P({ className, children, ...props }: PProps): import("react").JSX.Element;
|
|
46
|
+
declare function Span({ className, children, ...props }: SpanProps): import("react").JSX.Element;
|
|
47
|
+
declare function Sub({ className, children, ...props }: SubProps): import("react").JSX.Element;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./content-view";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { MenuRect } from "./menu-reveal";
|
|
3
|
+
export type ContextMenuAlignX = "start" | "end";
|
|
4
|
+
export type ContextMenuAlignY = "top" | "bottom";
|
|
5
|
+
export type ContextMenuEdge = "leading" | "trailing";
|
|
6
|
+
/** One row of a context menu, or a divider between groups of rows. */
|
|
7
|
+
export type ContextMenuItem = {
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
onSelect: () => void;
|
|
11
|
+
destructive?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Marks the current choice, e.g. a note's kind. */
|
|
14
|
+
checked?: boolean;
|
|
15
|
+
} | {
|
|
16
|
+
heading: string;
|
|
17
|
+
} | "divider";
|
|
18
|
+
export interface OpenMenu {
|
|
19
|
+
id: number;
|
|
20
|
+
anchor: Element | null;
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
items: ContextMenuItem[];
|
|
24
|
+
/** Opened by long-press: bigger rows for fingers. */
|
|
25
|
+
touch: boolean;
|
|
26
|
+
/** Which edge of the menu sits at `x`: its left (`start`) or its right (`end`). */
|
|
27
|
+
alignX: ContextMenuAlignX;
|
|
28
|
+
/** Which edge of the menu sits at `y`: its top (`top`) or its bottom (`bottom`). */
|
|
29
|
+
alignY: ContextMenuAlignY;
|
|
30
|
+
source?: MenuRect;
|
|
31
|
+
toolbar?: HTMLElement;
|
|
32
|
+
toolbarRect?: MenuRect;
|
|
33
|
+
restoreFocus?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Opens a menu at a point, such as where a pointer was pressed. */
|
|
36
|
+
export declare function openContextMenu(x: number, y: number, items: ContextMenuItem[], touch?: boolean, anchor?: Element | null): void;
|
|
37
|
+
/**
|
|
38
|
+
* Opens a second menu where the last one stood, the way an iOS menu swaps
|
|
39
|
+
* in a submenu: a long list (a note's fonts, its kinds) stays one row in the
|
|
40
|
+
* first menu instead of making it tall.
|
|
41
|
+
*/
|
|
42
|
+
export declare function openFollowUpMenu(items: ContextMenuItem[]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Opens a menu from a control, the way a SwiftUI `Menu` does: under it (or
|
|
45
|
+
* above it), lined up with its leading or trailing edge. Leading and
|
|
46
|
+
* trailing follow the text direction, so right-to-left languages mirror.
|
|
47
|
+
* The menu's real size decides where it goes; nothing is guessed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function openMenu(anchor: Element, items: ContextMenuItem[], { edge, above, toolbar, }?: {
|
|
50
|
+
edge?: ContextMenuEdge;
|
|
51
|
+
above?: boolean;
|
|
52
|
+
/** Replace this action group with a horizontally expanding menu surface. */
|
|
53
|
+
toolbar?: HTMLElement;
|
|
54
|
+
}): void;
|
|
55
|
+
export declare function closeContextMenu(restoreFocus?: boolean): void;
|
|
56
|
+
export declare function subscribeContextMenu(listener: () => void): () => void;
|
|
57
|
+
export declare function getContextMenu(): OpenMenu | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type MenuNavigationKey = "ArrowDown" | "ArrowUp" | "Home" | "End";
|
|
2
|
+
export declare function isMenuNavigationKey(key: string): key is MenuNavigationKey;
|
|
3
|
+
/** Index of the next enabled action in a menu, with wrapping arrow navigation. */
|
|
4
|
+
export declare function nextMenuIndex(key: MenuNavigationKey, current: number, count: number): number;
|
|
5
|
+
/** Finds a matching label after the current action, wrapping at the end. */
|
|
6
|
+
export declare function findMenuTypeaheadIndex(labels: ReadonlyArray<string>, query: string, current: number): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpenMenu } from "./context-menu-store";
|
|
2
|
+
import type { MenuRect } from "./menu-reveal";
|
|
3
|
+
type MenuAnchor = Pick<OpenMenu, "x" | "y" | "alignX" | "alignY">;
|
|
4
|
+
type MenuSize = Pick<MenuRect, "width" | "height">;
|
|
5
|
+
type MenuBounds = {
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
right: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
};
|
|
11
|
+
/** Fit within the current visible viewport, including a keyboard or Safari pan. */
|
|
12
|
+
export declare function menuPosition(menu: MenuAnchor, size: MenuSize, bounds: MenuBounds): {
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
originX: number;
|
|
16
|
+
originY: number;
|
|
17
|
+
maxHeight: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type MenuRect = {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
/** Animate the material's bounds independently so menu text never stretches. */
|
|
8
|
+
export declare function menuSurfaceReveal(source: MenuRect | undefined, target: MenuRect): {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
opacity: number;
|
|
14
|
+
borderRadius: string;
|
|
15
|
+
} | {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
opacity: number;
|
|
21
|
+
borderRadius: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type MouseEvent, type PointerEvent } from "react";
|
|
2
|
+
import { type ContextMenuItem } from "./context-menu-store";
|
|
3
|
+
/**
|
|
4
|
+
* Right-click on desktop, long-press on touch screens: both open the same
|
|
5
|
+
* menu of actions. Spread the returned handlers onto the element.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useContextMenu(items: () => ContextMenuItem[]): {
|
|
8
|
+
onContextMenu(event: MouseEvent): void;
|
|
9
|
+
onPointerDown(event: PointerEvent): void;
|
|
10
|
+
onPointerMove(event: PointerEvent): void;
|
|
11
|
+
onPointerUp: () => void;
|
|
12
|
+
onPointerCancel: () => void;
|
|
13
|
+
onClickCapture(event: MouseEvent): void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type ConversationMessage = {
|
|
3
|
+
id: string;
|
|
4
|
+
body: string;
|
|
5
|
+
/** Written by whoever is looking: drawn on the right. */
|
|
6
|
+
mine: boolean;
|
|
7
|
+
author?: string;
|
|
8
|
+
/** Shown beside the other side's messages, like their avatar. */
|
|
9
|
+
avatar?: ReactNode;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A thread of plain-text messages like Messages on iPhone: a day line when
|
|
14
|
+
* the date changes, back-to-back messages from one side grouped under one
|
|
15
|
+
* name, theirs on the left with an avatar, yours on the right.
|
|
16
|
+
*/
|
|
17
|
+
declare function Messages({ messages, locale, }: {
|
|
18
|
+
messages: ConversationMessage[];
|
|
19
|
+
/** For day names and times; the reader's own by default. */
|
|
20
|
+
locale?: string;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
type ComposerProps = {
|
|
23
|
+
onSend: (body: string) => Promise<unknown>;
|
|
24
|
+
pending?: boolean;
|
|
25
|
+
maxLength: number;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
/** Extra controls under the field, like a status picker. */
|
|
28
|
+
actions?: ReactNode;
|
|
29
|
+
/** Names the round Send button for screen readers. */
|
|
30
|
+
sendLabel: string;
|
|
31
|
+
/**
|
|
32
|
+
* Words for the characters left, shown near the limit, such as
|
|
33
|
+
* (count) => `${count} left`. Without it, just the number shows.
|
|
34
|
+
*/
|
|
35
|
+
remaining?: (count: number) => string;
|
|
36
|
+
};
|
|
37
|
+
/** A reply field with a round send button; Ctrl/Cmd+Enter sends, and it clears only once the send worked. */
|
|
38
|
+
declare function Composer({ onSend, pending, maxLength, placeholder, actions, sendLabel, remaining, }: ComposerProps): import("react").JSX.Element;
|
|
39
|
+
export declare const Conversation: {
|
|
40
|
+
Messages: typeof Messages;
|
|
41
|
+
Composer: typeof Composer;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./conversation";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type DatePickerProps = {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
label: string;
|
|
5
|
+
labels: {
|
|
6
|
+
day: string;
|
|
7
|
+
month: string;
|
|
8
|
+
year: string;
|
|
9
|
+
invalid: string;
|
|
10
|
+
};
|
|
11
|
+
locale: string;
|
|
12
|
+
max?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Segmented date entry suited to birthdays, without a native calendar dialog. */
|
|
15
|
+
export declare function DatePicker({ value, onChange, label, labels, locale, max }: DatePickerProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|