@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,311 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUpNarrowWide, EyeOff, Maximize2, Plus } from "lucide-react";
|
|
4
|
+
import { useRef, useState, type KeyboardEvent, type PointerEvent } from "react";
|
|
5
|
+
import { isEmpty, shownProperties, type Property, type Row, type Value, type View } from "../../../lib/database.ts";
|
|
6
|
+
import { cn } from "../../../lib/utils.ts";
|
|
7
|
+
import { Button } from "../button.tsx";
|
|
8
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../dropdown-menu.tsx";
|
|
9
|
+
import { Popover, PopoverAnchor, PopoverContent } from "../popover.tsx";
|
|
10
|
+
import { CellEditor, CellValue, editsInPopover } from "./cells.tsx";
|
|
11
|
+
import { PROPERTY_ICONS } from "./icons.ts";
|
|
12
|
+
|
|
13
|
+
/* The table view: a spreadsheet of the rows. One cell is current (the arrows move
|
|
14
|
+
it, Home and End to a row's ends); Enter, F2 or typing changes it, Escape puts
|
|
15
|
+
it back, Tab keeps and moves along. Space ticks a checkbox; Delete empties a
|
|
16
|
+
cell. A row's title has Open beside it. Columns are resized by their edge and
|
|
17
|
+
sorted, hidden and moved from their name's menu. It scrolls sideways inside
|
|
18
|
+
itself on a narrow screen. */
|
|
19
|
+
|
|
20
|
+
const MIN_WIDTH = 96;
|
|
21
|
+
const widthOf = (view: View, property: Property) => view.widths?.[property.id] ?? (property.type === "title" ? 260 : property.type === "checkbox" ? 110 : 180);
|
|
22
|
+
|
|
23
|
+
export function TableView({
|
|
24
|
+
properties,
|
|
25
|
+
rows,
|
|
26
|
+
view,
|
|
27
|
+
onViewChange,
|
|
28
|
+
onSetValue,
|
|
29
|
+
onAddRow,
|
|
30
|
+
onOpenRow,
|
|
31
|
+
}: {
|
|
32
|
+
properties: readonly Property[];
|
|
33
|
+
rows: readonly Row[];
|
|
34
|
+
view: View;
|
|
35
|
+
onViewChange: (view: View) => void;
|
|
36
|
+
onSetValue: (row: Row, property: Property, value: Value) => void;
|
|
37
|
+
onAddRow: () => void;
|
|
38
|
+
onOpenRow?: (row: Row) => void;
|
|
39
|
+
}) {
|
|
40
|
+
const columns = shownProperties(properties, view);
|
|
41
|
+
const [at, setAt] = useState<{ r: number; c: number }>({ r: 0, c: 0 });
|
|
42
|
+
// The cell being changed, by its row's id and its column: a row that moves (the
|
|
43
|
+
// change re-sorts it, or filters it out) takes the change with it, or ends it.
|
|
44
|
+
const [editingCell, setEditing] = useState<{ id: string; c: number; seed?: string } | null>(null);
|
|
45
|
+
const editingR = editingCell ? rows.findIndex((row) => row.id === editingCell.id) : -1;
|
|
46
|
+
const editing = editingCell && editingR !== -1 ? { r: editingR, c: editingCell.c, seed: editingCell.seed } : null;
|
|
47
|
+
const grid = useRef<HTMLDivElement>(null);
|
|
48
|
+
const r0 = Math.min(at.r, Math.max(0, rows.length - 1));
|
|
49
|
+
const c0 = Math.min(at.c, columns.length - 1);
|
|
50
|
+
|
|
51
|
+
// At once, so a second key pressed quickly comes from the new cell; a frame
|
|
52
|
+
// later as well, for a cell that is only now being drawn (a row just added).
|
|
53
|
+
// When a change ends without a move (Escape, a click elsewhere), focus comes
|
|
54
|
+
// back to the cell only if it has nowhere else to be: a click on the search or
|
|
55
|
+
// another cell keeps it there.
|
|
56
|
+
const focusCell = (r: number, c: number, onlyIfLost = false) => {
|
|
57
|
+
setAt({ r, c });
|
|
58
|
+
const find = () => grid.current?.querySelector<HTMLElement>(`[data-cell="${r}-${c}"]`);
|
|
59
|
+
if (!onlyIfLost) find()?.focus();
|
|
60
|
+
requestAnimationFrame(() => {
|
|
61
|
+
const cell = find();
|
|
62
|
+
const active = document.activeElement;
|
|
63
|
+
const lost = active === null || active === document.body || (onlyIfLost ? false : !cell?.contains(active));
|
|
64
|
+
if (cell && lost) cell.focus();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const done = (move?: "down" | "right" | "left") => {
|
|
68
|
+
const from = editing ?? { r: r0, c: c0 };
|
|
69
|
+
setEditing(null);
|
|
70
|
+
if (move === "down") focusCell(Math.min(rows.length - 1, from.r + 1), from.c);
|
|
71
|
+
else if (move === "right") focusCell(from.r, Math.min(columns.length - 1, from.c + 1));
|
|
72
|
+
else if (move === "left") focusCell(from.r, Math.max(0, from.c - 1));
|
|
73
|
+
else focusCell(from.r, from.c, true);
|
|
74
|
+
};
|
|
75
|
+
const startEditing = (r: number, c: number, seed?: string) => setEditing({ id: rows[r]!.id, c, seed });
|
|
76
|
+
|
|
77
|
+
const onKeyDown = (e: KeyboardEvent<HTMLDivElement>, r: number, c: number) => {
|
|
78
|
+
// Keys on what is inside the cell (Open, a link) are theirs.
|
|
79
|
+
if (editing || e.target !== e.currentTarget) return;
|
|
80
|
+
const row = rows[r]!;
|
|
81
|
+
const property = columns[c]!;
|
|
82
|
+
const moves: Record<string, [number, number]> = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] };
|
|
83
|
+
if (moves[e.key]) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
const [dr, dc] = moves[e.key]!;
|
|
86
|
+
focusCell(Math.max(0, Math.min(rows.length - 1, r + dr)), Math.max(0, Math.min(columns.length - 1, c + dc)));
|
|
87
|
+
} else if (e.key === "Home" || e.key === "End") {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
focusCell(r, e.key === "Home" ? 0 : columns.length - 1);
|
|
90
|
+
} else if (e.key === " " && property.type === "checkbox") {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
onSetValue(row, property, row.values[property.id] !== true);
|
|
93
|
+
} else if (e.key === "Enter" || e.key === "F2") {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
if (property.type === "checkbox") onSetValue(row, property, row.values[property.id] !== true);
|
|
96
|
+
else startEditing(r, c);
|
|
97
|
+
} else if ((e.key === "Delete" || e.key === "Backspace") && property.type !== "title") {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
onSetValue(row, property, property.type === "checkbox" ? false : property.type === "multiSelect" ? [] : null);
|
|
100
|
+
} else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey && !editsInPopover(property) && property.type !== "checkbox") {
|
|
101
|
+
// Typing starts a change with what was typed, as in a spreadsheet.
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
startEditing(r, c, e.key);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const resize = (e: PointerEvent<HTMLSpanElement>, property: Property) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
const startX = e.clientX;
|
|
111
|
+
const start = widthOf(view, property);
|
|
112
|
+
const el = e.currentTarget;
|
|
113
|
+
el.setPointerCapture(e.pointerId);
|
|
114
|
+
let width = start;
|
|
115
|
+
const th = el.closest("th")!;
|
|
116
|
+
const move = (ev: globalThis.PointerEvent) => {
|
|
117
|
+
width = Math.max(MIN_WIDTH, Math.round(start + ev.clientX - startX));
|
|
118
|
+
th.style.width = `${width}px`;
|
|
119
|
+
};
|
|
120
|
+
const up = () => {
|
|
121
|
+
el.removeEventListener("pointermove", move);
|
|
122
|
+
el.removeEventListener("pointerup", up);
|
|
123
|
+
el.removeEventListener("pointercancel", up);
|
|
124
|
+
if (width !== start) onViewChange({ ...view, widths: { ...view.widths, [property.id]: width } });
|
|
125
|
+
};
|
|
126
|
+
el.addEventListener("pointermove", move);
|
|
127
|
+
el.addEventListener("pointerup", up);
|
|
128
|
+
el.addEventListener("pointercancel", up);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// Swaps two shown columns within the order of all of them, so a hidden column
|
|
132
|
+
// keeps its place for when it is shown again.
|
|
133
|
+
const moveColumn = (index: number, by: -1 | 1) => {
|
|
134
|
+
const to = index + by;
|
|
135
|
+
if (to < 0 || to >= columns.length) return;
|
|
136
|
+
const all = shownProperties(properties, { ...view, hidden: [] }).map((p) => p.id);
|
|
137
|
+
const a = all.indexOf(columns[index]!.id);
|
|
138
|
+
const b = all.indexOf(columns[to]!.id);
|
|
139
|
+
[all[a], all[b]] = [all[b]!, all[a]!];
|
|
140
|
+
onViewChange({ ...view, order: all });
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<div>
|
|
145
|
+
{/* Room under the table for a scrollbar, and New outside the scrolling, so the bar never covers it. */}
|
|
146
|
+
<div ref={grid} className="pb-1.5 overflow-x-auto overscroll-x-contain">
|
|
147
|
+
<table
|
|
148
|
+
role="grid"
|
|
149
|
+
aria-label={view.name}
|
|
150
|
+
aria-rowcount={rows.length + 1}
|
|
151
|
+
className="border-collapse text-sm table-fixed"
|
|
152
|
+
style={{ width: columns.reduce((w, p) => w + widthOf(view, p), 0) }}
|
|
153
|
+
>
|
|
154
|
+
<thead>
|
|
155
|
+
<tr>
|
|
156
|
+
{columns.map((property, c) => {
|
|
157
|
+
const Icon = PROPERTY_ICONS[property.type];
|
|
158
|
+
const sorted = view.sort.find((s) => s.property === property.id);
|
|
159
|
+
return (
|
|
160
|
+
<th
|
|
161
|
+
key={property.id}
|
|
162
|
+
scope="col"
|
|
163
|
+
aria-sort={sorted ? (sorted.direction === "asc" ? "ascending" : "descending") : undefined}
|
|
164
|
+
style={{ width: widthOf(view, property) }}
|
|
165
|
+
className="relative p-0 border-hairline border-y border-r last:border-r-0 font-normal text-ink-secondary text-left"
|
|
166
|
+
>
|
|
167
|
+
<DropdownMenu>
|
|
168
|
+
<DropdownMenuTrigger asChild>
|
|
169
|
+
<button
|
|
170
|
+
type="button"
|
|
171
|
+
className="flex items-center gap-1.5 hover:bg-tint-hover px-2 w-full h-control-md text-left"
|
|
172
|
+
>
|
|
173
|
+
<Icon className="size-3.5 text-ink-tertiary shrink-0" aria-hidden />
|
|
174
|
+
<span className="truncate">{property.name}</span>
|
|
175
|
+
{sorted &&
|
|
176
|
+
(sorted.direction === "asc" ? (
|
|
177
|
+
<ArrowUpNarrowWide className="ml-auto size-3.5" aria-hidden />
|
|
178
|
+
) : (
|
|
179
|
+
<ArrowDownWideNarrow className="ml-auto size-3.5" aria-hidden />
|
|
180
|
+
))}
|
|
181
|
+
</button>
|
|
182
|
+
</DropdownMenuTrigger>
|
|
183
|
+
<DropdownMenuContent align="start">
|
|
184
|
+
<DropdownMenuItem
|
|
185
|
+
onSelect={() => onViewChange({ ...view, sort: [{ property: property.id, direction: "asc" }] })}
|
|
186
|
+
>
|
|
187
|
+
<ArrowUpNarrowWide /> Sort ascending
|
|
188
|
+
</DropdownMenuItem>
|
|
189
|
+
<DropdownMenuItem
|
|
190
|
+
onSelect={() => onViewChange({ ...view, sort: [{ property: property.id, direction: "desc" }] })}
|
|
191
|
+
>
|
|
192
|
+
<ArrowDownWideNarrow /> Sort descending
|
|
193
|
+
</DropdownMenuItem>
|
|
194
|
+
<DropdownMenuSeparator />
|
|
195
|
+
<DropdownMenuItem disabled={c === 0} onSelect={() => moveColumn(c, -1)}>
|
|
196
|
+
<ArrowLeft /> Move left
|
|
197
|
+
</DropdownMenuItem>
|
|
198
|
+
<DropdownMenuItem disabled={c === columns.length - 1} onSelect={() => moveColumn(c, 1)}>
|
|
199
|
+
<ArrowRight /> Move right
|
|
200
|
+
</DropdownMenuItem>
|
|
201
|
+
{property.type !== "title" && (
|
|
202
|
+
<DropdownMenuItem onSelect={() => onViewChange({ ...view, hidden: [...view.hidden, property.id] })}>
|
|
203
|
+
<EyeOff /> Hide
|
|
204
|
+
</DropdownMenuItem>
|
|
205
|
+
)}
|
|
206
|
+
</DropdownMenuContent>
|
|
207
|
+
</DropdownMenu>
|
|
208
|
+
{/* The column's edge, dragged to resize. */}
|
|
209
|
+
<span
|
|
210
|
+
aria-hidden
|
|
211
|
+
onPointerDown={(e) => resize(e, property)}
|
|
212
|
+
className="top-0 -right-1 z-1 absolute hover:bg-accent/40 w-2 h-full cursor-col-resize touch-none"
|
|
213
|
+
/>
|
|
214
|
+
</th>
|
|
215
|
+
);
|
|
216
|
+
})}
|
|
217
|
+
</tr>
|
|
218
|
+
</thead>
|
|
219
|
+
<tbody>
|
|
220
|
+
{rows.map((row, r) => (
|
|
221
|
+
<tr key={row.id} className="group/tr">
|
|
222
|
+
{columns.map((property, c) => {
|
|
223
|
+
const current = r === r0 && c === c0;
|
|
224
|
+
const isEditing = editing?.r === r && editing.c === c;
|
|
225
|
+
const value = row.values[property.id];
|
|
226
|
+
const popover = editsInPopover(property);
|
|
227
|
+
return (
|
|
228
|
+
<td
|
|
229
|
+
key={property.id}
|
|
230
|
+
data-cell={`${r}-${c}`}
|
|
231
|
+
role="gridcell"
|
|
232
|
+
tabIndex={current && !isEditing ? 0 : -1}
|
|
233
|
+
aria-label={property.type === "checkbox" ? `${property.name}: ${value ? "yes" : "no"}` : undefined}
|
|
234
|
+
onKeyDown={(e) => onKeyDown(e, r, c)}
|
|
235
|
+
onClick={() => {
|
|
236
|
+
setAt({ r, c });
|
|
237
|
+
if (property.type === "checkbox") onSetValue(row, property, value !== true);
|
|
238
|
+
}}
|
|
239
|
+
onDoubleClick={() => property.type !== "checkbox" && startEditing(r, c)}
|
|
240
|
+
className={cn(
|
|
241
|
+
"relative p-0 border-hairline border-y border-r last:border-r-0 h-control-md align-middle outline-none",
|
|
242
|
+
"focus-visible:shadow-[inset_0_0_0_2px_var(--accent)]",
|
|
243
|
+
property.type === "number" && "text-right"
|
|
244
|
+
)}
|
|
245
|
+
>
|
|
246
|
+
{isEditing && !popover ? (
|
|
247
|
+
<div className="absolute inset-0 z-1 shadow-[inset_0_0_0_2px_var(--accent)]">
|
|
248
|
+
<CellEditor
|
|
249
|
+
property={property}
|
|
250
|
+
value={value}
|
|
251
|
+
seed={editing.seed}
|
|
252
|
+
onChange={(v) => onSetValue(row, property, v)}
|
|
253
|
+
onDone={done}
|
|
254
|
+
/>
|
|
255
|
+
</div>
|
|
256
|
+
) : (
|
|
257
|
+
<Popover open={isEditing && popover} onOpenChange={(open) => !open && done()}>
|
|
258
|
+
<PopoverAnchor asChild>
|
|
259
|
+
<div className="flex items-center gap-1 px-2 py-1 min-h-control-md overflow-hidden">
|
|
260
|
+
<CellValue
|
|
261
|
+
property={property}
|
|
262
|
+
value={value}
|
|
263
|
+
// A link in a cell is clicked, not tabbed to: the grid is one stop.
|
|
264
|
+
linkTabIndex={-1}
|
|
265
|
+
className={cn(property.type === "number" && "ml-auto")}
|
|
266
|
+
/>
|
|
267
|
+
{property.type === "title" && isEmpty(value ?? null) && (
|
|
268
|
+
<span className="text-ink-tertiary">Untitled</span>
|
|
269
|
+
)}
|
|
270
|
+
{property.type === "title" && onOpenRow && (
|
|
271
|
+
<Button
|
|
272
|
+
variant="secondary"
|
|
273
|
+
size="sm"
|
|
274
|
+
tabIndex={current ? 0 : -1}
|
|
275
|
+
onClick={(e) => {
|
|
276
|
+
e.stopPropagation();
|
|
277
|
+
onOpenRow(row);
|
|
278
|
+
}}
|
|
279
|
+
className="ml-auto h-6 text-caption affordance group-hover/tr:opacity-100 [@media(hover:none)]:opacity-100"
|
|
280
|
+
>
|
|
281
|
+
<Maximize2 /> Open
|
|
282
|
+
</Button>
|
|
283
|
+
)}
|
|
284
|
+
</div>
|
|
285
|
+
</PopoverAnchor>
|
|
286
|
+
{isEditing && popover && (
|
|
287
|
+
<PopoverContent align="start" className="p-0 w-auto">
|
|
288
|
+
<CellEditor
|
|
289
|
+
property={property}
|
|
290
|
+
value={value}
|
|
291
|
+
onChange={(v) => onSetValue(row, property, v)}
|
|
292
|
+
onDone={done}
|
|
293
|
+
/>
|
|
294
|
+
</PopoverContent>
|
|
295
|
+
)}
|
|
296
|
+
</Popover>
|
|
297
|
+
)}
|
|
298
|
+
</td>
|
|
299
|
+
);
|
|
300
|
+
})}
|
|
301
|
+
</tr>
|
|
302
|
+
))}
|
|
303
|
+
</tbody>
|
|
304
|
+
</table>
|
|
305
|
+
</div>
|
|
306
|
+
<Button variant="ghost" size="sm" onClick={onAddRow} className="text-ink-tertiary">
|
|
307
|
+
<Plus /> New
|
|
308
|
+
</Button>
|
|
309
|
+
</div>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
@@ -4,8 +4,9 @@ import { CalendarDays } from "lucide-react";
|
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { Calendar, focusCalendarDay } from "./calendar.tsx";
|
|
6
6
|
import { FieldButton, type FieldButtonProps } from "./field-button.tsx";
|
|
7
|
-
import {
|
|
7
|
+
import { PickerPanel } from "./picker-panel.tsx";
|
|
8
8
|
import { formatDay, formatShortDay, fromISODate, toISODate } from "../../lib/dates.ts";
|
|
9
|
+
import { cn } from "../../lib/utils.ts";
|
|
9
10
|
|
|
10
11
|
type Shared = Omit<FieldButtonProps, "value" | "onChange" | "children" | "onClear" | "icon"> & {
|
|
11
12
|
/** Earliest and latest day that can be chosen, `YYYY-MM-DD`. */
|
|
@@ -34,6 +35,8 @@ export interface DatePickerProps extends Shared {
|
|
|
34
35
|
openTo?: string | null;
|
|
35
36
|
/** Sends the value with a form, as a hidden field of this name. */
|
|
36
37
|
name?: string;
|
|
38
|
+
/** Quick choices beside the calendar: [{ label: "Today", value: today() }, …]. */
|
|
39
|
+
shortcuts?: readonly { label: string; value: string }[];
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/* One day. The value is a string, `YYYY-MM-DD`: a calendar day, not an instant, so
|
|
@@ -47,43 +50,74 @@ export function DatePicker({
|
|
|
47
50
|
clearable = true,
|
|
48
51
|
placeholder = "Pick a date",
|
|
49
52
|
name,
|
|
53
|
+
shortcuts,
|
|
50
54
|
...props
|
|
51
55
|
}: DatePickerProps) {
|
|
52
56
|
const [open, setOpen] = useState(false);
|
|
53
57
|
const selected = fromISODate(value);
|
|
54
58
|
|
|
55
59
|
return (
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
<>
|
|
61
|
+
<PickerPanel
|
|
62
|
+
open={open}
|
|
63
|
+
onOpenChange={setOpen}
|
|
64
|
+
title={props["aria-label"] ?? "Pick a date"}
|
|
65
|
+
onOpenAutoFocus={focusCalendarDay}
|
|
66
|
+
trigger={
|
|
67
|
+
<FieldButton
|
|
68
|
+
icon={CalendarDays}
|
|
69
|
+
placeholder={placeholder}
|
|
70
|
+
onClear={clearable ? () => onChange(null) : undefined}
|
|
71
|
+
clearLabel="Clear the date"
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{selected === undefined ? null : formatDay(selected)}
|
|
75
|
+
</FieldButton>
|
|
76
|
+
}
|
|
72
77
|
>
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
<div className="flex max-sm:flex-col">
|
|
79
|
+
{shortcuts !== undefined && shortcuts.length > 0 && (
|
|
80
|
+
<div className="flex sm:flex-col gap-1 sm:shadow-edge-r max-sm:shadow-edge-b p-2 max-sm:overflow-x-auto">
|
|
81
|
+
{shortcuts.map((s) => {
|
|
82
|
+
const day = fromISODate(s.value);
|
|
83
|
+
const outside = (min && s.value < min) || (max && s.value > max) || day === undefined;
|
|
84
|
+
return (
|
|
85
|
+
<button
|
|
86
|
+
key={s.label}
|
|
87
|
+
type="button"
|
|
88
|
+
disabled={!!outside}
|
|
89
|
+
onClick={() => {
|
|
90
|
+
onChange(s.value);
|
|
91
|
+
setOpen(false);
|
|
92
|
+
}}
|
|
93
|
+
className={cn(
|
|
94
|
+
"flex items-center px-2.5 rounded-control h-control-sm [@media(pointer:coarse)]:h-10 text-sm text-left whitespace-nowrap",
|
|
95
|
+
"hover:bg-tint-hover disabled:text-ink-disabled disabled:pointer-events-none",
|
|
96
|
+
s.value === value && "bg-tint-active font-medium",
|
|
97
|
+
)}
|
|
98
|
+
>
|
|
99
|
+
{s.label}
|
|
100
|
+
</button>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
<Calendar
|
|
106
|
+
mode="single"
|
|
107
|
+
// Required, so pressing the chosen day again keeps it. The cross is how it is emptied.
|
|
108
|
+
required
|
|
109
|
+
selected={selected}
|
|
110
|
+
onSelect={(day: Date) => {
|
|
111
|
+
onChange(toISODate(day));
|
|
112
|
+
setOpen(false);
|
|
113
|
+
}}
|
|
114
|
+
defaultMonth={selected ?? fromISODate(openTo) ?? fromISODate(min)}
|
|
115
|
+
{...bounds(min, max)}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
</PickerPanel>
|
|
119
|
+
{name !== undefined && <input type="hidden" name={name} value={selected === undefined ? "" : (value ?? "")} />}
|
|
120
|
+
</>
|
|
87
121
|
);
|
|
88
122
|
}
|
|
89
123
|
|
|
@@ -130,41 +164,45 @@ export function DateRangePicker({
|
|
|
130
164
|
: `${formatShortDay(from)} – ${formatShortDay(to)}`;
|
|
131
165
|
|
|
132
166
|
return (
|
|
133
|
-
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
167
|
+
<>
|
|
168
|
+
<PickerPanel
|
|
169
|
+
open={open}
|
|
170
|
+
onOpenChange={setOpen}
|
|
171
|
+
title={props["aria-label"] ?? "Pick dates"}
|
|
172
|
+
onOpenAutoFocus={focusCalendarDay}
|
|
173
|
+
trigger={
|
|
174
|
+
<FieldButton
|
|
175
|
+
icon={CalendarDays}
|
|
176
|
+
placeholder={placeholder}
|
|
177
|
+
onClear={clearable ? () => onChange({ from: null, to: null }) : undefined}
|
|
178
|
+
clearLabel="Clear the dates"
|
|
179
|
+
{...props}
|
|
180
|
+
>
|
|
181
|
+
{label}
|
|
182
|
+
</FieldButton>
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
<div>
|
|
186
|
+
<Calendar
|
|
187
|
+
mode="range"
|
|
188
|
+
selected={{ from, to }}
|
|
189
|
+
// The library's own idea of what a press does to a range is ignored;
|
|
190
|
+
// only the day pressed is taken from it.
|
|
191
|
+
onSelect={(_range, pressed) => press(pressed)}
|
|
192
|
+
defaultMonth={from ?? fromISODate(min)}
|
|
193
|
+
{...bounds(min, max)}
|
|
194
|
+
/>
|
|
195
|
+
<p aria-live="polite" className="px-3 py-2 border-hairline border-t text-caption text-ink-tertiary">
|
|
196
|
+
{from !== undefined && to === undefined ? "Now the last day." : "Pick the first day, then the last."}
|
|
197
|
+
</p>
|
|
198
|
+
</div>
|
|
199
|
+
</PickerPanel>
|
|
145
200
|
{names !== undefined && (
|
|
146
201
|
<>
|
|
147
202
|
<input type="hidden" name={names.from} value={from === undefined ? "" : toISODate(from)} />
|
|
148
203
|
<input type="hidden" name={names.to} value={to === undefined ? "" : toISODate(to)} />
|
|
149
204
|
</>
|
|
150
205
|
)}
|
|
151
|
-
|
|
152
|
-
className="w-auto"
|
|
153
|
-
onOpenAutoFocus={focusCalendarDay}
|
|
154
|
-
>
|
|
155
|
-
<Calendar
|
|
156
|
-
mode="range"
|
|
157
|
-
selected={{ from, to }}
|
|
158
|
-
// The library's own idea of what a press does to a range is ignored;
|
|
159
|
-
// only the day pressed is taken from it.
|
|
160
|
-
onSelect={(_range, pressed) => press(pressed)}
|
|
161
|
-
defaultMonth={from ?? fromISODate(min)}
|
|
162
|
-
{...bounds(min, max)}
|
|
163
|
-
/>
|
|
164
|
-
<p className="border-hairline border-t px-3 py-2 text-caption text-ink-tertiary">
|
|
165
|
-
{from !== undefined && to === undefined ? "Now the last day." : "Pick the first day, then the last."}
|
|
166
|
-
</p>
|
|
167
|
-
</PopoverContent>
|
|
168
|
-
</Popover>
|
|
206
|
+
</>
|
|
169
207
|
);
|
|
170
208
|
}
|