@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.
Files changed (108) hide show
  1. package/README.md +4 -4
  2. package/cli.js +82 -27
  3. package/package.json +1 -1
  4. package/registry/agenda-1.json +1297 -0
  5. package/registry/aggregate.json +1 -1
  6. package/registry/ai-chat-1.json +91 -0
  7. package/registry/checklist.json +21 -7
  8. package/registry/collection.json +624 -351
  9. package/registry/crm-1.json +1317 -0
  10. package/registry/crm-2.json +1400 -0
  11. package/registry/dashboard-5.json +167 -0
  12. package/registry/dashboard-6.json +143 -0
  13. package/registry/dashboard-7.json +188 -0
  14. package/registry/documents-1.json +1322 -0
  15. package/registry/finance-1.json +845 -0
  16. package/registry/finance-2.json +973 -0
  17. package/registry/finance-3.json +1436 -0
  18. package/registry/{workflow-editor.json → flow-1.json} +37 -37
  19. package/registry/{agent-builder.json → flow-2.json} +55 -55
  20. package/registry/{run-monitor.json → flow-3.json} +16 -16
  21. package/registry/{impact-map.json → flow-4.json} +16 -16
  22. package/registry/inbox-1.json +1184 -0
  23. package/registry/inventory-1.json +828 -0
  24. package/registry/inventory-2.json +956 -0
  25. package/registry/legal-1.json +1345 -0
  26. package/registry/legal-2.json +1279 -0
  27. package/registry/legal-3.json +1273 -0
  28. package/registry/legal-4.json +1273 -0
  29. package/registry/legal-5.json +1393 -0
  30. package/registry/legal-6.json +1309 -0
  31. package/registry/legal-7.json +1315 -0
  32. package/registry/legal-8.json +1358 -0
  33. package/registry/legal-9.json +1381 -0
  34. package/registry/marketing-1.json +833 -0
  35. package/registry/marketing-2.json +961 -0
  36. package/registry/navbar-1.json +6 -6
  37. package/registry/navbar-10.json +50 -0
  38. package/registry/navbar-11.json +48 -0
  39. package/registry/navbar-12.json +48 -0
  40. package/registry/navbar-6.json +48 -0
  41. package/registry/navbar-7.json +72 -0
  42. package/registry/navbar-8.json +50 -0
  43. package/registry/navbar-9.json +54 -0
  44. package/registry/projects-1.json +865 -0
  45. package/registry/projects-2.json +993 -0
  46. package/registry/projects-3.json +1346 -0
  47. package/registry/properties.json +65 -58
  48. package/registry/record-group.json +5 -1
  49. package/registry/revenue-1.json +834 -0
  50. package/registry/revenue-2.json +968 -0
  51. package/registry/revenue-3.json +821 -0
  52. package/registry/revenue-4.json +949 -0
  53. package/registry/rich-text-editor-1.json +172 -0
  54. package/registry/rich-text-editor-2.json +158 -0
  55. package/registry/rich-text-editor-3.json +198 -0
  56. package/registry/rich-text-editor-4.json +200 -0
  57. package/registry/rich-text-editor-5.json +237 -0
  58. package/registry/rich-text-editor.json +27 -7
  59. package/registry/{settings-1.json → settings-account-1.json} +17 -17
  60. package/registry/{settings-23.json → settings-account-2.json} +17 -17
  61. package/registry/{settings-7.json → settings-catalog-1.json} +17 -17
  62. package/registry/{settings-16.json → settings-catalog-10.json} +17 -17
  63. package/registry/{settings-8.json → settings-catalog-2.json} +17 -17
  64. package/registry/{settings-9.json → settings-catalog-3.json} +17 -17
  65. package/registry/{settings-10.json → settings-catalog-4.json} +29 -20
  66. package/registry/{settings-11.json → settings-catalog-5.json} +17 -17
  67. package/registry/{settings-12.json → settings-catalog-6.json} +17 -17
  68. package/registry/{settings-13.json → settings-catalog-7.json} +17 -17
  69. package/registry/{settings-14.json → settings-catalog-8.json} +29 -19
  70. package/registry/{settings-15.json → settings-catalog-9.json} +28 -18
  71. package/registry/{settings-19.json → settings-integration-1.json} +17 -17
  72. package/registry/settings-integration-2.json +122 -0
  73. package/registry/{settings-22.json → settings-integration-3.json} +17 -17
  74. package/registry/settings-integration-4.json +129 -0
  75. package/registry/settings-integration-5.json +122 -0
  76. package/registry/settings-integration-6.json +92 -0
  77. package/registry/{settings-21.json → settings-integration-7.json} +23 -17
  78. package/registry/settings-integration-8.json +593 -0
  79. package/registry/{settings-20.json → settings-notification-channel-1.json} +17 -17
  80. package/registry/{settings-2.json → settings-preference-1.json} +17 -17
  81. package/registry/{settings-3.json → settings-preference-2.json} +17 -17
  82. package/registry/{settings-4.json → settings-preference-3.json} +17 -17
  83. package/registry/{settings-18.json → settings-role-permission-1.json} +17 -17
  84. package/registry/{settings-17.json → settings-security-1.json} +17 -17
  85. package/registry/{settings-5.json → settings-workspace-1.json} +28 -28
  86. package/registry/{settings-6.json → settings-workspace-2.json} +31 -31
  87. package/registry/support-1.json +853 -0
  88. package/registry/support-2.json +981 -0
  89. package/registry/support-3.json +762 -0
  90. package/registry/support-4.json +538 -0
  91. package/registry/team-1.json +829 -0
  92. package/registry/team-2.json +957 -0
  93. package/registry/ui/gauge.json +1 -1
  94. package/registry/ui/menu.json +1 -1
  95. package/registry/ui/property-meta.json +16 -0
  96. package/registry/ui/property-tone.json +12 -0
  97. package/registry/ui/scroll-area.json +1 -1
  98. package/registry/ui/select.json +1 -1
  99. package/registry/view.json +624 -351
  100. package/registry/app-shell-5.json +0 -106
  101. package/registry/bulk-import-1.json +0 -151
  102. package/registry/collection-layouts.json +0 -836
  103. package/registry/collection-views.json +0 -836
  104. package/registry/detail-sheet.json +0 -54
  105. package/registry/icon-row.json +0 -52
  106. package/registry/lookup-create-1.json +0 -157
  107. package/registry/next-steps-1.json +0 -147
  108. package/registry/settings-shell.json +0 -60
@@ -59,13 +59,13 @@
59
59
  {
60
60
  "path": "patterns/properties/composition/assigned/assigned-property.tsx",
61
61
  "type": "registry:file",
62
- "content": "'use client'\n\nimport {\n PersonProperty,\n PersonPropertyBadge,\n type PersonPropertyDropdownPlacement,\n type PersonPropertyOption,\n} from '../../display/person/index'\nimport type { PropertyVariant } from '../../shared/property-surface'\n\nexport type AssignedPropertyOption<TValue extends string = string> =\n PersonPropertyOption<TValue>\nexport type AssignedPropertyDropdownPlacement = PersonPropertyDropdownPlacement\n\nexport interface AssignedPropertyActionContext<TValue extends string = string> {\n option: AssignedPropertyOption<TValue>\n previousValue: TValue | null\n}\n\nexport interface AssignedPropertyProps<TValue extends string = string> {\n value: TValue | null\n options: readonly AssignedPropertyOption<TValue>[]\n action?: (\n value: TValue,\n context: AssignedPropertyActionContext<TValue>,\n ) => void\n ariaLabel?: string\n className?: string\n disabled?: boolean\n dropdownPlacement?: AssignedPropertyDropdownPlacement\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: TValue) => void\n}\n\nexport function AssignedProperty<TValue extends string = string>({\n action,\n ariaLabel = 'Responsável',\n dropdownPlacement,\n options,\n placeholder = 'Sem responsável',\n ...props\n}: Readonly<AssignedPropertyProps<TValue>>) {\n return (\n <PersonProperty\n action={action}\n ariaLabel={ariaLabel}\n dropdownPlacement={dropdownPlacement}\n options={options}\n placeholder={placeholder}\n {...props}\n />\n )\n}\n\nexport function AssignedPropertyBadge<TValue extends string = string>({\n className,\n option,\n placeholder = 'Sem responsável',\n}: Readonly<{\n className?: string\n option: AssignedPropertyOption<TValue> | null\n placeholder?: string\n}>) {\n return (\n <PersonPropertyBadge\n className={className}\n option={option}\n placeholder={placeholder}\n />\n )\n}\n",
62
+ "content": "'use client'\n\nimport {\n PersonProperty,\n PersonPropertyBadge,\n type PersonPropertyOption,\n} from '../../display/person/index'\nimport type {\n PropertyChangeContext,\n PropertySelectDropdownPlacement,\n} from '../../shared/property-catalog'\nimport {\n defaultPropertyAriaLabels,\n defaultPropertyPlaceholders,\n} from '../../shared/property-labels'\nimport type { PropertyVariant } from '../../shared/property-surface'\n\nexport interface AssignedPropertyActionContext<TValue extends string = string>\n extends PropertyChangeContext<TValue | null> {\n option: PersonPropertyOption<TValue>\n}\n\nexport interface AssignedPropertyProps<TValue extends string = string> {\n value: TValue | null\n options: readonly PersonPropertyOption<TValue>[]\n action?: (\n value: TValue,\n context: AssignedPropertyActionContext<TValue>,\n ) => void\n ariaLabel?: string\n className?: string\n disabled?: boolean\n dropdownPlacement?: PropertySelectDropdownPlacement\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: TValue) => void\n}\n\nexport function AssignedProperty<TValue extends string = string>({\n action,\n ariaLabel = defaultPropertyAriaLabels.assigned,\n dropdownPlacement,\n options,\n placeholder = defaultPropertyPlaceholders.assigned,\n ...props\n}: Readonly<AssignedPropertyProps<TValue>>) {\n return (\n <PersonProperty\n action={action}\n ariaLabel={ariaLabel}\n dropdownPlacement={dropdownPlacement}\n options={options}\n placeholder={placeholder}\n {...props}\n />\n )\n}\n\nexport function AssignedPropertyBadge<TValue extends string = string>({\n className,\n option,\n placeholder = defaultPropertyPlaceholders.assigned,\n}: Readonly<{\n className?: string\n option: PersonPropertyOption<TValue> | null\n placeholder?: string\n}>) {\n return (\n <PersonPropertyBadge\n className={className}\n option={option}\n placeholder={placeholder}\n />\n )\n}\n",
63
63
  "target": "~/packages/ui/src/patterns/properties/composition/assigned/assigned-property.tsx"
64
64
  },
65
65
  {
66
66
  "path": "patterns/properties/composition/assigned/index.ts",
67
67
  "type": "registry:file",
68
- "content": "export {\n AssignedProperty,\n type AssignedPropertyActionContext,\n AssignedPropertyBadge,\n type AssignedPropertyDropdownPlacement,\n type AssignedPropertyOption,\n type AssignedPropertyProps,\n} from './assigned-property'\n",
68
+ "content": "export {\n AssignedProperty,\n type AssignedPropertyActionContext,\n AssignedPropertyBadge,\n type AssignedPropertyProps,\n} from './assigned-property'\n",
69
69
  "target": "~/packages/ui/src/patterns/properties/composition/assigned/index.ts"
70
70
  },
71
71
  {
@@ -77,25 +77,25 @@
77
77
  {
78
78
  "path": "patterns/properties/composition/property-collection.tsx",
79
79
  "type": "registry:file",
80
- "content": "'use client'\n\nimport { DotsThreeIcon } from '@phosphor-icons/react'\nimport { Menu, MenuCheckboxItem, MenuPopup, MenuTrigger } from '@tc96/ui/menu'\nimport { cn } from '@tc96/utils'\nimport type React from 'react'\nimport { Fragment, useState } from 'react'\nimport type { PropertyIcon } from '../shared/property-catalog'\nimport { PropertyRow } from '../shared/property-row'\nimport { PropertySurface } from '../shared/property-surface'\n\nexport interface PropertyCollectionItem {\n id: string\n label: string\n icon?: PropertyIcon\n defaultVisible?: boolean\n render: () => React.ReactNode\n}\n\nexport interface PropertyCollectionProps {\n items: readonly PropertyCollectionItem[]\n ariaLabel?: string\n className?: string\n defaultVisible?: readonly string[]\n readOnly?: boolean\n triggerLabel?: string\n visible?: readonly string[]\n onVisibleChange?: (visible: readonly string[]) => void\n}\n\nexport function PropertyCollection({\n ariaLabel,\n className,\n defaultVisible,\n items,\n onVisibleChange,\n readOnly = false,\n triggerLabel = 'Ajustar propriedades',\n visible,\n}: Readonly<PropertyCollectionProps>) {\n const [uncontrolledVisible, setUncontrolledVisible] = useState<\n readonly string[]\n >(\n () =>\n defaultVisible ??\n items.filter((item) => item.defaultVisible).map((item) => item.id),\n )\n\n const visibleIds = visible ?? uncontrolledVisible\n const visibleSet = new Set(visibleIds)\n\n const toggle = (id: string) => {\n const next = items\n .filter((item) =>\n item.id === id ? !visibleSet.has(id) : visibleSet.has(item.id),\n )\n .map((item) => item.id)\n if (visible === undefined) {\n setUncontrolledVisible(next)\n }\n onVisibleChange?.(next)\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-x-1 gap-y-0.5', className)}\n slot=\"property-collection\"\n >\n {items\n .filter((item) => visibleSet.has(item.id))\n .map((item) => (\n <Fragment key={item.id}>{item.render()}</Fragment>\n ))}\n {readOnly ? null : (\n <Menu>\n <MenuTrigger\n aria-label={triggerLabel}\n render={\n <PropertySurface\n className=\"text-muted-foreground\"\n render={<button type=\"button\" />}\n />\n }\n >\n <DotsThreeIcon aria-hidden className=\"size-4\" />\n </MenuTrigger>\n <MenuPopup align=\"start\">\n {items.map((item) => {\n const Icon = item.icon\n return (\n <MenuCheckboxItem\n checked={visibleSet.has(item.id)}\n closeOnClick={false}\n key={item.id}\n onCheckedChange={() => toggle(item.id)}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n {Icon ? (\n <Icon\n aria-hidden\n className=\"size-4 text-muted-foreground\"\n />\n ) : null}\n <span className=\"truncate\">{item.label}</span>\n </span>\n </MenuCheckboxItem>\n )\n })}\n </MenuPopup>\n </Menu>\n )}\n </PropertyRow>\n )\n}\n",
80
+ "content": "'use client'\n\nimport { DotsThreeIcon } from '@phosphor-icons/react'\nimport { Menu, MenuCheckboxItem, MenuPopup, MenuTrigger } from '@tc96/ui/menu'\nimport { cn } from '@tc96/utils'\nimport type React from 'react'\nimport { Fragment, useState } from 'react'\nimport type { PropertyIcon } from '../shared/property-catalog'\nimport {\n defaultPropertyLabels,\n type PropertyCollectionLabels,\n resolvePropertyLabels,\n} from '../shared/property-labels'\nimport { PropertyRow } from '../shared/property-row'\nimport { PropertySurface } from '../shared/property-surface'\n\nexport interface PropertyCollectionItem {\n id: string\n label: string\n icon?: PropertyIcon\n defaultVisible?: boolean\n render: () => React.ReactNode\n}\n\nexport interface PropertyCollectionProps {\n items: readonly PropertyCollectionItem[]\n ariaLabel?: string\n className?: string\n defaultVisible?: readonly string[]\n labels?: Partial<PropertyCollectionLabels>\n readOnly?: boolean\n visible?: readonly string[]\n onVisibleChange?: (visible: readonly string[]) => void\n}\n\nexport function PropertyCollection({\n ariaLabel,\n className,\n defaultVisible,\n items,\n labels: labelOverrides,\n onVisibleChange,\n readOnly = false,\n visible,\n}: Readonly<PropertyCollectionProps>) {\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.collection,\n labelOverrides,\n )\n const [uncontrolledVisible, setUncontrolledVisible] = useState<\n readonly string[]\n >(\n () =>\n defaultVisible ??\n items.filter((item) => item.defaultVisible).map((item) => item.id),\n )\n\n const visibleIds = visible ?? uncontrolledVisible\n const visibleSet = new Set(visibleIds)\n\n const toggle = (id: string) => {\n const next = items\n .filter((item) =>\n item.id === id ? !visibleSet.has(id) : visibleSet.has(item.id),\n )\n .map((item) => item.id)\n if (visible === undefined) {\n setUncontrolledVisible(next)\n }\n onVisibleChange?.(next)\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-x-1 gap-y-0.5', className)}\n slot=\"property-collection\"\n >\n {items\n .filter((item) => visibleSet.has(item.id))\n .map((item) => (\n <Fragment key={item.id}>{item.render()}</Fragment>\n ))}\n {readOnly ? null : (\n <Menu>\n <MenuTrigger\n aria-label={labels.trigger}\n render={\n <PropertySurface\n className=\"text-muted-foreground\"\n render={<button type=\"button\" />}\n />\n }\n >\n <DotsThreeIcon aria-hidden className=\"size-4\" />\n </MenuTrigger>\n <MenuPopup align=\"start\">\n {items.map((item) => {\n const Icon = item.icon\n return (\n <MenuCheckboxItem\n checked={visibleSet.has(item.id)}\n closeOnClick={false}\n key={item.id}\n onCheckedChange={() => toggle(item.id)}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n {Icon ? (\n <Icon\n aria-hidden\n className=\"size-4 text-muted-foreground\"\n />\n ) : null}\n <span className=\"truncate\">{item.label}</span>\n </span>\n </MenuCheckboxItem>\n )\n })}\n </MenuPopup>\n </Menu>\n )}\n </PropertyRow>\n )\n}\n",
81
81
  "target": "~/packages/ui/src/patterns/properties/composition/property-collection.tsx"
82
82
  },
83
83
  {
84
84
  "path": "patterns/properties/display/attachments/attachment-property.tsx",
85
85
  "type": "registry:file",
86
- "content": "'use client'\n\nimport { XIcon } from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport type { ComponentPropsWithoutRef, ReactNode } from 'react'\nimport { PropertySurface } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport { type AttachmentType, AttachmentTypeIcon } from './attachment-type'\n\nexport interface AttachmentPropertyProps\n extends Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'download'> {\n action?: 'anchor' | 'download'\n label: ReactNode\n onRemove?: () => void\n removeLabel?: string\n type?: AttachmentType\n}\n\nexport function AttachmentProperty({\n action = 'anchor',\n className,\n label,\n onRemove,\n removeLabel,\n type,\n ...props\n}: Readonly<AttachmentPropertyProps>) {\n return (\n <PropertySurface\n className={cn('max-w-full', onRemove && 'pe-0', className)}\n data-slot=\"attachment-property\"\n >\n <IconLabelProperty\n label={label}\n leading={\n type ? <AttachmentTypeIcon aria-hidden=\"true\" type={type} /> : null\n }\n render={\n <a\n data-slot=\"attachment-property-link\"\n download={action === 'download' ? true : undefined}\n {...props}\n />\n }\n variant=\"plain\"\n />\n {onRemove ? (\n <button\n aria-label={removeLabel ?? 'Remover anexo'}\n className=\"h-full shrink-0 cursor-pointer px-1.5 opacity-80 transition-opacity hover:opacity-100\"\n data-slot=\"attachment-property-remove\"\n onClick={onRemove}\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" />\n </button>\n ) : null}\n </PropertySurface>\n )\n}\n",
86
+ "content": "'use client'\n\nimport { XIcon } from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport type { ComponentPropsWithoutRef, ReactNode } from 'react'\nimport {\n type AttachmentPropertyLabels,\n defaultPropertyLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport { PropertySurface } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport { type AttachmentType, AttachmentTypeIcon } from './attachment-type'\n\nexport interface AttachmentPropertyProps\n extends Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'download'> {\n action?: 'anchor' | 'download'\n label: ReactNode\n labels?: Partial<AttachmentPropertyLabels>\n onRemove?: () => void\n type?: AttachmentType\n}\n\nexport function AttachmentProperty({\n action = 'anchor',\n className,\n label,\n labels: labelOverrides,\n onRemove,\n type,\n ...props\n}: Readonly<AttachmentPropertyProps>) {\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.attachment,\n labelOverrides,\n )\n\n return (\n <PropertySurface\n className={cn('max-w-full', onRemove && 'pe-0', className)}\n data-slot=\"attachment-property\"\n >\n <IconLabelProperty\n label={label}\n leading={\n type ? <AttachmentTypeIcon aria-hidden=\"true\" type={type} /> : null\n }\n render={\n <a\n data-slot=\"attachment-property-link\"\n download={action === 'download' ? true : undefined}\n {...props}\n />\n }\n variant=\"plain\"\n />\n {onRemove ? (\n <button\n aria-label={labels.remove}\n className=\"h-full shrink-0 cursor-pointer px-1.5 opacity-80 transition-opacity hover:opacity-100\"\n data-slot=\"attachment-property-remove\"\n onClick={onRemove}\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" />\n </button>\n ) : null}\n </PropertySurface>\n )\n}\n",
87
87
  "target": "~/packages/ui/src/patterns/properties/display/attachments/attachment-property.tsx"
88
88
  },
89
89
  {
90
90
  "path": "patterns/properties/display/attachments/attachment-type.tsx",
91
91
  "type": "registry:file",
92
- "content": "import {\n FileIcon,\n FileTextIcon,\n LinkIcon,\n WaveformIcon,\n} from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport {\n type PropertyIcon,\n type PropertyTone,\n propertyToneClassName,\n} from '../../shared/property-catalog'\n\nexport type AttachmentType = 'audio' | 'doc' | 'link' | 'pdf'\n\ninterface AttachmentTypePreset {\n icon: PropertyIcon\n label: string\n tone: PropertyTone\n}\n\nexport const attachmentTypeCatalog: Record<\n AttachmentType,\n AttachmentTypePreset\n> = {\n audio: { icon: WaveformIcon, label: 'Áudio', tone: 'warning' },\n doc: { icon: FileIcon, label: 'Documento', tone: 'info' },\n link: { icon: LinkIcon, label: 'Link', tone: 'neutral' },\n pdf: { icon: FileTextIcon, label: 'PDF', tone: 'danger' },\n}\n\nexport interface AttachmentTypeIconProps {\n type: AttachmentType\n className?: string\n}\n\nexport function AttachmentTypeIcon({\n className,\n type,\n}: Readonly<AttachmentTypeIconProps>) {\n const preset = attachmentTypeCatalog[type]\n const Icon = preset.icon\n\n return (\n <Icon\n aria-hidden=\"true\"\n className={cn(\n 'size-4 shrink-0',\n propertyToneClassName[preset.tone],\n className,\n )}\n data-attachment-type={type}\n data-slot=\"attachment-type-icon\"\n />\n )\n}\n",
92
+ "content": "import { cn } from '@tc96/utils'\nimport { propertyToneClassName } from '../../shared/property-catalog'\nimport {\n type AttachmentType,\n attachmentTypeMeta,\n} from '../../shared/property-display-meta'\n\nexport type { AttachmentType }\n\nexport interface AttachmentTypeIconProps {\n type: AttachmentType\n className?: string\n}\n\nexport function AttachmentTypeIcon({\n className,\n type,\n}: Readonly<AttachmentTypeIconProps>) {\n const { icon: Icon, tone } = attachmentTypeMeta[type]\n\n return (\n <Icon\n aria-hidden=\"true\"\n className={cn('size-4 shrink-0', propertyToneClassName[tone], className)}\n data-attachment-type={type}\n data-slot=\"attachment-type-icon\"\n />\n )\n}\n",
93
93
  "target": "~/packages/ui/src/patterns/properties/display/attachments/attachment-type.tsx"
94
94
  },
95
95
  {
96
96
  "path": "patterns/properties/display/attachments/attachments-property.tsx",
97
97
  "type": "registry:file",
98
- "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport {\n Children,\n type ComponentType,\n type ReactNode,\n type SVGProps,\n} from 'react'\nimport { PropertyAddTrigger } from '../../shared/property-add-trigger'\nimport { PropertyRow } from '../../shared/property-row'\n\nexport interface AttachmentsPropertyAction {\n label: string\n onSelect: () => void\n disabled?: boolean\n icon?: ComponentType<SVGProps<SVGSVGElement>>\n}\n\nexport interface AttachmentsPropertyProps {\n children?: ReactNode\n action?: AttachmentsPropertyAction\n ariaLabel?: string\n className?: string\n}\n\nexport function AttachmentsProperty({\n action,\n ariaLabel,\n children,\n className,\n}: Readonly<AttachmentsPropertyProps>) {\n const hasAttachments = Children.count(children) > 0\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-x-1 gap-y-0.5', className)}\n slot=\"attachments-property\"\n >\n {children}\n {action ? (\n <PropertyAddTrigger\n addLabel={action.label}\n className=\"text-muted-foreground\"\n disabled={action.disabled}\n hasValue={hasAttachments}\n icon={action.icon}\n muted={false}\n onClick={action.onSelect}\n placeholder={action.label}\n />\n ) : null}\n </PropertyRow>\n )\n}\n",
98
+ "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport { Children, type ReactNode } from 'react'\nimport { PropertyAddTrigger } from '../../shared/property-add-trigger'\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport { PropertyRow } from '../../shared/property-row'\n\nexport interface AttachmentsPropertyAction {\n label: string\n onSelect: () => void\n disabled?: boolean\n icon?: PropertyIcon\n}\n\nexport interface AttachmentsPropertyProps {\n children?: ReactNode\n action?: AttachmentsPropertyAction\n ariaLabel?: string\n className?: string\n}\n\nexport function AttachmentsProperty({\n action,\n ariaLabel,\n children,\n className,\n}: Readonly<AttachmentsPropertyProps>) {\n const hasAttachments = Children.count(children) > 0\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-x-1 gap-y-0.5', className)}\n slot=\"attachments-property\"\n >\n {children}\n {action ? (\n <PropertyAddTrigger\n addLabel={action.label}\n className=\"text-muted-foreground\"\n disabled={action.disabled}\n hasValue={hasAttachments}\n icon={action.icon}\n muted={false}\n onClick={action.onSelect}\n placeholder={action.label}\n />\n ) : null}\n </PropertyRow>\n )\n}\n",
99
99
  "target": "~/packages/ui/src/patterns/properties/display/attachments/attachments-property.tsx"
100
100
  },
