@tc96/cli 0.0.0-stage → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -2
  3. package/cli.js +1450 -0
  4. package/package.json +35 -4
  5. package/registry/agenda-1.json +1297 -0
  6. package/registry/aggregate.json +4 -0
  7. package/registry/ai-chat-1.json +91 -0
  8. package/registry/app-shell-1.json +81 -0
  9. package/registry/app-shell-2.json +89 -0
  10. package/registry/app-shell-3.json +109 -0
  11. package/registry/app-shell-4.json +104 -0
  12. package/registry/card-1.json +104 -0
  13. package/registry/card-2.json +97 -0
  14. package/registry/card-3.json +104 -0
  15. package/registry/card-4.json +98 -0
  16. package/registry/card-5.json +85 -0
  17. package/registry/card-6.json +98 -0
  18. package/registry/card-7.json +104 -0
  19. package/registry/card-8.json +106 -0
  20. package/registry/card-9.json +92 -0
  21. package/registry/charts.json +30 -0
  22. package/registry/chat-assistant.json +110 -0
  23. package/registry/chats-panel.json +97 -0
  24. package/registry/checklist.json +321 -0
  25. package/registry/collection.json +1104 -0
  26. package/registry/crm-1.json +1317 -0
  27. package/registry/crm-2.json +1400 -0
  28. package/registry/dashboard-1.json +160 -0
  29. package/registry/dashboard-2.json +153 -0
  30. package/registry/dashboard-3.json +154 -0
  31. package/registry/dashboard-4.json +168 -0
  32. package/registry/dashboard-5.json +167 -0
  33. package/registry/dashboard-6.json +143 -0
  34. package/registry/dashboard-7.json +188 -0
  35. package/registry/documents-1.json +1322 -0
  36. package/registry/editable.json +36 -0
  37. package/registry/empty-state-1.json +40 -0
  38. package/registry/empty-state-2.json +39 -0
  39. package/registry/empty-state-3.json +61 -0
  40. package/registry/empty-state-4.json +39 -0
  41. package/registry/empty-state-5.json +47 -0
  42. package/registry/empty-state-6.json +40 -0
  43. package/registry/finance-1.json +845 -0
  44. package/registry/finance-2.json +973 -0
  45. package/registry/finance-3.json +1436 -0
  46. package/registry/flow-1.json +460 -0
  47. package/registry/flow-2.json +503 -0
  48. package/registry/flow-3.json +198 -0
  49. package/registry/flow-4.json +75 -0
  50. package/registry/flow-canvas.json +198 -0
  51. package/registry/flow-inspector.json +151 -0
  52. package/registry/flow-step-library.json +112 -0
  53. package/registry/forgot-password-1.json +73 -0
  54. package/registry/forgot-password-2.json +73 -0
  55. package/registry/inbox-1.json +1184 -0
  56. package/registry/inventory-1.json +828 -0
  57. package/registry/inventory-2.json +956 -0
  58. package/registry/legal-1.json +1345 -0
  59. package/registry/legal-2.json +1279 -0
  60. package/registry/legal-3.json +1273 -0
  61. package/registry/legal-4.json +1273 -0
  62. package/registry/legal-5.json +1393 -0
  63. package/registry/legal-6.json +1309 -0
  64. package/registry/legal-7.json +1315 -0
  65. package/registry/legal-8.json +1358 -0
  66. package/registry/legal-9.json +1381 -0
  67. package/registry/list-1.json +129 -0
  68. package/registry/list-2.json +117 -0
  69. package/registry/list-3.json +129 -0
  70. package/registry/list-4.json +105 -0
  71. package/registry/list-5.json +98 -0
  72. package/registry/list-6.json +92 -0
  73. package/registry/list.json +52 -0
  74. package/registry/login-1.json +89 -0
  75. package/registry/login-10.json +88 -0
  76. package/registry/login-2.json +81 -0
  77. package/registry/login-3.json +90 -0
  78. package/registry/login-4.json +81 -0
  79. package/registry/login-5.json +82 -0
  80. package/registry/login-6.json +88 -0
  81. package/registry/login-7.json +83 -0
  82. package/registry/login-8.json +81 -0
  83. package/registry/login-9.json +88 -0
  84. package/registry/magic-link-6.json +79 -0
  85. package/registry/marketing-1.json +833 -0
  86. package/registry/marketing-2.json +961 -0
  87. package/registry/navbar-1.json +66 -0
  88. package/registry/navbar-10.json +50 -0
  89. package/registry/navbar-11.json +48 -0
  90. package/registry/navbar-12.json +48 -0
  91. package/registry/navbar-2.json +48 -0
  92. package/registry/navbar-3.json +50 -0
  93. package/registry/navbar-4.json +39 -0
  94. package/registry/navbar-5.json +50 -0
  95. package/registry/navbar-6.json +48 -0
  96. package/registry/navbar-7.json +72 -0
  97. package/registry/navbar-8.json +50 -0
  98. package/registry/navbar-9.json +54 -0
  99. package/registry/onboarding-1.json +114 -0
  100. package/registry/onboarding-2.json +78 -0
  101. package/registry/onboarding-3.json +71 -0
  102. package/registry/otp-1.json +73 -0
  103. package/registry/projects-1.json +865 -0
  104. package/registry/projects-2.json +993 -0
  105. package/registry/projects-3.json +1346 -0
  106. package/registry/properties.json +530 -0
  107. package/registry/record-dialog.json +88 -0
  108. package/registry/record-group.json +194 -0
  109. package/registry/record-preview.json +70 -0
  110. package/registry/record-status-list.json +70 -0
  111. package/registry/reset-password-1.json +92 -0
  112. package/registry/reset-password-2.json +98 -0
  113. package/registry/reset-password-6.json +91 -0
  114. package/registry/revenue-1.json +834 -0
  115. package/registry/revenue-2.json +968 -0
  116. package/registry/revenue-3.json +821 -0
  117. package/registry/revenue-4.json +949 -0
  118. package/registry/rich-text-editor-1.json +172 -0
  119. package/registry/rich-text-editor-2.json +158 -0
  120. package/registry/rich-text-editor-3.json +198 -0
  121. package/registry/rich-text-editor-4.json +200 -0
  122. package/registry/rich-text-editor-5.json +237 -0
  123. package/registry/rich-text-editor.json +113 -0
  124. package/registry/settings-account-1.json +119 -0
  125. package/registry/settings-account-2.json +118 -0
  126. package/registry/settings-catalog-1.json +128 -0
  127. package/registry/settings-catalog-10.json +129 -0
  128. package/registry/settings-catalog-2.json +116 -0
  129. package/registry/settings-catalog-3.json +118 -0
  130. package/registry/settings-catalog-4.json +227 -0
  131. package/registry/settings-catalog-5.json +129 -0
  132. package/registry/settings-catalog-6.json +130 -0
  133. package/registry/settings-catalog-7.json +130 -0
  134. package/registry/settings-catalog-8.json +183 -0
  135. package/registry/settings-catalog-9.json +159 -0
  136. package/registry/settings-integration-1.json +125 -0
  137. package/registry/settings-integration-2.json +122 -0
  138. package/registry/settings-integration-3.json +118 -0
  139. package/registry/settings-integration-4.json +129 -0
  140. package/registry/settings-integration-5.json +122 -0
  141. package/registry/settings-integration-6.json +92 -0
  142. package/registry/settings-integration-7.json +122 -0
  143. package/registry/settings-integration-8.json +593 -0
  144. package/registry/settings-notification-channel-1.json +112 -0
  145. package/registry/settings-preference-1.json +123 -0
  146. package/registry/settings-preference-2.json +123 -0
  147. package/registry/settings-preference-3.json +116 -0
  148. package/registry/settings-role-permission-1.json +117 -0
  149. package/registry/settings-security-1.json +117 -0
  150. package/registry/settings-workspace-1.json +119 -0
  151. package/registry/settings-workspace-2.json +125 -0
  152. package/registry/settings.json +82 -0
  153. package/registry/signup-1.json +100 -0
  154. package/registry/signup-2.json +93 -0
  155. package/registry/signup-3.json +83 -0
  156. package/registry/signup-6.json +99 -0
  157. package/registry/state-surface.json +58 -0
  158. package/registry/stats-1.json +116 -0
  159. package/registry/stats-2.json +115 -0
  160. package/registry/stats-3.json +97 -0
  161. package/registry/stats-4.json +92 -0
  162. package/registry/stats-5.json +103 -0
  163. package/registry/stats-6.json +105 -0
  164. package/registry/stats-7.json +103 -0
  165. package/registry/stats.json +64 -0
  166. package/registry/support-1.json +853 -0
  167. package/registry/support-2.json +981 -0
  168. package/registry/support-3.json +762 -0
  169. package/registry/support-4.json +538 -0
  170. package/registry/team-1.json +829 -0
  171. package/registry/team-2.json +957 -0
  172. package/registry/timeline-1.json +97 -0
  173. package/registry/timeline-2.json +102 -0
  174. package/registry/timeline-3.json +68 -0
  175. package/registry/timeline-4.json +86 -0
  176. package/registry/ui/accordion.json +15 -0
  177. package/registry/ui/alert-dialog.json +14 -0
  178. package/registry/ui/alert.json +50 -0
  179. package/registry/ui/autocomplete.json +18 -0
  180. package/registry/ui/avatar.json +14 -0
  181. package/registry/ui/badge.json +51 -0
  182. package/registry/ui/breadcrumb.json +15 -0
  183. package/registry/ui/button.json +25 -0
  184. package/registry/ui/calendar.json +15 -0
  185. package/registry/ui/card.json +14 -0
  186. package/registry/ui/chat.json +115 -0
  187. package/registry/ui/checkbox-group.json +14 -0
  188. package/registry/ui/checkbox.json +14 -0
  189. package/registry/ui/collapsible.json +14 -0
  190. package/registry/ui/combobox.json +18 -0
  191. package/registry/ui/command.json +17 -0
  192. package/registry/ui/composer-clipboard.json +14 -0
  193. package/registry/ui/composer-document.json +14 -0
  194. package/registry/ui/composer-editor.json +16 -0
  195. package/registry/ui/composer-query.json +12 -0
  196. package/registry/ui/composer.json +17 -0
  197. package/registry/ui/context-menu.json +23 -0
  198. package/registry/ui/dialog.json +18 -0
  199. package/registry/ui/drawer.json +18 -0
  200. package/registry/ui/empty.json +14 -0
  201. package/registry/ui/field.json +22 -0
  202. package/registry/ui/fieldset.json +14 -0
  203. package/registry/ui/form.json +14 -0
  204. package/registry/ui/frame.json +12 -0
  205. package/registry/ui/gauge.json +31 -0
  206. package/registry/ui/group.json +17 -0
  207. package/registry/ui/icon-frame.json +31 -0
  208. package/registry/ui/input-group.json +17 -0
  209. package/registry/ui/input.json +14 -0
  210. package/registry/ui/kbd.json +12 -0
  211. package/registry/ui/label.json +14 -0
  212. package/registry/ui/menu.json +39 -0
  213. package/registry/ui/meter.json +14 -0
  214. package/registry/ui/number-field.json +17 -0
  215. package/registry/ui/otp-field.json +31 -0
  216. package/registry/ui/pagination.json +17 -0
  217. package/registry/ui/popover.json +14 -0
  218. package/registry/ui/preview-card.json +14 -0
  219. package/registry/ui/progress.json +14 -0
  220. package/registry/ui/property-meta.json +16 -0
  221. package/registry/ui/property-tone.json +12 -0
  222. package/registry/ui/radio-group.json +14 -0
  223. package/registry/ui/render-anchor.json +12 -0
  224. package/registry/ui/scroll-area.json +14 -0
  225. package/registry/ui/segmented-control.json +14 -0
  226. package/registry/ui/select.json +16 -0
  227. package/registry/ui/separator.json +14 -0
  228. package/registry/ui/sheet.json +18 -0
  229. package/registry/ui/sidebar.json +25 -0
  230. package/registry/ui/skeleton.json +24 -0
  231. package/registry/ui/slider.json +14 -0
  232. package/registry/ui/spinner.json +14 -0
  233. package/registry/ui/switch.json +14 -0
  234. package/registry/ui/table.json +14 -0
  235. package/registry/ui/tabs.json +16 -0
  236. package/registry/ui/text.json +31 -0
  237. package/registry/ui/textarea.json +14 -0
  238. package/registry/ui/toast.json +89 -0
  239. package/registry/ui/toggle-group.json +18 -0
  240. package/registry/ui/toggle.json +15 -0
  241. package/registry/ui/toolbar.json +14 -0
  242. package/registry/ui/tooltip.json +14 -0
  243. package/registry/ui/use-composer-editor.json +17 -0
  244. package/registry/ui/use-copy-to-clipboard.json +12 -0
  245. package/registry/ui/use-media-query.json +12 -0
  246. package/registry/view.json +1104 -0
  247. package/registry/widgets.json +319 -0
  248. package/registry/wizard.json +89 -0
