@kujoforall/paper-ui 0.1.0 → 0.2.1
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 +94 -0
- package/README.md +50 -7
- package/dist/components/editor/block-text.d.ts.map +1 -1
- package/dist/components/editor/block-text.js +52 -17
- package/dist/components/editor/block-text.js.map +1 -1
- package/dist/components/editor/blocks.d.ts.map +1 -1
- package/dist/components/editor/blocks.js +17 -13
- package/dist/components/editor/blocks.js.map +1 -1
- package/dist/components/editor/document-editor.d.ts.map +1 -1
- package/dist/components/editor/document-editor.js +4 -2
- package/dist/components/editor/document-editor.js.map +1 -1
- package/dist/components/editor/document-view.d.ts.map +1 -1
- package/dist/components/editor/document-view.js +17 -12
- package/dist/components/editor/document-view.js.map +1 -1
- package/dist/components/editor/editor-state.d.ts +7 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -1
- package/dist/components/editor/editor-state.js +28 -3
- package/dist/components/editor/editor-state.js.map +1 -1
- 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.map +1 -1
- package/dist/components/editor/extensions/spoiler.js +2 -2
- package/dist/components/editor/extensions/spoiler.js.map +1 -1
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.d.ts.map +1 -1
- package/dist/components/editor/index.js +1 -0
- package/dist/components/editor/index.js.map +1 -1
- package/dist/components/editor/kinds.js +1 -1
- package/dist/components/editor/kinds.js.map +1 -1
- 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/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.js +1 -1
- package/dist/components/ui/accent-picker.js.map +1 -1
- 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 +1 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -1
- package/dist/components/ui/app-shell.js +5 -3
- package/dist/components/ui/app-shell.js.map +1 -1
- 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 +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +2 -2
- package/dist/components/ui/badge.js.map +1 -1
- 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.js +1 -1
- package/dist/components/ui/breadcrumbs.js.map +1 -1
- package/dist/components/ui/button.d.ts +8 -6
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +91 -26
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +6 -5
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/callout.d.ts +23 -4
- package/dist/components/ui/callout.d.ts.map +1 -1
- package/dist/components/ui/callout.js +28 -15
- package/dist/components/ui/callout.js.map +1 -1
- package/dist/components/ui/card.d.ts +13 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +10 -9
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +9 -4
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +25 -5
- package/dist/components/ui/checkbox.js.map +1 -1
- 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 +5 -2
- package/dist/components/ui/command-menu.d.ts.map +1 -1
- package/dist/components/ui/command-menu.js +31 -6
- package/dist/components/ui/command-menu.js.map +1 -1
- 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 +6 -1
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/date-picker.js +20 -12
- package/dist/components/ui/date-picker.js.map +1 -1
- package/dist/components/ui/date-time-picker.d.ts +3 -1
- package/dist/components/ui/date-time-picker.d.ts.map +1 -1
- package/dist/components/ui/date-time-picker.js +17 -15
- package/dist/components/ui/date-time-picker.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +13 -9
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +33 -3
- package/dist/components/ui/dialog.js.map +1 -1
- 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 +14 -10
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +22 -13
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/editable-text.d.ts +9 -2
- package/dist/components/ui/editable-text.d.ts.map +1 -1
- package/dist/components/ui/editable-text.js +27 -10
- package/dist/components/ui/editable-text.js.map +1 -1
- 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 +2 -1
- package/dist/components/ui/field-button.d.ts.map +1 -1
- package/dist/components/ui/field-button.js +7 -5
- package/dist/components/ui/field-button.js.map +1 -1
- package/dist/components/ui/file-preview.js +1 -1
- package/dist/components/ui/file-preview.js.map +1 -1
- package/dist/components/ui/file-uploader.d.ts.map +1 -1
- package/dist/components/ui/file-uploader.js +5 -4
- package/dist/components/ui/file-uploader.js.map +1 -1
- 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 +11 -1
- package/dist/components/ui/handle-row.d.ts.map +1 -1
- package/dist/components/ui/handle-row.js +101 -32
- package/dist/components/ui/handle-row.js.map +1 -1
- 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.js +4 -4
- package/dist/components/ui/image-block.js.map +1 -1
- package/dist/components/ui/image-card.d.ts.map +1 -1
- package/dist/components/ui/image-card.js +5 -4
- package/dist/components/ui/image-card.js.map +1 -1
- 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.map +1 -1
- package/dist/components/ui/image-viewer.js +38 -5
- package/dist/components/ui/image-viewer.js.map +1 -1
- package/dist/components/ui/image.d.ts +25 -3
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +50 -21
- package/dist/components/ui/image.js.map +1 -1
- package/dist/components/ui/index.d.ts +54 -11
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +53 -10
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/input.d.ts +71 -12
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +236 -23
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/link-block.d.ts.map +1 -1
- package/dist/components/ui/link-block.js +1 -1
- package/dist/components/ui/link-block.js.map +1 -1
- 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.js +1 -1
- package/dist/components/ui/mac-card.js.map +1 -1
- 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.map +1 -1
- package/dist/components/ui/nav-tree.js +10 -3
- package/dist/components/ui/nav-tree.js.map +1 -1
- package/dist/components/ui/page.d.ts +16 -5
- package/dist/components/ui/page.d.ts.map +1 -1
- package/dist/components/ui/page.js +23 -10
- package/dist/components/ui/page.js.map +1 -1
- 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 +2 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +11 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +17 -4
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/property.d.ts +2 -6
- package/dist/components/ui/property.d.ts.map +1 -1
- package/dist/components/ui/property.js +6 -22
- package/dist/components/ui/property.js.map +1 -1
- 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 +15 -7
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +8 -6
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select-menu.d.ts +3 -1
- package/dist/components/ui/select-menu.d.ts.map +1 -1
- package/dist/components/ui/select-menu.js +2 -2
- package/dist/components/ui/select-menu.js.map +1 -1
- package/dist/components/ui/select.d.ts +7 -2
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +19 -5
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/selection-bar.js +1 -1
- package/dist/components/ui/selection-bar.js.map +1 -1
- 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.map +1 -1
- package/dist/components/ui/spotlight.js +14 -11
- package/dist/components/ui/spotlight.js.map +1 -1
- package/dist/components/ui/step-dialog.js +3 -3
- package/dist/components/ui/step-dialog.js.map +1 -1
- 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 +13 -5
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +65 -12
- package/dist/components/ui/table.js.map +1 -1
- 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 +14 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.js +69 -41
- package/dist/components/ui/theme-toggle.js.map +1 -1
- 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 +37 -11
- package/dist/components/ui/time-picker.d.ts.map +1 -1
- package/dist/components/ui/time-picker.js +130 -52
- package/dist/components/ui/time-picker.js.map +1 -1
- 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 +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -2
- package/dist/components/ui/tooltip.js.map +1 -1
- 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 +11 -5
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/components/ui/typography.js +31 -5
- package/dist/components/ui/typography.js.map +1 -1
- package/dist/components/ui/video-block.d.ts.map +1 -1
- package/dist/components/ui/video-block.js +5 -1
- package/dist/components/ui/video-block.js.map +1 -1
- 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.map +1 -1
- package/dist/hooks/use-save-queue.js +19 -7
- package/dist/hooks/use-save-queue.js.map +1 -1
- package/dist/hooks/use-selection.d.ts.map +1 -1
- package/dist/hooks/use-selection.js +10 -1
- package/dist/hooks/use-selection.js.map +1 -1
- 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 +16 -0
- package/dist/lib/dates.d.ts.map +1 -1
- package/dist/lib/dates.js +27 -0
- package/dist/lib/dates.js.map +1 -1
- 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 +2 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -1
- package/dist/lib/rich-text-dom.js +5 -3
- package/dist/lib/rich-text-dom.js.map +1 -1
- 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/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +20 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles/notion.css +342 -51
- package/package.json +27 -4
- package/src/components/editor/block-text.tsx +58 -17
- package/src/components/editor/blocks.tsx +19 -14
- package/src/components/editor/document-editor.tsx +7 -2
- package/src/components/editor/document-view.tsx +37 -24
- package/src/components/editor/editor-state.tsx +31 -3
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +9 -4
- package/src/components/editor/index.ts +1 -0
- package/src/components/editor/kinds.ts +1 -1
- package/src/components/editor/look.tsx +36 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +2 -2
- 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 +9 -7
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +4 -4
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +1 -1
- package/src/components/ui/button.tsx +115 -41
- package/src/components/ui/calendar.tsx +8 -7
- package/src/components/ui/callout.tsx +41 -42
- package/src/components/ui/card.tsx +27 -58
- package/src/components/ui/checkbox.tsx +53 -19
- 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 +61 -31
- 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 +99 -61
- package/src/components/ui/date-time-picker.tsx +68 -62
- package/src/components/ui/dialog.tsx +48 -21
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +33 -31
- package/src/components/ui/editable-text.tsx +40 -7
- 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 +11 -9
- package/src/components/ui/file-preview.tsx +1 -1
- package/src/components/ui/file-uploader.tsx +23 -24
- 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 +176 -40
- 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 +6 -6
- package/src/components/ui/image-card.tsx +18 -25
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +53 -10
- package/src/components/ui/image.tsx +133 -29
- package/src/components/ui/index.ts +106 -11
- package/src/components/ui/input.tsx +437 -65
- package/src/components/ui/link-block.tsx +5 -2
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +5 -5
- 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 +11 -5
- package/src/components/ui/page.tsx +63 -15
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +3 -3
- package/src/components/ui/progress.tsx +56 -16
- package/src/components/ui/property.tsx +6 -37
- 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 +48 -16
- package/src/components/ui/select-menu.tsx +11 -3
- package/src/components/ui/select.tsx +33 -10
- package/src/components/ui/selection-bar.tsx +1 -1
- 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 +21 -21
- package/src/components/ui/step-dialog.tsx +6 -6
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +75 -18
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +74 -83
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +305 -134
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +20 -6
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +45 -9
- package/src/components/ui/video-block.tsx +9 -3
- 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 +19 -7
- package/src/hooks/use-selection.ts +8 -1
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +36 -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 +5 -3
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/utils.ts +21 -2
- package/src/styles/notion.css +342 -51
|
@@ -1,99 +1,471 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
import { Search, X } from "lucide-react";
|
|
5
|
+
import {
|
|
6
|
+
createContext,
|
|
7
|
+
useContext,
|
|
8
|
+
useEffect,
|
|
9
|
+
useId,
|
|
10
|
+
useLayoutEffect,
|
|
11
|
+
useRef,
|
|
12
|
+
useState,
|
|
13
|
+
type ComponentProps,
|
|
14
|
+
type ReactNode,
|
|
15
|
+
type Ref,
|
|
16
|
+
} from "react";
|
|
17
|
+
import { clamp, parseNumber } from "../../lib/number.ts";
|
|
4
18
|
import { cn } from "../../lib/utils.ts";
|
|
19
|
+
import { useEscapeFirst } from "../../hooks/use-escape-first.ts";
|
|
5
20
|
|
|
6
|
-
/*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
/* Text inputs: Field (a label, a control, a hint or an error, wired together),
|
|
22
|
+
Label, Input, Textarea, NumberInput, SearchField, and QuietInput. The rules are
|
|
23
|
+
in docs/parts/basics.md; what each fixes is in STATE.md.
|
|
24
|
+
|
|
25
|
+
A field is a sunken well with a faint edge, not an outlined box. On focus it
|
|
26
|
+
lifts to the page's surface and its edge turns to the accent, so the field being
|
|
27
|
+
typed in is the brightest thing on the row. The quiet variant, for a record's
|
|
28
|
+
properties, has no well until it is hovered or focused.
|
|
29
|
+
|
|
30
|
+
Text is 16px on a phone (iOS Safari zooms the page into any smaller field) and
|
|
31
|
+
14px from the `sm` breakpoint up. */
|
|
32
|
+
|
|
33
|
+
/* ── Field: the label, hint and error, wired to the control inside ─────────────── */
|
|
34
|
+
|
|
35
|
+
type FieldState = { id: string; labelId: string; describedBy?: string; invalid: boolean; required?: boolean; disabled?: boolean };
|
|
36
|
+
const FieldContext = createContext<FieldState | null>(null);
|
|
37
|
+
|
|
38
|
+
/** For a control inside a Field: its id, description, and invalid, required and disabled states. Null outside a Field. */
|
|
39
|
+
export const useField = (): FieldState | null => useContext(FieldContext);
|
|
40
|
+
|
|
41
|
+
/* What a control takes from the Field around it, unless it was given its own. */
|
|
42
|
+
function fromField<P extends { id?: string; "aria-describedby"?: string; "aria-invalid"?: unknown; required?: boolean; disabled?: boolean }>(field: FieldState | null, props: P): P {
|
|
43
|
+
if (!field) return props;
|
|
44
|
+
const describedBy = [props["aria-describedby"], field.describedBy].filter(Boolean).join(" ") || undefined;
|
|
45
|
+
return {
|
|
46
|
+
...props,
|
|
47
|
+
id: props.id ?? field.id,
|
|
48
|
+
"aria-describedby": describedBy,
|
|
49
|
+
"aria-invalid": props["aria-invalid"] ?? (field.invalid || undefined),
|
|
50
|
+
required: props.required ?? field.required,
|
|
51
|
+
disabled: props.disabled ?? field.disabled,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function Label({ className, required, children, ...props }: ComponentProps<"label"> & { required?: boolean }) {
|
|
56
|
+
return (
|
|
57
|
+
<label className={cn("block mb-1.5 font-medium text-ink-secondary text-caption", className)} {...props}>
|
|
58
|
+
{children}
|
|
59
|
+
{/* The control says "required" to a screen reader itself; the mark is for the eye. */}
|
|
60
|
+
{required && (
|
|
61
|
+
<span aria-hidden className="ml-0.5 text-ink-tertiary">
|
|
62
|
+
*
|
|
63
|
+
</span>
|
|
64
|
+
)}
|
|
65
|
+
</label>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
21
68
|
|
|
22
|
-
|
|
69
|
+
/** 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. */
|
|
70
|
+
export function Field({
|
|
71
|
+
label,
|
|
72
|
+
hint,
|
|
73
|
+
error,
|
|
74
|
+
htmlFor,
|
|
75
|
+
required,
|
|
76
|
+
disabled,
|
|
77
|
+
children,
|
|
23
78
|
className,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
79
|
+
}: {
|
|
80
|
+
label?: ReactNode;
|
|
81
|
+
hint?: ReactNode;
|
|
82
|
+
/** Replaces the hint while present, marks the control invalid, and is announced. */
|
|
83
|
+
error?: ReactNode;
|
|
84
|
+
/** The control's id; one is made when it is not given. */
|
|
85
|
+
htmlFor?: string;
|
|
86
|
+
required?: boolean;
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
className?: string;
|
|
90
|
+
}) {
|
|
91
|
+
const made = useId();
|
|
92
|
+
const id = htmlFor ?? made;
|
|
93
|
+
const hintId = `${id}-hint`;
|
|
94
|
+
const errorId = `${id}-error`;
|
|
95
|
+
const hasError = error !== undefined && error !== null && error !== false && error !== "";
|
|
96
|
+
const hasHint = !hasError && hint !== undefined && hint !== null && hint !== "";
|
|
97
|
+
const describedBy = hasError ? errorId : hasHint ? hintId : undefined;
|
|
27
98
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
99
|
+
<FieldContext.Provider value={{ id, labelId: `${id}-label`, describedBy, invalid: hasError, required, disabled }}>
|
|
100
|
+
<div className={cn("w-full", disabled && "[&>label]:text-ink-disabled", className)}>
|
|
101
|
+
{label !== undefined && (
|
|
102
|
+
<Label htmlFor={id} id={`${id}-label`} required={required}>
|
|
103
|
+
{label}
|
|
104
|
+
</Label>
|
|
105
|
+
)}
|
|
106
|
+
{children}
|
|
107
|
+
{hasHint && (
|
|
108
|
+
<p id={hintId} className="mt-1.5 text-caption text-ink-tertiary">
|
|
109
|
+
{hint}
|
|
110
|
+
</p>
|
|
111
|
+
)}
|
|
112
|
+
{/* Always present, so an error that appears is announced. */}
|
|
113
|
+
<p id={errorId} aria-live="polite" className={cn("text-caption text-danger", hasError && "mt-1.5")}>
|
|
114
|
+
{hasError ? error : null}
|
|
115
|
+
</p>
|
|
116
|
+
</div>
|
|
117
|
+
</FieldContext.Provider>
|
|
33
118
|
);
|
|
34
119
|
}
|
|
35
120
|
|
|
121
|
+
/* ── The look ─────────────────────────────────────────────────────────────────── */
|
|
122
|
+
|
|
123
|
+
/* Written twice, once for a lone control (its own :focus, [aria-invalid]) and once
|
|
124
|
+
for a group holding a control with something before or after it (:focus-within,
|
|
125
|
+
and the control's states through has-[]). Kept side by side so they stay alike. */
|
|
126
|
+
const wellLook = {
|
|
127
|
+
field: {
|
|
128
|
+
self: [
|
|
129
|
+
"bg-tint-hover shadow-[inset_0_0_0_1px_var(--hairline-strong)] hover:bg-tint-active",
|
|
130
|
+
"focus:bg-surface focus:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
131
|
+
"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)]",
|
|
132
|
+
"[&[readonly]]:bg-transparent [&[readonly]]:hover:bg-transparent [&[readonly]]:shadow-edge",
|
|
133
|
+
"disabled:bg-tint-hover disabled:shadow-edge",
|
|
134
|
+
],
|
|
135
|
+
group: [
|
|
136
|
+
"bg-tint-hover shadow-[inset_0_0_0_1px_var(--hairline-strong)] hover:bg-tint-active",
|
|
137
|
+
"focus-within:bg-surface focus-within:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
138
|
+
"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)]",
|
|
139
|
+
"has-[input[readonly]]:bg-transparent has-[input[readonly]]:hover:bg-transparent has-[input[readonly]]:shadow-edge",
|
|
140
|
+
"has-[input:disabled]:bg-tint-hover has-[input:disabled]:shadow-edge",
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
quiet: {
|
|
144
|
+
self: [
|
|
145
|
+
"bg-transparent hover:bg-tint-hover",
|
|
146
|
+
"focus:bg-surface focus:shadow-[inset_0_0_0_1px_var(--accent)]",
|
|
147
|
+
"aria-invalid:shadow-[inset_0_0_0_1px_var(--danger)] aria-invalid:focus:shadow-[inset_0_0_0_1px_var(--danger)]",
|
|
148
|
+
"[&[readonly]]:hover:bg-transparent",
|
|
149
|
+
],
|
|
150
|
+
group: [
|
|
151
|
+
"bg-transparent hover:bg-tint-hover",
|
|
152
|
+
"focus-within:bg-surface focus-within:shadow-[inset_0_0_0_1px_var(--accent)]",
|
|
153
|
+
"has-[input[aria-invalid=true]]:shadow-[inset_0_0_0_1px_var(--danger)]",
|
|
154
|
+
"has-[input[readonly]]:hover:bg-transparent",
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const shared = [
|
|
160
|
+
"w-full min-w-0 rounded-control text-ink outline-none",
|
|
161
|
+
"transition-[background-color,box-shadow] duration-(--duration-fast) ease-out-notion",
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
const sizes = {
|
|
165
|
+
// 16px on a phone, so iOS does not zoom in; 14px from sm up (lg stays 16px).
|
|
166
|
+
sm: "h-control-sm px-2 text-body sm:text-sm",
|
|
167
|
+
md: "h-control-md px-2.5 text-body sm:text-sm",
|
|
168
|
+
lg: "h-control-lg px-3 text-body",
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const controlVariants = cva(
|
|
172
|
+
[
|
|
173
|
+
...shared,
|
|
174
|
+
"placeholder:text-ink-placeholder disabled:text-ink-disabled disabled:cursor-not-allowed disabled:placeholder:text-ink-disabled",
|
|
175
|
+
// Browser autofill keeps the kit's colours instead of painting the field yellow.
|
|
176
|
+
"autofill:shadow-[inset_0_0_0_100rem_var(--surface),inset_0_0_0_1px_var(--hairline-strong)] autofill:[-webkit-text-fill-color:var(--ink)]",
|
|
177
|
+
// The browser's own clear button on type=search; SearchField draws its own.
|
|
178
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
179
|
+
],
|
|
180
|
+
{
|
|
181
|
+
variants: {
|
|
182
|
+
variant: { field: wellLook.field.self, quiet: wellLook.quiet.self },
|
|
183
|
+
size: sizes,
|
|
184
|
+
},
|
|
185
|
+
defaultVariants: { variant: "field", size: "md" },
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const groupVariants = cva(
|
|
190
|
+
[...shared, "flex items-center gap-2 cursor-text has-[input:disabled]:cursor-not-allowed [&>span]:text-ink-tertiary [&>span]:shrink-0 [&_svg]:size-4"],
|
|
191
|
+
{
|
|
192
|
+
variants: {
|
|
193
|
+
variant: { field: wellLook.field.group, quiet: wellLook.quiet.group },
|
|
194
|
+
size: sizes,
|
|
195
|
+
},
|
|
196
|
+
defaultVariants: { variant: "field", size: "md" },
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
type Look = VariantProps<typeof controlVariants>;
|
|
201
|
+
|
|
202
|
+
/** The classes of a text field, for a control the kit does not provide (a native select, a button that opens a picker). */
|
|
203
|
+
export const fieldBase = controlVariants({ variant: "field", size: "md" });
|
|
204
|
+
/** The same, at any variant and size. */
|
|
205
|
+
export const fieldVariants = controlVariants;
|
|
206
|
+
/** What a control takes from the Field around it, unless it was given its own: id, description, invalid, required, disabled. */
|
|
207
|
+
export { fromField };
|
|
208
|
+
|
|
209
|
+
/* ── Input ───────────────────────────────────────────────────────────────────── */
|
|
210
|
+
|
|
211
|
+
export type InputProps = Omit<ComponentProps<"input">, "size"> &
|
|
212
|
+
Look & {
|
|
213
|
+
/** Something before the text, inside the field: an icon, a "$". */
|
|
214
|
+
start?: ReactNode;
|
|
215
|
+
/** Something after it: a unit, a button. */
|
|
216
|
+
end?: ReactNode;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export function Input({ className, type = "text", variant, size, start, end, ...props }: InputProps) {
|
|
220
|
+
const field = useField();
|
|
221
|
+
const own = fromField(field, props);
|
|
222
|
+
if (start === undefined && end === undefined) {
|
|
223
|
+
return <input type={type} className={cn(controlVariants({ variant, size }), className)} {...own} />;
|
|
224
|
+
}
|
|
225
|
+
return (
|
|
226
|
+
<div
|
|
227
|
+
data-slot="input-group"
|
|
228
|
+
className={cn(groupVariants({ variant, size }), className)}
|
|
229
|
+
// A press on the "$" or the unit puts the caret in the field, as if part of it.
|
|
230
|
+
onPointerDown={(e) => {
|
|
231
|
+
const input = e.currentTarget.querySelector("input");
|
|
232
|
+
if (input && e.target !== input && !(e.target as Element).closest("button")) {
|
|
233
|
+
e.preventDefault();
|
|
234
|
+
input.focus();
|
|
235
|
+
}
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
{start !== undefined && <span className="flex items-center">{start}</span>}
|
|
239
|
+
<input
|
|
240
|
+
type={type}
|
|
241
|
+
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"
|
|
242
|
+
{...own}
|
|
243
|
+
/>
|
|
244
|
+
{end !== undefined && <span className="flex items-center">{end}</span>}
|
|
245
|
+
</div>
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** Input's quiet variant: no well until hovered or focused, for a record's properties. */
|
|
250
|
+
export function QuietInput(props: Omit<InputProps, "variant">) {
|
|
251
|
+
return <Input variant="quiet" size="sm" {...props} />;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* ── Textarea ────────────────────────────────────────────────────────────────── */
|
|
255
|
+
|
|
256
|
+
const canSizeToContent = () => typeof CSS !== "undefined" && CSS.supports("field-sizing", "content");
|
|
257
|
+
|
|
258
|
+
/** A Ref merged with the component's own, so both see the element. */
|
|
259
|
+
function useMergedRef<T>(outer: Ref<T> | undefined) {
|
|
260
|
+
const inner = useRef<T | null>(null);
|
|
261
|
+
const set = (node: T | null) => {
|
|
262
|
+
inner.current = node;
|
|
263
|
+
if (typeof outer === "function") outer(node);
|
|
264
|
+
else if (outer) (outer as { current: T | null }).current = node;
|
|
265
|
+
};
|
|
266
|
+
return [inner, set] as const;
|
|
267
|
+
}
|
|
268
|
+
|
|
36
269
|
export function Textarea({
|
|
37
270
|
className,
|
|
271
|
+
variant,
|
|
272
|
+
size,
|
|
38
273
|
rows = 4,
|
|
274
|
+
autoGrow = false,
|
|
275
|
+
maxRows,
|
|
276
|
+
ref,
|
|
277
|
+
onInput,
|
|
39
278
|
...props
|
|
40
|
-
}:
|
|
279
|
+
}: Omit<ComponentProps<"textarea">, "size"> &
|
|
280
|
+
Look & {
|
|
281
|
+
/** Grow with the text, from `rows` up to `maxRows`, then scroll. */
|
|
282
|
+
autoGrow?: boolean;
|
|
283
|
+
maxRows?: number;
|
|
284
|
+
}) {
|
|
285
|
+
const field = useField();
|
|
286
|
+
const [inner, setRef] = useMergedRef<HTMLTextAreaElement>(ref);
|
|
287
|
+
// Where the browser cannot size a field to its content (Safari, Firefox in 2026),
|
|
288
|
+
// the height is set from the scroll height on every change.
|
|
289
|
+
const fallback = autoGrow && !canSizeToContent();
|
|
290
|
+
const fit = () => {
|
|
291
|
+
const el = inner.current;
|
|
292
|
+
if (!el || !fallback) return;
|
|
293
|
+
el.style.height = "auto";
|
|
294
|
+
el.style.height = `${el.scrollHeight + 2}px`;
|
|
295
|
+
};
|
|
296
|
+
useLayoutEffect(fit);
|
|
297
|
+
const lineHeight = 1.5;
|
|
41
298
|
return (
|
|
42
299
|
<textarea
|
|
300
|
+
ref={setRef}
|
|
43
301
|
rows={rows}
|
|
44
|
-
|
|
45
|
-
|
|
302
|
+
onInput={(e) => {
|
|
303
|
+
onInput?.(e);
|
|
304
|
+
fit();
|
|
305
|
+
}}
|
|
306
|
+
style={
|
|
307
|
+
autoGrow
|
|
308
|
+
? {
|
|
309
|
+
minHeight: `calc(${rows} * ${lineHeight}em + 1rem)`,
|
|
310
|
+
maxHeight: maxRows ? `calc(${maxRows} * ${lineHeight}em + 1rem)` : undefined,
|
|
311
|
+
...props.style,
|
|
312
|
+
}
|
|
313
|
+
: props.style
|
|
314
|
+
}
|
|
315
|
+
className={cn(
|
|
316
|
+
controlVariants({ variant, size }),
|
|
317
|
+
"h-auto py-2 leading-normal",
|
|
318
|
+
autoGrow ? "resize-none overflow-y-auto field-sizing-content" : "resize-y",
|
|
319
|
+
className,
|
|
320
|
+
)}
|
|
321
|
+
{...fromField(field, props)}
|
|
46
322
|
/>
|
|
47
323
|
);
|
|
48
324
|
}
|
|
49
325
|
|
|
50
|
-
|
|
326
|
+
/* ── NumberInput ─────────────────────────────────────────────────────────────── */
|
|
327
|
+
|
|
328
|
+
/* A number. It is saved when the field is left or Enter is pressed, never on each
|
|
329
|
+
keystroke, so a half-typed "12." is never saved. Empty clears it (undefined);
|
|
330
|
+
anything that is not a number is put back as it was. "1,234.5", "1.234,5", "12,5"
|
|
331
|
+
and "$1 200" all read as people mean them (lib/number). The arrows step by
|
|
332
|
+
`step`, ten steps with Shift, within `min` and `max`. A value the app changes
|
|
333
|
+
while the field is not being typed in is shown at once. */
|
|
334
|
+
export function NumberInput({
|
|
335
|
+
value,
|
|
336
|
+
onChange,
|
|
337
|
+
min,
|
|
338
|
+
max,
|
|
339
|
+
step = 1,
|
|
340
|
+
variant,
|
|
341
|
+
size,
|
|
51
342
|
className,
|
|
343
|
+
onBlur,
|
|
344
|
+
onKeyDown,
|
|
345
|
+
onFocus,
|
|
52
346
|
...props
|
|
53
|
-
}:
|
|
347
|
+
}: Omit<InputProps, "value" | "onChange" | "defaultValue" | "min" | "max" | "step" | "type"> & {
|
|
348
|
+
value: number | undefined;
|
|
349
|
+
onChange: (value: number | undefined) => void;
|
|
350
|
+
min?: number;
|
|
351
|
+
max?: number;
|
|
352
|
+
step?: number;
|
|
353
|
+
}) {
|
|
354
|
+
const shown = value === undefined ? "" : String(value);
|
|
355
|
+
const [text, setText] = useState(shown);
|
|
356
|
+
const [editing, setEditing] = useState(false);
|
|
357
|
+
useEffect(() => {
|
|
358
|
+
if (!editing) setText(shown);
|
|
359
|
+
}, [shown, editing]);
|
|
360
|
+
|
|
361
|
+
const commit = (raw: string) => {
|
|
362
|
+
const n = parseNumber(raw);
|
|
363
|
+
if (n === null) return onChange(undefined);
|
|
364
|
+
if (Number.isNaN(n)) return setText(shown);
|
|
365
|
+
const next = clamp(n, min, max);
|
|
366
|
+
setText(String(next));
|
|
367
|
+
if (next !== value) onChange(next);
|
|
368
|
+
};
|
|
369
|
+
|
|
54
370
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
371
|
+
<Input
|
|
372
|
+
inputMode="decimal"
|
|
373
|
+
autoComplete="off"
|
|
374
|
+
variant={variant}
|
|
375
|
+
size={size}
|
|
376
|
+
value={text}
|
|
377
|
+
aria-valuemin={min}
|
|
378
|
+
aria-valuemax={max}
|
|
379
|
+
onChange={(e) => setText(e.target.value)}
|
|
380
|
+
onFocus={(e) => {
|
|
381
|
+
setEditing(true);
|
|
382
|
+
onFocus?.(e);
|
|
383
|
+
}}
|
|
384
|
+
onBlur={(e) => {
|
|
385
|
+
setEditing(false);
|
|
386
|
+
commit(e.target.value);
|
|
387
|
+
onBlur?.(e);
|
|
388
|
+
}}
|
|
389
|
+
onKeyDown={(e) => {
|
|
390
|
+
onKeyDown?.(e);
|
|
391
|
+
if (e.defaultPrevented) return;
|
|
392
|
+
if (e.key === "Enter") commit(e.currentTarget.value);
|
|
393
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
394
|
+
e.preventDefault();
|
|
395
|
+
const current = parseNumber(e.currentTarget.value);
|
|
396
|
+
const base = current === null || Number.isNaN(current) ? (value ?? 0) : current;
|
|
397
|
+
const by = (e.key === "ArrowUp" ? 1 : -1) * step * (e.shiftKey ? 10 : 1);
|
|
398
|
+
// Rounded to the step's own decimals, so 0.1 + 0.2 shows 0.3.
|
|
399
|
+
const decimals = (String(step).split(".")[1] ?? "").length;
|
|
400
|
+
const next = clamp(Number((base + by).toFixed(decimals)), min, max);
|
|
401
|
+
setText(String(next));
|
|
402
|
+
onChange(next);
|
|
403
|
+
}
|
|
404
|
+
}}
|
|
405
|
+
className={cn("tabular-nums", className)}
|
|
60
406
|
{...props}
|
|
61
407
|
/>
|
|
62
408
|
);
|
|
63
409
|
}
|
|
64
410
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
411
|
+
/* ── SearchField ─────────────────────────────────────────────────────────────── */
|
|
412
|
+
|
|
413
|
+
/* Finding something by typing: a search icon, a clear button once there is text,
|
|
414
|
+
and Escape to clear (a second Escape leaves the field). Announced as a search
|
|
415
|
+
box. `onChange` hands over the text, not an event. */
|
|
416
|
+
export function SearchField({
|
|
417
|
+
value,
|
|
418
|
+
onChange,
|
|
419
|
+
placeholder = "Search",
|
|
420
|
+
"aria-label": label,
|
|
421
|
+
size,
|
|
422
|
+
variant,
|
|
72
423
|
className,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
children: React.ReactNode;
|
|
79
|
-
className?: string;
|
|
424
|
+
onKeyDown,
|
|
425
|
+
...props
|
|
426
|
+
}: Omit<InputProps, "value" | "onChange" | "type" | "start" | "end"> & {
|
|
427
|
+
value: string;
|
|
428
|
+
onChange: (value: string) => void;
|
|
80
429
|
}) {
|
|
430
|
+
const input = useRef<HTMLInputElement>(null);
|
|
431
|
+
const inField = useField() !== null;
|
|
432
|
+
// Escape with text clears it and nothing else. A dialog around the field hears
|
|
433
|
+
// Escape on the document before the field does, so the window catches it first.
|
|
434
|
+
useEscapeFirst(value !== "", input, () => onChange(""));
|
|
81
435
|
return (
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
436
|
+
<Input
|
|
437
|
+
ref={input}
|
|
438
|
+
type="search"
|
|
439
|
+
role="searchbox"
|
|
440
|
+
aria-label={label ?? (inField ? undefined : placeholder)}
|
|
441
|
+
value={value}
|
|
442
|
+
onChange={(e) => onChange(e.target.value)}
|
|
443
|
+
onKeyDown={(e) => {
|
|
444
|
+
onKeyDown?.(e);
|
|
445
|
+
// With text, the window's listener above has cleared it.
|
|
446
|
+
if (e.key === "Escape" && !e.defaultPrevented && value === "") e.currentTarget.blur();
|
|
447
|
+
}}
|
|
448
|
+
placeholder={placeholder}
|
|
449
|
+
size={size}
|
|
450
|
+
variant={variant}
|
|
451
|
+
className={className}
|
|
452
|
+
start={<Search aria-hidden />}
|
|
453
|
+
end={
|
|
454
|
+
value !== "" ? (
|
|
455
|
+
<button
|
|
456
|
+
type="button"
|
|
457
|
+
aria-label="Clear"
|
|
458
|
+
onClick={() => {
|
|
459
|
+
onChange("");
|
|
460
|
+
input.current?.focus();
|
|
461
|
+
}}
|
|
462
|
+
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"
|
|
463
|
+
>
|
|
464
|
+
<X />
|
|
465
|
+
</button>
|
|
466
|
+
) : undefined
|
|
467
|
+
}
|
|
468
|
+
{...props}
|
|
469
|
+
/>
|
|
96
470
|
);
|
|
97
471
|
}
|
|
98
|
-
|
|
99
|
-
export { fieldBase };
|
|
@@ -42,14 +42,17 @@ export function LinkBlock({
|
|
|
42
42
|
return (
|
|
43
43
|
<div
|
|
44
44
|
className={cn(
|
|
45
|
-
"flex items-center gap-3 rounded-surface px-3.5 py-3 shadow-
|
|
45
|
+
"flex items-center gap-3 rounded-surface px-3.5 py-3 shadow-edge transition-colors duration-(--duration-fast) hover:bg-tint-hover",
|
|
46
46
|
className,
|
|
47
47
|
)}
|
|
48
48
|
>
|
|
49
49
|
<span className="flex size-9 shrink-0 items-center justify-center rounded-control bg-accent-tint text-accent-text">
|
|
50
50
|
<Globe className="size-4" />
|
|
51
51
|
</span>
|
|
52
|
-
|
|
52
|
+
{/* w-0 with flex-1: the column grows into the room there is rather than
|
|
53
|
+
starting from its text, so a long address cannot make the card (and a
|
|
54
|
+
phone's page) wider than it may be. */}
|
|
55
|
+
<div className="flex-1 w-0 min-w-0">
|
|
53
56
|
{onTitleChange ? (
|
|
54
57
|
<input
|
|
55
58
|
defaultValue={title}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ChevronLeft, MousePointerClick } from "lucide-react";
|
|
4
|
+
import type { ComponentProps, KeyboardEvent, ReactNode } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Button } from "./button.tsx";
|
|
7
|
+
import { EmptyState } from "./empty-state.tsx";
|
|
8
|
+
|
|
9
|
+
/* A list beside the one chosen from it: mail, notes, a feed with a reader.
|
|
10
|
+
|
|
11
|
+
From 48rem of room (its own width, not the window's, so it works inside a
|
|
12
|
+
sidebar app) the two sit side by side, each scrolling on its own. Narrower, one
|
|
13
|
+
shows at a time: the list, or, once something is chosen (`showDetail`), the
|
|
14
|
+
detail with a way back (`onBack`). The arrow keys move between the list's items
|
|
15
|
+
(ListItem). It fills the height it is given: put it in a parent with a height. */
|
|
16
|
+
export function ListDetail({
|
|
17
|
+
list,
|
|
18
|
+
detail,
|
|
19
|
+
showDetail,
|
|
20
|
+
onBack,
|
|
21
|
+
backLabel = "Back",
|
|
22
|
+
listLabel = "List",
|
|
23
|
+
detailLabel = "Detail",
|
|
24
|
+
empty,
|
|
25
|
+
listWidth = "20rem",
|
|
26
|
+
className,
|
|
27
|
+
}: {
|
|
28
|
+
list: ReactNode;
|
|
29
|
+
/** The chosen thing, or nothing yet. */
|
|
30
|
+
detail?: ReactNode;
|
|
31
|
+
/** Something is chosen: on a narrow screen, show it instead of the list. */
|
|
32
|
+
showDetail: boolean;
|
|
33
|
+
onBack: () => void;
|
|
34
|
+
backLabel?: string;
|
|
35
|
+
listLabel?: string;
|
|
36
|
+
detailLabel?: string;
|
|
37
|
+
/** Shown in the detail's place on a wide screen while nothing is chosen. */
|
|
38
|
+
empty?: ReactNode;
|
|
39
|
+
listWidth?: string;
|
|
40
|
+
className?: string;
|
|
41
|
+
}) {
|
|
42
|
+
const move = (e: KeyboardEvent<HTMLElement>) => {
|
|
43
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
44
|
+
const items = [...e.currentTarget.querySelectorAll<HTMLElement>("[data-list-item]")];
|
|
45
|
+
const at = items.indexOf(document.activeElement as HTMLElement);
|
|
46
|
+
if (at === -1) return;
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
items[Math.max(0, Math.min(items.length - 1, at + (e.key === "ArrowDown" ? 1 : -1)))]?.focus();
|
|
49
|
+
};
|
|
50
|
+
return (
|
|
51
|
+
<div className={cn("@container flex h-full min-h-0", className)} style={{ "--list-w": listWidth } as React.CSSProperties}>
|
|
52
|
+
<section
|
|
53
|
+
aria-label={listLabel}
|
|
54
|
+
onKeyDown={move}
|
|
55
|
+
className={cn(
|
|
56
|
+
"flex flex-col w-full @3xl:w-(--list-w) min-h-0 overflow-y-auto overscroll-contain shrink-0",
|
|
57
|
+
"@3xl:shadow-edge-r",
|
|
58
|
+
showDetail && "@max-3xl:hidden"
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
{list}
|
|
62
|
+
</section>
|
|
63
|
+
<section
|
|
64
|
+
aria-label={detailLabel}
|
|
65
|
+
className={cn("flex flex-col flex-1 min-w-0 min-h-0 overflow-y-auto overscroll-contain", !showDetail && "@max-3xl:hidden")}
|
|
66
|
+
>
|
|
67
|
+
{showDetail && (
|
|
68
|
+
<div className="@3xl:hidden px-2 pt-2">
|
|
69
|
+
<Button variant="ghost" size="sm" onClick={onBack}>
|
|
70
|
+
<ChevronLeft /> {backLabel}
|
|
71
|
+
</Button>
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
{showDetail ? detail : empty ?? <EmptyState icon={MousePointerClick} title="Nothing chosen" description="Choose one from the list." />}
|
|
75
|
+
</section>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* One item in a ListDetail's list: a title, a line under it, something at the end
|
|
81
|
+
(a date, a count). A button, or a link with `asChild`-free `href`. The chosen one
|
|
82
|
+
is tinted and says so (aria-current). */
|
|
83
|
+
export function ListItem({
|
|
84
|
+
title,
|
|
85
|
+
description,
|
|
86
|
+
meta,
|
|
87
|
+
selected,
|
|
88
|
+
className,
|
|
89
|
+
...props
|
|
90
|
+
}: Omit<ComponentProps<"button">, "title"> & {
|
|
91
|
+
title: ReactNode;
|
|
92
|
+
description?: ReactNode;
|
|
93
|
+
meta?: ReactNode;
|
|
94
|
+
selected?: boolean;
|
|
95
|
+
}) {
|
|
96
|
+
return (
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
data-list-item
|
|
100
|
+
aria-current={selected ? "true" : undefined}
|
|
101
|
+
className={cn(
|
|
102
|
+
"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]",
|
|
103
|
+
selected ? "bg-tint-active" : "hover:bg-tint-hover",
|
|
104
|
+
className
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<span className="flex items-baseline gap-2 w-full">
|
|
109
|
+
<span className="flex-1 min-w-0 font-medium text-ink text-sm truncate">{title}</span>
|
|
110
|
+
{meta !== undefined && <span className="tabular-nums text-caption text-ink-tertiary shrink-0">{meta}</span>}
|
|
111
|
+
</span>
|
|
112
|
+
{description !== undefined && <span className="w-full text-ink-secondary text-sm line-clamp-2">{description}</span>}
|
|
113
|
+
</button>
|
|
114
|
+
);
|
|
115
|
+
}
|