@kujoforall/paper-ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/dist/components/editor/block-text.d.ts +8 -0
- package/dist/components/editor/block-text.d.ts.map +1 -0
- package/dist/components/editor/block-text.js +248 -0
- package/dist/components/editor/block-text.js.map +1 -0
- package/dist/components/editor/blocks.d.ts +33 -0
- package/dist/components/editor/blocks.d.ts.map +1 -0
- package/dist/components/editor/blocks.js +191 -0
- package/dist/components/editor/blocks.js.map +1 -0
- package/dist/components/editor/document-editor.d.ts +27 -0
- package/dist/components/editor/document-editor.d.ts.map +1 -0
- package/dist/components/editor/document-editor.js +42 -0
- package/dist/components/editor/document-editor.js.map +1 -0
- package/dist/components/editor/document-view.d.ts +22 -0
- package/dist/components/editor/document-view.d.ts.map +1 -0
- package/dist/components/editor/document-view.js +110 -0
- package/dist/components/editor/document-view.js.map +1 -0
- package/dist/components/editor/editor-state.d.ts +107 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -0
- package/dist/components/editor/editor-state.js +217 -0
- package/dist/components/editor/editor-state.js.map +1 -0
- package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
- package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
- package/dist/components/editor/extensions/kit-blocks.js +201 -0
- package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
- package/dist/components/editor/extensions/spoiler.d.ts +8 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
- package/dist/components/editor/extensions/spoiler.js +36 -0
- package/dist/components/editor/extensions/spoiler.js.map +1 -0
- package/dist/components/editor/index.d.ts +10 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +10 -0
- package/dist/components/editor/index.js.map +1 -0
- package/dist/components/editor/kinds.d.ts +99 -0
- package/dist/components/editor/kinds.d.ts.map +1 -0
- package/dist/components/editor/kinds.js +74 -0
- package/dist/components/editor/kinds.js.map +1 -0
- package/dist/components/editor/look.d.ts +18 -0
- package/dist/components/editor/look.d.ts.map +1 -0
- package/dist/components/editor/look.js +21 -0
- package/dist/components/editor/look.js.map +1 -0
- package/dist/components/sketch/rough.d.ts +38 -0
- package/dist/components/sketch/rough.d.ts.map +1 -0
- package/dist/components/sketch/rough.js +57 -0
- package/dist/components/sketch/rough.js.map +1 -0
- package/dist/components/three/model-viewer.d.ts +36 -0
- package/dist/components/three/model-viewer.d.ts.map +1 -0
- package/dist/components/three/model-viewer.js +338 -0
- package/dist/components/three/model-viewer.js.map +1 -0
- package/dist/components/ui/accent-picker.d.ts +2 -0
- package/dist/components/ui/accent-picker.d.ts.map +1 -0
- package/dist/components/ui/accent-picker.js +44 -0
- package/dist/components/ui/accent-picker.js.map +1 -0
- package/dist/components/ui/address-field.d.ts +10 -0
- package/dist/components/ui/address-field.d.ts.map +1 -0
- package/dist/components/ui/address-field.js +24 -0
- package/dist/components/ui/address-field.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +29 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +72 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/animated-height.d.ts +6 -0
- package/dist/components/ui/animated-height.d.ts.map +1 -0
- package/dist/components/ui/animated-height.js +26 -0
- package/dist/components/ui/animated-height.js.map +1 -0
- package/dist/components/ui/app-shell.d.ts +26 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -0
- package/dist/components/ui/app-shell.js +71 -0
- package/dist/components/ui/app-shell.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +30 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +19 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +62 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/banner.d.ts +33 -0
- package/dist/components/ui/banner.d.ts.map +1 -0
- package/dist/components/ui/banner.js +21 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/breadcrumbs.d.ts +10 -0
- package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
- package/dist/components/ui/breadcrumbs.js +9 -0
- package/dist/components/ui/breadcrumbs.js.map +1 -0
- package/dist/components/ui/button.d.ts +15 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +110 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +5 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +65 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/callout.d.ts +32 -0
- package/dist/components/ui/callout.d.ts.map +1 -0
- package/dist/components/ui/callout.js +40 -0
- package/dist/components/ui/callout.js.map +1 -0
- package/dist/components/ui/card.d.ts +18 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +28 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +11 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +30 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/choice-label.d.ts +13 -0
- package/dist/components/ui/choice-label.d.ts.map +1 -0
- package/dist/components/ui/choice-label.js +17 -0
- package/dist/components/ui/choice-label.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +10 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/collection-layout.d.ts +24 -0
- package/dist/components/ui/collection-layout.d.ts.map +1 -0
- package/dist/components/ui/collection-layout.js +16 -0
- package/dist/components/ui/collection-layout.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +10 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +93 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command-menu.d.ts +18 -0
- package/dist/components/ui/command-menu.d.ts.map +1 -0
- package/dist/components/ui/command-menu.js +49 -0
- package/dist/components/ui/command-menu.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +19 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +42 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/copy-button.d.ts +11 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +48 -0
- package/dist/components/ui/copy-button.js.map +1 -0
- package/dist/components/ui/database/calendar-view.d.ts +10 -0
- package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
- package/dist/components/ui/database/calendar-view.js +65 -0
- package/dist/components/ui/database/calendar-view.js.map +1 -0
- package/dist/components/ui/database/card-views.d.ts +22 -0
- package/dist/components/ui/database/card-views.d.ts.map +1 -0
- package/dist/components/ui/database/card-views.js +74 -0
- package/dist/components/ui/database/card-views.js.map +1 -0
- package/dist/components/ui/database/cells.d.ts +20 -0
- package/dist/components/ui/database/cells.d.ts.map +1 -0
- package/dist/components/ui/database/cells.js +132 -0
- package/dist/components/ui/database/cells.js.map +1 -0
- package/dist/components/ui/database/database.d.ts +19 -0
- package/dist/components/ui/database/database.d.ts.map +1 -0
- package/dist/components/ui/database/database.js +102 -0
- package/dist/components/ui/database/database.js.map +1 -0
- package/dist/components/ui/database/icons.d.ts +5 -0
- package/dist/components/ui/database/icons.d.ts.map +1 -0
- package/dist/components/ui/database/icons.js +13 -0
- package/dist/components/ui/database/icons.js.map +1 -0
- package/dist/components/ui/database/table-view.d.ts +11 -0
- package/dist/components/ui/database/table-view.d.ts.map +1 -0
- package/dist/components/ui/database/table-view.js +157 -0
- package/dist/components/ui/database/table-view.js.map +1 -0
- package/dist/components/ui/date-picker.d.ts +40 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +64 -0
- package/dist/components/ui/date-picker.js.map +1 -0
- package/dist/components/ui/date-time-picker.d.ts +21 -0
- package/dist/components/ui/date-time-picker.d.ts.map +1 -0
- package/dist/components/ui/date-time-picker.js +34 -0
- package/dist/components/ui/date-time-picker.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +21 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +63 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/document-layout.d.ts +15 -0
- package/dist/components/ui/document-layout.d.ts.map +1 -0
- package/dist/components/ui/document-layout.js +15 -0
- package/dist/components/ui/document-layout.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +24 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +65 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/editable-text.d.ts +24 -0
- package/dist/components/ui/editable-text.d.ts.map +1 -0
- package/dist/components/ui/editable-text.js +85 -0
- package/dist/components/ui/editable-text.js.map +1 -0
- package/dist/components/ui/empty-state.d.ts +11 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty-state.js +9 -0
- package/dist/components/ui/empty-state.js.map +1 -0
- package/dist/components/ui/error-state.d.ts +20 -0
- package/dist/components/ui/error-state.d.ts.map +1 -0
- package/dist/components/ui/error-state.js +17 -0
- package/dist/components/ui/error-state.js.map +1 -0
- package/dist/components/ui/field-button.d.ts +15 -0
- package/dist/components/ui/field-button.d.ts.map +1 -0
- package/dist/components/ui/field-button.js +18 -0
- package/dist/components/ui/field-button.js.map +1 -0
- package/dist/components/ui/file-preview.d.ts +5 -0
- package/dist/components/ui/file-preview.d.ts.map +1 -0
- package/dist/components/ui/file-preview.js +66 -0
- package/dist/components/ui/file-preview.js.map +1 -0
- package/dist/components/ui/file-uploader.d.ts +39 -0
- package/dist/components/ui/file-uploader.d.ts.map +1 -0
- package/dist/components/ui/file-uploader.js +111 -0
- package/dist/components/ui/file-uploader.js.map +1 -0
- package/dist/components/ui/filter-builder.d.ts +18 -0
- package/dist/components/ui/filter-builder.d.ts.map +1 -0
- package/dist/components/ui/filter-builder.js +98 -0
- package/dist/components/ui/filter-builder.js.map +1 -0
- package/dist/components/ui/focus-shell.d.ts +14 -0
- package/dist/components/ui/focus-shell.d.ts.map +1 -0
- package/dist/components/ui/focus-shell.js +13 -0
- package/dist/components/ui/focus-shell.js.map +1 -0
- package/dist/components/ui/handle-row.d.ts +25 -0
- package/dist/components/ui/handle-row.d.ts.map +1 -0
- package/dist/components/ui/handle-row.js +110 -0
- package/dist/components/ui/handle-row.js.map +1 -0
- package/dist/components/ui/header-bar.d.ts +5 -0
- package/dist/components/ui/header-bar.d.ts.map +1 -0
- package/dist/components/ui/header-bar.js +10 -0
- package/dist/components/ui/header-bar.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +13 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/image-block.d.ts +31 -0
- package/dist/components/ui/image-block.d.ts.map +1 -0
- package/dist/components/ui/image-block.js +103 -0
- package/dist/components/ui/image-block.js.map +1 -0
- package/dist/components/ui/image-card.d.ts +17 -0
- package/dist/components/ui/image-card.d.ts.map +1 -0
- package/dist/components/ui/image-card.js +39 -0
- package/dist/components/ui/image-card.js.map +1 -0
- package/dist/components/ui/image-framer.d.ts +24 -0
- package/dist/components/ui/image-framer.d.ts.map +1 -0
- package/dist/components/ui/image-framer.js +89 -0
- package/dist/components/ui/image-framer.js.map +1 -0
- package/dist/components/ui/image-viewer.d.ts +31 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -0
- package/dist/components/ui/image-viewer.js +114 -0
- package/dist/components/ui/image-viewer.js.map +1 -0
- package/dist/components/ui/image.d.ts +33 -0
- package/dist/components/ui/image.d.ts.map +1 -0
- package/dist/components/ui/image.js +61 -0
- package/dist/components/ui/image.js.map +1 -0
- package/dist/components/ui/index.d.ts +92 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +92 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/input.d.ts +75 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +245 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/link-block.d.ts +13 -0
- package/dist/components/ui/link-block.d.ts.map +1 -0
- package/dist/components/ui/link-block.js +21 -0
- package/dist/components/ui/link-block.js.map +1 -0
- package/dist/components/ui/list-detail.d.ts +23 -0
- package/dist/components/ui/list-detail.d.ts.map +1 -0
- package/dist/components/ui/list-detail.js +33 -0
- package/dist/components/ui/list-detail.js.map +1 -0
- package/dist/components/ui/listbox.d.ts +7 -0
- package/dist/components/ui/listbox.d.ts.map +1 -0
- package/dist/components/ui/listbox.js +29 -0
- package/dist/components/ui/listbox.js.map +1 -0
- package/dist/components/ui/mac-card.d.ts +15 -0
- package/dist/components/ui/mac-card.d.ts.map +1 -0
- package/dist/components/ui/mac-card.js +9 -0
- package/dist/components/ui/mac-card.js.map +1 -0
- package/dist/components/ui/month-picker.d.ts +13 -0
- package/dist/components/ui/month-picker.d.ts.map +1 -0
- package/dist/components/ui/month-picker.js +53 -0
- package/dist/components/ui/month-picker.js.map +1 -0
- package/dist/components/ui/multi-select.d.ts +22 -0
- package/dist/components/ui/multi-select.d.ts.map +1 -0
- package/dist/components/ui/multi-select.js +88 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/nav-tree.d.ts +16 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -0
- package/dist/components/ui/nav-tree.js +41 -0
- package/dist/components/ui/nav-tree.js.map +1 -0
- package/dist/components/ui/page.d.ts +23 -0
- package/dist/components/ui/page.d.ts.map +1 -0
- package/dist/components/ui/page.js +28 -0
- package/dist/components/ui/page.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +26 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +54 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/picker-panel.d.ts +13 -0
- package/dist/components/ui/picker-panel.d.ts.map +1 -0
- package/dist/components/ui/picker-panel.js +19 -0
- package/dist/components/ui/picker-panel.js.map +1 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +19 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +22 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/property.d.ts +11 -0
- package/dist/components/ui/property.d.ts.map +1 -0
- package/dist/components/ui/property.js +18 -0
- package/dist/components/ui/property.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +18 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/rating.d.ts +14 -0
- package/dist/components/ui/rating.d.ts.map +1 -0
- package/dist/components/ui/rating.js +61 -0
- package/dist/components/ui/rating.js.map +1 -0
- package/dist/components/ui/save-status.d.ts +8 -0
- package/dist/components/ui/save-status.d.ts.map +1 -0
- package/dist/components/ui/save-status.js +31 -0
- package/dist/components/ui/save-status.js.map +1 -0
- package/dist/components/ui/segmented.d.ts +21 -0
- package/dist/components/ui/segmented.d.ts.map +1 -0
- package/dist/components/ui/segmented.js +12 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/select-menu.d.ts +12 -0
- package/dist/components/ui/select-menu.d.ts.map +1 -0
- package/dist/components/ui/select-menu.js +10 -0
- package/dist/components/ui/select-menu.js.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +45 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/selection-bar.d.ts +12 -0
- package/dist/components/ui/selection-bar.d.ts.map +1 -0
- package/dist/components/ui/selection-bar.js +15 -0
- package/dist/components/ui/selection-bar.js.map +1 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +12 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/settings-layout.d.ts +34 -0
- package/dist/components/ui/settings-layout.d.ts.map +1 -0
- package/dist/components/ui/settings-layout.js +16 -0
- package/dist/components/ui/settings-layout.js.map +1 -0
- package/dist/components/ui/share-link.d.ts +14 -0
- package/dist/components/ui/share-link.d.ts.map +1 -0
- package/dist/components/ui/share-link.js +16 -0
- package/dist/components/ui/share-link.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +21 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +53 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +82 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +258 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +8 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +12 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +14 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spotlight.d.ts +23 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -0
- package/dist/components/ui/spotlight.js +110 -0
- package/dist/components/ui/spotlight.js.map +1 -0
- package/dist/components/ui/stat-tile.d.ts +8 -0
- package/dist/components/ui/stat-tile.d.ts.map +1 -0
- package/dist/components/ui/stat-tile.js +9 -0
- package/dist/components/ui/stat-tile.js.map +1 -0
- package/dist/components/ui/step-dialog.d.ts +20 -0
- package/dist/components/ui/step-dialog.d.ts.map +1 -0
- package/dist/components/ui/step-dialog.js +36 -0
- package/dist/components/ui/step-dialog.js.map +1 -0
- package/dist/components/ui/steps-layout.d.ts +20 -0
- package/dist/components/ui/steps-layout.d.ts.map +1 -0
- package/dist/components/ui/steps-layout.js +26 -0
- package/dist/components/ui/steps-layout.js.map +1 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +16 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +76 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +19 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +16 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +65 -0
- package/dist/components/ui/theme-toggle.js.map +1 -0
- package/dist/components/ui/time-list.d.ts +16 -0
- package/dist/components/ui/time-list.d.ts.map +1 -0
- package/dist/components/ui/time-list.js +49 -0
- package/dist/components/ui/time-list.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +47 -0
- package/dist/components/ui/time-picker.d.ts.map +1 -0
- package/dist/components/ui/time-picker.js +141 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +77 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +15 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +55 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +15 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +32 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/top-bar.d.ts +25 -0
- package/dist/components/ui/top-bar.d.ts.map +1 -0
- package/dist/components/ui/top-bar.js +23 -0
- package/dist/components/ui/top-bar.js.map +1 -0
- package/dist/components/ui/typography.d.ts +40 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/components/ui/typography.js +98 -0
- package/dist/components/ui/typography.js.map +1 -0
- package/dist/components/ui/video-block.d.ts +14 -0
- package/dist/components/ui/video-block.d.ts.map +1 -0
- package/dist/components/ui/video-block.js +22 -0
- package/dist/components/ui/video-block.js.map +1 -0
- package/dist/hooks/use-dismiss.d.ts +5 -0
- package/dist/hooks/use-dismiss.d.ts.map +1 -0
- package/dist/hooks/use-dismiss.js +23 -0
- package/dist/hooks/use-dismiss.js.map +1 -0
- package/dist/hooks/use-escape-first.d.ts +3 -0
- package/dist/hooks/use-escape-first.d.ts.map +1 -0
- package/dist/hooks/use-escape-first.js +27 -0
- package/dist/hooks/use-escape-first.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +5 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +16 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-save-queue.d.ts +13 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -0
- package/dist/hooks/use-save-queue.js +57 -0
- package/dist/hooks/use-save-queue.js.map +1 -0
- package/dist/hooks/use-selection.d.ts +10 -0
- package/dist/hooks/use-selection.d.ts.map +1 -0
- package/dist/hooks/use-selection.js +52 -0
- package/dist/hooks/use-selection.js.map +1 -0
- package/dist/hooks/use-shared-transition.d.ts +3 -0
- package/dist/hooks/use-shared-transition.d.ts.map +1 -0
- package/dist/hooks/use-shared-transition.js +38 -0
- package/dist/hooks/use-shared-transition.js.map +1 -0
- package/dist/hooks/use-upload-queue.d.ts +22 -0
- package/dist/hooks/use-upload-queue.d.ts.map +1 -0
- package/dist/hooks/use-upload-queue.js +78 -0
- package/dist/hooks/use-upload-queue.js.map +1 -0
- package/dist/lib/accent.d.ts +5 -0
- package/dist/lib/accent.d.ts.map +1 -0
- package/dist/lib/accent.js +10 -0
- package/dist/lib/accent.js.map +1 -0
- package/dist/lib/bento.d.ts +17 -0
- package/dist/lib/bento.d.ts.map +1 -0
- package/dist/lib/bento.js +92 -0
- package/dist/lib/bento.js.map +1 -0
- package/dist/lib/database.d.ts +92 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +272 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/dates.d.ts +30 -0
- package/dist/lib/dates.d.ts.map +1 -0
- package/dist/lib/dates.js +61 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/document.d.ts +79 -0
- package/dist/lib/document.d.ts.map +1 -0
- package/dist/lib/document.js +11 -0
- package/dist/lib/document.js.map +1 -0
- package/dist/lib/embed.d.ts +14 -0
- package/dist/lib/embed.d.ts.map +1 -0
- package/dist/lib/embed.js +63 -0
- package/dist/lib/embed.js.map +1 -0
- package/dist/lib/files.d.ts +23 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/files.js +69 -0
- package/dist/lib/files.js.map +1 -0
- package/dist/lib/justified.d.ts +50 -0
- package/dist/lib/justified.d.ts.map +1 -0
- package/dist/lib/justified.js +78 -0
- package/dist/lib/justified.js.map +1 -0
- package/dist/lib/keys.d.ts +18 -0
- package/dist/lib/keys.d.ts.map +1 -0
- package/dist/lib/keys.js +66 -0
- package/dist/lib/keys.js.map +1 -0
- package/dist/lib/number.d.ts +4 -0
- package/dist/lib/number.d.ts.map +1 -0
- package/dist/lib/number.js +33 -0
- package/dist/lib/number.js.map +1 -0
- package/dist/lib/pointer.d.ts +2 -0
- package/dist/lib/pointer.d.ts.map +1 -0
- package/dist/lib/pointer.js +4 -0
- package/dist/lib/pointer.js.map +1 -0
- package/dist/lib/prepare-image.d.ts +43 -0
- package/dist/lib/prepare-image.d.ts.map +1 -0
- package/dist/lib/prepare-image.js +105 -0
- package/dist/lib/prepare-image.js.map +1 -0
- package/dist/lib/rich-text-dom.d.ts +16 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -0
- package/dist/lib/rich-text-dom.js +145 -0
- package/dist/lib/rich-text-dom.js.map +1 -0
- package/dist/lib/rich-text.d.ts +15 -0
- package/dist/lib/rich-text.d.ts.map +1 -0
- package/dist/lib/rich-text.js +35 -0
- package/dist/lib/rich-text.js.map +1 -0
- package/dist/lib/spotlight.d.ts +22 -0
- package/dist/lib/spotlight.d.ts.map +1 -0
- package/dist/lib/spotlight.js +66 -0
- package/dist/lib/spotlight.js.map +1 -0
- package/dist/lib/theme.d.ts +6 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +15 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/time.d.ts +19 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +91 -0
- package/dist/lib/time.js.map +1 -0
- package/dist/lib/tree.d.ts +17 -0
- package/dist/lib/tree.d.ts.map +1 -0
- package/dist/lib/tree.js +35 -0
- package/dist/lib/tree.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +24 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles/notion.css +817 -0
- package/package.json +129 -5
- package/src/components/editor/block-text.tsx +271 -0
- package/src/components/editor/blocks.tsx +373 -0
- package/src/components/editor/document-editor.tsx +106 -0
- package/src/components/editor/document-view.tsx +205 -0
- package/src/components/editor/editor-state.tsx +298 -0
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +81 -0
- package/src/components/editor/index.ts +10 -0
- package/src/components/editor/kinds.ts +158 -0
- package/src/components/editor/look.tsx +36 -0
- package/src/components/sketch/rough.tsx +90 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +72 -0
- package/src/components/ui/address-field.tsx +57 -0
- package/src/components/ui/alert-dialog.tsx +136 -0
- package/src/components/ui/animated-height.tsx +34 -0
- package/src/components/ui/app-shell.tsx +140 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +81 -0
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +25 -0
- package/src/components/ui/button.tsx +147 -0
- package/src/components/ui/calendar.tsx +101 -0
- package/src/components/ui/callout.tsx +61 -0
- package/src/components/ui/card.tsx +59 -0
- package/src/components/ui/checkbox.tsx +66 -0
- package/src/components/ui/choice-label.tsx +43 -0
- package/src/components/ui/collapsible.tsx +58 -0
- package/src/components/ui/collection-layout.tsx +69 -0
- package/src/components/ui/combobox.tsx +155 -0
- package/src/components/ui/command-menu.tsx +102 -0
- package/src/components/ui/context-menu.tsx +89 -0
- package/src/components/ui/copy-button.tsx +80 -0
- package/src/components/ui/database/calendar-view.tsx +180 -0
- package/src/components/ui/database/card-views.tsx +221 -0
- package/src/components/ui/database/cells.tsx +237 -0
- package/src/components/ui/database/database.tsx +279 -0
- package/src/components/ui/database/icons.ts +15 -0
- package/src/components/ui/database/table-view.tsx +311 -0
- package/src/components/ui/date-picker.tsx +208 -0
- package/src/components/ui/date-time-picker.tsx +123 -0
- package/src/components/ui/dialog.tsx +151 -0
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +185 -0
- package/src/components/ui/editable-text.tsx +142 -0
- package/src/components/ui/empty-state.tsx +35 -0
- package/src/components/ui/error-state.tsx +67 -0
- package/src/components/ui/field-button.tsx +70 -0
- package/src/components/ui/file-preview.tsx +80 -0
- package/src/components/ui/file-uploader.tsx +375 -0
- package/src/components/ui/filter-builder.tsx +304 -0
- package/src/components/ui/focus-shell.tsx +48 -0
- package/src/components/ui/handle-row.tsx +252 -0
- package/src/components/ui/header-bar.tsx +15 -0
- package/src/components/ui/hover-card.tsx +30 -0
- package/src/components/ui/image-block.tsx +238 -0
- package/src/components/ui/image-card.tsx +95 -0
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +230 -0
- package/src/components/ui/image.tsx +200 -0
- package/src/components/ui/index.ts +178 -0
- package/src/components/ui/input.tsx +471 -0
- package/src/components/ui/link-block.tsx +85 -0
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +46 -0
- package/src/components/ui/month-picker.tsx +119 -0
- package/src/components/ui/multi-select.tsx +221 -0
- package/src/components/ui/nav-tree.tsx +92 -0
- package/src/components/ui/page.tsx +73 -0
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +42 -0
- package/src/components/ui/progress.tsx +76 -0
- package/src/components/ui/property.tsx +33 -0
- package/src/components/ui/radio-group.tsx +61 -0
- package/src/components/ui/rating.tsx +122 -0
- package/src/components/ui/save-status.tsx +53 -0
- package/src/components/ui/segmented.tsx +74 -0
- package/src/components/ui/select-menu.tsx +54 -0
- package/src/components/ui/select.tsx +147 -0
- package/src/components/ui/selection-bar.tsx +50 -0
- package/src/components/ui/separator.tsx +30 -0
- package/src/components/ui/settings-layout.tsx +117 -0
- package/src/components/ui/share-link.tsx +66 -0
- package/src/components/ui/sheet.tsx +90 -0
- package/src/components/ui/sidebar.tsx +627 -0
- package/src/components/ui/skeleton.tsx +22 -0
- package/src/components/ui/spinner.tsx +28 -0
- package/src/components/ui/spotlight.tsx +222 -0
- package/src/components/ui/stat-tile.tsx +25 -0
- package/src/components/ui/step-dialog.tsx +104 -0
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +99 -0
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +80 -0
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +344 -0
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +78 -0
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +204 -0
- package/src/components/ui/video-block.tsx +66 -0
- package/src/hooks/use-dismiss.ts +24 -0
- package/src/hooks/use-escape-first.ts +25 -0
- package/src/hooks/use-media-query.ts +23 -0
- package/src/hooks/use-save-queue.ts +78 -0
- package/src/hooks/use-selection.ts +51 -0
- package/src/hooks/use-shared-transition.ts +40 -0
- package/src/hooks/use-upload-queue.ts +111 -0
- package/src/lib/accent.ts +11 -0
- package/src/lib/bento.ts +87 -0
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +75 -0
- package/src/lib/document.ts +55 -0
- package/src/lib/embed.ts +62 -0
- package/src/lib/files.ts +73 -0
- package/src/lib/justified.ts +106 -0
- package/src/lib/keys.ts +72 -0
- package/src/lib/number.ts +29 -0
- package/src/lib/pointer.ts +3 -0
- package/src/lib/prepare-image.ts +141 -0
- package/src/lib/rich-text-dom.ts +138 -0
- package/src/lib/rich-text.ts +50 -0
- package/src/lib/spotlight.ts +78 -0
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/tree.ts +41 -0
- package/src/lib/utils.ts +25 -0
- package/src/styles/notion.css +817 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import { useId, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Input, type InputProps } from "./input.tsx";
|
|
7
|
+
import { useEscapeFirst } from "../../hooks/use-escape-first.ts";
|
|
8
|
+
import { listSurfaceClasses, optionClasses, stepActive } from "./listbox.ts";
|
|
9
|
+
|
|
10
|
+
/* A text field that suggests as you type. Anything may be typed; the list under it,
|
|
11
|
+
as wide as the field, offers the options that contain it, those that start with
|
|
12
|
+
it first. Arrow keys move through the list, Enter takes the highlighted one,
|
|
13
|
+
Escape closes the list (and not the dialog around it).
|
|
14
|
+
|
|
15
|
+
The list opens in a layer of its own (a popover in the overlay layer), so a
|
|
16
|
+
dialog's scrolling body or a card's overflow cannot clip it. The cursor stays in
|
|
17
|
+
the field throughout.
|
|
18
|
+
|
|
19
|
+
For a free value with suggestions (a shop, a city typed before). To choose only
|
|
20
|
+
from a list, use Select; to choose several, MultiSelect.
|
|
21
|
+
|
|
22
|
+
From endgame, 2026-12-05. */
|
|
23
|
+
export function Combobox({
|
|
24
|
+
value,
|
|
25
|
+
onChange,
|
|
26
|
+
options,
|
|
27
|
+
onEnter,
|
|
28
|
+
limit = 6,
|
|
29
|
+
className,
|
|
30
|
+
onFocus,
|
|
31
|
+
onBlur,
|
|
32
|
+
onKeyDown,
|
|
33
|
+
...props
|
|
34
|
+
}: Omit<InputProps, "value" | "onChange"> & {
|
|
35
|
+
value: string;
|
|
36
|
+
onChange: (value: string) => void;
|
|
37
|
+
options: readonly string[];
|
|
38
|
+
/** Enter with nothing highlighted: the field's own submit. */
|
|
39
|
+
onEnter?: () => void;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}) {
|
|
42
|
+
const listId = useId();
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
const [at, setAt] = useState(-1);
|
|
45
|
+
|
|
46
|
+
const typed = value.trim().toLowerCase();
|
|
47
|
+
const starts = options.filter((o) => o.toLowerCase().startsWith(typed));
|
|
48
|
+
const contains = options.filter((o) => !o.toLowerCase().startsWith(typed) && o.toLowerCase().includes(typed));
|
|
49
|
+
const found = (typed === "" ? [...options] : [...starts, ...contains]).filter((o) => o.toLowerCase() !== typed).slice(0, limit);
|
|
50
|
+
const showing = open && found.length > 0;
|
|
51
|
+
// The options can change under the highlight (loaded late, filtered by someone
|
|
52
|
+
// else): one past the end is no highlight, never an undefined choice.
|
|
53
|
+
const active = at < found.length ? at : -1;
|
|
54
|
+
const optionId = (i: number) => `${listId}-${i}`;
|
|
55
|
+
const field = useRef<HTMLInputElement>(null);
|
|
56
|
+
const take = (option: string) => {
|
|
57
|
+
onChange(option);
|
|
58
|
+
setOpen(false);
|
|
59
|
+
setAt(-1);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/* Escape with the list open closes the list and nothing else. A dialog around the
|
|
63
|
+
field listens for Escape on the document as the key goes down the tree, before
|
|
64
|
+
the field hears it, so stopping it in the field's own handler is too late. The
|
|
65
|
+
window hears it first of all. (Endgame's copy closed the dialog too.) */
|
|
66
|
+
useEscapeFirst(showing, field, () => setOpen(false));
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<PopoverPrimitive.Root open={showing}>
|
|
70
|
+
<PopoverPrimitive.Anchor asChild>
|
|
71
|
+
<div className="relative">
|
|
72
|
+
<Input
|
|
73
|
+
{...props}
|
|
74
|
+
ref={field}
|
|
75
|
+
role="combobox"
|
|
76
|
+
aria-expanded={showing}
|
|
77
|
+
aria-controls={showing ? listId : undefined}
|
|
78
|
+
aria-autocomplete="list"
|
|
79
|
+
aria-activedescendant={showing && active >= 0 ? optionId(active) : undefined}
|
|
80
|
+
autoComplete="off"
|
|
81
|
+
value={value}
|
|
82
|
+
className={className}
|
|
83
|
+
onChange={(e) => {
|
|
84
|
+
onChange(e.target.value);
|
|
85
|
+
setOpen(true);
|
|
86
|
+
setAt(-1);
|
|
87
|
+
}}
|
|
88
|
+
onFocus={(e) => {
|
|
89
|
+
setOpen(true);
|
|
90
|
+
onFocus?.(e);
|
|
91
|
+
}}
|
|
92
|
+
// A click in the list keeps the focus here (it is mousedown,
|
|
93
|
+
// prevented), so a blur means the field really was left.
|
|
94
|
+
onBlur={(e) => {
|
|
95
|
+
setOpen(false);
|
|
96
|
+
onBlur?.(e);
|
|
97
|
+
}}
|
|
98
|
+
onKeyDown={(e) => {
|
|
99
|
+
onKeyDown?.(e);
|
|
100
|
+
// The Enter that finishes composing belongs to the input method.
|
|
101
|
+
if (e.defaultPrevented || e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
102
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
setOpen(true);
|
|
105
|
+
const next = stepActive(active, found.length, e.key);
|
|
106
|
+
if (next !== null) setAt(next);
|
|
107
|
+
} else if (e.key === "Enter") {
|
|
108
|
+
if (showing && active >= 0) {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
take(found[active]!);
|
|
111
|
+
} else onEnter?.();
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
</PopoverPrimitive.Anchor>
|
|
117
|
+
<PopoverPrimitive.Portal>
|
|
118
|
+
<PopoverPrimitive.Content
|
|
119
|
+
// The cursor stays in the field: nothing in the list takes focus.
|
|
120
|
+
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
121
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
122
|
+
onCloseAutoFocus={(e) => e.preventDefault()}
|
|
123
|
+
onInteractOutside={(e) => {
|
|
124
|
+
if (e.target instanceof Node && field.current?.contains(e.target)) e.preventDefault();
|
|
125
|
+
}}
|
|
126
|
+
align="start"
|
|
127
|
+
sideOffset={4}
|
|
128
|
+
collisionPadding={8}
|
|
129
|
+
className={cn("z-(--z-overlay) w-(--radix-popper-anchor-width) max-h-(--radix-popper-available-height) animate-slide-in", listSurfaceClasses)}
|
|
130
|
+
>
|
|
131
|
+
<ul id={listId} role="listbox">
|
|
132
|
+
{found.map((option, i) => (
|
|
133
|
+
<li
|
|
134
|
+
key={option}
|
|
135
|
+
id={optionId(i)}
|
|
136
|
+
role="option"
|
|
137
|
+
aria-selected={i === active}
|
|
138
|
+
data-active={i === active}
|
|
139
|
+
// mousedown, so the choice lands before the field's blur closes the list.
|
|
140
|
+
onMouseDown={(e) => {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
take(option);
|
|
143
|
+
}}
|
|
144
|
+
onMouseEnter={() => setAt(i)}
|
|
145
|
+
className={optionClasses}
|
|
146
|
+
>
|
|
147
|
+
<span className="truncate">{option}</span>
|
|
148
|
+
</li>
|
|
149
|
+
))}
|
|
150
|
+
</ul>
|
|
151
|
+
</PopoverPrimitive.Content>
|
|
152
|
+
</PopoverPrimitive.Portal>
|
|
153
|
+
</PopoverPrimitive.Root>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import type { LucideIcon } from "lucide-react";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { listSurfaceClasses, optionClasses } from "./listbox.ts";
|
|
8
|
+
|
|
9
|
+
export type Command = { key: string; label: string; hint?: string; icon: LucideIcon };
|
|
10
|
+
|
|
11
|
+
const HEIGHT = 320;
|
|
12
|
+
const WIDTH = 288;
|
|
13
|
+
const GAP = 6;
|
|
14
|
+
const MARGIN = 8;
|
|
15
|
+
|
|
16
|
+
/** The id of a CommandMenu's option, for the field's aria-activedescendant. */
|
|
17
|
+
export const commandOptionId = (menuId: string, index: number) => `${menuId}-option-${index}`;
|
|
18
|
+
|
|
19
|
+
/* A list of commands anchored to a point on screen, usually the text caret: the "/"
|
|
20
|
+
menu. It never takes focus. Whatever is being typed in keeps the keyboard and
|
|
21
|
+
drives the highlight, so the owner holds `index`, moves it on the arrow keys and
|
|
22
|
+
calls `onPick` on Enter. `caretRect()` in lib/rich-text-dom gives the anchor.
|
|
23
|
+
|
|
24
|
+
For a screen reader to follow the highlight, give it an `id` and put on the
|
|
25
|
+
field: aria-controls={id}, aria-expanded, and
|
|
26
|
+
aria-activedescendant={commandOptionId(id, index)}.
|
|
27
|
+
|
|
28
|
+
It is drawn at the foot of the page (a portal), so a dialog's transform or
|
|
29
|
+
overflow does not move or clip it, and kept on screen: it opens upward when
|
|
30
|
+
there is more room above, and shifts left at the window's right edge.
|
|
31
|
+
|
|
32
|
+
Filtering is the owner's too: pass the commands that match what was typed. */
|
|
33
|
+
export function CommandMenu({
|
|
34
|
+
id,
|
|
35
|
+
rect,
|
|
36
|
+
commands,
|
|
37
|
+
index,
|
|
38
|
+
onPick,
|
|
39
|
+
title,
|
|
40
|
+
}: {
|
|
41
|
+
id?: string;
|
|
42
|
+
rect: DOMRect;
|
|
43
|
+
commands: Command[];
|
|
44
|
+
index: number;
|
|
45
|
+
onPick: (command: Command) => void;
|
|
46
|
+
title?: string;
|
|
47
|
+
}) {
|
|
48
|
+
const list = useRef<HTMLDivElement>(null);
|
|
49
|
+
const [mounted, setMounted] = useState(false);
|
|
50
|
+
useLayoutEffect(() => setMounted(true), []);
|
|
51
|
+
// The keyboard moves the highlight, so the list follows it out of view.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
list.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
|
|
54
|
+
}, [index]);
|
|
55
|
+
|
|
56
|
+
if (!mounted) return null;
|
|
57
|
+
const below = window.innerHeight - rect.bottom - GAP - MARGIN;
|
|
58
|
+
const aboveRoom = rect.top - GAP - MARGIN;
|
|
59
|
+
const above = below < Math.min(HEIGHT, 200) && aboveRoom > below;
|
|
60
|
+
const room = Math.max(120, Math.min(HEIGHT, above ? aboveRoom : below));
|
|
61
|
+
const width = Math.min(WIDTH, window.innerWidth - MARGIN * 2);
|
|
62
|
+
const left = Math.max(MARGIN, Math.min(rect.left, window.innerWidth - width - MARGIN));
|
|
63
|
+
|
|
64
|
+
return createPortal(
|
|
65
|
+
<div
|
|
66
|
+
ref={list}
|
|
67
|
+
style={{ left, width, maxHeight: room, ...(above ? { bottom: window.innerHeight - rect.top + GAP } : { top: rect.bottom + GAP }) }}
|
|
68
|
+
className={cn("fixed z-(--z-overlay) flex flex-col animate-slide-in", listSurfaceClasses)}
|
|
69
|
+
// Keeps the caret where it is when an entry is clicked.
|
|
70
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
71
|
+
>
|
|
72
|
+
{title && (
|
|
73
|
+
<div aria-hidden className="px-2 pt-1.5 pb-1 text-caption font-medium text-ink-tertiary">
|
|
74
|
+
{title}
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
<div role="listbox" id={id} aria-label={title ?? "Commands"}>
|
|
78
|
+
{commands.map((command, i) => (
|
|
79
|
+
<div
|
|
80
|
+
key={command.key}
|
|
81
|
+
id={id ? commandOptionId(id, i) : undefined}
|
|
82
|
+
role="option"
|
|
83
|
+
aria-selected={i === index}
|
|
84
|
+
data-active={i === index}
|
|
85
|
+
onClick={() => onPick(command)}
|
|
86
|
+
// A taller row: an icon tile and a line of hint under the name.
|
|
87
|
+
className={cn(optionClasses, "h-auto gap-2.5 py-1.5 hover:bg-tint-hover")}
|
|
88
|
+
>
|
|
89
|
+
<span aria-hidden className="flex size-9 shrink-0 items-center justify-center rounded-control bg-surface shadow-xs">
|
|
90
|
+
<command.icon className="size-4 text-ink-secondary" />
|
|
91
|
+
</span>
|
|
92
|
+
<span className="min-w-0">
|
|
93
|
+
<span className="block text-sm">{command.label}</span>
|
|
94
|
+
{command.hint && <span className="block truncate text-caption text-ink-tertiary">{command.hint}</span>}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>,
|
|
100
|
+
document.body,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
4
|
+
import { Check, ChevronRight } from "lucide-react";
|
|
5
|
+
import type { ComponentProps } from "react";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { menuItemClasses, menuSurfaceClasses } from "./dropdown-menu.tsx";
|
|
8
|
+
|
|
9
|
+
/* The menu for a right click, or a long press on a touch screen, on the thing it
|
|
10
|
+
is about: a row, a card, a picture. The same look as DropdownMenu, from the same
|
|
11
|
+
classes. Its items should also be reachable another way (a row's "⋯" button),
|
|
12
|
+
because a right click is invisible to anyone who does not know to try it, and
|
|
13
|
+
a keyboard can only open it with the Menu key or Shift+F10. */
|
|
14
|
+
|
|
15
|
+
export const ContextMenu = ContextMenuPrimitive.Root;
|
|
16
|
+
export const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
17
|
+
export const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
18
|
+
export const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
19
|
+
export const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
20
|
+
|
|
21
|
+
export function ContextMenuContent({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Content>) {
|
|
22
|
+
return (
|
|
23
|
+
<ContextMenuPrimitive.Portal>
|
|
24
|
+
<ContextMenuPrimitive.Content collisionPadding={8} className={cn(menuSurfaceClasses, "origin-[--radix-context-menu-content-transform-origin]", className)} {...props} />
|
|
25
|
+
</ContextMenuPrimitive.Portal>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function ContextMenuItem({ className, danger, ...props }: ComponentProps<typeof ContextMenuPrimitive.Item> & { danger?: boolean }) {
|
|
30
|
+
return (
|
|
31
|
+
<ContextMenuPrimitive.Item
|
|
32
|
+
className={cn(menuItemClasses, danger && "text-danger data-[highlighted]:bg-danger-tint [&_svg]:text-danger", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ContextMenuCheckboxItem({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
|
|
39
|
+
return (
|
|
40
|
+
<ContextMenuPrimitive.CheckboxItem className={cn(menuItemClasses, "pl-7", className)} {...props}>
|
|
41
|
+
<span className="left-2 absolute flex justify-center items-center size-4">
|
|
42
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
43
|
+
<Check className="size-3.5 !text-ink" />
|
|
44
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
45
|
+
</span>
|
|
46
|
+
{children}
|
|
47
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function ContextMenuRadioItem({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
|
|
52
|
+
return (
|
|
53
|
+
<ContextMenuPrimitive.RadioItem className={cn(menuItemClasses, "pl-7", className)} {...props}>
|
|
54
|
+
<span className="left-2 absolute flex justify-center items-center size-4">
|
|
55
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
56
|
+
<span className="block bg-ink rounded-full size-1.5" />
|
|
57
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
58
|
+
</span>
|
|
59
|
+
{children}
|
|
60
|
+
</ContextMenuPrimitive.RadioItem>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function ContextMenuLabel({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Label>) {
|
|
65
|
+
return <ContextMenuPrimitive.Label className={cn("px-2 pt-1.5 pb-1 font-medium text-caption text-ink-tertiary", className)} {...props} />;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function ContextMenuSeparator({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Separator>) {
|
|
69
|
+
return <ContextMenuPrimitive.Separator className={cn("-mx-1.5 my-1.5 bg-hairline h-px", className)} {...props} />;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function ContextMenuSubTrigger({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.SubTrigger>) {
|
|
73
|
+
return (
|
|
74
|
+
<ContextMenuPrimitive.SubTrigger className={cn(menuItemClasses, "data-[state=open]:bg-tint-hover", className)} {...props}>
|
|
75
|
+
{children}
|
|
76
|
+
<ChevronRight className="ml-auto size-3.5" />
|
|
77
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function ContextMenuSubContent({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
|
|
82
|
+
return (
|
|
83
|
+
<ContextMenuPrimitive.Portal>
|
|
84
|
+
<ContextMenuPrimitive.SubContent className={cn(menuSurfaceClasses, className)} {...props} />
|
|
85
|
+
</ContextMenuPrimitive.Portal>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { DropdownMenuShortcut as ContextMenuShortcut } from "./dropdown-menu.tsx";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Check, Copy } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef, useState, type ReactNode } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Button, type ButtonProps } from "./button.tsx";
|
|
7
|
+
|
|
8
|
+
/** Writes text to the clipboard; true if it worked. Falls back to a hidden field where the Clipboard API is missing or refused. */
|
|
9
|
+
export async function copyText(text: string): Promise<boolean> {
|
|
10
|
+
try {
|
|
11
|
+
await navigator.clipboard.writeText(text);
|
|
12
|
+
return true;
|
|
13
|
+
} catch {
|
|
14
|
+
try {
|
|
15
|
+
const area = document.createElement("textarea");
|
|
16
|
+
area.value = text;
|
|
17
|
+
area.setAttribute("readonly", "");
|
|
18
|
+
area.style.position = "fixed";
|
|
19
|
+
area.style.opacity = "0";
|
|
20
|
+
document.body.appendChild(area);
|
|
21
|
+
area.select();
|
|
22
|
+
const ok = document.execCommand("copy");
|
|
23
|
+
area.remove();
|
|
24
|
+
return ok;
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Copies `value`. The icon turns to a tick for a moment and a screen reader hears
|
|
32
|
+
"Copied"; if copying fails it says so instead. Icon-only by default (named
|
|
33
|
+
"Copy …" with `label`); give `children` for words beside the icon. */
|
|
34
|
+
export function CopyButton({
|
|
35
|
+
value,
|
|
36
|
+
label = "Copy",
|
|
37
|
+
children,
|
|
38
|
+
size,
|
|
39
|
+
variant = "ghost",
|
|
40
|
+
className,
|
|
41
|
+
onCopied,
|
|
42
|
+
...props
|
|
43
|
+
}: Omit<ButtonProps, "value" | "onClick" | "children"> & {
|
|
44
|
+
value: string | (() => string);
|
|
45
|
+
label?: string;
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
onCopied?: () => void;
|
|
48
|
+
}) {
|
|
49
|
+
const [state, setState] = useState<"idle" | "copied" | "failed">("idle");
|
|
50
|
+
const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
51
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
52
|
+
const iconOnly = children === undefined;
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<Button
|
|
56
|
+
{...props}
|
|
57
|
+
variant={variant}
|
|
58
|
+
size={size ?? (iconOnly ? "icon-sm" : "sm")}
|
|
59
|
+
aria-label={iconOnly ? label : undefined}
|
|
60
|
+
className={cn(className)}
|
|
61
|
+
onClick={async () => {
|
|
62
|
+
const ok = await copyText(typeof value === "function" ? value() : value);
|
|
63
|
+
setState(ok ? "copied" : "failed");
|
|
64
|
+
if (ok) onCopied?.();
|
|
65
|
+
clearTimeout(timer.current);
|
|
66
|
+
timer.current = setTimeout(() => setState("idle"), 1600);
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
<span className="inline-grid [&>svg]:col-start-1 [&>svg]:row-start-1">
|
|
70
|
+
<Copy className={cn("transition-[opacity,scale] duration-(--duration-fast)", state === "copied" ? "opacity-0 scale-50" : "opacity-100 scale-100")} />
|
|
71
|
+
<Check className={cn("text-success transition-[opacity,scale] duration-(--duration-fast)", state === "copied" ? "opacity-100 scale-100" : "opacity-0 scale-50")} />
|
|
72
|
+
</span>
|
|
73
|
+
{children}
|
|
74
|
+
</Button>
|
|
75
|
+
<span role="status" className="sr-only">
|
|
76
|
+
{state === "copied" ? "Copied" : state === "failed" ? "Couldn't copy" : ""}
|
|
77
|
+
</span>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { DndContext, MouseSensor, pointerWithin, TouchSensor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
|
|
4
|
+
import { ChevronLeft, ChevronRight, Plus } from "lucide-react";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { daysIn, formatMonth, fromISODate, monthOf, shiftMonth, today, toISODate } from "../../../lib/dates.ts";
|
|
7
|
+
import { isEmpty, titleOf, type Property, type Row, type Value, type View } from "../../../lib/database.ts";
|
|
8
|
+
import { cn } from "../../../lib/utils.ts";
|
|
9
|
+
import { Button } from "../button.tsx";
|
|
10
|
+
import { EmptyState } from "../empty-state.tsx";
|
|
11
|
+
|
|
12
|
+
/* The calendar view: a month, each row on the day of the view's date property
|
|
13
|
+
(`dateProperty`). A row is dragged to another day to move it (a short press on
|
|
14
|
+
a touch screen); "+" on a day adds a row there. Under 40rem of room the grid
|
|
15
|
+
becomes the month's days that have something, as a list, since seven columns
|
|
16
|
+
of chips cannot be read on a phone. */
|
|
17
|
+
|
|
18
|
+
const WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
19
|
+
|
|
20
|
+
/** The days a month grid shows: from the Monday on or before the 1st, whole weeks. */
|
|
21
|
+
function gridDays(month: string): string[] {
|
|
22
|
+
const first = fromISODate(`${month}-01`)!;
|
|
23
|
+
const lead = (first.getDay() + 6) % 7;
|
|
24
|
+
const count = Math.ceil((lead + daysIn(month)) / 7) * 7;
|
|
25
|
+
return Array.from({ length: count }, (_, i) => toISODate(new Date(first.getFullYear(), first.getMonth(), 1 - lead + i)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Chip({ row, title, onOpenRow }: { row: Row; title: string; onOpenRow?: (row: Row) => void }) {
|
|
29
|
+
const drag = useDraggable({ id: row.id });
|
|
30
|
+
return (
|
|
31
|
+
<button
|
|
32
|
+
ref={drag.setNodeRef}
|
|
33
|
+
{...drag.listeners}
|
|
34
|
+
type="button"
|
|
35
|
+
onClick={() => onOpenRow?.(row)}
|
|
36
|
+
className={cn(
|
|
37
|
+
"bg-surface shadow-xs hover:shadow-sm px-1.5 py-0.5 rounded-small w-full text-caption text-left truncate touch-manipulation",
|
|
38
|
+
drag.isDragging && "opacity-40",
|
|
39
|
+
)}
|
|
40
|
+
style={drag.transform ? { transform: `translate(${drag.transform.x}px, ${drag.transform.y}px)`, position: "relative", zIndex: 10 } : undefined}
|
|
41
|
+
>
|
|
42
|
+
{title || <span className="text-ink-tertiary">Untitled</span>}
|
|
43
|
+
</button>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function Day({ day, month, rows, titleOf, onOpenRow, onAdd }: { day: string; month: string; rows: Row[]; titleOf: (row: Row) => string; onOpenRow?: (row: Row) => void; onAdd: () => void }) {
|
|
48
|
+
const drop = useDroppable({ id: day });
|
|
49
|
+
const date = fromISODate(day)!;
|
|
50
|
+
const isToday = day === today();
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
ref={drop.setNodeRef}
|
|
54
|
+
role="gridcell"
|
|
55
|
+
aria-label={date.toLocaleDateString(undefined, { weekday: "long", day: "numeric", month: "long" }) + (rows.length ? `, ${rows.length} item${rows.length === 1 ? "" : "s"}` : "")}
|
|
56
|
+
className={cn(
|
|
57
|
+
"group group/day flex flex-col gap-0.5 p-1 border-hairline border-r border-b min-h-24 transition-colors duration-(--duration-fast)",
|
|
58
|
+
monthOf(day) !== month && "bg-surface-sunken/60",
|
|
59
|
+
drop.isOver && "bg-accent-tint",
|
|
60
|
+
)}
|
|
61
|
+
>
|
|
62
|
+
<div className="flex justify-between items-center">
|
|
63
|
+
<button type="button" aria-label={`Add on ${date.toLocaleDateString()}`} onClick={onAdd} className="flex justify-center items-center hover:bg-tint-hover rounded-small size-5 text-ink-tertiary affordance">
|
|
64
|
+
<Plus className="size-3.5" />
|
|
65
|
+
</button>
|
|
66
|
+
<span className={cn("flex justify-center items-center rounded-full size-6 tabular-nums text-caption", isToday ? "bg-accent-solid text-accent-ink font-medium" : monthOf(day) === month ? "text-ink-secondary" : "text-ink-tertiary")}>
|
|
67
|
+
{date.getDate()}
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
{rows.map((row) => (
|
|
71
|
+
<Chip key={row.id} row={row} title={titleOf(row)} onOpenRow={onOpenRow} />
|
|
72
|
+
))}
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function CalendarView({ properties, rows, view, onSetValue, onAddRow, onOpenRow }: {
|
|
78
|
+
properties: readonly Property[];
|
|
79
|
+
rows: readonly Row[];
|
|
80
|
+
view: View;
|
|
81
|
+
onSetValue: (row: Row, property: Property, value: Value) => void;
|
|
82
|
+
onAddRow: (values?: Record<string, Value>) => void;
|
|
83
|
+
onOpenRow?: (row: Row) => void;
|
|
84
|
+
}) {
|
|
85
|
+
const dateBy = properties.find((p) => p.id === view.dateProperty && p.type === "date");
|
|
86
|
+
const [month, setMonth] = useState(() => monthOf(today()));
|
|
87
|
+
const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 4 } }), useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }));
|
|
88
|
+
if (!dateBy) return <EmptyState compact title="Choose what the calendar dates by" description="A calendar needs a date property to place rows on days. Choose one in the view's options." />;
|
|
89
|
+
|
|
90
|
+
const title = titleOf(properties);
|
|
91
|
+
const nameOf = (row: Row) => (title && !isEmpty(row.values[title.id] ?? null) ? String(row.values[title.id]) : "");
|
|
92
|
+
const onDay = new Map<string, Row[]>();
|
|
93
|
+
for (const row of rows) {
|
|
94
|
+
const v = row.values[dateBy.id];
|
|
95
|
+
if (typeof v !== "string" || v === "") continue;
|
|
96
|
+
const day = v.slice(0, 10);
|
|
97
|
+
onDay.set(day, [...(onDay.get(day) ?? []), row]);
|
|
98
|
+
}
|
|
99
|
+
const days = gridDays(month);
|
|
100
|
+
const inMonth = days.filter((d) => monthOf(d) === month && onDay.has(d));
|
|
101
|
+
const undated = rows.filter((r) => isEmpty(r.values[dateBy.id] ?? null)).length;
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div className="@container">
|
|
105
|
+
<div className="flex items-center gap-1 mb-2">
|
|
106
|
+
<h3 className="mr-auto font-semibold text-h3" aria-live="polite">
|
|
107
|
+
{formatMonth(month)}
|
|
108
|
+
</h3>
|
|
109
|
+
<Button variant="ghost" size="icon-sm" aria-label="Previous month" onClick={() => setMonth(shiftMonth(month, -1))}>
|
|
110
|
+
<ChevronLeft />
|
|
111
|
+
</Button>
|
|
112
|
+
<Button variant="ghost" size="sm" onClick={() => setMonth(monthOf(today()))}>
|
|
113
|
+
Today
|
|
114
|
+
</Button>
|
|
115
|
+
<Button variant="ghost" size="icon-sm" aria-label="Next month" onClick={() => setMonth(shiftMonth(month, 1))}>
|
|
116
|
+
<ChevronRight />
|
|
117
|
+
</Button>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<DndContext
|
|
121
|
+
sensors={sensors}
|
|
122
|
+
collisionDetection={pointerWithin}
|
|
123
|
+
onDragEnd={(e) => {
|
|
124
|
+
const row = rows.find((r) => r.id === e.active.id);
|
|
125
|
+
if (!row || !e.over) return;
|
|
126
|
+
const day = String(e.over.id);
|
|
127
|
+
const before = row.values[dateBy.id];
|
|
128
|
+
// A time the date had stays with it.
|
|
129
|
+
const time = typeof before === "string" && before.length > 10 ? before.slice(10) : "";
|
|
130
|
+
if (typeof before !== "string" || before.slice(0, 10) !== day) onSetValue(row, dateBy, day + time);
|
|
131
|
+
}}
|
|
132
|
+
accessibility={{ screenReaderInstructions: { draggable: "Open the item to change its date." } }}
|
|
133
|
+
>
|
|
134
|
+
<div role="grid" aria-label={formatMonth(month)} className="@max-xl:hidden border-hairline border-t border-l rounded-surface overflow-hidden">
|
|
135
|
+
<div role="row" className="grid grid-cols-7">
|
|
136
|
+
{WEEKDAYS.map((d) => (
|
|
137
|
+
<div key={d} role="columnheader" className="px-2 py-1 border-hairline border-r border-b text-caption text-ink-tertiary">
|
|
138
|
+
{d}
|
|
139
|
+
</div>
|
|
140
|
+
))}
|
|
141
|
+
</div>
|
|
142
|
+
{Array.from({ length: days.length / 7 }, (_, w) => (
|
|
143
|
+
<div key={w} role="row" className="grid grid-cols-7">
|
|
144
|
+
{days.slice(w * 7, w * 7 + 7).map((day) => (
|
|
145
|
+
<Day key={day} day={day} month={month} rows={onDay.get(day) ?? []} titleOf={nameOf} onOpenRow={onOpenRow} onAdd={() => onAddRow({ [dateBy.id]: day })} />
|
|
146
|
+
))}
|
|
147
|
+
</div>
|
|
148
|
+
))}
|
|
149
|
+
</div>
|
|
150
|
+
</DndContext>
|
|
151
|
+
|
|
152
|
+
{/* Narrow: the month's days that have something. */}
|
|
153
|
+
<div className="@xl:hidden">
|
|
154
|
+
{inMonth.length === 0 ? (
|
|
155
|
+
<EmptyState compact title={`Nothing in ${formatMonth(month)}`} />
|
|
156
|
+
) : (
|
|
157
|
+
<ol className="flex flex-col">
|
|
158
|
+
{inMonth.map((day) => (
|
|
159
|
+
<li key={day} className="py-2 border-hairline border-b">
|
|
160
|
+
<p className="mb-1 font-medium text-caption text-ink-secondary">{fromISODate(day)!.toLocaleDateString(undefined, { weekday: "long", day: "numeric", month: "long" })}</p>
|
|
161
|
+
<div className="flex flex-col gap-1">
|
|
162
|
+
{onDay.get(day)!.map((row) => (
|
|
163
|
+
<button key={row.id} type="button" onClick={() => onOpenRow?.(row)} className="hover:bg-tint-hover px-2 py-1.5 rounded-control text-sm text-left">
|
|
164
|
+
{nameOf(row) || <span className="text-ink-tertiary">Untitled</span>}
|
|
165
|
+
</button>
|
|
166
|
+
))}
|
|
167
|
+
</div>
|
|
168
|
+
</li>
|
|
169
|
+
))}
|
|
170
|
+
</ol>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
{undated > 0 && (
|
|
174
|
+
<p className="mt-2 text-caption text-ink-tertiary">
|
|
175
|
+
{undated} with no {dateBy.name}, not shown.
|
|
176
|
+
</p>
|
|
177
|
+
)}
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|