@tc96/cli 0.0.0-stage → 0.28.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 +1450 -0
- package/package.json +35 -4
- package/registry/agenda-1.json +1297 -0
- package/registry/aggregate.json +4 -0
- package/registry/ai-chat-1.json +91 -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/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 +321 -0
- package/registry/collection.json +1104 -0
- package/registry/crm-1.json +1317 -0
- package/registry/crm-2.json +1400 -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/dashboard-5.json +167 -0
- package/registry/dashboard-6.json +143 -0
- package/registry/dashboard-7.json +188 -0
- package/registry/documents-1.json +1322 -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/finance-1.json +845 -0
- package/registry/finance-2.json +973 -0
- package/registry/finance-3.json +1436 -0
- package/registry/flow-1.json +460 -0
- package/registry/flow-2.json +503 -0
- package/registry/flow-3.json +198 -0
- package/registry/flow-4.json +75 -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/inbox-1.json +1184 -0
- package/registry/inventory-1.json +828 -0
- package/registry/inventory-2.json +956 -0
- package/registry/legal-1.json +1345 -0
- package/registry/legal-2.json +1279 -0
- package/registry/legal-3.json +1273 -0
- package/registry/legal-4.json +1273 -0
- package/registry/legal-5.json +1393 -0
- package/registry/legal-6.json +1309 -0
- package/registry/legal-7.json +1315 -0
- package/registry/legal-8.json +1358 -0
- package/registry/legal-9.json +1381 -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/magic-link-6.json +79 -0
- package/registry/marketing-1.json +833 -0
- package/registry/marketing-2.json +961 -0
- package/registry/navbar-1.json +66 -0
- package/registry/navbar-10.json +50 -0
- package/registry/navbar-11.json +48 -0
- package/registry/navbar-12.json +48 -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/navbar-6.json +48 -0
- package/registry/navbar-7.json +72 -0
- package/registry/navbar-8.json +50 -0
- package/registry/navbar-9.json +54 -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/projects-1.json +865 -0
- package/registry/projects-2.json +993 -0
- package/registry/projects-3.json +1346 -0
- package/registry/properties.json +530 -0
- package/registry/record-dialog.json +88 -0
- package/registry/record-group.json +194 -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/revenue-1.json +834 -0
- package/registry/revenue-2.json +968 -0
- package/registry/revenue-3.json +821 -0
- package/registry/revenue-4.json +949 -0
- package/registry/rich-text-editor-1.json +172 -0
- package/registry/rich-text-editor-2.json +158 -0
- package/registry/rich-text-editor-3.json +198 -0
- package/registry/rich-text-editor-4.json +200 -0
- package/registry/rich-text-editor-5.json +237 -0
- package/registry/rich-text-editor.json +113 -0
- package/registry/settings-account-1.json +119 -0
- package/registry/settings-account-2.json +118 -0
- package/registry/settings-catalog-1.json +128 -0
- package/registry/settings-catalog-10.json +129 -0
- package/registry/settings-catalog-2.json +116 -0
- package/registry/settings-catalog-3.json +118 -0
- package/registry/settings-catalog-4.json +227 -0
- package/registry/settings-catalog-5.json +129 -0
- package/registry/settings-catalog-6.json +130 -0
- package/registry/settings-catalog-7.json +130 -0
- package/registry/settings-catalog-8.json +183 -0
- package/registry/settings-catalog-9.json +159 -0
- package/registry/settings-integration-1.json +125 -0
- package/registry/settings-integration-2.json +122 -0
- package/registry/settings-integration-3.json +118 -0
- package/registry/settings-integration-4.json +129 -0
- package/registry/settings-integration-5.json +122 -0
- package/registry/settings-integration-6.json +92 -0
- package/registry/settings-integration-7.json +122 -0
- package/registry/settings-integration-8.json +593 -0
- package/registry/settings-notification-channel-1.json +112 -0
- package/registry/settings-preference-1.json +123 -0
- package/registry/settings-preference-2.json +123 -0
- package/registry/settings-preference-3.json +116 -0
- package/registry/settings-role-permission-1.json +117 -0
- package/registry/settings-security-1.json +117 -0
- package/registry/settings-workspace-1.json +119 -0
- package/registry/settings-workspace-2.json +125 -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/support-1.json +853 -0
- package/registry/support-2.json +981 -0
- package/registry/support-3.json +762 -0
- package/registry/support-4.json +538 -0
- package/registry/team-1.json +829 -0
- package/registry/team-2.json +957 -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/property-meta.json +16 -0
- package/registry/ui/property-tone.json +12 -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 +1104 -0
- package/registry/widgets.json +319 -0
- package/registry/wizard.json +89 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "timeline-1",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/timeline/shared/timeline-error.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\n\nexport interface TimelineErrorProps {\n description: string\n onRetry?: () => void\n retry: string\n title: string\n}\n\nexport function TimelineError({\n description,\n onRetry,\n retry,\n title,\n}: Readonly<TimelineErrorProps>) {\n return (\n <StateSurface\n actions={\n onRetry ? (\n <Button onClick={onRetry} size=\"sm\" variant=\"outline\">\n {retry}\n </Button>\n ) : undefined\n }\n description={description}\n kind=\"error\"\n title={title}\n />\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-error.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/timeline/shared/timeline-item.tsx",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TimelineItemProps {\n children: ReactNode\n className?: string\n last?: boolean\n marker: ReactNode\n}\n\nexport function TimelineItem({\n children,\n className,\n last = false,\n marker,\n}: Readonly<TimelineItemProps>) {\n return (\n <li\n className={cn('flex gap-3', className)}\n data-last={last ? '' : undefined}\n data-slot=\"timeline-item\"\n >\n <div\n className=\"flex shrink-0 flex-col items-center\"\n data-slot=\"timeline-marker\"\n >\n {marker}\n {last ? null : (\n <span\n aria-hidden=\"true\"\n className=\"mt-1 w-px flex-1 bg-border\"\n data-slot=\"timeline-connector\"\n />\n )}\n </div>\n <div\n className={cn('min-w-0 flex-1', last ? '' : 'pb-6')}\n data-slot=\"timeline-content\"\n >\n {children}\n </div>\n </li>\n )\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-item.tsx"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/timeline/shared/timeline-list.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TimelineListProps {\n children: ReactNode\n className?: string\n label: string\n}\n\nexport function TimelineList({\n children,\n className,\n label,\n}: Readonly<TimelineListProps>) {\n return (\n <ol\n aria-label={label}\n className={cn('m-0 list-none p-0', className)}\n data-slot=\"timeline-list\"\n >\n {children}\n </ol>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-list.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/timeline/shared/timeline-skeleton-item.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { Skeleton } from '@tc96/ui/skeleton'\nimport type { ReactNode } from 'react'\nimport { TimelineItem } from './timeline-item'\n\nexport interface TimelineSkeletonItemProps {\n children?: ReactNode\n last?: boolean\n}\n\nexport function TimelineSkeletonItem({\n children,\n last,\n}: Readonly<TimelineSkeletonItemProps>) {\n return (\n <TimelineItem\n last={last}\n marker={<Skeleton className=\"size-8 rounded-full\" />}\n >\n {children ?? (\n <div className=\"grid gap-2 pt-1\">\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-1/4\" />\n </div>\n )}\n </TimelineItem>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-skeleton-item.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/timeline/shared/types.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "export type TimelineTone =\n | 'error'\n | 'info'\n | 'outline'\n | 'secondary'\n | 'success'\n | 'warning'\n\nexport interface TimelineBadgeData {\n label: string\n tone?: TimelineTone\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/types.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "blocks/application/timeline/timeline-1/index.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "export { Timeline1 } from './timeline-1'\nexport type {\n Timeline1Attachment,\n Timeline1Event,\n Timeline1Labels,\n Timeline1Props,\n} from './types'\n",
|
|
39
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-1/index.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "blocks/application/timeline/timeline-1/labels.ts",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import type { Timeline1Labels } from './types'\n\nexport const defaultTimeline1Labels: Timeline1Labels = {\n attachments: 'Anexos',\n emptyDescription: 'As atividades aparecem aqui assim que acontecerem.',\n emptyTitle: 'Nenhuma atividade ainda',\n errorDescription: 'Tente novamente em instantes.',\n errorTitle: 'Não foi possível carregar as atividades',\n loading: 'Carregando atividades',\n retry: 'Tentar novamente',\n title: 'Atividades',\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-1/labels.ts"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/timeline/timeline-1/timeline-1-skeleton.tsx",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import { Skeleton } from '@tc96/ui/skeleton'\nimport { cn } from '@tc96/utils'\nimport { TimelineList } from '../shared/timeline-list'\nimport { TimelineSkeletonItem } from '../shared/timeline-skeleton-item'\n\nexport function Timeline1Skeleton({\n className,\n label,\n title,\n}: Readonly<{ className?: string; label: string; title: string }>) {\n return (\n <section\n aria-busy=\"true\"\n aria-label={label}\n className={cn('grid gap-4', className)}\n >\n <h3 className=\"font-medium text-base\">{title}</h3>\n <TimelineList label={title}>\n <TimelineSkeletonItem />\n <TimelineSkeletonItem>\n <div className=\"grid gap-2 pt-1\">\n <Skeleton className=\"h-4 w-1/2\" />\n <Skeleton className=\"h-3 w-1/5\" />\n <Skeleton className=\"h-6 w-32\" />\n </div>\n </TimelineSkeletonItem>\n <TimelineSkeletonItem last />\n </TimelineList>\n </section>\n )\n}\n",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-1/timeline-1-skeleton.tsx"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "blocks/application/timeline/timeline-1/timeline-1.tsx",
|
|
55
|
+
"type": "registry:file",
|
|
56
|
+
"content": "import { PaperclipIcon } from '@phosphor-icons/react'\nimport { Avatar, AvatarFallback, AvatarImage } from '@tc96/ui/avatar'\nimport { Badge } from '@tc96/ui/badge'\nimport { getInitials } from '@tc96/ui/helpers/initials'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { cn } from '@tc96/utils'\nimport { TimelineError } from '../shared/timeline-error'\nimport { TimelineItem } from '../shared/timeline-item'\nimport { TimelineList } from '../shared/timeline-list'\nimport { defaultTimeline1Labels } from './labels'\nimport { Timeline1Skeleton } from './timeline-1-skeleton'\nimport type { Timeline1Props } from './types'\n\nexport function Timeline1({\n className,\n error = false,\n events,\n labels: labelsProp,\n onRetry,\n pending = false,\n}: Readonly<Timeline1Props>) {\n const labels = { ...defaultTimeline1Labels, ...labelsProp }\n\n if (pending) {\n return (\n <Timeline1Skeleton\n className={className}\n label={labels.loading}\n title={labels.title}\n />\n )\n }\n\n return (\n <section aria-label={labels.title} className={cn('grid gap-4', className)}>\n <h3 className=\"font-medium text-base\">{labels.title}</h3>\n {error ? (\n <TimelineError\n description={labels.errorDescription}\n onRetry={onRetry}\n retry={labels.retry}\n title={labels.errorTitle}\n />\n ) : events.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n <TimelineList label={labels.title}>\n {events.map((event, index) => (\n <TimelineItem\n key={event.id}\n last={index === events.length - 1}\n marker={\n <Avatar className=\"size-8\">\n {event.avatarSrc ? (\n <AvatarImage alt=\"\" src={event.avatarSrc} />\n ) : null}\n <AvatarFallback>{getInitials(event.actor)}</AvatarFallback>\n </Avatar>\n }\n >\n <div className=\"grid gap-2 pt-1\" data-event={event.id}>\n <div className=\"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-sm\">\n <span className=\"font-medium\">{event.actor}</span>\n <span className=\"text-muted-foreground\">{event.action}</span>\n {event.status ? (\n <Badge variant={event.status.tone ?? 'secondary'}>\n {event.status.label}\n </Badge>\n ) : null}\n </div>\n <p className=\"text-muted-foreground text-xs\">{event.time}</p>\n {event.attachments?.length ? (\n <ul\n aria-label={labels.attachments}\n className=\"m-0 flex list-none flex-wrap gap-1.5 p-0\"\n >\n {event.attachments.map((attachment) => (\n <li key={attachment.id}>\n <Badge variant=\"outline\">\n <PaperclipIcon aria-hidden=\"true\" />\n {attachment.label}\n </Badge>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n </TimelineItem>\n ))}\n </TimelineList>\n )}\n </section>\n )\n}\n",
|
|
57
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-1/timeline-1.tsx"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "blocks/application/timeline/timeline-1/types.ts",
|
|
61
|
+
"type": "registry:file",
|
|
62
|
+
"content": "import type { TimelineBadgeData } from '../shared/types'\n\nexport interface Timeline1Attachment {\n id: string\n label: string\n}\n\nexport interface Timeline1Event {\n action: string\n actor: string\n attachments?: Timeline1Attachment[]\n avatarSrc?: string\n id: string\n status?: TimelineBadgeData\n time: string\n}\n\nexport interface Timeline1Labels {\n attachments: string\n emptyDescription: string\n emptyTitle: string\n errorDescription: string\n errorTitle: string\n loading: string\n retry: string\n title: string\n}\n\nexport interface Timeline1Props {\n className?: string\n error?: boolean\n events: Timeline1Event[]\n labels?: Partial<Timeline1Labels>\n onRetry?: () => void\n pending?: boolean\n}\n",
|
|
63
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-1/types.ts"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "helpers/initials.ts",
|
|
67
|
+
"type": "registry:file",
|
|
68
|
+
"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",
|
|
69
|
+
"target": "~/packages/ui/src/helpers/initials.ts"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
73
|
+
"type": "registry:file",
|
|
74
|
+
"content": "import {\n FileMagnifyingGlassIcon,\n LockIcon,\n MagnifyingGlassIcon,\n TrayIcon,\n WarningIcon,\n} from '@phosphor-icons/react'\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 { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport {\n STATE_SURFACE_ICON_COLORS,\n STATE_SURFACE_ROLES,\n type StateSurfaceKind,\n type StateSurfaceProps,\n} from '../../core'\n\nconst KIND_ICONS = {\n empty: TrayIcon,\n error: WarningIcon,\n 'no-result': MagnifyingGlassIcon,\n 'not-found': FileMagnifyingGlassIcon,\n permission: LockIcon,\n} as const satisfies Record<StateSurfaceKind, typeof TrayIcon>\n\nexport function StateSurface({\n actions,\n className,\n description,\n icon,\n kind,\n title,\n}: StateSurfaceProps): ReactNode {\n const Icon = KIND_ICONS[kind]\n const iconColor = STATE_SURFACE_ICON_COLORS[kind]\n\n return (\n <Empty\n className={className}\n data-kind={kind}\n role={STATE_SURFACE_ROLES[kind]}\n >\n <EmptyHeader>\n {icon === null ? null : (\n <EmptyMedia>\n <IconFrame\n className={cn(!iconColor && 'bg-muted/60')}\n color={iconColor}\n shape=\"rounded\"\n size=\"xl\"\n >\n {icon === undefined ? <Icon aria-hidden=\"true\" /> : icon}\n </IconFrame>\n </EmptyMedia>\n )}\n <EmptyTitle>{title}</EmptyTitle>\n <EmptyDescription>{description}</EmptyDescription>\n </EmptyHeader>\n {actions ? (\n <EmptyContent className=\"flex-row flex-wrap justify-center gap-2\">\n {actions}\n </EmptyContent>\n ) : null}\n </Empty>\n )\n}\n",
|
|
75
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "import type { ReactNode } from 'react'\n\nexport const STATE_SURFACE_KINDS = [\n 'empty',\n 'no-result',\n 'error',\n 'permission',\n 'not-found',\n] as const\n\nexport type StateSurfaceKind = (typeof STATE_SURFACE_KINDS)[number]\n\nexport type StateGuardState = 'data' | 'loading' | StateSurfaceKind\n\nexport type StateSurfaceRole = 'alert' | 'status'\n\nexport const STATE_SURFACE_ROLES = {\n empty: 'status',\n error: 'alert',\n 'no-result': 'status',\n 'not-found': 'status',\n permission: 'alert',\n} as const satisfies Record<StateSurfaceKind, StateSurfaceRole>\n\nexport const STATE_SURFACE_ICON_COLORS: Partial<\n Record<StateSurfaceKind, string>\n> = {\n error: 'var(--destructive)',\n permission: 'var(--destructive)',\n}\n\nexport interface StateSurfaceProps {\n actions?: ReactNode\n className?: string\n description: ReactNode\n icon?: ReactNode\n kind: StateSurfaceKind\n title: ReactNode\n}\n\nexport type StateGuardProps = {\n children: ReactNode\n} & (\n | { state: 'data'; surface?: Omit<StateSurfaceProps, 'kind'> }\n | {\n state: 'loading'\n surface: Pick<StateSurfaceProps, 'className' | 'title'> & {\n description?: ReactNode\n }\n }\n | { state: StateSurfaceKind; surface: Omit<StateSurfaceProps, 'kind'> }\n)\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"dependencies": [
|
|
85
|
+
"@phosphor-icons/react@2.1.10",
|
|
86
|
+
"react@19.1.1"
|
|
87
|
+
],
|
|
88
|
+
"registryDependencies": [
|
|
89
|
+
"@ui/avatar",
|
|
90
|
+
"@ui/badge",
|
|
91
|
+
"@ui/button",
|
|
92
|
+
"@ui/empty",
|
|
93
|
+
"@ui/icon-frame",
|
|
94
|
+
"@ui/skeleton"
|
|
95
|
+
],
|
|
96
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
97
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "timeline-2",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/timeline/shared/timeline-error.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\n\nexport interface TimelineErrorProps {\n description: string\n onRetry?: () => void\n retry: string\n title: string\n}\n\nexport function TimelineError({\n description,\n onRetry,\n retry,\n title,\n}: Readonly<TimelineErrorProps>) {\n return (\n <StateSurface\n actions={\n onRetry ? (\n <Button onClick={onRetry} size=\"sm\" variant=\"outline\">\n {retry}\n </Button>\n ) : undefined\n }\n description={description}\n kind=\"error\"\n title={title}\n />\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-error.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/timeline/shared/timeline-item.tsx",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TimelineItemProps {\n children: ReactNode\n className?: string\n last?: boolean\n marker: ReactNode\n}\n\nexport function TimelineItem({\n children,\n className,\n last = false,\n marker,\n}: Readonly<TimelineItemProps>) {\n return (\n <li\n className={cn('flex gap-3', className)}\n data-last={last ? '' : undefined}\n data-slot=\"timeline-item\"\n >\n <div\n className=\"flex shrink-0 flex-col items-center\"\n data-slot=\"timeline-marker\"\n >\n {marker}\n {last ? null : (\n <span\n aria-hidden=\"true\"\n className=\"mt-1 w-px flex-1 bg-border\"\n data-slot=\"timeline-connector\"\n />\n )}\n </div>\n <div\n className={cn('min-w-0 flex-1', last ? '' : 'pb-6')}\n data-slot=\"timeline-content\"\n >\n {children}\n </div>\n </li>\n )\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-item.tsx"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/timeline/shared/timeline-list.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TimelineListProps {\n children: ReactNode\n className?: string\n label: string\n}\n\nexport function TimelineList({\n children,\n className,\n label,\n}: Readonly<TimelineListProps>) {\n return (\n <ol\n aria-label={label}\n className={cn('m-0 list-none p-0', className)}\n data-slot=\"timeline-list\"\n >\n {children}\n </ol>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-list.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/timeline/shared/timeline-skeleton-item.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { Skeleton } from '@tc96/ui/skeleton'\nimport type { ReactNode } from 'react'\nimport { TimelineItem } from './timeline-item'\n\nexport interface TimelineSkeletonItemProps {\n children?: ReactNode\n last?: boolean\n}\n\nexport function TimelineSkeletonItem({\n children,\n last,\n}: Readonly<TimelineSkeletonItemProps>) {\n return (\n <TimelineItem\n last={last}\n marker={<Skeleton className=\"size-8 rounded-full\" />}\n >\n {children ?? (\n <div className=\"grid gap-2 pt-1\">\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-1/4\" />\n </div>\n )}\n </TimelineItem>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-skeleton-item.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/timeline/timeline-2/index.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "export { Timeline2 } from './timeline-2'\nexport type {\n Timeline2ChangeType,\n Timeline2Entry,\n Timeline2Labels,\n Timeline2Props,\n Timeline2Release,\n} from './types'\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-2/index.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "blocks/application/timeline/timeline-2/labels.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "import type { Timeline2Labels } from './types'\n\nexport const defaultTimeline2Labels: Timeline2Labels = {\n emptyDescription: 'As versões publicadas aparecem aqui.',\n emptyTitle: 'Nenhuma versão publicada',\n errorDescription: 'Tente novamente em instantes.',\n errorTitle: 'Não foi possível carregar o histórico de versões',\n loading: 'Carregando histórico de versões',\n retry: 'Tentar novamente',\n title: 'Histórico de versões',\n types: { fix: 'Correção', improvement: 'Melhoria', new: 'Novo' },\n}\n",
|
|
39
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-2/labels.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "blocks/application/timeline/timeline-2/timeline-2-skeleton.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { Skeleton } from '@tc96/ui/skeleton'\nimport { cn } from '@tc96/utils'\nimport { TimelineList } from '../shared/timeline-list'\nimport { TimelineSkeletonItem } from '../shared/timeline-skeleton-item'\n\nfunction SkeletonRelease({ last }: Readonly<{ last?: boolean }>) {\n return (\n <TimelineSkeletonItem last={last}>\n <div className=\"grid gap-3 pt-1 sm:grid-cols-[7rem_1fr]\">\n <Skeleton className=\"h-4 w-20\" />\n <div className=\"grid gap-2\">\n <Skeleton className=\"h-5 w-24\" />\n <Skeleton className=\"h-4 w-3/4\" />\n <Skeleton className=\"h-4 w-1/2\" />\n </div>\n </div>\n </TimelineSkeletonItem>\n )\n}\n\nexport function Timeline2Skeleton({\n className,\n label,\n title,\n}: Readonly<{ className?: string; label: string; title: string }>) {\n return (\n <section\n aria-busy=\"true\"\n aria-label={label}\n className={cn('grid gap-4', className)}\n >\n <h3 className=\"font-medium text-base\">{title}</h3>\n <TimelineList label={title}>\n <SkeletonRelease />\n <SkeletonRelease last />\n </TimelineList>\n </section>\n )\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-2/timeline-2-skeleton.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/timeline/timeline-2/timeline-2.tsx",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import { Badge } from '@tc96/ui/badge'\nimport { formatShortDate, parseIsoDate } from '@tc96/ui/helpers/date'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { cn } from '@tc96/utils'\nimport { TimelineError } from '../shared/timeline-error'\nimport { TimelineItem } from '../shared/timeline-item'\nimport { TimelineList } from '../shared/timeline-list'\nimport { defaultTimeline2Labels } from './labels'\nimport { Timeline2Skeleton } from './timeline-2-skeleton'\nimport type { Timeline2ChangeType, Timeline2Props } from './types'\n\nconst tones = {\n fix: 'warning',\n improvement: 'info',\n new: 'success',\n} as const satisfies Record<Timeline2ChangeType, string>\n\nfunction formatDay(value: string, locale: string) {\n const date = parseIsoDate(value)\n return date ? formatShortDate(date, locale, 'UTC') : value\n}\n\nexport function Timeline2({\n className,\n error = false,\n labels: labelsProp,\n locale = 'pt-BR',\n onRetry,\n pending = false,\n releases,\n}: Readonly<Timeline2Props>) {\n const labels = {\n ...defaultTimeline2Labels,\n ...labelsProp,\n types: { ...defaultTimeline2Labels.types, ...labelsProp?.types },\n }\n\n if (pending) {\n return (\n <Timeline2Skeleton\n className={className}\n label={labels.loading}\n title={labels.title}\n />\n )\n }\n\n return (\n <section aria-label={labels.title} className={cn('grid gap-4', className)}>\n <h3 className=\"font-medium text-base\">{labels.title}</h3>\n {error ? (\n <TimelineError\n description={labels.errorDescription}\n onRetry={onRetry}\n retry={labels.retry}\n title={labels.errorTitle}\n />\n ) : releases.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n <TimelineList label={labels.title}>\n {releases.map((release, index) => (\n <TimelineItem\n key={release.id}\n last={index === releases.length - 1}\n marker={\n <span\n aria-hidden=\"true\"\n className=\"mt-1.5 size-2.5 rounded-full bg-primary\"\n />\n }\n >\n <div\n className=\"grid gap-3 sm:grid-cols-[7rem_1fr]\"\n data-release={release.id}\n >\n <time\n className=\"text-muted-foreground text-sm\"\n dateTime={release.date}\n >\n {formatDay(release.date, locale)}\n </time>\n <div className=\"grid gap-3\">\n <h4 className=\"font-medium text-sm\">{release.version}</h4>\n {release.entries.map((entry) => (\n <div\n className=\"grid justify-items-start gap-1.5\"\n data-type={entry.type}\n key={entry.id}\n >\n <Badge variant={tones[entry.type]}>\n {labels.types[entry.type]}\n </Badge>\n <ul className=\"m-0 grid list-disc gap-1 pl-5 text-sm\">\n {entry.items.map((item) => (\n <li key={item}>{item}</li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n </TimelineItem>\n ))}\n </TimelineList>\n )}\n </section>\n )\n}\n",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-2/timeline-2.tsx"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "blocks/application/timeline/timeline-2/types.ts",
|
|
55
|
+
"type": "registry:file",
|
|
56
|
+
"content": "export type Timeline2ChangeType = 'fix' | 'improvement' | 'new'\n\nexport interface Timeline2Entry {\n id: string\n items: string[]\n type: Timeline2ChangeType\n}\n\nexport interface Timeline2Release {\n date: string\n entries: Timeline2Entry[]\n id: string\n version: string\n}\n\nexport interface Timeline2Labels {\n emptyDescription: string\n emptyTitle: string\n errorDescription: string\n errorTitle: string\n loading: string\n retry: string\n title: string\n types: Record<Timeline2ChangeType, string>\n}\n\nexport interface Timeline2Props {\n className?: string\n error?: boolean\n labels?: Partial<Omit<Timeline2Labels, 'types'>> & {\n types?: Partial<Timeline2Labels['types']>\n }\n locale?: string\n onRetry?: () => void\n pending?: boolean\n releases: Timeline2Release[]\n}\n",
|
|
57
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-2/types.ts"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "helpers/calendar-date.ts",
|
|
61
|
+
"type": "registry:file",
|
|
62
|
+
"content": "/** Span of days {@link calendarRange} produces around an anchor date. */\nexport type CalendarRangeMode = 'day' | 'month' | 'week'\n\n/**\n * A calendar day with no time and no time zone attached. `month` runs from\n * 1 to 12.\n */\nexport interface CalendarDate {\n day: number\n month: number\n year: number\n}\n\nconst DATE_KEY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\n/**\n * Serializes a calendar date as `YYYY-MM-DD`, a stable key for maps and DOM\n * attributes.\n *\n * @param date - The calendar date to serialize.\n */\nexport function calendarDateKey(date: CalendarDate): string {\n const month = String(date.month).padStart(2, '0')\n const day = String(date.day).padStart(2, '0')\n\n return `${date.year}-${month}-${day}`\n}\n\n/**\n * Parses a `YYYY-MM-DD` key produced by {@link calendarDateKey}.\n *\n * @param key - The serialized date.\n * @returns The calendar date, or `null` when the text is malformed or names a\n * day that does not exist, such as February 30.\n */\nexport function parseCalendarDateKey(key: string): CalendarDate | null {\n const match = DATE_KEY_PATTERN.exec(key)\n if (!match) return null\n\n const candidate = {\n day: Number(match[3]),\n month: Number(match[2]),\n year: Number(match[1]),\n }\n\n return isSameCalendarDate(candidate, normalizeCalendarDate(candidate))\n ? candidate\n : null\n}\n\n/**\n * Reads the local calendar day of a `Date`, dropping its time.\n *\n * @param date - A valid date, such as the one a date picker selects.\n */\nexport function calendarDateFromDate(date: Date): CalendarDate {\n return {\n day: date.getDate(),\n month: date.getMonth() + 1,\n year: date.getFullYear(),\n }\n}\n\n/**\n * Builds the local midnight `Date` of a calendar date, the value a date\n * picker expects for a day.\n *\n * @param date - The calendar date to convert.\n */\nexport function calendarDateToDate(date: CalendarDate): Date {\n return new Date(date.year, date.month - 1, date.day)\n}\n\n/**\n * Moves a calendar date by a number of days, rolling over months and years.\n *\n * @param date - The starting date.\n * @param days - Days to add; negative values move backwards.\n */\nexport function addCalendarDays(\n date: CalendarDate,\n days: number,\n): CalendarDate {\n return normalizeCalendarDate({ ...date, day: date.day + days })\n}\n\n/**\n * Orders two calendar dates chronologically.\n *\n * @returns Negative when `a` is earlier, positive when later, zero when equal.\n */\nexport function compareCalendarDates(a: CalendarDate, b: CalendarDate): number {\n return a.year - b.year || a.month - b.month || a.day - b.day\n}\n\n/** Whether two calendar dates name the same day. */\nexport function isSameCalendarDate(a: CalendarDate, b: CalendarDate): boolean {\n return compareCalendarDates(a, b) === 0\n}\n\n/**\n * Day of the week of a calendar date.\n *\n * @returns `0` for Sunday through `6` for Saturday.\n */\nexport function calendarDayOfWeek(date: CalendarDate): number {\n return new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay()\n}\n\n/**\n * First day of the week that contains a calendar date.\n *\n * @param date - Any day of the week.\n * @param weekStartsOn - `0` when weeks start on Sunday, `1` on Monday.\n */\nexport function startOfWeek(\n date: CalendarDate,\n weekStartsOn: 0 | 1,\n): CalendarDate {\n const offset = (calendarDayOfWeek(date) - weekStartsOn + 7) % 7\n\n return addCalendarDays(date, -offset)\n}\n\n/**\n * Lists the days a calendar view shows for an anchor date. A month spans from\n * the first week containing the 1st to the last week containing the final day,\n * so adjacent days of neighbouring months are included.\n *\n * @param anchor - The date the view is centred on.\n * @param mode - Whether to list one day, one week or one month.\n * @param weekStartsOn - `0` when weeks start on Sunday, `1` on Monday.\n * @returns The visible days in chronological order.\n */\nexport function calendarRange(\n anchor: CalendarDate,\n mode: CalendarRangeMode,\n weekStartsOn: 0 | 1,\n): CalendarDate[] {\n if (mode === 'day') return [anchor]\n\n if (mode === 'week') {\n const first = startOfWeek(anchor, weekStartsOn)\n\n return Array.from({ length: 7 }, (_, index) =>\n addCalendarDays(first, index),\n )\n }\n\n const firstOfMonth = { ...anchor, day: 1 }\n const lastOfMonth = addCalendarDays(\n {\n ...normalizeCalendarDate({ ...anchor, day: 1, month: anchor.month + 1 }),\n },\n -1,\n )\n const first = startOfWeek(firstOfMonth, weekStartsOn)\n const last = addCalendarDays(startOfWeek(lastOfMonth, weekStartsOn), 6)\n const days: CalendarDate[] = []\n\n for (\n let day = first;\n compareCalendarDates(day, last) <= 0;\n day = addCalendarDays(day, 1)\n ) {\n days.push(day)\n }\n\n return days\n}\n\n/**\n * Normalizes an out-of-range day or month through `Date.UTC`, which rolls it\n * over into the right month and year. Arithmetic stays in year/month/day\n * rather than adding 86400 seconds to an instant, which would break across\n * daylight saving transitions.\n */\nfunction normalizeCalendarDate(date: CalendarDate): CalendarDate {\n const normalized = new Date(Date.UTC(date.year, date.month - 1, date.day))\n\n return {\n day: normalized.getUTCDate(),\n month: normalized.getUTCMonth() + 1,\n year: normalized.getUTCFullYear(),\n }\n}\n",
|
|
63
|
+
"target": "~/packages/ui/src/helpers/calendar-date.ts"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "helpers/date.ts",
|
|
67
|
+
"type": "registry:file",
|
|
68
|
+
"content": "import type { CalendarDate } from './calendar-date'\nimport { toZonedDateTime } from './zoned-date-time'\n\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/\nconst MILLISECONDS_IN_DAY = 86_400_000\n\nconst DATE_FORMAT_OPTIONS = {\n dateTime: { dateStyle: 'long', timeStyle: 'short' },\n long: { dateStyle: 'long' },\n medium: { dateStyle: 'medium' },\n numeric: { day: '2-digit', month: '2-digit', year: 'numeric' },\n short: { day: 'numeric', month: 'short' },\n weekdayAndDay: { day: 'numeric', weekday: 'long' },\n} satisfies Record<string, Intl.DateTimeFormatOptions>\n\nconst dateFormatters = new Map<string, Intl.DateTimeFormat>()\nconst relativeDayFormatters = new Map<string, Intl.RelativeTimeFormat>()\n\n/**\n * Type guard for a `Date` whose time is not `NaN`.\n *\n * @param value - Any value, typically the result of parsing user input.\n */\nexport function isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime())\n}\n\n/**\n * Parses an ISO 8601 string, such as the value stored by a date property.\n *\n * @param value - The serialized date; empty values are treated as absent.\n * @returns The parsed date, or `null` when the value is absent or invalid.\n */\nexport function parseIsoDate(value: string | null | undefined): Date | null {\n if (!value) return null\n const date = new Date(value)\n return isValidDate(date) ? date : null\n}\n\n/**\n * Coerces a cell value into a `Date`. A date-only string (`2026-08-04`) is\n * read as local midnight, because `new Date('2026-08-04')` is UTC midnight and\n * would display as the previous day in any negative time zone.\n *\n * @param value - A `Date`, a date string or anything `String()` can serialize.\n * @returns A date that may be invalid; check it with {@link isValidDate}.\n */\nexport function parseDateValue(value: unknown): Date {\n if (value instanceof Date) return value\n const raw = String(value)\n return DATE_ONLY_PATTERN.test(raw)\n ? new Date(`${raw}T00:00:00`)\n : new Date(raw)\n}\n\n/**\n * Serializes the local calendar day of a date as noon UTC, so the day survives\n * a round trip through any time zone.\n *\n * @param date - A date whose local year, month and day are kept.\n * @returns An ISO string such as `2026-06-19T12:00:00.000Z`.\n */\nexport function serializeIsoDay(date: Date): string {\n return new Date(\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 12),\n ).toISOString()\n}\n\n/**\n * Formats a date as day and abbreviated month, without the year.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone, which suits local day markers.\n * @returns The formatted date, such as `Jun 19` or `19 de jun.`.\n */\nexport function formatShortDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('short', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date as two-digit day and month with the full year, so a column\n * of dates aligns.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date, such as `11/09/2026` or `09/11/2026`.\n */\nexport function formatNumericDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('numeric', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date with day, abbreviated month and year, as a date picker\n * trigger shows it.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date, such as `Oct 20, 2026` or `20 de out. de 2026`.\n */\nexport function formatMediumDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('medium', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date with day, full month name and year.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date, such as `October 20, 2026` or\n * `20 de outubro de 2026`.\n */\nexport function formatLongDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('long', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date with day, full month name, year and time of day, as a\n * tooltip over a short or relative date shows it.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date and time, such as `October 20, 2026 at 2:30 PM`\n * or `20 de outubro de 2026 às 14:30`.\n */\nexport function formatDateTime(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('dateTime', locale, timeZone).format(date)\n}\n\n/**\n * Formats the weekday name with the day of the month, as a day heading over a\n * list of time slots.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted day, such as `Tuesday 20` or `terça-feira, 20`.\n */\nexport function formatWeekdayAndDay(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('weekdayAndDay', locale, timeZone).format(date)\n}\n\n/**\n * Counts the civil days between two instants as seen on the wall clock of a\n * time zone, so an instant just after midnight in that zone counts as the\n * next day even when it is still the previous day in UTC.\n *\n * @param from - The reference instant, usually now.\n * @param to - The instant being measured, such as a due date.\n * @param timeZone - An IANA time zone.\n * @returns Negative when `to` falls on an earlier day than `from`.\n */\nexport function dayOffsetInTimeZone(\n from: Date,\n to: Date,\n timeZone: string,\n): number {\n return (\n dayNumber(toZonedDateTime(to, timeZone).date) -\n dayNumber(toZonedDateTime(from, timeZone).date)\n )\n}\n\n/**\n * Names a day relative to today (`Yesterday`, `Today`, `Tomorrow`, `In 3\n * days`) with the first letter upper-cased for the locale.\n *\n * @param dayOffset - Civil days from today; see {@link dayOffsetInTimeZone}.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n */\nexport function formatRelativeDay(dayOffset: number, locale: string): string {\n const label = getRelativeDayFormatter(locale).format(dayOffset, 'day')\n return label.charAt(0).toLocaleUpperCase(locale) + label.slice(1)\n}\n\n/**\n * Moves a date by a number of local calendar days, keeping its time of day.\n *\n * @param date - The starting date; it is not mutated.\n * @param days - Days to add; negative values move backwards.\n */\nexport function addDays(date: Date, days: number): Date {\n const next = new Date(date)\n next.setDate(next.getDate() + days)\n return next\n}\n\n/**\n * Moves a date by a number of months. When the target month is shorter, the\n * day is clamped to its last day, so January 31 plus one month is the end of\n * February instead of early March.\n *\n * @param date - The starting date; it is not mutated.\n * @param months - Months to add; negative values move backwards.\n */\nexport function addMonths(date: Date, months: number): Date {\n const next = new Date(date)\n next.setDate(1)\n next.setMonth(next.getMonth() + months)\n const lastDay = new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate()\n next.setDate(Math.min(date.getDate(), lastDay))\n return next\n}\n\n/**\n * Moves a date by a number of years. February 29 becomes February 28 in a\n * common year.\n *\n * @param date - The starting date; it is not mutated.\n * @param years - Years to add; negative values move backwards.\n */\nexport function addYears(date: Date, years: number): Date {\n return addMonths(date, years * 12)\n}\n\n/** Building an `Intl` formatter costs ~50 formats, so one is kept per key. */\nfunction getDateFormatter(\n style: keyof typeof DATE_FORMAT_OPTIONS,\n locale: string,\n timeZone?: string,\n): Intl.DateTimeFormat {\n const key = `${style}|${locale}|${timeZone ?? ''}`\n const cached = dateFormatters.get(key)\n if (cached) return cached\n\n const formatter = new Intl.DateTimeFormat(locale, {\n ...DATE_FORMAT_OPTIONS[style],\n ...(timeZone ? { timeZone } : {}),\n })\n dateFormatters.set(key, formatter)\n\n return formatter\n}\n\nfunction getRelativeDayFormatter(locale: string): Intl.RelativeTimeFormat {\n const cached = relativeDayFormatters.get(locale)\n if (cached) return cached\n\n const formatter = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' })\n relativeDayFormatters.set(locale, formatter)\n\n return formatter\n}\n\n/** Days since the Unix epoch for a calendar date, ignoring time zones. */\nfunction dayNumber(date: CalendarDate): number {\n return Date.UTC(date.year, date.month - 1, date.day) / MILLISECONDS_IN_DAY\n}\n",
|
|
69
|
+
"target": "~/packages/ui/src/helpers/date.ts"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "helpers/zoned-date-time.ts",
|
|
73
|
+
"type": "registry:file",
|
|
74
|
+
"content": "import type { CalendarDate } from './calendar-date'\n\n/**\n * A wall-clock reading in some time zone: the calendar day and the minutes\n * elapsed since local midnight.\n */\nexport interface ZonedDateTime {\n date: CalendarDate\n minutes: number\n}\n\nconst formatterCache = new Map<string, Intl.DateTimeFormat>()\n\n/**\n * Returns the formatter for a time zone. `Intl.DateTimeFormat` is expensive\n * to construct, so one instance per zone is kept for the life of the module.\n */\nfunction getFormatter(timeZone: string): Intl.DateTimeFormat {\n const cached = formatterCache.get(timeZone)\n if (cached) return cached\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n day: '2-digit',\n hour: '2-digit',\n hourCycle: 'h23',\n minute: '2-digit',\n month: '2-digit',\n second: '2-digit',\n timeZone,\n year: 'numeric',\n })\n formatterCache.set(timeZone, formatter)\n\n return formatter\n}\n\n/** Numeric date and time fields of an instant, read in a time zone. */\ninterface WallClockParts {\n day: number\n hour: number\n minute: number\n month: number\n second: number\n year: number\n}\n\n/**\n * Reads the wall-clock fields of an instant in a time zone.\n *\n * @param instant - The UTC instant to project.\n * @param timeZone - An IANA time zone.\n */\nfunction wallClockPartsOf(instant: Date, timeZone: string): WallClockParts {\n const parts: Partial<WallClockParts> = {}\n\n for (const part of getFormatter(timeZone).formatToParts(instant)) {\n if (part.type === 'literal') continue\n if (part.type in partKeys)\n parts[partKeys[part.type as keyof typeof partKeys]] = Number(part.value)\n }\n\n return parts as WallClockParts\n}\n\nconst partKeys = {\n day: 'day',\n hour: 'hour',\n minute: 'minute',\n month: 'month',\n second: 'second',\n year: 'year',\n} as const\n\n/**\n * Projects a UTC instant onto the wall clock of a time zone.\n *\n * @param instant - The UTC instant to project.\n * @param timeZone - An IANA time zone.\n * @returns The calendar day and the minutes since local midnight.\n */\nexport function toZonedDateTime(\n instant: Date,\n timeZone: string,\n): ZonedDateTime {\n const parts = wallClockPartsOf(instant, timeZone)\n\n return {\n date: { day: parts.day, month: parts.month, year: parts.year },\n minutes: parts.hour * 60 + parts.minute,\n }\n}\n\n/**\n * Offset of a time zone from UTC at a given instant. The formatter stops at\n * seconds, so the instant is truncated to the second before comparing;\n * otherwise milliseconds would leak into the offset.\n *\n * @param instant - The UTC instant to measure at.\n * @param timeZone - An IANA time zone.\n * @returns The offset in milliseconds; positive east of UTC.\n */\nexport function getTimeZoneOffsetMs(instant: Date, timeZone: string): number {\n const parts = wallClockPartsOf(instant, timeZone)\n const wallAsUtc = Date.UTC(\n parts.year,\n parts.month - 1,\n parts.day,\n parts.hour,\n parts.minute,\n parts.second,\n )\n const truncated =\n instant.getTime() - (((instant.getTime() % 1000) + 1000) % 1000)\n\n return wallAsUtc - truncated\n}\n\n/**\n * Converts a wall-clock reading in a time zone back to a UTC instant without a\n * date library: the wall time is first treated as UTC and then corrected by the\n * zone offset. A second pass handles transition edges, since offsets only\n * change there: an ambiguous time (fall back) keeps the first offset found,\n * and a nonexistent time (spring forward) resolves to the instant after the\n * transition.\n *\n * @param zoned - The calendar day and minutes since local midnight.\n * @param timeZone - An IANA time zone.\n * @returns The UTC instant that shows that wall time in the zone.\n */\nexport function fromZonedDateTime(\n zoned: ZonedDateTime,\n timeZone: string,\n): Date {\n const { date, minutes } = zoned\n const guess = Date.UTC(date.year, date.month - 1, date.day, 0, minutes)\n const firstOffset = getTimeZoneOffsetMs(new Date(guess), timeZone)\n const candidate = guess - firstOffset\n const secondOffset = getTimeZoneOffsetMs(new Date(candidate), timeZone)\n\n if (firstOffset === secondOffset) return new Date(candidate)\n\n const corrected = guess - secondOffset\n const projected = toZonedDateTime(new Date(corrected), timeZone)\n const matchesWall =\n projected.minutes === ((minutes % 1440) + 1440) % 1440 &&\n projected.date.day === date.day &&\n projected.date.month === date.month &&\n projected.date.year === date.year\n\n return matchesWall ? new Date(corrected) : new Date(candidate)\n}\n",
|
|
75
|
+
"target": "~/packages/ui/src/helpers/zoned-date-time.ts"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "import {\n FileMagnifyingGlassIcon,\n LockIcon,\n MagnifyingGlassIcon,\n TrayIcon,\n WarningIcon,\n} from '@phosphor-icons/react'\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 { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport {\n STATE_SURFACE_ICON_COLORS,\n STATE_SURFACE_ROLES,\n type StateSurfaceKind,\n type StateSurfaceProps,\n} from '../../core'\n\nconst KIND_ICONS = {\n empty: TrayIcon,\n error: WarningIcon,\n 'no-result': MagnifyingGlassIcon,\n 'not-found': FileMagnifyingGlassIcon,\n permission: LockIcon,\n} as const satisfies Record<StateSurfaceKind, typeof TrayIcon>\n\nexport function StateSurface({\n actions,\n className,\n description,\n icon,\n kind,\n title,\n}: StateSurfaceProps): ReactNode {\n const Icon = KIND_ICONS[kind]\n const iconColor = STATE_SURFACE_ICON_COLORS[kind]\n\n return (\n <Empty\n className={className}\n data-kind={kind}\n role={STATE_SURFACE_ROLES[kind]}\n >\n <EmptyHeader>\n {icon === null ? null : (\n <EmptyMedia>\n <IconFrame\n className={cn(!iconColor && 'bg-muted/60')}\n color={iconColor}\n shape=\"rounded\"\n size=\"xl\"\n >\n {icon === undefined ? <Icon aria-hidden=\"true\" /> : icon}\n </IconFrame>\n </EmptyMedia>\n )}\n <EmptyTitle>{title}</EmptyTitle>\n <EmptyDescription>{description}</EmptyDescription>\n </EmptyHeader>\n {actions ? (\n <EmptyContent className=\"flex-row flex-wrap justify-center gap-2\">\n {actions}\n </EmptyContent>\n ) : null}\n </Empty>\n )\n}\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
85
|
+
"type": "registry:file",
|
|
86
|
+
"content": "import type { ReactNode } from 'react'\n\nexport const STATE_SURFACE_KINDS = [\n 'empty',\n 'no-result',\n 'error',\n 'permission',\n 'not-found',\n] as const\n\nexport type StateSurfaceKind = (typeof STATE_SURFACE_KINDS)[number]\n\nexport type StateGuardState = 'data' | 'loading' | StateSurfaceKind\n\nexport type StateSurfaceRole = 'alert' | 'status'\n\nexport const STATE_SURFACE_ROLES = {\n empty: 'status',\n error: 'alert',\n 'no-result': 'status',\n 'not-found': 'status',\n permission: 'alert',\n} as const satisfies Record<StateSurfaceKind, StateSurfaceRole>\n\nexport const STATE_SURFACE_ICON_COLORS: Partial<\n Record<StateSurfaceKind, string>\n> = {\n error: 'var(--destructive)',\n permission: 'var(--destructive)',\n}\n\nexport interface StateSurfaceProps {\n actions?: ReactNode\n className?: string\n description: ReactNode\n icon?: ReactNode\n kind: StateSurfaceKind\n title: ReactNode\n}\n\nexport type StateGuardProps = {\n children: ReactNode\n} & (\n | { state: 'data'; surface?: Omit<StateSurfaceProps, 'kind'> }\n | {\n state: 'loading'\n surface: Pick<StateSurfaceProps, 'className' | 'title'> & {\n description?: ReactNode\n }\n }\n | { state: StateSurfaceKind; surface: Omit<StateSurfaceProps, 'kind'> }\n)\n",
|
|
87
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"dependencies": [
|
|
91
|
+
"@phosphor-icons/react@2.1.10",
|
|
92
|
+
"react@19.1.1"
|
|
93
|
+
],
|
|
94
|
+
"registryDependencies": [
|
|
95
|
+
"@ui/badge",
|
|
96
|
+
"@ui/button",
|
|
97
|
+
"@ui/empty",
|
|
98
|
+
"@ui/icon-frame",
|
|
99
|
+
"@ui/skeleton"
|
|
100
|
+
],
|
|
101
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
102
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "timeline-3",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/timeline/timeline-3/index.ts",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "export { Timeline3 } from './timeline-3'\nexport type {\n Timeline3Labels,\n Timeline3Owner,\n Timeline3Props,\n Timeline3Status,\n Timeline3Step,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-3/index.ts"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/timeline/timeline-3/labels.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import type { Timeline3Labels } from './types'\n\nexport const defaultTimeline3Labels: Timeline3Labels = {\n approve: 'Aprovar',\n currentStep: 'Etapa atual',\n emptyDescription: 'As etapas aparecem aqui quando o fluxo for iniciado.',\n emptyTitle: 'Nenhuma etapa de aprovação',\n errorDescription: 'Tente novamente em instantes.',\n errorTitle: 'Não foi possível carregar as etapas',\n loading: 'Carregando etapas',\n reject: 'Recusar',\n retry: 'Tentar novamente',\n statuses: {\n approved: 'Aprovado',\n pending: 'Pendente',\n rejected: 'Recusado',\n },\n title: 'Fluxo de aprovação',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-3/labels.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/timeline/timeline-3/timeline-3-skeleton.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { Skeleton } from '@tc96/ui/skeleton'\n\nexport function Timeline3Skeleton({ label }: Readonly<{ label: string }>) {\n return (\n <output\n aria-busy=\"true\"\n aria-label={label}\n className=\"flex w-max items-start\"\n >\n {[0, 1, 2].map((index) => (\n <div className=\"flex items-start\" key={index}>\n <div className=\"grid w-64 gap-3 rounded-xl border p-4\">\n <div className=\"flex items-center gap-2\">\n <Skeleton className=\"size-8 rounded-full\" />\n <Skeleton className=\"h-4 w-28\" />\n </div>\n <Skeleton className=\"h-4 w-36\" />\n <Skeleton className=\"h-5 w-20\" />\n <Skeleton className=\"h-3 w-32\" />\n </div>\n {index < 2 ? <Skeleton className=\"mt-8 h-px w-6\" /> : null}\n </div>\n ))}\n </output>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-3/timeline-3-skeleton.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/timeline/timeline-3/timeline-3.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { Avatar, AvatarFallback, AvatarImage } from '@tc96/ui/avatar'\nimport { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\nimport { getInitials } from '@tc96/ui/helpers/initials'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { ScrollArea } from '@tc96/ui/scroll-area'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport { defaultTimeline3Labels } from './labels'\nimport { Timeline3Skeleton } from './timeline-3-skeleton'\nimport type { Timeline3Props, Timeline3Status } from './types'\n\nconst statusVariants = {\n approved: 'success',\n pending: 'warning',\n rejected: 'error',\n} as const satisfies Record<Timeline3Status, string>\n\nexport function Timeline3({\n className,\n currentStepId,\n error = false,\n labels: labelsProp,\n onApprove,\n onReject,\n onRetry,\n pending = false,\n steps,\n}: Readonly<Timeline3Props>) {\n const labels = { ...defaultTimeline3Labels, ...labelsProp }\n\n let body: ReactNode\n if (pending) {\n body = <Timeline3Skeleton label={labels.loading} />\n } else if (error) {\n body = (\n <StateSurface\n actions={\n onRetry ? (\n <Button onClick={onRetry} size=\"sm\" variant=\"outline\">\n {labels.retry}\n </Button>\n ) : undefined\n }\n description={labels.errorDescription}\n kind=\"error\"\n title={labels.errorTitle}\n />\n )\n } else if (steps.length === 0) {\n body = (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n )\n } else {\n body = (\n <ScrollArea>\n <ol\n aria-label={labels.title}\n className=\"m-0 flex w-max list-none items-start p-0 pb-3\"\n >\n {steps.map((step, index) => {\n const current = step.id === currentStepId\n return (\n <li\n aria-current={current ? 'step' : undefined}\n className=\"flex items-start\"\n data-current={current ? '' : undefined}\n data-step={step.id}\n key={step.id}\n >\n <div\n className={cn(\n 'grid w-64 gap-3 rounded-xl border bg-card p-4 text-card-foreground',\n current && 'border-primary ring-1 ring-primary',\n )}\n >\n <div className=\"flex items-center gap-2\">\n <Avatar>\n {step.owner.image ? (\n <AvatarImage\n alt={step.owner.name}\n src={step.owner.image}\n />\n ) : null}\n <AvatarFallback>\n {getInitials(step.owner.name)}\n </AvatarFallback>\n </Avatar>\n <span className=\"truncate text-sm\">{step.owner.name}</span>\n </div>\n <div className=\"grid gap-1\">\n <span className=\"font-medium text-sm\">{step.name}</span>\n <span className=\"text-muted-foreground text-xs\">\n {step.date}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <Badge variant={statusVariants[step.status]}>\n {labels.statuses[step.status]}\n </Badge>\n {current ? (\n <span className=\"font-medium text-primary text-xs\">\n {labels.currentStep}\n </span>\n ) : null}\n </div>\n {current ? (\n <div className=\"flex gap-2\">\n <Button onClick={() => onApprove?.(step.id)} size=\"sm\">\n {labels.approve}\n </Button>\n <Button\n onClick={() => onReject?.(step.id)}\n size=\"sm\"\n variant=\"outline\"\n >\n {labels.reject}\n </Button>\n </div>\n ) : null}\n </div>\n {index < steps.length - 1 ? (\n <span\n aria-hidden=\"true\"\n className=\"mt-8 h-px w-6 shrink-0 bg-border\"\n data-slot=\"timeline-3-connector\"\n />\n ) : null}\n </li>\n )\n })}\n </ol>\n </ScrollArea>\n )\n }\n\n return (\n <section\n aria-label={labels.title}\n className={cn('grid grid-cols-[minmax(0,1fr)] gap-3', className)}\n >\n <h3 className=\"font-medium text-base\">{labels.title}</h3>\n {body}\n </section>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-3/timeline-3.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/timeline/timeline-3/types.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "export type Timeline3Status = 'approved' | 'pending' | 'rejected'\n\nexport interface Timeline3Owner {\n image?: string\n name: string\n}\n\nexport interface Timeline3Step {\n date: string\n id: string\n name: string\n owner: Timeline3Owner\n status: Timeline3Status\n}\n\nexport interface Timeline3Labels {\n approve: string\n currentStep: string\n emptyDescription: string\n emptyTitle: string\n errorDescription: string\n errorTitle: string\n loading: string\n reject: string\n retry: string\n statuses: Record<Timeline3Status, string>\n title: string\n}\n\nexport interface Timeline3Props {\n className?: string\n currentStepId?: string\n error?: boolean\n labels?: Partial<Timeline3Labels>\n onApprove?: (stepId: string) => void\n onReject?: (stepId: string) => void\n onRetry?: () => void\n pending?: boolean\n steps: Timeline3Step[]\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-3/types.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "helpers/initials.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"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",
|
|
39
|
+
"target": "~/packages/ui/src/helpers/initials.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import {\n FileMagnifyingGlassIcon,\n LockIcon,\n MagnifyingGlassIcon,\n TrayIcon,\n WarningIcon,\n} from '@phosphor-icons/react'\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 { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport {\n STATE_SURFACE_ICON_COLORS,\n STATE_SURFACE_ROLES,\n type StateSurfaceKind,\n type StateSurfaceProps,\n} from '../../core'\n\nconst KIND_ICONS = {\n empty: TrayIcon,\n error: WarningIcon,\n 'no-result': MagnifyingGlassIcon,\n 'not-found': FileMagnifyingGlassIcon,\n permission: LockIcon,\n} as const satisfies Record<StateSurfaceKind, typeof TrayIcon>\n\nexport function StateSurface({\n actions,\n className,\n description,\n icon,\n kind,\n title,\n}: StateSurfaceProps): ReactNode {\n const Icon = KIND_ICONS[kind]\n const iconColor = STATE_SURFACE_ICON_COLORS[kind]\n\n return (\n <Empty\n className={className}\n data-kind={kind}\n role={STATE_SURFACE_ROLES[kind]}\n >\n <EmptyHeader>\n {icon === null ? null : (\n <EmptyMedia>\n <IconFrame\n className={cn(!iconColor && 'bg-muted/60')}\n color={iconColor}\n shape=\"rounded\"\n size=\"xl\"\n >\n {icon === undefined ? <Icon aria-hidden=\"true\" /> : icon}\n </IconFrame>\n </EmptyMedia>\n )}\n <EmptyTitle>{title}</EmptyTitle>\n <EmptyDescription>{description}</EmptyDescription>\n </EmptyHeader>\n {actions ? (\n <EmptyContent className=\"flex-row flex-wrap justify-center gap-2\">\n {actions}\n </EmptyContent>\n ) : null}\n </Empty>\n )\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import type { ReactNode } from 'react'\n\nexport const STATE_SURFACE_KINDS = [\n 'empty',\n 'no-result',\n 'error',\n 'permission',\n 'not-found',\n] as const\n\nexport type StateSurfaceKind = (typeof STATE_SURFACE_KINDS)[number]\n\nexport type StateGuardState = 'data' | 'loading' | StateSurfaceKind\n\nexport type StateSurfaceRole = 'alert' | 'status'\n\nexport const STATE_SURFACE_ROLES = {\n empty: 'status',\n error: 'alert',\n 'no-result': 'status',\n 'not-found': 'status',\n permission: 'alert',\n} as const satisfies Record<StateSurfaceKind, StateSurfaceRole>\n\nexport const STATE_SURFACE_ICON_COLORS: Partial<\n Record<StateSurfaceKind, string>\n> = {\n error: 'var(--destructive)',\n permission: 'var(--destructive)',\n}\n\nexport interface StateSurfaceProps {\n actions?: ReactNode\n className?: string\n description: ReactNode\n icon?: ReactNode\n kind: StateSurfaceKind\n title: ReactNode\n}\n\nexport type StateGuardProps = {\n children: ReactNode\n} & (\n | { state: 'data'; surface?: Omit<StateSurfaceProps, 'kind'> }\n | {\n state: 'loading'\n surface: Pick<StateSurfaceProps, 'className' | 'title'> & {\n description?: ReactNode\n }\n }\n | { state: StateSurfaceKind; surface: Omit<StateSurfaceProps, 'kind'> }\n)\n",
|
|
51
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"dependencies": [
|
|
55
|
+
"@phosphor-icons/react@2.1.10",
|
|
56
|
+
"react@19.1.1"
|
|
57
|
+
],
|
|
58
|
+
"registryDependencies": [
|
|
59
|
+
"@ui/avatar",
|
|
60
|
+
"@ui/badge",
|
|
61
|
+
"@ui/button",
|
|
62
|
+
"@ui/empty",
|
|
63
|
+
"@ui/icon-frame",
|
|
64
|
+
"@ui/scroll-area",
|
|
65
|
+
"@ui/skeleton"
|
|
66
|
+
],
|
|
67
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
68
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "timeline-4",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/timeline/shared/timeline-item.tsx",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "import { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TimelineItemProps {\n children: ReactNode\n className?: string\n last?: boolean\n marker: ReactNode\n}\n\nexport function TimelineItem({\n children,\n className,\n last = false,\n marker,\n}: Readonly<TimelineItemProps>) {\n return (\n <li\n className={cn('flex gap-3', className)}\n data-last={last ? '' : undefined}\n data-slot=\"timeline-item\"\n >\n <div\n className=\"flex shrink-0 flex-col items-center\"\n data-slot=\"timeline-marker\"\n >\n {marker}\n {last ? null : (\n <span\n aria-hidden=\"true\"\n className=\"mt-1 w-px flex-1 bg-border\"\n data-slot=\"timeline-connector\"\n />\n )}\n </div>\n <div\n className={cn('min-w-0 flex-1', last ? '' : 'pb-6')}\n data-slot=\"timeline-content\"\n >\n {children}\n </div>\n </li>\n )\n}\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-item.tsx"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/timeline/shared/timeline-list.tsx",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\nexport interface TimelineListProps {\n children: ReactNode\n className?: string\n label: string\n}\n\nexport function TimelineList({\n children,\n className,\n label,\n}: Readonly<TimelineListProps>) {\n return (\n <ol\n aria-label={label}\n className={cn('m-0 list-none p-0', className)}\n data-slot=\"timeline-list\"\n >\n {children}\n </ol>\n )\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/timeline-list.tsx"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/timeline/shared/types.ts",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "export type TimelineTone =\n | 'error'\n | 'info'\n | 'outline'\n | 'secondary'\n | 'success'\n | 'warning'\n\nexport interface TimelineBadgeData {\n label: string\n tone?: TimelineTone\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/timeline/shared/types.ts"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/timeline/timeline-4/index.ts",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "export { Timeline4 } from './timeline-4'\nexport type {\n Timeline4Actor,\n Timeline4Entry,\n Timeline4Labels,\n Timeline4Props,\n} from './types'\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-4/index.ts"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/timeline/timeline-4/labels.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "import type { Timeline4Labels } from './types'\n\nexport const defaultTimeline4Labels: Timeline4Labels = {\n description: 'Histórico recente do registro.',\n emptyDescription: 'As atividades aparecem aqui quando houver movimentação.',\n emptyTitle: 'Nenhuma atividade',\n errorDescription: 'Tente novamente em instantes.',\n errorTitle: 'Não foi possível carregar as atividades',\n feed: 'Linha do tempo de atividades',\n loading: 'Carregando atividades',\n retry: 'Tentar novamente',\n title: 'Atividades',\n trigger: 'Ver atividades',\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-4/labels.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "blocks/application/timeline/timeline-4/timeline-4-skeleton.tsx",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "import { Skeleton } from '@tc96/ui/skeleton'\n\nexport function Timeline4Skeleton({ label }: Readonly<{ label: string }>) {\n return (\n <output aria-busy=\"true\" aria-label={label} className=\"grid gap-6\">\n {[0, 1, 2, 3].map((index) => (\n <div className=\"flex gap-3\" key={index}>\n <Skeleton className=\"size-8 shrink-0 rounded-full\" />\n <div className=\"grid flex-1 gap-2\">\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-24\" />\n </div>\n </div>\n ))}\n </output>\n )\n}\n",
|
|
39
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-4/timeline-4-skeleton.tsx"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "blocks/application/timeline/timeline-4/timeline-4.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { Avatar, AvatarFallback, AvatarImage } from '@tc96/ui/avatar'\nimport { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\nimport { getInitials } from '@tc96/ui/helpers/initials'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport {\n Sheet,\n SheetDescription,\n SheetHeader,\n SheetPanel,\n SheetPopup,\n SheetTitle,\n SheetTrigger,\n} from '@tc96/ui/sheet'\nimport type { ReactNode } from 'react'\nimport { TimelineItem } from '../shared/timeline-item'\nimport { TimelineList } from '../shared/timeline-list'\nimport { defaultTimeline4Labels } from './labels'\nimport { Timeline4Skeleton } from './timeline-4-skeleton'\nimport type { Timeline4Props } from './types'\n\nexport function Timeline4({\n className,\n entries,\n error = false,\n labels: labelsProp,\n onOpenChange,\n onRetry,\n open,\n pending = false,\n}: Readonly<Timeline4Props>) {\n const labels = { ...defaultTimeline4Labels, ...labelsProp }\n\n let body: ReactNode\n if (pending) {\n body = <Timeline4Skeleton label={labels.loading} />\n } else if (error) {\n body = (\n <StateSurface\n actions={\n onRetry ? (\n <Button onClick={onRetry} size=\"sm\" variant=\"outline\">\n {labels.retry}\n </Button>\n ) : undefined\n }\n description={labels.errorDescription}\n kind=\"error\"\n title={labels.errorTitle}\n />\n )\n } else if (entries.length === 0) {\n body = (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n )\n } else {\n body = (\n <TimelineList label={labels.feed}>\n {entries.map((entry, index) => (\n <TimelineItem\n key={entry.id}\n last={index === entries.length - 1}\n marker={\n <Avatar>\n {entry.actor.image ? (\n <AvatarImage alt={entry.actor.name} src={entry.actor.image} />\n ) : null}\n <AvatarFallback>{getInitials(entry.actor.name)}</AvatarFallback>\n </Avatar>\n }\n >\n <div className=\"grid gap-1\" data-entry={entry.id}>\n <span className=\"text-sm\">{entry.title}</span>\n <span className=\"text-muted-foreground text-xs\">\n {entry.time}\n </span>\n {entry.badge ? (\n <Badge\n className=\"mt-1 w-fit\"\n variant={entry.badge.tone ?? 'secondary'}\n >\n {entry.badge.label}\n </Badge>\n ) : null}\n </div>\n </TimelineItem>\n ))}\n </TimelineList>\n )\n }\n\n return (\n <Sheet onOpenChange={onOpenChange} open={open}>\n <SheetTrigger render={<Button className={className} size=\"sm\" />}>\n {labels.trigger}\n </SheetTrigger>\n <SheetPopup side=\"right\">\n <SheetHeader>\n <SheetTitle>{labels.title}</SheetTitle>\n <SheetDescription>{labels.description}</SheetDescription>\n </SheetHeader>\n <SheetPanel>{body}</SheetPanel>\n </SheetPopup>\n </Sheet>\n )\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-4/timeline-4.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/timeline/timeline-4/types.ts",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import type { TimelineBadgeData } from '../shared/types'\n\nexport interface Timeline4Actor {\n image?: string\n name: string\n}\n\nexport interface Timeline4Entry {\n actor: Timeline4Actor\n badge?: TimelineBadgeData\n id: string\n time: string\n title: string\n}\n\nexport interface Timeline4Labels {\n description: string\n emptyDescription: string\n emptyTitle: string\n errorDescription: string\n errorTitle: string\n feed: string\n loading: string\n retry: string\n title: string\n trigger: string\n}\n\nexport interface Timeline4Props {\n className?: string\n entries: Timeline4Entry[]\n error?: boolean\n labels?: Partial<Timeline4Labels>\n onOpenChange: (open: boolean) => void\n onRetry?: () => void\n open: boolean\n pending?: boolean\n}\n",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/timeline/timeline-4/types.ts"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "helpers/initials.ts",
|
|
55
|
+
"type": "registry:file",
|
|
56
|
+
"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",
|
|
57
|
+
"target": "~/packages/ui/src/helpers/initials.ts"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
61
|
+
"type": "registry:file",
|
|
62
|
+
"content": "import {\n FileMagnifyingGlassIcon,\n LockIcon,\n MagnifyingGlassIcon,\n TrayIcon,\n WarningIcon,\n} from '@phosphor-icons/react'\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 { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport {\n STATE_SURFACE_ICON_COLORS,\n STATE_SURFACE_ROLES,\n type StateSurfaceKind,\n type StateSurfaceProps,\n} from '../../core'\n\nconst KIND_ICONS = {\n empty: TrayIcon,\n error: WarningIcon,\n 'no-result': MagnifyingGlassIcon,\n 'not-found': FileMagnifyingGlassIcon,\n permission: LockIcon,\n} as const satisfies Record<StateSurfaceKind, typeof TrayIcon>\n\nexport function StateSurface({\n actions,\n className,\n description,\n icon,\n kind,\n title,\n}: StateSurfaceProps): ReactNode {\n const Icon = KIND_ICONS[kind]\n const iconColor = STATE_SURFACE_ICON_COLORS[kind]\n\n return (\n <Empty\n className={className}\n data-kind={kind}\n role={STATE_SURFACE_ROLES[kind]}\n >\n <EmptyHeader>\n {icon === null ? null : (\n <EmptyMedia>\n <IconFrame\n className={cn(!iconColor && 'bg-muted/60')}\n color={iconColor}\n shape=\"rounded\"\n size=\"xl\"\n >\n {icon === undefined ? <Icon aria-hidden=\"true\" /> : icon}\n </IconFrame>\n </EmptyMedia>\n )}\n <EmptyTitle>{title}</EmptyTitle>\n <EmptyDescription>{description}</EmptyDescription>\n </EmptyHeader>\n {actions ? (\n <EmptyContent className=\"flex-row flex-wrap justify-center gap-2\">\n {actions}\n </EmptyContent>\n ) : null}\n </Empty>\n )\n}\n",
|
|
63
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
67
|
+
"type": "registry:file",
|
|
68
|
+
"content": "import type { ReactNode } from 'react'\n\nexport const STATE_SURFACE_KINDS = [\n 'empty',\n 'no-result',\n 'error',\n 'permission',\n 'not-found',\n] as const\n\nexport type StateSurfaceKind = (typeof STATE_SURFACE_KINDS)[number]\n\nexport type StateGuardState = 'data' | 'loading' | StateSurfaceKind\n\nexport type StateSurfaceRole = 'alert' | 'status'\n\nexport const STATE_SURFACE_ROLES = {\n empty: 'status',\n error: 'alert',\n 'no-result': 'status',\n 'not-found': 'status',\n permission: 'alert',\n} as const satisfies Record<StateSurfaceKind, StateSurfaceRole>\n\nexport const STATE_SURFACE_ICON_COLORS: Partial<\n Record<StateSurfaceKind, string>\n> = {\n error: 'var(--destructive)',\n permission: 'var(--destructive)',\n}\n\nexport interface StateSurfaceProps {\n actions?: ReactNode\n className?: string\n description: ReactNode\n icon?: ReactNode\n kind: StateSurfaceKind\n title: ReactNode\n}\n\nexport type StateGuardProps = {\n children: ReactNode\n} & (\n | { state: 'data'; surface?: Omit<StateSurfaceProps, 'kind'> }\n | {\n state: 'loading'\n surface: Pick<StateSurfaceProps, 'className' | 'title'> & {\n description?: ReactNode\n }\n }\n | { state: StateSurfaceKind; surface: Omit<StateSurfaceProps, 'kind'> }\n)\n",
|
|
69
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"dependencies": [
|
|
73
|
+
"@phosphor-icons/react@2.1.10",
|
|
74
|
+
"react@19.1.1"
|
|
75
|
+
],
|
|
76
|
+
"registryDependencies": [
|
|
77
|
+
"@ui/avatar",
|
|
78
|
+
"@ui/badge",
|
|
79
|
+
"@ui/button",
|
|
80
|
+
"@ui/empty",
|
|
81
|
+
"@ui/icon-frame",
|
|
82
|
+
"@ui/sheet",
|
|
83
|
+
"@ui/skeleton"
|
|
84
|
+
],
|
|
85
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
86
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "accordion",
|
|
3
|
+
"type": "registry:ui",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "registry/default/ui/accordion.tsx",
|
|
7
|
+
"content": "\"use client\";\n\nimport { Accordion as AccordionPrimitive } from \"@base-ui/react/accordion\";\nimport { CaretDownIcon } from \"@phosphor-icons/react\";\nimport type React from \"react\";\nimport { cn } from \"@tc96/utils\";\n\nexport function Accordion(\n props: AccordionPrimitive.Root.Props,\n): React.ReactElement {\n return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} />;\n}\n\nexport function AccordionItem({\n className,\n ...props\n}: AccordionPrimitive.Item.Props): React.ReactElement {\n return (\n <AccordionPrimitive.Item\n className={cn(\"border-b last:border-b-0\", className)}\n data-slot=\"accordion-item\"\n {...props}\n />\n );\n}\n\nexport function AccordionTrigger({\n className,\n children,\n ...props\n}: AccordionPrimitive.Trigger.Props): React.ReactElement {\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n className={cn(\n \"flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left font-medium text-sm outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 data-panel-open:*:data-[slot=accordion-indicator]:rotate-180\",\n className,\n )}\n data-slot=\"accordion-trigger\"\n {...props}\n >\n {children}\n <CaretDownIcon aria-hidden=\"true\"\n className=\"pointer-events-none size-4 shrink-0 translate-y-0.5 opacity-80 transition-transform duration-200 ease-in-out\"\n data-slot=\"accordion-indicator\"\n />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n}\n\nexport function AccordionPanel({\n className,\n children,\n ...props\n}: AccordionPrimitive.Panel.Props): React.ReactElement {\n return (\n <AccordionPrimitive.Panel\n className=\"h-(--accordion-panel-height) overflow-hidden text-muted-foreground text-sm transition-[height] duration-200 ease-in-out data-ending-style:h-0 data-starting-style:h-0\"\n data-slot=\"accordion-panel\"\n {...props}\n >\n <div className={cn(\"pt-0 pb-4\", className)}>{children}</div>\n </AccordionPrimitive.Panel>\n );\n}\n\nexport { AccordionPrimitive, AccordionPanel as AccordionContent };\n"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"dependencies": [
|
|
11
|
+
"@base-ui/react@1.8.0",
|
|
12
|
+
"@phosphor-icons/react@2.1.10"
|
|
13
|
+
],
|
|
14
|
+
"registryDependencies": []
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alert-dialog",
|
|
3
|
+
"type": "registry:ui",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "registry/default/ui/alert-dialog.tsx",
|
|
7
|
+
"content": "\"use client\";\n\nimport { AlertDialog as AlertDialogPrimitive } from \"@base-ui/react/alert-dialog\";\nimport type React from \"react\";\nimport { cn } from \"@tc96/utils\";\n\nexport const AlertDialogCreateHandle: typeof AlertDialogPrimitive.createHandle =\n AlertDialogPrimitive.createHandle;\n\nexport const AlertDialog: typeof AlertDialogPrimitive.Root =\n AlertDialogPrimitive.Root;\n\nexport const AlertDialogPortal: typeof AlertDialogPrimitive.Portal =\n AlertDialogPrimitive.Portal;\n\nexport function AlertDialogTrigger(\n props: AlertDialogPrimitive.Trigger.Props,\n): React.ReactElement {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n );\n}\n\nexport function AlertDialogBackdrop({\n className,\n ...props\n}: AlertDialogPrimitive.Backdrop.Props): React.ReactElement {\n return (\n <AlertDialogPrimitive.Backdrop\n className={cn(\n \"fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-[-webkit-touch-callout:none]:absolute\",\n className,\n )}\n data-slot=\"alert-dialog-backdrop\"\n {...props}\n />\n );\n}\n\nexport function AlertDialogViewport({\n className,\n ...props\n}: AlertDialogPrimitive.Viewport.Props): React.ReactElement {\n return (\n <AlertDialogPrimitive.Viewport\n className={cn(\n \"fixed inset-0 z-50 grid grid-rows-[1fr_auto_3fr] justify-items-center p-4\",\n className,\n )}\n data-slot=\"alert-dialog-viewport\"\n {...props}\n />\n );\n}\n\nexport function AlertDialogPopup({\n className,\n bottomStickOnMobile = true,\n portalProps,\n ...props\n}: AlertDialogPrimitive.Popup.Props & {\n bottomStickOnMobile?: boolean;\n portalProps?: AlertDialogPrimitive.Portal.Props;\n}): React.ReactElement {\n return (\n <AlertDialogPortal {...portalProps}>\n <AlertDialogBackdrop />\n <AlertDialogViewport\n className={cn(\n bottomStickOnMobile &&\n \"max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12\",\n )}\n >\n <AlertDialogPrimitive.Popup\n className={cn(\n \"relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg origin-center flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 sm:scale-[calc(1-0.1*var(--nested-dialogs))] sm:data-ending-style:scale-98 sm:data-starting-style:scale-98 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n bottomStickOnMobile &&\n \"max-sm:max-w-none max-sm:origin-bottom max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none\",\n className,\n )}\n data-slot=\"alert-dialog-popup\"\n {...props}\n />\n </AlertDialogViewport>\n </AlertDialogPortal>\n );\n}\n\nexport function AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left\",\n className,\n )}\n data-slot=\"alert-dialog-header\"\n {...props}\n />\n );\n}\n\nexport function AlertDialogFooter({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & {\n variant?: \"default\" | \"bare\";\n}): React.ReactElement {\n return (\n <div\n className={cn(\n \"flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]\",\n variant === \"default\" && \"border-t bg-muted/72 py-4\",\n variant === \"bare\" && \"pb-6\",\n className,\n )}\n data-slot=\"alert-dialog-footer\"\n {...props}\n />\n );\n}\n\nexport function AlertDialogTitle({\n className,\n ...props\n}: AlertDialogPrimitive.Title.Props): React.ReactElement {\n return (\n <AlertDialogPrimitive.Title\n className={cn(\"font-bold font-heading text-xl leading-none\", className)}\n data-slot=\"alert-dialog-title\"\n {...props}\n />\n );\n}\n\nexport function AlertDialogDescription({\n className,\n ...props\n}: AlertDialogPrimitive.Description.Props): React.ReactElement {\n return (\n <AlertDialogPrimitive.Description\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"alert-dialog-description\"\n {...props}\n />\n );\n}\n\nexport function AlertDialogClose(\n props: AlertDialogPrimitive.Close.Props,\n): React.ReactElement {\n return (\n <AlertDialogPrimitive.Close data-slot=\"alert-dialog-close\" {...props} />\n );\n}\n\nexport {\n AlertDialogPrimitive,\n AlertDialogBackdrop as AlertDialogOverlay,\n AlertDialogPopup as AlertDialogContent,\n};\n"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"dependencies": [
|
|
11
|
+
"@base-ui/react@1.8.0"
|
|
12
|
+
],
|
|
13
|
+
"registryDependencies": []
|
|
14
|
+
}
|