@kujoforall/paper-ui 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/README.md +50 -7
- package/dist/components/editor/block-text.d.ts.map +1 -1
- package/dist/components/editor/block-text.js +52 -17
- package/dist/components/editor/block-text.js.map +1 -1
- package/dist/components/editor/blocks.d.ts.map +1 -1
- package/dist/components/editor/blocks.js +17 -13
- package/dist/components/editor/blocks.js.map +1 -1
- package/dist/components/editor/document-editor.d.ts.map +1 -1
- package/dist/components/editor/document-editor.js +4 -2
- package/dist/components/editor/document-editor.js.map +1 -1
- package/dist/components/editor/document-view.d.ts.map +1 -1
- package/dist/components/editor/document-view.js +17 -12
- package/dist/components/editor/document-view.js.map +1 -1
- package/dist/components/editor/editor-state.d.ts +7 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -1
- package/dist/components/editor/editor-state.js +28 -3
- package/dist/components/editor/editor-state.js.map +1 -1
- package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
- package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
- package/dist/components/editor/extensions/kit-blocks.js +201 -0
- package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -1
- package/dist/components/editor/extensions/spoiler.js +2 -2
- package/dist/components/editor/extensions/spoiler.js.map +1 -1
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.d.ts.map +1 -1
- package/dist/components/editor/index.js +1 -0
- package/dist/components/editor/index.js.map +1 -1
- package/dist/components/editor/kinds.js +1 -1
- package/dist/components/editor/kinds.js.map +1 -1
- package/dist/components/editor/look.d.ts +18 -0
- package/dist/components/editor/look.d.ts.map +1 -0
- package/dist/components/editor/look.js +21 -0
- package/dist/components/editor/look.js.map +1 -0
- package/dist/components/three/model-viewer.d.ts +36 -0
- package/dist/components/three/model-viewer.d.ts.map +1 -0
- package/dist/components/three/model-viewer.js +338 -0
- package/dist/components/three/model-viewer.js.map +1 -0
- package/dist/components/ui/accent-picker.js +1 -1
- package/dist/components/ui/accent-picker.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +29 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +72 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/animated-height.d.ts +6 -0
- package/dist/components/ui/animated-height.d.ts.map +1 -0
- package/dist/components/ui/animated-height.js +26 -0
- package/dist/components/ui/animated-height.js.map +1 -0
- package/dist/components/ui/app-shell.d.ts +1 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -1
- package/dist/components/ui/app-shell.js +5 -3
- package/dist/components/ui/app-shell.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +30 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +2 -2
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/banner.d.ts +33 -0
- package/dist/components/ui/banner.d.ts.map +1 -0
- package/dist/components/ui/banner.js +21 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/breadcrumbs.js +1 -1
- package/dist/components/ui/breadcrumbs.js.map +1 -1
- package/dist/components/ui/button.d.ts +8 -6
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +91 -26
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +6 -5
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/callout.d.ts +23 -4
- package/dist/components/ui/callout.d.ts.map +1 -1
- package/dist/components/ui/callout.js +28 -15
- package/dist/components/ui/callout.js.map +1 -1
- package/dist/components/ui/card.d.ts +13 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +10 -9
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +9 -4
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +25 -5
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/choice-label.d.ts +13 -0
- package/dist/components/ui/choice-label.d.ts.map +1 -0
- package/dist/components/ui/choice-label.js +17 -0
- package/dist/components/ui/choice-label.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +10 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/collection-layout.d.ts +24 -0
- package/dist/components/ui/collection-layout.d.ts.map +1 -0
- package/dist/components/ui/collection-layout.js +16 -0
- package/dist/components/ui/collection-layout.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +10 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +93 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command-menu.d.ts +5 -2
- package/dist/components/ui/command-menu.d.ts.map +1 -1
- package/dist/components/ui/command-menu.js +31 -6
- package/dist/components/ui/command-menu.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +19 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +42 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/copy-button.d.ts +11 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +48 -0
- package/dist/components/ui/copy-button.js.map +1 -0
- package/dist/components/ui/database/calendar-view.d.ts +10 -0
- package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
- package/dist/components/ui/database/calendar-view.js +65 -0
- package/dist/components/ui/database/calendar-view.js.map +1 -0
- package/dist/components/ui/database/card-views.d.ts +22 -0
- package/dist/components/ui/database/card-views.d.ts.map +1 -0
- package/dist/components/ui/database/card-views.js +74 -0
- package/dist/components/ui/database/card-views.js.map +1 -0
- package/dist/components/ui/database/cells.d.ts +20 -0
- package/dist/components/ui/database/cells.d.ts.map +1 -0
- package/dist/components/ui/database/cells.js +132 -0
- package/dist/components/ui/database/cells.js.map +1 -0
- package/dist/components/ui/database/database.d.ts +19 -0
- package/dist/components/ui/database/database.d.ts.map +1 -0
- package/dist/components/ui/database/database.js +102 -0
- package/dist/components/ui/database/database.js.map +1 -0
- package/dist/components/ui/database/icons.d.ts +5 -0
- package/dist/components/ui/database/icons.d.ts.map +1 -0
- package/dist/components/ui/database/icons.js +13 -0
- package/dist/components/ui/database/icons.js.map +1 -0
- package/dist/components/ui/database/table-view.d.ts +11 -0
- package/dist/components/ui/database/table-view.d.ts.map +1 -0
- package/dist/components/ui/database/table-view.js +157 -0
- package/dist/components/ui/database/table-view.js.map +1 -0
- package/dist/components/ui/date-picker.d.ts +6 -1
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/date-picker.js +20 -12
- package/dist/components/ui/date-picker.js.map +1 -1
- package/dist/components/ui/date-time-picker.d.ts +3 -1
- package/dist/components/ui/date-time-picker.d.ts.map +1 -1
- package/dist/components/ui/date-time-picker.js +17 -15
- package/dist/components/ui/date-time-picker.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +13 -9
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +33 -3
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/document-layout.d.ts +15 -0
- package/dist/components/ui/document-layout.d.ts.map +1 -0
- package/dist/components/ui/document-layout.js +15 -0
- package/dist/components/ui/document-layout.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +14 -10
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +22 -13
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/editable-text.d.ts +9 -2
- package/dist/components/ui/editable-text.d.ts.map +1 -1
- package/dist/components/ui/editable-text.js +27 -10
- package/dist/components/ui/editable-text.js.map +1 -1
- package/dist/components/ui/empty-state.d.ts +11 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty-state.js +9 -0
- package/dist/components/ui/empty-state.js.map +1 -0
- package/dist/components/ui/error-state.d.ts +20 -0
- package/dist/components/ui/error-state.d.ts.map +1 -0
- package/dist/components/ui/error-state.js +17 -0
- package/dist/components/ui/error-state.js.map +1 -0
- package/dist/components/ui/field-button.d.ts +2 -1
- package/dist/components/ui/field-button.d.ts.map +1 -1
- package/dist/components/ui/field-button.js +7 -5
- package/dist/components/ui/field-button.js.map +1 -1
- package/dist/components/ui/file-preview.js +1 -1
- package/dist/components/ui/file-preview.js.map +1 -1
- package/dist/components/ui/file-uploader.d.ts.map +1 -1
- package/dist/components/ui/file-uploader.js +5 -4
- package/dist/components/ui/file-uploader.js.map +1 -1
- package/dist/components/ui/filter-builder.d.ts +18 -0
- package/dist/components/ui/filter-builder.d.ts.map +1 -0
- package/dist/components/ui/filter-builder.js +98 -0
- package/dist/components/ui/filter-builder.js.map +1 -0
- package/dist/components/ui/focus-shell.d.ts +14 -0
- package/dist/components/ui/focus-shell.d.ts.map +1 -0
- package/dist/components/ui/focus-shell.js +13 -0
- package/dist/components/ui/focus-shell.js.map +1 -0
- package/dist/components/ui/handle-row.d.ts +11 -1
- package/dist/components/ui/handle-row.d.ts.map +1 -1
- package/dist/components/ui/handle-row.js +101 -32
- package/dist/components/ui/handle-row.js.map +1 -1
- package/dist/components/ui/header-bar.d.ts +5 -0
- package/dist/components/ui/header-bar.d.ts.map +1 -0
- package/dist/components/ui/header-bar.js +10 -0
- package/dist/components/ui/header-bar.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +13 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/image-block.js +4 -4
- package/dist/components/ui/image-block.js.map +1 -1
- package/dist/components/ui/image-card.d.ts.map +1 -1
- package/dist/components/ui/image-card.js +5 -4
- package/dist/components/ui/image-card.js.map +1 -1
- package/dist/components/ui/image-framer.d.ts +24 -0
- package/dist/components/ui/image-framer.d.ts.map +1 -0
- package/dist/components/ui/image-framer.js +89 -0
- package/dist/components/ui/image-framer.js.map +1 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -1
- package/dist/components/ui/image-viewer.js +38 -5
- package/dist/components/ui/image-viewer.js.map +1 -1
- package/dist/components/ui/image.d.ts +25 -3
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +50 -21
- package/dist/components/ui/image.js.map +1 -1
- package/dist/components/ui/index.d.ts +54 -11
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +53 -10
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/input.d.ts +71 -12
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +236 -23
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/link-block.d.ts.map +1 -1
- package/dist/components/ui/link-block.js +1 -1
- package/dist/components/ui/link-block.js.map +1 -1
- package/dist/components/ui/list-detail.d.ts +23 -0
- package/dist/components/ui/list-detail.d.ts.map +1 -0
- package/dist/components/ui/list-detail.js +33 -0
- package/dist/components/ui/list-detail.js.map +1 -0
- package/dist/components/ui/listbox.d.ts +7 -0
- package/dist/components/ui/listbox.d.ts.map +1 -0
- package/dist/components/ui/listbox.js +29 -0
- package/dist/components/ui/listbox.js.map +1 -0
- package/dist/components/ui/mac-card.js +1 -1
- package/dist/components/ui/mac-card.js.map +1 -1
- package/dist/components/ui/month-picker.d.ts +13 -0
- package/dist/components/ui/month-picker.d.ts.map +1 -0
- package/dist/components/ui/month-picker.js +53 -0
- package/dist/components/ui/month-picker.js.map +1 -0
- package/dist/components/ui/multi-select.d.ts +22 -0
- package/dist/components/ui/multi-select.d.ts.map +1 -0
- package/dist/components/ui/multi-select.js +88 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -1
- package/dist/components/ui/nav-tree.js +10 -3
- package/dist/components/ui/nav-tree.js.map +1 -1
- package/dist/components/ui/page.d.ts +16 -5
- package/dist/components/ui/page.d.ts.map +1 -1
- package/dist/components/ui/page.js +23 -10
- package/dist/components/ui/page.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +26 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +54 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/picker-panel.d.ts +13 -0
- package/dist/components/ui/picker-panel.d.ts.map +1 -0
- package/dist/components/ui/picker-panel.js +19 -0
- package/dist/components/ui/picker-panel.js.map +1 -0
- package/dist/components/ui/popover.d.ts +2 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +11 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +17 -4
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/property.d.ts +2 -6
- package/dist/components/ui/property.d.ts.map +1 -1
- package/dist/components/ui/property.js +6 -22
- package/dist/components/ui/property.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +18 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/rating.d.ts +14 -0
- package/dist/components/ui/rating.d.ts.map +1 -0
- package/dist/components/ui/rating.js +61 -0
- package/dist/components/ui/rating.js.map +1 -0
- package/dist/components/ui/save-status.d.ts +8 -0
- package/dist/components/ui/save-status.d.ts.map +1 -0
- package/dist/components/ui/save-status.js +31 -0
- package/dist/components/ui/save-status.js.map +1 -0
- package/dist/components/ui/segmented.d.ts +15 -7
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +8 -6
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select-menu.d.ts +3 -1
- package/dist/components/ui/select-menu.d.ts.map +1 -1
- package/dist/components/ui/select-menu.js +2 -2
- package/dist/components/ui/select-menu.js.map +1 -1
- package/dist/components/ui/select.d.ts +7 -2
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +19 -5
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/selection-bar.js +1 -1
- package/dist/components/ui/selection-bar.js.map +1 -1
- package/dist/components/ui/settings-layout.d.ts +34 -0
- package/dist/components/ui/settings-layout.d.ts.map +1 -0
- package/dist/components/ui/settings-layout.js +16 -0
- package/dist/components/ui/settings-layout.js.map +1 -0
- package/dist/components/ui/share-link.d.ts +14 -0
- package/dist/components/ui/share-link.d.ts.map +1 -0
- package/dist/components/ui/share-link.js +16 -0
- package/dist/components/ui/share-link.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +21 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +53 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +82 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +258 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +8 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +12 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +14 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -1
- package/dist/components/ui/spotlight.js +14 -11
- package/dist/components/ui/spotlight.js.map +1 -1
- package/dist/components/ui/step-dialog.js +3 -3
- package/dist/components/ui/step-dialog.js.map +1 -1
- package/dist/components/ui/steps-layout.d.ts +20 -0
- package/dist/components/ui/steps-layout.d.ts.map +1 -0
- package/dist/components/ui/steps-layout.js +26 -0
- package/dist/components/ui/steps-layout.js.map +1 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +13 -5
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +65 -12
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +19 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +14 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.js +69 -41
- package/dist/components/ui/theme-toggle.js.map +1 -1
- package/dist/components/ui/time-list.d.ts +16 -0
- package/dist/components/ui/time-list.d.ts.map +1 -0
- package/dist/components/ui/time-list.js +49 -0
- package/dist/components/ui/time-list.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +37 -11
- package/dist/components/ui/time-picker.d.ts.map +1 -1
- package/dist/components/ui/time-picker.js +130 -52
- package/dist/components/ui/time-picker.js.map +1 -1
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +77 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +15 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +55 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -2
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/top-bar.d.ts +25 -0
- package/dist/components/ui/top-bar.d.ts.map +1 -0
- package/dist/components/ui/top-bar.js +23 -0
- package/dist/components/ui/top-bar.js.map +1 -0
- package/dist/components/ui/typography.d.ts +11 -5
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/components/ui/typography.js +31 -5
- package/dist/components/ui/typography.js.map +1 -1
- package/dist/components/ui/video-block.d.ts.map +1 -1
- package/dist/components/ui/video-block.js +5 -1
- package/dist/components/ui/video-block.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +5 -0
- package/dist/hooks/use-dismiss.d.ts.map +1 -0
- package/dist/hooks/use-dismiss.js +23 -0
- package/dist/hooks/use-dismiss.js.map +1 -0
- package/dist/hooks/use-escape-first.d.ts +3 -0
- package/dist/hooks/use-escape-first.d.ts.map +1 -0
- package/dist/hooks/use-escape-first.js +27 -0
- package/dist/hooks/use-escape-first.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +5 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +16 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -1
- package/dist/hooks/use-save-queue.js +19 -7
- package/dist/hooks/use-save-queue.js.map +1 -1
- package/dist/hooks/use-selection.d.ts.map +1 -1
- package/dist/hooks/use-selection.js +10 -1
- package/dist/hooks/use-selection.js.map +1 -1
- package/dist/lib/database.d.ts +92 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +272 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/dates.d.ts +16 -0
- package/dist/lib/dates.d.ts.map +1 -1
- package/dist/lib/dates.js +27 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/keys.d.ts +18 -0
- package/dist/lib/keys.d.ts.map +1 -0
- package/dist/lib/keys.js +66 -0
- package/dist/lib/keys.js.map +1 -0
- package/dist/lib/number.d.ts +4 -0
- package/dist/lib/number.d.ts.map +1 -0
- package/dist/lib/number.js +33 -0
- package/dist/lib/number.js.map +1 -0
- package/dist/lib/pointer.d.ts +2 -0
- package/dist/lib/pointer.d.ts.map +1 -0
- package/dist/lib/pointer.js +4 -0
- package/dist/lib/pointer.js.map +1 -0
- package/dist/lib/prepare-image.d.ts +43 -0
- package/dist/lib/prepare-image.d.ts.map +1 -0
- package/dist/lib/prepare-image.js +105 -0
- package/dist/lib/prepare-image.js.map +1 -0
- package/dist/lib/rich-text-dom.d.ts +2 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -1
- package/dist/lib/rich-text-dom.js +5 -3
- package/dist/lib/rich-text-dom.js.map +1 -1
- package/dist/lib/theme.d.ts +6 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +15 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/time.d.ts +19 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +91 -0
- package/dist/lib/time.js.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +20 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles/notion.css +342 -51
- package/package.json +27 -4
- package/src/components/editor/block-text.tsx +58 -17
- package/src/components/editor/blocks.tsx +19 -14
- package/src/components/editor/document-editor.tsx +7 -2
- package/src/components/editor/document-view.tsx +37 -24
- package/src/components/editor/editor-state.tsx +31 -3
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +9 -4
- package/src/components/editor/index.ts +1 -0
- package/src/components/editor/kinds.ts +1 -1
- package/src/components/editor/look.tsx +36 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +2 -2
- package/src/components/ui/alert-dialog.tsx +136 -0
- package/src/components/ui/animated-height.tsx +34 -0
- package/src/components/ui/app-shell.tsx +9 -7
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +4 -4
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +1 -1
- package/src/components/ui/button.tsx +115 -41
- package/src/components/ui/calendar.tsx +8 -7
- package/src/components/ui/callout.tsx +41 -42
- package/src/components/ui/card.tsx +27 -58
- package/src/components/ui/checkbox.tsx +53 -19
- package/src/components/ui/choice-label.tsx +43 -0
- package/src/components/ui/collapsible.tsx +58 -0
- package/src/components/ui/collection-layout.tsx +69 -0
- package/src/components/ui/combobox.tsx +155 -0
- package/src/components/ui/command-menu.tsx +61 -31
- package/src/components/ui/context-menu.tsx +89 -0
- package/src/components/ui/copy-button.tsx +80 -0
- package/src/components/ui/database/calendar-view.tsx +180 -0
- package/src/components/ui/database/card-views.tsx +221 -0
- package/src/components/ui/database/cells.tsx +237 -0
- package/src/components/ui/database/database.tsx +279 -0
- package/src/components/ui/database/icons.ts +15 -0
- package/src/components/ui/database/table-view.tsx +311 -0
- package/src/components/ui/date-picker.tsx +99 -61
- package/src/components/ui/date-time-picker.tsx +68 -62
- package/src/components/ui/dialog.tsx +48 -21
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +33 -31
- package/src/components/ui/editable-text.tsx +40 -7
- package/src/components/ui/empty-state.tsx +35 -0
- package/src/components/ui/error-state.tsx +67 -0
- package/src/components/ui/field-button.tsx +11 -9
- package/src/components/ui/file-preview.tsx +1 -1
- package/src/components/ui/file-uploader.tsx +23 -24
- package/src/components/ui/filter-builder.tsx +304 -0
- package/src/components/ui/focus-shell.tsx +48 -0
- package/src/components/ui/handle-row.tsx +176 -40
- package/src/components/ui/header-bar.tsx +15 -0
- package/src/components/ui/hover-card.tsx +30 -0
- package/src/components/ui/image-block.tsx +6 -6
- package/src/components/ui/image-card.tsx +18 -25
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +53 -10
- package/src/components/ui/image.tsx +133 -29
- package/src/components/ui/index.ts +106 -11
- package/src/components/ui/input.tsx +437 -65
- package/src/components/ui/link-block.tsx +5 -2
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +5 -5
- package/src/components/ui/month-picker.tsx +119 -0
- package/src/components/ui/multi-select.tsx +221 -0
- package/src/components/ui/nav-tree.tsx +11 -5
- package/src/components/ui/page.tsx +63 -15
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +3 -3
- package/src/components/ui/progress.tsx +56 -16
- package/src/components/ui/property.tsx +6 -37
- package/src/components/ui/radio-group.tsx +61 -0
- package/src/components/ui/rating.tsx +122 -0
- package/src/components/ui/save-status.tsx +53 -0
- package/src/components/ui/segmented.tsx +48 -16
- package/src/components/ui/select-menu.tsx +11 -3
- package/src/components/ui/select.tsx +33 -10
- package/src/components/ui/selection-bar.tsx +1 -1
- package/src/components/ui/settings-layout.tsx +117 -0
- package/src/components/ui/share-link.tsx +66 -0
- package/src/components/ui/sheet.tsx +90 -0
- package/src/components/ui/sidebar.tsx +627 -0
- package/src/components/ui/skeleton.tsx +22 -0
- package/src/components/ui/spinner.tsx +28 -0
- package/src/components/ui/spotlight.tsx +21 -21
- package/src/components/ui/step-dialog.tsx +6 -6
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +75 -18
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +74 -83
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +305 -134
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +20 -6
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +45 -9
- package/src/components/ui/video-block.tsx +9 -3
- package/src/hooks/use-dismiss.ts +24 -0
- package/src/hooks/use-escape-first.ts +25 -0
- package/src/hooks/use-media-query.ts +23 -0
- package/src/hooks/use-save-queue.ts +19 -7
- package/src/hooks/use-selection.ts +8 -1
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +36 -0
- package/src/lib/keys.ts +72 -0
- package/src/lib/number.ts +29 -0
- package/src/lib/pointer.ts +3 -0
- package/src/lib/prepare-image.ts +141 -0
- package/src/lib/rich-text-dom.ts +5 -3
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/utils.ts +21 -2
- package/src/styles/notion.css +342 -51
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 } from "react";
|
|
6
|
+
import { groupRows, isEmpty, shownProperties, titleOf } from "../../../lib/database.js";
|
|
7
|
+
import { cn } from "../../../lib/utils.js";
|
|
8
|
+
import { Badge } from "../badge.js";
|
|
9
|
+
import { Button } from "../button.js";
|
|
10
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../dropdown-menu.js";
|
|
11
|
+
import { EmptyState } from "../empty-state.js";
|
|
12
|
+
import { Image } from "../image.js";
|
|
13
|
+
import { CellValue } from "./cells.js";
|
|
14
|
+
/* The views made of cards and lines: board, gallery and list. A card or a line
|
|
15
|
+
opens its row (onOpenRow); the properties shown under its title are the view's
|
|
16
|
+
own (hidden ones left out, empty ones skipped). */
|
|
17
|
+
function Title({ row, properties }) {
|
|
18
|
+
const title = titleOf(properties);
|
|
19
|
+
const v = title ? row.values[title.id] : null;
|
|
20
|
+
return isEmpty(v ?? null) ? _jsx("span", { className: "text-ink-tertiary", children: "Untitled" }) : _jsx(_Fragment, { children: String(v) });
|
|
21
|
+
}
|
|
22
|
+
function Facts({ row, properties, skip }) {
|
|
23
|
+
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));
|
|
24
|
+
if (facts.length === 0)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsx("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 mt-1.5 text-caption text-ink-secondary", children: facts.map((p) => (_jsxs("span", { className: "inline-flex items-center gap-1 max-w-full", children: [p.type === "checkbox" && _jsx("span", { children: p.name }), _jsx(CellValue, { property: p, value: row.values[p.id], plain: true })] }, p.id))) }));
|
|
27
|
+
}
|
|
28
|
+
/* ── Board ─────────────────────────────────────────────────────────────────
|
|
29
|
+
A column for each option of the view's select (`groupBy`), and one for no
|
|
30
|
+
value. Cards are dragged between columns (a short press on a touch screen); a
|
|
31
|
+
card's menu moves it from the keyboard. "New" in a column adds a row there.
|
|
32
|
+
On a phone the columns scroll sideways, a column at a time. */
|
|
33
|
+
function BoardCard({ row, properties, view, groups, onOpenRow, onMoveTo, overlay = false }) {
|
|
34
|
+
const drag = useDraggable({ id: row.id, disabled: overlay });
|
|
35
|
+
const groupBy = properties.find((p) => p.id === view.groupBy);
|
|
36
|
+
return (_jsxs("div", { ref: drag.setNodeRef, ...drag.listeners, className: cn("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", drag.isDragging && "opacity-40", overlay && "shadow-popover rotate-1 cursor-grabbing"), children: [_jsx("button", { type: "button", onClick: () => onOpenRow?.(row), className: "pr-6 w-full font-medium text-left break-words after:absolute after:inset-0 after:content-['']", children: _jsx(Title, { row: row, properties: properties }) }), _jsx(Facts, { row: row, properties: shownProperties(properties, view), skip: view.groupBy }), !overlay && groupBy && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(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", children: _jsx(MoreHorizontal, {}) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsx(DropdownMenuLabel, { children: "Move to" }), groups.map((g) => (_jsxs(DropdownMenuItem, { disabled: row.values[groupBy.id] === g.key || (g.key === null && isEmpty(row.values[groupBy.id] ?? null)), onSelect: () => onMoveTo(row, g.key), children: [_jsx(ArrowRightLeft, {}), " ", g.option?.name ?? `No ${groupBy.name}`] }, g.key ?? "none")))] })] }))] }));
|
|
37
|
+
}
|
|
38
|
+
function BoardColumn({ group, label, children, onAdd, count }) {
|
|
39
|
+
const drop = useDroppable({ id: group.key ?? "__none" });
|
|
40
|
+
return (_jsxs("section", { ref: drop.setNodeRef, "aria-label": typeof label === "string" ? label : group.option?.name, className: cn("flex flex-col gap-2 bg-surface-sunken p-2 rounded-surface w-68 transition-colors duration-(--duration-fast) snap-start shrink-0", drop.isOver && "bg-accent-tint"), children: [_jsxs("h3", { className: "flex items-center gap-2 px-1 h-control-sm text-sm", children: [label, _jsx("span", { className: "tabular-nums text-ink-tertiary", children: count })] }), children, _jsxs(Button, { variant: "ghost", size: "sm", onClick: onAdd, className: "justify-start text-ink-tertiary", children: [_jsx(Plus, {}), " New"] })] }));
|
|
41
|
+
}
|
|
42
|
+
export function BoardView({ properties, rows, view, onSetValue, onAddRow, onOpenRow }) {
|
|
43
|
+
const groupBy = properties.find((p) => p.id === view.groupBy && p.type === "select");
|
|
44
|
+
const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 4 } }), useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }));
|
|
45
|
+
const [dragging, setDragging] = useState(null);
|
|
46
|
+
if (!groupBy)
|
|
47
|
+
return _jsx(EmptyState, { compact: true, 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." });
|
|
48
|
+
const groups = groupRows(rows, groupBy);
|
|
49
|
+
const moveTo = (row, key) => onSetValue(row, groupBy, key);
|
|
50
|
+
return (_jsxs(DndContext, { sensors: sensors, collisionDetection: pointerWithin, onDragStart: (e) => setDragging(rows.find((r) => r.id === e.active.id) ?? null), onDragCancel: () => setDragging(null), onDragEnd: (e) => {
|
|
51
|
+
setDragging(null);
|
|
52
|
+
const row = rows.find((r) => r.id === e.active.id);
|
|
53
|
+
if (!row || !e.over)
|
|
54
|
+
return;
|
|
55
|
+
const key = e.over.id === "__none" ? null : String(e.over.id);
|
|
56
|
+
if ((row.values[groupBy.id] ?? null) !== key)
|
|
57
|
+
moveTo(row, key);
|
|
58
|
+
}, accessibility: { screenReaderInstructions: { draggable: "Open a card's menu to move it to another column." } }, children: [_jsx("div", { className: "flex items-start gap-3 pb-2 overflow-x-auto overscroll-x-contain snap-x snap-mandatory sm:snap-none", children: groups.map((g) => (_jsx(BoardColumn, { group: g, count: g.rows.length, label: g.option ? _jsx(Badge, { color: g.option.color, children: g.option.name }) : _jsxs("span", { className: "text-ink-secondary", children: ["No ", groupBy.name] }), onAdd: () => onAddRow({ [groupBy.id]: g.key }), children: g.rows.map((row) => (_jsx(BoardCard, { row: row, properties: properties, view: view, groups: groups, onOpenRow: onOpenRow, onMoveTo: moveTo }, row.id))) }, g.key ?? "none"))) }), _jsx(DragOverlay, { dropAnimation: null, children: dragging && (_jsxs("div", { className: "bg-surface shadow-popover p-2.5 rounded-surface text-sm rotate-1 cursor-grabbing", children: [_jsx("div", { className: "font-medium break-words", children: _jsx(Title, { row: dragging, properties: properties }) }), _jsx(Facts, { row: dragging, properties: shownProperties(properties, view), skip: view.groupBy })] })) })] }));
|
|
59
|
+
}
|
|
60
|
+
/* ── Gallery ───────────────────────────────────────────────────────────────
|
|
61
|
+
Cards with the row's cover picture (row.cover) over its title. As many columns
|
|
62
|
+
as fit, one on a small phone. */
|
|
63
|
+
export function GalleryView({ properties, rows, view, onOpenRow }) {
|
|
64
|
+
const shown = shownProperties(properties, view);
|
|
65
|
+
return (_jsx("ul", { className: "gap-3 grid grid-cols-[repeat(auto-fill,minmax(min(14rem,100%),1fr))]", children: rows.map((row) => (_jsxs("li", { className: "group/card relative bg-surface shadow-sm hover:shadow-md rounded-surface overflow-hidden transition-shadow duration-(--duration-fast)", children: [_jsx(Image, { src: row.cover ?? null, alt: "", ratio: "landscape", className: "rounded-none" }), _jsxs("div", { className: "p-2.5 text-sm", children: [_jsx("button", { type: "button", onClick: () => onOpenRow?.(row), className: "w-full font-medium text-left break-words after:absolute after:inset-0 after:content-['']", children: _jsx(Title, { row: row, properties: properties }) }), _jsx(Facts, { row: row, properties: shown })] })] }, row.id))) }));
|
|
66
|
+
}
|
|
67
|
+
/* ── List ──────────────────────────────────────────────────────────────────
|
|
68
|
+
A line per row: its title, and its shown properties at the end (under it on a
|
|
69
|
+
phone). The quietest view. */
|
|
70
|
+
export function ListView({ properties, rows, view, onOpenRow }) {
|
|
71
|
+
const shown = shownProperties(properties, view).filter((p) => p.type !== "title");
|
|
72
|
+
return (_jsx("ul", { className: "@container flex flex-col", children: rows.map((row) => (_jsx("li", { className: "border-hairline border-b", children: _jsxs("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", children: [_jsx("span", { className: "flex-1 min-w-0 font-medium truncate", children: _jsx(Title, { row: row, properties: properties }) }), _jsx("span", { className: "flex flex-wrap items-center gap-2 text-caption text-ink-secondary", children: shown.map((p) => (_jsx(CellValue, { property: p, value: row.values[p.id], plain: true }, p.id))) })] }) }, row.id))) }));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=card-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-views.js","sourceRoot":"","sources":["../../../../src/components/ui/database/card-views.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,WAA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AEhC,MAAM,UAAU,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAyG;IACjK,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAClF,OAAO,CACH,aAAI,SAAS,EAAC,0BAA0B,YACnC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACf,aAAiB,SAAS,EAAC,0BAA0B,YACjD,kBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAC,+HAA+H,aAC5L,eAAM,SAAS,EAAC,qCAAqC,YACjD,KAAC,KAAK,IAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,GAAI,GACxC,EACP,eAAM,SAAS,EAAC,mEAAmE,YAC9E,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACd,KAAC,SAAS,IAAY,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,UAAjD,CAAC,CAAC,EAAE,CAAgD,CACvE,CAAC,GACC,IACF,IAVJ,GAAG,CAAC,EAAE,CAWV,CACR,CAAC,GACD,CACR,CAAC;AACN,CAAC"}
|
|
@@ -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,CAAC,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E,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,UAAU,EAA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AAC,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"}
|