@tfn-design/design-system 0.3.0 → 0.4.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 (749) hide show
  1. package/README.md +2 -2
  2. package/dist/accordion/accordion.d.ts +1 -1
  3. package/dist/accordion/accordion.js +1 -1
  4. package/dist/accordion/web/ds-accordion.js +5 -4
  5. package/dist/account-password-field/account-password-field.js +1 -1
  6. package/dist/account-switcher/account-switcher.d.ts +11 -4
  7. package/dist/account-switcher/account-switcher.js +2 -1
  8. package/dist/account-switcher/web/ds-account-switcher.js +12 -4
  9. package/dist/ai-attachment/ai-attachment.d.ts +1 -1
  10. package/dist/ai-attachment/ai-attachment.js +1 -1
  11. package/dist/ai-attachment/web/ds-ai-attachment.js +1 -1
  12. package/dist/ai-branch-switcher/web/ds-ai-branch-switcher.js +2 -2
  13. package/dist/ai-composer/ai-composer.d.ts +1 -1
  14. package/dist/ai-composer/ai-composer.js +1 -1
  15. package/dist/ai-composer/native/ds-ai-composer.js +4 -2
  16. package/dist/ai-composer/web/ds-ai-composer.js +2 -3
  17. package/dist/ai-confirmation/ai-confirmation.d.ts +19 -3
  18. package/dist/ai-confirmation/ai-confirmation.js +18 -3
  19. package/dist/ai-confirmation/native/ds-ai-confirmation.js +18 -13
  20. package/dist/ai-confirmation/web/ds-ai-confirmation.d.ts +1 -1
  21. package/dist/ai-confirmation/web/ds-ai-confirmation.js +22 -11
  22. package/dist/ai-context-scope/ai-context-scope.d.ts +10 -2
  23. package/dist/ai-context-scope/ai-context-scope.js +11 -2
  24. package/dist/ai-context-scope/native/ds-ai-context-scope.js +4 -3
  25. package/dist/ai-context-scope/web/ds-ai-context-scope.js +19 -5
  26. package/dist/ai-conversation-list/ai-conversation-list.d.ts +16 -0
  27. package/dist/ai-conversation-list/ai-conversation-list.js +8 -0
  28. package/dist/ai-conversation-list/web/ds-ai-conversation-list.d.ts +10 -6
  29. package/dist/ai-conversation-list/web/ds-ai-conversation-list.js +89 -47
  30. package/dist/ai-diff/ai-diff.d.ts +13 -1
  31. package/dist/ai-diff/ai-diff.js +12 -1
  32. package/dist/ai-diff/native/ds-ai-diff.d.ts +1 -1
  33. package/dist/ai-diff/native/ds-ai-diff.js +4 -6
  34. package/dist/ai-diff/web/ds-ai-diff.d.ts +0 -4
  35. package/dist/ai-diff/web/ds-ai-diff.js +16 -9
  36. package/dist/ai-draft-panel/ai-draft-panel.d.ts +2 -0
  37. package/dist/ai-draft-panel/ai-draft-panel.js +5 -0
  38. package/dist/ai-draft-panel/web/ds-ai-draft-panel.d.ts +3 -1
  39. package/dist/ai-draft-panel/web/ds-ai-draft-panel.js +4 -4
  40. package/dist/ai-empty-state/native/ds-ai-empty-state.js +2 -2
  41. package/dist/ai-empty-state/web/ds-ai-empty-state.js +3 -1
  42. package/dist/ai-error-state/ai-error-state.d.ts +2 -2
  43. package/dist/ai-error-state/ai-error-state.js +2 -2
  44. package/dist/ai-error-state/native/ds-ai-error-state.d.ts +5 -1
  45. package/dist/ai-error-state/native/ds-ai-error-state.js +2 -1
  46. package/dist/ai-error-state/web/ds-ai-error-state.d.ts +5 -1
  47. package/dist/ai-error-state/web/ds-ai-error-state.js +3 -2
  48. package/dist/ai-label/native/ds-ai-label.js +2 -1
  49. package/dist/ai-label/web/ds-ai-label.js +1 -1
  50. package/dist/ai-message/ai-message.d.ts +1 -1
  51. package/dist/ai-message/ai-message.js +1 -1
  52. package/dist/ai-message/native/ds-ai-message.js +4 -3
  53. package/dist/ai-message/web/ds-ai-message-markdown.js +3 -3
  54. package/dist/ai-message/web/ds-ai-message.js +4 -3
  55. package/dist/ai-message-actions/ai-message-actions.d.ts +1 -1
  56. package/dist/ai-message-actions/ai-message-actions.js +1 -1
  57. package/dist/ai-message-actions/native/ds-ai-message-actions.js +1 -1
  58. package/dist/ai-message-actions/web/ds-ai-message-actions.js +1 -1
  59. package/dist/ai-plan/ai-plan.d.ts +1 -1
  60. package/dist/ai-plan/ai-plan.js +1 -1
  61. package/dist/ai-plan/web/ds-ai-plan.js +2 -2
  62. package/dist/ai-side-nav/web/ds-ai-side-nav.js +4 -3
  63. package/dist/ai-summary-card/native/ds-ai-summary-card.js +2 -1
  64. package/dist/ai-summary-card/web/ds-ai-summary-card.js +2 -1
  65. package/dist/ai-thread/web/ds-ai-thread.js +1 -1
  66. package/dist/ai-tool-call/ai-tool-call.d.ts +1 -1
  67. package/dist/ai-tool-call/ai-tool-call.js +1 -1
  68. package/dist/ai-tool-call/native/ds-ai-tool-call.js +3 -2
  69. package/dist/ai-tool-call/web/ds-ai-tool-call.js +4 -3
  70. package/dist/alert/native/ds-alert.js +4 -4
  71. package/dist/alert/web/ds-alert.js +5 -5
  72. package/dist/ambient-gradient/ambient-gradient.d.ts +1 -1
  73. package/dist/amount/amount.d.ts +1 -1
  74. package/dist/amount/amount.js +3 -2
  75. package/dist/amount/native/ds-amount.js +1 -1
  76. package/dist/amount/web/ds-amount.js +1 -1
  77. package/dist/amount-cell/amount-cell.d.ts +5 -2
  78. package/dist/amount-cell/web/ds-amount-cell.d.ts +1 -1
  79. package/dist/amount-cell/web/ds-amount-cell.js +7 -1
  80. package/dist/amount-entry/amount-entry.d.ts +28 -2
  81. package/dist/amount-entry/amount-entry.js +19 -12
  82. package/dist/amount-entry/native/ds-amount-entry.d.ts +1 -1
  83. package/dist/amount-entry/native/ds-amount-entry.js +5 -4
  84. package/dist/amount-entry/web/ds-amount-entry.d.ts +1 -1
  85. package/dist/amount-entry/web/ds-amount-entry.js +5 -4
  86. package/dist/app-shell/app-shell.d.ts +2 -0
  87. package/dist/app-shell/web/ds-app-shell.js +26 -3
  88. package/dist/approval-chain/approval-chain.d.ts +6 -2
  89. package/dist/approval-chain/approval-chain.js +4 -4
  90. package/dist/approval-chain/native/ds-approval-chain.js +16 -9
  91. package/dist/approval-chain/web/ds-approval-chain.d.ts +7 -1
  92. package/dist/approval-chain/web/ds-approval-chain.js +12 -11
  93. package/dist/auth-shell/web/ds-auth-shell.d.ts +5 -1
  94. package/dist/auth-shell/web/ds-auth-shell.js +5 -2
  95. package/dist/balance-header/balance-header.d.ts +8 -4
  96. package/dist/balance-header/native/ds-balance-header.d.ts +3 -3
  97. package/dist/balance-header/native/ds-balance-header.js +11 -4
  98. package/dist/balance-header/web/ds-balance-header.d.ts +1 -1
  99. package/dist/balance-header/web/ds-balance-header.js +7 -4
  100. package/dist/bar-chart/bar-chart.d.ts +46 -5
  101. package/dist/bar-chart/bar-chart.js +64 -6
  102. package/dist/bar-chart/web/ds-bar-chart.d.ts +21 -4
  103. package/dist/bar-chart/web/ds-bar-chart.js +121 -50
  104. package/dist/bottom-nav/bottom-nav.d.ts +8 -3
  105. package/dist/bottom-nav/bottom-nav.js +2 -2
  106. package/dist/bottom-nav/web/ds-bottom-nav.js +2 -2
  107. package/dist/box-plot/box-plot.d.ts +150 -0
  108. package/dist/box-plot/box-plot.js +124 -0
  109. package/dist/box-plot/web/ds-box-plot.d.ts +8 -0
  110. package/dist/box-plot/web/ds-box-plot.js +57 -0
  111. package/dist/brand-lockup/native/ds-brand-lockup.js +1 -1
  112. package/dist/brand-provider/brand-provider.d.ts +29 -0
  113. package/dist/brand-provider/brand-provider.js +9 -0
  114. package/dist/brand-provider/native/ds-brand-provider.d.ts +11 -0
  115. package/dist/brand-provider/native/ds-brand-provider.js +18 -0
  116. package/dist/brand-provider/web/ds-brand-provider.d.ts +10 -0
  117. package/dist/brand-provider/web/ds-brand-provider.js +20 -0
  118. package/dist/bullet-chart/bullet-chart.d.ts +12 -7
  119. package/dist/bullet-chart/bullet-chart.js +5 -4
  120. package/dist/bullet-chart/web/ds-bullet-chart.d.ts +1 -1
  121. package/dist/bullet-chart/web/ds-bullet-chart.js +9 -4
  122. package/dist/button/button.d.ts +1 -1
  123. package/dist/button/native/ds-button.js +2 -2
  124. package/dist/button/web/ds-button.js +1 -1
  125. package/dist/button-group/button-group.d.ts +1 -1
  126. package/dist/button-group/web/ds-button-group.d.ts +2 -2
  127. package/dist/calendar/calendar.d.ts +13 -2
  128. package/dist/calendar/calendar.js +4 -3
  129. package/dist/calendar/web/ds-calendar.d.ts +1 -1
  130. package/dist/calendar/web/ds-calendar.js +6 -5
  131. package/dist/card-carousel/native/ds-card-carousel.js +1 -1
  132. package/dist/card-carousel/web/ds-card-carousel.js +2 -2
  133. package/dist/chart/chart.d.ts +180 -64
  134. package/dist/chart/chart.js +367 -118
  135. package/dist/chart/web/ds-chart.d.ts +17 -7
  136. package/dist/chart/web/ds-chart.js +85 -108
  137. package/dist/check-option/check-option.d.ts +1 -1
  138. package/dist/check-option/check-option.js +1 -1
  139. package/dist/check-option/web/ds-check-option.d.ts +6 -1
  140. package/dist/check-option/web/ds-check-option.js +10 -6
  141. package/dist/checkbox/checkbox.d.ts +2 -2
  142. package/dist/checkbox/checkbox.js +2 -2
  143. package/dist/checkbox/native/ds-checkbox.js +1 -1
  144. package/dist/checkbox/web/checkbox-mark.js +1 -1
  145. package/dist/checkbox/web/ds-checkbox.d.ts +2 -2
  146. package/dist/checkbox/web/ds-checkbox.js +17 -6
  147. package/dist/chip/chip.d.ts +11 -11
  148. package/dist/chip/chip.js +5 -3
  149. package/dist/chip/native/ds-chip.js +1 -1
  150. package/dist/chip/web/ds-chip.js +6 -6
  151. package/dist/code-block/web/ds-code-block.js +3 -3
  152. package/dist/column-picker/web/ds-column-picker.js +2 -1
  153. package/dist/combobox/combobox.d.ts +2 -2
  154. package/dist/combobox/web/ds-combobox.js +4 -2
  155. package/dist/command-palette/command-palette.d.ts +4 -0
  156. package/dist/comment-thread/comment-thread.d.ts +2 -2
  157. package/dist/comment-thread/comment-thread.js +2 -2
  158. package/dist/comment-thread/native/ds-comment-thread.js +10 -9
  159. package/dist/comment-thread/web/ds-comment-thread.js +11 -10
  160. package/dist/condition-builder/condition-builder.d.ts +96 -4
  161. package/dist/condition-builder/condition-builder.js +68 -28
  162. package/dist/condition-builder/web/ds-condition-builder.d.ts +4 -2
  163. package/dist/condition-builder/web/ds-condition-builder.js +97 -57
  164. package/dist/context-switcher/context-switcher.d.ts +10 -1
  165. package/dist/context-switcher/context-switcher.js +5 -2
  166. package/dist/context-switcher/web/ds-context-switcher.d.ts +1 -1
  167. package/dist/context-switcher/web/ds-context-switcher.js +4 -3
  168. package/dist/coordinate-field/coordinate-field.d.ts +46 -5
  169. package/dist/coordinate-field/coordinate-field.js +35 -18
  170. package/dist/coordinate-field/native/ds-coordinate-field.d.ts +1 -1
  171. package/dist/coordinate-field/native/ds-coordinate-field.js +9 -8
  172. package/dist/coordinate-field/web/ds-coordinate-field.d.ts +1 -1
  173. package/dist/coordinate-field/web/ds-coordinate-field.js +10 -9
  174. package/dist/copy-field/copy-field.d.ts +23 -9
  175. package/dist/copy-field/copy-field.js +11 -6
  176. package/dist/copy-field/web/ds-copy-field.d.ts +1 -1
  177. package/dist/copy-field/web/ds-copy-field.js +6 -5
  178. package/dist/copy.d.ts +8 -0
  179. package/dist/copy.js +7 -0
  180. package/dist/count-badge/web/ds-count-badge.js +1 -1
  181. package/dist/countdown/native/ds-countdown.js +1 -1
  182. package/dist/countdown/web/ds-countdown.js +1 -1
  183. package/dist/dashboard-shell/dashboard-shell.d.ts +4 -2
  184. package/dist/data-table/web/data-table-theme.css +340 -52
  185. package/dist/data-table/web/ds-data-table.d.ts +43 -1
  186. package/dist/data-table/web/ds-data-table.js +165 -17
  187. package/dist/date-field/web/ds-date-field.d.ts +1 -1
  188. package/dist/date-field/web/ds-date-field.js +6 -5
  189. package/dist/date-input/date-input.d.ts +26 -5
  190. package/dist/date-input/date-input.js +34 -2
  191. package/dist/date-input/web/ds-date-input.js +13 -4
  192. package/dist/date-picker/date-picker.d.ts +38 -67
  193. package/dist/date-picker/date-picker.js +26 -60
  194. package/dist/date-picker/web/ds-date-picker.d.ts +13 -6
  195. package/dist/date-picker/web/ds-date-picker.js +41 -10
  196. package/dist/date-range-picker/web/ds-date-range-picker.d.ts +10 -4
  197. package/dist/date-range-picker/web/ds-date-range-picker.js +8 -5
  198. package/dist/day-picker/day-picker.d.ts +1 -1
  199. package/dist/day-picker/web/ds-day-picker.js +1 -1
  200. package/dist/delta/delta.d.ts +15 -1
  201. package/dist/delta/delta.js +20 -0
  202. package/dist/delta/native/ds-delta.d.ts +5 -2
  203. package/dist/delta/native/ds-delta.js +4 -3
  204. package/dist/delta/web/ds-delta.d.ts +5 -2
  205. package/dist/delta/web/ds-delta.js +4 -3
  206. package/dist/description-list/description-list.d.ts +4 -2
  207. package/dist/description-list/native/ds-description-list.d.ts +2 -2
  208. package/dist/description-list/native/ds-description-list.js +49 -27
  209. package/dist/description-list/web/ds-description-list.d.ts +2 -2
  210. package/dist/description-list/web/ds-description-list.js +40 -17
  211. package/dist/dialog/dialog.d.ts +12 -1
  212. package/dist/dialog/web/ds-dialog.d.ts +1 -1
  213. package/dist/dialog/web/ds-dialog.js +5 -3
  214. package/dist/diverging-bar-chart/diverging-bar-chart.d.ts +2 -1
  215. package/dist/diverging-bar-chart/diverging-bar-chart.js +2 -1
  216. package/dist/diverging-bar-chart/web/ds-diverging-bar-chart.d.ts +1 -1
  217. package/dist/diverging-bar-chart/web/ds-diverging-bar-chart.js +28 -5
  218. package/dist/donut-chart/donut-chart.d.ts +7 -1
  219. package/dist/donut-chart/donut-chart.js +4 -0
  220. package/dist/donut-chart/web/ds-donut-chart.d.ts +4 -1
  221. package/dist/donut-chart/web/ds-donut-chart.js +43 -24
  222. package/dist/drawer/drawer.d.ts +42 -5
  223. package/dist/drawer/drawer.js +10 -4
  224. package/dist/drawer/native/ds-drawer.d.ts +1 -1
  225. package/dist/drawer/native/ds-drawer.js +17 -7
  226. package/dist/drawer/web/ds-drawer.d.ts +1 -1
  227. package/dist/drawer/web/ds-drawer.js +32 -17
  228. package/dist/dropdown-menu/dropdown-menu.d.ts +10 -5
  229. package/dist/dropdown-menu/dropdown-menu.js +13 -4
  230. package/dist/dropdown-menu/web/ds-dropdown-menu-surface.d.ts +4 -2
  231. package/dist/dropdown-menu/web/ds-dropdown-menu-surface.js +6 -6
  232. package/dist/dropdown-menu/web/ds-dropdown-menu.d.ts +5 -2
  233. package/dist/dropdown-menu/web/ds-dropdown-menu.js +2 -2
  234. package/dist/dumbbell-chart/dumbbell-chart.d.ts +10 -9
  235. package/dist/dumbbell-chart/dumbbell-chart.js +18 -4
  236. package/dist/dumbbell-chart/web/ds-dumbbell-chart.d.ts +4 -1
  237. package/dist/dumbbell-chart/web/ds-dumbbell-chart.js +13 -3
  238. package/dist/editable-row/editable-row.d.ts +5 -1
  239. package/dist/editable-row/editable-row.js +7 -1
  240. package/dist/editable-row/web/ds-editable-row.js +7 -5
  241. package/dist/empty-state/empty-state.d.ts +39 -0
  242. package/dist/empty-state/empty-state.js +21 -0
  243. package/dist/empty-state/web/ds-empty-state.d.ts +19 -8
  244. package/dist/empty-state/web/ds-empty-state.js +15 -3
  245. package/dist/environment-banner/environment-banner.d.ts +1 -1
  246. package/dist/environment-banner/environment-banner.js +1 -1
  247. package/dist/environment-banner/web/ds-environment-banner.js +3 -3
  248. package/dist/evaluation-trace/evaluation-trace.d.ts +1 -1
  249. package/dist/evaluation-trace/evaluation-trace.js +1 -1
  250. package/dist/evaluation-trace/web/ds-evaluation-trace.js +1 -1
  251. package/dist/event-row/web/ds-event-row.d.ts +1 -1
  252. package/dist/event-row/web/ds-event-row.js +2 -1
  253. package/dist/facet-button/facet-button.d.ts +9 -1
  254. package/dist/facet-button/facet-button.js +2 -2
  255. package/dist/facet-button/web/ds-facet-button.d.ts +1 -1
  256. package/dist/facet-button/web/ds-facet-button.js +9 -5
  257. package/dist/facet-menu/facet-menu.d.ts +1 -1
  258. package/dist/facet-menu/facet-menu.js +2 -1
  259. package/dist/facet-menu/web/ds-facet-menu.js +1 -1
  260. package/dist/fact/native/ds-fact.d.ts +4 -1
  261. package/dist/file-dropzone/file-dropzone.d.ts +54 -5
  262. package/dist/file-dropzone/file-dropzone.js +38 -20
  263. package/dist/file-dropzone/web/ds-file-dropzone.d.ts +1 -1
  264. package/dist/file-dropzone/web/ds-file-dropzone.js +16 -15
  265. package/dist/file-field/file-field.d.ts +26 -5
  266. package/dist/file-field/file-field.js +18 -8
  267. package/dist/file-field/web/ds-file-field.d.ts +5 -2
  268. package/dist/file-field/web/ds-file-field.js +6 -5
  269. package/dist/file-import/file-import.d.ts +50 -4
  270. package/dist/file-import/file-import.js +30 -11
  271. package/dist/file-import/web/ds-file-import.d.ts +7 -3
  272. package/dist/file-import/web/ds-file-import.js +11 -10
  273. package/dist/file-upload/file-upload.d.ts +64 -15
  274. package/dist/file-upload/file-upload.js +44 -30
  275. package/dist/file-upload/web/ds-file-upload.d.ts +11 -2
  276. package/dist/file-upload/web/ds-file-upload.js +17 -12
  277. package/dist/filter-bar/web/ds-filter-bar.js +1 -1
  278. package/dist/filter-button/filter-button.d.ts +5 -4
  279. package/dist/filter-button/filter-button.js +1 -1
  280. package/dist/filter-chip/web/ds-filter-chip.js +2 -2
  281. package/dist/filter-popover/web/ds-filter-popover.js +2 -1
  282. package/dist/form-field-group/form-field-group.d.ts +7 -2
  283. package/dist/form-field-group/form-field-group.js +2 -0
  284. package/dist/form-field-group/web/ds-form-field-group.js +2 -1
  285. package/dist/form-section/form-section.d.ts +4 -2
  286. package/dist/form-section/form-section.js +1 -1
  287. package/dist/funnel/funnel.d.ts +2 -1
  288. package/dist/funnel/web/ds-funnel.d.ts +1 -1
  289. package/dist/funnel/web/ds-funnel.js +22 -12
  290. package/dist/gauge/gauge.d.ts +6 -1
  291. package/dist/gauge/gauge.js +9 -1
  292. package/dist/gauge/web/ds-gauge.d.ts +8 -3
  293. package/dist/gauge/web/ds-gauge.js +26 -15
  294. package/dist/geo/geo.d.ts +15 -0
  295. package/dist/geo/geo.js +112 -0
  296. package/dist/geofence-editor/geofence-editor.d.ts +14 -5
  297. package/dist/geofence-editor/geofence-editor.js +32 -7
  298. package/dist/geofence-editor/web/ds-geofence-editor.d.ts +18 -3
  299. package/dist/geofence-editor/web/ds-geofence-editor.js +28 -13
  300. package/dist/group-header/web/ds-group-header.d.ts +1 -1
  301. package/dist/heatmap/heatmap-calendar.d.ts +95 -0
  302. package/dist/heatmap/heatmap-calendar.js +130 -0
  303. package/dist/heatmap/heatmap.d.ts +35 -8
  304. package/dist/heatmap/heatmap.js +61 -7
  305. package/dist/heatmap/web/ds-heatmap-calendar.d.ts +22 -0
  306. package/dist/heatmap/web/ds-heatmap-calendar.js +33 -0
  307. package/dist/heatmap/web/ds-heatmap.d.ts +21 -1
  308. package/dist/heatmap/web/ds-heatmap.js +59 -31
  309. package/dist/helper-text/native/ds-helper-text.js +2 -2
  310. package/dist/helper-text/web/ds-helper-text.js +2 -2
  311. package/dist/histogram/histogram.d.ts +2 -3
  312. package/dist/histogram/web/ds-histogram.d.ts +1 -1
  313. package/dist/histogram/web/ds-histogram.js +8 -2
  314. package/dist/icon/icon.d.ts +11 -0
  315. package/dist/icon/icon.js +52 -0
  316. package/dist/icon/native/ds-icon-provider.d.ts +6 -1
  317. package/dist/icon/native/ds-icon-provider.js +4 -2
  318. package/dist/icon/native/icon-direction.d.ts +10 -0
  319. package/dist/icon/native/icon-direction.js +6 -0
  320. package/dist/icon/native/use-icon-size.d.ts +6 -0
  321. package/dist/icon/native/use-icon-size.js +12 -0
  322. package/dist/icon/web/ds-icon-provider.d.ts +3 -1
  323. package/dist/icon/web/ds-icon-provider.js +1 -0
  324. package/dist/icon/web/icon-direction.css +45 -0
  325. package/dist/icon-button/icon-button.d.ts +6 -0
  326. package/dist/icon-button/native/ds-icon-button.d.ts +1 -1
  327. package/dist/icon-button/native/ds-icon-button.js +2 -1
  328. package/dist/icon-button/web/ds-icon-button.d.ts +1 -1
  329. package/dist/icon-button/web/ds-icon-button.js +8 -5
  330. package/dist/icon-frame/icon-frame.d.ts +2 -2
  331. package/dist/icon-frame/native/ds-icon-frame.js +3 -3
  332. package/dist/icon-frame/web/ds-icon-frame.js +3 -3
  333. package/dist/ident/ident.d.ts +2 -0
  334. package/dist/ident/ident.js +5 -0
  335. package/dist/ident/native/ds-ident.d.ts +30 -0
  336. package/dist/ident/native/ds-ident.js +13 -0
  337. package/dist/index.d.ts +88 -65
  338. package/dist/index.js +47 -36
  339. package/dist/inline-edit/inline-edit.d.ts +34 -4
  340. package/dist/inline-edit/inline-edit.js +19 -7
  341. package/dist/inline-edit/web/ds-inline-edit.d.ts +1 -1
  342. package/dist/inline-edit/web/ds-inline-edit.js +13 -8
  343. package/dist/input/input.d.ts +18 -5
  344. package/dist/input/input.js +17 -13
  345. package/dist/input/native/ds-input.js +1 -1
  346. package/dist/input/web/ds-input.d.ts +7 -1
  347. package/dist/input/web/ds-input.js +11 -9
  348. package/dist/interaction.d.ts +7 -5
  349. package/dist/interaction.js +1 -1
  350. package/dist/json-viewer/web/ds-json-viewer.js +1 -1
  351. package/dist/key-value-editor/key-value-editor.d.ts +57 -3
  352. package/dist/key-value-editor/key-value-editor.js +56 -26
  353. package/dist/key-value-editor/web/ds-key-value-editor.d.ts +1 -1
  354. package/dist/key-value-editor/web/ds-key-value-editor.js +15 -16
  355. package/dist/keypad/keypad.d.ts +21 -11
  356. package/dist/keypad/keypad.js +16 -10
  357. package/dist/keypad/native/ds-keypad.d.ts +1 -1
  358. package/dist/keypad/native/ds-keypad.js +10 -8
  359. package/dist/keypad/web/ds-keypad.d.ts +1 -1
  360. package/dist/keypad/web/ds-keypad.js +5 -4
  361. package/dist/label-picker/label-picker.d.ts +34 -4
  362. package/dist/label-picker/label-picker.js +28 -17
  363. package/dist/label-picker/native/ds-label-picker.d.ts +1 -1
  364. package/dist/label-picker/native/ds-label-picker.js +11 -10
  365. package/dist/label-picker/web/ds-label-picker.d.ts +1 -1
  366. package/dist/label-picker/web/ds-label-picker.js +11 -10
  367. package/dist/labeled-field/labeled-field.d.ts +17 -2
  368. package/dist/labeled-field/labeled-field.js +7 -5
  369. package/dist/labeled-field/web/ds-labeled-field.d.ts +1 -1
  370. package/dist/labeled-field/web/ds-labeled-field.js +6 -2
  371. package/dist/leaderboard/leaderboard.d.ts +4 -3
  372. package/dist/leaderboard/leaderboard.js +4 -1
  373. package/dist/leaderboard/web/ds-leaderboard.d.ts +1 -1
  374. package/dist/leaderboard/web/ds-leaderboard.js +8 -3
  375. package/dist/legend/legend.d.ts +4 -0
  376. package/dist/legend/legend.js +1 -0
  377. package/dist/legend/web/ds-legend.js +18 -11
  378. package/dist/lib/chart-context.d.ts +23 -3
  379. package/dist/lib/chart-context.js +9 -3
  380. package/dist/lib/chart-finish.d.ts +13 -6
  381. package/dist/lib/chart-finish.js +8 -2
  382. package/dist/lib/chart-library.d.ts +1 -1
  383. package/dist/lib/chart-series.d.ts +7 -4
  384. package/dist/lib/chart-series.js +2 -4
  385. package/dist/lib/chart-ticks.d.ts +11 -0
  386. package/dist/lib/chart-ticks.js +11 -0
  387. package/dist/lib/chart-value.d.ts +1 -1
  388. package/dist/lib/chart-value.js +3 -1
  389. package/dist/lib/cn.d.ts +1 -0
  390. package/dist/lib/cn.js +7 -2
  391. package/dist/lib/time-of-day.d.ts +21 -0
  392. package/dist/lib/time-of-day.js +37 -0
  393. package/dist/lib/web/chart-finish.d.ts +1 -1
  394. package/dist/lib/web/chart-finish.js +1 -1
  395. package/dist/lib/web/density.d.ts +1 -0
  396. package/dist/lib/web/density.js +7 -0
  397. package/dist/lib/web/focus-habits.js +20 -8
  398. package/dist/lib/web/focus-trap.d.ts +10 -0
  399. package/dist/lib/web/focus-trap.js +4 -1
  400. package/dist/lib/web/live-announcer.d.ts +2 -0
  401. package/dist/lib/web/live-announcer.js +2 -1
  402. package/dist/lib/web/touch-target.d.ts +4 -4
  403. package/dist/lib/web/touch-target.js +3 -3
  404. package/dist/lib/web/use-anchored-surface.js +3 -2
  405. package/dist/lib/web/use-overlay.js +7 -1
  406. package/dist/list-page/list-page.d.ts +2 -1
  407. package/dist/list-page/web/ds-list-page.js +1 -5
  408. package/dist/list-row/list-row.d.ts +6 -6
  409. package/dist/list-row/list-row.js +4 -5
  410. package/dist/list-row/native/ds-list-row.js +7 -2
  411. package/dist/list-row/web/ds-list-row-group.d.ts +6 -2
  412. package/dist/list-row/web/ds-list-row-group.js +4 -2
  413. package/dist/list-row/web/ds-list-row.js +9 -9
  414. package/dist/loading-screen/native/ds-loading-screen.js +1 -1
  415. package/dist/log-viewer/log-viewer.d.ts +2 -2
  416. package/dist/log-viewer/log-viewer.js +1 -1
  417. package/dist/log-viewer/web/ds-log-viewer.js +6 -5
  418. package/dist/map/map.d.ts +5 -0
  419. package/dist/map/map.js +2 -0
  420. package/dist/map/web/ds-map.js +9 -3
  421. package/dist/map-banner/native/ds-map-banner.js +3 -3
  422. package/dist/map-banner/web/ds-map-banner.js +4 -4
  423. package/dist/map-controls/map-controls.d.ts +3 -5
  424. package/dist/map-controls/map-controls.js +4 -4
  425. package/dist/map-controls/native/ds-map-controls.js +1 -1
  426. package/dist/map-controls/web/ds-map-controls.js +1 -1
  427. package/dist/map-draw-toolbar/web/ds-map-draw-toolbar.js +3 -2
  428. package/dist/map-heatmap-layer/map-heatmap-layer.d.ts +1 -1
  429. package/dist/map-layers/map-layers.d.ts +1 -1
  430. package/dist/map-layers/map-layers.js +1 -1
  431. package/dist/map-layers/native/ds-map-layers.d.ts +4 -2
  432. package/dist/map-layers/native/ds-map-layers.js +5 -4
  433. package/dist/map-layers/web/ds-map-layers.js +4 -4
  434. package/dist/map-list/map-list.d.ts +2 -1
  435. package/dist/map-list/web/ds-map-list.d.ts +1 -1
  436. package/dist/map-list/web/ds-map-list.js +19 -16
  437. package/dist/map-marker/map-marker.d.ts +5 -0
  438. package/dist/map-marker/map-marker.js +6 -0
  439. package/dist/map-marker/web/ds-map-marker.d.ts +12 -3
  440. package/dist/map-marker/web/ds-map-marker.js +18 -8
  441. package/dist/map-search/map-search.d.ts +9 -0
  442. package/dist/map-search/map-search.js +13 -0
  443. package/dist/map-search/native/ds-map-search.d.ts +10 -3
  444. package/dist/map-search/native/ds-map-search.js +32 -19
  445. package/dist/map-search/web/ds-map-search.d.ts +8 -3
  446. package/dist/map-search/web/ds-map-search.js +37 -27
  447. package/dist/map-search-area/native/ds-map-search-area.js +2 -1
  448. package/dist/map-search-area/web/ds-map-search-area.js +2 -1
  449. package/dist/map-sheet/native/ds-map-sheet.js +1 -1
  450. package/dist/map-sheet/web/ds-map-sheet.js +2 -2
  451. package/dist/map-summary/map-summary.d.ts +2 -1
  452. package/dist/map-summary/web/ds-map-summary.d.ts +2 -2
  453. package/dist/map-summary/web/ds-map-summary.js +18 -9
  454. package/dist/mention-input/mention-input.d.ts +23 -2
  455. package/dist/mention-input/mention-input.js +15 -8
  456. package/dist/mention-input/native/ds-mention-input.d.ts +1 -1
  457. package/dist/mention-input/native/ds-mention-input.js +6 -9
  458. package/dist/mention-input/web/ds-mention-input.d.ts +1 -1
  459. package/dist/mention-input/web/ds-mention-input.js +6 -5
  460. package/dist/menu-button/web/ds-menu-button.d.ts +2 -2
  461. package/dist/menu-button/web/ds-menu-button.js +9 -4
  462. package/dist/meter/meter.d.ts +5 -2
  463. package/dist/meter/meter.js +2 -1
  464. package/dist/meter/native/ds-meter.d.ts +2 -2
  465. package/dist/meter/native/ds-meter.js +13 -3
  466. package/dist/meter/web/ds-meter.d.ts +1 -1
  467. package/dist/meter/web/ds-meter.js +16 -9
  468. package/dist/metric/metric.d.ts +13 -9
  469. package/dist/metric/native/ds-metric.d.ts +1 -1
  470. package/dist/metric/native/ds-metric.js +26 -16
  471. package/dist/metric/web/ds-metric.d.ts +1 -1
  472. package/dist/metric/web/ds-metric.js +21 -5
  473. package/dist/metric-card/metric-card.d.ts +4 -3
  474. package/dist/metric-card/web/ds-metric-card.d.ts +1 -1
  475. package/dist/metric-card/web/ds-metric-card.js +4 -2
  476. package/dist/month-picker/web/ds-month-picker.js +2 -1
  477. package/dist/month-strip/web/ds-month-strip.js +1 -1
  478. package/dist/motion.d.ts +18 -3
  479. package/dist/motion.js +3 -1
  480. package/dist/multi-select/multi-select.d.ts +39 -9
  481. package/dist/multi-select/multi-select.js +35 -22
  482. package/dist/multi-select/web/ds-multi-select.d.ts +1 -1
  483. package/dist/multi-select/web/ds-multi-select.js +42 -24
  484. package/dist/native.d.ts +12 -0
  485. package/dist/native.js +8 -0
  486. package/dist/notification-list/native/ds-notification-list.d.ts +1 -1
  487. package/dist/notification-list/native/ds-notification-list.js +14 -7
  488. package/dist/notification-list/notification-list.d.ts +2 -1
  489. package/dist/notification-list/web/ds-notification-list.d.ts +1 -1
  490. package/dist/notification-list/web/ds-notification-list.js +10 -4
  491. package/dist/number-field/native/ds-number-field.js +1 -1
  492. package/dist/number-field/web/ds-number-field.js +1 -1
  493. package/dist/otp/native/ds-otp-field.js +3 -21
  494. package/dist/otp/native/ds-otp.js +3 -3
  495. package/dist/otp/otp.d.ts +3 -3
  496. package/dist/otp/web/ds-otp.js +3 -3
  497. package/dist/overflow-menu/web/ds-overflow-menu.js +7 -2
  498. package/dist/page-head/web/ds-page-head.js +2 -2
  499. package/dist/panel/native/ds-panel.js +1 -1
  500. package/dist/panel/panel.d.ts +1 -1
  501. package/dist/panel/web/ds-panel.d.ts +3 -1
  502. package/dist/panel/web/ds-panel.js +3 -2
  503. package/dist/password-feedback/web/ds-password-feedback.d.ts +1 -1
  504. package/dist/password-feedback/web/ds-password-feedback.js +3 -3
  505. package/dist/password-input/web/ds-password-input.d.ts +7 -2
  506. package/dist/password-input/web/ds-password-input.js +28 -3
  507. package/dist/password-requirements/password-requirements.d.ts +12 -2
  508. package/dist/password-requirements/password-requirements.js +6 -8
  509. package/dist/password-requirements/web/ds-password-requirements.js +5 -5
  510. package/dist/password-strength/web/ds-password-strength.js +2 -2
  511. package/dist/payment-card/native/ds-payment-card.d.ts +1 -1
  512. package/dist/payment-card/native/ds-payment-card.js +1 -1
  513. package/dist/payment-card/web/ds-payment-card.d.ts +1 -1
  514. package/dist/payment-card/web/ds-payment-card.js +1 -1
  515. package/dist/people-cell/people-cell.d.ts +5 -2
  516. package/dist/people-cell/web/ds-people-cell.d.ts +1 -1
  517. package/dist/people-cell/web/ds-people-cell.js +6 -2
  518. package/dist/person-cell/person-cell.d.ts +5 -2
  519. package/dist/person-cell/web/ds-person-cell.d.ts +1 -1
  520. package/dist/person-cell/web/ds-person-cell.js +11 -1
  521. package/dist/phone-field/native/ds-phone-field.js +2 -2
  522. package/dist/phone-field/phone-field.d.ts +35 -0
  523. package/dist/phone-field/phone-field.js +38 -0
  524. package/dist/phone-field/web/ds-phone-field.d.ts +31 -3
  525. package/dist/phone-field/web/ds-phone-field.js +45 -8
  526. package/dist/place-card/native/ds-place-card.d.ts +7 -3
  527. package/dist/place-card/native/ds-place-card.js +32 -21
  528. package/dist/place-card/place-card.d.ts +12 -6
  529. package/dist/place-card/place-card.js +6 -3
  530. package/dist/place-card/web/ds-place-card.d.ts +5 -3
  531. package/dist/place-card/web/ds-place-card.js +39 -27
  532. package/dist/plan-chart/plan-chart.d.ts +2 -3
  533. package/dist/plan-chart/web/ds-plan-chart.d.ts +1 -1
  534. package/dist/plan-chart/web/ds-plan-chart.js +34 -6
  535. package/dist/popover/popover.d.ts +7 -3
  536. package/dist/popover/web/ds-popover.d.ts +5 -1
  537. package/dist/popover/web/ds-popover.js +4 -2
  538. package/dist/priority-indicator/native/ds-priority-indicator.js +4 -4
  539. package/dist/priority-indicator/priority-indicator.d.ts +3 -3
  540. package/dist/priority-indicator/priority-indicator.js +3 -3
  541. package/dist/priority-indicator/web/ds-priority-indicator.js +4 -4
  542. package/dist/profile-card/profile-card.d.ts +2 -1
  543. package/dist/profile-card/web/ds-profile-card.d.ts +2 -2
  544. package/dist/profile-card/web/ds-profile-card.js +16 -3
  545. package/dist/progress-bar/native/ds-progress-bar.js +2 -1
  546. package/dist/progress-bar/web/ds-progress-bar.js +2 -1
  547. package/dist/progress-cell/progress-cell.d.ts +8 -3
  548. package/dist/progress-cell/progress-cell.js +1 -1
  549. package/dist/progress-cell/web/ds-progress-cell.d.ts +5 -2
  550. package/dist/progress-cell/web/ds-progress-cell.js +6 -2
  551. package/dist/progress-ring/native/ds-progress-ring.js +16 -11
  552. package/dist/progress-ring/progress-ring.d.ts +8 -4
  553. package/dist/progress-ring/progress-ring.js +7 -3
  554. package/dist/progress-ring/web/ds-progress-ring.js +16 -10
  555. package/dist/proportion-bar/native/ds-proportion-bar.d.ts +2 -2
  556. package/dist/proportion-bar/native/ds-proportion-bar.js +18 -7
  557. package/dist/proportion-bar/proportion-bar.d.ts +10 -3
  558. package/dist/proportion-bar/proportion-bar.js +6 -1
  559. package/dist/proportion-bar/web/ds-proportion-bar.d.ts +1 -1
  560. package/dist/proportion-bar/web/ds-proportion-bar.js +21 -14
  561. package/dist/quick-actions/native/ds-quick-actions.js +17 -2
  562. package/dist/quick-actions/quick-actions.d.ts +32 -2
  563. package/dist/quick-actions/quick-actions.js +9 -1
  564. package/dist/quick-actions/web/ds-quick-actions.js +20 -6
  565. package/dist/radar-chart/radar-chart.d.ts +11 -3
  566. package/dist/radar-chart/radar-chart.js +21 -3
  567. package/dist/radar-chart/web/ds-radar-chart.d.ts +1 -1
  568. package/dist/radar-chart/web/ds-radar-chart.js +34 -22
  569. package/dist/radial-progress/native/ds-radial-progress.d.ts +6 -2
  570. package/dist/radial-progress/native/ds-radial-progress.js +34 -11
  571. package/dist/radial-progress/radial-progress.d.ts +11 -2
  572. package/dist/radial-progress/radial-progress.js +9 -0
  573. package/dist/radial-progress/web/ds-radial-progress.d.ts +6 -2
  574. package/dist/radial-progress/web/ds-radial-progress.js +24 -10
  575. package/dist/radio/radio.d.ts +4 -4
  576. package/dist/radio/radio.js +4 -4
  577. package/dist/radio/web/ds-radio.d.ts +6 -2
  578. package/dist/radio/web/ds-radio.js +22 -10
  579. package/dist/radio-group/radio-group.d.ts +41 -5
  580. package/dist/radio-group/radio-group.js +5 -0
  581. package/dist/radio-group/web/ds-radio-group.d.ts +1 -1
  582. package/dist/radio-group/web/ds-radio-group.js +7 -2
  583. package/dist/rating-badge/rating-badge.d.ts +8 -2
  584. package/dist/rating-badge/rating-badge.js +5 -0
  585. package/dist/rating-badge/web/ds-rating-badge.d.ts +2 -2
  586. package/dist/rating-badge/web/ds-rating-badge.js +6 -4
  587. package/dist/recipient-select/recipient-select.d.ts +7 -0
  588. package/dist/recipient-select/recipient-select.js +3 -0
  589. package/dist/recipient-select/web/ds-recipient-select.js +4 -4
  590. package/dist/record-panel/record-panel.d.ts +17 -2
  591. package/dist/record-panel/web/ds-record-panel.d.ts +48 -13
  592. package/dist/record-panel/web/ds-record-panel.js +27 -18
  593. package/dist/reorder-list/reorder-list.d.ts +3 -0
  594. package/dist/reorder-list/web/ds-reorder-list.d.ts +6 -1
  595. package/dist/reorder-list/web/ds-reorder-list.js +6 -4
  596. package/dist/resend-control/native/ds-resend-control.d.ts +24 -0
  597. package/dist/resend-control/native/ds-resend-control.js +73 -0
  598. package/dist/resend-control/resend-control.d.ts +2 -0
  599. package/dist/resend-control/resend-control.js +2 -0
  600. package/dist/resend-control/web/ds-resend-control.js +3 -3
  601. package/dist/route-fields/route-fields.d.ts +79 -0
  602. package/dist/route-fields/route-fields.js +71 -0
  603. package/dist/route-fields/web/ds-route-fields.d.ts +5 -0
  604. package/dist/route-fields/web/ds-route-fields.js +83 -0
  605. package/dist/route-line/web/ds-route-line.js +2 -2
  606. package/dist/save-bar/save-bar.d.ts +1 -1
  607. package/dist/save-bar/save-bar.js +1 -1
  608. package/dist/save-bar/web/ds-save-bar.js +2 -2
  609. package/dist/scanner/scanner.d.ts +1 -1
  610. package/dist/scanner/scanner.js +2 -1
  611. package/dist/scatter-chart/scatter-chart.d.ts +2 -3
  612. package/dist/scatter-chart/web/ds-scatter-chart.d.ts +1 -1
  613. package/dist/scatter-chart/web/ds-scatter-chart.js +13 -4
  614. package/dist/schedule-chart/schedule-chart.d.ts +187 -0
  615. package/dist/schedule-chart/schedule-chart.js +285 -0
  616. package/dist/schedule-chart/web/ds-schedule-chart.d.ts +24 -0
  617. package/dist/schedule-chart/web/ds-schedule-chart.js +143 -0
  618. package/dist/segmented-control/native/ds-segmented-control.d.ts +1 -1
  619. package/dist/segmented-control/native/ds-segmented-control.js +1 -1
  620. package/dist/segmented-control/segmented-control.d.ts +7 -0
  621. package/dist/segmented-control/web/ds-segmented-control.d.ts +1 -1
  622. package/dist/segmented-control/web/ds-segmented-control.js +4 -3
  623. package/dist/select/native/ds-select.js +6 -3
  624. package/dist/select/select.d.ts +5 -0
  625. package/dist/select/web/ds-select.d.ts +14 -1
  626. package/dist/select/web/ds-select.js +22 -12
  627. package/dist/settings-directory/native/ds-settings-directory.js +1 -1
  628. package/dist/settings-directory/web/ds-settings-directory.js +1 -1
  629. package/dist/settings-row/web/ds-settings-row.d.ts +3 -1
  630. package/dist/settings-row/web/ds-settings-row.js +2 -2
  631. package/dist/sheet/web/ds-sheet.js +3 -3
  632. package/dist/side-nav/side-nav.d.ts +2 -1
  633. package/dist/side-nav/web/ds-side-nav-collapse.d.ts +4 -1
  634. package/dist/side-nav/web/ds-side-nav-collapse.js +6 -3
  635. package/dist/side-nav/web/ds-side-nav-header.js +1 -1
  636. package/dist/side-nav/web/ds-side-nav-primary.js +1 -1
  637. package/dist/side-nav/web/ds-side-nav-profile.js +1 -1
  638. package/dist/side-nav/web/ds-side-nav.d.ts +1 -1
  639. package/dist/side-nav/web/ds-side-nav.js +3 -3
  640. package/dist/skeleton/skeleton.d.ts +20 -0
  641. package/dist/skeleton/skeleton.js +4 -0
  642. package/dist/slider/native/ds-slider.js +1 -1
  643. package/dist/small-multiples/small-multiples.d.ts +3 -4
  644. package/dist/small-multiples/small-multiples.js +2 -1
  645. package/dist/small-multiples/web/ds-small-multiples.d.ts +1 -1
  646. package/dist/small-multiples/web/ds-small-multiples.js +8 -2
  647. package/dist/sparkline/sparkline.d.ts +19 -7
  648. package/dist/sparkline/sparkline.js +42 -17
  649. package/dist/sparkline/web/ds-sparkline.d.ts +1 -1
  650. package/dist/sparkline/web/ds-sparkline.js +4 -3
  651. package/dist/split-pane/web/ds-split-pane.js +2 -2
  652. package/dist/stat-tile/native/ds-stat-tile.d.ts +3 -3
  653. package/dist/stat-tile/native/ds-stat-tile.js +14 -7
  654. package/dist/stat-tile/stat-tile.d.ts +14 -8
  655. package/dist/stat-tile/web/ds-stat-tile.d.ts +4 -2
  656. package/dist/stat-tile/web/ds-stat-tile.js +8 -5
  657. package/dist/state-message/web/ds-state-message.d.ts +6 -2
  658. package/dist/state-message/web/ds-state-message.js +5 -2
  659. package/dist/status-badge/native/ds-status-badge.js +3 -3
  660. package/dist/status-badge/status-badge.d.ts +3 -3
  661. package/dist/status-badge/status-badge.js +1 -1
  662. package/dist/status-badge/web/ds-status-badge.js +4 -4
  663. package/dist/status-cell/status-cell.d.ts +5 -2
  664. package/dist/status-cell/web/ds-status-cell.d.ts +6 -2
  665. package/dist/status-cell/web/ds-status-cell.js +7 -2
  666. package/dist/status-control/web/ds-status-control.js +3 -3
  667. package/dist/status-dot/native/ds-status-dot.js +1 -1
  668. package/dist/status-dot/status-dot.d.ts +2 -2
  669. package/dist/status-dot/status-dot.js +2 -2
  670. package/dist/status-dot/web/ds-status-dot.js +2 -2
  671. package/dist/stepper-form/stepper-form.d.ts +27 -4
  672. package/dist/stepper-form/stepper-form.js +17 -9
  673. package/dist/stepper-form/web/ds-stepper-form.d.ts +1 -1
  674. package/dist/stepper-form/web/ds-stepper-form.js +7 -5
  675. package/dist/stick-chart/stick-chart.d.ts +2 -1
  676. package/dist/stick-chart/stick-chart.js +2 -1
  677. package/dist/stick-chart/web/ds-stick-chart.d.ts +1 -1
  678. package/dist/stick-chart/web/ds-stick-chart.js +17 -3
  679. package/dist/switch/native/ds-switch.js +1 -1
  680. package/dist/system-state/native/ds-system-state.d.ts +29 -0
  681. package/dist/system-state/native/ds-system-state.js +68 -0
  682. package/dist/system-state/system-state.js +4 -3
  683. package/dist/system-state/web/ds-system-state.js +2 -2
  684. package/dist/table-toolbar/web/ds-table-toolbar.js +1 -1
  685. package/dist/tabs/tabs.d.ts +5 -0
  686. package/dist/tabs/tabs.js +2 -0
  687. package/dist/tabs/web/ds-tabs.js +2 -2
  688. package/dist/task-shell/task-shell.d.ts +15 -6
  689. package/dist/task-shell/task-shell.js +5 -2
  690. package/dist/task-shell/web/ds-task-shell.d.ts +21 -6
  691. package/dist/task-shell/web/ds-task-shell.js +52 -18
  692. package/dist/text/native/ds-text.js +1 -1
  693. package/dist/text/text.d.ts +1 -1
  694. package/dist/text/text.js +1 -1
  695. package/dist/text/web/ds-text.js +1 -1
  696. package/dist/textarea/native/ds-textarea.d.ts +1 -1
  697. package/dist/textarea/native/ds-textarea.js +9 -8
  698. package/dist/textarea/web/ds-textarea.d.ts +1 -1
  699. package/dist/textarea/web/ds-textarea.js +8 -7
  700. package/dist/time-field/time-field.d.ts +37 -0
  701. package/dist/time-field/time-field.js +23 -0
  702. package/dist/time-field/web/ds-time-field.d.ts +8 -0
  703. package/dist/time-field/web/ds-time-field.js +28 -0
  704. package/dist/time-range/time-range.d.ts +35 -26
  705. package/dist/time-range/time-range.js +28 -46
  706. package/dist/time-range/web/ds-time-range.d.ts +1 -1
  707. package/dist/time-range/web/ds-time-range.js +9 -6
  708. package/dist/timeline/native/ds-timeline.d.ts +2 -2
  709. package/dist/timeline/native/ds-timeline.js +21 -7
  710. package/dist/timeline/timeline.d.ts +2 -1
  711. package/dist/timeline/web/ds-timeline.d.ts +2 -2
  712. package/dist/timeline/web/ds-timeline.js +18 -9
  713. package/dist/toast/native/ds-toast.js +1 -1
  714. package/dist/toggle-group/native/ds-toggle-group.js +1 -1
  715. package/dist/token-roles.d.ts +1 -1
  716. package/dist/token-roles.js +18 -0
  717. package/dist/tone.d.ts +4 -4
  718. package/dist/tone.js +1 -5
  719. package/dist/toolbar/toolbar.d.ts +19 -7
  720. package/dist/toolbar/toolbar.js +4 -3
  721. package/dist/toolbar/web/ds-toolbar.d.ts +5 -2
  722. package/dist/toolbar/web/ds-toolbar.js +3 -3
  723. package/dist/track-bars/track-bars.d.ts +3 -4
  724. package/dist/track-bars/web/ds-track-bars.d.ts +1 -1
  725. package/dist/track-bars/web/ds-track-bars.js +9 -3
  726. package/dist/tree/tree.d.ts +1 -1
  727. package/dist/tree/tree.js +1 -1
  728. package/dist/tree/web/ds-tree.js +2 -2
  729. package/dist/treemap/treemap.d.ts +2 -3
  730. package/dist/treemap/web/ds-treemap.d.ts +1 -1
  731. package/dist/treemap/web/ds-treemap.js +14 -3
  732. package/dist/two-line-cell/two-line-cell.d.ts +5 -2
  733. package/dist/two-line-cell/web/ds-two-line-cell.d.ts +1 -1
  734. package/dist/two-line-cell/web/ds-two-line-cell.js +5 -1
  735. package/dist/vehicle-marker/vehicle-marker.d.ts +5 -4
  736. package/dist/vehicle-marker/vehicle-marker.js +3 -3
  737. package/dist/vehicle-marker/web/ds-vehicle-marker.js +9 -6
  738. package/dist/waterfall-chart/waterfall-chart.d.ts +10 -5
  739. package/dist/waterfall-chart/waterfall-chart.js +17 -12
  740. package/dist/waterfall-chart/web/ds-waterfall-chart.d.ts +7 -2
  741. package/dist/waterfall-chart/web/ds-waterfall-chart.js +49 -11
  742. package/dist/web.d.ts +20 -5
  743. package/dist/web.js +10 -2
  744. package/dist/week-schedule/web/ds-week-schedule.d.ts +1 -1
  745. package/dist/week-schedule/web/ds-week-schedule.js +4 -4
  746. package/dist/week-schedule/week-schedule.d.ts +23 -4
  747. package/dist/week-schedule/week-schedule.js +19 -13
  748. package/forced-colors.css +8 -5
  749. package/package.json +10 -15