101
101
  {
@@ -107,13 +107,13 @@
107
107
  {
108
108
  "path": "patterns/properties/display/date-range/date-range-format.ts",
109
109
  "type": "registry:file",
110
- "content": "import type { DateRange } from '@daypicker/react'\nimport { formatShortDate, isValidDate } from '@tc96/ui/helpers/date'\n\nexport function formatDateRangeProperty(\n value: DateRange | undefined,\n fallback: string,\n locale: string,\n {\n fromLabel = 'A partir de',\n untilLabel = 'Até',\n }: Readonly<{ fromLabel?: string; untilLabel?: string }> = {},\n): string {\n const from = formatEnd(value?.from, locale)\n const to = formatEnd(value?.to, locale)\n\n if (from && to) return `${from} – ${to}`\n if (from) return `${fromLabel} ${from}`\n if (to) return `${untilLabel} ${to}`\n return fallback\n}\n\nfunction formatEnd(date: Date | undefined, locale: string): string | null {\n return isValidDate(date) ? formatShortDate(date, locale) : null\n}\n",
110
+ "content": "import type { DateRange } from '@daypicker/react'\nimport { formatShortDate, isValidDate } from '@tc96/ui/helpers/date'\nimport {\n type DateRangePropertyLabels,\n defaultPropertyLabels,\n} from '../../shared/property-labels'\n\nexport function formatDateRangeProperty(\n value: DateRange | undefined,\n fallback: string,\n locale: string,\n {\n from: fromLabel = defaultPropertyLabels.dateRange.from,\n until: untilLabel = defaultPropertyLabels.dateRange.until,\n }: Readonly<Partial<Pick<DateRangePropertyLabels, 'from' | 'until'>>> = {},\n): string {\n const from = formatEnd(value?.from, locale)\n const to = formatEnd(value?.to, locale)\n\n if (from && to) return `${from} – ${to}`\n if (from) return `${fromLabel} ${from}`\n if (to) return `${untilLabel} ${to}`\n return fallback\n}\n\nfunction formatEnd(date: Date | undefined, locale: string): string | null {\n return isValidDate(date) ? formatShortDate(date, locale) : null\n}\n",
111
111
  "target": "~/packages/ui/src/patterns/properties/display/date-range/date-range-format.ts"
112
112
  },
113
113
  {
114
114
  "path": "patterns/properties/display/date-range/date-range-property.tsx",
115
115
  "type": "registry:file",
116
- "content": "'use client'\n\nimport type { DateRange, DayPickerLocale } from '@daypicker/react'\nimport { CalendarIcon } from '@phosphor-icons/react'\nimport { Calendar } from '@tc96/ui/calendar'\nimport { useState } from 'react'\nimport {\n PropertyCalendarPopover,\n type PropertyCalendarProps,\n type PropertyPopoverDropdownPlacement,\n} from '../../shared/property-calendar-popover'\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport { formatDateRangeProperty } from './date-range-format'\n\nexport type { DateRange }\n\nexport interface DateRangePropertyProps {\n value: DateRange | undefined\n allowClear?: boolean\n ariaLabel?: string\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n className?: string\n clearLabel?: string\n disabled?: boolean\n displayLabel?: string\n dropdownPlacement?: PropertyPopoverDropdownPlacement\n fallback?: string\n fromLabel?: string\n locale?: string\n numberOfMonths?: number\n readOnly?: boolean\n untilLabel?: string\n variant?: PropertyVariant\n onValueChange?: (value: DateRange | undefined) => void\n}\n\nexport function DateRangeProperty({\n allowClear = true,\n ariaLabel,\n calendarLocale,\n calendarProps,\n className,\n clearLabel = 'Limpar período',\n disabled = false,\n displayLabel,\n dropdownPlacement,\n fallback = 'Sem período',\n fromLabel,\n locale = 'en-US',\n numberOfMonths = 2,\n onValueChange,\n readOnly = false,\n untilLabel,\n value,\n variant = 'badge',\n}: Readonly<DateRangePropertyProps>) {\n const [open, setOpen] = useState(false)\n const formatted = formatDateRangeProperty(value, fallback, locale, {\n fromLabel,\n untilLabel,\n })\n const isEmpty = formatted === fallback\n const label = isEmpty ? formatted : (displayLabel ?? formatted)\n\n if (readOnly || !onValueChange) {\n return (\n <IconLabelProperty\n className={className}\n icon={CalendarIcon}\n label={label}\n muted={isEmpty}\n variant={variant}\n />\n )\n }\n\n return (\n <PropertyCalendarPopover\n align=\"center\"\n ariaLabel={ariaLabel ?? 'Period'}\n className={className}\n clear={\n allowClear\n ? {\n label: clearLabel,\n onClear: () => {\n onValueChange(undefined)\n setOpen(false)\n },\n }\n : undefined\n }\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n icon={CalendarIcon}\n label={label}\n muted={isEmpty}\n onOpenChange={setOpen}\n open={open}\n variant={variant}\n >\n <Calendar\n defaultMonth={value?.from}\n locale={calendarLocale}\n mode=\"range\"\n numberOfMonths={numberOfMonths}\n selected={value}\n onSelect={onValueChange}\n {...calendarProps}\n />\n </PropertyCalendarPopover>\n )\n}\n",
116
+ "content": "'use client'\n\nimport type { DateRange, DayPickerLocale } from '@daypicker/react'\nimport { Calendar } from '@tc96/ui/calendar'\nimport { useState } from 'react'\nimport {\n PropertyCalendarPopover,\n type PropertyCalendarProps,\n} from '../../shared/property-calendar-popover'\nimport type { PropertyPopoverDropdownPlacement } from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport {\n type DateRangePropertyLabels,\n defaultPropertyAriaLabels,\n defaultPropertyLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport { formatDateRangeProperty } from './date-range-format'\n\nexport type { DateRange }\n\nexport interface DateRangePropertyProps {\n value: DateRange | undefined\n allowClear?: boolean\n ariaLabel?: string\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n className?: string\n disabled?: boolean\n displayLabel?: string\n dropdownPlacement?: PropertyPopoverDropdownPlacement\n labels?: Partial<DateRangePropertyLabels>\n locale?: string\n numberOfMonths?: number\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: DateRange | undefined) => void\n}\n\nexport function DateRangeProperty({\n allowClear = true,\n ariaLabel,\n calendarLocale,\n calendarProps,\n className,\n disabled = false,\n displayLabel,\n dropdownPlacement,\n labels: labelOverrides,\n locale = 'en-US',\n numberOfMonths = 2,\n onValueChange,\n readOnly = false,\n value,\n variant = 'badge',\n}: Readonly<DateRangePropertyProps>) {\n const [open, setOpen] = useState(false)\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.dateRange,\n labelOverrides,\n )\n const formatted = formatDateRangeProperty(\n value,\n labels.fallback,\n locale,\n labels,\n )\n const isEmpty = formatted === labels.fallback\n const label = isEmpty ? formatted : (displayLabel ?? formatted)\n\n if (readOnly || !onValueChange) {\n return (\n <IconLabelProperty\n className={className}\n icon={propertyDisplayIcons.dateRange}\n label={label}\n muted={isEmpty}\n variant={variant}\n />\n )\n }\n\n return (\n <PropertyCalendarPopover\n align=\"center\"\n ariaLabel={ariaLabel ?? defaultPropertyAriaLabels.dateRange}\n className={className}\n clear={\n allowClear\n ? {\n label: labels.clear,\n onClear: () => {\n onValueChange(undefined)\n setOpen(false)\n },\n }\n : undefined\n }\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n icon={propertyDisplayIcons.dateRange}\n label={label}\n muted={isEmpty}\n onOpenChange={setOpen}\n open={open}\n variant={variant}\n >\n <Calendar\n defaultMonth={value?.from}\n locale={calendarLocale}\n mode=\"range\"\n numberOfMonths={numberOfMonths}\n selected={value}\n onSelect={onValueChange}\n {...calendarProps}\n />\n </PropertyCalendarPopover>\n )\n}\n",
117
117
  "target": "~/packages/ui/src/patterns/properties/display/date-range/date-range-property.tsx"
118
118
  },
119
119
  {
@@ -125,7 +125,7 @@
125
125
  {
126
126
  "path": "patterns/properties/display/date/date-property.tsx",
127
127
  "type": "registry:file",
128
- "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport { CalendarDotsIcon } from '@phosphor-icons/react'\nimport { Calendar } from '@tc96/ui/calendar'\nimport { formatDateTime } from '@tc96/ui/helpers/date'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport {\n PropertyCalendarPopover,\n type PropertyCalendarProps,\n type PropertyPopoverDropdownPlacement,\n} from '../../shared/property-calendar-popover'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { PropertyTooltip } from '../../shared/property-tooltip'\nimport {\n formatDateProperty,\n parseDatePropertyValue,\n serializeDatePropertyValue,\n} from './date-value'\n\nexport type DatePropertyDropdownPlacement = PropertyPopoverDropdownPlacement\n\nexport interface DatePropertyActionContext {\n date: Date | null\n previousValue: string | null\n}\n\nexport interface DatePropertyProps {\n value: string | null\n action?: (value: string | null, context: DatePropertyActionContext) => void\n allowClear?: boolean\n ariaLabel?: string\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n className?: string\n clearLabel?: string\n fallback?: string\n disabled?: boolean\n displayLabel?: string\n dropdownPlacement?: DatePropertyDropdownPlacement\n isOverdue?: boolean\n locale?: string\n readOnly?: boolean\n serializeDate?: (date: Date) => string\n timeZone?: string\n tooltip?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: string | null) => void\n}\n\nfunction formatFullDate(\n value: string | null,\n locale: string,\n timeZone: string,\n): string | null {\n const date = parseDatePropertyValue(value)\n return date ? formatDateTime(date, locale, timeZone) : null\n}\n\nexport function DateProperty({\n action,\n allowClear = true,\n ariaLabel,\n calendarLocale,\n calendarProps,\n className,\n clearLabel = 'Limpar data',\n disabled = false,\n displayLabel,\n dropdownPlacement,\n fallback = 'Sem data',\n isOverdue = false,\n locale = 'en-US',\n onValueChange,\n readOnly = false,\n serializeDate = serializeDatePropertyValue,\n timeZone = 'UTC',\n tooltip = false,\n value,\n variant = 'badge',\n}: Readonly<DatePropertyProps>) {\n const [open, setOpen] = useState(false)\n const selectedDate = parseDatePropertyValue(value)\n const accessibleLabel = ariaLabel ?? 'Date'\n\n const handleChange = (nextValue: string | null, date: Date | null) => {\n if (nextValue !== value) {\n emitChange({ action, onValueChange }, nextValue, {\n date,\n previousValue: value,\n })\n }\n setOpen(false)\n }\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <DatePropertyBadge\n className={className}\n displayLabel={displayLabel}\n fallback={fallback}\n isOverdue={isOverdue}\n locale={locale}\n timeZone={timeZone}\n tooltip={tooltip}\n value={value}\n variant={variant}\n />\n )\n }\n\n const label =\n displayLabel ?? formatDateProperty(value, fallback, locale, timeZone)\n\n return (\n <PropertyCalendarPopover\n ariaLabel={accessibleLabel}\n className={cn(isOverdue && 'font-medium', className)}\n muted={!value}\n clear={\n allowClear\n ? { label: clearLabel, onClear: () => handleChange(null, null) }\n : undefined\n }\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n icon={CalendarDotsIcon}\n label={label}\n onOpenChange={setOpen}\n open={open}\n overdue={isOverdue}\n tooltip={tooltip ? formatFullDate(value, locale, timeZone) : null}\n variant={variant}\n >\n <Calendar\n defaultMonth={selectedDate ?? undefined}\n locale={calendarLocale}\n mode=\"single\"\n selected={selectedDate ?? undefined}\n onSelect={(date) => {\n if (!date) return\n handleChange(serializeDate(date), date)\n }}\n {...calendarProps}\n />\n </PropertyCalendarPopover>\n )\n}\n\nexport function DatePropertyBadge({\n className,\n displayLabel,\n fallback = 'Sem data',\n isOverdue = false,\n locale = 'en-US',\n timeZone = 'UTC',\n tooltip = false,\n value,\n variant = 'badge',\n}: Readonly<\n Pick<\n DatePropertyProps,\n | 'className'\n | 'displayLabel'\n | 'fallback'\n | 'isOverdue'\n | 'locale'\n | 'timeZone'\n | 'tooltip'\n | 'value'\n | 'variant'\n >\n>) {\n const label =\n displayLabel ?? formatDateProperty(value, fallback, locale, timeZone)\n const fullDate = tooltip ? formatFullDate(value, locale, timeZone) : null\n\n const surface = (\n <PropertySurface\n className={cn('max-w-full', isOverdue && 'font-medium', className)}\n data-overdue={isOverdue || undefined}\n data-slot=\"property-surface\"\n muted={!value}\n tabIndex={fullDate ? 0 : undefined}\n variant={variant}\n >\n <CalendarDotsIcon\n aria-hidden\n className=\"size-4\"\n data-slot=\"property-icon\"\n />\n <span className=\"truncate\">{label}</span>\n </PropertySurface>\n )\n\n if (!fullDate) return surface\n\n return <PropertyTooltip content={fullDate} trigger={surface} />\n}\n",
128
+ "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport { Calendar } from '@tc96/ui/calendar'\nimport { formatDateTime } from '@tc96/ui/helpers/date'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport {\n PropertyCalendarPopover,\n type PropertyCalendarProps,\n} from '../../shared/property-calendar-popover'\nimport type {\n PropertyChangeContext,\n PropertyPopoverDropdownPlacement,\n} from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport {\n type DatePropertyLabels,\n defaultPropertyAriaLabels,\n defaultPropertyLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { PropertyTooltip } from '../../shared/property-tooltip'\nimport {\n formatDateProperty,\n parseDatePropertyValue,\n serializeDatePropertyValue,\n} from './date-value'\n\nexport interface DatePropertyActionContext\n extends PropertyChangeContext<string | null> {\n date: Date | null\n}\n\nexport interface DatePropertyProps {\n value: string | null\n action?: (value: string | null, context: DatePropertyActionContext) => void\n allowClear?: boolean\n ariaLabel?: string\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n className?: string\n disabled?: boolean\n displayLabel?: string\n dropdownPlacement?: PropertyPopoverDropdownPlacement\n isOverdue?: boolean\n labels?: Partial<DatePropertyLabels>\n locale?: string\n readOnly?: boolean\n serializeDate?: (date: Date) => string\n timeZone?: string\n tooltip?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: string | null) => void\n}\n\nfunction formatFullDate(\n value: string | null,\n locale: string,\n timeZone: string,\n): string | null {\n const date = parseDatePropertyValue(value)\n return date ? formatDateTime(date, locale, timeZone) : null\n}\n\nexport function DateProperty({\n action,\n allowClear = true,\n ariaLabel,\n calendarLocale,\n calendarProps,\n className,\n disabled = false,\n displayLabel,\n dropdownPlacement,\n isOverdue = false,\n labels: labelOverrides,\n locale = 'en-US',\n onValueChange,\n readOnly = false,\n serializeDate = serializeDatePropertyValue,\n timeZone = 'UTC',\n tooltip = false,\n value,\n variant = 'badge',\n}: Readonly<DatePropertyProps>) {\n const [open, setOpen] = useState(false)\n const selectedDate = parseDatePropertyValue(value)\n const accessibleLabel = ariaLabel ?? defaultPropertyAriaLabels.date\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.date,\n labelOverrides,\n )\n\n const handleChange = (nextValue: string | null, date: Date | null) => {\n if (nextValue !== value) {\n emitChange({ action, onValueChange }, nextValue, {\n date,\n previousValue: value,\n })\n }\n setOpen(false)\n }\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <DatePropertyBadge\n className={className}\n displayLabel={displayLabel}\n isOverdue={isOverdue}\n labels={labels}\n locale={locale}\n timeZone={timeZone}\n tooltip={tooltip}\n value={value}\n variant={variant}\n />\n )\n }\n\n const label =\n displayLabel ?? formatDateProperty(value, labels.fallback, locale, timeZone)\n\n return (\n <PropertyCalendarPopover\n ariaLabel={accessibleLabel}\n className={cn(isOverdue && 'font-medium', className)}\n muted={!value}\n clear={\n allowClear\n ? { label: labels.clear, onClear: () => handleChange(null, null) }\n : undefined\n }\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n icon={propertyDisplayIcons.date}\n label={label}\n onOpenChange={setOpen}\n open={open}\n overdue={isOverdue}\n tooltip={tooltip ? formatFullDate(value, locale, timeZone) : null}\n variant={variant}\n >\n <Calendar\n defaultMonth={selectedDate ?? undefined}\n locale={calendarLocale}\n mode=\"single\"\n selected={selectedDate ?? undefined}\n onSelect={(date) => {\n if (!date) return\n handleChange(serializeDate(date), date)\n }}\n {...calendarProps}\n />\n </PropertyCalendarPopover>\n )\n}\n\nexport function DatePropertyBadge({\n className,\n displayLabel,\n isOverdue = false,\n labels,\n locale = 'en-US',\n timeZone = 'UTC',\n tooltip = false,\n value,\n variant = 'badge',\n}: Readonly<\n Pick<\n DatePropertyProps,\n | 'className'\n | 'displayLabel'\n | 'isOverdue'\n | 'labels'\n | 'locale'\n | 'timeZone'\n | 'tooltip'\n | 'value'\n | 'variant'\n >\n>) {\n const fallback = labels?.fallback ?? defaultPropertyLabels.date.fallback\n const label =\n displayLabel ?? formatDateProperty(value, fallback, locale, timeZone)\n const fullDate = tooltip ? formatFullDate(value, locale, timeZone) : null\n\n const DateIcon = propertyDisplayIcons.date\n const surface = (\n <PropertySurface\n className={cn('max-w-full', isOverdue && 'font-medium', className)}\n data-overdue={isOverdue || undefined}\n data-slot=\"property-surface\"\n muted={!value}\n tabIndex={fullDate ? 0 : undefined}\n variant={variant}\n >\n <DateIcon aria-hidden className=\"size-4\" data-slot=\"property-icon\" />\n <span className=\"truncate\">{label}</span>\n </PropertySurface>\n )\n\n if (!fullDate) return surface\n\n return <PropertyTooltip content={fullDate} trigger={surface} />\n}\n",
129
129
  "target": "~/packages/ui/src/patterns/properties/display/date/date-property.tsx"
130
130
  },
131
131
  {
@@ -137,7 +137,7 @@
137
137
  {
138
138
  "path": "patterns/properties/display/date/index.ts",
139
139
  "type": "registry:file",
140
- "content": "export {\n DateProperty,\n type DatePropertyActionContext,\n DatePropertyBadge,\n type DatePropertyDropdownPlacement,\n type DatePropertyProps,\n} from './date-property'\nexport {\n formatDateProperty,\n parseDatePropertyValue,\n serializeDatePropertyValue,\n} from './date-value'\n",
140
+ "content": "export {\n DateProperty,\n type DatePropertyActionContext,\n DatePropertyBadge,\n type DatePropertyProps,\n} from './date-property'\nexport {\n formatDateProperty,\n parseDatePropertyValue,\n serializeDatePropertyValue,\n} from './date-value'\n",
141
141
  "target": "~/packages/ui/src/patterns/properties/display/date/index.ts"
142
142
  },
143
143
  {
@@ -155,43 +155,43 @@
155
155
  {
156
156
  "path": "patterns/properties/display/email/email-address.ts",
157
157
  "type": "registry:file",
158
- "content": "import { z } from 'zod'\n\nexport const emailAddressSchema = z.email('Informe um e-mail válido.')\n",
158
+ "content": "import { z } from 'zod'\nimport { defaultPropertyLabels } from '../../shared/property-labels'\n\nexport function emailAddressSchema(\n message: string = defaultPropertyLabels.email.invalid,\n) {\n return z.email(message)\n}\n",
159
159
  "target": "~/packages/ui/src/patterns/properties/display/email/email-address.ts"
160
160
  },
161
161
  {
162
162
  "path": "patterns/properties/display/email/email-property.tsx",
163
163
  "type": "registry:file",
164
- "content": "'use client'\n\nimport { EnvelopeSimpleIcon, XIcon } from '@phosphor-icons/react'\nimport { Input } from '@tc96/ui/input'\nimport { Popover, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { useEntryListEditor } from '../../hooks/use-entry-list-editor'\nimport { createEntryParser } from '../../shared/lib/entry-parser'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { PropertyAddTrigger } from '../../shared/property-add-trigger'\nimport { PropertyEntryForm } from '../../shared/property-entry-form'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { EditableText } from '../editable-text/index'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport { emailAddressSchema } from './email-address'\n\nconst invalidEmailMessage = 'Informe um e-mail válido.'\nconst duplicateEmailMessage = 'Este e-mail já está na lista.'\nconst parseEmail = createEntryParser(emailAddressSchema, invalidEmailMessage)\n\nexport interface EmailPropertyActionContext {\n added: string | null\n previousValue: readonly string[]\n removed: string | null\n}\n\nexport interface EmailPropertyProps {\n value: readonly string[]\n action?: (\n value: readonly string[],\n context: EmailPropertyActionContext,\n ) => void\n\n addDisabled?: boolean\n addLabel?: string\n ariaLabel?: string\n className?: string\n disabled?: boolean\n display?: 'chips' | 'trigger'\n editing?: 'inline' | 'popover'\n entryLabels?: readonly string[]\n errorMessage?: string | null\n inputPlaceholder?: string\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly string[]) => void\n}\n\nexport function EmailProperty({\n action,\n addDisabled = false,\n addLabel = 'Adicionar e-mail',\n ariaLabel = 'E-mails',\n className,\n disabled = false,\n display = 'chips',\n editing = 'popover',\n entryLabels = ['Principal', 'Secundário'],\n errorMessage = null,\n inputPlaceholder = 'nome@exemplo.com',\n onValueChange,\n placeholder = 'Sem e-mail',\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<EmailPropertyProps>) {\n const [editingInline, setEditingInline] = useState(false)\n const [inlineDraft, setInlineDraft] = useState<string | null>(null)\n const [formatError, setFormatError] = useState<string | null>(null)\n\n const commit = (\n next: readonly string[],\n context: EmailPropertyActionContext,\n ) => emitChange({ action, onValueChange }, next, context)\n\n const editor = useEntryListEditor({\n duplicateMessage: duplicateEmailMessage,\n limit: entryLabels.length,\n onCommit: commit,\n parse: parseEmail,\n value,\n })\n\n const addEmail = (candidate: string): boolean => {\n const parsed = parseEmail(candidate.trim())\n if (!parsed.success) {\n setFormatError(parsed.message)\n return false\n }\n\n if (value.includes(parsed.value)) {\n setFormatError(duplicateEmailMessage)\n return false\n }\n\n commit([...value, parsed.value], {\n added: parsed.value,\n previousValue: value,\n removed: null,\n })\n return true\n }\n\n const removeEmail = (email: string) =>\n commit(\n value.filter((current) => current !== email),\n { added: null, previousValue: value, removed: email },\n )\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-1', className)}\n slot=\"email-property\"\n variant={variant}\n >\n {value.length > 0 ? (\n value.map((email) => (\n <IconLabelProperty\n icon={EnvelopeSimpleIcon}\n key={email}\n label={email}\n variant={variant}\n />\n ))\n ) : (\n <PropertySurface muted variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n const entryForm = (\n <PropertyEntryForm\n addLabel={addLabel}\n canAddAnother={editor.canAddAnother}\n drafts={editor.drafts}\n entryLabels={entryLabels}\n errorMessage={errorMessage}\n errors={editor.errors}\n onAdd={editor.addDraft}\n onChange={editor.setDraft}\n onRemove={editor.removeDraft}\n onSave={editor.save}\n removeLabel={(entryLabel) => `Remover ${entryLabel} e-mail`}\n renderField={(field) => (\n <Input\n aria-invalid={field.invalid || undefined}\n aria-label={field.ariaLabel}\n nativeInput\n onChange={(event) => field.onChange(event.target.value)}\n onKeyDown={field.onKeyDown}\n placeholder={inputPlaceholder}\n type=\"email\"\n value={field.draft}\n />\n )}\n />\n )\n\n const summary =\n value.length > 1\n ? `${value[0]} +${value.length - 1}`\n : (value[0] ?? placeholder)\n\n if (display === 'trigger') {\n return (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertySurface\n aria-label={\n value.length > 0 ? `${ariaLabel}: ${summary}` : ariaLabel\n }\n className={cn('max-w-full', className)}\n muted={value.length === 0}\n render={<button disabled={disabled} type=\"button\" />}\n variant={variant === 'plain' ? 'plain' : 'badge'}\n >\n <EnvelopeSimpleIcon\n aria-hidden=\"true\"\n className=\"size-4\"\n data-slot=\"property-icon\"\n />\n <span className=\"truncate\">{summary}</span>\n </PropertySurface>\n }\n />\n {entryForm}\n </Popover>\n )\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-1', className)}\n data-editing={editing}\n slot=\"email-property\"\n variant={variant}\n >\n {value.map((email) => (\n <IconLabelProperty\n className=\"pe-0\"\n icon={EnvelopeSimpleIcon}\n key={email}\n label={email}\n trailing={\n <button\n aria-label={`Remover e-mail ${email}`}\n className=\"flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n disabled={disabled}\n onClick={() => removeEmail(email)}\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n }\n />\n ))}\n\n {addDisabled ? null : editing === 'inline' ? (\n editingInline ? (\n <span className=\"inline-flex min-w-0 flex-col gap-0.5\">\n <PropertySurface className=\"w-48\">\n <EditableText\n ariaLabel={addLabel}\n className=\"text-sm\"\n onCommit={(next) => {\n const candidate = next?.trim() ?? ''\n if (!candidate) {\n setInlineDraft(null)\n setFormatError(null)\n setEditingInline(false)\n return\n }\n if (addEmail(candidate)) {\n setInlineDraft(null)\n setEditingInline(false)\n return\n }\n setInlineDraft(candidate)\n }}\n placeholder={inputPlaceholder}\n size=\"sm\"\n type=\"email\"\n value={inlineDraft}\n />\n </PropertySurface>\n {(formatError ?? errorMessage) ? (\n <span\n className=\"text-destructive-foreground text-xs\"\n role=\"alert\"\n >\n {formatError ?? errorMessage}\n </span>\n ) : null}\n </span>\n ) : (\n <PropertyAddTrigger\n addLabel={addLabel}\n disabled={disabled}\n hasValue={value.length > 0}\n icon={EnvelopeSimpleIcon}\n onClick={() => {\n setFormatError(null)\n setEditingInline(true)\n }}\n placeholder={placeholder}\n />\n )\n ) : (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertyAddTrigger\n addLabel={addLabel}\n disabled={disabled}\n hasValue={value.length > 0}\n icon={EnvelopeSimpleIcon}\n placeholder={placeholder}\n />\n }\n />\n {entryForm}\n </Popover>\n )}\n </PropertyRow>\n )\n}\n",
164
+ "content": "'use client'\n\nimport { XIcon } from '@phosphor-icons/react'\nimport { Input } from '@tc96/ui/input'\nimport { Popover, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { useEntryListEditor } from '../../hooks/use-entry-list-editor'\nimport { createEntryParser } from '../../shared/lib/entry-parser'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { PropertyAddTrigger } from '../../shared/property-add-trigger'\nimport type { PropertyListChangeContext } from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport { PropertyEntryForm } from '../../shared/property-entry-form'\nimport {\n defaultPropertyAriaLabels,\n defaultPropertyLabels,\n defaultPropertyPlaceholders,\n type EmailPropertyLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { EditableText } from '../editable-text/index'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport { emailAddressSchema } from './email-address'\n\nconst EmailIcon = propertyDisplayIcons.email\n\ntype EmailChangeContext = PropertyListChangeContext<string, string>\n\nexport interface EmailPropertyProps {\n value: readonly string[]\n action?: (value: readonly string[], context: EmailChangeContext) => void\n addDisabled?: boolean\n ariaLabel?: string\n className?: string\n disabled?: boolean\n display?: 'chips' | 'trigger'\n editing?: 'inline' | 'popover'\n errorMessage?: string | null\n labels?: Partial<EmailPropertyLabels>\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly string[]) => void\n}\n\nexport function EmailProperty({\n action,\n addDisabled = false,\n ariaLabel = defaultPropertyAriaLabels.email,\n className,\n disabled = false,\n display = 'chips',\n editing = 'popover',\n errorMessage = null,\n labels: labelOverrides,\n onValueChange,\n placeholder = defaultPropertyPlaceholders.email,\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<EmailPropertyProps>) {\n const [editingInline, setEditingInline] = useState(false)\n const [inlineDraft, setInlineDraft] = useState<string | null>(null)\n const [formatError, setFormatError] = useState<string | null>(null)\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.email,\n labelOverrides,\n )\n const parseEmail = createEntryParser(\n emailAddressSchema(labels.invalid),\n labels.invalid,\n )\n\n const commit = (next: readonly string[], context: EmailChangeContext) =>\n emitChange({ action, onValueChange }, next, context)\n\n const editor = useEntryListEditor({\n duplicateMessage: labels.duplicate,\n limit: labels.entries.length,\n onCommit: commit,\n parse: parseEmail,\n value,\n })\n\n const addEmail = (candidate: string): boolean => {\n const parsed = parseEmail(candidate.trim())\n if (!parsed.success) {\n setFormatError(parsed.message)\n return false\n }\n\n if (value.includes(parsed.value)) {\n setFormatError(labels.duplicate)\n return false\n }\n\n commit([...value, parsed.value], {\n added: parsed.value,\n previousValue: value,\n removed: null,\n })\n return true\n }\n\n const removeEmail = (email: string) =>\n commit(\n value.filter((current) => current !== email),\n { added: null, previousValue: value, removed: email },\n )\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-1', className)}\n slot=\"email-property\"\n variant={variant}\n >\n {value.length > 0 ? (\n value.map((email) => (\n <IconLabelProperty\n icon={EmailIcon}\n key={email}\n label={email}\n variant={variant}\n />\n ))\n ) : (\n <PropertySurface muted variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n const entryForm = (\n <PropertyEntryForm\n canAddAnother={editor.canAddAnother}\n drafts={editor.drafts}\n errorMessage={errorMessage}\n errors={editor.errors}\n labels={labels}\n onAdd={editor.addDraft}\n onChange={editor.setDraft}\n onRemove={editor.removeDraft}\n onSave={editor.save}\n renderField={(field) => (\n <Input\n aria-invalid={field.invalid || undefined}\n aria-label={field.ariaLabel}\n nativeInput\n onChange={(event) => field.onChange(event.target.value)}\n onKeyDown={field.onKeyDown}\n placeholder={labels.inputPlaceholder}\n type=\"email\"\n value={field.draft}\n />\n )}\n />\n )\n\n const summary =\n value.length > 1\n ? `${value[0]} +${value.length - 1}`\n : (value[0] ?? placeholder)\n\n if (display === 'trigger') {\n return (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertySurface\n aria-label={\n value.length > 0 ? `${ariaLabel}: ${summary}` : ariaLabel\n }\n className={cn('max-w-full', className)}\n muted={value.length === 0}\n render={<button disabled={disabled} type=\"button\" />}\n variant={variant === 'plain' ? 'plain' : 'badge'}\n >\n <EmailIcon\n aria-hidden=\"true\"\n className=\"size-4\"\n data-slot=\"property-icon\"\n />\n <span className=\"truncate\">{summary}</span>\n </PropertySurface>\n }\n />\n {entryForm}\n </Popover>\n )\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-1', className)}\n data-editing={editing}\n slot=\"email-property\"\n variant={variant}\n >\n {value.map((email) => (\n <IconLabelProperty\n className=\"pe-0\"\n icon={EmailIcon}\n key={email}\n label={email}\n trailing={\n <button\n aria-label={`${labels.remove} ${email}`}\n className=\"flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n disabled={disabled}\n onClick={() => removeEmail(email)}\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n }\n />\n ))}\n\n {addDisabled ? null : editing === 'inline' ? (\n editingInline ? (\n <span className=\"inline-flex min-w-0 flex-col gap-0.5\">\n <PropertySurface className=\"w-48\">\n <EditableText\n ariaLabel={labels.add}\n className=\"text-sm\"\n onCommit={(next) => {\n const candidate = next?.trim() ?? ''\n if (!candidate) {\n setInlineDraft(null)\n setFormatError(null)\n setEditingInline(false)\n return\n }\n if (addEmail(candidate)) {\n setInlineDraft(null)\n setEditingInline(false)\n return\n }\n setInlineDraft(candidate)\n }}\n placeholder={labels.inputPlaceholder}\n size=\"sm\"\n type=\"email\"\n value={inlineDraft}\n />\n </PropertySurface>\n {(formatError ?? errorMessage) ? (\n <span\n className=\"text-destructive-foreground text-xs\"\n role=\"alert\"\n >\n {formatError ?? errorMessage}\n </span>\n ) : null}\n </span>\n ) : (\n <PropertyAddTrigger\n addLabel={labels.add}\n disabled={disabled}\n hasValue={value.length > 0}\n icon={EmailIcon}\n onClick={() => {\n setFormatError(null)\n setEditingInline(true)\n }}\n placeholder={placeholder}\n />\n )\n ) : (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertyAddTrigger\n addLabel={labels.add}\n disabled={disabled}\n hasValue={value.length > 0}\n icon={EmailIcon}\n placeholder={placeholder}\n />\n }\n />\n {entryForm}\n </Popover>\n )}\n </PropertyRow>\n )\n}\n",
165
165
  "target": "~/packages/ui/src/patterns/properties/display/email/email-property.tsx"
166
166
  },
167
167
  {
168
168
  "path": "patterns/properties/display/email/index.ts",
169
169
  "type": "registry:file",
170
- "content": "export {\n EmailProperty,\n type EmailPropertyActionContext,\n type EmailPropertyProps,\n} from './email-property'\n",
170
+ "content": "export {\n EmailProperty,\n type EmailPropertyProps,\n} from './email-property'\n",
171
171
  "target": "~/packages/ui/src/patterns/properties/display/email/index.ts"
172
172
  },
173
173
  {
174
174
  "path": "patterns/properties/display/flag/flag-property.tsx",
175
175
  "type": "registry:file",
176
- "content": "'use client'\n\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport {\n IconLabelProperty,\n type IconLabelPropertyIcon,\n} from '../icon-label/icon-label-property'\n\nexport type FlagPropertyIcon = IconLabelPropertyIcon\n\nexport interface FlagPropertyProps {\n active: boolean\n label: string\n activeIcon?: FlagPropertyIcon\n ariaLabel?: string\n className?: string\n iconClassName?: string\n inactiveLabel?: string\n inactiveIcon?: FlagPropertyIcon\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",
176
+ "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",
177
177
  "target": "~/packages/ui/src/patterns/properties/display/flag/flag-property.tsx"
178
178
  },
179
179
  {
180
180
  "path": "patterns/properties/display/flag/index.ts",
181
181
  "type": "registry:file",
182
- "content": "export {\n FlagProperty,\n type FlagPropertyIcon,\n type FlagPropertyProps,\n} from './flag-property'\n",
182
+ "content": "export {\n FlagProperty,\n type FlagPropertyProps,\n} from './flag-property'\n",
183
183
  "target": "~/packages/ui/src/patterns/properties/display/flag/index.ts"
184
184
  },
185
185
  {
186
186
  "path": "patterns/properties/display/icon-label/icon-label-property.tsx",
187
187
  "type": "registry:file",
188
- "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport type React from 'react'\nimport type { ReactNode } from 'react'\nimport {\n PropertySurface,\n type PropertySurfaceProps,\n type PropertyVariant,\n} from '../../shared/property-surface'\n\nexport type IconLabelPropertyIcon = React.ComponentType<\n React.SVGProps<SVGSVGElement>\n>\n\nexport type IconLabelPropertyTrailingVisibility = 'always' | 'hover'\n\nexport interface IconLabelPropertyProps {\n label: ReactNode\n ariaLabel?: string\n className?: string\n icon?: IconLabelPropertyIcon\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",
188
+ "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",
189
189
  "target": "~/packages/ui/src/patterns/properties/display/icon-label/icon-label-property.tsx"
190
190
  },
191
191
  {
192
192
  "path": "patterns/properties/display/icon-label/index.ts",
193
193
  "type": "registry:file",
194
- "content": "export {\n IconLabelProperty,\n type IconLabelPropertyIcon,\n type IconLabelPropertyProps,\n} from './icon-label-property'\n",
194
+ "content": "export {\n IconLabelProperty,\n type IconLabelPropertyProps,\n} from './icon-label-property'\n",
195
195
  "target": "~/packages/ui/src/patterns/properties/display/icon-label/index.ts"
196
196
  },
197
197
  {
@@ -203,31 +203,31 @@
203
203
  {
204
204
  "path": "patterns/properties/display/people/index.ts",
205
205
  "type": "registry:file",
206
- "content": "export {\n PeopleProperty,\n type PeoplePropertyActionContext,\n type PeoplePropertyDropdownPlacement,\n type PeoplePropertyOption,\n type PeoplePropertyProps,\n} from './people-property'\n",
206
+ "content": "export {\n PeopleProperty,\n type PeoplePropertyProps,\n} from './people-property'\n",
207
207
  "target": "~/packages/ui/src/patterns/properties/display/people/index.ts"
208
208
  },
209
209
  {
210
210
  "path": "patterns/properties/display/people/people-property.tsx",
211
211
  "type": "registry:file",
212
- "content": "'use client'\n\nimport { UserPlusIcon } from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport { useMemo } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { resolveOptions } from '../../shared/lib/property-options'\nimport {\n type PropertyMultiSelectDropdownPlacement,\n PropertyMultiSelectShell,\n} from '../../shared/property-multi-select-shell'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport {\n PersonOptionContent,\n type PersonPropertyOption,\n} from '../person/person-option-content'\n\nconst addPersonLabel = 'Adicionar pessoa'\n\nexport type PeoplePropertyOption<TValue extends string = string> =\n PersonPropertyOption<TValue>\n\nexport type PeoplePropertyDropdownPlacement =\n PropertyMultiSelectDropdownPlacement\n\nexport interface PeoplePropertyActionContext<TValue extends string = string> {\n added: PeoplePropertyOption<TValue> | null\n previousValue: readonly TValue[]\n removed: PeoplePropertyOption<TValue> | null\n}\n\nexport interface PeoplePropertyProps<TValue extends string = string> {\n value: readonly TValue[]\n options: readonly PeoplePropertyOption<TValue>[]\n action?: (\n value: readonly TValue[],\n context: PeoplePropertyActionContext<TValue>,\n ) => void\n ariaLabel?: string\n className?: string\n disabled?: boolean\n dropdownPlacement?: PeoplePropertyDropdownPlacement\n isLoading?: boolean\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly TValue[]) => void\n}\n\nexport function PeopleProperty<TValue extends string = string>({\n action,\n ariaLabel = 'Pessoas',\n className,\n disabled = false,\n dropdownPlacement,\n isLoading = false,\n onValueChange,\n options,\n placeholder = addPersonLabel,\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<PeoplePropertyProps<TValue>>) {\n const selectedOptions = useMemo(\n () => resolveOptions(options, value),\n [options, value],\n )\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-1.5', className)}\n slot=\"people-property\"\n variant={variant}\n >\n {selectedOptions.length > 0 ? (\n selectedOptions.map((option) => (\n <PropertySurface key={option.value} variant={variant}>\n <PersonOptionContent option={option} size=\"xs\" />\n </PropertySurface>\n ))\n ) : (\n <PropertySurface className=\"text-muted-foreground\" variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('w-full', className)}\n slot=\"people-property\"\n variant={variant}\n >\n <PropertyMultiSelectShell\n addIcon={UserPlusIcon}\n addLabel={addPersonLabel}\n ariaLabel={ariaLabel}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n emptyLabel=\"Nenhuma pessoa encontrada.\"\n isLoading={isLoading}\n loadingLabel=\"Carregando pessoas…\"\n onChange={(nextValue, change) =>\n emitChange({ action, onValueChange }, nextValue, change)\n }\n options={options}\n placeholder={placeholder}\n removeLabel={(option) => `Remover ${option.label}`}\n renderChip={(option) => (\n <PersonOptionContent option={option} size=\"xs\" />\n )}\n renderOption={(option) => <PersonOptionContent option={option} />}\n selectedOptions={selectedOptions}\n value={value}\n variant={variant}\n />\n </PropertyRow>\n )\n}\n",
212
+ "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport { useMemo } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { resolveOptions } from '../../shared/lib/property-options'\nimport type {\n PropertyListChangeContext,\n PropertyMultiSelectDropdownPlacement,\n} from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport {\n defaultPropertyAriaLabels,\n defaultPropertyLabels,\n defaultPropertyPlaceholders,\n type PeoplePropertyLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport { PropertyMultiSelectShell } from '../../shared/property-multi-select-shell'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport {\n PersonOptionContent,\n type PersonPropertyOption,\n} from '../person/person-option-content'\n\nexport interface PeoplePropertyProps<TValue extends string = string> {\n value: readonly TValue[]\n options: readonly PersonPropertyOption<TValue>[]\n action?: (\n value: readonly TValue[],\n context: PropertyListChangeContext<PersonPropertyOption<TValue>, TValue>,\n ) => void\n ariaLabel?: string\n className?: string\n disabled?: boolean\n dropdownPlacement?: PropertyMultiSelectDropdownPlacement\n isLoading?: boolean\n labels?: Partial<PeoplePropertyLabels>\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly TValue[]) => void\n}\n\nexport function PeopleProperty<TValue extends string = string>({\n action,\n ariaLabel = defaultPropertyAriaLabels.people,\n className,\n disabled = false,\n dropdownPlacement,\n isLoading = false,\n labels: labelOverrides,\n onValueChange,\n options,\n placeholder = defaultPropertyPlaceholders.people,\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<PeoplePropertyProps<TValue>>) {\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.people,\n labelOverrides,\n )\n const selectedOptions = useMemo(\n () => resolveOptions(options, value),\n [options, value],\n )\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-1.5', className)}\n slot=\"people-property\"\n variant={variant}\n >\n {selectedOptions.length > 0 ? (\n selectedOptions.map((option) => (\n <PropertySurface key={option.value} variant={variant}>\n <PersonOptionContent option={option} size=\"xs\" />\n </PropertySurface>\n ))\n ) : (\n <PropertySurface className=\"text-muted-foreground\" variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('w-full', className)}\n slot=\"people-property\"\n variant={variant}\n >\n <PropertyMultiSelectShell\n addIcon={propertyDisplayIcons.personAdd}\n addLabel={labels.add}\n ariaLabel={ariaLabel}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n emptyLabel={labels.empty}\n isLoading={isLoading}\n loadingLabel={labels.loading}\n onChange={(nextValue, change) =>\n emitChange({ action, onValueChange }, nextValue, change)\n }\n options={options}\n placeholder={placeholder}\n removeLabel={(option) => `${labels.remove} ${option.label}`}\n renderChip={(option) => (\n <PersonOptionContent option={option} size=\"xs\" />\n )}\n renderOption={(option) => <PersonOptionContent option={option} />}\n selectedOptions={selectedOptions}\n value={value}\n variant={variant}\n />\n </PropertyRow>\n )\n}\n",
213
213
  "target": "~/packages/ui/src/patterns/properties/display/people/people-property.tsx"
214
214
  },
215
215
  {
216
216
  "path": "patterns/properties/display/person/index.ts",
217
217
  "type": "registry:file",
218
- "content": "export {\n PersonProperty,\n type PersonPropertyActionContext,\n PersonPropertyBadge,\n type PersonPropertyDropdownPlacement,\n type PersonPropertyOption,\n type PersonPropertyProps,\n} from './person-property'\n",
218
+ "content": "export {\n PersonProperty,\n type PersonPropertyActionContext,\n PersonPropertyBadge,\n type PersonPropertyOption,\n type PersonPropertyProps,\n} from './person-property'\n",
219
219
  "target": "~/packages/ui/src/patterns/properties/display/person/index.ts"
220
220
  },
221
221
  {
222
222
  "path": "patterns/properties/display/person/person-option-content.tsx",
223
223
  "type": "registry:file",
224
- "content": "'use client'\n\nimport { UserIcon } from '@phosphor-icons/react'\nimport { Avatar, AvatarFallback, AvatarImage } from '@tc96/ui/avatar'\nimport { resolveInitials } from '@tc96/ui/helpers/initials'\n\nexport type PersonAvatarSize = 'xs' | 'sm' | 'default' | 'lg' | 'xl'\n\nconst personAvatarSizeClassNames: Record<PersonAvatarSize, string | undefined> =\n {\n xs: '[--avatar-size:--spacing(4)] text-[0.625rem]',\n sm: '[--avatar-size:--spacing(6)] text-[0.625rem]',\n default: undefined,\n lg: '[--avatar-size:--spacing(10)]',\n xl: '[--avatar-size:--spacing(12)]',\n }\n\nexport interface PersonPropertyOption<TValue extends string = string> {\n value: TValue\n label: string\n fallback?: string\n imageUrl?: string\n supportingLabel?: string\n}\n\nexport function PersonAvatar({\n option,\n size = 'sm',\n}: Readonly<{\n option: PersonPropertyOption | null\n size?: PersonAvatarSize\n}>) {\n const resolved = option ? resolveInitials(option) : null\n const fallback =\n size === 'xs' && resolved !== null\n ? (Array.from(resolved)[0] ?? '')\n : resolved\n return (\n <Avatar className={personAvatarSizeClassNames[size]} data-size={size}>\n {option?.imageUrl ? <AvatarImage alt=\"\" src={option.imageUrl} /> : null}\n <AvatarFallback className=\"border border-input\">\n {fallback ?? <UserIcon aria-hidden className=\"size-4\" />}\n </AvatarFallback>\n </Avatar>\n )\n}\n\nexport function PersonOptionContent({\n option,\n size,\n}: Readonly<{\n option: PersonPropertyOption\n size?: PersonAvatarSize\n}>) {\n return (\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <PersonAvatar option={option} size={size} />\n <span className=\"min-w-0 truncate\">{option.label}</span>\n {option.supportingLabel ? (\n <span className=\"hidden text-muted-foreground text-xs in-data-[slot=combobox-chip]:text-foreground/72 sm:inline\">\n {option.supportingLabel}\n </span>\n ) : null}\n </span>\n )\n}\n",
224
+ "content": "'use client'\n\nimport { UserIcon } from '@phosphor-icons/react'\nimport { Avatar, AvatarFallback, AvatarImage } from '@tc96/ui/avatar'\nimport { resolveInitials } from '@tc96/ui/helpers/initials'\nimport type { PropertyOption } from '../../shared/property-catalog'\n\nexport type PersonAvatarSize = 'xs' | 'sm' | 'default' | 'lg' | 'xl'\n\nconst personAvatarSizeClassNames: Record<PersonAvatarSize, string | undefined> =\n {\n xs: '[--avatar-size:--spacing(4)] text-[0.625rem]',\n sm: '[--avatar-size:--spacing(6)] text-[0.625rem]',\n default: undefined,\n lg: '[--avatar-size:--spacing(10)]',\n xl: '[--avatar-size:--spacing(12)]',\n }\n\nexport interface PersonPropertyOption<TValue extends string = string>\n extends PropertyOption<TValue> {\n fallback?: string\n imageUrl?: string\n supportingLabel?: string\n}\n\nexport function PersonAvatar({\n option,\n size = 'sm',\n}: Readonly<{\n option: PersonPropertyOption | null\n size?: PersonAvatarSize\n}>) {\n const resolved = option ? resolveInitials(option) : null\n const fallback =\n size === 'xs' && resolved !== null\n ? (Array.from(resolved)[0] ?? '')\n : resolved\n return (\n <Avatar className={personAvatarSizeClassNames[size]} data-size={size}>\n {option?.imageUrl ? <AvatarImage alt=\"\" src={option.imageUrl} /> : null}\n <AvatarFallback className=\"border border-input\">\n {fallback ?? <UserIcon aria-hidden className=\"size-4\" />}\n </AvatarFallback>\n </Avatar>\n )\n}\n\nexport function PersonOptionContent({\n option,\n size,\n}: Readonly<{\n option: PersonPropertyOption\n size?: PersonAvatarSize\n}>) {\n return (\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <PersonAvatar option={option} size={size} />\n <span className=\"min-w-0 truncate\">{option.label}</span>\n {option.supportingLabel ? (\n <span className=\"hidden text-muted-foreground text-xs in-data-[slot=combobox-chip]:text-foreground/72 sm:inline\">\n {option.supportingLabel}\n </span>\n ) : null}\n </span>\n )\n}\n",
225
225
  "target": "~/packages/ui/src/patterns/properties/display/person/person-option-content.tsx"
226
226
  },
227
227
  {
228
228
  "path": "patterns/properties/display/person/person-property.tsx",
229
229
  "type": "registry:file",
230
- "content": "'use client'\n\nimport { UserPlusIcon } from '@phosphor-icons/react'\nimport { SelectItem } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { resolveOption } from '../../shared/lib/property-options'\nimport {\n type PropertySelectDropdownPlacement,\n PropertySelectShell,\n propertySelectItemClassName,\n} from '../../shared/property-select-shell'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport {\n PersonAvatar,\n type PersonAvatarSize,\n PersonOptionContent,\n type PersonPropertyOption,\n} from './person-option-content'\n\nexport type { PersonPropertyOption }\n\nexport type PersonPropertyDropdownPlacement = PropertySelectDropdownPlacement\n\nexport interface PersonPropertyActionContext<TValue extends string = string> {\n option: PersonPropertyOption<TValue>\n previousValue: TValue | null\n}\n\nexport interface PersonPropertyProps<TValue extends string = string> {\n value: TValue | null\n options: readonly PersonPropertyOption<TValue>[]\n action?: (value: TValue, context: PersonPropertyActionContext<TValue>) => void\n ariaLabel?: string\n avatarSize?: PersonAvatarSize\n className?: string\n disabled?: boolean\n display?: 'avatar' | 'full'\n dropdownPlacement?: PersonPropertyDropdownPlacement\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: TValue) => void\n}\n\nexport function PersonProperty<TValue extends string = string>({\n action,\n ariaLabel,\n avatarSize = 'xs',\n className,\n disabled = false,\n display = 'full',\n dropdownPlacement,\n onValueChange,\n options,\n placeholder = 'Sem responsável',\n readOnly = false,\n value,\n variant = 'badge',\n}: Readonly<PersonPropertyProps<TValue>>) {\n const selectedOption = value ? resolveOption(options, value) : null\n const accessibleLabel = ariaLabel ?? 'Person'\n\n return (\n <PropertySelectShell\n ariaLabel={`${accessibleLabel}: ${selectedOption?.label ?? placeholder}`}\n className={className}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n items={options}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n onValueChange={(option) => {\n if (option && option.value !== value) {\n emitChange({ action, onValueChange }, option.value, {\n option,\n previousValue: value,\n })\n }\n }}\n muted={!selectedOption}\n readOnly={!isEditable({ action, onValueChange, readOnly })}\n renderValue={(option) => (\n <PersonPropertyContent\n avatarSize={avatarSize}\n display={display}\n option={option}\n placeholder={placeholder}\n />\n )}\n variant={variant}\n value={selectedOption}\n >\n {options.map((option) => (\n <SelectItem\n aria-label={option.label}\n key={option.value}\n className={propertySelectItemClassName}\n value={option}\n >\n <PersonPropertyContent option={option} placeholder={placeholder} />\n </SelectItem>\n ))}\n </PropertySelectShell>\n )\n}\n\nexport function PersonPropertyBadge<TValue extends string = string>({\n ariaLabel,\n className,\n display = 'full',\n option,\n placeholder = 'Sem responsável',\n variant = 'badge',\n}: Readonly<{\n ariaLabel?: string\n className?: string\n display?: 'avatar' | 'full'\n option: PersonPropertyOption<TValue> | null\n placeholder?: string\n variant?: PropertyVariant\n}>) {\n return (\n <PropertySurface\n aria-label={ariaLabel}\n className={cn('max-w-full', className)}\n muted={!option}\n variant={variant}\n >\n <PersonPropertyContent\n avatarSize=\"xs\"\n display={display}\n option={option}\n placeholder={placeholder}\n />\n </PropertySurface>\n )\n}\n\nfunction PersonPropertyContent<TValue extends string = string>({\n avatarSize,\n display,\n option,\n placeholder,\n}: Readonly<{\n avatarSize?: PersonAvatarSize\n display?: 'avatar' | 'full'\n option: PersonPropertyOption<TValue> | null\n placeholder: string\n}>) {\n if (display === 'avatar') {\n return <PersonAvatar option={option} size={avatarSize} />\n }\n\n if (!option) {\n return (\n <span className=\"flex min-w-0 items-center gap-1.5 text-muted-foreground\">\n <UserPlusIcon aria-hidden className=\"size-4\" />\n <span className=\"truncate\">{placeholder}</span>\n </span>\n )\n }\n\n return <PersonOptionContent option={option} size={avatarSize} />\n}\n",
230
+ "content": "'use client'\n\nimport { SelectItem } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { resolveOption } from '../../shared/lib/property-options'\nimport type {\n PropertyChangeContext,\n PropertySelectDropdownPlacement,\n} from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport {\n defaultPropertyAriaLabels,\n defaultPropertyPlaceholders,\n} from '../../shared/property-labels'\nimport {\n PropertySelectShell,\n propertySelectItemClassName,\n} from '../../shared/property-select-shell'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport {\n PersonAvatar,\n type PersonAvatarSize,\n PersonOptionContent,\n type PersonPropertyOption,\n} from './person-option-content'\n\nexport type { PersonPropertyOption }\n\nexport interface PersonPropertyActionContext<TValue extends string = string>\n extends PropertyChangeContext<TValue | null> {\n option: PersonPropertyOption<TValue>\n}\n\nexport interface PersonPropertyProps<TValue extends string = string> {\n value: TValue | null\n options: readonly PersonPropertyOption<TValue>[]\n action?: (value: TValue, context: PersonPropertyActionContext<TValue>) => void\n ariaLabel?: string\n avatarSize?: PersonAvatarSize\n className?: string\n disabled?: boolean\n display?: 'avatar' | 'full'\n dropdownPlacement?: PropertySelectDropdownPlacement\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: TValue) => void\n}\n\nexport function PersonProperty<TValue extends string = string>({\n action,\n ariaLabel,\n avatarSize = 'xs',\n className,\n disabled = false,\n display = 'full',\n dropdownPlacement,\n onValueChange,\n options,\n placeholder = defaultPropertyPlaceholders.person,\n readOnly = false,\n value,\n variant = 'badge',\n}: Readonly<PersonPropertyProps<TValue>>) {\n const selectedOption = value ? resolveOption(options, value) : null\n const accessibleLabel = ariaLabel ?? defaultPropertyAriaLabels.person\n\n return (\n <PropertySelectShell\n ariaLabel={`${accessibleLabel}: ${selectedOption?.label ?? placeholder}`}\n className={className}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n items={options}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n onValueChange={(option) => {\n if (option && option.value !== value) {\n emitChange({ action, onValueChange }, option.value, {\n option,\n previousValue: value,\n })\n }\n }}\n muted={!selectedOption}\n readOnly={!isEditable({ action, onValueChange, readOnly })}\n renderValue={(option) => (\n <PersonPropertyContent\n avatarSize={avatarSize}\n display={display}\n option={option}\n placeholder={placeholder}\n />\n )}\n variant={variant}\n value={selectedOption}\n >\n {options.map((option) => (\n <SelectItem\n aria-label={option.label}\n key={option.value}\n className={propertySelectItemClassName}\n value={option}\n >\n <PersonPropertyContent option={option} placeholder={placeholder} />\n </SelectItem>\n ))}\n </PropertySelectShell>\n )\n}\n\nexport function PersonPropertyBadge<TValue extends string = string>({\n ariaLabel,\n className,\n display = 'full',\n option,\n placeholder = defaultPropertyPlaceholders.person,\n variant = 'badge',\n}: Readonly<{\n ariaLabel?: string\n className?: string\n display?: 'avatar' | 'full'\n option: PersonPropertyOption<TValue> | null\n placeholder?: string\n variant?: PropertyVariant\n}>) {\n return (\n <PropertySurface\n aria-label={ariaLabel}\n className={cn('max-w-full', className)}\n muted={!option}\n variant={variant}\n >\n <PersonPropertyContent\n avatarSize=\"xs\"\n display={display}\n option={option}\n placeholder={placeholder}\n />\n </PropertySurface>\n )\n}\n\nfunction PersonPropertyContent<TValue extends string = string>({\n avatarSize,\n display,\n option,\n placeholder,\n}: Readonly<{\n avatarSize?: PersonAvatarSize\n display?: 'avatar' | 'full'\n option: PersonPropertyOption<TValue> | null\n placeholder: string\n}>) {\n if (display === 'avatar') {\n return <PersonAvatar option={option} size={avatarSize} />\n }\n\n if (!option) {\n const AddIcon = propertyDisplayIcons.personAdd\n\n return (\n <span className=\"flex min-w-0 items-center gap-1.5 text-muted-foreground\">\n <AddIcon aria-hidden className=\"size-4\" />\n <span className=\"truncate\">{placeholder}</span>\n </span>\n )\n }\n\n return <PersonOptionContent option={option} size={avatarSize} />\n}\n",
231
231
  "target": "~/packages/ui/src/patterns/properties/display/person/person-property.tsx"
232
232
  },
233
233
  {
@@ -239,31 +239,31 @@
239
239
  {
240
240
  "path": "patterns/properties/display/phone-input/index.ts",
241
241
  "type": "registry:file",
242
- "content": "export type { PhoneCountryCode } from './countries'\nexport { PhoneInput, type PhoneInputProps } from './phone-input'\nexport {\n defaultPhoneCountry,\n type PhoneNumberSchemaOptions,\n phoneNumberSchema,\n} from './phone-number'\n",
242
+ "content": "export type { PhoneInputLabels } from '../../shared/property-labels'\nexport type { PhoneCountryCode } from './countries'\nexport { PhoneInput, type PhoneInputProps } from './phone-input'\nexport {\n defaultPhoneCountry,\n type PhoneNumberSchemaOptions,\n phoneNumberSchema,\n} from './phone-number'\n",
243
243
  "target": "~/packages/ui/src/patterns/properties/display/phone-input/index.ts"
244
244
  },
245
245
  {
246
246
  "path": "patterns/properties/display/phone-input/phone-input.tsx",
247
247
  "type": "registry:file",
248
- "content": "'use client'\n\nimport {\n CaretDownIcon,\n GlobeIcon,\n MagnifyingGlassIcon,\n} from '@phosphor-icons/react'\nimport {\n Combobox,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxPopup,\n ComboboxSeparator,\n ComboboxTrigger,\n useComboboxFilter,\n} from '@tc96/ui/combobox'\nimport { FieldPrimitive } from '@tc96/ui/field'\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from '@tc96/ui/input-group'\nimport type React from 'react'\nimport type { ComponentRef } from 'react'\nimport { useCallback, useRef, useState } from 'react'\nimport PhoneNumberInput from 'react-phone-number-input/input-max'\nimport { propertySelectItemClassName } from '../../shared/property-select-shell'\nimport {\n findPhoneCountry,\n type PhoneCountry,\n type PhoneCountryCode,\n phoneCountries,\n} from './countries'\nimport {\n defaultPhoneCountry,\n nationalDigits,\n phoneNumberCountry,\n} from './phone-number'\n\nexport interface PhoneInputProps {\n value: string | null\n onValueChange: (value: string | null) => void\n ariaLabel?: string\n className?: string\n defaultCountry?: PhoneCountryCode\n disabled?: boolean\n invalid?: boolean\n name?: string\n placeholder?: string\n readOnly?: boolean\n required?: boolean\n onBlur?: React.FocusEventHandler<HTMLInputElement>\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n}\n\nexport function PhoneInput({\n ariaLabel,\n className,\n defaultCountry = defaultPhoneCountry,\n disabled = false,\n invalid = false,\n name,\n onBlur,\n onKeyDown,\n onValueChange,\n placeholder,\n readOnly = false,\n required = false,\n value,\n}: Readonly<PhoneInputProps>) {\n const fieldRef = useRef<ComponentRef<typeof InputGroup>>(null)\n const [chosenCountry, setChosenCountry] =\n useState<PhoneCountryCode>(defaultCountry)\n\n const country = findPhoneCountry(phoneNumberCountry(value) ?? chosenCountry)\n\n const filter = useComboboxFilter({ sensitivity: 'base' })\n const matchesQuery = useCallback(\n (item: PhoneCountry, query: string) => {\n const digits = query.replace(/\\D/g, '')\n return (\n filter.contains(item.name, query) ||\n (digits !== '' && item.callingCode.startsWith(digits))\n )\n },\n [filter],\n )\n\n const selectCountry = (next: PhoneCountry | null) => {\n if (!next || next.code === country.code) return\n setChosenCountry(next.code)\n const digits = nationalDigits(value)\n onValueChange(digits === '' ? null : `+${next.callingCode}${digits}`)\n }\n\n return (\n <InputGroup className={className} data-slot=\"phone-input\" ref={fieldRef}>\n <FieldPrimitive.Root render={<span className=\"contents\" />}>\n <InputGroupAddon align=\"inline-start\">\n <Combobox\n filter={matchesQuery}\n items={phoneCountries}\n itemToStringLabel={(item: PhoneCountry) => item.name}\n onValueChange={selectCountry}\n value={country}\n >\n <ComboboxTrigger\n aria-label={`País: ${country.name}`}\n className=\"flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-0.5 outline-none transition-colors hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/24 disabled:cursor-default disabled:hover:bg-transparent\"\n disabled={disabled || readOnly}\n >\n <PhoneCountryFlag country={country} />\n <span className=\"text-base text-muted-foreground tabular-nums sm:text-sm\">\n +{country.callingCode}\n </span>\n <CaretDownIcon aria-hidden=\"true\" className=\"size-4 opacity-80\" />\n </ComboboxTrigger>\n <ComboboxPopup\n align=\"start\"\n anchor={fieldRef}\n aria-label=\"Selecionar país\"\n className=\"w-max\"\n >\n <ComboboxInput\n aria-label=\"Buscar país\"\n className=\"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0\"\n placeholder=\"Buscar país\"\n showTrigger={false}\n startAddon={<MagnifyingGlassIcon aria-hidden=\"true\" />}\n />\n <ComboboxSeparator className=\"mx-0 my-0\" />\n <ComboboxEmpty>Nenhum país encontrado.</ComboboxEmpty>\n <ComboboxList aria-label=\"Selecionar país\">\n {(item: PhoneCountry) => (\n <ComboboxItem\n className={propertySelectItemClassName}\n key={item.code}\n value={item}\n >\n <span className=\"flex w-full min-w-0 items-center gap-2\">\n <PhoneCountryFlag country={item} />\n <span className=\"min-w-0 truncate\">{item.name}</span>\n <span className=\"ms-auto shrink-0 text-muted-foreground tabular-nums\">\n +{item.callingCode}\n </span>\n </span>\n </ComboboxItem>\n )}\n </ComboboxList>\n </ComboboxPopup>\n </Combobox>\n <span aria-hidden=\"true\" className=\"h-4 w-px bg-input\" />\n </InputGroupAddon>\n </FieldPrimitive.Root>\n <PhoneNumberInput\n aria-invalid={invalid || undefined}\n aria-label={ariaLabel}\n autoComplete=\"tel\"\n country={country.code}\n disabled={disabled}\n inputComponent={PhoneNumberField}\n name={name}\n onBlur={onBlur}\n onChange={(next) => onValueChange(next ?? null)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n value={value ?? undefined}\n />\n </InputGroup>\n )\n}\n\nfunction PhoneNumberField({ ref, ...props }: React.ComponentProps<'input'>) {\n return <InputGroupInput ref={ref} {...props} />\n}\n\nfunction PhoneCountryFlag({ country }: Readonly<{ country: PhoneCountry }>) {\n const Flag = country.flag\n\n return (\n <span\n aria-hidden=\"true\"\n className=\"block w-5 shrink-0 overflow-hidden rounded-xs [&>svg]:block [&>svg]:h-auto [&>svg]:w-full\"\n >\n {Flag ? <Flag title={country.name} /> : <GlobeIcon aria-hidden=\"true\" />}\n </span>\n )\n}\n",
248
+ "content": "'use client'\n\nimport {\n CaretDownIcon,\n GlobeIcon,\n MagnifyingGlassIcon,\n} from '@phosphor-icons/react'\nimport {\n Combobox,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxPopup,\n ComboboxSeparator,\n ComboboxTrigger,\n useComboboxFilter,\n} from '@tc96/ui/combobox'\nimport { FieldPrimitive } from '@tc96/ui/field'\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from '@tc96/ui/input-group'\nimport type React from 'react'\nimport type { ComponentRef } from 'react'\nimport { useCallback, useRef, useState } from 'react'\nimport PhoneNumberInput from 'react-phone-number-input/input-max'\nimport {\n defaultPropertyLabels,\n type PhoneInputLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport { propertySelectItemClassName } from '../../shared/property-select-shell'\nimport {\n findPhoneCountry,\n type PhoneCountry,\n type PhoneCountryCode,\n phoneCountries,\n} from './countries'\nimport {\n defaultPhoneCountry,\n nationalDigits,\n phoneNumberCountry,\n} from './phone-number'\n\nexport interface PhoneInputProps {\n value: string | null\n onValueChange: (value: string | null) => void\n ariaLabel?: string\n className?: string\n defaultCountry?: PhoneCountryCode\n disabled?: boolean\n invalid?: boolean\n labels?: Partial<PhoneInputLabels>\n name?: string\n placeholder?: string\n readOnly?: boolean\n required?: boolean\n onBlur?: React.FocusEventHandler<HTMLInputElement>\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n}\n\nexport function PhoneInput({\n ariaLabel,\n className,\n defaultCountry = defaultPhoneCountry,\n disabled = false,\n invalid = false,\n labels: labelOverrides,\n name,\n onBlur,\n onKeyDown,\n onValueChange,\n placeholder,\n readOnly = false,\n required = false,\n value,\n}: Readonly<PhoneInputProps>) {\n const fieldRef = useRef<ComponentRef<typeof InputGroup>>(null)\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.phoneInput,\n labelOverrides,\n )\n const [chosenCountry, setChosenCountry] =\n useState<PhoneCountryCode>(defaultCountry)\n\n const country = findPhoneCountry(phoneNumberCountry(value) ?? chosenCountry)\n\n const filter = useComboboxFilter({ sensitivity: 'base' })\n const matchesQuery = useCallback(\n (item: PhoneCountry, query: string) => {\n const digits = query.replace(/\\D/g, '')\n return (\n filter.contains(item.name, query) ||\n (digits !== '' && item.callingCode.startsWith(digits))\n )\n },\n [filter],\n )\n\n const selectCountry = (next: PhoneCountry | null) => {\n if (!next || next.code === country.code) return\n setChosenCountry(next.code)\n const digits = nationalDigits(value)\n onValueChange(digits === '' ? null : `+${next.callingCode}${digits}`)\n }\n\n return (\n <InputGroup className={className} data-slot=\"phone-input\" ref={fieldRef}>\n <FieldPrimitive.Root render={<span className=\"contents\" />}>\n <InputGroupAddon align=\"inline-start\">\n <Combobox\n filter={matchesQuery}\n items={phoneCountries}\n itemToStringLabel={(item: PhoneCountry) => item.name}\n onValueChange={selectCountry}\n value={country}\n >\n <ComboboxTrigger\n aria-label={`${labels.country}: ${country.name}`}\n className=\"flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-0.5 outline-none transition-colors hover:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/24 disabled:cursor-default disabled:hover:bg-transparent\"\n disabled={disabled || readOnly}\n >\n <PhoneCountryFlag country={country} />\n <span className=\"text-base text-muted-foreground tabular-nums sm:text-sm\">\n +{country.callingCode}\n </span>\n <CaretDownIcon aria-hidden=\"true\" className=\"size-4 opacity-80\" />\n </ComboboxTrigger>\n <ComboboxPopup\n align=\"start\"\n anchor={fieldRef}\n aria-label={labels.countryList}\n className=\"w-max\"\n >\n <ComboboxInput\n aria-label={labels.countrySearch}\n className=\"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0\"\n placeholder={labels.countrySearch}\n showTrigger={false}\n startAddon={<MagnifyingGlassIcon aria-hidden=\"true\" />}\n />\n <ComboboxSeparator className=\"mx-0 my-0\" />\n <ComboboxEmpty>{labels.countryEmpty}</ComboboxEmpty>\n <ComboboxList aria-label={labels.countryList}>\n {(item: PhoneCountry) => (\n <ComboboxItem\n className={propertySelectItemClassName}\n key={item.code}\n value={item}\n >\n <span className=\"flex w-full min-w-0 items-center gap-2\">\n <PhoneCountryFlag country={item} />\n <span className=\"min-w-0 truncate\">{item.name}</span>\n <span className=\"ms-auto shrink-0 text-muted-foreground tabular-nums\">\n +{item.callingCode}\n </span>\n </span>\n </ComboboxItem>\n )}\n </ComboboxList>\n </ComboboxPopup>\n </Combobox>\n <span aria-hidden=\"true\" className=\"h-4 w-px bg-input\" />\n </InputGroupAddon>\n </FieldPrimitive.Root>\n <PhoneNumberInput\n aria-invalid={invalid || undefined}\n aria-label={ariaLabel}\n autoComplete=\"tel\"\n country={country.code}\n disabled={disabled}\n inputComponent={PhoneNumberField}\n name={name}\n onBlur={onBlur}\n onChange={(next) => onValueChange(next ?? null)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n value={value ?? undefined}\n />\n </InputGroup>\n )\n}\n\nfunction PhoneNumberField({ ref, ...props }: React.ComponentProps<'input'>) {\n return <InputGroupInput ref={ref} {...props} />\n}\n\nfunction PhoneCountryFlag({ country }: Readonly<{ country: PhoneCountry }>) {\n const Flag = country.flag\n\n return (\n <span\n aria-hidden=\"true\"\n className=\"block w-5 shrink-0 overflow-hidden rounded-xs [&>svg]:block [&>svg]:h-auto [&>svg]:w-full\"\n >\n {Flag ? <Flag title={country.name} /> : <GlobeIcon aria-hidden=\"true\" />}\n </span>\n )\n}\n",
249
249
  "target": "~/packages/ui/src/patterns/properties/display/phone-input/phone-input.tsx"
250
250
  },
251
251
  {
252
252
  "path": "patterns/properties/display/phone-input/phone-number.ts",
253
253
  "type": "registry:file",
254
- "content": "import {\n formatPhoneNumberIntl,\n isValidPhoneNumber,\n parsePhoneNumber,\n} from 'react-phone-number-input/input-max'\nimport { z } from 'zod'\nimport type { PhoneCountryCode } from './countries'\n\nexport const defaultPhoneCountry: PhoneCountryCode = 'BR'\n\nexport function phoneNumberCountry(\n value: string | null,\n): PhoneCountryCode | undefined {\n if (!value) return undefined\n return parsePhoneNumber(value)?.country\n}\n\nexport function nationalDigits(value: string | null): string {\n if (!value) return ''\n const callingCode = parsePhoneNumber(value)?.countryCallingCode\n if (!callingCode) return ''\n return value.slice(callingCode.length + 1)\n}\n\nexport function internationalPhoneLabel(value: string): string {\n return formatPhoneNumberIntl(value) || value\n}\n\nexport interface PhoneNumberSchemaOptions {\n invalidMessage?: string\n requiredMessage?: string\n}\n\nexport function phoneNumberSchema({\n invalidMessage = 'Informe um telefone válido.',\n requiredMessage = 'Informe um telefone.',\n}: PhoneNumberSchemaOptions = {}): z.ZodType<string, string> {\n return z\n .string({ error: requiredMessage })\n .trim()\n .min(1, requiredMessage)\n .refine((value) => isValidPhoneNumber(value), invalidMessage)\n}\n",
254
+ "content": "import {\n formatPhoneNumberIntl,\n isValidPhoneNumber,\n parsePhoneNumber,\n} from 'react-phone-number-input/input-max'\nimport { z } from 'zod'\nimport { defaultPropertyLabels } from '../../shared/property-labels'\nimport type { PhoneCountryCode } from './countries'\n\nexport const defaultPhoneCountry: PhoneCountryCode = 'BR'\n\nexport function phoneNumberCountry(\n value: string | null,\n): PhoneCountryCode | undefined {\n if (!value) return undefined\n return parsePhoneNumber(value)?.country\n}\n\nexport function nationalDigits(value: string | null): string {\n if (!value) return ''\n const callingCode = parsePhoneNumber(value)?.countryCallingCode\n if (!callingCode) return ''\n return value.slice(callingCode.length + 1)\n}\n\nexport function internationalPhoneLabel(value: string): string {\n return formatPhoneNumberIntl(value) || value\n}\n\nexport interface PhoneNumberSchemaOptions {\n invalidMessage?: string\n requiredMessage?: string\n}\n\nexport function phoneNumberSchema({\n invalidMessage = defaultPropertyLabels.phone.invalid,\n requiredMessage = defaultPropertyLabels.phone.required,\n}: PhoneNumberSchemaOptions = {}): z.ZodType<string, string> {\n return z\n .string({ error: requiredMessage })\n .trim()\n .min(1, requiredMessage)\n .refine((value) => isValidPhoneNumber(value), invalidMessage)\n}\n",
255
255
  "target": "~/packages/ui/src/patterns/properties/display/phone-input/phone-number.ts"
256
256
  },
257
257
  {
258
258
  "path": "patterns/properties/display/phone/index.ts",
259
259
  "type": "registry:file",
260
- "content": "export {\n PhoneProperty,\n type PhonePropertyActionContext,\n type PhonePropertyProps,\n} from './phone-property'\n",
260
+ "content": "export {\n PhoneProperty,\n type PhonePropertyProps,\n} from './phone-property'\n",
261
261
  "target": "~/packages/ui/src/patterns/properties/display/phone/index.ts"
262
262
  },
263
263
  {
264
264
  "path": "patterns/properties/display/phone/phone-property.tsx",
265
265
  "type": "registry:file",
266
- "content": "'use client'\n\nimport { PhoneIcon, XIcon } from '@phosphor-icons/react'\nimport { Popover, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport { useEntryListEditor } from '../../hooks/use-entry-list-editor'\nimport { createEntryParser } from '../../shared/lib/entry-parser'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { PropertyAddTrigger } from '../../shared/property-add-trigger'\nimport { PropertyEntryForm } from '../../shared/property-entry-form'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport {\n type PhoneCountryCode,\n PhoneInput,\n phoneNumberSchema,\n} from '../phone-input/index'\nimport { internationalPhoneLabel } from '../phone-input/phone-number'\n\nconst invalidPhoneMessage = 'Informe um telefone válido.'\nconst duplicatePhoneMessage = 'Este telefone já está na lista.'\nconst parsePhone = createEntryParser(phoneNumberSchema(), invalidPhoneMessage)\n\nexport interface PhonePropertyActionContext {\n added: string | null\n previousValue: readonly string[]\n removed: string | null\n}\n\nexport interface PhonePropertyProps {\n value: readonly string[]\n action?: (\n value: readonly string[],\n context: PhonePropertyActionContext,\n ) => void\n addLabel?: string\n ariaLabel?: string\n className?: string\n /** País assumido para o número digitado em formato nacional. */\n defaultCountry?: PhoneCountryCode\n /**\n * Recusa do **consumidor** — duplicata no workspace, unicidade, papel. Formato\n * não passa por aqui: o campo carrega a biblioteca que formata e sabe validar.\n */\n errorMessage?: string | null\n disabled?: boolean\n /**\n * `chips` mostra um chip por valor e colapsa o gatilho no `+`; `trigger`\n * mantém um gatilho único que segue nomeando a propriedade mesmo preenchida.\n * Lado a lado com outra fileira, dois `+` iguais não dizem a qual pertencem —\n * é o caso que `trigger` resolve, e a edição inteira vive no popup.\n */\n display?: 'chips' | 'trigger'\n /**\n * Fecha o caminho de adição sem tornar a fileira somente leitura: os números\n * já existentes continuam removíveis. Serve ao contrato que guarda um número\n * só — com um preenchido, não há segundo a adicionar.\n */\n addDisabled?: boolean\n /**\n * Rótulos das entradas do popup, na ordem de precedência — o cadastro que\n * guarda um número principal e um secundário declara os dois aqui. O tamanho\n * da lista é o teto: com todas preenchidas, não há outra a acrescentar.\n */\n entryLabels?: readonly string[]\n inputPlaceholder?: string\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly string[]) => void\n}\n\n/**\n * Telefones como fileira de chips, no mesmo gatilho de `TagsProperty`: vazia, o\n * gatilho se explica (\"Adicionar telefone\"); com números na fileira o contexto\n * já está dado e sobra o `+`, sem repetir a palavra ao lado de cada um.\n *\n * A diferença para Tags é a origem do valor: tag vem de catálogo fechado e o\n * popup é uma lista; telefone é digitado, e o popup é um campo. O componente não\n * valida formato — quem consome conhece o contrato do próprio domínio e devolve\n * a recusa por `errorMessage`.\n */\nexport function PhoneProperty({\n action,\n addDisabled = false,\n addLabel = 'Adicionar telefone',\n ariaLabel = 'Telefones',\n className,\n defaultCountry,\n disabled = false,\n display = 'chips',\n entryLabels = ['Principal', 'Secundário'],\n errorMessage = null,\n inputPlaceholder,\n onValueChange,\n placeholder = 'Sem telefone',\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<PhonePropertyProps>) {\n const commit = (\n next: readonly string[],\n context: PhonePropertyActionContext,\n ) => emitChange({ action, onValueChange }, next, context)\n\n const editor = useEntryListEditor({\n duplicateMessage: duplicatePhoneMessage,\n limit: entryLabels.length,\n onCommit: commit,\n parse: parsePhone,\n value,\n })\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-3', className)}\n slot=\"phone-property\"\n variant={variant}\n >\n {value.length > 0 ? (\n value.map((phone) => (\n <IconLabelProperty\n icon={PhoneIcon}\n key={phone}\n label={internationalPhoneLabel(phone)}\n variant={variant}\n />\n ))\n ) : (\n <PropertySurface muted variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n const entryForm = (\n <PropertyEntryForm\n addLabel={addLabel}\n canAddAnother={editor.canAddAnother}\n drafts={editor.drafts}\n entryLabels={entryLabels}\n errorMessage={errorMessage}\n errors={editor.errors}\n onAdd={editor.addDraft}\n onChange={editor.setDraft}\n onRemove={editor.removeDraft}\n onSave={editor.save}\n removeLabel={(entryLabel) => `Remover ${entryLabel} telefone`}\n renderField={(field) => (\n <PhoneInput\n ariaLabel={field.ariaLabel}\n defaultCountry={defaultCountry}\n invalid={field.invalid}\n onKeyDown={field.onKeyDown}\n onValueChange={(next) => field.onChange(next ?? '')}\n placeholder={inputPlaceholder}\n value={field.draft || null}\n />\n )}\n />\n )\n\n const summary =\n value.length > 1\n ? `${internationalPhoneLabel(value[0])} +${value.length - 1}`\n : value[0]\n ? internationalPhoneLabel(value[0])\n : placeholder\n\n if (display === 'trigger') {\n return (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertySurface\n aria-label={\n value.length > 0 ? `${ariaLabel}: ${summary}` : ariaLabel\n }\n className={cn('max-w-full', className)}\n muted={value.length === 0}\n render={<button disabled={disabled} type=\"button\" />}\n variant={variant === 'plain' ? 'plain' : 'badge'}\n >\n <PhoneIcon\n aria-hidden=\"true\"\n className=\"size-4\"\n data-slot=\"property-icon\"\n />\n <span className=\"truncate\">{summary}</span>\n </PropertySurface>\n }\n />\n {entryForm}\n </Popover>\n )\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-1', className)}\n slot=\"phone-property\"\n variant={variant}\n >\n {value.map((phone) => (\n <IconLabelProperty\n className=\"pe-0\"\n icon={PhoneIcon}\n key={phone}\n label={internationalPhoneLabel(phone)}\n trailing={\n <button\n aria-label={`Remover telefone ${internationalPhoneLabel(phone)}`}\n className=\"flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n disabled={disabled}\n onClick={() =>\n commit(\n value.filter((current) => current !== phone),\n { added: null, previousValue: value, removed: phone },\n )\n }\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n }\n />\n ))}\n\n {addDisabled ? null : (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertyAddTrigger\n addLabel={addLabel}\n disabled={disabled}\n hasValue={value.length > 0}\n icon={PhoneIcon}\n placeholder={placeholder}\n />\n }\n />\n {entryForm}\n </Popover>\n )}\n </PropertyRow>\n )\n}\n",
266
+ "content": "'use client'\n\nimport { XIcon } from '@phosphor-icons/react'\nimport { Popover, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport { useEntryListEditor } from '../../hooks/use-entry-list-editor'\nimport { createEntryParser } from '../../shared/lib/entry-parser'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { PropertyAddTrigger } from '../../shared/property-add-trigger'\nimport type { PropertyListChangeContext } from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport { PropertyEntryForm } from '../../shared/property-entry-form'\nimport {\n defaultPropertyAriaLabels,\n defaultPropertyLabels,\n defaultPropertyPlaceholders,\n type PhonePropertyLabels,\n resolvePropertyLabels,\n} from '../../shared/property-labels'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\nimport {\n type PhoneCountryCode,\n PhoneInput,\n phoneNumberSchema,\n} from '../phone-input/index'\nimport { internationalPhoneLabel } from '../phone-input/phone-number'\n\nconst PhoneIcon = propertyDisplayIcons.phone\n\ntype PhoneChangeContext = PropertyListChangeContext<string, string>\n\nexport interface PhonePropertyProps {\n value: readonly string[]\n action?: (value: readonly string[], context: PhoneChangeContext) => void\n ariaLabel?: string\n className?: string\n /** País assumido para o número digitado em formato nacional. */\n defaultCountry?: PhoneCountryCode\n /**\n * Recusa do **consumidor** — duplicata no workspace, unicidade, papel. Formato\n * não passa por aqui: o campo carrega a biblioteca que formata e sabe validar.\n */\n errorMessage?: string | null\n disabled?: boolean\n /**\n * `chips` mostra um chip por valor e colapsa o gatilho no `+`; `trigger`\n * mantém um gatilho único que segue nomeando a propriedade mesmo preenchida.\n * Lado a lado com outra fileira, dois `+` iguais não dizem a qual pertencem —\n * é o caso que `trigger` resolve, e a edição inteira vive no popup.\n */\n display?: 'chips' | 'trigger'\n /**\n * Fecha o caminho de adição sem tornar a fileira somente leitura: os números\n * já existentes continuam removíveis. Serve ao contrato que guarda um número\n * só — com um preenchido, não há segundo a adicionar.\n */\n addDisabled?: boolean\n labels?: Partial<PhonePropertyLabels>\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly string[]) => void\n}\n\n/**\n * Telefones como fileira de chips, no mesmo gatilho de `TagsProperty`: vazia, o\n * gatilho se explica (\"Adicionar telefone\"); com números na fileira o contexto\n * já está dado e sobra o `+`, sem repetir a palavra ao lado de cada um.\n *\n * A diferença para Tags é a origem do valor: tag vem de catálogo fechado e o\n * popup é uma lista; telefone é digitado, e o popup é um campo. O componente não\n * valida formato — quem consome conhece o contrato do próprio domínio e devolve\n * a recusa por `errorMessage`.\n */\nexport function PhoneProperty({\n action,\n addDisabled = false,\n ariaLabel = defaultPropertyAriaLabels.phone,\n className,\n defaultCountry,\n disabled = false,\n display = 'chips',\n errorMessage = null,\n labels: labelOverrides,\n onValueChange,\n placeholder = defaultPropertyPlaceholders.phone,\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<PhonePropertyProps>) {\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.phone,\n labelOverrides,\n )\n const parsePhone = createEntryParser(\n phoneNumberSchema({\n invalidMessage: labels.invalid,\n requiredMessage: labels.required,\n }),\n labels.invalid,\n )\n\n const commit = (next: readonly string[], context: PhoneChangeContext) =>\n emitChange({ action, onValueChange }, next, context)\n\n const editor = useEntryListEditor({\n duplicateMessage: labels.duplicate,\n limit: labels.entries.length,\n onCommit: commit,\n parse: parsePhone,\n value,\n })\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-3', className)}\n slot=\"phone-property\"\n variant={variant}\n >\n {value.length > 0 ? (\n value.map((phone) => (\n <IconLabelProperty\n icon={PhoneIcon}\n key={phone}\n label={internationalPhoneLabel(phone)}\n variant={variant}\n />\n ))\n ) : (\n <PropertySurface muted variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n const entryForm = (\n <PropertyEntryForm\n canAddAnother={editor.canAddAnother}\n drafts={editor.drafts}\n errorMessage={errorMessage}\n errors={editor.errors}\n labels={labels}\n onAdd={editor.addDraft}\n onChange={editor.setDraft}\n onRemove={editor.removeDraft}\n onSave={editor.save}\n renderField={(field) => (\n <PhoneInput\n ariaLabel={field.ariaLabel}\n defaultCountry={defaultCountry}\n invalid={field.invalid}\n labels={labels}\n onKeyDown={field.onKeyDown}\n onValueChange={(next) => field.onChange(next ?? '')}\n placeholder={labels.inputPlaceholder}\n value={field.draft || null}\n />\n )}\n />\n )\n\n const summary =\n value.length > 1\n ? `${internationalPhoneLabel(value[0])} +${value.length - 1}`\n : value[0]\n ? internationalPhoneLabel(value[0])\n : placeholder\n\n if (display === 'trigger') {\n return (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertySurface\n aria-label={\n value.length > 0 ? `${ariaLabel}: ${summary}` : ariaLabel\n }\n className={cn('max-w-full', className)}\n muted={value.length === 0}\n render={<button disabled={disabled} type=\"button\" />}\n variant={variant === 'plain' ? 'plain' : 'badge'}\n >\n <PhoneIcon\n aria-hidden=\"true\"\n className=\"size-4\"\n data-slot=\"property-icon\"\n />\n <span className=\"truncate\">{summary}</span>\n </PropertySurface>\n }\n />\n {entryForm}\n </Popover>\n )\n }\n\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap items-center gap-1', className)}\n slot=\"phone-property\"\n variant={variant}\n >\n {value.map((phone) => (\n <IconLabelProperty\n className=\"pe-0\"\n icon={PhoneIcon}\n key={phone}\n label={internationalPhoneLabel(phone)}\n trailing={\n <button\n aria-label={`${labels.remove} ${internationalPhoneLabel(phone)}`}\n className=\"flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n disabled={disabled}\n onClick={() =>\n commit(\n value.filter((current) => current !== phone),\n { added: null, previousValue: value, removed: phone },\n )\n }\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n }\n />\n ))}\n\n {addDisabled ? null : (\n <Popover onOpenChange={editor.onOpenChange} open={editor.open}>\n <PopoverTrigger\n render={\n <PropertyAddTrigger\n addLabel={labels.add}\n disabled={disabled}\n hasValue={value.length > 0}\n icon={PhoneIcon}\n placeholder={placeholder}\n />\n }\n />\n {entryForm}\n </Popover>\n )}\n </PropertyRow>\n )\n}\n",
267
267
  "target": "~/packages/ui/src/patterns/properties/display/phone/phone-property.tsx"
268
268
  },
269
269
  {
@@ -275,13 +275,13 @@
275
275
  {
276
276
  "path": "patterns/properties/display/reference/reference-property.tsx",
277
277
  "type": "registry:file",
278
- "content": "'use client'\n\nimport { BuildingsIcon, CubeIcon, PackageIcon } from '@phosphor-icons/react'\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\n\nexport type ReferencePropertyKind = 'account' | 'product' | 'record'\n\nexport interface ReferencePropertyProps {\n label: string\n ariaLabel?: string\n className?: string\n kind?: ReferencePropertyKind\n variant?: PropertyVariant\n}\n\nconst referenceIcon = {\n account: BuildingsIcon,\n product: PackageIcon,\n record: CubeIcon,\n} satisfies Record<ReferencePropertyKind, typeof CubeIcon>\n\nexport function ReferenceProperty({\n ariaLabel,\n className,\n kind = 'record',\n label,\n variant = 'badge',\n}: Readonly<ReferencePropertyProps>) {\n return (\n <IconLabelProperty\n ariaLabel={ariaLabel}\n className={className}\n icon={referenceIcon[kind]}\n label={label}\n variant={variant}\n />\n )\n}\n",
278
+ "content": "'use client'\n\nimport {\n type ReferencePropertyKind,\n referenceKindIcons,\n} from '../../shared/property-display-meta'\nimport type { PropertyVariant } from '../../shared/property-surface'\nimport { IconLabelProperty } from '../icon-label/icon-label-property'\n\nexport type { ReferencePropertyKind }\n\nexport interface ReferencePropertyProps {\n label: string\n ariaLabel?: string\n className?: string\n kind?: ReferencePropertyKind\n variant?: PropertyVariant\n}\n\nexport function ReferenceProperty({\n ariaLabel,\n className,\n kind = 'record',\n label,\n variant = 'badge',\n}: Readonly<ReferencePropertyProps>) {\n return (\n <IconLabelProperty\n ariaLabel={ariaLabel}\n className={className}\n icon={referenceKindIcons[kind]}\n label={label}\n variant={variant}\n />\n )\n}\n",
279
279
  "target": "~/packages/ui/src/patterns/properties/display/reference/reference-property.tsx"
280
280
  },
281
281
  {
282
282
  "path": "patterns/properties/display/schedule/index.ts",
283
283
  "type": "registry:file",
284
- "content": "export type { SchedulePropertyLabels } from './schedule-labels'\nexport type { SchedulePropertyDropdownPlacement } from './schedule-popup-frame'\nexport {\n ScheduleProperty,\n type SchedulePropertyProps,\n} from './schedule-property'\nexport type { ScheduleFooterLayout } from './schedule-section'\nexport type { ScheduleTimeControl } from './schedule-time-section'\nexport {\n defaultScheduleRecurrenceOptions,\n defaultScheduleReminderOptions,\n emptyScheduleValue,\n formatScheduleProperty,\n type ScheduleRecurrenceOption,\n type ScheduleReminderOption,\n type ScheduleValue,\n scheduleRecurrenceLabel,\n} from './schedule-value'\n",
284
+ "content": "export type { SchedulePropertyDropdownPlacement } from './schedule-popup-frame'\nexport {\n ScheduleProperty,\n type SchedulePropertyProps,\n} from './schedule-property'\nexport type { ScheduleFooterLayout } from './schedule-section'\nexport type { ScheduleTimeControl } from './schedule-time-section'\nexport {\n defaultScheduleRecurrenceOptions,\n defaultScheduleReminderOptions,\n emptyScheduleValue,\n formatScheduleProperty,\n type ScheduleValue,\n scheduleRecurrenceLabel,\n} from './schedule-value'\n",
285
285
  "target": "~/packages/ui/src/patterns/properties/display/schedule/index.ts"
286
286
  },
287
287
  {
@@ -296,46 +296,40 @@
296
296
  "content": "'use client'\n\nimport { CaretDownIcon, CaretRightIcon } from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport { useId } from 'react'\nimport {\n type ScheduleFooterProps,\n type ScheduleSection,\n scheduleSectionIcons,\n scheduleSectionLabel,\n scheduleSections,\n} from './schedule-section'\nimport { ScheduleSectionEditor } from './schedule-section-editor'\nimport { scheduleSectionSummary } from './schedule-summaries'\n\nfunction SectionRow({\n expanded,\n panelId,\n props,\n rowRef,\n section,\n}: Readonly<{\n props: ScheduleFooterProps\n section: ScheduleSection\n expanded?: boolean\n panelId?: string\n rowRef?: (element: HTMLButtonElement | null) => void\n}>) {\n const labelId = useId()\n const valueId = useId()\n const Icon = scheduleSectionIcons[section]\n const Chevron = expanded === undefined ? CaretRightIcon : CaretDownIcon\n const summary = scheduleSectionSummary(section, props)\n\n return (\n <button\n aria-controls={panelId}\n aria-describedby={valueId}\n aria-expanded={expanded}\n aria-labelledby={labelId}\n className=\"flex h-9 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-sm outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\"\n data-slot=\"schedule-section-row\"\n disabled={!props.enabled[section]}\n onClick={() => props.onSelect(section)}\n ref={rowRef}\n type=\"button\"\n >\n <Icon aria-hidden className=\"size-4 shrink-0 opacity-80\" />\n <span className=\"shrink-0 text-start\" id={labelId}>\n {scheduleSectionLabel(props.labels, section)}\n </span>\n <span\n className={cn(\n 'min-w-0 flex-1 truncate text-end text-xs',\n summary.filled ? 'text-foreground' : 'text-muted-foreground',\n expanded && 'invisible',\n )}\n id={valueId}\n >\n {summary.text}\n </span>\n <Chevron\n aria-hidden\n className={cn(\n 'size-4 shrink-0 opacity-60 transition-transform',\n expanded && 'rotate-180',\n )}\n />\n </button>\n )\n}\n\nexport function ScheduleFooterRows(props: Readonly<ScheduleFooterProps>) {\n const panelId = useId()\n\n return (\n <ul className=\"flex flex-col p-1\" data-slot=\"schedule-sections\">\n {scheduleSections.map((section) => {\n const expanded = props.active === section && props.enabled[section]\n\n return (\n <li key={section}>\n <SectionRow\n expanded={expanded}\n panelId={`${panelId}-${section}`}\n props={props}\n section={section}\n />\n {expanded ? (\n <fieldset\n aria-label={scheduleSectionLabel(props.labels, section)}\n className=\"mx-1 mb-1 min-w-0 rounded-md bg-muted/40\"\n id={`${panelId}-${section}`}\n >\n <ScheduleSectionEditor {...props} section={section} />\n </fieldset>\n ) : null}\n </li>\n )\n })}\n </ul>\n )\n}\n\nexport function ScheduleFooterDrillIn({\n rowRef,\n ...props\n}: Readonly<\n ScheduleFooterProps & {\n rowRef: (\n section: ScheduleSection,\n ) => (element: HTMLButtonElement | null) => void\n }\n>) {\n return (\n <ul className=\"flex flex-col p-1\" data-slot=\"schedule-sections\">\n {scheduleSections.map((section) => (\n <li key={section}>\n <SectionRow\n props={props}\n rowRef={rowRef(section)}\n section={section}\n />\n </li>\n ))}\n </ul>\n )\n}\n",
297
297
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-footer-rows.tsx"
298
298
  },
299
- {
300
- "path": "patterns/properties/display/schedule/schedule-labels.ts",
301
- "type": "registry:file",
302
- "content": "export interface SchedulePropertyLabels {\n addReminder: string\n allDay: string\n back: string\n end: string\n frequency: string\n nextWeek: string\n noDate: string\n noReminders: string\n noRepeat: string\n presets: string\n reminders: string\n removeReminder: string\n repeat: string\n start: string\n thisWeekend: string\n time: string\n today: string\n tomorrow: string\n until: string\n untilFallback: string\n}\n\nexport const defaultSchedulePropertyLabels: SchedulePropertyLabels = {\n addReminder: 'Adicionar lembrete',\n allDay: 'Dia inteiro',\n back: 'Voltar',\n end: 'Fim',\n frequency: 'Frequência',\n nextWeek: 'Próxima semana',\n noDate: 'Sem data',\n noReminders: 'Nenhum lembrete encontrado.',\n noRepeat: 'Não repete',\n presets: 'Atalhos de data',\n reminders: 'Lembretes',\n removeReminder: 'Remover lembrete',\n repeat: 'Repetir',\n start: 'Início',\n thisWeekend: 'Este fim de semana',\n time: 'Hora',\n today: 'Hoje',\n tomorrow: 'Amanhã',\n until: 'Até',\n untilFallback: 'Sem término',\n}\n",
303
- "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-labels.ts"
304
- },
305
299
  {
306
300
  "path": "patterns/properties/display/schedule/schedule-popup-frame.tsx",
307
301
  "type": "registry:file",
308
- "content": "'use client'\n\nimport { PopoverPrimitive } from '@tc96/ui/popover'\nimport type { ReactNode } from 'react'\nimport type { PropertyPopoverDropdownPlacement } from '../../shared/property-calendar-popover'\n\nexport type SchedulePropertyDropdownPlacement =\n PropertyPopoverDropdownPlacement &\n Pick<PopoverPrimitive.Positioner.Props, 'collisionAvoidance'>\n\nexport function SchedulePopupFrame({\n ariaLabel,\n children,\n placement: {\n align = 'start',\n alignOffset = 0,\n collisionAvoidance,\n side = 'bottom',\n sideOffset = 4,\n } = {},\n}: Readonly<{\n ariaLabel: string\n children: ReactNode\n placement?: SchedulePropertyDropdownPlacement\n}>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"z-50 max-w-(--available-width)\"\n collisionAvoidance={collisionAvoidance}\n data-slot=\"popover-positioner\"\n side={side}\n sideOffset={sideOffset}\n >\n <PopoverPrimitive.Popup\n aria-label={ariaLabel}\n className=\"relative flex max-h-(--available-height) origin-(--transform-origin) rounded-xl border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\"\n data-slot=\"popover-popup\"\n >\n <div className=\"relative min-h-0 w-full overflow-y-auto p-2\">\n {children}\n </div>\n </PopoverPrimitive.Popup>\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n )\n}\n",
302
+ "content": "'use client'\n\nimport { PopoverPrimitive } from '@tc96/ui/popover'\nimport type { ReactNode } from 'react'\nimport type { PropertyPopoverDropdownPlacement } from '../../shared/property-catalog'\n\nexport type SchedulePropertyDropdownPlacement =\n PropertyPopoverDropdownPlacement &\n Pick<PopoverPrimitive.Positioner.Props, 'collisionAvoidance'>\n\nexport function SchedulePopupFrame({\n ariaLabel,\n children,\n placement: {\n align = 'start',\n alignOffset = 0,\n collisionAvoidance,\n side = 'bottom',\n sideOffset = 4,\n } = {},\n}: Readonly<{\n ariaLabel: string\n children: ReactNode\n placement?: SchedulePropertyDropdownPlacement\n}>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"z-50 max-w-(--available-width)\"\n collisionAvoidance={collisionAvoidance}\n data-slot=\"popover-positioner\"\n side={side}\n sideOffset={sideOffset}\n >\n <PopoverPrimitive.Popup\n aria-label={ariaLabel}\n className=\"relative flex max-h-(--available-height) origin-(--transform-origin) rounded-xl border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\"\n data-slot=\"popover-popup\"\n >\n <div className=\"relative min-h-0 w-full overflow-y-auto p-2\">\n {children}\n </div>\n </PopoverPrimitive.Popup>\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n )\n}\n",
309
303
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-popup-frame.tsx"
310
304
  },
311
305
  {
312
306
  "path": "patterns/properties/display/schedule/schedule-popup.tsx",
313
307
  "type": "registry:file",
314
- "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport { Calendar } from '@tc96/ui/calendar'\nimport { Separator } from '@tc96/ui/separator'\nimport { cn } from '@tc96/utils'\nimport { useRef, useState } from 'react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport { ScheduleDetailView } from './schedule-detail-view'\nimport {\n ScheduleFooterDrillIn,\n ScheduleFooterRows,\n} from './schedule-footer-rows'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport { buildSchedulePresets, type SchedulePreset } from './schedule-presets'\nimport type {\n ScheduleFooterLayout,\n ScheduleFooterProps,\n ScheduleSection,\n} from './schedule-section'\nimport type { ScheduleTimeControl } from './schedule-time-section'\nimport type {\n ScheduleRecurrenceOption,\n ScheduleReminderOption,\n ScheduleValue,\n} from './schedule-value'\n\nfunction PresetList({\n label,\n onPick,\n presets,\n}: Readonly<{\n label: string\n onPick: (day: Date | null) => void\n presets: readonly SchedulePreset[]\n}>) {\n return (\n <ul aria-label={label} className=\"flex flex-col\">\n {presets.map(({ day, hint, icon: Icon, label: presetLabel }) => (\n <li key={presetLabel}>\n <button\n className={cn(\n 'flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-sm outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring',\n !day && 'text-muted-foreground',\n )}\n data-slot=\"schedule-preset\"\n onClick={() => onPick(day)}\n type=\"button\"\n >\n <Icon aria-hidden className=\"size-4 shrink-0 opacity-80\" />\n <span className=\"flex-1 truncate text-start\">{presetLabel}</span>\n {hint ? (\n <span className=\"shrink-0 text-muted-foreground text-xs\">\n {hint}\n </span>\n ) : null}\n </button>\n </li>\n ))}\n </ul>\n )\n}\n\nexport interface SchedulePopupProps {\n dateOnly: boolean\n labels: SchedulePropertyLabels\n locale: string\n onChange: (value: ScheduleValue) => void\n onDone: () => void\n recurrenceOptions: readonly ScheduleRecurrenceOption[]\n reminderOptions: readonly ScheduleReminderOption[]\n timeControl: ScheduleTimeControl\n today: Date\n value: ScheduleValue\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n footerLayout?: ScheduleFooterLayout\n recurrenceEnabled?: boolean\n remindersEnabled?: boolean\n}\n\nexport function SchedulePopup({\n calendarLocale,\n calendarProps,\n dateOnly,\n footerLayout = 'rows',\n labels,\n locale,\n onChange,\n onDone,\n recurrenceEnabled: recurrenceEnabledProp,\n recurrenceOptions,\n reminderOptions,\n remindersEnabled: remindersEnabledProp,\n timeControl,\n today,\n value,\n}: Readonly<SchedulePopupProps>) {\n const recurrenceEnabled = recurrenceEnabledProp ?? Boolean(value.from)\n const remindersEnabled = remindersEnabledProp ?? Boolean(value.from)\n const [active, setActive] = useState<ScheduleSection | null>(null)\n const [month, setMonth] = useState(value.from ?? today)\n const returnFocusRef = useRef<ScheduleSection | null>(null)\n const presets = buildSchedulePresets(today, labels, locale)\n const drillIn = footerLayout === 'drill-in'\n const enabled = {\n reminders: remindersEnabled,\n repeat: recurrenceEnabled,\n time: true,\n }\n\n const finish = () => {\n if (!active) onDone()\n }\n\n const select = (section: ScheduleSection) => {\n setActive((current) => (current === section ? null : section))\n }\n\n const back = () => {\n returnFocusRef.current = active\n setActive(null)\n }\n\n const restoreFocus =\n (section: ScheduleSection) => (element: HTMLButtonElement | null) => {\n if (element && returnFocusRef.current === section) {\n returnFocusRef.current = null\n element.focus()\n }\n }\n\n const pick = (day: Date | null) => {\n if (day?.getTime() !== value.from?.getTime()) {\n onChange({\n ...value,\n from: day,\n ...(day ? {} : { frequency: null, reminders: [], until: null }),\n })\n }\n if (day) setMonth(day)\n finish()\n }\n\n const footerProps: ScheduleFooterProps = {\n active,\n calendarLocale,\n calendarProps,\n enabled,\n labels,\n locale,\n onChange,\n onSelect: select,\n recurrenceOptions,\n reminderOptions,\n timeControl,\n value,\n }\n const detail = drillIn && active && enabled[active] ? active : null\n\n return (\n <div className=\"flex w-72 flex-col\" data-slot=\"schedule-popup\">\n {detail ? (\n <ScheduleDetailView {...footerProps} onBack={back} section={detail} />\n ) : (\n <div className=\"flex flex-col\">\n <div className=\"p-1\">\n <PresetList\n label={labels.presets}\n onPick={pick}\n presets={presets}\n />\n </div>\n <Separator className=\"my-2\" />\n <Calendar\n locale={calendarLocale}\n {...calendarProps}\n className={cn(\n 'w-full px-1 [--cell-size:--spacing(10)] sm:[--cell-size:--spacing(10)]',\n calendarProps?.className,\n )}\n mode=\"single\"\n month={month}\n onMonthChange={setMonth}\n onSelect={(day) => (day ? pick(day) : finish())}\n selected={value.from ?? undefined}\n today={today}\n />\n {dateOnly ? null : (\n <>\n <Separator className=\"my-2\" />\n {drillIn ? (\n <ScheduleFooterDrillIn {...footerProps} rowRef={restoreFocus} />\n ) : (\n <ScheduleFooterRows {...footerProps} />\n )}\n </>\n )}\n </div>\n )}\n </div>\n )\n}\n",
308
+ "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport { Calendar } from '@tc96/ui/calendar'\nimport { Separator } from '@tc96/ui/separator'\nimport { cn } from '@tc96/utils'\nimport { useRef, useState } from 'react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport type { PropertyOption } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport { ScheduleDetailView } from './schedule-detail-view'\nimport {\n ScheduleFooterDrillIn,\n ScheduleFooterRows,\n} from './schedule-footer-rows'\nimport { buildSchedulePresets, type SchedulePreset } from './schedule-presets'\nimport type {\n ScheduleFooterLayout,\n ScheduleFooterProps,\n ScheduleSection,\n} from './schedule-section'\nimport type { ScheduleTimeControl } from './schedule-time-section'\nimport type { ScheduleValue } from './schedule-value'\n\nfunction PresetList({\n label,\n onPick,\n presets,\n}: Readonly<{\n label: string\n onPick: (day: Date | null) => void\n presets: readonly SchedulePreset[]\n}>) {\n return (\n <ul aria-label={label} className=\"flex flex-col\">\n {presets.map(({ day, hint, icon: Icon, label: presetLabel }) => (\n <li key={presetLabel}>\n <button\n className={cn(\n 'flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-sm outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring',\n !day && 'text-muted-foreground',\n )}\n data-slot=\"schedule-preset\"\n onClick={() => onPick(day)}\n type=\"button\"\n >\n <Icon aria-hidden className=\"size-4 shrink-0 opacity-80\" />\n <span className=\"flex-1 truncate text-start\">{presetLabel}</span>\n {hint ? (\n <span className=\"shrink-0 text-muted-foreground text-xs\">\n {hint}\n </span>\n ) : null}\n </button>\n </li>\n ))}\n </ul>\n )\n}\n\nexport interface SchedulePopupProps {\n dateOnly: boolean\n labels: SchedulePropertyLabels\n locale: string\n onChange: (value: ScheduleValue) => void\n onDone: () => void\n recurrenceOptions: readonly PropertyOption[]\n reminderOptions: readonly PropertyOption[]\n timeControl: ScheduleTimeControl\n today: Date\n value: ScheduleValue\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n footerLayout?: ScheduleFooterLayout\n recurrenceEnabled?: boolean\n remindersEnabled?: boolean\n}\n\nexport function SchedulePopup({\n calendarLocale,\n calendarProps,\n dateOnly,\n footerLayout = 'rows',\n labels,\n locale,\n onChange,\n onDone,\n recurrenceEnabled: recurrenceEnabledProp,\n recurrenceOptions,\n reminderOptions,\n remindersEnabled: remindersEnabledProp,\n timeControl,\n today,\n value,\n}: Readonly<SchedulePopupProps>) {\n const recurrenceEnabled = recurrenceEnabledProp ?? Boolean(value.from)\n const remindersEnabled = remindersEnabledProp ?? Boolean(value.from)\n const [active, setActive] = useState<ScheduleSection | null>(null)\n const [month, setMonth] = useState(value.from ?? today)\n const returnFocusRef = useRef<ScheduleSection | null>(null)\n const presets = buildSchedulePresets(today, labels, locale)\n const drillIn = footerLayout === 'drill-in'\n const enabled = {\n reminders: remindersEnabled,\n repeat: recurrenceEnabled,\n time: true,\n }\n\n const finish = () => {\n if (!active) onDone()\n }\n\n const select = (section: ScheduleSection) => {\n setActive((current) => (current === section ? null : section))\n }\n\n const back = () => {\n returnFocusRef.current = active\n setActive(null)\n }\n\n const restoreFocus =\n (section: ScheduleSection) => (element: HTMLButtonElement | null) => {\n if (element && returnFocusRef.current === section) {\n returnFocusRef.current = null\n element.focus()\n }\n }\n\n const pick = (day: Date | null) => {\n if (day?.getTime() !== value.from?.getTime()) {\n onChange({\n ...value,\n from: day,\n ...(day ? {} : { frequency: null, reminders: [], until: null }),\n })\n }\n if (day) setMonth(day)\n finish()\n }\n\n const footerProps: ScheduleFooterProps = {\n active,\n calendarLocale,\n calendarProps,\n enabled,\n labels,\n locale,\n onChange,\n onSelect: select,\n recurrenceOptions,\n reminderOptions,\n timeControl,\n value,\n }\n const detail = drillIn && active && enabled[active] ? active : null\n\n return (\n <div className=\"flex w-72 flex-col\" data-slot=\"schedule-popup\">\n {detail ? (\n <ScheduleDetailView {...footerProps} onBack={back} section={detail} />\n ) : (\n <div className=\"flex flex-col\">\n <div className=\"p-1\">\n <PresetList\n label={labels.presets}\n onPick={pick}\n presets={presets}\n />\n </div>\n <Separator className=\"my-2\" />\n <Calendar\n locale={calendarLocale}\n {...calendarProps}\n className={cn(\n 'w-full px-1 [--cell-size:--spacing(10)] sm:[--cell-size:--spacing(10)]',\n calendarProps?.className,\n )}\n mode=\"single\"\n month={month}\n onMonthChange={setMonth}\n onSelect={(day) => (day ? pick(day) : finish())}\n selected={value.from ?? undefined}\n today={today}\n />\n {dateOnly ? null : (\n <>\n <Separator className=\"my-2\" />\n {drillIn ? (\n <ScheduleFooterDrillIn {...footerProps} rowRef={restoreFocus} />\n ) : (\n <ScheduleFooterRows {...footerProps} />\n )}\n </>\n )}\n </div>\n )}\n </div>\n )\n}\n",
315
309
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-popup.tsx"
316
310
  },
317
311
  {
318
312
  "path": "patterns/properties/display/schedule/schedule-presets.ts",
319
313
  "type": "registry:file",
320
- "content": "import {\n CalendarBlankIcon,\n CalendarIcon,\n CalendarSlashIcon,\n SunHorizonIcon,\n SunIcon,\n} from '@phosphor-icons/react'\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport { addLocalDays } from './schedule-value'\n\nexport interface SchedulePreset {\n day: Date | null\n hint: string\n icon: PropertyIcon\n label: string\n}\n\nconst SATURDAY = 6\nconst MONDAY = 1\n\nfunction nextWeekday(today: Date, weekday: number): Date {\n return addLocalDays(today, (weekday - today.getDay() + 7) % 7 || 7)\n}\n\nfunction capitalize(text: string, locale: string): string {\n return text.charAt(0).toLocaleUpperCase(locale) + text.slice(1)\n}\n\nexport function buildSchedulePresets(\n today: Date,\n labels: SchedulePropertyLabels,\n locale: string,\n): readonly SchedulePreset[] {\n const weekday = new Intl.DateTimeFormat(locale, { weekday: 'short' })\n const weekdayAndDay = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'short',\n weekday: 'short',\n })\n const hint = (format: Intl.DateTimeFormat, date: Date) =>\n capitalize(format.format(date).replaceAll('.', ''), locale)\n\n const tomorrow = addLocalDays(today, 1)\n const weekend = nextWeekday(today, SATURDAY)\n const nextWeek = nextWeekday(today, MONDAY)\n\n return [\n {\n day: today,\n hint: hint(weekday, today),\n icon: CalendarBlankIcon,\n label: labels.today,\n },\n {\n day: tomorrow,\n hint: hint(weekday, tomorrow),\n icon: SunIcon,\n label: labels.tomorrow,\n },\n {\n day: weekend,\n hint: hint(weekday, weekend),\n icon: SunHorizonIcon,\n label: labels.thisWeekend,\n },\n {\n day: nextWeek,\n hint: hint(weekdayAndDay, nextWeek),\n icon: CalendarIcon,\n label: labels.nextWeek,\n },\n { day: null, hint: '', icon: CalendarSlashIcon, label: labels.noDate },\n ]\n}\n",
314
+ "content": "import {\n CalendarBlankIcon,\n CalendarIcon,\n CalendarSlashIcon,\n SunHorizonIcon,\n SunIcon,\n} from '@phosphor-icons/react'\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport { addLocalDays } from './schedule-value'\n\nexport interface SchedulePreset {\n day: Date | null\n hint: string\n icon: PropertyIcon\n label: string\n}\n\nconst SATURDAY = 6\nconst MONDAY = 1\n\nfunction nextWeekday(today: Date, weekday: number): Date {\n return addLocalDays(today, (weekday - today.getDay() + 7) % 7 || 7)\n}\n\nfunction capitalize(text: string, locale: string): string {\n return text.charAt(0).toLocaleUpperCase(locale) + text.slice(1)\n}\n\nexport function buildSchedulePresets(\n today: Date,\n labels: SchedulePropertyLabels,\n locale: string,\n): readonly SchedulePreset[] {\n const weekday = new Intl.DateTimeFormat(locale, { weekday: 'short' })\n const weekdayAndDay = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'short',\n weekday: 'short',\n })\n const hint = (format: Intl.DateTimeFormat, date: Date) =>\n capitalize(format.format(date).replaceAll('.', ''), locale)\n\n const tomorrow = addLocalDays(today, 1)\n const weekend = nextWeekday(today, SATURDAY)\n const nextWeek = nextWeekday(today, MONDAY)\n\n return [\n {\n day: today,\n hint: hint(weekday, today),\n icon: CalendarBlankIcon,\n label: labels.today,\n },\n {\n day: tomorrow,\n hint: hint(weekday, tomorrow),\n icon: SunIcon,\n label: labels.tomorrow,\n },\n {\n day: weekend,\n hint: hint(weekday, weekend),\n icon: SunHorizonIcon,\n label: labels.thisWeekend,\n },\n {\n day: nextWeek,\n hint: hint(weekdayAndDay, nextWeek),\n icon: CalendarIcon,\n label: labels.nextWeek,\n },\n { day: null, hint: '', icon: CalendarSlashIcon, label: labels.noDate },\n ]\n}\n",
321
315
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-presets.ts"
322
316
  },
323
317
  {
324
318
  "path": "patterns/properties/display/schedule/schedule-property.tsx",
325
319
  "type": "registry:file",
326
- "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport { CalendarBlankIcon, RepeatIcon } from '@phosphor-icons/react'\nimport { Popover, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport {\n defaultSchedulePropertyLabels,\n type SchedulePropertyLabels,\n} from './schedule-labels'\nimport { SchedulePopup } from './schedule-popup'\nimport {\n SchedulePopupFrame,\n type SchedulePropertyDropdownPlacement,\n} from './schedule-popup-frame'\nimport type { ScheduleFooterLayout } from './schedule-section'\nimport type { ScheduleTimeControl } from './schedule-time-section'\nimport {\n defaultScheduleRecurrenceOptions,\n defaultScheduleReminderOptions,\n formatScheduleProperty,\n type ScheduleRecurrenceOption,\n type ScheduleReminderOption,\n type ScheduleValue,\n scheduleRecurrenceLabel,\n startOfLocalDay,\n} from './schedule-value'\n\nexport interface SchedulePropertyProps {\n ariaLabel: string\n value: ScheduleValue\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n className?: string\n dateOnly?: boolean\n dropdownPlacement?: SchedulePropertyDropdownPlacement\n fallback?: string\n footerLayout?: ScheduleFooterLayout\n labels?: Partial<SchedulePropertyLabels>\n locale?: string\n readOnly?: boolean\n recurrenceEnabled?: boolean\n recurrenceOptions?: readonly ScheduleRecurrenceOption[]\n reminderOptions?: readonly ScheduleReminderOption[]\n remindersEnabled?: boolean\n timeControl?: ScheduleTimeControl\n today?: Date\n variant?: PropertyVariant\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: ScheduleValue) => void\n}\n\nfunction ScheduleSurfaceContent({\n label,\n repeats,\n}: Readonly<{ label: string; repeats: boolean }>) {\n return (\n <>\n <CalendarBlankIcon\n aria-hidden\n className=\"size-4\"\n data-slot=\"property-icon\"\n />\n <span className=\"truncate\">{label}</span>\n {repeats ? <RepeatIcon aria-hidden className=\"size-4\" /> : null}\n </>\n )\n}\n\nexport function ScheduleProperty({\n ariaLabel,\n calendarLocale,\n calendarProps,\n className,\n dateOnly = false,\n dropdownPlacement,\n fallback,\n footerLayout,\n labels: labelOverrides,\n locale = 'pt-BR',\n onOpenChange,\n onValueChange,\n readOnly = false,\n recurrenceEnabled,\n recurrenceOptions = defaultScheduleRecurrenceOptions,\n reminderOptions = defaultScheduleReminderOptions,\n remindersEnabled,\n timeControl = 'select',\n today = startOfLocalDay(new Date()),\n value,\n variant = 'badge',\n}: Readonly<SchedulePropertyProps>) {\n const [open, setOpen] = useState(false)\n const labels = { ...defaultSchedulePropertyLabels, ...labelOverrides }\n const label = formatScheduleProperty(value, fallback ?? labels.noDate, locale)\n const repeatLabel = scheduleRecurrenceLabel(\n value.frequency,\n recurrenceOptions,\n )\n const accessibleName = [`${ariaLabel}: ${label}`, repeatLabel]\n .filter(Boolean)\n .join(' · ')\n\n const changeOpen = (next: boolean) => {\n setOpen(next)\n onOpenChange?.(next)\n }\n\n if (readOnly || !onValueChange) {\n return (\n <PropertySurface\n aria-label={accessibleName}\n className={cn('max-w-full', className)}\n muted={!value.from}\n variant={variant}\n >\n <ScheduleSurfaceContent label={label} repeats={Boolean(repeatLabel)} />\n </PropertySurface>\n )\n }\n\n return (\n <Popover onOpenChange={changeOpen} open={open}>\n <PopoverTrigger\n aria-label={accessibleName}\n render={\n <PropertySurface\n className={cn('max-w-full', className)}\n muted={!value.from}\n render={<button type=\"button\" />}\n variant={variant}\n />\n }\n >\n <ScheduleSurfaceContent label={label} repeats={Boolean(repeatLabel)} />\n </PopoverTrigger>\n <SchedulePopupFrame ariaLabel={ariaLabel} placement={dropdownPlacement}>\n <SchedulePopup\n calendarLocale={calendarLocale}\n calendarProps={calendarProps}\n dateOnly={dateOnly}\n footerLayout={footerLayout}\n labels={labels}\n locale={locale}\n onChange={onValueChange}\n onDone={() => changeOpen(false)}\n recurrenceEnabled={recurrenceEnabled}\n recurrenceOptions={recurrenceOptions}\n reminderOptions={reminderOptions}\n remindersEnabled={remindersEnabled}\n timeControl={timeControl}\n today={today}\n value={value}\n />\n </SchedulePopupFrame>\n </Popover>\n )\n}\n",
320
+ "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport { RepeatIcon } from '@phosphor-icons/react'\nimport { Popover, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport type { PropertyOption } from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport {\n defaultPropertyLabels,\n resolvePropertyLabels,\n type SchedulePropertyLabels,\n} from '../../shared/property-labels'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { SchedulePopup } from './schedule-popup'\nimport {\n SchedulePopupFrame,\n type SchedulePropertyDropdownPlacement,\n} from './schedule-popup-frame'\nimport type { ScheduleFooterLayout } from './schedule-section'\nimport type { ScheduleTimeControl } from './schedule-time-section'\nimport {\n formatScheduleProperty,\n type ScheduleValue,\n scheduleRecurrenceLabel,\n scheduleRecurrenceOptions,\n scheduleReminderOptions,\n startOfLocalDay,\n} from './schedule-value'\n\nexport interface SchedulePropertyProps {\n ariaLabel: string\n value: ScheduleValue\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n className?: string\n dateOnly?: boolean\n dropdownPlacement?: SchedulePropertyDropdownPlacement\n footerLayout?: ScheduleFooterLayout\n labels?: Partial<SchedulePropertyLabels>\n locale?: string\n readOnly?: boolean\n recurrenceEnabled?: boolean\n recurrenceOptions?: readonly PropertyOption[]\n reminderOptions?: readonly PropertyOption[]\n remindersEnabled?: boolean\n timeControl?: ScheduleTimeControl\n today?: Date\n variant?: PropertyVariant\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: ScheduleValue) => void\n}\n\nfunction ScheduleSurfaceContent({\n label,\n repeats,\n}: Readonly<{ label: string; repeats: boolean }>) {\n const ScheduleIcon = propertyDisplayIcons.schedule\n\n return (\n <>\n <ScheduleIcon aria-hidden className=\"size-4\" data-slot=\"property-icon\" />\n <span className=\"truncate\">{label}</span>\n {repeats ? <RepeatIcon aria-hidden className=\"size-4\" /> : null}\n </>\n )\n}\n\nexport function ScheduleProperty({\n ariaLabel,\n calendarLocale,\n calendarProps,\n className,\n dateOnly = false,\n dropdownPlacement,\n footerLayout,\n labels: labelOverrides,\n locale = 'en-US',\n onOpenChange,\n onValueChange,\n readOnly = false,\n recurrenceEnabled,\n recurrenceOptions: recurrenceOptionsProp,\n reminderOptions: reminderOptionsProp,\n remindersEnabled,\n timeControl = 'select',\n today = startOfLocalDay(new Date()),\n value,\n variant = 'badge',\n}: Readonly<SchedulePropertyProps>) {\n const [open, setOpen] = useState(false)\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.schedule,\n labelOverrides,\n )\n const recurrenceOptions =\n recurrenceOptionsProp ?? scheduleRecurrenceOptions(labels)\n const reminderOptions = reminderOptionsProp ?? scheduleReminderOptions(labels)\n const label = formatScheduleProperty(value, labels.fallback, locale)\n const repeatLabel = scheduleRecurrenceLabel(\n value.frequency,\n recurrenceOptions,\n )\n const accessibleName = [`${ariaLabel}: ${label}`, repeatLabel]\n .filter(Boolean)\n .join(' · ')\n\n const changeOpen = (next: boolean) => {\n setOpen(next)\n onOpenChange?.(next)\n }\n\n if (readOnly || !onValueChange) {\n return (\n <PropertySurface\n aria-label={accessibleName}\n className={cn('max-w-full', className)}\n muted={!value.from}\n variant={variant}\n >\n <ScheduleSurfaceContent label={label} repeats={Boolean(repeatLabel)} />\n </PropertySurface>\n )\n }\n\n return (\n <Popover onOpenChange={changeOpen} open={open}>\n <PopoverTrigger\n aria-label={accessibleName}\n render={\n <PropertySurface\n className={cn('max-w-full', className)}\n muted={!value.from}\n render={<button type=\"button\" />}\n variant={variant}\n />\n }\n >\n <ScheduleSurfaceContent label={label} repeats={Boolean(repeatLabel)} />\n </PopoverTrigger>\n <SchedulePopupFrame ariaLabel={ariaLabel} placement={dropdownPlacement}>\n <SchedulePopup\n calendarLocale={calendarLocale}\n calendarProps={calendarProps}\n dateOnly={dateOnly}\n footerLayout={footerLayout}\n labels={labels}\n locale={locale}\n onChange={onValueChange}\n onDone={() => changeOpen(false)}\n recurrenceEnabled={recurrenceEnabled}\n recurrenceOptions={recurrenceOptions}\n reminderOptions={reminderOptions}\n remindersEnabled={remindersEnabled}\n timeControl={timeControl}\n today={today}\n value={value}\n />\n </SchedulePopupFrame>\n </Popover>\n )\n}\n",
327
321
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-property.tsx"
328
322
  },
329
323
  {
330
324
  "path": "patterns/properties/display/schedule/schedule-recurrence-section.tsx",
331
325
  "type": "registry:file",
332
- "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport { DateProperty } from '../date/date-property'\nimport { SelectProperty } from '../select/select-property'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport type { ScheduleRecurrenceOption, ScheduleValue } from './schedule-value'\n\nexport function ScheduleRecurrenceSection({\n calendarLocale,\n calendarProps,\n labels,\n locale,\n onChange,\n options,\n value,\n}: Readonly<{\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n labels: SchedulePropertyLabels\n locale: string\n onChange: (value: ScheduleValue) => void\n options: readonly ScheduleRecurrenceOption[]\n value: ScheduleValue\n}>) {\n return (\n <div className=\"flex flex-col gap-2 p-2\" data-slot=\"schedule-recurrence\">\n <div className=\"flex h-8 items-center justify-between gap-2 text-sm\">\n {labels.frequency}\n <SelectProperty\n ariaLabel={labels.frequency}\n emptyOptionLabel={labels.noRepeat}\n onValueChange={(frequency) =>\n onChange({\n ...value,\n frequency: frequency || null,\n until: frequency ? value.until : null,\n })\n }\n options={options}\n placeholder={labels.noRepeat}\n value={value.frequency}\n />\n </div>\n {value.frequency ? (\n <div className=\"flex h-8 items-center justify-between gap-2 text-sm\">\n {labels.until}\n <DateProperty\n ariaLabel={labels.until}\n calendarLocale={calendarLocale}\n calendarProps={calendarProps}\n fallback={labels.untilFallback}\n locale={locale}\n onValueChange={(until) => onChange({ ...value, until })}\n value={value.until}\n />\n </div>\n ) : null}\n </div>\n )\n}\n",
326
+ "content": "'use client'\n\nimport type { DayPickerLocale } from '@daypicker/react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport type { PropertyOption } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport { DateProperty } from '../date/date-property'\nimport { SelectProperty } from '../select/select-property'\nimport type { ScheduleValue } from './schedule-value'\n\nexport function ScheduleRecurrenceSection({\n calendarLocale,\n calendarProps,\n labels,\n locale,\n onChange,\n options,\n value,\n}: Readonly<{\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n labels: SchedulePropertyLabels\n locale: string\n onChange: (value: ScheduleValue) => void\n options: readonly PropertyOption[]\n value: ScheduleValue\n}>) {\n return (\n <div className=\"flex flex-col gap-2 p-2\" data-slot=\"schedule-recurrence\">\n <div className=\"flex h-8 items-center justify-between gap-2 text-sm\">\n {labels.frequency}\n <SelectProperty\n allowEmpty\n ariaLabel={labels.frequency}\n labels={{ emptyOption: labels.noRepeat }}\n onValueChange={(frequency) =>\n onChange({\n ...value,\n frequency: frequency || null,\n until: frequency ? value.until : null,\n })\n }\n options={options}\n placeholder={labels.noRepeat}\n value={value.frequency}\n />\n </div>\n {value.frequency ? (\n <div className=\"flex h-8 items-center justify-between gap-2 text-sm\">\n {labels.until}\n <DateProperty\n ariaLabel={labels.until}\n calendarLocale={calendarLocale}\n calendarProps={calendarProps}\n labels={{\n clear: labels.clearUntil,\n fallback: labels.untilFallback,\n }}\n locale={locale}\n onValueChange={(until) => onChange({ ...value, until })}\n value={value.until}\n />\n </div>\n ) : null}\n </div>\n )\n}\n",
333
327
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-recurrence-section.tsx"
334
328
  },
335
329
  {
336
330
  "path": "patterns/properties/display/schedule/schedule-reminders-section.tsx",
337
331
  "type": "registry:file",
338
- "content": "'use client'\n\nimport { BellIcon } from '@phosphor-icons/react'\nimport { resolveOptions } from '../../shared/lib/property-options'\nimport { PropertyMultiSelectShell } from '../../shared/property-multi-select-shell'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport {\n type ScheduleReminderOption,\n type ScheduleValue,\n sortScheduleReminders,\n} from './schedule-value'\n\nexport function ScheduleRemindersSection({\n labels,\n onChange,\n options,\n value,\n}: Readonly<{\n labels: SchedulePropertyLabels\n onChange: (value: ScheduleValue) => void\n options: readonly ScheduleReminderOption[]\n value: ScheduleValue\n}>) {\n const reminders = sortScheduleReminders(value.reminders, options)\n\n return (\n <div className=\"flex flex-col gap-2 p-2\" data-slot=\"schedule-reminders\">\n <PropertyMultiSelectShell\n addIcon={BellIcon}\n addLabel={labels.addReminder}\n ariaLabel={labels.reminders}\n emptyLabel={labels.noReminders}\n loadingLabel=\"\"\n onChange={(next) =>\n onChange({\n ...value,\n reminders: sortScheduleReminders(next, options),\n })\n }\n options={options}\n placeholder={labels.addReminder}\n removeLabel={(option) => `${labels.removeReminder} ${option.label}`}\n renderOption={(option) => option.label}\n selectedOptions={resolveOptions(options, reminders)}\n value={reminders}\n />\n </div>\n )\n}\n",
332
+ "content": "'use client'\n\nimport { BellIcon } from '@phosphor-icons/react'\nimport { resolveOptions } from '../../shared/lib/property-options'\nimport type { PropertyOption } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport { PropertyMultiSelectShell } from '../../shared/property-multi-select-shell'\nimport { type ScheduleValue, sortScheduleReminders } from './schedule-value'\n\nexport function ScheduleRemindersSection({\n labels,\n onChange,\n options,\n value,\n}: Readonly<{\n labels: SchedulePropertyLabels\n onChange: (value: ScheduleValue) => void\n options: readonly PropertyOption[]\n value: ScheduleValue\n}>) {\n const reminders = sortScheduleReminders(value.reminders, options)\n\n return (\n <div className=\"flex flex-col gap-2 p-2\" data-slot=\"schedule-reminders\">\n <PropertyMultiSelectShell\n addIcon={BellIcon}\n addLabel={labels.addReminder}\n ariaLabel={labels.reminders}\n emptyLabel={labels.noReminders}\n loadingLabel=\"\"\n onChange={(next) =>\n onChange({\n ...value,\n reminders: sortScheduleReminders(next, options),\n })\n }\n options={options}\n placeholder={labels.addReminder}\n removeLabel={(option) => `${labels.removeReminder} ${option.label}`}\n renderOption={(option) => option.label}\n selectedOptions={resolveOptions(options, reminders)}\n value={reminders}\n />\n </div>\n )\n}\n",
339
333
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-reminders-section.tsx"
340
334
  },
341
335
  {
@@ -347,67 +341,67 @@
347
341
  {
348
342
  "path": "patterns/properties/display/schedule/schedule-section.ts",
349
343
  "type": "registry:file",
350
- "content": "import type { DayPickerLocale } from '@daypicker/react'\nimport type { Icon as PhosphorIcon } from '@phosphor-icons/react'\nimport { BellIcon, ClockIcon, RepeatIcon } from '@phosphor-icons/react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport type { ScheduleTimeControl } from './schedule-time-section'\nimport type {\n ScheduleRecurrenceOption,\n ScheduleReminderOption,\n ScheduleValue,\n} from './schedule-value'\n\nexport type ScheduleSection = 'time' | 'repeat' | 'reminders'\n\nexport type ScheduleFooterLayout = 'rows' | 'drill-in'\n\nexport const scheduleSections: readonly ScheduleSection[] = [\n 'time',\n 'repeat',\n 'reminders',\n]\n\nexport const scheduleSectionIcons: Readonly<\n Record<ScheduleSection, PhosphorIcon>\n> = {\n reminders: BellIcon,\n repeat: RepeatIcon,\n time: ClockIcon,\n}\n\nexport function scheduleSectionLabel(\n labels: SchedulePropertyLabels,\n section: ScheduleSection,\n): string {\n if (section === 'time') return labels.time\n if (section === 'repeat') return labels.repeat\n return labels.reminders\n}\n\nexport interface ScheduleEditorProps {\n labels: SchedulePropertyLabels\n locale: string\n onChange: (value: ScheduleValue) => void\n recurrenceOptions: readonly ScheduleRecurrenceOption[]\n reminderOptions: readonly ScheduleReminderOption[]\n timeControl: ScheduleTimeControl\n value: ScheduleValue\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n}\n\nexport interface ScheduleFooterProps extends ScheduleEditorProps {\n active: ScheduleSection | null\n enabled: Readonly<Record<ScheduleSection, boolean>>\n onSelect: (section: ScheduleSection) => void\n}\n",
344
+ "content": "import type { DayPickerLocale } from '@daypicker/react'\nimport type { Icon as PhosphorIcon } from '@phosphor-icons/react'\nimport { BellIcon, ClockIcon, RepeatIcon } from '@phosphor-icons/react'\nimport type { PropertyCalendarProps } from '../../shared/property-calendar-popover'\nimport type { PropertyOption } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport type { ScheduleTimeControl } from './schedule-time-section'\nimport type { ScheduleValue } from './schedule-value'\n\nexport type ScheduleSection = 'time' | 'repeat' | 'reminders'\n\nexport type ScheduleFooterLayout = 'rows' | 'drill-in'\n\nexport const scheduleSections: readonly ScheduleSection[] = [\n 'time',\n 'repeat',\n 'reminders',\n]\n\nexport const scheduleSectionIcons: Readonly<\n Record<ScheduleSection, PhosphorIcon>\n> = {\n reminders: BellIcon,\n repeat: RepeatIcon,\n time: ClockIcon,\n}\n\nexport function scheduleSectionLabel(\n labels: SchedulePropertyLabels,\n section: ScheduleSection,\n): string {\n if (section === 'time') return labels.time\n if (section === 'repeat') return labels.repeat\n return labels.reminders\n}\n\nexport interface ScheduleEditorProps {\n labels: SchedulePropertyLabels\n locale: string\n onChange: (value: ScheduleValue) => void\n recurrenceOptions: readonly PropertyOption[]\n reminderOptions: readonly PropertyOption[]\n timeControl: ScheduleTimeControl\n value: ScheduleValue\n calendarLocale?: DayPickerLocale\n calendarProps?: PropertyCalendarProps\n}\n\nexport interface ScheduleFooterProps extends ScheduleEditorProps {\n active: ScheduleSection | null\n enabled: Readonly<Record<ScheduleSection, boolean>>\n onSelect: (section: ScheduleSection) => void\n}\n",
351
345
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-section.ts"
352
346
  },
353
347
  {
354
348
  "path": "patterns/properties/display/schedule/schedule-summaries.ts",
355
349
  "type": "registry:file",
356
- "content": "import { formatDateProperty } from '../date/date-value'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport type { ScheduleSection } from './schedule-section'\nimport {\n type ScheduleRecurrenceOption,\n type ScheduleReminderOption,\n type ScheduleValue,\n scheduleRecurrenceLabel,\n sortScheduleReminders,\n} from './schedule-value'\n\nexport interface ScheduleSummary {\n filled: boolean\n text: string\n}\n\nexport interface ScheduleSummaryContext {\n labels: SchedulePropertyLabels\n locale: string\n recurrenceOptions: readonly ScheduleRecurrenceOption[]\n reminderOptions: readonly ScheduleReminderOption[]\n value: ScheduleValue\n}\n\nfunction timeSummary({ labels, value }: ScheduleSummaryContext) {\n if (value.allDay || !value.startTime) {\n return { filled: false, text: labels.allDay }\n }\n\n return {\n filled: true,\n text: value.endTime\n ? `${value.startTime} – ${value.endTime}`\n : value.startTime,\n }\n}\n\nfunction repeatSummary({\n labels,\n locale,\n recurrenceOptions,\n value,\n}: ScheduleSummaryContext) {\n const frequency = scheduleRecurrenceLabel(value.frequency, recurrenceOptions)\n if (!frequency) return { filled: false, text: labels.noRepeat }\n\n const until = formatDateProperty(value.until, '', locale, 'UTC')\n return {\n filled: true,\n text: until ? `${frequency} · ${labels.until} ${until}` : frequency,\n }\n}\n\nfunction remindersSummary({\n labels,\n reminderOptions,\n value,\n}: ScheduleSummaryContext) {\n const names = sortScheduleReminders(value.reminders, reminderOptions)\n .map(\n (reminder) =>\n reminderOptions.find((option) => option.value === reminder)?.label,\n )\n .filter((name): name is string => Boolean(name))\n\n const [first, ...rest] = names\n if (first === undefined) return { filled: false, text: labels.addReminder }\n\n return {\n filled: true,\n text: rest.length ? `${first} +${rest.length}` : first,\n }\n}\n\nexport function scheduleSectionSummary(\n section: ScheduleSection,\n context: ScheduleSummaryContext,\n): ScheduleSummary {\n if (section === 'time') return timeSummary(context)\n if (section === 'repeat') return repeatSummary(context)\n return remindersSummary(context)\n}\n",
350
+ "content": "import type { PropertyOption } from '../../shared/property-catalog'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport { formatDateProperty } from '../date/date-value'\nimport type { ScheduleSection } from './schedule-section'\nimport {\n type ScheduleValue,\n scheduleRecurrenceLabel,\n sortScheduleReminders,\n} from './schedule-value'\n\nexport interface ScheduleSummary {\n filled: boolean\n text: string\n}\n\nexport interface ScheduleSummaryContext {\n labels: SchedulePropertyLabels\n locale: string\n recurrenceOptions: readonly PropertyOption[]\n reminderOptions: readonly PropertyOption[]\n value: ScheduleValue\n}\n\nfunction timeSummary({ labels, value }: ScheduleSummaryContext) {\n if (value.allDay || !value.startTime) {\n return { filled: false, text: labels.allDay }\n }\n\n return {\n filled: true,\n text: value.endTime\n ? `${value.startTime} – ${value.endTime}`\n : value.startTime,\n }\n}\n\nfunction repeatSummary({\n labels,\n locale,\n recurrenceOptions,\n value,\n}: ScheduleSummaryContext) {\n const frequency = scheduleRecurrenceLabel(value.frequency, recurrenceOptions)\n if (!frequency) return { filled: false, text: labels.noRepeat }\n\n const until = formatDateProperty(value.until, '', locale, 'UTC')\n return {\n filled: true,\n text: until ? `${frequency} · ${labels.until} ${until}` : frequency,\n }\n}\n\nfunction remindersSummary({\n labels,\n reminderOptions,\n value,\n}: ScheduleSummaryContext) {\n const names = sortScheduleReminders(value.reminders, reminderOptions)\n .map(\n (reminder) =>\n reminderOptions.find((option) => option.value === reminder)?.label,\n )\n .filter((name): name is string => Boolean(name))\n\n const [first, ...rest] = names\n if (first === undefined) return { filled: false, text: labels.addReminder }\n\n return {\n filled: true,\n text: rest.length ? `${first} +${rest.length}` : first,\n }\n}\n\nexport function scheduleSectionSummary(\n section: ScheduleSection,\n context: ScheduleSummaryContext,\n): ScheduleSummary {\n if (section === 'time') return timeSummary(context)\n if (section === 'repeat') return repeatSummary(context)\n return remindersSummary(context)\n}\n",
357
351
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-summaries.ts"
358
352
  },
359
353
  {
360
354
  "path": "patterns/properties/display/schedule/schedule-time-section.tsx",
361
355
  "type": "registry:file",
362
- "content": "'use client'\n\nimport { ClockIcon } from '@phosphor-icons/react'\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from '@tc96/ui/input-group'\nimport {\n Select,\n SelectItem,\n SelectPopup,\n SelectTrigger,\n SelectValue,\n} from '@tc96/ui/select'\nimport { Switch } from '@tc96/ui/switch'\nimport { useId } from 'react'\nimport { propertySelectItemClassName } from '../../shared/property-select-shell'\nimport type { SchedulePropertyLabels } from './schedule-labels'\nimport type { ScheduleValue } from './schedule-value'\n\nexport type ScheduleTimeControl = 'select' | 'input'\n\nconst QUARTER_HOUR_SECONDS = 900\n\nconst quarterHourSlots = Array.from({ length: 96 }, (_, index) => {\n const hours = String(Math.floor(index / 4)).padStart(2, '0')\n const minutes = String((index % 4) * 15).padStart(2, '0')\n return `${hours}:${minutes}`\n})\n\ninterface TimeControlProps {\n disabled: boolean\n label: string\n onChange: (time: string) => void\n value: string\n}\n\nfunction TimeSelect({\n disabled,\n label,\n onChange,\n value,\n}: Readonly<TimeControlProps>) {\n return (\n <Select\n disabled={disabled}\n onValueChange={(time) => onChange(time ?? '')}\n value={value || null}\n >\n <SelectTrigger aria-label={label} className=\"w-full min-w-0\">\n <ClockIcon aria-hidden className=\"size-4 opacity-80\" />\n <SelectValue placeholder={label} />\n </SelectTrigger>\n <SelectPopup className=\"max-h-64\">\n {quarterHourSlots.map((slot) => (\n <SelectItem\n className={propertySelectItemClassName}\n key={slot}\n value={slot}\n >\n {slot}\n </SelectItem>\n ))}\n </SelectPopup>\n </Select>\n )\n}\n\nfunction TimeField({\n disabled,\n label,\n onChange,\n value,\n}: Readonly<TimeControlProps>) {\n return (\n <InputGroup className=\"grow\">\n <InputGroupInput\n aria-label={label}\n className=\"*:[input]:[&::-webkit-calendar-picker-indicator]:hidden\"\n disabled={disabled}\n onChange={(event) => onChange(event.target.value)}\n step={QUARTER_HOUR_SECONDS}\n type=\"time\"\n value={value}\n />\n <InputGroupAddon>\n <ClockIcon aria-hidden />\n </InputGroupAddon>\n </InputGroup>\n )\n}\n\nexport function ScheduleTimeSection({\n labels,\n onChange,\n timeControl,\n value,\n}: Readonly<{\n labels: SchedulePropertyLabels\n onChange: (value: ScheduleValue) => void\n timeControl: ScheduleTimeControl\n value: ScheduleValue\n}>) {\n const Control = timeControl === 'select' ? TimeSelect : TimeField\n const allDayLabelId = useId()\n\n return (\n <div className=\"flex flex-col gap-2 p-2\" data-slot=\"schedule-time\">\n <div className=\"grid grid-cols-2 gap-2 *:min-w-0\">\n <Control\n disabled={value.allDay}\n label={labels.start}\n onChange={(startTime) => onChange({ ...value, startTime })}\n value={value.startTime}\n />\n <Control\n disabled={value.allDay}\n label={labels.end}\n onChange={(endTime) => onChange({ ...value, endTime })}\n value={value.endTime}\n />\n </div>\n <div className=\"flex h-8 items-center justify-between text-sm\">\n <span id={allDayLabelId}>{labels.allDay}</span>\n <Switch\n aria-labelledby={allDayLabelId}\n checked={value.allDay}\n onCheckedChange={(allDay) =>\n onChange({\n ...value,\n allDay,\n endTime: allDay ? '' : value.endTime,\n startTime: allDay ? '' : value.startTime,\n })\n }\n />\n </div>\n </div>\n )\n}\n",
356
+ "content": "'use client'\n\nimport { ClockIcon } from '@phosphor-icons/react'\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from '@tc96/ui/input-group'\nimport {\n Select,\n SelectItem,\n SelectPopup,\n SelectTrigger,\n SelectValue,\n} from '@tc96/ui/select'\nimport { Switch } from '@tc96/ui/switch'\nimport { useId } from 'react'\nimport type { SchedulePropertyLabels } from '../../shared/property-labels'\nimport { propertySelectItemClassName } from '../../shared/property-select-shell'\nimport type { ScheduleValue } from './schedule-value'\n\nexport type ScheduleTimeControl = 'select' | 'input'\n\nconst QUARTER_HOUR_SECONDS = 900\n\nconst quarterHourSlots = Array.from({ length: 96 }, (_, index) => {\n const hours = String(Math.floor(index / 4)).padStart(2, '0')\n const minutes = String((index % 4) * 15).padStart(2, '0')\n return `${hours}:${minutes}`\n})\n\ninterface TimeControlProps {\n disabled: boolean\n label: string\n onChange: (time: string) => void\n value: string\n}\n\nfunction TimeSelect({\n disabled,\n label,\n onChange,\n value,\n}: Readonly<TimeControlProps>) {\n return (\n <Select\n disabled={disabled}\n onValueChange={(time) => onChange(time ?? '')}\n value={value || null}\n >\n <SelectTrigger aria-label={label} className=\"w-full min-w-0\">\n <ClockIcon aria-hidden className=\"size-4 opacity-80\" />\n <SelectValue placeholder={label} />\n </SelectTrigger>\n <SelectPopup className=\"max-h-64\">\n {quarterHourSlots.map((slot) => (\n <SelectItem\n className={propertySelectItemClassName}\n key={slot}\n value={slot}\n >\n {slot}\n </SelectItem>\n ))}\n </SelectPopup>\n </Select>\n )\n}\n\nfunction TimeField({\n disabled,\n label,\n onChange,\n value,\n}: Readonly<TimeControlProps>) {\n return (\n <InputGroup className=\"grow\">\n <InputGroupInput\n aria-label={label}\n className=\"*:[input]:[&::-webkit-calendar-picker-indicator]:hidden\"\n disabled={disabled}\n onChange={(event) => onChange(event.target.value)}\n step={QUARTER_HOUR_SECONDS}\n type=\"time\"\n value={value}\n />\n <InputGroupAddon>\n <ClockIcon aria-hidden />\n </InputGroupAddon>\n </InputGroup>\n )\n}\n\nexport function ScheduleTimeSection({\n labels,\n onChange,\n timeControl,\n value,\n}: Readonly<{\n labels: SchedulePropertyLabels\n onChange: (value: ScheduleValue) => void\n timeControl: ScheduleTimeControl\n value: ScheduleValue\n}>) {\n const Control = timeControl === 'select' ? TimeSelect : TimeField\n const allDayLabelId = useId()\n\n return (\n <div className=\"flex flex-col gap-2 p-2\" data-slot=\"schedule-time\">\n <div className=\"grid grid-cols-2 gap-2 *:min-w-0\">\n <Control\n disabled={value.allDay}\n label={labels.start}\n onChange={(startTime) => onChange({ ...value, startTime })}\n value={value.startTime}\n />\n <Control\n disabled={value.allDay}\n label={labels.end}\n onChange={(endTime) => onChange({ ...value, endTime })}\n value={value.endTime}\n />\n </div>\n <div className=\"flex h-8 items-center justify-between text-sm\">\n <span id={allDayLabelId}>{labels.allDay}</span>\n <Switch\n aria-labelledby={allDayLabelId}\n checked={value.allDay}\n onCheckedChange={(allDay) =>\n onChange({\n ...value,\n allDay,\n endTime: allDay ? '' : value.endTime,\n startTime: allDay ? '' : value.startTime,\n })\n }\n />\n </div>\n </div>\n )\n}\n",
363
357
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-time-section.tsx"
364
358
  },
365
359
  {
366
360
  "path": "patterns/properties/display/schedule/schedule-value.ts",
367
361
  "type": "registry:file",
368
- "content": "export interface ScheduleValue {\n allDay: boolean\n endTime: string\n frequency: string | null\n from: Date | null\n reminders: readonly string[]\n startTime: string\n until: string | null\n}\n\nexport const emptyScheduleValue: ScheduleValue = {\n allDay: true,\n endTime: '',\n frequency: null,\n from: null,\n reminders: [],\n startTime: '',\n until: null,\n}\n\nexport interface ScheduleRecurrenceOption {\n label: string\n value: string\n}\n\nexport const defaultScheduleRecurrenceOptions: readonly ScheduleRecurrenceOption[] =\n [\n { label: 'Diariamente', value: 'daily' },\n { label: 'Dias úteis', value: 'weekdays' },\n { label: 'Semanalmente', value: 'weekly' },\n { label: 'Mensalmente', value: 'monthly' },\n { label: 'Anualmente', value: 'yearly' },\n ]\n\nexport interface ScheduleReminderOption {\n label: string\n value: string\n}\n\nexport const defaultScheduleReminderOptions: readonly ScheduleReminderOption[] =\n [\n { label: '10 min antes', value: '10' },\n { label: '30 min antes', value: '30' },\n { label: '1 hora antes', value: '60' },\n { label: '1 dia antes', value: '1440' },\n ]\n\nexport function sortScheduleReminders(\n reminders: readonly string[],\n options: readonly ScheduleReminderOption[],\n): string[] {\n const rank = (reminder: string) => {\n const index = options.findIndex((option) => option.value === reminder)\n return index === -1 ? options.length : index\n }\n\n return [...reminders].sort((left, right) => rank(left) - rank(right))\n}\n\nexport function startOfLocalDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nexport function addLocalDays(date: Date, days: number): Date {\n const next = startOfLocalDay(date)\n next.setDate(next.getDate() + days)\n return next\n}\n\nexport function formatScheduleDay(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'short' })\n .format(date)\n .replaceAll('.', '')\n}\n\nexport function formatScheduleProperty(\n value: ScheduleValue,\n fallback: string,\n locale: string,\n): string {\n if (!value.from) return fallback\n\n const parts = [formatScheduleDay(value.from, locale)]\n if (!value.allDay && value.startTime) {\n parts.push(\n value.endTime ? `${value.startTime} – ${value.endTime}` : value.startTime,\n )\n }\n\n return parts.join(' · ')\n}\n\nexport function scheduleRecurrenceLabel(\n frequency: string | null,\n options: readonly ScheduleRecurrenceOption[],\n): string | null {\n if (!frequency) return null\n return options.find((option) => option.value === frequency)?.label ?? null\n}\n",
362
+ "content": "import type { PropertyOption } from '../../shared/property-catalog'\nimport {\n defaultPropertyLabels,\n type SchedulePropertyLabels,\n} from '../../shared/property-labels'\n\nexport interface ScheduleValue {\n allDay: boolean\n endTime: string\n frequency: string | null\n from: Date | null\n reminders: readonly string[]\n startTime: string\n until: string | null\n}\n\nexport const emptyScheduleValue: ScheduleValue = {\n allDay: true,\n endTime: '',\n frequency: null,\n from: null,\n reminders: [],\n startTime: '',\n until: null,\n}\n\nexport function scheduleRecurrenceOptions(\n labels: Pick<\n SchedulePropertyLabels,\n 'daily' | 'monthly' | 'weekdays' | 'weekly' | 'yearly'\n >,\n): readonly PropertyOption[] {\n return [\n { label: labels.daily, value: 'daily' },\n { label: labels.weekdays, value: 'weekdays' },\n { label: labels.weekly, value: 'weekly' },\n { label: labels.monthly, value: 'monthly' },\n { label: labels.yearly, value: 'yearly' },\n ]\n}\n\nexport function scheduleReminderOptions(\n labels: Pick<\n SchedulePropertyLabels,\n | 'oneDayBefore'\n | 'oneHourBefore'\n | 'tenMinutesBefore'\n | 'thirtyMinutesBefore'\n >,\n): readonly PropertyOption[] {\n return [\n { label: labels.tenMinutesBefore, value: '10' },\n { label: labels.thirtyMinutesBefore, value: '30' },\n { label: labels.oneHourBefore, value: '60' },\n { label: labels.oneDayBefore, value: '1440' },\n ]\n}\n\nexport const defaultScheduleRecurrenceOptions: readonly PropertyOption[] =\n scheduleRecurrenceOptions(defaultPropertyLabels.schedule)\n\nexport const defaultScheduleReminderOptions: readonly PropertyOption[] =\n scheduleReminderOptions(defaultPropertyLabels.schedule)\n\nexport function sortScheduleReminders(\n reminders: readonly string[],\n options: readonly PropertyOption[],\n): string[] {\n const rank = (reminder: string) => {\n const index = options.findIndex((option) => option.value === reminder)\n return index === -1 ? options.length : index\n }\n\n return [...reminders].sort((left, right) => rank(left) - rank(right))\n}\n\nexport function startOfLocalDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nexport function addLocalDays(date: Date, days: number): Date {\n const next = startOfLocalDay(date)\n next.setDate(next.getDate() + days)\n return next\n}\n\nexport function formatScheduleDay(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'short' })\n .format(date)\n .replaceAll('.', '')\n}\n\nexport function formatScheduleProperty(\n value: ScheduleValue,\n fallback: string,\n locale: string,\n): string {\n if (!value.from) return fallback\n\n const parts = [formatScheduleDay(value.from, locale)]\n if (!value.allDay && value.startTime) {\n parts.push(\n value.endTime ? `${value.startTime} – ${value.endTime}` : value.startTime,\n )\n }\n\n return parts.join(' · ')\n}\n\nexport function scheduleRecurrenceLabel(\n frequency: string | null,\n options: readonly PropertyOption[],\n): string | null {\n if (!frequency) return null\n return options.find((option) => option.value === frequency)?.label ?? null\n}\n",
369
363
  "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-value.ts"
370
364
  },
371
365
  {
372
366
  "path": "patterns/properties/display/select/index.ts",
373
367
  "type": "registry:file",
374
- "content": "export type {\n SelectPropertyActionContext,\n SelectPropertyDropdownPlacement,\n SelectPropertyGroup,\n SelectPropertyOption,\n SelectPropertyProps,\n} from './select-property'\nexport { SelectProperty } from './select-property'\n",
368
+ "content": "export type {\n SelectPropertyGroup,\n SelectPropertyProps,\n} from './select-property'\nexport { SelectProperty } from './select-property'\n",
375
369
  "target": "~/packages/ui/src/patterns/properties/display/select/index.ts"
376
370
  },
377
371
  {
378
372
  "path": "patterns/properties/display/select/select-property.tsx",
379
373
  "type": "registry:file",
380
- "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 PropertyIcon,\n type PropertyTone,\n propertyToneClassName,\n} from '../../shared/property-catalog'\nimport {\n type PropertySelectDropdownPlacement,\n PropertySelectShell,\n propertySelectItemClassName,\n} from '../../shared/property-select-shell'\nimport type { PropertyVariant } from '../../shared/property-surface'\n\nexport interface SelectPropertyOption {\n label: string\n value: string\n icon?: PropertyIcon\n tone?: PropertyTone\n}\n\nexport interface SelectPropertyGroup {\n label: string\n options: readonly SelectPropertyOption[]\n}\n\nexport type SelectPropertyDropdownPlacement = PropertySelectDropdownPlacement\n\nexport interface SelectPropertyActionContext {\n previousValue: string | null\n}\n\ninterface SelectPropertyBaseProps {\n ariaLabel: string\n value: string | null\n action?: (value: string | null, context: SelectPropertyActionContext) => void\n className?: string\n disabled?: boolean\n dropdownPlacement?: SelectPropertyDropdownPlacement\n placeholder?: string\n fallback?: string\n emptyOptionLabel?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: string | null) => void\n}\n\nexport type SelectPropertyItems =\n | { groups?: undefined; options: readonly SelectPropertyOption[] }\n | { groups: readonly SelectPropertyGroup[]; options?: undefined }\n\nexport type SelectPropertyProps = SelectPropertyBaseProps & SelectPropertyItems\n\nexport function SelectProperty({\n action,\n ariaLabel,\n className,\n disabled = false,\n dropdownPlacement,\n emptyOptionLabel,\n fallback = '—',\n groups,\n onValueChange,\n options,\n placeholder,\n readOnly = false,\n value,\n variant = 'badge',\n}: Readonly<SelectPropertyProps>) {\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: SelectPropertyOption | null = emptyOptionLabel\n ? {\n icon: catalog.some((option) => option.icon)\n ? CircleDashedIcon\n : undefined,\n label: emptyOptionLabel,\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 ?? fallback)\n : 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?: SelectPropertyOption }>) {\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 />\n ) : null}\n <span className=\"truncate\">{label}</span>\n </span>\n )\n}\n",
374
+ "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",
381
375
  "target": "~/packages/ui/src/patterns/properties/display/select/select-property.tsx"
382
376
  },
383
377
  {
384
378
  "path": "patterns/properties/display/tags/index.ts",
385
379
  "type": "registry:file",
386
- "content": "export {\n TagsProperty,\n type TagsPropertyActionContext,\n type TagsPropertyDropdownPlacement,\n type TagsPropertyOption,\n type TagsPropertyProps,\n} from './tags-property'\n",
380
+ "content": "export {\n TagsProperty,\n type TagsPropertyProps,\n} from './tags-property'\n",
387
381
  "target": "~/packages/ui/src/patterns/properties/display/tags/index.ts"
388
382
  },
389
383
  {
390
384
  "path": "patterns/properties/display/tags/tags-property.tsx",
391
385
  "type": "registry:file",
392
- "content": "'use client'\n\nimport { TagIcon } from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport { useMemo } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { resolveOptions } from '../../shared/lib/property-options'\nimport {\n type PropertyMultiSelectDropdownPlacement,\n PropertyMultiSelectShell,\n} from '../../shared/property-multi-select-shell'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\n\nconst addTagLabel = 'Adicionar tag'\n\nconst defaultCountLabel = (count: number) =>\n `${count} ${count === 1 ? 'Tag' : 'Tags'}`\n\nexport interface TagsPropertyOption<TValue extends string = string> {\n label: string\n value: TValue\n}\n\nexport type TagsPropertyDropdownPlacement = PropertyMultiSelectDropdownPlacement\n\nexport interface TagsPropertyActionContext<TValue extends string = string> {\n added: TagsPropertyOption<TValue> | null\n previousValue: readonly TValue[]\n removed: TagsPropertyOption<TValue> | null\n}\n\nexport interface TagsPropertyProps<TValue extends string = string> {\n value: readonly TValue[]\n options: readonly TagsPropertyOption<TValue>[]\n action?: (\n value: readonly TValue[],\n context: TagsPropertyActionContext<TValue>,\n ) => void\n ariaLabel?: string\n className?: string\n countLabel?: (count: number) => string\n disabled?: boolean\n display?: 'chips' | 'count'\n dropdownPlacement?: TagsPropertyDropdownPlacement\n isLoading?: boolean\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly TValue[]) => void\n}\n\nexport function TagsProperty<TValue extends string = string>({\n action,\n ariaLabel = 'Tags',\n className,\n countLabel = defaultCountLabel,\n disabled = false,\n display = 'chips',\n dropdownPlacement,\n isLoading = false,\n onValueChange,\n options,\n placeholder = 'Adicionar uma tag',\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<TagsPropertyProps<TValue>>) {\n const selectedOptions = useMemo(\n () => resolveOptions(options, value),\n [options, value],\n )\n\n const countText = countLabel(selectedOptions.length)\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-1', className)}\n data-display={display}\n slot=\"tags-property\"\n variant={variant}\n >\n {display === 'count' ? (\n <PropertySurface\n muted={selectedOptions.length === 0}\n variant={variant}\n >\n <TagIcon aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n <span className=\"tabular-nums\">{countText}</span>\n </PropertySurface>\n ) : selectedOptions.length > 0 ? (\n selectedOptions.map((option) => (\n <PropertySurface key={option.value} variant={variant}>\n {option.label}\n </PropertySurface>\n ))\n ) : (\n <PropertySurface className=\"text-muted-foreground\" variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n return (\n <div\n className={cn(\n display === 'count' ? 'min-w-0' : 'min-w-0 w-full',\n className,\n )}\n data-display={display}\n data-slot=\"tags-property\"\n data-variant={variant}\n >\n <PropertyMultiSelectShell\n addIcon={TagIcon}\n addLabel={addTagLabel}\n ariaLabel={ariaLabel}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n emptyLabel=\"Nenhuma tag encontrada.\"\n isLoading={isLoading}\n loadingLabel=\"Carregando tags…\"\n onChange={(nextValue, change) =>\n emitChange({ action, onValueChange }, nextValue, change)\n }\n options={options}\n placeholder={addTagLabel}\n removeLabel={(option) => `Remover tag ${option.label}`}\n renderOption={(option) => option.label}\n renderTrigger={\n display === 'count'\n ? ({ anchorRef, open }) => (\n <PropertySurface\n aria-label={`${ariaLabel}: ${countText}`}\n muted={selectedOptions.length === 0}\n render={\n <button\n disabled={disabled}\n onClick={open}\n ref={anchorRef}\n type=\"button\"\n />\n }\n variant={variant}\n >\n <TagIcon aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n <span className=\"tabular-nums\">{countText}</span>\n </PropertySurface>\n )\n : undefined\n }\n selectedOptions={selectedOptions}\n value={value}\n variant={variant}\n />\n </div>\n )\n}\n",
386
+ "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport { useMemo } from 'react'\nimport { emitChange, isEditable } from '../../shared/lib/property-change'\nimport { resolveOptions } from '../../shared/lib/property-options'\nimport type {\n PropertyListChangeContext,\n PropertyMultiSelectDropdownPlacement,\n PropertyOption,\n} from '../../shared/property-catalog'\nimport { propertyDisplayIcons } from '../../shared/property-display-meta'\nimport {\n defaultPropertyAriaLabels,\n defaultPropertyLabels,\n defaultPropertyPlaceholders,\n resolvePropertyLabels,\n type TagsPropertyLabels,\n} from '../../shared/property-labels'\nimport { PropertyMultiSelectShell } from '../../shared/property-multi-select-shell'\nimport { PropertyRow } from '../../shared/property-row'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\n\nconst TagIcon = propertyDisplayIcons.tags\n\nexport interface TagsPropertyProps<TValue extends string = string> {\n value: readonly TValue[]\n options: readonly PropertyOption<TValue>[]\n action?: (\n value: readonly TValue[],\n context: PropertyListChangeContext<PropertyOption<TValue>, TValue>,\n ) => void\n ariaLabel?: string\n className?: string\n disabled?: boolean\n display?: 'chips' | 'count'\n dropdownPlacement?: PropertyMultiSelectDropdownPlacement\n isLoading?: boolean\n labels?: Partial<TagsPropertyLabels>\n placeholder?: string\n readOnly?: boolean\n variant?: PropertyVariant\n onValueChange?: (value: readonly TValue[]) => void\n}\n\nexport function TagsProperty<TValue extends string = string>({\n action,\n ariaLabel = defaultPropertyAriaLabels.tags,\n className,\n disabled = false,\n display = 'chips',\n dropdownPlacement,\n isLoading = false,\n labels: labelOverrides,\n onValueChange,\n options,\n placeholder = defaultPropertyPlaceholders.tags,\n readOnly = false,\n value,\n variant = 'plain',\n}: Readonly<TagsPropertyProps<TValue>>) {\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.tags,\n labelOverrides,\n )\n const selectedOptions = useMemo(\n () => resolveOptions(options, value),\n [options, value],\n )\n\n const countText = labels.count(selectedOptions.length)\n\n if (!isEditable({ action, onValueChange, readOnly })) {\n return (\n <PropertyRow\n ariaLabel={ariaLabel}\n className={cn('flex flex-wrap gap-1', className)}\n data-display={display}\n slot=\"tags-property\"\n variant={variant}\n >\n {display === 'count' ? (\n <PropertySurface\n muted={selectedOptions.length === 0}\n variant={variant}\n >\n <TagIcon aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n <span className=\"tabular-nums\">{countText}</span>\n </PropertySurface>\n ) : selectedOptions.length > 0 ? (\n selectedOptions.map((option) => (\n <PropertySurface key={option.value} variant={variant}>\n {option.label}\n </PropertySurface>\n ))\n ) : (\n <PropertySurface className=\"text-muted-foreground\" variant={variant}>\n {placeholder}\n </PropertySurface>\n )}\n </PropertyRow>\n )\n }\n\n return (\n <div\n className={cn(\n display === 'count' ? 'min-w-0' : 'min-w-0 w-full',\n className,\n )}\n data-display={display}\n data-slot=\"tags-property\"\n data-variant={variant}\n >\n <PropertyMultiSelectShell\n addIcon={TagIcon}\n addLabel={labels.add}\n ariaLabel={ariaLabel}\n disabled={disabled}\n dropdownPlacement={dropdownPlacement}\n emptyLabel={labels.empty}\n isLoading={isLoading}\n loadingLabel={labels.loading}\n onChange={(nextValue, change) =>\n emitChange({ action, onValueChange }, nextValue, change)\n }\n options={options}\n placeholder={labels.add}\n removeLabel={(option) => `${labels.remove} ${option.label}`}\n renderOption={(option) => option.label}\n renderTrigger={\n display === 'count'\n ? ({ anchorRef, open }) => (\n <PropertySurface\n aria-label={`${ariaLabel}: ${countText}`}\n muted={selectedOptions.length === 0}\n render={\n <button\n disabled={disabled}\n onClick={open}\n ref={anchorRef}\n type=\"button\"\n />\n }\n variant={variant}\n >\n <TagIcon aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n <span className=\"tabular-nums\">{countText}</span>\n </PropertySurface>\n )\n : undefined\n }\n selectedOptions={selectedOptions}\n value={value}\n variant={variant}\n />\n </div>\n )\n}\n",
393
387
  "target": "~/packages/ui/src/patterns/properties/display/tags/tags-property.tsx"
394
388
  },
395
389
  {
396
390
  "path": "patterns/properties/display/text/index.ts",
397
391
  "type": "registry:file",
398
- "content": "export {\n TextProperty,\n type TextPropertyIcon,\n type TextPropertyProps,\n} from './text-property'\n",
392
+ "content": "export {\n TextProperty,\n type TextPropertyProps,\n} from './text-property'\n",
399
393
  "target": "~/packages/ui/src/patterns/properties/display/text/index.ts"
400
394
  },
401
395
  {
402
396
  "path": "patterns/properties/display/text/text-property.tsx",
403
397
  "type": "registry:file",
404
- "content": "'use client'\n\nimport { CopyIcon, PlusIcon } from '@phosphor-icons/react'\nimport { copyToClipboard } from '@tc96/ui/helpers/clipboard'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { EditableText } from '../editable-text/index'\nimport {\n IconLabelProperty,\n type IconLabelPropertyIcon,\n type IconLabelPropertyTrailingVisibility,\n} from '../icon-label/icon-label-property'\n\nexport type TextPropertyIcon = IconLabelPropertyIcon\n\nexport type TextPropertyEditing = 'inline' | 'trigger'\n\nexport interface TextPropertyProps {\n value: string | null\n addLabel?: string\n ariaLabel?: string\n className?: string\n copyLabel?: string\n disabled?: boolean\n editing?: TextPropertyEditing\n fallback?: string\n icon?: TextPropertyIcon\n inputPlaceholder?: string\n iconClassName?: string\n trailingVisibility?: IconLabelPropertyTrailingVisibility\n variant?: PropertyVariant\n onCommit?: (value: string | null) => void\n}\n\nexport function TextProperty({\n addLabel,\n ariaLabel,\n className,\n copyLabel,\n disabled = false,\n editing = 'trigger',\n fallback = 'Não informado',\n icon: Icon,\n iconClassName,\n inputPlaceholder,\n trailingVisibility,\n value,\n variant = 'badge',\n onCommit,\n}: Readonly<TextPropertyProps>) {\n const [editingInline, setEditingInline] = useState(false)\n const text = value?.trim() || null\n const copiable = Boolean(copyLabel && text)\n const editable = Boolean(onCommit) && !disabled\n\n const commit = (next: string | null) => {\n setEditingInline(false)\n onCommit?.(next)\n }\n\n if (editable && !text && editing === 'trigger' && !editingInline) {\n return (\n <PropertySurface\n aria-label={addLabel ?? fallback}\n className={cn('gap-1', className)}\n muted\n onClick={() => setEditingInline(true)}\n render={<button type=\"button\" />}\n >\n <PlusIcon aria-hidden=\"true\" className=\"size-4\" />\n {fallback}\n </PropertySurface>\n )\n }\n\n const copyAffordance =\n copiable && text ? (\n <button\n aria-label={copyLabel}\n className=\"h-full shrink-0 cursor-pointer px-1.5 opacity-80 transition-opacity hover:opacity-100\"\n data-slot=\"text-property-copy\"\n onClick={() => void copyToClipboard(text)?.catch(() => undefined)}\n type=\"button\"\n >\n <CopyIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n ) : null\n\n const label =\n editable && (editing === 'inline' || editingInline) ? (\n <EditableText\n ariaLabel={ariaLabel ?? fallback}\n autoFocus={editingInline}\n className=\"field-sizing-content w-auto min-w-[1ch] max-w-full\"\n onCommit={commit}\n placeholder={inputPlaceholder ?? fallback}\n size=\"sm\"\n value={text}\n />\n ) : (\n (text ?? fallback)\n )\n\n return (\n <IconLabelProperty\n ariaLabel={typeof label === 'string' ? ariaLabel : undefined}\n className={cn(copiable && 'pe-0', className)}\n icon={Icon}\n iconClassName={iconClassName}\n label={label}\n muted={!text}\n trailing={copyAffordance}\n trailingVisibility={trailingVisibility}\n variant={variant}\n />\n )\n}\n",
398
+ "content": "'use client'\n\nimport { CopyIcon, PlusIcon } from '@phosphor-icons/react'\nimport { copyToClipboard } from '@tc96/ui/helpers/clipboard'\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport type { PropertyIcon } from '../../shared/property-catalog'\nimport {\n defaultPropertyLabels,\n resolvePropertyLabels,\n type TextPropertyLabels,\n} from '../../shared/property-labels'\nimport {\n PropertySurface,\n type PropertyVariant,\n} from '../../shared/property-surface'\nimport { EditableText } from '../editable-text/index'\nimport {\n IconLabelProperty,\n type IconLabelPropertyTrailingVisibility,\n} from '../icon-label/icon-label-property'\n\nexport type TextPropertyEditing = 'inline' | 'trigger'\n\nexport interface TextPropertyProps {\n value: string | null\n ariaLabel?: string\n className?: string\n copyable?: boolean\n disabled?: boolean\n editing?: TextPropertyEditing\n icon?: PropertyIcon\n iconClassName?: string\n labels?: Partial<TextPropertyLabels>\n trailingVisibility?: IconLabelPropertyTrailingVisibility\n variant?: PropertyVariant\n onCommit?: (value: string | null) => void\n}\n\nexport function TextProperty({\n ariaLabel,\n className,\n copyable = false,\n disabled = false,\n editing = 'trigger',\n icon: Icon,\n iconClassName,\n labels: labelOverrides,\n trailingVisibility,\n value,\n variant = 'badge',\n onCommit,\n}: Readonly<TextPropertyProps>) {\n const [editingInline, setEditingInline] = useState(false)\n const labels = resolvePropertyLabels(\n defaultPropertyLabels.text,\n labelOverrides,\n )\n const { fallback } = labels\n const text = value?.trim() || null\n const copiable = copyable && Boolean(text)\n const editable = Boolean(onCommit) && !disabled\n\n const commit = (next: string | null) => {\n setEditingInline(false)\n onCommit?.(next)\n }\n\n if (editable && !text && editing === 'trigger' && !editingInline) {\n return (\n <PropertySurface\n aria-label={labels.add ?? fallback}\n className={cn('gap-1', className)}\n muted\n onClick={() => setEditingInline(true)}\n render={<button type=\"button\" />}\n >\n <PlusIcon aria-hidden=\"true\" className=\"size-4\" />\n {fallback}\n </PropertySurface>\n )\n }\n\n const copyAffordance =\n copiable && text ? (\n <button\n aria-label={labels.copy}\n className=\"h-full shrink-0 cursor-pointer px-1.5 opacity-80 transition-opacity hover:opacity-100\"\n data-slot=\"text-property-copy\"\n onClick={() => void copyToClipboard(text)?.catch(() => undefined)}\n type=\"button\"\n >\n <CopyIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n ) : null\n\n const label =\n editable && (editing === 'inline' || editingInline) ? (\n <EditableText\n ariaLabel={ariaLabel ?? fallback}\n autoFocus={editingInline}\n className=\"field-sizing-content w-auto min-w-[1ch] max-w-full\"\n onCommit={commit}\n placeholder={labels.inputPlaceholder ?? fallback}\n size=\"sm\"\n value={text}\n />\n ) : (\n (text ?? fallback)\n )\n\n return (\n <IconLabelProperty\n ariaLabel={typeof label === 'string' ? ariaLabel : undefined}\n className={cn(copiable && 'pe-0', className)}\n icon={Icon}\n iconClassName={iconClassName}\n label={label}\n muted={!text}\n trailing={copyAffordance}\n trailingVisibility={trailingVisibility}\n variant={variant}\n />\n )\n}\n",
405
399
  "target": "~/packages/ui/src/patterns/properties/display/text/text-property.tsx"
406
400
  },
407
401
  {
408
402
  "path": "patterns/properties/hooks/use-entry-list-editor.ts",
409
403
  "type": "registry:file",
410
- "content": "import { useState } from 'react'\nimport type { EntryParser } from '../shared/lib/entry-parser'\nimport { diffValues } from '../shared/lib/property-options'\n\nexport interface EntryListChange {\n added: string | null\n previousValue: readonly string[]\n removed: string | null\n}\n\nexport interface UseEntryListEditorOptions {\n duplicateMessage: string\n limit: number\n onCommit: (next: readonly string[], change: EntryListChange) => void\n parse: EntryParser\n value: readonly string[]\n}\n\nexport function useEntryListEditor({\n duplicateMessage,\n limit,\n onCommit,\n parse,\n value,\n}: UseEntryListEditorOptions) {\n const [open, setOpen] = useState(false)\n const [drafts, setDrafts] = useState<readonly string[]>([])\n const [errors, setErrors] = useState<readonly (string | null)[]>([])\n\n const onOpenChange = (next: boolean) => {\n if (next) {\n setDrafts(value.length > 0 ? [...value] : [''])\n setErrors([])\n }\n setOpen(next)\n }\n\n const setDraft = (index: number, next: string) => {\n setDrafts((current) =>\n current.map((draft, at) => (at === index ? next : draft)),\n )\n setErrors((current) =>\n current.map((error, at) => (at === index ? null : error)),\n )\n }\n\n const removeDraft = (index: number) => {\n setDrafts((current) => current.filter((_, at) => at !== index))\n setErrors((current) => current.filter((_, at) => at !== index))\n }\n\n const addDraft = () => setDrafts((current) => [...current, ''])\n\n const canAddAnother =\n drafts.length < limit &&\n drafts.every((draft) => parse(draft.trim()).success)\n\n const save = () => {\n const nextErrors: (string | null)[] = []\n const saved: string[] = []\n\n for (const draft of drafts) {\n const raw = draft.trim()\n if (!raw) {\n nextErrors.push(null)\n continue\n }\n\n const parsed = parse(raw)\n if (!parsed.success) {\n nextErrors.push(parsed.message)\n continue\n }\n if (saved.includes(parsed.value)) {\n nextErrors.push(duplicateMessage)\n continue\n }\n\n nextErrors.push(null)\n saved.push(parsed.value)\n }\n\n setErrors(nextErrors)\n if (nextErrors.some(Boolean)) return\n\n onCommit(saved, { ...diffValues(value, saved), previousValue: value })\n setOpen(false)\n }\n\n return {\n addDraft,\n canAddAnother,\n drafts,\n errors,\n onOpenChange,\n open,\n removeDraft,\n save,\n setDraft,\n }\n}\n",
404
+ "content": "import { useState } from 'react'\nimport type { EntryParser } from '../shared/lib/entry-parser'\nimport { diffValues } from '../shared/lib/property-options'\nimport type { PropertyListChangeContext } from '../shared/property-catalog'\n\nexport interface UseEntryListEditorOptions {\n duplicateMessage: string\n limit: number\n onCommit: (\n next: readonly string[],\n change: PropertyListChangeContext<string, string>,\n ) => void\n parse: EntryParser\n value: readonly string[]\n}\n\nexport function useEntryListEditor({\n duplicateMessage,\n limit,\n onCommit,\n parse,\n value,\n}: UseEntryListEditorOptions) {\n const [open, setOpen] = useState(false)\n const [drafts, setDrafts] = useState<readonly string[]>([])\n const [errors, setErrors] = useState<readonly (string | null)[]>([])\n\n const onOpenChange = (next: boolean) => {\n if (next) {\n setDrafts(value.length > 0 ? [...value] : [''])\n setErrors([])\n }\n setOpen(next)\n }\n\n const setDraft = (index: number, next: string) => {\n setDrafts((current) =>\n current.map((draft, at) => (at === index ? next : draft)),\n )\n setErrors((current) =>\n current.map((error, at) => (at === index ? null : error)),\n )\n }\n\n const removeDraft = (index: number) => {\n setDrafts((current) => current.filter((_, at) => at !== index))\n setErrors((current) => current.filter((_, at) => at !== index))\n }\n\n const addDraft = () => setDrafts((current) => [...current, ''])\n\n const canAddAnother =\n drafts.length < limit &&\n drafts.every((draft) => parse(draft.trim()).success)\n\n const save = () => {\n const nextErrors: (string | null)[] = []\n const saved: string[] = []\n\n for (const draft of drafts) {\n const raw = draft.trim()\n if (!raw) {\n nextErrors.push(null)\n continue\n }\n\n const parsed = parse(raw)\n if (!parsed.success) {\n nextErrors.push(parsed.message)\n continue\n }\n if (saved.includes(parsed.value)) {\n nextErrors.push(duplicateMessage)\n continue\n }\n\n nextErrors.push(null)\n saved.push(parsed.value)\n }\n\n setErrors(nextErrors)\n if (nextErrors.some(Boolean)) return\n\n onCommit(saved, { ...diffValues(value, saved), previousValue: value })\n setOpen(false)\n }\n\n return {\n addDraft,\n canAddAnother,\n drafts,\n errors,\n onOpenChange,\n open,\n removeDraft,\n save,\n setDraft,\n }\n}\n",
411
405
  "target": "~/packages/ui/src/patterns/properties/hooks/use-entry-list-editor.ts"
412
406
  },
413
407
  {
@@ -419,7 +413,7 @@
419
413
  {
420
414
  "path": "patterns/properties/shared/index.ts",
421
415
  "type": "registry:file",
422
- "content": "export * from './property-catalog'\nexport * from './property-surface'\n",
416
+ "content": "export * from './property-catalog'\nexport {\n type AttachmentPropertyLabels,\n type DatePropertyLabels,\n type DateRangePropertyLabels,\n defaultPropertyLabels,\n type EmailPropertyLabels,\n type PeoplePropertyLabels,\n type PhoneInputLabels,\n type PhonePropertyLabels,\n type PropertyCollectionLabels,\n type PropertyEntryListLabels,\n type PropertyLabels,\n type SchedulePropertyLabels,\n type SelectPropertyLabels,\n type TagsPropertyLabels,\n type TextPropertyLabels,\n} from './property-labels'\nexport * from './property-surface'\n",
423
417
  "target": "~/packages/ui/src/patterns/properties/shared/index.ts"
424
418
  },
425
419
  {
@@ -449,25 +443,37 @@
449
443
  {
450
444
  "path": "patterns/properties/shared/property-calendar-popover.tsx",
451
445
  "type": "registry:file",
452
- "content": "'use client'\n\nimport { Button } from '@tc96/ui/button'\nimport type { Calendar } from '@tc96/ui/calendar'\nimport { Popover, PopoverPopup, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport type { ComponentProps, ReactNode } from 'react'\nimport type { PropertyIcon } from './property-catalog'\nimport { PropertySurface, type PropertyVariant } from './property-surface'\nimport { PropertyTooltip } from './property-tooltip'\n\nexport type PropertyPopoverDropdownPlacement = Pick<\n ComponentProps<typeof PopoverPopup>,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n>\n\nexport type PropertyCalendarProps = Omit<\n ComponentProps<typeof Calendar>,\n 'defaultMonth' | 'mode' | 'onSelect' | 'selected'\n>\n\nexport interface PropertyCalendarPopoverProps {\n ariaLabel: string\n children: ReactNode\n icon: PropertyIcon\n label: string\n onOpenChange: (open: boolean) => void\n open: boolean\n align?: PropertyPopoverDropdownPlacement['align']\n className?: string\n clear?: { label: string; onClear: () => void }\n disabled?: boolean\n dropdownPlacement?: PropertyPopoverDropdownPlacement\n muted?: boolean\n overdue?: boolean\n tooltip?: ReactNode\n variant?: PropertyVariant\n}\n\nexport function PropertyCalendarPopover({\n align = 'start',\n ariaLabel,\n children,\n className,\n clear,\n disabled,\n dropdownPlacement,\n icon: Icon,\n label,\n muted = false,\n onOpenChange,\n open,\n overdue = false,\n tooltip,\n variant,\n}: Readonly<PropertyCalendarPopoverProps>) {\n const trigger = (\n <PopoverTrigger\n aria-label={`${ariaLabel}: ${label}`}\n disabled={disabled}\n render={\n <PropertySurface\n className={cn('max-w-full', className)}\n data-overdue={overdue || undefined}\n muted={muted}\n render={<button type=\"button\" />}\n variant={variant}\n />\n }\n >\n <Icon aria-hidden className=\"size-4\" data-slot=\"property-icon\" />\n <span className=\"truncate\">{label}</span>\n </PopoverTrigger>\n )\n\n return (\n <Popover onOpenChange={onOpenChange} open={open}>\n {tooltip ? (\n <PropertyTooltip content={tooltip} trigger={trigger} />\n ) : (\n trigger\n )}\n <PopoverPopup\n align={align}\n aria-label={ariaLabel}\n className=\"w-auto\"\n side=\"bottom\"\n {...dropdownPlacement}\n >\n {children}\n {clear ? (\n <div className=\"border-t p-2\">\n <Button\n className=\"w-full justify-start\"\n onClick={clear.onClear}\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n {clear.label}\n </Button>\n </div>\n ) : null}\n </PopoverPopup>\n </Popover>\n )\n}\n",
446
+ "content": "'use client'\n\nimport { Button } from '@tc96/ui/button'\nimport type { Calendar } from '@tc96/ui/calendar'\nimport { Popover, PopoverPopup, PopoverTrigger } from '@tc96/ui/popover'\nimport { cn } from '@tc96/utils'\nimport type { ComponentProps, ReactNode } from 'react'\nimport type {\n PropertyIcon,\n PropertyPopoverDropdownPlacement,\n} from './property-catalog'\nimport { PropertySurface, type PropertyVariant } from './property-surface'\nimport { PropertyTooltip } from './property-tooltip'\n\nexport type PropertyCalendarProps = Omit<\n ComponentProps<typeof Calendar>,\n 'defaultMonth' | 'mode' | 'onSelect' | 'selected'\n>\n\nexport interface PropertyCalendarPopoverProps {\n ariaLabel: string\n children: ReactNode\n icon: PropertyIcon\n label: string\n onOpenChange: (open: boolean) => void\n open: boolean\n align?: PropertyPopoverDropdownPlacement['align']\n className?: string\n clear?: { label: string; onClear: () => void }\n disabled?: boolean\n dropdownPlacement?: PropertyPopoverDropdownPlacement\n muted?: boolean\n overdue?: boolean\n tooltip?: ReactNode\n variant?: PropertyVariant\n}\n\nexport function PropertyCalendarPopover({\n align = 'start',\n ariaLabel,\n children,\n className,\n clear,\n disabled,\n dropdownPlacement,\n icon: Icon,\n label,\n muted = false,\n onOpenChange,\n open,\n overdue = false,\n tooltip,\n variant,\n}: Readonly<PropertyCalendarPopoverProps>) {\n const trigger = (\n <PopoverTrigger\n aria-label={`${ariaLabel}: ${label}`}\n disabled={disabled}\n render={\n <PropertySurface\n className={cn('max-w-full', className)}\n data-overdue={overdue || undefined}\n muted={muted}\n render={<button type=\"button\" />}\n variant={variant}\n />\n }\n >\n <Icon aria-hidden className=\"size-4\" data-slot=\"property-icon\" />\n <span className=\"truncate\">{label}</span>\n </PopoverTrigger>\n )\n\n return (\n <Popover onOpenChange={onOpenChange} open={open}>\n {tooltip ? (\n <PropertyTooltip content={tooltip} trigger={trigger} />\n ) : (\n trigger\n )}\n <PopoverPopup\n align={align}\n aria-label={ariaLabel}\n className=\"w-auto\"\n side=\"bottom\"\n {...dropdownPlacement}\n >\n {children}\n {clear ? (\n <div className=\"border-t p-2\">\n <Button\n className=\"w-full justify-start\"\n onClick={clear.onClear}\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n {clear.label}\n </Button>\n </div>\n ) : null}\n </PopoverPopup>\n </Popover>\n )\n}\n",
453
447
  "target": "~/packages/ui/src/patterns/properties/shared/property-calendar-popover.tsx"
454
448
  },
455
449
  {
456
450
  "path": "patterns/properties/shared/property-catalog.ts",
457
451
  "type": "registry:file",
458
- "content": "import type React from 'react'\n\nexport type PropertyIcon = React.ComponentType<React.SVGProps<SVGSVGElement>>\n\nexport type PropertyTone = 'danger' | 'info' | 'neutral' | 'success' | 'warning'\n\nexport interface PropertyPreset<TValue extends string> {\n icon: PropertyIcon\n label: string\n tone: PropertyTone\n value: TValue\n}\n\nexport const propertyToneClassName: Record<PropertyTone, string> = {\n danger: 'text-destructive-foreground',\n info: 'text-info-foreground',\n neutral: 'text-muted-foreground',\n success: 'text-success-foreground',\n warning: 'text-warning-foreground',\n}\n",
452
+ "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",
459
453
  "target": "~/packages/ui/src/patterns/properties/shared/property-catalog.ts"
460
454
  },
455
+ {
456
+ "path": "patterns/properties/shared/property-display-meta.ts",
457
+ "type": "registry:file",
458
+ "content": "import {\n BuildingsIcon,\n CalendarBlankIcon,\n CalendarDotsIcon,\n CalendarIcon,\n CubeIcon,\n EnvelopeSimpleIcon,\n FileIcon,\n FileTextIcon,\n LinkIcon,\n PackageIcon,\n PhoneIcon,\n TagIcon,\n UserPlusIcon,\n WaveformIcon,\n} from '@phosphor-icons/react'\nimport type { PropertyIcon, PropertyOption } from './property-catalog'\n\nexport type AttachmentType = 'audio' | 'doc' | 'link' | 'pdf'\n\nexport type ReferencePropertyKind = 'account' | 'product' | 'record'\n\nexport type PropertyDisplayMeta = Required<\n Pick<PropertyOption, 'icon' | 'tone'>\n> &\n Pick<PropertyOption, 'weight'>\n\nexport const propertyDisplayIcons = {\n date: CalendarDotsIcon,\n dateRange: CalendarIcon,\n email: EnvelopeSimpleIcon,\n personAdd: UserPlusIcon,\n phone: PhoneIcon,\n schedule: CalendarBlankIcon,\n tags: TagIcon,\n} as const satisfies Record<string, PropertyIcon>\n\nexport const referenceKindIcons = {\n account: BuildingsIcon,\n product: PackageIcon,\n record: CubeIcon,\n} as const satisfies Record<ReferencePropertyKind, PropertyIcon>\n\nexport const attachmentTypeMeta = {\n audio: { icon: WaveformIcon, tone: 'warning' },\n doc: { icon: FileIcon, tone: 'info' },\n link: { icon: LinkIcon, tone: 'neutral' },\n pdf: { icon: FileTextIcon, tone: 'danger' },\n} as const satisfies Record<AttachmentType, PropertyDisplayMeta>\n",
459
+ "target": "~/packages/ui/src/patterns/properties/shared/property-display-meta.ts"
460
+ },
461
461
  {
462
462
  "path": "patterns/properties/shared/property-entry-form.tsx",
463
463
  "type": "registry:file",
464
- "content": "'use client'\n\nimport { PlusIcon, XIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { PopoverPopup } from '@tc96/ui/popover'\nimport type { FormEvent, KeyboardEventHandler, ReactNode } from 'react'\n\nexport interface PropertyEntryField {\n ariaLabel: string\n draft: string\n index: number\n invalid: boolean\n onChange: (next: string) => void\n onKeyDown: KeyboardEventHandler<HTMLInputElement>\n}\n\nexport interface PropertyEntryFormProps {\n addLabel: string\n canAddAnother: boolean\n drafts: readonly string[]\n entryLabels: readonly string[]\n errors: readonly (string | null)[]\n onAdd: () => void\n onChange: (index: number, next: string) => void\n onRemove: (index: number) => void\n onSave: () => void\n removeLabel: (entryLabel: string) => string\n renderField: (field: PropertyEntryField) => ReactNode\n errorMessage?: string | null\n}\n\nexport function PropertyEntryForm({\n addLabel,\n canAddAnother,\n drafts,\n entryLabels,\n errorMessage = null,\n errors,\n onAdd,\n onChange,\n onRemove,\n onSave,\n removeLabel,\n renderField,\n}: Readonly<PropertyEntryFormProps>) {\n const submit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n onSave()\n }\n\n const saveOnEnter: KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (event.key !== 'Enter') return\n event.preventDefault()\n event.stopPropagation()\n onSave()\n }\n\n return (\n <PopoverPopup align=\"start\" aria-label={addLabel} className=\"w-80\">\n <form className=\"grid gap-3 p-1\" noValidate onSubmit={submit}>\n {drafts.map((draft, index) => (\n <div\n className=\"group/entry grid gap-1\"\n key={entryLabels[index] ?? index}\n >\n {drafts.length > 1 || entryLabels.length > 1 ? (\n <span className=\"font-medium text-muted-foreground text-xs\">\n {entryLabels[index] ?? `${index + 1}`}\n </span>\n ) : null}\n <div className=\"flex items-center gap-1\">\n {renderField({\n ariaLabel: entryLabels[index] ?? addLabel,\n draft,\n index,\n invalid: Boolean(errors[index]),\n onChange: (next) => onChange(index, next),\n onKeyDown: saveOnEnter,\n })}\n {drafts.length > 1 ? (\n <Button\n aria-label={removeLabel(entryLabels[index] ?? '')}\n className=\"opacity-0 transition-opacity focus-visible:opacity-100 group-focus-within/entry:opacity-100 group-hover/entry:opacity-100\"\n onClick={() => onRemove(index)}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n <XIcon aria-hidden=\"true\" />\n </Button>\n ) : null}\n </div>\n {errors[index] ? (\n <p className=\"text-destructive-foreground text-xs\" role=\"alert\">\n {errors[index]}\n </p>\n ) : null}\n </div>\n ))}\n {errorMessage ? (\n <p className=\"text-destructive-foreground text-xs\" role=\"alert\">\n {errorMessage}\n </p>\n ) : null}\n <div className=\"flex items-center justify-between gap-2\">\n <Button\n disabled={!canAddAnother}\n onClick={onAdd}\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n <PlusIcon aria-hidden=\"true\" />\n Adicionar outro\n </Button>\n <Button size=\"sm\" type=\"submit\" variant=\"secondary\">\n Salvar\n </Button>\n </div>\n </form>\n </PopoverPopup>\n )\n}\n",
464
+ "content": "'use client'\n\nimport { PlusIcon, XIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { PopoverPopup } from '@tc96/ui/popover'\nimport type { FormEvent, KeyboardEventHandler, ReactNode } from 'react'\nimport type { PropertyEntryListLabels } from './property-labels'\n\nexport interface PropertyEntryField {\n ariaLabel: string\n draft: string\n index: number\n invalid: boolean\n onChange: (next: string) => void\n onKeyDown: KeyboardEventHandler<HTMLInputElement>\n}\n\nexport interface PropertyEntryFormProps {\n canAddAnother: boolean\n drafts: readonly string[]\n errors: readonly (string | null)[]\n labels: Pick<\n PropertyEntryListLabels,\n 'add' | 'addAnother' | 'entries' | 'removeEntry' | 'save'\n >\n onAdd: () => void\n onChange: (index: number, next: string) => void\n onRemove: (index: number) => void\n onSave: () => void\n renderField: (field: PropertyEntryField) => ReactNode\n errorMessage?: string | null\n}\n\nexport function PropertyEntryForm({\n canAddAnother,\n drafts,\n errorMessage = null,\n errors,\n labels,\n onAdd,\n onChange,\n onRemove,\n onSave,\n renderField,\n}: Readonly<PropertyEntryFormProps>) {\n const entryLabels = labels.entries\n const submit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n onSave()\n }\n\n const saveOnEnter: KeyboardEventHandler<HTMLInputElement> = (event) => {\n if (event.key !== 'Enter') return\n event.preventDefault()\n event.stopPropagation()\n onSave()\n }\n\n return (\n <PopoverPopup align=\"start\" aria-label={labels.add} className=\"w-80\">\n <form className=\"grid gap-3 p-1\" noValidate onSubmit={submit}>\n {drafts.map((draft, index) => (\n <div\n className=\"group/entry grid gap-1\"\n key={entryLabels[index] ?? index}\n >\n {drafts.length > 1 || entryLabels.length > 1 ? (\n <span className=\"font-medium text-muted-foreground text-xs\">\n {entryLabels[index] ?? `${index + 1}`}\n </span>\n ) : null}\n <div className=\"flex items-center gap-1\">\n {renderField({\n ariaLabel: entryLabels[index] ?? labels.add,\n draft,\n index,\n invalid: Boolean(errors[index]),\n onChange: (next) => onChange(index, next),\n onKeyDown: saveOnEnter,\n })}\n {drafts.length > 1 ? (\n <Button\n aria-label={labels.removeEntry(entryLabels[index] ?? '')}\n className=\"opacity-0 transition-opacity focus-visible:opacity-100 group-focus-within/entry:opacity-100 group-hover/entry:opacity-100\"\n onClick={() => onRemove(index)}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n <XIcon aria-hidden=\"true\" />\n </Button>\n ) : null}\n </div>\n {errors[index] ? (\n <p className=\"text-destructive-foreground text-xs\" role=\"alert\">\n {errors[index]}\n </p>\n ) : null}\n </div>\n ))}\n {errorMessage ? (\n <p className=\"text-destructive-foreground text-xs\" role=\"alert\">\n {errorMessage}\n </p>\n ) : null}\n <div className=\"flex items-center justify-between gap-2\">\n <Button\n disabled={!canAddAnother}\n onClick={onAdd}\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n <PlusIcon aria-hidden=\"true\" />\n {labels.addAnother}\n </Button>\n <Button size=\"sm\" type=\"submit\" variant=\"secondary\">\n {labels.save}\n </Button>\n </div>\n </form>\n </PopoverPopup>\n )\n}\n",
465
465
  "target": "~/packages/ui/src/patterns/properties/shared/property-entry-form.tsx"
466
466
  },
467
+ {
468
+ "path": "patterns/properties/shared/property-labels.ts",
469
+ "type": "registry:file",
470
+ "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",
471
+ "target": "~/packages/ui/src/patterns/properties/shared/property-labels.ts"
472
+ },
467
473
  {
468
474
  "path": "patterns/properties/shared/property-multi-select-shell.tsx",
469
475
  "type": "registry:file",
470
- "content": "'use client'\n\nimport { PlusIcon } from '@phosphor-icons/react'\nimport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxEmpty,\n ComboboxItem,\n ComboboxList,\n ComboboxPopup,\n ComboboxStatus,\n} from '@tc96/ui/combobox'\nimport { cn } from '@tc96/utils'\nimport type { ComponentProps, ReactNode, RefObject } from 'react'\nimport { useRef, useState } from 'react'\nimport {\n diffOptions,\n type OptionLike,\n type ResolvedOption,\n} from './lib/property-options'\nimport type { PropertyIcon } from './property-catalog'\nimport { propertySelectItemClassName } from './property-select-shell'\nimport { PropertySurface, type PropertyVariant } from './property-surface'\n\nexport type PropertyMultiSelectDropdownPlacement = Pick<\n ComponentProps<typeof ComboboxPopup>,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n>\n\nexport interface PropertyMultiSelectChange<TOption extends OptionLike> {\n added: ResolvedOption<TOption> | null\n previousValue: readonly TOption['value'][]\n removed: ResolvedOption<TOption> | null\n}\n\nexport interface PropertyMultiSelectShellProps<TOption extends OptionLike> {\n addIcon: PropertyIcon\n addLabel: string\n ariaLabel: string\n emptyLabel: string\n loadingLabel: string\n onChange: (\n value: readonly TOption['value'][],\n change: PropertyMultiSelectChange<TOption>,\n ) => void\n options: readonly TOption[]\n placeholder: string\n removeLabel: (option: ResolvedOption<TOption>) => string\n renderChip?: (option: ResolvedOption<TOption>) => ReactNode\n renderOption: (option: ResolvedOption<TOption>) => ReactNode\n selectedOptions: ResolvedOption<TOption>[]\n value: readonly TOption['value'][]\n disabled?: boolean\n dropdownPlacement?: PropertyMultiSelectDropdownPlacement\n isLoading?: boolean\n renderTrigger?: (controls: {\n anchorRef: RefObject<HTMLButtonElement | null>\n open: () => void\n }) => ReactNode\n variant?: PropertyVariant\n}\n\nexport function PropertyMultiSelectShell<TOption extends OptionLike>({\n addIcon: AddIcon,\n addLabel,\n ariaLabel,\n disabled = false,\n dropdownPlacement,\n emptyLabel,\n isLoading = false,\n loadingLabel,\n onChange,\n options,\n placeholder,\n removeLabel,\n renderChip,\n renderOption,\n renderTrigger,\n selectedOptions,\n value,\n variant = 'plain',\n}: Readonly<PropertyMultiSelectShellProps<TOption>>) {\n const [open, setOpen] = useState(false)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const hasValue = selectedOptions.length > 0\n const openList = () => setOpen(true)\n\n return (\n <Combobox<ResolvedOption<TOption>, true>\n autoHighlight\n disabled={disabled}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n items={options}\n multiple\n onOpenChange={setOpen}\n onValueChange={(nextOptions) => {\n const nextValue = nextOptions.map((option) => option.value)\n\n onChange(nextValue, {\n ...diffOptions(options, value, nextValue),\n previousValue: value,\n })\n }}\n open={open}\n value={selectedOptions}\n >\n {renderTrigger ? (\n renderTrigger({ anchorRef: triggerRef, open: openList })\n ) : (\n <ComboboxChips\n className={cn(\n '**:data-[slot=combobox-chip]:rounded-sm **:data-[slot=combobox-chip]:text-sm',\n variant === 'plain' &&\n 'min-h-7 border-transparent! bg-transparent! p-0 shadow-none! before:hidden focus-within:ring-0 sm:min-h-6',\n )}\n >\n {selectedOptions.map((option) => (\n <ComboboxChip\n key={option.value}\n removeProps={{ 'aria-label': removeLabel(option) }}\n >\n {(renderChip ?? renderOption)(option)}\n </ComboboxChip>\n ))}\n <PropertySurface\n aria-label={hasValue ? addLabel : undefined}\n className={cn(\n hasValue ? 'w-6 px-0' : 'gap-1.5 text-muted-foreground',\n )}\n muted={!hasValue}\n onClick={openList}\n render={<button disabled={disabled} type=\"button\" />}\n >\n {hasValue ? (\n <PlusIcon aria-hidden=\"true\" className=\"size-4\" />\n ) : (\n <>\n <AddIcon aria-hidden=\"true\" className=\"size-4\" />\n {placeholder}\n </>\n )}\n </PropertySurface>\n </ComboboxChips>\n )}\n <ComboboxPopup\n {...dropdownPlacement}\n anchor={renderTrigger ? triggerRef : undefined}\n align={dropdownPlacement?.align ?? 'end'}\n aria-label={ariaLabel}\n className=\"w-max min-w-0! max-w-[calc(100vw-2rem)]\"\n >\n {isLoading ? <ComboboxStatus>{loadingLabel}</ComboboxStatus> : null}\n <ComboboxEmpty>{emptyLabel}</ComboboxEmpty>\n <ComboboxList aria-label={ariaLabel}>\n {(option: ResolvedOption<TOption>) => (\n <ComboboxItem\n className={propertySelectItemClassName}\n key={option.value}\n value={option}\n >\n {renderOption(option)}\n </ComboboxItem>\n )}\n </ComboboxList>\n </ComboboxPopup>\n </Combobox>\n )\n}\n",
476
+ "content": "'use client'\n\nimport { PlusIcon } from '@phosphor-icons/react'\nimport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxEmpty,\n ComboboxItem,\n ComboboxList,\n ComboboxPopup,\n ComboboxStatus,\n} from '@tc96/ui/combobox'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode, RefObject } from 'react'\nimport { useRef, useState } from 'react'\nimport {\n diffOptions,\n type OptionLike,\n type ResolvedOption,\n} from './lib/property-options'\nimport type {\n PropertyIcon,\n PropertyListChangeContext,\n PropertyMultiSelectDropdownPlacement,\n} from './property-catalog'\nimport { propertySelectItemClassName } from './property-select-shell'\nimport { PropertySurface, type PropertyVariant } from './property-surface'\n\nexport interface PropertyMultiSelectShellProps<TOption extends OptionLike> {\n addIcon: PropertyIcon\n addLabel: string\n ariaLabel: string\n emptyLabel: string\n loadingLabel: string\n onChange: (\n value: readonly TOption['value'][],\n change: PropertyListChangeContext<\n ResolvedOption<TOption>,\n TOption['value']\n >,\n ) => void\n options: readonly TOption[]\n placeholder: string\n removeLabel: (option: ResolvedOption<TOption>) => string\n renderChip?: (option: ResolvedOption<TOption>) => ReactNode\n renderOption: (option: ResolvedOption<TOption>) => ReactNode\n selectedOptions: ResolvedOption<TOption>[]\n value: readonly TOption['value'][]\n disabled?: boolean\n dropdownPlacement?: PropertyMultiSelectDropdownPlacement\n isLoading?: boolean\n renderTrigger?: (controls: {\n anchorRef: RefObject<HTMLButtonElement | null>\n open: () => void\n }) => ReactNode\n variant?: PropertyVariant\n}\n\nexport function PropertyMultiSelectShell<TOption extends OptionLike>({\n addIcon: AddIcon,\n addLabel,\n ariaLabel,\n disabled = false,\n dropdownPlacement,\n emptyLabel,\n isLoading = false,\n loadingLabel,\n onChange,\n options,\n placeholder,\n removeLabel,\n renderChip,\n renderOption,\n renderTrigger,\n selectedOptions,\n value,\n variant = 'plain',\n}: Readonly<PropertyMultiSelectShellProps<TOption>>) {\n const [open, setOpen] = useState(false)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const hasValue = selectedOptions.length > 0\n const openList = () => setOpen(true)\n\n return (\n <Combobox<ResolvedOption<TOption>, true>\n autoHighlight\n disabled={disabled}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n items={options}\n multiple\n onOpenChange={setOpen}\n onValueChange={(nextOptions) => {\n const nextValue = nextOptions.map((option) => option.value)\n\n onChange(nextValue, {\n ...diffOptions(options, value, nextValue),\n previousValue: value,\n })\n }}\n open={open}\n value={selectedOptions}\n >\n {renderTrigger ? (\n renderTrigger({ anchorRef: triggerRef, open: openList })\n ) : (\n <ComboboxChips\n className={cn(\n '**:data-[slot=combobox-chip]:rounded-sm **:data-[slot=combobox-chip]:text-sm',\n variant === 'plain' &&\n 'min-h-7 border-transparent! bg-transparent! p-0 shadow-none! before:hidden focus-within:ring-0 sm:min-h-6',\n )}\n >\n {selectedOptions.map((option) => (\n <ComboboxChip\n key={option.value}\n removeProps={{ 'aria-label': removeLabel(option) }}\n >\n {(renderChip ?? renderOption)(option)}\n </ComboboxChip>\n ))}\n <PropertySurface\n aria-label={hasValue ? addLabel : undefined}\n className={cn(\n hasValue ? 'w-6 px-0' : 'gap-1.5 text-muted-foreground',\n )}\n muted={!hasValue}\n onClick={openList}\n render={<button disabled={disabled} type=\"button\" />}\n >\n {hasValue ? (\n <PlusIcon aria-hidden=\"true\" className=\"size-4\" />\n ) : (\n <>\n <AddIcon aria-hidden=\"true\" className=\"size-4\" />\n {placeholder}\n </>\n )}\n </PropertySurface>\n </ComboboxChips>\n )}\n <ComboboxPopup\n {...dropdownPlacement}\n anchor={renderTrigger ? triggerRef : undefined}\n align={dropdownPlacement?.align ?? 'end'}\n aria-label={ariaLabel}\n className=\"w-max min-w-0! max-w-[calc(100vw-2rem)]\"\n >\n {isLoading ? <ComboboxStatus>{loadingLabel}</ComboboxStatus> : null}\n <ComboboxEmpty>{emptyLabel}</ComboboxEmpty>\n <ComboboxList aria-label={ariaLabel}>\n {(option: ResolvedOption<TOption>) => (\n <ComboboxItem\n className={propertySelectItemClassName}\n key={option.value}\n value={option}\n >\n {renderOption(option)}\n </ComboboxItem>\n )}\n </ComboboxList>\n </ComboboxPopup>\n </Combobox>\n )\n}\n",
471
477
  "target": "~/packages/ui/src/patterns/properties/shared/property-multi-select-shell.tsx"
472
478
  },
473
479
  {
@@ -479,7 +485,7 @@
479
485
  {
480
486
  "path": "patterns/properties/shared/property-select-shell.tsx",
481
487
  "type": "registry:file",
482
- "content": "'use client'\n\nimport { Select, SelectPopup, SelectPrimitive } from '@tc96/ui/select'\nimport { cn } from '@tc96/utils'\nimport type { ComponentProps, ReactNode } from 'react'\nimport { PropertySurface, type PropertyVariant } from './property-surface'\n\nexport type PropertySelectDropdownPlacement = Pick<\n ComponentProps<typeof SelectPopup>,\n 'align' | 'alignItemWithTrigger' | 'alignOffset' | 'side' | 'sideOffset'\n>\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",
488
+ "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",
483
489
  "target": "~/packages/ui/src/patterns/properties/shared/property-select-shell.tsx"
484
490
  },
485
491
  {
@@ -514,6 +520,7 @@
514
520
  "@ui/input-group",
515
521
  "@ui/menu",
516
522
  "@ui/popover",
523
+ "@ui/property-tone",
517
524
  "@ui/select",
518
525
  "@ui/separator",
519
526
  "@ui/switch",