@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
|
@@ -5,12 +5,14 @@ import { CornerDownLeft, Search, type LucideIcon } from "lucide-react";
|
|
|
5
5
|
import { Fragment, useEffect, useId, useMemo, useRef, useState, type ReactNode } from "react";
|
|
6
6
|
import { rankEntries, type SpotlightEntry } from "../../lib/spotlight.ts";
|
|
7
7
|
import { cn } from "../../lib/utils.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { Shortcut } from "./typography.tsx";
|
|
9
|
+
import { matchShortcut } from "../../lib/keys.ts";
|
|
10
|
+
import { EmptyState } from "./empty-state.tsx";
|
|
11
|
+
import { DialogOverlay } from "./dialog.tsx";
|
|
12
|
+
import { optionClasses } from "./listbox.ts";
|
|
9
13
|
|
|
10
14
|
export type SpotlightItem = SpotlightEntry & { icon?: LucideIcon };
|
|
11
15
|
|
|
12
|
-
/** Whether the platform's own shortcut modifier is ⌘ rather than Ctrl. */
|
|
13
|
-
const mac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* ⌘K (Ctrl+K elsewhere) from anywhere on the page calls `toggle`. Kept apart from
|
|
@@ -21,7 +23,7 @@ export function useSpotlightShortcut(toggle: () => void): void {
|
|
|
21
23
|
latest.current = toggle;
|
|
22
24
|
useEffect(() => {
|
|
23
25
|
const onKey = (e: KeyboardEvent) => {
|
|
24
|
-
if (e
|
|
26
|
+
if (matchShortcut(e, "mod+k")) {
|
|
25
27
|
e.preventDefault();
|
|
26
28
|
latest.current();
|
|
27
29
|
}
|
|
@@ -88,9 +90,10 @@ export function Spotlight({
|
|
|
88
90
|
const list = useRef<HTMLDivElement>(null);
|
|
89
91
|
const id = useId();
|
|
90
92
|
|
|
91
|
-
// Every opening starts afresh
|
|
93
|
+
// Every opening starts afresh: reset while closing, so the first frame of the
|
|
94
|
+
// next opening never shows last time's search.
|
|
92
95
|
useEffect(() => {
|
|
93
|
-
if (
|
|
96
|
+
if (open) return;
|
|
94
97
|
setQuery("");
|
|
95
98
|
setIndex(0);
|
|
96
99
|
}, [open]);
|
|
@@ -118,18 +121,18 @@ export function Spotlight({
|
|
|
118
121
|
return (
|
|
119
122
|
<DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>
|
|
120
123
|
<DialogPrimitive.Portal>
|
|
121
|
-
<
|
|
124
|
+
<DialogOverlay />
|
|
122
125
|
<DialogPrimitive.Content
|
|
123
126
|
aria-describedby={undefined}
|
|
124
127
|
className={cn(
|
|
125
|
-
"z-
|
|
128
|
+
"z-(--z-overlay) fixed top-[12dvh] left-1/2 -translate-x-1/2 flex flex-col",
|
|
126
129
|
"w-[calc(100vw-2rem)] max-w-xl max-h-[min(30rem,76dvh)] overflow-hidden outline-none",
|
|
127
130
|
"bg-surface-overlay shadow-dialog rounded-overlay",
|
|
128
131
|
"data-[state=open]:animate-scale-in data-[state=closed]:animate-scale-out",
|
|
129
132
|
)}
|
|
130
133
|
>
|
|
131
134
|
<DialogPrimitive.Title className="sr-only">{title}</DialogPrimitive.Title>
|
|
132
|
-
<div className="flex items-center gap-2.5 shadow-
|
|
135
|
+
<div className="flex items-center gap-2.5 shadow-edge-b px-4 h-12 shrink-0">
|
|
133
136
|
<Search className="size-4 text-ink-tertiary shrink-0" />
|
|
134
137
|
<input
|
|
135
138
|
autoFocus
|
|
@@ -162,7 +165,7 @@ export function Spotlight({
|
|
|
162
165
|
</div>
|
|
163
166
|
|
|
164
167
|
<div ref={list} id={`${id}-list`} role="listbox" aria-label={title} className="flex-1 p-1.5 min-h-0 overflow-y-auto overscroll-contain">
|
|
165
|
-
{results.length === 0 && <
|
|
168
|
+
{results.length === 0 && <EmptyState compact title={empty} />}
|
|
166
169
|
{results.map(({ item, hits }, i) => {
|
|
167
170
|
const heading = browsing && item.group !== undefined && item.group !== results[i - 1]?.item.group;
|
|
168
171
|
const Icon = item.icon;
|
|
@@ -173,13 +176,11 @@ export function Spotlight({
|
|
|
173
176
|
id={`${id}-${i}`}
|
|
174
177
|
role="option"
|
|
175
178
|
aria-selected={i === active}
|
|
179
|
+
data-active={i === active}
|
|
176
180
|
// Movement, not entry: a list scrolled under a still pointer keeps the keyboard's pick.
|
|
177
181
|
onPointerMove={() => i !== active && setIndex(i)}
|
|
178
182
|
onClick={() => pick(item)}
|
|
179
|
-
className={cn(
|
|
180
|
-
"flex items-center gap-2.5 px-2 rounded-control h-9 text-sm cursor-pointer select-none",
|
|
181
|
-
i === active && "bg-tint-hover",
|
|
182
|
-
)}
|
|
183
|
+
className={cn(optionClasses, "gap-2.5 h-control-md")}
|
|
183
184
|
>
|
|
184
185
|
{Icon && <Icon className="size-4 text-ink-secondary shrink-0" />}
|
|
185
186
|
<span className="min-w-0 text-ink truncate">
|
|
@@ -195,23 +196,22 @@ export function Spotlight({
|
|
|
195
196
|
})}
|
|
196
197
|
</div>
|
|
197
198
|
|
|
198
|
-
<div className="max-sm:hidden flex items-center gap-4 shadow-
|
|
199
|
+
<div className="max-sm:hidden flex items-center gap-4 shadow-edge-t px-4 h-9 text-caption text-ink-tertiary shrink-0">
|
|
199
200
|
<span className="flex items-center gap-1">
|
|
200
|
-
<
|
|
201
|
-
<
|
|
201
|
+
<Shortcut keys="up" />
|
|
202
|
+
<Shortcut keys="down" />
|
|
202
203
|
to move
|
|
203
204
|
</span>
|
|
204
205
|
<span className="flex items-center gap-1">
|
|
205
|
-
<
|
|
206
|
+
<Shortcut keys="enter" />
|
|
206
207
|
to open
|
|
207
208
|
</span>
|
|
208
209
|
<span className="flex items-center gap-1">
|
|
209
|
-
<
|
|
210
|
+
<Shortcut keys="escape" />
|
|
210
211
|
to close
|
|
211
212
|
</span>
|
|
212
213
|
<span className="flex items-center gap-1 ml-auto">
|
|
213
|
-
<
|
|
214
|
-
<Kbd>K</Kbd>
|
|
214
|
+
<Shortcut keys="mod+k" />
|
|
215
215
|
anywhere
|
|
216
216
|
</span>
|
|
217
217
|
</div>
|
|
@@ -13,19 +13,19 @@ export function Stepper({ steps, step, className }: { steps: readonly string[];
|
|
|
13
13
|
<ol className={cn("flex items-center gap-2 text-sm", className)}>
|
|
14
14
|
{steps.map((label, index) => (
|
|
15
15
|
<li key={label} className="flex items-center gap-2">
|
|
16
|
-
{index > 0 && <span aria-hidden className={cn("h-px w-5 transition-colors duration-
|
|
16
|
+
{index > 0 && <span aria-hidden className={cn("h-px w-5 transition-colors duration-(--duration-slow) sm:w-8", index <= step ? "bg-accent" : "bg-hairline-strong")} />}
|
|
17
17
|
<span
|
|
18
18
|
aria-current={index === step ? "step" : undefined}
|
|
19
19
|
className={cn(
|
|
20
|
-
"flex items-center gap-1.5 transition-colors duration-
|
|
20
|
+
"flex items-center gap-1.5 transition-colors duration-(--duration-slow)",
|
|
21
21
|
index === step ? "font-medium text-ink" : index < step ? "text-ink-secondary" : "text-ink-tertiary",
|
|
22
22
|
)}
|
|
23
23
|
>
|
|
24
24
|
<span
|
|
25
25
|
className={cn(
|
|
26
|
-
"flex size-5 items-center justify-center rounded-full text-caption font-medium tabular-nums transition-colors duration-
|
|
26
|
+
"flex size-5 items-center justify-center rounded-full text-caption font-medium tabular-nums transition-colors duration-(--duration-slow)",
|
|
27
27
|
index < step
|
|
28
|
-
? "bg-accent text-accent-ink"
|
|
28
|
+
? "bg-accent-solid text-accent-ink"
|
|
29
29
|
: index === step
|
|
30
30
|
? "bg-accent-tint text-accent-text shadow-[inset_0_0_0_1px_var(--accent)]"
|
|
31
31
|
: "bg-tint-active text-ink-tertiary",
|
|
@@ -93,11 +93,11 @@ export function StepDialog({
|
|
|
93
93
|
{banner}
|
|
94
94
|
</header>
|
|
95
95
|
|
|
96
|
-
<div key={step} className="min-h-0 flex-1 animate-step-in overflow-y-auto px-6 py-4" style={{ "--from": from } as CSSProperties}>
|
|
96
|
+
<div key={step} className="min-h-0 flex-1 animate-step-in overflow-y-auto overscroll-contain px-6 py-4" style={{ "--from": from } as CSSProperties}>
|
|
97
97
|
{children}
|
|
98
98
|
</div>
|
|
99
99
|
|
|
100
|
-
<footer className="flex shrink-0 items-center gap-2 px-6 py-4 shadow-
|
|
100
|
+
<footer className="flex shrink-0 items-center gap-2 px-6 py-4 shadow-edge-t">{footer}</footer>
|
|
101
101
|
</DialogContent>
|
|
102
102
|
</Dialog>
|
|
103
103
|
);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type ReactNode } from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.ts";
|
|
5
|
+
import { Button } from "./button.tsx";
|
|
6
|
+
import { ProgressBar } from "./progress.tsx";
|
|
7
|
+
import { Stepper } from "./step-dialog.tsx";
|
|
8
|
+
|
|
9
|
+
/* A flow of several steps as a page of its own: onboarding, setting something up.
|
|
10
|
+
The steps across the top (on a phone, "Step 2 of 4" and a bar), one step's
|
|
11
|
+
content in the middle sliding in from the side it came from, and Back and
|
|
12
|
+
Continue in a bar that stays at the foot of the window. Moving to a step puts
|
|
13
|
+
focus at its top, so a screen reader starts reading it there. For a short flow
|
|
14
|
+
over a page, StepDialog. */
|
|
15
|
+
export function StepsLayout({
|
|
16
|
+
steps,
|
|
17
|
+
step,
|
|
18
|
+
onBack,
|
|
19
|
+
onNext,
|
|
20
|
+
canNext = true,
|
|
21
|
+
nextLabel = "Continue",
|
|
22
|
+
finishLabel = "Finish",
|
|
23
|
+
backLabel = "Back",
|
|
24
|
+
exit,
|
|
25
|
+
busy = false,
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
}: {
|
|
29
|
+
steps: readonly string[];
|
|
30
|
+
/** Which step is showing, from 0. */
|
|
31
|
+
step: number;
|
|
32
|
+
onBack: () => void;
|
|
33
|
+
/** Continue, or on the last step, finish. */
|
|
34
|
+
onNext: () => void;
|
|
35
|
+
canNext?: boolean;
|
|
36
|
+
nextLabel?: string;
|
|
37
|
+
finishLabel?: string;
|
|
38
|
+
backLabel?: string;
|
|
39
|
+
/** A way out, top left: Cancel, Skip. */
|
|
40
|
+
exit?: ReactNode;
|
|
41
|
+
/** Continue is working (saving the step). */
|
|
42
|
+
busy?: boolean;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
className?: string;
|
|
45
|
+
}) {
|
|
46
|
+
const last = useRef(step);
|
|
47
|
+
const from = step >= last.current ? 1 : -1;
|
|
48
|
+
const content = useRef<HTMLDivElement>(null);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (last.current !== step) content.current?.focus({ preventScroll: false });
|
|
51
|
+
last.current = step;
|
|
52
|
+
}, [step]);
|
|
53
|
+
const final = step === steps.length - 1;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className={cn("@container flex flex-col bg-surface min-h-dvh", className)}>
|
|
57
|
+
<header className="flex items-center gap-4 px-5 @xl:px-8 h-14 shrink-0">
|
|
58
|
+
<div className="flex items-center min-w-0">{exit}</div>
|
|
59
|
+
<div className="@max-2xl:hidden flex flex-1 justify-center">
|
|
60
|
+
<Stepper steps={steps} step={step} />
|
|
61
|
+
</div>
|
|
62
|
+
<div className="@2xl:hidden flex flex-col flex-1 gap-1.5">
|
|
63
|
+
<span className="text-caption text-ink-secondary">
|
|
64
|
+
Step {step + 1} of {steps.length}: <span className="font-medium text-ink">{steps[step]}</span>
|
|
65
|
+
</span>
|
|
66
|
+
<ProgressBar value={step + 1} max={steps.length} size="sm" label="Progress" valueText={`Step ${step + 1} of ${steps.length}`} />
|
|
67
|
+
</div>
|
|
68
|
+
</header>
|
|
69
|
+
<main className="flex flex-1 justify-center px-5 @xl:px-8 py-8 @xl:py-14">
|
|
70
|
+
<div
|
|
71
|
+
key={step}
|
|
72
|
+
ref={content}
|
|
73
|
+
tabIndex={-1}
|
|
74
|
+
aria-label={`Step ${step + 1} of ${steps.length}: ${steps[step]}`}
|
|
75
|
+
style={{ "--from": from } as React.CSSProperties}
|
|
76
|
+
className="w-full max-w-lg outline-none animate-step-in"
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</div>
|
|
80
|
+
</main>
|
|
81
|
+
<footer className="bottom-0 z-(--z-sticky) sticky flex justify-between items-center gap-2 bg-surface shadow-edge-t px-5 @xl:px-8 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]">
|
|
82
|
+
<Button variant="ghost" onClick={onBack} disabled={step === 0}>
|
|
83
|
+
{backLabel}
|
|
84
|
+
</Button>
|
|
85
|
+
<Button variant="primary" onClick={onNext} disabled={!canNext} loading={busy}>
|
|
86
|
+
{final ? finishLabel : nextLabel}
|
|
87
|
+
</Button>
|
|
88
|
+
</footer>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
4
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { ChoiceLabel } from "./choice-label.tsx";
|
|
7
|
+
import { fromField, useField } from "./input.tsx";
|
|
8
|
+
|
|
9
|
+
/* A setting that is on or off and takes effect at once: no Save to press. For a
|
|
10
|
+
choice that is saved with a form, a Checkbox. Off is a track in the control edge
|
|
11
|
+
(3:1, so it reads as a control and not as a gap), on is the accent; the thumb is
|
|
12
|
+
white on both. With `label` the words sit before it, pressable too. */
|
|
13
|
+
|
|
14
|
+
const track = {
|
|
15
|
+
sm: "h-4 w-7 [&>span]:size-3 [&>span]:data-[state=checked]:translate-x-3",
|
|
16
|
+
md: "h-5 w-9 [&>span]:size-4 [&>span]:data-[state=checked]:translate-x-4",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function Switch({
|
|
20
|
+
size = "md",
|
|
21
|
+
label,
|
|
22
|
+
description,
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: ComponentProps<typeof SwitchPrimitive.Root> & { size?: "sm" | "md"; label?: ReactNode; description?: ReactNode }) {
|
|
26
|
+
const own = fromField(useField(), props);
|
|
27
|
+
return (
|
|
28
|
+
<ChoiceLabel
|
|
29
|
+
end
|
|
30
|
+
label={label}
|
|
31
|
+
description={description}
|
|
32
|
+
disabled={own.disabled}
|
|
33
|
+
control={({ labelId, descriptionId }) => (
|
|
34
|
+
<SwitchPrimitive.Root
|
|
35
|
+
aria-labelledby={own["aria-labelledby"] ?? labelId}
|
|
36
|
+
{...own}
|
|
37
|
+
aria-describedby={[own["aria-describedby"], descriptionId].filter(Boolean).join(" ") || undefined}
|
|
38
|
+
className={cn(
|
|
39
|
+
"relative inline-flex items-center p-0.5 rounded-full shrink-0 outline-offset-2",
|
|
40
|
+
"bg-control-edge data-[state=checked]:bg-accent-solid hover:data-[state=checked]:bg-accent-solid-hover",
|
|
41
|
+
"transition-colors duration-(--duration-fast)",
|
|
42
|
+
"aria-invalid:shadow-[0_0_0_1.5px_var(--danger)]",
|
|
43
|
+
"disabled:cursor-not-allowed disabled:bg-tint-active disabled:data-[state=checked]:bg-tint-active",
|
|
44
|
+
// 24px to press.
|
|
45
|
+
"after:absolute after:-inset-y-1 after:-inset-x-0.5 after:content-['']",
|
|
46
|
+
track[size],
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<SwitchPrimitive.Thumb className="block bg-accent-ink shadow-sm rounded-full transition-transform duration-(--duration-fast) ease-out-notion" />
|
|
51
|
+
</SwitchPrimitive.Root>
|
|
52
|
+
)}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -1,42 +1,99 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { createContext, useContext, useEffect, useId, useRef, useState, type ComponentProps } from "react";
|
|
4
4
|
import { cn } from "../../lib/utils.ts";
|
|
5
5
|
|
|
6
6
|
/* Notion's simple table: a hairline grid, a sunken header row, 14px text. It scrolls
|
|
7
7
|
sideways inside its own box rather than squeezing columns below a readable width,
|
|
8
|
-
which is what keeps a page from scrolling sideways on a phone.
|
|
8
|
+
which is what keeps a page from scrolling sideways on a phone. That box can be
|
|
9
|
+
reached with Tab and scrolled with the arrow keys, and is named by the table's
|
|
10
|
+
caption (or `label`), so the part out of view is not out of reach.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
A number column: `<Td numeric>` and `<Th numeric>`, right-aligned in figures of one
|
|
13
|
+
width so the digits line up. A row that opens something: ClickableRow. */
|
|
14
|
+
|
|
15
|
+
const CaptionId = createContext<string | undefined>(undefined);
|
|
16
|
+
|
|
17
|
+
export function Table({ className, children, label, ...props }: ComponentProps<"table"> & { label?: string }) {
|
|
18
|
+
const captionId = useId();
|
|
19
|
+
const box = useRef<HTMLDivElement>(null);
|
|
20
|
+
// Only a table wider than its box is a stop for the keyboard: one that fits has
|
|
21
|
+
// nothing to scroll, and an extra Tab stop would only be in the way.
|
|
22
|
+
const [scrolls, setScrolls] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const el = box.current;
|
|
25
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
26
|
+
const check = () => setScrolls(el.scrollWidth > el.clientWidth + 1);
|
|
27
|
+
const observer = new ResizeObserver(check);
|
|
28
|
+
observer.observe(el);
|
|
29
|
+
if (el.firstElementChild) observer.observe(el.firstElementChild);
|
|
30
|
+
check();
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
}, []);
|
|
33
|
+
const [hasCaption, setHasCaption] = useState(false);
|
|
34
|
+
useEffect(() => setHasCaption(!!box.current?.querySelector(`[id="${captionId}"]`)), [children, captionId]);
|
|
35
|
+
const named = label !== undefined || hasCaption;
|
|
11
36
|
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
// A region the keyboard can scroll, named by `label` or the caption.
|
|
38
|
+
<div
|
|
39
|
+
ref={box}
|
|
40
|
+
role={scrolls && named ? "region" : undefined}
|
|
41
|
+
aria-label={scrolls ? label : undefined}
|
|
42
|
+
aria-labelledby={scrolls && label === undefined && hasCaption ? captionId : undefined}
|
|
43
|
+
tabIndex={scrolls ? 0 : undefined}
|
|
44
|
+
className="rounded-small overflow-x-auto outline-offset-2"
|
|
45
|
+
>
|
|
46
|
+
<CaptionId.Provider value={captionId}>
|
|
47
|
+
<table className={cn("w-full text-sm border-collapse", className)} {...props}>
|
|
48
|
+
{children}
|
|
49
|
+
</table>
|
|
50
|
+
</CaptionId.Provider>
|
|
16
51
|
</div>
|
|
17
52
|
);
|
|
18
53
|
}
|
|
19
54
|
|
|
20
|
-
|
|
55
|
+
/** The table's name, shown above it; it names the scrolling box too. */
|
|
56
|
+
export function TableCaption({ className, ...props }: ComponentProps<"caption">) {
|
|
57
|
+
const id = useContext(CaptionId);
|
|
58
|
+
return <caption id={id} className={cn("mb-2 font-medium text-ink-secondary text-sm text-left caption-top", className)} {...props} />;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const cell = "border border-hairline-strong px-2.25 py-1.75 text-left align-top";
|
|
21
62
|
|
|
22
|
-
export function Th({ className, ...props }:
|
|
23
|
-
return <th scope="col" className={cn(cell, "bg-surface-sunken font-medium", className)} {...props} />;
|
|
63
|
+
export function Th({ className, numeric, ...props }: ComponentProps<"th"> & { numeric?: boolean }) {
|
|
64
|
+
return <th scope="col" className={cn(cell, "bg-surface-sunken font-medium", numeric && "text-right", className)} {...props} />;
|
|
24
65
|
}
|
|
25
66
|
|
|
26
|
-
export function Td({ className, ...props }:
|
|
27
|
-
return <td className={cn(cell, "min-w-28", className)} {...props} />;
|
|
67
|
+
export function Td({ className, numeric, ...props }: ComponentProps<"td"> & { numeric?: boolean }) {
|
|
68
|
+
return <td className={cn(cell, "min-w-28", numeric && "text-right tabular-nums", className)} {...props} />;
|
|
28
69
|
}
|
|
29
70
|
|
|
30
71
|
/* A row that opens something: hover tint, pointer, and Enter from the keyboard. */
|
|
31
|
-
export function ClickableRow({ className, onOpen, ...props }:
|
|
72
|
+
export function ClickableRow({ className, onOpen, onClick, onKeyDown, ...props }: ComponentProps<"tr"> & { onOpen: () => void }) {
|
|
32
73
|
return (
|
|
33
74
|
<tr
|
|
34
|
-
tabIndex={0}
|
|
35
|
-
// A link inside a cell keeps its own click.
|
|
36
|
-
onClick={(e) => !(e.target as Element).closest("a") && onOpen()}
|
|
37
|
-
onKeyDown={(e) => e.key === "Enter" && onOpen()}
|
|
38
|
-
className={cn("cursor-pointer outline-offset-[-2px] transition-colors duration-100 hover:bg-tint-hover", className)}
|
|
39
75
|
{...props}
|
|
76
|
+
tabIndex={0}
|
|
77
|
+
onClick={(e) => {
|
|
78
|
+
onClick?.(e);
|
|
79
|
+
if (e.defaultPrevented) return;
|
|
80
|
+
// React carries clicks up from portals, so a choice in a menu opened from
|
|
81
|
+
// this row arrives here too; only a click in the row's own DOM opens it.
|
|
82
|
+
if (!e.currentTarget.contains(e.target as Node)) return;
|
|
83
|
+
// A link or a button inside a cell keeps its own click.
|
|
84
|
+
if ((e.target as Element).closest("a, button")) return;
|
|
85
|
+
onOpen();
|
|
86
|
+
}}
|
|
87
|
+
onKeyDown={(e) => {
|
|
88
|
+
onKeyDown?.(e);
|
|
89
|
+
if (e.defaultPrevented || e.target !== e.currentTarget) return;
|
|
90
|
+
// Enter or Space, as for anything else that opens.
|
|
91
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
onOpen();
|
|
94
|
+
}
|
|
95
|
+
}}
|
|
96
|
+
className={cn("cursor-pointer outline-offset-[-2px] transition-colors duration-(--duration-fast) hover:bg-tint-hover", className)}
|
|
40
97
|
/>
|
|
41
98
|
);
|
|
42
99
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* Notion's tabs: a row of names over a hairline, the current one in full ink with
|
|
8
|
+
a 2px rule under it in the ink (well over 3:1). The arrow keys move between them,
|
|
9
|
+
Tab goes into the panel. A row too long for its space scrolls sideways rather
|
|
10
|
+
than wrapping. For choosing a value, not a view, use Segmented. */
|
|
11
|
+
|
|
12
|
+
export const Tabs = TabsPrimitive.Root;
|
|
13
|
+
|
|
14
|
+
export function TabsList({ className, ...props }: ComponentProps<typeof TabsPrimitive.List>) {
|
|
15
|
+
return (
|
|
16
|
+
<TabsPrimitive.List
|
|
17
|
+
className={cn("flex gap-1 shadow-edge-b overflow-x-auto [scrollbar-width:none]", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function TabsTrigger({ className, ...props }: ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
24
|
+
return (
|
|
25
|
+
<TabsPrimitive.Trigger
|
|
26
|
+
className={cn(
|
|
27
|
+
"inline-flex relative items-center gap-1.5 px-2 h-control-md font-medium text-ink-secondary text-sm whitespace-nowrap outline-offset-[-2px] shrink-0",
|
|
28
|
+
"hover:text-ink transition-colors duration-(--duration-fast) [&_svg]:size-4",
|
|
29
|
+
"after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:content-[''] after:bg-transparent",
|
|
30
|
+
"data-[state=active]:text-ink data-[state=active]:after:bg-ink",
|
|
31
|
+
"disabled:text-ink-disabled disabled:cursor-not-allowed",
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function TabsContent({ className, ...props }: ComponentProps<typeof TabsPrimitive.Content>) {
|
|
40
|
+
return <TabsPrimitive.Content className={cn("pt-4 rounded-control outline-offset-2", className)} {...props} />;
|
|
41
|
+
}
|
|
@@ -1,101 +1,92 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { AnimatePresence, motion, useAnimationControls } from "framer-motion";
|
|
5
3
|
import { Moon, Sun } from "lucide-react";
|
|
4
|
+
import { createContext, useContext, useEffect, useLayoutEffect, useState, type ReactNode } from "react";
|
|
5
|
+
import { isTheme, THEME_KEY, type Theme } from "../../lib/theme.ts";
|
|
6
6
|
import { Button } from "./button.tsx";
|
|
7
|
-
import {
|
|
7
|
+
import { Tooltip } from "./tooltip.tsx";
|
|
8
8
|
|
|
9
|
-
type
|
|
9
|
+
type ThemeContextValue = { theme: Theme; resolved: "light" | "dark"; setTheme: (theme: Theme) => void };
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return document.documentElement.classList.contains("dark")
|
|
15
|
-
? "dark"
|
|
16
|
-
: "light";
|
|
17
|
-
}
|
|
11
|
+
const ThemeContext = createContext<ThemeContextValue | null>(null);
|
|
12
|
+
|
|
13
|
+
const prefersDark = (): boolean => typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
18
14
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
function read(storageKey: string): Theme {
|
|
16
|
+
try {
|
|
17
|
+
const stored = localStorage.getItem(storageKey);
|
|
18
|
+
return isTheme(stored) ? stored : "system";
|
|
19
|
+
} catch {
|
|
20
|
+
// Private windows and blocked site data both throw here.
|
|
21
|
+
return "system";
|
|
22
|
+
}
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
/* Holds the theme for everything inside it and puts the `dark` class on <html>.
|
|
26
|
+
"system" keeps following the OS after load, not just at it. Pair it with
|
|
27
|
+
themeInitScript() in <head> so the first paint is already right.
|
|
28
|
+
|
|
29
|
+
The first render is the same on the server and in the browser (system, light),
|
|
30
|
+
so a server-rendered page hydrates without a mismatch; the stored choice and the
|
|
31
|
+
system's are read straight after, before the browser paints. Until then the
|
|
32
|
+
`dark` class is left as the init script set it, so there is no flash either.
|
|
33
|
+
|
|
34
|
+
From triptrack and medialogue, 2026-12-05; it replaces the kit's animated toggle,
|
|
35
|
+
which had no system mode and could throw where storage is blocked. */
|
|
36
|
+
export function ThemeProvider({ children, storageKey = THEME_KEY }: { children: ReactNode; storageKey?: string }) {
|
|
37
|
+
const [theme, setThemeState] = useState<Theme>("system");
|
|
38
|
+
const [systemDark, setSystemDark] = useState(false);
|
|
39
|
+
const [ready, setReady] = useState(false);
|
|
40
|
+
|
|
41
|
+
useLayoutEffect(() => {
|
|
42
|
+
setThemeState(read(storageKey));
|
|
43
|
+
setSystemDark(prefersDark());
|
|
44
|
+
setReady(true);
|
|
45
|
+
}, [storageKey]);
|
|
33
46
|
|
|
34
47
|
useEffect(() => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
const query = window.matchMedia("(prefers-color-scheme: dark)");
|
|
49
|
+
const onChange = (event: MediaQueryListEvent) => setSystemDark(event.matches);
|
|
50
|
+
query.addEventListener("change", onChange);
|
|
51
|
+
return () => query.removeEventListener("change", onChange);
|
|
38
52
|
}, []);
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
const next: Theme = theme === "dark" ? "light" : "dark";
|
|
42
|
-
setFillDark(next === "dark");
|
|
43
|
-
setTheme(next);
|
|
44
|
-
apply(next);
|
|
45
|
-
// Reset to collapsed then sweep — only on explicit click, never on mount
|
|
46
|
-
fillControls.set({ clipPath: "circle(0% at 100% 0%)" });
|
|
47
|
-
fillControls.start({
|
|
48
|
-
clipPath: "circle(150% at 100% 0%)",
|
|
49
|
-
transition: { duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
50
|
-
});
|
|
51
|
-
}
|
|
54
|
+
const resolved = theme === "system" ? (systemDark ? "dark" : "light") : theme;
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (ready) document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
58
|
+
}, [resolved, ready]);
|
|
59
|
+
|
|
60
|
+
const setTheme = (next: Theme) => {
|
|
61
|
+
setThemeState(next);
|
|
62
|
+
try {
|
|
63
|
+
localStorage.setItem(storageKey, next);
|
|
64
|
+
} catch {
|
|
65
|
+
// Remembering the choice is a convenience, not a requirement.
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return <ThemeContext.Provider value={{ theme, resolved, setTheme }}>{children}</ThemeContext.Provider>;
|
|
70
|
+
}
|
|
54
71
|
|
|
72
|
+
/** The theme chosen (`theme`), what it comes to now (`resolved`), and a way to change it. */
|
|
73
|
+
export function useTheme(): ThemeContextValue {
|
|
74
|
+
const value = useContext(ThemeContext);
|
|
75
|
+
if (value === null) throw new Error("useTheme must be used inside ThemeProvider");
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* One button between light and dark. Until it is pressed the app follows the
|
|
80
|
+
system; pressing it is a choice, and the choice is kept. To offer "system" again,
|
|
81
|
+
put the three THEMES in a Segmented or a menu and call setTheme. */
|
|
82
|
+
export function ThemeToggle() {
|
|
83
|
+
const { resolved, setTheme } = useTheme();
|
|
84
|
+
const next = resolved === "dark" ? "light" : "dark";
|
|
55
85
|
return (
|
|
56
|
-
<
|
|
57
|
-
variant="
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
className="relative overflow-hidden"
|
|
62
|
-
>
|
|
63
|
-
<motion.span
|
|
64
|
-
className={cn(
|
|
65
|
-
"absolute inset-0 rounded-[inherit] pointer-events-none",
|
|
66
|
-
fillDark ? "bg-zinc-900" : "bg-amber-50",
|
|
67
|
-
)}
|
|
68
|
-
initial={{ clipPath: "circle(0% at 100% 0%)" }}
|
|
69
|
-
animate={fillControls}
|
|
70
|
-
/>
|
|
71
|
-
|
|
72
|
-
<AnimatePresence mode="wait" initial={false}>
|
|
73
|
-
{!mounted ? (
|
|
74
|
-
<span key="placeholder" className="size-4" />
|
|
75
|
-
) : isDark ? (
|
|
76
|
-
<motion.span
|
|
77
|
-
key="moon"
|
|
78
|
-
className="z-10 relative"
|
|
79
|
-
initial={{ opacity: 0, rotate: -45, scale: 0.5 }}
|
|
80
|
-
animate={{ opacity: 1, rotate: 0, scale: 1 }}
|
|
81
|
-
exit={{ opacity: 0, rotate: 45, scale: 0.5 }}
|
|
82
|
-
transition={{ duration: 0.15 }}
|
|
83
|
-
>
|
|
84
|
-
<Moon className="size-4 text-indigo-300" />
|
|
85
|
-
</motion.span>
|
|
86
|
-
) : (
|
|
87
|
-
<motion.span
|
|
88
|
-
key="sun"
|
|
89
|
-
className="z-10 relative"
|
|
90
|
-
initial={{ opacity: 0, rotate: 45, scale: 0.5 }}
|
|
91
|
-
animate={{ opacity: 1, rotate: 0, scale: 1 }}
|
|
92
|
-
exit={{ opacity: 0, rotate: -45, scale: 0.5 }}
|
|
93
|
-
transition={{ duration: 0.15 }}
|
|
94
|
-
>
|
|
95
|
-
<Sun className="size-4 text-amber-600" />
|
|
96
|
-
</motion.span>
|
|
97
|
-
)}
|
|
98
|
-
</AnimatePresence>
|
|
99
|
-
</Button>
|
|
86
|
+
<Tooltip content="Toggle theme" side="bottom">
|
|
87
|
+
<Button variant="ghost" size="icon-sm" aria-label={`Switch to ${next} mode`} onClick={() => setTheme(next)}>
|
|
88
|
+
{resolved === "dark" ? <Moon /> : <Sun />}
|
|
89
|
+
</Button>
|
|
90
|
+
</Tooltip>
|
|
100
91
|
);
|
|
101
92
|
}
|