@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,35 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
4
|
+
|
|
5
|
+
/* Nothing here yet, said kindly: an icon, a line saying what would be here, a
|
|
6
|
+
sentence on how it gets here, and the one action that starts it. `compact` for
|
|
7
|
+
inside a card, a table or a sidebar; the default for a page. */
|
|
8
|
+
export function EmptyState({
|
|
9
|
+
icon: Icon,
|
|
10
|
+
title,
|
|
11
|
+
description,
|
|
12
|
+
action,
|
|
13
|
+
compact = false,
|
|
14
|
+
className,
|
|
15
|
+
}: {
|
|
16
|
+
icon?: LucideIcon;
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
description?: ReactNode;
|
|
19
|
+
action?: ReactNode;
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}) {
|
|
23
|
+
return (
|
|
24
|
+
<div className={cn("flex flex-col items-center mx-auto max-w-sm text-center", compact ? "gap-1.5 py-6" : "gap-2 py-16", className)}>
|
|
25
|
+
{Icon && (
|
|
26
|
+
<span aria-hidden className={cn("flex justify-center items-center bg-tint-hover mb-1 rounded-full text-ink-tertiary", compact ? "size-9 [&>svg]:size-4" : "size-12 [&>svg]:size-5")}>
|
|
27
|
+
<Icon />
|
|
28
|
+
</span>
|
|
29
|
+
)}
|
|
30
|
+
<p className={cn("font-medium text-ink", compact ? "text-sm" : "text-body")}>{title}</p>
|
|
31
|
+
{description && <p className="text-ink-secondary text-sm">{description}</p>}
|
|
32
|
+
{action && <div className="mt-2">{action}</div>}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CircleAlert, FileQuestion, type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
4
|
+
import { EmptyState } from "./empty-state.tsx";
|
|
5
|
+
|
|
6
|
+
/* Something went wrong where content should be: a page that failed to load, a
|
|
7
|
+
panel whose request errored. EmptyState's shape, in the danger ink, with what
|
|
8
|
+
happened, what to do, and usually a "Try again". `detail` is the technical
|
|
9
|
+
message, folded away for whoever needs it. `compact` inside a card or panel. */
|
|
10
|
+
export function ErrorState({
|
|
11
|
+
title = "Something went wrong",
|
|
12
|
+
description = "It may be a moment's trouble. Try again, and if it keeps happening, reload the page.",
|
|
13
|
+
action,
|
|
14
|
+
detail,
|
|
15
|
+
icon = CircleAlert,
|
|
16
|
+
compact = false,
|
|
17
|
+
className,
|
|
18
|
+
}: {
|
|
19
|
+
title?: ReactNode;
|
|
20
|
+
description?: ReactNode;
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
/** The error's own message, shown under "Details". */
|
|
23
|
+
detail?: string;
|
|
24
|
+
icon?: LucideIcon;
|
|
25
|
+
compact?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<div role="alert" className={cn("[&>div>span:first-child]:bg-danger-tint [&>div>span:first-child]:text-danger", className)}>
|
|
30
|
+
<EmptyState icon={icon} title={title} description={description} compact={compact} action={action} />
|
|
31
|
+
{detail && (
|
|
32
|
+
<details className="mx-auto -mt-8 mb-8 max-w-sm text-caption text-ink-tertiary text-center">
|
|
33
|
+
<summary className="rounded-control cursor-pointer">Details</summary>
|
|
34
|
+
<pre className="bg-surface-sunken mt-2 p-2 rounded-control font-mono text-left whitespace-pre-wrap break-words">{detail}</pre>
|
|
35
|
+
</details>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* The body of a not-found page: the page's code in quiet large type, a line on
|
|
42
|
+
what happened, and a way home (`action`). Give it a Page or a FocusShell. */
|
|
43
|
+
export function NotFound({
|
|
44
|
+
title = "This page doesn't exist",
|
|
45
|
+
description = "It may have been moved or deleted, or the link may be mistyped.",
|
|
46
|
+
action,
|
|
47
|
+
code = "404",
|
|
48
|
+
className,
|
|
49
|
+
}: {
|
|
50
|
+
title?: ReactNode;
|
|
51
|
+
description?: ReactNode;
|
|
52
|
+
action?: ReactNode;
|
|
53
|
+
code?: ReactNode;
|
|
54
|
+
className?: string;
|
|
55
|
+
}) {
|
|
56
|
+
return (
|
|
57
|
+
<div className={cn("flex flex-col items-center mx-auto py-16 max-w-sm text-center", className)}>
|
|
58
|
+
<FileQuestion aria-hidden className="mb-4 size-10 text-ink-tertiary" strokeWidth={1.5} />
|
|
59
|
+
<p aria-hidden className="tabular-nums font-semibold text-display text-ink-tertiary leading-none">
|
|
60
|
+
{code}
|
|
61
|
+
</p>
|
|
62
|
+
<h1 className="mt-4 font-semibold text-h2 text-balance">{title}</h1>
|
|
63
|
+
<p className="mt-2 text-ink-secondary text-sm">{description}</p>
|
|
64
|
+
{action !== undefined && <div className="flex flex-wrap justify-center gap-2 mt-6">{action}</div>}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { X, type LucideIcon } from "lucide-react";
|
|
4
4
|
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { fieldVariants, fromField, useField } from "./input.tsx";
|
|
6
6
|
import { cn } from "../../lib/utils.ts";
|
|
7
7
|
|
|
8
8
|
export interface FieldButtonProps extends Omit<ComponentPropsWithRef<"button">, "children"> {
|
|
@@ -14,6 +14,7 @@ export interface FieldButtonProps extends Omit<ComponentPropsWithRef<"button">,
|
|
|
14
14
|
onClear?: () => void;
|
|
15
15
|
clearLabel?: string;
|
|
16
16
|
invalid?: boolean;
|
|
17
|
+
size?: "sm" | "md" | "lg";
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/* A field you press rather than type in: what a picker shows at rest. It is the
|
|
@@ -28,28 +29,29 @@ export function FieldButton({
|
|
|
28
29
|
invalid,
|
|
29
30
|
className,
|
|
30
31
|
disabled,
|
|
32
|
+
size,
|
|
31
33
|
...props
|
|
32
34
|
}: FieldButtonProps) {
|
|
35
|
+
// Inside a Field: its id (so the label names this), description, invalid, disabled.
|
|
36
|
+
const own = fromField(useField(), { ...props, disabled, "aria-invalid": invalid || undefined });
|
|
33
37
|
const empty = children === undefined || children === null || children === "";
|
|
34
|
-
const clearable = onClear !== undefined && !empty && !disabled;
|
|
38
|
+
const clearable = onClear !== undefined && !empty && !own.disabled;
|
|
35
39
|
|
|
36
40
|
return (
|
|
37
41
|
<span className={cn("relative block w-full", className)}>
|
|
38
42
|
<button
|
|
39
43
|
type="button"
|
|
40
|
-
|
|
41
|
-
aria-invalid={invalid || undefined}
|
|
42
|
-
{...props}
|
|
44
|
+
{...own}
|
|
43
45
|
className={cn(
|
|
44
|
-
|
|
45
|
-
"flex
|
|
46
|
+
fieldVariants({ size }),
|
|
47
|
+
"flex items-center gap-2 text-left cursor-pointer",
|
|
46
48
|
// Open, it looks the way a focused input does.
|
|
47
49
|
"data-[state=open]:bg-surface data-[state=open]:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
48
50
|
clearable && "pr-8",
|
|
49
51
|
)}
|
|
50
52
|
>
|
|
51
53
|
{Icon !== undefined && <Icon className="size-4 shrink-0 text-ink-tertiary" />}
|
|
52
|
-
<span className={cn("min-w-0 flex-1 truncate", empty && "text-ink-
|
|
54
|
+
<span className={cn("min-w-0 flex-1 truncate", empty && "text-ink-placeholder")}>
|
|
53
55
|
{empty ? placeholder : children}
|
|
54
56
|
</span>
|
|
55
57
|
</button>
|
|
@@ -58,7 +60,7 @@ export function FieldButton({
|
|
|
58
60
|
type="button"
|
|
59
61
|
aria-label={clearLabel}
|
|
60
62
|
onClick={onClear}
|
|
61
|
-
className="absolute top-1/2 right-1 flex size-6 -translate-y-1/2 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-
|
|
63
|
+
className="absolute top-1/2 right-1 flex size-6 -translate-y-1/2 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-(--duration-fast) hover:bg-tint-active hover:text-ink"
|
|
62
64
|
>
|
|
63
65
|
<X className="size-3.5" />
|
|
64
66
|
</button>
|
|
@@ -69,7 +69,7 @@ export function FilePreview({ file, className }: { file: File | undefined; class
|
|
|
69
69
|
|
|
70
70
|
return (
|
|
71
71
|
<span className={cn("relative block overflow-hidden bg-surface-sunken", className)}>
|
|
72
|
-
<canvas ref={canvas} className={cn("h-full w-full object-cover transition-opacity duration-
|
|
72
|
+
<canvas ref={canvas} className={cn("h-full w-full object-cover transition-opacity duration-(--duration-slow)", state === "shown" ? "opacity-100" : "opacity-0")} />
|
|
73
73
|
{(state === "unreadable" || file === undefined) && (
|
|
74
74
|
<span className="absolute inset-0 flex items-center justify-center text-ink-disabled">
|
|
75
75
|
<ImageOff className="size-5" />
|
|
@@ -8,6 +8,7 @@ import { StepDialog } from "./step-dialog.tsx";
|
|
|
8
8
|
import { useUploadQueue, type UploadItem } from "../../hooks/use-upload-queue.ts";
|
|
9
9
|
import { carriesFiles, filesFromDrop, pickFiles } from "../../lib/files.ts";
|
|
10
10
|
import { cn } from "../../lib/utils.ts";
|
|
11
|
+
import { ProgressBar } from "./progress.tsx";
|
|
11
12
|
|
|
12
13
|
const megabytes = (bytes: number): string => {
|
|
13
14
|
const mb = bytes / (1024 * 1024);
|
|
@@ -60,12 +61,12 @@ export function FileDropArea({
|
|
|
60
61
|
void filesFromDrop(event.dataTransfer).then((files) => onFiles(single ? files.slice(0, 1) : files));
|
|
61
62
|
}}
|
|
62
63
|
className={cn(
|
|
63
|
-
"flex min-h-64 flex-col items-center justify-center rounded-overlay border-2 border-dashed px-6 py-10 text-center transition-colors duration-
|
|
64
|
+
"flex min-h-64 flex-col items-center justify-center rounded-overlay border-2 border-dashed px-6 py-10 text-center transition-colors duration-(--duration-base)",
|
|
64
65
|
over ? "border-accent bg-accent-tint" : "border-hairline-strong",
|
|
65
66
|
className,
|
|
66
67
|
)}
|
|
67
68
|
>
|
|
68
|
-
<Upload className={cn("size-8 transition-colors duration-
|
|
69
|
+
<Upload className={cn("size-8 transition-colors duration-(--duration-base)", over ? "text-accent-text" : "text-ink-tertiary")} />
|
|
69
70
|
<p className="mt-4 text-h3 text-ink">{title}</p>
|
|
70
71
|
{hint !== undefined && <p className="mt-1 text-sm text-ink-secondary">{hint}</p>}
|
|
71
72
|
<div className="mt-6 flex flex-wrap justify-center gap-2">
|
|
@@ -94,21 +95,21 @@ function Tile({ item, onRetry }: { item: UploadItem; onRetry: () => void }) {
|
|
|
94
95
|
const problem = item.state === "failed" || item.state === "rejected";
|
|
95
96
|
return (
|
|
96
97
|
<li className="relative">
|
|
97
|
-
<span className="relative block overflow-hidden rounded-
|
|
98
|
-
<FilePreview file={item.file} className={cn("aspect-square transition-opacity duration-
|
|
98
|
+
<span className="relative block overflow-hidden rounded-surface">
|
|
99
|
+
<FilePreview file={item.file} className={cn("aspect-square transition-opacity duration-(--duration-slow)", item.state !== "done" && "opacity-55")} />
|
|
99
100
|
{/* How far along, as a bar across the bottom of its own picture. */}
|
|
100
101
|
{item.state === "uploading" && (
|
|
101
|
-
<span className="absolute inset-x-0 bottom-0 h-1 bg-
|
|
102
|
-
<span className="block h-full bg-accent transition-[width] duration-
|
|
102
|
+
<span className="absolute inset-x-0 bottom-0 h-1 bg-on-media-faint">
|
|
103
|
+
<span className="block h-full bg-accent transition-[width] duration-(--duration-base) ease-out-notion" style={{ width: `${item.progress * 100}%` }} />
|
|
103
104
|
</span>
|
|
104
105
|
)}
|
|
105
106
|
{(item.state === "uploading" || item.state === "waiting") && (
|
|
106
|
-
<span className="absolute inset-x-0 bottom-1.5 text-center text-caption font-medium text-
|
|
107
|
+
<span className="absolute inset-x-0 bottom-1.5 text-center text-caption font-medium text-on-media-ink tabular-nums [text-shadow:0_1px_2px_var(--on-media-strong)]">
|
|
107
108
|
{item.state === "uploading" ? `${Math.round(item.progress * 100)}%` : "Waiting"}
|
|
108
109
|
</span>
|
|
109
110
|
)}
|
|
110
111
|
{item.state === "done" && (
|
|
111
|
-
<span className="absolute top-1.5 right-1.5 flex size-6 animate-scale-in items-center justify-center rounded-full bg-
|
|
112
|
+
<span className="absolute top-1.5 right-1.5 flex size-6 animate-scale-in items-center justify-center rounded-full bg-success text-on-media-ink shadow-sm">
|
|
112
113
|
<Check className="size-3.5" />
|
|
113
114
|
</span>
|
|
114
115
|
)}
|
|
@@ -242,15 +243,12 @@ export function FileUploader({
|
|
|
242
243
|
}
|
|
243
244
|
banner={
|
|
244
245
|
// By bytes, so one large file does not count the same as one small one.
|
|
245
|
-
<
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
>
|
|
252
|
-
<div className="h-full rounded-full bg-accent transition-[width] duration-150 ease-out-notion" style={{ width: `${total === 0 ? 0 : (sent / total) * 100}%` }} />
|
|
253
|
-
</div>
|
|
246
|
+
<ProgressBar
|
|
247
|
+
size="sm"
|
|
248
|
+
label="Uploading"
|
|
249
|
+
value={total === 0 ? 0 : Math.round((sent / total) * 100)}
|
|
250
|
+
className={cn("mt-2 transition-opacity duration-(--duration-slow)", step === 2 ? "opacity-100" : "opacity-0")}
|
|
251
|
+
/>
|
|
254
252
|
}
|
|
255
253
|
footer={
|
|
256
254
|
step === 0 ? (
|
|
@@ -305,21 +303,22 @@ export function FileUploader({
|
|
|
305
303
|
const refused = validate?.(file);
|
|
306
304
|
return (
|
|
307
305
|
<li key={`${file.name}-${file.size}-${file.lastModified}`} className="group relative">
|
|
308
|
-
<FilePreview file={file} className={cn("aspect-square rounded-
|
|
306
|
+
<FilePreview file={file} className={cn("aspect-square rounded-surface", refused !== undefined && "opacity-40")} />
|
|
309
307
|
{refused !== undefined && (
|
|
310
|
-
<span className="absolute inset-x-1.5 top-1.5 flex items-start gap-1 rounded-
|
|
308
|
+
<span className="absolute inset-x-1.5 top-1.5 flex items-start gap-1 rounded-control bg-danger-tint px-1.5 py-1 text-caption text-danger backdrop-blur-sm">
|
|
311
309
|
<CircleAlert className="mt-px size-3 shrink-0" />
|
|
312
310
|
{refused}
|
|
313
311
|
</span>
|
|
314
312
|
)}
|
|
315
|
-
<
|
|
316
|
-
|
|
313
|
+
<Button
|
|
314
|
+
variant="on-media"
|
|
315
|
+
size="icon-sm"
|
|
317
316
|
aria-label={`Leave out ${file.name}`}
|
|
318
317
|
onClick={() => setStaged((prev) => prev.filter((f) => f !== file))}
|
|
319
|
-
className="affordance
|
|
318
|
+
className="affordance top-1.5 right-1.5 absolute"
|
|
320
319
|
>
|
|
321
|
-
<X
|
|
322
|
-
</
|
|
320
|
+
<X />
|
|
321
|
+
</Button>
|
|
323
322
|
<p className="mt-1 truncate text-caption text-ink-tertiary">{file.name}</p>
|
|
324
323
|
</li>
|
|
325
324
|
);
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ArrowDownWideNarrow, ListFilter, Plus, X } from "lucide-react";
|
|
4
|
+
import { useId, useRef, type ReactNode } from "react";
|
|
5
|
+
import { needsValue, newFilter, OPS, type Filter, type FilterOp, type Match, type Property, type Sort } from "../../lib/database.ts";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { Badge } from "./badge.tsx";
|
|
8
|
+
import { Button } from "./button.tsx";
|
|
9
|
+
import { DatePicker } from "./date-picker.tsx";
|
|
10
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.tsx";
|
|
11
|
+
import { Input, NumberInput } from "./input.tsx";
|
|
12
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.tsx";
|
|
13
|
+
import { SelectMenu } from "./select-menu.tsx";
|
|
14
|
+
|
|
15
|
+
/* Narrowing and ordering any list by its properties (lib/database's Property):
|
|
16
|
+
FilterBuilder and SortBuilder, and FilterButton and SortButton that open them
|
|
17
|
+
from a toolbar. Each filter reads as a sentence, Notion's way: "Where Status is
|
|
18
|
+
Done", "and Price > 100". A filter missing its value lets everything through,
|
|
19
|
+
so one being written never empties the list. The value is asked for in the
|
|
20
|
+
property's own kind of field: words, a number, a date, an option. */
|
|
21
|
+
|
|
22
|
+
const fieldClass = "h-control-sm rounded-control bg-tint-hover px-1.5 text-sm";
|
|
23
|
+
let nextId = 0;
|
|
24
|
+
const freshId = () => `f${Date.now().toString(36)}${(nextId++).toString(36)}`;
|
|
25
|
+
|
|
26
|
+
function AddProperty({ properties, label, onPick }: { properties: readonly Property[]; label: string; onPick: (p: Property) => void }) {
|
|
27
|
+
return (
|
|
28
|
+
<DropdownMenu>
|
|
29
|
+
<DropdownMenuTrigger asChild>
|
|
30
|
+
<Button variant="ghost" size="sm" className="self-start text-ink-secondary">
|
|
31
|
+
<Plus /> {label}
|
|
32
|
+
</Button>
|
|
33
|
+
</DropdownMenuTrigger>
|
|
34
|
+
<DropdownMenuContent align="start">
|
|
35
|
+
{properties.map((p) => (
|
|
36
|
+
<DropdownMenuItem key={p.id} onSelect={() => onPick(p)}>
|
|
37
|
+
{p.name}
|
|
38
|
+
</DropdownMenuItem>
|
|
39
|
+
))}
|
|
40
|
+
</DropdownMenuContent>
|
|
41
|
+
</DropdownMenu>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ValueField({ property, filter, onChange }: { property: Property; filter: Filter; onChange: (value: Filter["value"]) => void }) {
|
|
46
|
+
const label = `${property.name}: value`;
|
|
47
|
+
switch (property.type) {
|
|
48
|
+
case "number":
|
|
49
|
+
return (
|
|
50
|
+
<NumberInput
|
|
51
|
+
size="sm"
|
|
52
|
+
aria-label={label}
|
|
53
|
+
value={typeof filter.value === "number" ? filter.value : undefined}
|
|
54
|
+
onChange={(v) => onChange(v ?? null)}
|
|
55
|
+
className="w-24"
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
case "date":
|
|
59
|
+
// A field fills its row; in a sentence it takes a date's width.
|
|
60
|
+
return (
|
|
61
|
+
<div className="w-44">
|
|
62
|
+
<DatePicker aria-label={label} value={typeof filter.value === "string" ? filter.value : null} onChange={onChange} />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
case "checkbox":
|
|
66
|
+
return (
|
|
67
|
+
<SelectMenu
|
|
68
|
+
label={label}
|
|
69
|
+
value={filter.value === false ? "unchecked" : "checked"}
|
|
70
|
+
options={["checked", "unchecked"] as const}
|
|
71
|
+
render={(v) => (v === "checked" ? "Checked" : "Unchecked")}
|
|
72
|
+
onChange={(v) => onChange(v === "checked")}
|
|
73
|
+
className={fieldClass}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
case "select":
|
|
77
|
+
case "multiSelect": {
|
|
78
|
+
const options = property.options ?? [];
|
|
79
|
+
const chosen = Array.isArray(filter.value) ? filter.value[0] : typeof filter.value === "string" ? filter.value : undefined;
|
|
80
|
+
const ids = ["", ...options.map((o) => o.id)];
|
|
81
|
+
return (
|
|
82
|
+
<SelectMenu
|
|
83
|
+
label={label}
|
|
84
|
+
value={chosen ?? ""}
|
|
85
|
+
options={ids}
|
|
86
|
+
render={(id) => {
|
|
87
|
+
const o = options.find((x) => x.id === id);
|
|
88
|
+
return o ? <Badge color={o.color}>{o.name}</Badge> : <span className="text-ink-tertiary">Choose…</span>;
|
|
89
|
+
}}
|
|
90
|
+
onChange={(id) => onChange(id === "" ? null : property.type === "multiSelect" ? [id] : id)}
|
|
91
|
+
className={fieldClass}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
default:
|
|
96
|
+
return <Input size="sm" aria-label={label} placeholder="Value" value={typeof filter.value === "string" ? filter.value : ""} onChange={(e) => onChange(e.target.value)} className="w-40 max-w-full" />;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function FilterBuilder({
|
|
101
|
+
properties,
|
|
102
|
+
filters,
|
|
103
|
+
onChange,
|
|
104
|
+
match = "all",
|
|
105
|
+
onMatchChange,
|
|
106
|
+
className,
|
|
107
|
+
}: {
|
|
108
|
+
properties: readonly Property[];
|
|
109
|
+
filters: readonly Filter[];
|
|
110
|
+
onChange: (filters: Filter[]) => void;
|
|
111
|
+
match?: Match;
|
|
112
|
+
onMatchChange?: (match: Match) => void;
|
|
113
|
+
className?: string;
|
|
114
|
+
}) {
|
|
115
|
+
const byId = new Map(properties.map((p) => [p.id, p]));
|
|
116
|
+
const list = useRef<HTMLDivElement>(null);
|
|
117
|
+
const add = useRef<HTMLDivElement>(null);
|
|
118
|
+
const set = (i: number, patch: Partial<Filter>) => onChange(filters.map((f, k) => (k === i ? { ...f, ...patch } : f)));
|
|
119
|
+
return (
|
|
120
|
+
<div className={cn("flex flex-col gap-2", className)}>
|
|
121
|
+
{filters.length === 0 && <p className="px-1 text-ink-tertiary text-sm">No filters. Everything shows.</p>}
|
|
122
|
+
<div ref={list} role="list" aria-label="Filters" className="flex flex-col gap-2">
|
|
123
|
+
{filters.map((filter, i) => {
|
|
124
|
+
const property = byId.get(filter.property);
|
|
125
|
+
if (!property)
|
|
126
|
+
// A filter on a property since deleted: shown, so it can be removed.
|
|
127
|
+
return (
|
|
128
|
+
<div key={filter.id} role="listitem" className="flex items-center gap-1.5 text-ink-tertiary text-sm">
|
|
129
|
+
<span className="w-14 shrink-0">{i === 0 ? "Where" : match === "all" ? "And" : "Or"}</span>
|
|
130
|
+
A deleted property
|
|
131
|
+
<Button variant="ghost" size="icon-sm" aria-label="Remove the filter on a deleted property" onClick={() => onChange(filters.filter((_, k) => k !== i))}>
|
|
132
|
+
<X />
|
|
133
|
+
</Button>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
const ops = OPS[property.type];
|
|
137
|
+
return (
|
|
138
|
+
<div key={filter.id} role="listitem" className="flex flex-wrap items-center gap-1.5">
|
|
139
|
+
<span className="w-14 text-ink-secondary text-sm shrink-0">
|
|
140
|
+
{i === 0 ? (
|
|
141
|
+
"Where"
|
|
142
|
+
) : i === 1 && onMatchChange ? (
|
|
143
|
+
<SelectMenu
|
|
144
|
+
label="Match"
|
|
145
|
+
value={match}
|
|
146
|
+
options={["all", "any"] as const}
|
|
147
|
+
render={(m) => (m === "all" ? "And" : "Or")}
|
|
148
|
+
onChange={onMatchChange}
|
|
149
|
+
className="-ml-1.5"
|
|
150
|
+
/>
|
|
151
|
+
) : match === "all" ? (
|
|
152
|
+
"And"
|
|
153
|
+
) : (
|
|
154
|
+
"Or"
|
|
155
|
+
)}
|
|
156
|
+
</span>
|
|
157
|
+
<SelectMenu
|
|
158
|
+
label="Property"
|
|
159
|
+
value={property.id}
|
|
160
|
+
options={properties.map((p) => p.id)}
|
|
161
|
+
render={(id) => byId.get(id)?.name ?? id}
|
|
162
|
+
onChange={(id) => {
|
|
163
|
+
const next = byId.get(id);
|
|
164
|
+
if (next) set(i, { ...newFilter(next, filter.id) });
|
|
165
|
+
}}
|
|
166
|
+
className={fieldClass}
|
|
167
|
+
/>
|
|
168
|
+
<SelectMenu
|
|
169
|
+
label="Condition"
|
|
170
|
+
value={filter.op}
|
|
171
|
+
options={ops.map((o) => o.op) as FilterOp[]}
|
|
172
|
+
render={(op) => ops.find((o) => o.op === op)?.label ?? op}
|
|
173
|
+
onChange={(op) => set(i, { op })}
|
|
174
|
+
className={fieldClass}
|
|
175
|
+
/>
|
|
176
|
+
{needsValue(filter.op) && <ValueField property={property} filter={filter} onChange={(value) => set(i, { value })} />}
|
|
177
|
+
<Button
|
|
178
|
+
variant="ghost"
|
|
179
|
+
size="icon-sm"
|
|
180
|
+
aria-label={`Remove the filter on ${property.name}`}
|
|
181
|
+
className="text-ink-tertiary"
|
|
182
|
+
onClick={() => {
|
|
183
|
+
onChange(filters.filter((_, k) => k !== i));
|
|
184
|
+
// Focus stays in the list rather than falling to the page.
|
|
185
|
+
requestAnimationFrame(() => add.current?.querySelector<HTMLElement>("button")?.focus());
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
<X />
|
|
189
|
+
</Button>
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
})}
|
|
193
|
+
</div>
|
|
194
|
+
<div ref={add}>
|
|
195
|
+
<AddProperty properties={properties} label="Add a filter" onPick={(p) => onChange([...filters, newFilter(p, freshId())])} />
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function SortBuilder({
|
|
202
|
+
properties,
|
|
203
|
+
sorts,
|
|
204
|
+
onChange,
|
|
205
|
+
className,
|
|
206
|
+
}: {
|
|
207
|
+
properties: readonly Property[];
|
|
208
|
+
sorts: readonly Sort[];
|
|
209
|
+
onChange: (sorts: Sort[]) => void;
|
|
210
|
+
className?: string;
|
|
211
|
+
}) {
|
|
212
|
+
const byId = new Map(properties.map((p) => [p.id, p]));
|
|
213
|
+
const unused = properties.filter((p) => !sorts.some((s) => s.property === p.id));
|
|
214
|
+
const set = (i: number, patch: Partial<Sort>) => onChange(sorts.map((s, k) => (k === i ? { ...s, ...patch } : s)));
|
|
215
|
+
return (
|
|
216
|
+
<div className={cn("flex flex-col gap-2", className)}>
|
|
217
|
+
{sorts.length === 0 && <p className="px-1 text-ink-tertiary text-sm">No sorts. In the order they were added.</p>}
|
|
218
|
+
<ol aria-label="Sorts, first applied first" className="flex flex-col gap-2">
|
|
219
|
+
{sorts.map((sort, i) => {
|
|
220
|
+
const property = byId.get(sort.property);
|
|
221
|
+
if (!property)
|
|
222
|
+
return (
|
|
223
|
+
<li key={i} className="flex items-center gap-1.5 text-ink-tertiary text-sm">
|
|
224
|
+
<span className="w-14 shrink-0">{i === 0 ? "Sort by" : "then"}</span>
|
|
225
|
+
A deleted property
|
|
226
|
+
<Button variant="ghost" size="icon-sm" aria-label="Remove the sort by a deleted property" onClick={() => onChange(sorts.filter((_, k) => k !== i))}>
|
|
227
|
+
<X />
|
|
228
|
+
</Button>
|
|
229
|
+
</li>
|
|
230
|
+
);
|
|
231
|
+
return (
|
|
232
|
+
// By place, not property: changing a sort's property keeps its row (and focus).
|
|
233
|
+
<li key={i} className="flex flex-wrap items-center gap-1.5">
|
|
234
|
+
<span className="w-14 text-ink-secondary text-sm shrink-0">{i === 0 ? "Sort by" : "then"}</span>
|
|
235
|
+
<SelectMenu
|
|
236
|
+
label="Property"
|
|
237
|
+
value={property.id}
|
|
238
|
+
// Its own property, and those not yet sorted by.
|
|
239
|
+
options={[property.id, ...unused.map((p) => p.id)]}
|
|
240
|
+
render={(id) => byId.get(id)?.name ?? id}
|
|
241
|
+
onChange={(id) => set(i, { property: id })}
|
|
242
|
+
className={fieldClass}
|
|
243
|
+
/>
|
|
244
|
+
<SelectMenu
|
|
245
|
+
label="Direction"
|
|
246
|
+
value={sort.direction}
|
|
247
|
+
options={["asc", "desc"] as const}
|
|
248
|
+
render={(d) => (d === "asc" ? "Ascending" : "Descending")}
|
|
249
|
+
onChange={(direction) => set(i, { direction })}
|
|
250
|
+
className={fieldClass}
|
|
251
|
+
/>
|
|
252
|
+
<Button variant="ghost" size="icon-sm" aria-label={`Remove the sort by ${property.name}`} className="text-ink-tertiary" onClick={() => onChange(sorts.filter((_, k) => k !== i))}>
|
|
253
|
+
<X />
|
|
254
|
+
</Button>
|
|
255
|
+
</li>
|
|
256
|
+
);
|
|
257
|
+
})}
|
|
258
|
+
</ol>
|
|
259
|
+
{unused.length > 0 && <AddProperty properties={unused} label="Add a sort" onPick={(p) => onChange([...sorts, { property: p.id, direction: "asc" }])} />}
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* A toolbar button that opens a builder in a popover, saying how many are set. */
|
|
265
|
+
function CountButton({ icon, label, count, children }: { icon: ReactNode; label: string; count: number; children: ReactNode }) {
|
|
266
|
+
const id = useId();
|
|
267
|
+
return (
|
|
268
|
+
<Popover>
|
|
269
|
+
<PopoverTrigger asChild>
|
|
270
|
+
<Button variant="ghost" size="sm" aria-describedby={count > 0 ? id : undefined} className={cn(count > 0 && "text-accent-text")}>
|
|
271
|
+
{icon}
|
|
272
|
+
{label}
|
|
273
|
+
{count > 0 && (
|
|
274
|
+
<span id={id} className="tabular-nums">
|
|
275
|
+
<span className="sr-only">, </span>
|
|
276
|
+
{count}
|
|
277
|
+
<span className="sr-only"> set</span>
|
|
278
|
+
</span>
|
|
279
|
+
)}
|
|
280
|
+
</Button>
|
|
281
|
+
</PopoverTrigger>
|
|
282
|
+
{/* As wide as its sentences, no wider; on a phone it wraps within the screen. */}
|
|
283
|
+
<PopoverContent align="start" className="p-3 w-max max-w-[calc(100vw-2rem)]">
|
|
284
|
+
{children}
|
|
285
|
+
</PopoverContent>
|
|
286
|
+
</Popover>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function FilterButton(props: Parameters<typeof FilterBuilder>[0]) {
|
|
291
|
+
return (
|
|
292
|
+
<CountButton icon={<ListFilter />} label="Filter" count={props.filters.length}>
|
|
293
|
+
<FilterBuilder {...props} />
|
|
294
|
+
</CountButton>
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function SortButton(props: Parameters<typeof SortBuilder>[0]) {
|
|
299
|
+
return (
|
|
300
|
+
<CountButton icon={<ArrowDownWideNarrow />} label="Sort" count={props.sorts.length}>
|
|
301
|
+
<SortBuilder {...props} />
|
|
302
|
+
</CountButton>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* The focus shell (docs/parts/layouts.md): no navigation, one task. The app's mark
|
|
5
|
+
at the top, a way out opposite it (Back, Cancel, Sign in), the task in a narrow
|
|
6
|
+
column in the middle of the room, and a quiet footer for the small print. For
|
|
7
|
+
signing in or up, onboarding, a checkout, a link to one shared thing.
|
|
8
|
+
|
|
9
|
+
`aside` splits the window from 64rem: the task on one side, artwork or a pitch on
|
|
10
|
+
the other. Below 64rem the aside is left out: on a phone the task is the page. */
|
|
11
|
+
export function FocusShell({
|
|
12
|
+
brand,
|
|
13
|
+
exit,
|
|
14
|
+
footer,
|
|
15
|
+
aside,
|
|
16
|
+
width = "sm",
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
}: {
|
|
20
|
+
brand?: ReactNode;
|
|
21
|
+
/** The way out, top right. */
|
|
22
|
+
exit?: ReactNode;
|
|
23
|
+
footer?: ReactNode;
|
|
24
|
+
/** Artwork or a pitch beside the task, from 64rem. */
|
|
25
|
+
aside?: ReactNode;
|
|
26
|
+
/** sm 24rem (a sign-in), md 28rem (a longer form). */
|
|
27
|
+
width?: "sm" | "md";
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
}) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn("flex bg-surface min-h-dvh", className)}>
|
|
33
|
+
<div className="flex flex-col flex-1 min-w-0">
|
|
34
|
+
<header className="flex justify-between items-center gap-3 px-5 sm:px-8 h-14 shrink-0">
|
|
35
|
+
<div className="flex items-center min-w-0">{brand}</div>
|
|
36
|
+
{exit !== undefined && <div className="flex items-center shrink-0">{exit}</div>}
|
|
37
|
+
</header>
|
|
38
|
+
<main className="flex flex-1 justify-center items-center px-5 sm:px-8 py-10">
|
|
39
|
+
<div className={cn("w-full", width === "sm" ? "max-w-sm" : "max-w-md")}>{children}</div>
|
|
40
|
+
</main>
|
|
41
|
+
{footer !== undefined && (
|
|
42
|
+
<footer className="flex flex-wrap justify-center gap-x-4 gap-y-1 px-5 py-4 text-caption text-ink-tertiary [&_a]:link">{footer}</footer>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
{aside !== undefined && <aside className="hidden lg:block relative bg-surface-sunken w-[45%] max-w-3xl overflow-hidden shrink-0">{aside}</aside>}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|