@@ -156,14 +156,14 @@ export function conditionPositions(tree) {
156
156
  walk(tree, '');
157
157
  return positions;
158
158
  }
159
- export function nodeLabel(tree, id) {
159
+ export function nodeLabel(tree, id, copy = CONDITION_BUILDER_COPY) {
160
160
  if (tree.id === id)
161
- return 'All conditions';
161
+ return copy.allConditions;
162
162
  const node = findNode(tree, id);
163
163
  const position = conditionPositions(tree).get(id);
164
164
  if (node === undefined || position === undefined)
165
165
  return '';
166
- return `${node.kind === 'group' ? 'Group' : 'Condition'} ${position}`;
166
+ return node.kind === 'group' ? copy.group(position) : copy.condition(position);
167
167
  }
168
168
  export function createCondition(id) {
169
169
  return { kind: 'condition', id };
@@ -550,12 +550,14 @@ export function describeCondition(schema, condition, describe) {
550
550
  }
551
551
  export function describeConditions(tree, schema, options = {}) {
552
552
  const walk = (group, nested) => {
553
- const parts = group.children.map((child) => child.kind === 'group'
553
+ if (nested && group.children.length === 0)
554
+ return PENDING;
555
+ const parts = group.children
556
+ .map((child) => child.kind === 'group'
554
557
  ? walk(child, true)
555
- : describeCondition(schema, child, options.describeValue));
556
- const joined = parts
557
- .filter((part) => part !== '')
558
- .join(group.conjunction === 'all' ? ' and ' : ' or ');
558
+ : describeCondition(schema, child, options.describeValue))
559
+ .filter((part) => part !== '');
560
+ const joined = parts.join(group.conjunction === 'all' ? ' and ' : ' or ');
559
561
  return nested && parts.length > 1 ? `(${joined})` : joined;
560
562
  };
561
563
  const sentence = walk(tree, false);
@@ -568,27 +570,68 @@ export const CONDITION_CONJUNCTION_LABELS = {
568
570
  export function conditionJoinWord(conjunction) {
569
571
  return conjunction === 'all' ? 'and' : 'or';
570
572
  }
571
- export function conditionGroupLabel(tree, groupId, rootLabel) {
573
+ function lowerFirst(text) {
574
+ return text.charAt(0).toLowerCase() + text.slice(1);
575
+ }
576
+ export const CONDITION_BUILDER_COPY = {
577
+ empty: 'No conditions yet. This rule applies to every request.',
578
+ allConditions: 'All conditions',
579
+ condition: (position) => `Condition ${position}`,
580
+ group: (position) => `Group ${position}`,
581
+ all: CONDITION_CONJUNCTION_LABELS.all,
582
+ any: CONDITION_CONJUNCTION_LABELS.any,
583
+ and: 'and',
584
+ or: 'or',
585
+ where: 'Where',
586
+ match: 'Match',
587
+ groupMatch: (name) => `${name}: match`,
588
+ ofTheFollowing: 'of the following',
589
+ groupLabel: (name, conjunction) => `${name}, match ${conjunction} of`,
590
+ matchLabel: (name) => `${name}, match`,
591
+ fieldLabel: (name) => `${name}, field`,
592
+ comparisonLabel: (name) => `${name}, comparison`,
593
+ valueLabel: (name) => `${name}, value`,
594
+ fromLabel: (name) => `${name}, from`,
595
+ toLabel: (name) => `${name}, to`,
596
+ inUnit: (label, unit) => `${label} in ${unit}`,
597
+ dateLabel: (label, date) => `${label}, ${date}`,
598
+ date: (iso) => formatConditionDate(iso),
599
+ operator: (operator) => operator.label,
600
+ chooseField: 'Choose a field',
601
+ comparison: 'Comparison',
602
+ choose: 'Choose…',
603
+ rangeAnd: 'and',
604
+ rangeTo: 'to',
605
+ duplicate: (name) => `Duplicate ${name.toLowerCase()}`,
606
+ remove: (name) => `Remove ${name.toLowerCase()}`,
607
+ addCondition: 'Add condition',
608
+ addConditionTo: (name) => `Add condition to ${name.toLowerCase()}`,
609
+ addGroup: 'Add group',
610
+ addGroupTo: (name) => `Add group to ${name.toLowerCase()}`,
611
+ added: (name, parent) => parent === undefined ? `${name} added.` : `${name} added to ${lowerFirst(parent)}.`,
612
+ groupMatches: (conjunction) => `It matches ${conjunction} of its conditions.`,
613
+ removed: (name) => `${name} removed.`,
614
+ removedWithGroup: (name, group) => `${name} removed and ${lowerFirst(group)} with it.`,
615
+ copied: (name, copy) => `${name} copied. The copy is ${lowerFirst(copy)}.`,
616
+ };
617
+ export function conditionGroupLabel(tree, groupId, rootLabel, copy = CONDITION_BUILDER_COPY) {
572
618
  const group = findNode(tree, groupId);
573
619
  if (group?.kind !== 'group')
574
620
  return '';
575
- const name = group.id === tree.id ? rootLabel : nodeLabel(tree, groupId);
576
- return `${name}, match ${CONDITION_CONJUNCTION_LABELS[group.conjunction]} of`;
621
+ const name = group.id === tree.id ? rootLabel : nodeLabel(tree, groupId, copy);
622
+ return copy.groupLabel(name, copy[group.conjunction]);
577
623
  }
578
624
  export const CONDITION_CHANGE_KINDS = ['added', 'removed', 'duplicated'];
579
- function lowerFirst(text) {
580
- return text.charAt(0).toLowerCase() + text.slice(1);
581
- }
582
- export function conditionChangeAnnouncement(kind, before, after, id) {
625
+ export function conditionChangeAnnouncement(kind, before, after, id, words = CONDITION_BUILDER_COPY) {
583
626
  if (kind === 'removed') {
584
- const name = nodeLabel(before, id);
627
+ const name = nodeLabel(before, id, words);
585
628
  if (name === '')
586
629
  return '';
587
630
  const parent = findParent(before, id);
588
631
  const pruned = parent !== undefined && parent.id !== before.id && findNode(after, parent.id) === undefined;
589
632
  return pruned
590
- ? `${name} removed and ${lowerFirst(nodeLabel(before, parent.id))} with it.`
591
- : `${name} removed.`;
633
+ ? words.removedWithGroup(name, nodeLabel(before, parent.id, words))
634
+ : words.removed(name);
592
635
  }
593
636
  if (kind === 'duplicated') {
594
637
  const parent = findParent(after, id);
@@ -596,20 +639,17 @@ export function conditionChangeAnnouncement(kind, before, after, id) {
596
639
  const copy = parent?.children[index + 1];
597
640
  if (copy === undefined)
598
641
  return '';
599
- return `${nodeLabel(after, id)} copied. The copy is ${lowerFirst(nodeLabel(after, copy.id))}.`;
642
+ return words.copied(nodeLabel(after, id, words), nodeLabel(after, copy.id, words));
600
643
  }
601
- const name = nodeLabel(after, id);
644
+ const name = nodeLabel(after, id, words);
602
645
  if (name === '')
603
646
  return '';
604
647
  const parent = findParent(after, id);
605
- const where = parent === undefined || parent.id === after.id
606
- ? ''
607
- : ` to ${lowerFirst(nodeLabel(after, parent.id))}`;
648
+ const added = words.added(name, parent === undefined || parent.id === after.id
649
+ ? undefined
650
+ : nodeLabel(after, parent.id, words));
608
651
  const node = findNode(after, id);
609
- const match = node?.kind === 'group'
610
- ? ` It matches ${CONDITION_CONJUNCTION_LABELS[node.conjunction]} of its conditions.`
611
- : '';
612
- return `${name} added${where}.${match}`;
652
+ return node?.kind === 'group' ? `${added} ${words.groupMatches(words[node.conjunction])}` : added;
613
653
  }
614
654
  export const CONDITION_GROUP_SURFACES = {
615
655
  1: 'background',
@@ -618,7 +658,7 @@ export const CONDITION_GROUP_SURFACES = {
618
658
  };
619
659
  export const CONDITION_GROUP_BORDER = 'border';
620
660
  export const CONDITION_JOIN_INK = 'muted-foreground';
621
- export const CONDITION_ERROR_INK = 'destructive';
661
+ export const CONDITION_ERROR_INK = 'error';
622
662
  export function conditionGroupSurface(depth) {
623
663
  const clamped = Math.min(Math.max(Math.round(depth), 1), CONDITION_MAX_DEPTH);
624
664
  return CONDITION_GROUP_SURFACES[clamped];
@@ -14,6 +14,8 @@ export interface DSConditionValueSlot {
14
14
  /** The id of the error message, to set as the editor's `aria-describedby`. */
15
15
  describedBy: string | undefined;
16
16
  disabled: boolean;
17
+ /** The builder is read-only: show the value, take no change. */
18
+ readOnly: boolean;
17
19
  }
18
20
  /** The words and the clock a date value's calendar panel needs. This package owns no copy, so each
19
21
  * is the caller's. Given, a `date` condition chooses its day in the design system's date panel
@@ -40,7 +42,7 @@ export type DSConditionBuilderProps = Omit<ComponentProps<'div'>, 'children' | '
40
42
  makeId?: () => string;
41
43
  /** The height of every control in the builder. */
42
44
  size?: Size;
43
- /** What an empty builder says in place of its rows. */
45
+ /** What an empty builder says in place of its rows. Wins over `copy.empty`. */
44
46
  emptyLabel?: string;
45
47
  /** Choose a `date` value in the date panel rather than a typed field. */
46
48
  datePanel?: DSConditionDatePanel;
@@ -48,5 +50,5 @@ export type DSConditionBuilderProps = Omit<ComponentProps<'div'>, 'children' | '
48
50
  chipsSearchLabel?: string;
49
51
  };
50
52
  /** An editor for the "if" of a rule: groups that match all or any of their conditions, nested up to three deep. */
51
- export declare function DSConditionBuilder({ value, onValueChange, schema, errors, label, disabled, renderValue, makeId, size, emptyLabel, datePanel, chipsSearchLabel, className, ...props }: DSConditionBuilderProps): import("react/jsx-runtime").JSX.Element;
53
+ export declare function DSConditionBuilder({ value, onValueChange, schema, errors, label, disabled, readOnly, renderValue, makeId, size, emptyLabel, datePanel, chipsSearchLabel, copy, className, ref, ...props }: DSConditionBuilderProps): import("react/jsx-runtime").JSX.Element;
52
54
  export {};
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useId, useRef, useState } from 'react';
3
- import { Brackets, Copy, Plus, Trash2 } from 'lucide-react';
4
- import { CONDITION_CONJUNCTIONS, CONDITION_CONJUNCTION_LABELS, addCondition, addGroup, canAddGroup, changeField, changeOperator, conditionChangeAnnouncement, conditionErrorFor, conditionField, conditionGroupLabel, conditionGroupSurface, conditionJoinWord, conditionOperator, conditionOperators, duplicateNode, focusAfterRemoval, nodeDepth, nodeLabel, removeNode, setConjunction, updateNode, formatConditionDate, CONDITION_GROUP_BORDER, CONDITION_JOIN_INK, } from '../condition-builder';
2
+ import { useCallback, useEffect, useId, useRef, useState, } from 'react';
3
+ import { Brackets, CalendarDays, Copy, Plus, Trash2 } from 'lucide-react';
4
+ import { CONDITION_BUILDER_COPY, CONDITION_CONJUNCTIONS, addCondition, addGroup, canAddGroup, changeField, changeOperator, conditionChangeAnnouncement, conditionErrorFor, conditionField, conditionGroupLabel, conditionGroupSurface, conditionJoinWord, conditionOperator, conditionOperators, duplicateNode, focusAfterRemoval, nodeDepth, nodeLabel, removeNode, setConjunction, updateNode, CONDITION_GROUP_BORDER, CONDITION_JOIN_INK, } from '../condition-builder';
5
5
  import { DSSelect } from '../../select/web/ds-select';
6
- import { DSInput } from '../../input/web/ds-input';
6
+ import { DSInput, INPUT_TEXT } from '../../input/web/ds-input';
7
7
  import { DSButton } from '../../button/web/ds-button';
8
8
  import { DSHelperText } from '../../helper-text/web/ds-helper-text';
9
9
  import { DSIconButton } from '../../icon-button/web/ds-icon-button';
@@ -12,21 +12,44 @@ import { DSMultiSelect } from '../../multi-select/web/ds-multi-select';
12
12
  import { DSDatePicker } from '../../date-picker/web/ds-date-picker';
13
13
  import { DSText } from '../../text/web/ds-text';
14
14
  import { announceLive } from '../../lib/web/live-announcer';
15
+ import { assignRef } from '../../lib/web/assign-ref';
15
16
  import { cn } from '../../lib/cn';
17
+ import { COMPACT_HEIGHT } from '../../lib/web/density';
16
18
  const GROUP_SURFACE = {
17
19
  background: 'bg-background',
18
20
  muted: 'bg-muted',
19
21
  };
20
- const GROUP_BORDER = { border: 'border-border' };
22
+ const GROUP_BORDER = {
23
+ border: 'border-border',
24
+ };
21
25
  const JOIN_INK = {
22
26
  'muted-foreground': 'text-muted-foreground',
23
27
  };
24
28
  const STACK = '@container';
25
29
  const FIRST_LINE = {
26
- sm: '@lg:min-h-9 compact:@lg:min-h-7',
27
- md: '@lg:min-h-12 compact:@lg:min-h-8',
30
+ sm: '@lg:min-h-9 compact:@lg:min-h-dense-compact',
31
+ md: '@lg:min-h-10.5 compact:@lg:min-h-dense-field',
28
32
  };
29
33
  const ROW_CONTROL = 'compact:size-8';
34
+ const DATE_TRIGGER = {
35
+ sm: cn('min-h-9', INPUT_TEXT.sm, COMPACT_HEIGHT.compact),
36
+ md: cn('min-h-10.5', INPUT_TEXT.field, COMPACT_HEIGHT.field),
37
+ };
38
+ const NUMBER_INPUT = {
39
+ type: 'number',
40
+ inputMode: 'decimal',
41
+ step: 'any',
42
+ };
43
+ const FIELD_SEARCH = {
44
+ searchLabel: 'Search fields',
45
+ searchPlaceholder: 'Search',
46
+ emptyLabel: 'No fields match.',
47
+ };
48
+ const OPTION_SEARCH = {
49
+ searchLabel: 'Search options',
50
+ searchPlaceholder: 'Search',
51
+ emptyLabel: 'No options match.',
52
+ };
30
53
  function findMarked(root, attribute, value) {
31
54
  if (root === null)
32
55
  return null;
@@ -48,73 +71,78 @@ function numberFrom(raw) {
48
71
  const asNumber = Number(raw);
49
72
  return Number.isFinite(asNumber) ? asNumber : undefined;
50
73
  }
51
- function DateValue({ label, value, panel, invalid, describedBy, disabled, onValue, }) {
74
+ function DateValue({ label, value, panel, invalid, describedBy, disabled, readOnly, size, onValue, words, }) {
52
75
  const [open, setOpen] = useState(false);
53
- return (_jsx(DSDatePicker, { mode: "single", label: label, open: open, onOpenChange: setOpen, value: { from: value ?? null, to: value ?? null }, ...(panel.today === undefined ? {} : { today: panel.today }), applyLabel: panel.applyLabel, clearLabel: panel.clearLabel, previousLabel: panel.previousLabel, nextLabel: panel.nextLabel, dateLabel: panel.dateLabel, startDateLabel: panel.startDateLabel, endDateLabel: panel.endDateLabel, onValueChange: (next) => {
76
+ if (readOnly) {
77
+ return (_jsx(DSInput, { size: size, readOnly: true, "aria-label": label, invalid: invalid, value: value === undefined ? '' : words.date(value), className: "tabular-nums", ...(describedBy === undefined ? {} : { 'aria-describedby': describedBy }) }));
78
+ }
79
+ return (_jsx(DSDatePicker, { mode: "single", className: "flex w-full", label: label, open: open, onOpenChange: setOpen, value: { from: value ?? null, to: value ?? null }, ...(panel.today === undefined ? {} : { today: panel.today }), applyLabel: panel.applyLabel, clearLabel: panel.clearLabel, previousLabel: panel.previousLabel, nextLabel: panel.nextLabel, dateLabel: panel.dateLabel, startDateLabel: panel.startDateLabel, endDateLabel: panel.endDateLabel, onValueChange: (next) => {
54
80
  onValue(next.from ?? undefined);
55
- }, trigger: _jsx(DSButton, { variant: "secondary", "aria-label": `${label}${value === undefined ? '' : `, ${formatConditionDate(value)}`}`, "aria-haspopup": "dialog", "aria-expanded": open, "aria-invalid": invalid, ...(describedBy === undefined ? {} : { 'aria-describedby': describedBy }), disabled: disabled, onClick: () => {
81
+ }, trigger: _jsxs("button", { type: "button", "aria-label": value === undefined ? label : words.dateLabel(label, words.date(value)), "aria-haspopup": "dialog", "aria-expanded": open, "aria-invalid": invalid, ...(describedBy === undefined ? {} : { 'aria-describedby': describedBy }), disabled: disabled, onClick: () => {
56
82
  setOpen((now) => !now);
57
- }, children: value === undefined ? panel.placeholder : formatConditionDate(value) }) }));
83
+ }, className: cn('flex w-full cursor-pointer items-center justify-between gap-2 rounded-field border bg-field px-field-x text-left font-normal text-card-foreground tabular-nums transition-control focusable-field state-layer-press enabled:hover:bg-field-hover', invalid ? 'border-error' : 'border-field-edge state-layer-edge', 'disabled:cursor-not-allowed disabled:border-disabled-border disabled:bg-disabled disabled:text-disabled-foreground', DATE_TRIGGER[size]), children: [_jsx("span", { className: cn('min-w-0 flex-1 truncate', value === undefined && !disabled && 'text-muted-foreground'), children: value === undefined ? panel.placeholder : words.date(value) }), _jsx(CalendarDays, { "aria-hidden": true, className: "size-4 shrink-0 text-muted-foreground" })] }) }));
58
84
  }
59
- function ChipsValue({ field, label, chosen, invalid, describedBy, disabled, searchLabel, onValue, }) {
85
+ function ChipsValue({ field, label, chosen, invalid, describedBy, disabled, readOnly, searchLabel, onValue, }) {
60
86
  const [query, setQuery] = useState('');
61
- return (_jsx(DSMultiSelect, { label: label, options: field.options ?? [], value: [...chosen], query: query, invalid: invalid, describedBy: describedBy, disabled: disabled, ...(searchLabel === undefined ? {} : { placeholder: searchLabel }), onQueryChange: setQuery, onValueChange: onValue }));
87
+ return (_jsx(DSMultiSelect, { label: label, options: field.options ?? [], value: [...chosen], query: query, invalid: invalid, describedBy: describedBy, disabled: disabled, readOnly: readOnly, ...(searchLabel === undefined ? {} : { placeholder: searchLabel }), onQueryChange: setQuery, onValueChange: onValue }));
62
88
  }
63
- function ValueEditor({ field, operator, value, name, invalid, describedBy, disabled, size, onValue, renderValue, datePanel, chipsSearchLabel, }) {
64
- const label = `${name}, value`;
89
+ function ValueEditor({ field, operator, value, name, invalid, describedBy, disabled, readOnly, size, onValue, renderValue, datePanel, chipsSearchLabel, words, }) {
90
+ const label = words.valueLabel(name);
65
91
  const described = describedBy === undefined ? {} : { 'aria-describedby': describedBy };
66
- const currency = field.currency === undefined ? null : (_jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: "shrink-0 text-muted-foreground", children: field.currency }));
67
- const unit = field.unit === undefined || field.currency !== undefined ? null : (_jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: "shrink-0 text-muted-foreground", children: field.unit }));
92
+ const affix = {
93
+ ...(field.currency === undefined ? {} : { leading: field.currency }),
94
+ ...(field.unit === undefined || field.currency !== undefined ? {} : { trailing: field.unit }),
95
+ };
68
96
  const measure = field.currency ?? field.unit;
69
- const unitLabel = measure === undefined ? '' : ` in ${measure}`;
97
+ const inUnit = (named) => (measure === undefined ? named : words.inUnit(named, measure));
70
98
  switch (operator.input) {
71
99
  case 'none':
72
100
  return null;
73
101
  case 'text':
74
- return (_jsx(DSInput, { size: size, "aria-label": label, invalid: invalid, disabled: disabled, value: typeof value === 'string' ? value : '', onValueChange: onValue, ...described }));
102
+ return (_jsx(DSInput, { size: size, "aria-label": label, invalid: invalid, disabled: disabled, readOnly: readOnly, value: typeof value === 'string' ? value : '', onValueChange: onValue, ...described }));
75
103
  case 'number':
76
- return (_jsxs("div", { className: "flex items-center gap-2", children: [currency, _jsx(DSInput, { type: "number", inputMode: "decimal", size: size, "aria-label": `${label}${unitLabel}`, invalid: invalid, disabled: disabled, min: field.min, max: field.max, value: typeof value === 'number' ? String(value) : '', onValueChange: (value) => {
77
- onValue(numberFrom(value));
78
- }, className: "tabular-nums", ...described }), unit] }));
104
+ return (_jsx(DSInput, { ...NUMBER_INPUT, size: size, ...affix, "aria-label": inUnit(label), invalid: invalid, disabled: disabled, readOnly: readOnly, min: field.min, max: field.max, value: typeof value === 'number' ? String(value) : '', onValueChange: (value) => {
105
+ onValue(numberFrom(value));
106
+ }, className: "tabular-nums", ...described }));
79
107
  case 'number-range': {
80
108
  const span = spanValue(value);
81
- return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [currency, _jsx(DSInput, { type: "number", inputMode: "decimal", size: size, "aria-label": `${name}, from${unitLabel}`, invalid: invalid, disabled: disabled, value: typeof span.from === 'number' ? String(span.from) : '', onValueChange: (value) => {
82
- onValue({
83
- ...span,
84
- from: numberFrom(value),
85
- });
86
- }, className: "w-28 tabular-nums", ...described }), _jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: "text-muted-foreground", children: "and" }), currency, _jsx(DSInput, { type: "number", inputMode: "decimal", size: size, "aria-label": `${name}, to${unitLabel}`, invalid: invalid, disabled: disabled, value: typeof span.to === 'number' ? String(span.to) : '', onValueChange: (value) => {
87
- onValue({ ...span, to: numberFrom(value) });
88
- }, className: "w-28 tabular-nums", ...described }), unit] }));
109
+ return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("div", { className: "min-w-24 flex-1", children: _jsx(DSInput, { ...NUMBER_INPUT, size: size, ...affix, "aria-label": inUnit(words.fromLabel(name)), invalid: invalid, disabled: disabled, readOnly: readOnly, value: typeof span.from === 'number' ? String(span.from) : '', onValueChange: (value) => {
110
+ onValue({
111
+ ...span,
112
+ from: numberFrom(value),
113
+ });
114
+ }, className: "tabular-nums", ...described }) }), _jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: "text-muted-foreground", children: words.rangeAnd }), _jsx("div", { className: "min-w-24 flex-1", children: _jsx(DSInput, { ...NUMBER_INPUT, size: size, ...affix, "aria-label": inUnit(words.toLabel(name)), invalid: invalid, disabled: disabled, readOnly: readOnly, value: typeof span.to === 'number' ? String(span.to) : '', onValueChange: (value) => {
115
+ onValue({ ...span, to: numberFrom(value) });
116
+ }, className: "tabular-nums", ...described }) })] }));
89
117
  }
