@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,245 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { Search, X } from "lucide-react";
|
|
5
|
+
import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState, } from "react";
|
|
6
|
+
import { clamp, parseNumber } from "../../lib/number.js";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
8
|
+
import { useEscapeFirst } from "../../hooks/use-escape-first.js";
|
|
9
|
+
const FieldContext = createContext(null);
|
|
10
|
+
/** For a control inside a Field: its id, description, and invalid, required and disabled states. Null outside a Field. */
|
|
11
|
+
export const useField = () => useContext(FieldContext);
|
|
12
|
+
/* What a control takes from the Field around it, unless it was given its own. */
|
|
13
|
+
function fromField(field, props) {
|
|
14
|
+
if (!field)
|
|
15
|
+
return props;
|
|
16
|
+
const describedBy = [props["aria-describedby"], field.describedBy].filter(Boolean).join(" ") || undefined;
|
|
17
|
+
return {
|
|
18
|
+
...props,
|
|
19
|
+
id: props.id ?? field.id,
|
|
20
|
+
"aria-describedby": describedBy,
|
|
21
|
+
"aria-invalid": props["aria-invalid"] ?? (field.invalid || undefined),
|
|
22
|
+
required: props.required ?? field.required,
|
|
23
|
+
disabled: props.disabled ?? field.disabled,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function Label({ className, required, children, ...props }) {
|
|
27
|
+
return (_jsxs("label", { className: cn("block mb-1.5 font-medium text-ink-secondary text-caption", className), ...props, children: [children, required && (_jsx("span", { "aria-hidden": true, className: "ml-0.5 text-ink-tertiary", children: "*" }))] }));
|
|
28
|
+
}
|
|
29
|
+
/** A label, a control, and a hint or an error, wired together: the label names the control, the hint and error describe it, an error marks it invalid and is announced. */
|
|
30
|
+
export function Field({ label, hint, error, htmlFor, required, disabled, children, className, }) {
|
|
31
|
+
const made = useId();
|
|
32
|
+
const id = htmlFor ?? made;
|
|
33
|
+
const hintId = `${id}-hint`;
|
|
34
|
+
const errorId = `${id}-error`;
|
|
35
|
+
const hasError = error !== undefined && error !== null && error !== false && error !== "";
|
|
36
|
+
const hasHint = !hasError && hint !== undefined && hint !== null && hint !== "";
|
|
37
|
+
const describedBy = hasError ? errorId : hasHint ? hintId : undefined;
|
|
38
|
+
return (_jsx(FieldContext.Provider, { value: { id, labelId: `${id}-label`, describedBy, invalid: hasError, required, disabled }, children: _jsxs("div", { className: cn("w-full", disabled && "[&>label]:text-ink-disabled", className), children: [label !== undefined && (_jsx(Label, { htmlFor: id, id: `${id}-label`, required: required, children: label })), children, hasHint && (_jsx("p", { id: hintId, className: "mt-1.5 text-caption text-ink-tertiary", children: hint })), _jsx("p", { id: errorId, "aria-live": "polite", className: cn("text-caption text-danger", hasError && "mt-1.5"), children: hasError ? error : null })] }) }));
|
|
39
|
+
}
|
|
40
|
+
/* ── The look ─────────────────────────────────────────────────────────────────── */
|
|
41
|
+
/* Written twice, once for a lone control (its own :focus, [aria-invalid]) and once
|
|
42
|
+
for a group holding a control with something before or after it (:focus-within,
|
|
43
|
+
and the control's states through has-[]). Kept side by side so they stay alike. */
|
|
44
|
+
const wellLook = {
|
|
45
|
+
field: {
|
|
46
|
+
self: [
|
|
47
|
+
"bg-tint-hover shadow-[inset_0_0_0_1px_var(--hairline-strong)] hover:bg-tint-active",
|
|
48
|
+
"focus:bg-surface focus:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
49
|
+
"aria-invalid:shadow-[inset_0_0_0_1px_var(--danger)] aria-invalid:focus:shadow-[inset_0_0_0_1px_var(--danger),0_0_0_3px_var(--danger-tint)]",
|
|
50
|
+
"[&[readonly]]:bg-transparent [&[readonly]]:hover:bg-transparent [&[readonly]]:shadow-edge",
|
|
51
|
+
"disabled:bg-tint-hover disabled:shadow-edge",
|
|
52
|
+
],
|
|
53
|
+
group: [
|
|
54
|
+
"bg-tint-hover shadow-[inset_0_0_0_1px_var(--hairline-strong)] hover:bg-tint-active",
|
|
55
|
+
"focus-within:bg-surface focus-within:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
56
|
+
"has-[input[aria-invalid=true]]:shadow-[inset_0_0_0_1px_var(--danger)] has-[input[aria-invalid=true]]:focus-within:shadow-[inset_0_0_0_1px_var(--danger),0_0_0_3px_var(--danger-tint)]",
|
|
57
|
+
"has-[input[readonly]]:bg-transparent has-[input[readonly]]:hover:bg-transparent has-[input[readonly]]:shadow-edge",
|
|
58
|
+
"has-[input:disabled]:bg-tint-hover has-[input:disabled]:shadow-edge",
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
quiet: {
|
|
62
|
+
self: [
|
|
63
|
+
"bg-transparent hover:bg-tint-hover",
|
|
64
|
+
"focus:bg-surface focus:shadow-[inset_0_0_0_1px_var(--accent)]",
|
|
65
|
+
"aria-invalid:shadow-[inset_0_0_0_1px_var(--danger)] aria-invalid:focus:shadow-[inset_0_0_0_1px_var(--danger)]",
|
|
66
|
+
"[&[readonly]]:hover:bg-transparent",
|
|
67
|
+
],
|
|
68
|
+
group: [
|
|
69
|
+
"bg-transparent hover:bg-tint-hover",
|
|
70
|
+
"focus-within:bg-surface focus-within:shadow-[inset_0_0_0_1px_var(--accent)]",
|
|
71
|
+
"has-[input[aria-invalid=true]]:shadow-[inset_0_0_0_1px_var(--danger)]",
|
|
72
|
+
"has-[input[readonly]]:hover:bg-transparent",
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
const shared = [
|
|
77
|
+
"w-full min-w-0 rounded-control text-ink outline-none",
|
|
78
|
+
"transition-[background-color,box-shadow] duration-(--duration-fast) ease-out-notion",
|
|
79
|
+
];
|
|
80
|
+
const sizes = {
|
|
81
|
+
// 16px on a phone, so iOS does not zoom in; 14px from sm up (lg stays 16px).
|
|
82
|
+
sm: "h-control-sm px-2 text-body sm:text-sm",
|
|
83
|
+
md: "h-control-md px-2.5 text-body sm:text-sm",
|
|
84
|
+
lg: "h-control-lg px-3 text-body",
|
|
85
|
+
};
|
|
86
|
+
const controlVariants = cva([
|
|
87
|
+
...shared,
|
|
88
|
+
"placeholder:text-ink-placeholder disabled:text-ink-disabled disabled:cursor-not-allowed disabled:placeholder:text-ink-disabled",
|
|
89
|
+
// Browser autofill keeps the kit's colours instead of painting the field yellow.
|
|
90
|
+
"autofill:shadow-[inset_0_0_0_100rem_var(--surface),inset_0_0_0_1px_var(--hairline-strong)] autofill:[-webkit-text-fill-color:var(--ink)]",
|
|
91
|
+
// The browser's own clear button on type=search; SearchField draws its own.
|
|
92
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
93
|
+
], {
|
|
94
|
+
variants: {
|
|
95
|
+
variant: { field: wellLook.field.self, quiet: wellLook.quiet.self },
|
|
96
|
+
size: sizes,
|
|
97
|
+
},
|
|
98
|
+
defaultVariants: { variant: "field", size: "md" },
|
|
99
|
+
});
|
|
100
|
+
const groupVariants = cva([...shared, "flex items-center gap-2 cursor-text has-[input:disabled]:cursor-not-allowed [&>span]:text-ink-tertiary [&>span]:shrink-0 [&_svg]:size-4"], {
|
|
101
|
+
variants: {
|
|
102
|
+
variant: { field: wellLook.field.group, quiet: wellLook.quiet.group },
|
|
103
|
+
size: sizes,
|
|
104
|
+
},
|
|
105
|
+
defaultVariants: { variant: "field", size: "md" },
|
|
106
|
+
});
|
|
107
|
+
/** The classes of a text field, for a control the kit does not provide (a native select, a button that opens a picker). */
|
|
108
|
+
export const fieldBase = controlVariants({ variant: "field", size: "md" });
|
|
109
|
+
/** The same, at any variant and size. */
|
|
110
|
+
export const fieldVariants = controlVariants;
|
|
111
|
+
/** What a control takes from the Field around it, unless it was given its own: id, description, invalid, required, disabled. */
|
|
112
|
+
export { fromField };
|
|
113
|
+
export function Input({ className, type = "text", variant, size, start, end, ...props }) {
|
|
114
|
+
const field = useField();
|
|
115
|
+
const own = fromField(field, props);
|
|
116
|
+
if (start === undefined && end === undefined) {
|
|
117
|
+
return _jsx("input", { type: type, className: cn(controlVariants({ variant, size }), className), ...own });
|
|
118
|
+
}
|
|
119
|
+
return (_jsxs("div", { "data-slot": "input-group", className: cn(groupVariants({ variant, size }), className),
|
|
120
|
+
// A press on the "$" or the unit puts the caret in the field, as if part of it.
|
|
121
|
+
onPointerDown: (e) => {
|
|
122
|
+
const input = e.currentTarget.querySelector("input");
|
|
123
|
+
if (input && e.target !== input && !e.target.closest("button")) {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
input.focus();
|
|
126
|
+
}
|
|
127
|
+
}, children: [start !== undefined && _jsx("span", { className: "flex items-center", children: start }), _jsx("input", { type: type, className: "flex-1 bg-transparent placeholder:text-ink-placeholder disabled:placeholder:text-ink-disabled h-full min-w-0 [&::-webkit-search-cancel-button]:appearance-none outline-none disabled:text-ink-disabled", ...own }), end !== undefined && _jsx("span", { className: "flex items-center", children: end })] }));
|
|
128
|
+
}
|
|
129
|
+
/** Input's quiet variant: no well until hovered or focused, for a record's properties. */
|
|
130
|
+
export function QuietInput(props) {
|
|
131
|
+
return _jsx(Input, { variant: "quiet", size: "sm", ...props });
|
|
132
|
+
}
|
|
133
|
+
/* ── Textarea ────────────────────────────────────────────────────────────────── */
|
|
134
|
+
const canSizeToContent = () => typeof CSS !== "undefined" && CSS.supports("field-sizing", "content");
|
|
135
|
+
/** A Ref merged with the component's own, so both see the element. */
|
|
136
|
+
function useMergedRef(outer) {
|
|
137
|
+
const inner = useRef(null);
|
|
138
|
+
const set = (node) => {
|
|
139
|
+
inner.current = node;
|
|
140
|
+
if (typeof outer === "function")
|
|
141
|
+
outer(node);
|
|
142
|
+
else if (outer)
|
|
143
|
+
outer.current = node;
|
|
144
|
+
};
|
|
145
|
+
return [inner, set];
|
|
146
|
+
}
|
|
147
|
+
export function Textarea({ className, variant, size, rows = 4, autoGrow = false, maxRows, ref, onInput, ...props }) {
|
|
148
|
+
const field = useField();
|
|
149
|
+
const [inner, setRef] = useMergedRef(ref);
|
|
150
|
+
// Where the browser cannot size a field to its content (Safari, Firefox in 2026),
|
|
151
|
+
// the height is set from the scroll height on every change.
|
|
152
|
+
const fallback = autoGrow && !canSizeToContent();
|
|
153
|
+
const fit = () => {
|
|
154
|
+
const el = inner.current;
|
|
155
|
+
if (!el || !fallback)
|
|
156
|
+
return;
|
|
157
|
+
el.style.height = "auto";
|
|
158
|
+
el.style.height = `${el.scrollHeight + 2}px`;
|
|
159
|
+
};
|
|
160
|
+
useLayoutEffect(fit);
|
|
161
|
+
const lineHeight = 1.5;
|
|
162
|
+
return (_jsx("textarea", { ref: setRef, rows: rows, onInput: (e) => {
|
|
163
|
+
onInput?.(e);
|
|
164
|
+
fit();
|
|
165
|
+
}, style: autoGrow
|
|
166
|
+
? {
|
|
167
|
+
minHeight: `calc(${rows} * ${lineHeight}em + 1rem)`,
|
|
168
|
+
maxHeight: maxRows ? `calc(${maxRows} * ${lineHeight}em + 1rem)` : undefined,
|
|
169
|
+
...props.style,
|
|
170
|
+
}
|
|
171
|
+
: props.style, className: cn(controlVariants({ variant, size }), "h-auto py-2 leading-normal", autoGrow ? "resize-none overflow-y-auto field-sizing-content" : "resize-y", className), ...fromField(field, props) }));
|
|
172
|
+
}
|
|
173
|
+
/* ── NumberInput ─────────────────────────────────────────────────────────────── */
|
|
174
|
+
/* A number. It is saved when the field is left or Enter is pressed, never on each
|
|
175
|
+
keystroke, so a half-typed "12." is never saved. Empty clears it (undefined);
|
|
176
|
+
anything that is not a number is put back as it was. "1,234.5", "1.234,5", "12,5"
|
|
177
|
+
and "$1 200" all read as people mean them (lib/number). The arrows step by
|
|
178
|
+
`step`, ten steps with Shift, within `min` and `max`. A value the app changes
|
|
179
|
+
while the field is not being typed in is shown at once. */
|
|
180
|
+
export function NumberInput({ value, onChange, min, max, step = 1, variant, size, className, onBlur, onKeyDown, onFocus, ...props }) {
|
|
181
|
+
const shown = value === undefined ? "" : String(value);
|
|
182
|
+
const [text, setText] = useState(shown);
|
|
183
|
+
const [editing, setEditing] = useState(false);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!editing)
|
|
186
|
+
setText(shown);
|
|
187
|
+
}, [shown, editing]);
|
|
188
|
+
const commit = (raw) => {
|
|
189
|
+
const n = parseNumber(raw);
|
|
190
|
+
if (n === null)
|
|
191
|
+
return onChange(undefined);
|
|
192
|
+
if (Number.isNaN(n))
|
|
193
|
+
return setText(shown);
|
|
194
|
+
const next = clamp(n, min, max);
|
|
195
|
+
setText(String(next));
|
|
196
|
+
if (next !== value)
|
|
197
|
+
onChange(next);
|
|
198
|
+
};
|
|
199
|
+
return (_jsx(Input, { inputMode: "decimal", autoComplete: "off", variant: variant, size: size, value: text, "aria-valuemin": min, "aria-valuemax": max, onChange: (e) => setText(e.target.value), onFocus: (e) => {
|
|
200
|
+
setEditing(true);
|
|
201
|
+
onFocus?.(e);
|
|
202
|
+
}, onBlur: (e) => {
|
|
203
|
+
setEditing(false);
|
|
204
|
+
commit(e.target.value);
|
|
205
|
+
onBlur?.(e);
|
|
206
|
+
}, onKeyDown: (e) => {
|
|
207
|
+
onKeyDown?.(e);
|
|
208
|
+
if (e.defaultPrevented)
|
|
209
|
+
return;
|
|
210
|
+
if (e.key === "Enter")
|
|
211
|
+
commit(e.currentTarget.value);
|
|
212
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
const current = parseNumber(e.currentTarget.value);
|
|
215
|
+
const base = current === null || Number.isNaN(current) ? (value ?? 0) : current;
|
|
216
|
+
const by = (e.key === "ArrowUp" ? 1 : -1) * step * (e.shiftKey ? 10 : 1);
|
|
217
|
+
// Rounded to the step's own decimals, so 0.1 + 0.2 shows 0.3.
|
|
218
|
+
const decimals = (String(step).split(".")[1] ?? "").length;
|
|
219
|
+
const next = clamp(Number((base + by).toFixed(decimals)), min, max);
|
|
220
|
+
setText(String(next));
|
|
221
|
+
onChange(next);
|
|
222
|
+
}
|
|
223
|
+
}, className: cn("tabular-nums", className), ...props }));
|
|
224
|
+
}
|
|
225
|
+
/* ── SearchField ─────────────────────────────────────────────────────────────── */
|
|
226
|
+
/* Finding something by typing: a search icon, a clear button once there is text,
|
|
227
|
+
and Escape to clear (a second Escape leaves the field). Announced as a search
|
|
228
|
+
box. `onChange` hands over the text, not an event. */
|
|
229
|
+
export function SearchField({ value, onChange, placeholder = "Search", "aria-label": label, size, variant, className, onKeyDown, ...props }) {
|
|
230
|
+
const input = useRef(null);
|
|
231
|
+
const inField = useField() !== null;
|
|
232
|
+
// Escape with text clears it and nothing else. A dialog around the field hears
|
|
233
|
+
// Escape on the document before the field does, so the window catches it first.
|
|
234
|
+
useEscapeFirst(value !== "", input, () => onChange(""));
|
|
235
|
+
return (_jsx(Input, { ref: input, type: "search", role: "searchbox", "aria-label": label ?? (inField ? undefined : placeholder), value: value, onChange: (e) => onChange(e.target.value), onKeyDown: (e) => {
|
|
236
|
+
onKeyDown?.(e);
|
|
237
|
+
// With text, the window's listener above has cleared it.
|
|
238
|
+
if (e.key === "Escape" && !e.defaultPrevented && value === "")
|
|
239
|
+
e.currentTarget.blur();
|
|
240
|
+
}, placeholder: placeholder, size: size, variant: variant, className: className, start: _jsx(Search, { "aria-hidden": true }), end: value !== "" ? (_jsx("button", { type: "button", "aria-label": "Clear", onClick: () => {
|
|
241
|
+
onChange("");
|
|
242
|
+
input.current?.focus();
|
|
243
|
+
}, className: "flex justify-center items-center hover:bg-tint-active -mr-1 rounded-small size-5 text-ink-tertiary hover:text-ink transition-colors duration-(--duration-instant) [&_svg]:size-3.5", children: _jsx(X, {}) })) : undefined, ...props }));
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/ui/input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,eAAe,EACf,MAAM,EACN,QAAQ,GAIX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,cAAc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,EAAE,CAAC,CAAC,CAAC;IACxD,OAAO,CACH,KAAC,KAAK,IACF,GAAG,EAAE,KAAK,EACV,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,WAAW,gBACJ,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EACxD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;YACf,yDAAyD;YACzD,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,gBAAgB,IAAI,KAAK,KAAK,EAAE;gBAAE,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;QAC1F,CAAC,EACD,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAC,MAAM,0BAAe,EAC7B,GAAG,EACC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CACX,iBACI,IAAI,EAAC,QAAQ,gBACF,OAAO,EAClB,OAAO,EAAE,GAAG,EAAE;gBACV,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACb,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;YAC3B,CAAC,EACD,SAAS,EAAC,oLAAoL,YAE9L,KAAC,CAAC,KAAG,GACA,CACZ,CAAC,CAAC,CAAC,SAAS,KAEb,KAAK,GACX,CACL,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function LinkBlock({ url, title, onTitleChange, onTitleEnter, onLink, check, className, }: {
|
|
2
|
+
url?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
/** Called on every keystroke; debounce saving in the owner. */
|
|
5
|
+
onTitleChange?: (title: string) => void;
|
|
6
|
+
/** Enter in the name: in a document, the writing goes on below the card. */
|
|
7
|
+
onTitleEnter?: () => void;
|
|
8
|
+
onLink?: (url: string) => void;
|
|
9
|
+
/** The owner's own rule for a link, after this block's: why it is refused, or null. */
|
|
10
|
+
check?: (url: string) => string | null;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
13
|
+
//# sourceMappingURL=link-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-block.d.ts","sourceRoot":"","sources":["../../../src/components/ui/link-block.tsx"],"names":[],"mappings":"AAUA,wBAAgB,SAAS,CAAC,EACtB,GAAG,EACH,KAAU,EACV,aAAa,EACb,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,GACZ,EAAE;IACC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uFAAuF;IACvF,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,sCAuDA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ExternalLink, Globe } from "lucide-react";
|
|
4
|
+
import { hostOf, isWebUrl } from "../../lib/embed.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { AddressField } from "./address-field.js";
|
|
7
|
+
/* A web page in a document, as a card: a name for it, which can be typed over and
|
|
8
|
+
falls back to its site, and the address under it. Nothing is fetched from the
|
|
9
|
+
page. Until it has an address it asks for one. */
|
|
10
|
+
export function LinkBlock({ url, title = "", onTitleChange, onTitleEnter, onLink, check, className, }) {
|
|
11
|
+
if (!url || !isWebUrl(url))
|
|
12
|
+
return onLink ? (_jsx(AddressField, { icon: _jsx(Globe, {}), placeholder: "Paste a link to a web page, then Enter", check: (link) => (isWebUrl(link) ? null : "That needs to be a web address, starting http:// or https://.") ?? check?.(link) ?? null, onCommit: onLink, className: className })) : null;
|
|
13
|
+
const site = hostOf(url);
|
|
14
|
+
return (_jsxs("div", { className: cn("flex items-center gap-3 rounded-surface px-3.5 py-3 shadow-edge transition-colors duration-(--duration-fast) hover:bg-tint-hover", className), children: [_jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-control bg-accent-tint text-accent-text", children: _jsx(Globe, { className: "size-4" }) }), _jsxs("div", { className: "flex-1 w-0 min-w-0", children: [onTitleChange ? (_jsx("input", { defaultValue: title, placeholder: site, "aria-label": "Name of the link", onChange: (e) => onTitleChange(e.target.value), onKeyDown: (e) => {
|
|
15
|
+
if (e.key !== "Enter" || !onTitleEnter)
|
|
16
|
+
return;
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
onTitleEnter();
|
|
19
|
+
}, className: "w-full truncate bg-transparent font-medium text-ink outline-none placeholder:text-ink" })) : (_jsx("p", { className: "truncate font-medium text-ink", children: title || site })), _jsx("p", { className: "truncate text-sm text-ink-tertiary", children: url })] }), _jsx("a", { href: url, target: "_blank", rel: "noreferrer", "aria-label": `Open ${site}`, className: "flex size-8 shrink-0 items-center justify-center rounded-control text-ink-secondary transition-colors hover:bg-tint-active hover:text-ink", children: _jsx(ExternalLink, { className: "size-4" }) })] }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=link-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-block.js","sourceRoot":"","sources":["../../../src/components/ui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CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC9C,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;4BACb,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,YAAY;gCAAE,OAAO;4BAC/C,CAAC,CAAC,cAAc,EAAE,CAAC;4BACnB,YAAY,EAAE,CAAC;wBACnB,CAAC,EACD,SAAS,EAAC,uFAAuF,GACnG,CACL,CAAC,CAAC,CAAC,CACA,YAAG,SAAS,EAAC,+BAA+B,YAAE,KAAK,IAAI,IAAI,GAAK,CACnE,EACD,YAAG,SAAS,EAAC,oCAAoC,YAAE,GAAG,GAAK,IACzD,EACN,YACI,IAAI,EAAE,GAAG,EACT,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,gBACJ,QAAQ,IAAI,EAAE,EAC1B,SAAS,EAAC,2IAA2I,YAErJ,KAAC,YAAY,IAAC,SAAS,EAAC,QAAQ,GAAG,GACnC,IACF,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export declare function ListDetail({ list, detail, showDetail, onBack, backLabel, listLabel, detailLabel, empty, listWidth, className, }: {
|
|
3
|
+
list: ReactNode;
|
|
4
|
+
/** The chosen thing, or nothing yet. */
|
|
5
|
+
detail?: ReactNode;
|
|
6
|
+
/** Something is chosen: on a narrow screen, show it instead of the list. */
|
|
7
|
+
showDetail: boolean;
|
|
8
|
+
onBack: () => void;
|
|
9
|
+
backLabel?: string;
|
|
10
|
+
listLabel?: string;
|
|
11
|
+
detailLabel?: string;
|
|
12
|
+
/** Shown in the detail's place on a wide screen while nothing is chosen. */
|
|
13
|
+
empty?: ReactNode;
|
|
14
|
+
listWidth?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function ListItem({ title, description, meta, selected, className, ...props }: Omit<ComponentProps<"button">, "title"> & {
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
description?: ReactNode;
|
|
20
|
+
meta?: ReactNode;
|
|
21
|
+
selected?: boolean;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=list-detail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-detail.d.ts","sourceRoot":"","sources":["../../../src/components/ui/list-detail.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAYtE,wBAAgB,UAAU,CAAC,EACvB,IAAI,EACJ,MAAM,EACN,UAAU,EACV,MAAM,EACN,SAAkB,EAClB,SAAkB,EAClB,WAAsB,EACtB,KAAK,EACL,SAAmB,EACnB,SAAS,GACZ,EAAE;IACC,IAAI,EAAE,SAAS,CAAC;IAChB,wCAAwC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,4EAA4E;IAC5E,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,+BAqCA;AAKD,wBAAgB,QAAQ,CAAC,EACrB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACX,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,GAAG;IACzC,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,+BAoBA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeft, MousePointerClick } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { EmptyState } from "./empty-state.js";
|
|
7
|
+
/* A list beside the one chosen from it: mail, notes, a feed with a reader.
|
|
8
|
+
|
|
9
|
+
From 48rem of room (its own width, not the window's, so it works inside a
|
|
10
|
+
sidebar app) the two sit side by side, each scrolling on its own. Narrower, one
|
|
11
|
+
shows at a time: the list, or, once something is chosen (`showDetail`), the
|
|
12
|
+
detail with a way back (`onBack`). The arrow keys move between the list's items
|
|
13
|
+
(ListItem). It fills the height it is given: put it in a parent with a height. */
|
|
14
|
+
export function ListDetail({ list, detail, showDetail, onBack, backLabel = "Back", listLabel = "List", detailLabel = "Detail", empty, listWidth = "20rem", className, }) {
|
|
15
|
+
const move = (e) => {
|
|
16
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp")
|
|
17
|
+
return;
|
|
18
|
+
const items = [...e.currentTarget.querySelectorAll("[data-list-item]")];
|
|
19
|
+
const at = items.indexOf(document.activeElement);
|
|
20
|
+
if (at === -1)
|
|
21
|
+
return;
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
items[Math.max(0, Math.min(items.length - 1, at + (e.key === "ArrowDown" ? 1 : -1)))]?.focus();
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs("div", { className: cn("@container flex h-full min-h-0", className), style: { "--list-w": listWidth }, children: [_jsx("section", { "aria-label": listLabel, onKeyDown: move, className: cn("flex flex-col w-full @3xl:w-(--list-w) min-h-0 overflow-y-auto overscroll-contain shrink-0", "@3xl:shadow-edge-r", showDetail && "@max-3xl:hidden"), children: list }), _jsxs("section", { "aria-label": detailLabel, className: cn("flex flex-col flex-1 min-w-0 min-h-0 overflow-y-auto overscroll-contain", !showDetail && "@max-3xl:hidden"), children: [showDetail && (_jsx("div", { className: "@3xl:hidden px-2 pt-2", children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: onBack, children: [_jsx(ChevronLeft, {}), " ", backLabel] }) })), showDetail ? detail : empty ?? _jsx(EmptyState, { icon: MousePointerClick, title: "Nothing chosen", description: "Choose one from the list." })] })] }));
|
|
26
|
+
}
|
|
27
|
+
/* One item in a ListDetail's list: a title, a line under it, something at the end
|
|
28
|
+
(a date, a count). A button, or a link with `asChild`-free `href`. The chosen one
|
|
29
|
+
is tinted and says so (aria-current). */
|
|
30
|
+
export function ListItem({ title, description, meta, selected, className, ...props }) {
|
|
31
|
+
return (_jsxs("button", { type: "button", "data-list-item": true, "aria-current": selected ? "true" : undefined, className: cn("flex flex-col gap-0.5 mx-1.5 my-px px-3 py-2.5 w-[calc(100%-0.75rem)] rounded-control text-left transition-colors duration-(--duration-instant) outline-offset-[-2px]", selected ? "bg-tint-active" : "hover:bg-tint-hover", className), ...props, children: [_jsxs("span", { className: "flex items-baseline gap-2 w-full", children: [_jsx("span", { className: "flex-1 min-w-0 font-medium text-ink text-sm truncate", children: title }), meta !== undefined && _jsx("span", { className: "tabular-nums text-caption text-ink-tertiary shrink-0", children: meta })] }), description !== undefined && _jsx("span", { className: "w-full text-ink-secondary text-sm line-clamp-2", children: description })] }));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=list-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-detail.js","sourceRoot":"","sources":["../../../src/components/ui/list-detail.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,UAAU,E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,EAAE,EAAE,CAAC,yEAAyE,EAAE,CAAC,UAAU,IAAI,iBAAiB,CAAC,aAEzH,UAAU,IAAI,CACX,cAAK,SAAS,EAAC,uBAAuB,YAClC,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,MAAM,aAC7C,KAAC,WAAW,KAAG,OAAE,SAAS,IACrB,GACP,CACT,EACA,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,KAAC,UAAU,IAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAC,gBAAgB,EAAC,WAAW,EAAC,2BAA2B,GAAG,IAChI,IACR,CACT,CAAC;AACN,CAAC;AAED;;2CAE2C;AAC3C,MAAM,UAAU,QAAQ,CAAC,EACrB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EAMX;IACG,OAAO,CACH,kBACI,IAAI,EAAC,QAAQ,0CAEC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC3C,SAAS,EAAE,EAAE,CACT,uKAAuK,EACvK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,qBAAqB,EACnD,SAAS,CACZ,KACG,KAAK,aAET,gBAAM,SAAS,EAAC,kCAAkC,aAC9C,eAAM,SAAS,EAAC,sDAAsD,YAAE,KAAK,GAAQ,EACpF,IAAI,KAAK,SAAS,IAAI,eAAM,SAAS,EAAC,sDAAsD,YAAE,IAAI,GAAQ,IACxG,EACN,WAAW,KAAK,SAAS,IAAI,eAAM,SAAS,EAAC,gDAAgD,YAAE,WAAW,GAAQ,IAC9G,CACZ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A list's panel, as a popover. */
|
|
2
|
+
export declare const listSurfaceClasses = "bg-surface-overlay shadow-popover p-1.5 rounded-overlay outline-none overflow-y-auto overscroll-contain";
|
|
3
|
+
/** One option. Set data-active on the highlighted one. Taller by className where a row carries more (Spotlight's). */
|
|
4
|
+
export declare const optionClasses: string;
|
|
5
|
+
/** Where the highlight goes for a key: the arrows step and wrap round, Home and End jump. From nothing (-1), down is the first and up the last. Null for any other key. */
|
|
6
|
+
export declare function stepActive(current: number, count: number, key: string): number | null;
|
|
7
|
+
//# sourceMappingURL=listbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/listbox.ts"],"names":[],"mappings":"AAOA,oCAAoC;AACpC,eAAO,MAAM,kBAAkB,4GAA4G,CAAC;AAE5I,sHAAsH;AACtH,eAAO,MAAM,aAAa,QAIf,CAAC;AAEZ,2KAA2K;AAC3K,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOrF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* The pieces every list of options shares: Combobox, MultiSelect, Spotlight, the
|
|
2
|
+
"/" CommandMenu. Kept in one place so their rows and panels stay one look (they
|
|
3
|
+
had drifted to three row heights, two paddings and two radii).
|
|
4
|
+
|
|
5
|
+
The highlight is `data-active`, not aria-selected: in a multiple choice list
|
|
6
|
+
(MultiSelect) aria-selected says chosen, and the two must not be confused. */
|
|
7
|
+
/** A list's panel, as a popover. */
|
|
8
|
+
export const listSurfaceClasses = "bg-surface-overlay shadow-popover p-1.5 rounded-overlay outline-none overflow-y-auto overscroll-contain";
|
|
9
|
+
/** One option. Set data-active on the highlighted one. Taller by className where a row carries more (Spotlight's). */
|
|
10
|
+
export const optionClasses = [
|
|
11
|
+
"flex items-center gap-2 px-2 rounded-control w-full h-control-sm text-sm text-left cursor-pointer select-none",
|
|
12
|
+
"transition-colors duration-(--duration-instant) data-[active=true]:bg-tint-hover",
|
|
13
|
+
"aria-disabled:pointer-events-none aria-disabled:text-ink-disabled",
|
|
14
|
+
].join(" ");
|
|
15
|
+
/** Where the highlight goes for a key: the arrows step and wrap round, Home and End jump. From nothing (-1), down is the first and up the last. Null for any other key. */
|
|
16
|
+
export function stepActive(current, count, key) {
|
|
17
|
+
if (count === 0)
|
|
18
|
+
return null;
|
|
19
|
+
if (key === "Home")
|
|
20
|
+
return 0;
|
|
21
|
+
if (key === "End")
|
|
22
|
+
return count - 1;
|
|
23
|
+
if (key === "ArrowDown")
|
|
24
|
+
return current < 0 ? 0 : (current + 1) % count;
|
|
25
|
+
if (key === "ArrowUp")
|
|
26
|
+
return current < 0 ? count - 1 : (current - 1 + count) % count;
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=listbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listbox.js","sourceRoot":"","sources":["../../../src/components/ui/listbox.ts"],"names":[],"mappings":"AAAA;;;;;gFAKgF;AAEhF,oCAAoC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,yGAAyG,CAAC;AAE5I,sHAAsH;AACtH,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,+GAA+G;IAC/G,kFAAkF;IAClF,mEAAmE;CACtE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,2KAA2K;AAC3K,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,KAAa,EAAE,GAAW;IAClE,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7B,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,KAAK,GAAG,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,WAAW;QAAE,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IACxE,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;IACtF,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface MacWindowHeaderProps {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function MacWindowHeader({ title, className }: MacWindowHeaderProps): import("react").JSX.Element;
|
|
7
|
+
interface MacCardProps {
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
headerClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function MacCard({ title, children, className, headerClassName, }: MacCardProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=mac-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mac-card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/mac-card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,oBAAoB;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,oBAAoB,+BAgBzE;AAED,UAAU,YAAY;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,OAAO,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,GAClB,EAAE,YAAY,+BAOd"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
export function MacWindowHeader({ title, className }) {
|
|
4
|
+
return (_jsxs("div", { className: cn("flex items-center gap-1.5 bg-surface-sunken px-4 py-2.5 border-b", className), children: [_jsx("span", { className: "bg-tag-red-ink/70 rounded-full size-2.5" }), _jsx("span", { className: "bg-tag-yellow-ink/70 rounded-full size-2.5" }), _jsx("span", { className: "bg-tag-green-ink/70 rounded-full size-2.5" }), _jsx("span", { className: "ml-auto font-mono text-ink-tertiary text-caption", children: title })] }));
|
|
5
|
+
}
|
|
6
|
+
export function MacCard({ title, children, className, headerClassName, }) {
|
|
7
|
+
return (_jsxs("div", { className: cn("overflow-hidden", className), children: [_jsx(MacWindowHeader, { title: title, className: headerClassName }), children] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=mac-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mac-card.js","sourceRoot":"","sources":["../../../src/components/ui/mac-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAQxC,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAwB;IACtE,OAAO,CACH,eACI,SAAS,EAAE,EAAE,CACT,kEAAkE,EAClE,SAAS,CACZ,aAED,eAAM,SAAS,EAAC,yCAAyC,GAAG,EAC5D,eAAM,SAAS,EAAC,4CAA4C,GAAG,EAC/D,eAAM,SAAS,EAAC,2CAA2C,GAAG,EAC9D,eAAM,SAAS,EAAC,kDAAkD,YAC7D,KAAK,GACH,IACL,CACT,CAAC;AACN,CAAC;AASD,MAAM,UAAU,OAAO,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,GACJ;IACX,OAAO,CACH,eAAK,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,aAC5C,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,GAAI,EAC5D,QAAQ,IACP,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FieldButtonProps } from "./field-button.js";
|
|
2
|
+
export interface MonthPickerProps extends Omit<FieldButtonProps, "value" | "onChange" | "children" | "onClear" | "icon"> {
|
|
3
|
+
/** `YYYY-MM`, or null for none. */
|
|
4
|
+
value: string | null;
|
|
5
|
+
onChange: (value: string | null) => void;
|
|
6
|
+
/** Earliest and latest month, `YYYY-MM`. */
|
|
7
|
+
min?: string | null;
|
|
8
|
+
max?: string | null;
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function MonthPicker({ value, onChange, min, max, clearable, placeholder, name, ...props }: MonthPickerProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=month-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"month-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/month-picker.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMxE,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACpH,mCAAmC;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,SAAgB,EAAE,WAA4B,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BA4F1I"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CalendarRange, ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
import { formatMonth, isMonth, today } from "../../lib/dates.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { FieldButton } from "./field-button.js";
|
|
8
|
+
import { PickerPanel } from "./picker-panel.js";
|
|
9
|
+
const SHORT = new Intl.DateTimeFormat(undefined, { month: "short" });
|
|
10
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
11
|
+
/* A month: a budget's, a report's, a calendar's. A year of months on a grid, the
|
|
12
|
+
year changed with the arrows beside it. The arrow keys move through the months,
|
|
13
|
+
across years; Enter chooses. */
|
|
14
|
+
export function MonthPicker({ value, onChange, min, max, clearable = true, placeholder = "Pick a month", name, ...props }) {
|
|
15
|
+
const chosen = isMonth(value) ? value : null;
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const [year, setYear] = useState(() => Number((chosen ?? today()).slice(0, 4)));
|
|
18
|
+
const [focusMonth, setFocusMonth] = useState(chosen ?? today().slice(0, 7));
|
|
19
|
+
const grid = useRef(null);
|
|
20
|
+
const outside = (m) => (min != null && m < min) || (max != null && m > max);
|
|
21
|
+
const moveTo = (m) => {
|
|
22
|
+
setFocusMonth(m);
|
|
23
|
+
setYear(Number(m.slice(0, 4)));
|
|
24
|
+
requestAnimationFrame(() => grid.current?.querySelector(`[data-month="${m}"]`)?.focus());
|
|
25
|
+
};
|
|
26
|
+
const onKey = (e) => {
|
|
27
|
+
const by = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: 3, ArrowUp: -3 }[e.key];
|
|
28
|
+
if (by === undefined)
|
|
29
|
+
return;
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
const [y, m] = focusMonth.split("-").map(Number);
|
|
32
|
+
const d = new Date(y, m - 1 + by, 1);
|
|
33
|
+
moveTo(`${d.getFullYear()}-${pad(d.getMonth() + 1)}`);
|
|
34
|
+
};
|
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsx(PickerPanel, { open: open, onOpenChange: (next) => {
|
|
36
|
+
setOpen(next);
|
|
37
|
+
if (next) {
|
|
38
|
+
setYear(Number((chosen ?? today()).slice(0, 4)));
|
|
39
|
+
setFocusMonth(chosen ?? today().slice(0, 7));
|
|
40
|
+
}
|
|
41
|
+
}, title: props["aria-label"] ?? "Pick a month", onOpenAutoFocus: (e) => {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
e.currentTarget.querySelector('[data-month][tabindex="0"]')?.focus();
|
|
44
|
+
}, trigger: _jsx(FieldButton, { icon: CalendarRange, placeholder: placeholder, onClear: clearable ? () => onChange(null) : undefined, clearLabel: "Clear the month", ...props, children: chosen === null ? null : formatMonth(chosen) }), children: _jsxs("div", { className: "p-3 w-72 max-sm:w-full max-sm:max-w-sm", children: [_jsxs("div", { className: "flex justify-between items-center mb-2", children: [_jsx("button", { type: "button", "aria-label": "Previous year", onClick: () => setYear((y) => y - 1), className: "inline-flex justify-center items-center hover:bg-tint-hover rounded-control size-7 [@media(pointer:coarse)]:size-10 text-ink-secondary", children: _jsx(ChevronLeft, { className: "size-4" }) }), _jsx("span", { "aria-live": "polite", className: "font-medium text-sm tabular-nums", children: year }), _jsx("button", { type: "button", "aria-label": "Next year", onClick: () => setYear((y) => y + 1), className: "inline-flex justify-center items-center hover:bg-tint-hover rounded-control size-7 [@media(pointer:coarse)]:size-10 text-ink-secondary", children: _jsx(ChevronRight, { className: "size-4" }) })] }), _jsx("div", { ref: grid, role: "grid", "aria-label": `Months of ${year}`, onKeyDown: onKey, className: "gap-1 grid grid-cols-3", children: Array.from({ length: 12 }, (_, i) => {
|
|
45
|
+
const m = `${year}-${pad(i + 1)}`;
|
|
46
|
+
const isChosen = m === chosen;
|
|
47
|
+
return (_jsx("button", { type: "button", role: "gridcell", "data-month": m, "aria-selected": isChosen, "aria-label": formatMonth(m), tabIndex: m === focusMonth ? 0 : -1, disabled: outside(m), onFocus: () => setFocusMonth(m), onClick: () => {
|
|
48
|
+
onChange(m);
|
|
49
|
+
setOpen(false);
|
|
50
|
+
}, className: cn("rounded-control h-9 [@media(pointer:coarse)]:h-12 text-sm transition-colors duration-(--duration-instant)", isChosen ? "bg-accent-solid font-medium text-accent-ink hover:bg-accent-solid-hover" : "text-ink hover:bg-tint-hover", m === today().slice(0, 7) && !isChosen && "font-semibold shadow-[inset_0_0_0_1px_var(--hairline-strong)]", "disabled:text-ink-disabled disabled:pointer-events-none"), children: SHORT.format(new Date(year, i, 1)) }, m));
|
|
51
|
+
}) })] }) }), name !== undefined && _jsx("input", { type: "hidden", name: name, value: chosen ?? "" })] }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=month-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"month-picker.js","sourceRoot":"","sources":["../../../src/components/ui/month-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAoB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,m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CAAC,GACA,IACJ,GACI,EACb,IAAI,KAAK,SAAS,IAAI,gBAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,IAAI,EAAE,GAAI,IAChF,CACN,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type TagColor } from "./badge.js";
|
|
2
|
+
export type MultiSelectOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
color?: TagColor;
|
|
6
|
+
};
|
|
7
|
+
export declare function MultiSelect({ options, value, onChange, onCreate, placeholder, size, disabled, name, className, "aria-label": ariaLabel, autoFocus, }: {
|
|
8
|
+
options: readonly MultiSelectOption[];
|
|
9
|
+
value: readonly string[];
|
|
10
|
+
onChange: (value: string[]) => void;
|
|
11
|
+
/** Offers "Create …" for what was typed; return the new option (it is chosen at once). */
|
|
12
|
+
onCreate?: (label: string) => MultiSelectOption | void;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
"aria-label"?: string;
|
|
19
|
+
/** Put the caret in it when it appears (in a popover opened to edit it). */
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=multi-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/multi-select.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAiBhE,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEnF,wBAAgB,WAAW,CAAC,EACxB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAoB,EACpB,IAAW,EACX,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,SAAS,GACZ,EAAE;IACC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACtC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,iBAAiB,GAAG,IAAI,CAAC;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,+BAyKA"}
|