@tc96/cli 0.0.0-stage → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +213 -2
- package/cli.js +1395 -0
- package/package.json +35 -4
- package/registry/agent-builder.json +503 -0
- package/registry/aggregate.json +4 -0
- package/registry/app-shell-1.json +81 -0
- package/registry/app-shell-2.json +89 -0
- package/registry/app-shell-3.json +109 -0
- package/registry/app-shell-4.json +104 -0
- package/registry/app-shell-5.json +106 -0
- package/registry/bulk-import-1.json +151 -0
- package/registry/card-1.json +104 -0
- package/registry/card-2.json +97 -0
- package/registry/card-3.json +104 -0
- package/registry/card-4.json +98 -0
- package/registry/card-5.json +85 -0
- package/registry/card-6.json +98 -0
- package/registry/card-7.json +104 -0
- package/registry/card-8.json +106 -0
- package/registry/card-9.json +92 -0
- package/registry/charts.json +30 -0
- package/registry/chat-assistant.json +110 -0
- package/registry/chats-panel.json +97 -0
- package/registry/checklist.json +307 -0
- package/registry/collection-layouts.json +836 -0
- package/registry/collection-views.json +836 -0
- package/registry/collection.json +831 -0
- package/registry/dashboard-1.json +160 -0
- package/registry/dashboard-2.json +153 -0
- package/registry/dashboard-3.json +154 -0
- package/registry/dashboard-4.json +168 -0
- package/registry/detail-sheet.json +54 -0
- package/registry/editable.json +36 -0
- package/registry/empty-state-1.json +40 -0
- package/registry/empty-state-2.json +39 -0
- package/registry/empty-state-3.json +61 -0
- package/registry/empty-state-4.json +39 -0
- package/registry/empty-state-5.json +47 -0
- package/registry/empty-state-6.json +40 -0
- package/registry/flow-canvas.json +198 -0
- package/registry/flow-inspector.json +151 -0
- package/registry/flow-step-library.json +112 -0
- package/registry/forgot-password-1.json +73 -0
- package/registry/forgot-password-2.json +73 -0
- package/registry/icon-row.json +52 -0
- package/registry/impact-map.json +75 -0
- package/registry/list-1.json +129 -0
- package/registry/list-2.json +117 -0
- package/registry/list-3.json +129 -0
- package/registry/list-4.json +105 -0
- package/registry/list-5.json +98 -0
- package/registry/list-6.json +92 -0
- package/registry/list.json +52 -0
- package/registry/login-1.json +89 -0
- package/registry/login-10.json +88 -0
- package/registry/login-2.json +81 -0
- package/registry/login-3.json +90 -0
- package/registry/login-4.json +81 -0
- package/registry/login-5.json +82 -0
- package/registry/login-6.json +88 -0
- package/registry/login-7.json +83 -0
- package/registry/login-8.json +81 -0
- package/registry/login-9.json +88 -0
- package/registry/lookup-create-1.json +157 -0
- package/registry/magic-link-6.json +79 -0
- package/registry/navbar-1.json +66 -0
- package/registry/navbar-2.json +48 -0
- package/registry/navbar-3.json +50 -0
- package/registry/navbar-4.json +39 -0
- package/registry/navbar-5.json +50 -0
- package/registry/next-steps-1.json +147 -0
- package/registry/onboarding-1.json +114 -0
- package/registry/onboarding-2.json +78 -0
- package/registry/onboarding-3.json +71 -0
- package/registry/otp-1.json +73 -0
- package/registry/properties.json +523 -0
- package/registry/record-dialog.json +88 -0
- package/registry/record-group.json +190 -0
- package/registry/record-preview.json +70 -0
- package/registry/record-status-list.json +70 -0
- package/registry/reset-password-1.json +92 -0
- package/registry/reset-password-2.json +98 -0
- package/registry/reset-password-6.json +91 -0
- package/registry/rich-text-editor.json +93 -0
- package/registry/run-monitor.json +198 -0
- package/registry/settings-1.json +119 -0
- package/registry/settings-10.json +218 -0
- package/registry/settings-11.json +129 -0
- package/registry/settings-12.json +130 -0
- package/registry/settings-13.json +130 -0
- package/registry/settings-14.json +173 -0
- package/registry/settings-15.json +149 -0
- package/registry/settings-16.json +129 -0
- package/registry/settings-17.json +117 -0
- package/registry/settings-18.json +117 -0
- package/registry/settings-19.json +125 -0
- package/registry/settings-2.json +123 -0
- package/registry/settings-20.json +112 -0
- package/registry/settings-21.json +116 -0
- package/registry/settings-22.json +118 -0
- package/registry/settings-23.json +118 -0
- package/registry/settings-3.json +123 -0
- package/registry/settings-4.json +116 -0
- package/registry/settings-5.json +119 -0
- package/registry/settings-6.json +125 -0
- package/registry/settings-7.json +128 -0
- package/registry/settings-8.json +116 -0
- package/registry/settings-9.json +118 -0
- package/registry/settings-shell.json +60 -0
- package/registry/settings.json +82 -0
- package/registry/signup-1.json +100 -0
- package/registry/signup-2.json +93 -0
- package/registry/signup-3.json +83 -0
- package/registry/signup-6.json +99 -0
- package/registry/state-surface.json +58 -0
- package/registry/stats-1.json +116 -0
- package/registry/stats-2.json +115 -0
- package/registry/stats-3.json +97 -0
- package/registry/stats-4.json +92 -0
- package/registry/stats-5.json +103 -0
- package/registry/stats-6.json +105 -0
- package/registry/stats-7.json +103 -0
- package/registry/stats.json +64 -0
- package/registry/timeline-1.json +97 -0
- package/registry/timeline-2.json +102 -0
- package/registry/timeline-3.json +68 -0
- package/registry/timeline-4.json +86 -0
- package/registry/ui/accordion.json +15 -0
- package/registry/ui/alert-dialog.json +14 -0
- package/registry/ui/alert.json +50 -0
- package/registry/ui/autocomplete.json +18 -0
- package/registry/ui/avatar.json +14 -0
- package/registry/ui/badge.json +51 -0
- package/registry/ui/breadcrumb.json +15 -0
- package/registry/ui/button.json +25 -0
- package/registry/ui/calendar.json +15 -0
- package/registry/ui/card.json +14 -0
- package/registry/ui/chat.json +115 -0
- package/registry/ui/checkbox-group.json +14 -0
- package/registry/ui/checkbox.json +14 -0
- package/registry/ui/collapsible.json +14 -0
- package/registry/ui/combobox.json +18 -0
- package/registry/ui/command.json +17 -0
- package/registry/ui/composer-clipboard.json +14 -0
- package/registry/ui/composer-document.json +14 -0
- package/registry/ui/composer-editor.json +16 -0
- package/registry/ui/composer-query.json +12 -0
- package/registry/ui/composer.json +17 -0
- package/registry/ui/context-menu.json +23 -0
- package/registry/ui/dialog.json +18 -0
- package/registry/ui/drawer.json +18 -0
- package/registry/ui/empty.json +14 -0
- package/registry/ui/field.json +22 -0
- package/registry/ui/fieldset.json +14 -0
- package/registry/ui/form.json +14 -0
- package/registry/ui/frame.json +12 -0
- package/registry/ui/gauge.json +31 -0
- package/registry/ui/group.json +17 -0
- package/registry/ui/icon-frame.json +31 -0
- package/registry/ui/input-group.json +17 -0
- package/registry/ui/input.json +14 -0
- package/registry/ui/kbd.json +12 -0
- package/registry/ui/label.json +14 -0
- package/registry/ui/menu.json +39 -0
- package/registry/ui/meter.json +14 -0
- package/registry/ui/number-field.json +17 -0
- package/registry/ui/otp-field.json +31 -0
- package/registry/ui/pagination.json +17 -0
- package/registry/ui/popover.json +14 -0
- package/registry/ui/preview-card.json +14 -0
- package/registry/ui/progress.json +14 -0
- package/registry/ui/radio-group.json +14 -0
- package/registry/ui/render-anchor.json +12 -0
- package/registry/ui/scroll-area.json +14 -0
- package/registry/ui/segmented-control.json +14 -0
- package/registry/ui/select.json +16 -0
- package/registry/ui/separator.json +14 -0
- package/registry/ui/sheet.json +18 -0
- package/registry/ui/sidebar.json +25 -0
- package/registry/ui/skeleton.json +24 -0
- package/registry/ui/slider.json +14 -0
- package/registry/ui/spinner.json +14 -0
- package/registry/ui/switch.json +14 -0
- package/registry/ui/table.json +14 -0
- package/registry/ui/tabs.json +16 -0
- package/registry/ui/text.json +31 -0
- package/registry/ui/textarea.json +14 -0
- package/registry/ui/toast.json +89 -0
- package/registry/ui/toggle-group.json +18 -0
- package/registry/ui/toggle.json +15 -0
- package/registry/ui/toolbar.json +14 -0
- package/registry/ui/tooltip.json +14 -0
- package/registry/ui/use-composer-editor.json +17 -0
- package/registry/ui/use-copy-to-clipboard.json +12 -0
- package/registry/ui/use-media-query.json +12 -0
- package/registry/view.json +831 -0
- package/registry/widgets.json +319 -0
- package/registry/wizard.json +89 -0
- package/registry/workflow-editor.json +460 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "settings-3",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/settings/settings-3/index.ts",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "export { Settings3 } from './settings-3'\nexport type {\n Settings3Labels,\n Settings3Options,\n Settings3Props,\n Settings3SettingOption,\n Settings3Values,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-3/index.ts"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/settings/settings-3/labels.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../shared/labels'\nimport type { Settings3Labels } from './types'\n\nexport const defaultSettings3Labels: Settings3Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar as configurações',\n loading: 'Carregando configurações',\n emailNotifications: 'Notificações por e-mail',\n emailNotificationsDescription: 'Envia um resumo da atividade do dia',\n fontSize: 'Tamanho da fonte',\n fontSizeDescription: 'Ajusta o tamanho do texto em todo o app',\n language: 'Idioma',\n languageDescription: 'O idioma dos menus e das mensagens',\n title: 'Interface e tema',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-3/labels.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/settings/settings-3/settings-3-skeleton.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../shared/settings-skeleton'\n\nexport function Settings3Skeleton() {\n return <SettingsRowsSkeleton count={3} start=\"icon\" end=\"select\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-3/settings-3-skeleton.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/settings/settings-3/settings-3.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { BellIcon, TextTIcon, TranslateIcon } from '@phosphor-icons/react'\nimport { SettingsRow } from '@tc96/ui/patterns/surfaces/settings/composition/settings-row/settings-row'\nimport { SettingsSection } from '@tc96/ui/patterns/surfaces/settings/composition/settings-section/settings-section'\nimport {\n SettingsSectionHeader,\n SettingsSectionTitle,\n} from '@tc96/ui/patterns/surfaces/settings/composition/settings-section/settings-section-header'\nimport { Switch } from '@tc96/ui/switch'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '../shared/settings-load-state'\nimport { SettingsSelect } from '../shared/settings-select'\nimport { defaultSettings3Labels } from './labels'\nimport { Settings3Skeleton } from './settings-3-skeleton'\nimport type { Settings3Props } from './types'\n\nexport function Settings3({\n error,\n onRetry,\n pending,\n className,\n labels: labelsProp,\n onValueChange,\n options,\n values,\n}: Readonly<Settings3Props>) {\n const labels = { ...defaultSettings3Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <Settings3Skeleton />,\n })\n\n return (\n <SettingsSection\n className={cn('mx-auto w-full max-w-2xl', className)}\n header={\n <SettingsSectionHeader>\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <>\n <SettingsRow\n description={labels.fontSizeDescription}\n endSlot={\n <SettingsSelect\n ariaLabel={labels.fontSize}\n items={options.fontSize}\n onValueChange={(next) => onValueChange?.('fontSize', next)}\n value={values.fontSize}\n />\n }\n startSlot={<TextTIcon aria-hidden=\"true\" />}\n title={labels.fontSize}\n />\n <SettingsRow\n description={labels.languageDescription}\n endSlot={\n <SettingsSelect\n ariaLabel={labels.language}\n items={options.language}\n onValueChange={(next) => onValueChange?.('language', next)}\n value={values.language}\n />\n }\n startSlot={<TranslateIcon aria-hidden=\"true\" />}\n title={labels.language}\n />\n <SettingsRow\n description={labels.emailNotificationsDescription}\n endSlot={\n <Switch\n aria-label={labels.emailNotifications}\n checked={values.emailNotifications}\n onCheckedChange={(next) =>\n onValueChange?.('emailNotifications', next)\n }\n />\n }\n startSlot={<BellIcon aria-hidden=\"true\" />}\n title={labels.emailNotifications}\n />\n </>\n )}\n </SettingsSection>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-3/settings-3.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/settings/settings-3/types.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '../shared/types'\nexport interface Settings3SettingOption {\n label: string\n value: string\n}\n\nexport interface Settings3Values {\n emailNotifications: boolean\n fontSize: string\n language: string\n}\n\nexport interface Settings3Options {\n fontSize: Settings3SettingOption[]\n language: Settings3SettingOption[]\n}\n\nexport interface Settings3Labels extends SettingsLoadLabels {\n emailNotifications: string\n emailNotificationsDescription: string\n fontSize: string\n fontSizeDescription: string\n language: string\n languageDescription: string\n title: string\n}\n\nexport interface Settings3Props extends SettingsLoadProps {\n className?: string\n labels?: Partial<Settings3Labels>\n onValueChange?: <K extends keyof Settings3Values>(\n key: K,\n value: Settings3Values[K],\n ) => void\n options: Settings3Options\n values: Settings3Values\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-3/types.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "blocks/application/settings/shared/labels.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "import type { SettingsLoadLabels } from './types'\n\nexport const defaultSettingsLoadLabels: Pick<\n SettingsLoadLabels,\n 'errorDescription' | 'retry'\n> = {\n errorDescription: 'Verifique sua conexão e tente novamente.',\n retry: 'Tentar novamente',\n}\n",
|
|
39
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/labels.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "blocks/application/settings/shared/settings-load-state.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport type { ReactNode } from 'react'\nimport { SettingsSkeleton } from './settings-skeleton'\nimport type { SettingsLoadLabels, SettingsLoadProps } from './types'\n\nexport interface SettingsLoadStateOptions extends SettingsLoadProps {\n labels: SettingsLoadLabels\n skeleton: ReactNode\n}\n\nexport function settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton,\n}: Readonly<SettingsLoadStateOptions>): ReactNode {\n if (pending)\n return (\n <SettingsSkeleton label={labels.loading}>{skeleton}</SettingsSkeleton>\n )\n if (error)\n return (\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 return null\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-load-state.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/settings/shared/settings-select.tsx",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import {\n Select,\n SelectItem,\n SelectPopup,\n SelectTrigger,\n SelectValue,\n} from '@tc96/ui/select'\nimport type { SettingsOption } from './types'\n\ninterface SettingsSelectProps {\n ariaLabel: string\n items: SettingsOption[]\n onValueChange?: (value: string) => void\n value: string\n}\n\nexport function SettingsSelect({\n ariaLabel,\n items,\n onValueChange,\n value,\n}: Readonly<SettingsSelectProps>) {\n return (\n <Select\n items={items}\n onValueChange={(next) => {\n if (next) onValueChange?.(next)\n }}\n value={value}\n >\n <SelectTrigger aria-label={ariaLabel} className=\"w-44\">\n <SelectValue />\n </SelectTrigger>\n <SelectPopup>\n {items.map((item) => (\n <SelectItem key={item.value} value={item.value}>\n {item.label}\n </SelectItem>\n ))}\n </SelectPopup>\n </Select>\n )\n}\n",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-select.tsx"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "blocks/application/settings/shared/settings-skeleton.tsx",
|
|
55
|
+
"type": "registry:file",
|
|
56
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { Skeleton } from '@tc96/ui/skeleton'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\ntype RowStart = 'avatar' | 'icon' | 'none'\ntype RowEnd = 'button' | 'menu' | 'none' | 'select' | 'switch'\n\nconst placeholderIds = (prefix: string, length: number) =>\n Array.from({ length }, (_, index) => `${prefix}-${index}`)\n\nconst titleWidths = ['w-40', 'w-32', 'w-48', 'w-36', 'w-44']\nconst descriptionWidths = ['w-64', 'w-56', 'w-72', 'w-60', 'w-52']\n\nexport function SettingsSkeleton({\n children,\n className,\n label,\n}: Readonly<{ children: ReactNode; className?: string; label: string }>) {\n return (\n <output\n aria-busy=\"true\"\n aria-label={label}\n className={cn('flex flex-col divide-y', className)}\n data-slot=\"settings-skeleton\"\n >\n {children}\n </output>\n )\n}\n\nexport function SettingsSectionSkeleton({\n action = false,\n children,\n description = false,\n}: Readonly<{ action?: boolean; children: ReactNode; description?: boolean }>) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-end justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n <Skeleton className=\"h-5 w-32\" />\n {description ? <Skeleton className=\"h-4 w-72 max-w-full\" /> : null}\n </div>\n {action ? <Skeleton className=\"h-8 w-24 shrink-0\" /> : null}\n </div>\n <Card>\n <div className=\"flex flex-col divide-y px-6\">{children}</div>\n </Card>\n </div>\n )\n}\n\nfunction RowEndSkeleton({ end }: Readonly<{ end: RowEnd }>) {\n if (end === 'switch')\n return <Skeleton className=\"h-5 w-9 shrink-0 rounded-full\" />\n if (end === 'select') return <Skeleton className=\"h-8 w-36 shrink-0\" />\n if (end === 'button') return <Skeleton className=\"h-8 w-24 shrink-0\" />\n if (end === 'menu') return <Skeleton className=\"size-8 shrink-0\" />\n return null\n}\n\nexport function SettingsRowsSkeleton({\n count,\n description = true,\n end = 'none',\n start = 'none',\n}: Readonly<{\n count: number\n description?: boolean\n end?: RowEnd\n start?: RowStart\n}>) {\n return placeholderIds('row', count).map((id, index) => (\n <div className=\"flex items-center gap-3 py-3\" key={id}>\n {start === 'avatar' ? (\n <Skeleton className=\"size-10 shrink-0 rounded-full\" />\n ) : null}\n {start === 'icon' ? <Skeleton className=\"size-4 shrink-0\" /> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">\n <Skeleton className={cn('h-4 max-w-full', titleWidths[index % 5])} />\n {description ? (\n <Skeleton\n className={cn('h-3.5 max-w-full', descriptionWidths[index % 5])}\n />\n ) : null}\n </div>\n <RowEndSkeleton end={end} />\n </div>\n ))\n}\n\nexport function SettingsCollapsedSkeleton({\n children,\n}: Readonly<{ children: ReactNode }>) {\n return (\n <div className=\"my-1 flex flex-col first:mt-4 last:mb-4\">\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n <div className=\"flex flex-col px-4\">{children}</div>\n </div>\n )\n}\n\nexport function SettingsTableSkeleton({\n columns,\n rows,\n}: Readonly<{ columns: number; rows: number }>) {\n return (\n <div className=\"flex flex-col divide-y py-2\">\n {placeholderIds('row', rows + 1).map((rowId, row) => (\n <div\n className=\"grid gap-4 py-3\"\n key={rowId}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {placeholderIds('cell', columns).map((cellId) => (\n <Skeleton\n className={row === 0 ? 'h-3.5 w-16' : 'h-4 w-full'}\n key={cellId}\n />\n ))}\n </div>\n ))}\n </div>\n )\n}\n",
|
|
57
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-skeleton.tsx"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "blocks/application/settings/shared/types.ts",
|
|
61
|
+
"type": "registry:file",
|
|
62
|
+
"content": "export interface SettingsRowAction {\n destructive?: boolean\n id: string\n label: string\n}\n\nexport interface SettingsOption {\n label: string\n value: string\n}\n\nexport interface SettingsLoadLabels {\n errorDescription: string\n errorTitle: string\n loading: string\n retry: string\n}\n\nexport interface SettingsLoadProps {\n error?: boolean\n onRetry?: () => void\n pending?: boolean\n}\n",
|
|
63
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "patterns/surfaces/settings/composition/settings-row/settings-row.tsx",
|
|
67
|
+
"type": "registry:file",
|
|
68
|
+
"content": "import { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type { SettingsRowProps } from '../../core'\n\nexport function SettingsRow({\n className,\n description,\n endSlot,\n startSlot,\n title,\n}: Readonly<SettingsRowProps>): ReactElement {\n return (\n <div\n className={cn('flex items-center gap-3 py-3', className)}\n data-slot=\"settings-row\"\n >\n {startSlot ? (\n <div\n className=\"flex shrink-0 items-center [&>svg]:size-4\"\n data-slot=\"settings-row-start\"\n >\n {startSlot}\n </div>\n ) : null}\n <div className=\"min-w-0 flex-1\" data-slot=\"settings-row-heading\">\n <Text\n render={<p data-slot=\"settings-row-title\">{title}</p>}\n size=\"sm\"\n weight=\"semibold\"\n />\n {description ? (\n <Text\n foreground=\"muted\"\n render={<p data-slot=\"settings-row-description\">{description}</p>}\n size=\"sm\"\n />\n ) : null}\n </div>\n {endSlot ? (\n <div\n className=\"ms-3 flex shrink-0 items-center gap-2\"\n data-slot=\"settings-row-end\"\n >\n {endSlot}\n </div>\n ) : null}\n </div>\n )\n}\n",
|
|
69
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-row/settings-row.tsx"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section-context.ts",
|
|
73
|
+
"type": "registry:file",
|
|
74
|
+
"content": "import { createContext, useContext } from 'react'\n\nexport const SettingsSectionTitleIdContext = createContext<string | undefined>(\n undefined,\n)\n\nexport function useSettingsSectionTitleId(): string | undefined {\n return useContext(SettingsSectionTitleIdContext)\n}\n",
|
|
75
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section-context.ts"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section-header.tsx",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "import { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type {\n SettingsSectionDescriptionProps,\n SettingsSectionHeaderProps,\n SettingsSectionTitleProps,\n} from '../../core'\nimport { useSettingsSectionTitleId } from './settings-section-context'\n\nexport function SettingsSectionHeader({\n actions,\n children,\n className,\n}: Readonly<SettingsSectionHeaderProps>): ReactElement {\n return (\n <div\n className={cn('flex items-end justify-between gap-3', className)}\n data-slot=\"settings-section-header\"\n >\n <div className=\"flex min-w-0 flex-col gap-1\">{children}</div>\n {actions ? (\n <div className=\"shrink-0\" data-slot=\"settings-section-actions\">\n {actions}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport function SettingsSectionTitle({\n children,\n className,\n}: Readonly<SettingsSectionTitleProps>): ReactElement {\n const id = useSettingsSectionTitleId()\n\n return (\n <Text\n className={className}\n render={\n <h2 data-slot=\"settings-section-title\" id={id}>\n {children}\n </h2>\n }\n size=\"base\"\n weight=\"medium\"\n />\n )\n}\n\nexport function SettingsSectionDescription({\n children,\n className,\n}: Readonly<SettingsSectionDescriptionProps>): ReactElement {\n return (\n <Text\n className={className}\n foreground=\"muted\"\n render={<p data-slot=\"settings-section-description\">{children}</p>}\n size=\"sm\"\n />\n )\n}\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section-header.tsx"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section.tsx",
|
|
85
|
+
"type": "registry:file",
|
|
86
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useId } from 'react'\nimport type { SettingsSectionProps } from '../../core'\nimport { SettingsSectionTitleIdContext } from './settings-section-context'\n\nexport function SettingsSection({\n children,\n className,\n header,\n}: Readonly<SettingsSectionProps>): ReactElement {\n const titleId = `settings-section-title-${useId()}`\n const card = (\n <Card>\n <div\n className=\"divide-y px-6 has-[[data-slot=record-group]]:px-4 has-[[data-slot=settings-collapsed]]:px-4\"\n data-slot=\"settings-section-rows\"\n >\n {children}\n </div>\n </Card>\n )\n\n if (!header) {\n return (\n <div className={className} data-slot=\"settings-section\">\n {card}\n </div>\n )\n }\n\n return (\n <section\n aria-labelledby={titleId}\n className={cn('flex flex-col gap-3', className)}\n data-slot=\"settings-section\"\n >\n <SettingsSectionTitleIdContext.Provider value={titleId}>\n {header}\n </SettingsSectionTitleIdContext.Provider>\n {card}\n </section>\n )\n}\n",
|
|
87
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section.tsx"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "patterns/surfaces/settings/core.ts",
|
|
91
|
+
"type": "registry:file",
|
|
92
|
+
"content": "import type { ReactNode } from 'react'\n\nexport interface SettingsSectionProps {\n children?: ReactNode\n className?: string\n header?: ReactNode\n}\n\nexport interface SettingsSectionHeaderProps {\n actions?: ReactNode\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsSectionTitleProps {\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsSectionDescriptionProps {\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsRowProps {\n className?: string\n description?: ReactNode\n endSlot?: ReactNode\n startSlot?: ReactNode\n title: ReactNode\n}\n\nexport interface SettingsCollapsedProps {\n actions?: ReactNode\n children?: ReactNode\n className?: string\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n open?: boolean\n title: ReactNode\n}\n",
|
|
93
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/core.ts"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
97
|
+
"type": "registry:file",
|
|
98
|
+
"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",
|
|
99
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
103
|
+
"type": "registry:file",
|
|
104
|
+
"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",
|
|
105
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"dependencies": [
|
|
109
|
+
"@phosphor-icons/react@2.1.10",
|
|
110
|
+
"react@19.1.1"
|
|
111
|
+
],
|
|
112
|
+
"registryDependencies": [
|
|
113
|
+
"@ui/button",
|
|
114
|
+
"@ui/card",
|
|
115
|
+
"@ui/empty",
|
|
116
|
+
"@ui/icon-frame",
|
|
117
|
+
"@ui/select",
|
|
118
|
+
"@ui/skeleton",
|
|
119
|
+
"@ui/switch",
|
|
120
|
+
"@ui/text"
|
|
121
|
+
],
|
|
122
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
123
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "settings-4",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/settings/settings-4/index.ts",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "export { Settings4 } from './settings-4'\nexport type {\n Settings4Labels,\n Settings4Option,\n Settings4Props,\n Settings4ThemeGroup,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-4/index.ts"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/settings/settings-4/labels.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../shared/labels'\nimport type { Settings4Labels } from './types'\n\nexport const defaultSettings4Labels: Settings4Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar a aparência',\n loading: 'Carregando aparência',\n mode: 'Modo',\n modeDescription: 'Claro, escuro ou a configuração do seu sistema',\n theme: 'Tema',\n themeDescription: 'Cores, raio e fontes da interface',\n title: 'Aparência',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-4/labels.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/settings/settings-4/settings-4-skeleton.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../shared/settings-skeleton'\n\nexport function Settings4Skeleton() {\n return <SettingsRowsSkeleton count={2} start=\"icon\" end=\"select\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-4/settings-4-skeleton.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/settings/settings-4/settings-4.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { CircleHalfIcon, PaletteIcon } from '@phosphor-icons/react'\nimport { SettingsRow } from '@tc96/ui/patterns/surfaces/settings/composition/settings-row/settings-row'\nimport { SettingsSection } from '@tc96/ui/patterns/surfaces/settings/composition/settings-section/settings-section'\nimport {\n SettingsSectionHeader,\n SettingsSectionTitle,\n} from '@tc96/ui/patterns/surfaces/settings/composition/settings-section/settings-section-header'\nimport {\n Select,\n SelectGroup,\n SelectGroupLabel,\n SelectItem,\n SelectPopup,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport { Fragment } from 'react'\nimport { settingsLoadState } from '../shared/settings-load-state'\nimport { defaultSettings4Labels } from './labels'\nimport { Settings4Skeleton } from './settings-4-skeleton'\nimport type { Settings4Option, Settings4Props } from './types'\n\nfunction ThemeSwatch({ preset }: Readonly<{ preset: string }>) {\n return (\n <span\n aria-hidden=\"true\"\n className=\"flex h-4 w-7 shrink-0 overflow-hidden rounded-full border border-foreground/16 bg-background\"\n data-slot=\"theme-swatch\"\n data-theme-preset={preset}\n >\n <span className=\"flex-1\" />\n <span className=\"flex-1 bg-accent\" />\n <span className=\"flex-1 bg-primary\" data-slot=\"theme-swatch-primary\" />\n </span>\n )\n}\n\nfunction ThemeOption({ option }: Readonly<{ option: Settings4Option }>) {\n return (\n <SelectItem value={option.value}>\n <span className=\"flex items-center gap-2\">\n <ThemeSwatch preset={option.value} />\n {option.label}\n </span>\n </SelectItem>\n )\n}\n\nexport function Settings4({\n error,\n onRetry,\n pending,\n className,\n colorTheme,\n labels: labelsProp,\n mode,\n modeOptions,\n onColorThemeChange,\n onModeChange,\n themeGroups,\n}: Readonly<Settings4Props>) {\n const labels = { ...defaultSettings4Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <Settings4Skeleton />,\n })\n const themeOptions = themeGroups.flatMap((group) => group.options)\n const titleOf = (value: string) =>\n themeOptions.find((option) => option.value === value)?.label ?? value\n\n return (\n <SettingsSection\n className={cn('mx-auto w-full max-w-2xl', className)}\n header={\n <SettingsSectionHeader>\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <>\n <SettingsRow\n description={labels.modeDescription}\n endSlot={\n <Select\n items={modeOptions}\n onValueChange={(next) => {\n if (next) onModeChange?.(next)\n }}\n value={mode}\n >\n <SelectTrigger aria-label={labels.mode} className=\"w-52\">\n <SelectValue />\n </SelectTrigger>\n <SelectPopup>\n {modeOptions.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectPopup>\n </Select>\n }\n startSlot={<CircleHalfIcon aria-hidden=\"true\" />}\n title={labels.mode}\n />\n <SettingsRow\n description={labels.themeDescription}\n endSlot={\n <Select\n items={themeOptions}\n onValueChange={(next) => {\n if (next) onColorThemeChange?.(next)\n }}\n value={colorTheme}\n >\n <SelectTrigger aria-label={labels.theme} className=\"w-52\">\n <SelectValue>\n {(current: string) => (\n <span className=\"flex min-w-0 items-center gap-2\">\n <ThemeSwatch preset={current} />\n <span className=\"truncate\">{titleOf(current)}</span>\n </span>\n )}\n </SelectValue>\n </SelectTrigger>\n <SelectPopup>\n {themeGroups.map((group, index) => (\n <Fragment key={group.id}>\n {index > 0 ? <SelectSeparator /> : null}\n {group.label ? (\n <SelectGroup>\n <SelectGroupLabel>{group.label}</SelectGroupLabel>\n {group.options.map((option) => (\n <ThemeOption key={option.value} option={option} />\n ))}\n </SelectGroup>\n ) : (\n group.options.map((option) => (\n <ThemeOption key={option.value} option={option} />\n ))\n )}\n </Fragment>\n ))}\n </SelectPopup>\n </Select>\n }\n startSlot={<PaletteIcon aria-hidden=\"true\" />}\n title={labels.theme}\n />\n </>\n )}\n </SettingsSection>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-4/settings-4.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/settings/settings-4/types.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '../shared/types'\nexport interface Settings4Option {\n label: string\n value: string\n}\n\nexport interface Settings4ThemeGroup {\n id: string\n label?: string\n options: Settings4Option[]\n}\n\nexport interface Settings4Labels extends SettingsLoadLabels {\n mode: string\n modeDescription: string\n theme: string\n themeDescription: string\n title: string\n}\n\nexport interface Settings4Props extends SettingsLoadProps {\n className?: string\n colorTheme: string\n labels?: Partial<Settings4Labels>\n mode: string\n modeOptions: Settings4Option[]\n onColorThemeChange?: (value: string) => void\n onModeChange?: (value: string) => void\n themeGroups: Settings4ThemeGroup[]\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-4/types.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "blocks/application/settings/shared/labels.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "import type { SettingsLoadLabels } from './types'\n\nexport const defaultSettingsLoadLabels: Pick<\n SettingsLoadLabels,\n 'errorDescription' | 'retry'\n> = {\n errorDescription: 'Verifique sua conexão e tente novamente.',\n retry: 'Tentar novamente',\n}\n",
|
|
39
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/labels.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "blocks/application/settings/shared/settings-load-state.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport type { ReactNode } from 'react'\nimport { SettingsSkeleton } from './settings-skeleton'\nimport type { SettingsLoadLabels, SettingsLoadProps } from './types'\n\nexport interface SettingsLoadStateOptions extends SettingsLoadProps {\n labels: SettingsLoadLabels\n skeleton: ReactNode\n}\n\nexport function settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton,\n}: Readonly<SettingsLoadStateOptions>): ReactNode {\n if (pending)\n return (\n <SettingsSkeleton label={labels.loading}>{skeleton}</SettingsSkeleton>\n )\n if (error)\n return (\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 return null\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-load-state.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/settings/shared/settings-skeleton.tsx",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { Skeleton } from '@tc96/ui/skeleton'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\ntype RowStart = 'avatar' | 'icon' | 'none'\ntype RowEnd = 'button' | 'menu' | 'none' | 'select' | 'switch'\n\nconst placeholderIds = (prefix: string, length: number) =>\n Array.from({ length }, (_, index) => `${prefix}-${index}`)\n\nconst titleWidths = ['w-40', 'w-32', 'w-48', 'w-36', 'w-44']\nconst descriptionWidths = ['w-64', 'w-56', 'w-72', 'w-60', 'w-52']\n\nexport function SettingsSkeleton({\n children,\n className,\n label,\n}: Readonly<{ children: ReactNode; className?: string; label: string }>) {\n return (\n <output\n aria-busy=\"true\"\n aria-label={label}\n className={cn('flex flex-col divide-y', className)}\n data-slot=\"settings-skeleton\"\n >\n {children}\n </output>\n )\n}\n\nexport function SettingsSectionSkeleton({\n action = false,\n children,\n description = false,\n}: Readonly<{ action?: boolean; children: ReactNode; description?: boolean }>) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-end justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n <Skeleton className=\"h-5 w-32\" />\n {description ? <Skeleton className=\"h-4 w-72 max-w-full\" /> : null}\n </div>\n {action ? <Skeleton className=\"h-8 w-24 shrink-0\" /> : null}\n </div>\n <Card>\n <div className=\"flex flex-col divide-y px-6\">{children}</div>\n </Card>\n </div>\n )\n}\n\nfunction RowEndSkeleton({ end }: Readonly<{ end: RowEnd }>) {\n if (end === 'switch')\n return <Skeleton className=\"h-5 w-9 shrink-0 rounded-full\" />\n if (end === 'select') return <Skeleton className=\"h-8 w-36 shrink-0\" />\n if (end === 'button') return <Skeleton className=\"h-8 w-24 shrink-0\" />\n if (end === 'menu') return <Skeleton className=\"size-8 shrink-0\" />\n return null\n}\n\nexport function SettingsRowsSkeleton({\n count,\n description = true,\n end = 'none',\n start = 'none',\n}: Readonly<{\n count: number\n description?: boolean\n end?: RowEnd\n start?: RowStart\n}>) {\n return placeholderIds('row', count).map((id, index) => (\n <div className=\"flex items-center gap-3 py-3\" key={id}>\n {start === 'avatar' ? (\n <Skeleton className=\"size-10 shrink-0 rounded-full\" />\n ) : null}\n {start === 'icon' ? <Skeleton className=\"size-4 shrink-0\" /> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">\n <Skeleton className={cn('h-4 max-w-full', titleWidths[index % 5])} />\n {description ? (\n <Skeleton\n className={cn('h-3.5 max-w-full', descriptionWidths[index % 5])}\n />\n ) : null}\n </div>\n <RowEndSkeleton end={end} />\n </div>\n ))\n}\n\nexport function SettingsCollapsedSkeleton({\n children,\n}: Readonly<{ children: ReactNode }>) {\n return (\n <div className=\"my-1 flex flex-col first:mt-4 last:mb-4\">\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n <div className=\"flex flex-col px-4\">{children}</div>\n </div>\n )\n}\n\nexport function SettingsTableSkeleton({\n columns,\n rows,\n}: Readonly<{ columns: number; rows: number }>) {\n return (\n <div className=\"flex flex-col divide-y py-2\">\n {placeholderIds('row', rows + 1).map((rowId, row) => (\n <div\n className=\"grid gap-4 py-3\"\n key={rowId}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {placeholderIds('cell', columns).map((cellId) => (\n <Skeleton\n className={row === 0 ? 'h-3.5 w-16' : 'h-4 w-full'}\n key={cellId}\n />\n ))}\n </div>\n ))}\n </div>\n )\n}\n",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-skeleton.tsx"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "blocks/application/settings/shared/types.ts",
|
|
55
|
+
"type": "registry:file",
|
|
56
|
+
"content": "export interface SettingsRowAction {\n destructive?: boolean\n id: string\n label: string\n}\n\nexport interface SettingsOption {\n label: string\n value: string\n}\n\nexport interface SettingsLoadLabels {\n errorDescription: string\n errorTitle: string\n loading: string\n retry: string\n}\n\nexport interface SettingsLoadProps {\n error?: boolean\n onRetry?: () => void\n pending?: boolean\n}\n",
|
|
57
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "patterns/surfaces/settings/composition/settings-row/settings-row.tsx",
|
|
61
|
+
"type": "registry:file",
|
|
62
|
+
"content": "import { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type { SettingsRowProps } from '../../core'\n\nexport function SettingsRow({\n className,\n description,\n endSlot,\n startSlot,\n title,\n}: Readonly<SettingsRowProps>): ReactElement {\n return (\n <div\n className={cn('flex items-center gap-3 py-3', className)}\n data-slot=\"settings-row\"\n >\n {startSlot ? (\n <div\n className=\"flex shrink-0 items-center [&>svg]:size-4\"\n data-slot=\"settings-row-start\"\n >\n {startSlot}\n </div>\n ) : null}\n <div className=\"min-w-0 flex-1\" data-slot=\"settings-row-heading\">\n <Text\n render={<p data-slot=\"settings-row-title\">{title}</p>}\n size=\"sm\"\n weight=\"semibold\"\n />\n {description ? (\n <Text\n foreground=\"muted\"\n render={<p data-slot=\"settings-row-description\">{description}</p>}\n size=\"sm\"\n />\n ) : null}\n </div>\n {endSlot ? (\n <div\n className=\"ms-3 flex shrink-0 items-center gap-2\"\n data-slot=\"settings-row-end\"\n >\n {endSlot}\n </div>\n ) : null}\n </div>\n )\n}\n",
|
|
63
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-row/settings-row.tsx"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section-context.ts",
|
|
67
|
+
"type": "registry:file",
|
|
68
|
+
"content": "import { createContext, useContext } from 'react'\n\nexport const SettingsSectionTitleIdContext = createContext<string | undefined>(\n undefined,\n)\n\nexport function useSettingsSectionTitleId(): string | undefined {\n return useContext(SettingsSectionTitleIdContext)\n}\n",
|
|
69
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section-context.ts"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section-header.tsx",
|
|
73
|
+
"type": "registry:file",
|
|
74
|
+
"content": "import { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type {\n SettingsSectionDescriptionProps,\n SettingsSectionHeaderProps,\n SettingsSectionTitleProps,\n} from '../../core'\nimport { useSettingsSectionTitleId } from './settings-section-context'\n\nexport function SettingsSectionHeader({\n actions,\n children,\n className,\n}: Readonly<SettingsSectionHeaderProps>): ReactElement {\n return (\n <div\n className={cn('flex items-end justify-between gap-3', className)}\n data-slot=\"settings-section-header\"\n >\n <div className=\"flex min-w-0 flex-col gap-1\">{children}</div>\n {actions ? (\n <div className=\"shrink-0\" data-slot=\"settings-section-actions\">\n {actions}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport function SettingsSectionTitle({\n children,\n className,\n}: Readonly<SettingsSectionTitleProps>): ReactElement {\n const id = useSettingsSectionTitleId()\n\n return (\n <Text\n className={className}\n render={\n <h2 data-slot=\"settings-section-title\" id={id}>\n {children}\n </h2>\n }\n size=\"base\"\n weight=\"medium\"\n />\n )\n}\n\nexport function SettingsSectionDescription({\n children,\n className,\n}: Readonly<SettingsSectionDescriptionProps>): ReactElement {\n return (\n <Text\n className={className}\n foreground=\"muted\"\n render={<p data-slot=\"settings-section-description\">{children}</p>}\n size=\"sm\"\n />\n )\n}\n",
|
|
75
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section-header.tsx"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section.tsx",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useId } from 'react'\nimport type { SettingsSectionProps } from '../../core'\nimport { SettingsSectionTitleIdContext } from './settings-section-context'\n\nexport function SettingsSection({\n children,\n className,\n header,\n}: Readonly<SettingsSectionProps>): ReactElement {\n const titleId = `settings-section-title-${useId()}`\n const card = (\n <Card>\n <div\n className=\"divide-y px-6 has-[[data-slot=record-group]]:px-4 has-[[data-slot=settings-collapsed]]:px-4\"\n data-slot=\"settings-section-rows\"\n >\n {children}\n </div>\n </Card>\n )\n\n if (!header) {\n return (\n <div className={className} data-slot=\"settings-section\">\n {card}\n </div>\n )\n }\n\n return (\n <section\n aria-labelledby={titleId}\n className={cn('flex flex-col gap-3', className)}\n data-slot=\"settings-section\"\n >\n <SettingsSectionTitleIdContext.Provider value={titleId}>\n {header}\n </SettingsSectionTitleIdContext.Provider>\n {card}\n </section>\n )\n}\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section.tsx"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "patterns/surfaces/settings/core.ts",
|
|
85
|
+
"type": "registry:file",
|
|
86
|
+
"content": "import type { ReactNode } from 'react'\n\nexport interface SettingsSectionProps {\n children?: ReactNode\n className?: string\n header?: ReactNode\n}\n\nexport interface SettingsSectionHeaderProps {\n actions?: ReactNode\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsSectionTitleProps {\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsSectionDescriptionProps {\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsRowProps {\n className?: string\n description?: ReactNode\n endSlot?: ReactNode\n startSlot?: ReactNode\n title: ReactNode\n}\n\nexport interface SettingsCollapsedProps {\n actions?: ReactNode\n children?: ReactNode\n className?: string\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n open?: boolean\n title: ReactNode\n}\n",
|
|
87
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/core.ts"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
91
|
+
"type": "registry:file",
|
|
92
|
+
"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",
|
|
93
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
97
|
+
"type": "registry:file",
|
|
98
|
+
"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",
|
|
99
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"dependencies": [
|
|
103
|
+
"@phosphor-icons/react@2.1.10",
|
|
104
|
+
"react@19.1.1"
|
|
105
|
+
],
|
|
106
|
+
"registryDependencies": [
|
|
107
|
+
"@ui/button",
|
|
108
|
+
"@ui/card",
|
|
109
|
+
"@ui/empty",
|
|
110
|
+
"@ui/icon-frame",
|
|
111
|
+
"@ui/select",
|
|
112
|
+
"@ui/skeleton",
|
|
113
|
+
"@ui/text"
|
|
114
|
+
],
|
|
115
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
116
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "settings-5",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/settings/settings-5/index.ts",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "export { Settings5 } from './settings-5'\nexport type {\n Settings5Labels,\n Settings5Props,\n Settings5TimeZone,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-5/index.ts"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/settings/settings-5/labels.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../shared/labels'\nimport type { Settings5Labels } from './types'\n\nexport const defaultSettings5Labels: Settings5Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar o workspace',\n loading: 'Carregando workspace',\n dangerTitle: 'Zona de perigo',\n deleteDescription:\n 'Exclui todos os registros e remove o acesso de todos os membros',\n deleteTitle: 'Excluir workspace',\n deleteWorkspace: 'Excluir workspace',\n logoDescription: 'Exibido na barra lateral e nos e-mails de convite',\n logoTitle: 'Logo',\n nameLabel: 'Nome do workspace',\n timeZoneDescription: 'Usado em prazos, relatórios e e-mails agendados',\n timeZoneLabel: 'Fuso horário',\n uploadLogo: 'Enviar logo',\n urlDescription: 'Alterar quebra os links compartilhados antes',\n urlLabel: 'URL do workspace',\n urlPrefix: 'app.example.com/',\n workspaceDescription: (name) =>\n `Detalhes que todos os membros de ${name} veem.`,\n workspaceTitle: 'Workspace',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-5/labels.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/settings/settings-5/settings-5-skeleton.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../shared/settings-skeleton'\n\nexport function Settings5Skeleton() {\n return (\n <>\n <SettingsRowsSkeleton count={1} start=\"avatar\" end=\"button\" />\n <SettingsRowsSkeleton count={3} end=\"select\" />\n </>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-5/settings-5-skeleton.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/settings/settings-5/settings-5.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { CameraIcon } from '@phosphor-icons/react'\nimport { Avatar, AvatarFallback } from '@tc96/ui/avatar'\nimport { Button } from '@tc96/ui/button'\nimport { Input } from '@tc96/ui/input'\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n InputGroupText,\n} from '@tc96/ui/input-group'\nimport { SettingsRow } from '@tc96/ui/patterns/surfaces/settings/composition/settings-row/settings-row'\nimport { SettingsSection } from '@tc96/ui/patterns/surfaces/settings/composition/settings-section/settings-section'\nimport {\n SettingsSectionDescription,\n SettingsSectionHeader,\n SettingsSectionTitle,\n} from '@tc96/ui/patterns/surfaces/settings/composition/settings-section/settings-section-header'\nimport {\n Select,\n SelectItem,\n SelectPopup,\n SelectTrigger,\n SelectValue,\n} from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { settingsLoadState } from '../shared/settings-load-state'\nimport { defaultSettings5Labels } from './labels'\nimport { Settings5Skeleton } from './settings-5-skeleton'\nimport type { Settings5Props } from './types'\n\ninterface AvatarUploadTriggerProps {\n initials: string\n label: string\n onClick?: () => void\n}\n\nfunction AvatarUploadTrigger({\n initials,\n label,\n onClick,\n}: Readonly<AvatarUploadTriggerProps>) {\n return (\n <Avatar\n aria-label={label}\n className=\"group cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\"\n onClick={onClick}\n render={<button type=\"button\" />}\n >\n <AvatarFallback>{initials}</AvatarFallback>\n <span\n aria-hidden=\"true\"\n className=\"absolute inset-0 flex items-center justify-center bg-foreground/64 text-background opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100\"\n >\n <CameraIcon aria-hidden=\"true\" className=\"size-4\" />\n </span>\n </Avatar>\n )\n}\n\nexport function Settings5({\n error,\n onRetry,\n pending,\n className,\n initials,\n labels: labelsProp,\n name,\n onDeleteWorkspace,\n onNameCommit,\n onSlugCommit,\n onTimeZoneChange,\n onUploadLogo,\n slug,\n timeZone: timeZoneProp,\n timeZones,\n}: Readonly<Settings5Props>) {\n const labels = { ...defaultSettings5Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <Settings5Skeleton />,\n })\n const [timeZone, setTimeZone] = useState(timeZoneProp)\n\n return (\n <div\n className={cn('mx-auto flex w-full max-w-2xl flex-col gap-8', className)}\n >\n <SettingsSection\n header={\n <SettingsSectionHeader>\n <SettingsSectionTitle>{labels.workspaceTitle}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.workspaceDescription(name)}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <>\n <SettingsRow\n description={labels.logoDescription}\n endSlot={\n <AvatarUploadTrigger\n initials={initials}\n label={labels.uploadLogo}\n onClick={onUploadLogo}\n />\n }\n title={labels.logoTitle}\n />\n <SettingsRow\n endSlot={\n <Input\n aria-label={labels.nameLabel}\n className=\"w-64\"\n defaultValue={name}\n onBlur={(event) => onNameCommit?.(event.currentTarget.value)}\n />\n }\n title={labels.nameLabel}\n />\n <SettingsRow\n description={labels.urlDescription}\n endSlot={\n <InputGroup className=\"w-64\">\n <InputGroupAddon>\n <InputGroupText>{labels.urlPrefix}</InputGroupText>\n </InputGroupAddon>\n <InputGroupInput\n aria-label={labels.urlLabel}\n defaultValue={slug}\n onBlur={(event) =>\n onSlugCommit?.(event.currentTarget.value)\n }\n />\n </InputGroup>\n }\n title={labels.urlLabel}\n />\n <SettingsRow\n description={labels.timeZoneDescription}\n endSlot={\n <Select\n items={timeZones}\n onValueChange={(next) => {\n if (!next) return\n setTimeZone(next)\n onTimeZoneChange?.(next)\n }}\n value={timeZone}\n >\n <SelectTrigger\n aria-label={labels.timeZoneLabel}\n className=\"w-64\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectPopup>\n {timeZones.map((item) => (\n <SelectItem key={item.value} value={item.value}>\n {item.label}\n </SelectItem>\n ))}\n </SelectPopup>\n </Select>\n }\n title={labels.timeZoneLabel}\n />\n </>\n )}\n </SettingsSection>\n {loadState ? null : (\n <SettingsSection\n header={\n <SettingsSectionHeader>\n <SettingsSectionTitle>{labels.dangerTitle}</SettingsSectionTitle>\n </SettingsSectionHeader>\n }\n >\n <SettingsRow\n description={labels.deleteDescription}\n endSlot={\n <Button\n onClick={onDeleteWorkspace}\n size=\"sm\"\n variant=\"destructive\"\n >\n {labels.deleteWorkspace}\n </Button>\n }\n title={labels.deleteTitle}\n />\n </SettingsSection>\n )}\n </div>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-5/settings-5.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/settings/settings-5/types.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '../shared/types'\nexport interface Settings5TimeZone {\n label: string\n value: string\n}\n\nexport interface Settings5Labels extends SettingsLoadLabels {\n dangerTitle: string\n deleteDescription: string\n deleteTitle: string\n deleteWorkspace: string\n logoDescription: string\n logoTitle: string\n nameLabel: string\n timeZoneDescription: string\n timeZoneLabel: string\n uploadLogo: string\n urlDescription: string\n urlLabel: string\n urlPrefix: string\n workspaceDescription: (name: string) => string\n workspaceTitle: string\n}\n\nexport interface Settings5Props extends SettingsLoadProps {\n className?: string\n initials: string\n labels?: Partial<Settings5Labels>\n name: string\n onDeleteWorkspace?: () => void\n onNameCommit?: (value: string) => void\n onSlugCommit?: (value: string) => void\n onTimeZoneChange?: (value: string) => void\n onUploadLogo?: () => void\n slug: string\n timeZone: string\n timeZones: Settings5TimeZone[]\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/settings-5/types.ts"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "blocks/application/settings/shared/labels.ts",
|
|
37
|
+
"type": "registry:file",
|
|
38
|
+
"content": "import type { SettingsLoadLabels } from './types'\n\nexport const defaultSettingsLoadLabels: Pick<\n SettingsLoadLabels,\n 'errorDescription' | 'retry'\n> = {\n errorDescription: 'Verifique sua conexão e tente novamente.',\n retry: 'Tentar novamente',\n}\n",
|
|
39
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/labels.ts"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "blocks/application/settings/shared/settings-load-state.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport type { ReactNode } from 'react'\nimport { SettingsSkeleton } from './settings-skeleton'\nimport type { SettingsLoadLabels, SettingsLoadProps } from './types'\n\nexport interface SettingsLoadStateOptions extends SettingsLoadProps {\n labels: SettingsLoadLabels\n skeleton: ReactNode\n}\n\nexport function settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton,\n}: Readonly<SettingsLoadStateOptions>): ReactNode {\n if (pending)\n return (\n <SettingsSkeleton label={labels.loading}>{skeleton}</SettingsSkeleton>\n )\n if (error)\n return (\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 return null\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-load-state.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/settings/shared/settings-skeleton.tsx",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { Skeleton } from '@tc96/ui/skeleton'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\n\ntype RowStart = 'avatar' | 'icon' | 'none'\ntype RowEnd = 'button' | 'menu' | 'none' | 'select' | 'switch'\n\nconst placeholderIds = (prefix: string, length: number) =>\n Array.from({ length }, (_, index) => `${prefix}-${index}`)\n\nconst titleWidths = ['w-40', 'w-32', 'w-48', 'w-36', 'w-44']\nconst descriptionWidths = ['w-64', 'w-56', 'w-72', 'w-60', 'w-52']\n\nexport function SettingsSkeleton({\n children,\n className,\n label,\n}: Readonly<{ children: ReactNode; className?: string; label: string }>) {\n return (\n <output\n aria-busy=\"true\"\n aria-label={label}\n className={cn('flex flex-col divide-y', className)}\n data-slot=\"settings-skeleton\"\n >\n {children}\n </output>\n )\n}\n\nexport function SettingsSectionSkeleton({\n action = false,\n children,\n description = false,\n}: Readonly<{ action?: boolean; children: ReactNode; description?: boolean }>) {\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-end justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n <Skeleton className=\"h-5 w-32\" />\n {description ? <Skeleton className=\"h-4 w-72 max-w-full\" /> : null}\n </div>\n {action ? <Skeleton className=\"h-8 w-24 shrink-0\" /> : null}\n </div>\n <Card>\n <div className=\"flex flex-col divide-y px-6\">{children}</div>\n </Card>\n </div>\n )\n}\n\nfunction RowEndSkeleton({ end }: Readonly<{ end: RowEnd }>) {\n if (end === 'switch')\n return <Skeleton className=\"h-5 w-9 shrink-0 rounded-full\" />\n if (end === 'select') return <Skeleton className=\"h-8 w-36 shrink-0\" />\n if (end === 'button') return <Skeleton className=\"h-8 w-24 shrink-0\" />\n if (end === 'menu') return <Skeleton className=\"size-8 shrink-0\" />\n return null\n}\n\nexport function SettingsRowsSkeleton({\n count,\n description = true,\n end = 'none',\n start = 'none',\n}: Readonly<{\n count: number\n description?: boolean\n end?: RowEnd\n start?: RowStart\n}>) {\n return placeholderIds('row', count).map((id, index) => (\n <div className=\"flex items-center gap-3 py-3\" key={id}>\n {start === 'avatar' ? (\n <Skeleton className=\"size-10 shrink-0 rounded-full\" />\n ) : null}\n {start === 'icon' ? <Skeleton className=\"size-4 shrink-0\" /> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">\n <Skeleton className={cn('h-4 max-w-full', titleWidths[index % 5])} />\n {description ? (\n <Skeleton\n className={cn('h-3.5 max-w-full', descriptionWidths[index % 5])}\n />\n ) : null}\n </div>\n <RowEndSkeleton end={end} />\n </div>\n ))\n}\n\nexport function SettingsCollapsedSkeleton({\n children,\n}: Readonly<{ children: ReactNode }>) {\n return (\n <div className=\"my-1 flex flex-col first:mt-4 last:mb-4\">\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n <div className=\"flex flex-col px-4\">{children}</div>\n </div>\n )\n}\n\nexport function SettingsTableSkeleton({\n columns,\n rows,\n}: Readonly<{ columns: number; rows: number }>) {\n return (\n <div className=\"flex flex-col divide-y py-2\">\n {placeholderIds('row', rows + 1).map((rowId, row) => (\n <div\n className=\"grid gap-4 py-3\"\n key={rowId}\n style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n >\n {placeholderIds('cell', columns).map((cellId) => (\n <Skeleton\n className={row === 0 ? 'h-3.5 w-16' : 'h-4 w-full'}\n key={cellId}\n />\n ))}\n </div>\n ))}\n </div>\n )\n}\n",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-skeleton.tsx"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "blocks/application/settings/shared/types.ts",
|
|
55
|
+
"type": "registry:file",
|
|
56
|
+
"content": "export interface SettingsRowAction {\n destructive?: boolean\n id: string\n label: string\n}\n\nexport interface SettingsOption {\n label: string\n value: string\n}\n\nexport interface SettingsLoadLabels {\n errorDescription: string\n errorTitle: string\n loading: string\n retry: string\n}\n\nexport interface SettingsLoadProps {\n error?: boolean\n onRetry?: () => void\n pending?: boolean\n}\n",
|
|
57
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "patterns/surfaces/settings/composition/settings-row/settings-row.tsx",
|
|
61
|
+
"type": "registry:file",
|
|
62
|
+
"content": "import { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type { SettingsRowProps } from '../../core'\n\nexport function SettingsRow({\n className,\n description,\n endSlot,\n startSlot,\n title,\n}: Readonly<SettingsRowProps>): ReactElement {\n return (\n <div\n className={cn('flex items-center gap-3 py-3', className)}\n data-slot=\"settings-row\"\n >\n {startSlot ? (\n <div\n className=\"flex shrink-0 items-center [&>svg]:size-4\"\n data-slot=\"settings-row-start\"\n >\n {startSlot}\n </div>\n ) : null}\n <div className=\"min-w-0 flex-1\" data-slot=\"settings-row-heading\">\n <Text\n render={<p data-slot=\"settings-row-title\">{title}</p>}\n size=\"sm\"\n weight=\"semibold\"\n />\n {description ? (\n <Text\n foreground=\"muted\"\n render={<p data-slot=\"settings-row-description\">{description}</p>}\n size=\"sm\"\n />\n ) : null}\n </div>\n {endSlot ? (\n <div\n className=\"ms-3 flex shrink-0 items-center gap-2\"\n data-slot=\"settings-row-end\"\n >\n {endSlot}\n </div>\n ) : null}\n </div>\n )\n}\n",
|
|
63
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-row/settings-row.tsx"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section-context.ts",
|
|
67
|
+
"type": "registry:file",
|
|
68
|
+
"content": "import { createContext, useContext } from 'react'\n\nexport const SettingsSectionTitleIdContext = createContext<string | undefined>(\n undefined,\n)\n\nexport function useSettingsSectionTitleId(): string | undefined {\n return useContext(SettingsSectionTitleIdContext)\n}\n",
|
|
69
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section-context.ts"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section-header.tsx",
|
|
73
|
+
"type": "registry:file",
|
|
74
|
+
"content": "import { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type {\n SettingsSectionDescriptionProps,\n SettingsSectionHeaderProps,\n SettingsSectionTitleProps,\n} from '../../core'\nimport { useSettingsSectionTitleId } from './settings-section-context'\n\nexport function SettingsSectionHeader({\n actions,\n children,\n className,\n}: Readonly<SettingsSectionHeaderProps>): ReactElement {\n return (\n <div\n className={cn('flex items-end justify-between gap-3', className)}\n data-slot=\"settings-section-header\"\n >\n <div className=\"flex min-w-0 flex-col gap-1\">{children}</div>\n {actions ? (\n <div className=\"shrink-0\" data-slot=\"settings-section-actions\">\n {actions}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport function SettingsSectionTitle({\n children,\n className,\n}: Readonly<SettingsSectionTitleProps>): ReactElement {\n const id = useSettingsSectionTitleId()\n\n return (\n <Text\n className={className}\n render={\n <h2 data-slot=\"settings-section-title\" id={id}>\n {children}\n </h2>\n }\n size=\"base\"\n weight=\"medium\"\n />\n )\n}\n\nexport function SettingsSectionDescription({\n children,\n className,\n}: Readonly<SettingsSectionDescriptionProps>): ReactElement {\n return (\n <Text\n className={className}\n foreground=\"muted\"\n render={<p data-slot=\"settings-section-description\">{children}</p>}\n size=\"sm\"\n />\n )\n}\n",
|
|
75
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section-header.tsx"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/surfaces/settings/composition/settings-section/settings-section.tsx",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "import { Card } from '@tc96/ui/card'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useId } from 'react'\nimport type { SettingsSectionProps } from '../../core'\nimport { SettingsSectionTitleIdContext } from './settings-section-context'\n\nexport function SettingsSection({\n children,\n className,\n header,\n}: Readonly<SettingsSectionProps>): ReactElement {\n const titleId = `settings-section-title-${useId()}`\n const card = (\n <Card>\n <div\n className=\"divide-y px-6 has-[[data-slot=record-group]]:px-4 has-[[data-slot=settings-collapsed]]:px-4\"\n data-slot=\"settings-section-rows\"\n >\n {children}\n </div>\n </Card>\n )\n\n if (!header) {\n return (\n <div className={className} data-slot=\"settings-section\">\n {card}\n </div>\n )\n }\n\n return (\n <section\n aria-labelledby={titleId}\n className={cn('flex flex-col gap-3', className)}\n data-slot=\"settings-section\"\n >\n <SettingsSectionTitleIdContext.Provider value={titleId}>\n {header}\n </SettingsSectionTitleIdContext.Provider>\n {card}\n </section>\n )\n}\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/composition/settings-section/settings-section.tsx"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "patterns/surfaces/settings/core.ts",
|
|
85
|
+
"type": "registry:file",
|
|
86
|
+
"content": "import type { ReactNode } from 'react'\n\nexport interface SettingsSectionProps {\n children?: ReactNode\n className?: string\n header?: ReactNode\n}\n\nexport interface SettingsSectionHeaderProps {\n actions?: ReactNode\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsSectionTitleProps {\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsSectionDescriptionProps {\n children?: ReactNode\n className?: string\n}\n\nexport interface SettingsRowProps {\n className?: string\n description?: ReactNode\n endSlot?: ReactNode\n startSlot?: ReactNode\n title: ReactNode\n}\n\nexport interface SettingsCollapsedProps {\n actions?: ReactNode\n children?: ReactNode\n className?: string\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n open?: boolean\n title: ReactNode\n}\n",
|
|
87
|
+
"target": "~/packages/ui/src/patterns/surfaces/settings/core.ts"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
|
|
91
|
+
"type": "registry:file",
|
|
92
|
+
"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",
|
|
93
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"path": "patterns/surfaces/state/core.ts",
|
|
97
|
+
"type": "registry:file",
|
|
98
|
+
"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",
|
|
99
|
+
"target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"dependencies": [
|
|
103
|
+
"@phosphor-icons/react@2.1.10",
|
|
104
|
+
"react@19.1.1"
|
|
105
|
+
],
|
|
106
|
+
"registryDependencies": [
|
|
107
|
+
"@ui/avatar",
|
|
108
|
+
"@ui/button",
|
|
109
|
+
"@ui/card",
|
|
110
|
+
"@ui/empty",
|
|
111
|
+
"@ui/icon-frame",
|
|
112
|
+
"@ui/input",
|
|
113
|
+
"@ui/input-group",
|
|
114
|
+
"@ui/select",
|
|
115
|
+
"@ui/skeleton",
|
|
116
|
+
"@ui/text"
|
|
117
|
+
],
|
|
118
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
119
|
+
}
|