@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-4",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/catalog/settings-catalog-4/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsCatalog4 } from './settings-catalog-4'\nexport type {\n SettingsCatalog4Action,\n SettingsCatalog4Labels,\n SettingsCatalog4Phase,\n SettingsCatalog4Props,\n SettingsCatalog4Stage,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-4/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/catalog/settings-catalog-4/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 { SettingsCatalog4Labels } from './types'\n\nexport const defaultSettingsCatalog4Labels: SettingsCatalog4Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar as etapas',\n loading: 'Carregando etapas',\n actions: (name) => `Ações de ${name}`,\n cancel: 'Cancelar',\n createStage: 'Criar etapa',\n delete: 'Excluir',\n description: 'Etapas são os passos que um lead percorre, agrupadas por fase',\n dialogAncestor: 'Etapas do funil',\n dialogTitle: 'Nova etapa',\n edit: 'Editar',\n moveDown: 'Mover para baixo',\n moveUp: 'Mover para cima',\n newStage: 'Nova etapa',\n phase: 'Fase',\n stageDescription: (leads, phaseLabel, closed) => {\n const count =\n leads === 0 ? undefined : `${leads} ${leads === 1 ? 'lead' : 'leads'}`\n if (!closed) return count\n const closes = `Fecha como ${phaseLabel.toLowerCase()}`\n return count ? `${count} · ${closes}` : closes\n },\n stageName: 'Nome da etapa',\n title: 'Etapas do funil',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-4/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/catalog/settings-catalog-4/settings-catalog-4-skeleton.tsx",
|
|
19
19
|
"type": "registry:file",
|
|
20
|
-
"content": "import {\n SettingsCollapsedSkeleton,\n SettingsRowsSkeleton,\n} from '
|
|
21
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
20
|
+
"content": "import {\n SettingsCollapsedSkeleton,\n SettingsRowsSkeleton,\n} from '../../shared/settings-skeleton'\n\nexport function SettingsCatalog4Skeleton() {\n return (\n <>\n <SettingsCollapsedSkeleton key=\"group-0\">\n <SettingsRowsSkeleton count={3} description={false} end=\"menu\" />\n </SettingsCollapsedSkeleton>\n <SettingsCollapsedSkeleton key=\"group-1\">\n <SettingsRowsSkeleton count={3} description={false} end=\"menu\" />\n </SettingsCollapsedSkeleton>\n </>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-4/settings-catalog-4-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/catalog/settings-catalog-4/settings-catalog-4.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import { DotsThreeIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { Menu, MenuItem, MenuPopup, MenuTrigger } from '@tc96/ui/menu'\nimport { SelectProperty } from '@tc96/ui/patterns/properties/display/select/select-property'\nimport { RecordDialog } from '@tc96/ui/patterns/records/dialog/composition/record-dialog/record-dialog'\nimport { RecordDialogHeadline } from '@tc96/ui/patterns/records/dialog/composition/record-dialog/record-dialog-headline'\nimport { RecordGroup } from '@tc96/ui/patterns/records/group/composition/record-group/record-group'\nimport { RecordGroupItem } from '@tc96/ui/patterns/records/group/composition/record-group-item/record-group-item'\nimport { RecordGroupRow } from '@tc96/ui/patterns/records/group/composition/record-group-row/record-group-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 { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { settingsLoadState } from '
|
|
27
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
26
|
+
"content": "import { DotsThreeIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { Menu, MenuItem, MenuPopup, MenuTrigger } from '@tc96/ui/menu'\nimport { SelectProperty } from '@tc96/ui/patterns/properties/display/select/select-property'\nimport { RecordDialog } from '@tc96/ui/patterns/records/dialog/composition/record-dialog/record-dialog'\nimport { RecordDialogHeadline } from '@tc96/ui/patterns/records/dialog/composition/record-dialog/record-dialog-headline'\nimport { RecordGroup } from '@tc96/ui/patterns/records/group/composition/record-group/record-group'\nimport { RecordGroupItem } from '@tc96/ui/patterns/records/group/composition/record-group-item/record-group-item'\nimport { RecordGroupRow } from '@tc96/ui/patterns/records/group/composition/record-group-row/record-group-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 { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { settingsLoadState } from '../../shared/settings-load-state'\nimport { defaultSettingsCatalog4Labels } from './labels'\nimport { SettingsCatalog4Skeleton } from './settings-catalog-4-skeleton'\nimport type {\n SettingsCatalog4Action,\n SettingsCatalog4Labels,\n SettingsCatalog4Phase,\n SettingsCatalog4Props,\n SettingsCatalog4Stage,\n} from './types'\n\ninterface StageItemProps {\n first: boolean\n labels: SettingsCatalog4Labels\n last: boolean\n onStageAction?: SettingsCatalog4Props['onStageAction']\n phase: SettingsCatalog4Phase\n stage: SettingsCatalog4Stage\n}\n\nfunction StageItem({\n first,\n labels,\n last,\n onStageAction,\n phase,\n stage,\n}: Readonly<StageItemProps>) {\n const { icon: Icon, name, tone } = stage\n const description = labels.stageDescription(\n stage.leads,\n phase.label,\n phase.closed === true,\n )\n const run = (action: SettingsCatalog4Action) =>\n onStageAction?.(stage.id, action)\n\n return (\n <RecordGroupItem\n leading={<Icon aria-hidden=\"true\" className={tone} />}\n title={name}\n >\n <div className=\"flex min-w-0 items-center gap-3\">\n {description ? (\n <Text\n className=\"truncate\"\n foreground=\"muted\"\n render={<span>{description}</span>}\n size=\"sm\"\n />\n ) : null}\n {onStageAction ? (\n <Menu>\n <MenuTrigger\n aria-label={labels.actions(name)}\n render={<Button size=\"icon-sm\" variant=\"ghost\" />}\n >\n <DotsThreeIcon aria-hidden=\"true\" />\n </MenuTrigger>\n <MenuPopup align=\"end\">\n <MenuItem onClick={() => run('edit')}>{labels.edit}</MenuItem>\n {stage.locked ? null : (\n <>\n <MenuItem disabled={first} onClick={() => run('move-up')}>\n {labels.moveUp}\n </MenuItem>\n <MenuItem disabled={last} onClick={() => run('move-down')}>\n {labels.moveDown}\n </MenuItem>\n <MenuItem onClick={() => run('delete')} variant=\"destructive\">\n {labels.delete}\n </MenuItem>\n </>\n )}\n </MenuPopup>\n </Menu>\n ) : null}\n </div>\n </RecordGroupItem>\n )\n}\n\ninterface NewStageDialogProps {\n labels: SettingsCatalog4Labels\n names: string[]\n onCreate?: SettingsCatalog4Props['onStageCreate']\n onOpenChange: (open: boolean) => void\n open: boolean\n phases: SettingsCatalog4Phase[]\n}\n\nfunction NewStageDialog({\n labels,\n names,\n onCreate,\n onOpenChange,\n open,\n phases,\n}: Readonly<NewStageDialogProps>) {\n const defaultPhase = phases[0]?.id ?? ''\n const [name, setName] = useState('')\n const [phase, setPhase] = useState(defaultPhase)\n const trimmed = name.trim()\n const taken = names.some(\n (existing) => existing.toLowerCase() === trimmed.toLowerCase(),\n )\n const options = phases.map((item) => ({ label: item.label, value: item.id }))\n\n const reset = () => {\n setName('')\n setPhase(defaultPhase)\n }\n\n return (\n <RecordDialog\n cancelLabel={labels.cancel}\n onOpenChange={(next) => {\n onOpenChange(next)\n if (!next) reset()\n }}\n onSubmit={() => {\n if (trimmed === '' || taken) return false\n onCreate?.(trimmed, phase)\n reset()\n return true\n }}\n open={open}\n size=\"small\"\n submitDisabled={trimmed === '' || taken}\n submitLabel={labels.createStage}\n submitOnModEnter\n title={labels.dialogTitle}\n titleAncestor={labels.dialogAncestor}\n >\n <div className=\"grid gap-4\">\n <RecordDialogHeadline\n onTitleChange={setName}\n title={name}\n titleLabel={labels.stageName}\n titlePlaceholder={labels.stageName}\n />\n <div>\n <RecordGroupRow label={labels.phase}>\n <SelectProperty\n ariaLabel={labels.phase}\n onValueChange={(value) => {\n if (value) setPhase(value)\n }}\n options={options}\n value={phase}\n />\n </RecordGroupRow>\n </div>\n </div>\n </RecordDialog>\n )\n}\n\nexport function SettingsCatalog4({\n error,\n onRetry,\n pending,\n className,\n labels: labelsProp,\n onStageAction,\n onStageCreate,\n phases,\n stages,\n}: Readonly<SettingsCatalog4Props>) {\n const labels = { ...defaultSettingsCatalog4Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsCatalog4Skeleton />,\n })\n const [creating, setCreating] = useState(false)\n\n return (\n <main className={cn('mx-auto w-full max-w-2xl', className)}>\n <SettingsSection\n header={\n <SettingsSectionHeader\n actions={\n onStageCreate ? (\n <Button onClick={() => setCreating(true)} size=\"sm\">\n {labels.newStage}\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 <div className=\"flex flex-col gap-3 py-4\">\n {phases.map((phase) => {\n const group = stages.filter((stage) => stage.phase === phase.id)\n return (\n <RecordGroup key={phase.id} title={phase.label}>\n {group.map((stage, index) => (\n <StageItem\n first={index === 0}\n key={stage.id}\n labels={labels}\n last={index === group.length - 1}\n onStageAction={onStageAction}\n phase={phase}\n stage={stage}\n />\n ))}\n </RecordGroup>\n )\n })}\n </div>\n )}\n </SettingsSection>\n {onStageCreate ? (\n <NewStageDialog\n labels={labels}\n names={stages.map((stage) => stage.name)}\n onCreate={onStageCreate}\n onOpenChange={setCreating}\n open={creating}\n phases={phases}\n />\n ) : null}\n </main>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-4/settings-catalog-4.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/catalog/settings-catalog-4/types.ts",
|
|
31
31
|
"type": "registry:file",
|
|
32
|
-
"content": "import type { Icon } from '@phosphor-icons/react'\nimport type { SettingsLoadLabels, SettingsLoadProps } from '
|
|
33
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
32
|
+
"content": "import type { Icon } from '@phosphor-icons/react'\nimport type { SettingsLoadLabels, SettingsLoadProps } from '../../shared/types'\n\nexport interface SettingsCatalog4Phase {\n closed?: boolean\n id: string\n label: string\n}\n\nexport interface SettingsCatalog4Stage {\n icon: Icon\n id: string\n leads: number\n locked?: boolean\n name: string\n phase: string\n tone: string\n}\n\nexport type SettingsCatalog4Action = 'edit' | 'move-up' | 'move-down' | 'delete'\n\nexport interface SettingsCatalog4Labels extends SettingsLoadLabels {\n actions: (name: string) => string\n cancel: string\n createStage: string\n delete: string\n description: string\n dialogAncestor: string\n dialogTitle: string\n edit: string\n moveDown: string\n moveUp: string\n newStage: string\n phase: string\n stageDescription: (\n leads: number,\n phaseLabel: string,\n closed: boolean,\n ) => string | undefined\n stageName: string\n title: string\n}\n\nexport interface SettingsCatalog4Props extends SettingsLoadProps {\n className?: string\n labels?: Partial<SettingsCatalog4Labels>\n onStageAction?: (stageId: string, action: SettingsCatalog4Action) => void\n onStageCreate?: (name: string, phaseId: string) => void\n phases: SettingsCatalog4Phase[]\n stages: SettingsCatalog4Stage[]\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-4/types.ts"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"path": "blocks/application/settings/shared/labels.ts",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
{
|
|
54
54
|
"path": "blocks/application/settings/shared/types.ts",
|
|
55
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",
|
|
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\nexport interface SettingsAppLogoData {\n svg: string\n title?: string\n}\n",
|
|
57
57
|
"target": "~/packages/ui/src/blocks/application/settings/shared/types.ts"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"path": "patterns/properties/display/select/select-property.tsx",
|
|
61
61
|
"type": "registry:file",
|
|
62
|
-
"content": "'use client'\n\nimport { CircleDashedIcon } from '@phosphor-icons/react'\nimport { SelectGroup, SelectGroupLabel, SelectItem } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport {\n type
|
|
62
|
+
"content": "'use client'\n\nimport { CircleDashedIcon } from '@phosphor-icons/react'\nimport { SelectGroup, SelectGroupLabel, SelectItem } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport {\n type PropertyChangeContext,\n type PropertyOption,\n type PropertySelectDropdownPlacement,\n propertyToneClassName,\n} from '../../shared/property-catalog'\nimport {\n defaultPropertyLabels,\n resolvePropertyLabels,\n type SelectPropertyLabels,\n} from '../../shared/property-labels'\nimport {\n PropertySelectShell,\n propertySelectItemClassName,\n} from '../../shared/property-select-shell'\nimport type { PropertyVariant } from '../../shared/property-surface'\n\nexport interface SelectPropertyGroup {\n label: string\n options: readonly PropertyOption[]\n}\n\ninterface SelectPropertyBaseProps {\n ariaLabel: string\n value: string | null\n action?: (\n value: string | null,\n context: PropertyChangeContext<string | null>,\n ) => void\n allowEmpty?: boolean\n className?: string\n disabled?: boolean\n dropdownPlacement?: PropertySelectDropdownPlacement\n labels?: Partial<SelectPropertyLabels>\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: string | null) => void\n}\n\nexport type SelectPropertyItems =\n | { groups?: undefined; options: readonly PropertyOption[] }\n | { groups: readonly SelectPropertyGroup[]; options?: undefined }\n\nexport type SelectPropertyProps = SelectPropertyBaseProps & SelectPropertyItems\n\nexport function SelectProperty({\n action,\n allowEmpty = false,\n ariaLabel,\n className,\n disabled = false,\n dropdownPlacement,\n groups,\n labels: labelOverrides,\n onValueChange,\n options,\n placeholder,\n readOnly = false,\n value,\n variant = 'badge',\n}: Readonly<SelectPropertyProps>) {\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.select,\n labelOverrides,\n )\n const catalog = groups ? groups.flatMap((group) => group.options) : options\n const selectedOption =\n value === null ? undefined : catalog.find((o) => o.value === value)\n const emptyOption: PropertyOption | null = allowEmpty\n ? {\n icon: catalog.some((option) => option.icon)\n ? CircleDashedIcon\n : undefined,\n label: labels.emptyOption,\n tone: 'neutral',\n value: '',\n }\n : null\n const [chosenEmpty, setChosenEmpty] = useState(false)\n const [seenValue, setSeenValue] = useState(value)\n if (seenValue !== value) {\n setSeenValue(value)\n if (value !== null) setChosenEmpty(false)\n }\n const explicitEmpty = emptyOption !== null && value === null && chosenEmpty\n const absent = value === null && !explicitEmpty\n\n const currentLabel =\n selectedOption?.label ??\n (explicitEmpty\n ? emptyOption.label\n : value === null\n ? (placeholder ?? labels.fallback)\n : labels.fallback)\n\n const accessibleLabel = absent ? ariaLabel : `${ariaLabel}: ${currentLabel}`\n const items = emptyOption ? [emptyOption, ...catalog] : catalog\n\n return (\n <PropertySelectShell\n ariaLabel={accessibleLabel}\n className={className}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n items={items}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n muted={absent}\n onValueChange={(option) => {\n if (!option) return\n const next = option.value === '' ? null : option.value\n setChosenEmpty(next === null)\n if (next === value) return\n emitChange({ action, onValueChange }, next, { previousValue: value })\n }}\n readOnly={!isEditable({ action, onValueChange, readOnly })}\n variant={variant}\n renderValue={() => (\n <SelectPropertyContent\n label={currentLabel}\n option={selectedOption ?? (explicitEmpty ? emptyOption : undefined)}\n />\n )}\n value={selectedOption ?? (explicitEmpty ? emptyOption : null)}\n >\n {emptyOption ? (\n <SelectItem className={propertySelectItemClassName} value={emptyOption}>\n <SelectPropertyContent\n label={emptyOption.label}\n option={emptyOption}\n />\n </SelectItem>\n ) : null}\n {groups\n ? groups.map((group) => (\n <SelectGroup key={group.label}>\n <SelectGroupLabel>{group.label}</SelectGroupLabel>\n {group.options.map((option) => (\n <SelectItem\n key={option.value}\n className={propertySelectItemClassName}\n value={option}\n >\n <SelectPropertyContent label={option.label} option={option} />\n </SelectItem>\n ))}\n </SelectGroup>\n ))\n : catalog.map((option) => (\n <SelectItem\n key={option.value}\n className={propertySelectItemClassName}\n value={option}\n >\n <SelectPropertyContent label={option.label} option={option} />\n </SelectItem>\n ))}\n </PropertySelectShell>\n )\n}\n\nfunction SelectPropertyContent({\n label,\n option,\n}: Readonly<{ label: string; option?: PropertyOption }>) {\n const Icon = option?.icon\n\n return (\n <span className=\"flex min-w-0 items-center gap-1.5\">\n {Icon ? (\n <Icon\n aria-hidden\n className={cn(\n 'size-4',\n option?.tone ? propertyToneClassName[option.tone] : undefined,\n )}\n data-slot=\"property-icon\"\n weight={option?.weight}\n />\n ) : null}\n <span className=\"truncate\">{label}</span>\n </span>\n )\n}\n",
|
|
63
63
|
"target": "~/packages/ui/src/patterns/properties/display/select/select-property.tsx"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
@@ -71,13 +71,19 @@
|
|
|
71
71
|
{
|
|
72
72
|
"path": "patterns/properties/shared/property-catalog.ts",
|
|
73
73
|
"type": "registry:file",
|
|
74
|
-
"content": "import type
|
|
74
|
+
"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",
|
|
75
75
|
"target": "~/packages/ui/src/patterns/properties/shared/property-catalog.ts"
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
"path": "patterns/properties/shared/property-labels.ts",
|
|
79
|
+
"type": "registry:file",
|
|
80
|
+
"content": "export interface DatePropertyLabels {\n clear: string\n fallback: string\n}\n\nexport interface DateRangePropertyLabels {\n clear: string\n fallback: string\n from: string\n until: string\n}\n\nexport interface SchedulePropertyLabels {\n addReminder: string\n allDay: string\n back: string\n clearUntil: string\n daily: string\n end: string\n fallback: string\n frequency: string\n monthly: string\n nextWeek: string\n noDate: string\n noReminders: string\n noRepeat: string\n oneDayBefore: string\n oneHourBefore: string\n presets: string\n reminders: string\n removeReminder: string\n repeat: string\n start: string\n tenMinutesBefore: string\n thirtyMinutesBefore: string\n thisWeekend: string\n time: string\n today: string\n tomorrow: string\n until: string\n untilFallback: string\n weekdays: string\n weekly: string\n yearly: string\n}\n\nexport interface SelectPropertyLabels {\n emptyOption: string\n fallback: string\n}\n\nexport interface TextPropertyLabels {\n copy: string\n fallback: string\n add?: string\n inputPlaceholder?: string\n}\n\nexport interface PropertyEntryListLabels {\n add: string\n addAnother: string\n duplicate: string\n entries: readonly string[]\n invalid: string\n remove: string\n removeEntry: (entry: string) => string\n save: string\n inputPlaceholder?: string\n}\n\nexport type EmailPropertyLabels = PropertyEntryListLabels\n\nexport interface PhoneInputLabels {\n country: string\n countryEmpty: string\n countryList: string\n countrySearch: string\n}\n\nexport interface PhonePropertyLabels\n extends PropertyEntryListLabels,\n PhoneInputLabels {\n required: string\n}\n\nexport interface PeoplePropertyLabels {\n add: string\n empty: string\n loading: string\n remove: string\n}\n\nexport interface TagsPropertyLabels {\n add: string\n count: (count: number) => string\n empty: string\n loading: string\n remove: string\n}\n\nexport interface AttachmentPropertyLabels {\n remove: string\n}\n\nexport interface PropertyCollectionLabels {\n trigger: string\n}\n\nexport interface PropertyLabels {\n attachment: AttachmentPropertyLabels\n collection: PropertyCollectionLabels\n date: DatePropertyLabels\n dateRange: DateRangePropertyLabels\n email: EmailPropertyLabels\n people: PeoplePropertyLabels\n phone: PhonePropertyLabels\n phoneInput: PhoneInputLabels\n schedule: SchedulePropertyLabels\n select: SelectPropertyLabels\n tags: TagsPropertyLabels\n text: TextPropertyLabels\n}\n\nconst phoneInputLabels: PhoneInputLabels = {\n country: 'Country',\n countryEmpty: 'No country found.',\n countryList: 'Select country',\n countrySearch: 'Search country',\n}\n\nexport const defaultPropertyLabels: PropertyLabels = {\n attachment: { remove: 'Remove attachment' },\n collection: { trigger: 'Adjust properties' },\n date: { clear: 'Clear date', fallback: 'No date' },\n dateRange: {\n clear: 'Clear period',\n fallback: 'No period',\n from: 'From',\n until: 'Until',\n },\n email: {\n add: 'Add email',\n addAnother: 'Add another',\n duplicate: 'This email is already in the list.',\n entries: ['Primary', 'Secondary'],\n inputPlaceholder: 'name@example.com',\n invalid: 'Enter a valid email.',\n remove: 'Remove email',\n removeEntry: (entry) => `Remove ${entry} email`,\n save: 'Save',\n },\n people: {\n add: 'Add person',\n empty: 'No people found.',\n loading: 'Loading people…',\n remove: 'Remove',\n },\n phone: {\n ...phoneInputLabels,\n add: 'Add phone',\n addAnother: 'Add another',\n duplicate: 'This phone is already in the list.',\n entries: ['Primary', 'Secondary'],\n invalid: 'Enter a valid phone number.',\n remove: 'Remove phone',\n removeEntry: (entry) => `Remove ${entry} phone`,\n required: 'Enter a phone number.',\n save: 'Save',\n },\n phoneInput: phoneInputLabels,\n schedule: {\n addReminder: 'Add reminder',\n allDay: 'All day',\n back: 'Back',\n clearUntil: 'Clear date',\n daily: 'Daily',\n end: 'End',\n fallback: 'No date',\n frequency: 'Frequency',\n monthly: 'Monthly',\n nextWeek: 'Next week',\n noDate: 'No date',\n noReminders: 'No reminders found.',\n noRepeat: 'Does not repeat',\n oneDayBefore: '1 day before',\n oneHourBefore: '1 hour before',\n presets: 'Date shortcuts',\n reminders: 'Reminders',\n removeReminder: 'Remove reminder',\n repeat: 'Repeat',\n start: 'Start',\n tenMinutesBefore: '10 min before',\n thirtyMinutesBefore: '30 min before',\n thisWeekend: 'This weekend',\n time: 'Time',\n today: 'Today',\n tomorrow: 'Tomorrow',\n until: 'Until',\n untilFallback: 'No end',\n weekdays: 'Weekdays',\n weekly: 'Weekly',\n yearly: 'Yearly',\n },\n select: { emptyOption: 'None', fallback: '—' },\n tags: {\n add: 'Add tag',\n count: (count) => `${count} ${count === 1 ? 'Tag' : 'Tags'}`,\n empty: 'No tags found.',\n loading: 'Loading tags…',\n remove: 'Remove tag',\n },\n text: { copy: 'Copy', fallback: 'Not set' },\n}\n\nexport const defaultPropertyAriaLabels = {\n assigned: 'Assignee',\n date: 'Date',\n dateRange: 'Period',\n email: 'Emails',\n people: 'People',\n person: 'Person',\n phone: 'Phones',\n tags: 'Tags',\n} as const\n\nexport const defaultPropertyPlaceholders = {\n assigned: 'No assignee',\n email: 'No email',\n people: 'Add person',\n person: 'No assignee',\n phone: 'No phone',\n tags: 'Add a tag',\n} as const\n\nexport function resolvePropertyLabels<TLabels extends object>(\n defaults: TLabels,\n overrides: Partial<TLabels> | undefined,\n): TLabels {\n const resolved = { ...defaults }\n\n for (const [key, value] of Object.entries(overrides ?? {})) {\n if (value !== undefined) Object.assign(resolved, { [key]: value })\n }\n\n return resolved\n}\n",
|
|
81
|
+
"target": "~/packages/ui/src/patterns/properties/shared/property-labels.ts"
|
|
82
|
+
},
|
|
77
83
|
{
|
|
78
84
|
"path": "patterns/properties/shared/property-select-shell.tsx",
|
|
79
85
|
"type": "registry:file",
|
|
80
|
-
"content": "'use client'\n\nimport { Select, SelectPopup, SelectPrimitive } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport type {
|
|
86
|
+
"content": "'use client'\n\nimport { Select, SelectPopup, SelectPrimitive } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport type { PropertySelectDropdownPlacement } from './property-catalog'\nimport { PropertySurface, type PropertyVariant } from './property-surface'\n\nexport interface PropertySelectShellProps<\n TOption extends { label: ReactNode; value: string },\n> {\n ariaLabel: string\n children: ReactNode\n className?: string\n disabled?: boolean\n dropdownPlacement?: PropertySelectDropdownPlacement\n items: readonly TOption[]\n itemToStringLabel: (option: TOption) => string\n itemToStringValue: (option: TOption) => string\n muted?: boolean\n onValueChange: (option: TOption | null) => void\n readOnly?: boolean\n renderValue: (option: TOption | null) => ReactNode\n value: TOption | null\n variant?: PropertyVariant\n}\n\nexport function PropertySelectShell<\n TOption extends { label: ReactNode; value: string },\n>({\n ariaLabel,\n children,\n className,\n disabled = false,\n dropdownPlacement,\n items,\n itemToStringLabel,\n itemToStringValue,\n muted = false,\n onValueChange,\n readOnly = false,\n renderValue,\n value,\n variant = 'badge',\n}: Readonly<PropertySelectShellProps<TOption>>) {\n if (readOnly) {\n return (\n <PropertySurface\n aria-label={ariaLabel}\n className={cn('max-w-full', className)}\n muted={muted}\n role=\"img\"\n variant={variant}\n >\n {renderValue(value)}\n </PropertySurface>\n )\n }\n\n return (\n <Select<TOption>\n itemToStringLabel={itemToStringLabel}\n itemToStringValue={itemToStringValue}\n items={[...items]}\n onValueChange={onValueChange}\n value={value}\n >\n <SelectPrimitive.Trigger\n aria-label={ariaLabel}\n disabled={disabled}\n render={\n <PropertySurface\n className={cn('max-w-full', className)}\n muted={muted}\n render={<button type=\"button\" />}\n variant={variant}\n />\n }\n >\n {renderValue(value)}\n </SelectPrimitive.Trigger>\n <SelectPopup {...dropdownPlacement}>{children}</SelectPopup>\n </Select>\n )\n}\n\nexport const propertySelectItemClassName =\n 'grid-cols-[minmax(0,1fr)_.75rem] gap-4 pe-2.5 *:row-start-1 [&>div]:col-start-1 [&>span]:col-start-2 [&>span]:-me-0.5'\n",
|
|
81
87
|
"target": "~/packages/ui/src/patterns/properties/shared/property-select-shell.tsx"
|
|
82
88
|
},
|
|
83
89
|
{
|
|
@@ -200,6 +206,7 @@
|
|
|
200
206
|
"@ui/button",
|
|
201
207
|
"@ui/card",
|
|
202
208
|
"@ui/collapsible",
|
|
209
|
+
"@ui/combobox",
|
|
203
210
|
"@ui/dialog",
|
|
204
211
|
"@ui/empty",
|
|
205
212
|
"@ui/field",
|
|
@@ -208,6 +215,8 @@
|
|
|
208
215
|
"@ui/input",
|
|
209
216
|
"@ui/kbd",
|
|
210
217
|
"@ui/menu",
|
|
218
|
+
"@ui/popover",
|
|
219
|
+
"@ui/property-tone",
|
|
211
220
|
"@ui/select",
|
|
212
221
|
"@ui/skeleton",
|
|
213
222
|
"@ui/spinner",
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "settings-
|
|
2
|
+
"name": "settings-catalog-5",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/catalog/settings-catalog-5/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsCatalog5 } from './settings-catalog-5'\nexport type {\n SettingsCatalog5Action,\n SettingsCatalog5Group,\n SettingsCatalog5Labels,\n SettingsCatalog5Props,\n SettingsCatalog5Status,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-5/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/catalog/settings-catalog-5/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 { SettingsCatalog5Labels } from './types'\n\nexport const defaultSettingsCatalog5Labels: SettingsCatalog5Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar os status',\n loading: 'Carregando status',\n actions: (name) => `Ações de ${name}`,\n delete: 'Excluir',\n description:\n 'Os status definem o fluxo que os projetos percorrem do início à conclusão',\n edit: 'Editar',\n newStatus: 'Novo status',\n projects: (count) => `${count} ${count === 1 ? 'projeto' : 'projetos'}`,\n title: 'Status de projetos',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-5/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/catalog/settings-catalog-5/settings-catalog-5-skeleton.tsx",
|
|
19
19
|
"type": "registry:file",
|
|
20
|
-
"content": "import {\n SettingsCollapsedSkeleton,\n SettingsRowsSkeleton,\n} from '
|
|
21
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
20
|
+
"content": "import {\n SettingsCollapsedSkeleton,\n SettingsRowsSkeleton,\n} from '../../shared/settings-skeleton'\n\nexport function SettingsCatalog5Skeleton() {\n return (\n <>\n <SettingsCollapsedSkeleton key=\"group-0\">\n <SettingsRowsSkeleton count={2} description={false} end=\"menu\" />\n </SettingsCollapsedSkeleton>\n <SettingsCollapsedSkeleton key=\"group-1\">\n <SettingsRowsSkeleton count={2} description={false} end=\"menu\" />\n </SettingsCollapsedSkeleton>\n <SettingsCollapsedSkeleton key=\"group-2\">\n <SettingsRowsSkeleton count={2} description={false} end=\"menu\" />\n </SettingsCollapsedSkeleton>\n </>\n )\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-5/settings-catalog-5-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/catalog/settings-catalog-5/settings-catalog-5.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import { Button } from '@tc96/ui/button'\nimport { IconFrame } from '@tc96/ui/icon-frame'\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 { cn } from '@tc96/utils'\nimport { settingsLoadState } from '
|
|
27
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
26
|
+
"content": "import { Button } from '@tc96/ui/button'\nimport { IconFrame } from '@tc96/ui/icon-frame'\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 { cn } from '@tc96/utils'\nimport { settingsLoadState } from '../../shared/settings-load-state'\nimport { SettingsRowActions } from '../../shared/settings-row-actions'\nimport { defaultSettingsCatalog5Labels } from './labels'\nimport { SettingsCatalog5Skeleton } from './settings-catalog-5-skeleton'\nimport type { SettingsCatalog5Action, SettingsCatalog5Props } from './types'\n\nexport function SettingsCatalog5({\n error,\n onRetry,\n pending,\n className,\n groups,\n labels: labelsProp,\n onCreate,\n onStatusAction,\n}: Readonly<SettingsCatalog5Props>) {\n const labels = { ...defaultSettingsCatalog5Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsCatalog5Skeleton />,\n })\n const actions = [\n { id: 'edit', label: labels.edit },\n { destructive: true, id: 'delete', label: labels.delete },\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.newStatus}\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 <div>\n {groups.map((group) => (\n <SettingsCollapsed key={group.id} title={group.title}>\n {group.statuses.map(\n ({ icon: StatusIcon, id, label, projects, toneClassName }) => (\n <SettingsRow\n description={\n projects === undefined\n ? undefined\n : labels.projects(projects)\n }\n endSlot={\n onStatusAction ? (\n <SettingsRowActions\n actions={actions}\n label={labels.actions(label)}\n onAction={(action) =>\n onStatusAction(id, action as SettingsCatalog5Action)\n }\n />\n ) : undefined\n }\n key={id}\n startSlot={\n <IconFrame className={toneClassName} shape=\"rounded\">\n <StatusIcon aria-hidden=\"true\" className=\"size-4\" />\n </IconFrame>\n }\n title={label}\n />\n ),\n )}\n </SettingsCollapsed>\n ))}\n </div>\n )}\n </SettingsSection>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-5/settings-catalog-5.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/catalog/settings-catalog-5/types.ts",
|
|
31
31
|
"type": "registry:file",
|
|
32
|
-
"content": "import type { Icon } from '@phosphor-icons/react'\nimport type { SettingsLoadLabels, SettingsLoadProps } from '
|
|
33
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
32
|
+
"content": "import type { Icon } from '@phosphor-icons/react'\nimport type { SettingsLoadLabels, SettingsLoadProps } from '../../shared/types'\n\nexport interface SettingsCatalog5Status {\n icon: Icon\n id: string\n label: string\n projects?: number\n toneClassName?: string\n}\n\nexport interface SettingsCatalog5Group {\n id: string\n statuses: SettingsCatalog5Status[]\n title: string\n}\n\nexport interface SettingsCatalog5Labels extends SettingsLoadLabels {\n actions: (name: string) => string\n delete: string\n description: string\n edit: string\n newStatus: string\n projects: (count: number) => string\n title: string\n}\n\nexport type SettingsCatalog5Action = 'edit' | 'delete'\n\nexport interface SettingsCatalog5Props extends SettingsLoadProps {\n className?: string\n groups: SettingsCatalog5Group[]\n labels?: Partial<SettingsCatalog5Labels>\n onCreate?: () => void\n onStatusAction?: (statusId: string, action: SettingsCatalog5Action) => void\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-5/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
|
{
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "settings-
|
|
2
|
+
"name": "settings-catalog-6",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/catalog/settings-catalog-6/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsCatalog6 } from './settings-catalog-6'\nexport type {\n SettingsCatalog6Action,\n SettingsCatalog6ActionType,\n SettingsCatalog6Labels,\n SettingsCatalog6NextAction,\n SettingsCatalog6Props,\n SettingsCatalog6Stage,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-6/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/catalog/settings-catalog-6/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 SettingsCatalog6ActionType,\n SettingsCatalog6Labels,\n} from './types'\n\nconst actionTypeLabels: Record<SettingsCatalog6ActionType, string> = {\n call: 'Ligação',\n email: 'E-mail',\n 'follow-up': 'Acompanhamento',\n meeting: 'Reunião',\n proposal: 'Proposta',\n}\n\nexport const defaultSettingsCatalog6Labels: SettingsCatalog6Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar as próximas ações',\n loading: 'Carregando próximas ações',\n actionType: (type) => actionTypeLabels[type],\n actions: (title) => `Ações de ${title}`,\n blockStageChanges: 'Bloquear mudança de etapa',\n blockStageChangesDescription:\n 'Leads só avançam para a próxima etapa quando todas as ações obrigatórias estiverem concluídas. Desativado, apenas avisa.',\n delete: 'Excluir',\n description:\n 'Ações que um lead precisa cumprir antes de sair de cada etapa aberta.',\n edit: 'Editar',\n emptyDescription: 'Adicione ações às etapas pelas quais os leads passam.',\n emptyStage: 'Leads avançam sem ações obrigatórias',\n emptyTitle: 'Nenhuma próxima ação ainda',\n gatesTitle: 'Bloqueio de etapas',\n leaving: (stage) => `Saindo de ${stage}`,\n newAction: 'Nova ação',\n required: (title) => `Obrigatória: ${title}`,\n title: 'Próximas ações',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-6/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/catalog/settings-catalog-6/settings-catalog-6-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 SettingsCatalog6Skeleton() {\n return <SettingsRowsSkeleton count={1} end=\"switch\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-6/settings-catalog-6-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/catalog/settings-catalog-6/settings-catalog-6.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import {\n CalendarBlankIcon,\n EnvelopeSimpleIcon,\n FileTextIcon,\n type Icon,\n PhoneIcon,\n RepeatIcon,\n} from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\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 { Switch } from '@tc96/ui/switch'\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 {\n CalendarBlankIcon,\n EnvelopeSimpleIcon,\n FileTextIcon,\n type Icon,\n PhoneIcon,\n RepeatIcon,\n} from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\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 { Switch } from '@tc96/ui/switch'\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 { defaultSettingsCatalog6Labels } from './labels'\nimport { SettingsCatalog6Skeleton } from './settings-catalog-6-skeleton'\nimport type {\n SettingsCatalog6Action,\n SettingsCatalog6ActionType,\n SettingsCatalog6Props,\n} from './types'\n\nconst actionTypeIcons: Record<SettingsCatalog6ActionType, Icon> = {\n call: PhoneIcon,\n email: EnvelopeSimpleIcon,\n 'follow-up': RepeatIcon,\n meeting: CalendarBlankIcon,\n proposal: FileTextIcon,\n}\n\nexport function SettingsCatalog6({\n error,\n onRetry,\n pending,\n blockStageChanges = false,\n className,\n labels: labelsProp,\n onBlockStageChangesChange,\n onCreate,\n onNextActionAction,\n onRequiredChange,\n stages,\n}: Readonly<SettingsCatalog6Props>) {\n const labels = { ...defaultSettingsCatalog6Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsCatalog6Skeleton />,\n })\n const actions = [\n { id: 'edit', label: labels.edit },\n { destructive: true, id: 'delete', label: labels.delete },\n ]\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.gatesTitle}</SettingsSectionTitle>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <SettingsRow\n description={labels.blockStageChangesDescription}\n endSlot={\n <Switch\n aria-label={labels.blockStageChanges}\n checked={blockStageChanges}\n onCheckedChange={onBlockStageChangesChange}\n />\n }\n title={labels.blockStageChanges}\n />\n )}\n </SettingsSection>\n {loadState ? null : (\n <SettingsSection\n header={\n <SettingsSectionHeader\n actions={\n onCreate ? (\n <Button onClick={onCreate} size=\"sm\">\n {labels.newAction}\n </Button>\n ) : undefined\n }\n >\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.description}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {stages.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n <div>\n {stages.map((stage) => (\n <SettingsCollapsed\n key={stage.id}\n title={labels.leaving(stage.name)}\n >\n {stage.actions.length === 0 ? (\n <Text\n foreground=\"muted\"\n render={<p className=\"py-3\" />}\n size=\"sm\"\n >\n {labels.emptyStage}\n </Text>\n ) : (\n stage.actions.map((action) => {\n const ActionIcon = actionTypeIcons[action.type]\n\n return (\n <SettingsRow\n description={labels.actionType(action.type)}\n endSlot={\n <>\n <Switch\n aria-label={labels.required(action.title)}\n checked={action.required}\n onCheckedChange={(checked) =>\n onRequiredChange?.(action.id, checked)\n }\n />\n {onNextActionAction ? (\n <SettingsRowActions\n actions={actions}\n label={labels.actions(action.title)}\n onAction={(item) =>\n onNextActionAction(\n action.id,\n item as SettingsCatalog6Action,\n )\n }\n />\n ) : null}\n </>\n }\n key={action.id}\n startSlot={\n <ActionIcon\n aria-hidden=\"true\"\n className=\"text-muted-foreground\"\n />\n }\n title={action.title}\n />\n )\n })\n )}\n </SettingsCollapsed>\n ))}\n </div>\n )}\n </SettingsSection>\n )}\n </div>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-6/settings-catalog-6.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/catalog/settings-catalog-6/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 SettingsCatalog6ActionType =\n | 'call'\n | 'email'\n | 'meeting'\n | 'proposal'\n | 'follow-up'\n\nexport interface SettingsCatalog6NextAction {\n id: string\n required: boolean\n title: string\n type: SettingsCatalog6ActionType\n}\n\nexport interface SettingsCatalog6Stage {\n actions: SettingsCatalog6NextAction[]\n id: string\n name: string\n}\n\nexport interface SettingsCatalog6Labels extends SettingsLoadLabels {\n actionType: (type: SettingsCatalog6ActionType) => string\n actions: (title: string) => string\n blockStageChanges: string\n blockStageChangesDescription: string\n delete: string\n description: string\n edit: string\n emptyDescription: string\n emptyStage: string\n emptyTitle: string\n gatesTitle: string\n leaving: (stage: string) => string\n newAction: string\n required: (title: string) => string\n title: string\n}\n\nexport type SettingsCatalog6Action = 'edit' | 'delete'\n\nexport interface SettingsCatalog6Props extends SettingsLoadProps {\n blockStageChanges?: boolean\n className?: string\n labels?: Partial<SettingsCatalog6Labels>\n onBlockStageChangesChange?: (checked: boolean) => void\n onCreate?: () => void\n onNextActionAction?: (\n actionId: string,\n action: SettingsCatalog6Action,\n ) => void\n onRequiredChange?: (actionId: string, required: boolean) => void\n stages: SettingsCatalog6Stage[]\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-6/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
|
{
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "settings-
|
|
2
|
+
"name": "settings-catalog-7",
|
|
3
3
|
"type": "registry:block",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "blocks/application/settings/settings-
|
|
6
|
+
"path": "blocks/application/settings/catalog/settings-catalog-7/index.ts",
|
|
7
7
|
"type": "registry:file",
|
|
8
|
-
"content": "export {
|
|
9
|
-
"target": "~/packages/ui/src/blocks/application/settings/settings-
|
|
8
|
+
"content": "export { SettingsCatalog7 } from './settings-catalog-7'\nexport type {\n SettingsCatalog7Action,\n SettingsCatalog7Labels,\n SettingsCatalog7Props,\n SettingsCatalog7Reason,\n} from './types'\n",
|
|
9
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-7/index.ts"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"path": "blocks/application/settings/settings-
|
|
12
|
+
"path": "blocks/application/settings/catalog/settings-catalog-7/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 { SettingsCatalog7Labels } from './types'\n\nexport const defaultSettingsCatalog7Labels: SettingsCatalog7Labels = {\n ...defaultSettingsLoadLabels,\n errorTitle: 'Não foi possível carregar os motivos',\n loading: 'Carregando motivos',\n actions: (name) => `Ações de ${name}`,\n allowCustomReason: 'Permitir motivo personalizado',\n allowCustomReasonDescription:\n 'Vendedores podem escrever o próprio motivo quando nenhuma opção serve',\n archive: 'Arquivar',\n archived: 'Arquivados',\n delete: 'Excluir',\n description:\n 'Os motivos que o vendedor pode escolher quando um lead é perdido.',\n edit: 'Editar',\n emptyDescription:\n 'Crie um motivo para que os vendedores digam por que um lead foi perdido.',\n emptyTitle: 'Nenhum motivo de perda ainda',\n leadsLost: (leads) =>\n `${leads} ${leads === 1 ? 'lead perdido' : 'leads perdidos'}`,\n lostLeadsDescription:\n 'Escolha o que os vendedores devem informar ao marcar um lead como perdido.',\n lostLeadsTitle: 'Leads perdidos',\n newReason: 'Novo motivo',\n requireReason: 'Exigir motivo de perda',\n requireReasonDescription:\n 'O vendedor escolhe um motivo antes de marcar um lead como perdido',\n restore: 'Restaurar',\n title: 'Motivos de perda',\n}\n",
|
|
15
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-7/labels.ts"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "blocks/application/settings/settings-
|
|
18
|
+
"path": "blocks/application/settings/catalog/settings-catalog-7/settings-catalog-7-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 SettingsCatalog7Skeleton() {\n return <SettingsRowsSkeleton count={2} end=\"switch\" />\n}\n",
|
|
21
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-7/settings-catalog-7-skeleton.tsx"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"path": "blocks/application/settings/settings-
|
|
24
|
+
"path": "blocks/application/settings/catalog/settings-catalog-7/settings-catalog-7.tsx",
|
|
25
25
|
"type": "registry:file",
|
|
26
|
-
"content": "import { Button } from '@tc96/ui/button'\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 { 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 { Button } from '@tc96/ui/button'\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 { 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 { defaultSettingsCatalog7Labels } from './labels'\nimport { SettingsCatalog7Skeleton } from './settings-catalog-7-skeleton'\nimport type {\n SettingsCatalog7Action,\n SettingsCatalog7Labels,\n SettingsCatalog7Props,\n SettingsCatalog7Reason,\n} from './types'\n\ninterface ReasonRowProps {\n archived?: boolean\n labels: SettingsCatalog7Labels\n onReasonAction?: SettingsCatalog7Props['onReasonAction']\n reason: SettingsCatalog7Reason\n}\n\nfunction ReasonRow({\n archived,\n labels,\n onReasonAction,\n reason,\n}: Readonly<ReasonRowProps>) {\n const actions = archived\n ? [\n { id: 'restore', label: labels.restore },\n { destructive: true, id: 'delete', label: labels.delete },\n ]\n : [\n { id: 'edit', label: labels.edit },\n { id: 'archive', label: labels.archive },\n { destructive: true, id: 'delete', label: labels.delete },\n ]\n\n return (\n <SettingsRow\n description={labels.leadsLost(reason.leads)}\n endSlot={\n onReasonAction ? (\n <SettingsRowActions\n actions={actions}\n label={labels.actions(reason.name)}\n onAction={(action) =>\n onReasonAction(reason.id, action as SettingsCatalog7Action)\n }\n />\n ) : undefined\n }\n title={reason.name}\n />\n )\n}\n\nexport function SettingsCatalog7({\n error,\n onRetry,\n pending,\n allowCustomReason = true,\n archivedReasons = [],\n className,\n labels: labelsProp,\n onAllowCustomReasonChange,\n onCreate,\n onReasonAction,\n onRequireReasonChange,\n reasons,\n requireReason = false,\n}: Readonly<SettingsCatalog7Props>) {\n const labels = { ...defaultSettingsCatalog7Labels, ...labelsProp }\n const loadState = settingsLoadState({\n error,\n labels,\n onRetry,\n pending,\n skeleton: <SettingsCatalog7Skeleton />,\n })\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.lostLeadsTitle}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.lostLeadsDescription}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {loadState ?? (\n <>\n <SettingsRow\n description={labels.requireReasonDescription}\n endSlot={\n <Switch\n aria-label={labels.requireReason}\n checked={requireReason}\n onCheckedChange={onRequireReasonChange}\n />\n }\n title={labels.requireReason}\n />\n <SettingsRow\n description={labels.allowCustomReasonDescription}\n endSlot={\n <Switch\n aria-label={labels.allowCustomReason}\n checked={allowCustomReason}\n onCheckedChange={onAllowCustomReasonChange}\n />\n }\n title={labels.allowCustomReason}\n />\n </>\n )}\n </SettingsSection>\n {loadState ? null : (\n <SettingsSection\n header={\n <SettingsSectionHeader\n actions={\n onCreate ? (\n <Button onClick={onCreate} size=\"sm\">\n {labels.newReason}\n </Button>\n ) : undefined\n }\n >\n <SettingsSectionTitle>{labels.title}</SettingsSectionTitle>\n <SettingsSectionDescription>\n {labels.description}\n </SettingsSectionDescription>\n </SettingsSectionHeader>\n }\n >\n {reasons.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n reasons.map((reason) => (\n <ReasonRow\n key={reason.id}\n labels={labels}\n onReasonAction={onReasonAction}\n reason={reason}\n />\n ))\n )}\n {archivedReasons.length > 0 ? (\n <div>\n <SettingsCollapsed defaultOpen={false} title={labels.archived}>\n {archivedReasons.map((reason) => (\n <ReasonRow\n archived\n key={reason.id}\n labels={labels}\n onReasonAction={onReasonAction}\n reason={reason}\n />\n ))}\n </SettingsCollapsed>\n </div>\n ) : null}\n </SettingsSection>\n )}\n </div>\n )\n}\n",
|
|
27
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-7/settings-catalog-7.tsx"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"path": "blocks/application/settings/settings-
|
|
30
|
+
"path": "blocks/application/settings/catalog/settings-catalog-7/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 SettingsCatalog7Reason {\n id: string\n leads: number\n name: string\n}\n\nexport interface SettingsCatalog7Labels extends SettingsLoadLabels {\n actions: (name: string) => string\n allowCustomReason: string\n allowCustomReasonDescription: string\n archive: string\n archived: string\n delete: string\n description: string\n edit: string\n emptyDescription: string\n emptyTitle: string\n leadsLost: (leads: number) => string\n lostLeadsDescription: string\n lostLeadsTitle: string\n newReason: string\n requireReason: string\n requireReasonDescription: string\n restore: string\n title: string\n}\n\nexport type SettingsCatalog7Action = 'edit' | 'archive' | 'restore' | 'delete'\n\nexport interface SettingsCatalog7Props extends SettingsLoadProps {\n allowCustomReason?: boolean\n archivedReasons?: SettingsCatalog7Reason[]\n className?: string\n labels?: Partial<SettingsCatalog7Labels>\n onAllowCustomReasonChange?: (checked: boolean) => void\n onCreate?: () => void\n onReasonAction?: (reasonId: string, action: SettingsCatalog7Action) => void\n onRequireReasonChange?: (checked: boolean) => void\n reasons: SettingsCatalog7Reason[]\n requireReason?: boolean\n}\n",
|
|
33
|
+
"target": "~/packages/ui/src/blocks/application/settings/catalog/settings-catalog-7/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
|
{
|