@kujoforall/paper-ui 0.1.0 → 0.2.1
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/CHANGELOG.md +94 -0
- package/README.md +50 -7
- package/dist/components/editor/block-text.d.ts.map +1 -1
- package/dist/components/editor/block-text.js +52 -17
- package/dist/components/editor/block-text.js.map +1 -1
- package/dist/components/editor/blocks.d.ts.map +1 -1
- package/dist/components/editor/blocks.js +17 -13
- package/dist/components/editor/blocks.js.map +1 -1
- package/dist/components/editor/document-editor.d.ts.map +1 -1
- package/dist/components/editor/document-editor.js +4 -2
- package/dist/components/editor/document-editor.js.map +1 -1
- package/dist/components/editor/document-view.d.ts.map +1 -1
- package/dist/components/editor/document-view.js +17 -12
- package/dist/components/editor/document-view.js.map +1 -1
- package/dist/components/editor/editor-state.d.ts +7 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -1
- package/dist/components/editor/editor-state.js +28 -3
- package/dist/components/editor/editor-state.js.map +1 -1
- package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
- package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
- package/dist/components/editor/extensions/kit-blocks.js +201 -0
- package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -1
- package/dist/components/editor/extensions/spoiler.js +2 -2
- package/dist/components/editor/extensions/spoiler.js.map +1 -1
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.d.ts.map +1 -1
- package/dist/components/editor/index.js +1 -0
- package/dist/components/editor/index.js.map +1 -1
- package/dist/components/editor/kinds.js +1 -1
- package/dist/components/editor/kinds.js.map +1 -1
- package/dist/components/editor/look.d.ts +18 -0
- package/dist/components/editor/look.d.ts.map +1 -0
- package/dist/components/editor/look.js +21 -0
- package/dist/components/editor/look.js.map +1 -0
- package/dist/components/three/model-viewer.d.ts +36 -0
- package/dist/components/three/model-viewer.d.ts.map +1 -0
- package/dist/components/three/model-viewer.js +338 -0
- package/dist/components/three/model-viewer.js.map +1 -0
- package/dist/components/ui/accent-picker.js +1 -1
- package/dist/components/ui/accent-picker.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +29 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +72 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/animated-height.d.ts +6 -0
- package/dist/components/ui/animated-height.d.ts.map +1 -0
- package/dist/components/ui/animated-height.js +26 -0
- package/dist/components/ui/animated-height.js.map +1 -0
- package/dist/components/ui/app-shell.d.ts +1 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -1
- package/dist/components/ui/app-shell.js +5 -3
- package/dist/components/ui/app-shell.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +30 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +2 -2
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/banner.d.ts +33 -0
- package/dist/components/ui/banner.d.ts.map +1 -0
- package/dist/components/ui/banner.js +21 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/breadcrumbs.js +1 -1
- package/dist/components/ui/breadcrumbs.js.map +1 -1
- package/dist/components/ui/button.d.ts +8 -6
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +91 -26
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +6 -5
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/callout.d.ts +23 -4
- package/dist/components/ui/callout.d.ts.map +1 -1
- package/dist/components/ui/callout.js +28 -15
- package/dist/components/ui/callout.js.map +1 -1
- package/dist/components/ui/card.d.ts +13 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +10 -9
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +9 -4
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +25 -5
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/choice-label.d.ts +13 -0
- package/dist/components/ui/choice-label.d.ts.map +1 -0
- package/dist/components/ui/choice-label.js +17 -0
- package/dist/components/ui/choice-label.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +10 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/collection-layout.d.ts +24 -0
- package/dist/components/ui/collection-layout.d.ts.map +1 -0
- package/dist/components/ui/collection-layout.js +16 -0
- package/dist/components/ui/collection-layout.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +10 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +93 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command-menu.d.ts +5 -2
- package/dist/components/ui/command-menu.d.ts.map +1 -1
- package/dist/components/ui/command-menu.js +31 -6
- package/dist/components/ui/command-menu.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +19 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +42 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/copy-button.d.ts +11 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +48 -0
- package/dist/components/ui/copy-button.js.map +1 -0
- package/dist/components/ui/database/calendar-view.d.ts +10 -0
- package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
- package/dist/components/ui/database/calendar-view.js +65 -0
- package/dist/components/ui/database/calendar-view.js.map +1 -0
- package/dist/components/ui/database/card-views.d.ts +22 -0
- package/dist/components/ui/database/card-views.d.ts.map +1 -0
- package/dist/components/ui/database/card-views.js +74 -0
- package/dist/components/ui/database/card-views.js.map +1 -0
- package/dist/components/ui/database/cells.d.ts +20 -0
- package/dist/components/ui/database/cells.d.ts.map +1 -0
- package/dist/components/ui/database/cells.js +132 -0
- package/dist/components/ui/database/cells.js.map +1 -0
- package/dist/components/ui/database/database.d.ts +19 -0
- package/dist/components/ui/database/database.d.ts.map +1 -0
- package/dist/components/ui/database/database.js +102 -0
- package/dist/components/ui/database/database.js.map +1 -0
- package/dist/components/ui/database/icons.d.ts +5 -0
- package/dist/components/ui/database/icons.d.ts.map +1 -0
- package/dist/components/ui/database/icons.js +13 -0
- package/dist/components/ui/database/icons.js.map +1 -0
- package/dist/components/ui/database/table-view.d.ts +11 -0
- package/dist/components/ui/database/table-view.d.ts.map +1 -0
- package/dist/components/ui/database/table-view.js +157 -0
- package/dist/components/ui/database/table-view.js.map +1 -0
- package/dist/components/ui/date-picker.d.ts +6 -1
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/date-picker.js +20 -12
- package/dist/components/ui/date-picker.js.map +1 -1
- package/dist/components/ui/date-time-picker.d.ts +3 -1
- package/dist/components/ui/date-time-picker.d.ts.map +1 -1
- package/dist/components/ui/date-time-picker.js +17 -15
- package/dist/components/ui/date-time-picker.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +13 -9
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +33 -3
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/document-layout.d.ts +15 -0
- package/dist/components/ui/document-layout.d.ts.map +1 -0
- package/dist/components/ui/document-layout.js +15 -0
- package/dist/components/ui/document-layout.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +14 -10
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +22 -13
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/editable-text.d.ts +9 -2
- package/dist/components/ui/editable-text.d.ts.map +1 -1
- package/dist/components/ui/editable-text.js +27 -10
- package/dist/components/ui/editable-text.js.map +1 -1
- package/dist/components/ui/empty-state.d.ts +11 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty-state.js +9 -0
- package/dist/components/ui/empty-state.js.map +1 -0
- package/dist/components/ui/error-state.d.ts +20 -0
- package/dist/components/ui/error-state.d.ts.map +1 -0
- package/dist/components/ui/error-state.js +17 -0
- package/dist/components/ui/error-state.js.map +1 -0
- package/dist/components/ui/field-button.d.ts +2 -1
- package/dist/components/ui/field-button.d.ts.map +1 -1
- package/dist/components/ui/field-button.js +7 -5
- package/dist/components/ui/field-button.js.map +1 -1
- package/dist/components/ui/file-preview.js +1 -1
- package/dist/components/ui/file-preview.js.map +1 -1
- package/dist/components/ui/file-uploader.d.ts.map +1 -1
- package/dist/components/ui/file-uploader.js +5 -4
- package/dist/components/ui/file-uploader.js.map +1 -1
- package/dist/components/ui/filter-builder.d.ts +18 -0
- package/dist/components/ui/filter-builder.d.ts.map +1 -0
- package/dist/components/ui/filter-builder.js +98 -0
- package/dist/components/ui/filter-builder.js.map +1 -0
- package/dist/components/ui/focus-shell.d.ts +14 -0
- package/dist/components/ui/focus-shell.d.ts.map +1 -0
- package/dist/components/ui/focus-shell.js +13 -0
- package/dist/components/ui/focus-shell.js.map +1 -0
- package/dist/components/ui/handle-row.d.ts +11 -1
- package/dist/components/ui/handle-row.d.ts.map +1 -1
- package/dist/components/ui/handle-row.js +101 -32
- package/dist/components/ui/handle-row.js.map +1 -1
- package/dist/components/ui/header-bar.d.ts +5 -0
- package/dist/components/ui/header-bar.d.ts.map +1 -0
- package/dist/components/ui/header-bar.js +10 -0
- package/dist/components/ui/header-bar.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +13 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/image-block.js +4 -4
- package/dist/components/ui/image-block.js.map +1 -1
- package/dist/components/ui/image-card.d.ts.map +1 -1
- package/dist/components/ui/image-card.js +5 -4
- package/dist/components/ui/image-card.js.map +1 -1
- package/dist/components/ui/image-framer.d.ts +24 -0
- package/dist/components/ui/image-framer.d.ts.map +1 -0
- package/dist/components/ui/image-framer.js +89 -0
- package/dist/components/ui/image-framer.js.map +1 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -1
- package/dist/components/ui/image-viewer.js +38 -5
- package/dist/components/ui/image-viewer.js.map +1 -1
- package/dist/components/ui/image.d.ts +25 -3
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +50 -21
- package/dist/components/ui/image.js.map +1 -1
- package/dist/components/ui/index.d.ts +54 -11
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +53 -10
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/input.d.ts +71 -12
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +236 -23
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/link-block.d.ts.map +1 -1
- package/dist/components/ui/link-block.js +1 -1
- package/dist/components/ui/link-block.js.map +1 -1
- package/dist/components/ui/list-detail.d.ts +23 -0
- package/dist/components/ui/list-detail.d.ts.map +1 -0
- package/dist/components/ui/list-detail.js +33 -0
- package/dist/components/ui/list-detail.js.map +1 -0
- package/dist/components/ui/listbox.d.ts +7 -0
- package/dist/components/ui/listbox.d.ts.map +1 -0
- package/dist/components/ui/listbox.js +29 -0
- package/dist/components/ui/listbox.js.map +1 -0
- package/dist/components/ui/mac-card.js +1 -1
- package/dist/components/ui/mac-card.js.map +1 -1
- package/dist/components/ui/month-picker.d.ts +13 -0
- package/dist/components/ui/month-picker.d.ts.map +1 -0
- package/dist/components/ui/month-picker.js +53 -0
- package/dist/components/ui/month-picker.js.map +1 -0
- package/dist/components/ui/multi-select.d.ts +22 -0
- package/dist/components/ui/multi-select.d.ts.map +1 -0
- package/dist/components/ui/multi-select.js +88 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -1
- package/dist/components/ui/nav-tree.js +10 -3
- package/dist/components/ui/nav-tree.js.map +1 -1
- package/dist/components/ui/page.d.ts +16 -5
- package/dist/components/ui/page.d.ts.map +1 -1
- package/dist/components/ui/page.js +23 -10
- package/dist/components/ui/page.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +26 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +54 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/picker-panel.d.ts +13 -0
- package/dist/components/ui/picker-panel.d.ts.map +1 -0
- package/dist/components/ui/picker-panel.js +19 -0
- package/dist/components/ui/picker-panel.js.map +1 -0
- package/dist/components/ui/popover.d.ts +2 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +11 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +17 -4
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/property.d.ts +2 -6
- package/dist/components/ui/property.d.ts.map +1 -1
- package/dist/components/ui/property.js +6 -22
- package/dist/components/ui/property.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +18 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/rating.d.ts +14 -0
- package/dist/components/ui/rating.d.ts.map +1 -0
- package/dist/components/ui/rating.js +61 -0
- package/dist/components/ui/rating.js.map +1 -0
- package/dist/components/ui/save-status.d.ts +8 -0
- package/dist/components/ui/save-status.d.ts.map +1 -0
- package/dist/components/ui/save-status.js +31 -0
- package/dist/components/ui/save-status.js.map +1 -0
- package/dist/components/ui/segmented.d.ts +15 -7
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +8 -6
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select-menu.d.ts +3 -1
- package/dist/components/ui/select-menu.d.ts.map +1 -1
- package/dist/components/ui/select-menu.js +2 -2
- package/dist/components/ui/select-menu.js.map +1 -1
- package/dist/components/ui/select.d.ts +7 -2
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +19 -5
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/selection-bar.js +1 -1
- package/dist/components/ui/selection-bar.js.map +1 -1
- package/dist/components/ui/settings-layout.d.ts +34 -0
- package/dist/components/ui/settings-layout.d.ts.map +1 -0
- package/dist/components/ui/settings-layout.js +16 -0
- package/dist/components/ui/settings-layout.js.map +1 -0
- package/dist/components/ui/share-link.d.ts +14 -0
- package/dist/components/ui/share-link.d.ts.map +1 -0
- package/dist/components/ui/share-link.js +16 -0
- package/dist/components/ui/share-link.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +21 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +53 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +82 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +258 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +8 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +12 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +14 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -1
- package/dist/components/ui/spotlight.js +14 -11
- package/dist/components/ui/spotlight.js.map +1 -1
- package/dist/components/ui/step-dialog.js +3 -3
- package/dist/components/ui/step-dialog.js.map +1 -1
- package/dist/components/ui/steps-layout.d.ts +20 -0
- package/dist/components/ui/steps-layout.d.ts.map +1 -0
- package/dist/components/ui/steps-layout.js +26 -0
- package/dist/components/ui/steps-layout.js.map +1 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +13 -5
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +65 -12
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +19 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +14 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.js +69 -41
- package/dist/components/ui/theme-toggle.js.map +1 -1
- package/dist/components/ui/time-list.d.ts +16 -0
- package/dist/components/ui/time-list.d.ts.map +1 -0
- package/dist/components/ui/time-list.js +49 -0
- package/dist/components/ui/time-list.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +37 -11
- package/dist/components/ui/time-picker.d.ts.map +1 -1
- package/dist/components/ui/time-picker.js +130 -52
- package/dist/components/ui/time-picker.js.map +1 -1
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +77 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +15 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +55 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -2
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/top-bar.d.ts +25 -0
- package/dist/components/ui/top-bar.d.ts.map +1 -0
- package/dist/components/ui/top-bar.js +23 -0
- package/dist/components/ui/top-bar.js.map +1 -0
- package/dist/components/ui/typography.d.ts +11 -5
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/components/ui/typography.js +31 -5
- package/dist/components/ui/typography.js.map +1 -1
- package/dist/components/ui/video-block.d.ts.map +1 -1
- package/dist/components/ui/video-block.js +5 -1
- package/dist/components/ui/video-block.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +5 -0
- package/dist/hooks/use-dismiss.d.ts.map +1 -0
- package/dist/hooks/use-dismiss.js +23 -0
- package/dist/hooks/use-dismiss.js.map +1 -0
- package/dist/hooks/use-escape-first.d.ts +3 -0
- package/dist/hooks/use-escape-first.d.ts.map +1 -0
- package/dist/hooks/use-escape-first.js +27 -0
- package/dist/hooks/use-escape-first.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +5 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +16 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -1
- package/dist/hooks/use-save-queue.js +19 -7
- package/dist/hooks/use-save-queue.js.map +1 -1
- package/dist/hooks/use-selection.d.ts.map +1 -1
- package/dist/hooks/use-selection.js +10 -1
- package/dist/hooks/use-selection.js.map +1 -1
- package/dist/lib/database.d.ts +92 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +272 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/dates.d.ts +16 -0
- package/dist/lib/dates.d.ts.map +1 -1
- package/dist/lib/dates.js +27 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/keys.d.ts +18 -0
- package/dist/lib/keys.d.ts.map +1 -0
- package/dist/lib/keys.js +66 -0
- package/dist/lib/keys.js.map +1 -0
- package/dist/lib/number.d.ts +4 -0
- package/dist/lib/number.d.ts.map +1 -0
- package/dist/lib/number.js +33 -0
- package/dist/lib/number.js.map +1 -0
- package/dist/lib/pointer.d.ts +2 -0
- package/dist/lib/pointer.d.ts.map +1 -0
- package/dist/lib/pointer.js +4 -0
- package/dist/lib/pointer.js.map +1 -0
- package/dist/lib/prepare-image.d.ts +43 -0
- package/dist/lib/prepare-image.d.ts.map +1 -0
- package/dist/lib/prepare-image.js +105 -0
- package/dist/lib/prepare-image.js.map +1 -0
- package/dist/lib/rich-text-dom.d.ts +2 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -1
- package/dist/lib/rich-text-dom.js +5 -3
- package/dist/lib/rich-text-dom.js.map +1 -1
- package/dist/lib/theme.d.ts +6 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +15 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/time.d.ts +19 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +91 -0
- package/dist/lib/time.js.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +20 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles/notion.css +342 -51
- package/package.json +27 -4
- package/src/components/editor/block-text.tsx +58 -17
- package/src/components/editor/blocks.tsx +19 -14
- package/src/components/editor/document-editor.tsx +7 -2
- package/src/components/editor/document-view.tsx +37 -24
- package/src/components/editor/editor-state.tsx +31 -3
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +9 -4
- package/src/components/editor/index.ts +1 -0
- package/src/components/editor/kinds.ts +1 -1
- package/src/components/editor/look.tsx +36 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +2 -2
- package/src/components/ui/alert-dialog.tsx +136 -0
- package/src/components/ui/animated-height.tsx +34 -0
- package/src/components/ui/app-shell.tsx +9 -7
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +4 -4
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +1 -1
- package/src/components/ui/button.tsx +115 -41
- package/src/components/ui/calendar.tsx +8 -7
- package/src/components/ui/callout.tsx +41 -42
- package/src/components/ui/card.tsx +27 -58
- package/src/components/ui/checkbox.tsx +53 -19
- package/src/components/ui/choice-label.tsx +43 -0
- package/src/components/ui/collapsible.tsx +58 -0
- package/src/components/ui/collection-layout.tsx +69 -0
- package/src/components/ui/combobox.tsx +155 -0
- package/src/components/ui/command-menu.tsx +61 -31
- package/src/components/ui/context-menu.tsx +89 -0
- package/src/components/ui/copy-button.tsx +80 -0
- package/src/components/ui/database/calendar-view.tsx +180 -0
- package/src/components/ui/database/card-views.tsx +221 -0
- package/src/components/ui/database/cells.tsx +237 -0
- package/src/components/ui/database/database.tsx +279 -0
- package/src/components/ui/database/icons.ts +15 -0
- package/src/components/ui/database/table-view.tsx +311 -0
- package/src/components/ui/date-picker.tsx +99 -61
- package/src/components/ui/date-time-picker.tsx +68 -62
- package/src/components/ui/dialog.tsx +48 -21
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +33 -31
- package/src/components/ui/editable-text.tsx +40 -7
- package/src/components/ui/empty-state.tsx +35 -0
- package/src/components/ui/error-state.tsx +67 -0
- package/src/components/ui/field-button.tsx +11 -9
- package/src/components/ui/file-preview.tsx +1 -1
- package/src/components/ui/file-uploader.tsx +23 -24
- package/src/components/ui/filter-builder.tsx +304 -0
- package/src/components/ui/focus-shell.tsx +48 -0
- package/src/components/ui/handle-row.tsx +176 -40
- package/src/components/ui/header-bar.tsx +15 -0
- package/src/components/ui/hover-card.tsx +30 -0
- package/src/components/ui/image-block.tsx +6 -6
- package/src/components/ui/image-card.tsx +18 -25
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +53 -10
- package/src/components/ui/image.tsx +133 -29
- package/src/components/ui/index.ts +106 -11
- package/src/components/ui/input.tsx +437 -65
- package/src/components/ui/link-block.tsx +5 -2
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +5 -5
- package/src/components/ui/month-picker.tsx +119 -0
- package/src/components/ui/multi-select.tsx +221 -0
- package/src/components/ui/nav-tree.tsx +11 -5
- package/src/components/ui/page.tsx +63 -15
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +3 -3
- package/src/components/ui/progress.tsx +56 -16
- package/src/components/ui/property.tsx +6 -37
- package/src/components/ui/radio-group.tsx +61 -0
- package/src/components/ui/rating.tsx +122 -0
- package/src/components/ui/save-status.tsx +53 -0
- package/src/components/ui/segmented.tsx +48 -16
- package/src/components/ui/select-menu.tsx +11 -3
- package/src/components/ui/select.tsx +33 -10
- package/src/components/ui/selection-bar.tsx +1 -1
- package/src/components/ui/settings-layout.tsx +117 -0
- package/src/components/ui/share-link.tsx +66 -0
- package/src/components/ui/sheet.tsx +90 -0
- package/src/components/ui/sidebar.tsx +627 -0
- package/src/components/ui/skeleton.tsx +22 -0
- package/src/components/ui/spinner.tsx +28 -0
- package/src/components/ui/spotlight.tsx +21 -21
- package/src/components/ui/step-dialog.tsx +6 -6
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +75 -18
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +74 -83
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +305 -134
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +20 -6
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +45 -9
- package/src/components/ui/video-block.tsx +9 -3
- package/src/hooks/use-dismiss.ts +24 -0
- package/src/hooks/use-escape-first.ts +25 -0
- package/src/hooks/use-media-query.ts +23 -0
- package/src/hooks/use-save-queue.ts +19 -7
- package/src/hooks/use-selection.ts +8 -1
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +36 -0
- package/src/lib/keys.ts +72 -0
- package/src/lib/number.ts +29 -0
- package/src/lib/pointer.ts +3 -0
- package/src/lib/prepare-image.ts +141 -0
- package/src/lib/rich-text-dom.ts +5 -3
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/utils.ts +21 -2
- package/src/styles/notion.css +342 -51
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import type { ComponentProps, ElementType } from "react";
|
|
2
3
|
import { cn } from "../../lib/utils.ts";
|
|
3
4
|
|
|
4
|
-
/* A card is a hairline and a whisper of shadow. No heavy border, no
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/* A card is a hairline and a whisper of shadow. No heavy border, no drop shadow you
|
|
6
|
+
can point at. The `interactive` variant is the only place depth animates, and it
|
|
7
|
+
moves 1px, not 6.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
An interactive card is a link or a button, so the keyboard can reach and press
|
|
10
|
+
it: render it as one with `asChild` (`<Card interactive asChild><a href>…`). A
|
|
11
|
+
div that only reacts to the mouse is out of reach for everyone else. */
|
|
12
|
+
|
|
13
|
+
export interface CardProps extends ComponentProps<"div"> {
|
|
9
14
|
interactive?: boolean;
|
|
10
15
|
/** Sit flush on a sunken surface with no lift of its own. */
|
|
11
16
|
flat?: boolean;
|
|
17
|
+
/** Render as the single child (a link, a button) instead of a div. */
|
|
18
|
+
asChild?: boolean;
|
|
12
19
|
}
|
|
13
20
|
|
|
14
|
-
export function Card({
|
|
15
|
-
|
|
16
|
-
interactive,
|
|
17
|
-
flat,
|
|
18
|
-
...props
|
|
19
|
-
}: CardProps) {
|
|
21
|
+
export function Card({ className, interactive, flat, asChild = false, ...props }: CardProps) {
|
|
22
|
+
const Comp = asChild ? Slot : "div";
|
|
20
23
|
return (
|
|
21
|
-
<
|
|
24
|
+
<Comp
|
|
22
25
|
className={cn(
|
|
23
|
-
"bg-surface-raised rounded-surface overflow-hidden",
|
|
24
|
-
flat
|
|
25
|
-
? "border border-hairline"
|
|
26
|
-
: "shadow-sm",
|
|
26
|
+
"block bg-surface-raised rounded-surface overflow-hidden text-left",
|
|
27
|
+
flat ? "border border-hairline" : "shadow-sm",
|
|
27
28
|
interactive && [
|
|
28
|
-
"transition-[box-shadow,transform] duration-
|
|
29
|
+
"transition-[box-shadow,transform] duration-(--duration-base) ease-out-notion outline-offset-2",
|
|
29
30
|
"hover:shadow-md hover:-translate-y-px cursor-pointer",
|
|
30
31
|
"active:translate-y-0 active:shadow-sm",
|
|
31
32
|
],
|
|
@@ -36,55 +37,23 @@ export function Card({
|
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export function CardHeader({
|
|
40
|
-
className,
|
|
41
|
-
...props
|
|
42
|
-
}: ComponentPropsWithoutRef<"div">) {
|
|
40
|
+
export function CardHeader({ className, ...props }: ComponentProps<"div">) {
|
|
43
41
|
return <div className={cn("px-4 pt-4 pb-0", className)} {...props} />;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...props
|
|
49
|
-
}: ComponentPropsWithoutRef<"h3">) {
|
|
50
|
-
return (
|
|
51
|
-
<h3
|
|
52
|
-
className={cn("font-semibold text-ink text-h3 my-0", className)}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
44
|
+
/** The card's name. An h3 unless `as` says otherwise, to fit the page's outline. */
|
|
45
|
+
export function CardTitle({ className, as: Tag = "h3", ...props }: ComponentProps<"h3"> & { as?: ElementType }) {
|
|
46
|
+
return <Tag className={cn("my-0 font-semibold text-h3 text-ink", className)} {...props} />;
|
|
56
47
|
}
|
|
57
48
|
|
|
58
|
-
export function CardDescription({
|
|
59
|
-
className,
|
|
60
|
-
...props
|
|
61
|
-
}: ComponentPropsWithoutRef<"p">) {
|
|
62
|
-
return (
|
|
63
|
-
<p
|
|
64
|
-
className={cn("mt-1 text-ink-secondary text-sm", className)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
49
|
+
export function CardDescription({ className, ...props }: ComponentProps<"p">) {
|
|
50
|
+
return <p className={cn("mt-1 text-ink-secondary text-sm", className)} {...props} />;
|
|
68
51
|
}
|
|
69
52
|
|
|
70
|
-
export function CardContent({
|
|
71
|
-
className,
|
|
72
|
-
...props
|
|
73
|
-
}: ComponentPropsWithoutRef<"div">) {
|
|
53
|
+
export function CardContent({ className, ...props }: ComponentProps<"div">) {
|
|
74
54
|
return <div className={cn("p-4", className)} {...props} />;
|
|
75
55
|
}
|
|
76
56
|
|
|
77
|
-
export function CardFooter({
|
|
78
|
-
className,
|
|
79
|
-
...props
|
|
80
|
-
}: ComponentPropsWithoutRef<"div">) {
|
|
81
|
-
return (
|
|
82
|
-
<div
|
|
83
|
-
className={cn(
|
|
84
|
-
"flex items-center gap-2 px-4 py-3 border-hairline border-t",
|
|
85
|
-
className,
|
|
86
|
-
)}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
57
|
+
export function CardFooter({ className, ...props }: ComponentProps<"div">) {
|
|
58
|
+
return <div className={cn("flex flex-wrap items-center gap-2 px-4 py-3 border-hairline border-t", className)} {...props} />;
|
|
90
59
|
}
|
|
@@ -1,32 +1,66 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
4
|
+
import { Check, Minus } from "lucide-react";
|
|
5
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
4
6
|
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { ChoiceLabel } from "./choice-label.tsx";
|
|
8
|
+
import { fromField, useField } from "./input.tsx";
|
|
9
|
+
|
|
10
|
+
/* Notion's to-do box: a 16px square whose empty edge reads at 3:1 (--control-edge)
|
|
11
|
+
and that fills with the accent when ticked. Its pressable area is 24px. It can be
|
|
12
|
+
partly ticked ("indeterminate"), for a row that stands for several. With `name`
|
|
13
|
+
it sends its value with a form; inside a Field it takes the Field's label and
|
|
14
|
+
error. With `label` (and `description`) it draws its own words, pressable too. */
|
|
15
|
+
|
|
16
|
+
export const checkboxBox = [
|
|
17
|
+
"peer relative flex justify-center items-center rounded-small size-4 shrink-0 outline-offset-2",
|
|
18
|
+
"shadow-[inset_0_0_0_1.5px_var(--control-edge)] transition-[background-color,box-shadow] duration-(--duration-fast)",
|
|
19
|
+
"hover:bg-tint-hover",
|
|
20
|
+
"data-[state=checked]:bg-accent-solid data-[state=checked]:text-accent-ink data-[state=checked]:shadow-none data-[state=checked]:hover:bg-accent-solid-hover",
|
|
21
|
+
"data-[state=indeterminate]:bg-accent-solid data-[state=indeterminate]:text-accent-ink data-[state=indeterminate]:shadow-none",
|
|
22
|
+
"aria-invalid:shadow-[inset_0_0_0_1.5px_var(--danger)]",
|
|
23
|
+
"disabled:cursor-not-allowed disabled:bg-tint-hover disabled:shadow-[inset_0_0_0_1.5px_var(--hairline-strong)] disabled:text-ink-disabled",
|
|
24
|
+
// Ticked but disabled: grey, so it never looks like a choice that can be changed.
|
|
25
|
+
"disabled:data-[state=checked]:bg-tint-active disabled:data-[state=checked]:text-ink-disabled disabled:data-[state=indeterminate]:bg-tint-active disabled:data-[state=indeterminate]:text-ink-disabled",
|
|
26
|
+
// 24px to press, around the 16px box.
|
|
27
|
+
"after:absolute after:-inset-1 after:content-['']",
|
|
28
|
+
];
|
|
5
29
|
|
|
6
|
-
/* Notion's to-do box: a 16px square with a strong hairline that fills with accent
|
|
7
|
-
when ticked. */
|
|
8
30
|
export function Checkbox({
|
|
9
31
|
checked,
|
|
10
32
|
onCheckedChange,
|
|
33
|
+
label,
|
|
34
|
+
description,
|
|
11
35
|
className,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
...props
|
|
37
|
+
}: Omit<ComponentProps<typeof CheckboxPrimitive.Root>, "onCheckedChange" | "checked"> & {
|
|
38
|
+
checked?: boolean | "indeterminate";
|
|
39
|
+
/** Ticked or not. A partly ticked box becomes ticked when pressed. */
|
|
40
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
41
|
+
label?: ReactNode;
|
|
42
|
+
description?: ReactNode;
|
|
16
43
|
}) {
|
|
44
|
+
const own = fromField(useField(), props);
|
|
17
45
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
<ChoiceLabel
|
|
47
|
+
label={label}
|
|
48
|
+
description={description}
|
|
49
|
+
disabled={own.disabled}
|
|
50
|
+
control={({ labelId, descriptionId }) => (
|
|
51
|
+
<CheckboxPrimitive.Root
|
|
52
|
+
checked={checked}
|
|
53
|
+
onCheckedChange={(next) => onCheckedChange?.(next === true)}
|
|
54
|
+
aria-labelledby={own["aria-labelledby"] ?? labelId}
|
|
55
|
+
{...own}
|
|
56
|
+
aria-describedby={[own["aria-describedby"], descriptionId].filter(Boolean).join(" ") || undefined}
|
|
57
|
+
className={cn(checkboxBox, className)}
|
|
58
|
+
>
|
|
59
|
+
<CheckboxPrimitive.Indicator className="flex">
|
|
60
|
+
{checked === "indeterminate" ? <Minus className="size-3" strokeWidth={3} /> : <Check className="size-3" strokeWidth={3} />}
|
|
61
|
+
</CheckboxPrimitive.Indicator>
|
|
62
|
+
</CheckboxPrimitive.Root>
|
|
27
63
|
)}
|
|
28
|
-
|
|
29
|
-
{checked && <Check className="size-3" strokeWidth={3} />}
|
|
30
|
-
</button>
|
|
64
|
+
/>
|
|
31
65
|
);
|
|
32
66
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useId, type ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* The words beside a checkbox, switch or radio: a label that is part of the
|
|
5
|
+
control (pressing it presses the control) and an optional line under it. The
|
|
6
|
+
control comes first for a checkbox or radio, last for a switch. */
|
|
7
|
+
export function ChoiceLabel({
|
|
8
|
+
control,
|
|
9
|
+
label,
|
|
10
|
+
description,
|
|
11
|
+
disabled,
|
|
12
|
+
end = false,
|
|
13
|
+
className,
|
|
14
|
+
}: {
|
|
15
|
+
control: (ids: { labelId?: string; descriptionId?: string }) => ReactNode;
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
end?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
}) {
|
|
22
|
+
const id = useId();
|
|
23
|
+
if (label === undefined) return <>{control({})}</>;
|
|
24
|
+
const labelId = `${id}-label`;
|
|
25
|
+
const descriptionId = description !== undefined ? `${id}-description` : undefined;
|
|
26
|
+
return (
|
|
27
|
+
// A <label> around both: a press anywhere on the words presses the control.
|
|
28
|
+
<label className={cn("group/choice flex items-start gap-2.5 text-sm cursor-pointer", disabled && "cursor-not-allowed", end && "flex-row-reverse justify-between", className)}>
|
|
29
|
+
{/* The control is centred on the first line of the label (1.5 × 14px). */}
|
|
30
|
+
<span className="flex items-center h-[1.3125rem] shrink-0">{control({ labelId, descriptionId })}</span>
|
|
31
|
+
<span className="min-w-0">
|
|
32
|
+
<span id={labelId} className={cn("block text-ink", disabled && "text-ink-disabled")}>
|
|
33
|
+
{label}
|
|
34
|
+
</span>
|
|
35
|
+
{description !== undefined && (
|
|
36
|
+
<span id={descriptionId} className={cn("block mt-0.5 text-caption text-ink-tertiary", disabled && "text-ink-disabled")}>
|
|
37
|
+
{description}
|
|
38
|
+
</span>
|
|
39
|
+
)}
|
|
40
|
+
</span>
|
|
41
|
+
</label>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
|
|
8
|
+
/* Something folded away: Notion's toggle. A trigger with a chevron that turns, and
|
|
9
|
+
the content easing open to its own height. The trigger says whether it is open
|
|
10
|
+
(aria-expanded) and what it opens. The parts are Radix's; `Disclosure` is the
|
|
11
|
+
whole thing in one. */
|
|
12
|
+
|
|
13
|
+
export const Collapsible = CollapsiblePrimitive.Root;
|
|
14
|
+
|
|
15
|
+
export function CollapsibleTrigger({ className, children, ...props }: ComponentProps<typeof CollapsiblePrimitive.Trigger>) {
|
|
16
|
+
return (
|
|
17
|
+
<CollapsiblePrimitive.Trigger
|
|
18
|
+
className={cn(
|
|
19
|
+
"group/trigger flex items-center gap-1 -ml-1 px-1 rounded-control min-h-control-sm font-medium text-ink text-sm text-left",
|
|
20
|
+
"hover:bg-tint-hover transition-colors duration-(--duration-instant)",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
<ChevronRight
|
|
26
|
+
aria-hidden
|
|
27
|
+
className="size-4 text-ink-tertiary group-data-[state=open]/trigger:rotate-90 transition-transform duration-(--duration-fast) shrink-0"
|
|
28
|
+
/>
|
|
29
|
+
{children}
|
|
30
|
+
</CollapsiblePrimitive.Trigger>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function CollapsibleContent({ className, ...props }: ComponentProps<typeof CollapsiblePrimitive.Content>) {
|
|
35
|
+
return (
|
|
36
|
+
<CollapsiblePrimitive.Content
|
|
37
|
+
className={cn("overflow-hidden data-[state=closed]:animate-collapse-up data-[state=open]:animate-collapse-down", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A titled toggle in one: closed unless `defaultOpen` (or controlled with `open`). */
|
|
44
|
+
export function Disclosure({
|
|
45
|
+
title,
|
|
46
|
+
children,
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}: Omit<ComponentProps<typeof CollapsiblePrimitive.Root>, "title"> & { title: ReactNode }) {
|
|
50
|
+
return (
|
|
51
|
+
<Collapsible className={className} {...props}>
|
|
52
|
+
<CollapsibleTrigger>{title}</CollapsibleTrigger>
|
|
53
|
+
<CollapsibleContent>
|
|
54
|
+
<div className="pt-1 pb-2 pl-5 text-ink-secondary text-sm">{children}</div>
|
|
55
|
+
</CollapsibleContent>
|
|
56
|
+
</Collapsible>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
import { Page, PageHeader } from "./page.tsx";
|
|
4
|
+
|
|
5
|
+
/* A page of many things to browse: a library, trips, items. The page's name and
|
|
6
|
+
its actions, then a toolbar (CollectionToolbar) that sticks under the top of the
|
|
7
|
+
page while the grid, list or table scrolls under it. Wide by default. */
|
|
8
|
+
export function CollectionLayout({
|
|
9
|
+
title,
|
|
10
|
+
lead,
|
|
11
|
+
actions,
|
|
12
|
+
toolbar,
|
|
13
|
+
stickyTop = "top-0",
|
|
14
|
+
width = "wide",
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
}: {
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
lead?: ReactNode;
|
|
20
|
+
actions?: ReactNode;
|
|
21
|
+
toolbar?: ReactNode;
|
|
22
|
+
/** Where the toolbar sticks: `top-11` under a HeaderBar, `top-14` under a TopBarShell. */
|
|
23
|
+
stickyTop?: string;
|
|
24
|
+
width?: "reading" | "wide";
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<Page width={width} className={className}>
|
|
30
|
+
<PageHeader title={title} lead={lead} actions={actions} />
|
|
31
|
+
{toolbar !== undefined && <div className={cn("z-(--z-sticky) sticky bg-surface -mx-2 mb-4 px-2 py-2", stickyTop)}>{toolbar}</div>}
|
|
32
|
+
{children}
|
|
33
|
+
</Page>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* What a collection is narrowed and shown by: a search, filters, a count, and the
|
|
38
|
+
view switch at the end. It wraps on a narrow screen: the search takes the row,
|
|
39
|
+
and the filters scroll sideways in theirs rather than wrapping line after line. */
|
|
40
|
+
export function CollectionToolbar({
|
|
41
|
+
search,
|
|
42
|
+
filters,
|
|
43
|
+
count,
|
|
44
|
+
view,
|
|
45
|
+
className,
|
|
46
|
+
}: {
|
|
47
|
+
/** A SearchField. */
|
|
48
|
+
search?: ReactNode;
|
|
49
|
+
/** SelectMenus, Toggles, a Sort menu. */
|
|
50
|
+
filters?: ReactNode;
|
|
51
|
+
/** "128 photos". */
|
|
52
|
+
count?: ReactNode;
|
|
53
|
+
/** A Segmented of grid / list / table. */
|
|
54
|
+
view?: ReactNode;
|
|
55
|
+
className?: string;
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<div role="toolbar" aria-label="Collection" className={cn("flex flex-wrap items-center gap-2", className)}>
|
|
59
|
+
{search !== undefined && <div className="flex-1 max-w-xs min-w-[min(12rem,100%)] max-sm:max-w-none max-sm:basis-full">{search}</div>}
|
|
60
|
+
{filters !== undefined && (
|
|
61
|
+
<div className="flex items-center gap-1 max-sm:-mx-1 max-sm:px-1 max-sm:max-w-full overflow-x-auto [scrollbar-width:none]">{filters}</div>
|
|
62
|
+
)}
|
|
63
|
+
<div className="flex items-center gap-3 ml-auto">
|
|
64
|
+
{count !== undefined && <span className="tabular-nums text-ink-tertiary text-sm whitespace-nowrap">{count}</span>}
|
|
65
|
+
{view}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import { useId, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Input, type InputProps } from "./input.tsx";
|
|
7
|
+
import { useEscapeFirst } from "../../hooks/use-escape-first.ts";
|
|
8
|
+
import { listSurfaceClasses, optionClasses, stepActive } from "./listbox.ts";
|
|
9
|
+
|
|
10
|
+
/* A text field that suggests as you type. Anything may be typed; the list under it,
|
|
11
|
+
as wide as the field, offers the options that contain it, those that start with
|
|
12
|
+
it first. Arrow keys move through the list, Enter takes the highlighted one,
|
|
13
|
+
Escape closes the list (and not the dialog around it).
|
|
14
|
+
|
|
15
|
+
The list opens in a layer of its own (a popover in the overlay layer), so a
|
|
16
|
+
dialog's scrolling body or a card's overflow cannot clip it. The cursor stays in
|
|
17
|
+
the field throughout.
|
|
18
|
+
|
|
19
|
+
For a free value with suggestions (a shop, a city typed before). To choose only
|
|
20
|
+
from a list, use Select; to choose several, MultiSelect.
|
|
21
|
+
|
|
22
|
+
From endgame, 2026-12-05. */
|
|
23
|
+
export function Combobox({
|
|
24
|
+
value,
|
|
25
|
+
onChange,
|
|
26
|
+
options,
|
|
27
|
+
onEnter,
|
|
28
|
+
limit = 6,
|
|
29
|
+
className,
|
|
30
|
+
onFocus,
|
|
31
|
+
onBlur,
|
|
32
|
+
onKeyDown,
|
|
33
|
+
...props
|
|
34
|
+
}: Omit<InputProps, "value" | "onChange"> & {
|
|
35
|
+
value: string;
|
|
36
|
+
onChange: (value: string) => void;
|
|
37
|
+
options: readonly string[];
|
|
38
|
+
/** Enter with nothing highlighted: the field's own submit. */
|
|
39
|
+
onEnter?: () => void;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}) {
|
|
42
|
+
const listId = useId();
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
const [at, setAt] = useState(-1);
|
|
45
|
+
|
|
46
|
+
const typed = value.trim().toLowerCase();
|
|
47
|
+
const starts = options.filter((o) => o.toLowerCase().startsWith(typed));
|
|
48
|
+
const contains = options.filter((o) => !o.toLowerCase().startsWith(typed) && o.toLowerCase().includes(typed));
|
|
49
|
+
const found = (typed === "" ? [...options] : [...starts, ...contains]).filter((o) => o.toLowerCase() !== typed).slice(0, limit);
|
|
50
|
+
const showing = open && found.length > 0;
|
|
51
|
+
// The options can change under the highlight (loaded late, filtered by someone
|
|
52
|
+
// else): one past the end is no highlight, never an undefined choice.
|
|
53
|
+
const active = at < found.length ? at : -1;
|
|
54
|
+
const optionId = (i: number) => `${listId}-${i}`;
|
|
55
|
+
const field = useRef<HTMLInputElement>(null);
|
|
56
|
+
const take = (option: string) => {
|
|
57
|
+
onChange(option);
|
|
58
|
+
setOpen(false);
|
|
59
|
+
setAt(-1);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/* Escape with the list open closes the list and nothing else. A dialog around the
|
|
63
|
+
field listens for Escape on the document as the key goes down the tree, before
|
|
64
|
+
the field hears it, so stopping it in the field's own handler is too late. The
|
|
65
|
+
window hears it first of all. (Endgame's copy closed the dialog too.) */
|
|
66
|
+
useEscapeFirst(showing, field, () => setOpen(false));
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<PopoverPrimitive.Root open={showing}>
|
|
70
|
+
<PopoverPrimitive.Anchor asChild>
|
|
71
|
+
<div className="relative">
|
|
72
|
+
<Input
|
|
73
|
+
{...props}
|
|
74
|
+
ref={field}
|
|
75
|
+
role="combobox"
|
|
76
|
+
aria-expanded={showing}
|
|
77
|
+
aria-controls={showing ? listId : undefined}
|
|
78
|
+
aria-autocomplete="list"
|
|
79
|
+
aria-activedescendant={showing && active >= 0 ? optionId(active) : undefined}
|
|
80
|
+
autoComplete="off"
|
|
81
|
+
value={value}
|
|
82
|
+
className={className}
|
|
83
|
+
onChange={(e) => {
|
|
84
|
+
onChange(e.target.value);
|
|
85
|
+
setOpen(true);
|
|
86
|
+
setAt(-1);
|
|
87
|
+
}}
|
|
88
|
+
onFocus={(e) => {
|
|
89
|
+
setOpen(true);
|
|
90
|
+
onFocus?.(e);
|
|
91
|
+
}}
|
|
92
|
+
// A click in the list keeps the focus here (it is mousedown,
|
|
93
|
+
// prevented), so a blur means the field really was left.
|
|
94
|
+
onBlur={(e) => {
|
|
95
|
+
setOpen(false);
|
|
96
|
+
onBlur?.(e);
|
|
97
|
+
}}
|
|
98
|
+
onKeyDown={(e) => {
|
|
99
|
+
onKeyDown?.(e);
|
|
100
|
+
// The Enter that finishes composing belongs to the input method.
|
|
101
|
+
if (e.defaultPrevented || e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
102
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
setOpen(true);
|
|
105
|
+
const next = stepActive(active, found.length, e.key);
|
|
106
|
+
if (next !== null) setAt(next);
|
|
107
|
+
} else if (e.key === "Enter") {
|
|
108
|
+
if (showing && active >= 0) {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
take(found[active]!);
|
|
111
|
+
} else onEnter?.();
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
</PopoverPrimitive.Anchor>
|
|
117
|
+
<PopoverPrimitive.Portal>
|
|
118
|
+
<PopoverPrimitive.Content
|
|
119
|
+
// The cursor stays in the field: nothing in the list takes focus.
|
|
120
|
+
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
121
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
122
|
+
onCloseAutoFocus={(e) => e.preventDefault()}
|
|
123
|
+
onInteractOutside={(e) => {
|
|
124
|
+
if (e.target instanceof Node && field.current?.contains(e.target)) e.preventDefault();
|
|
125
|
+
}}
|
|
126
|
+
align="start"
|
|
127
|
+
sideOffset={4}
|
|
128
|
+
collisionPadding={8}
|
|
129
|
+
className={cn("z-(--z-overlay) w-(--radix-popper-anchor-width) max-h-(--radix-popper-available-height) animate-slide-in", listSurfaceClasses)}
|
|
130
|
+
>
|
|
131
|
+
<ul id={listId} role="listbox">
|
|
132
|
+
{found.map((option, i) => (
|
|
133
|
+
<li
|
|
134
|
+
key={option}
|
|
135
|
+
id={optionId(i)}
|
|
136
|
+
role="option"
|
|
137
|
+
aria-selected={i === active}
|
|
138
|
+
data-active={i === active}
|
|
139
|
+
// mousedown, so the choice lands before the field's blur closes the list.
|
|
140
|
+
onMouseDown={(e) => {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
take(option);
|
|
143
|
+
}}
|
|
144
|
+
onMouseEnter={() => setAt(i)}
|
|
145
|
+
className={optionClasses}
|
|
146
|
+
>
|
|
147
|
+
<span className="truncate">{option}</span>
|
|
148
|
+
</li>
|
|
149
|
+
))}
|
|
150
|
+
</ul>
|
|
151
|
+
</PopoverPrimitive.Content>
|
|
152
|
+
</PopoverPrimitive.Portal>
|
|
153
|
+
</PopoverPrimitive.Root>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
4
5
|
import type { LucideIcon } from "lucide-react";
|
|
5
6
|
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { listSurfaceClasses, optionClasses } from "./listbox.ts";
|
|
6
8
|
|
|
7
9
|
export type Command = { key: string; label: string; hint?: string; icon: LucideIcon };
|
|
8
10
|
|
|
9
11
|
const HEIGHT = 320;
|
|
12
|
+
const WIDTH = 288;
|
|
13
|
+
const GAP = 6;
|
|
14
|
+
const MARGIN = 8;
|
|
15
|
+
|
|
16
|
+
/** The id of a CommandMenu's option, for the field's aria-activedescendant. */
|
|
17
|
+
export const commandOptionId = (menuId: string, index: number) => `${menuId}-option-${index}`;
|
|
10
18
|
|
|
11
19
|
/* A list of commands anchored to a point on screen, usually the text caret: the "/"
|
|
12
20
|
menu. It never takes focus. Whatever is being typed in keeps the keyboard and
|
|
13
21
|
drives the highlight, so the owner holds `index`, moves it on the arrow keys and
|
|
14
22
|
calls `onPick` on Enter. `caretRect()` in lib/rich-text-dom gives the anchor.
|
|
15
23
|
|
|
24
|
+
For a screen reader to follow the highlight, give it an `id` and put on the
|
|
25
|
+
field: aria-controls={id}, aria-expanded, and
|
|
26
|
+
aria-activedescendant={commandOptionId(id, index)}.
|
|
27
|
+
|
|
28
|
+
It is drawn at the foot of the page (a portal), so a dialog's transform or
|
|
29
|
+
overflow does not move or clip it, and kept on screen: it opens upward when
|
|
30
|
+
there is more room above, and shifts left at the window's right edge.
|
|
31
|
+
|
|
16
32
|
Filtering is the owner's too: pass the commands that match what was typed. */
|
|
17
33
|
export function CommandMenu({
|
|
34
|
+
id,
|
|
18
35
|
rect,
|
|
19
36
|
commands,
|
|
20
37
|
index,
|
|
21
38
|
onPick,
|
|
22
39
|
title,
|
|
23
40
|
}: {
|
|
41
|
+
id?: string;
|
|
24
42
|
rect: DOMRect;
|
|
25
43
|
commands: Command[];
|
|
26
44
|
index: number;
|
|
@@ -28,45 +46,57 @@ export function CommandMenu({
|
|
|
28
46
|
title?: string;
|
|
29
47
|
}) {
|
|
30
48
|
const list = useRef<HTMLDivElement>(null);
|
|
49
|
+
const [mounted, setMounted] = useState(false);
|
|
50
|
+
useLayoutEffect(() => setMounted(true), []);
|
|
31
51
|
// The keyboard moves the highlight, so the list follows it out of view.
|
|
32
52
|
useEffect(() => {
|
|
33
53
|
list.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
34
54
|
}, [index]);
|
|
35
55
|
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
56
|
+
if (!mounted) return null;
|
|
57
|
+
const below = window.innerHeight - rect.bottom - GAP - MARGIN;
|
|
58
|
+
const aboveRoom = rect.top - GAP - MARGIN;
|
|
59
|
+
const above = below < Math.min(HEIGHT, 200) && aboveRoom > below;
|
|
60
|
+
const room = Math.max(120, Math.min(HEIGHT, above ? aboveRoom : below));
|
|
61
|
+
const width = Math.min(WIDTH, window.innerWidth - MARGIN * 2);
|
|
62
|
+
const left = Math.max(MARGIN, Math.min(rect.left, window.innerWidth - width - MARGIN));
|
|
63
|
+
|
|
64
|
+
return createPortal(
|
|
39
65
|
<div
|
|
40
66
|
ref={list}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
style={{ left: rect.left, ...(above ? { bottom: window.innerHeight - rect.top + 6 } : { top: rect.bottom + 6 }) }}
|
|
44
|
-
className="fixed z-50 max-h-80 w-72 animate-slide-in overflow-y-auto rounded-overlay bg-surface-overlay p-1.5 shadow-popover"
|
|
67
|
+
style={{ left, width, maxHeight: room, ...(above ? { bottom: window.innerHeight - rect.top + GAP } : { top: rect.bottom + GAP }) }}
|
|
68
|
+
className={cn("fixed z-(--z-overlay) flex flex-col animate-slide-in", listSurfaceClasses)}
|
|
45
69
|
// Keeps the caret where it is when an entry is clicked.
|
|
46
70
|
onMouseDown={(e) => e.preventDefault()}
|
|
47
71
|
>
|
|
48
|
-
{title &&
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<span className="
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
{title && (
|
|
73
|
+
<div aria-hidden className="px-2 pt-1.5 pb-1 text-caption font-medium text-ink-tertiary">
|
|
74
|
+
{title}
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
<div role="listbox" id={id} aria-label={title ?? "Commands"}>
|
|
78
|
+
{commands.map((command, i) => (
|
|
79
|
+
<div
|
|
80
|
+
key={command.key}
|
|
81
|
+
id={id ? commandOptionId(id, i) : undefined}
|
|
82
|
+
role="option"
|
|
83
|
+
aria-selected={i === index}
|
|
84
|
+
data-active={i === index}
|
|
85
|
+
onClick={() => onPick(command)}
|
|
86
|
+
// A taller row: an icon tile and a line of hint under the name.
|
|
87
|
+
className={cn(optionClasses, "h-auto gap-2.5 py-1.5 hover:bg-tint-hover")}
|
|
88
|
+
>
|
|
89
|
+
<span aria-hidden className="flex size-9 shrink-0 items-center justify-center rounded-control bg-surface shadow-xs">
|
|
90
|
+
<command.icon className="size-4 text-ink-secondary" />
|
|
91
|
+
</span>
|
|
92
|
+
<span className="min-w-0">
|
|
93
|
+
<span className="block text-sm">{command.label}</span>
|
|
94
|
+
{command.hint && <span className="block truncate text-caption text-ink-tertiary">{command.hint}</span>}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>,
|
|
100
|
+
document.body,
|
|
71
101
|
);
|
|
72
102
|
}
|