90
118
  case 'option':
91
- return (_jsx(DSSelect, { size: size, "aria-label": label, ...described, placeholder: "Choose\u2026", invalid: invalid, disabled: disabled, options: field.options ?? [], value: typeof value === 'string' ? value : undefined, onValueChange: onValue }));
119
+ return (_jsx(DSSelect, { size: size, "aria-label": label, ...described, placeholder: words.choose, ...OPTION_SEARCH, invalid: invalid, disabled: disabled, readOnly: readOnly, options: field.options ?? [], value: typeof value === 'string' ? value : undefined, onValueChange: onValue }));
92
120
  case 'options': {
93
121
  const chosen = Array.isArray(value) ? value : [];
94
122
  if (field.chips === true) {
95
- return (_jsx(ChipsValue, { field: field, label: label, chosen: chosen, invalid: invalid, describedBy: describedBy, disabled: disabled, searchLabel: chipsSearchLabel, onValue: onValue }));
123
+ return (_jsx(ChipsValue, { field: field, label: label, chosen: chosen, invalid: invalid, describedBy: describedBy, disabled: disabled, readOnly: readOnly, searchLabel: chipsSearchLabel, onValue: onValue }));
96
124
  }
97
- return (_jsx("div", { role: "group", "aria-label": label, ...described, className: "flex min-h-9 flex-wrap items-center gap-x-4 gap-y-2", children: (field.options ?? []).map((option) => (_jsxs("label", { className: "inline-flex cursor-pointer items-center gap-2 text-body-sm", children: [_jsx(DSCheckbox, { size: "sm", invalid: invalid, disabled: disabled, checked: chosen.includes(option.value), onCheckedChange: (on) => {
125
+ return (_jsx("div", { role: "group", "aria-label": label, ...described, className: "flex min-h-9 flex-wrap items-center gap-x-4 gap-y-2", children: (field.options ?? []).map((option) => (_jsxs("label", { className: cn('inline-flex items-center gap-2 text-body-sm has-[:disabled]:cursor-not-allowed has-[:disabled]:text-disabled-foreground', readOnly ? 'cursor-default' : 'cursor-pointer'), children: [_jsx(DSCheckbox, { size: "sm", invalid: invalid, disabled: disabled, readOnly: readOnly, checked: chosen.includes(option.value), onCheckedChange: (on) => {
98
126
  onValue(on ? [...chosen, option.value] : chosen.filter((item) => item !== option.value));
99
127
  } }), option.label] }, option.value))) }));
100
128
  }
101
129
  case 'date':
102
130
  if (datePanel !== undefined) {
103
- return (_jsx(DateValue, { label: label, value: typeof value === 'string' ? value : undefined, panel: datePanel, invalid: invalid, describedBy: describedBy, disabled: disabled, onValue: onValue }));
131
+ return (_jsx(DateValue, { label: label, value: typeof value === 'string' ? value : undefined, panel: datePanel, invalid: invalid, describedBy: describedBy, disabled: disabled, readOnly: readOnly, size: size, onValue: onValue, words: words }));
104
132
  }
105
- return (_jsx(DSInput, { type: "date", size: size, "aria-label": label, invalid: invalid, disabled: disabled, value: typeof value === 'string' ? value : '', onValueChange: (value) => {
133
+ return (_jsx(DSInput, { type: "date", size: size, "aria-label": label, invalid: invalid, disabled: disabled, readOnly: readOnly, value: typeof value === 'string' ? value : '', onValueChange: (value) => {
106
134
  onValue(value === '' ? undefined : value);
107
135
  }, ...described }));
108
136
  case 'date-range':
109
137
  case 'time-range': {
110
138
  const span = spanValue(value);
111
139
  const type = operator.input === 'date-range' ? 'date' : 'time';
112
- return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(DSInput, { type: type, size: size, "aria-label": `${name}, from`, invalid: invalid, disabled: disabled, value: span.from ?? '', onValueChange: (value) => {
140
+ return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(DSInput, { type: type, size: size, "aria-label": words.fromLabel(name), invalid: invalid, disabled: disabled, readOnly: readOnly, value: span.from ?? '', onValueChange: (value) => {
113
141
  onValue({
114
142
  ...span,
115
143
  from: value === '' ? undefined : value,
116
144
  });
117
- }, className: "w-auto tabular-nums", ...described }), _jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: "text-muted-foreground", children: operator.input === 'date-range' ? 'and' : 'to' }), _jsx(DSInput, { type: type, size: size, "aria-label": `${name}, to`, invalid: invalid, disabled: disabled, value: span.to ?? '', onValueChange: (value) => {
145
+ }, className: "w-auto tabular-nums", ...described }), _jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: "text-muted-foreground", children: operator.input === 'date-range' ? words.rangeAnd : words.rangeTo }), _jsx(DSInput, { type: type, size: size, "aria-label": words.toLabel(name), invalid: invalid, disabled: disabled, readOnly: readOnly, value: span.to ?? '', onValueChange: (value) => {
118
146
  onValue({ ...span, to: value === '' ? undefined : value });
119
147
  }, className: "w-auto tabular-nums", ...described })] }));
120
148
  }
@@ -129,21 +157,28 @@ function ValueEditor({ field, operator, value, name, invalid, describedBy, disab
129
157
  invalid,
130
158
  describedBy,
131
159
  disabled,
160
+ readOnly,
132
161
  });
133
162
  }
134
163
  if (process.env['NODE_ENV'] !== 'production') {
135
164
  console.error(`DSConditionBuilder: "${field.key}" is a ${field.type} field and needs \`renderValue\` to draw its value editor. Falling back to a text box.`);
136
165
  }
137
- return (_jsx(DSInput, { size: size, "aria-label": label, invalid: invalid, disabled: disabled, value: typeof value === 'string' ? value : '', onValueChange: onValue, ...described }));
166
+ return (_jsx(DSInput, { size: size, "aria-label": label, invalid: invalid, disabled: disabled, readOnly: readOnly, value: typeof value === 'string' ? value : '', onValueChange: onValue, ...described }));
138
167
  }
139
168
  }
140
169
  }
141
- export function DSConditionBuilder({ value, onValueChange, schema, errors = {}, label, disabled = false, renderValue, makeId, size = 'md', emptyLabel = 'No conditions yet. This rule applies to every request.', datePanel, chipsSearchLabel, className, ...props }) {
170
+ export function DSConditionBuilder({ value, onValueChange, schema, errors = {}, label, disabled = false, readOnly = false, renderValue, makeId, size = 'md', emptyLabel, datePanel, chipsSearchLabel, copy, className, ref, ...props }) {
171
+ const words = { ...CONDITION_BUILDER_COPY, ...copy };
142
172
  const baseId = useId();
143
173
  const counter = useRef(0);
144
174
  const rootRef = useRef(null);
175
+ const setRoot = useCallback((node) => {
176
+ rootRef.current = node;
177
+ assignRef(ref, node);
178
+ }, [ref]);
145
179
  const pending = useRef(null);
146
180
  const isDisabled = disabled;
181
+ const isReadOnly = readOnly && !isDisabled;
147
182
  const nextId = () => {
148
183
  if (makeId !== undefined)
149
184
  return makeId();
@@ -194,55 +229,60 @@ export function DSConditionBuilder({ value, onValueChange, schema, errors = {},
194
229
  : { value: field.key, label: field.label, group: field.group });
195
230
  const conjunctionOptions = CONDITION_CONJUNCTIONS.map((conjunction) => ({
196
231
  value: conjunction,
197
- label: CONDITION_CONJUNCTION_LABELS[conjunction],
232
+ label: words[conjunction],
198
233
  }));
199
234
  function rowActions(id, name) {
235
+ if (isReadOnly)
236
+ return null;
200
237
  return (_jsxs(_Fragment, { children: [_jsx(DSIconButton, { variant: "ghost", size: "sm", label: `Duplicate ${name.toLowerCase()}`, icon: _jsx(Copy, { "aria-hidden": true }), disabled: isDisabled, className: ROW_CONTROL, onClick: () => {
201
238
  const next = duplicateNode(value, id, nextId);
202
- change(next, undefined, conditionChangeAnnouncement('duplicated', value, next, id));
239
+ change(next, undefined, conditionChangeAnnouncement('duplicated', value, next, id, words));
203
240
  } }), _jsx(DSIconButton, { variant: "ghost", size: "sm", "data-condition-remove": id, label: `Remove ${name.toLowerCase()}`, icon: _jsx(Trash2, { "aria-hidden": true }), disabled: isDisabled, className: ROW_CONTROL, onClick: () => {
204
241
  const next = removeNode(value, id);
205
- change(next, focusAfterRemoval(value, id), conditionChangeAnnouncement('removed', value, next, id));
242
+ change(next, focusAfterRemoval(value, id), conditionChangeAnnouncement('removed', value, next, id, words));
206
243
  } })] }));
207
244
  }
208
245
  function renderCondition(condition) {
209
- const name = nodeLabel(value, condition.id);
246
+ const name = nodeLabel(value, condition.id, words);
210
247
  const error = conditionErrorFor(errors, condition.id);
211
248
  const describedBy = error === undefined ? undefined : errorId(condition.id);
212
249
  const field = conditionField(schema, condition.field);
213
250
  const operator = conditionOperator(field, condition.operator);
214
251
  const operators = conditionOperators(field);
215
- return (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { className: "flex flex-wrap items-start gap-2", children: [_jsx("div", { "data-condition-field": condition.id, className: "w-full @lg:w-48", children: _jsx(DSSelect, { size: size, "aria-label": `${name}, field`, ...(error?.part === 'field' && describedBy !== undefined
252
+ return (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { className: "flex flex-wrap items-start gap-2", children: [_jsx("div", { "data-condition-field": condition.id, className: "w-full @lg:w-48", children: _jsx(DSSelect, { size: size, "aria-label": words.fieldLabel(name), ...(error?.part === 'field' && describedBy !== undefined
216
253
  ? { 'aria-describedby': describedBy }
217
- : {}), placeholder: "Choose a field", invalid: error?.part === 'field', disabled: isDisabled, options: fieldOptions, value: field === undefined ? undefined : field.key, onValueChange: (key) => {
254
+ : {}), placeholder: words.chooseField, ...FIELD_SEARCH, invalid: error?.part === 'field', disabled: isDisabled, readOnly: isReadOnly, options: fieldOptions, value: field === undefined ? undefined : field.key, onValueChange: (key) => {
218
255
  change(updateNode(value, condition.id, changeField(schema, condition, key)));
219
- } }) }), _jsx("div", { className: "w-full @lg:w-44", children: _jsx(DSSelect, { size: size, "aria-label": `${name}, comparison`, ...(error?.part === 'operator' && describedBy !== undefined
256
+ } }) }), _jsx("div", { className: "w-full @lg:w-44", children: _jsx(DSSelect, { size: size, "aria-label": words.comparisonLabel(name), ...(error?.part === 'operator' && describedBy !== undefined
220
257
  ? { 'aria-describedby': describedBy }
221
- : {}), placeholder: "Comparison", invalid: error?.part === 'operator', disabled: isDisabled || field === undefined, options: operators.map((option) => ({ value: option.key, label: option.label })), value: operator?.key, onValueChange: (key) => {
258
+ : {}), placeholder: words.comparison, invalid: error?.part === 'operator', disabled: isDisabled || field === undefined, readOnly: isReadOnly, options: operators.map((option) => ({
259
+ value: option.key,
260
+ label: words.operator(option),
261
+ })), value: operator?.key, onValueChange: (key) => {
222
262
  change(updateNode(value, condition.id, changeOperator(schema, condition, key)));
223
- } }) }), field !== undefined && operator !== undefined && operator.input !== 'none' && (_jsx("div", { className: "w-full @lg:w-auto @lg:min-w-40 @lg:flex-1", children: _jsx(ValueEditor, { field: field, operator: operator, value: condition.value, name: name, invalid: error?.part === 'value', describedBy: error?.part === 'value' ? describedBy : undefined, disabled: isDisabled, size: size, renderValue: renderValue, datePanel: datePanel, chipsSearchLabel: chipsSearchLabel, onValue: (next) => {
263
+ } }) }), field !== undefined && operator !== undefined && operator.input !== 'none' && (_jsx("div", { className: "w-full @lg:w-auto @lg:min-w-40 @lg:flex-1", children: _jsx(ValueEditor, { field: field, operator: operator, value: condition.value, name: name, invalid: error?.part === 'value', describedBy: error?.part === 'value' ? describedBy : undefined, disabled: isDisabled, readOnly: isReadOnly, size: size, renderValue: renderValue, datePanel: datePanel, chipsSearchLabel: chipsSearchLabel, words: words, onValue: (next) => {
224
264
  change(updateNode(value, condition.id, { value: next }));
225
- } }) })), _jsx("div", { className: cn('ms-auto flex shrink-0 items-center gap-1', FIRST_LINE[size]), children: rowActions(condition.id, name) })] }), error !== undefined && describedBy !== undefined && (_jsx(ErrorLine, { id: describedBy, error: error }))] }));
265
+ } }) })), !isReadOnly && (_jsx("div", { className: cn('ms-auto flex shrink-0 items-center gap-1', FIRST_LINE[size]), children: rowActions(condition.id, name) }))] }), error !== undefined && describedBy !== undefined && (_jsx(ErrorLine, { id: describedBy, error: error }))] }));
226
266
  }
227
267
  function renderGroup(group) {
228
268
  const isRoot = group.id === value.id;
229
269
  const depth = nodeDepth(value, group.id) ?? 1;
230
- const name = isRoot ? label : nodeLabel(value, group.id);
270
+ const name = isRoot ? label : nodeLabel(value, group.id, words);
231
271
  const headingId = `${baseId}-h-${group.id}`;
232
272
  const error = conditionErrorFor(errors, group.id);
233
273
  const describedBy = error === undefined ? undefined : errorId(group.id);
234
274
  const join = conditionJoinWord(group.conjunction);
235
- return (_jsxs("div", { ...(describedBy === undefined ? {} : { 'aria-describedby': describedBy }), role: "group", "aria-labelledby": headingId, "data-depth": depth, className: cn('flex min-w-0 flex-1 flex-col gap-3', !isRoot && 'rounded-field border p-3', !isRoot && GROUP_BORDER[CONDITION_GROUP_BORDER], GROUP_SURFACE[conditionGroupSurface(depth)]), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { id: headingId, className: "sr-only", children: conditionGroupLabel(value, group.id, label) }), _jsx(DSText, { as: "span", variant: "body-sm", children: isRoot ? 'Match' : `${name}: match` }), _jsx("div", { className: "w-24", children: _jsx(DSSelect, { size: size, "aria-label": `${name}, match`, placeholder: "all", disabled: isDisabled, options: conjunctionOptions, value: group.conjunction, onValueChange: (next) => {
275
+ return (_jsxs("div", { ...(describedBy === undefined ? {} : { 'aria-describedby': describedBy }), role: "group", "aria-labelledby": headingId, "data-depth": depth, className: cn('flex min-w-0 flex-1 flex-col gap-3', !isRoot && 'rounded-field border p-3', !isRoot && GROUP_BORDER[CONDITION_GROUP_BORDER], GROUP_SURFACE[conditionGroupSurface(depth)]), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { id: headingId, className: "sr-only", children: conditionGroupLabel(value, group.id, label, words) }), _jsx(DSText, { as: "span", variant: "body-sm", children: isRoot ? words.match : words.groupMatch(name) }), _jsx("div", { className: "w-24", children: _jsx(DSSelect, { size: size, "aria-label": words.matchLabel(name), placeholder: words.all, disabled: isDisabled, readOnly: isReadOnly, options: conjunctionOptions, value: group.conjunction, onValueChange: (next) => {
236
276
  change(setConjunction(value, group.id, next));
237
- } }) }), _jsx(DSText, { as: "span", variant: "body-sm", children: "of the following" }), !isRoot && (_jsx("div", { className: "ms-auto flex shrink-0 items-center gap-1", children: rowActions(group.id, name) }))] }), error !== undefined && describedBy !== undefined && (_jsx(ErrorLine, { id: describedBy, error: error })), group.children.length === 0 ? (_jsx(DSText, { as: "p", variant: "body-sm", tone: "muted", className: "m-0", children: emptyLabel })) : (_jsx("ol", { className: "m-0 flex list-none flex-col gap-3 p-0", children: group.children.map((child, index) => (_jsxs("li", { className: "flex flex-col gap-1 @lg:flex-row @lg:items-start @lg:gap-2", children: [_jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: cn('@lg:flex @lg:w-12 @lg:shrink-0 @lg:items-center @lg:justify-end', child.kind === 'group' && '@lg:mt-3.25', FIRST_LINE[size], JOIN_INK[CONDITION_JOIN_INK]), children: index === 0 ? 'Where' : join }), child.kind === 'group' ? renderGroup(child) : renderCondition(child)] }, child.id))) })), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(DSButton, { variant: "ghost", size: "sm", "data-condition-add": group.id, disabled: isDisabled, "aria-label": isRoot ? 'Add condition' : `Add condition to ${name.toLowerCase()}`, onClick: () => {
277
+ } }) }), _jsx(DSText, { as: "span", variant: "body-sm", children: words.ofTheFollowing }), !isRoot && !isReadOnly && (_jsx("div", { className: "ms-auto flex shrink-0 items-center gap-1", children: rowActions(group.id, name) }))] }), error !== undefined && describedBy !== undefined && (_jsx(ErrorLine, { id: describedBy, error: error })), group.children.length === 0 ? (isRoot && (_jsx(DSText, { as: "p", variant: "body-sm", tone: "muted", className: "m-0", children: emptyLabel ?? words.empty }))) : (_jsx("ol", { className: "m-0 flex list-none flex-col gap-3 p-0", children: group.children.map((child, index) => (_jsxs("li", { className: "flex flex-col gap-1 @lg:flex-row @lg:items-start @lg:gap-2", children: [_jsx(DSText, { as: "span", variant: "body-sm", "aria-hidden": true, className: cn('@lg:flex @lg:w-12 @lg:shrink-0 @lg:items-center @lg:justify-end', child.kind === 'group' && '@lg:mt-3.25', FIRST_LINE[size], JOIN_INK[CONDITION_JOIN_INK]), children: index === 0 ? words.where : words[join] }), child.kind === 'group' ? renderGroup(child) : renderCondition(child)] }, child.id))) })), !isReadOnly && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(DSButton, { variant: "ghost", size: "sm", "data-condition-add": group.id, disabled: isDisabled, "aria-label": isRoot ? words.addCondition : words.addConditionTo(name), onClick: () => {
238
278
  const id = nextId();
239
279
  const next = addCondition(value, group.id, id);
240
- change(next, { kind: 'field', id }, conditionChangeAnnouncement('added', value, next, id));
241
- }, children: [_jsx(Plus, { "aria-hidden": true, className: "size-4" }), "Add condition"] }), canAddGroup(value, group.id) && (_jsxs(DSButton, { variant: "ghost", size: "sm", disabled: isDisabled, "aria-label": isRoot ? 'Add group' : `Add group to ${name.toLowerCase()}`, onClick: () => {
280
+ change(next, { kind: 'field', id }, conditionChangeAnnouncement('added', value, next, id, words));
281
+ }, children: [_jsx(Plus, { "aria-hidden": true, className: "size-4" }), words.addCondition] }), canAddGroup(value, group.id) && (_jsxs(DSButton, { variant: "ghost", size: "sm", disabled: isDisabled, "aria-label": isRoot ? words.addGroup : words.addGroupTo(name), onClick: () => {
242
282
  const ids = { group: nextId(), condition: nextId() };
243
283
  const next = addGroup(value, group.id, ids);
244
- change(next, { kind: 'field', id: ids.condition }, conditionChangeAnnouncement('added', value, next, ids.group));
245
- }, children: [_jsx(Brackets, { "aria-hidden": true, className: "size-4" }), "Add group"] }))] })] }));
284
+ change(next, { kind: 'field', id: ids.condition }, conditionChangeAnnouncement('added', value, next, ids.group, words));
285
+ }, children: [_jsx(Brackets, { "aria-hidden": true, className: "size-4" }), words.addGroup] }))] }))] }));
246
286
  }
