@kujoforall/paper-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +252 -2
- package/dist/components/editor/block-text.d.ts +8 -0
- package/dist/components/editor/block-text.d.ts.map +1 -0
- package/dist/components/editor/block-text.js +213 -0
- package/dist/components/editor/block-text.js.map +1 -0
- package/dist/components/editor/blocks.d.ts +33 -0
- package/dist/components/editor/blocks.d.ts.map +1 -0
- package/dist/components/editor/blocks.js +187 -0
- package/dist/components/editor/blocks.js.map +1 -0
- package/dist/components/editor/document-editor.d.ts +27 -0
- package/dist/components/editor/document-editor.d.ts.map +1 -0
- package/dist/components/editor/document-editor.js +40 -0
- package/dist/components/editor/document-editor.js.map +1 -0
- package/dist/components/editor/document-view.d.ts +22 -0
- package/dist/components/editor/document-view.d.ts.map +1 -0
- package/dist/components/editor/document-view.js +105 -0
- package/dist/components/editor/document-view.js.map +1 -0
- package/dist/components/editor/editor-state.d.ts +100 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -0
- package/dist/components/editor/editor-state.js +192 -0
- package/dist/components/editor/editor-state.js.map +1 -0
- package/dist/components/editor/extensions/spoiler.d.ts +8 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
- package/dist/components/editor/extensions/spoiler.js +36 -0
- package/dist/components/editor/extensions/spoiler.js.map +1 -0
- package/dist/components/editor/index.d.ts +9 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +9 -0
- package/dist/components/editor/index.js.map +1 -0
- package/dist/components/editor/kinds.d.ts +99 -0
- package/dist/components/editor/kinds.d.ts.map +1 -0
- package/dist/components/editor/kinds.js +74 -0
- package/dist/components/editor/kinds.js.map +1 -0
- package/dist/components/sketch/rough.d.ts +38 -0
- package/dist/components/sketch/rough.d.ts.map +1 -0
- package/dist/components/sketch/rough.js +57 -0
- package/dist/components/sketch/rough.js.map +1 -0
- package/dist/components/ui/accent-picker.d.ts +2 -0
- package/dist/components/ui/accent-picker.d.ts.map +1 -0
- package/dist/components/ui/accent-picker.js +44 -0
- package/dist/components/ui/accent-picker.js.map +1 -0
- package/dist/components/ui/address-field.d.ts +10 -0
- package/dist/components/ui/address-field.d.ts.map +1 -0
- package/dist/components/ui/address-field.js +24 -0
- package/dist/components/ui/address-field.js.map +1 -0
- package/dist/components/ui/app-shell.d.ts +25 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -0
- package/dist/components/ui/app-shell.js +69 -0
- package/dist/components/ui/app-shell.js.map +1 -0
- package/dist/components/ui/badge.d.ts +19 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +62 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumbs.d.ts +10 -0
- package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
- package/dist/components/ui/breadcrumbs.js +9 -0
- package/dist/components/ui/breadcrumbs.js.map +1 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +45 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +5 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +64 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/callout.d.ts +13 -0
- package/dist/components/ui/callout.d.ts.map +1 -0
- package/dist/components/ui/callout.js +27 -0
- package/dist/components/ui/callout.js.map +1 -0
- package/dist/components/ui/card.d.ts +13 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +27 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +10 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/command-menu.d.ts +15 -0
- package/dist/components/ui/command-menu.d.ts.map +1 -0
- package/dist/components/ui/command-menu.js +24 -0
- package/dist/components/ui/command-menu.js.map +1 -0
- package/dist/components/ui/date-picker.d.ts +35 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +56 -0
- package/dist/components/ui/date-picker.js.map +1 -0
- package/dist/components/ui/date-time-picker.d.ts +19 -0
- package/dist/components/ui/date-time-picker.d.ts.map +1 -0
- package/dist/components/ui/date-time-picker.js +32 -0
- package/dist/components/ui/date-time-picker.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +33 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +20 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +56 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/editable-text.d.ts +17 -0
- package/dist/components/ui/editable-text.d.ts.map +1 -0
- package/dist/components/ui/editable-text.js +68 -0
- package/dist/components/ui/editable-text.js.map +1 -0
- package/dist/components/ui/field-button.d.ts +14 -0
- package/dist/components/ui/field-button.d.ts.map +1 -0
- package/dist/components/ui/field-button.js +16 -0
- package/dist/components/ui/field-button.js.map +1 -0
- package/dist/components/ui/file-preview.d.ts +5 -0
- package/dist/components/ui/file-preview.d.ts.map +1 -0
- package/dist/components/ui/file-preview.js +66 -0
- package/dist/components/ui/file-preview.js.map +1 -0
- package/dist/components/ui/file-uploader.d.ts +39 -0
- package/dist/components/ui/file-uploader.d.ts.map +1 -0
- package/dist/components/ui/file-uploader.js +110 -0
- package/dist/components/ui/file-uploader.js.map +1 -0
- package/dist/components/ui/handle-row.d.ts +15 -0
- package/dist/components/ui/handle-row.d.ts.map +1 -0
- package/dist/components/ui/handle-row.js +41 -0
- package/dist/components/ui/handle-row.js.map +1 -0
- package/dist/components/ui/image-block.d.ts +31 -0
- package/dist/components/ui/image-block.d.ts.map +1 -0
- package/dist/components/ui/image-block.js +103 -0
- package/dist/components/ui/image-block.js.map +1 -0
- package/dist/components/ui/image-card.d.ts +17 -0
- package/dist/components/ui/image-card.d.ts.map +1 -0
- package/dist/components/ui/image-card.js +38 -0
- package/dist/components/ui/image-card.js.map +1 -0
- package/dist/components/ui/image-viewer.d.ts +31 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -0
- package/dist/components/ui/image-viewer.js +81 -0
- package/dist/components/ui/image-viewer.js.map +1 -0
- package/dist/components/ui/image.d.ts +11 -0
- package/dist/components/ui/image.d.ts.map +1 -0
- package/dist/components/ui/image.js +32 -0
- package/dist/components/ui/image.js.map +1 -0
- package/dist/components/ui/index.d.ts +49 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +49 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/input.d.ts +16 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +32 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/link-block.d.ts +13 -0
- package/dist/components/ui/link-block.d.ts.map +1 -0
- package/dist/components/ui/link-block.js +21 -0
- package/dist/components/ui/link-block.js.map +1 -0
- package/dist/components/ui/mac-card.d.ts +15 -0
- package/dist/components/ui/mac-card.d.ts.map +1 -0
- package/dist/components/ui/mac-card.js +9 -0
- package/dist/components/ui/mac-card.js.map +1 -0
- package/dist/components/ui/nav-tree.d.ts +16 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -0
- package/dist/components/ui/nav-tree.js +34 -0
- package/dist/components/ui/nav-tree.js.map +1 -0
- package/dist/components/ui/page.d.ts +12 -0
- package/dist/components/ui/page.d.ts.map +1 -0
- package/dist/components/ui/page.js +15 -0
- package/dist/components/ui/page.js.map +1 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +9 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +9 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/property.d.ts +15 -0
- package/dist/components/ui/property.d.ts.map +1 -0
- package/dist/components/ui/property.js +34 -0
- package/dist/components/ui/property.js.map +1 -0
- package/dist/components/ui/segmented.d.ts +13 -0
- package/dist/components/ui/segmented.d.ts.map +1 -0
- package/dist/components/ui/segmented.js +10 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/select-menu.d.ts +10 -0
- package/dist/components/ui/select-menu.d.ts.map +1 -0
- package/dist/components/ui/select-menu.js +10 -0
- package/dist/components/ui/select-menu.js.map +1 -0
- package/dist/components/ui/select.d.ts +11 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +31 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/selection-bar.d.ts +12 -0
- package/dist/components/ui/selection-bar.d.ts.map +1 -0
- package/dist/components/ui/selection-bar.js +15 -0
- package/dist/components/ui/selection-bar.js.map +1 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +12 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/spotlight.d.ts +23 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -0
- package/dist/components/ui/spotlight.js +107 -0
- package/dist/components/ui/spotlight.js.map +1 -0
- package/dist/components/ui/stat-tile.d.ts +8 -0
- package/dist/components/ui/stat-tile.d.ts.map +1 -0
- package/dist/components/ui/stat-tile.js +9 -0
- package/dist/components/ui/stat-tile.js.map +1 -0
- package/dist/components/ui/step-dialog.d.ts +20 -0
- package/dist/components/ui/step-dialog.d.ts.map +1 -0
- package/dist/components/ui/step-dialog.js +36 -0
- package/dist/components/ui/step-dialog.js.map +1 -0
- package/dist/components/ui/table.d.ts +8 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +23 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +2 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +49 -0
- package/dist/components/ui/theme-toggle.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +21 -0
- package/dist/components/ui/time-picker.d.ts.map +1 -0
- package/dist/components/ui/time-picker.js +63 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +15 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +21 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/typography.d.ts +34 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/components/ui/typography.js +72 -0
- package/dist/components/ui/typography.js.map +1 -0
- package/dist/components/ui/video-block.d.ts +14 -0
- package/dist/components/ui/video-block.d.ts.map +1 -0
- package/dist/components/ui/video-block.js +18 -0
- package/dist/components/ui/video-block.js.map +1 -0
- package/dist/hooks/use-save-queue.d.ts +13 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -0
- package/dist/hooks/use-save-queue.js +45 -0
- package/dist/hooks/use-save-queue.js.map +1 -0
- package/dist/hooks/use-selection.d.ts +10 -0
- package/dist/hooks/use-selection.d.ts.map +1 -0
- package/dist/hooks/use-selection.js +43 -0
- package/dist/hooks/use-selection.js.map +1 -0
- package/dist/hooks/use-shared-transition.d.ts +3 -0
- package/dist/hooks/use-shared-transition.d.ts.map +1 -0
- package/dist/hooks/use-shared-transition.js +38 -0
- package/dist/hooks/use-shared-transition.js.map +1 -0
- package/dist/hooks/use-upload-queue.d.ts +22 -0
- package/dist/hooks/use-upload-queue.d.ts.map +1 -0
- package/dist/hooks/use-upload-queue.js +78 -0
- package/dist/hooks/use-upload-queue.js.map +1 -0
- package/dist/lib/accent.d.ts +5 -0
- package/dist/lib/accent.d.ts.map +1 -0
- package/dist/lib/accent.js +10 -0
- package/dist/lib/accent.js.map +1 -0
- package/dist/lib/bento.d.ts +17 -0
- package/dist/lib/bento.d.ts.map +1 -0
- package/dist/lib/bento.js +92 -0
- package/dist/lib/bento.js.map +1 -0
- package/dist/lib/dates.d.ts +14 -0
- package/dist/lib/dates.d.ts.map +1 -0
- package/dist/lib/dates.js +34 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/document.d.ts +79 -0
- package/dist/lib/document.d.ts.map +1 -0
- package/dist/lib/document.js +11 -0
- package/dist/lib/document.js.map +1 -0
- package/dist/lib/embed.d.ts +14 -0
- package/dist/lib/embed.d.ts.map +1 -0
- package/dist/lib/embed.js +63 -0
- package/dist/lib/embed.js.map +1 -0
- package/dist/lib/files.d.ts +23 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/files.js +69 -0
- package/dist/lib/files.js.map +1 -0
- package/dist/lib/justified.d.ts +50 -0
- package/dist/lib/justified.d.ts.map +1 -0
- package/dist/lib/justified.js +78 -0
- package/dist/lib/justified.js.map +1 -0
- package/dist/lib/rich-text-dom.d.ts +14 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -0
- package/dist/lib/rich-text-dom.js +143 -0
- package/dist/lib/rich-text-dom.js.map +1 -0
- package/dist/lib/rich-text.d.ts +15 -0
- package/dist/lib/rich-text.d.ts.map +1 -0
- package/dist/lib/rich-text.js +35 -0
- package/dist/lib/rich-text.js.map +1 -0
- package/dist/lib/spotlight.d.ts +22 -0
- package/dist/lib/spotlight.d.ts.map +1 -0
- package/dist/lib/spotlight.js +66 -0
- package/dist/lib/spotlight.js.map +1 -0
- package/dist/lib/tree.d.ts +17 -0
- package/dist/lib/tree.d.ts.map +1 -0
- package/dist/lib/tree.js +35 -0
- package/dist/lib/tree.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles/notion.css +526 -0
- package/package.json +106 -5
- package/src/components/editor/block-text.tsx +230 -0
- package/src/components/editor/blocks.tsx +368 -0
- package/src/components/editor/document-editor.tsx +101 -0
- package/src/components/editor/document-view.tsx +192 -0
- package/src/components/editor/editor-state.tsx +270 -0
- package/src/components/editor/extensions/spoiler.tsx +76 -0
- package/src/components/editor/index.ts +9 -0
- package/src/components/editor/kinds.ts +158 -0
- package/src/components/sketch/rough.tsx +90 -0
- package/src/components/ui/accent-picker.tsx +72 -0
- package/src/components/ui/address-field.tsx +57 -0
- package/src/components/ui/app-shell.tsx +138 -0
- package/src/components/ui/badge.tsx +81 -0
- package/src/components/ui/breadcrumbs.tsx +25 -0
- package/src/components/ui/button.tsx +73 -0
- package/src/components/ui/calendar.tsx +100 -0
- package/src/components/ui/callout.tsx +62 -0
- package/src/components/ui/card.tsx +90 -0
- package/src/components/ui/checkbox.tsx +32 -0
- package/src/components/ui/command-menu.tsx +72 -0
- package/src/components/ui/date-picker.tsx +170 -0
- package/src/components/ui/date-time-picker.tsx +117 -0
- package/src/components/ui/dialog.tsx +124 -0
- package/src/components/ui/dropdown-menu.tsx +183 -0
- package/src/components/ui/editable-text.tsx +109 -0
- package/src/components/ui/field-button.tsx +68 -0
- package/src/components/ui/file-preview.tsx +80 -0
- package/src/components/ui/file-uploader.tsx +376 -0
- package/src/components/ui/handle-row.tsx +116 -0
- package/src/components/ui/image-block.tsx +238 -0
- package/src/components/ui/image-card.tsx +102 -0
- package/src/components/ui/image-viewer.tsx +187 -0
- package/src/components/ui/image.tsx +96 -0
- package/src/components/ui/index.ts +83 -0
- package/src/components/ui/input.tsx +99 -0
- package/src/components/ui/link-block.tsx +82 -0
- package/src/components/ui/mac-card.tsx +46 -0
- package/src/components/ui/nav-tree.tsx +86 -0
- package/src/components/ui/page.tsx +25 -0
- package/src/components/ui/popover.tsx +42 -0
- package/src/components/ui/progress.tsx +36 -0
- package/src/components/ui/property.tsx +64 -0
- package/src/components/ui/segmented.tsx +42 -0
- package/src/components/ui/select-menu.tsx +46 -0
- package/src/components/ui/select.tsx +124 -0
- package/src/components/ui/selection-bar.tsx +50 -0
- package/src/components/ui/separator.tsx +30 -0
- package/src/components/ui/spotlight.tsx +222 -0
- package/src/components/ui/stat-tile.tsx +25 -0
- package/src/components/ui/step-dialog.tsx +104 -0
- package/src/components/ui/table.tsx +42 -0
- package/src/components/ui/theme-toggle.tsx +101 -0
- package/src/components/ui/time-picker.tsx +173 -0
- package/src/components/ui/tooltip.tsx +64 -0
- package/src/components/ui/typography.tsx +168 -0
- package/src/components/ui/video-block.tsx +60 -0
- package/src/hooks/use-save-queue.ts +66 -0
- package/src/hooks/use-selection.ts +44 -0
- package/src/hooks/use-shared-transition.ts +40 -0
- package/src/hooks/use-upload-queue.ts +111 -0
- package/src/lib/accent.ts +11 -0
- package/src/lib/bento.ts +87 -0
- package/src/lib/dates.ts +39 -0
- package/src/lib/document.ts +55 -0
- package/src/lib/embed.ts +62 -0
- package/src/lib/files.ts +73 -0
- package/src/lib/justified.ts +106 -0
- package/src/lib/rich-text-dom.ts +136 -0
- package/src/lib/rich-text.ts +50 -0
- package/src/lib/spotlight.ts +78 -0
- package/src/lib/tree.ts +41 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/notion.css +526 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export { Button, buttonVariants, type ButtonProps } from "./button.tsx";
|
|
2
|
+
export { Badge, TAG_COLORS, tagColorFor, type TagColor } from "./badge.tsx";
|
|
3
|
+
export { Callout } from "./callout.tsx";
|
|
4
|
+
export {
|
|
5
|
+
Card,
|
|
6
|
+
CardHeader,
|
|
7
|
+
CardTitle,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardFooter,
|
|
11
|
+
} from "./card.tsx";
|
|
12
|
+
export {
|
|
13
|
+
Dialog,
|
|
14
|
+
DialogTrigger,
|
|
15
|
+
DialogContent,
|
|
16
|
+
DialogHeader,
|
|
17
|
+
DialogTitle,
|
|
18
|
+
DialogDescription,
|
|
19
|
+
DialogBody,
|
|
20
|
+
DialogFooter,
|
|
21
|
+
DialogClose,
|
|
22
|
+
} from "./dialog.tsx";
|
|
23
|
+
export {
|
|
24
|
+
DropdownMenu,
|
|
25
|
+
DropdownMenuTrigger,
|
|
26
|
+
DropdownMenuContent,
|
|
27
|
+
DropdownMenuItem,
|
|
28
|
+
DropdownMenuCheckboxItem,
|
|
29
|
+
DropdownMenuLabel,
|
|
30
|
+
DropdownMenuSeparator,
|
|
31
|
+
DropdownMenuShortcut,
|
|
32
|
+
DropdownMenuSub,
|
|
33
|
+
DropdownMenuSubTrigger,
|
|
34
|
+
DropdownMenuSubContent,
|
|
35
|
+
} from "./dropdown-menu.tsx";
|
|
36
|
+
export { Input, Textarea, Label, Field } from "./input.tsx";
|
|
37
|
+
export { Separator } from "./separator.tsx";
|
|
38
|
+
export {
|
|
39
|
+
Tooltip,
|
|
40
|
+
TooltipProvider,
|
|
41
|
+
TooltipRoot,
|
|
42
|
+
TooltipTrigger,
|
|
43
|
+
TooltipContent,
|
|
44
|
+
} from "./tooltip.tsx";
|
|
45
|
+
export { Heading, Text, Code, Kbd, Prose } from "./typography.tsx";
|
|
46
|
+
export { ThemeToggle } from "./theme-toggle.tsx";
|
|
47
|
+
export { MacCard, MacWindowHeader } from "./mac-card.tsx";
|
|
48
|
+
export { DropdownMenuRadioGroup, DropdownMenuRadioItem } from "./dropdown-menu.tsx";
|
|
49
|
+
export { Checkbox } from "./checkbox.tsx";
|
|
50
|
+
export { SelectMenu } from "./select-menu.tsx";
|
|
51
|
+
export { AccentPicker } from "./accent-picker.tsx";
|
|
52
|
+
export { Property, PropertyList, QuietInput, NumberInput, quietField } from "./property.tsx";
|
|
53
|
+
export { StatTile } from "./stat-tile.tsx";
|
|
54
|
+
export { Progress } from "./progress.tsx";
|
|
55
|
+
export { Table, Th, Td, ClickableRow } from "./table.tsx";
|
|
56
|
+
export { Breadcrumbs, type Crumb } from "./breadcrumbs.tsx";
|
|
57
|
+
export { NavTree, type NavNode } from "./nav-tree.tsx";
|
|
58
|
+
export { AppShell, SidebarFrame, SidebarSection, type ShellControls } from "./app-shell.tsx";
|
|
59
|
+
export { EditableText } from "./editable-text.tsx";
|
|
60
|
+
export { CommandMenu, type Command } from "./command-menu.tsx";
|
|
61
|
+
export { HandleRow, type DropSide } from "./handle-row.tsx";
|
|
62
|
+
export { toggleSidebar } from "./app-shell.tsx";
|
|
63
|
+
export { Image } from "./image.tsx";
|
|
64
|
+
export { ImageCard, ImageCardButton, ImageCardBadge } from "./image-card.tsx";
|
|
65
|
+
export { ImageViewer, type ViewerItem } from "./image-viewer.tsx";
|
|
66
|
+
export { Stepper, StepDialog } from "./step-dialog.tsx";
|
|
67
|
+
export { SelectionBar } from "./selection-bar.tsx";
|
|
68
|
+
export { Segmented } from "./segmented.tsx";
|
|
69
|
+
export { Page, PageHeader } from "./page.tsx";
|
|
70
|
+
export { FilePreview } from "./file-preview.tsx";
|
|
71
|
+
export { FileDropArea, FileUploader } from "./file-uploader.tsx";
|
|
72
|
+
export { Popover, PopoverTrigger, PopoverAnchor, PopoverClose, PopoverContent } from "./popover.tsx";
|
|
73
|
+
export { FieldButton, type FieldButtonProps } from "./field-button.tsx";
|
|
74
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectItem, SelectLabel, SelectSeparator } from "./select.tsx";
|
|
75
|
+
export { Calendar, focusCalendarDay } from "./calendar.tsx";
|
|
76
|
+
export { DatePicker, DateRangePicker, type DatePickerProps, type DateRangePickerProps, type DateRange } from "./date-picker.tsx";
|
|
77
|
+
export { TimePicker, TimeColumns, type TimePickerProps } from "./time-picker.tsx";
|
|
78
|
+
export { DateTimePicker, type DateTimePickerProps } from "./date-time-picker.tsx";
|
|
79
|
+
export { ImageBlock, MIN_IMAGE_WIDTH } from "./image-block.tsx";
|
|
80
|
+
export { VideoBlock } from "./video-block.tsx";
|
|
81
|
+
export { LinkBlock } from "./link-block.tsx";
|
|
82
|
+
export { AddressField } from "./address-field.tsx";
|
|
83
|
+
export { Spotlight, useSpotlightShortcut, type SpotlightItem } from "./spotlight.tsx";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.ts";
|
|
5
|
+
|
|
6
|
+
/* Fields read as sunken, not outlined: a soft inset well rather than a
|
|
7
|
+
hard 1px box. On focus the well lifts to white and gains the accent
|
|
8
|
+
ring, so the active field is the brightest thing on the row. */
|
|
9
|
+
|
|
10
|
+
const fieldBase = [
|
|
11
|
+
"w-full rounded-control bg-tint-hover px-2.5 text-ink",
|
|
12
|
+
"placeholder:text-ink-tertiary",
|
|
13
|
+
"shadow-[inset_0_0_0_1px_transparent]",
|
|
14
|
+
"transition-[background-color,box-shadow] duration-100 ease-out-notion",
|
|
15
|
+
"hover:bg-tint-active",
|
|
16
|
+
"focus:bg-surface focus:outline-none",
|
|
17
|
+
"focus:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
18
|
+
"disabled:text-ink-disabled disabled:hover:bg-tint-hover disabled:cursor-not-allowed",
|
|
19
|
+
"aria-[invalid=true]:shadow-[inset_0_0_0_1px_var(--danger)]",
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export function Input({
|
|
23
|
+
className,
|
|
24
|
+
type = "text",
|
|
25
|
+
...props
|
|
26
|
+
}: ComponentPropsWithoutRef<"input">) {
|
|
27
|
+
return (
|
|
28
|
+
<input
|
|
29
|
+
type={type}
|
|
30
|
+
className={cn(fieldBase, "h-8 text-sm", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function Textarea({
|
|
37
|
+
className,
|
|
38
|
+
rows = 4,
|
|
39
|
+
...props
|
|
40
|
+
}: ComponentPropsWithoutRef<"textarea">) {
|
|
41
|
+
return (
|
|
42
|
+
<textarea
|
|
43
|
+
rows={rows}
|
|
44
|
+
className={cn(fieldBase, "py-2 text-sm resize-y", className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function Label({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: ComponentPropsWithoutRef<"label">) {
|
|
54
|
+
return (
|
|
55
|
+
<label
|
|
56
|
+
className={cn(
|
|
57
|
+
"block mb-1.5 font-medium text-ink-secondary text-caption",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Label + control + hint/error, with the spacing already correct. */
|
|
66
|
+
export function Field({
|
|
67
|
+
label,
|
|
68
|
+
hint,
|
|
69
|
+
error,
|
|
70
|
+
htmlFor,
|
|
71
|
+
children,
|
|
72
|
+
className,
|
|
73
|
+
}: {
|
|
74
|
+
label?: string;
|
|
75
|
+
hint?: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
htmlFor?: string;
|
|
78
|
+
children: React.ReactNode;
|
|
79
|
+
className?: string;
|
|
80
|
+
}) {
|
|
81
|
+
return (
|
|
82
|
+
<div className={cn("w-full", className)}>
|
|
83
|
+
{label && <Label htmlFor={htmlFor}>{label}</Label>}
|
|
84
|
+
{children}
|
|
85
|
+
{(error || hint) && (
|
|
86
|
+
<p
|
|
87
|
+
className={cn(
|
|
88
|
+
"mt-1.5 text-caption",
|
|
89
|
+
error ? "text-danger" : "text-ink-tertiary",
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
{error ?? hint}
|
|
93
|
+
</p>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { fieldBase };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ExternalLink, Globe } from "lucide-react";
|
|
4
|
+
import { hostOf, isWebUrl } from "../../lib/embed.ts";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { AddressField } from "./address-field.tsx";
|
|
7
|
+
|
|
8
|
+
/* A web page in a document, as a card: a name for it, which can be typed over and
|
|
9
|
+
falls back to its site, and the address under it. Nothing is fetched from the
|
|
10
|
+
page. Until it has an address it asks for one. */
|
|
11
|
+
export function LinkBlock({
|
|
12
|
+
url,
|
|
13
|
+
title = "",
|
|
14
|
+
onTitleChange,
|
|
15
|
+
onTitleEnter,
|
|
16
|
+
onLink,
|
|
17
|
+
check,
|
|
18
|
+
className,
|
|
19
|
+
}: {
|
|
20
|
+
url?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Called on every keystroke; debounce saving in the owner. */
|
|
23
|
+
onTitleChange?: (title: string) => void;
|
|
24
|
+
/** Enter in the name: in a document, the writing goes on below the card. */
|
|
25
|
+
onTitleEnter?: () => void;
|
|
26
|
+
onLink?: (url: string) => void;
|
|
27
|
+
/** The owner's own rule for a link, after this block's: why it is refused, or null. */
|
|
28
|
+
check?: (url: string) => string | null;
|
|
29
|
+
className?: string;
|
|
30
|
+
}) {
|
|
31
|
+
if (!url || !isWebUrl(url))
|
|
32
|
+
return onLink ? (
|
|
33
|
+
<AddressField
|
|
34
|
+
icon={<Globe />}
|
|
35
|
+
placeholder="Paste a link to a web page, then Enter"
|
|
36
|
+
check={(link) => (isWebUrl(link) ? null : "That needs to be a web address, starting http:// or https://.") ?? check?.(link) ?? null}
|
|
37
|
+
onCommit={onLink}
|
|
38
|
+
className={className}
|
|
39
|
+
/>
|
|
40
|
+
) : null;
|
|
41
|
+
const site = hostOf(url);
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className={cn(
|
|
45
|
+
"flex items-center gap-3 rounded-surface px-3.5 py-3 shadow-[inset_0_0_0_1px_var(--hairline)] transition-colors duration-100 hover:bg-tint-hover",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
>
|
|
49
|
+
<span className="flex size-9 shrink-0 items-center justify-center rounded-control bg-accent-tint text-accent-text">
|
|
50
|
+
<Globe className="size-4" />
|
|
51
|
+
</span>
|
|
52
|
+
<div className="min-w-0 flex-1">
|
|
53
|
+
{onTitleChange ? (
|
|
54
|
+
<input
|
|
55
|
+
defaultValue={title}
|
|
56
|
+
placeholder={site}
|
|
57
|
+
aria-label="Name of the link"
|
|
58
|
+
onChange={(e) => onTitleChange(e.target.value)}
|
|
59
|
+
onKeyDown={(e) => {
|
|
60
|
+
if (e.key !== "Enter" || !onTitleEnter) return;
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
onTitleEnter();
|
|
63
|
+
}}
|
|
64
|
+
className="w-full truncate bg-transparent font-medium text-ink outline-none placeholder:text-ink"
|
|
65
|
+
/>
|
|
66
|
+
) : (
|
|
67
|
+
<p className="truncate font-medium text-ink">{title || site}</p>
|
|
68
|
+
)}
|
|
69
|
+
<p className="truncate text-sm text-ink-tertiary">{url}</p>
|
|
70
|
+
</div>
|
|
71
|
+
<a
|
|
72
|
+
href={url}
|
|
73
|
+
target="_blank"
|
|
74
|
+
rel="noreferrer"
|
|
75
|
+
aria-label={`Open ${site}`}
|
|
76
|
+
className="flex size-8 shrink-0 items-center justify-center rounded-control text-ink-secondary transition-colors hover:bg-tint-active hover:text-ink"
|
|
77
|
+
>
|
|
78
|
+
<ExternalLink className="size-4" />
|
|
79
|
+
</a>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.ts";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
interface MacWindowHeaderProps {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function MacWindowHeader({ title, className }: MacWindowHeaderProps) {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex items-center gap-1.5 bg-muted/40 px-4 py-2.5 border-b",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
<span className="bg-red-400/70 rounded-full size-2.5" />
|
|
18
|
+
<span className="bg-yellow-400/70 rounded-full size-2.5" />
|
|
19
|
+
<span className="bg-green-400/70 rounded-full size-2.5" />
|
|
20
|
+
<span className="ml-auto font-mono text-foreground/60 text-xs">
|
|
21
|
+
{title}
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface MacCardProps {
|
|
28
|
+
title: ReactNode;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
headerClassName?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function MacCard({
|
|
35
|
+
title,
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
headerClassName,
|
|
39
|
+
}: MacCardProps) {
|
|
40
|
+
return (
|
|
41
|
+
<div className={cn("overflow-hidden", className)}>
|
|
42
|
+
<MacWindowHeader title={title} className={headerClassName} />
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ChevronRight, FileText, type LucideIcon } from "lucide-react";
|
|
4
|
+
import { useState, type ElementType } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
export type NavNode = { id: string; title: string; href: string; icon?: LucideIcon; children?: NavNode[] };
|
|
8
|
+
|
|
9
|
+
// Each entry keeps one of the nine tag colours for its icon, picked from its id, so
|
|
10
|
+
// a sidebar has some colour and an entry is recognisable by more than its name.
|
|
11
|
+
const ICON_COLORS = [
|
|
12
|
+
"text-tag-gray-ink", "text-tag-brown-ink", "text-tag-orange-ink", "text-tag-yellow-ink", "text-tag-green-ink",
|
|
13
|
+
"text-tag-blue-ink", "text-tag-purple-ink", "text-tag-pink-ink", "text-tag-red-ink",
|
|
14
|
+
];
|
|
15
|
+
function iconColor(id: string): string {
|
|
16
|
+
let hash = 0;
|
|
17
|
+
for (const ch of id) hash = (hash * 31 + ch.charCodeAt(0)) | 0;
|
|
18
|
+
return ICON_COLORS[Math.abs(hash) % ICON_COLORS.length];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const holds = (node: NavNode, id: string): boolean => (node.children ?? []).some((c) => c.id === id || holds(c, id));
|
|
22
|
+
|
|
23
|
+
function Row({ node, depth, activeId, link: Link }: { node: NavNode; depth: number; activeId?: string; link: ElementType }) {
|
|
24
|
+
const children = node.children ?? [];
|
|
25
|
+
const [open, setOpen] = useState(activeId !== undefined && holds(node, activeId));
|
|
26
|
+
const current = node.id === activeId;
|
|
27
|
+
const Icon = node.icon ?? FileText;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<li>
|
|
31
|
+
<div
|
|
32
|
+
className={cn(
|
|
33
|
+
"group flex h-[30px] items-center rounded-control pr-2 text-sm font-medium transition-colors duration-100",
|
|
34
|
+
current ? "bg-accent-tint text-accent-text" : "text-ink-secondary hover:bg-tint-hover",
|
|
35
|
+
)}
|
|
36
|
+
style={{ paddingLeft: 8 + depth * 16 }}
|
|
37
|
+
>
|
|
38
|
+
{/* The icon slot doubles as the toggle: on hover a parent's icon gives way
|
|
39
|
+
to its chevron, as in Notion. */}
|
|
40
|
+
<span className="relative mr-1.5 flex size-5 shrink-0 items-center justify-center">
|
|
41
|
+
<Icon className={cn("size-4", iconColor(node.id), children.length > 0 && "group-hover:opacity-0")} />
|
|
42
|
+
{children.length > 0 && (
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
aria-label={open ? `Collapse ${node.title}` : `Expand ${node.title}`}
|
|
46
|
+
aria-expanded={open}
|
|
47
|
+
onClick={() => setOpen(!open)}
|
|
48
|
+
className="affordance absolute inset-0 flex items-center justify-center rounded-[3px] hover:bg-tint-active"
|
|
49
|
+
>
|
|
50
|
+
<ChevronRight className={cn("size-3.5 transition-transform duration-100", open && "rotate-90")} />
|
|
51
|
+
</button>
|
|
52
|
+
)}
|
|
53
|
+
</span>
|
|
54
|
+
<Link href={node.href} aria-current={current ? "page" : undefined} className="flex h-full min-w-0 flex-1 items-center outline-offset-[-2px]">
|
|
55
|
+
<span className="truncate">{node.title}</span>
|
|
56
|
+
</Link>
|
|
57
|
+
</div>
|
|
58
|
+
{children.length > 0 && open && <NavTree nodes={children} depth={depth + 1} activeId={activeId} link={Link} />}
|
|
59
|
+
</li>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* A sidebar's tree of destinations. The entry matching `activeId` is highlighted
|
|
64
|
+
in the accent, and its ancestors start open. Pass your router's link as `link`.
|
|
65
|
+
|
|
66
|
+
Put the tree inside something that is not itself a `group`, or use a named group
|
|
67
|
+
there: the rows use `group` to reveal their chevrons. */
|
|
68
|
+
export function NavTree({
|
|
69
|
+
nodes,
|
|
70
|
+
activeId,
|
|
71
|
+
depth = 0,
|
|
72
|
+
link = "a",
|
|
73
|
+
}: {
|
|
74
|
+
nodes: NavNode[];
|
|
75
|
+
activeId?: string;
|
|
76
|
+
depth?: number;
|
|
77
|
+
link?: ElementType;
|
|
78
|
+
}) {
|
|
79
|
+
return (
|
|
80
|
+
<ul className="flex flex-col gap-px">
|
|
81
|
+
{nodes.map((node) => (
|
|
82
|
+
<Row key={node.id} node={node} depth={depth} activeId={activeId} link={link} />
|
|
83
|
+
))}
|
|
84
|
+
</ul>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* Every page of an app sits in this: one width and one set of margins, so
|
|
5
|
+
moving between views does not shift the left edge. Meant for inside
|
|
6
|
+
`AppShell`, whose main area is a container (the `@4xl` here answers to the
|
|
7
|
+
room the page really has, sidebar open or shut). */
|
|
8
|
+
export function Page({ children, className }: { children: ReactNode; className?: string }) {
|
|
9
|
+
return <div className={cn("mx-auto w-full max-w-[1500px] px-5 pt-10 pb-24 @4xl:px-10", className)}>{children}</div>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* A page's name at the display size, the line under it, and room on the right
|
|
13
|
+
for its actions. */
|
|
14
|
+
export function PageHeader({ title, lead, note, actions }: { title: ReactNode; lead?: ReactNode; note?: ReactNode; actions?: ReactNode }) {
|
|
15
|
+
return (
|
|
16
|
+
<header className="mb-8 flex flex-wrap items-end gap-x-4 gap-y-3">
|
|
17
|
+
<div className="min-w-0 flex-1">
|
|
18
|
+
<h1 className="text-display text-ink">{title}</h1>
|
|
19
|
+
{lead !== undefined && <p className="mt-2 text-ink-secondary">{lead}</p>}
|
|
20
|
+
{note !== undefined && <p className="mt-2 max-w-2xl text-sm text-ink-tertiary">{note}</p>}
|
|
21
|
+
</div>
|
|
22
|
+
{actions !== undefined && <div className="flex shrink-0 items-center gap-1 pb-1">{actions}</div>}
|
|
23
|
+
</header>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* A panel anchored to the thing that opened it, for content richer than a menu: a
|
|
8
|
+
calendar, a few fields. The same surface as a dropdown, without its padding, so
|
|
9
|
+
what goes inside decides its own. */
|
|
10
|
+
|
|
11
|
+
export const Popover = PopoverPrimitive.Root;
|
|
12
|
+
export const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
13
|
+
export const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
14
|
+
export const PopoverClose = PopoverPrimitive.Close;
|
|
15
|
+
|
|
16
|
+
export function PopoverContent({
|
|
17
|
+
className,
|
|
18
|
+
align = "start",
|
|
19
|
+
sideOffset = 6,
|
|
20
|
+
collisionPadding = 8,
|
|
21
|
+
...props
|
|
22
|
+
}: ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>) {
|
|
23
|
+
return (
|
|
24
|
+
<PopoverPrimitive.Portal>
|
|
25
|
+
<PopoverPrimitive.Content
|
|
26
|
+
align={align}
|
|
27
|
+
sideOffset={sideOffset}
|
|
28
|
+
collisionPadding={collisionPadding}
|
|
29
|
+
className={cn(
|
|
30
|
+
"z-50 bg-surface-overlay shadow-popover rounded-overlay outline-none",
|
|
31
|
+
// Never larger than the room there is: a tall panel on a short screen
|
|
32
|
+
// scrolls inside itself rather than running off the edge.
|
|
33
|
+
"max-w-[calc(100vw-1rem)] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain",
|
|
34
|
+
"data-[state=open]:animate-slide-in data-[state=closed]:animate-fade-out",
|
|
35
|
+
"origin-[--radix-popover-content-transform-origin]",
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
</PopoverPrimitive.Portal>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* How far along something is: "n of m", a bar, and room for one action on the
|
|
5
|
+
right (a reset, usually). The row wraps on a narrow screen. */
|
|
6
|
+
export function Progress({
|
|
7
|
+
value,
|
|
8
|
+
max,
|
|
9
|
+
label,
|
|
10
|
+
action,
|
|
11
|
+
className,
|
|
12
|
+
}: {
|
|
13
|
+
value: number;
|
|
14
|
+
max: number;
|
|
15
|
+
// Defaults to "value of max".
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
action?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}) {
|
|
20
|
+
const share = max === 0 ? 0 : Math.min(value / max, 1);
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn("flex flex-wrap items-center gap-x-3 rounded-surface bg-surface-sunken py-2 pr-2 pl-4", className)}>
|
|
23
|
+
<span className="text-sm font-medium text-accent-text tabular-nums">{label ?? `${value} of ${max}`}</span>
|
|
24
|
+
<div
|
|
25
|
+
role="progressbar"
|
|
26
|
+
aria-valuemin={0}
|
|
27
|
+
aria-valuemax={max}
|
|
28
|
+
aria-valuenow={value}
|
|
29
|
+
className="h-1.5 min-w-16 flex-1 overflow-hidden rounded-full bg-tint-active"
|
|
30
|
+
>
|
|
31
|
+
<div className="h-full rounded-full bg-accent transition-[width] duration-150 ease-out-notion" style={{ width: `${share * 100}%` }} />
|
|
32
|
+
</div>
|
|
33
|
+
{action}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { LucideIcon } from "lucide-react";
|
|
4
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* A record's properties, Notion's way: a quiet label column on the left, values on
|
|
8
|
+
the right, and no boxes until a value is hovered or focused. Use it in a dialog
|
|
9
|
+
or a side panel for anything with a handful of fields. */
|
|
10
|
+
|
|
11
|
+
// The look of a value at rest: transparent, with a tint on hover and focus.
|
|
12
|
+
export const quietField =
|
|
13
|
+
"min-h-7 w-full rounded-control bg-transparent px-1.5 py-1 text-sm outline-none transition-colors duration-100 placeholder:text-ink-tertiary hover:bg-tint-hover focus:bg-tint-hover";
|
|
14
|
+
|
|
15
|
+
export function PropertyList({ className, ...props }: ComponentPropsWithoutRef<"div">) {
|
|
16
|
+
return <div className={cn("flex flex-col gap-1", className)} {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function Property({ icon: Icon, label, children }: { icon?: LucideIcon; label: string; children: ReactNode }) {
|
|
20
|
+
return (
|
|
21
|
+
<div className="flex items-start gap-2">
|
|
22
|
+
<div className="flex h-7 w-28 shrink-0 items-center gap-1.5 text-sm text-ink-secondary sm:w-32">
|
|
23
|
+
{Icon && <Icon className="size-4 text-ink-tertiary" />}
|
|
24
|
+
<span className="truncate">{label}</span>
|
|
25
|
+
</div>
|
|
26
|
+
<div className="flex min-w-0 flex-1 flex-wrap items-center gap-1">{children}</div>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function QuietInput({ className, ...props }: ComponentPropsWithoutRef<"input">) {
|
|
32
|
+
return <input className={cn(quietField, className)} {...props} />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* A number that is committed when the field is left, not on every keystroke, so a
|
|
36
|
+
half-typed "12." is never saved. Empty clears the value; anything that is not a
|
|
37
|
+
number is put back as it was. Currency signs and thousands separators are
|
|
38
|
+
ignored. */
|
|
39
|
+
export function NumberInput({
|
|
40
|
+
value,
|
|
41
|
+
onChange,
|
|
42
|
+
className,
|
|
43
|
+
...props
|
|
44
|
+
}: Omit<ComponentPropsWithoutRef<"input">, "value" | "onChange" | "defaultValue"> & {
|
|
45
|
+
value: number | undefined;
|
|
46
|
+
onChange: (value: number | undefined) => void;
|
|
47
|
+
}) {
|
|
48
|
+
return (
|
|
49
|
+
<input
|
|
50
|
+
inputMode="decimal"
|
|
51
|
+
placeholder="Empty"
|
|
52
|
+
defaultValue={value ?? ""}
|
|
53
|
+
onBlur={(e) => {
|
|
54
|
+
const raw = e.target.value.replace(/[$€£,\s]/g, "");
|
|
55
|
+
const n = Number(raw);
|
|
56
|
+
if (raw === "") onChange(undefined);
|
|
57
|
+
else if (Number.isFinite(n)) onChange(n);
|
|
58
|
+
else e.target.value = String(value ?? "");
|
|
59
|
+
}}
|
|
60
|
+
className={cn(quietField, "w-28 tabular-nums", className)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
4
|
+
|
|
5
|
+
/* Two or three views of one thing, chosen like tabs: a sunken track with the
|
|
6
|
+
chosen one raised on it. For switching what a panel shows, not for
|
|
7
|
+
navigation between pages. */
|
|
8
|
+
export function Segmented<T extends string>({
|
|
9
|
+
options,
|
|
10
|
+
value,
|
|
11
|
+
onChange,
|
|
12
|
+
label,
|
|
13
|
+
className,
|
|
14
|
+
}: {
|
|
15
|
+
options: readonly { value: T; label: string; disabled?: boolean }[];
|
|
16
|
+
value: T;
|
|
17
|
+
onChange: (value: T) => void;
|
|
18
|
+
/** What is being switched, for screen readers. */
|
|
19
|
+
label: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<div role="tablist" aria-label={label} className={cn("flex gap-1 rounded-control bg-tint-hover p-0.5", className)}>
|
|
24
|
+
{options.map((option) => (
|
|
25
|
+
<button
|
|
26
|
+
key={option.value}
|
|
27
|
+
type="button"
|
|
28
|
+
role="tab"
|
|
29
|
+
aria-selected={value === option.value}
|
|
30
|
+
disabled={option.disabled}
|
|
31
|
+
onClick={() => onChange(option.value)}
|
|
32
|
+
className={cn(
|
|
33
|
+
"h-7 flex-1 rounded-[3px] px-3 text-sm font-medium transition-colors duration-100 disabled:text-ink-disabled",
|
|
34
|
+
value === option.value ? "bg-surface-overlay text-ink shadow-xs" : "text-ink-secondary hover:text-ink",
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
{option.label}
|
|
38
|
+
</button>
|
|
39
|
+
))}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "./dropdown-menu.tsx";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* Pick one of a fixed set. The trigger is whatever shows the current value, a badge
|
|
8
|
+
or plain text, so a property reads the same at rest as it does in a table. */
|
|
9
|
+
export function SelectMenu<T extends string>({
|
|
10
|
+
value,
|
|
11
|
+
options,
|
|
12
|
+
onChange,
|
|
13
|
+
render = (v) => v,
|
|
14
|
+
label,
|
|
15
|
+
className,
|
|
16
|
+
}: {
|
|
17
|
+
value: T;
|
|
18
|
+
options: readonly T[];
|
|
19
|
+
onChange: (value: T) => void;
|
|
20
|
+
render?: (value: T) => ReactNode;
|
|
21
|
+
label: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
}) {
|
|
24
|
+
return (
|
|
25
|
+
<DropdownMenu>
|
|
26
|
+
<DropdownMenuTrigger asChild>
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
aria-label={label}
|
|
30
|
+
className={cn("flex min-h-7 items-center rounded-control px-1.5 text-left text-sm transition-colors duration-100 hover:bg-tint-hover", className)}
|
|
31
|
+
>
|
|
32
|
+
{render(value)}
|
|
33
|
+
</button>
|
|
34
|
+
</DropdownMenuTrigger>
|
|
35
|
+
<DropdownMenuContent align="start" className="max-h-80 overflow-y-auto">
|
|
36
|
+
<DropdownMenuRadioGroup value={value} onValueChange={(v) => onChange(v as T)}>
|
|
37
|
+
{options.map((option) => (
|
|
38
|
+
<DropdownMenuRadioItem key={option} value={option}>
|
|
39
|
+
{render(option)}
|
|
40
|
+
</DropdownMenuRadioItem>
|
|
41
|
+
))}
|
|
42
|
+
</DropdownMenuRadioGroup>
|
|
43
|
+
</DropdownMenuContent>
|
|
44
|
+
</DropdownMenu>
|
|
45
|
+
);
|
|
46
|
+
}
|