@tc96/cli 0.27.0 → 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/README.md +4 -4
- package/cli.js +82 -27
- package/package.json +1 -1
- package/registry/agenda-1.json +1297 -0
- package/registry/aggregate.json +1 -1
- package/registry/ai-chat-1.json +91 -0
- package/registry/checklist.json +21 -7
- package/registry/collection.json +624 -351
- package/registry/crm-1.json +1317 -0
- package/registry/crm-2.json +1400 -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/finance-1.json +845 -0
- package/registry/finance-2.json +973 -0
- package/registry/finance-3.json +1436 -0
- package/registry/{workflow-editor.json → flow-1.json} +37 -37
- package/registry/{agent-builder.json → flow-2.json} +55 -55
- package/registry/{run-monitor.json → flow-3.json} +16 -16
- package/registry/{impact-map.json → flow-4.json} +16 -16
- 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/marketing-1.json +833 -0
- package/registry/marketing-2.json +961 -0
- package/registry/navbar-1.json +6 -6
- package/registry/navbar-10.json +50 -0
- package/registry/navbar-11.json +48 -0
- package/registry/navbar-12.json +48 -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/projects-1.json +865 -0
- package/registry/projects-2.json +993 -0
- package/registry/projects-3.json +1346 -0
- package/registry/properties.json +65 -58
- package/registry/record-group.json +5 -1
- 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 +27 -7
- package/registry/{settings-1.json → settings-account-1.json} +17 -17
- package/registry/{settings-23.json → settings-account-2.json} +17 -17
- package/registry/{settings-7.json → settings-catalog-1.json} +17 -17
- package/registry/{settings-16.json → settings-catalog-10.json} +17 -17
- package/registry/{settings-8.json → settings-catalog-2.json} +17 -17
- package/registry/{settings-9.json → settings-catalog-3.json} +17 -17
- package/registry/{settings-10.json → settings-catalog-4.json} +29 -20
- package/registry/{settings-11.json → settings-catalog-5.json} +17 -17
- package/registry/{settings-12.json → settings-catalog-6.json} +17 -17
- package/registry/{settings-13.json → settings-catalog-7.json} +17 -17
- package/registry/{settings-14.json → settings-catalog-8.json} +29 -19
- package/registry/{settings-15.json → settings-catalog-9.json} +28 -18
- package/registry/{settings-19.json → settings-integration-1.json} +17 -17
- package/registry/settings-integration-2.json +122 -0
- package/registry/{settings-22.json → settings-integration-3.json} +17 -17
- 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-21.json → settings-integration-7.json} +23 -17
- package/registry/settings-integration-8.json +593 -0
- package/registry/{settings-20.json → settings-notification-channel-1.json} +17 -17
- package/registry/{settings-2.json → settings-preference-1.json} +17 -17
- package/registry/{settings-3.json → settings-preference-2.json} +17 -17
- package/registry/{settings-4.json → settings-preference-3.json} +17 -17
- package/registry/{settings-18.json → settings-role-permission-1.json} +17 -17
- package/registry/{settings-17.json → settings-security-1.json} +17 -17
- package/registry/{settings-5.json → settings-workspace-1.json} +28 -28
- package/registry/{settings-6.json → settings-workspace-2.json} +31 -31
- 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/ui/gauge.json +1 -1
- package/registry/ui/menu.json +1 -1
- package/registry/ui/property-meta.json +16 -0
- package/registry/ui/property-tone.json +12 -0
- package/registry/ui/scroll-area.json +1 -1
- package/registry/ui/select.json +1 -1
- package/registry/view.json +624 -351
- package/registry/app-shell-5.json +0 -106
- package/registry/bulk-import-1.json +0 -151
- package/registry/collection-layouts.json +0 -836
- package/registry/collection-views.json +0 -836
- package/registry/detail-sheet.json +0 -54
- package/registry/icon-row.json +0 -52
- package/registry/lookup-create-1.json +0 -157
- package/registry/next-steps-1.json +0 -147
- package/registry/settings-shell.json +0 -60
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "settings-
|
|
2
|
+
"name": "settings-catalog-8",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/catalog/settings-catalog-8/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsCatalog8 } from './settings-catalog-8'\nexport type {\n SettingsCatalog8Account,\n SettingsCatalog8AccountType,\n SettingsCatalog8Action,\n SettingsCatalog8Labels,\n SettingsCatalog8Props,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-8/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/catalog/settings-catalog-8/labels.ts",
|
|
13
13
|
"type": "registry:file",
|
|
14
|
-
"content": "import { defaultSettingsLoadLabels } from '
|
|
15
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../../shared/labels'\nimport type {\n SettingsCatalog8AccountType,\n SettingsCatalog8Labels,\n} from './types'\n\nconst accountTypeLabels: Record<SettingsCatalog8AccountType, string> = {\n bank: 'Banco',\n cash: 'Dinheiro',\n}\n\nexport const defaultSettingsCatalog8Labels: SettingsCatalog8Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar as contas',\n loading: 'Carregando contas',\n accountType: (type) => accountTypeLabels[type],\n actions: (name) => `Ações de ${name}`,\n archive: 'Arquivar',\n archived: 'Arquivadas',\n default: 'Padrão',\n description:\n 'Bancos e caixas onde os lançamentos são liquidados. Novos lançamentos começam na conta padrão.',\n edit: 'Editar',\n emptyDescription: 'Crie uma conta para começar a registrar lançamentos.',\n emptyTitle: 'Nenhuma conta ainda',\n makeDefault: 'Tornar padrão',\n newAccount: 'Nova conta',\n opening: (type, balance, date) => `${type} · Abre com ${balance} em ${date}`,\n restore: 'Restaurar',\n title: 'Contas',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-8/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/catalog/settings-catalog-8/settings-catalog-8-skeleton.tsx",
|
|
19
19
|
"type": "registry:file",
|
|
20
|
-
"content": "import { SettingsRowsSkeleton } from '
|
|
21
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../../shared/settings-skeleton'\n\nexport function SettingsCatalog8Skeleton() {\n return <SettingsRowsSkeleton count={4} start=\"icon\" end=\"menu\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-8/settings-catalog-8-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/catalog/settings-catalog-8/settings-catalog-8.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import { BankIcon, StarIcon, WalletIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { formatMediumDate } from '@tc96/ui/helpers/date'\nimport { formatAmount } from '@tc96/ui/helpers/format'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { FlagProperty } from '@tc96/ui/patterns/properties/display/flag/flag-property'\nimport { SettingsCollapsed } from '@tc96/ui/patterns/surfaces/settings/composition/settings-collapsed/settings-collapsed'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '
|
|
27
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
26
|
+
"content": "import { BankIcon, StarIcon, WalletIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { formatMediumDate } from '@tc96/ui/helpers/date'\nimport { formatAmount } from '@tc96/ui/helpers/format'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { FlagProperty } from '@tc96/ui/patterns/properties/display/flag/flag-property'\nimport { SettingsCollapsed } from '@tc96/ui/patterns/surfaces/settings/composition/settings-collapsed/settings-collapsed'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '../../shared/settings-load-state'\nimport { SettingsRowActions } from '../../shared/settings-row-actions'\nimport { defaultSettingsCatalog8Labels } from './labels'\nimport { SettingsCatalog8Skeleton } from './settings-catalog-8-skeleton'\nimport type {\n SettingsCatalog8Account,\n SettingsCatalog8AccountType,\n SettingsCatalog8Action,\n SettingsCatalog8Labels,\n SettingsCatalog8Props,\n} from './types'\n\nconst accountIcons = {\n bank: BankIcon,\n cash: WalletIcon,\n} satisfies Record<SettingsCatalog8AccountType, typeof BankIcon>\n\ninterface AccountRowProps {\n account: SettingsCatalog8Account\n archived?: boolean\n currency: string\n isDefault?: boolean\n labels: SettingsCatalog8Labels\n locale: string\n onAccountAction?: SettingsCatalog8Props['onAccountAction']\n}\n\nfunction AccountRow({\n account,\n archived,\n currency,\n isDefault,\n labels,\n locale,\n onAccountAction,\n}: Readonly<AccountRowProps>) {\n const AccountIcon = accountIcons[account.type]\n const actions = archived\n ? [{ id: 'restore', label: labels.restore }]\n : [\n { id: 'edit', label: labels.edit },\n ...(isDefault\n ? []\n : [\n { id: 'make-default', label: labels.makeDefault },\n { destructive: true, id: 'archive', label: labels.archive },\n ]),\n ]\n\n return (\n <SettingsRow\n description={labels.opening(\n labels.accountType(account.type),\n formatAmount(account.openingBalance, { currency, locale }),\n formatMediumDate(\n new Date(`${account.openingOn}T00:00:00Z`),\n locale,\n 'UTC',\n ),\n )}\n endSlot={\n <div className=\"flex items-center gap-3\">\n <FlagProperty\n active={Boolean(isDefault)}\n activeIcon={StarIcon}\n label={labels.default}\n />\n {onAccountAction ? (\n <SettingsRowActions\n actions={actions}\n label={labels.actions(account.name)}\n onAction={(action) =>\n onAccountAction(account.id, action as SettingsCatalog8Action)\n }\n />\n ) : null}\n </div>\n }\n startSlot={\n <IconFrame shape=\"rounded\">\n <AccountIcon aria-hidden=\"true\" className=\"size-4\" />\n </IconFrame>\n }\n title={account.name}\n />\n )\n}\n\nexport function SettingsCatalog8({\n error,\n onRetry,\n pending,\n accounts,\n archivedAccounts = [],\n className,\n currency = 'BRL',\n defaultAccountId,\n labels: labelsProp,\n locale = 'pt-BR',\n onAccountAction,\n onCreate,\n}: Readonly<SettingsCatalog8Props>) {\n const labels = { ...defaultSettingsCatalog8Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsCatalog8Skeleton />,\n })\n\n return (\n <SettingsSection\n className={cn('mx-auto w-full max-w-2xl', className)}\n header={\n <SettingsSectionHeader\n actions={\n onCreate ? (\n <Button onClick={onCreate} size=\"sm\">\n {labels.newAccount}\n </Button>\n ) : undefined\n }\n >\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.description}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <>\n {accounts.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n accounts.map((account) => (\n <AccountRow\n account={account}\n currency={currency}\n isDefault={account.id === defaultAccountId}\n key={account.id}\n labels={labels}\n locale={locale}\n onAccountAction={onAccountAction}\n />\n ))\n )}\n {archivedAccounts.length > 0 ? (\n <div>\n <SettingsCollapsed defaultOpen={false} title={labels.archived}>\n {archivedAccounts.map((account) => (\n <AccountRow\n account={account}\n archived\n currency={currency}\n key={account.id}\n labels={labels}\n locale={locale}\n onAccountAction={onAccountAction}\n />\n ))}\n </SettingsCollapsed>\n </div>\n ) : null}\n </>\n )}\n </SettingsSection>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-8/settings-catalog-8.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/catalog/settings-catalog-8/types.ts",
|
|
31
31
|
"type": "registry:file",
|
|
32
|
-
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '
|
|
33
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
32
|
+
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '../../shared/types'\nexport type SettingsCatalog8AccountType = 'bank' | 'cash'\n\nexport interface SettingsCatalog8Account {\n id: string\n name: string\n openingBalance: number\n openingOn: string\n type: SettingsCatalog8AccountType\n}\n\nexport interface SettingsCatalog8Labels extends SettingsLoadLabels {\n accountType: (type: SettingsCatalog8AccountType) => string\n actions: (name: string) => string\n archive: string\n archived: string\n default: string\n description: string\n edit: string\n emptyDescription: string\n emptyTitle: string\n makeDefault: string\n newAccount: string\n opening: (type: string, balance: string, date: string) => string\n restore: string\n title: string\n}\n\nexport type SettingsCatalog8Action =\n | 'edit'\n | 'make-default'\n | 'archive'\n | 'restore'\n\nexport interface SettingsCatalog8Props extends SettingsLoadProps {\n accounts: SettingsCatalog8Account[]\n archivedAccounts?: SettingsCatalog8Account[]\n className?: string\n currency?: string\n defaultAccountId?: string\n labels?: Partial<SettingsCatalog8Labels>\n locale?: string\n onAccountAction?: (accountId: string, action: SettingsCatalog8Action) => void\n onCreate?: () => void\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-8/types.ts"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"path": "blocks/application/settings/shared/labels.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
{
|
|
60
60
|
"path": "blocks/application/settings/shared/types.ts",
|
|
61
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",
|
|
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\nexport interface SettingsAppLogoData {\n svg: string\n title?: string\n}\n",
|
|
63
63
|
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
@@ -89,15 +89,21 @@
|
|
|
89
89
|
{
|
|
90
90
|
"path": "patterns/properties/display/flag/flag-property.tsx",
|
|
91
91
|
"type": "registry:file",
|
|
92
|
-
"content": "'use client'\n\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport {
|
|
92
|
+
"content": "'use client'\n\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\n\nexport interface FlagPropertyProps {\n active: boolean\n label: string\n activeIcon?: PropertyIcon\n ariaLabel?: string\n className?: string\n iconClassName?: string\n inactiveLabel?: string\n inactiveIcon?: PropertyIcon\n showInactive?: boolean\n variant?: PropertyVariant\n}\n\nexport function FlagProperty({\n active,\n activeIcon,\n ariaLabel,\n className,\n iconClassName,\n inactiveIcon,\n inactiveLabel,\n label,\n showInactive = false,\n variant = 'badge',\n}: Readonly<FlagPropertyProps>) {\n if (!active && !showInactive) return null\n\n return (\n <IconLabelProperty\n ariaLabel={ariaLabel}\n className={className}\n icon={active ? activeIcon : inactiveIcon}\n iconClassName={iconClassName}\n label={active ? label : (inactiveLabel ?? label)}\n variant={variant}\n />\n )\n}\n",
|
|
93
93
|
"target": "~/packages/ui/src/patterns/properties/display/flag/flag-property.tsx"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"path": "patterns/properties/display/icon-label/icon-label-property.tsx",
|
|
97
97
|
"type": "registry:file",
|
|
98
|
-
"content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport type
|
|
98
|
+
"content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport {\n PropertySurface,\n type PropertySurfaceProps,\n type PropertyVariant,\n} from '../../shared/property-surface'\n\nexport type IconLabelPropertyTrailingVisibility = 'always' | 'hover'\n\nexport interface IconLabelPropertyProps {\n label: ReactNode\n ariaLabel?: string\n className?: string\n icon?: PropertyIcon\n iconClassName?: string\n leading?: ReactNode\n muted?: boolean\n render?: PropertySurfaceProps['render']\n trailing?: ReactNode\n trailingVisibility?: IconLabelPropertyTrailingVisibility\n variant?: PropertyVariant\n}\n\nexport function IconLabelProperty({\n ariaLabel,\n className,\n icon: Icon,\n iconClassName,\n label,\n leading,\n muted = false,\n render,\n trailing,\n trailingVisibility = 'always',\n variant = 'badge',\n}: Readonly<IconLabelPropertyProps>) {\n const hidesTrailing = Boolean(trailing) && trailingVisibility === 'hover'\n\n return (\n <PropertySurface\n aria-label={\n ariaLabel\n ? `${ariaLabel}: ${typeof label === 'string' ? label : ''}`.trim()\n : undefined\n }\n className={cn('max-w-full', hidesTrailing && 'group/property', className)}\n muted={muted}\n render={render}\n {...(trailing && ariaLabel ? { role: 'group' } : {})}\n variant={variant}\n >\n {leading}\n {Icon ? (\n <Icon\n aria-hidden\n className={cn('size-4', iconClassName)}\n data-slot=\"property-icon\"\n />\n ) : null}\n <span className=\"truncate\">{label}</span>\n {hidesTrailing ? (\n <span\n className=\"pointer-coarse:opacity-100 flex shrink-0 self-stretch items-center opacity-0 transition-opacity group-focus-within/property:opacity-100 group-hover/property:opacity-100\"\n data-slot=\"property-trailing\"\n >\n {trailing}\n </span>\n ) : (\n trailing\n )}\n </PropertySurface>\n )\n}\n",
|
|
99
99
|
"target": "~/packages/ui/src/patterns/properties/display/icon-label/icon-label-property.tsx"
|
|
100
100
|
},
|
|
101
|
+
{
|
|
102
|
+
"path": "patterns/properties/shared/property-catalog.ts",
|
|
103
|
+
"type": "registry:file",
|
|
104
|
+
"content": "import type { IconWeight } from '@phosphor-icons/react'\nimport type { ComboboxPopup } from '@tc96/ui/combobox'\nimport type { PropertyTone } from '@tc96/ui/lib/property-tone'\nimport type { PopoverPopup } from '@tc96/ui/popover'\nimport type { SelectPopup } from '@tc96/ui/select'\nimport type { ComponentProps, ComponentType, SVGProps } from 'react'\n\nexport {\n type PropertyTone,\n propertyToneClassName,\n} from '@tc96/ui/lib/property-tone'\n\nexport type PropertyIcon = ComponentType<\n SVGProps<SVGSVGElement> & { weight?: IconWeight }\n>\n\nexport interface PropertyOption<TValue extends string = string> {\n value: TValue\n label: string\n icon?: PropertyIcon\n tone?: PropertyTone\n weight?: IconWeight\n}\n\nexport interface PropertyChangeContext<TValue> {\n previousValue: TValue\n}\n\nexport interface PropertyListChangeContext<TItem, TValue> {\n added: TItem | null\n previousValue: readonly TValue[]\n removed: TItem | null\n}\n\nexport type PropertySelectDropdownPlacement = Pick<\n ComponentProps<typeof SelectPopup>,\n 'align' | 'alignItemWithTrigger' | 'alignOffset' | 'side' | 'sideOffset'\n>\n\nexport type PropertyMultiSelectDropdownPlacement = Pick<\n ComponentProps<typeof ComboboxPopup>,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n>\n\nexport type PropertyPopoverDropdownPlacement = Pick<\n ComponentProps<typeof PopoverPopup>,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n>\n",
|
|
105
|
+
"target": "~/packages/ui/src/patterns/properties/shared/property-catalog.ts"
|
|
106
|
+
},
|
|
101
107
|
{
|
|
102
108
|
"path": "patterns/properties/shared/property-surface.tsx",
|
|
103
109
|
"type": "registry:file",
|
|
@@ -163,9 +169,13 @@
|
|
|
163
169
|
"@ui/button",
|
|
164
170
|
"@ui/card",
|
|
165
171
|
"@ui/collapsible",
|
|
172
|
+
"@ui/combobox",
|
|
166
173
|
"@ui/empty",
|
|
167
174
|
"@ui/icon-frame",
|
|
168
175
|
"@ui/menu",
|
|
176
|
+
"@ui/popover",
|
|
177
|
+
"@ui/property-tone",
|
|
178
|
+
"@ui/select",
|
|
169
179
|
"@ui/skeleton",
|
|
170
180
|
"@ui/text"
|
|
171
181
|
],
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "settings-
|
|
2
|
+
"name": "settings-catalog-9",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/catalog/settings-catalog-9/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsCatalog9 } from './settings-catalog-9'\nexport type {\n SettingsCatalog9Action,\n SettingsCatalog9Category,\n SettingsCatalog9Direction,\n SettingsCatalog9Labels,\n SettingsCatalog9Props,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-9/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/catalog/settings-catalog-9/labels.ts",
|
|
13
13
|
"type": "registry:file",
|
|
14
|
-
"content": "import { defaultSettingsLoadLabels } from '
|
|
15
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../../shared/labels'\nimport type { SettingsCatalog9Direction, SettingsCatalog9Labels } from './types'\n\nconst directionLabels: Record<SettingsCatalog9Direction, string> = {\n expense: 'Despesa',\n income: 'Receita',\n}\n\nexport const defaultSettingsCatalog9Labels: SettingsCatalog9Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar as categorias',\n loading: 'Carregando categorias',\n actions: (name) => `Ações de ${name}`,\n addSubcategory: 'Adicionar subcategoria',\n archive: 'Arquivar',\n archived: 'Arquivadas',\n description:\n 'Como os lançamentos são classificados: honorários, custas, despesas.',\n direction: (direction) => directionLabels[direction],\n edit: 'Editar',\n emptyDescription: 'Crie uma categoria para classificar receitas e despesas.',\n emptyTitle: 'Nenhuma categoria ainda',\n entries: (count) => `${count} ${count === 1 ? 'lançamento' : 'lançamentos'}`,\n newCategory: 'Nova categoria',\n restore: 'Restaurar',\n subcategoryOf: (parent) => `Subcategoria de ${parent}`,\n title: 'Categorias',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-9/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/catalog/settings-catalog-9/settings-catalog-9-skeleton.tsx",
|
|
19
19
|
"type": "registry:file",
|
|
20
|
-
"content": "import { SettingsRowsSkeleton } from '
|
|
21
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../../shared/settings-skeleton'\n\nexport function SettingsCatalog9Skeleton() {\n return <SettingsRowsSkeleton count={4} description={false} end=\"menu\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-9/settings-catalog-9-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/catalog/settings-catalog-9/settings-catalog-9.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import { ArrowElbowDownRightIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { IconLabelProperty } from '@tc96/ui/patterns/properties/display/icon-label/icon-label-property'\nimport { SettingsCollapsed } from '@tc96/ui/patterns/surfaces/settings/composition/settings-collapsed/settings-collapsed'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '
|
|
27
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
26
|
+
"content": "import { ArrowElbowDownRightIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { IconLabelProperty } from '@tc96/ui/patterns/properties/display/icon-label/icon-label-property'\nimport { SettingsCollapsed } from '@tc96/ui/patterns/surfaces/settings/composition/settings-collapsed/settings-collapsed'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '../../shared/settings-load-state'\nimport { SettingsRowActions } from '../../shared/settings-row-actions'\nimport { SettingsSwatch } from '../../shared/settings-swatch'\nimport { defaultSettingsCatalog9Labels } from './labels'\nimport { SettingsCatalog9Skeleton } from './settings-catalog-9-skeleton'\nimport type {\n SettingsCatalog9Action,\n SettingsCatalog9Category,\n SettingsCatalog9Direction,\n SettingsCatalog9Labels,\n SettingsCatalog9Props,\n} from './types'\n\nconst directionDots: Record<SettingsCatalog9Direction, string> = {\n expense: 'bg-red-700 dark:bg-red-500',\n income: 'bg-green-700 dark:bg-green-500',\n}\n\ninterface CategoryRowProps {\n archived?: boolean\n category: SettingsCatalog9Category\n labels: SettingsCatalog9Labels\n onCategoryAction?: SettingsCatalog9Props['onCategoryAction']\n parent?: string\n}\n\nfunction CategoryRow({\n archived,\n category,\n labels,\n onCategoryAction,\n parent,\n}: Readonly<CategoryRowProps>) {\n const actions = archived\n ? [{ id: 'restore', label: labels.restore }]\n : [\n { id: 'edit', label: labels.edit },\n ...(parent\n ? []\n : [{ id: 'add-subcategory', label: labels.addSubcategory }]),\n { destructive: true, id: 'archive', label: labels.archive },\n ]\n\n return (\n <SettingsRow\n className={parent ? 'ps-2' : undefined}\n description={parent ? labels.subcategoryOf(parent) : undefined}\n endSlot={\n <div className=\"flex items-center gap-3\">\n <Text\n foreground=\"muted\"\n render={<span>{labels.entries(category.entries)}</span>}\n size=\"sm\"\n />\n {parent ? null : (\n <IconLabelProperty\n label={labels.direction(category.direction)}\n leading={\n <SettingsSwatch\n className={cn('size-2', directionDots[category.direction])}\n />\n }\n />\n )}\n {onCategoryAction ? (\n <SettingsRowActions\n actions={actions}\n label={labels.actions(category.name)}\n onAction={(action) =>\n onCategoryAction(category.id, action as SettingsCatalog9Action)\n }\n />\n ) : null}\n </div>\n }\n startSlot={\n parent ? (\n <ArrowElbowDownRightIcon\n aria-hidden=\"true\"\n className=\"text-muted-foreground\"\n />\n ) : undefined\n }\n title={category.name}\n />\n )\n}\n\nfunction categoryRows(\n list: SettingsCatalog9Category[],\n labels: SettingsCatalog9Labels,\n onCategoryAction: SettingsCatalog9Props['onCategoryAction'],\n archived?: boolean,\n) {\n return list.flatMap((category) => [\n <CategoryRow\n archived={archived}\n category={category}\n key={category.id}\n labels={labels}\n onCategoryAction={onCategoryAction}\n />,\n ...(category.subcategories ?? []).map((subcategory) => (\n <CategoryRow\n archived={archived}\n category={subcategory}\n key={subcategory.id}\n labels={labels}\n onCategoryAction={onCategoryAction}\n parent={category.name}\n />\n )),\n ])\n}\n\nexport function SettingsCatalog9({\n error,\n onRetry,\n pending,\n archivedCategories = [],\n categories,\n className,\n labels: labelsProp,\n onCategoryAction,\n onCreate,\n}: Readonly<SettingsCatalog9Props>) {\n const labels = { ...defaultSettingsCatalog9Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsCatalog9Skeleton />,\n })\n\n return (\n <SettingsSection\n className={cn('mx-auto w-full max-w-2xl', className)}\n header={\n <SettingsSectionHeader\n actions={\n onCreate ? (\n <Button onClick={onCreate} size=\"sm\">\n {labels.newCategory}\n </Button>\n ) : undefined\n }\n >\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.description}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <>\n {categories.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n categoryRows(categories, labels, onCategoryAction)\n )}\n {archivedCategories.length > 0 ? (\n <div>\n <SettingsCollapsed defaultOpen={false} title={labels.archived}>\n {categoryRows(\n archivedCategories,\n labels,\n onCategoryAction,\n true,\n )}\n </SettingsCollapsed>\n </div>\n ) : null}\n </>\n )}\n </SettingsSection>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-9/settings-catalog-9.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/catalog/settings-catalog-9/types.ts",
|
|
31
31
|
"type": "registry:file",
|
|
32
|
-
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '
|
|
33
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
32
|
+
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '../../shared/types'\nexport type SettingsCatalog9Direction = 'income' | 'expense'\n\nexport interface SettingsCatalog9Category {\n direction: SettingsCatalog9Direction\n entries: number\n id: string\n name: string\n subcategories?: SettingsCatalog9Category[]\n}\n\nexport interface SettingsCatalog9Labels extends SettingsLoadLabels {\n actions: (name: string) => string\n addSubcategory: string\n archive: string\n archived: string\n description: string\n direction: (direction: SettingsCatalog9Direction) => string\n edit: string\n emptyDescription: string\n emptyTitle: string\n entries: (count: number) => string\n newCategory: string\n restore: string\n subcategoryOf: (parent: string) => string\n title: string\n}\n\nexport type SettingsCatalog9Action =\n | 'edit'\n | 'add-subcategory'\n | 'archive'\n | 'restore'\n\nexport interface SettingsCatalog9Props extends SettingsLoadProps {\n archivedCategories?: SettingsCatalog9Category[]\n categories: SettingsCatalog9Category[]\n className?: string\n labels?: Partial<SettingsCatalog9Labels>\n onCategoryAction?: (\n categoryId: string,\n action: SettingsCatalog9Action,\n ) => void\n onCreate?: () => void\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-9/types.ts"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"path": "blocks/application/settings/shared/labels.ts",
|
|
@@ -65,15 +65,21 @@
|
|
|
65
65
|
{
|
|
66
66
|
"path": "blocks/application/settings/shared/types.ts",
|
|
67
67
|
"type": "registry:file",
|
|
68
|
-
"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",
|
|
68
|
+
"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\nexport interface SettingsAppLogoData {\n svg: string\n title?: string\n}\n",
|
|
69
69
|
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"path": "patterns/properties/display/icon-label/icon-label-property.tsx",
|
|
73
73
|
"type": "registry:file",
|
|
74
|
-
"content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport type
|
|
74
|
+
"content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport {\n PropertySurface,\n type PropertySurfaceProps,\n type PropertyVariant,\n} from '../../shared/property-surface'\n\nexport type IconLabelPropertyTrailingVisibility = 'always' | 'hover'\n\nexport interface IconLabelPropertyProps {\n label: ReactNode\n ariaLabel?: string\n className?: string\n icon?: PropertyIcon\n iconClassName?: string\n leading?: ReactNode\n muted?: boolean\n render?: PropertySurfaceProps['render']\n trailing?: ReactNode\n trailingVisibility?: IconLabelPropertyTrailingVisibility\n variant?: PropertyVariant\n}\n\nexport function IconLabelProperty({\n ariaLabel,\n className,\n icon: Icon,\n iconClassName,\n label,\n leading,\n muted = false,\n render,\n trailing,\n trailingVisibility = 'always',\n variant = 'badge',\n}: Readonly<IconLabelPropertyProps>) {\n const hidesTrailing = Boolean(trailing) && trailingVisibility === 'hover'\n\n return (\n <PropertySurface\n aria-label={\n ariaLabel\n ? `${ariaLabel}: ${typeof label === 'string' ? label : ''}`.trim()\n : undefined\n }\n className={cn('max-w-full', hidesTrailing && 'group/property', className)}\n muted={muted}\n render={render}\n {...(trailing && ariaLabel ? { role: 'group' } : {})}\n variant={variant}\n >\n {leading}\n {Icon ? (\n <Icon\n aria-hidden\n className={cn('size-4', iconClassName)}\n data-slot=\"property-icon\"\n />\n ) : null}\n <span className=\"truncate\">{label}</span>\n {hidesTrailing ? (\n <span\n className=\"pointer-coarse:opacity-100 flex shrink-0 self-stretch items-center opacity-0 transition-opacity group-focus-within/property:opacity-100 group-hover/property:opacity-100\"\n data-slot=\"property-trailing\"\n >\n {trailing}\n </span>\n ) : (\n trailing\n )}\n </PropertySurface>\n )\n}\n",
|
|
75
75
|
"target": "~/packages/ui/src/patterns/properties/display/icon-label/icon-label-property.tsx"
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/properties/shared/property-catalog.ts",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "import type { IconWeight } from '@phosphor-icons/react'\nimport type { ComboboxPopup } from '@tc96/ui/combobox'\nimport type { PropertyTone } from '@tc96/ui/lib/property-tone'\nimport type { PopoverPopup } from '@tc96/ui/popover'\nimport type { SelectPopup } from '@tc96/ui/select'\nimport type { ComponentProps, ComponentType, SVGProps } from 'react'\n\nexport {\n type PropertyTone,\n propertyToneClassName,\n} from '@tc96/ui/lib/property-tone'\n\nexport type PropertyIcon = ComponentType<\n SVGProps<SVGSVGElement> & { weight?: IconWeight }\n>\n\nexport interface PropertyOption<TValue extends string = string> {\n value: TValue\n label: string\n icon?: PropertyIcon\n tone?: PropertyTone\n weight?: IconWeight\n}\n\nexport interface PropertyChangeContext<TValue> {\n previousValue: TValue\n}\n\nexport interface PropertyListChangeContext<TItem, TValue> {\n added: TItem | null\n previousValue: readonly TValue[]\n removed: TItem | null\n}\n\nexport type PropertySelectDropdownPlacement = Pick<\n ComponentProps<typeof SelectPopup>,\n 'align' | 'alignItemWithTrigger' | 'alignOffset' | 'side' | 'sideOffset'\n>\n\nexport type PropertyMultiSelectDropdownPlacement = Pick<\n ComponentProps<typeof ComboboxPopup>,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n>\n\nexport type PropertyPopoverDropdownPlacement = Pick<\n ComponentProps<typeof PopoverPopup>,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n>\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/properties/shared/property-catalog.ts"
|
|
82
|
+
},
|
|
77
83
|
{
|
|
78
84
|
"path": "patterns/properties/shared/property-surface.tsx",
|
|
79
85
|
"type": "registry:file",
|
|
@@ -139,9 +145,13 @@
|
|
|
139
145
|
"@ui/button",
|
|
140
146
|
"@ui/card",
|
|
141
147
|
"@ui/collapsible",
|
|
148
|
+
"@ui/combobox",
|
|
142
149
|
"@ui/empty",
|
|
143
150
|
"@ui/icon-frame",
|
|
144
151
|
"@ui/menu",
|
|
152
|
+
"@ui/popover",
|
|
153
|
+
"@ui/property-tone",
|
|
154
|
+
"@ui/select",
|
|
145
155
|
"@ui/skeleton",
|
|
146
156
|
"@ui/text"
|
|
147
157
|
],
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "settings-
|
|
2
|
+
"name": "settings-integration-1",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/integration/settings-integration-1/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsIntegration1 } from './settings-integration-1'\nexport type {\n SettingsIntegration1Action,\n SettingsIntegration1Endpoint,\n SettingsIntegration1Labels,\n SettingsIntegration1Props,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-1/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/integration/settings-integration-1/labels.ts",
|
|
13
13
|
"type": "registry:file",
|
|
14
|
-
"content": "import { defaultSettingsLoadLabels } from '
|
|
15
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../../shared/labels'\nimport type { SettingsIntegration1Labels } from './types'\n\nexport const defaultSettingsIntegration1Labels: SettingsIntegration1Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar os webhooks',\n loading: 'Carregando webhooks',\n actions: (url) => `Ações de ${url}`,\n delete: 'Excluir',\n description: 'Receba eventos do workspace em URLs que você controla.',\n edit: 'Editar',\n emptyDescription: 'Crie um endpoint para receber eventos por HTTP.',\n emptyTitle: 'Nenhum endpoint ainda',\n enable: (url) => `Ativar ${url}`,\n eventCount: (count) => `${count} ${count === 1 ? 'evento' : 'eventos'}`,\n failing: 'Falhando',\n failingDescription: (count) =>\n count === 1\n ? 'Um endpoint não está recebendo as entregas.'\n : `${count} endpoints não estão recebendo as entregas.`,\n failingTitle: 'Entregas com falha',\n lastDelivery: (value) => `Última entrega ${value}`,\n newEndpoint: 'Novo endpoint',\n sendTest: 'Enviar teste',\n title: 'Webhooks',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-1/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/integration/settings-integration-1/settings-integration-1-skeleton.tsx",
|
|
19
19
|
"type": "registry:file",
|
|
20
|
-
"content": "import { SettingsRowsSkeleton } from '
|
|
21
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../../shared/settings-skeleton'\n\nexport function SettingsIntegration1Skeleton() {\n return <SettingsRowsSkeleton count={3} end=\"switch\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-1/settings-integration-1-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/integration/settings-integration-1/settings-integration-1.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import { WarningIcon } from '@phosphor-icons/react'\nimport { Alert, AlertDescription, AlertTitle } from '@tc96/ui/alert'\nimport { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { Switch } from '@tc96/ui/switch'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '
|
|
27
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
26
|
+
"content": "import { WarningIcon } from '@phosphor-icons/react'\nimport { Alert, AlertDescription, AlertTitle } from '@tc96/ui/alert'\nimport { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { Switch } from '@tc96/ui/switch'\nimport { cn } from '@tc96/utils'\nimport { settingsLoadState } from '../../shared/settings-load-state'\nimport { SettingsRowActions } from '../../shared/settings-row-actions'\nimport { defaultSettingsIntegration1Labels } from './labels'\nimport { SettingsIntegration1Skeleton } from './settings-integration-1-skeleton'\nimport type {\n SettingsIntegration1Action,\n SettingsIntegration1Endpoint,\n SettingsIntegration1Labels,\n SettingsIntegration1Props,\n} from './types'\n\ninterface EndpointRowProps {\n endpoint: SettingsIntegration1Endpoint\n labels: SettingsIntegration1Labels\n onEnabledChange?: SettingsIntegration1Props['onEnabledChange']\n onEndpointAction?: SettingsIntegration1Props['onEndpointAction']\n}\n\nfunction EndpointRow({\n endpoint,\n labels,\n onEnabledChange,\n onEndpointAction,\n}: Readonly<EndpointRowProps>) {\n return (\n <SettingsRow\n description={`${labels.eventCount(endpoint.events)} · ${labels.lastDelivery(endpoint.lastDelivery)}`}\n endSlot={\n <div className=\"flex items-center gap-3\">\n {endpoint.failing ? (\n <Badge variant=\"error\">{labels.failing}</Badge>\n ) : null}\n <Switch\n aria-label={labels.enable(endpoint.url)}\n checked={endpoint.enabled}\n onCheckedChange={(next) => onEnabledChange?.(endpoint.id, next)}\n />\n {onEndpointAction ? (\n <SettingsRowActions\n actions={[\n { id: 'edit', label: labels.edit },\n { id: 'send-test', label: labels.sendTest },\n { destructive: true, id: 'delete', label: labels.delete },\n ]}\n label={labels.actions(endpoint.url)}\n onAction={(action) =>\n onEndpointAction(\n endpoint.id,\n action as SettingsIntegration1Action,\n )\n }\n />\n ) : null}\n </div>\n }\n title={endpoint.url}\n />\n )\n}\n\nexport function SettingsIntegration1({\n error,\n onRetry,\n pending,\n className,\n endpoints,\n labels: labelsProp,\n onCreate,\n onEnabledChange,\n onEndpointAction,\n}: Readonly<SettingsIntegration1Props>) {\n const labels = { ...defaultSettingsIntegration1Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsIntegration1Skeleton />,\n })\n const failingCount = endpoints.filter((endpoint) => endpoint.failing).length\n\n return (\n <div\n className={cn('mx-auto flex w-full max-w-2xl flex-col gap-4', className)}\n >\n {!loadState && failingCount > 0 ? (\n <Alert variant=\"error\">\n <WarningIcon aria-hidden=\"true\" />\n <AlertTitle>{labels.failingTitle}</AlertTitle>\n <AlertDescription>\n {labels.failingDescription(failingCount)}\n </AlertDescription>\n </Alert>\n ) : null}\n <SettingsSection\n header={\n <SettingsSectionHeader\n actions={\n onCreate ? (\n <Button onClick={onCreate} size=\"sm\">\n {labels.newEndpoint}\n </Button>\n ) : undefined\n }\n >\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.description}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {loadState ??\n (endpoints.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n endpoints.map((endpoint) => (\n <EndpointRow\n endpoint={endpoint}\n key={endpoint.id}\n labels={labels}\n onEnabledChange={onEnabledChange}\n onEndpointAction={onEndpointAction}\n />\n ))\n ))}\n </SettingsSection>\n </div>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-1/settings-integration-1.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/integration/settings-integration-1/types.ts",
|
|
31
31
|
"type": "registry:file",
|
|
32
|
-
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '
|
|
33
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
32
|
+
"content": "import type { SettingsLoadLabels, SettingsLoadProps } from '../../shared/types'\nexport interface SettingsIntegration1Endpoint {\n enabled: boolean\n events: number\n failing?: boolean\n id: string\n lastDelivery: string\n url: string\n}\n\nexport type SettingsIntegration1Action = 'edit' | 'send-test' | 'delete'\n\nexport interface SettingsIntegration1Labels extends SettingsLoadLabels {\n actions: (url: string) => string\n delete: string\n description: string\n edit: string\n emptyDescription: string\n emptyTitle: string\n enable: (url: string) => string\n eventCount: (count: number) => string\n failing: string\n failingDescription: (count: number) => string\n failingTitle: string\n lastDelivery: (value: string) => string\n newEndpoint: string\n sendTest: string\n title: string\n}\n\nexport interface SettingsIntegration1Props extends SettingsLoadProps {\n className?: string\n endpoints: SettingsIntegration1Endpoint[]\n labels?: Partial<SettingsIntegration1Labels>\n onCreate?: () => void\n onEnabledChange?: (endpointId: string, enabled: boolean) => void\n onEndpointAction?: (\n endpointId: string,\n action: SettingsIntegration1Action,\n ) => void\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-1/types.ts"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"path": "blocks/application/settings/shared/labels.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
{
|
|
60
60
|
"path": "blocks/application/settings/shared/types.ts",
|
|
61
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",
|
|
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\nexport interface SettingsAppLogoData {\n svg: string\n title?: string\n}\n",
|
|
63
63
|
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "settings-integration-2",
|
|
3
|
+
"type": "registry:block",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "blocks/application/settings/integration/settings-integration-2/index.ts",
|
|
7
|
+
"type": "registry:file",
|
|
8
|
+
"content": "export { SettingsIntegration2 } from './settings-integration-2'\nexport type {\n SettingsIntegration2App,\n SettingsIntegration2Labels,\n SettingsIntegration2Props,\n SettingsIntegration2Status,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-2/index.ts"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "blocks/application/settings/integration/settings-integration-2/labels.ts",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"content": "import { defaultSettingsLoadLabels } from '../../shared/labels'\nimport type { SettingsIntegration2Labels } from './types'\n\nexport const defaultSettingsIntegration2Labels: SettingsIntegration2Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar os aplicativos',\n loading: 'Carregando aplicativos',\n connect: 'Conectar',\n connectAction: (name) => `Conectar ${name}`,\n connected: 'Conectado',\n description: 'Gerencie os aplicativos conectados ao seu espaço de trabalho.',\n disconnect: 'Desconectar',\n disconnectAction: (name) => `Desconectar ${name}`,\n disconnected: 'Desconectado',\n emptyDescription: 'Os aplicativos disponíveis para conexão aparecem aqui.',\n emptyTitle: 'Nenhum aplicativo disponível',\n error: 'Erro',\n reconnect: 'Reconectar',\n reconnectAction: (name) => `Reconectar ${name}`,\n title: 'Aplicativos conectados',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-2/labels.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "blocks/application/settings/integration/settings-integration-2/settings-integration-2-skeleton.tsx",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"content": "import { SettingsRowsSkeleton } from '../../shared/settings-skeleton'\n\nexport function SettingsIntegration2Skeleton() {\n return <SettingsRowsSkeleton count={4} start=\"avatar\" end=\"button\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-2/settings-integration-2-skeleton.tsx"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "blocks/application/settings/integration/settings-integration-2/settings-integration-2.tsx",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"content": "import { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\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 { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { cn } from '@tc96/utils'\nimport { SettingsAppLogo } from '../../shared/settings-app-logo'\nimport { settingsLoadState } from '../../shared/settings-load-state'\nimport { defaultSettingsIntegration2Labels } from './labels'\nimport { SettingsIntegration2Skeleton } from './settings-integration-2-skeleton'\nimport type {\n SettingsIntegration2App,\n SettingsIntegration2Labels,\n SettingsIntegration2Props,\n} from './types'\n\nconst statusBadge = {\n connected: { key: 'connected', variant: 'success' },\n disconnected: { key: 'disconnected', variant: 'secondary' },\n error: { key: 'error', variant: 'error' },\n} as const\n\ninterface AppRowProps {\n app: SettingsIntegration2App\n labels: SettingsIntegration2Labels\n onConnect?: SettingsIntegration2Props['onConnect']\n onDisconnect?: SettingsIntegration2Props['onDisconnect']\n}\n\nfunction AppRow({\n app,\n labels,\n onConnect,\n onDisconnect,\n}: Readonly<AppRowProps>) {\n const badge = statusBadge[app.status]\n\n return (\n <SettingsRow\n description={app.description}\n endSlot={\n <div className=\"flex items-center gap-3\">\n <Badge variant={badge.variant}>{labels[badge.key]}</Badge>\n {app.status === 'connected' ? (\n onDisconnect ? (\n <Button\n aria-label={labels.disconnectAction(app.name)}\n onClick={() => onDisconnect(app.id)}\n size=\"sm\"\n variant=\"outline\"\n >\n {labels.disconnect}\n </Button>\n ) : null\n ) : onConnect ? (\n <Button\n aria-label={\n app.status === 'error'\n ? labels.reconnectAction(app.name)\n : labels.connectAction(app.name)\n }\n onClick={() => onConnect(app.id)}\n size=\"sm\"\n variant={app.status === 'error' ? 'outline' : 'default'}\n >\n {app.status === 'error' ? labels.reconnect : labels.connect}\n </Button>\n ) : null}\n </div>\n }\n startSlot={<SettingsAppLogo logo={app.logo} name={app.name} />}\n title={app.name}\n />\n )\n}\n\nexport function SettingsIntegration2({\n error,\n onRetry,\n pending,\n apps,\n className,\n labels: labelsProp,\n onConnect,\n onDisconnect,\n}: Readonly<SettingsIntegration2Props>) {\n const labels = { ...defaultSettingsIntegration2Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsIntegration2Skeleton />,\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 <SettingsSectionDescription>\n {labels.description}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {loadState ??\n (apps.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n apps.map((app) => (\n <AppRow\n app={app}\n key={app.id}\n labels={labels}\n onConnect={onConnect}\n onDisconnect={onDisconnect}\n />\n ))\n ))}\n </SettingsSection>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-2/settings-integration-2.tsx"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "blocks/application/settings/integration/settings-integration-2/types.ts",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"content": "import type {\n SettingsAppLogoData,\n SettingsLoadLabels,\n SettingsLoadProps,\n} from '../../shared/types'\nexport type SettingsIntegration2Status = 'connected' | 'disconnected' | 'error'\n\nexport interface SettingsIntegration2App {\n logo?: SettingsAppLogoData\n description: string\n id: string\n name: string\n status: SettingsIntegration2Status\n}\n\nexport interface SettingsIntegration2Labels extends SettingsLoadLabels {\n connect: string\n connectAction: (name: string) => string\n connected: string\n description: string\n disconnect: string\n disconnectAction: (name: string) => string\n disconnected: string\n emptyDescription: string\n emptyTitle: string\n error: string\n reconnect: string\n reconnectAction: (name: string) => string\n title: string\n}\n\nexport interface SettingsIntegration2Props extends SettingsLoadProps {\n apps: SettingsIntegration2App[]\n className?: string\n labels?: Partial<SettingsIntegration2Labels>\n onConnect?: (appId: string) => void\n onDisconnect?: (appId: string) => void\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/integration/settings-integration-2/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-app-logo.tsx",
|
|
43
|
+
"type": "registry:file",
|
|
44
|
+
"content": "import { IconFrame } from '@tc96/ui/icon-frame'\nimport type { SettingsAppLogoData } from './types'\n\nconst initials = (name: string) =>\n name\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((word) => word.charAt(0).toUpperCase())\n .join('')\n\nexport function SettingsAppLogo({\n logo,\n name,\n}: Readonly<{ logo?: SettingsAppLogoData; name: string }>) {\n return (\n <IconFrame shape=\"rounded\" size=\"lg\">\n {logo ? (\n <img\n alt=\"\"\n className=\"size-6\"\n src={`data:image/svg+xml;charset=utf-8,${encodeURIComponent(logo.svg)}`}\n />\n ) : (\n initials(name)\n )}\n </IconFrame>\n )\n}\n",
|
|
45
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-app-logo.tsx"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "blocks/application/settings/shared/settings-load-state.tsx",
|
|
49
|
+
"type": "registry:file",
|
|
50
|
+
"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",
|
|
51
|
+
"target": "~/packages/ui/src/blocks/application/settings/shared/settings-load-state.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\nexport interface SettingsAppLogoData {\n svg: string\n title?: string\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/badge",
|
|
114
|
+
"@ui/button",
|
|
115
|
+
"@ui/card",
|
|
116
|
+
"@ui/empty",
|
|
117
|
+
"@ui/icon-frame",
|
|
118
|
+
"@ui/skeleton",
|
|
119
|
+
"@ui/text"
|
|
120
|
+
],
|
|
121
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json"
|
|
122
|
+
}
|