@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,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
/* Nothing here yet, said kindly: an icon, a line saying what would be here, a
|
|
4
|
+
sentence on how it gets here, and the one action that starts it. `compact` for
|
|
5
|
+
inside a card, a table or a sidebar; the default for a page. */
|
|
6
|
+
export function EmptyState({ icon: Icon, title, description, action, compact = false, className, }) {
|
|
7
|
+
return (_jsxs("div", { className: cn("flex flex-col items-center mx-auto max-w-sm text-center", compact ? "gap-1.5 py-6" : "gap-2 py-16", className), children: [Icon && (_jsx("span", { "aria-hidden": true, className: cn("flex justify-center items-center bg-tint-hover mb-1 rounded-full text-ink-tertiary", compact ? "size-9 [&>svg]:size-4" : "size-12 [&>svg]:size-5"), children: _jsx(Icon, {}) })), _jsx("p", { className: cn("font-medium text-ink", compact ? "text-sm" : "text-body"), children: title }), description && _jsx("p", { className: "text-ink-secondary text-sm", children: description }), action && _jsx("div", { className: "mt-2", children: action })] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../../../src/components/ui/empty-state.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;;kEAEkE;AAClE,MAAM,UAAU,UAAU,CAAC,EACvB,IAAI,EAAE,IAAI,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,GAAG,KAAK,EACf,SAAS,GAQZ;IACG,OAAO,CACH,eAAK,SAAS,EAAE,EAAE,CAAC,yDAAyD,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,EAAE,SAAS,CAAC,aAC7H,IAAI,IAAI,CACL,oCAAkB,SAAS,EAAE,EAAE,CAAC,oFAAoF,EAAE,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAC/K,KAAC,IAAI,KAAG,GACL,CACV,EACD,YAAG,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,YAAG,KAAK,GAAK,EACvF,WAAW,IAAI,YAAG,SAAS,EAAC,4BAA4B,YAAE,WAAW,GAAK,EAC1E,MAAM,IAAI,cAAK,SAAS,EAAC,MAAM,YAAE,MAAM,GAAO,IAC7C,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export declare function ErrorState({ title, description, action, detail, icon, compact, className, }: {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
/** The error's own message, shown under "Details". */
|
|
8
|
+
detail?: string;
|
|
9
|
+
icon?: LucideIcon;
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export declare function NotFound({ title, description, action, code, className, }: {
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
action?: ReactNode;
|
|
17
|
+
code?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=error-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-state.d.ts","sourceRoot":"","sources":["../../../src/components/ui/error-state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC,wBAAgB,UAAU,CAAC,EACvB,KAA8B,EAC9B,WAAoG,EACpG,MAAM,EACN,MAAM,EACN,IAAkB,EAClB,OAAe,EACf,SAAS,GACZ,EAAE;IACC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAYA;AAID,wBAAgB,QAAQ,CAAC,EACrB,KAAiC,EACjC,WAA+E,EAC/E,MAAM,EACN,IAAY,EACZ,SAAS,GACZ,EAAE;IACC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAYA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CircleAlert, FileQuestion } from "lucide-react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { EmptyState } from "./empty-state.js";
|
|
5
|
+
/* Something went wrong where content should be: a page that failed to load, a
|
|
6
|
+
panel whose request errored. EmptyState's shape, in the danger ink, with what
|
|
7
|
+
happened, what to do, and usually a "Try again". `detail` is the technical
|
|
8
|
+
message, folded away for whoever needs it. `compact` inside a card or panel. */
|
|
9
|
+
export function ErrorState({ title = "Something went wrong", description = "It may be a moment's trouble. Try again, and if it keeps happening, reload the page.", action, detail, icon = CircleAlert, compact = false, className, }) {
|
|
10
|
+
return (_jsxs("div", { role: "alert", className: cn("[&>div>span:first-child]:bg-danger-tint [&>div>span:first-child]:text-danger", className), children: [_jsx(EmptyState, { icon: icon, title: title, description: description, compact: compact, action: action }), detail && (_jsxs("details", { className: "mx-auto -mt-8 mb-8 max-w-sm text-caption text-ink-tertiary text-center", children: [_jsx("summary", { className: "rounded-control cursor-pointer", children: "Details" }), _jsx("pre", { className: "bg-surface-sunken mt-2 p-2 rounded-control font-mono text-left whitespace-pre-wrap break-words", children: detail })] }))] }));
|
|
11
|
+
}
|
|
12
|
+
/* The body of a not-found page: the page's code in quiet large type, a line on
|
|
13
|
+
what happened, and a way home (`action`). Give it a Page or a FocusShell. */
|
|
14
|
+
export function NotFound({ title = "This page doesn't exist", description = "It may have been moved or deleted, or the link may be mistyped.", action, code = "404", className, }) {
|
|
15
|
+
return (_jsxs("div", { className: cn("flex flex-col items-center mx-auto py-16 max-w-sm text-center", className), children: [_jsx(FileQuestion, { "aria-hidden": true, className: "mb-4 size-10 text-ink-tertiary", strokeWidth: 1.5 }), _jsx("p", { "aria-hidden": true, className: "tabular-nums font-semibold text-display text-ink-tertiary leading-none", children: code }), _jsx("h1", { className: "mt-4 font-semibold text-h2 text-balance", children: title }), _jsx("p", { className: "mt-2 text-ink-secondary text-sm", children: description }), action !== undefined && _jsx("div", { className: "flex flex-wrap justify-center gap-2 mt-6", children: action })] }));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=error-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-state.js","sourceRoot":"","sources":["../../../src/components/ui/error-state.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAmB,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAE/C;;;kFAGkF;AAClF,MAAM,UAAU,UAAU,CAAC,EACvB,KAAK,GAAG,sBAAsB,EAC9B,WAAW,GAAG,sFAAsF,EACpG,MAAM,EACN,MAAM,EACN,IAAI,GAAG,WAAW,EAClB,OAAO,GAAG,KAAK,EACf,SAAS,GAUZ;IACG,OAAO,CACH,eAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,EAAE,CAAC,8EAA8E,EAAE,SAAS,CAAC,aACtH,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAI,EACnG,MAAM,IAAI,CACP,mBAAS,SAAS,EAAC,wEAAwE,aACvF,kBAAS,SAAS,EAAC,gCAAgC,wBAAkB,EACrE,cAAK,SAAS,EAAC,gGAAgG,YAAE,MAAM,GAAO,IACxH,CACb,IACC,CACT,CAAC;AACN,CAAC;AAED;+EAC+E;AAC/E,MAAM,UAAU,QAAQ,CAAC,EACrB,KAAK,GAAG,yBAAyB,EACjC,WAAW,GAAG,iEAAiE,EAC/E,MAAM,EACN,IAAI,GAAG,KAAK,EACZ,SAAS,GAOZ;IACG,OAAO,CACH,eAAK,SAAS,EAAE,EAAE,CAAC,+DAA+D,EAAE,SAAS,CAAC,aAC1F,KAAC,YAAY,yBAAa,SAAS,EAAC,gCAAgC,EAAC,WAAW,EAAE,GAAG,GAAI,EACzF,iCAAe,SAAS,EAAC,wEAAwE,YAC5F,IAAI,GACL,EACJ,aAAI,SAAS,EAAC,yCAAyC,YAAE,KAAK,GAAM,EACpE,YAAG,SAAS,EAAC,iCAAiC,YAAE,WAAW,GAAK,EAC/D,MAAM,KAAK,SAAS,IAAI,cAAK,SAAS,EAAC,0CAA0C,YAAE,MAAM,GAAO,IAC/F,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
export interface FieldButtonProps extends Omit<ComponentPropsWithRef<"button">, "children"> {
|
|
4
|
+
icon?: LucideIcon;
|
|
5
|
+
/** What is chosen. Nothing, and the placeholder shows in its place. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/** Supplying this adds the cross that empties the field. */
|
|
9
|
+
onClear?: () => void;
|
|
10
|
+
clearLabel?: string;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
size?: "sm" | "md" | "lg";
|
|
13
|
+
}
|
|
14
|
+
export declare function FieldButton({ icon: Icon, children, placeholder, onClear, clearLabel, invalid, className, disabled, size, ...props }: FieldButtonProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=field-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/field-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAK,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9D,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IACvF,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC7B;AAKD,wBAAgB,WAAW,CAAC,EACxB,IAAI,EAAE,IAAI,EACV,QAAQ,EACR,WAAW,EACX,OAAO,EACP,UAAoB,EACpB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACX,EAAE,gBAAgB,+BAoClB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { fieldVariants, fromField, useField } from "./input.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
/* A field you press rather than type in: what a picker shows at rest. It is the
|
|
7
|
+
same sunken well as Input, so a row of both reads as one form. The cross sits
|
|
8
|
+
beside the button, not inside it, because a button cannot hold a button. */
|
|
9
|
+
export function FieldButton({ icon: Icon, children, placeholder, onClear, clearLabel = "Clear", invalid, className, disabled, size, ...props }) {
|
|
10
|
+
// Inside a Field: its id (so the label names this), description, invalid, disabled.
|
|
11
|
+
const own = fromField(useField(), { ...props, disabled, "aria-invalid": invalid || undefined });
|
|
12
|
+
const empty = children === undefined || children === null || children === "";
|
|
13
|
+
const clearable = onClear !== undefined && !empty && !own.disabled;
|
|
14
|
+
return (_jsxs("span", { className: cn("relative block w-full", className), children: [_jsxs("button", { type: "button", ...own, className: cn(fieldVariants({ size }), "flex items-center gap-2 text-left cursor-pointer",
|
|
15
|
+
// Open, it looks the way a focused input does.
|
|
16
|
+
"data-[state=open]:bg-surface data-[state=open]:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]", clearable && "pr-8"), children: [Icon !== undefined && _jsx(Icon, { className: "size-4 shrink-0 text-ink-tertiary" }), _jsx("span", { className: cn("min-w-0 flex-1 truncate", empty && "text-ink-placeholder"), children: empty ? placeholder : children })] }), clearable && (_jsx("button", { type: "button", "aria-label": clearLabel, onClick: onClear, className: "absolute top-1/2 right-1 flex size-6 -translate-y-1/2 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-(--duration-fast) hover:bg-tint-active hover:text-ink", children: _jsx(X, { className: "size-3.5" }) }))] }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=field-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-button.js","sourceRoot":"","sources":["../../../src/components/ui/field-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,CAAC,EAAmB,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAa,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAcxC;;8EAE8E;AAC9E,MAAM,UAAU,WAAW,CAAC,EACxB,IAAI,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ts","sourceRoot":"","sources":["../../../src/components/ui/file-preview.tsx"],"names":[],"mappings":"AAoCA,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BA2C9F"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ImageOff } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
/* A small picture of an image file that has not been uploaded: for showing
|
|
7
|
+
someone what they picked before anything is sent.
|
|
8
|
+
|
|
9
|
+
A camera's files are tens of megapixels; decoding a folder of them at full
|
|
10
|
+
size would stall the tab. So each is decoded straight to a few hundred
|
|
11
|
+
pixels, two at a time, and only once it is scrolled into view. A file is
|
|
12
|
+
decoded once however many times its preview is shown. */
|
|
13
|
+
const decoded = new WeakMap();
|
|
14
|
+
let running = 0;
|
|
15
|
+
const waiting = [];
|
|
16
|
+
function small(file) {
|
|
17
|
+
let promise = decoded.get(file);
|
|
18
|
+
if (promise === undefined) {
|
|
19
|
+
promise = (async () => {
|
|
20
|
+
if (running >= 2)
|
|
21
|
+
await new Promise((resolve) => waiting.push(resolve));
|
|
22
|
+
running += 1;
|
|
23
|
+
try {
|
|
24
|
+
return await createImageBitmap(file, { resizeWidth: 360, resizeQuality: "low" });
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
running -= 1;
|
|
28
|
+
waiting.shift()?.();
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
decoded.set(file, promise);
|
|
32
|
+
}
|
|
33
|
+
return promise;
|
|
34
|
+
}
|
|
35
|
+
export function FilePreview({ file, className }) {
|
|
36
|
+
const canvas = useRef(null);
|
|
37
|
+
const [state, setState] = useState("waiting");
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const el = canvas.current;
|
|
40
|
+
if (el === null || file === undefined)
|
|
41
|
+
return;
|
|
42
|
+
let cancelled = false;
|
|
43
|
+
const observer = new IntersectionObserver((entries) => {
|
|
44
|
+
if (!entries.some((entry) => entry.isIntersecting))
|
|
45
|
+
return;
|
|
46
|
+
observer.disconnect();
|
|
47
|
+
small(file).then((bitmap) => {
|
|
48
|
+
if (cancelled)
|
|
49
|
+
return;
|
|
50
|
+
el.width = bitmap.width;
|
|
51
|
+
el.height = bitmap.height;
|
|
52
|
+
el.getContext("2d")?.drawImage(bitmap, 0, 0);
|
|
53
|
+
setState("shown");
|
|
54
|
+
},
|
|
55
|
+
// Not an image the browser can read: another type renamed, a damaged file.
|
|
56
|
+
() => !cancelled && setState("unreadable"));
|
|
57
|
+
}, { rootMargin: "200px" });
|
|
58
|
+
observer.observe(el);
|
|
59
|
+
return () => {
|
|
60
|
+
cancelled = true;
|
|
61
|
+
observer.disconnect();
|
|
62
|
+
};
|
|
63
|
+
}, [file]);
|
|
64
|
+
return (_jsxs("span", { className: cn("relative block overflow-hidden bg-surface-sunken", className), children: [_jsx("canvas", { ref: canvas, className: cn("h-full w-full object-cover transition-opacity duration-(--duration-slow)", state === "shown" ? "opacity-100" : "opacity-0") }), (state === "unreadable" || file === undefined) && (_jsx("span", { className: "absolute inset-0 flex items-center justify-center text-ink-disabled", children: _jsx(ImageOff, { className: "size-5" }) }))] }));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=file-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-preview.js","sourceRoot":"","sources":["../../../src/components/ui/file-preview.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,E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I,EAClK,CAAC,KAAK,KAAK,YAAY,IAAI,IAAI,KAAK,SAAS,CAAC,IAAI,CAC/C,eAAM,SAAS,EAAC,qEAAqE,YACjF,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC5B,CACV,IACE,CACV,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type UploadItem } from "../../hooks/use-upload-queue.js";
|
|
3
|
+
export declare function FileDropArea({ onFiles, title, hint, accept, folders, single, more, className, }: {
|
|
4
|
+
onFiles: (files: File[]) => void;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
/** What is accepted, in words: "JPEGs up to 32 MB each". */
|
|
7
|
+
hint?: ReactNode;
|
|
8
|
+
/** For the system chooser only; it does not filter drops. Check those with a `validate`. */
|
|
9
|
+
accept?: string;
|
|
10
|
+
/** Offer "Choose a folder". Never offered with `single`. */
|
|
11
|
+
folders?: boolean;
|
|
12
|
+
/** One file: the chooser takes one, and a drop of several gives only the first. */
|
|
13
|
+
single?: boolean;
|
|
14
|
+
/** Another way to get files, beside the choose buttons: "From this trip", say. */
|
|
15
|
+
more?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
export declare function FileUploader({ open, onOpenChange, upload, validate, dropped, accept, hint, noun, parallel, onFinished, doneAction, more, single, }: {
|
|
19
|
+
open: boolean;
|
|
20
|
+
onOpenChange: (open: boolean) => void;
|
|
21
|
+
upload: (file: File, report: (progress: number) => void) => Promise<string | void>;
|
|
22
|
+
validate?: (file: File) => string | undefined;
|
|
23
|
+
/** Files to start the review step with. A new array is a new batch. */
|
|
24
|
+
dropped?: File[];
|
|
25
|
+
accept?: string;
|
|
26
|
+
hint?: ReactNode;
|
|
27
|
+
/** Singular; an "s" is added for any count but one. */
|
|
28
|
+
noun?: string;
|
|
29
|
+
parallel?: number;
|
|
30
|
+
/** Called once each batch has settled, with what happened to every file. */
|
|
31
|
+
onFinished?: (items: UploadItem[]) => void;
|
|
32
|
+
/** A button for the last step beside "Upload more": "See them", say. */
|
|
33
|
+
doneAction?: ReactNode;
|
|
34
|
+
/** Another way in, offered beside the choose buttons on the first step. */
|
|
35
|
+
more?: ReactNode;
|
|
36
|
+
/** One file, not a batch. */
|
|
37
|
+
single?: boolean;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=file-uploader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../../../src/components/ui/file-uploader.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAalF,wBAAgB,YAAY,CAAC,EACzB,OAAO,EACP,KAAyB,EACzB,IAAI,EACJ,MAAM,EACN,OAAc,EACd,MAAc,EACd,IAAI,EACJ,SAAS,GACZ,EAAE;IACC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mFAAmF;IACnF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BA2CA;AA+DD,wBAAgB,YAAY,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,IAAI,EACJ,IAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,IAAI,EACJ,MAAc,GACjB,EAAE;IACC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACnF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC;IAC9C,uEAAuE;IACvE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAC3C,wEAAwE;IACxE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,+BA+LA"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Check, CircleAlert, FolderOpen, ImagePlus, Info, RotateCw, Upload, X } from "lucide-react";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { FilePreview } from "./file-preview.js";
|
|
7
|
+
import { StepDialog } from "./step-dialog.js";
|
|
8
|
+
import { useUploadQueue } from "../../hooks/use-upload-queue.js";
|
|
9
|
+
import { carriesFiles, filesFromDrop, pickFiles } from "../../lib/files.js";
|
|
10
|
+
import { cn } from "../../lib/utils.js";
|
|
11
|
+
import { ProgressBar } from "./progress.js";
|
|
12
|
+
const megabytes = (bytes) => {
|
|
13
|
+
const mb = bytes / (1024 * 1024);
|
|
14
|
+
return mb >= 1000 ? `${(mb / 1024).toFixed(1)} GB` : mb >= 10 ? `${Math.round(mb)} MB` : `${mb.toFixed(1)} MB`;
|
|
15
|
+
};
|
|
16
|
+
/* Somewhere to drop files, with the two buttons for people who would sooner
|
|
17
|
+
choose them. Lights up while files are dragged over it. Use it on a page,
|
|
18
|
+
or as the first step of `FileUploader`. */
|
|
19
|
+
export function FileDropArea({ onFiles, title = "Drop files here", hint, accept, folders = true, single = false, more, className, }) {
|
|
20
|
+
const [over, setOver] = useState(false);
|
|
21
|
+
return (_jsxs("div", { onDragOver: (event) => {
|
|
22
|
+
if (!carriesFiles(event))
|
|
23
|
+
return;
|
|
24
|
+
// Without this the browser opens the dropped file.
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
setOver(true);
|
|
27
|
+
}, onDragLeave: () => setOver(false), onDrop: (event) => {
|
|
28
|
+
if (!carriesFiles(event))
|
|
29
|
+
return;
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
// The window may have its own drop target; this one has the files.
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
setOver(false);
|
|
34
|
+
void filesFromDrop(event.dataTransfer).then((files) => onFiles(single ? files.slice(0, 1) : files));
|
|
35
|
+
}, className: cn("flex min-h-64 flex-col items-center justify-center rounded-overlay border-2 border-dashed px-6 py-10 text-center transition-colors duration-(--duration-base)", over ? "border-accent bg-accent-tint" : "border-hairline-strong", className), children: [_jsx(Upload, { className: cn("size-8 transition-colors duration-(--duration-base)", over ? "text-accent-text" : "text-ink-tertiary") }), _jsx("p", { className: "mt-4 text-h3 text-ink", children: title }), hint !== undefined && _jsx("p", { className: "mt-1 text-sm text-ink-secondary", children: hint }), _jsxs("div", { className: "mt-6 flex flex-wrap justify-center gap-2", children: [_jsxs(Button, { variant: "primary", onClick: () => pickFiles(onFiles, { accept, single }), children: [_jsx(ImagePlus, {}), single ? "Choose a file" : "Choose files"] }), folders && !single && (_jsxs(Button, { onClick: () => pickFiles(onFiles, { folder: true }), children: [_jsx(FolderOpen, {}), "Choose a folder"] })), more] })] }));
|
|
36
|
+
}
|
|
37
|
+
const TILES = "grid grid-cols-[repeat(auto-fill,minmax(7.5rem,1fr))] gap-2";
|
|
38
|
+
// One file, shown as large as the narrower dialog allows.
|
|
39
|
+
const ONE = "mx-auto grid w-full max-w-72";
|
|
40
|
+
const sameFile = (a, b) => a.name === b.name && a.size === b.size && a.lastModified === b.lastModified;
|
|
41
|
+
function Tile({ item, onRetry }) {
|
|
42
|
+
const problem = item.state === "failed" || item.state === "rejected";
|
|
43
|
+
return (_jsxs("li", { className: "relative", children: [_jsxs("span", { className: "relative block overflow-hidden rounded-surface", children: [_jsx(FilePreview, { file: item.file, className: cn("aspect-square transition-opacity duration-(--duration-slow)", item.state !== "done" && "opacity-55") }), item.state === "uploading" && (_jsx("span", { className: "absolute inset-x-0 bottom-0 h-1 bg-on-media-faint", children: _jsx("span", { className: "block h-full bg-accent transition-[width] duration-(--duration-base) ease-out-notion", style: { width: `${item.progress * 100}%` } }) })), (item.state === "uploading" || item.state === "waiting") && (_jsx("span", { className: "absolute inset-x-0 bottom-1.5 text-center text-caption font-medium text-on-media-ink tabular-nums [text-shadow:0_1px_2px_var(--on-media-strong)]", children: item.state === "uploading" ? `${Math.round(item.progress * 100)}%` : "Waiting" })), item.state === "done" && (_jsx("span", { className: "absolute top-1.5 right-1.5 flex size-6 animate-scale-in items-center justify-center rounded-full bg-success text-on-media-ink shadow-sm", children: _jsx(Check, { className: "size-3.5" }) })), problem && (_jsxs("span", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1.5 bg-surface/80 px-2 text-center text-caption text-danger", children: [_jsx(CircleAlert, { className: "size-4" }), item.message, item.state === "failed" && (_jsxs(Button, { size: "sm", onClick: onRetry, children: [_jsx(RotateCw, {}), "Retry"] }))] }))] }), _jsx("p", { className: "mt-1 truncate text-caption text-ink-tertiary", children: item.state === "done" && item.message !== undefined ? item.message : item.file.name })] }));
|
|
44
|
+
}
|
|
45
|
+
/* Uploading as four steps in one dialog: choose the files, look them over,
|
|
46
|
+
watch them go, see what happened.
|
|
47
|
+
|
|
48
|
+
You supply `upload`, which sends one file and reports its progress; see
|
|
49
|
+
`useUploadQueue` for its contract and `sendWithProgress` in lib/files for a
|
|
50
|
+
request that can report. Everything else is here: the drop area, previews,
|
|
51
|
+
leaving files out, files turned away by `validate` with the reason shown,
|
|
52
|
+
a few uploads at a time, retry, and the summary. A message an upload
|
|
53
|
+
resolves with ("already here") is shown on its tile and again in the summary.
|
|
54
|
+
|
|
55
|
+
Nothing is sent until the review step's button is pressed. To open it on
|
|
56
|
+
files dropped elsewhere on the page, pass them as `dropped`.
|
|
57
|
+
|
|
58
|
+
With `single` it takes one file, for a thing that has one picture: choosing
|
|
59
|
+
or dropping again replaces it, and there is no folder or "Add more". The
|
|
60
|
+
dialog is narrower and shorter, and the one file is shown large. */
|
|
61
|
+
export function FileUploader({ open, onOpenChange, upload, validate, dropped, accept, hint, noun = "file", parallel, onFinished, doneAction, more, single = false, }) {
|
|
62
|
+
const queue = useUploadQueue({ upload, validate, parallel });
|
|
63
|
+
const [staged, setStaged] = useState([]);
|
|
64
|
+
const stage = (files) => single
|
|
65
|
+
? files.length > 0 && setStaged(files.slice(0, 1))
|
|
66
|
+
: setStaged((prev) => [...prev, ...files.filter((file, i) => !prev.some((p) => sameFile(p, file)) && files.findIndex((f) => sameFile(f, file)) === i)]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (dropped !== undefined && dropped.length > 0)
|
|
69
|
+
stage(dropped);
|
|
70
|
+
}, [dropped]);
|
|
71
|
+
// Where the dialog is follows from what there is: files chosen and not
|
|
72
|
+
// sent are reviewed, files in flight are watched, files landed are summed
|
|
73
|
+
// up. Closing and reopening therefore lands on the right step.
|
|
74
|
+
const step = staged.length > 0 ? 1 : queue.busy ? 2 : queue.items.length > 0 ? 3 : 0;
|
|
75
|
+
const { busy, items } = queue;
|
|
76
|
+
const settled = !busy && items.length > 0;
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (settled)
|
|
79
|
+
onFinished?.(items);
|
|
80
|
+
// Once per batch: when the queue goes from busy to settled.
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
}, [settled]);
|
|
83
|
+
const words = (n) => `${n.toLocaleString()} ${noun}${n === 1 ? "" : "s"}`;
|
|
84
|
+
const acceptable = staged.filter((file) => validate?.(file) === undefined);
|
|
85
|
+
const skipped = staged.length - acceptable.length;
|
|
86
|
+
const wanted = items.filter((i) => i.state !== "rejected");
|
|
87
|
+
const total = wanted.reduce((sum, i) => sum + i.file.size, 0);
|
|
88
|
+
const sent = wanted.reduce((sum, i) => sum + i.file.size * (i.state === "done" || i.state === "failed" ? 1 : i.progress), 0);
|
|
89
|
+
const done = items.filter((i) => i.state === "done").length;
|
|
90
|
+
const problems = items.filter((i) => i.state === "failed" || i.state === "rejected");
|
|
91
|
+
// Sent, but with something to say about it: "already here", for one.
|
|
92
|
+
const noted = items.filter((i) => i.state === "done" && i.message !== undefined);
|
|
93
|
+
return (_jsxs(StepDialog, { open: open, onOpenChange: onOpenChange, className: single ? "h-[min(36rem,90dvh)] max-w-lg" : undefined, steps: ["Choose", "Review", "Upload", "Done"], step: step, title: step === 0
|
|
94
|
+
? single
|
|
95
|
+
? `Add a ${noun}`
|
|
96
|
+
: `Add ${noun}s`
|
|
97
|
+
: step === 1
|
|
98
|
+
? `${words(acceptable.length)}, ${megabytes(acceptable.reduce((sum, f) => sum + f.size, 0))}`
|
|
99
|
+
: step === 2
|
|
100
|
+
? `Uploading ${Math.min(items.filter((i) => i.state !== "waiting" && i.state !== "uploading").length + 1, items.length)} of ${items.length}`
|
|
101
|
+
: "Finished", description: step === 1 ? (_jsx("span", { className: skipped > 0 ? "text-danger" : undefined, children: skipped > 0 ? `${skipped} cannot be uploaded and will be skipped.` : "Leave out any you do not want, then send them." })) : undefined, banner:
|
|
102
|
+
// By bytes, so one large file does not count the same as one small one.
|
|
103
|
+
_jsx(ProgressBar, { size: "sm", label: "Uploading", value: total === 0 ? 0 : Math.round((sent / total) * 100), className: cn("mt-2 transition-opacity duration-(--duration-slow)", step === 2 ? "opacity-100" : "opacity-0") }), footer: step === 0 ? (_jsx(Button, { onClick: () => onOpenChange(false), children: "Cancel" })) : step === 1 ? (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "ghost", className: "mr-auto", onClick: () => pickFiles(stage, { accept, single }), children: [_jsx(ImagePlus, {}), single ? "Choose another" : "Add more"] }), _jsx(Button, { onClick: () => setStaged([]), children: "Start over" }), _jsxs(Button, { variant: "primary", disabled: acceptable.length === 0, onClick: () => {
|
|
104
|
+
queue.add(acceptable);
|
|
105
|
+
setStaged([]);
|
|
106
|
+
}, children: ["Upload ", words(acceptable.length)] })] })) : step === 2 ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "mr-auto text-sm text-ink-tertiary", children: "Keep this page open until it finishes." }), _jsx(Button, { onClick: () => onOpenChange(false), children: "Hide" })] })) : (_jsxs(_Fragment, { children: [!single && (_jsxs(Button, { className: "mr-auto", onClick: queue.clear, children: [_jsx(ImagePlus, {}), "Upload more"] })), doneAction ?? (_jsx(Button, { variant: "primary", onClick: () => onOpenChange(false), children: "Close" }))] })), children: [step === 0 && (_jsx(FileDropArea, { onFiles: stage, accept: accept, hint: hint, more: more, single: single, title: single ? `Drop a ${noun} here` : `Drop ${noun}s here`, className: "h-full" })), step === 1 && (_jsx("ul", { className: single ? ONE : TILES, children: staged.map((file) => {
|
|
107
|
+
const refused = validate?.(file);
|
|
108
|
+
return (_jsxs("li", { className: "group relative", children: [_jsx(FilePreview, { file: file, className: cn("aspect-square rounded-surface", refused !== undefined && "opacity-40") }), refused !== undefined && (_jsxs("span", { className: "absolute inset-x-1.5 top-1.5 flex items-start gap-1 rounded-control bg-danger-tint px-1.5 py-1 text-caption text-danger backdrop-blur-sm", children: [_jsx(CircleAlert, { className: "mt-px size-3 shrink-0" }), refused] })), _jsx(Button, { variant: "on-media", size: "icon-sm", "aria-label": `Leave out ${file.name}`, onClick: () => setStaged((prev) => prev.filter((f) => f !== file)), className: "affordance top-1.5 right-1.5 absolute", children: _jsx(X, {}) }), _jsx("p", { className: "mt-1 truncate text-caption text-ink-tertiary", children: file.name })] }, `${file.name}-${file.size}-${file.lastModified}`));
|
|
109
|
+
}) })), step === 2 && (_jsx("ul", { className: single ? ONE : TILES, children: items.map((item) => (_jsx(Tile, { item: item, onRetry: () => queue.retry(item.key) }, item.key))) })), step === 3 && (_jsxs("div", { className: "flex h-full flex-col items-center justify-center py-6 text-center", children: [_jsx("span", { className: cn("flex size-14 animate-scale-in items-center justify-center rounded-full", done > 0 ? "bg-tag-green-bg text-tag-green-ink" : "bg-tint-active text-ink-secondary"), children: done > 0 ? _jsx(Check, { className: "size-7" }) : _jsx(CircleAlert, { className: "size-6" }) }), _jsx("p", { className: "mt-5 text-h2 text-ink", children: done > 0 ? `${words(done)} uploaded` : "Nothing was uploaded" }), problems.length > 0 && _jsxs("p", { className: "mt-1 text-sm text-ink-secondary", children: [problems.length, " could not be uploaded."] }), noted.length > 0 && (_jsx("ul", { className: "mt-5 w-full max-w-md text-left", children: noted.map((item) => (_jsxs("li", { className: "flex items-center gap-2 py-1 text-sm", children: [_jsx(Info, { className: "size-4 shrink-0 text-ink-tertiary" }), _jsx("span", { className: "min-w-0 flex-1 truncate text-ink", children: item.file.name }), _jsx("span", { className: "shrink-0 text-ink-tertiary", children: item.message })] }, item.key))) })), problems.length > 0 && (_jsx("ul", { className: "mt-5 w-full max-w-md text-left", children: problems.map((item) => (_jsxs("li", { className: "flex items-center gap-2 py-1 text-sm", children: [_jsx(CircleAlert, { className: "size-4 shrink-0 text-danger" }), _jsx("span", { className: "min-w-0 flex-1 truncate text-ink", children: item.file.name }), _jsx("span", { className: "shrink-0 text-ink-tertiary", children: item.message }), item.state === "failed" && (_jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": `Retry ${item.file.name}`, onClick: () => queue.retry(item.key), children: _jsx(RotateCw, {}) }))] }, item.key))) }))] }))] }));
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=file-uploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-uploader.js","sourceRoot":"","sources":["../../../src/components/ui/file-uploader.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAmB,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAgB,CAAC;AAE7C,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE;IACxC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACjC,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,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AAC,IAAI,EAAE,EAAE,CAAC,CACjB,cAAmB,SAAS,EAAC,sCAAsC,aAC/D,KAAC,IAAI,IAAC,SAAS,EAAC,mCAAmC,GAAG,EACtD,eAAM,SAAS,EAAC,kCAAkC,YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAQ,EAC1E,eAAM,SAAS,EAAC,4BAA4B,YAAE,IAAI,CAAC,OAAO,GAAQ,KAH7D,IAAI,CAAC,GAAG,CAIZ,CACR,CAAC,GACD,CACR,EACA,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACpB,aAAI,SAAS,EAAC,gCAAgC,YACzC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACpB,cAAmB,SAAS,EAAC,sCAAsC,aAC/D,KAAC,WAAW,IAAC,SAAS,EAAC,6BAA6B,GAAG,EACvD,eAAM,SAAS,EAAC,kCAAkC,YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAQ,EAC1E,eAAM,SAAS,EAAC,4BAA4B,YAAE,IAAI,CAAC,OAAO,GAAQ,EACjE,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,CACxB,KAAC,MAAM,IAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,gBAAa,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAC9G,KAAC,QAAQ,KAAG,GACP,CACZ,KARI,IAAI,CAAC,GAAG,CASZ,CACR,CAAC,GACD,CACR,IACC,CACT,IACQ,CAChB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Filter, type Match, type Property, type Sort } from "../../lib/database.js";
|
|
2
|
+
export declare function FilterBuilder({ properties, filters, onChange, match, onMatchChange, className, }: {
|
|
3
|
+
properties: readonly Property[];
|
|
4
|
+
filters: readonly Filter[];
|
|
5
|
+
onChange: (filters: Filter[]) => void;
|
|
6
|
+
match?: Match;
|
|
7
|
+
onMatchChange?: (match: Match) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export declare function SortBuilder({ properties, sorts, onChange, className, }: {
|
|
11
|
+
properties: readonly Property[];
|
|
12
|
+
sorts: readonly Sort[];
|
|
13
|
+
onChange: (sorts: Sort[]) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export declare function FilterButton(props: Parameters<typeof FilterBuilder>[0]): import("react").JSX.Element;
|
|
17
|
+
export declare function SortButton(props: Parameters<typeof SortBuilder>[0]): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=filter-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-builder.d.ts","sourceRoot":"","sources":["../../../src/components/ui/filter-builder.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA8B,KAAK,MAAM,EAAiB,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AA+FrI,wBAAgB,aAAa,CAAC,EAC1B,UAAU,EACV,OAAO,EACP,QAAQ,EACR,KAAa,EACb,aAAa,EACb,SAAS,GACZ,EAAE;IACC,UAAU,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAqFA;AAED,wBAAgB,WAAW,CAAC,EACxB,UAAU,EACV,KAAK,EACL,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,UAAU,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAmDA;AA4BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,+BAMtE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,+BAMlE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDownWideNarrow, ListFilter, Plus, X } from "lucide-react";
|
|
4
|
+
import { useId, useRef } from "react";
|
|
5
|
+
import { needsValue, newFilter, OPS } from "../../lib/database.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { Badge } from "./badge.js";
|
|
8
|
+
import { Button } from "./button.js";
|
|
9
|
+
import { DatePicker } from "./date-picker.js";
|
|
10
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
11
|
+
import { Input, NumberInput } from "./input.js";
|
|
12
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
13
|
+
import { SelectMenu } from "./select-menu.js";
|
|
14
|
+
/* Narrowing and ordering any list by its properties (lib/database's Property):
|
|
15
|
+
FilterBuilder and SortBuilder, and FilterButton and SortButton that open them
|
|
16
|
+
from a toolbar. Each filter reads as a sentence, Notion's way: "Where Status is
|
|
17
|
+
Done", "and Price > 100". A filter missing its value lets everything through,
|
|
18
|
+
so one being written never empties the list. The value is asked for in the
|
|
19
|
+
property's own kind of field: words, a number, a date, an option. */
|
|
20
|
+
const fieldClass = "h-control-sm rounded-control bg-tint-hover px-1.5 text-sm";
|
|
21
|
+
let nextId = 0;
|
|
22
|
+
const freshId = () => `f${Date.now().toString(36)}${(nextId++).toString(36)}`;
|
|
23
|
+
function AddProperty({ properties, label, onPick }) {
|
|
24
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "self-start text-ink-secondary", children: [_jsx(Plus, {}), " ", label] }) }), _jsx(DropdownMenuContent, { align: "start", children: properties.map((p) => (_jsx(DropdownMenuItem, { onSelect: () => onPick(p), children: p.name }, p.id))) })] }));
|
|
25
|
+
}
|
|
26
|
+
function ValueField({ property, filter, onChange }) {
|
|
27
|
+
const label = `${property.name}: value`;
|
|
28
|
+
switch (property.type) {
|
|
29
|
+
case "number":
|
|
30
|
+
return (_jsx(NumberInput, { size: "sm", "aria-label": label, value: typeof filter.value === "number" ? filter.value : undefined, onChange: (v) => onChange(v ?? null), className: "w-24" }));
|
|
31
|
+
case "date":
|
|
32
|
+
// A field fills its row; in a sentence it takes a date's width.
|
|
33
|
+
return (_jsx("div", { className: "w-44", children: _jsx(DatePicker, { "aria-label": label, value: typeof filter.value === "string" ? filter.value : null, onChange: onChange }) }));
|
|
34
|
+
case "checkbox":
|
|
35
|
+
return (_jsx(SelectMenu, { label: label, value: filter.value === false ? "unchecked" : "checked", options: ["checked", "unchecked"], render: (v) => (v === "checked" ? "Checked" : "Unchecked"), onChange: (v) => onChange(v === "checked"), className: fieldClass }));
|
|
36
|
+
case "select":
|
|
37
|
+
case "multiSelect": {
|
|
38
|
+
const options = property.options ?? [];
|
|
39
|
+
const chosen = Array.isArray(filter.value) ? filter.value[0] : typeof filter.value === "string" ? filter.value : undefined;
|
|
40
|
+
const ids = ["", ...options.map((o) => o.id)];
|
|
41
|
+
return (_jsx(SelectMenu, { label: label, value: chosen ?? "", options: ids, render: (id) => {
|
|
42
|
+
const o = options.find((x) => x.id === id);
|
|
43
|
+
return o ? _jsx(Badge, { color: o.color, children: o.name }) : _jsx("span", { className: "text-ink-tertiary", children: "Choose\u2026" });
|
|
44
|
+
}, onChange: (id) => onChange(id === "" ? null : property.type === "multiSelect" ? [id] : id), className: fieldClass }));
|
|
45
|
+
}
|
|
46
|
+
default:
|
|
47
|
+
return _jsx(Input, { size: "sm", "aria-label": label, placeholder: "Value", value: typeof filter.value === "string" ? filter.value : "", onChange: (e) => onChange(e.target.value), className: "w-40 max-w-full" });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function FilterBuilder({ properties, filters, onChange, match = "all", onMatchChange, className, }) {
|
|
51
|
+
const byId = new Map(properties.map((p) => [p.id, p]));
|
|
52
|
+
const list = useRef(null);
|
|
53
|
+
const add = useRef(null);
|
|
54
|
+
const set = (i, patch) => onChange(filters.map((f, k) => (k === i ? { ...f, ...patch } : f)));
|
|
55
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-2", className), children: [filters.length === 0 && _jsx("p", { className: "px-1 text-ink-tertiary text-sm", children: "No filters. Everything shows." }), _jsx("div", { ref: list, role: "list", "aria-label": "Filters", className: "flex flex-col gap-2", children: filters.map((filter, i) => {
|
|
56
|
+
const property = byId.get(filter.property);
|
|
57
|
+
if (!property)
|
|
58
|
+
// A filter on a property since deleted: shown, so it can be removed.
|
|
59
|
+
return (_jsxs("div", { role: "listitem", className: "flex items-center gap-1.5 text-ink-tertiary text-sm", children: [_jsx("span", { className: "w-14 shrink-0", children: i === 0 ? "Where" : match === "all" ? "And" : "Or" }), "A deleted property", _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Remove the filter on a deleted property", onClick: () => onChange(filters.filter((_, k) => k !== i)), children: _jsx(X, {}) })] }, filter.id));
|
|
60
|
+
const ops = OPS[property.type];
|
|
61
|
+
return (_jsxs("div", { role: "listitem", className: "flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "w-14 text-ink-secondary text-sm shrink-0", children: i === 0 ? ("Where") : i === 1 && onMatchChange ? (_jsx(SelectMenu, { label: "Match", value: match, options: ["all", "any"], render: (m) => (m === "all" ? "And" : "Or"), onChange: onMatchChange, className: "-ml-1.5" })) : match === "all" ? ("And") : ("Or") }), _jsx(SelectMenu, { label: "Property", value: property.id, options: properties.map((p) => p.id), render: (id) => byId.get(id)?.name ?? id, onChange: (id) => {
|
|
62
|
+
const next = byId.get(id);
|
|
63
|
+
if (next)
|
|
64
|
+
set(i, { ...newFilter(next, filter.id) });
|
|
65
|
+
}, className: fieldClass }), _jsx(SelectMenu, { label: "Condition", value: filter.op, options: ops.map((o) => o.op), render: (op) => ops.find((o) => o.op === op)?.label ?? op, onChange: (op) => set(i, { op }), className: fieldClass }), needsValue(filter.op) && _jsx(ValueField, { property: property, filter: filter, onChange: (value) => set(i, { value }) }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Remove the filter on ${property.name}`, className: "text-ink-tertiary", onClick: () => {
|
|
66
|
+
onChange(filters.filter((_, k) => k !== i));
|
|
67
|
+
// Focus stays in the list rather than falling to the page.
|
|
68
|
+
requestAnimationFrame(() => add.current?.querySelector("button")?.focus());
|
|
69
|
+
}, children: _jsx(X, {}) })] }, filter.id));
|
|
70
|
+
}) }), _jsx("div", { ref: add, children: _jsx(AddProperty, { properties: properties, label: "Add a filter", onPick: (p) => onChange([...filters, newFilter(p, freshId())]) }) })] }));
|
|
71
|
+
}
|
|
72
|
+
export function SortBuilder({ properties, sorts, onChange, className, }) {
|
|
73
|
+
const byId = new Map(properties.map((p) => [p.id, p]));
|
|
74
|
+
const unused = properties.filter((p) => !sorts.some((s) => s.property === p.id));
|
|
75
|
+
const set = (i, patch) => onChange(sorts.map((s, k) => (k === i ? { ...s, ...patch } : s)));
|
|
76
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-2", className), children: [sorts.length === 0 && _jsx("p", { className: "px-1 text-ink-tertiary text-sm", children: "No sorts. In the order they were added." }), _jsx("ol", { "aria-label": "Sorts, first applied first", className: "flex flex-col gap-2", children: sorts.map((sort, i) => {
|
|
77
|
+
const property = byId.get(sort.property);
|
|
78
|
+
if (!property)
|
|
79
|
+
return (_jsxs("li", { className: "flex items-center gap-1.5 text-ink-tertiary text-sm", children: [_jsx("span", { className: "w-14 shrink-0", children: i === 0 ? "Sort by" : "then" }), "A deleted property", _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Remove the sort by a deleted property", onClick: () => onChange(sorts.filter((_, k) => k !== i)), children: _jsx(X, {}) })] }, i));
|
|
80
|
+
return (
|
|
81
|
+
// By place, not property: changing a sort's property keeps its row (and focus).
|
|
82
|
+
_jsxs("li", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "w-14 text-ink-secondary text-sm shrink-0", children: i === 0 ? "Sort by" : "then" }), _jsx(SelectMenu, { label: "Property", value: property.id,
|
|
83
|
+
// Its own property, and those not yet sorted by.
|
|
84
|
+
options: [property.id, ...unused.map((p) => p.id)], render: (id) => byId.get(id)?.name ?? id, onChange: (id) => set(i, { property: id }), className: fieldClass }), _jsx(SelectMenu, { label: "Direction", value: sort.direction, options: ["asc", "desc"], render: (d) => (d === "asc" ? "Ascending" : "Descending"), onChange: (direction) => set(i, { direction }), className: fieldClass }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Remove the sort by ${property.name}`, className: "text-ink-tertiary", onClick: () => onChange(sorts.filter((_, k) => k !== i)), children: _jsx(X, {}) })] }, i));
|
|
85
|
+
}) }), unused.length > 0 && _jsx(AddProperty, { properties: unused, label: "Add a sort", onPick: (p) => onChange([...sorts, { property: p.id, direction: "asc" }]) })] }));
|
|
86
|
+
}
|
|
87
|
+
/* A toolbar button that opens a builder in a popover, saying how many are set. */
|
|
88
|
+
function CountButton({ icon, label, count, children }) {
|
|
89
|
+
const id = useId();
|
|
90
|
+
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", "aria-describedby": count > 0 ? id : undefined, className: cn(count > 0 && "text-accent-text"), children: [icon, label, count > 0 && (_jsxs("span", { id: id, className: "tabular-nums", children: [_jsx("span", { className: "sr-only", children: ", " }), count, _jsx("span", { className: "sr-only", children: " set" })] }))] }) }), _jsx(PopoverContent, { align: "start", className: "p-3 w-max max-w-[calc(100vw-2rem)]", children: children })] }));
|
|
91
|
+
}
|
|
92
|
+
export function FilterButton(props) {
|
|
93
|
+
return (_jsx(CountButton, { icon: _jsx(ListFilter, {}), label: "Filter", count: props.filters.length, children: _jsx(FilterBuilder, { ...props }) }));
|
|
94
|
+
}
|
|
95
|
+
export function SortButton(props) {
|
|
96
|
+
return (_jsx(CountButton, { icon: _jsx(ArrowDownWideNarrow, {}), label: "Sort", count: props.sorts.length, children: _jsx(SortBuilder, { ...props }) }));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=filter-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-builder.js","sourceRoot":"","sources":["../../../src/components/ui/filter-builder.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAoE,MAAM,uBAAuB,CAAC;AACrI,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAa,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAqB,CAAC;AAC/G,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,cAAc,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B,CACjB,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAwC;IAC/D,OAAO,CACH,KAAC,WAAW,IAAC,IAAI,EAAE,KAAC,mBAAmB,KAAG,EAAE,KAAK,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,YAC9E,KAAC,WAAW,OAAK,KAAK,GAAI,GAChB,CACjB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export declare function FocusShell({ brand, exit, footer, aside, width, children, className, }: {
|
|
3
|
+
brand?: ReactNode;
|
|
4
|
+
/** The way out, top right. */
|
|
5
|
+
exit?: ReactNode;
|
|
6
|
+
footer?: ReactNode;
|
|
7
|
+
/** Artwork or a pitch beside the task, from 64rem. */
|
|
8
|
+
aside?: ReactNode;
|
|
9
|
+
/** sm 24rem (a sign-in), md 28rem (a longer form). */
|
|
10
|
+
width?: "sm" | "md";
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=focus-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-shell.d.ts","sourceRoot":"","sources":["../../../src/components/ui/focus-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAY,EACZ,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,sDAAsD;IACtD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sDAAsD;IACtD,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAkBA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
/* The focus shell (docs/parts/layouts.md): no navigation, one task. The app's mark
|
|
4
|
+
at the top, a way out opposite it (Back, Cancel, Sign in), the task in a narrow
|
|
5
|
+
column in the middle of the room, and a quiet footer for the small print. For
|
|
6
|
+
signing in or up, onboarding, a checkout, a link to one shared thing.
|
|
7
|
+
|
|
8
|
+
`aside` splits the window from 64rem: the task on one side, artwork or a pitch on
|
|
9
|
+
the other. Below 64rem the aside is left out: on a phone the task is the page. */
|
|
10
|
+
export function FocusShell({ brand, exit, footer, aside, width = "sm", children, className, }) {
|
|
11
|
+
return (_jsxs("div", { className: cn("flex bg-surface min-h-dvh", className), children: [_jsxs("div", { className: "flex flex-col flex-1 min-w-0", children: [_jsxs("header", { className: "flex justify-between items-center gap-3 px-5 sm:px-8 h-14 shrink-0", children: [_jsx("div", { className: "flex items-center min-w-0", children: brand }), exit !== undefined && _jsx("div", { className: "flex items-center shrink-0", children: exit })] }), _jsx("main", { className: "flex flex-1 justify-center items-center px-5 sm:px-8 py-10", children: _jsx("div", { className: cn("w-full", width === "sm" ? "max-w-sm" : "max-w-md"), children: children }) }), footer !== undefined && (_jsx("footer", { className: "flex flex-wrap justify-center gap-x-4 gap-y-1 px-5 py-4 text-caption text-ink-tertiary [&_a]:link", children: footer }))] }), aside !== undefined && _jsx("aside", { className: "hidden lg:block relative bg-surface-sunken w-[45%] max-w-3xl overflow-hidden shrink-0", children: aside })] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=focus-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-shell.js","sourceRoot":"","sources":["../../../src/components/ui/focus-shell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;;;;;;oFAMoF;AACpF,MAAM,UAAU,UAAU,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,GAAG,IAAI,EACZ,QAAQ,EACR,SAAS,GAYZ;IACG,OAAO,CACH,eAAK,SAAS,EAAE,EAAE,CAAC,2BAA2B,EAAE,SAAS,CAAC,aACtD,eAAK,SAAS,EAAC,8BAA8B,aACzC,kBAAQ,SAAS,EAAC,oEAAoE,aAClF,cAAK,SAAS,EAAC,2BAA2B,YAAE,KAAK,GAAO,EACvD,IAAI,KAAK,SAAS,IAAI,cAAK,SAAS,EAAC,4BAA4B,YAAE,IAAI,GAAO,IAC1E,EACT,eAAM,SAAS,EAAC,4DAA4D,YACxE,cAAK,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,YAAG,QAAQ,GAAO,GACrF,EACN,MAAM,KAAK,SAAS,IAAI,CACrB,iBAAQ,SAAS,EAAC,mGAAmG,YAAE,MAAM,GAAU,CAC1I,IACC,EACL,KAAK,KAAK,SAAS,IAAI,gBAAO,SAAS,EAAC,uFAAuF,YAAE,KAAK,GAAS,IAC9I,CACT,CAAC;AACN,CAAC"}
|