@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,20 @@
|
|
|
1
|
+
import { type Property, type Value } from "../../../lib/database.js";
|
|
2
|
+
export declare function CellValue({ property, value, className, plain, linkTabIndex, }: {
|
|
3
|
+
property: Property;
|
|
4
|
+
value: Value | undefined;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Draw a link as words: inside something that is itself pressed (a card, a list's line). */
|
|
7
|
+
plain?: boolean;
|
|
8
|
+
linkTabIndex?: number;
|
|
9
|
+
}): import("react").JSX.Element | null;
|
|
10
|
+
export declare function CellEditor({ property, value, seed, onChange, onDone, }: {
|
|
11
|
+
property: Property;
|
|
12
|
+
value: Value | undefined;
|
|
13
|
+
/** What was typed to start the change, in place of the value (a spreadsheet's way). */
|
|
14
|
+
seed?: string;
|
|
15
|
+
onChange: (value: Value) => void;
|
|
16
|
+
onDone: (move?: "down" | "right" | "left") => void;
|
|
17
|
+
}): import("react").JSX.Element | null;
|
|
18
|
+
/** Whether a property is changed in a popover (true) or in place (false), or toggled (checkbox). */
|
|
19
|
+
export declare const editsInPopover: (property: Property) => boolean;
|
|
20
|
+
//# sourceMappingURL=cells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cells.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/database/cells.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAW,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAY9E,wBAAgB,SAAS,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,KAAa,EACb,YAAY,GACf,EAAE;IACC,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,sCAyDA;AAMD,wBAAgB,UAAU,CAAC,EACvB,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,GACT,EAAE;IACC,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;CACtD,sCA8HA;AAED,oGAAoG;AACpG,eAAO,MAAM,cAAc,GAAI,UAAU,QAAQ,YAA8F,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check } from "lucide-react";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
import { useEscapeFirst } from "../../../hooks/use-escape-first.js";
|
|
6
|
+
import { formatShortDay, fromISODate, toISODate } from "../../../lib/dates.js";
|
|
7
|
+
import { isEmpty } from "../../../lib/database.js";
|
|
8
|
+
import { isWebUrl } from "../../../lib/embed.js";
|
|
9
|
+
import { cn } from "../../../lib/utils.js";
|
|
10
|
+
import { Badge } from "../badge.js";
|
|
11
|
+
import { Calendar } from "../calendar.js";
|
|
12
|
+
import { MultiSelect } from "../multi-select.js";
|
|
13
|
+
import { optionClasses, stepActive } from "../listbox.js";
|
|
14
|
+
/* A database's values: how each kind looks (CellValue) and the field each is
|
|
15
|
+
changed in (CellEditor). Shared by every view, so a value looks the same in a
|
|
16
|
+
table's cell, on a board's card and in a calendar's day. */
|
|
17
|
+
export function CellValue({ property, value, className, plain = false, linkTabIndex, }) {
|
|
18
|
+
if (property.type === "checkbox")
|
|
19
|
+
return (_jsx("span", { role: "img", "aria-label": value ? "Yes" : "No", className: cn("inline-flex justify-center items-center rounded-small size-4 shrink-0", value ? "bg-accent-solid text-accent-ink" : "shadow-[inset_0_0_0_1.5px_var(--control-edge)]", className), children: value === true && _jsx(Check, { className: "size-3", strokeWidth: 3 }) }));
|
|
20
|
+
if (isEmpty(value ?? null))
|
|
21
|
+
return null;
|
|
22
|
+
switch (property.type) {
|
|
23
|
+
case "select": {
|
|
24
|
+
const o = property.options?.find((x) => x.id === value);
|
|
25
|
+
return o ? (_jsx(Badge, { color: o.color, className: className, children: o.name })) : null;
|
|
26
|
+
}
|
|
27
|
+
case "multiSelect":
|
|
28
|
+
return (_jsx("span", { className: cn("inline-flex flex-wrap gap-1", className), children: value.map((id) => {
|
|
29
|
+
const o = property.options?.find((x) => x.id === id);
|
|
30
|
+
return o ? (_jsx(Badge, { color: o.color, children: o.name }, id)) : null;
|
|
31
|
+
}) }));
|
|
32
|
+
case "date": {
|
|
33
|
+
const d = fromISODate(String(value));
|
|
34
|
+
return _jsx("span", { className: cn("tabular-nums", className), children: d ? formatShortDay(d) : String(value) });
|
|
35
|
+
}
|
|
36
|
+
case "number":
|
|
37
|
+
return _jsx("span", { className: cn("tabular-nums", className), children: Number(value).toLocaleString() });
|
|
38
|
+
case "url": {
|
|
39
|
+
const url = String(value);
|
|
40
|
+
return isWebUrl(url) && !plain ? (_jsx("a", { href: url, target: "_blank", rel: "noreferrer", tabIndex: linkTabIndex, className: cn("link truncate", className), onClick: (e) => e.stopPropagation(), children: url.replace(/^https?:\/\/(www\.)?/, "") })) : (_jsx("span", { className: className, children: url }));
|
|
41
|
+
}
|
|
42
|
+
default:
|
|
43
|
+
return _jsx("span", { className: cn("truncate", className), children: String(value) });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/* The field a value is changed in, in place (a table's cell) or in a popover
|
|
47
|
+
(a card). Words and numbers are an input: Enter keeps, Escape puts back. An
|
|
48
|
+
option is a list to choose from; options are a MultiSelect; a date a calendar.
|
|
49
|
+
`onDone` closes it. */
|
|
50
|
+
export function CellEditor({ property, value, seed, onChange, onDone, }) {
|
|
51
|
+
// Starts from what was typed, if anything; kept when it differs from the value
|
|
52
|
+
// itself (not from the seed, or typing one letter and Enter would keep nothing).
|
|
53
|
+
const [draft, setDraft] = useState(seed ?? (value === null || value === undefined ? "" : String(value)));
|
|
54
|
+
const input = useRef(null);
|
|
55
|
+
// Finished by a key (kept or put back): the blur that follows as focus returns
|
|
56
|
+
// to the cell must not keep it again, or Escape would keep what it puts back.
|
|
57
|
+
const finished = useRef(false);
|
|
58
|
+
// Escape puts the change back and nothing else, not the dialog the table is in.
|
|
59
|
+
useEscapeFirst(!editsInPopover(property) && property.type !== "checkbox", input, () => {
|
|
60
|
+
finished.current = true;
|
|
61
|
+
onDone();
|
|
62
|
+
});
|
|
63
|
+
const keep = () => {
|
|
64
|
+
const next = property.type === "number" ? (draft.trim() === "" || Number.isNaN(Number(draft)) ? null : Number(draft)) : draft;
|
|
65
|
+
if (next !== (value ?? (property.type === "number" ? null : "")))
|
|
66
|
+
onChange(next);
|
|
67
|
+
};
|
|
68
|
+
const onKeyDown = (e) => {
|
|
69
|
+
if (e.nativeEvent.isComposing)
|
|
70
|
+
return;
|
|
71
|
+
if (e.key === "Enter") {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
keep();
|
|
74
|
+
finished.current = true;
|
|
75
|
+
onDone("down");
|
|
76
|
+
}
|
|
77
|
+
else if (e.key === "Escape") {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
finished.current = true;
|
|
81
|
+
onDone();
|
|
82
|
+
}
|
|
83
|
+
else if (e.key === "Tab") {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
keep();
|
|
86
|
+
finished.current = true;
|
|
87
|
+
onDone(e.shiftKey ? "left" : "right");
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
switch (property.type) {
|
|
91
|
+
case "select": {
|
|
92
|
+
const options = property.options ?? [];
|
|
93
|
+
return (_jsx("div", { role: "listbox", "aria-label": property.name, className: "flex flex-col p-1.5 min-w-48",
|
|
94
|
+
// The arrows move between options; Escape is the popover's own.
|
|
95
|
+
onKeyDown: (e) => {
|
|
96
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp" && e.key !== "Home" && e.key !== "End")
|
|
97
|
+
return;
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
const all = [...e.currentTarget.querySelectorAll("[role=option]")];
|
|
100
|
+
const at = all.indexOf(document.activeElement);
|
|
101
|
+
const next = stepActive(at, all.length, e.key);
|
|
102
|
+
if (next !== null)
|
|
103
|
+
all[next]?.focus();
|
|
104
|
+
}, children: [...options, null].map((o, i) => {
|
|
105
|
+
const id = o?.id ?? null;
|
|
106
|
+
return (_jsxs("button", { type: "button", role: "option", "aria-selected": value === id || (id === null && isEmpty(value ?? null)), autoFocus: value === id || (i === 0 && isEmpty(value ?? null)), onClick: () => {
|
|
107
|
+
onChange(id);
|
|
108
|
+
onDone();
|
|
109
|
+
}, className: cn(optionClasses, "hover:bg-tint-hover focus-visible:bg-tint-hover outline-none"), children: [o ? _jsx(Badge, { color: o.color, children: o.name }) : _jsx("span", { className: "text-ink-tertiary", children: "No value" }), (value === id || (id === null && isEmpty(value ?? null))) && _jsx(Check, { className: "ml-auto size-4 text-ink-secondary" })] }, id ?? "none"));
|
|
110
|
+
}) }));
|
|
111
|
+
}
|
|
112
|
+
case "multiSelect":
|
|
113
|
+
return (_jsx("div", { className: "p-2 w-72", children: _jsx(MultiSelect, { "aria-label": property.name, autoFocus: true, options: (property.options ?? []).map((o) => ({ value: o.id, label: o.name, color: o.color })), value: Array.isArray(value) ? value : [], onChange: (ids) => onChange(ids) }) }));
|
|
114
|
+
case "date":
|
|
115
|
+
return (_jsx("div", { children: _jsx(Calendar, { mode: "single", autoFocus: true, selected: fromISODate(typeof value === "string" ? value : null), defaultMonth: fromISODate(typeof value === "string" ? value : null), onSelect: (day) => {
|
|
116
|
+
onChange(day ? toISODate(day) : null);
|
|
117
|
+
onDone();
|
|
118
|
+
} }) }));
|
|
119
|
+
case "checkbox":
|
|
120
|
+
return null;
|
|
121
|
+
default:
|
|
122
|
+
return (_jsx("input", { ref: input, autoFocus: true, "aria-label": property.name, inputMode: property.type === "number" ? "decimal" : property.type === "url" ? "url" : undefined, value: draft, onChange: (e) => setDraft(e.target.value), onKeyDown: onKeyDown, onBlur: () => {
|
|
123
|
+
if (finished.current)
|
|
124
|
+
return;
|
|
125
|
+
keep();
|
|
126
|
+
onDone();
|
|
127
|
+
}, 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") }));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** Whether a property is changed in a popover (true) or in place (false), or toggled (checkbox). */
|
|
131
|
+
export const editsInPopover = (property) => property.type === "select" || property.type === "multiSelect" || property.type === "date";
|
|
132
|
+
//# sourceMappingURL=cells.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cells.js","sourceRoot":"","sources":["../../../../src/components/ui/database/cells.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,OAAO,EAA6B,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE1D;;8DAE8D;AAE9D,MAAM,UAAU,SAAS,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,KAAK,GAAG,KAAK,EACb,YAAY,GAQf;IACG,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU;QAC5B,OAAO,CACH,eACI,IAAI,EAAC,KAAK,gBACE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,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G,EAAE,KAAK,EACV,SAAS,sBACG,QAAQ,CAAC,IAAI,EACzB,SAAS,EAAE,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAC/F,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,GAAG,EAAE;oBACT,IAAI,QAAQ,CAAC,OAAO;wBAAE,OAAO;oBAC7B,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,CAAC;gBACb,CAAC,EACD,SAAS,EAAE,EAAE,CAAC,4DAA4D,EAAE,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,yBAAyB,CAAC,GACtI,CACL,CAAC;IACV,CAAC;AACL,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,aAAa,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import { type Property, type Row, type View, type ViewKind } from "../../../lib/database.js";
|
|
3
|
+
export declare const VIEW_ICONS: Record<ViewKind, LucideIcon>;
|
|
4
|
+
export declare function Database({ properties, rows, views, onRowsChange, onViewsChange, onOpenRow, view: controlled, onViewChange, newRowId, title, className, }: {
|
|
5
|
+
properties: readonly Property[];
|
|
6
|
+
rows: readonly Row[];
|
|
7
|
+
views: readonly View[];
|
|
8
|
+
onRowsChange: (rows: Row[]) => void;
|
|
9
|
+
onViewsChange: (views: View[]) => void;
|
|
10
|
+
onOpenRow?: (row: Row) => void;
|
|
11
|
+
/** Which view shows, if the app keeps it (in the address, say). */
|
|
12
|
+
view?: string;
|
|
13
|
+
onViewChange?: (id: string) => void;
|
|
14
|
+
newRowId?: () => string;
|
|
15
|
+
/** Names the database for a screen reader, and is shown above the views. */
|
|
16
|
+
title?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/database/database.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmF,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAEhI,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAc,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAkC7H,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,UAAU,CAA+F,CAAC;AAMpJ,wBAAgB,QAAQ,CAAC,EACrB,UAAU,EACV,IAAI,EACJ,KAAK,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,IAAI,EAAE,UAAU,EAChB,YAAY,EACZ,QAA+B,EAC/B,KAAK,EACL,SAAS,GACZ,EAAE;IACC,UAAU,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChC,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACpC,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAgNA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarDays, Columns3, Copy, LayoutGrid, List, Plus, Settings2, Table2, Trash2 } from "lucide-react";
|
|
4
|
+
import { useId, useState } from "react";
|
|
5
|
+
import { applyView, newView } from "../../../lib/database.js";
|
|
6
|
+
import { cn } from "../../../lib/utils.js";
|
|
7
|
+
import { Button } from "../button.js";
|
|
8
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "../dropdown-menu.js";
|
|
9
|
+
import { EmptyState } from "../empty-state.js";
|
|
10
|
+
import { FilterButton, SortButton } from "../filter-builder.js";
|
|
11
|
+
import { SearchField } from "../input.js";
|
|
12
|
+
import { CalendarView } from "./calendar-view.js";
|
|
13
|
+
import { BoardView, GalleryView, ListView } from "./card-views.js";
|
|
14
|
+
import { TableView } from "./table-view.js";
|
|
15
|
+
/* Notion's database: one set of rows with typed properties (lib/database), seen
|
|
16
|
+
through views: a table, a board, a gallery, a list, a calendar. The app owns the
|
|
17
|
+
rows and the views; this draws and edits them and reports every change.
|
|
18
|
+
|
|
19
|
+
Around the views: a row of the views' tabs (switch, add, duplicate, delete), and
|
|
20
|
+
a toolbar with search, Filter and Sort (kept per view), the view's options
|
|
21
|
+
(properties to show; what a board groups by and a calendar dates by) and New.
|
|
22
|
+
A row opens through `onOpenRow`: the app decides whether that is a dialog, a
|
|
23
|
+
Sheet or a page of its own.
|
|
24
|
+
|
|
25
|
+
Limits in v1: no virtualisation (comfortable to about 1,000 rows), no formulas,
|
|
26
|
+
relations or rollups, no grouping in the table. */
|
|
27
|
+
export const VIEW_ICONS = { table: Table2, board: Columns3, gallery: LayoutGrid, list: List, calendar: CalendarDays };
|
|
28
|
+
let made = 0;
|
|
29
|
+
const freshId = (prefix) => typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${prefix}-${Date.now().toString(36)}-${(made++).toString(36)}`;
|
|
30
|
+
export function Database({ properties, rows, views, onRowsChange, onViewsChange, onOpenRow, view: controlled, onViewChange, newRowId = () => freshId("row"), title, className, }) {
|
|
31
|
+
const [own, setOwn] = useState(views[0]?.id);
|
|
32
|
+
const uid = useId();
|
|
33
|
+
const currentId = controlled ?? own;
|
|
34
|
+
const view = views.find((v) => v.id === currentId) ?? views[0];
|
|
35
|
+
const [query, setQuery] = useState("");
|
|
36
|
+
const choose = (id) => {
|
|
37
|
+
setOwn(id);
|
|
38
|
+
onViewChange?.(id);
|
|
39
|
+
};
|
|
40
|
+
const setView = (next) => onViewsChange(views.map((v) => (v.id === next.id ? next : v)));
|
|
41
|
+
const setValue = (row, property, value) => onRowsChange(rows.map((r) => (r.id === row.id ? { ...r, values: { ...r.values, [property.id]: value } } : r)));
|
|
42
|
+
// A new row takes the view's simple "is" filters (Status is Booked, Shared), so
|
|
43
|
+
// in a filtered view it stays in sight rather than vanishing as it is added.
|
|
44
|
+
const addRow = (values = {}) => {
|
|
45
|
+
const fromFilters = {};
|
|
46
|
+
if ((view?.match ?? "all") === "all")
|
|
47
|
+
for (const f of view?.filter ?? []) {
|
|
48
|
+
const p = properties.find((x) => x.id === f.property);
|
|
49
|
+
if (p && f.op === "is" && f.value !== undefined && f.value !== null && f.value !== "")
|
|
50
|
+
fromFilters[p.id] = f.value;
|
|
51
|
+
}
|
|
52
|
+
const row = { id: newRowId(), values: { ...fromFilters, ...values } };
|
|
53
|
+
onRowsChange([...rows, row]);
|
|
54
|
+
return row;
|
|
55
|
+
};
|
|
56
|
+
const addView = (kind) => {
|
|
57
|
+
const next = newView(kind, properties, freshId("view"));
|
|
58
|
+
onViewsChange([...views, next]);
|
|
59
|
+
choose(next.id);
|
|
60
|
+
};
|
|
61
|
+
if (!view)
|
|
62
|
+
return _jsx(EmptyState, { title: "No views", action: _jsx(Button, { onClick: () => addView("table"), children: "Add a table view" }) });
|
|
63
|
+
const shown = applyView(rows, properties, view, query);
|
|
64
|
+
const selects = properties.filter((p) => p.type === "select");
|
|
65
|
+
const dates = properties.filter((p) => p.type === "date");
|
|
66
|
+
const common = { properties, rows: shown, view, onOpenRow };
|
|
67
|
+
return (_jsxs("section", { "aria-label": title ?? "Database", className: cn("@container flex flex-col gap-2", className), children: [title && _jsx("h2", { className: "font-semibold text-h2", children: title }), _jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [_jsxs("div", { className: "flex items-center gap-0.5 max-w-full", children: [_jsx("div", { role: "tablist", "aria-label": "Views", className: "flex items-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none]", children: views.map((v) => {
|
|
68
|
+
const Icon = VIEW_ICONS[v.kind];
|
|
69
|
+
const current = v.id === view.id;
|
|
70
|
+
return (_jsxs("button", { type: "button", role: "tab", id: `${uid}-tab-${v.id}`, "aria-controls": `${uid}-panel`, "aria-selected": current, tabIndex: current ? 0 : -1, onClick: () => choose(v.id), onKeyDown: (e) => {
|
|
71
|
+
const i = views.indexOf(v);
|
|
72
|
+
const to = e.key === "ArrowRight" ? i + 1 : e.key === "ArrowLeft" ? i - 1 : e.key === "Home" ? 0 : e.key === "End" ? views.length - 1 : null;
|
|
73
|
+
if (to === null)
|
|
74
|
+
return;
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
const next = views[(to + views.length) % views.length];
|
|
77
|
+
choose(next.id);
|
|
78
|
+
e.currentTarget.parentElement?.children[(to + views.length) % views.length]?.focus();
|
|
79
|
+
}, className: cn("relative flex items-center gap-1.5 hover:bg-tint-hover px-2 rounded-control h-control-sm text-sm whitespace-nowrap shrink-0", current ? "text-ink font-medium after:absolute after:inset-x-2 after:-bottom-1.25 after:h-0.5 after:rounded-full after:bg-ink after:content-['']" : "text-ink-secondary"), children: [_jsx(Icon, { className: "size-4", "aria-hidden": true }), v.name] }, v.id));
|
|
80
|
+
}) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Add a view", className: "text-ink-tertiary", children: _jsx(Plus, {}) }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsx(DropdownMenuLabel, { children: "Add a view" }), Object.keys(VIEW_ICONS).map((kind) => {
|
|
81
|
+
const Icon = VIEW_ICONS[kind];
|
|
82
|
+
return (_jsxs(DropdownMenuItem, { onSelect: () => addView(kind), children: [_jsx(Icon, {}), " ", kind[0].toUpperCase() + kind.slice(1)] }, kind));
|
|
83
|
+
})] })] })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-1 @lg:ml-auto", children: [_jsx(SearchField, { size: "sm", value: query, onChange: setQuery, placeholder: "Search", "aria-label": `Search ${title ?? "the database"}`, className: "w-40 @max-lg:w-full" }), _jsx(FilterButton, { properties: properties, filters: view.filter, onChange: (filter) => setView({ ...view, filter }), match: view.match ?? "all", onMatchChange: (match) => setView({ ...view, match }) }), _jsx(SortButton, { properties: properties, sorts: view.sort, onChange: (sort) => setView({ ...view, sort }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "View options", children: _jsx(Settings2, {}) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "min-w-56", children: [view.kind === "board" && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuLabel, { children: "Group by" }), _jsx(DropdownMenuRadioGroup, { value: view.groupBy ?? "", onValueChange: (groupBy) => setView({ ...view, groupBy }), children: selects.map((p) => (_jsx(DropdownMenuRadioItem, { value: p.id, children: p.name }, p.id))) }), _jsx(DropdownMenuSeparator, {})] })), view.kind === "calendar" && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuLabel, { children: "Date by" }), _jsx(DropdownMenuRadioGroup, { value: view.dateProperty ?? "", onValueChange: (dateProperty) => setView({ ...view, dateProperty }), children: dates.map((p) => (_jsx(DropdownMenuRadioItem, { value: p.id, children: p.name }, p.id))) }), _jsx(DropdownMenuSeparator, {})] })), _jsx(DropdownMenuLabel, { children: "Properties shown" }), properties
|
|
84
|
+
.filter((p) => p.type !== "title")
|
|
85
|
+
.map((p) => (_jsx(DropdownMenuCheckboxItem, { checked: !view.hidden.includes(p.id), onSelect: (e) => e.preventDefault(), onCheckedChange: (on) => setView({ ...view, hidden: on ? view.hidden.filter((h) => h !== p.id) : [...view.hidden, p.id] }), children: p.name }, p.id))), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onSelect: () => {
|
|
86
|
+
const copy = { ...view, id: freshId("view"), name: `${view.name} copy` };
|
|
87
|
+
onViewsChange([...views, copy]);
|
|
88
|
+
choose(copy.id);
|
|
89
|
+
}, children: [_jsx(Copy, {}), " Duplicate this view"] }), _jsxs(DropdownMenuItem, { danger: true, disabled: views.length <= 1, onSelect: () => {
|
|
90
|
+
const rest = views.filter((v) => v.id !== view.id);
|
|
91
|
+
onViewsChange(rest);
|
|
92
|
+
choose(rest[0].id);
|
|
93
|
+
}, children: [_jsx(Trash2, {}), " Delete this view"] })] })] }), _jsxs(Button, { variant: "primary", size: "sm", onClick: () => {
|
|
94
|
+
// Added first, opened after: written as onOpenRow?.(addRow()), an app
|
|
95
|
+
// without onOpenRow would skip the call and its argument, adding nothing.
|
|
96
|
+
const row = addRow();
|
|
97
|
+
onOpenRow?.(row);
|
|
98
|
+
}, children: [_jsx(Plus, {}), " New"] })] })] }), _jsxs("p", { className: "sr-only", "aria-live": "polite", children: [shown.length, " of ", rows.length, " shown"] }), _jsx("div", { role: "tabpanel", id: `${uid}-panel`, "aria-labelledby": `${uid}-tab-${view.id}`, children: shown.length === 0 && rows.length > 0 && view.kind !== "board" && view.kind !== "calendar" ? (_jsx(EmptyState, { compact: true, title: "Nothing matches", description: "Change the search or the view's filters." })) : view.kind === "table" ? (
|
|
99
|
+
// Its own cursor and edit state per view.
|
|
100
|
+
_jsx(TableView, { ...common, onViewChange: setView, onSetValue: setValue, onAddRow: () => addRow() }, view.id)) : view.kind === "board" ? (_jsx(BoardView, { ...common, onSetValue: setValue, onAddRow: addRow })) : view.kind === "gallery" ? (_jsx(GalleryView, { ...common })) : view.kind === "list" ? (_jsx(ListView, { ...common })) : (_jsx(CalendarView, { ...common, onSetValue: setValue, onAddRow: addRow })) })] }));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../../../src/components/ui/database/database.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAmB,MAAM,cAAc,CAAC;AAChI,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAiE,MAAM,0BAA0B,CAAC;AAC7H,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAe,CAAC;AACvC,OAAO,EACH,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,qBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAA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ACjH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CACxB,KAAC,SAAS,OAAK,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAI,CACpE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1B,KAAC,WAAW,OAAK,MAAM,GAAI,CAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACvB,KAAC,QAAQ,OAAK,MAAM,GAAI,CAC3B,CAAC,CAAC,CAAC,CACA,KAAC,YAAY,OAAK,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAI,CACvE,GACC,IACA,CACb,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { PropertyType } from "../../../lib/database.js";
|
|
3
|
+
/** Each kind of property's icon, beside its name in a table's header and a builder's menus. */
|
|
4
|
+
export declare const PROPERTY_ICONS: Record<PropertyType, LucideIcon>;
|
|
5
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/database/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,UAAU,CAS3D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Calendar, CheckSquare, CircleChevronDown, Hash, Link, Tags, Text, Type } from "lucide-react";
|
|
2
|
+
/** Each kind of property's icon, beside its name in a table's header and a builder's menus. */
|
|
3
|
+
export const PROPERTY_ICONS = {
|
|
4
|
+
title: Type,
|
|
5
|
+
text: Text,
|
|
6
|
+
number: Hash,
|
|
7
|
+
select: CircleChevronDown,
|
|
8
|
+
multiSelect: Tags,
|
|
9
|
+
date: Calendar,
|
|
10
|
+
checkbox: CheckSquare,
|
|
11
|
+
url: Link,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../src/components/ui/database/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAGvH,+FAA+F;AAC/F,MAAM,CAAC,MAAM,cAAc,GAAqC;IAC5D,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,iBAAiB;IACzB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,WAAW;IACrB,GAAG,EAAE,IAAI;CACZ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Property, type Row, type Value, type View } from "../../../lib/database.js";
|
|
2
|
+
export declare function TableView({ properties, rows, view, onViewChange, onSetValue, onAddRow, onOpenRow, }: {
|
|
3
|
+
properties: readonly Property[];
|
|
4
|
+
rows: readonly Row[];
|
|
5
|
+
view: View;
|
|
6
|
+
onViewChange: (view: View) => void;
|
|
7
|
+
onSetValue: (row: Row, property: Property, value: Value) => void;
|
|
8
|
+
onAddRow: () => void;
|
|
9
|
+
onOpenRow?: (row: Row) => void;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=table-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-view.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/database/table-view.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAkBpH,wBAAgB,SAAS,CAAC,EACtB,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,UAAU,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChC,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjE,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC,+BAgRA"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUpNarrowWide, EyeOff, Maximize2, Plus } from "lucide-react";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
import { isEmpty, shownProperties } from "../../../lib/database.js";
|
|
6
|
+
import { cn } from "../../../lib/utils.js";
|
|
7
|
+
import { Button } from "../button.js";
|
|
8
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../dropdown-menu.js";
|
|
9
|
+
import { Popover, PopoverAnchor, PopoverContent } from "../popover.js";
|
|
10
|
+
import { CellEditor, CellValue, editsInPopover } from "./cells.js";
|
|
11
|
+
import { PROPERTY_ICONS } from "./icons.js";
|
|
12
|
+
/* The table view: a spreadsheet of the rows. One cell is current (the arrows move
|
|
13
|
+
it, Home and End to a row's ends); Enter, F2 or typing changes it, Escape puts
|
|
14
|
+
it back, Tab keeps and moves along. Space ticks a checkbox; Delete empties a
|
|
15
|
+
cell. A row's title has Open beside it. Columns are resized by their edge and
|
|
16
|
+
sorted, hidden and moved from their name's menu. It scrolls sideways inside
|
|
17
|
+
itself on a narrow screen. */
|
|
18
|
+
const MIN_WIDTH = 96;
|
|
19
|
+
const widthOf = (view, property) => view.widths?.[property.id] ?? (property.type === "title" ? 260 : property.type === "checkbox" ? 110 : 180);
|
|
20
|
+
export function TableView({ properties, rows, view, onViewChange, onSetValue, onAddRow, onOpenRow, }) {
|
|
21
|
+
const columns = shownProperties(properties, view);
|
|
22
|
+
const [at, setAt] = useState({ r: 0, c: 0 });
|
|
23
|
+
// The cell being changed, by its row's id and its column: a row that moves (the
|
|
24
|
+
// change re-sorts it, or filters it out) takes the change with it, or ends it.
|
|
25
|
+
const [editingCell, setEditing] = useState(null);
|
|
26
|
+
const editingR = editingCell ? rows.findIndex((row) => row.id === editingCell.id) : -1;
|
|
27
|
+
const editing = editingCell && editingR !== -1 ? { r: editingR, c: editingCell.c, seed: editingCell.seed } : null;
|
|
28
|
+
const grid = useRef(null);
|
|
29
|
+
const r0 = Math.min(at.r, Math.max(0, rows.length - 1));
|
|
30
|
+
const c0 = Math.min(at.c, columns.length - 1);
|
|
31
|
+
// At once, so a second key pressed quickly comes from the new cell; a frame
|
|
32
|
+
// later as well, for a cell that is only now being drawn (a row just added).
|
|
33
|
+
// When a change ends without a move (Escape, a click elsewhere), focus comes
|
|
34
|
+
// back to the cell only if it has nowhere else to be: a click on the search or
|
|
35
|
+
// another cell keeps it there.
|
|
36
|
+
const focusCell = (r, c, onlyIfLost = false) => {
|
|
37
|
+
setAt({ r, c });
|
|
38
|
+
const find = () => grid.current?.querySelector(`[data-cell="${r}-${c}"]`);
|
|
39
|
+
if (!onlyIfLost)
|
|
40
|
+
find()?.focus();
|
|
41
|
+
requestAnimationFrame(() => {
|
|
42
|
+
const cell = find();
|
|
43
|
+
const active = document.activeElement;
|
|
44
|
+
const lost = active === null || active === document.body || (onlyIfLost ? false : !cell?.contains(active));
|
|
45
|
+
if (cell && lost)
|
|
46
|
+
cell.focus();
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const done = (move) => {
|
|
50
|
+
const from = editing ?? { r: r0, c: c0 };
|
|
51
|
+
setEditing(null);
|
|
52
|
+
if (move === "down")
|
|
53
|
+
focusCell(Math.min(rows.length - 1, from.r + 1), from.c);
|
|
54
|
+
else if (move === "right")
|
|
55
|
+
focusCell(from.r, Math.min(columns.length - 1, from.c + 1));
|
|
56
|
+
else if (move === "left")
|
|
57
|
+
focusCell(from.r, Math.max(0, from.c - 1));
|
|
58
|
+
else
|
|
59
|
+
focusCell(from.r, from.c, true);
|
|
60
|
+
};
|
|
61
|
+
const startEditing = (r, c, seed) => setEditing({ id: rows[r].id, c, seed });
|
|
62
|
+
const onKeyDown = (e, r, c) => {
|
|
63
|
+
// Keys on what is inside the cell (Open, a link) are theirs.
|
|
64
|
+
if (editing || e.target !== e.currentTarget)
|
|
65
|
+
return;
|
|
66
|
+
const row = rows[r];
|
|
67
|
+
const property = columns[c];
|
|
68
|
+
const moves = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] };
|
|
69
|
+
if (moves[e.key]) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
const [dr, dc] = moves[e.key];
|
|
72
|
+
focusCell(Math.max(0, Math.min(rows.length - 1, r + dr)), Math.max(0, Math.min(columns.length - 1, c + dc)));
|
|
73
|
+
}
|
|
74
|
+
else if (e.key === "Home" || e.key === "End") {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
focusCell(r, e.key === "Home" ? 0 : columns.length - 1);
|
|
77
|
+
}
|
|
78
|
+
else if (e.key === " " && property.type === "checkbox") {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
onSetValue(row, property, row.values[property.id] !== true);
|
|
81
|
+
}
|
|
82
|
+
else if (e.key === "Enter" || e.key === "F2") {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
if (property.type === "checkbox")
|
|
85
|
+
onSetValue(row, property, row.values[property.id] !== true);
|
|
86
|
+
else
|
|
87
|
+
startEditing(r, c);
|
|
88
|
+
}
|
|
89
|
+
else if ((e.key === "Delete" || e.key === "Backspace") && property.type !== "title") {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
onSetValue(row, property, property.type === "checkbox" ? false : property.type === "multiSelect" ? [] : null);
|
|
92
|
+
}
|
|
93
|
+
else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey && !editsInPopover(property) && property.type !== "checkbox") {
|
|
94
|
+
// Typing starts a change with what was typed, as in a spreadsheet.
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
startEditing(r, c, e.key);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const resize = (e, property) => {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
const startX = e.clientX;
|
|
103
|
+
const start = widthOf(view, property);
|
|
104
|
+
const el = e.currentTarget;
|
|
105
|
+
el.setPointerCapture(e.pointerId);
|
|
106
|
+
let width = start;
|
|
107
|
+
const th = el.closest("th");
|
|
108
|
+
const move = (ev) => {
|
|
109
|
+
width = Math.max(MIN_WIDTH, Math.round(start + ev.clientX - startX));
|
|
110
|
+
th.style.width = `${width}px`;
|
|
111
|
+
};
|
|
112
|
+
const up = () => {
|
|
113
|
+
el.removeEventListener("pointermove", move);
|
|
114
|
+
el.removeEventListener("pointerup", up);
|
|
115
|
+
el.removeEventListener("pointercancel", up);
|
|
116
|
+
if (width !== start)
|
|
117
|
+
onViewChange({ ...view, widths: { ...view.widths, [property.id]: width } });
|
|
118
|
+
};
|
|
119
|
+
el.addEventListener("pointermove", move);
|
|
120
|
+
el.addEventListener("pointerup", up);
|
|
121
|
+
el.addEventListener("pointercancel", up);
|
|
122
|
+
};
|
|
123
|
+
// Swaps two shown columns within the order of all of them, so a hidden column
|
|
124
|
+
// keeps its place for when it is shown again.
|
|
125
|
+
const moveColumn = (index, by) => {
|
|
126
|
+
const to = index + by;
|
|
127
|
+
if (to < 0 || to >= columns.length)
|
|
128
|
+
return;
|
|
129
|
+
const all = shownProperties(properties, { ...view, hidden: [] }).map((p) => p.id);
|
|
130
|
+
const a = all.indexOf(columns[index].id);
|
|
131
|
+
const b = all.indexOf(columns[to].id);
|
|
132
|
+
[all[a], all[b]] = [all[b], all[a]];
|
|
133
|
+
onViewChange({ ...view, order: all });
|
|
134
|
+
};
|
|
135
|
+
return (_jsxs("div", { children: [_jsx("div", { ref: grid, className: "pb-1.5 overflow-x-auto overscroll-x-contain", children: _jsxs("table", { role: "grid", "aria-label": view.name, "aria-rowcount": rows.length + 1, className: "border-collapse text-sm table-fixed", style: { width: columns.reduce((w, p) => w + widthOf(view, p), 0) }, children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((property, c) => {
|
|
136
|
+
const Icon = PROPERTY_ICONS[property.type];
|
|
137
|
+
const sorted = view.sort.find((s) => s.property === property.id);
|
|
138
|
+
return (_jsxs("th", { scope: "col", "aria-sort": sorted ? (sorted.direction === "asc" ? "ascending" : "descending") : undefined, style: { width: widthOf(view, property) }, className: "relative p-0 border-hairline border-y border-r last:border-r-0 font-normal text-ink-secondary text-left", children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "flex items-center gap-1.5 hover:bg-tint-hover px-2 w-full h-control-md text-left", children: [_jsx(Icon, { className: "size-3.5 text-ink-tertiary shrink-0", "aria-hidden": true }), _jsx("span", { className: "truncate", children: property.name }), sorted &&
|
|
139
|
+
(sorted.direction === "asc" ? (_jsx(ArrowUpNarrowWide, { className: "ml-auto size-3.5", "aria-hidden": true })) : (_jsx(ArrowDownWideNarrow, { className: "ml-auto size-3.5", "aria-hidden": true })))] }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsxs(DropdownMenuItem, { onSelect: () => onViewChange({ ...view, sort: [{ property: property.id, direction: "asc" }] }), children: [_jsx(ArrowUpNarrowWide, {}), " Sort ascending"] }), _jsxs(DropdownMenuItem, { onSelect: () => onViewChange({ ...view, sort: [{ property: property.id, direction: "desc" }] }), children: [_jsx(ArrowDownWideNarrow, {}), " Sort descending"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: c === 0, onSelect: () => moveColumn(c, -1), children: [_jsx(ArrowLeft, {}), " Move left"] }), _jsxs(DropdownMenuItem, { disabled: c === columns.length - 1, onSelect: () => moveColumn(c, 1), children: [_jsx(ArrowRight, {}), " Move right"] }), property.type !== "title" && (_jsxs(DropdownMenuItem, { onSelect: () => onViewChange({ ...view, hidden: [...view.hidden, property.id] }), children: [_jsx(EyeOff, {}), " Hide"] }))] })] }), _jsx("span", { "aria-hidden": true, onPointerDown: (e) => resize(e, property), className: "top-0 -right-1 z-1 absolute hover:bg-accent/40 w-2 h-full cursor-col-resize touch-none" })] }, property.id));
|
|
140
|
+
}) }) }), _jsx("tbody", { children: rows.map((row, r) => (_jsx("tr", { className: "group/tr", children: columns.map((property, c) => {
|
|
141
|
+
const current = r === r0 && c === c0;
|
|
142
|
+
const isEditing = editing?.r === r && editing.c === c;
|
|
143
|
+
const value = row.values[property.id];
|
|
144
|
+
const popover = editsInPopover(property);
|
|
145
|
+
return (_jsx("td", { "data-cell": `${r}-${c}`, role: "gridcell", tabIndex: current && !isEditing ? 0 : -1, "aria-label": property.type === "checkbox" ? `${property.name}: ${value ? "yes" : "no"}` : undefined, onKeyDown: (e) => onKeyDown(e, r, c), onClick: () => {
|
|
146
|
+
setAt({ r, c });
|
|
147
|
+
if (property.type === "checkbox")
|
|
148
|
+
onSetValue(row, property, value !== true);
|
|
149
|
+
}, onDoubleClick: () => property.type !== "checkbox" && startEditing(r, c), className: cn("relative p-0 border-hairline border-y border-r last:border-r-0 h-control-md align-middle outline-none", "focus-visible:shadow-[inset_0_0_0_2px_var(--accent)]", property.type === "number" && "text-right"), children: isEditing && !popover ? (_jsx("div", { className: "absolute inset-0 z-1 shadow-[inset_0_0_0_2px_var(--accent)]", children: _jsx(CellEditor, { property: property, value: value, seed: editing.seed, onChange: (v) => onSetValue(row, property, v), onDone: done }) })) : (_jsxs(Popover, { open: isEditing && popover, onOpenChange: (open) => !open && done(), children: [_jsx(PopoverAnchor, { asChild: true, children: _jsxs("div", { className: "flex items-center gap-1 px-2 py-1 min-h-control-md overflow-hidden", children: [_jsx(CellValue, { property: property, value: value,
|
|
150
|
+
// A link in a cell is clicked, not tabbed to: the grid is one stop.
|
|
151
|
+
linkTabIndex: -1, className: cn(property.type === "number" && "ml-auto") }), property.type === "title" && isEmpty(value ?? null) && (_jsx("span", { className: "text-ink-tertiary", children: "Untitled" })), property.type === "title" && onOpenRow && (_jsxs(Button, { variant: "secondary", size: "sm", tabIndex: current ? 0 : -1, onClick: (e) => {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
onOpenRow(row);
|
|
154
|
+
}, className: "ml-auto h-6 text-caption affordance group-hover/tr:opacity-100 [@media(hover:none)]:opacity-100", children: [_jsx(Maximize2, {}), " Open"] }))] }) }), isEditing && popover && (_jsx(PopoverContent, { align: "start", className: "p-0 w-auto", children: _jsx(CellEditor, { property: property, value: value, onChange: (v) => onSetValue(row, property, v), onDone: done }) }))] })) }, property.id));
|
|
155
|
+
}) }, row.id))) })] }) }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: onAddRow, className: "text-ink-tertiary", children: [_jsx(Plus, {}), " New"] })] }));
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=table-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-view.js","sourceRoot":"","sources":["../../../../src/components/ui/database/table-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAA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