@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,147 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
import { Children, isValidElement, type ComponentProps, type ReactNode } from "react";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { Spinner } from "./spinner.tsx";
|
|
8
|
+
|
|
9
|
+
/* Buttons are small (28–40px), lightly weighted and 4px-rounded. The loudest thing a
|
|
10
|
+
Notion button ever does is fill with the accent, and only one button per view
|
|
11
|
+
earns that. Everything else is a tint.
|
|
12
|
+
|
|
13
|
+
Every variant has its rest, hover, pressed, focus (the kit's ring) and disabled
|
|
14
|
+
look; a filled one's white text passes WCAG AA on every colour theme because it
|
|
15
|
+
sits on the deeper `-solid` fill. A link styled as a button is disabled with
|
|
16
|
+
aria-disabled, which looks and behaves the same. */
|
|
17
|
+
|
|
18
|
+
const buttonVariants = cva(
|
|
19
|
+
[
|
|
20
|
+
"inline-flex items-center justify-center gap-1.5 shrink-0 min-w-0 max-w-full relative",
|
|
21
|
+
"rounded-control font-medium whitespace-nowrap select-none",
|
|
22
|
+
"transition-[background-color,box-shadow,color] duration-(--duration-fast) ease-out-notion",
|
|
23
|
+
// Written out in full, so Tailwind finds them.
|
|
24
|
+
"disabled:pointer-events-none disabled:text-ink-disabled aria-disabled:pointer-events-none aria-disabled:text-ink-disabled",
|
|
25
|
+
"[&_svg]:shrink-0 [&_svg]:pointer-events-none",
|
|
26
|
+
],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
/** The one loud option. At most one per view. */
|
|
31
|
+
primary: [
|
|
32
|
+
"bg-accent-solid text-accent-ink hover:bg-accent-solid-hover active:bg-accent-solid-active",
|
|
33
|
+
"disabled:bg-tint-active aria-disabled:bg-tint-active",
|
|
34
|
+
],
|
|
35
|
+
/** The workhorse: the page's surface, a hairline ring, a whisper of lift. */
|
|
36
|
+
secondary: "bg-surface text-ink shadow-xs hover:bg-tint-hover active:bg-tint-active",
|
|
37
|
+
/** Invisible until hovered: toolbars, a row's actions. */
|
|
38
|
+
ghost: "text-ink hover:bg-tint-hover active:bg-tint-active",
|
|
39
|
+
/** Already tinted, for a second action that needs weight. */
|
|
40
|
+
subtle: "bg-tint-hover text-ink hover:bg-tint-active active:bg-tint-active active:shadow-edge",
|
|
41
|
+
/** Cannot be undone. Filled, like primary, so it is never the quiet choice. */
|
|
42
|
+
danger: [
|
|
43
|
+
"bg-danger-solid text-danger-ink hover:bg-danger-solid-hover active:bg-danger-solid-active",
|
|
44
|
+
"disabled:bg-tint-active aria-disabled:bg-tint-active",
|
|
45
|
+
],
|
|
46
|
+
/** Cannot be undone, in a menu or a row where a fill would shout. */
|
|
47
|
+
"danger-ghost": "text-danger hover:bg-danger-tint active:bg-danger-tint active:shadow-edge",
|
|
48
|
+
/** Over a picture: round, dark and blurred, so it reads against a bright sky as well as a dark one. */
|
|
49
|
+
"on-media": "rounded-full bg-on-media text-on-media-ink backdrop-blur-sm hover:bg-on-media-strong active:scale-90 transition-[opacity,scale,background-color]",
|
|
50
|
+
/** Words in a sentence that act. */
|
|
51
|
+
link: "link text-ink px-0! h-auto!",
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
/* A leading icon carries its own empty margin, so the left of the
|
|
55
|
+
button reads as roomier than the right. A little more on the right
|
|
56
|
+
evens the two out. */
|
|
57
|
+
sm: "h-control-sm px-2 text-sm [&_svg]:size-3.5 has-[>svg:first-child]:pr-2.5",
|
|
58
|
+
md: "h-control-md px-3 text-sm [&_svg]:size-4 has-[>svg:first-child]:pr-3.5",
|
|
59
|
+
lg: "h-control-lg px-4 text-body [&_svg]:size-4 has-[>svg:first-child]:pr-5",
|
|
60
|
+
/** Icon only, at each control height. Name it with aria-label. */
|
|
61
|
+
"icon-sm": "size-control-sm [&_svg]:size-3.5",
|
|
62
|
+
icon: "size-control-md [&_svg]:size-4",
|
|
63
|
+
"icon-lg": "size-control-lg [&_svg]:size-5",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: { variant: "secondary", size: "md" },
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
/* The colour a spinner takes in place of the label, per variant. */
|
|
71
|
+
const SPINNER_INK: Record<string, string> = {
|
|
72
|
+
primary: "text-accent-ink",
|
|
73
|
+
danger: "text-danger-ink",
|
|
74
|
+
"danger-ghost": "text-danger",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export interface ButtonProps extends ComponentProps<"button">, VariantProps<typeof buttonVariants> {
|
|
78
|
+
/** Render as the single child element (a router's link) instead of a <button>. */
|
|
79
|
+
asChild?: boolean;
|
|
80
|
+
/** Working: a spinner in place of the label, the width kept, presses ignored. */
|
|
81
|
+
loading?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* A label is wrapped so a long one can shorten with an ellipsis instead of pushing
|
|
85
|
+
out of its container; icons stay direct children for the padding rule above.
|
|
86
|
+
Neighbouring words ("Upload", 3, "photos") share one span: as separate flex
|
|
87
|
+
items the spaces between them would collapse. */
|
|
88
|
+
function labelled(children: ReactNode): ReactNode {
|
|
89
|
+
const out: ReactNode[] = [];
|
|
90
|
+
let words: (string | number)[] = [];
|
|
91
|
+
const flush = () => {
|
|
92
|
+
if (words.length) out.push(<span key={`label-${out.length}`} className="min-w-0 truncate">{words.join("")}</span>);
|
|
93
|
+
words = [];
|
|
94
|
+
};
|
|
95
|
+
// toArray drops empty children and keys the rest, so the list needs no keys of its own.
|
|
96
|
+
for (const child of Children.toArray(children)) {
|
|
97
|
+
if (typeof child === "string" || typeof child === "number") words.push(child);
|
|
98
|
+
else {
|
|
99
|
+
flush();
|
|
100
|
+
out.push(child);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
flush();
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare const process: { env: { NODE_ENV?: string } };
|
|
108
|
+
|
|
109
|
+
export function Button({ className, variant, size, asChild = false, loading = false, type, children, onClick, ...props }: ButtonProps) {
|
|
110
|
+
const iconOnly = typeof size === "string" && size.startsWith("icon");
|
|
111
|
+
if (process.env.NODE_ENV !== "production" && iconOnly && !props["aria-label"] && !props["aria-labelledby"] && !props.title) {
|
|
112
|
+
console.warn("paper-ui: an icon-only Button needs an aria-label (or aria-labelledby, or title) so a screen reader can name it.");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const classes = cn(buttonVariants({ variant, size }), loading && "text-transparent! [&>svg]:invisible", className);
|
|
116
|
+
|
|
117
|
+
if (asChild) {
|
|
118
|
+
const child = Children.only(children);
|
|
119
|
+
return (
|
|
120
|
+
<Slot className={classes} aria-busy={loading || undefined} onClick={onClick} {...props}>
|
|
121
|
+
{isValidElement(child) ? child : children}
|
|
122
|
+
</Slot>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<button
|
|
128
|
+
type={type ?? "button"}
|
|
129
|
+
className={classes}
|
|
130
|
+
aria-busy={loading || undefined}
|
|
131
|
+
data-loading={loading || undefined}
|
|
132
|
+
// Not `disabled` while loading: that would drop focus from the button the
|
|
133
|
+
// person just pressed, and grey it. It ignores presses instead.
|
|
134
|
+
onClick={loading ? (e) => e.preventDefault() : onClick}
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
{labelled(children)}
|
|
138
|
+
{loading && (
|
|
139
|
+
<span className="absolute inset-0 flex justify-center items-center">
|
|
140
|
+
<Spinner className={cn("size-4", SPINNER_INK[variant ?? "secondary"] ?? "text-ink")} />
|
|
141
|
+
</span>
|
|
142
|
+
)}
|
|
143
|
+
</button>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { buttonVariants };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef, type ComponentProps } from "react";
|
|
5
|
+
import { DayPicker, type DayButton } from "react-day-picker";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
|
|
8
|
+
/* A month of days, on react-day-picker: it supplies the grid, the keyboard and the
|
|
9
|
+
screen-reader labels; everything visible is here. Days are 32px with a mouse and
|
|
10
|
+
40px on a touch screen (seven of them still fit a 320px phone). Its own stylesheet is not
|
|
11
|
+
imported, so every part it draws has a class below.
|
|
12
|
+
|
|
13
|
+
The week starts on Monday. Pass `weekStartsOn={0}` for Sunday. */
|
|
14
|
+
export function Calendar({ className, classNames, components, ...props }: ComponentProps<typeof DayPicker>) {
|
|
15
|
+
return (
|
|
16
|
+
<DayPicker
|
|
17
|
+
showOutsideDays
|
|
18
|
+
// Always six rows, so the panel does not change height from month to month.
|
|
19
|
+
fixedWeeks
|
|
20
|
+
weekStartsOn={1}
|
|
21
|
+
className={cn("relative w-fit p-3 select-none", className)}
|
|
22
|
+
classNames={{
|
|
23
|
+
months: "flex flex-col gap-4 sm:flex-row",
|
|
24
|
+
month: "flex flex-col gap-2",
|
|
25
|
+
month_caption: "flex h-7 items-center justify-center px-8",
|
|
26
|
+
caption_label: "text-sm font-medium text-ink",
|
|
27
|
+
// Laid over the caption row; the buttons take the clicks, the gap between them does not.
|
|
28
|
+
nav: "absolute inset-x-3 top-3 flex h-7 items-center justify-between pointer-events-none",
|
|
29
|
+
button_previous: NAV_BUTTON,
|
|
30
|
+
button_next: NAV_BUTTON,
|
|
31
|
+
month_grid: "border-collapse",
|
|
32
|
+
weekday: "size-8 [@media(pointer:coarse)]:size-10 p-0 text-caption font-normal text-ink-tertiary",
|
|
33
|
+
day: "size-8 [@media(pointer:coarse)]:size-10 p-0 text-center",
|
|
34
|
+
range_start: "rounded-l-control bg-accent-tint",
|
|
35
|
+
range_middle: "bg-accent-tint",
|
|
36
|
+
range_end: "rounded-r-control bg-accent-tint",
|
|
37
|
+
hidden: "invisible",
|
|
38
|
+
...classNames,
|
|
39
|
+
}}
|
|
40
|
+
components={{
|
|
41
|
+
Chevron: ({ orientation, className: chevronClass }) =>
|
|
42
|
+
orientation === "left" ? (
|
|
43
|
+
<ChevronLeft className={cn("size-4", chevronClass)} />
|
|
44
|
+
) : (
|
|
45
|
+
<ChevronRight className={cn("size-4", chevronClass)} />
|
|
46
|
+
),
|
|
47
|
+
DayButton: CalendarDayButton,
|
|
48
|
+
...components,
|
|
49
|
+
}}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const NAV_BUTTON =
|
|
56
|
+
"pointer-events-auto inline-flex size-7 [@media(pointer:coarse)]:size-10 items-center justify-center rounded-control text-ink-secondary transition-colors duration-(--duration-fast) hover:bg-tint-hover hover:text-ink aria-disabled:pointer-events-none aria-disabled:text-ink-disabled";
|
|
57
|
+
|
|
58
|
+
/* The day itself. The states are resolved here, in order, rather than as classes on
|
|
59
|
+
the cell, because several hold at once (today, outside the month, chosen) and the
|
|
60
|
+
last one named has to win whatever order the stylesheet was built in. */
|
|
61
|
+
function CalendarDayButton({ className, day: _day, modifiers, ...props }: ComponentProps<typeof DayButton>) {
|
|
62
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
63
|
+
|
|
64
|
+
// The library moves focus by flag, not by calling focus, so arrow keys need this.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (modifiers.focused) ref.current?.focus();
|
|
67
|
+
}, [modifiers.focused]);
|
|
68
|
+
|
|
69
|
+
const inRange = modifiers.range_middle === true;
|
|
70
|
+
const chosen = modifiers.selected === true && !inRange;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<button
|
|
74
|
+
ref={ref}
|
|
75
|
+
type="button"
|
|
76
|
+
className={cn(
|
|
77
|
+
"inline-flex size-8 [@media(pointer:coarse)]:size-10 items-center justify-center rounded-control text-sm text-ink tabular-nums cursor-pointer",
|
|
78
|
+
"transition-colors duration-(--duration-instant) hover:bg-tint-hover",
|
|
79
|
+
modifiers.outside && "text-ink-tertiary",
|
|
80
|
+
modifiers.today && "font-semibold shadow-[inset_0_0_0_1px_var(--hairline-strong)]",
|
|
81
|
+
inRange && "rounded-none hover:bg-accent-tint",
|
|
82
|
+
chosen && "bg-accent-solid font-medium text-accent-ink shadow-none hover:bg-accent-solid-hover",
|
|
83
|
+
modifiers.disabled && "pointer-events-none text-ink-disabled shadow-none",
|
|
84
|
+
className,
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* For `onOpenAutoFocus` on a popover that holds a calendar: puts focus on the day
|
|
92
|
+
the arrow keys start from (the chosen one, or today) rather than on the first
|
|
93
|
+
thing in the panel, which is the previous-month arrow.
|
|
94
|
+
|
|
95
|
+
It has to happen here and not through the calendar's own `autoFocus`. Inside a
|
|
96
|
+
dialog that fires before the popover has taken over the dialog's focus trap, and
|
|
97
|
+
the dialog pulls focus straight back. */
|
|
98
|
+
export function focusCalendarDay(event: Event): void {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
(event.currentTarget as HTMLElement | null)?.querySelector<HTMLElement>('td button[tabindex="0"]')?.focus();
|
|
101
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { CircleAlert, CircleCheck, Info, TriangleAlert } from "lucide-react";
|
|
3
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.ts";
|
|
5
|
+
|
|
6
|
+
/* Notion's callout block: a tinted panel with an emoji or icon in the gutter. It
|
|
7
|
+
borrows one of the nine, so a callout never brings a new colour to the page. The
|
|
8
|
+
words are in the page's own ink (on a tinted ground the secondary ink read at
|
|
9
|
+
3.9:1); the icon is decoration and is hidden from assistive technology.
|
|
10
|
+
|
|
11
|
+
`tone` is the short way to a status: success, warning, info or danger, each its
|
|
12
|
+
colour and an icon. `color` and `icon` choose freely. A callout is a note
|
|
13
|
+
(role="note"); for something that must be heard at once, a Toast. */
|
|
14
|
+
|
|
15
|
+
const calloutVariants = cva("flex gap-3 p-4 rounded-surface text-ink text-sm leading-prose", {
|
|
16
|
+
variants: {
|
|
17
|
+
color: {
|
|
18
|
+
gray: "bg-tag-gray-bg",
|
|
19
|
+
brown: "bg-tag-brown-bg",
|
|
20
|
+
orange: "bg-tag-orange-bg",
|
|
21
|
+
yellow: "bg-tag-yellow-bg",
|
|
22
|
+
green: "bg-tag-green-bg",
|
|
23
|
+
blue: "bg-tag-blue-bg",
|
|
24
|
+
purple: "bg-tag-purple-bg",
|
|
25
|
+
pink: "bg-tag-pink-bg",
|
|
26
|
+
red: "bg-tag-red-bg",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { color: "gray" },
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const TONES = {
|
|
33
|
+
success: { color: "green", icon: <CircleCheck className="text-success" /> },
|
|
34
|
+
warning: { color: "yellow", icon: <TriangleAlert className="text-warning" /> },
|
|
35
|
+
info: { color: "blue", icon: <Info className="text-info" /> },
|
|
36
|
+
danger: { color: "red", icon: <CircleAlert className="text-danger" /> },
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
export interface CalloutProps extends Omit<ComponentProps<"div">, "color" | "title">, VariantProps<typeof calloutVariants> {
|
|
40
|
+
/** An emoji or an icon. */
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
title?: ReactNode;
|
|
43
|
+
tone?: keyof typeof TONES;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function Callout({ className, color, tone, icon, title, children, ...props }: CalloutProps) {
|
|
47
|
+
const t = tone ? TONES[tone] : undefined;
|
|
48
|
+
return (
|
|
49
|
+
<div role="note" className={cn(calloutVariants({ color: color ?? t?.color }), className)} {...props}>
|
|
50
|
+
<span aria-hidden className="flex-shrink-0 mt-px text-body leading-snug [&_svg]:size-4 [&_svg]:mt-0.5">
|
|
51
|
+
{icon ?? t?.icon ?? "💡"}
|
|
52
|
+
</span>
|
|
53
|
+
<div className="min-w-0">
|
|
54
|
+
{title && <p className="mb-1 font-semibold">{title}</p>}
|
|
55
|
+
<div className="[&_p+p]:mt-2">{children}</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { calloutVariants };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import type { ComponentProps, ElementType } from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
4
|
+
|
|
5
|
+
/* A card is a hairline and a whisper of shadow. No heavy border, no drop shadow you
|
|
6
|
+
can point at. The `interactive` variant is the only place depth animates, and it
|
|
7
|
+
moves 1px, not 6.
|
|
8
|
+
|
|
9
|
+
An interactive card is a link or a button, so the keyboard can reach and press
|
|
10
|
+
it: render it as one with `asChild` (`<Card interactive asChild><a href>…`). A
|
|
11
|
+
div that only reacts to the mouse is out of reach for everyone else. */
|
|
12
|
+
|
|
13
|
+
export interface CardProps extends ComponentProps<"div"> {
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
/** Sit flush on a sunken surface with no lift of its own. */
|
|
16
|
+
flat?: boolean;
|
|
17
|
+
/** Render as the single child (a link, a button) instead of a div. */
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function Card({ className, interactive, flat, asChild = false, ...props }: CardProps) {
|
|
22
|
+
const Comp = asChild ? Slot : "div";
|
|
23
|
+
return (
|
|
24
|
+
<Comp
|
|
25
|
+
className={cn(
|
|
26
|
+
"block bg-surface-raised rounded-surface overflow-hidden text-left",
|
|
27
|
+
flat ? "border border-hairline" : "shadow-sm",
|
|
28
|
+
interactive && [
|
|
29
|
+
"transition-[box-shadow,transform] duration-(--duration-base) ease-out-notion outline-offset-2",
|
|
30
|
+
"hover:shadow-md hover:-translate-y-px cursor-pointer",
|
|
31
|
+
"active:translate-y-0 active:shadow-sm",
|
|
32
|
+
],
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function CardHeader({ className, ...props }: ComponentProps<"div">) {
|
|
41
|
+
return <div className={cn("px-4 pt-4 pb-0", className)} {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The card's name. An h3 unless `as` says otherwise, to fit the page's outline. */
|
|
45
|
+
export function CardTitle({ className, as: Tag = "h3", ...props }: ComponentProps<"h3"> & { as?: ElementType }) {
|
|
46
|
+
return <Tag className={cn("my-0 font-semibold text-h3 text-ink", className)} {...props} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function CardDescription({ className, ...props }: ComponentProps<"p">) {
|
|
50
|
+
return <p className={cn("mt-1 text-ink-secondary text-sm", className)} {...props} />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function CardContent({ className, ...props }: ComponentProps<"div">) {
|
|
54
|
+
return <div className={cn("p-4", className)} {...props} />;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function CardFooter({ className, ...props }: ComponentProps<"div">) {
|
|
58
|
+
return <div className={cn("flex flex-wrap items-center gap-2 px-4 py-3 border-hairline border-t", className)} {...props} />;
|
|
59
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
4
|
+
import { Check, Minus } from "lucide-react";
|
|
5
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
import { ChoiceLabel } from "./choice-label.tsx";
|
|
8
|
+
import { fromField, useField } from "./input.tsx";
|
|
9
|
+
|
|
10
|
+
/* Notion's to-do box: a 16px square whose empty edge reads at 3:1 (--control-edge)
|
|
11
|
+
and that fills with the accent when ticked. Its pressable area is 24px. It can be
|
|
12
|
+
partly ticked ("indeterminate"), for a row that stands for several. With `name`
|
|
13
|
+
it sends its value with a form; inside a Field it takes the Field's label and
|
|
14
|
+
error. With `label` (and `description`) it draws its own words, pressable too. */
|
|
15
|
+
|
|
16
|
+
export const checkboxBox = [
|
|
17
|
+
"peer relative flex justify-center items-center rounded-small size-4 shrink-0 outline-offset-2",
|
|
18
|
+
"shadow-[inset_0_0_0_1.5px_var(--control-edge)] transition-[background-color,box-shadow] duration-(--duration-fast)",
|
|
19
|
+
"hover:bg-tint-hover",
|
|
20
|
+
"data-[state=checked]:bg-accent-solid data-[state=checked]:text-accent-ink data-[state=checked]:shadow-none data-[state=checked]:hover:bg-accent-solid-hover",
|
|
21
|
+
"data-[state=indeterminate]:bg-accent-solid data-[state=indeterminate]:text-accent-ink data-[state=indeterminate]:shadow-none",
|
|
22
|
+
"aria-invalid:shadow-[inset_0_0_0_1.5px_var(--danger)]",
|
|
23
|
+
"disabled:cursor-not-allowed disabled:bg-tint-hover disabled:shadow-[inset_0_0_0_1.5px_var(--hairline-strong)] disabled:text-ink-disabled",
|
|
24
|
+
// Ticked but disabled: grey, so it never looks like a choice that can be changed.
|
|
25
|
+
"disabled:data-[state=checked]:bg-tint-active disabled:data-[state=checked]:text-ink-disabled disabled:data-[state=indeterminate]:bg-tint-active disabled:data-[state=indeterminate]:text-ink-disabled",
|
|
26
|
+
// 24px to press, around the 16px box.
|
|
27
|
+
"after:absolute after:-inset-1 after:content-['']",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export function Checkbox({
|
|
31
|
+
checked,
|
|
32
|
+
onCheckedChange,
|
|
33
|
+
label,
|
|
34
|
+
description,
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}: Omit<ComponentProps<typeof CheckboxPrimitive.Root>, "onCheckedChange" | "checked"> & {
|
|
38
|
+
checked?: boolean | "indeterminate";
|
|
39
|
+
/** Ticked or not. A partly ticked box becomes ticked when pressed. */
|
|
40
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
41
|
+
label?: ReactNode;
|
|
42
|
+
description?: ReactNode;
|
|
43
|
+
}) {
|
|
44
|
+
const own = fromField(useField(), props);
|
|
45
|
+
return (
|
|
46
|
+
<ChoiceLabel
|
|
47
|
+
label={label}
|
|
48
|
+
description={description}
|
|
49
|
+
disabled={own.disabled}
|
|
50
|
+
control={({ labelId, descriptionId }) => (
|
|
51
|
+
<CheckboxPrimitive.Root
|
|
52
|
+
checked={checked}
|
|
53
|
+
onCheckedChange={(next) => onCheckedChange?.(next === true)}
|
|
54
|
+
aria-labelledby={own["aria-labelledby"] ?? labelId}
|
|
55
|
+
{...own}
|
|
56
|
+
aria-describedby={[own["aria-describedby"], descriptionId].filter(Boolean).join(" ") || undefined}
|
|
57
|
+
className={cn(checkboxBox, className)}
|
|
58
|
+
>
|
|
59
|
+
<CheckboxPrimitive.Indicator className="flex">
|
|
60
|
+
{checked === "indeterminate" ? <Minus className="size-3" strokeWidth={3} /> : <Check className="size-3" strokeWidth={3} />}
|
|
61
|
+
</CheckboxPrimitive.Indicator>
|
|
62
|
+
</CheckboxPrimitive.Root>
|
|
63
|
+
)}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useId, type ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* The words beside a checkbox, switch or radio: a label that is part of the
|
|
5
|
+
control (pressing it presses the control) and an optional line under it. The
|
|
6
|
+
control comes first for a checkbox or radio, last for a switch. */
|
|
7
|
+
export function ChoiceLabel({
|
|
8
|
+
control,
|
|
9
|
+
label,
|
|
10
|
+
description,
|
|
11
|
+
disabled,
|
|
12
|
+
end = false,
|
|
13
|
+
className,
|
|
14
|
+
}: {
|
|
15
|
+
control: (ids: { labelId?: string; descriptionId?: string }) => ReactNode;
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
end?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
}) {
|
|
22
|
+
const id = useId();
|
|
23
|
+
if (label === undefined) return <>{control({})}</>;
|
|
24
|
+
const labelId = `${id}-label`;
|
|
25
|
+
const descriptionId = description !== undefined ? `${id}-description` : undefined;
|
|
26
|
+
return (
|
|
27
|
+
// A <label> around both: a press anywhere on the words presses the control.
|
|
28
|
+
<label className={cn("group/choice flex items-start gap-2.5 text-sm cursor-pointer", disabled && "cursor-not-allowed", end && "flex-row-reverse justify-between", className)}>
|
|
29
|
+
{/* The control is centred on the first line of the label (1.5 × 14px). */}
|
|
30
|
+
<span className="flex items-center h-[1.3125rem] shrink-0">{control({ labelId, descriptionId })}</span>
|
|
31
|
+
<span className="min-w-0">
|
|
32
|
+
<span id={labelId} className={cn("block text-ink", disabled && "text-ink-disabled")}>
|
|
33
|
+
{label}
|
|
34
|
+
</span>
|
|
35
|
+
{description !== undefined && (
|
|
36
|
+
<span id={descriptionId} className={cn("block mt-0.5 text-caption text-ink-tertiary", disabled && "text-ink-disabled")}>
|
|
37
|
+
{description}
|
|
38
|
+
</span>
|
|
39
|
+
)}
|
|
40
|
+
</span>
|
|
41
|
+
</label>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
|
|
8
|
+
/* Something folded away: Notion's toggle. A trigger with a chevron that turns, and
|
|
9
|
+
the content easing open to its own height. The trigger says whether it is open
|
|
10
|
+
(aria-expanded) and what it opens. The parts are Radix's; `Disclosure` is the
|
|
11
|
+
whole thing in one. */
|
|
12
|
+
|
|
13
|
+
export const Collapsible = CollapsiblePrimitive.Root;
|
|
14
|
+
|
|
15
|
+
export function CollapsibleTrigger({ className, children, ...props }: ComponentProps<typeof CollapsiblePrimitive.Trigger>) {
|
|
16
|
+
return (
|
|
17
|
+
<CollapsiblePrimitive.Trigger
|
|
18
|
+
className={cn(
|
|
19
|
+
"group/trigger flex items-center gap-1 -ml-1 px-1 rounded-control min-h-control-sm font-medium text-ink text-sm text-left",
|
|
20
|
+
"hover:bg-tint-hover transition-colors duration-(--duration-instant)",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
<ChevronRight
|
|
26
|
+
aria-hidden
|
|
27
|
+
className="size-4 text-ink-tertiary group-data-[state=open]/trigger:rotate-90 transition-transform duration-(--duration-fast) shrink-0"
|
|
28
|
+
/>
|
|
29
|
+
{children}
|
|
30
|
+
</CollapsiblePrimitive.Trigger>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function CollapsibleContent({ className, ...props }: ComponentProps<typeof CollapsiblePrimitive.Content>) {
|
|
35
|
+
return (
|
|
36
|
+
<CollapsiblePrimitive.Content
|
|
37
|
+
className={cn("overflow-hidden data-[state=closed]:animate-collapse-up data-[state=open]:animate-collapse-down", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A titled toggle in one: closed unless `defaultOpen` (or controlled with `open`). */
|
|
44
|
+
export function Disclosure({
|
|
45
|
+
title,
|
|
46
|
+
children,
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}: Omit<ComponentProps<typeof CollapsiblePrimitive.Root>, "title"> & { title: ReactNode }) {
|
|
50
|
+
return (
|
|
51
|
+
<Collapsible className={className} {...props}>
|
|
52
|
+
<CollapsibleTrigger>{title}</CollapsibleTrigger>
|
|
53
|
+
<CollapsibleContent>
|
|
54
|
+
<div className="pt-1 pb-2 pl-5 text-ink-secondary text-sm">{children}</div>
|
|
55
|
+
</CollapsibleContent>
|
|
56
|
+
</Collapsible>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
import { Page, PageHeader } from "./page.tsx";
|
|
4
|
+
|
|
5
|
+
/* A page of many things to browse: a library, trips, items. The page's name and
|
|
6
|
+
its actions, then a toolbar (CollectionToolbar) that sticks under the top of the
|
|
7
|
+
page while the grid, list or table scrolls under it. Wide by default. */
|
|
8
|
+
export function CollectionLayout({
|
|
9
|
+
title,
|
|
10
|
+
lead,
|
|
11
|
+
actions,
|
|
12
|
+
toolbar,
|
|
13
|
+
stickyTop = "top-0",
|
|
14
|
+
width = "wide",
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
}: {
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
lead?: ReactNode;
|
|
20
|
+
actions?: ReactNode;
|
|
21
|
+
toolbar?: ReactNode;
|
|
22
|
+
/** Where the toolbar sticks: `top-11` under a HeaderBar, `top-14` under a TopBarShell. */
|
|
23
|
+
stickyTop?: string;
|
|
24
|
+
width?: "reading" | "wide";
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<Page width={width} className={className}>
|
|
30
|
+
<PageHeader title={title} lead={lead} actions={actions} />
|
|
31
|
+
{toolbar !== undefined && <div className={cn("z-(--z-sticky) sticky bg-surface -mx-2 mb-4 px-2 py-2", stickyTop)}>{toolbar}</div>}
|
|
32
|
+
{children}
|
|
33
|
+
</Page>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* What a collection is narrowed and shown by: a search, filters, a count, and the
|
|
38
|
+
view switch at the end. It wraps on a narrow screen: the search takes the row,
|
|
39
|
+
and the filters scroll sideways in theirs rather than wrapping line after line. */
|
|
40
|
+
export function CollectionToolbar({
|
|
41
|
+
search,
|
|
42
|
+
filters,
|
|
43
|
+
count,
|
|
44
|
+
view,
|
|
45
|
+
className,
|
|
46
|
+
}: {
|
|
47
|
+
/** A SearchField. */
|
|
48
|
+
search?: ReactNode;
|
|
49
|
+
/** SelectMenus, Toggles, a Sort menu. */
|
|
50
|
+
filters?: ReactNode;
|
|
51
|
+
/** "128 photos". */
|
|
52
|
+
count?: ReactNode;
|
|
53
|
+
/** A Segmented of grid / list / table. */
|
|
54
|
+
view?: ReactNode;
|
|
55
|
+
className?: string;
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<div role="toolbar" aria-label="Collection" className={cn("flex flex-wrap items-center gap-2", className)}>
|
|
59
|
+
{search !== undefined && <div className="flex-1 max-w-xs min-w-[min(12rem,100%)] max-sm:max-w-none max-sm:basis-full">{search}</div>}
|
|
60
|
+
{filters !== undefined && (
|
|
61
|
+
<div className="flex items-center gap-1 max-sm:-mx-1 max-sm:px-1 max-sm:max-w-full overflow-x-auto [scrollbar-width:none]">{filters}</div>
|
|
62
|
+
)}
|
|
63
|
+
<div className="flex items-center gap-3 ml-auto">
|
|
64
|
+
{count !== undefined && <span className="tabular-nums text-ink-tertiary text-sm whitespace-nowrap">{count}</span>}
|
|
65
|
+
{view}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|