@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
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { CalendarClock } from "lucide-react";
|
|
4
4
|
import { useState } from "react";
|
|
5
|
+
import { formatDay, fromISODate, isTime, splitDateTime, toISODate } from "../../lib/dates.ts";
|
|
6
|
+
import { formatTime, localHourCycle, type HourCycle } from "../../lib/time.ts";
|
|
5
7
|
import { Button } from "./button.tsx";
|
|
6
8
|
import { Calendar, focusCalendarDay } from "./calendar.tsx";
|
|
7
9
|
import { FieldButton, type FieldButtonProps } from "./field-button.tsx";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { formatDay, fromISODate, isTime, splitDateTime, toISODate } from "../../lib/dates.ts";
|
|
10
|
+
import { PickerPanel } from "./picker-panel.tsx";
|
|
11
|
+
import { TimeList } from "./time-list.tsx";
|
|
11
12
|
|
|
12
13
|
export interface DateTimePickerProps extends Omit<FieldButtonProps, "value" | "onChange" | "children" | "onClear" | "icon"> {
|
|
13
14
|
/** `YYYY-MM-DDTHH:MM`, local, or null for none. What a `datetime-local` input holds. */
|
|
@@ -21,14 +22,15 @@ export interface DateTimePickerProps extends Omit<FieldButtonProps, "value" | "o
|
|
|
21
22
|
/** The time a day gets when it is chosen before any time is. */
|
|
22
23
|
defaultTime?: string;
|
|
23
24
|
minuteStep?: number;
|
|
25
|
+
hourCycle?: HourCycle;
|
|
24
26
|
clearable?: boolean;
|
|
25
27
|
/** Sends the value with a form, as a hidden field of this name. */
|
|
26
28
|
name?: string;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
/* A day and a time of day, in one field: the calendar with the
|
|
30
|
-
(
|
|
31
|
-
first is held and joins the day when one is picked. */
|
|
31
|
+
/* A day and a time of day, in one field: the calendar with the day's times beside
|
|
32
|
+
it (under it, in a sheet, on a phone). There is no value until there is a day. A
|
|
33
|
+
time chosen first is held and joins the day when one is picked. */
|
|
32
34
|
export function DateTimePicker({
|
|
33
35
|
value,
|
|
34
36
|
onChange,
|
|
@@ -36,7 +38,8 @@ export function DateTimePicker({
|
|
|
36
38
|
max,
|
|
37
39
|
openTo,
|
|
38
40
|
defaultTime = "12:00",
|
|
39
|
-
minuteStep =
|
|
41
|
+
minuteStep = 15,
|
|
42
|
+
hourCycle,
|
|
40
43
|
clearable = true,
|
|
41
44
|
placeholder = "Pick a date and time",
|
|
42
45
|
name,
|
|
@@ -45,6 +48,7 @@ export function DateTimePicker({
|
|
|
45
48
|
const [open, setOpen] = useState(false);
|
|
46
49
|
/** A time chosen while there is still no day to attach it to. */
|
|
47
50
|
const [heldTime, setHeldTime] = useState<string | null>(null);
|
|
51
|
+
const cycle = hourCycle ?? localHourCycle();
|
|
48
52
|
|
|
49
53
|
const { date, time } = splitDateTime(value);
|
|
50
54
|
const selected = fromISODate(date);
|
|
@@ -54,64 +58,66 @@ export function DateTimePicker({
|
|
|
54
58
|
const to = fromISODate(max);
|
|
55
59
|
|
|
56
60
|
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
className="w-auto"
|
|
83
|
-
onOpenAutoFocus={focusCalendarDay}
|
|
61
|
+
<>
|
|
62
|
+
<PickerPanel
|
|
63
|
+
open={open}
|
|
64
|
+
onOpenChange={(next) => {
|
|
65
|
+
setOpen(next);
|
|
66
|
+
if (!next) setHeldTime(null);
|
|
67
|
+
}}
|
|
68
|
+
title={props["aria-label"] ?? "Pick a date and time"}
|
|
69
|
+
onOpenAutoFocus={focusCalendarDay}
|
|
70
|
+
trigger={
|
|
71
|
+
<FieldButton
|
|
72
|
+
icon={CalendarClock}
|
|
73
|
+
placeholder={placeholder}
|
|
74
|
+
onClear={clearable ? () => onChange(null) : undefined}
|
|
75
|
+
clearLabel="Clear the date and time"
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{selected === undefined ? null : (
|
|
79
|
+
<>
|
|
80
|
+
{formatDay(selected)}
|
|
81
|
+
<span className="ml-2 text-ink-secondary tabular-nums">{formatTime(time ?? defaultTime, cycle)}</span>
|
|
82
|
+
</>
|
|
83
|
+
)}
|
|
84
|
+
</FieldButton>
|
|
85
|
+
}
|
|
84
86
|
>
|
|
85
|
-
<div className="
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
<
|
|
87
|
+
<div className="max-sm:w-full">
|
|
88
|
+
<div className="flex max-sm:flex-col sm:divide-x sm:divide-hairline">
|
|
89
|
+
<Calendar
|
|
90
|
+
mode="single"
|
|
91
|
+
required
|
|
92
|
+
selected={selected}
|
|
93
|
+
onSelect={(day: Date) => onChange(`${toISODate(day)}T${shownTime}`)}
|
|
94
|
+
defaultMonth={selected ?? fromISODate(openTo) ?? from}
|
|
95
|
+
disabled={[...(from === undefined ? [] : [{ before: from }]), ...(to === undefined ? [] : [{ after: to }])]}
|
|
96
|
+
startMonth={from}
|
|
97
|
+
endMonth={to}
|
|
98
|
+
className="max-sm:mx-auto"
|
|
99
|
+
/>
|
|
100
|
+
<TimeList
|
|
101
|
+
label="Time"
|
|
102
|
+
value={isTime(shownTime) ? shownTime : null}
|
|
103
|
+
onChange={(next) => (date === null ? setHeldTime(next) : onChange(`${date}T${next}`))}
|
|
104
|
+
step={minuteStep}
|
|
105
|
+
hourCycle={cycle}
|
|
106
|
+
// Beside the calendar, as tall as it; under it, on a phone, short.
|
|
107
|
+
className="sm:h-auto sm:max-h-[18.5rem] sm:w-36 max-sm:h-40 max-sm:border-hairline max-sm:border-t"
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
<div className="flex justify-between items-center gap-3 p-1.5 pl-3 border-hairline border-t">
|
|
111
|
+
<p aria-live="polite" className="text-caption text-ink-tertiary">
|
|
112
|
+
{date === null ? "Pick a day to set it." : " "}
|
|
113
|
+
</p>
|
|
114
|
+
<Button variant="ghost" size="sm" onClick={() => setOpen(false)}>
|
|
110
115
|
Done
|
|
111
116
|
</Button>
|
|
112
|
-
</
|
|
117
|
+
</div>
|
|
113
118
|
</div>
|
|
114
|
-
</
|
|
115
|
-
|
|
119
|
+
</PickerPanel>
|
|
120
|
+
{name !== undefined && <input type="hidden" name={name} value={date === null ? "" : `${date}T${time ?? defaultTime}`} />}
|
|
121
|
+
</>
|
|
116
122
|
);
|
|
117
123
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
4
|
import { X } from "lucide-react";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ComponentProps } from "react";
|
|
6
|
+
import { finePointer } from "../../lib/pointer.ts";
|
|
6
7
|
import { cn } from "../../lib/utils.ts";
|
|
7
8
|
|
|
8
9
|
export const Dialog = DialogPrimitive.Root;
|
|
@@ -12,44 +13,70 @@ export const DialogPortal = DialogPrimitive.Portal;
|
|
|
12
13
|
|
|
13
14
|
/* The scrim is light — 32%, not 60%. The page behind stays legible, so
|
|
14
15
|
a dialog reads as a layer rather than a mode switch. */
|
|
16
|
+
export const overlayClasses = "z-(--z-overlay) fixed inset-0 bg-scrim data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out";
|
|
17
|
+
|
|
18
|
+
/* A dialog's panel, centred, or on a phone a sheet from the bottom edge (below).
|
|
19
|
+
Shared with AlertDialog, so the two never drift apart. */
|
|
20
|
+
export const dialogPanelClasses = [
|
|
21
|
+
"z-(--z-overlay) fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
22
|
+
"w-[calc(100vw-2rem)] max-h-[85dvh] overflow-y-auto overscroll-contain outline-none",
|
|
23
|
+
"bg-surface-overlay shadow-dialog rounded-overlay",
|
|
24
|
+
"data-[state=open]:animate-scale-in data-[state=closed]:animate-scale-out",
|
|
25
|
+
"max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:translate-x-0 max-sm:translate-y-0",
|
|
26
|
+
"max-sm:w-full max-sm:max-w-none max-sm:max-h-[92dvh] max-sm:rounded-b-none max-sm:pb-[env(safe-area-inset-bottom)]",
|
|
27
|
+
"max-sm:data-[state=open]:animate-sheet-in max-sm:data-[state=closed]:animate-sheet-out",
|
|
28
|
+
];
|
|
29
|
+
|
|
15
30
|
export function DialogOverlay({
|
|
16
31
|
className,
|
|
17
32
|
...props
|
|
18
|
-
}:
|
|
33
|
+
}: ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
19
34
|
return (
|
|
20
35
|
<DialogPrimitive.Overlay
|
|
21
|
-
className={cn(
|
|
22
|
-
"z-50 fixed inset-0 bg-black/32",
|
|
23
|
-
"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",
|
|
24
|
-
className,
|
|
25
|
-
)}
|
|
36
|
+
className={cn(overlayClasses, className)}
|
|
26
37
|
{...props}
|
|
27
38
|
/>
|
|
28
39
|
);
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
export interface DialogContentProps
|
|
32
|
-
extends
|
|
43
|
+
extends ComponentProps<typeof DialogPrimitive.Content> {
|
|
33
44
|
showClose?: boolean;
|
|
45
|
+
/** sm 24rem (a question), md 32rem (a form; the default), lg 42rem (more to read or compare). */
|
|
46
|
+
size?: "sm" | "md" | "lg";
|
|
34
47
|
}
|
|
35
48
|
|
|
49
|
+
const DIALOG_WIDTH = { sm: "max-w-sm", md: "max-w-lg", lg: "max-w-2xl" } as const;
|
|
50
|
+
|
|
51
|
+
/* On a phone a dialog is a sheet that rises from the bottom edge, full width. Centred
|
|
52
|
+
in the window it jumped when the keyboard opened, because the window's height
|
|
53
|
+
changed under it; anchored to the bottom it has nowhere to jump to. Its height is
|
|
54
|
+
measured in dvh, which follows the browser's bars as they come and go, and its
|
|
55
|
+
scrolling is kept from carrying on into the page behind (overscroll-contain).
|
|
56
|
+
|
|
57
|
+
Opening a dialog does not put the cursor in its first field on a touch screen:
|
|
58
|
+
that would bring the keyboard up over a form nobody has looked at yet.
|
|
59
|
+
|
|
60
|
+
From endgame and triptrack, 2026-12-02. */
|
|
36
61
|
export function DialogContent({
|
|
37
62
|
className,
|
|
38
63
|
children,
|
|
39
64
|
showClose = true,
|
|
65
|
+
size = "md",
|
|
66
|
+
onOpenAutoFocus,
|
|
40
67
|
...props
|
|
41
68
|
}: DialogContentProps) {
|
|
42
69
|
return (
|
|
43
70
|
<DialogPortal>
|
|
44
71
|
<DialogOverlay />
|
|
45
72
|
<DialogPrimitive.Content
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)}
|
|
73
|
+
onOpenAutoFocus={(event) => {
|
|
74
|
+
onOpenAutoFocus?.(event);
|
|
75
|
+
if (event.defaultPrevented || finePointer()) return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
(event.currentTarget as HTMLElement).focus({ preventScroll: true });
|
|
78
|
+
}}
|
|
79
|
+
className={cn(dialogPanelClasses, DIALOG_WIDTH[size], className)}
|
|
53
80
|
{...props}
|
|
54
81
|
>
|
|
55
82
|
{children}
|
|
@@ -58,7 +85,7 @@ export function DialogContent({
|
|
|
58
85
|
className={cn(
|
|
59
86
|
"top-3 right-3 absolute inline-flex justify-center items-center",
|
|
60
87
|
"rounded-control size-7 text-ink-tertiary hover:text-ink",
|
|
61
|
-
"hover:bg-tint-hover transition-colors duration-
|
|
88
|
+
"hover:bg-tint-hover transition-colors duration-(--duration-fast)",
|
|
62
89
|
)}
|
|
63
90
|
aria-label="Close"
|
|
64
91
|
>
|
|
@@ -73,14 +100,14 @@ export function DialogContent({
|
|
|
73
100
|
export function DialogHeader({
|
|
74
101
|
className,
|
|
75
102
|
...props
|
|
76
|
-
}:
|
|
103
|
+
}: ComponentProps<"div">) {
|
|
77
104
|
return <div className={cn("px-5 pt-5 pb-0 pr-12", className)} {...props} />;
|
|
78
105
|
}
|
|
79
106
|
|
|
80
107
|
export function DialogTitle({
|
|
81
108
|
className,
|
|
82
109
|
...props
|
|
83
|
-
}:
|
|
110
|
+
}: ComponentProps<typeof DialogPrimitive.Title>) {
|
|
84
111
|
return (
|
|
85
112
|
<DialogPrimitive.Title
|
|
86
113
|
className={cn("font-semibold text-ink text-h3", className)}
|
|
@@ -92,7 +119,7 @@ export function DialogTitle({
|
|
|
92
119
|
export function DialogDescription({
|
|
93
120
|
className,
|
|
94
121
|
...props
|
|
95
|
-
}:
|
|
122
|
+
}: ComponentProps<typeof DialogPrimitive.Description>) {
|
|
96
123
|
return (
|
|
97
124
|
<DialogPrimitive.Description
|
|
98
125
|
className={cn("mt-1.5 text-ink-secondary text-sm", className)}
|
|
@@ -104,14 +131,14 @@ export function DialogDescription({
|
|
|
104
131
|
export function DialogBody({
|
|
105
132
|
className,
|
|
106
133
|
...props
|
|
107
|
-
}:
|
|
134
|
+
}: ComponentProps<"div">) {
|
|
108
135
|
return <div className={cn("px-5 py-4", className)} {...props} />;
|
|
109
136
|
}
|
|
110
137
|
|
|
111
138
|
export function DialogFooter({
|
|
112
139
|
className,
|
|
113
140
|
...props
|
|
114
|
-
}:
|
|
141
|
+
}: ComponentProps<"div">) {
|
|
115
142
|
return (
|
|
116
143
|
<div
|
|
117
144
|
className={cn(
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* A page that is mostly to be read: Notion's page. An optional cover across the
|
|
5
|
+
top, an icon that sits half over it, the title, a line of properties, then the
|
|
6
|
+
body in one reading column (44rem). A wide thing in the body (a table, a
|
|
7
|
+
picture) may break out of the column to the page's reading width with
|
|
8
|
+
`<Breakout>`. Margins step with the room, as Page's do. */
|
|
9
|
+
export function DocumentLayout({
|
|
10
|
+
cover,
|
|
11
|
+
icon,
|
|
12
|
+
title,
|
|
13
|
+
meta,
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
}: {
|
|
17
|
+
/** A picture across the top, full width (an Image with fit cover, usually). */
|
|
18
|
+
cover?: ReactNode;
|
|
19
|
+
/** An emoji or an icon, large, above the title. */
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
title: ReactNode;
|
|
22
|
+
/** Under the title: properties, a byline, a date. */
|
|
23
|
+
meta?: ReactNode;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<article className={cn("pb-24", className)}>
|
|
29
|
+
{cover !== undefined && <div className="w-full h-[min(30vh,16rem)] overflow-hidden [&>*]:w-full [&>*]:h-full">{cover}</div>}
|
|
30
|
+
<div className="mx-auto px-5 @xl:px-8 @4xl:px-12 w-full max-w-reading">
|
|
31
|
+
{/* The full-bleed grid: everything in the middle column, a Breakout across all three. */}
|
|
32
|
+
<div className="grid grid-cols-[1fr_min(var(--container-measure),100%)_1fr] [&>*]:col-start-2">
|
|
33
|
+
<header className={cn(cover !== undefined ? (icon !== undefined ? "-mt-9" : "pt-8") : "pt-12 @xl:pt-16")}>
|
|
34
|
+
{icon !== undefined && (
|
|
35
|
+
<div aria-hidden className="mb-3 text-display [&_svg]:size-14 leading-none">
|
|
36
|
+
{icon}
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
<h1 className="text-title text-ink text-balance">{title}</h1>
|
|
40
|
+
{meta !== undefined && <div className="mt-3 text-ink-secondary text-sm">{meta}</div>}
|
|
41
|
+
</header>
|
|
42
|
+
<div className="contents [&>*]:col-start-2 [&>*]:mt-4">{children}</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</article>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** In a DocumentLayout's body, something wider than the reading column (a table, a picture): it spans the page's reading width. */
|
|
50
|
+
export function Breakout({ className, ...props }: ComponentProps<"div">) {
|
|
51
|
+
return <div className={cn("col-span-full! col-start-1! min-w-0", className)} {...props} />;
|
|
52
|
+
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
4
|
import { Check, ChevronRight } from "lucide-react";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ComponentProps } from "react";
|
|
6
|
+
import { formatShortcut } from "../../lib/keys.ts";
|
|
6
7
|
import { cn } from "../../lib/utils.ts";
|
|
8
|
+
import { usePlatform } from "./typography.tsx";
|
|
7
9
|
|
|
8
10
|
/* The archetypal Notion surface: 6px padding, 4px-radius rows, 28px
|
|
9
11
|
tall, hover = tint. The shadow's 1px ambient ring is what keeps this
|
|
@@ -15,17 +17,20 @@ export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
15
17
|
export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
16
18
|
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/* Shared with ContextMenu, so the two menus are one look. A menu taller than the
|
|
21
|
+
room there is scrolls inside itself rather than running off the screen. */
|
|
22
|
+
export const menuSurfaceClasses = [
|
|
23
|
+
"z-(--z-overlay) min-w-[11rem] overflow-x-hidden overflow-y-auto overscroll-contain p-1.5",
|
|
24
|
+
"max-h-[var(--radix-dropdown-menu-content-available-height,var(--radix-context-menu-content-available-height,80vh))]",
|
|
20
25
|
"bg-surface-overlay shadow-popover rounded-overlay",
|
|
21
26
|
"data-[state=open]:animate-slide-in data-[state=closed]:animate-fade-out",
|
|
22
27
|
"origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
23
28
|
];
|
|
24
29
|
|
|
25
|
-
const
|
|
30
|
+
export const menuItemClasses = [
|
|
26
31
|
"relative flex items-center gap-2 cursor-default select-none",
|
|
27
|
-
"h-
|
|
28
|
-
"transition-colors duration-
|
|
32
|
+
"h-control-sm px-2 rounded-control text-sm text-ink outline-none",
|
|
33
|
+
"transition-colors duration-(--duration-instant)",
|
|
29
34
|
"data-[highlighted]:bg-tint-hover",
|
|
30
35
|
"data-[disabled]:pointer-events-none data-[disabled]:text-ink-disabled",
|
|
31
36
|
"[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-ink-tertiary",
|
|
@@ -35,12 +40,12 @@ export function DropdownMenuContent({
|
|
|
35
40
|
className,
|
|
36
41
|
sideOffset = 6,
|
|
37
42
|
...props
|
|
38
|
-
}:
|
|
43
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
39
44
|
return (
|
|
40
45
|
<DropdownMenuPrimitive.Portal>
|
|
41
46
|
<DropdownMenuPrimitive.Content
|
|
42
47
|
sideOffset={sideOffset}
|
|
43
|
-
className={cn(
|
|
48
|
+
className={cn(menuSurfaceClasses, className)}
|
|
44
49
|
{...props}
|
|
45
50
|
/>
|
|
46
51
|
</DropdownMenuPrimitive.Portal>
|
|
@@ -48,7 +53,7 @@ export function DropdownMenuContent({
|
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
export interface DropdownMenuItemProps
|
|
51
|
-
extends
|
|
56
|
+
extends ComponentProps<typeof DropdownMenuPrimitive.Item> {
|
|
52
57
|
danger?: boolean;
|
|
53
58
|
}
|
|
54
59
|
|
|
@@ -60,7 +65,7 @@ export function DropdownMenuItem({
|
|
|
60
65
|
return (
|
|
61
66
|
<DropdownMenuPrimitive.Item
|
|
62
67
|
className={cn(
|
|
63
|
-
|
|
68
|
+
menuItemClasses,
|
|
64
69
|
danger &&
|
|
65
70
|
"text-danger data-[highlighted]:bg-danger-tint [&_svg]:text-danger",
|
|
66
71
|
className,
|
|
@@ -74,10 +79,10 @@ export function DropdownMenuCheckboxItem({
|
|
|
74
79
|
className,
|
|
75
80
|
children,
|
|
76
81
|
...props
|
|
77
|
-
}:
|
|
82
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
78
83
|
return (
|
|
79
84
|
<DropdownMenuPrimitive.CheckboxItem
|
|
80
|
-
className={cn(
|
|
85
|
+
className={cn(menuItemClasses, "pl-7", className)}
|
|
81
86
|
{...props}
|
|
82
87
|
>
|
|
83
88
|
<span className="left-2 absolute flex justify-center items-center size-4">
|
|
@@ -94,10 +99,10 @@ export function DropdownMenuRadioItem({
|
|
|
94
99
|
className,
|
|
95
100
|
children,
|
|
96
101
|
...props
|
|
97
|
-
}:
|
|
102
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
98
103
|
return (
|
|
99
104
|
<DropdownMenuPrimitive.RadioItem
|
|
100
|
-
className={cn(
|
|
105
|
+
className={cn(menuItemClasses, "pl-7", className)}
|
|
101
106
|
{...props}
|
|
102
107
|
>
|
|
103
108
|
<span className="left-2 absolute flex justify-center items-center size-4">
|
|
@@ -113,7 +118,7 @@ export function DropdownMenuRadioItem({
|
|
|
113
118
|
export function DropdownMenuLabel({
|
|
114
119
|
className,
|
|
115
120
|
...props
|
|
116
|
-
}:
|
|
121
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Label>) {
|
|
117
122
|
return (
|
|
118
123
|
<DropdownMenuPrimitive.Label
|
|
119
124
|
className={cn(
|
|
@@ -128,7 +133,7 @@ export function DropdownMenuLabel({
|
|
|
128
133
|
export function DropdownMenuSeparator({
|
|
129
134
|
className,
|
|
130
135
|
...props
|
|
131
|
-
}:
|
|
136
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
132
137
|
return (
|
|
133
138
|
<DropdownMenuPrimitive.Separator
|
|
134
139
|
className={cn("-mx-1.5 my-1.5 bg-hairline h-px", className)}
|
|
@@ -137,18 +142,15 @@ export function DropdownMenuSeparator({
|
|
|
137
142
|
);
|
|
138
143
|
}
|
|
139
144
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}:
|
|
145
|
+
/* A menu item's shortcut, written once ("mod+d") and shown as the platform has it
|
|
146
|
+
(⌘D, Ctrl+D). It is for the eye: hidden from the item's name, which a screen
|
|
147
|
+
reader reads as the words alone. */
|
|
148
|
+
export function DropdownMenuShortcut({ className, keys, children, ...props }: ComponentProps<"span"> & { keys?: string }) {
|
|
149
|
+
const on = usePlatform();
|
|
144
150
|
return (
|
|
145
|
-
<span
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
className,
|
|
149
|
-
)}
|
|
150
|
-
{...props}
|
|
151
|
-
/>
|
|
151
|
+
<span aria-hidden className={cn("ml-auto pl-4 text-ink-tertiary text-caption tracking-wide", className)} {...props}>
|
|
152
|
+
{keys ? formatShortcut(keys, on) : children}
|
|
153
|
+
</span>
|
|
152
154
|
);
|
|
153
155
|
}
|
|
154
156
|
|
|
@@ -156,10 +158,10 @@ export function DropdownMenuSubTrigger({
|
|
|
156
158
|
className,
|
|
157
159
|
children,
|
|
158
160
|
...props
|
|
159
|
-
}:
|
|
161
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger>) {
|
|
160
162
|
return (
|
|
161
163
|
<DropdownMenuPrimitive.SubTrigger
|
|
162
|
-
className={cn(
|
|
164
|
+
className={cn(menuItemClasses, "data-[state=open]:bg-tint-hover", className)}
|
|
163
165
|
{...props}
|
|
164
166
|
>
|
|
165
167
|
{children}
|
|
@@ -171,11 +173,11 @@ export function DropdownMenuSubTrigger({
|
|
|
171
173
|
export function DropdownMenuSubContent({
|
|
172
174
|
className,
|
|
173
175
|
...props
|
|
174
|
-
}:
|
|
176
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
175
177
|
return (
|
|
176
178
|
<DropdownMenuPrimitive.Portal>
|
|
177
179
|
<DropdownMenuPrimitive.SubContent
|
|
178
|
-
className={cn(
|
|
180
|
+
className={cn(menuSurfaceClasses, className)}
|
|
179
181
|
{...props}
|
|
180
182
|
/>
|
|
181
183
|
</DropdownMenuPrimitive.Portal>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useLayoutEffect, useRef, useState, type AriaAttributes, type ClipboardEvent, type KeyboardEvent, type MouseEvent } from "react";
|
|
4
4
|
import { isWebUrl } from "../../lib/embed.ts";
|
|
5
5
|
import type { Text } from "../../lib/rich-text.ts";
|
|
6
6
|
import { readSpans, spansToHtml } from "../../lib/rich-text-dom.ts";
|
|
7
7
|
import { cn } from "../../lib/utils.ts";
|
|
8
|
+
import { matchShortcut } from "../../lib/keys.ts";
|
|
8
9
|
|
|
9
10
|
/* Rich text edited in place: bold, italic, strike, code, links and page mentions
|
|
10
11
|
over the span model in lib/rich-text. The browser owns the DOM while the user
|
|
@@ -26,6 +27,10 @@ export function EditableText({
|
|
|
26
27
|
onLink,
|
|
27
28
|
placeholder,
|
|
28
29
|
alwaysShowPlaceholder,
|
|
30
|
+
label,
|
|
31
|
+
multiline = true,
|
|
32
|
+
onBlur,
|
|
33
|
+
aria,
|
|
29
34
|
className,
|
|
30
35
|
}: {
|
|
31
36
|
// Put on the element as data-text, so it can be found to move focus to it.
|
|
@@ -39,10 +44,32 @@ export function EditableText({
|
|
|
39
44
|
onLink?: (link: { href?: string; page?: string }) => void;
|
|
40
45
|
placeholder?: string;
|
|
41
46
|
alwaysShowPlaceholder?: boolean;
|
|
47
|
+
/** Names the field for a screen reader (the placeholder is heard too). */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** Enter makes a new line or block, rather than submitting. */
|
|
50
|
+
multiline?: boolean;
|
|
51
|
+
onBlur?: () => void;
|
|
52
|
+
/** More ARIA for the field: a "/" menu's aria-controls, aria-expanded, aria-activedescendant. */
|
|
53
|
+
aria?: AriaAttributes;
|
|
42
54
|
className?: string;
|
|
43
55
|
}) {
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
const el = useRef<HTMLDivElement>(null);
|
|
57
|
+
// The first markup goes through React, so a server-rendered page shows the text.
|
|
58
|
+
// React never writes it again (the string never changes): every later rewrite is
|
|
59
|
+
// done here, on each `rev`. Leaving it to React would skip a rewrite whose markup
|
|
60
|
+
// happens to equal the last one React wrote, though the browser has changed the
|
|
61
|
+
// DOM since (an empty line typed into, then split: both halves kept the text).
|
|
62
|
+
const [initial] = useState(() => ({ __html: spansToHtml(text) }));
|
|
63
|
+
const latest = useRef(text);
|
|
64
|
+
latest.current = text;
|
|
65
|
+
const first = useRef(true);
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
if (first.current) {
|
|
68
|
+
first.current = false;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (el.current) el.current.innerHTML = spansToHtml(latest.current);
|
|
72
|
+
}, [rev]);
|
|
46
73
|
|
|
47
74
|
const onInput = (el: HTMLDivElement) => {
|
|
48
75
|
// An emptied element keeps a stray <br>, which would defeat :empty and read
|
|
@@ -76,32 +103,38 @@ export function EditableText({
|
|
|
76
103
|
|
|
77
104
|
return (
|
|
78
105
|
<div
|
|
106
|
+
ref={el}
|
|
79
107
|
data-text={id}
|
|
80
108
|
role="textbox"
|
|
109
|
+
aria-label={label}
|
|
110
|
+
aria-multiline={multiline}
|
|
111
|
+
aria-placeholder={placeholder}
|
|
112
|
+
{...aria}
|
|
81
113
|
contentEditable
|
|
82
114
|
suppressContentEditableWarning
|
|
83
115
|
spellCheck
|
|
84
116
|
data-placeholder={placeholder}
|
|
85
117
|
className={cn(
|
|
86
118
|
// A link the browser inserts (a paste) is styled before the text is redrawn.
|
|
87
|
-
"min-w-0 break-words whitespace-pre-wrap outline-none [&_a]:
|
|
119
|
+
"min-w-0 break-words whitespace-pre-wrap outline-none [&_a]:link [&_b]:font-semibold",
|
|
88
120
|
"empty:before:pointer-events-none empty:before:text-ink-tertiary",
|
|
89
121
|
alwaysShowPlaceholder
|
|
90
122
|
? "empty:before:content-[attr(data-placeholder)]"
|
|
91
123
|
: "focus:empty:before:content-[attr(data-placeholder)]",
|
|
92
124
|
className,
|
|
93
125
|
)}
|
|
94
|
-
dangerouslySetInnerHTML={
|
|
126
|
+
dangerouslySetInnerHTML={initial}
|
|
95
127
|
onInput={(e) => onInput(e.currentTarget)}
|
|
96
128
|
onKeyDown={(e) => {
|
|
97
129
|
// The model has no underline.
|
|
98
|
-
if ((e
|
|
99
|
-
if ((e
|
|
130
|
+
if (matchShortcut(e, "mod+u")) e.preventDefault();
|
|
131
|
+
if (matchShortcut(e, "mod+shift+s")) {
|
|
100
132
|
e.preventDefault();
|
|
101
133
|
document.execCommand("strikeThrough");
|
|
102
134
|
}
|
|
103
135
|
onKeyDown?.(e);
|
|
104
136
|
}}
|
|
137
|
+
onBlur={onBlur}
|
|
105
138
|
onPaste={onPaste}
|
|
106
139
|
onClick={onClick}
|
|
107
140
|
/>
|