247
- return (_jsx("div", { ref: rootRef, className: cn(STACK, 'flex flex-col', className), ...props, children: renderGroup(value) }));
287
+ return (_jsx("div", { ref: setRoot, className: cn(STACK, 'fields-on-card flex flex-col', className), ...props, children: renderGroup(value) }));
248
288
  }
@@ -1,7 +1,14 @@
1
1
  /** Whether there is anything to switch between: two or more. */
2
2
  export declare function contextSwitcherShows(options: readonly string[]): boolean;
3
+ /** The words the switcher builds itself, so a screen can swap them. The
4
+ * defaults are English and live here, not in the adapter. */
5
+ export interface ContextSwitcherCopy {
6
+ /** The button's name for a screen reader, given what is switched and the current one. */
7
+ switchLabel: (noun: string, current: string) => string;
8
+ }
9
+ export declare const CONTEXT_SWITCHER_COPY: ContextSwitcherCopy;
3
10
  /** What the button is called to a screen reader: "Customer: Acme. Switch customer". */
4
- export declare function contextSwitcherLabel(noun: string, current: string): string;
11
+ export declare function contextSwitcherLabel(noun: string, current: string, copy?: Pick<ContextSwitcherCopy, 'switchLabel'>): string;
5
12
  /** The props every Context Switcher implementation accepts. */
