@tc96/cli 0.0.0-stage → 0.27.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/LICENSE +21 -0
- package/README.md +213 -2
- package/cli.js +1395 -0
- package/package.json +35 -4
- package/registry/agent-builder.json +503 -0
- package/registry/aggregate.json +4 -0
- package/registry/app-shell-1.json +81 -0
- package/registry/app-shell-2.json +89 -0
- package/registry/app-shell-3.json +109 -0
- package/registry/app-shell-4.json +104 -0
- package/registry/app-shell-5.json +106 -0
- package/registry/bulk-import-1.json +151 -0
- package/registry/card-1.json +104 -0
- package/registry/card-2.json +97 -0
- package/registry/card-3.json +104 -0
- package/registry/card-4.json +98 -0
- package/registry/card-5.json +85 -0
- package/registry/card-6.json +98 -0
- package/registry/card-7.json +104 -0
- package/registry/card-8.json +106 -0
- package/registry/card-9.json +92 -0
- package/registry/charts.json +30 -0
- package/registry/chat-assistant.json +110 -0
- package/registry/chats-panel.json +97 -0
- package/registry/checklist.json +307 -0
- package/registry/collection-layouts.json +836 -0
- package/registry/collection-views.json +836 -0
- package/registry/collection.json +831 -0
- package/registry/dashboard-1.json +160 -0
- package/registry/dashboard-2.json +153 -0
- package/registry/dashboard-3.json +154 -0
- package/registry/dashboard-4.json +168 -0
- package/registry/detail-sheet.json +54 -0
- package/registry/editable.json +36 -0
- package/registry/empty-state-1.json +40 -0
- package/registry/empty-state-2.json +39 -0
- package/registry/empty-state-3.json +61 -0
- package/registry/empty-state-4.json +39 -0
- package/registry/empty-state-5.json +47 -0
- package/registry/empty-state-6.json +40 -0
- package/registry/flow-canvas.json +198 -0
- package/registry/flow-inspector.json +151 -0
- package/registry/flow-step-library.json +112 -0
- package/registry/forgot-password-1.json +73 -0
- package/registry/forgot-password-2.json +73 -0
- package/registry/icon-row.json +52 -0
- package/registry/impact-map.json +75 -0
- package/registry/list-1.json +129 -0
- package/registry/list-2.json +117 -0
- package/registry/list-3.json +129 -0
- package/registry/list-4.json +105 -0
- package/registry/list-5.json +98 -0
- package/registry/list-6.json +92 -0
- package/registry/list.json +52 -0
- package/registry/login-1.json +89 -0
- package/registry/login-10.json +88 -0
- package/registry/login-2.json +81 -0
- package/registry/login-3.json +90 -0
- package/registry/login-4.json +81 -0
- package/registry/login-5.json +82 -0
- package/registry/login-6.json +88 -0
- package/registry/login-7.json +83 -0
- package/registry/login-8.json +81 -0
- package/registry/login-9.json +88 -0
- package/registry/lookup-create-1.json +157 -0
- package/registry/magic-link-6.json +79 -0
- package/registry/navbar-1.json +66 -0
- package/registry/navbar-2.json +48 -0
- package/registry/navbar-3.json +50 -0
- package/registry/navbar-4.json +39 -0
- package/registry/navbar-5.json +50 -0
- package/registry/next-steps-1.json +147 -0
- package/registry/onboarding-1.json +114 -0
- package/registry/onboarding-2.json +78 -0
- package/registry/onboarding-3.json +71 -0
- package/registry/otp-1.json +73 -0
- package/registry/properties.json +523 -0
- package/registry/record-dialog.json +88 -0
- package/registry/record-group.json +190 -0
- package/registry/record-preview.json +70 -0
- package/registry/record-status-list.json +70 -0
- package/registry/reset-password-1.json +92 -0
- package/registry/reset-password-2.json +98 -0
- package/registry/reset-password-6.json +91 -0
- package/registry/rich-text-editor.json +93 -0
- package/registry/run-monitor.json +198 -0
- package/registry/settings-1.json +119 -0
- package/registry/settings-10.json +218 -0
- package/registry/settings-11.json +129 -0
- package/registry/settings-12.json +130 -0
- package/registry/settings-13.json +130 -0
- package/registry/settings-14.json +173 -0
- package/registry/settings-15.json +149 -0
- package/registry/settings-16.json +129 -0
- package/registry/settings-17.json +117 -0
- package/registry/settings-18.json +117 -0
- package/registry/settings-19.json +125 -0
- package/registry/settings-2.json +123 -0
- package/registry/settings-20.json +112 -0
- package/registry/settings-21.json +116 -0
- package/registry/settings-22.json +118 -0
- package/registry/settings-23.json +118 -0
- package/registry/settings-3.json +123 -0
- package/registry/settings-4.json +116 -0
- package/registry/settings-5.json +119 -0
- package/registry/settings-6.json +125 -0
- package/registry/settings-7.json +128 -0
- package/registry/settings-8.json +116 -0
- package/registry/settings-9.json +118 -0
- package/registry/settings-shell.json +60 -0
- package/registry/settings.json +82 -0
- package/registry/signup-1.json +100 -0
- package/registry/signup-2.json +93 -0
- package/registry/signup-3.json +83 -0
- package/registry/signup-6.json +99 -0
- package/registry/state-surface.json +58 -0
- package/registry/stats-1.json +116 -0
- package/registry/stats-2.json +115 -0
- package/registry/stats-3.json +97 -0
- package/registry/stats-4.json +92 -0
- package/registry/stats-5.json +103 -0
- package/registry/stats-6.json +105 -0
- package/registry/stats-7.json +103 -0
- package/registry/stats.json +64 -0
- package/registry/timeline-1.json +97 -0
- package/registry/timeline-2.json +102 -0
- package/registry/timeline-3.json +68 -0
- package/registry/timeline-4.json +86 -0
- package/registry/ui/accordion.json +15 -0
- package/registry/ui/alert-dialog.json +14 -0
- package/registry/ui/alert.json +50 -0
- package/registry/ui/autocomplete.json +18 -0
- package/registry/ui/avatar.json +14 -0
- package/registry/ui/badge.json +51 -0
- package/registry/ui/breadcrumb.json +15 -0
- package/registry/ui/button.json +25 -0
- package/registry/ui/calendar.json +15 -0
- package/registry/ui/card.json +14 -0
- package/registry/ui/chat.json +115 -0
- package/registry/ui/checkbox-group.json +14 -0
- package/registry/ui/checkbox.json +14 -0
- package/registry/ui/collapsible.json +14 -0
- package/registry/ui/combobox.json +18 -0
- package/registry/ui/command.json +17 -0
- package/registry/ui/composer-clipboard.json +14 -0
- package/registry/ui/composer-document.json +14 -0
- package/registry/ui/composer-editor.json +16 -0
- package/registry/ui/composer-query.json +12 -0
- package/registry/ui/composer.json +17 -0
- package/registry/ui/context-menu.json +23 -0
- package/registry/ui/dialog.json +18 -0
- package/registry/ui/drawer.json +18 -0
- package/registry/ui/empty.json +14 -0
- package/registry/ui/field.json +22 -0
- package/registry/ui/fieldset.json +14 -0
- package/registry/ui/form.json +14 -0
- package/registry/ui/frame.json +12 -0
- package/registry/ui/gauge.json +31 -0
- package/registry/ui/group.json +17 -0
- package/registry/ui/icon-frame.json +31 -0
- package/registry/ui/input-group.json +17 -0
- package/registry/ui/input.json +14 -0
- package/registry/ui/kbd.json +12 -0
- package/registry/ui/label.json +14 -0
- package/registry/ui/menu.json +39 -0
- package/registry/ui/meter.json +14 -0
- package/registry/ui/number-field.json +17 -0
- package/registry/ui/otp-field.json +31 -0
- package/registry/ui/pagination.json +17 -0
- package/registry/ui/popover.json +14 -0
- package/registry/ui/preview-card.json +14 -0
- package/registry/ui/progress.json +14 -0
- package/registry/ui/radio-group.json +14 -0
- package/registry/ui/render-anchor.json +12 -0
- package/registry/ui/scroll-area.json +14 -0
- package/registry/ui/segmented-control.json +14 -0
- package/registry/ui/select.json +16 -0
- package/registry/ui/separator.json +14 -0
- package/registry/ui/sheet.json +18 -0
- package/registry/ui/sidebar.json +25 -0
- package/registry/ui/skeleton.json +24 -0
- package/registry/ui/slider.json +14 -0
- package/registry/ui/spinner.json +14 -0
- package/registry/ui/switch.json +14 -0
- package/registry/ui/table.json +14 -0
- package/registry/ui/tabs.json +16 -0
- package/registry/ui/text.json +31 -0
- package/registry/ui/textarea.json +14 -0
- package/registry/ui/toast.json +89 -0
- package/registry/ui/toggle-group.json +18 -0
- package/registry/ui/toggle.json +15 -0
- package/registry/ui/toolbar.json +14 -0
- package/registry/ui/tooltip.json +14 -0
- package/registry/ui/use-composer-editor.json +17 -0
- package/registry/ui/use-copy-to-clipboard.json +12 -0
- package/registry/ui/use-media-query.json +12 -0
- package/registry/view.json +831 -0
- package/registry/widgets.json +319 -0
- package/registry/wizard.json +89 -0
- package/registry/workflow-editor.json +460 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "detail-sheet",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "parttens/src/detail-sheet/components/detail-sheet/detail-group.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { cn } from '@tc96/utils'\nimport type * as React from 'react'\n\nexport interface DetailGroupProps\n extends Omit<React.ComponentProps<'section'>, 'title'> {\n action?: React.ReactNode\n children?: React.ReactNode\n description?: React.ReactNode\n title?: React.ReactNode\n}\n\nexport function DetailGroup({\n action,\n children,\n className,\n description,\n title,\n ...props\n}: Readonly<DetailGroupProps>): React.ReactElement {\n return (\n <section className={cn('space-y-2', className)} {...props}>\n {title || description || action ? (\n <div className=\"flex items-start justify-between gap-4 px-1\">\n <div className=\"min-w-0 space-y-0.5\">\n {title ? (\n <h3 className=\"font-medium text-muted-foreground text-sm\">\n {title}\n </h3>\n ) : null}\n {description ? (\n <p className=\"text-muted-foreground text-sm\">{description}</p>\n ) : null}\n </div>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n ) : null}\n\n <Card\n className=\"shadow-none before:hidden\"\n data-slot=\"detail-group-content\"\n >\n {children}\n </Card>\n </section>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/patterns/src/detail-sheet/components/detail-sheet/detail-group.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "parttens/src/detail-sheet/components/detail-sheet/detail-row.tsx",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { cn } from '@tc96/utils'\nimport * as React from 'react'\n\nexport interface DetailRowProps extends React.ComponentProps<'div'> {\n description?: React.ReactNode\n label: React.ReactNode\n leading?: React.ReactNode\n value?: React.ReactNode\n}\n\nexport function DetailRow({\n className,\n description,\n label,\n leading,\n value,\n ...props\n}: Readonly<DetailRowProps>): React.ReactElement {\n return (\n <div\n className={cn(\n 'flex min-h-12 items-center gap-3 border-t p-4 first:border-t-0',\n className,\n )}\n data-slot=\"detail-sheet-row\"\n {...props}\n >\n {leading ? (\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground\">\n {React.isValidElement(leading)\n ? React.cloneElement(\n leading as React.ReactElement<{ size?: number }>,\n {\n size: 16,\n },\n )\n : leading}\n </div>\n ) : null}\n\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-sm\">{label}</div>\n {description ? (\n <div className=\"mt-0.5 text-muted-foreground text-xs\">\n {description}\n </div>\n ) : null}\n </div>\n\n {value ? (\n <div className=\"shrink-0 text-right font-medium text-sm\">{value}</div>\n ) : null}\n </div>\n )\n}\n",
|
|
15
|
+
"target": "~/packages/patterns/src/detail-sheet/components/detail-sheet/detail-row.tsx"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "parttens/src/detail-sheet/components/detail-sheet/detail-sheet-action.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { Button, type ButtonProps } from '@tc96/ui/button'\nimport { Tooltip, TooltipPopup, TooltipTrigger } from '@tc96/ui/tooltip'\nimport type * as React from 'react'\n\nexport interface DetailSheetActionProps\n extends Omit<ButtonProps, 'aria-label' | 'children' | 'render' | 'size'> {\n children: React.ReactNode\n label: string\n}\n\nexport function DetailSheetAction({\n children,\n label,\n variant = 'ghost',\n ...props\n}: Readonly<DetailSheetActionProps>): React.ReactElement {\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n {...props}\n aria-label={label}\n size=\"icon-sm\"\n variant={variant}\n />\n }\n >\n {children}\n </TooltipTrigger>\n <TooltipPopup>{label}</TooltipPopup>\n </Tooltip>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/patterns/src/detail-sheet/components/detail-sheet/detail-sheet-action.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "parttens/src/detail-sheet/components/detail-sheet/detail-sheet.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "'use client'\n\nimport type { Dialog } from '@base-ui/react/dialog'\nimport { Button } from '@tc96/ui/button'\nimport {\n Sheet,\n SheetClose,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetPanel,\n SheetPopup,\n SheetTitle,\n} from '@tc96/ui/sheet'\nimport { XIcon } from 'lucide-react'\nimport type * as React from 'react'\n\nexport interface DetailSheetProps extends Omit<Dialog.Root.Props, 'children'> {\n actions?: React.ReactNode\n children?: React.ReactNode\n description?: React.ReactNode\n footer?: React.ReactNode\n showCloseButton?: boolean\n title?: React.ReactNode\n}\n\nexport function DetailSheet({\n actions,\n children,\n description,\n footer,\n showCloseButton = true,\n title,\n ...props\n}: Readonly<DetailSheetProps>): React.ReactElement {\n return (\n <Sheet {...props}>\n <SheetPopup showCloseButton={false} side=\"right\">\n {title || description || actions || showCloseButton ? (\n <SheetHeader className=\"p-4\">\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"min-w-0 flex-1 space-y-0.5\">\n {title ? <SheetTitle>{title}</SheetTitle> : null}\n {description ? (\n <SheetDescription>{description}</SheetDescription>\n ) : null}\n </div>\n\n {actions || showCloseButton ? (\n <div className=\"flex shrink-0 items-start gap-1 self-start\">\n {actions ? (\n <div className=\"flex items-center gap-1\">{actions}</div>\n ) : null}\n {showCloseButton ? (\n <SheetClose\n aria-label=\"Fechar detalhes\"\n render={<Button size=\"icon-sm\" variant=\"ghost\" />}\n >\n <XIcon aria-hidden=\"true\" />\n </SheetClose>\n ) : null}\n </div>\n ) : null}\n </div>\n </SheetHeader>\n ) : null}\n\n <SheetPanel className=\"p-4 in-[[data-slot=sheet-popup]:has([data-slot=sheet-header])]:pt-4\">\n {children}\n </SheetPanel>\n\n {footer ? <SheetFooter className=\"px-4\">{footer}</SheetFooter> : null}\n </SheetPopup>\n </Sheet>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/patterns/src/detail-sheet/components/detail-sheet/detail-sheet.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "parttens/src/detail-sheet/components/detail-sheet/index.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "export { DetailGroup, type DetailGroupProps } from './detail-group'\nexport { DetailRow, type DetailRowProps } from './detail-row'\nexport { DetailSheet, type DetailSheetProps } from './detail-sheet'\nexport {\n DetailSheetAction,\n type DetailSheetActionProps,\n} from './detail-sheet-action'\n",
|
|
33
|
+
"target": "~/packages/patterns/src/detail-sheet/components/detail-sheet/index.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "parttens/src/detail-sheet/index.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "export * from './components/detail-sheet/index'\n",
|
|
39
|
+
"target": "~/packages/patterns/src/detail-sheet/index.ts"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"dependencies": [
|
|
43
|
+
"@base-ui/react@1.8.0",
|
|
44
|
+
"lucide-react@1.28.0",
|
|
45
|
+
"react@19.1.1"
|
|
46
|
+
],
|
|
47
|
+
"registryDependencies": [
|
|
48
|
+
"@coss/button",
|
|
49
|
+
"@coss/card",
|
|
50
|
+
"@coss/sheet",
|
|
51
|
+
"@coss/tooltip"
|
|
52
|
+
],
|
|
53
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
54
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "editable",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "patterns/editable/composition/editable/editable.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '@tc96/utils'\nimport * as React from 'react'\nimport {\n EditableContext,\n type EditableContextValue,\n useEditableContext,\n} from '../../store/editable-store'\n\ntype Direction = 'ltr' | 'rtl'\ntype TriggerMode = 'click' | 'dblclick' | 'focus'\n\nfunction assignRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') {\n ref(value)\n return\n }\n if (ref) {\n ref.current = value\n }\n}\n\nfunction dataAttributes(\n attributes: Record<`data-${string}`, string | undefined>,\n): Record<string, string | undefined> {\n return attributes\n}\n\nfunction useComposedRefs<T>(\n firstRef: React.Ref<T> | undefined,\n secondRef: React.Ref<T> | undefined,\n) {\n return React.useCallback(\n (value: T | null) => {\n assignRef(firstRef, value)\n assignRef(secondRef, value)\n },\n [firstRef, secondRef],\n )\n}\n\nexport interface EditableProps\n extends Omit<\n React.ComponentProps<'div'> & useRender.ComponentProps<'div'>,\n 'defaultValue' | 'onSubmit'\n > {\n defaultValue?: string\n value?: string\n onValueChange?: (value: string) => void\n defaultEditing?: boolean\n editing?: boolean\n onEditingChange?: (editing: boolean) => void\n onCancel?: () => void\n onEdit?: () => void\n onSubmit?: (value: string) => void\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n onEnterKeyDown?: (event: KeyboardEvent) => void\n dir?: Direction\n maxLength?: number\n name?: string\n placeholder?: string\n triggerMode?: TriggerMode\n autosize?: boolean\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nexport function Editable(props: EditableProps) {\n const {\n value: controlledValue,\n defaultValue = '',\n defaultEditing = false,\n editing: controlledEditing,\n onValueChange,\n onEditingChange,\n onCancel,\n onEdit,\n onSubmit,\n onEscapeKeyDown,\n onEnterKeyDown,\n dir,\n maxLength,\n name,\n placeholder,\n triggerMode = 'click',\n autosize = false,\n disabled = false,\n required = false,\n readOnly = false,\n invalid = false,\n className,\n id,\n render,\n ref,\n ...rootProps\n } = props\n\n const generatedRootId = React.useId()\n const rootId = id ?? generatedRootId\n const inputId = React.useId()\n const labelId = React.useId()\n const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)\n const [uncontrolledEditing, setUncontrolledEditing] =\n React.useState(defaultEditing)\n const rootRef = React.useRef<HTMLDivElement>(null)\n const composedRef = useComposedRefs(ref, rootRef)\n\n const value = controlledValue ?? uncontrolledValue\n const editing = controlledEditing ?? uncontrolledEditing\n\n const previousValueRef = React.useRef(value)\n const restoreValueRef = React.useRef(value)\n const valueRef = React.useRef(value)\n const editingRef = React.useRef(editing)\n\n React.useEffect(() => {\n valueRef.current = value\n editingRef.current = editing\n }, [editing, value])\n\n const setValue = React.useCallback(\n (nextValue: string) => {\n valueRef.current = nextValue\n if (controlledValue === undefined) {\n setUncontrolledValue(nextValue)\n }\n onValueChange?.(nextValue)\n },\n [controlledValue, onValueChange],\n )\n\n const setEditing = React.useCallback(\n (nextEditing: boolean) => {\n editingRef.current = nextEditing\n if (controlledEditing === undefined) {\n setUncontrolledEditing(nextEditing)\n }\n onEditingChange?.(nextEditing)\n },\n [controlledEditing, onEditingChange],\n )\n\n const beginEditing = React.useCallback(\n (initialDraft?: string) => {\n if (disabled || readOnly) return\n const draft = initialDraft ?? value\n restoreValueRef.current = value\n previousValueRef.current = draft\n valueRef.current = value\n if (draft !== value) setValue(draft)\n setEditing(true)\n onEdit?.()\n },\n [disabled, onEdit, readOnly, setEditing, setValue, value],\n )\n\n const cancelEditing = React.useCallback(() => {\n if (disabled || readOnly) return\n setValue(restoreValueRef.current)\n setEditing(false)\n onCancel?.()\n }, [disabled, onCancel, readOnly, setEditing, setValue])\n\n const submitValue = React.useCallback(() => {\n if (disabled || readOnly) return\n setEditing(false)\n onSubmit?.(value)\n }, [disabled, onSubmit, readOnly, setEditing, value])\n\n const isDirty = React.useCallback(\n () => editingRef.current && valueRef.current !== previousValueRef.current,\n [],\n )\n\n const finishEditing = React.useCallback(() => {\n if (disabled || readOnly || !editingRef.current) return\n if (isDirty()) {\n submitValue()\n return\n }\n if (valueRef.current !== restoreValueRef.current) {\n setValue(restoreValueRef.current)\n }\n setEditing(false)\n }, [disabled, isDirty, readOnly, setEditing, setValue, submitValue])\n\n const context = React.useMemo<EditableContextValue>(\n () => ({\n rootId,\n inputId,\n labelId,\n value,\n editing,\n dir,\n maxLength,\n placeholder,\n triggerMode,\n autosize,\n disabled,\n readOnly,\n required,\n invalid,\n beginEditing,\n cancelEditing,\n finishEditing,\n isDirty,\n submitValue,\n setValue,\n onEnterKeyDown,\n onEscapeKeyDown,\n }),\n [\n rootId,\n inputId,\n labelId,\n value,\n editing,\n dir,\n maxLength,\n placeholder,\n triggerMode,\n autosize,\n disabled,\n readOnly,\n required,\n invalid,\n beginEditing,\n cancelEditing,\n finishEditing,\n isDirty,\n submitValue,\n setValue,\n onEnterKeyDown,\n onEscapeKeyDown,\n ],\n )\n\n const element = useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n id: rootId,\n ref: composedRef,\n ...dataAttributes({\n 'data-disabled': disabled ? '' : undefined,\n 'data-editing': editing ? '' : undefined,\n 'data-invalid': invalid ? '' : undefined,\n 'data-slot': 'editable',\n }),\n className: cn('flex min-w-0 flex-col gap-2', className),\n },\n rootProps,\n ),\n render,\n state: {\n slot: 'editable',\n ...(editing && { editing: '' }),\n ...(disabled && { disabled: '' }),\n ...(invalid && { invalid: '' }),\n },\n })\n\n return (\n <EditableContext.Provider value={context}>\n {element}\n {name && (\n <input\n disabled={disabled}\n name={name}\n readOnly={readOnly}\n type=\"hidden\"\n value={value}\n />\n )}\n </EditableContext.Provider>\n )\n}\n\nexport interface EditableLabelProps\n extends React.ComponentProps<'label'>,\n useRender.ComponentProps<'label'> {}\n\nexport function EditableLabel(props: EditableLabelProps) {\n const { className, render, ref, ...labelProps } = props\n const context = useEditableContext('EditableLabel')\n\n return useRender({\n defaultTagName: 'label',\n props: mergeProps<'label'>(\n {\n ref,\n id: context.labelId,\n htmlFor: context.inputId,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-invalid': context.invalid ? '' : undefined,\n 'data-required': context.required ? '' : undefined,\n 'data-slot': 'editable-label',\n }),\n className: cn(\n \"font-medium text-sm leading-none data-required:after:ml-0.5 data-required:after:text-destructive-foreground data-required:after:content-['*'] data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n className,\n ),\n },\n labelProps,\n ),\n render,\n state: {\n slot: 'editable-label',\n ...(context.disabled && { disabled: '' }),\n ...(context.invalid && { invalid: '' }),\n ...(context.required && { required: '' }),\n },\n })\n}\n\nexport interface EditableAreaProps\n extends React.ComponentProps<'div'>,\n useRender.ComponentProps<'div'> {}\n\nexport function EditableArea(props: EditableAreaProps) {\n const { className, render, ref, ...areaProps } = props\n const context = useEditableContext('EditableArea')\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n role: 'group',\n dir: context.dir,\n ref,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-editing': context.editing ? '' : undefined,\n 'data-slot': 'editable-area',\n }),\n className: cn(\n 'relative inline-flex min-w-0 items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',\n className,\n ),\n },\n areaProps,\n ),\n render,\n state: {\n slot: 'editable-area',\n ...(context.disabled && { disabled: '' }),\n ...(context.editing && { editing: '' }),\n },\n })\n}\n\nexport interface EditablePreviewProps\n extends React.ComponentProps<'div'>,\n useRender.ComponentProps<'div'> {}\n\nexport function EditablePreview(props: EditablePreviewProps) {\n const {\n onClick,\n onDoubleClick,\n onFocus,\n onKeyDown,\n className,\n render,\n ref,\n ...previewProps\n } = props\n const context = useEditableContext('EditablePreview')\n\n const trigger = React.useCallback(() => {\n context.beginEditing()\n }, [context.beginEditing])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented || event.key !== 'Enter') return\n\n const nativeEvent = event.nativeEvent\n context.onEnterKeyDown?.(nativeEvent)\n if (!nativeEvent.defaultPrevented) {\n trigger()\n }\n },\n [context.onEnterKeyDown, onKeyDown, trigger],\n )\n\n const element = useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n role: 'button',\n tabIndex: context.disabled ? undefined : 0,\n 'aria-disabled': context.disabled || undefined,\n ref,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-empty': !context.value ? '' : undefined,\n 'data-slot': 'editable-preview',\n }),\n onClick: (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && context.triggerMode === 'click')\n trigger()\n },\n onDoubleClick: (event: React.MouseEvent<HTMLDivElement>) => {\n onDoubleClick?.(event)\n if (!event.defaultPrevented && context.triggerMode === 'dblclick')\n trigger()\n },\n onFocus: (event: React.FocusEvent<HTMLDivElement>) => {\n onFocus?.(event)\n if (!event.defaultPrevented && context.triggerMode === 'focus')\n trigger()\n },\n onKeyDown: handleKeyDown,\n className: cn(\n 'min-w-0 cursor-text truncate rounded-md border border-transparent px-2 py-1.5 text-sm outline-none hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-empty:text-muted-foreground',\n className,\n ),\n children: context.value || context.placeholder,\n },\n previewProps,\n ),\n render,\n state: {\n slot: 'editable-preview',\n ...(context.disabled && { disabled: '' }),\n ...(!context.value && { empty: '' }),\n },\n })\n\n if (context.editing || context.readOnly) return null\n\n return element\n}\n\nexport interface EditableInputProps\n extends React.ComponentProps<'input'>,\n useRender.ComponentProps<'input'> {}\n\nexport function EditableInput(props: EditableInputProps) {\n const {\n onBlur,\n onChange,\n onKeyDown,\n className,\n disabled,\n readOnly,\n required,\n maxLength,\n render,\n ref,\n ...inputProps\n } = props\n const context = useEditableContext('EditableInput')\n const inputRef = React.useRef<HTMLInputElement>(null)\n const composedRef = useComposedRefs(ref, inputRef)\n const isDisabled = disabled || context.disabled\n const isReadOnly = readOnly || context.readOnly\n const isRequired = required || context.required\n\n const autosize = React.useCallback(\n (target: HTMLInputElement) => {\n if (!context.autosize) return\n target.style.width = '0'\n target.style.width = `${target.scrollWidth + 4}px`\n },\n [context.autosize],\n )\n\n React.useEffect(() => {\n if (!context.editing || isDisabled || isReadOnly || !inputRef.current)\n return\n\n const frame = requestAnimationFrame(() => {\n inputRef.current?.focus()\n inputRef.current?.select()\n if (inputRef.current) autosize(inputRef.current)\n })\n return () => cancelAnimationFrame(frame)\n }, [autosize, context.editing, isDisabled, isReadOnly])\n\n const element = useRender({\n defaultTagName: 'input',\n props: mergeProps<'input'>(\n {\n id: context.inputId,\n 'aria-labelledby': context.labelId,\n 'aria-required': isRequired || undefined,\n 'aria-invalid': context.invalid || undefined,\n dir: context.dir,\n disabled: isDisabled,\n readOnly: isReadOnly,\n required: isRequired,\n ref: composedRef,\n ...dataAttributes({ 'data-slot': 'editable-input' }),\n maxLength: maxLength ?? context.maxLength,\n placeholder: context.placeholder,\n value: context.value,\n onBlur: (event: React.FocusEvent<HTMLInputElement>) => {\n onBlur?.(event)\n if (event.defaultPrevented || isDisabled || isReadOnly) return\n\n const relatedTarget = event.relatedTarget\n const isEditableAction =\n relatedTarget instanceof HTMLElement &&\n Boolean(\n relatedTarget.closest(\n '[data-slot=\"editable-trigger\"], [data-slot=\"editable-cancel\"], [data-slot=\"editable-submit\"]',\n ),\n )\n if (!isEditableAction) {\n context.submitValue()\n }\n },\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event)\n if (event.defaultPrevented || isDisabled || isReadOnly) return\n context.setValue(event.target.value)\n autosize(event.target)\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented || isDisabled || isReadOnly) return\n\n if (event.key === 'Escape') {\n const nativeEvent = event.nativeEvent\n context.onEscapeKeyDown?.(nativeEvent)\n if (!nativeEvent.defaultPrevented) {\n context.cancelEditing()\n }\n } else if (event.key === 'Enter') {\n const nativeEvent = event.nativeEvent\n context.onEnterKeyDown?.(nativeEvent)\n if (!nativeEvent.defaultPrevented) {\n context.submitValue()\n }\n }\n },\n className: cn(\n 'flex h-9 rounded-md border border-input bg-transparent px-2 py-1 text-sm shadow-xs outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50',\n context.autosize ? 'w-auto min-w-8' : 'w-full',\n className,\n ),\n },\n inputProps,\n ),\n render,\n state: {\n slot: 'editable-input',\n },\n })\n\n if (!context.editing && !isReadOnly) return null\n\n return element\n}\n\ntype EditableFieldElement = HTMLInputElement | HTMLTextAreaElement\n\nexport interface EditableFieldProps\n extends Omit<\n React.ComponentProps<'input'>,\n | 'defaultValue'\n | 'onBlur'\n | 'onChange'\n | 'onFocus'\n | 'onKeyDown'\n | 'ref'\n | 'value'\n > {\n emptyValue?: string\n multiline?: boolean\n ref?: React.Ref<EditableFieldElement>\n render?: useRender.ComponentProps<'input'>['render']\n onBlur?: React.FocusEventHandler<EditableFieldElement>\n onChange?: React.ChangeEventHandler<EditableFieldElement>\n onFocus?: React.FocusEventHandler<EditableFieldElement>\n onKeyDown?: React.KeyboardEventHandler<EditableFieldElement>\n}\n\nexport function EditableField(props: EditableFieldProps) {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n emptyValue,\n multiline = false,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n className,\n disabled,\n readOnly,\n required,\n maxLength,\n type,\n render,\n ref,\n ...fieldProps\n } = props\n const context = useEditableContext('EditableField')\n const isDisabled = disabled || context.disabled\n const isReadOnly = readOnly || context.readOnly\n const isRequired = required || context.required\n\n const begin = () => {\n if (context.editing) return\n context.beginEditing(\n emptyValue !== undefined && context.value === emptyValue ? '' : undefined,\n )\n }\n\n const element = useRender({\n defaultTagName: multiline ? 'textarea' : 'input',\n ref,\n props: mergeProps<'input'>(\n {\n id: context.inputId,\n 'aria-label': ariaLabel,\n 'aria-labelledby':\n ariaLabelledBy ?? (ariaLabel ? undefined : context.labelId),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': context.invalid || undefined,\n dir: context.dir,\n disabled: isDisabled,\n required: isRequired,\n ...dataAttributes({\n 'data-disabled': isDisabled ? '' : undefined,\n 'data-editing': context.editing ? '' : undefined,\n 'data-empty': !context.value ? '' : undefined,\n 'data-slot': 'editable-field',\n }),\n maxLength: maxLength ?? context.maxLength,\n placeholder: context.placeholder,\n value: context.value,\n ...(multiline ? { rows: 1 } : { type }),\n onFocus: (event: React.FocusEvent<EditableFieldElement>) => {\n onFocus?.(event)\n if (event.defaultPrevented || isDisabled) return\n begin()\n },\n onBlur: (event: React.FocusEvent<EditableFieldElement>) => {\n onBlur?.(event)\n if (event.defaultPrevented || isDisabled) return\n context.finishEditing()\n },\n onChange: (event: React.ChangeEvent<EditableFieldElement>) => {\n onChange?.(event)\n if (event.defaultPrevented || isDisabled) return\n begin()\n context.setValue(event.target.value)\n },\n onKeyDown: (event: React.KeyboardEvent<EditableFieldElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented || isDisabled) return\n\n const nativeEvent = event.nativeEvent\n if (event.key === 'Escape') {\n if (!context.isDirty()) return\n context.onEscapeKeyDown?.(nativeEvent)\n if (nativeEvent.defaultPrevented) return\n event.stopPropagation()\n context.cancelEditing()\n event.currentTarget.blur()\n } else if (event.key === 'Enter' && !multiline) {\n context.onEnterKeyDown?.(nativeEvent)\n if (nativeEvent.defaultPrevented) return\n event.preventDefault()\n event.currentTarget.blur()\n }\n },\n className: cn(\n 'w-full bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n multiline && 'field-sizing-content resize-none',\n className,\n ),\n },\n fieldProps,\n ),\n render,\n state: {\n slot: 'editable-field',\n ...(context.editing && { editing: '' }),\n ...(isDisabled && { disabled: '' }),\n ...(!context.value && { empty: '' }),\n },\n })\n\n if (isReadOnly) {\n const dataProps = Object.fromEntries(\n Object.entries(fieldProps).filter(([key]) => key.startsWith('data-')),\n )\n return (\n <span\n className={className}\n data-empty={!context.value ? '' : undefined}\n data-readonly=\"\"\n data-slot=\"editable-field\"\n dir={context.dir}\n {...dataProps}\n >\n {context.value || context.placeholder}\n </span>\n )\n }\n\n return element\n}\n\nexport interface EditableTriggerProps\n extends React.ComponentProps<'button'>,\n useRender.ComponentProps<'button'> {\n forceMount?: boolean\n}\n\nexport function EditableTrigger(props: EditableTriggerProps) {\n const { forceMount = false, className, render, ref, ...triggerProps } = props\n const context = useEditableContext('EditableTrigger')\n\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n 'aria-controls': context.rootId,\n 'aria-disabled': context.disabled || context.readOnly || undefined,\n ref,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-readonly': context.readOnly ? '' : undefined,\n 'data-slot': 'editable-trigger',\n }),\n onClick:\n context.triggerMode === 'click'\n ? () => context.beginEditing()\n : undefined,\n onDoubleClick:\n context.triggerMode === 'dblclick'\n ? () => context.beginEditing()\n : undefined,\n className: cn(\n 'inline-flex h-8 w-fit items-center justify-center rounded-md border border-input bg-background px-3 font-medium text-sm shadow-xs outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:opacity-50',\n className,\n ),\n },\n triggerProps,\n ),\n render,\n state: {\n slot: 'editable-trigger',\n ...(context.disabled && { disabled: '' }),\n ...(context.readOnly && { readonly: '' }),\n },\n })\n\n if (!forceMount && (context.editing || context.readOnly)) return null\n\n return element\n}\n\nexport interface EditableToolbarProps\n extends React.ComponentProps<'div'>,\n useRender.ComponentProps<'div'> {\n orientation?: 'horizontal' | 'vertical'\n}\n\nexport function EditableToolbar(props: EditableToolbarProps) {\n const {\n className,\n orientation = 'horizontal',\n render,\n ref,\n ...toolbarProps\n } = props\n const context = useEditableContext('EditableToolbar')\n\n const element = useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n role: 'toolbar',\n 'aria-orientation': orientation,\n ref,\n ...dataAttributes({\n 'data-orientation': orientation,\n 'data-slot': 'editable-toolbar',\n }),\n className: cn(\n 'flex gap-2',\n orientation === 'vertical'\n ? 'flex-col items-stretch'\n : 'flex-row items-center',\n className,\n ),\n },\n toolbarProps,\n ),\n render,\n state: {\n slot: 'editable-toolbar',\n orientation,\n },\n })\n\n if (!context.editing) return null\n\n return element\n}\n\nexport interface EditableCancelProps\n extends React.ComponentProps<'button'>,\n useRender.ComponentProps<'button'> {}\n\nexport function EditableCancel(props: EditableCancelProps) {\n const { className, render, ref, ...cancelProps } = props\n const context = useEditableContext('EditableCancel')\n\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n 'aria-controls': context.rootId,\n ref,\n ...dataAttributes({ 'data-slot': 'editable-cancel' }),\n onClick: context.cancelEditing,\n className: cn(\n 'inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 font-medium text-sm shadow-xs outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/30',\n className,\n ),\n },\n cancelProps,\n ),\n render,\n state: {\n slot: 'editable-cancel',\n },\n })\n\n if (!context.editing) return null\n\n return element\n}\n\nexport interface EditableSubmitProps\n extends React.ComponentProps<'button'>,\n useRender.ComponentProps<'button'> {}\n\nexport function EditableSubmit(props: EditableSubmitProps) {\n const { className, render, ref, ...submitProps } = props\n const context = useEditableContext('EditableSubmit')\n\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n 'aria-controls': context.rootId,\n ref,\n ...dataAttributes({ 'data-slot': 'editable-submit' }),\n onClick: context.submitValue,\n className: cn(\n 'inline-flex h-8 items-center justify-center rounded-md border border-primary bg-primary px-3 font-medium text-primary-foreground text-sm shadow-xs outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/30',\n className,\n ),\n },\n submitProps,\n ),\n render,\n state: {\n slot: 'editable-submit',\n },\n })\n\n if (!context.editing) return null\n\n return element\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/patterns/editable/composition/editable/editable.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "patterns/editable/composition/editable/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export {\n Editable,\n EditableArea,\n type EditableAreaProps,\n EditableCancel,\n type EditableCancelProps,\n EditableField,\n type EditableFieldProps,\n EditableInput,\n type EditableInputProps,\n EditableLabel,\n type EditableLabelProps,\n EditablePreview,\n type EditablePreviewProps,\n type EditableProps,\n EditableSubmit,\n type EditableSubmitProps,\n EditableToolbar,\n type EditableToolbarProps,\n EditableTrigger,\n type EditableTriggerProps,\n} from './editable'\n",
|
|
15
|
+
"target": "~/packages/ui/src/patterns/editable/composition/editable/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "patterns/editable/index.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "export * from './composition/editable/index'\n",
|
|
21
|
+
"target": "~/packages/ui/src/patterns/editable/index.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "patterns/editable/store/editable-store.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { createContext, useContext } from 'react'\n\ntype Direction = 'ltr' | 'rtl'\ntype TriggerMode = 'click' | 'dblclick' | 'focus'\n\nexport interface EditableContextValue {\n rootId: string\n inputId: string\n labelId: string\n value: string\n editing: boolean\n dir?: Direction\n maxLength?: number\n placeholder?: string\n triggerMode: TriggerMode\n autosize: boolean\n disabled: boolean\n readOnly: boolean\n required: boolean\n invalid: boolean\n beginEditing: (initialDraft?: string) => void\n cancelEditing: () => void\n finishEditing: () => void\n isDirty: () => boolean\n submitValue: () => void\n setValue: (value: string) => void\n onEnterKeyDown?: (event: KeyboardEvent) => void\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n}\n\nexport const EditableContext = createContext<EditableContextValue | null>(null)\n\nexport function useEditableContext(consumerName: string): EditableContextValue {\n const context = useContext(EditableContext)\n if (!context) {\n throw new Error(`\\`${consumerName}\\` must be used within \\`Editable\\``)\n }\n return context\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/patterns/editable/store/editable-store.ts"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"dependencies": [
|
|
31
|
+
"@base-ui/react@1.8.0",
|
|
32
|
+
"react@19.1.1"
|
|
33
|
+
],
|
|
34
|
+
"registryDependencies": [],
|
|
35
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "empty-state-1",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/empty-state/empty-state-1/empty-state-1.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { UploadSimpleIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { renderAnchor } from '@tc96/ui/render-anchor'\nimport { cn } from '@tc96/utils'\nimport { cloneElement, type ReactElement, useId } from 'react'\nimport { defaultEmptyState1Labels } from './labels'\nimport type { EmptyState1Props } from './types'\n\nconst guideClassName =\n 'text-sm underline-offset-4 hover:underline focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n\nexport function EmptyState1({\n className,\n guides = [],\n icon,\n labels: labelsProp,\n onCreate,\n onImport,\n renderLink = renderAnchor,\n}: Readonly<EmptyState1Props>) {\n const labels = { ...defaultEmptyState1Labels, ...labelsProp }\n const guidesId = useId()\n\n return (\n <section\n aria-label={labels.title}\n className={cn('flex', className)}\n data-slot=\"empty-state-1\"\n >\n <Empty>\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n {icon ?? <UploadSimpleIcon aria-hidden=\"true\" />}\n </EmptyMedia>\n <EmptyTitle>{labels.title}</EmptyTitle>\n <EmptyDescription>{labels.description}</EmptyDescription>\n </EmptyHeader>\n <EmptyContent>\n {onImport || onCreate ? (\n <div className=\"flex flex-wrap justify-center gap-2\">\n {onImport ? (\n <Button onClick={onImport} size=\"sm\" type=\"button\">\n {labels.import}\n </Button>\n ) : null}\n {onCreate ? (\n <Button\n onClick={onCreate}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n >\n {labels.create}\n </Button>\n ) : null}\n </div>\n ) : null}\n {guides.length > 0 ? (\n <nav aria-labelledby={guidesId} className=\"grid gap-2\">\n <p className=\"text-muted-foreground text-xs\" id={guidesId}>\n {labels.guides}\n </p>\n <ul className=\"grid list-none gap-1\">\n {guides.map((guide) => (\n <li data-guide={guide.id} key={guide.id}>\n {cloneElement(\n renderLink(guide.href) as ReactElement<{\n className: string\n }>,\n { className: guideClassName },\n guide.title,\n )}\n </li>\n ))}\n </ul>\n </nav>\n ) : null}\n </EmptyContent>\n </Empty>\n </section>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-1/empty-state-1.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/empty-state/empty-state-1/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export { EmptyState1 } from './empty-state-1'\nexport type {\n EmptyState1Guide,\n EmptyState1Labels,\n EmptyState1Props,\n} from './types'\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-1/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/empty-state/empty-state-1/labels.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import type { EmptyState1Labels } from './types'\n\nexport const defaultEmptyState1Labels: EmptyState1Labels = {\n create: 'Criar manualmente',\n description:\n 'Importe uma planilha para começar com seus dados ou cadastre o primeiro registro à mão.',\n guides: 'Guias para começar',\n import: 'Importar',\n title: 'Nenhum dado por aqui ainda',\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-1/labels.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/empty-state/empty-state-1/types.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import type { RenderLink } from '@tc96/ui/render-anchor'\nimport type { ReactNode } from 'react'\n\nexport interface EmptyState1Guide {\n href: string\n id: string\n title: string\n}\n\nexport interface EmptyState1Labels {\n create: string\n description: string\n guides: string\n import: string\n title: string\n}\n\nexport interface EmptyState1Props {\n className?: string\n guides?: EmptyState1Guide[]\n icon?: ReactNode\n labels?: Partial<EmptyState1Labels>\n onCreate?: () => void\n onImport?: () => void\n renderLink?: RenderLink\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-1/types.ts"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"dependencies": [
|
|
31
|
+
"@phosphor-icons/react@2.1.10",
|
|
32
|
+
"react@19.1.1"
|
|
33
|
+
],
|
|
34
|
+
"registryDependencies": [
|
|
35
|
+
"@ui/button",
|
|
36
|
+
"@ui/empty",
|
|
37
|
+
"@ui/render-anchor"
|
|
38
|
+
],
|
|
39
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
40
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "empty-state-2",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/empty-state/empty-state-2/empty-state-2.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { MagnifyingGlassIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { cn } from '@tc96/utils'\nimport { useId } from 'react'\nimport { defaultEmptyState2Labels } from './labels'\nimport type { EmptyState2Props } from './types'\n\nexport function EmptyState2({\n className,\n icon,\n labels: labelsProp,\n onClear,\n onSuggestion,\n query,\n suggestions = [],\n}: Readonly<EmptyState2Props>) {\n const labels = { ...defaultEmptyState2Labels, ...labelsProp }\n const suggestionsId = useId()\n const showSuggestions = Boolean(onSuggestion) && suggestions.length > 0\n\n return (\n <output className={cn('flex', className)} data-slot=\"empty-state-2\">\n <Empty>\n <EmptyHeader>\n <EmptyMedia variant=\"icon\">\n {icon ?? <MagnifyingGlassIcon aria-hidden=\"true\" />}\n </EmptyMedia>\n <EmptyTitle>{labels.title(query)}</EmptyTitle>\n <EmptyDescription>{labels.description}</EmptyDescription>\n </EmptyHeader>\n <EmptyContent>\n {showSuggestions ? (\n <div className=\"grid gap-2\">\n <p className=\"text-muted-foreground text-xs\" id={suggestionsId}>\n {labels.suggestions}\n </p>\n <ul\n aria-labelledby={suggestionsId}\n className=\"flex list-none flex-wrap justify-center gap-2\"\n >\n {suggestions.map((suggestion) => (\n <li key={suggestion}>\n <Button\n onClick={() => onSuggestion?.(suggestion)}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n >\n {suggestion}\n </Button>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {onClear ? (\n <Button onClick={onClear} size=\"sm\" type=\"button\" variant=\"ghost\">\n {labels.clear}\n </Button>\n ) : null}\n </EmptyContent>\n </Empty>\n </output>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-2/empty-state-2.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/empty-state/empty-state-2/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export { EmptyState2 } from './empty-state-2'\nexport type { EmptyState2Labels, EmptyState2Props } from './types'\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-2/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/empty-state/empty-state-2/labels.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import type { EmptyState2Labels } from './types'\n\nexport const defaultEmptyState2Labels: EmptyState2Labels = {\n clear: 'Limpar busca',\n description: 'Confira a ortografia ou tente termos mais curtos e gerais.',\n suggestions: 'Tente buscar por',\n title: (query) => `Nenhum resultado para “${query}”`,\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-2/labels.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/empty-state/empty-state-2/types.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import type { ReactNode } from 'react'\n\nexport interface EmptyState2Labels {\n clear: string\n description: string\n suggestions: string\n title: (query: string) => string\n}\n\nexport interface EmptyState2Props {\n className?: string\n icon?: ReactNode\n labels?: Partial<EmptyState2Labels>\n onClear?: () => void\n onSuggestion?: (suggestion: string) => void\n query: string\n suggestions?: string[]\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-2/types.ts"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"dependencies": [
|
|
31
|
+
"@phosphor-icons/react@2.1.10",
|
|
32
|
+
"react@19.1.1"
|
|
33
|
+
],
|
|
34
|
+
"registryDependencies": [
|
|
35
|
+
"@ui/button",
|
|
36
|
+
"@ui/empty"
|
|
37
|
+
],
|
|
38
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
39
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "empty-state-3",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/empty-state/empty-state-3/empty-state-3.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { RocketLaunchIcon, SquaresFourIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { List } from '@tc96/ui/patterns/list/composition/list/list'\nimport { cn } from '@tc96/utils'\nimport { useId } from 'react'\nimport { defaultEmptyState3Labels } from './labels'\nimport type { EmptyState3Props } from './types'\n\nexport function EmptyState3({\n className,\n icon,\n labels: labelsProp,\n onCreate,\n onImport,\n onTemplate,\n templates = [],\n}: Readonly<EmptyState3Props>) {\n const labels = { ...defaultEmptyState3Labels, ...labelsProp }\n const templatesId = useId()\n\n return (\n <section\n aria-label={labels.title}\n className={cn('flex', className)}\n data-slot=\"empty-state-3\"\n >\n <Empty>\n <EmptyHeader>\n <EmptyMedia>\n <IconFrame shape=\"rounded\" size=\"xl\">\n {icon ?? <RocketLaunchIcon aria-hidden=\"true\" />}\n </IconFrame>\n </EmptyMedia>\n <EmptyTitle>{labels.title}</EmptyTitle>\n <EmptyDescription>{labels.description}</EmptyDescription>\n </EmptyHeader>\n <EmptyContent className=\"max-w-md\">\n {onCreate || onImport ? (\n <div className=\"flex flex-wrap justify-center gap-2\">\n {onCreate ? (\n <Button onClick={onCreate} size=\"sm\" type=\"button\">\n {labels.create}\n </Button>\n ) : null}\n {onImport ? (\n <Button\n onClick={onImport}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n >\n {labels.import}\n </Button>\n ) : null}\n </div>\n ) : null}\n {templates.length > 0 ? (\n <div className=\"grid w-full gap-2 text-start\">\n <p className=\"text-muted-foreground text-xs\" id={templatesId}>\n {labels.templates}\n </p>\n <ul\n aria-labelledby={templatesId}\n className=\"grid list-none gap-2\"\n >\n {templates.map((template) => (\n <li data-template={template.id} key={template.id}>\n <List\n description={template.description}\n icon={\n template.icon ?? <SquaresFourIcon aria-hidden=\"true\" />\n }\n render={\n <button\n onClick={() => onTemplate?.(template.id)}\n type=\"button\"\n />\n }\n title={template.title}\n />\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n </EmptyContent>\n </Empty>\n </section>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-3/empty-state-3.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/empty-state/empty-state-3/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export { EmptyState3 } from './empty-state-3'\nexport type {\n EmptyState3Labels,\n EmptyState3Props,\n EmptyState3Template,\n} from './types'\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-3/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/empty-state/empty-state-3/labels.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import type { EmptyState3Labels } from './types'\n\nexport const defaultEmptyState3Labels: EmptyState3Labels = {\n create: 'Criar projeto',\n description:\n 'Organize tarefas, prazos e pessoas em um só lugar. Comece do zero ou use um modelo pronto.',\n import: 'Importar projeto',\n templates: 'Comece por um modelo',\n title: 'Crie seu primeiro projeto',\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-3/labels.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/empty-state/empty-state-3/types.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import type { ReactNode } from 'react'\n\nexport interface EmptyState3Template {\n description?: string\n icon?: ReactNode\n id: string\n title: string\n}\n\nexport interface EmptyState3Labels {\n create: string\n description: string\n import: string\n templates: string\n title: string\n}\n\nexport interface EmptyState3Props {\n className?: string\n icon?: ReactNode\n labels?: Partial<EmptyState3Labels>\n onCreate?: () => void\n onImport?: () => void\n onTemplate?: (id: string) => void\n templates?: EmptyState3Template[]\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-3/types.ts"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "patterns/list/composition/list/list.tsx",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type { ListProps } from '../../core'\nimport {\n listActionsClassName,\n listContentClassName,\n listDescriptionClassName,\n listRootVariants,\n} from '../../lib/variants'\n\nexport function List({\n actions,\n className,\n description,\n icon,\n iconColor,\n render,\n title,\n variant = 'outline',\n}: Readonly<ListProps>): ReactElement {\n return useRender({\n defaultTagName: 'div',\n props: {\n children: (\n <>\n <IconFrame color={iconColor} shape=\"rounded\" size=\"sm\">\n {icon}\n </IconFrame>\n <span className={listContentClassName} data-slot=\"list-content\">\n <Text data-slot=\"list-title\" size=\"sm\" truncate weight=\"medium\">\n {title}\n </Text>\n {description ? (\n <Text\n className={listDescriptionClassName}\n data-slot=\"list-description\"\n foreground=\"muted\"\n size=\"sm\"\n >\n {description}\n </Text>\n ) : null}\n </span>\n {actions ? (\n <span className={listActionsClassName} data-slot=\"list-actions\">\n {actions}\n </span>\n ) : null}\n </>\n ),\n className: cn(listRootVariants({ variant }), className),\n 'data-slot': 'list',\n 'data-variant': variant,\n },\n render,\n })\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/patterns/list/composition/list/list.tsx"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "patterns/list/core.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "import type { useRender } from '@base-ui/react/use-render'\nimport type { ReactNode } from 'react'\n\nexport const listVariants = ['outline', 'plain'] as const\n\nexport type ListVariant = (typeof listVariants)[number]\n\nexport interface ListProps {\n actions?: ReactNode\n className?: string\n description?: ReactNode\n icon: ReactNode\n iconColor?: string\n render?: useRender.ComponentProps<'div'>['render']\n title: ReactNode\n variant?: ListVariant\n}\n",
|
|
39
|
+
"target": "~/packages/ui/src/patterns/list/core.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "patterns/list/lib/variants.ts",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { cva } from 'class-variance-authority'\n\nexport const listRootVariants = cva(\n 'flex w-full min-w-0 items-center gap-3 px-3 py-3 text-start outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring [:is(a,button,label)&]:cursor-pointer [:is(a,button,label)&]:hover:bg-muted/50',\n {\n defaultVariants: { variant: 'outline' },\n variants: {\n variant: {\n outline: 'rounded-lg border [label&]:has-data-checked:border-primary',\n plain: '',\n },\n },\n },\n)\n\nexport const listContentClassName = 'flex min-w-0 flex-1 flex-col'\n\nexport const listDescriptionClassName = 'line-clamp-2'\n\nexport const listActionsClassName = 'flex shrink-0 items-center gap-1'\n",
|
|
45
|
+
"target": "~/packages/ui/src/patterns/list/lib/variants.ts"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"dependencies": [
|
|
49
|
+
"@base-ui/react@1.8.0",
|
|
50
|
+
"@phosphor-icons/react@2.1.10",
|
|
51
|
+
"class-variance-authority@0.7.1",
|
|
52
|
+
"react@19.1.1"
|
|
53
|
+
],
|
|
54
|
+
"registryDependencies": [
|
|
55
|
+
"@ui/button",
|
|
56
|
+
"@ui/empty",
|
|
57
|
+
"@ui/icon-frame",
|
|
58
|
+
"@ui/text"
|
|
59
|
+
],
|
|
60
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
61
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "empty-state-4",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/empty-state/empty-state-4/empty-state-4.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { CheckIcon, LinkIcon, UserPlusIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { defaultEmptyState4Labels } from './labels'\nimport type { EmptyState4Props } from './types'\n\nexport function EmptyState4({\n className,\n copied = false,\n labels: labelsProp,\n onCopyLink,\n onInvite,\n}: Readonly<EmptyState4Props>) {\n const labels = { ...defaultEmptyState4Labels, ...labelsProp }\n\n return (\n <Empty className={className}>\n <EmptyHeader>\n <EmptyMedia>\n <IconFrame size=\"xl\">\n <UserPlusIcon />\n </IconFrame>\n </EmptyMedia>\n <EmptyTitle>{labels.title}</EmptyTitle>\n <EmptyDescription>{labels.description}</EmptyDescription>\n </EmptyHeader>\n {onInvite || onCopyLink ? (\n <EmptyContent className=\"flex-row flex-wrap justify-center\">\n {onInvite ? (\n <Button onClick={onInvite} size=\"sm\">\n <UserPlusIcon aria-hidden=\"true\" />\n {labels.invite}\n </Button>\n ) : null}\n {onCopyLink ? (\n <Button\n data-copied={copied ? 'true' : 'false'}\n onClick={onCopyLink}\n size=\"sm\"\n variant=\"outline\"\n >\n {copied ? (\n <CheckIcon aria-hidden=\"true\" />\n ) : (\n <LinkIcon aria-hidden=\"true\" />\n )}\n {copied ? labels.copied : labels.copyLink}\n </Button>\n ) : null}\n </EmptyContent>\n ) : null}\n </Empty>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-4/empty-state-4.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/empty-state/empty-state-4/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export { EmptyState4 } from './empty-state-4'\nexport type { EmptyState4Labels, EmptyState4Props } from './types'\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-4/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/empty-state/empty-state-4/labels.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import type { EmptyState4Labels } from './types'\n\nexport const defaultEmptyState4Labels: EmptyState4Labels = {\n copied: 'Link copiado',\n copyLink: 'Copiar link',\n description:\n 'Convide colegas para planejar, comentar e acompanhar o trabalho junto com você.',\n invite: 'Convidar',\n title: 'Você ainda está sozinho por aqui',\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-4/labels.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/empty-state/empty-state-4/types.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "export interface EmptyState4Labels {\n copied: string\n copyLink: string\n description: string\n invite: string\n title: string\n}\n\nexport interface EmptyState4Props {\n className?: string\n copied?: boolean\n labels?: Partial<EmptyState4Labels>\n onCopyLink?: () => void\n onInvite?: () => void\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-4/types.ts"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"dependencies": [
|
|
31
|
+
"@phosphor-icons/react@2.1.10"
|
|
32
|
+
],
|
|
33
|
+
"registryDependencies": [
|
|
34
|
+
"@ui/button",
|
|
35
|
+
"@ui/empty",
|
|
36
|
+
"@ui/icon-frame"
|
|
37
|
+
],
|
|
38
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
39
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "empty-state-5",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/empty-state/empty-state-5/empty-state-5.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { CheckIcon } from '@phosphor-icons/react'\nimport { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\nimport {\n Empty,\n EmptyDescription,\n EmptyHeader,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { getInitials } from '@tc96/ui/helpers/initials'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { useId } from 'react'\nimport { defaultEmptyState5Labels } from './labels'\nimport type { EmptyState5Connector, EmptyState5Props } from './types'\n\nfunction ConnectorTile({\n connectLabel,\n connectedLabel,\n connector,\n onConnect,\n}: Readonly<{\n connectLabel: string\n connectedLabel: string\n connector: EmptyState5Connector\n onConnect?: (id: string) => void\n}>) {\n const nameId = useId()\n const buttonId = useId()\n\n return (\n <li\n className=\"flex items-center gap-3 rounded-lg border bg-card p-3 text-start\"\n data-connected={connector.connected ? 'true' : 'false'}\n data-connector={connector.id}\n >\n <IconFrame shape=\"rounded\">\n <span className=\"font-medium text-xs\">\n {getInitials(connector.name)}\n </span>\n </IconFrame>\n <span className=\"min-w-0 flex-1 truncate font-medium text-sm\" id={nameId}>\n {connector.name}\n </span>\n {connector.connected ? (\n <Badge variant=\"success\">\n <CheckIcon aria-hidden=\"true\" />\n {connectedLabel}\n </Badge>\n ) : onConnect ? (\n <Button\n aria-labelledby={`${buttonId} ${nameId}`}\n id={buttonId}\n onClick={() => onConnect(connector.id)}\n size=\"sm\"\n variant=\"outline\"\n >\n {connectLabel}\n </Button>\n ) : null}\n </li>\n )\n}\n\nexport function EmptyState5({\n className,\n connectors,\n labels: labelsProp,\n onConnect,\n}: Readonly<EmptyState5Props>) {\n const labels = { ...defaultEmptyState5Labels, ...labelsProp }\n\n return (\n <Empty className={className}>\n <EmptyHeader>\n <EmptyTitle>{labels.title}</EmptyTitle>\n <EmptyDescription>{labels.description}</EmptyDescription>\n </EmptyHeader>\n <ul\n aria-label={labels.connectors}\n className=\"grid w-full max-w-2xl gap-3 sm:grid-cols-2\"\n >\n {connectors.map((connector) => (\n <ConnectorTile\n connectLabel={labels.connect}\n connectedLabel={labels.connected}\n connector={connector}\n key={connector.id}\n onConnect={onConnect}\n />\n ))}\n </ul>\n </Empty>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-5/empty-state-5.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/empty-state/empty-state-5/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export { EmptyState5 } from './empty-state-5'\nexport type {\n EmptyState5Connector,\n EmptyState5Labels,\n EmptyState5Props,\n} from './types'\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-5/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/empty-state/empty-state-5/labels.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import type { EmptyState5Labels } from './types'\n\nexport const defaultEmptyState5Labels: EmptyState5Labels = {\n connect: 'Conectar',\n connected: 'Conectado',\n connectors: 'Serviços de armazenamento',\n description:\n 'Conecte um serviço de armazenamento para importar e sincronizar seus arquivos.',\n title: 'Nenhum armazenamento conectado',\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-5/labels.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/empty-state/empty-state-5/types.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "export interface EmptyState5Connector {\n connected?: boolean\n id: string\n name: string\n}\n\nexport interface EmptyState5Labels {\n connect: string\n connected: string\n connectors: string\n description: string\n title: string\n}\n\nexport interface EmptyState5Props {\n className?: string\n connectors: readonly EmptyState5Connector[]\n labels?: Partial<EmptyState5Labels>\n onConnect?: (id: string) => void\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-5/types.ts"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "helpers/initials.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "/**\n * Builds the initials shown in an avatar fallback: the first letter of the\n * first words of a label, upper-cased.\n *\n * @param label - A person or entity name; surrounding and repeated whitespace is ignored.\n * @param size - How many words contribute a letter. Defaults to two.\n * @returns The initials, or an empty string for a blank label.\n */\nexport function getInitials(label: string, size = 2): string {\n return label\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, size)\n .map((part) => part[0])\n .join('')\n .toUpperCase()\n}\n\n/**\n * Picks the text of an avatar fallback: the explicit fallback a person carries,\n * or the initials of its label when there is none.\n *\n * @param person - Anything with a `label` and an optional `fallback`.\n * @param size - How many words contribute a letter when the label is used. Defaults to two.\n * @returns The fallback as given (only `undefined` falls through, so an empty\n * string is kept), otherwise the initials of the label.\n */\nexport function resolveInitials(\n person: { label: string; fallback?: string },\n size = 2,\n): string {\n return person.fallback ?? getInitials(person.label, size)\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/helpers/initials.ts"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"dependencies": [
|
|
37
|
+
"@phosphor-icons/react@2.1.10",
|
|
38
|
+
"react@19.1.1"
|
|
39
|
+
],
|
|
40
|
+
"registryDependencies": [
|
|
41
|
+
"@ui/badge",
|
|
42
|
+
"@ui/button",
|
|
43
|
+
"@ui/empty",
|
|
44
|
+
"@ui/icon-frame"
|
|
45
|
+
],
|
|
46
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "empty-state-6",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/empty-state/empty-state-6/empty-state-6.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport {\n Empty,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { Tabs, TabsList, TabsPanel, TabsTab } from '@tc96/ui/tabs'\nimport { cn } from '@tc96/utils'\nimport { defaultEmptyState6Labels } from './labels'\nimport type { EmptyState6Props } from './types'\n\nexport function EmptyState6({\n className,\n labels: labelsProp,\n onSetup,\n onTabChange,\n tab,\n tabs,\n}: Readonly<EmptyState6Props>) {\n const labels = { ...defaultEmptyState6Labels, ...labelsProp }\n\n return (\n <Tabs\n className={cn('w-full', className)}\n onValueChange={(value) => onTabChange(String(value))}\n value={tab}\n >\n <TabsList aria-label={labels.tabs} variant=\"underline\">\n {tabs.map((item) => (\n <TabsTab key={item.id} value={item.id}>\n {item.label}\n </TabsTab>\n ))}\n </TabsList>\n {tabs.map((item) => {\n const Icon = item.icon\n\n return (\n <TabsPanel key={item.id} value={item.id}>\n <Empty>\n <EmptyHeader>\n <EmptyMedia>\n <IconFrame shape=\"rounded\" size=\"xl\">\n <Icon />\n </IconFrame>\n </EmptyMedia>\n <EmptyTitle>{item.title}</EmptyTitle>\n <EmptyDescription>{item.description}</EmptyDescription>\n </EmptyHeader>\n <Button onClick={() => onSetup(item.id)} size=\"sm\">\n {item.actionLabel}\n </Button>\n </Empty>\n </TabsPanel>\n )\n })}\n </Tabs>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-6/empty-state-6.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/empty-state/empty-state-6/index.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "export { EmptyState6 } from './empty-state-6'\nexport type {\n EmptyState6Labels,\n EmptyState6Props,\n EmptyState6Tab,\n} from './types'\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-6/index.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/empty-state/empty-state-6/labels.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import type { EmptyState6Labels } from './types'\n\nexport const defaultEmptyState6Labels: EmptyState6Labels = {\n tabs: 'Configurações',\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-6/labels.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/empty-state/empty-state-6/types.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import type { ElementType } from 'react'\n\nexport interface EmptyState6Tab {\n actionLabel: string\n description: string\n icon: ElementType\n id: string\n label: string\n title: string\n}\n\nexport interface EmptyState6Labels {\n tabs: string\n}\n\nexport interface EmptyState6Props {\n className?: string\n labels?: Partial<EmptyState6Labels>\n onSetup: (tabId: string) => void\n onTabChange: (tab: string) => void\n tab: string\n tabs: readonly EmptyState6Tab[]\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/empty-state/empty-state-6/types.ts"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"dependencies": [
|
|
31
|
+
"react@19.1.1"
|
|
32
|
+
],
|
|
33
|
+
"registryDependencies": [
|
|
34
|
+
"@ui/button",
|
|
35
|
+
"@ui/empty",
|
|
36
|
+
"@ui/icon-frame",
|
|
37
|
+
"@ui/tabs"
|
|
38
|
+
],
|
|
39
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
40
|
+
}
|