@kujoforall/paper-ui 0.0.0-stage → 0.2.0
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 +93 -0
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/dist/components/editor/block-text.d.ts +8 -0
- package/dist/components/editor/block-text.d.ts.map +1 -0
- package/dist/components/editor/block-text.js +248 -0
- package/dist/components/editor/block-text.js.map +1 -0
- package/dist/components/editor/blocks.d.ts +33 -0
- package/dist/components/editor/blocks.d.ts.map +1 -0
- package/dist/components/editor/blocks.js +191 -0
- package/dist/components/editor/blocks.js.map +1 -0
- package/dist/components/editor/document-editor.d.ts +27 -0
- package/dist/components/editor/document-editor.d.ts.map +1 -0
- package/dist/components/editor/document-editor.js +42 -0
- package/dist/components/editor/document-editor.js.map +1 -0
- package/dist/components/editor/document-view.d.ts +22 -0
- package/dist/components/editor/document-view.d.ts.map +1 -0
- package/dist/components/editor/document-view.js +110 -0
- package/dist/components/editor/document-view.js.map +1 -0
- package/dist/components/editor/editor-state.d.ts +107 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -0
- package/dist/components/editor/editor-state.js +217 -0
- package/dist/components/editor/editor-state.js.map +1 -0
- 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 +8 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
- package/dist/components/editor/extensions/spoiler.js +36 -0
- package/dist/components/editor/extensions/spoiler.js.map +1 -0
- package/dist/components/editor/index.d.ts +10 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +10 -0
- package/dist/components/editor/index.js.map +1 -0
- package/dist/components/editor/kinds.d.ts +99 -0
- package/dist/components/editor/kinds.d.ts.map +1 -0
- package/dist/components/editor/kinds.js +74 -0
- package/dist/components/editor/kinds.js.map +1 -0
- 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/sketch/rough.d.ts +38 -0
- package/dist/components/sketch/rough.d.ts.map +1 -0
- package/dist/components/sketch/rough.js +57 -0
- package/dist/components/sketch/rough.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.d.ts +2 -0
- package/dist/components/ui/accent-picker.d.ts.map +1 -0
- package/dist/components/ui/accent-picker.js +44 -0
- package/dist/components/ui/accent-picker.js.map +1 -0
- package/dist/components/ui/address-field.d.ts +10 -0
- package/dist/components/ui/address-field.d.ts.map +1 -0
- package/dist/components/ui/address-field.js +24 -0
- package/dist/components/ui/address-field.js.map +1 -0
- 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 +26 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -0
- package/dist/components/ui/app-shell.js +71 -0
- package/dist/components/ui/app-shell.js.map +1 -0
- 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 +19 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +62 -0
- package/dist/components/ui/badge.js.map +1 -0
- 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.d.ts +10 -0
- package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
- package/dist/components/ui/breadcrumbs.js +9 -0
- package/dist/components/ui/breadcrumbs.js.map +1 -0
- package/dist/components/ui/button.d.ts +15 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +110 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +5 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +65 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/callout.d.ts +32 -0
- package/dist/components/ui/callout.d.ts.map +1 -0
- package/dist/components/ui/callout.js +40 -0
- package/dist/components/ui/callout.js.map +1 -0
- package/dist/components/ui/card.d.ts +18 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +28 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +11 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +30 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- 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 +18 -0
- package/dist/components/ui/command-menu.d.ts.map +1 -0
- package/dist/components/ui/command-menu.js +49 -0
- package/dist/components/ui/command-menu.js.map +1 -0
- 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 +40 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +64 -0
- package/dist/components/ui/date-picker.js.map +1 -0
- package/dist/components/ui/date-time-picker.d.ts +21 -0
- package/dist/components/ui/date-time-picker.d.ts.map +1 -0
- package/dist/components/ui/date-time-picker.js +34 -0
- package/dist/components/ui/date-time-picker.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +21 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +63 -0
- package/dist/components/ui/dialog.js.map +1 -0
- 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 +24 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +65 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/editable-text.d.ts +24 -0
- package/dist/components/ui/editable-text.d.ts.map +1 -0
- package/dist/components/ui/editable-text.js +85 -0
- package/dist/components/ui/editable-text.js.map +1 -0
- 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 +15 -0
- package/dist/components/ui/field-button.d.ts.map +1 -0
- package/dist/components/ui/field-button.js +18 -0
- package/dist/components/ui/field-button.js.map +1 -0
- package/dist/components/ui/file-preview.d.ts +5 -0
- package/dist/components/ui/file-preview.d.ts.map +1 -0
- package/dist/components/ui/file-preview.js +66 -0
- package/dist/components/ui/file-preview.js.map +1 -0
- package/dist/components/ui/file-uploader.d.ts +39 -0
- package/dist/components/ui/file-uploader.d.ts.map +1 -0
- package/dist/components/ui/file-uploader.js +111 -0
- package/dist/components/ui/file-uploader.js.map +1 -0
- 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 +25 -0
- package/dist/components/ui/handle-row.d.ts.map +1 -0
- package/dist/components/ui/handle-row.js +110 -0
- package/dist/components/ui/handle-row.js.map +1 -0
- 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.d.ts +31 -0
- package/dist/components/ui/image-block.d.ts.map +1 -0
- package/dist/components/ui/image-block.js +103 -0
- package/dist/components/ui/image-block.js.map +1 -0
- package/dist/components/ui/image-card.d.ts +17 -0
- package/dist/components/ui/image-card.d.ts.map +1 -0
- package/dist/components/ui/image-card.js +39 -0
- package/dist/components/ui/image-card.js.map +1 -0
- 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 +31 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -0
- package/dist/components/ui/image-viewer.js +114 -0
- package/dist/components/ui/image-viewer.js.map +1 -0
- package/dist/components/ui/image.d.ts +33 -0
- package/dist/components/ui/image.d.ts.map +1 -0
- package/dist/components/ui/image.js +61 -0
- package/dist/components/ui/image.js.map +1 -0
- package/dist/components/ui/index.d.ts +92 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +92 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/input.d.ts +75 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +245 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/link-block.d.ts +13 -0
- package/dist/components/ui/link-block.d.ts.map +1 -0
- package/dist/components/ui/link-block.js +21 -0
- package/dist/components/ui/link-block.js.map +1 -0
- 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.d.ts +15 -0
- package/dist/components/ui/mac-card.d.ts.map +1 -0
- package/dist/components/ui/mac-card.js +9 -0
- package/dist/components/ui/mac-card.js.map +1 -0
- 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 +16 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -0
- package/dist/components/ui/nav-tree.js +41 -0
- package/dist/components/ui/nav-tree.js.map +1 -0
- package/dist/components/ui/page.d.ts +23 -0
- package/dist/components/ui/page.d.ts.map +1 -0
- package/dist/components/ui/page.js +28 -0
- package/dist/components/ui/page.js.map +1 -0
- 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 +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +19 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +22 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/property.d.ts +11 -0
- package/dist/components/ui/property.d.ts.map +1 -0
- package/dist/components/ui/property.js +18 -0
- package/dist/components/ui/property.js.map +1 -0
- 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 +21 -0
- package/dist/components/ui/segmented.d.ts.map +1 -0
- package/dist/components/ui/segmented.js +12 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/select-menu.d.ts +12 -0
- package/dist/components/ui/select-menu.d.ts.map +1 -0
- package/dist/components/ui/select-menu.js +10 -0
- package/dist/components/ui/select-menu.js.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +45 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/selection-bar.d.ts +12 -0
- package/dist/components/ui/selection-bar.d.ts.map +1 -0
- package/dist/components/ui/selection-bar.js +15 -0
- package/dist/components/ui/selection-bar.js.map +1 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +12 -0
- package/dist/components/ui/separator.js.map +1 -0
- 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 +23 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -0
- package/dist/components/ui/spotlight.js +110 -0
- package/dist/components/ui/spotlight.js.map +1 -0
- package/dist/components/ui/stat-tile.d.ts +8 -0
- package/dist/components/ui/stat-tile.d.ts.map +1 -0
- package/dist/components/ui/stat-tile.js +9 -0
- package/dist/components/ui/stat-tile.js.map +1 -0
- package/dist/components/ui/step-dialog.d.ts +20 -0
- package/dist/components/ui/step-dialog.d.ts.map +1 -0
- package/dist/components/ui/step-dialog.js +36 -0
- package/dist/components/ui/step-dialog.js.map +1 -0
- 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 +16 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +76 -0
- package/dist/components/ui/table.js.map +1 -0
- 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 +16 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +65 -0
- package/dist/components/ui/theme-toggle.js.map +1 -0
- 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 +47 -0
- package/dist/components/ui/time-picker.d.ts.map +1 -0
- package/dist/components/ui/time-picker.js +141 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- 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 +15 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +32 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- 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 +40 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/components/ui/typography.js +98 -0
- package/dist/components/ui/typography.js.map +1 -0
- package/dist/components/ui/video-block.d.ts +14 -0
- package/dist/components/ui/video-block.d.ts.map +1 -0
- package/dist/components/ui/video-block.js +22 -0
- package/dist/components/ui/video-block.js.map +1 -0
- 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 +13 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -0
- package/dist/hooks/use-save-queue.js +57 -0
- package/dist/hooks/use-save-queue.js.map +1 -0
- package/dist/hooks/use-selection.d.ts +10 -0
- package/dist/hooks/use-selection.d.ts.map +1 -0
- package/dist/hooks/use-selection.js +52 -0
- package/dist/hooks/use-selection.js.map +1 -0
- package/dist/hooks/use-shared-transition.d.ts +3 -0
- package/dist/hooks/use-shared-transition.d.ts.map +1 -0
- package/dist/hooks/use-shared-transition.js +38 -0
- package/dist/hooks/use-shared-transition.js.map +1 -0
- package/dist/hooks/use-upload-queue.d.ts +22 -0
- package/dist/hooks/use-upload-queue.d.ts.map +1 -0
- package/dist/hooks/use-upload-queue.js +78 -0
- package/dist/hooks/use-upload-queue.js.map +1 -0
- package/dist/lib/accent.d.ts +5 -0
- package/dist/lib/accent.d.ts.map +1 -0
- package/dist/lib/accent.js +10 -0
- package/dist/lib/accent.js.map +1 -0
- package/dist/lib/bento.d.ts +17 -0
- package/dist/lib/bento.d.ts.map +1 -0
- package/dist/lib/bento.js +92 -0
- package/dist/lib/bento.js.map +1 -0
- 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 +30 -0
- package/dist/lib/dates.d.ts.map +1 -0
- package/dist/lib/dates.js +61 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/document.d.ts +79 -0
- package/dist/lib/document.d.ts.map +1 -0
- package/dist/lib/document.js +11 -0
- package/dist/lib/document.js.map +1 -0
- package/dist/lib/embed.d.ts +14 -0
- package/dist/lib/embed.d.ts.map +1 -0
- package/dist/lib/embed.js +63 -0
- package/dist/lib/embed.js.map +1 -0
- package/dist/lib/files.d.ts +23 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/files.js +69 -0
- package/dist/lib/files.js.map +1 -0
- package/dist/lib/justified.d.ts +50 -0
- package/dist/lib/justified.d.ts.map +1 -0
- package/dist/lib/justified.js +78 -0
- package/dist/lib/justified.js.map +1 -0
- 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 +16 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -0
- package/dist/lib/rich-text-dom.js +145 -0
- package/dist/lib/rich-text-dom.js.map +1 -0
- package/dist/lib/rich-text.d.ts +15 -0
- package/dist/lib/rich-text.d.ts.map +1 -0
- package/dist/lib/rich-text.js +35 -0
- package/dist/lib/rich-text.js.map +1 -0
- package/dist/lib/spotlight.d.ts +22 -0
- package/dist/lib/spotlight.d.ts.map +1 -0
- package/dist/lib/spotlight.js +66 -0
- package/dist/lib/spotlight.js.map +1 -0
- 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/tree.d.ts +17 -0
- package/dist/lib/tree.d.ts.map +1 -0
- package/dist/lib/tree.js +35 -0
- package/dist/lib/tree.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +24 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles/notion.css +817 -0
- package/package.json +129 -5
- package/src/components/editor/block-text.tsx +271 -0
- package/src/components/editor/blocks.tsx +373 -0
- package/src/components/editor/document-editor.tsx +106 -0
- package/src/components/editor/document-view.tsx +205 -0
- package/src/components/editor/editor-state.tsx +298 -0
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +81 -0
- package/src/components/editor/index.ts +10 -0
- package/src/components/editor/kinds.ts +158 -0
- package/src/components/editor/look.tsx +36 -0
- package/src/components/sketch/rough.tsx +90 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +72 -0
- package/src/components/ui/address-field.tsx +57 -0
- 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 +140 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +81 -0
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +25 -0
- package/src/components/ui/button.tsx +147 -0
- package/src/components/ui/calendar.tsx +101 -0
- package/src/components/ui/callout.tsx +61 -0
- package/src/components/ui/card.tsx +59 -0
- package/src/components/ui/checkbox.tsx +66 -0
- 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 +102 -0
- 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 +208 -0
- package/src/components/ui/date-time-picker.tsx +123 -0
- package/src/components/ui/dialog.tsx +151 -0
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +185 -0
- package/src/components/ui/editable-text.tsx +142 -0
- 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 +70 -0
- package/src/components/ui/file-preview.tsx +80 -0
- package/src/components/ui/file-uploader.tsx +375 -0
- 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 +252 -0
- 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 +238 -0
- package/src/components/ui/image-card.tsx +95 -0
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +230 -0
- package/src/components/ui/image.tsx +200 -0
- package/src/components/ui/index.ts +178 -0
- package/src/components/ui/input.tsx +471 -0
- package/src/components/ui/link-block.tsx +85 -0
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +46 -0
- 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 +92 -0
- package/src/components/ui/page.tsx +73 -0
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +42 -0
- package/src/components/ui/progress.tsx +76 -0
- package/src/components/ui/property.tsx +33 -0
- 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 +74 -0
- package/src/components/ui/select-menu.tsx +54 -0
- package/src/components/ui/select.tsx +147 -0
- package/src/components/ui/selection-bar.tsx +50 -0
- package/src/components/ui/separator.tsx +30 -0
- 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 +222 -0
- package/src/components/ui/stat-tile.tsx +25 -0
- package/src/components/ui/step-dialog.tsx +104 -0
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +99 -0
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +80 -0
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +344 -0
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +78 -0
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +204 -0
- package/src/components/ui/video-block.tsx +66 -0
- 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 +78 -0
- package/src/hooks/use-selection.ts +51 -0
- package/src/hooks/use-shared-transition.ts +40 -0
- package/src/hooks/use-upload-queue.ts +111 -0
- package/src/lib/accent.ts +11 -0
- package/src/lib/bento.ts +87 -0
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +75 -0
- package/src/lib/document.ts +55 -0
- package/src/lib/embed.ts +62 -0
- package/src/lib/files.ts +73 -0
- package/src/lib/justified.ts +106 -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 +138 -0
- package/src/lib/rich-text.ts +50 -0
- package/src/lib/spotlight.ts +78 -0
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/tree.ts +41 -0
- package/src/lib/utils.ts +25 -0
- package/src/styles/notion.css +817 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ArrowDownWideNarrow, ListFilter, Plus, X } from "lucide-react";
|
|
4
|
+
import { useId, useRef, type ReactNode } from "react";
|
|
5
|
+
import { needsValue, newFilter, OPS, type Filter, type FilterOp, type Match, type Property, type Sort } from "../../lib/database.ts";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { Badge } from "./badge.tsx";
|
|
8
|
+
import { Button } from "./button.tsx";
|
|
9
|
+
import { DatePicker } from "./date-picker.tsx";
|
|
10
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.tsx";
|
|
11
|
+
import { Input, NumberInput } from "./input.tsx";
|
|
12
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.tsx";
|
|
13
|
+
import { SelectMenu } from "./select-menu.tsx";
|
|
14
|
+
|
|
15
|
+
/* Narrowing and ordering any list by its properties (lib/database's Property):
|
|
16
|
+
FilterBuilder and SortBuilder, and FilterButton and SortButton that open them
|
|
17
|
+
from a toolbar. Each filter reads as a sentence, Notion's way: "Where Status is
|
|
18
|
+
Done", "and Price > 100". A filter missing its value lets everything through,
|
|
19
|
+
so one being written never empties the list. The value is asked for in the
|
|
20
|
+
property's own kind of field: words, a number, a date, an option. */
|
|
21
|
+
|
|
22
|
+
const fieldClass = "h-control-sm rounded-control bg-tint-hover px-1.5 text-sm";
|
|
23
|
+
let nextId = 0;
|
|
24
|
+
const freshId = () => `f${Date.now().toString(36)}${(nextId++).toString(36)}`;
|
|
25
|
+
|
|
26
|
+
function AddProperty({ properties, label, onPick }: { properties: readonly Property[]; label: string; onPick: (p: Property) => void }) {
|
|
27
|
+
return (
|
|
28
|
+
<DropdownMenu>
|
|
29
|
+
<DropdownMenuTrigger asChild>
|
|
30
|
+
<Button variant="ghost" size="sm" className="self-start text-ink-secondary">
|
|
31
|
+
<Plus /> {label}
|
|
32
|
+
</Button>
|
|
33
|
+
</DropdownMenuTrigger>
|
|
34
|
+
<DropdownMenuContent align="start">
|
|
35
|
+
{properties.map((p) => (
|
|
36
|
+
<DropdownMenuItem key={p.id} onSelect={() => onPick(p)}>
|
|
37
|
+
{p.name}
|
|
38
|
+
</DropdownMenuItem>
|
|
39
|
+
))}
|
|
40
|
+
</DropdownMenuContent>
|
|
41
|
+
</DropdownMenu>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ValueField({ property, filter, onChange }: { property: Property; filter: Filter; onChange: (value: Filter["value"]) => void }) {
|
|
46
|
+
const label = `${property.name}: value`;
|
|
47
|
+
switch (property.type) {
|
|
48
|
+
case "number":
|
|
49
|
+
return (
|
|
50
|
+
<NumberInput
|
|
51
|
+
size="sm"
|
|
52
|
+
aria-label={label}
|
|
53
|
+
value={typeof filter.value === "number" ? filter.value : undefined}
|
|
54
|
+
onChange={(v) => onChange(v ?? null)}
|
|
55
|
+
className="w-24"
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
case "date":
|
|
59
|
+
// A field fills its row; in a sentence it takes a date's width.
|
|
60
|
+
return (
|
|
61
|
+
<div className="w-44">
|
|
62
|
+
<DatePicker aria-label={label} value={typeof filter.value === "string" ? filter.value : null} onChange={onChange} />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
case "checkbox":
|
|
66
|
+
return (
|
|
67
|
+
<SelectMenu
|
|
68
|
+
label={label}
|
|
69
|
+
value={filter.value === false ? "unchecked" : "checked"}
|
|
70
|
+
options={["checked", "unchecked"] as const}
|
|
71
|
+
render={(v) => (v === "checked" ? "Checked" : "Unchecked")}
|
|
72
|
+
onChange={(v) => onChange(v === "checked")}
|
|
73
|
+
className={fieldClass}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
case "select":
|
|
77
|
+
case "multiSelect": {
|
|
78
|
+
const options = property.options ?? [];
|
|
79
|
+
const chosen = Array.isArray(filter.value) ? filter.value[0] : typeof filter.value === "string" ? filter.value : undefined;
|
|
80
|
+
const ids = ["", ...options.map((o) => o.id)];
|
|
81
|
+
return (
|
|
82
|
+
<SelectMenu
|
|
83
|
+
label={label}
|
|
84
|
+
value={chosen ?? ""}
|
|
85
|
+
options={ids}
|
|
86
|
+
render={(id) => {
|
|
87
|
+
const o = options.find((x) => x.id === id);
|
|
88
|
+
return o ? <Badge color={o.color}>{o.name}</Badge> : <span className="text-ink-tertiary">Choose…</span>;
|
|
89
|
+
}}
|
|
90
|
+
onChange={(id) => onChange(id === "" ? null : property.type === "multiSelect" ? [id] : id)}
|
|
91
|
+
className={fieldClass}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
default:
|
|
96
|
+
return <Input size="sm" aria-label={label} placeholder="Value" value={typeof filter.value === "string" ? filter.value : ""} onChange={(e) => onChange(e.target.value)} className="w-40 max-w-full" />;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function FilterBuilder({
|
|
101
|
+
properties,
|
|
102
|
+
filters,
|
|
103
|
+
onChange,
|
|
104
|
+
match = "all",
|
|
105
|
+
onMatchChange,
|
|
106
|
+
className,
|
|
107
|
+
}: {
|
|
108
|
+
properties: readonly Property[];
|
|
109
|
+
filters: readonly Filter[];
|
|
110
|
+
onChange: (filters: Filter[]) => void;
|
|
111
|
+
match?: Match;
|
|
112
|
+
onMatchChange?: (match: Match) => void;
|
|
113
|
+
className?: string;
|
|
114
|
+
}) {
|
|
115
|
+
const byId = new Map(properties.map((p) => [p.id, p]));
|
|
116
|
+
const list = useRef<HTMLDivElement>(null);
|
|
117
|
+
const add = useRef<HTMLDivElement>(null);
|
|
118
|
+
const set = (i: number, patch: Partial<Filter>) => onChange(filters.map((f, k) => (k === i ? { ...f, ...patch } : f)));
|
|
119
|
+
return (
|
|
120
|
+
<div className={cn("flex flex-col gap-2", className)}>
|
|
121
|
+
{filters.length === 0 && <p className="px-1 text-ink-tertiary text-sm">No filters. Everything shows.</p>}
|
|
122
|
+
<div ref={list} role="list" aria-label="Filters" className="flex flex-col gap-2">
|
|
123
|
+
{filters.map((filter, i) => {
|
|
124
|
+
const property = byId.get(filter.property);
|
|
125
|
+
if (!property)
|
|
126
|
+
// A filter on a property since deleted: shown, so it can be removed.
|
|
127
|
+
return (
|
|
128
|
+
<div key={filter.id} role="listitem" className="flex items-center gap-1.5 text-ink-tertiary text-sm">
|
|
129
|
+
<span className="w-14 shrink-0">{i === 0 ? "Where" : match === "all" ? "And" : "Or"}</span>
|
|
130
|
+
A deleted property
|
|
131
|
+
<Button variant="ghost" size="icon-sm" aria-label="Remove the filter on a deleted property" onClick={() => onChange(filters.filter((_, k) => k !== i))}>
|
|
132
|
+
<X />
|
|
133
|
+
</Button>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
const ops = OPS[property.type];
|
|
137
|
+
return (
|
|
138
|
+
<div key={filter.id} role="listitem" className="flex flex-wrap items-center gap-1.5">
|
|
139
|
+
<span className="w-14 text-ink-secondary text-sm shrink-0">
|
|
140
|
+
{i === 0 ? (
|
|
141
|
+
"Where"
|
|
142
|
+
) : i === 1 && onMatchChange ? (
|
|
143
|
+
<SelectMenu
|
|
144
|
+
label="Match"
|
|
145
|
+
value={match}
|
|
146
|
+
options={["all", "any"] as const}
|
|
147
|
+
render={(m) => (m === "all" ? "And" : "Or")}
|
|
148
|
+
onChange={onMatchChange}
|
|
149
|
+
className="-ml-1.5"
|
|
150
|
+
/>
|
|
151
|
+
) : match === "all" ? (
|
|
152
|
+
"And"
|
|
153
|
+
) : (
|
|
154
|
+
"Or"
|
|
155
|
+
)}
|
|
156
|
+
</span>
|
|
157
|
+
<SelectMenu
|
|
158
|
+
label="Property"
|
|
159
|
+
value={property.id}
|
|
160
|
+
options={properties.map((p) => p.id)}
|
|
161
|
+
render={(id) => byId.get(id)?.name ?? id}
|
|
162
|
+
onChange={(id) => {
|
|
163
|
+
const next = byId.get(id);
|
|
164
|
+
if (next) set(i, { ...newFilter(next, filter.id) });
|
|
165
|
+
}}
|
|
166
|
+
className={fieldClass}
|
|
167
|
+
/>
|
|
168
|
+
<SelectMenu
|
|
169
|
+
label="Condition"
|
|
170
|
+
value={filter.op}
|
|
171
|
+
options={ops.map((o) => o.op) as FilterOp[]}
|
|
172
|
+
render={(op) => ops.find((o) => o.op === op)?.label ?? op}
|
|
173
|
+
onChange={(op) => set(i, { op })}
|
|
174
|
+
className={fieldClass}
|
|
175
|
+
/>
|
|
176
|
+
{needsValue(filter.op) && <ValueField property={property} filter={filter} onChange={(value) => set(i, { value })} />}
|
|
177
|
+
<Button
|
|
178
|
+
variant="ghost"
|
|
179
|
+
size="icon-sm"
|
|
180
|
+
aria-label={`Remove the filter on ${property.name}`}
|
|
181
|
+
className="text-ink-tertiary"
|
|
182
|
+
onClick={() => {
|
|
183
|
+
onChange(filters.filter((_, k) => k !== i));
|
|
184
|
+
// Focus stays in the list rather than falling to the page.
|
|
185
|
+
requestAnimationFrame(() => add.current?.querySelector<HTMLElement>("button")?.focus());
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
<X />
|
|
189
|
+
</Button>
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
})}
|
|
193
|
+
</div>
|
|
194
|
+
<div ref={add}>
|
|
195
|
+
<AddProperty properties={properties} label="Add a filter" onPick={(p) => onChange([...filters, newFilter(p, freshId())])} />
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function SortBuilder({
|
|
202
|
+
properties,
|
|
203
|
+
sorts,
|
|
204
|
+
onChange,
|
|
205
|
+
className,
|
|
206
|
+
}: {
|
|
207
|
+
properties: readonly Property[];
|
|
208
|
+
sorts: readonly Sort[];
|
|
209
|
+
onChange: (sorts: Sort[]) => void;
|
|
210
|
+
className?: string;
|
|
211
|
+
}) {
|
|
212
|
+
const byId = new Map(properties.map((p) => [p.id, p]));
|
|
213
|
+
const unused = properties.filter((p) => !sorts.some((s) => s.property === p.id));
|
|
214
|
+
const set = (i: number, patch: Partial<Sort>) => onChange(sorts.map((s, k) => (k === i ? { ...s, ...patch } : s)));
|
|
215
|
+
return (
|
|
216
|
+
<div className={cn("flex flex-col gap-2", className)}>
|
|
217
|
+
{sorts.length === 0 && <p className="px-1 text-ink-tertiary text-sm">No sorts. In the order they were added.</p>}
|
|
218
|
+
<ol aria-label="Sorts, first applied first" className="flex flex-col gap-2">
|
|
219
|
+
{sorts.map((sort, i) => {
|
|
220
|
+
const property = byId.get(sort.property);
|
|
221
|
+
if (!property)
|
|
222
|
+
return (
|
|
223
|
+
<li key={i} className="flex items-center gap-1.5 text-ink-tertiary text-sm">
|
|
224
|
+
<span className="w-14 shrink-0">{i === 0 ? "Sort by" : "then"}</span>
|
|
225
|
+
A deleted property
|
|
226
|
+
<Button variant="ghost" size="icon-sm" aria-label="Remove the sort by a deleted property" onClick={() => onChange(sorts.filter((_, k) => k !== i))}>
|
|
227
|
+
<X />
|
|
228
|
+
</Button>
|
|
229
|
+
</li>
|
|
230
|
+
);
|
|
231
|
+
return (
|
|
232
|
+
// By place, not property: changing a sort's property keeps its row (and focus).
|
|
233
|
+
<li key={i} className="flex flex-wrap items-center gap-1.5">
|
|
234
|
+
<span className="w-14 text-ink-secondary text-sm shrink-0">{i === 0 ? "Sort by" : "then"}</span>
|
|
235
|
+
<SelectMenu
|
|
236
|
+
label="Property"
|
|
237
|
+
value={property.id}
|
|
238
|
+
// Its own property, and those not yet sorted by.
|
|
239
|
+
options={[property.id, ...unused.map((p) => p.id)]}
|
|
240
|
+
render={(id) => byId.get(id)?.name ?? id}
|
|
241
|
+
onChange={(id) => set(i, { property: id })}
|
|
242
|
+
className={fieldClass}
|
|
243
|
+
/>
|
|
244
|
+
<SelectMenu
|
|
245
|
+
label="Direction"
|
|
246
|
+
value={sort.direction}
|
|
247
|
+
options={["asc", "desc"] as const}
|
|
248
|
+
render={(d) => (d === "asc" ? "Ascending" : "Descending")}
|
|
249
|
+
onChange={(direction) => set(i, { direction })}
|
|
250
|
+
className={fieldClass}
|
|
251
|
+
/>
|
|
252
|
+
<Button variant="ghost" size="icon-sm" aria-label={`Remove the sort by ${property.name}`} className="text-ink-tertiary" onClick={() => onChange(sorts.filter((_, k) => k !== i))}>
|
|
253
|
+
<X />
|
|
254
|
+
</Button>
|
|
255
|
+
</li>
|
|
256
|
+
);
|
|
257
|
+
})}
|
|
258
|
+
</ol>
|
|
259
|
+
{unused.length > 0 && <AddProperty properties={unused} label="Add a sort" onPick={(p) => onChange([...sorts, { property: p.id, direction: "asc" }])} />}
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* A toolbar button that opens a builder in a popover, saying how many are set. */
|
|
265
|
+
function CountButton({ icon, label, count, children }: { icon: ReactNode; label: string; count: number; children: ReactNode }) {
|
|
266
|
+
const id = useId();
|
|
267
|
+
return (
|
|
268
|
+
<Popover>
|
|
269
|
+
<PopoverTrigger asChild>
|
|
270
|
+
<Button variant="ghost" size="sm" aria-describedby={count > 0 ? id : undefined} className={cn(count > 0 && "text-accent-text")}>
|
|
271
|
+
{icon}
|
|
272
|
+
{label}
|
|
273
|
+
{count > 0 && (
|
|
274
|
+
<span id={id} className="tabular-nums">
|
|
275
|
+
<span className="sr-only">, </span>
|
|
276
|
+
{count}
|
|
277
|
+
<span className="sr-only"> set</span>
|
|
278
|
+
</span>
|
|
279
|
+
)}
|
|
280
|
+
</Button>
|
|
281
|
+
</PopoverTrigger>
|
|
282
|
+
{/* As wide as its sentences, no wider; on a phone it wraps within the screen. */}
|
|
283
|
+
<PopoverContent align="start" className="p-3 w-max max-w-[calc(100vw-2rem)]">
|
|
284
|
+
{children}
|
|
285
|
+
</PopoverContent>
|
|
286
|
+
</Popover>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function FilterButton(props: Parameters<typeof FilterBuilder>[0]) {
|
|
291
|
+
return (
|
|
292
|
+
<CountButton icon={<ListFilter />} label="Filter" count={props.filters.length}>
|
|
293
|
+
<FilterBuilder {...props} />
|
|
294
|
+
</CountButton>
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function SortButton(props: Parameters<typeof SortBuilder>[0]) {
|
|
299
|
+
return (
|
|
300
|
+
<CountButton icon={<ArrowDownWideNarrow />} label="Sort" count={props.sorts.length}>
|
|
301
|
+
<SortBuilder {...props} />
|
|
302
|
+
</CountButton>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* The focus shell (docs/parts/layouts.md): no navigation, one task. The app's mark
|
|
5
|
+
at the top, a way out opposite it (Back, Cancel, Sign in), the task in a narrow
|
|
6
|
+
column in the middle of the room, and a quiet footer for the small print. For
|
|
7
|
+
signing in or up, onboarding, a checkout, a link to one shared thing.
|
|
8
|
+
|
|
9
|
+
`aside` splits the window from 64rem: the task on one side, artwork or a pitch on
|
|
10
|
+
the other. Below 64rem the aside is left out: on a phone the task is the page. */
|
|
11
|
+
export function FocusShell({
|
|
12
|
+
brand,
|
|
13
|
+
exit,
|
|
14
|
+
footer,
|
|
15
|
+
aside,
|
|
16
|
+
width = "sm",
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
}: {
|
|
20
|
+
brand?: ReactNode;
|
|
21
|
+
/** The way out, top right. */
|
|
22
|
+
exit?: ReactNode;
|
|
23
|
+
footer?: ReactNode;
|
|
24
|
+
/** Artwork or a pitch beside the task, from 64rem. */
|
|
25
|
+
aside?: ReactNode;
|
|
26
|
+
/** sm 24rem (a sign-in), md 28rem (a longer form). */
|
|
27
|
+
width?: "sm" | "md";
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
}) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn("flex bg-surface min-h-dvh", className)}>
|
|
33
|
+
<div className="flex flex-col flex-1 min-w-0">
|
|
34
|
+
<header className="flex justify-between items-center gap-3 px-5 sm:px-8 h-14 shrink-0">
|
|
35
|
+
<div className="flex items-center min-w-0">{brand}</div>
|
|
36
|
+
{exit !== undefined && <div className="flex items-center shrink-0">{exit}</div>}
|
|
37
|
+
</header>
|
|
38
|
+
<main className="flex flex-1 justify-center items-center px-5 sm:px-8 py-10">
|
|
39
|
+
<div className={cn("w-full", width === "sm" ? "max-w-sm" : "max-w-md")}>{children}</div>
|
|
40
|
+
</main>
|
|
41
|
+
{footer !== undefined && (
|
|
42
|
+
<footer className="flex flex-wrap justify-center gap-x-4 gap-y-1 px-5 py-4 text-caption text-ink-tertiary [&_a]:link">{footer}</footer>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
{aside !== undefined && <aside className="hidden lg:block relative bg-surface-sunken w-[45%] max-w-3xl overflow-hidden shrink-0">{aside}</aside>}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DndContext,
|
|
5
|
+
MouseSensor,
|
|
6
|
+
pointerWithin,
|
|
7
|
+
TouchSensor,
|
|
8
|
+
useDraggable,
|
|
9
|
+
useDroppable,
|
|
10
|
+
useSensor,
|
|
11
|
+
useSensors,
|
|
12
|
+
type DragEndEvent,
|
|
13
|
+
type DragMoveEvent,
|
|
14
|
+
type DragStartEvent,
|
|
15
|
+
} from "@dnd-kit/core";
|
|
16
|
+
import { ArrowDown, ArrowUp, GripVertical, Plus } from "lucide-react";
|
|
17
|
+
import { createContext, useContext, useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
18
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.tsx";
|
|
19
|
+
import { flushSync } from "react-dom";
|
|
20
|
+
import { cn } from "../../lib/utils.ts";
|
|
21
|
+
|
|
22
|
+
const control =
|
|
23
|
+
"flex h-6 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-(--duration-fast) hover:bg-tint-hover [&_svg]:size-4";
|
|
24
|
+
|
|
25
|
+
export type DropSide = "before" | "after";
|
|
26
|
+
|
|
27
|
+
type RowHandlers = {
|
|
28
|
+
onDragStart?: () => void;
|
|
29
|
+
onDragEnd?: () => void;
|
|
30
|
+
onDragOverSide?: (side: DropSide) => void;
|
|
31
|
+
onDrop?: () => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* The rows of one list (or tree) that can be dragged among each other. Each
|
|
35
|
+
HandleRow inside registers its handlers here, and the drag (dnd-kit's) calls
|
|
36
|
+
them: the row picked up, the half of the row under the pointer, the drop.
|
|
37
|
+
|
|
38
|
+
With a mouse a drag starts once the grip has moved 4px, so a click still opens
|
|
39
|
+
the grip's menu. On a touch screen it starts after a short press on the grip,
|
|
40
|
+
so a swipe over the page still scrolls it. The page scrolls on its own near
|
|
41
|
+
its edges while dragging. */
|
|
42
|
+
const Rows = createContext<Map<string, { current: RowHandlers }> | null>(null);
|
|
43
|
+
|
|
44
|
+
export function DragRows({ children }: { children: ReactNode }) {
|
|
45
|
+
const rows = useMemo(() => new Map<string, { current: RowHandlers }>(), []);
|
|
46
|
+
const dragged = useRef<string | null>(null);
|
|
47
|
+
const lastOver = useRef<{ id: string; side: DropSide } | null>(null);
|
|
48
|
+
const sensors = useSensors(
|
|
49
|
+
useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),
|
|
50
|
+
useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const pointerY = (e: DragMoveEvent | DragEndEvent) => {
|
|
54
|
+
const start = e.activatorEvent as MouseEvent | TouchEvent;
|
|
55
|
+
const y = "touches" in start ? (start.touches[0]?.clientY ?? 0) : start.clientY;
|
|
56
|
+
return y + e.delta.y;
|
|
57
|
+
};
|
|
58
|
+
const onMove = (e: DragMoveEvent) => {
|
|
59
|
+
const over = e.over;
|
|
60
|
+
if (!over || over.id === dragged.current) return;
|
|
61
|
+
const side: DropSide = pointerY(e) < over.rect.top + over.rect.height / 2 ? "before" : "after";
|
|
62
|
+
const id = String(over.id);
|
|
63
|
+
if (lastOver.current?.id === id && lastOver.current.side === side) return;
|
|
64
|
+
lastOver.current = { id, side };
|
|
65
|
+
rows.get(id)?.current.onDragOverSide?.(side);
|
|
66
|
+
};
|
|
67
|
+
const finish = (e: DragEndEvent | null) => {
|
|
68
|
+
const from = dragged.current;
|
|
69
|
+
if (e?.over && String(e.over.id) !== from) {
|
|
70
|
+
// Where the pointer let go decides, even after a flick too quick for a
|
|
71
|
+
// move to be reported: the owner hears that side, rendered, then the drop.
|
|
72
|
+
const id = String(e.over.id);
|
|
73
|
+
const side: DropSide = pointerY(e) < e.over.rect.top + e.over.rect.height / 2 ? "before" : "after";
|
|
74
|
+
if (lastOver.current?.id !== id || lastOver.current.side !== side) flushSync(() => rows.get(id)?.current.onDragOverSide?.(side));
|
|
75
|
+
rows.get(id)?.current.onDrop?.();
|
|
76
|
+
}
|
|
77
|
+
if (from) rows.get(from)?.current.onDragEnd?.();
|
|
78
|
+
dragged.current = null;
|
|
79
|
+
lastOver.current = null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Rows.Provider value={rows}>
|
|
84
|
+
<DndContext
|
|
85
|
+
sensors={sensors}
|
|
86
|
+
// The row under the pointer is the target: what a person aims with, not
|
|
87
|
+
// the overlap of the small grip being carried.
|
|
88
|
+
collisionDetection={pointerWithin}
|
|
89
|
+
onDragStart={(e: DragStartEvent) => {
|
|
90
|
+
dragged.current = String(e.active.id);
|
|
91
|
+
rows.get(dragged.current)?.current.onDragStart?.();
|
|
92
|
+
}}
|
|
93
|
+
onDragMove={onMove}
|
|
94
|
+
onDragOver={onMove}
|
|
95
|
+
onDragEnd={finish}
|
|
96
|
+
onDragCancel={() => finish(null)}
|
|
97
|
+
accessibility={{ screenReaderInstructions: { draggable: "Press the grip for options, including Move up and Move down." } }}
|
|
98
|
+
>
|
|
99
|
+
{children}
|
|
100
|
+
</DndContext>
|
|
101
|
+
</Rows.Provider>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* A row with Notion's two margin controls to its left, shown on hover: "+" to add
|
|
106
|
+
below, and a grip that drags the row and, pressed, opens its menu. Together they
|
|
107
|
+
are 46px wide, so whatever holds the row leaves that much room to its left
|
|
108
|
+
(DocumentEditor's gutter is 3rem).
|
|
109
|
+
|
|
110
|
+
On a screen that cannot hover, the grip alone shows on the row being edited or
|
|
111
|
+
selected (`selected`), small enough for a phone's margin; the menu it opens
|
|
112
|
+
holds everything + does and more.
|
|
113
|
+
|
|
114
|
+
Dragging needs a DragRows around the rows; the row reports which half the
|
|
115
|
+
pointer is over, the owner decides what a drop means and tells the row where to
|
|
116
|
+
draw the line (`drop`). From the keyboard, the grip's menu has Move up and Move
|
|
117
|
+
down (`onMove`).
|
|
118
|
+
|
|
119
|
+
Nest rows as siblings, not inside one another: put a row's children after this
|
|
120
|
+
element, or hovering a child lights up its parent's controls too. */
|
|
121
|
+
export function HandleRow({
|
|
122
|
+
children,
|
|
123
|
+
className,
|
|
124
|
+
onAdd,
|
|
125
|
+
menu,
|
|
126
|
+
onMove,
|
|
127
|
+
selected = false,
|
|
128
|
+
dragging,
|
|
129
|
+
onDragStart,
|
|
130
|
+
onDragEnd,
|
|
131
|
+
onDragOverSide,
|
|
132
|
+
onDrop,
|
|
133
|
+
drop,
|
|
134
|
+
}: {
|
|
135
|
+
children: ReactNode;
|
|
136
|
+
className?: string;
|
|
137
|
+
onAdd?: () => void;
|
|
138
|
+
// DropdownMenuItem elements for the grip's menu.
|
|
139
|
+
menu?: ReactNode;
|
|
140
|
+
/** Moves the row one place, from the grip's menu; give `null` for a direction it cannot go. */
|
|
141
|
+
onMove?: { up: (() => void) | null; down: (() => void) | null };
|
|
142
|
+
/** The row is the one being edited or selected: on a touch screen, its grip shows. */
|
|
143
|
+
selected?: boolean;
|
|
144
|
+
// True while any row is being dragged, so this one accepts the drop.
|
|
145
|
+
dragging?: boolean;
|
|
146
|
+
onDragStart?: () => void;
|
|
147
|
+
onDragEnd?: () => void;
|
|
148
|
+
onDragOverSide?: (side: DropSide) => void;
|
|
149
|
+
onDrop?: () => void;
|
|
150
|
+
// Where to draw the drop line on this row, if at all.
|
|
151
|
+
drop?: DropSide | null;
|
|
152
|
+
}) {
|
|
153
|
+
const [open, setOpen] = useState(false);
|
|
154
|
+
const grip = useRef<HTMLButtonElement>(null);
|
|
155
|
+
const id = useId();
|
|
156
|
+
const rows = useContext(Rows);
|
|
157
|
+
const handlers = useRef<RowHandlers>({});
|
|
158
|
+
handlers.current = { onDragStart, onDragEnd, onDragOverSide: dragging === false ? undefined : onDragOverSide, onDrop };
|
|
159
|
+
useLayoutEffect(() => {
|
|
160
|
+
if (!rows) return;
|
|
161
|
+
rows.set(id, handlers);
|
|
162
|
+
return () => void rows.delete(id);
|
|
163
|
+
}, [rows, id]);
|
|
164
|
+
|
|
165
|
+
const canDrag = rows !== null && onDragStart !== undefined;
|
|
166
|
+
const draggable = useDraggable({ id, disabled: !canDrag });
|
|
167
|
+
const droppable = useDroppable({ id, disabled: rows === null });
|
|
168
|
+
const hasMenu = menu !== undefined || onMove !== undefined;
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<div
|
|
172
|
+
ref={droppable.setNodeRef}
|
|
173
|
+
data-selected={selected || undefined}
|
|
174
|
+
data-dragged={draggable.isDragging || undefined}
|
|
175
|
+
className={cn("group/row relative transition-opacity duration-(--duration-fast) data-dragged:opacity-40", className)}
|
|
176
|
+
>
|
|
177
|
+
<div
|
|
178
|
+
contentEditable={false}
|
|
179
|
+
data-open={open}
|
|
180
|
+
className={cn(
|
|
181
|
+
"absolute top-0 right-full flex h-[calc(1lh+6px)] items-center pr-1 opacity-0 transition-opacity duration-(--duration-fast)",
|
|
182
|
+
"group-hover/row:opacity-100 focus-within:opacity-100 data-[open=true]:opacity-100",
|
|
183
|
+
// No hover: the grip shows on the row being edited or selected.
|
|
184
|
+
"[@media(hover:none)]:pr-0.5 [@media(hover:none)]:group-focus-within/row:opacity-100 [@media(hover:none)]:group-data-selected/row:opacity-100",
|
|
185
|
+
)}
|
|
186
|
+
>
|
|
187
|
+
{onAdd && (
|
|
188
|
+
<button type="button" aria-label="Add below" className={cn(control, "w-6 [@media(hover:none)]:hidden")} onClick={onAdd}>
|
|
189
|
+
<Plus />
|
|
190
|
+
</button>
|
|
191
|
+
)}
|
|
192
|
+
<DropdownMenu open={open} onOpenChange={setOpen}>
|
|
193
|
+
{/* The menu is anchored here but opened by the grip's click, because a
|
|
194
|
+
trigger that opens on pointer-down would swallow the drag. */}
|
|
195
|
+
<DropdownMenuTrigger asChild>
|
|
196
|
+
<span className="pointer-events-none absolute inset-y-0 right-1 w-[18px]" />
|
|
197
|
+
</DropdownMenuTrigger>
|
|
198
|
+
<button
|
|
199
|
+
ref={(el) => {
|
|
200
|
+
grip.current = el;
|
|
201
|
+
draggable.setNodeRef(el);
|
|
202
|
+
}}
|
|
203
|
+
type="button"
|
|
204
|
+
{...(canDrag ? draggable.listeners : null)}
|
|
205
|
+
// The button keeps its own role and name; dnd-kit's describe the drag.
|
|
206
|
+
aria-describedby={canDrag ? draggable.attributes["aria-describedby"] : undefined}
|
|
207
|
+
aria-label={hasMenu ? (canDrag ? "Drag to move, or press for options" : "Options") : "Drag to move"}
|
|
208
|
+
aria-haspopup={hasMenu ? "menu" : undefined}
|
|
209
|
+
aria-expanded={hasMenu ? open : undefined}
|
|
210
|
+
className={cn(control, "w-[18px] touch-none", canDrag && "cursor-grab active:cursor-grabbing")}
|
|
211
|
+
onClick={() => hasMenu && setOpen(true)}
|
|
212
|
+
>
|
|
213
|
+
<GripVertical />
|
|
214
|
+
</button>
|
|
215
|
+
{hasMenu && (
|
|
216
|
+
<DropdownMenuContent
|
|
217
|
+
align="start"
|
|
218
|
+
// Back to the grip that opened it: the menu's own trigger is a
|
|
219
|
+
// stand-in that cannot take focus, which would drop it to the page.
|
|
220
|
+
onCloseAutoFocus={(e) => {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
grip.current?.focus();
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{onMove && (
|
|
226
|
+
<>
|
|
227
|
+
<DropdownMenuItem disabled={!onMove.up} onSelect={() => onMove.up?.()}>
|
|
228
|
+
<ArrowUp /> Move up
|
|
229
|
+
</DropdownMenuItem>
|
|
230
|
+
<DropdownMenuItem disabled={!onMove.down} onSelect={() => onMove.down?.()}>
|
|
231
|
+
<ArrowDown /> Move down
|
|
232
|
+
</DropdownMenuItem>
|
|
233
|
+
{menu !== undefined && <DropdownMenuSeparator />}
|
|
234
|
+
</>
|
|
235
|
+
)}
|
|
236
|
+
{menu}
|
|
237
|
+
</DropdownMenuContent>
|
|
238
|
+
)}
|
|
239
|
+
</DropdownMenu>
|
|
240
|
+
</div>
|
|
241
|
+
{drop && (
|
|
242
|
+
<div
|
|
243
|
+
className={cn(
|
|
244
|
+
"pointer-events-none absolute inset-x-0 h-[3px] rounded-full bg-accent/50",
|
|
245
|
+
drop === "before" ? "-top-0.5" : "-bottom-0.5",
|
|
246
|
+
)}
|
|
247
|
+
/>
|
|
248
|
+
)}
|
|
249
|
+
{children}
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* The bar at the top of a page: what it is on the left (a sidebar's trigger,
|
|
5
|
+
breadcrumbs, a title), its actions on the right. Sticky, 2.75rem tall (the
|
|
6
|
+
sidebar's header is the same, so the two line up), on the page's surface. Inside
|
|
7
|
+
an inset sidebar it takes the card's rounded corners. */
|
|
8
|
+
export function HeaderBar({ className, children, end, ...props }: ComponentProps<"header"> & { end?: ReactNode }) {
|
|
9
|
+
return (
|
|
10
|
+
<header className={cn("top-0 z-(--z-sticky) sticky flex items-center gap-1 bg-surface px-3 rounded-t-[inherit] h-11 shrink-0", className)} {...props}>
|
|
11
|
+
{children}
|
|
12
|
+
{end !== undefined && <div className="flex items-center gap-1 ml-auto shrink-0">{end}</div>}
|
|
13
|
+
</header>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* A preview of what a link leads to, on hover or keyboard focus: a page's first
|
|
8
|
+
lines, a person's card. It adds to the link and never replaces it, because a
|
|
9
|
+
touch screen never shows it: nothing in it may be the only way to something. */
|
|
10
|
+
|
|
11
|
+
export const HoverCard = HoverCardPrimitive.Root;
|
|
12
|
+
export const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
13
|
+
|
|
14
|
+
export function HoverCardContent({ className, align = "start", sideOffset = 6, ...props }: ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
15
|
+
return (
|
|
16
|
+
<HoverCardPrimitive.Portal>
|
|
17
|
+
<HoverCardPrimitive.Content
|
|
18
|
+
align={align}
|
|
19
|
+
sideOffset={sideOffset}
|
|
20
|
+
collisionPadding={8}
|
|
21
|
+
className={cn(
|
|
22
|
+
"z-(--z-overlay) bg-surface-overlay shadow-popover p-4 rounded-overlay w-72 max-w-[calc(100vw-1rem)] outline-none",
|
|
23
|
+
"data-[state=open]:animate-slide-in data-[state=closed]:animate-fade-out origin-[--radix-hover-card-content-transform-origin]",
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
</HoverCardPrimitive.Portal>
|
|
29
|
+
);
|
|
30
|
+
}
|