6
13
  export interface ContextSwitcherContract {
7
14
  /** What is being switched, singular and capitalised: "Customer". */
@@ -10,4 +17,6 @@ export interface ContextSwitcherContract {
10
17
  current: string;
11
18
  /** Every one this person can switch between, the current one included. */
12
19
  options: readonly string[];
20
+ /** Replaces any of the words the switcher builds itself (see `ContextSwitcherCopy`). */
21
+ copy?: Partial<ContextSwitcherCopy> | undefined;
13
22
  }
@@ -1,6 +1,9 @@
1
1
  export function contextSwitcherShows(options) {
2
2
  return options.length > 1;
3
3
  }
4
- export function contextSwitcherLabel(noun, current) {
5
- return `${noun}: ${current}. Switch ${noun.toLowerCase()}`;
4
+ export const CONTEXT_SWITCHER_COPY = {
5
+ switchLabel: (noun, current) => `${noun}: ${current}. Switch ${noun.toLowerCase()}`,
6
+ };
7
+ export function contextSwitcherLabel(noun, current, copy = CONTEXT_SWITCHER_COPY) {
8
+ return copy.switchLabel(noun, current);
6
9
  }
@@ -4,4 +4,4 @@ export type DSContextSwitcherProps = ContextSwitcherContract & {
4
4
  onSwitch: (option: string) => void;
5
5
  };
6
6
  /** A ghost button in the top bar that names the current customer, organisation or workspace and opens a menu of the others. Absent when there is only one. */
7
- export declare function DSContextSwitcher({ noun, current, options, onSwitch }: DSContextSwitcherProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export declare function DSContextSwitcher({ noun, current, options, onSwitch, copy, }: DSContextSwitcherProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,15 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId, useState } from 'react';
3
3
  import { ChevronsUpDown } from 'lucide-react';
4
- import { contextSwitcherLabel, contextSwitcherShows, } from '../context-switcher';
4
+ import { CONTEXT_SWITCHER_COPY, contextSwitcherLabel, contextSwitcherShows, } from '../context-switcher';
5
5
  import { DSButton } from '../../button/web/ds-button';
6
6
  import { DSDropdownMenu } from '../../dropdown-menu/web/ds-dropdown-menu';
7
- export function DSContextSwitcher({ noun, current, options, onSwitch }) {
7
+ export function DSContextSwitcher({ noun, current, options, onSwitch, copy, }) {
8
+ const words = { ...CONTEXT_SWITCHER_COPY, ...copy };
8
9
  const [open, setOpen] = useState(false);
9
10
  const id = useId();
10
11
  if (!contextSwitcherShows(options))
11
12
  return null;
12
- return (_jsxs("div", { className: "flex", children: [_jsxs(DSButton, { id: id, variant: "ghost", size: "sm", "aria-haspopup": "menu", "aria-expanded": open, "aria-label": contextSwitcherLabel(noun, current), className: "max-w-48", onClick: () => {
13
+ return (_jsxs("div", { className: "flex", children: [_jsxs(DSButton, { id: id, variant: "ghost", size: "sm", "aria-haspopup": "menu", "aria-expanded": open, "aria-label": contextSwitcherLabel(noun, current, words), className: "max-w-48", onClick: () => {
13
14
  setOpen((was) => !was);
14
15
  }, children: [_jsx("span", { className: "truncate", children: current }), _jsx(ChevronsUpDown, { "aria-hidden": true, className: "size-4" })] }), _jsx(DSDropdownMenu, { open: open, "aria-labelledby": id, items: options.map((o) => ({ act: o, label: o, checked: o === current, radio: true })), onAction: (o) => {
15
16
  setOpen(false);