@@ -0,0 +1,530 @@
1
+ {
2
+ "name": "properties",
3
+ "type": "registry:block",
4
+ "files": [
5
+ {
6
+ "path": "helpers/calendar-date.ts",
7
+ "type": "registry:file",
8
+ "content": "/** Span of days {@link calendarRange} produces around an anchor date. */\nexport type CalendarRangeMode = 'day' | 'month' | 'week'\n\n/**\n * A calendar day with no time and no time zone attached. `month` runs from\n * 1 to 12.\n */\nexport interface CalendarDate {\n day: number\n month: number\n year: number\n}\n\nconst DATE_KEY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/\n\n/**\n * Serializes a calendar date as `YYYY-MM-DD`, a stable key for maps and DOM\n * attributes.\n *\n * @param date - The calendar date to serialize.\n */\nexport function calendarDateKey(date: CalendarDate): string {\n const month = String(date.month).padStart(2, '0')\n const day = String(date.day).padStart(2, '0')\n\n return `${date.year}-${month}-${day}`\n}\n\n/**\n * Parses a `YYYY-MM-DD` key produced by {@link calendarDateKey}.\n *\n * @param key - The serialized date.\n * @returns The calendar date, or `null` when the text is malformed or names a\n * day that does not exist, such as February 30.\n */\nexport function parseCalendarDateKey(key: string): CalendarDate | null {\n const match = DATE_KEY_PATTERN.exec(key)\n if (!match) return null\n\n const candidate = {\n day: Number(match[3]),\n month: Number(match[2]),\n year: Number(match[1]),\n }\n\n return isSameCalendarDate(candidate, normalizeCalendarDate(candidate))\n ? candidate\n : null\n}\n\n/**\n * Reads the local calendar day of a `Date`, dropping its time.\n *\n * @param date - A valid date, such as the one a date picker selects.\n */\nexport function calendarDateFromDate(date: Date): CalendarDate {\n return {\n day: date.getDate(),\n month: date.getMonth() + 1,\n year: date.getFullYear(),\n }\n}\n\n/**\n * Builds the local midnight `Date` of a calendar date, the value a date\n * picker expects for a day.\n *\n * @param date - The calendar date to convert.\n */\nexport function calendarDateToDate(date: CalendarDate): Date {\n return new Date(date.year, date.month - 1, date.day)\n}\n\n/**\n * Moves a calendar date by a number of days, rolling over months and years.\n *\n * @param date - The starting date.\n * @param days - Days to add; negative values move backwards.\n */\nexport function addCalendarDays(\n date: CalendarDate,\n days: number,\n): CalendarDate {\n return normalizeCalendarDate({ ...date, day: date.day + days })\n}\n\n/**\n * Orders two calendar dates chronologically.\n *\n * @returns Negative when `a` is earlier, positive when later, zero when equal.\n */\nexport function compareCalendarDates(a: CalendarDate, b: CalendarDate): number {\n return a.year - b.year || a.month - b.month || a.day - b.day\n}\n\n/** Whether two calendar dates name the same day. */\nexport function isSameCalendarDate(a: CalendarDate, b: CalendarDate): boolean {\n return compareCalendarDates(a, b) === 0\n}\n\n/**\n * Day of the week of a calendar date.\n *\n * @returns `0` for Sunday through `6` for Saturday.\n */\nexport function calendarDayOfWeek(date: CalendarDate): number {\n return new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay()\n}\n\n/**\n * First day of the week that contains a calendar date.\n *\n * @param date - Any day of the week.\n * @param weekStartsOn - `0` when weeks start on Sunday, `1` on Monday.\n */\nexport function startOfWeek(\n date: CalendarDate,\n weekStartsOn: 0 | 1,\n): CalendarDate {\n const offset = (calendarDayOfWeek(date) - weekStartsOn + 7) % 7\n\n return addCalendarDays(date, -offset)\n}\n\n/**\n * Lists the days a calendar view shows for an anchor date. A month spans from\n * the first week containing the 1st to the last week containing the final day,\n * so adjacent days of neighbouring months are included.\n *\n * @param anchor - The date the view is centred on.\n * @param mode - Whether to list one day, one week or one month.\n * @param weekStartsOn - `0` when weeks start on Sunday, `1` on Monday.\n * @returns The visible days in chronological order.\n */\nexport function calendarRange(\n anchor: CalendarDate,\n mode: CalendarRangeMode,\n weekStartsOn: 0 | 1,\n): CalendarDate[] {\n if (mode === 'day') return [anchor]\n\n if (mode === 'week') {\n const first = startOfWeek(anchor, weekStartsOn)\n\n return Array.from({ length: 7 }, (_, index) =>\n addCalendarDays(first, index),\n )\n }\n\n const firstOfMonth = { ...anchor, day: 1 }\n const lastOfMonth = addCalendarDays(\n {\n ...normalizeCalendarDate({ ...anchor, day: 1, month: anchor.month + 1 }),\n },\n -1,\n )\n const first = startOfWeek(firstOfMonth, weekStartsOn)\n const last = addCalendarDays(startOfWeek(lastOfMonth, weekStartsOn), 6)\n const days: CalendarDate[] = []\n\n for (\n let day = first;\n compareCalendarDates(day, last) <= 0;\n day = addCalendarDays(day, 1)\n ) {\n days.push(day)\n }\n\n return days\n}\n\n/**\n * Normalizes an out-of-range day or month through `Date.UTC`, which rolls it\n * over into the right month and year. Arithmetic stays in year/month/day\n * rather than adding 86400 seconds to an instant, which would break across\n * daylight saving transitions.\n */\nfunction normalizeCalendarDate(date: CalendarDate): CalendarDate {\n const normalized = new Date(Date.UTC(date.year, date.month - 1, date.day))\n\n return {\n day: normalized.getUTCDate(),\n month: normalized.getUTCMonth() + 1,\n year: normalized.getUTCFullYear(),\n }\n}\n",
9
+ "target": "~/packages/ui/src/helpers/calendar-date.ts"
10
+ },
11
+ {
12
+ "path": "helpers/clipboard.ts",
13
+ "type": "registry:file",
14
+ "content": "/**\n * Writes text to the system clipboard through the async Clipboard API.\n *\n * @param value - The text to copy.\n * @returns The pending write, or `undefined` when the browser exposes no\n * clipboard (insecure context or unsupported environment).\n */\nexport function copyToClipboard(value: string): Promise<void> | undefined {\n return navigator.clipboard?.writeText(value)\n}\n",
15
+ "target": "~/packages/ui/src/helpers/clipboard.ts"
16
+ },
17
+ {
18
+ "path": "helpers/date.ts",
19
+ "type": "registry:file",
20
+ "content": "import type { CalendarDate } from './calendar-date'\nimport { toZonedDateTime } from './zoned-date-time'\n\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/\nconst MILLISECONDS_IN_DAY = 86_400_000\n\nconst DATE_FORMAT_OPTIONS = {\n dateTime: { dateStyle: 'long', timeStyle: 'short' },\n long: { dateStyle: 'long' },\n medium: { dateStyle: 'medium' },\n numeric: { day: '2-digit', month: '2-digit', year: 'numeric' },\n short: { day: 'numeric', month: 'short' },\n weekdayAndDay: { day: 'numeric', weekday: 'long' },\n} satisfies Record<string, Intl.DateTimeFormatOptions>\n\nconst dateFormatters = new Map<string, Intl.DateTimeFormat>()\nconst relativeDayFormatters = new Map<string, Intl.RelativeTimeFormat>()\n\n/**\n * Type guard for a `Date` whose time is not `NaN`.\n *\n * @param value - Any value, typically the result of parsing user input.\n */\nexport function isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime())\n}\n\n/**\n * Parses an ISO 8601 string, such as the value stored by a date property.\n *\n * @param value - The serialized date; empty values are treated as absent.\n * @returns The parsed date, or `null` when the value is absent or invalid.\n */\nexport function parseIsoDate(value: string | null | undefined): Date | null {\n if (!value) return null\n const date = new Date(value)\n return isValidDate(date) ? date : null\n}\n\n/**\n * Coerces a cell value into a `Date`. A date-only string (`2026-08-04`) is\n * read as local midnight, because `new Date('2026-08-04')` is UTC midnight and\n * would display as the previous day in any negative time zone.\n *\n * @param value - A `Date`, a date string or anything `String()` can serialize.\n * @returns A date that may be invalid; check it with {@link isValidDate}.\n */\nexport function parseDateValue(value: unknown): Date {\n if (value instanceof Date) return value\n const raw = String(value)\n return DATE_ONLY_PATTERN.test(raw)\n ? new Date(`${raw}T00:00:00`)\n : new Date(raw)\n}\n\n/**\n * Serializes the local calendar day of a date as noon UTC, so the day survives\n * a round trip through any time zone.\n *\n * @param date - A date whose local year, month and day are kept.\n * @returns An ISO string such as `2026-06-19T12:00:00.000Z`.\n */\nexport function serializeIsoDay(date: Date): string {\n return new Date(\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 12),\n ).toISOString()\n}\n\n/**\n * Formats a date as day and abbreviated month, without the year.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone, which suits local day markers.\n * @returns The formatted date, such as `Jun 19` or `19 de jun.`.\n */\nexport function formatShortDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('short', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date as two-digit day and month with the full year, so a column\n * of dates aligns.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date, such as `11/09/2026` or `09/11/2026`.\n */\nexport function formatNumericDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('numeric', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date with day, abbreviated month and year, as a date picker\n * trigger shows it.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date, such as `Oct 20, 2026` or `20 de out. de 2026`.\n */\nexport function formatMediumDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('medium', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date with day, full month name and year.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date, such as `October 20, 2026` or\n * `20 de outubro de 2026`.\n */\nexport function formatLongDate(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('long', locale, timeZone).format(date)\n}\n\n/**\n * Formats a date with day, full month name, year and time of day, as a\n * tooltip over a short or relative date shows it.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted date and time, such as `October 20, 2026 at 2:30 PM`\n * or `20 de outubro de 2026 às 14:30`.\n */\nexport function formatDateTime(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('dateTime', locale, timeZone).format(date)\n}\n\n/**\n * Formats the weekday name with the day of the month, as a day heading over a\n * list of time slots.\n *\n * @param date - A valid date.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n * @param timeZone - An IANA time zone; when omitted the date is read in the\n * runtime's local zone.\n * @returns The formatted day, such as `Tuesday 20` or `terça-feira, 20`.\n */\nexport function formatWeekdayAndDay(\n date: Date,\n locale: string,\n timeZone?: string,\n): string {\n return getDateFormatter('weekdayAndDay', locale, timeZone).format(date)\n}\n\n/**\n * Counts the civil days between two instants as seen on the wall clock of a\n * time zone, so an instant just after midnight in that zone counts as the\n * next day even when it is still the previous day in UTC.\n *\n * @param from - The reference instant, usually now.\n * @param to - The instant being measured, such as a due date.\n * @param timeZone - An IANA time zone.\n * @returns Negative when `to` falls on an earlier day than `from`.\n */\nexport function dayOffsetInTimeZone(\n from: Date,\n to: Date,\n timeZone: string,\n): number {\n return (\n dayNumber(toZonedDateTime(to, timeZone).date) -\n dayNumber(toZonedDateTime(from, timeZone).date)\n )\n}\n\n/**\n * Names a day relative to today (`Yesterday`, `Today`, `Tomorrow`, `In 3\n * days`) with the first letter upper-cased for the locale.\n *\n * @param dayOffset - Civil days from today; see {@link dayOffsetInTimeZone}.\n * @param locale - A BCP 47 locale tag such as `pt-BR`.\n */\nexport function formatRelativeDay(dayOffset: number, locale: string): string {\n const label = getRelativeDayFormatter(locale).format(dayOffset, 'day')\n return label.charAt(0).toLocaleUpperCase(locale) + label.slice(1)\n}\n\n/**\n * Moves a date by a number of local calendar days, keeping its time of day.\n *\n * @param date - The starting date; it is not mutated.\n * @param days - Days to add; negative values move backwards.\n */\nexport function addDays(date: Date, days: number): Date {\n const next = new Date(date)\n next.setDate(next.getDate() + days)\n return next\n}\n\n/**\n * Moves a date by a number of months. When the target month is shorter, the\n * day is clamped to its last day, so January 31 plus one month is the end of\n * February instead of early March.\n *\n * @param date - The starting date; it is not mutated.\n * @param months - Months to add; negative values move backwards.\n */\nexport function addMonths(date: Date, months: number): Date {\n const next = new Date(date)\n next.setDate(1)\n next.setMonth(next.getMonth() + months)\n const lastDay = new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate()\n next.setDate(Math.min(date.getDate(), lastDay))\n return next\n}\n\n/**\n * Moves a date by a number of years. February 29 becomes February 28 in a\n * common year.\n *\n * @param date - The starting date; it is not mutated.\n * @param years - Years to add; negative values move backwards.\n */\nexport function addYears(date: Date, years: number): Date {\n return addMonths(date, years * 12)\n}\n\n/** Building an `Intl` formatter costs ~50 formats, so one is kept per key. */\nfunction getDateFormatter(\n style: keyof typeof DATE_FORMAT_OPTIONS,\n locale: string,\n timeZone?: string,\n): Intl.DateTimeFormat {\n const key = `${style}|${locale}|${timeZone ?? ''}`\n const cached = dateFormatters.get(key)\n if (cached) return cached\n\n const formatter = new Intl.DateTimeFormat(locale, {\n ...DATE_FORMAT_OPTIONS[style],\n ...(timeZone ? { timeZone } : {}),\n })\n dateFormatters.set(key, formatter)\n\n return formatter\n}\n\nfunction getRelativeDayFormatter(locale: string): Intl.RelativeTimeFormat {\n const cached = relativeDayFormatters.get(locale)\n if (cached) return cached\n\n const formatter = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' })\n relativeDayFormatters.set(locale, formatter)\n\n return formatter\n}\n\n/** Days since the Unix epoch for a calendar date, ignoring time zones. */\nfunction dayNumber(date: CalendarDate): number {\n return Date.UTC(date.year, date.month - 1, date.day) / MILLISECONDS_IN_DAY\n}\n",
21
+ "target": "~/packages/ui/src/helpers/date.ts"
22
+ },
23
+ {
24
+ "path": "helpers/initials.ts",
25
+ "type": "registry:file",
26
+ "content": "/**\n * Builds the initials shown in an avatar fallback: the first letter of the\n * first words of a label, upper-cased.\n *\n * @param label - A person or entity name; surrounding and repeated whitespace is ignored.\n * @param size - How many words contribute a letter. Defaults to two.\n * @returns The initials, or an empty string for a blank label.\n */\nexport function getInitials(label: string, size = 2): string {\n return label\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, size)\n .map((part) => part[0])\n .join('')\n .toUpperCase()\n}\n\n/**\n * Picks the text of an avatar fallback: the explicit fallback a person carries,\n * or the initials of its label when there is none.\n *\n * @param person - Anything with a `label` and an optional `fallback`.\n * @param size - How many words contribute a letter when the label is used. Defaults to two.\n * @returns The fallback as given (only `undefined` falls through, so an empty\n * string is kept), otherwise the initials of the label.\n */\nexport function resolveInitials(\n person: { label: string; fallback?: string },\n size = 2,\n): string {\n return person.fallback ?? getInitials(person.label, size)\n}\n",
27
+ "target": "~/packages/ui/src/helpers/initials.ts"
28
+ },
29
+ {
30
+ "path": "helpers/zoned-date-time.ts",
31
+ "type": "registry:file",
32
+ "content": "import type { CalendarDate } from './calendar-date'\n\n/**\n * A wall-clock reading in some time zone: the calendar day and the minutes\n * elapsed since local midnight.\n */\nexport interface ZonedDateTime {\n date: CalendarDate\n minutes: number\n}\n\nconst formatterCache = new Map<string, Intl.DateTimeFormat>()\n\n/**\n * Returns the formatter for a time zone. `Intl.DateTimeFormat` is expensive\n * to construct, so one instance per zone is kept for the life of the module.\n */\nfunction getFormatter(timeZone: string): Intl.DateTimeFormat {\n const cached = formatterCache.get(timeZone)\n if (cached) return cached\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n day: '2-digit',\n hour: '2-digit',\n hourCycle: 'h23',\n minute: '2-digit',\n month: '2-digit',\n second: '2-digit',\n timeZone,\n year: 'numeric',\n })\n formatterCache.set(timeZone, formatter)\n\n return formatter\n}\n\n/** Numeric date and time fields of an instant, read in a time zone. */\ninterface WallClockParts {\n day: number\n hour: number\n minute: number\n month: number\n second: number\n year: number\n}\n\n/**\n * Reads the wall-clock fields of an instant in a time zone.\n *\n * @param instant - The UTC instant to project.\n * @param timeZone - An IANA time zone.\n */\nfunction wallClockPartsOf(instant: Date, timeZone: string): WallClockParts {\n const parts: Partial<WallClockParts> = {}\n\n for (const part of getFormatter(timeZone).formatToParts(instant)) {\n if (part.type === 'literal') continue\n if (part.type in partKeys)\n parts[partKeys[part.type as keyof typeof partKeys]] = Number(part.value)\n }\n\n return parts as WallClockParts\n}\n\nconst partKeys = {\n day: 'day',\n hour: 'hour',\n minute: 'minute',\n month: 'month',\n second: 'second',\n year: 'year',\n} as const\n\n/**\n * Projects a UTC instant onto the wall clock of a time zone.\n *\n * @param instant - The UTC instant to project.\n * @param timeZone - An IANA time zone.\n * @returns The calendar day and the minutes since local midnight.\n */\nexport function toZonedDateTime(\n instant: Date,\n timeZone: string,\n): ZonedDateTime {\n const parts = wallClockPartsOf(instant, timeZone)\n\n return {\n date: { day: parts.day, month: parts.month, year: parts.year },\n minutes: parts.hour * 60 + parts.minute,\n }\n}\n\n/**\n * Offset of a time zone from UTC at a given instant. The formatter stops at\n * seconds, so the instant is truncated to the second before comparing;\n * otherwise milliseconds would leak into the offset.\n *\n * @param instant - The UTC instant to measure at.\n * @param timeZone - An IANA time zone.\n * @returns The offset in milliseconds; positive east of UTC.\n */\nexport function getTimeZoneOffsetMs(instant: Date, timeZone: string): number {\n const parts = wallClockPartsOf(instant, timeZone)\n const wallAsUtc = Date.UTC(\n parts.year,\n parts.month - 1,\n parts.day,\n parts.hour,\n parts.minute,\n parts.second,\n )\n const truncated =\n instant.getTime() - (((instant.getTime() % 1000) + 1000) % 1000)\n\n return wallAsUtc - truncated\n}\n\n/**\n * Converts a wall-clock reading in a time zone back to a UTC instant without a\n * date library: the wall time is first treated as UTC and then corrected by the\n * zone offset. A second pass handles transition edges, since offsets only\n * change there: an ambiguous time (fall back) keeps the first offset found,\n * and a nonexistent time (spring forward) resolves to the instant after the\n * transition.\n *\n * @param zoned - The calendar day and minutes since local midnight.\n * @param timeZone - An IANA time zone.\n * @returns The UTC instant that shows that wall time in the zone.\n */\nexport function fromZonedDateTime(\n zoned: ZonedDateTime,\n timeZone: string,\n): Date {\n const { date, minutes } = zoned\n const guess = Date.UTC(date.year, date.month - 1, date.day, 0, minutes)\n const firstOffset = getTimeZoneOffsetMs(new Date(guess), timeZone)\n const candidate = guess - firstOffset\n const secondOffset = getTimeZoneOffsetMs(new Date(candidate), timeZone)\n\n if (firstOffset === secondOffset) return new Date(candidate)\n\n const corrected = guess - secondOffset\n const projected = toZonedDateTime(new Date(corrected), timeZone)\n const matchesWall =\n projected.minutes === ((minutes % 1440) + 1440) % 1440 &&\n projected.date.day === date.day &&\n projected.date.month === date.month &&\n projected.date.year === date.year\n\n return matchesWall ? new Date(corrected) : new Date(candidate)\n}\n",
33
+ "target": "~/packages/ui/src/helpers/zoned-date-time.ts"
34
+ },
35
+ {
36
+ "path": "patterns/editable/composition/editable/editable.tsx",
37
+ "type": "registry:file",
38
+ "content": "'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { cn } from '@tc96/utils'\nimport * as React from 'react'\nimport {\n EditableContext,\n type EditableContextValue,\n useEditableContext,\n} from '../../store/editable-store'\n\ntype Direction = 'ltr' | 'rtl'\ntype TriggerMode = 'click' | 'dblclick' | 'focus'\n\nfunction assignRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') {\n ref(value)\n return\n }\n if (ref) {\n ref.current = value\n }\n}\n\nfunction dataAttributes(\n attributes: Record<`data-${string}`, string | undefined>,\n): Record<string, string | undefined> {\n return attributes\n}\n\nfunction useComposedRefs<T>(\n firstRef: React.Ref<T> | undefined,\n secondRef: React.Ref<T> | undefined,\n) {\n return React.useCallback(\n (value: T | null) => {\n assignRef(firstRef, value)\n assignRef(secondRef, value)\n },\n [firstRef, secondRef],\n )\n}\n\nexport interface EditableProps\n extends Omit<\n React.ComponentProps<'div'> & useRender.ComponentProps<'div'>,\n 'defaultValue' | 'onSubmit'\n > {\n defaultValue?: string\n value?: string\n onValueChange?: (value: string) => void\n defaultEditing?: boolean\n editing?: boolean\n onEditingChange?: (editing: boolean) => void\n onCancel?: () => void\n onEdit?: () => void\n onSubmit?: (value: string) => void\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n onEnterKeyDown?: (event: KeyboardEvent) => void\n dir?: Direction\n maxLength?: number\n name?: string\n placeholder?: string\n triggerMode?: TriggerMode\n autosize?: boolean\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nexport function Editable(props: EditableProps) {\n const {\n value: controlledValue,\n defaultValue = '',\n defaultEditing = false,\n editing: controlledEditing,\n onValueChange,\n onEditingChange,\n onCancel,\n onEdit,\n onSubmit,\n onEscapeKeyDown,\n onEnterKeyDown,\n dir,\n maxLength,\n name,\n placeholder,\n triggerMode = 'click',\n autosize = false,\n disabled = false,\n required = false,\n readOnly = false,\n invalid = false,\n className,\n id,\n render,\n ref,\n ...rootProps\n } = props\n\n const generatedRootId = React.useId()\n const rootId = id ?? generatedRootId\n const inputId = React.useId()\n const labelId = React.useId()\n const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)\n const [uncontrolledEditing, setUncontrolledEditing] =\n React.useState(defaultEditing)\n const rootRef = React.useRef<HTMLDivElement>(null)\n const composedRef = useComposedRefs(ref, rootRef)\n\n const value = controlledValue ?? uncontrolledValue\n const editing = controlledEditing ?? uncontrolledEditing\n\n const previousValueRef = React.useRef(value)\n const restoreValueRef = React.useRef(value)\n const valueRef = React.useRef(value)\n const editingRef = React.useRef(editing)\n\n React.useEffect(() => {\n valueRef.current = value\n editingRef.current = editing\n }, [editing, value])\n\n const setValue = React.useCallback(\n (nextValue: string) => {\n valueRef.current = nextValue\n if (controlledValue === undefined) {\n setUncontrolledValue(nextValue)\n }\n onValueChange?.(nextValue)\n },\n [controlledValue, onValueChange],\n )\n\n const setEditing = React.useCallback(\n (nextEditing: boolean) => {\n editingRef.current = nextEditing\n if (controlledEditing === undefined) {\n setUncontrolledEditing(nextEditing)\n }\n onEditingChange?.(nextEditing)\n },\n [controlledEditing, onEditingChange],\n )\n\n const beginEditing = React.useCallback(\n (initialDraft?: string) => {\n if (disabled || readOnly) return\n const draft = initialDraft ?? value\n restoreValueRef.current = value\n previousValueRef.current = draft\n valueRef.current = value\n if (draft !== value) setValue(draft)\n setEditing(true)\n onEdit?.()\n },\n [disabled, onEdit, readOnly, setEditing, setValue, value],\n )\n\n const cancelEditing = React.useCallback(() => {\n if (disabled || readOnly) return\n setValue(restoreValueRef.current)\n setEditing(false)\n onCancel?.()\n }, [disabled, onCancel, readOnly, setEditing, setValue])\n\n const submitValue = React.useCallback(() => {\n if (disabled || readOnly) return\n setEditing(false)\n onSubmit?.(value)\n }, [disabled, onSubmit, readOnly, setEditing, value])\n\n const isDirty = React.useCallback(\n () => editingRef.current && valueRef.current !== previousValueRef.current,\n [],\n )\n\n const finishEditing = React.useCallback(() => {\n if (disabled || readOnly || !editingRef.current) return\n if (isDirty()) {\n submitValue()\n return\n }\n if (valueRef.current !== restoreValueRef.current) {\n setValue(restoreValueRef.current)\n }\n setEditing(false)\n }, [disabled, isDirty, readOnly, setEditing, setValue, submitValue])\n\n const context = React.useMemo<EditableContextValue>(\n () => ({\n rootId,\n inputId,\n labelId,\n value,\n editing,\n dir,\n maxLength,\n placeholder,\n triggerMode,\n autosize,\n disabled,\n readOnly,\n required,\n invalid,\n beginEditing,\n cancelEditing,\n finishEditing,\n isDirty,\n submitValue,\n setValue,\n onEnterKeyDown,\n onEscapeKeyDown,\n }),\n [\n rootId,\n inputId,\n labelId,\n value,\n editing,\n dir,\n maxLength,\n placeholder,\n triggerMode,\n autosize,\n disabled,\n readOnly,\n required,\n invalid,\n beginEditing,\n cancelEditing,\n finishEditing,\n isDirty,\n submitValue,\n setValue,\n onEnterKeyDown,\n onEscapeKeyDown,\n ],\n )\n\n const element = useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n id: rootId,\n ref: composedRef,\n ...dataAttributes({\n 'data-disabled': disabled ? '' : undefined,\n 'data-editing': editing ? '' : undefined,\n 'data-invalid': invalid ? '' : undefined,\n 'data-slot': 'editable',\n }),\n className: cn('flex min-w-0 flex-col gap-2', className),\n },\n rootProps,\n ),\n render,\n state: {\n slot: 'editable',\n ...(editing && { editing: '' }),\n ...(disabled && { disabled: '' }),\n ...(invalid && { invalid: '' }),\n },\n })\n\n return (\n <EditableContext.Provider value={context}>\n {element}\n {name && (\n <input\n disabled={disabled}\n name={name}\n readOnly={readOnly}\n type=\"hidden\"\n value={value}\n />\n )}\n </EditableContext.Provider>\n )\n}\n\nexport interface EditableLabelProps\n extends React.ComponentProps<'label'>,\n useRender.ComponentProps<'label'> {}\n\nexport function EditableLabel(props: EditableLabelProps) {\n const { className, render, ref, ...labelProps } = props\n const context = useEditableContext('EditableLabel')\n\n return useRender({\n defaultTagName: 'label',\n props: mergeProps<'label'>(\n {\n ref,\n id: context.labelId,\n htmlFor: context.inputId,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-invalid': context.invalid ? '' : undefined,\n 'data-required': context.required ? '' : undefined,\n 'data-slot': 'editable-label',\n }),\n className: cn(\n \"font-medium text-sm leading-none data-required:after:ml-0.5 data-required:after:text-destructive-foreground data-required:after:content-['*'] data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n className,\n ),\n },\n labelProps,\n ),\n render,\n state: {\n slot: 'editable-label',\n ...(context.disabled && { disabled: '' }),\n ...(context.invalid && { invalid: '' }),\n ...(context.required && { required: '' }),\n },\n })\n}\n\nexport interface EditableAreaProps\n extends React.ComponentProps<'div'>,\n useRender.ComponentProps<'div'> {}\n\nexport function EditableArea(props: EditableAreaProps) {\n const { className, render, ref, ...areaProps } = props\n const context = useEditableContext('EditableArea')\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n role: 'group',\n dir: context.dir,\n ref,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-editing': context.editing ? '' : undefined,\n 'data-slot': 'editable-area',\n }),\n className: cn(\n 'relative inline-flex min-w-0 items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',\n className,\n ),\n },\n areaProps,\n ),\n render,\n state: {\n slot: 'editable-area',\n ...(context.disabled && { disabled: '' }),\n ...(context.editing && { editing: '' }),\n },\n })\n}\n\nexport interface EditablePreviewProps\n extends React.ComponentProps<'div'>,\n useRender.ComponentProps<'div'> {}\n\nexport function EditablePreview(props: EditablePreviewProps) {\n const {\n onClick,\n onDoubleClick,\n onFocus,\n onKeyDown,\n className,\n render,\n ref,\n ...previewProps\n } = props\n const context = useEditableContext('EditablePreview')\n\n const trigger = React.useCallback(() => {\n context.beginEditing()\n }, [context.beginEditing])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented || event.key !== 'Enter') return\n\n const nativeEvent = event.nativeEvent\n context.onEnterKeyDown?.(nativeEvent)\n if (!nativeEvent.defaultPrevented) {\n trigger()\n }\n },\n [context.onEnterKeyDown, onKeyDown, trigger],\n )\n\n const element = useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n role: 'button',\n tabIndex: context.disabled ? undefined : 0,\n 'aria-disabled': context.disabled || undefined,\n ref,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-empty': !context.value ? '' : undefined,\n 'data-slot': 'editable-preview',\n }),\n onClick: (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && context.triggerMode === 'click')\n trigger()\n },\n onDoubleClick: (event: React.MouseEvent<HTMLDivElement>) => {\n onDoubleClick?.(event)\n if (!event.defaultPrevented && context.triggerMode === 'dblclick')\n trigger()\n },\n onFocus: (event: React.FocusEvent<HTMLDivElement>) => {\n onFocus?.(event)\n if (!event.defaultPrevented && context.triggerMode === 'focus')\n trigger()\n },\n onKeyDown: handleKeyDown,\n className: cn(\n 'min-w-0 cursor-text truncate rounded-md border border-transparent px-2 py-1.5 text-sm outline-none hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-empty:text-muted-foreground',\n className,\n ),\n children: context.value || context.placeholder,\n },\n previewProps,\n ),\n render,\n state: {\n slot: 'editable-preview',\n ...(context.disabled && { disabled: '' }),\n ...(!context.value && { empty: '' }),\n },\n })\n\n if (context.editing || context.readOnly) return null\n\n return element\n}\n\nexport interface EditableInputProps\n extends React.ComponentProps<'input'>,\n useRender.ComponentProps<'input'> {}\n\nexport function EditableInput(props: EditableInputProps) {\n const {\n onBlur,\n onChange,\n onKeyDown,\n className,\n disabled,\n readOnly,\n required,\n maxLength,\n render,\n ref,\n ...inputProps\n } = props\n const context = useEditableContext('EditableInput')\n const inputRef = React.useRef<HTMLInputElement>(null)\n const composedRef = useComposedRefs(ref, inputRef)\n const isDisabled = disabled || context.disabled\n const isReadOnly = readOnly || context.readOnly\n const isRequired = required || context.required\n\n const autosize = React.useCallback(\n (target: HTMLInputElement) => {\n if (!context.autosize) return\n target.style.width = '0'\n target.style.width = `${target.scrollWidth + 4}px`\n },\n [context.autosize],\n )\n\n React.useEffect(() => {\n if (!context.editing || isDisabled || isReadOnly || !inputRef.current)\n return\n\n const frame = requestAnimationFrame(() => {\n inputRef.current?.focus()\n inputRef.current?.select()\n if (inputRef.current) autosize(inputRef.current)\n })\n return () => cancelAnimationFrame(frame)\n }, [autosize, context.editing, isDisabled, isReadOnly])\n\n const element = useRender({\n defaultTagName: 'input',\n props: mergeProps<'input'>(\n {\n id: context.inputId,\n 'aria-labelledby': context.labelId,\n 'aria-required': isRequired || undefined,\n 'aria-invalid': context.invalid || undefined,\n dir: context.dir,\n disabled: isDisabled,\n readOnly: isReadOnly,\n required: isRequired,\n ref: composedRef,\n ...dataAttributes({ 'data-slot': 'editable-input' }),\n maxLength: maxLength ?? context.maxLength,\n placeholder: context.placeholder,\n value: context.value,\n onBlur: (event: React.FocusEvent<HTMLInputElement>) => {\n onBlur?.(event)\n if (event.defaultPrevented || isDisabled || isReadOnly) return\n\n const relatedTarget = event.relatedTarget\n const isEditableAction =\n relatedTarget instanceof HTMLElement &&\n Boolean(\n relatedTarget.closest(\n '[data-slot=\"editable-trigger\"], [data-slot=\"editable-cancel\"], [data-slot=\"editable-submit\"]',\n ),\n )\n if (!isEditableAction) {\n context.submitValue()\n }\n },\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event)\n if (event.defaultPrevented || isDisabled || isReadOnly) return\n context.setValue(event.target.value)\n autosize(event.target)\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented || isDisabled || isReadOnly) return\n\n if (event.key === 'Escape') {\n const nativeEvent = event.nativeEvent\n context.onEscapeKeyDown?.(nativeEvent)\n if (!nativeEvent.defaultPrevented) {\n context.cancelEditing()\n }\n } else if (event.key === 'Enter') {\n const nativeEvent = event.nativeEvent\n context.onEnterKeyDown?.(nativeEvent)\n if (!nativeEvent.defaultPrevented) {\n context.submitValue()\n }\n }\n },\n className: cn(\n 'flex h-9 rounded-md border border-input bg-transparent px-2 py-1 text-sm shadow-xs outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50',\n context.autosize ? 'w-auto min-w-8' : 'w-full',\n className,\n ),\n },\n inputProps,\n ),\n render,\n state: {\n slot: 'editable-input',\n },\n })\n\n if (!context.editing && !isReadOnly) return null\n\n return element\n}\n\ntype EditableFieldElement = HTMLInputElement | HTMLTextAreaElement\n\nexport interface EditableFieldProps\n extends Omit<\n React.ComponentProps<'input'>,\n | 'defaultValue'\n | 'onBlur'\n | 'onChange'\n | 'onFocus'\n | 'onKeyDown'\n | 'ref'\n | 'value'\n > {\n emptyValue?: string\n multiline?: boolean\n ref?: React.Ref<EditableFieldElement>\n render?: useRender.ComponentProps<'input'>['render']\n onBlur?: React.FocusEventHandler<EditableFieldElement>\n onChange?: React.ChangeEventHandler<EditableFieldElement>\n onFocus?: React.FocusEventHandler<EditableFieldElement>\n onKeyDown?: React.KeyboardEventHandler<EditableFieldElement>\n}\n\nexport function EditableField(props: EditableFieldProps) {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n emptyValue,\n multiline = false,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n className,\n disabled,\n readOnly,\n required,\n maxLength,\n type,\n render,\n ref,\n ...fieldProps\n } = props\n const context = useEditableContext('EditableField')\n const isDisabled = disabled || context.disabled\n const isReadOnly = readOnly || context.readOnly\n const isRequired = required || context.required\n\n const begin = () => {\n if (context.editing) return\n context.beginEditing(\n emptyValue !== undefined && context.value === emptyValue ? '' : undefined,\n )\n }\n\n const element = useRender({\n defaultTagName: multiline ? 'textarea' : 'input',\n ref,\n props: mergeProps<'input'>(\n {\n id: context.inputId,\n 'aria-label': ariaLabel,\n 'aria-labelledby':\n ariaLabelledBy ?? (ariaLabel ? undefined : context.labelId),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': context.invalid || undefined,\n dir: context.dir,\n disabled: isDisabled,\n required: isRequired,\n ...dataAttributes({\n 'data-disabled': isDisabled ? '' : undefined,\n 'data-editing': context.editing ? '' : undefined,\n 'data-empty': !context.value ? '' : undefined,\n 'data-slot': 'editable-field',\n }),\n maxLength: maxLength ?? context.maxLength,\n placeholder: context.placeholder,\n value: context.value,\n ...(multiline ? { rows: 1 } : { type }),\n onFocus: (event: React.FocusEvent<EditableFieldElement>) => {\n onFocus?.(event)\n if (event.defaultPrevented || isDisabled) return\n begin()\n },\n onBlur: (event: React.FocusEvent<EditableFieldElement>) => {\n onBlur?.(event)\n if (event.defaultPrevented || isDisabled) return\n context.finishEditing()\n },\n onChange: (event: React.ChangeEvent<EditableFieldElement>) => {\n onChange?.(event)\n if (event.defaultPrevented || isDisabled) return\n begin()\n context.setValue(event.target.value)\n },\n onKeyDown: (event: React.KeyboardEvent<EditableFieldElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented || isDisabled) return\n\n const nativeEvent = event.nativeEvent\n if (event.key === 'Escape') {\n if (!context.isDirty()) return\n context.onEscapeKeyDown?.(nativeEvent)\n if (nativeEvent.defaultPrevented) return\n event.stopPropagation()\n context.cancelEditing()\n event.currentTarget.blur()\n } else if (event.key === 'Enter' && !multiline) {\n context.onEnterKeyDown?.(nativeEvent)\n if (nativeEvent.defaultPrevented) return\n event.preventDefault()\n event.currentTarget.blur()\n }\n },\n className: cn(\n 'w-full bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n multiline && 'field-sizing-content resize-none',\n className,\n ),\n },\n fieldProps,\n ),\n render,\n state: {\n slot: 'editable-field',\n ...(context.editing && { editing: '' }),\n ...(isDisabled && { disabled: '' }),\n ...(!context.value && { empty: '' }),\n },\n })\n\n if (isReadOnly) {\n const dataProps = Object.fromEntries(\n Object.entries(fieldProps).filter(([key]) => key.startsWith('data-')),\n )\n return (\n <span\n className={className}\n data-empty={!context.value ? '' : undefined}\n data-readonly=\"\"\n data-slot=\"editable-field\"\n dir={context.dir}\n {...dataProps}\n >\n {context.value || context.placeholder}\n </span>\n )\n }\n\n return element\n}\n\nexport interface EditableTriggerProps\n extends React.ComponentProps<'button'>,\n useRender.ComponentProps<'button'> {\n forceMount?: boolean\n}\n\nexport function EditableTrigger(props: EditableTriggerProps) {\n const { forceMount = false, className, render, ref, ...triggerProps } = props\n const context = useEditableContext('EditableTrigger')\n\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n 'aria-controls': context.rootId,\n 'aria-disabled': context.disabled || context.readOnly || undefined,\n ref,\n ...dataAttributes({\n 'data-disabled': context.disabled ? '' : undefined,\n 'data-readonly': context.readOnly ? '' : undefined,\n 'data-slot': 'editable-trigger',\n }),\n onClick:\n context.triggerMode === 'click'\n ? () => context.beginEditing()\n : undefined,\n onDoubleClick:\n context.triggerMode === 'dblclick'\n ? () => context.beginEditing()\n : undefined,\n className: cn(\n 'inline-flex h-8 w-fit items-center justify-center rounded-md border border-input bg-background px-3 font-medium text-sm shadow-xs outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:opacity-50',\n className,\n ),\n },\n triggerProps,\n ),\n render,\n state: {\n slot: 'editable-trigger',\n ...(context.disabled && { disabled: '' }),\n ...(context.readOnly && { readonly: '' }),\n },\n })\n\n if (!forceMount && (context.editing || context.readOnly)) return null\n\n return element\n}\n\nexport interface EditableToolbarProps\n extends React.ComponentProps<'div'>,\n useRender.ComponentProps<'div'> {\n orientation?: 'horizontal' | 'vertical'\n}\n\nexport function EditableToolbar(props: EditableToolbarProps) {\n const {\n className,\n orientation = 'horizontal',\n render,\n ref,\n ...toolbarProps\n } = props\n const context = useEditableContext('EditableToolbar')\n\n const element = useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(\n {\n role: 'toolbar',\n 'aria-orientation': orientation,\n ref,\n ...dataAttributes({\n 'data-orientation': orientation,\n 'data-slot': 'editable-toolbar',\n }),\n className: cn(\n 'flex gap-2',\n orientation === 'vertical'\n ? 'flex-col items-stretch'\n : 'flex-row items-center',\n className,\n ),\n },\n toolbarProps,\n ),\n render,\n state: {\n slot: 'editable-toolbar',\n orientation,\n },\n })\n\n if (!context.editing) return null\n\n return element\n}\n\nexport interface EditableCancelProps\n extends React.ComponentProps<'button'>,\n useRender.ComponentProps<'button'> {}\n\nexport function EditableCancel(props: EditableCancelProps) {\n const { className, render, ref, ...cancelProps } = props\n const context = useEditableContext('EditableCancel')\n\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n 'aria-controls': context.rootId,\n ref,\n ...dataAttributes({ 'data-slot': 'editable-cancel' }),\n onClick: context.cancelEditing,\n className: cn(\n 'inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 font-medium text-sm shadow-xs outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/30',\n className,\n ),\n },\n cancelProps,\n ),\n render,\n state: {\n slot: 'editable-cancel',\n },\n })\n\n if (!context.editing) return null\n\n return element\n}\n\nexport interface EditableSubmitProps\n extends React.ComponentProps<'button'>,\n useRender.ComponentProps<'button'> {}\n\nexport function EditableSubmit(props: EditableSubmitProps) {\n const { className, render, ref, ...submitProps } = props\n const context = useEditableContext('EditableSubmit')\n\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(\n {\n type: 'button',\n 'aria-controls': context.rootId,\n ref,\n ...dataAttributes({ 'data-slot': 'editable-submit' }),\n onClick: context.submitValue,\n className: cn(\n 'inline-flex h-8 items-center justify-center rounded-md border border-primary bg-primary px-3 font-medium text-primary-foreground text-sm shadow-xs outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/30',\n className,\n ),\n },\n submitProps,\n ),\n render,\n state: {\n slot: 'editable-submit',\n },\n })\n\n if (!context.editing) return null\n\n return element\n}\n",
39
+ "target": "~/packages/ui/src/patterns/editable/composition/editable/editable.tsx"
40
+ },
41
+ {
42
+ "path": "patterns/editable/composition/editable/index.ts",
43
+ "type": "registry:file",
44
+ "content": "export {\n Editable,\n EditableArea,\n type EditableAreaProps,\n EditableCancel,\n type EditableCancelProps,\n EditableField,\n type EditableFieldProps,\n EditableInput,\n type EditableInputProps,\n EditableLabel,\n type EditableLabelProps,\n EditablePreview,\n type EditablePreviewProps,\n type EditableProps,\n EditableSubmit,\n type EditableSubmitProps,\n EditableToolbar,\n type EditableToolbarProps,\n EditableTrigger,\n type EditableTriggerProps,\n} from './editable'\n",
45
+ "target": "~/packages/ui/src/patterns/editable/composition/editable/index.ts"
46
+ },
47
+ {
48
+ "path": "patterns/editable/index.ts",
49
+ "type": "registry:file",
50
+ "content": "export * from './composition/editable/index'\n",
51
+ "target": "~/packages/ui/src/patterns/editable/index.ts"
52
+ },
53
+ {
54
+ "path": "patterns/editable/store/editable-store.ts",
55
+ "type": "registry:file",
56
+ "content": "import { createContext, useContext } from 'react'\n\ntype Direction = 'ltr' | 'rtl'\ntype TriggerMode = 'click' | 'dblclick' | 'focus'\n\nexport interface EditableContextValue {\n rootId: string\n inputId: string\n labelId: string\n value: string\n editing: boolean\n dir?: Direction\n maxLength?: number\n placeholder?: string\n triggerMode: TriggerMode\n autosize: boolean\n disabled: boolean\n readOnly: boolean\n required: boolean\n invalid: boolean\n beginEditing: (initialDraft?: string) => void\n cancelEditing: () => void\n finishEditing: () => void\n isDirty: () => boolean\n submitValue: () => void\n setValue: (value: string) => void\n onEnterKeyDown?: (event: KeyboardEvent) => void\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n}\n\nexport const EditableContext = createContext<EditableContextValue | null>(null)\n\nexport function useEditableContext(consumerName: string): EditableContextValue {\n const context = useContext(EditableContext)\n if (!context) {\n throw new Error(`\\`${consumerName}\\` must be used within \\`Editable\\``)\n }\n return context\n}\n",
57
+ "target": "~/packages/ui/src/patterns/editable/store/editable-store.ts"
58
+ },
59
+ {
60
+ "path": "patterns/properties/composition/assigned/assigned-property.tsx",
61
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/composition/assigned/assigned-property.tsx"
64
+ },
65
+ {
66
+ "path": "patterns/properties/composition/assigned/index.ts",
67
+ "type": "registry:file",
68
+ "content": "export {\n AssignedProperty,\n type AssignedPropertyActionContext,\n AssignedPropertyBadge,\n type AssignedPropertyProps,\n} from './assigned-property'\n",
69
+ "target": "~/packages/ui/src/patterns/properties/composition/assigned/index.ts"
70
+ },
71
+ {
72
+ "path": "patterns/properties/composition/index.ts",
73
+ "type": "registry:file",
74
+ "content": "export * from './assigned/index'\nexport {\n PropertyCollection,\n type PropertyCollectionItem,\n type PropertyCollectionProps,\n} from './property-collection'\n",
75
+ "target": "~/packages/ui/src/patterns/properties/composition/index.ts"
76
+ },
77
+ {
78
+ "path": "patterns/properties/composition/property-collection.tsx",
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 {\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
+ "target": "~/packages/ui/src/patterns/properties/composition/property-collection.tsx"
82
+ },
83
+ {
84
+ "path": "patterns/properties/display/attachments/attachment-property.tsx",
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 {\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
+ "target": "~/packages/ui/src/patterns/properties/display/attachments/attachment-property.tsx"
88
+ },
89
+ {
90
+ "path": "patterns/properties/display/attachments/attachment-type.tsx",
91
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/attachments/attachment-type.tsx"
94
+ },
95
+ {
96
+ "path": "patterns/properties/display/attachments/attachments-property.tsx",
97
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/attachments/attachments-property.tsx"
100
+ },
101
+ {
102
+ "path": "patterns/properties/display/attachments/index.ts",
103
+ "type": "registry:file",
104
+ "content": "export {\n AttachmentProperty,\n type AttachmentPropertyProps,\n} from './attachment-property'\nexport type { AttachmentType } from './attachment-type'\nexport {\n AttachmentsProperty,\n type AttachmentsPropertyAction,\n type AttachmentsPropertyProps,\n} from './attachments-property'\n",
105
+ "target": "~/packages/ui/src/patterns/properties/display/attachments/index.ts"
106
+ },
107
+ {
108
+ "path": "patterns/properties/display/date-range/date-range-format.ts",
109
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/date-range/date-range-format.ts"
112
+ },
113
+ {
114
+ "path": "patterns/properties/display/date-range/date-range-property.tsx",
115
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/date-range/date-range-property.tsx"
118
+ },
119
+ {
120
+ "path": "patterns/properties/display/date-range/index.ts",
121
+ "type": "registry:file",
122
+ "content": "export { formatDateRangeProperty } from './date-range-format'\nexport {\n type DateRange,\n DateRangeProperty,\n type DateRangePropertyProps,\n} from './date-range-property'\n",
123
+ "target": "~/packages/ui/src/patterns/properties/display/date-range/index.ts"
124
+ },
125
+ {
126
+ "path": "patterns/properties/display/date/date-property.tsx",
127
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/date/date-property.tsx"
130
+ },
131
+ {
132
+ "path": "patterns/properties/display/date/date-value.ts",
133
+ "type": "registry:file",
134
+ "content": "import {\n formatShortDate,\n parseIsoDate,\n serializeIsoDay,\n} from '@tc96/ui/helpers/date'\n\nexport function formatDateProperty(\n value: string | null,\n fallback: string,\n locale: string,\n timeZone: string,\n): string {\n const date = parseIsoDate(value)\n return date ? formatShortDate(date, locale, timeZone) : fallback\n}\n\nexport function parseDatePropertyValue(value: string | null): Date | null {\n return parseIsoDate(value)\n}\n\nexport function serializeDatePropertyValue(date: Date): string {\n return serializeIsoDay(date)\n}\n",
135
+ "target": "~/packages/ui/src/patterns/properties/display/date/date-value.ts"
136
+ },
137
+ {
138
+ "path": "patterns/properties/display/date/index.ts",
139
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/date/index.ts"
142
+ },
143
+ {
144
+ "path": "patterns/properties/display/editable-text/editable-text.tsx",
145
+ "type": "registry:file",
146
+ "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport { useState } from 'react'\nimport { Editable, EditableField } from '../../../editable/index'\n\nexport type EditableTextSize = 'sm' | 'base' | 'lg' | 'xl'\n\nexport interface EditableTextProps {\n ariaLabel: string\n autoFocus?: boolean\n className?: string\n emptyValue?: string\n multiline?: boolean\n placeholder?: string\n readOnly?: boolean\n revertWhenEmpty?: boolean\n size?: EditableTextSize\n type?: 'email' | 'text'\n value: string | null\n onCommit: (value: string | null) => void\n}\n\nconst sizeClassName: Record<EditableTextSize, string> = {\n base: 'text-base',\n lg: 'text-2xl',\n sm: 'text-sm',\n xl: 'text-[2rem]',\n}\n\nexport function EditableText({\n ariaLabel,\n autoFocus = false,\n className,\n emptyValue,\n multiline = false,\n placeholder,\n readOnly = false,\n revertWhenEmpty = false,\n size = 'base',\n type = 'text',\n value,\n onCommit,\n}: Readonly<EditableTextProps>) {\n const confirmed = value ?? ''\n const [draft, setDraft] = useState(confirmed)\n const [editing, setEditing] = useState(false)\n const [syncedValue, setSyncedValue] = useState(confirmed)\n\n if (!editing && confirmed !== syncedValue) {\n setSyncedValue(confirmed)\n setDraft(confirmed)\n }\n\n const showsEmptyValue = !draft || draft === emptyValue\n\n const submit = (next: string) => {\n const trimmed = next.trim()\n if (!trimmed && revertWhenEmpty) return setDraft(confirmed)\n if (trimmed !== confirmed) onCommit(trimmed || null)\n }\n\n return (\n <Editable\n className=\"contents\"\n editing={editing}\n onEditingChange={setEditing}\n onSubmit={submit}\n onValueChange={setDraft}\n placeholder={placeholder}\n readOnly={readOnly}\n render={<span />}\n value={draft}\n >\n <EditableField\n aria-label={ariaLabel}\n autoFocus={autoFocus}\n className={cn(\n sizeClassName[size],\n showsEmptyValue && 'text-muted-foreground',\n className,\n )}\n data-slot=\"editable-text\"\n emptyValue={emptyValue}\n multiline={multiline}\n type={type}\n />\n </Editable>\n )\n}\n",
147
+ "target": "~/packages/ui/src/patterns/properties/display/editable-text/editable-text.tsx"
148
+ },
149
+ {
150
+ "path": "patterns/properties/display/editable-text/index.ts",
151
+ "type": "registry:file",
152
+ "content": "export type { EditableTextProps, EditableTextSize } from './editable-text'\nexport { EditableText } from './editable-text'\n",
153
+ "target": "~/packages/ui/src/patterns/properties/display/editable-text/index.ts"
154
+ },
155
+ {
156
+ "path": "patterns/properties/display/email/email-address.ts",
157
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/email/email-address.ts"
160
+ },
161
+ {
162
+ "path": "patterns/properties/display/email/email-property.tsx",
163
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/email/email-property.tsx"
166
+ },
167
+ {
168
+ "path": "patterns/properties/display/email/index.ts",
169
+ "type": "registry:file",
170
+ "content": "export {\n EmailProperty,\n type EmailPropertyProps,\n} from './email-property'\n",
171
+ "target": "~/packages/ui/src/patterns/properties/display/email/index.ts"
172
+ },
173
+ {
174
+ "path": "patterns/properties/display/flag/flag-property.tsx",
175
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/flag/flag-property.tsx"
178
+ },
179
+ {
180
+ "path": "patterns/properties/display/flag/index.ts",
181
+ "type": "registry:file",
182
+ "content": "export {\n FlagProperty,\n type FlagPropertyProps,\n} from './flag-property'\n",
183
+ "target": "~/packages/ui/src/patterns/properties/display/flag/index.ts"
184
+ },
185
+ {
186
+ "path": "patterns/properties/display/icon-label/icon-label-property.tsx",
187
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/icon-label/icon-label-property.tsx"
190
+ },
191
+ {
192
+ "path": "patterns/properties/display/icon-label/index.ts",
193
+ "type": "registry:file",
194
+ "content": "export {\n IconLabelProperty,\n type IconLabelPropertyProps,\n} from './icon-label-property'\n",
195
+ "target": "~/packages/ui/src/patterns/properties/display/icon-label/index.ts"
196
+ },
197
+ {
198
+ "path": "patterns/properties/display/index.ts",
199
+ "type": "registry:file",
200
+ "content": "export * from './attachments/index'\nexport * from './date/index'\nexport * from './date-range/index'\nexport * from './editable-text/index'\nexport * from './email/index'\nexport * from './flag/index'\nexport * from './icon-label/index'\nexport * from './people/index'\nexport * from './person/index'\nexport * from './phone/index'\nexport * from './reference/index'\nexport * from './schedule/index'\nexport * from './select/index'\nexport * from './tags/index'\nexport * from './text/index'\n",
201
+ "target": "~/packages/ui/src/patterns/properties/display/index.ts"
202
+ },
203
+ {
204
+ "path": "patterns/properties/display/people/index.ts",
205
+ "type": "registry:file",
206
+ "content": "export {\n PeopleProperty,\n type PeoplePropertyProps,\n} from './people-property'\n",
207
+ "target": "~/packages/ui/src/patterns/properties/display/people/index.ts"
208
+ },
209
+ {
210
+ "path": "patterns/properties/display/people/people-property.tsx",
211
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/people/people-property.tsx"
214
+ },
215
+ {
216
+ "path": "patterns/properties/display/person/index.ts",
217
+ "type": "registry:file",
218
+ "content": "export {\n PersonProperty,\n type PersonPropertyActionContext,\n PersonPropertyBadge,\n type PersonPropertyOption,\n type PersonPropertyProps,\n} from './person-property'\n",
219
+ "target": "~/packages/ui/src/patterns/properties/display/person/index.ts"
220
+ },
221
+ {
222
+ "path": "patterns/properties/display/person/person-option-content.tsx",
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'\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
+ "target": "~/packages/ui/src/patterns/properties/display/person/person-option-content.tsx"
226
+ },
227
+ {
228
+ "path": "patterns/properties/display/person/person-property.tsx",
229
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/person/person-property.tsx"
232
+ },
233
+ {
234
+ "path": "patterns/properties/display/phone-input/countries.ts",
235
+ "type": "registry:file",
236
+ "content": "import flags from 'react-phone-number-input/flags'\nimport type { Country } from 'react-phone-number-input/input-max'\nimport {\n getCountries,\n getCountryCallingCode,\n} from 'react-phone-number-input/input-max'\nimport countryNames from 'react-phone-number-input/locale/pt-BR.json'\n\nexport type PhoneCountryCode = Country\n\nexport interface PhoneCountry {\n callingCode: string\n code: PhoneCountryCode\n flag: NonNullable<(typeof flags)[Country]> | undefined\n name: string\n}\n\nconst toPhoneCountry = (code: PhoneCountryCode): PhoneCountry => ({\n callingCode: getCountryCallingCode(code),\n code,\n flag: flags[code],\n name: countryNames[code],\n})\n\nconst byName = new Intl.Collator('pt-BR')\n\nexport const phoneCountries: readonly PhoneCountry[] = getCountries()\n .map(toPhoneCountry)\n .sort((first, second) => byName.compare(first.name, second.name))\n\nconst byCode = new Map(phoneCountries.map((country) => [country.code, country]))\n\nexport function findPhoneCountry(code: PhoneCountryCode): PhoneCountry {\n return byCode.get(code) ?? toPhoneCountry(code)\n}\n",
237
+ "target": "~/packages/ui/src/patterns/properties/display/phone-input/countries.ts"
238
+ },
239
+ {
240
+ "path": "patterns/properties/display/phone-input/index.ts",
241
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/phone-input/index.ts"
244
+ },
245
+ {
246
+ "path": "patterns/properties/display/phone-input/phone-input.tsx",
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 {\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
+ "target": "~/packages/ui/src/patterns/properties/display/phone-input/phone-input.tsx"
250
+ },
251
+ {
252
+ "path": "patterns/properties/display/phone-input/phone-number.ts",
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 { 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
+ "target": "~/packages/ui/src/patterns/properties/display/phone-input/phone-number.ts"
256
+ },
257
+ {
258
+ "path": "patterns/properties/display/phone/index.ts",
259
+ "type": "registry:file",
260
+ "content": "export {\n PhoneProperty,\n type PhonePropertyProps,\n} from './phone-property'\n",
261
+ "target": "~/packages/ui/src/patterns/properties/display/phone/index.ts"
262
+ },
263
+ {
264
+ "path": "patterns/properties/display/phone/phone-property.tsx",
265
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/phone/phone-property.tsx"
268
+ },
269
+ {
270
+ "path": "patterns/properties/display/reference/index.ts",
271
+ "type": "registry:file",
272
+ "content": "export {\n ReferenceProperty,\n type ReferencePropertyKind,\n type ReferencePropertyProps,\n} from './reference-property'\n",
273
+ "target": "~/packages/ui/src/patterns/properties/display/reference/index.ts"
274
+ },
275
+ {
276
+ "path": "patterns/properties/display/reference/reference-property.tsx",
277
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/reference/reference-property.tsx"
280
+ },
281
+ {
282
+ "path": "patterns/properties/display/schedule/index.ts",
283
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/index.ts"
286
+ },
287
+ {
288
+ "path": "patterns/properties/display/schedule/schedule-detail-view.tsx",
289
+ "type": "registry:file",
290
+ "content": "'use client'\n\nimport { CaretLeftIcon } from '@phosphor-icons/react'\nimport { Button } from '@tc96/ui/button'\nimport { Separator } from '@tc96/ui/separator'\nimport {\n type ScheduleEditorProps,\n type ScheduleSection,\n scheduleSectionLabel,\n} from './schedule-section'\nimport { ScheduleSectionEditor } from './schedule-section-editor'\n\nexport function ScheduleDetailView({\n onBack,\n section,\n ...props\n}: Readonly<\n ScheduleEditorProps & {\n onBack: () => void\n section: ScheduleSection\n }\n>) {\n return (\n <div className=\"flex flex-col\" data-slot=\"schedule-detail\">\n <div className=\"flex items-center justify-between gap-2 p-1\">\n <Button\n autoFocus\n className=\"-ms-1\"\n onClick={onBack}\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n >\n <CaretLeftIcon aria-hidden />\n {props.labels.back}\n </Button>\n <span className=\"pe-2 font-medium text-sm\">\n {scheduleSectionLabel(props.labels, section)}\n </span>\n </div>\n <Separator className=\"my-1\" />\n <ScheduleSectionEditor {...props} section={section} />\n </div>\n )\n}\n",
291
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-detail-view.tsx"
292
+ },
293
+ {
294
+ "path": "patterns/properties/display/schedule/schedule-footer-rows.tsx",
295
+ "type": "registry:file",
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
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-footer-rows.tsx"
298
+ },
299
+ {
300
+ "path": "patterns/properties/display/schedule/schedule-popup-frame.tsx",
301
+ "type": "registry:file",
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",
303
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-popup-frame.tsx"
304
+ },
305
+ {
306
+ "path": "patterns/properties/display/schedule/schedule-popup.tsx",
307
+ "type": "registry:file",
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",
309
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-popup.tsx"
310
+ },
311
+ {
312
+ "path": "patterns/properties/display/schedule/schedule-presets.ts",
313
+ "type": "registry:file",
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",
315
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-presets.ts"
316
+ },
317
+ {
318
+ "path": "patterns/properties/display/schedule/schedule-property.tsx",
319
+ "type": "registry:file",
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",
321
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-property.tsx"
322
+ },
323
+ {
324
+ "path": "patterns/properties/display/schedule/schedule-recurrence-section.tsx",
325
+ "type": "registry:file",
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",
327
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-recurrence-section.tsx"
328
+ },
329
+ {
330
+ "path": "patterns/properties/display/schedule/schedule-reminders-section.tsx",
331
+ "type": "registry:file",
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",
333
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-reminders-section.tsx"
334
+ },
335
+ {
336
+ "path": "patterns/properties/display/schedule/schedule-section-editor.tsx",
337
+ "type": "registry:file",
338
+ "content": "'use client'\n\nimport { ScheduleRecurrenceSection } from './schedule-recurrence-section'\nimport { ScheduleRemindersSection } from './schedule-reminders-section'\nimport type { ScheduleEditorProps, ScheduleSection } from './schedule-section'\nimport { ScheduleTimeSection } from './schedule-time-section'\n\nexport function ScheduleSectionEditor({\n calendarLocale,\n calendarProps,\n labels,\n locale,\n onChange,\n recurrenceOptions,\n reminderOptions,\n section,\n timeControl,\n value,\n}: Readonly<ScheduleEditorProps & { section: ScheduleSection }>) {\n if (section === 'time') {\n return (\n <ScheduleTimeSection\n labels={labels}\n onChange={onChange}\n timeControl={timeControl}\n value={value}\n />\n )\n }\n\n if (section === 'repeat') {\n return (\n <ScheduleRecurrenceSection\n calendarLocale={calendarLocale}\n calendarProps={calendarProps}\n labels={labels}\n locale={locale}\n onChange={onChange}\n options={recurrenceOptions}\n value={value}\n />\n )\n }\n\n return (\n <ScheduleRemindersSection\n labels={labels}\n onChange={onChange}\n options={reminderOptions}\n value={value}\n />\n )\n}\n",
339
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-section-editor.tsx"
340
+ },
341
+ {
342
+ "path": "patterns/properties/display/schedule/schedule-section.ts",
343
+ "type": "registry:file",
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",
345
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-section.ts"
346
+ },
347
+ {
348
+ "path": "patterns/properties/display/schedule/schedule-summaries.ts",
349
+ "type": "registry:file",
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",
351
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-summaries.ts"
352
+ },
353
+ {
354
+ "path": "patterns/properties/display/schedule/schedule-time-section.tsx",
355
+ "type": "registry:file",
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",
357
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-time-section.tsx"
358
+ },
359
+ {
360
+ "path": "patterns/properties/display/schedule/schedule-value.ts",
361
+ "type": "registry:file",
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",
363
+ "target": "~/packages/ui/src/patterns/properties/display/schedule/schedule-value.ts"
364
+ },
365
+ {
366
+ "path": "patterns/properties/display/select/index.ts",
367
+ "type": "registry:file",
368
+ "content": "export type {\n SelectPropertyGroup,\n SelectPropertyProps,\n} from './select-property'\nexport { SelectProperty } from './select-property'\n",
369
+ "target": "~/packages/ui/src/patterns/properties/display/select/index.ts"
370
+ },
371
+ {
372
+ "path": "patterns/properties/display/select/select-property.tsx",
373
+ "type": "registry:file",
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",
375
+ "target": "~/packages/ui/src/patterns/properties/display/select/select-property.tsx"
376
+ },
377
+ {
378
+ "path": "patterns/properties/display/tags/index.ts",
379
+ "type": "registry:file",
380
+ "content": "export {\n TagsProperty,\n type TagsPropertyProps,\n} from './tags-property'\n",
381
+ "target": "~/packages/ui/src/patterns/properties/display/tags/index.ts"
382
+ },
383
+ {
384
+ "path": "patterns/properties/display/tags/tags-property.tsx",
385
+ "type": "registry:file",
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",
387
+ "target": "~/packages/ui/src/patterns/properties/display/tags/tags-property.tsx"
388
+ },
389
+ {
390
+ "path": "patterns/properties/display/text/index.ts",
391
+ "type": "registry:file",
392
+ "content": "export {\n TextProperty,\n type TextPropertyProps,\n} from './text-property'\n",
393
+ "target": "~/packages/ui/src/patterns/properties/display/text/index.ts"
394
+ },
395
+ {
396
+ "path": "patterns/properties/display/text/text-property.tsx",
397
+ "type": "registry:file",
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",
399
+ "target": "~/packages/ui/src/patterns/properties/display/text/text-property.tsx"
400
+ },
401
+ {
402
+ "path": "patterns/properties/hooks/use-entry-list-editor.ts",
403
+ "type": "registry:file",
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",
405
+ "target": "~/packages/ui/src/patterns/properties/hooks/use-entry-list-editor.ts"
406
+ },
407
+ {
408
+ "path": "patterns/properties/index.ts",
409
+ "type": "registry:file",
410
+ "content": "export * from './composition'\nexport * from './display'\nexport * from './shared'\n",
411
+ "target": "~/packages/ui/src/patterns/properties/index.ts"
412
+ },
413
+ {
414
+ "path": "patterns/properties/shared/index.ts",
415
+ "type": "registry:file",
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",
417
+ "target": "~/packages/ui/src/patterns/properties/shared/index.ts"
418
+ },
419
+ {
420
+ "path": "patterns/properties/shared/lib/entry-parser.ts",
421
+ "type": "registry:file",
422
+ "content": "import type { z } from 'zod'\n\nexport type EntryParseResult =\n | { success: true; value: string }\n | { success: false; message: string }\n\nexport type EntryParser = (raw: string) => EntryParseResult\n\nexport function createEntryParser(\n schema: z.ZodType<string>,\n fallbackMessage: string,\n): EntryParser {\n return (raw) => {\n const parsed = schema.safeParse(raw)\n\n if (parsed.success) return { success: true, value: parsed.data }\n\n return {\n message: parsed.error.issues[0]?.message ?? fallbackMessage,\n success: false,\n }\n }\n}\n",
423
+ "target": "~/packages/ui/src/patterns/properties/shared/lib/entry-parser.ts"
424
+ },
425
+ {
426
+ "path": "patterns/properties/shared/lib/property-change.ts",
427
+ "type": "registry:file",
428
+ "content": "export interface PropertyChangeHandlers<TValue, TContext> {\n action?: (value: TValue, context: TContext) => void\n onValueChange?: (value: TValue) => void\n}\n\nexport function isEditable({\n action,\n onValueChange,\n readOnly = false,\n}: Readonly<{\n action?: unknown\n onValueChange?: unknown\n readOnly?: boolean\n}>): boolean {\n return !readOnly && Boolean(action ?? onValueChange)\n}\n\nexport function emitChange<TValue, TContext>(\n { action, onValueChange }: Readonly<PropertyChangeHandlers<TValue, TContext>>,\n value: TValue,\n context: TContext,\n): void {\n if (action) {\n action(value, context)\n return\n }\n onValueChange?.(value)\n}\n",
429
+ "target": "~/packages/ui/src/patterns/properties/shared/lib/property-change.ts"
430
+ },
431
+ {
432
+ "path": "patterns/properties/shared/lib/property-options.ts",
433
+ "type": "registry:file",
434
+ "content": "export interface OptionLike {\n label: string\n value: string\n}\n\nexport type ResolvedOption<TOption extends OptionLike> =\n | TOption\n | { label: TOption['value']; value: TOption['value'] }\n\nexport function resolveOption<TOption extends OptionLike>(\n options: readonly TOption[],\n value: TOption['value'],\n): ResolvedOption<TOption> {\n return (\n options.find((option) => option.value === value) ?? {\n label: value,\n value,\n }\n )\n}\n\nexport function resolveOptions<TOption extends OptionLike>(\n options: readonly TOption[],\n values: readonly TOption['value'][],\n): ResolvedOption<TOption>[] {\n return values.map((value) => resolveOption(options, value))\n}\n\nexport function diffValues<TValue>(\n previous: readonly TValue[],\n next: readonly TValue[],\n): { added: TValue | null; removed: TValue | null } {\n const previousValues = new Set(previous)\n const nextValues = new Set(next)\n\n return {\n added: next.find((value) => !previousValues.has(value)) ?? null,\n removed: previous.find((value) => !nextValues.has(value)) ?? null,\n }\n}\n\nexport function diffOptions<TOption extends OptionLike>(\n options: readonly TOption[],\n previous: readonly TOption['value'][],\n next: readonly TOption['value'][],\n): {\n added: ResolvedOption<TOption> | null\n removed: ResolvedOption<TOption> | null\n} {\n const { added, removed } = diffValues(previous, next)\n\n return {\n added: added === null ? null : resolveOption(options, added),\n removed: removed === null ? null : resolveOption(options, removed),\n }\n}\n",
435
+ "target": "~/packages/ui/src/patterns/properties/shared/lib/property-options.ts"
436
+ },
437
+ {
438
+ "path": "patterns/properties/shared/property-add-trigger.tsx",
439
+ "type": "registry:file",
440
+ "content": "'use client'\n\nimport { PlusIcon } from '@phosphor-icons/react'\nimport { cn } from '@tc96/utils'\nimport type { PropertyIcon } from './property-catalog'\nimport { PropertySurface, type PropertySurfaceProps } from './property-surface'\n\nexport interface PropertyAddTriggerProps\n extends Omit<PropertySurfaceProps, 'children' | 'render'> {\n addLabel: string\n hasValue: boolean\n placeholder: string\n disabled?: boolean\n icon?: PropertyIcon\n}\n\nexport function PropertyAddTrigger({\n addLabel,\n className,\n disabled,\n hasValue,\n icon: Icon,\n muted = !hasValue,\n placeholder,\n ...props\n}: Readonly<PropertyAddTriggerProps>) {\n const Glyph = hasValue ? PlusIcon : Icon\n\n return (\n <PropertySurface\n {...props}\n aria-label={addLabel}\n className={cn(hasValue && 'w-6 px-0', className)}\n muted={muted}\n render={<button disabled={disabled} type=\"button\" />}\n >\n {Glyph ? <Glyph aria-hidden=\"true\" className=\"size-4\" /> : null}\n {hasValue ? null : <span className=\"truncate\">{placeholder}</span>}\n </PropertySurface>\n )\n}\n",
441
+ "target": "~/packages/ui/src/patterns/properties/shared/property-add-trigger.tsx"
442
+ },
443
+ {
444
+ "path": "patterns/properties/shared/property-calendar-popover.tsx",
445
+ "type": "registry:file",
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",
447
+ "target": "~/packages/ui/src/patterns/properties/shared/property-calendar-popover.tsx"
448
+ },
449
+ {
450
+ "path": "patterns/properties/shared/property-catalog.ts",
451
+ "type": "registry:file",
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",
453
+ "target": "~/packages/ui/src/patterns/properties/shared/property-catalog.ts"
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
+ {
462
+ "path": "patterns/properties/shared/property-entry-form.tsx",
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'\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
+ "target": "~/packages/ui/src/patterns/properties/shared/property-entry-form.tsx"
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
+ },
473
+ {
474
+ "path": "patterns/properties/shared/property-multi-select-shell.tsx",
475
+ "type": "registry:file",
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",
477
+ "target": "~/packages/ui/src/patterns/properties/shared/property-multi-select-shell.tsx"
478
+ },
479
+ {
480
+ "path": "patterns/properties/shared/property-row.tsx",
481
+ "type": "registry:file",
482
+ "content": "import { cn } from '@tc96/utils'\nimport type { ComponentProps } from 'react'\nimport type { PropertyVariant } from './property-surface'\n\nexport interface PropertyRowProps\n extends Omit<ComponentProps<'fieldset'>, 'aria-label'> {\n slot: string\n ariaLabel?: string\n variant?: PropertyVariant\n}\n\nexport function PropertyRow({\n ariaLabel,\n className,\n slot,\n variant,\n ...props\n}: Readonly<PropertyRowProps>) {\n return (\n <fieldset\n aria-label={ariaLabel}\n className={cn('m-0 min-w-0 border-0 p-0', className)}\n data-slot={slot}\n data-variant={variant}\n {...props}\n />\n )\n}\n",
483
+ "target": "~/packages/ui/src/patterns/properties/shared/property-row.tsx"
484
+ },
485
+ {
486
+ "path": "patterns/properties/shared/property-select-shell.tsx",
487
+ "type": "registry:file",
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",
489
+ "target": "~/packages/ui/src/patterns/properties/shared/property-select-shell.tsx"
490
+ },
491
+ {
492
+ "path": "patterns/properties/shared/property-surface.tsx",
493
+ "type": "registry:file",
494
+ "content": "'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { Badge } from '@tc96/ui/badge'\nimport { cn } from '@tc96/utils'\nimport type React from 'react'\n\nexport type PropertyVariant = 'badge' | 'plain'\n\nexport const propertyBadgeClassName =\n 'h-6 min-w-6 px-[calc(--spacing(2.5)-1px)] text-sm sm:h-6 sm:min-w-6 sm:text-sm'\n\nexport interface PropertySurfaceProps extends useRender.ComponentProps<'span'> {\n variant?: PropertyVariant\n muted?: boolean\n}\n\nexport function PropertySurface({\n className,\n muted = false,\n render,\n variant = 'badge',\n ...props\n}: PropertySurfaceProps): React.ReactElement {\n const state = {\n 'data-slot': 'property-surface',\n 'data-variant': variant,\n ...(muted ? { 'data-empty': 'true' } : {}),\n ...(props['aria-label'] && !props.role && !render ? { role: 'img' } : {}),\n }\n const plain = useRender({\n defaultTagName: 'span',\n enabled: variant !== 'badge',\n props: mergeProps<'span'>(\n {\n className: cn(\n muted ? 'text-muted-foreground' : 'text-primary',\n 'inline-flex min-w-0 max-w-full items-center gap-1 whitespace-nowrap text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [button&,a&]:cursor-pointer',\n '[button&,a&]:-ms-1.5 [button&,a&]:-my-0.5 [button&,a&]:h-6 [button&,a&]:rounded-sm [button&,a&]:px-1.5',\n '[button&,a&]:hover:bg-secondary [button&,a&]:hover:text-secondary-foreground',\n '[button&,a&]:focus-visible:bg-secondary [button&,a&]:focus-visible:text-secondary-foreground',\n '[button&,a&]:data-popup-open:bg-secondary [button&,a&]:data-popup-open:text-secondary-foreground',\n className,\n ),\n ...state,\n },\n props,\n ),\n render,\n })\n\n if (plain) return plain\n\n return (\n <Badge\n className={cn(\n propertyBadgeClassName,\n !muted && 'text-primary',\n className,\n )}\n variant={muted ? 'outline' : 'secondary'}\n {...(render ? { render } : {})}\n {...state}\n {...props}\n />\n )\n}\n",
495
+ "target": "~/packages/ui/src/patterns/properties/shared/property-surface.tsx"
496
+ },
497
+ {
498
+ "path": "patterns/properties/shared/property-tooltip.tsx",
499
+ "type": "registry:file",
500
+ "content": "'use client'\n\nimport { Tooltip, TooltipPopup, TooltipTrigger } from '@tc96/ui/tooltip'\nimport { type ReactElement, type ReactNode, useId } from 'react'\n\nexport interface PropertyTooltipProps {\n content: ReactNode\n trigger: ReactElement\n}\n\nexport function PropertyTooltip({\n content,\n trigger,\n}: Readonly<PropertyTooltipProps>) {\n const descriptionId = useId()\n\n return (\n <Tooltip>\n <TooltipTrigger aria-describedby={descriptionId} render={trigger} />\n <span hidden id={descriptionId}>\n {content}\n </span>\n <TooltipPopup>{content}</TooltipPopup>\n </Tooltip>\n )\n}\n",
501
+ "target": "~/packages/ui/src/patterns/properties/shared/property-tooltip.tsx"
502
+ }
503
+ ],
504
+ "dependencies": [
505
+ "@base-ui/react@1.8.0",
506
+ "@daypicker/react@10.0.2",
507
+ "@phosphor-icons/react@2.1.10",
508
+ "react@19.1.1",
509
+ "react-phone-number-input@3.4.18",
510
+ "zod@4.4.3"
511
+ ],
512
+ "registryDependencies": [
513
+ "@ui/avatar",
514
+ "@ui/badge",
515
+ "@ui/button",
516
+ "@ui/calendar",
517
+ "@ui/combobox",
518
+ "@ui/field",
519
+ "@ui/input",
520
+ "@ui/input-group",
521
+ "@ui/menu",
522
+ "@ui/popover",
523
+ "@ui/property-tone",
524
+ "@ui/select",
525
+ "@ui/separator",
526
+ "@ui/switch",
527
+ "@ui/tooltip"
528
+ ],
529
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
530
+ }