@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,221 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { DndContext, DragOverlay, MouseSensor, pointerWithin, TouchSensor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
|
|
4
|
+
import { ArrowRightLeft, MoreHorizontal, Plus } from "lucide-react";
|
|
5
|
+
import { useState, type ReactNode } from "react";
|
|
6
|
+
import { groupRows, isEmpty, shownProperties, titleOf, type Group, type Property, type Row, type Value, type View } from "../../../lib/database.ts";
|
|
7
|
+
import { cn } from "../../../lib/utils.ts";
|
|
8
|
+
import { Badge } from "../badge.tsx";
|
|
9
|
+
import { Button } from "../button.tsx";
|
|
10
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../dropdown-menu.tsx";
|
|
11
|
+
import { EmptyState } from "../empty-state.tsx";
|
|
12
|
+
import { Image } from "../image.tsx";
|
|
13
|
+
import { CellValue } from "./cells.tsx";
|
|
14
|
+
|
|
15
|
+
/* The views made of cards and lines: board, gallery and list. A card or a line
|
|
16
|
+
opens its row (onOpenRow); the properties shown under its title are the view's
|
|
17
|
+
own (hidden ones left out, empty ones skipped). */
|
|
18
|
+
|
|
19
|
+
function Title({ row, properties }: { row: Row; properties: readonly Property[] }) {
|
|
20
|
+
const title = titleOf(properties);
|
|
21
|
+
const v = title ? row.values[title.id] : null;
|
|
22
|
+
return isEmpty(v ?? null) ? <span className="text-ink-tertiary">Untitled</span> : <>{String(v)}</>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function Facts({ row, properties, skip }: { row: Row; properties: readonly Property[]; skip?: string }) {
|
|
26
|
+
const facts = properties.filter((p) => p.type !== "title" && p.id !== skip && !isEmpty(row.values[p.id] ?? null) && !(p.type === "checkbox" && row.values[p.id] !== true));
|
|
27
|
+
if (facts.length === 0) return null;
|
|
28
|
+
return (
|
|
29
|
+
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 mt-1.5 text-caption text-ink-secondary">
|
|
30
|
+
{facts.map((p) => (
|
|
31
|
+
<span key={p.id} className="inline-flex items-center gap-1 max-w-full">
|
|
32
|
+
{p.type === "checkbox" && <span>{p.name}</span>}
|
|
33
|
+
<CellValue property={p} value={row.values[p.id]} plain />
|
|
34
|
+
</span>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ── Board ─────────────────────────────────────────────────────────────────
|
|
41
|
+
A column for each option of the view's select (`groupBy`), and one for no
|
|
42
|
+
value. Cards are dragged between columns (a short press on a touch screen); a
|
|
43
|
+
card's menu moves it from the keyboard. "New" in a column adds a row there.
|
|
44
|
+
On a phone the columns scroll sideways, a column at a time. */
|
|
45
|
+
|
|
46
|
+
function BoardCard({ row, properties, view, groups, onOpenRow, onMoveTo, overlay = false }: {
|
|
47
|
+
row: Row;
|
|
48
|
+
properties: readonly Property[];
|
|
49
|
+
view: View;
|
|
50
|
+
groups: Group[];
|
|
51
|
+
onOpenRow?: (row: Row) => void;
|
|
52
|
+
onMoveTo: (row: Row, key: string | null) => void;
|
|
53
|
+
overlay?: boolean;
|
|
54
|
+
}) {
|
|
55
|
+
const drag = useDraggable({ id: row.id, disabled: overlay });
|
|
56
|
+
const groupBy = properties.find((p) => p.id === view.groupBy);
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
ref={drag.setNodeRef}
|
|
60
|
+
{...drag.listeners}
|
|
61
|
+
className={cn(
|
|
62
|
+
"group group/card relative bg-surface shadow-sm hover:shadow-md p-2.5 rounded-surface text-sm transition-[opacity,box-shadow] duration-(--duration-fast) touch-manipulation",
|
|
63
|
+
drag.isDragging && "opacity-40",
|
|
64
|
+
overlay && "shadow-popover rotate-1 cursor-grabbing",
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<button type="button" onClick={() => onOpenRow?.(row)} className="pr-6 w-full font-medium text-left break-words after:absolute after:inset-0 after:content-['']">
|
|
68
|
+
<Title row={row} properties={properties} />
|
|
69
|
+
</button>
|
|
70
|
+
<Facts row={row} properties={shownProperties(properties, view)} skip={view.groupBy} />
|
|
71
|
+
{!overlay && groupBy && (
|
|
72
|
+
<DropdownMenu>
|
|
73
|
+
<DropdownMenuTrigger asChild>
|
|
74
|
+
<Button variant="ghost" size="icon-sm" aria-label="Move to another column" className="top-1.5 right-1.5 z-1 absolute size-6 affordance">
|
|
75
|
+
<MoreHorizontal />
|
|
76
|
+
</Button>
|
|
77
|
+
</DropdownMenuTrigger>
|
|
78
|
+
<DropdownMenuContent align="end">
|
|
79
|
+
<DropdownMenuLabel>Move to</DropdownMenuLabel>
|
|
80
|
+
{groups.map((g) => (
|
|
81
|
+
<DropdownMenuItem key={g.key ?? "none"} disabled={row.values[groupBy.id] === g.key || (g.key === null && isEmpty(row.values[groupBy.id] ?? null))} onSelect={() => onMoveTo(row, g.key)}>
|
|
82
|
+
<ArrowRightLeft /> {g.option?.name ?? `No ${groupBy.name}`}
|
|
83
|
+
</DropdownMenuItem>
|
|
84
|
+
))}
|
|
85
|
+
</DropdownMenuContent>
|
|
86
|
+
</DropdownMenu>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function BoardColumn({ group, label, children, onAdd, count }: { group: Group; label: ReactNode; children: ReactNode; onAdd: () => void; count: number }) {
|
|
93
|
+
const drop = useDroppable({ id: group.key ?? "__none" });
|
|
94
|
+
return (
|
|
95
|
+
<section
|
|
96
|
+
ref={drop.setNodeRef}
|
|
97
|
+
aria-label={typeof label === "string" ? label : group.option?.name}
|
|
98
|
+
className={cn(
|
|
99
|
+
"flex flex-col gap-2 bg-surface-sunken p-2 rounded-surface w-68 transition-colors duration-(--duration-fast) snap-start shrink-0",
|
|
100
|
+
drop.isOver && "bg-accent-tint",
|
|
101
|
+
)}
|
|
102
|
+
>
|
|
103
|
+
<h3 className="flex items-center gap-2 px-1 h-control-sm text-sm">
|
|
104
|
+
{label}
|
|
105
|
+
<span className="tabular-nums text-ink-tertiary">{count}</span>
|
|
106
|
+
</h3>
|
|
107
|
+
{children}
|
|
108
|
+
<Button variant="ghost" size="sm" onClick={onAdd} className="justify-start text-ink-tertiary">
|
|
109
|
+
<Plus /> New
|
|
110
|
+
</Button>
|
|
111
|
+
</section>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function BoardView({ properties, rows, view, onSetValue, onAddRow, onOpenRow }: {
|
|
116
|
+
properties: readonly Property[];
|
|
117
|
+
rows: readonly Row[];
|
|
118
|
+
view: View;
|
|
119
|
+
onSetValue: (row: Row, property: Property, value: Value) => void;
|
|
120
|
+
onAddRow: (values?: Record<string, Value>) => void;
|
|
121
|
+
onOpenRow?: (row: Row) => void;
|
|
122
|
+
}) {
|
|
123
|
+
const groupBy = properties.find((p) => p.id === view.groupBy && p.type === "select");
|
|
124
|
+
const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 4 } }), useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }));
|
|
125
|
+
const [dragging, setDragging] = useState<Row | null>(null);
|
|
126
|
+
if (!groupBy) return <EmptyState compact title="Choose what the board groups by" description="A board needs a select property: its options become the columns. Choose one in the view's options." />;
|
|
127
|
+
const groups = groupRows(rows, groupBy);
|
|
128
|
+
const moveTo = (row: Row, key: string | null) => onSetValue(row, groupBy, key);
|
|
129
|
+
return (
|
|
130
|
+
<DndContext
|
|
131
|
+
sensors={sensors}
|
|
132
|
+
collisionDetection={pointerWithin}
|
|
133
|
+
onDragStart={(e) => setDragging(rows.find((r) => r.id === e.active.id) ?? null)}
|
|
134
|
+
onDragCancel={() => setDragging(null)}
|
|
135
|
+
onDragEnd={(e) => {
|
|
136
|
+
setDragging(null);
|
|
137
|
+
const row = rows.find((r) => r.id === e.active.id);
|
|
138
|
+
if (!row || !e.over) return;
|
|
139
|
+
const key = e.over.id === "__none" ? null : String(e.over.id);
|
|
140
|
+
if ((row.values[groupBy.id] ?? null) !== key) moveTo(row, key);
|
|
141
|
+
}}
|
|
142
|
+
accessibility={{ screenReaderInstructions: { draggable: "Open a card's menu to move it to another column." } }}
|
|
143
|
+
>
|
|
144
|
+
<div className="flex items-start gap-3 pb-2 overflow-x-auto overscroll-x-contain snap-x snap-mandatory sm:snap-none">
|
|
145
|
+
{groups.map((g) => (
|
|
146
|
+
<BoardColumn
|
|
147
|
+
key={g.key ?? "none"}
|
|
148
|
+
group={g}
|
|
149
|
+
count={g.rows.length}
|
|
150
|
+
label={g.option ? <Badge color={g.option.color}>{g.option.name}</Badge> : <span className="text-ink-secondary">No {groupBy.name}</span>}
|
|
151
|
+
onAdd={() => onAddRow({ [groupBy.id]: g.key })}
|
|
152
|
+
>
|
|
153
|
+
{g.rows.map((row) => (
|
|
154
|
+
<BoardCard key={row.id} row={row} properties={properties} view={view} groups={groups} onOpenRow={onOpenRow} onMoveTo={moveTo} />
|
|
155
|
+
))}
|
|
156
|
+
</BoardColumn>
|
|
157
|
+
))}
|
|
158
|
+
</div>
|
|
159
|
+
{/* A picture of the card being carried: not a second draggable card with the same id. */}
|
|
160
|
+
<DragOverlay dropAnimation={null}>
|
|
161
|
+
{dragging && (
|
|
162
|
+
<div className="bg-surface shadow-popover p-2.5 rounded-surface text-sm rotate-1 cursor-grabbing">
|
|
163
|
+
<div className="font-medium break-words">
|
|
164
|
+
<Title row={dragging} properties={properties} />
|
|
165
|
+
</div>
|
|
166
|
+
<Facts row={dragging} properties={shownProperties(properties, view)} skip={view.groupBy} />
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
</DragOverlay>
|
|
170
|
+
</DndContext>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* ── Gallery ───────────────────────────────────────────────────────────────
|
|
175
|
+
Cards with the row's cover picture (row.cover) over its title. As many columns
|
|
176
|
+
as fit, one on a small phone. */
|
|
177
|
+
|
|
178
|
+
export function GalleryView({ properties, rows, view, onOpenRow }: { properties: readonly Property[]; rows: readonly Row[]; view: View; onOpenRow?: (row: Row) => void }) {
|
|
179
|
+
const shown = shownProperties(properties, view);
|
|
180
|
+
return (
|
|
181
|
+
<ul className="gap-3 grid grid-cols-[repeat(auto-fill,minmax(min(14rem,100%),1fr))]">
|
|
182
|
+
{rows.map((row) => (
|
|
183
|
+
<li key={row.id} className="group/card relative bg-surface shadow-sm hover:shadow-md rounded-surface overflow-hidden transition-shadow duration-(--duration-fast)">
|
|
184
|
+
<Image src={row.cover ?? null} alt="" ratio="landscape" className="rounded-none" />
|
|
185
|
+
<div className="p-2.5 text-sm">
|
|
186
|
+
<button type="button" onClick={() => onOpenRow?.(row)} className="w-full font-medium text-left break-words after:absolute after:inset-0 after:content-['']">
|
|
187
|
+
<Title row={row} properties={properties} />
|
|
188
|
+
</button>
|
|
189
|
+
<Facts row={row} properties={shown} />
|
|
190
|
+
</div>
|
|
191
|
+
</li>
|
|
192
|
+
))}
|
|
193
|
+
</ul>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* ── List ──────────────────────────────────────────────────────────────────
|
|
198
|
+
A line per row: its title, and its shown properties at the end (under it on a
|
|
199
|
+
phone). The quietest view. */
|
|
200
|
+
|
|
201
|
+
export function ListView({ properties, rows, view, onOpenRow }: { properties: readonly Property[]; rows: readonly Row[]; view: View; onOpenRow?: (row: Row) => void }) {
|
|
202
|
+
const shown = shownProperties(properties, view).filter((p) => p.type !== "title");
|
|
203
|
+
return (
|
|
204
|
+
<ul className="@container flex flex-col">
|
|
205
|
+
{rows.map((row) => (
|
|
206
|
+
<li key={row.id} className="border-hairline border-b">
|
|
207
|
+
<button type="button" onClick={() => onOpenRow?.(row)} className="flex @max-md:flex-col @md:items-center gap-x-4 gap-y-1 hover:bg-tint-hover px-2 py-2 rounded-control w-full text-sm text-left">
|
|
208
|
+
<span className="flex-1 min-w-0 font-medium truncate">
|
|
209
|
+
<Title row={row} properties={properties} />
|
|
210
|
+
</span>
|
|
211
|
+
<span className="flex flex-wrap items-center gap-2 text-caption text-ink-secondary">
|
|
212
|
+
{shown.map((p) => (
|
|
213
|
+
<CellValue key={p.id} property={p} value={row.values[p.id]} plain />
|
|
214
|
+
))}
|
|
215
|
+
</span>
|
|
216
|
+
</button>
|
|
217
|
+
</li>
|
|
218
|
+
))}
|
|
219
|
+
</ul>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Check } from "lucide-react";
|
|
4
|
+
import { useRef, useState, type KeyboardEvent } from "react";
|
|
5
|
+
import { useEscapeFirst } from "../../../hooks/use-escape-first.ts";
|
|
6
|
+
import { formatShortDay, fromISODate, toISODate } from "../../../lib/dates.ts";
|
|
7
|
+
import { isEmpty, type Property, type Value } from "../../../lib/database.ts";
|
|
8
|
+
import { isWebUrl } from "../../../lib/embed.ts";
|
|
9
|
+
import { cn } from "../../../lib/utils.ts";
|
|
10
|
+
import { Badge } from "../badge.tsx";
|
|
11
|
+
import { Calendar } from "../calendar.tsx";
|
|
12
|
+
import { MultiSelect } from "../multi-select.tsx";
|
|
13
|
+
import { optionClasses, stepActive } from "../listbox.ts";
|
|
14
|
+
|
|
15
|
+
/* A database's values: how each kind looks (CellValue) and the field each is
|
|
16
|
+
changed in (CellEditor). Shared by every view, so a value looks the same in a
|
|
17
|
+
table's cell, on a board's card and in a calendar's day. */
|
|
18
|
+
|
|
19
|
+
export function CellValue({
|
|
20
|
+
property,
|
|
21
|
+
value,
|
|
22
|
+
className,
|
|
23
|
+
plain = false,
|
|
24
|
+
linkTabIndex,
|
|
25
|
+
}: {
|
|
26
|
+
property: Property;
|
|
27
|
+
value: Value | undefined;
|
|
28
|
+
className?: string;
|
|
29
|
+
/** Draw a link as words: inside something that is itself pressed (a card, a list's line). */
|
|
30
|
+
plain?: boolean;
|
|
31
|
+
linkTabIndex?: number;
|
|
32
|
+
}) {
|
|
33
|
+
if (property.type === "checkbox")
|
|
34
|
+
return (
|
|
35
|
+
<span
|
|
36
|
+
role="img"
|
|
37
|
+
aria-label={value ? "Yes" : "No"}
|
|
38
|
+
className={cn(
|
|
39
|
+
"inline-flex justify-center items-center rounded-small size-4 shrink-0",
|
|
40
|
+
value ? "bg-accent-solid text-accent-ink" : "shadow-[inset_0_0_0_1.5px_var(--control-edge)]",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
>
|
|
44
|
+
{value === true && <Check className="size-3" strokeWidth={3} />}
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
if (isEmpty(value ?? null)) return null;
|
|
48
|
+
switch (property.type) {
|
|
49
|
+
case "select": {
|
|
50
|
+
const o = property.options?.find((x) => x.id === value);
|
|
51
|
+
return o ? (
|
|
52
|
+
<Badge color={o.color} className={className}>
|
|
53
|
+
{o.name}
|
|
54
|
+
</Badge>
|
|
55
|
+
) : null;
|
|
56
|
+
}
|
|
57
|
+
case "multiSelect":
|
|
58
|
+
return (
|
|
59
|
+
<span className={cn("inline-flex flex-wrap gap-1", className)}>
|
|
60
|
+
{(value as string[]).map((id) => {
|
|
61
|
+
const o = property.options?.find((x) => x.id === id);
|
|
62
|
+
return o ? (
|
|
63
|
+
<Badge key={id} color={o.color}>
|
|
64
|
+
{o.name}
|
|
65
|
+
</Badge>
|
|
66
|
+
) : null;
|
|
67
|
+
})}
|
|
68
|
+
</span>
|
|
69
|
+
);
|
|
70
|
+
case "date": {
|
|
71
|
+
const d = fromISODate(String(value));
|
|
72
|
+
return <span className={cn("tabular-nums", className)}>{d ? formatShortDay(d) : String(value)}</span>;
|
|
73
|
+
}
|
|
74
|
+
case "number":
|
|
75
|
+
return <span className={cn("tabular-nums", className)}>{Number(value).toLocaleString()}</span>;
|
|
76
|
+
case "url": {
|
|
77
|
+
const url = String(value);
|
|
78
|
+
return isWebUrl(url) && !plain ? (
|
|
79
|
+
<a href={url} target="_blank" rel="noreferrer" tabIndex={linkTabIndex} className={cn("link truncate", className)} onClick={(e) => e.stopPropagation()}>
|
|
80
|
+
{url.replace(/^https?:\/\/(www\.)?/, "")}
|
|
81
|
+
</a>
|
|
82
|
+
) : (
|
|
83
|
+
<span className={className}>{url}</span>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
default:
|
|
87
|
+
return <span className={cn("truncate", className)}>{String(value)}</span>;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* The field a value is changed in, in place (a table's cell) or in a popover
|
|
92
|
+
(a card). Words and numbers are an input: Enter keeps, Escape puts back. An
|
|
93
|
+
option is a list to choose from; options are a MultiSelect; a date a calendar.
|
|
94
|
+
`onDone` closes it. */
|
|
95
|
+
export function CellEditor({
|
|
96
|
+
property,
|
|
97
|
+
value,
|
|
98
|
+
seed,
|
|
99
|
+
onChange,
|
|
100
|
+
onDone,
|
|
101
|
+
}: {
|
|
102
|
+
property: Property;
|
|
103
|
+
value: Value | undefined;
|
|
104
|
+
/** What was typed to start the change, in place of the value (a spreadsheet's way). */
|
|
105
|
+
seed?: string;
|
|
106
|
+
onChange: (value: Value) => void;
|
|
107
|
+
onDone: (move?: "down" | "right" | "left") => void;
|
|
108
|
+
}) {
|
|
109
|
+
// Starts from what was typed, if anything; kept when it differs from the value
|
|
110
|
+
// itself (not from the seed, or typing one letter and Enter would keep nothing).
|
|
111
|
+
const [draft, setDraft] = useState(seed ?? (value === null || value === undefined ? "" : String(value)));
|
|
112
|
+
const input = useRef<HTMLInputElement>(null);
|
|
113
|
+
// Finished by a key (kept or put back): the blur that follows as focus returns
|
|
114
|
+
// to the cell must not keep it again, or Escape would keep what it puts back.
|
|
115
|
+
const finished = useRef(false);
|
|
116
|
+
// Escape puts the change back and nothing else, not the dialog the table is in.
|
|
117
|
+
useEscapeFirst(!editsInPopover(property) && property.type !== "checkbox", input, () => {
|
|
118
|
+
finished.current = true;
|
|
119
|
+
onDone();
|
|
120
|
+
});
|
|
121
|
+
const keep = () => {
|
|
122
|
+
const next: Value = property.type === "number" ? (draft.trim() === "" || Number.isNaN(Number(draft)) ? null : Number(draft)) : draft;
|
|
123
|
+
if (next !== (value ?? (property.type === "number" ? null : ""))) onChange(next);
|
|
124
|
+
};
|
|
125
|
+
const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
|
|
126
|
+
if (e.nativeEvent.isComposing) return;
|
|
127
|
+
if (e.key === "Enter") {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
keep();
|
|
130
|
+
finished.current = true;
|
|
131
|
+
onDone("down");
|
|
132
|
+
} else if (e.key === "Escape") {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
finished.current = true;
|
|
136
|
+
onDone();
|
|
137
|
+
} else if (e.key === "Tab") {
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
keep();
|
|
140
|
+
finished.current = true;
|
|
141
|
+
onDone(e.shiftKey ? "left" : "right");
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
switch (property.type) {
|
|
146
|
+
case "select": {
|
|
147
|
+
const options = property.options ?? [];
|
|
148
|
+
return (
|
|
149
|
+
<div
|
|
150
|
+
role="listbox"
|
|
151
|
+
aria-label={property.name}
|
|
152
|
+
className="flex flex-col p-1.5 min-w-48"
|
|
153
|
+
// The arrows move between options; Escape is the popover's own.
|
|
154
|
+
onKeyDown={(e) => {
|
|
155
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp" && e.key !== "Home" && e.key !== "End") return;
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
const all = [...e.currentTarget.querySelectorAll<HTMLElement>("[role=option]")];
|
|
158
|
+
const at = all.indexOf(document.activeElement as HTMLElement);
|
|
159
|
+
const next = stepActive(at, all.length, e.key);
|
|
160
|
+
if (next !== null) all[next]?.focus();
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
{[...options, null].map((o, i) => {
|
|
164
|
+
const id = o?.id ?? null;
|
|
165
|
+
return (
|
|
166
|
+
<button
|
|
167
|
+
key={id ?? "none"}
|
|
168
|
+
type="button"
|
|
169
|
+
role="option"
|
|
170
|
+
aria-selected={value === id || (id === null && isEmpty(value ?? null))}
|
|
171
|
+
autoFocus={value === id || (i === 0 && isEmpty(value ?? null))}
|
|
172
|
+
onClick={() => {
|
|
173
|
+
onChange(id);
|
|
174
|
+
onDone();
|
|
175
|
+
}}
|
|
176
|
+
className={cn(optionClasses, "hover:bg-tint-hover focus-visible:bg-tint-hover outline-none")}
|
|
177
|
+
>
|
|
178
|
+
{o ? <Badge color={o.color}>{o.name}</Badge> : <span className="text-ink-tertiary">No value</span>}
|
|
179
|
+
{(value === id || (id === null && isEmpty(value ?? null))) && <Check className="ml-auto size-4 text-ink-secondary" />}
|
|
180
|
+
</button>
|
|
181
|
+
);
|
|
182
|
+
})}
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
case "multiSelect":
|
|
187
|
+
return (
|
|
188
|
+
<div className="p-2 w-72">
|
|
189
|
+
<MultiSelect
|
|
190
|
+
aria-label={property.name}
|
|
191
|
+
autoFocus
|
|
192
|
+
options={(property.options ?? []).map((o) => ({ value: o.id, label: o.name, color: o.color }))}
|
|
193
|
+
value={Array.isArray(value) ? value : []}
|
|
194
|
+
onChange={(ids) => onChange(ids)}
|
|
195
|
+
/>
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
case "date":
|
|
199
|
+
return (
|
|
200
|
+
<div>
|
|
201
|
+
<Calendar
|
|
202
|
+
mode="single"
|
|
203
|
+
autoFocus
|
|
204
|
+
selected={fromISODate(typeof value === "string" ? value : null)}
|
|
205
|
+
defaultMonth={fromISODate(typeof value === "string" ? value : null)}
|
|
206
|
+
onSelect={(day: Date | undefined) => {
|
|
207
|
+
onChange(day ? toISODate(day) : null);
|
|
208
|
+
onDone();
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
case "checkbox":
|
|
214
|
+
return null;
|
|
215
|
+
default:
|
|
216
|
+
return (
|
|
217
|
+
<input
|
|
218
|
+
ref={input}
|
|
219
|
+
autoFocus
|
|
220
|
+
aria-label={property.name}
|
|
221
|
+
inputMode={property.type === "number" ? "decimal" : property.type === "url" ? "url" : undefined}
|
|
222
|
+
value={draft}
|
|
223
|
+
onChange={(e) => setDraft(e.target.value)}
|
|
224
|
+
onKeyDown={onKeyDown}
|
|
225
|
+
onBlur={() => {
|
|
226
|
+
if (finished.current) return;
|
|
227
|
+
keep();
|
|
228
|
+
onDone();
|
|
229
|
+
}}
|
|
230
|
+
className={cn("bg-surface px-2 py-1.5 outline-none w-full min-w-0 text-sm", property.type === "number" && "text-right tabular-nums")}
|
|
231
|
+
/>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Whether a property is changed in a popover (true) or in place (false), or toggled (checkbox). */
|
|
237
|
+
export const editsInPopover = (property: Property) => property.type === "select" || property.type === "multiSelect" || property.type === "date";
|