@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,40 @@
|
|
|
1
|
+
import { type FieldButtonProps } from "./field-button.js";
|
|
2
|
+
type Shared = Omit<FieldButtonProps, "value" | "onChange" | "children" | "onClear" | "icon"> & {
|
|
3
|
+
/** Earliest and latest day that can be chosen, `YYYY-MM-DD`. */
|
|
4
|
+
min?: string | null;
|
|
5
|
+
max?: string | null;
|
|
6
|
+
/** Show the cross that empties it. On by default; turn off for a required date. */
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export interface DatePickerProps extends Shared {
|
|
10
|
+
/** `YYYY-MM-DD`, or null for none. */
|
|
11
|
+
value: string | null;
|
|
12
|
+
onChange: (value: string | null) => void;
|
|
13
|
+
/** The month shown when nothing is chosen yet, as any day in it. Today's, if not given. */
|
|
14
|
+
openTo?: string | null;
|
|
15
|
+
/** Sends the value with a form, as a hidden field of this name. */
|
|
16
|
+
name?: string;
|
|
17
|
+
/** Quick choices beside the calendar: [{ label: "Today", value: today() }, …]. */
|
|
18
|
+
shortcuts?: readonly {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export declare function DatePicker({ value, onChange, min, max, openTo, clearable, placeholder, name, shortcuts, ...props }: DatePickerProps): import("react").JSX.Element;
|
|
24
|
+
export type DateRange = {
|
|
25
|
+
from: string | null;
|
|
26
|
+
to: string | null;
|
|
27
|
+
};
|
|
28
|
+
export interface DateRangePickerProps extends Shared {
|
|
29
|
+
/** Both `YYYY-MM-DD`. A range may be half chosen: a start with no end. */
|
|
30
|
+
value: DateRange;
|
|
31
|
+
onChange: (value: DateRange) => void;
|
|
32
|
+
/** Sends the two ends with a form, as hidden fields of these names. */
|
|
33
|
+
names?: {
|
|
34
|
+
from: string;
|
|
35
|
+
to: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare function DateRangePicker({ value, onChange, min, max, clearable, placeholder, names, ...props }: DateRangePickerProps): import("react").JSX.Element;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKxE,KAAK,MAAM,GAAG,IAAI,CAAC,gBAAgB,E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AAgB,eAAe,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACH,SAAgB,EAChB,WAA0B,EAC1B,KAAK,EACL,GAAG,KAAK,EACX,EAAE,oBAAoB,+BA8DtB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarDays } from "lucide-react";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Calendar, focusCalendarDay } from "./calendar.js";
|
|
6
|
+
import { FieldButton } from "./field-button.js";
|
|
7
|
+
import { PickerPanel } from "./picker-panel.js";
|
|
8
|
+
import { formatDay, formatShortDay, fromISODate, toISODate } from "../../lib/dates.js";
|
|
9
|
+
import { cn } from "../../lib/utils.js";
|
|
10
|
+
/** What react-day-picker needs to grey out days outside `min` and `max`. */
|
|
11
|
+
function bounds(min, max) {
|
|
12
|
+
const from = fromISODate(min);
|
|
13
|
+
const to = fromISODate(max);
|
|
14
|
+
return {
|
|
15
|
+
disabled: [...(from === undefined ? [] : [{ before: from }]), ...(to === undefined ? [] : [{ after: to }])],
|
|
16
|
+
startMonth: from,
|
|
17
|
+
endMonth: to,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/* One day. The value is a string, `YYYY-MM-DD`: a calendar day, not an instant, so
|
|
21
|
+
it means the same day in every time zone. Choosing a day closes the calendar. */
|
|
22
|
+
export function DatePicker({ value, onChange, min, max, openTo, clearable = true, placeholder = "Pick a date", name, shortcuts, ...props }) {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const selected = fromISODate(value);
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx(PickerPanel, { open: open, onOpenChange: setOpen, title: props["aria-label"] ?? "Pick a date", onOpenAutoFocus: focusCalendarDay, trigger: _jsx(FieldButton, { icon: CalendarDays, placeholder: placeholder, onClear: clearable ? () => onChange(null) : undefined, clearLabel: "Clear the date", ...props, children: selected === undefined ? null : formatDay(selected) }), children: _jsxs("div", { className: "flex max-sm:flex-col", children: [shortcuts !== undefined && shortcuts.length > 0 && (_jsx("div", { className: "flex sm:flex-col gap-1 sm:shadow-edge-r max-sm:shadow-edge-b p-2 max-sm:overflow-x-auto", children: shortcuts.map((s) => {
|
|
26
|
+
const day = fromISODate(s.value);
|
|
27
|
+
const outside = (min && s.value < min) || (max && s.value > max) || day === undefined;
|
|
28
|
+
return (_jsx("button", { type: "button", disabled: !!outside, onClick: () => {
|
|
29
|
+
onChange(s.value);
|
|
30
|
+
setOpen(false);
|
|
31
|
+
}, className: cn("flex items-center px-2.5 rounded-control h-control-sm [@media(pointer:coarse)]:h-10 text-sm text-left whitespace-nowrap", "hover:bg-tint-hover disabled:text-ink-disabled disabled:pointer-events-none", s.value === value && "bg-tint-active font-medium"), children: s.label }, s.label));
|
|
32
|
+
}) })), _jsx(Calendar, { mode: "single",
|
|
33
|
+
// Required, so pressing the chosen day again keeps it. The cross is how it is emptied.
|
|
34
|
+
required: true, selected: selected, onSelect: (day) => {
|
|
35
|
+
onChange(toISODate(day));
|
|
36
|
+
setOpen(false);
|
|
37
|
+
}, defaultMonth: selected ?? fromISODate(openTo) ?? fromISODate(min), ...bounds(min, max) })] }) }), name !== undefined && _jsx("input", { type: "hidden", name: name, value: selected === undefined ? "" : (value ?? "") })] }));
|
|
38
|
+
}
|
|
39
|
+
/* A first and a last day, in one field. The first press sets the start and the
|
|
40
|
+
second the end, whichever order they come in; pressing again starts over. The
|
|
41
|
+
calendar closes once both are set. */
|
|
42
|
+
export function DateRangePicker({ value, onChange, min, max, clearable = true, placeholder = "Pick dates", names, ...props }) {
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
const from = fromISODate(value.from);
|
|
45
|
+
const to = from === undefined ? undefined : fromISODate(value.to);
|
|
46
|
+
const press = (day) => {
|
|
47
|
+
const pressed = toISODate(day);
|
|
48
|
+
// Nothing yet, or a finished range: this is a new start.
|
|
49
|
+
if (from === undefined || to !== undefined)
|
|
50
|
+
return onChange({ from: pressed, to: null });
|
|
51
|
+
onChange(day < from ? { from: pressed, to: toISODate(from) } : { from: toISODate(from), to: pressed });
|
|
52
|
+
setOpen(false);
|
|
53
|
+
};
|
|
54
|
+
const label = from === undefined
|
|
55
|
+
? null
|
|
56
|
+
: to === undefined
|
|
57
|
+
? `${formatShortDay(from)} –`
|
|
58
|
+
: `${formatShortDay(from)} – ${formatShortDay(to)}`;
|
|
59
|
+
return (_jsxs(_Fragment, { children: [_jsx(PickerPanel, { open: open, onOpenChange: setOpen, title: props["aria-label"] ?? "Pick dates", onOpenAutoFocus: focusCalendarDay, trigger: _jsx(FieldButton, { icon: CalendarDays, placeholder: placeholder, onClear: clearable ? () => onChange({ from: null, to: null }) : undefined, clearLabel: "Clear the dates", ...props, children: label }), children: _jsxs("div", { children: [_jsx(Calendar, { mode: "range", selected: { from, to },
|
|
60
|
+
// The library's own idea of what a press does to a range is ignored;
|
|
61
|
+
// only the day pressed is taken from it.
|
|
62
|
+
onSelect: (_range, pressed) => press(pressed), defaultMonth: from ?? fromISODate(min), ...bounds(min, max) }), _jsx("p", { "aria-live": "polite", className: "px-3 py-2 border-hairline border-t text-caption text-ink-tertiary", children: from !== undefined && to === undefined ? "Now the last day." : "Pick the first day, then the last." })] }) }), names !== undefined && (_jsxs(_Fragment, { children: [_jsx("input", { type: "hidden", name: names.from, value: from === undefined ? "" : toISODate(from) }), _jsx("input", { type: "hidden", name: names.to, value: to === undefined ? "" : toISODate(to) })] }))] }));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE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rE,yCAAyC;4BACzC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAC7C,YAAY,EAAE,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,KAClC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GACtB,EACF,yBAAa,QAAQ,EAAC,SAAS,EAAC,mEAAmE,YAC9F,IAAI,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,oCAAoC,GACpG,IACF,GACI,EACb,KAAK,KAAK,SAAS,IAAI,CACpB,8BACI,gBAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAI,EAC3F,gBAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,GAAI,IACtF,CACN,IACF,CACN,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HourCycle } from "../../lib/time.js";
|
|
2
|
+
import { type FieldButtonProps } from "./field-button.js";
|
|
3
|
+
export interface DateTimePickerProps extends Omit<FieldButtonProps, "value" | "onChange" | "children" | "onClear" | "icon"> {
|
|
4
|
+
/** `YYYY-MM-DDTHH:MM`, local, or null for none. What a `datetime-local` input holds. */
|
|
5
|
+
value: string | null;
|
|
6
|
+
onChange: (value: string | null) => void;
|
|
7
|
+
/** Earliest and latest day that can be chosen, `YYYY-MM-DD`. */
|
|
8
|
+
min?: string | null;
|
|
9
|
+
max?: string | null;
|
|
10
|
+
/** The month shown when nothing is chosen yet, as any day in it. */
|
|
11
|
+
openTo?: string | null;
|
|
12
|
+
/** The time a day gets when it is chosen before any time is. */
|
|
13
|
+
defaultTime?: string;
|
|
14
|
+
minuteStep?: number;
|
|
15
|
+
hourCycle?: HourCycle;
|
|
16
|
+
clearable?: boolean;
|
|
17
|
+
/** Sends the value with a form, as a hidden field of this name. */
|
|
18
|
+
name?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function DateTimePicker({ value, onChange, min, max, openTo, defaultTime, minuteStep, hourCycle, clearable, placeholder, name, ...props }: DateTimePickerProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=date-time-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-time-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIxE,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACvH,wFAAwF;IACxF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACH,MAAM,EACN,WAAqB,EACrB,UAAe,EACf,SAAS,EACT,SAAgB,EAChB,WAAoC,EACpC,IAAI,EACJ,GAAG,KAAK,EACX,EAAE,mBAAmB,+BA4ErB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarClock } from "lucide-react";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { formatDay, fromISODate, isTime, splitDateTime, toISODate } from "../../lib/dates.js";
|
|
6
|
+
import { formatTime, localHourCycle } from "../../lib/time.js";
|
|
7
|
+
import { Button } from "./button.js";
|
|
8
|
+
import { Calendar, focusCalendarDay } from "./calendar.js";
|
|
9
|
+
import { FieldButton } from "./field-button.js";
|
|
10
|
+
import { PickerPanel } from "./picker-panel.js";
|
|
11
|
+
import { TimeList } from "./time-list.js";
|
|
12
|
+
/* A day and a time of day, in one field: the calendar with the day's times beside
|
|
13
|
+
it (under it, in a sheet, on a phone). There is no value until there is a day. A
|
|
14
|
+
time chosen first is held and joins the day when one is picked. */
|
|
15
|
+
export function DateTimePicker({ value, onChange, min, max, openTo, defaultTime = "12:00", minuteStep = 15, hourCycle, clearable = true, placeholder = "Pick a date and time", name, ...props }) {
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
/** A time chosen while there is still no day to attach it to. */
|
|
18
|
+
const [heldTime, setHeldTime] = useState(null);
|
|
19
|
+
const cycle = hourCycle ?? localHourCycle();
|
|
20
|
+
const { date, time } = splitDateTime(value);
|
|
21
|
+
const selected = fromISODate(date);
|
|
22
|
+
// Shown even before there is a day: it is the time the day will get.
|
|
23
|
+
const shownTime = date === null ? (heldTime ?? defaultTime) : (time ?? defaultTime);
|
|
24
|
+
const from = fromISODate(min);
|
|
25
|
+
const to = fromISODate(max);
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx(PickerPanel, { open: open, onOpenChange: (next) => {
|
|
27
|
+
setOpen(next);
|
|
28
|
+
if (!next)
|
|
29
|
+
setHeldTime(null);
|
|
30
|
+
}, title: props["aria-label"] ?? "Pick a date and time", onOpenAutoFocus: focusCalendarDay, trigger: _jsx(FieldButton, { icon: CalendarClock, placeholder: placeholder, onClear: clearable ? () => onChange(null) : undefined, clearLabel: "Clear the date and time", ...props, children: selected === undefined ? null : (_jsxs(_Fragment, { children: [formatDay(selected), _jsx("span", { className: "ml-2 text-ink-secondary tabular-nums", children: formatTime(time ?? defaultTime, cycle) })] })) }), children: _jsxs("div", { className: "max-sm:w-full", children: [_jsxs("div", { className: "flex max-sm:flex-col sm:divide-x sm:divide-hairline", children: [_jsx(Calendar, { mode: "single", required: true, selected: selected, onSelect: (day) => onChange(`${toISODate(day)}T${shownTime}`), defaultMonth: selected ?? fromISODate(openTo) ?? from, disabled: [...(from === undefined ? [] : [{ before: from }]), ...(to === undefined ? [] : [{ after: to }])], startMonth: from, endMonth: to, className: "max-sm:mx-auto" }), _jsx(TimeList, { label: "Time", value: isTime(shownTime) ? shownTime : null, onChange: (next) => (date === null ? setHeldTime(next) : onChange(`${date}T${next}`)), step: minuteStep, hourCycle: cycle,
|
|
31
|
+
// Beside the calendar, as tall as it; under it, on a phone, short.
|
|
32
|
+
className: "sm:h-auto sm:max-h-[18.5rem] sm:w-36 max-sm:h-40 max-sm:border-hairline max-sm:border-t" })] }), _jsxs("div", { className: "flex justify-between items-center gap-3 p-1.5 pl-3 border-hairline border-t", children: [_jsx("p", { "aria-live": "polite", className: "text-caption text-ink-tertiary", children: date === null ? "Pick a day to set it." : " " }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setOpen(false), children: "Done" })] })] }) }), name !== undefined && _jsx("input", { type: "hidden", name: name, value: date === null ? "" : `${date}T${time ?? defaultTime}` })] }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=date-time-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time-picker.js","sourceRoot":"","sources":["../../../src/components/ui/date-time-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAgB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAoB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAiB,CAAC;AAoB3C;;qEAEqE;AACrE,MAAM,UAAU,cAAc,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACH,MAAM,EACN,WAAW,GAAG,OAAO,EACrB,UAAU,GAAG,EAAE,EACf,SAAS,EACT,SAAS,GAAG,IAAI,EAChB,WAAW,GAAG,sBAAsB,EACpC,IAAI,EACJ,GAAG,KAAK,EACU;IAClB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,iEAAiE;IACjE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,SAAS,IAAI,cAAc,EAAE,CAAC;IAE5C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE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AE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAEtD,IACP,IACJ,GACI,EACb,IAAI,KAAK,SAAS,IAAI,gBAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,WAAW,EAAE,GAAI,IACzH,CACN,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export declare const Dialog: import("react").FC<DialogPrimitive.DialogProps>;
|
|
4
|
+
export declare const DialogTrigger: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const DialogClose: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export declare const DialogPortal: import("react").FC<DialogPrimitive.DialogPortalProps>;
|
|
7
|
+
export declare const overlayClasses = "z-(--z-overlay) fixed inset-0 bg-scrim data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out";
|
|
8
|
+
export declare const dialogPanelClasses: string[];
|
|
9
|
+
export declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>): import("react").JSX.Element;
|
|
10
|
+
export interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {
|
|
11
|
+
showClose?: boolean;
|
|
12
|
+
/** sm 24rem (a question), md 32rem (a form; the default), lg 42rem (more to read or compare). */
|
|
13
|
+
size?: "sm" | "md" | "lg";
|
|
14
|
+
}
|
|
15
|
+
export declare function DialogContent({ className, children, showClose, size, onOpenAutoFocus, ...props }: DialogContentProps): import("react").JSX.Element;
|
|
16
|
+
export declare function DialogHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
17
|
+
export declare function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>): import("react").JSX.Element;
|
|
18
|
+
export declare function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>): import("react").JSX.Element;
|
|
19
|
+
export declare function DialogBody({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
20
|
+
export declare function DialogFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,eAAO,MAAM,MAAM,iDAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,kIAA0B,CAAC;AACrD,eAAO,MAAM,WAAW,gIAAwB,CAAC;AACjD,eAAO,MAAM,YAAY,uDAAyB,CAAC;AAInD,eAAO,MAAM,cAAc,kHAAkH,CAAC;AAI9I,eAAO,MAAM,kBAAkB,UAQ9B,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,+BAOhD;AAED,MAAM,WAAW,kBACb,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iGAAiG;IACjG,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC7B;AAcD,wBAAgB,aAAa,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,SAAgB,EAChB,IAAW,EACX,eAAe,EACf,GAAG,KAAK,EACX,EAAE,kBAAkB,+BA8BpB;AAED,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,KAAK,CAAC,+BAEvB;AAED,wBAAgB,WAAW,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,+BAO9C;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,+BAOpD;AAED,wBAAgB,UAAU,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,KAAK,CAAC,+BAEvB;AAED,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,KAAK,CAAC,+BAUvB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { X } from "lucide-react";
|
|
5
|
+
import { finePointer } from "../../lib/pointer.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
export const Dialog = DialogPrimitive.Root;
|
|
8
|
+
export const DialogTrigger = DialogPrimitive.Trigger;
|
|
9
|
+
export const DialogClose = DialogPrimitive.Close;
|
|
10
|
+
export const DialogPortal = DialogPrimitive.Portal;
|
|
11
|
+
/* The scrim is light — 32%, not 60%. The page behind stays legible, so
|
|
12
|
+
a dialog reads as a layer rather than a mode switch. */
|
|
13
|
+
export const overlayClasses = "z-(--z-overlay) fixed inset-0 bg-scrim data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out";
|
|
14
|
+
/* A dialog's panel, centred, or on a phone a sheet from the bottom edge (below).
|
|
15
|
+
Shared with AlertDialog, so the two never drift apart. */
|
|
16
|
+
export const dialogPanelClasses = [
|
|
17
|
+
"z-(--z-overlay) fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
18
|
+
"w-[calc(100vw-2rem)] max-h-[85dvh] overflow-y-auto overscroll-contain outline-none",
|
|
19
|
+
"bg-surface-overlay shadow-dialog rounded-overlay",
|
|
20
|
+
"data-[state=open]:animate-scale-in data-[state=closed]:animate-scale-out",
|
|
21
|
+
"max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:translate-x-0 max-sm:translate-y-0",
|
|
22
|
+
"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)]",
|
|
23
|
+
"max-sm:data-[state=open]:animate-sheet-in max-sm:data-[state=closed]:animate-sheet-out",
|
|
24
|
+
];
|
|
25
|
+
export function DialogOverlay({ className, ...props }) {
|
|
26
|
+
return (_jsx(DialogPrimitive.Overlay, { className: cn(overlayClasses, className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
const DIALOG_WIDTH = { sm: "max-w-sm", md: "max-w-lg", lg: "max-w-2xl" };
|
|
29
|
+
/* On a phone a dialog is a sheet that rises from the bottom edge, full width. Centred
|
|
30
|
+
in the window it jumped when the keyboard opened, because the window's height
|
|
31
|
+
changed under it; anchored to the bottom it has nowhere to jump to. Its height is
|
|
32
|
+
measured in dvh, which follows the browser's bars as they come and go, and its
|
|
33
|
+
scrolling is kept from carrying on into the page behind (overscroll-contain).
|
|
34
|
+
|
|
35
|
+
Opening a dialog does not put the cursor in its first field on a touch screen:
|
|
36
|
+
that would bring the keyboard up over a form nobody has looked at yet.
|
|
37
|
+
|
|
38
|
+
From endgame and triptrack, 2026-12-02. */
|
|
39
|
+
export function DialogContent({ className, children, showClose = true, size = "md", onOpenAutoFocus, ...props }) {
|
|
40
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { onOpenAutoFocus: (event) => {
|
|
41
|
+
onOpenAutoFocus?.(event);
|
|
42
|
+
if (event.defaultPrevented || finePointer())
|
|
43
|
+
return;
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
46
|
+
}, className: cn(dialogPanelClasses, DIALOG_WIDTH[size], className), ...props, children: [children, showClose && (_jsx(DialogPrimitive.Close, { className: cn("top-3 right-3 absolute inline-flex justify-center items-center", "rounded-control size-7 text-ink-tertiary hover:text-ink", "hover:bg-tint-hover transition-colors duration-(--duration-fast)"), "aria-label": "Close", children: _jsx(X, { className: "size-4" }) }))] })] }));
|
|
47
|
+
}
|
|
48
|
+
export function DialogHeader({ className, ...props }) {
|
|
49
|
+
return _jsx("div", { className: cn("px-5 pt-5 pb-0 pr-12", className), ...props });
|
|
50
|
+
}
|
|
51
|
+
export function DialogTitle({ className, ...props }) {
|
|
52
|
+
return (_jsx(DialogPrimitive.Title, { className: cn("font-semibold text-ink text-h3", className), ...props }));
|
|
53
|
+
}
|
|
54
|
+
export function DialogDescription({ className, ...props }) {
|
|
55
|
+
return (_jsx(DialogPrimitive.Description, { className: cn("mt-1.5 text-ink-secondary text-sm", className), ...props }));
|
|
56
|
+
}
|
|
57
|
+
export function DialogBody({ className, ...props }) {
|
|
58
|
+
return _jsx("div", { className: cn("px-5 py-4", className), ...props });
|
|
59
|
+
}
|
|
60
|
+
export function DialogFooter({ className, ...props }) {
|
|
61
|
+
return (_jsx("div", { className: cn("flex justify-end items-center gap-2 px-5 py-3.5 border-hairline border-t", className), ...props }));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAA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AAS,EACT,GAAG,KAAK,EACY;IACpB,OAAO,CACH,cACI,SAAS,EAAE,EAAE,CACT,0EAA0E,EAC1E,SAAS,CACZ,KACG,KAAK,GACX,CACL,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export declare function DocumentLayout({ cover, icon, title, meta, children, className, }: {
|
|
3
|
+
/** A picture across the top, full width (an Image with fit cover, usually). */
|
|
4
|
+
cover?: ReactNode;
|
|
5
|
+
/** An emoji or an icon, large, above the title. */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** Under the title: properties, a byline, a date. */
|
|
9
|
+
meta?: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/** In a DocumentLayout's body, something wider than the reading column (a table, a picture): it spans the page's reading width. */
|
|
14
|
+
export declare function Breakout({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=document-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-layout.d.ts","sourceRoot":"","sources":["../../../src/components/ui/document-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvD,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAqBA;AAED,mIAAmI;AACnI,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAEtE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
/* A page that is mostly to be read: Notion's page. An optional cover across the
|
|
4
|
+
top, an icon that sits half over it, the title, a line of properties, then the
|
|
5
|
+
body in one reading column (44rem). A wide thing in the body (a table, a
|
|
6
|
+
picture) may break out of the column to the page's reading width with
|
|
7
|
+
`<Breakout>`. Margins step with the room, as Page's do. */
|
|
8
|
+
export function DocumentLayout({ cover, icon, title, meta, children, className, }) {
|
|
9
|
+
return (_jsxs("article", { className: cn("pb-24", className), children: [cover !== undefined && _jsx("div", { className: "w-full h-[min(30vh,16rem)] overflow-hidden [&>*]:w-full [&>*]:h-full", children: cover }), _jsx("div", { className: "mx-auto px-5 @xl:px-8 @4xl:px-12 w-full max-w-reading", children: _jsxs("div", { className: "grid grid-cols-[1fr_min(var(--container-measure),100%)_1fr] [&>*]:col-start-2", children: [_jsxs("header", { className: cn(cover !== undefined ? (icon !== undefined ? "-mt-9" : "pt-8") : "pt-12 @xl:pt-16"), children: [icon !== undefined && (_jsx("div", { "aria-hidden": true, className: "mb-3 text-display [&_svg]:size-14 leading-none", children: icon })), _jsx("h1", { className: "text-title text-ink text-balance", children: title }), meta !== undefined && _jsx("div", { className: "mt-3 text-ink-secondary text-sm", children: meta })] }), _jsx("div", { className: "contents [&>*]:col-start-2 [&>*]:mt-4", children: children })] }) })] }));
|
|
10
|
+
}
|
|
11
|
+
/** In a DocumentLayout's body, something wider than the reading column (a table, a picture): it spans the page's reading width. */
|
|
12
|
+
export function Breakout({ className, ...props }) {
|
|
13
|
+
return _jsx("div", { className: cn("col-span-full! col-start-1! min-w-0", className), ...props });
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=document-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-layout.js","sourceRoot":"","sources":["../../../src/components/ui/document-layout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;;;;6DAI6D;AAC7D,MAAM,UAAU,cAAc,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,GAWZ;IACG,OAAO,CACH,mBAAS,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,aACrC,KAAK,KAAK,SAAS,IAAI,cAAK,SAAS,EAAC,sEAAsE,YAAE,KAAK,GAAO,EAC3H,cAAK,SAAS,EAAC,uDAAuD,YAElE,eAAK,SAAS,EAAC,+EAA+E,aAC1F,kBAAQ,SAAS,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,aACnG,IAAI,KAAK,SAAS,IAAI,CACnB,mCAAiB,SAAS,EAAC,gDAAgD,YACtE,IAAI,GACH,CACT,EACD,aAAI,SAAS,EAAC,kCAAkC,YAAE,KAAK,GAAM,EAC5D,IAAI,KAAK,SAAS,IAAI,cAAK,SAAS,EAAC,iCAAiC,YAAE,IAAI,GAAO,IAC/E,EACT,cAAK,SAAS,EAAC,uCAAuC,YAAE,QAAQ,GAAO,IACrE,GACJ,IACA,CACb,CAAC;AACN,CAAC;AAED,mIAAmI;AACnI,MAAM,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IACnE,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,qCAAqC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export declare const DropdownMenu: import("react").FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
4
|
+
export declare const DropdownMenuTrigger: import("react").ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const DropdownMenuGroup: import("react").ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const DropdownMenuSub: import("react").FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
7
|
+
export declare const DropdownMenuRadioGroup: import("react").ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const menuSurfaceClasses: string[];
|
|
9
|
+
export declare const menuItemClasses: string[];
|
|
10
|
+
export declare function DropdownMenuContent({ className, sideOffset, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react").JSX.Element;
|
|
11
|
+
export interface DropdownMenuItemProps extends ComponentProps<typeof DropdownMenuPrimitive.Item> {
|
|
12
|
+
danger?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function DropdownMenuItem({ className, danger, ...props }: DropdownMenuItemProps): import("react").JSX.Element;
|
|
15
|
+
export declare function DropdownMenuCheckboxItem({ className, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react").JSX.Element;
|
|
16
|
+
export declare function DropdownMenuRadioItem({ className, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): import("react").JSX.Element;
|
|
17
|
+
export declare function DropdownMenuLabel({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Label>): import("react").JSX.Element;
|
|
18
|
+
export declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react").JSX.Element;
|
|
19
|
+
export declare function DropdownMenuShortcut({ className, keys, children, ...props }: ComponentProps<"span"> & {
|
|
20
|
+
keys?: string;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
export declare function DropdownMenuSubTrigger({ className, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger>): import("react").JSX.Element;
|
|
23
|
+
export declare function DropdownMenuSubContent({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAS5C,eAAO,MAAM,YAAY,6DAA6B,CAAC;AACvD,eAAO,MAAM,mBAAmB,8IAAgC,CAAC;AACjE,eAAO,MAAM,iBAAiB,yIAA8B,CAAC;AAC7D,eAAO,MAAM,eAAe,gEAA4B,CAAC;AACzD,eAAO,MAAM,sBAAsB,8IAAmC,CAAC;AAIvE,eAAO,MAAM,kBAAkB,UAM9B,CAAC;AAEF,eAAO,MAAM,eAAe,UAO3B,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAChC,SAAS,EACT,UAAc,EACd,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,OAAO,CAAC,+BAUtD;AAED,MAAM,WAAW,qBACb,SAAQ,cAAc,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,GAAG,KAAK,EACX,EAAE,qBAAqB,+BAYvB;AAED,wBAAgB,wBAAwB,CAAC,EACrC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,YAAY,CAAC,+BAc3D;AAED,wBAAgB,qBAAqB,CAAC,EAClC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,SAAS,CAAC,+BAcxD;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,KAAK,CAAC,+BAUpD;AAED,wBAAgB,qBAAqB,CAAC,EAClC,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,SAAS,CAAC,+BAOxD;AAKD,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,+BAOvH;AAED,wBAAgB,sBAAsB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,+BAUzD;AAED,wBAAgB,sBAAsB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACX,EAAE,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,+BASzD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import { Check, ChevronRight } from "lucide-react";
|
|
5
|
+
import { formatShortcut } from "../../lib/keys.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { usePlatform } from "./typography.js";
|
|
8
|
+
/* The archetypal Notion surface: 6px padding, 4px-radius rows, 28px
|
|
9
|
+
tall, hover = tint. The shadow's 1px ambient ring is what keeps this
|
|
10
|
+
crisp when it opens over a white page. */
|
|
11
|
+
export const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
12
|
+
export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
13
|
+
export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
14
|
+
export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
15
|
+
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
16
|
+
/* Shared with ContextMenu, so the two menus are one look. A menu taller than the
|
|
17
|
+
room there is scrolls inside itself rather than running off the screen. */
|
|
18
|
+
export const menuSurfaceClasses = [
|
|
19
|
+
"z-(--z-overlay) min-w-[11rem] overflow-x-hidden overflow-y-auto overscroll-contain p-1.5",
|
|
20
|
+
"max-h-[var(--radix-dropdown-menu-content-available-height,var(--radix-context-menu-content-available-height,80vh))]",
|
|
21
|
+
"bg-surface-overlay shadow-popover rounded-overlay",
|
|
22
|
+
"data-[state=open]:animate-slide-in data-[state=closed]:animate-fade-out",
|
|
23
|
+
"origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
24
|
+
];
|
|
25
|
+
export const menuItemClasses = [
|
|
26
|
+
"relative flex items-center gap-2 cursor-default select-none",
|
|
27
|
+
"h-control-sm px-2 rounded-control text-sm text-ink outline-none",
|
|
28
|
+
"transition-colors duration-(--duration-instant)",
|
|
29
|
+
"data-[highlighted]:bg-tint-hover",
|
|
30
|
+
"data-[disabled]:pointer-events-none data-[disabled]:text-ink-disabled",
|
|
31
|
+
"[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-ink-tertiary",
|
|
32
|
+
];
|
|
33
|
+
export function DropdownMenuContent({ className, sideOffset = 6, ...props }) {
|
|
34
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { sideOffset: sideOffset, className: cn(menuSurfaceClasses, className), ...props }) }));
|
|
35
|
+
}
|
|
36
|
+
export function DropdownMenuItem({ className, danger, ...props }) {
|
|
37
|
+
return (_jsx(DropdownMenuPrimitive.Item, { className: cn(menuItemClasses, danger &&
|
|
38
|
+
"text-danger data-[highlighted]:bg-danger-tint [&_svg]:text-danger", className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
export function DropdownMenuCheckboxItem({ className, children, ...props }) {
|
|
41
|
+
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { className: cn(menuItemClasses, "pl-7", className), ...props, children: [_jsx("span", { className: "left-2 absolute flex justify-center items-center size-4", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: "size-3.5 !text-ink" }) }) }), children] }));
|
|
42
|
+
}
|
|
43
|
+
export function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
44
|
+
return (_jsxs(DropdownMenuPrimitive.RadioItem, { className: cn(menuItemClasses, "pl-7", className), ...props, children: [_jsx("span", { className: "left-2 absolute flex justify-center items-center size-4", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx("span", { className: "bg-ink rounded-full size-1.5" }) }) }), children] }));
|
|
45
|
+
}
|
|
46
|
+
export function DropdownMenuLabel({ className, ...props }) {
|
|
47
|
+
return (_jsx(DropdownMenuPrimitive.Label, { className: cn("px-2 pt-1.5 pb-1 font-medium text-ink-tertiary text-caption", className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
export function DropdownMenuSeparator({ className, ...props }) {
|
|
50
|
+
return (_jsx(DropdownMenuPrimitive.Separator, { className: cn("-mx-1.5 my-1.5 bg-hairline h-px", className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
/* A menu item's shortcut, written once ("mod+d") and shown as the platform has it
|
|
53
|
+
(⌘D, Ctrl+D). It is for the eye: hidden from the item's name, which a screen
|
|
54
|
+
reader reads as the words alone. */
|
|
55
|
+
export function DropdownMenuShortcut({ className, keys, children, ...props }) {
|
|
56
|
+
const on = usePlatform();
|
|
57
|
+
return (_jsx("span", { "aria-hidden": true, className: cn("ml-auto pl-4 text-ink-tertiary text-caption tracking-wide", className), ...props, children: keys ? formatShortcut(keys, on) : children }));
|
|
58
|
+
}
|
|
59
|
+
export function DropdownMenuSubTrigger({ className, children, ...props }) {
|
|
60
|
+
return (_jsxs(DropdownMenuPrimitive.SubTrigger, { className: cn(menuItemClasses, "data-[state=open]:bg-tint-hover", className), ...props, children: [children, _jsx(ChevronRight, { className: "ml-auto size-3.5" })] }));
|
|
61
|
+
}
|
|
62
|
+
export function DropdownMenuSubContent({ className, ...props }) {
|
|
63
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.SubContent, { className: cn(menuSurfaceClasses, className), ...props }) }));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/components/ui/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAkB,CAAC;AAE/C;;4CAE4C;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,OAAO,CAAC;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,CAAC;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAC,GAAG,CAAC;AACzD,MAA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C,qBAAqB,CAAC,UAAU,IAC7B,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,iCAAiC,EAAE,SAAS,CAAC,KACxE,KAAK,aAER,QAAQ,EACT,KAAC,YAAY,IAAC,SAAS,EAAC,kBAAkB,GAAG,IACd,CACtC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EAC8C;IACtD,OAAO,CACH,KAAC,qBAAqB,CAAC,MAAM,cACzB,KAAC,qBAAqB,CAAC,UAAU,IAC7B,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KACxC,KAAK,GACX,GACyB,CAClC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type AriaAttributes, type KeyboardEvent } from "react";
|
|
2
|
+
import type { Text } from "../../lib/rich-text.js";
|
|
3
|
+
export declare function EditableText({ id, text, rev, onChange, onKeyDown, onLink, placeholder, alwaysShowPlaceholder, label, multiline, onBlur, aria, className, }: {
|
|
4
|
+
id?: string;
|
|
5
|
+
text: Text;
|
|
6
|
+
rev?: number;
|
|
7
|
+
onChange: (text: Text, el: HTMLElement) => void;
|
|
8
|
+
onKeyDown?: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
9
|
+
onLink?: (link: {
|
|
10
|
+
href?: string;
|
|
11
|
+
page?: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
alwaysShowPlaceholder?: boolean;
|
|
15
|
+
/** Names the field for a screen reader (the placeholder is heard too). */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Enter makes a new line or block, rather than submitting. */
|
|
18
|
+
multiline?: boolean;
|
|
19
|
+
onBlur?: () => void;
|
|
20
|
+
/** More ARIA for the field: a "/" menu's aria-controls, aria-expanded, aria-activedescendant. */
|
|
21
|
+
aria?: AriaAttributes;
|
|
22
|
+
className?: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=editable-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable-text.d.ts","sourceRoot":"","sources":["../../../src/components/ui/editable-text.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,cAAc,EAAuB,KAAK,aAAa,EAAmB,MAAM,OAAO,CAAC;AAEzI,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAgBnD,wBAAgB,YAAY,CAAC,EACzB,EAAE,EACF,IAAI,EACJ,GAAO,EACP,QAAQ,EACR,SAAS,EACT,MAAM,EACN,WAAW,EACX,qBAAqB,EACrB,KAAK,EACL,SAAgB,EAChB,MAAM,EACN,IAAI,EACJ,SAAS,GACZ,EAAE;IAEC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAGvD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,iGAAiG;IACjG,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAuFA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { isWebUrl } from "../../lib/embed.js";
|
|
5
|
+
import { readSpans, spansToHtml } from "../../lib/rich-text-dom.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { matchShortcut } from "../../lib/keys.js";
|
|
8
|
+
/* Rich text edited in place: bold, italic, strike, code, links and page mentions
|
|
9
|
+
over the span model in lib/rich-text. The browser owns the DOM while the user
|
|
10
|
+
types: the markup is written once per `rev`, and every edit is read back into
|
|
11
|
+
spans. Bump `rev` only when you replace the text from outside (a split, a merge,
|
|
12
|
+
a command), which is when the DOM has to be rewritten.
|
|
13
|
+
|
|
14
|
+
⌘B and ⌘I are the browser's own; ⌘⇧S strikes through. Paste is plain text,
|
|
15
|
+
except a web address: pasted over a selection it links the selection, and
|
|
16
|
+
pasted on its own it arrives as a link. */
|
|
17
|
+
const escape = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
18
|
+
export function EditableText({ id, text, rev = 0, onChange, onKeyDown, onLink, placeholder, alwaysShowPlaceholder, label, multiline = true, onBlur, aria, className, }) {
|
|
19
|
+
const el = useRef(null);
|
|
20
|
+
// The first markup goes through React, so a server-rendered page shows the text.
|
|
21
|
+
// React never writes it again (the string never changes): every later rewrite is
|
|
22
|
+
// done here, on each `rev`. Leaving it to React would skip a rewrite whose markup
|
|
23
|
+
// happens to equal the last one React wrote, though the browser has changed the
|
|
24
|
+
// DOM since (an empty line typed into, then split: both halves kept the text).
|
|
25
|
+
const [initial] = useState(() => ({ __html: spansToHtml(text) }));
|
|
26
|
+
const latest = useRef(text);
|
|
27
|
+
latest.current = text;
|
|
28
|
+
const first = useRef(true);
|
|
29
|
+
useLayoutEffect(() => {
|
|
30
|
+
if (first.current) {
|
|
31
|
+
first.current = false;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (el.current)
|
|
35
|
+
el.current.innerHTML = spansToHtml(latest.current);
|
|
36
|
+
}, [rev]);
|
|
37
|
+
const onInput = (el) => {
|
|
38
|
+
// An emptied element keeps a stray <br>, which would defeat :empty and read
|
|
39
|
+
// back as a newline.
|
|
40
|
+
if (el.textContent === "" && !el.querySelector("[data-page]"))
|
|
41
|
+
el.innerHTML = "";
|
|
42
|
+
onChange(readSpans(el), el);
|
|
43
|
+
};
|
|
44
|
+
const onPaste = (e) => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
const pasted = e.clipboardData.getData("text/plain");
|
|
47
|
+
const url = pasted.trim();
|
|
48
|
+
if (/^\S+$/.test(url) && isWebUrl(url)) {
|
|
49
|
+
const selection = window.getSelection();
|
|
50
|
+
if (selection && !selection.isCollapsed)
|
|
51
|
+
document.execCommand("createLink", false, url);
|
|
52
|
+
else
|
|
53
|
+
document.execCommand("insertHTML", false, `<a href="${escape(url)}">${escape(url)}</a> `);
|
|
54
|
+
onInput(e.currentTarget);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
document.execCommand("insertText", false, pasted);
|
|
58
|
+
};
|
|
59
|
+
const onClick = (e) => {
|
|
60
|
+
const link = e.target.closest("a");
|
|
61
|
+
if (!link)
|
|
62
|
+
return;
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
const target = link.dataset.page ? { page: link.dataset.page } : { href: link.getAttribute("href") ?? undefined };
|
|
65
|
+
if (onLink)
|
|
66
|
+
onLink(target);
|
|
67
|
+
else if (target.href)
|
|
68
|
+
window.open(target.href, "_blank", "noreferrer");
|
|
69
|
+
};
|
|
70
|
+
return (_jsx("div", { ref: el, "data-text": id, role: "textbox", "aria-label": label, "aria-multiline": multiline, "aria-placeholder": placeholder, ...aria, contentEditable: true, suppressContentEditableWarning: true, spellCheck: true, "data-placeholder": placeholder, className: cn(
|
|
71
|
+
// A link the browser inserts (a paste) is styled before the text is redrawn.
|
|
72
|
+
"min-w-0 break-words whitespace-pre-wrap outline-none [&_a]:link [&_b]:font-semibold", "empty:before:pointer-events-none empty:before:text-ink-tertiary", alwaysShowPlaceholder
|
|
73
|
+
? "empty:before:content-[attr(data-placeholder)]"
|
|
74
|
+
: "focus:empty:before:content-[attr(data-placeholder)]", className), dangerouslySetInnerHTML: initial, onInput: (e) => onInput(e.currentTarget), onKeyDown: (e) => {
|
|
75
|
+
// The model has no underline.
|
|
76
|
+
if (matchShortcut(e, "mod+u"))
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
if (matchShortcut(e, "mod+shift+s")) {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
document.execCommand("strikeThrough");
|
|
81
|
+
}
|
|
82
|
+
onKeyDown?.(e);
|
|
83
|
+
}, onBlur: onBlur, onPaste: onPaste, onClick: onClick }));
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=editable-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable-text.js","sourceRoot":"","sources":["../../../src/components/ui/editable-text.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAiF,MAAM,OAAO,CAAC;AACzI,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;6CAQ6C;AAE7C,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC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MAAM,CAAC,MAAM,CAAC,CAAC;aACtB,IAAI,MAAM,CAAC,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC3E,CAAC,CAAC;IAEF,OAAO,CACH,cACI,GAAG,EAAE,EAAE,eACI,EAAE,EACb,IAAI,EAAC,SAAS,gBACF,KAAK,oBACD,SAAS,sBACP,WAAW,KACzB,IAAI,EACR,eAAe,QACf,8BAA8B,QAC9B,UAAU,4BACQ,WAAW,EAC7B,SAAS,EAAE,EAAE;QACT,6EAA6E;QAC7E,qFAAqF,EACrF,iEAAiE,EACjE,qBAAqB;YACjB,CAAC,CAAC,+CAA+C;YACjD,CAAC,CAAC,qDAAqD,EAC3D,SAAS,CACZ,EACD,uBAAuB,EAAE,OAAO,EAChC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EACxC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,8BAA8B;YAC9B,IAAI,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC;gBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;YAClD,IAAI,aAAa,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,CAAC;gBAClC,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YAC1C,CAAC;YACD,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC,EACD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GAClB,CACL,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export declare function EmptyState({ icon: Icon, title, description, action, compact, className, }: {
|
|
4
|
+
icon?: LucideIcon;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=empty-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../src/components/ui/empty-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,wBAAgB,UAAU,CAAC,EACvB,IAAI,EAAE,IAAI,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAe,EACf,SAAS,GACZ,EAAE;IACC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAaA"}
|