@persona/design-system 0.10.10 → 0.10.12

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 (356) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/AdvancedFilterRuleRow.d.mts +5 -2
  3. package/dist/AdvancedFilterRulesPopover.d.mts +6 -2
  4. package/dist/ArrayValueControl.d.mts +1 -1
  5. package/dist/{Badge-BCdsVKuj.mjs → Badge-B2AJMf3d.mjs} +2 -2
  6. package/dist/{Badge-BCdsVKuj.mjs.map → Badge-B2AJMf3d.mjs.map} +1 -1
  7. package/dist/BooleanValueControl.d.mts +1 -1
  8. package/dist/{Breadcrumbs-CMf3Uvow.mjs → Breadcrumbs-DRs9eo1o.mjs} +5 -5
  9. package/dist/Breadcrumbs-DRs9eo1o.mjs.map +1 -0
  10. package/dist/{CardV2-CrV6eEQb.mjs → CardV2-DO-8COfu.mjs} +11 -8
  11. package/dist/CardV2-DO-8COfu.mjs.map +1 -0
  12. package/dist/ChartFrame.d.mts +61 -0
  13. package/dist/ChartLegend.d.mts +60 -0
  14. package/dist/ChartPopover.d.mts +155 -0
  15. package/dist/{Checkbox-Dr4LMKHV.mjs → Checkbox-BAh-wF_F.mjs} +5 -5
  16. package/dist/Checkbox-BAh-wF_F.mjs.map +1 -0
  17. package/dist/{CheckboxGroupField-Bpu2j6G2.d.mts → CheckboxGroupField-XSVAmESI.d.mts} +2 -2
  18. package/dist/CheckboxGroupField.d.mts +1 -1
  19. package/dist/ChoicesValueControl.d.mts +1 -1
  20. package/dist/{Combobox-Gb_j1dg6.mjs → Combobox-BNjYEAmv.mjs} +313 -138
  21. package/dist/Combobox-BNjYEAmv.mjs.map +1 -0
  22. package/dist/Combobox-DbcSss15.d.mts +12 -0
  23. package/dist/Combobox.d.mts +3 -3
  24. package/dist/{ComboboxBase-BPXqJHaQ.d.mts → ComboboxBase-CrFweFGi.d.mts} +61 -21
  25. package/dist/ComboboxBase.d.mts +2 -2
  26. package/dist/{ComboboxMultiSelect-BwkkSymj.d.mts → ComboboxMultiSelect-Cp5GBGQj.d.mts} +10 -6
  27. package/dist/ComboboxMultiSelect.d.mts +2 -2
  28. package/dist/{ComboboxSingleSelect-CdNNJNkp.d.mts → ComboboxSingleSelect-u7fK3Yvy.d.mts} +8 -6
  29. package/dist/ComboboxSingleSelect.d.mts +2 -2
  30. package/dist/{DataTable-BE9inUi-.d.mts → DataTable-C1mdfmQa.d.mts} +17 -7
  31. package/dist/{DataTable-CIZJ1vO8.mjs → DataTable-DdSY9mzT.mjs} +36 -23
  32. package/dist/DataTable-DdSY9mzT.mjs.map +1 -0
  33. package/dist/DataTable.d.mts +1 -1
  34. package/dist/{DatePicker-C9redLBr.mjs → DatePicker-DiilpYQg.mjs} +5 -5
  35. package/dist/{DatePicker-C9redLBr.mjs.map → DatePicker-DiilpYQg.mjs.map} +1 -1
  36. package/dist/DateRangeValueControl.d.mts +1 -1
  37. package/dist/DateValueControl.d.mts +1 -1
  38. package/dist/{DropdownButton-DpLG-cIj.mjs → DropdownButton-BxZ5hn0X.mjs} +3 -3
  39. package/dist/{DropdownButton-DpLG-cIj.mjs.map → DropdownButton-BxZ5hn0X.mjs.map} +1 -1
  40. package/dist/DropdownButton.d.mts +1 -1
  41. package/dist/{DropdownMenu-B6D4stkF.d.mts → DropdownMenu-CQR0U-zM.d.mts} +2 -2
  42. package/dist/{DropdownMenu-c8XK2Lr4.mjs → DropdownMenu-Ip75l4Th.mjs} +21 -2
  43. package/dist/DropdownMenu-Ip75l4Th.mjs.map +1 -0
  44. package/dist/DropdownMenu.d.mts +1 -1
  45. package/dist/{FieldRegistry-C2NVPhMO.d.mts → FieldRegistry-CJwGpUVK.d.mts} +2 -2
  46. package/dist/FieldRegistry.d.mts +1 -1
  47. package/dist/{FilterBar-BE_gBM0H.d.mts → FilterBar-CA4mDAXK.d.mts} +13 -5
  48. package/dist/FilterBar.d.mts +1 -1
  49. package/dist/FilterPickerMenu.d.mts +2 -2
  50. package/dist/FilterPill.d.mts +1 -1
  51. package/dist/FilterPopover.d.mts +1 -1
  52. package/dist/FloatValueControl.d.mts +3 -2
  53. package/dist/{FloatingToolbar-DLRaE0o7.mjs → FloatingToolbar-BA8Fqmrz.mjs} +35 -38
  54. package/dist/FloatingToolbar-BA8Fqmrz.mjs.map +1 -0
  55. package/dist/{FormControl-BztNXLn6.mjs → FormControl-BoKGiWdQ.mjs} +2 -2
  56. package/dist/{FormControl-BztNXLn6.mjs.map → FormControl-BoKGiWdQ.mjs.map} +1 -1
  57. package/dist/{FormField-Cf1VMvoa.mjs → FormField-yYJFkJ6R.mjs} +13 -13
  58. package/dist/{FormField-Cf1VMvoa.mjs.map → FormField-yYJFkJ6R.mjs.map} +1 -1
  59. package/dist/{HoverCopyableField-XHC_n9tp.mjs → HoverCopyableField-X2XfKTTh.mjs} +10 -5
  60. package/dist/HoverCopyableField-X2XfKTTh.mjs.map +1 -0
  61. package/dist/{IconButton-DxHB2g80.mjs → IconButton-Bj1fry_K.mjs} +4 -3
  62. package/dist/IconButton-Bj1fry_K.mjs.map +1 -0
  63. package/dist/IndexTableLayout.d.mts +11 -3
  64. package/dist/InlineCombobox.d.mts +1 -1
  65. package/dist/InlineInput.d.mts +1 -1
  66. package/dist/{Input-RHXujO9u.mjs → Input-DcbzPaax.mjs} +2 -2
  67. package/dist/{Input-RHXujO9u.mjs.map → Input-DcbzPaax.mjs.map} +1 -1
  68. package/dist/IntegerValueControl.d.mts +3 -2
  69. package/dist/{Link-D_kCyLYX.mjs → Link-B29ZMN6m.mjs} +3 -3
  70. package/dist/Link-B29ZMN6m.mjs.map +1 -0
  71. package/dist/{ListBox-BZp6exb8.mjs → ListBox-4rTgr3IJ.mjs} +6 -6
  72. package/dist/{ListBox-BZp6exb8.mjs.map → ListBox-4rTgr3IJ.mjs.map} +1 -1
  73. package/dist/{ListBox-DpFcM-dM.d.mts → ListBox-ZDaitaXR.d.mts} +2 -2
  74. package/dist/ListBox.d.mts +1 -1
  75. package/dist/{ListBoxField-DL6Zk8TU.d.mts → ListBoxField-CGvVWKyL.d.mts} +4 -4
  76. package/dist/ListBoxField.d.mts +1 -1
  77. package/dist/{LoadingShimmer-oPIv2ESr.mjs → LoadingShimmer-BVVdBeN-.mjs} +18 -20
  78. package/dist/LoadingShimmer-BVVdBeN-.mjs.map +1 -0
  79. package/dist/{LogicRow-BakOUtzx.d.mts → LogicRow-Bzp5o1sL.d.mts} +2 -2
  80. package/dist/LogicRow.d.mts +1 -1
  81. package/dist/{Menu-D6OrKCTC.d.mts → Menu-DviYNrFd.d.mts} +2 -2
  82. package/dist/Menu.d.mts +1 -1
  83. package/dist/{Modal-De5_bPJ_.mjs → Modal-CiPFqr0L.mjs} +52 -23
  84. package/dist/{Modal-De5_bPJ_.mjs.map → Modal-CiPFqr0L.mjs.map} +1 -1
  85. package/dist/{PageHeader-7_Hf6rHl.mjs → PageHeader-6KvtGED-.mjs} +2 -2
  86. package/dist/{PageHeader-7_Hf6rHl.mjs.map → PageHeader-6KvtGED-.mjs.map} +1 -1
  87. package/dist/{PageLayout-DjtGrvJa.mjs → PageLayout-CPiVnS_r.mjs} +3 -1
  88. package/dist/PageLayout-CPiVnS_r.mjs.map +1 -0
  89. package/dist/{Pagination-DMH2IaV0.mjs → Pagination-CqFvnlXc.mjs} +4 -4
  90. package/dist/{Pagination-DMH2IaV0.mjs.map → Pagination-CqFvnlXc.mjs.map} +1 -1
  91. package/dist/{Pii-24D_nSRQ.mjs → Pii-jSYND7Cn.mjs} +2 -2
  92. package/dist/{Pii-24D_nSRQ.mjs.map → Pii-jSYND7Cn.mjs.map} +1 -1
  93. package/dist/{PillShell-B7Bm-dsE.d.mts → PillShell-Bkyu5FXB.d.mts} +2 -2
  94. package/dist/PillShell.d.mts +1 -1
  95. package/dist/{Popover-DordjYNM.mjs → Popover-CVX-dfYb.mjs} +48 -18
  96. package/dist/Popover-CVX-dfYb.mjs.map +1 -0
  97. package/dist/{Radio-BlEtetrr.mjs → Radio-B1H_S-Qj.mjs} +2 -2
  98. package/dist/Radio-B1H_S-Qj.mjs.map +1 -0
  99. package/dist/{RadioGroup-CMrXmmn4.mjs → RadioGroup-7hdcVhsp.mjs} +2 -2
  100. package/dist/{RadioGroup-CMrXmmn4.mjs.map → RadioGroup-7hdcVhsp.mjs.map} +1 -1
  101. package/dist/RuleEditorFields.d.mts +2 -2
  102. package/dist/RulesPill.d.mts +1 -1
  103. package/dist/{SegmentedControl-D_DA-MU1.mjs → SegmentedControl-BNOJ1FYQ.mjs} +5 -2
  104. package/dist/SegmentedControl-BNOJ1FYQ.mjs.map +1 -0
  105. package/dist/{Select-DOlw_LPR.mjs → Select-DbWEgH5c.mjs} +5 -3
  106. package/dist/Select-DbWEgH5c.mjs.map +1 -0
  107. package/dist/{Select-CR9TjFfo.d.mts → Select-DsVeAyZy.d.mts} +2 -2
  108. package/dist/Select.d.mts +1 -1
  109. package/dist/SmartTextInputField.d.mts +2 -2
  110. package/dist/{Spinner-CXb-KUs1.mjs → Spinner-k9ZiOdTr.mjs} +1 -1
  111. package/dist/{Spinner-CXb-KUs1.mjs.map → Spinner-k9ZiOdTr.mjs.map} +1 -1
  112. package/dist/{Sticker-C1_6I08u.mjs → Sticker-4VdGEFAu.mjs} +2 -2
  113. package/dist/{Sticker-C1_6I08u.mjs.map → Sticker-4VdGEFAu.mjs.map} +1 -1
  114. package/dist/StringValueControl.d.mts +2 -1
  115. package/dist/{TabBar-BCFO38E0.mjs → TabBar-d4sdknti.mjs} +5 -5
  116. package/dist/TabBar-d4sdknti.mjs.map +1 -0
  117. package/dist/{Table-DPi4Dt5H.mjs → Table-9mNn8Q-d.mjs} +14 -6
  118. package/dist/Table-9mNn8Q-d.mjs.map +1 -0
  119. package/dist/{TableBox-DNQsgQ8x.mjs → TableBox-D9NA-s9l.mjs} +16 -12
  120. package/dist/TableBox-D9NA-s9l.mjs.map +1 -0
  121. package/dist/TableBox.d.mts +1 -1
  122. package/dist/{TableBoxCell-CsRt_5gP.d.mts → TableBoxCell-CQOL30et.d.mts} +4 -4
  123. package/dist/TableBoxCell.d.mts +1 -1
  124. package/dist/{TableBoxField-Db0Vjo6Z.d.mts → TableBoxField-z0GIFeQw.d.mts} +5 -5
  125. package/dist/TableBoxField.d.mts +1 -1
  126. package/dist/{TableBoxRow-exMlZyc4.d.mts → TableBoxRow-tb9-KMr9.d.mts} +2 -2
  127. package/dist/TableBoxRow.d.mts +1 -1
  128. package/dist/{TableBoxRowActions-UO9YN34k.d.mts → TableBoxRowActions-BZwulsFP.d.mts} +2 -2
  129. package/dist/TableBoxRowActions.d.mts +1 -1
  130. package/dist/{TableControls-BrP_BqnF.mjs → TableControls-BXykbUBf.mjs} +126 -40
  131. package/dist/TableControls-BXykbUBf.mjs.map +1 -0
  132. package/dist/{TableControls-Clo_0Mty.d.mts → TableControls-DE6eHq8h.d.mts} +4 -4
  133. package/dist/TableControls.d.mts +1 -1
  134. package/dist/{TableControlsContext-BNd6z9mD.d.mts → TableControlsContext-C2_2EuMh.d.mts} +2 -2
  135. package/dist/TableControlsContext.d.mts +1 -1
  136. package/dist/{TableViewConfigurationDropdown-Cp7ausV_.d.mts → TableViewConfigurationDropdown-DE9HFXYY.d.mts} +2 -2
  137. package/dist/TableViewConfigurationDropdown.d.mts +1 -1
  138. package/dist/{TechnicalSticker-Cq5jzYKQ.mjs → TechnicalSticker-DtV7Gawf.mjs} +5 -3
  139. package/dist/TechnicalSticker-DtV7Gawf.mjs.map +1 -0
  140. package/dist/{TextArea-Dro-HH8O.mjs → TextArea-CQ1YNi2b.mjs} +4 -5
  141. package/dist/TextArea-CQ1YNi2b.mjs.map +1 -0
  142. package/dist/{Toggle-D9MzTIZs.mjs → Toggle-CzHoIR-n.mjs} +8 -4
  143. package/dist/Toggle-CzHoIR-n.mjs.map +1 -0
  144. package/dist/{Tooltip-YViXzMdm.mjs → Tooltip-CVBxc1yf.mjs} +17 -4
  145. package/dist/Tooltip-CVBxc1yf.mjs.map +1 -0
  146. package/dist/chartColors.d.mts +92 -0
  147. package/dist/chartFrameLayout.d.mts +46 -0
  148. package/dist/{clientFilterUtils-CGHYF5NE.d.mts → clientFilterUtils-2TBUC31K.d.mts} +2 -2
  149. package/dist/clientFilterUtils.d.mts +1 -1
  150. package/dist/components/Accordion/index.mjs +22 -13
  151. package/dist/components/Accordion/index.mjs.map +1 -1
  152. package/dist/components/Attribute/index.mjs +6 -4
  153. package/dist/components/Attribute/index.mjs.map +1 -1
  154. package/dist/components/Badge/index.mjs +1 -1
  155. package/dist/components/Banner/index.mjs +1 -1
  156. package/dist/components/BottomPanel/index.mjs +7 -5
  157. package/dist/components/BottomPanel/index.mjs.map +1 -1
  158. package/dist/components/Breadcrumbs/index.mjs +1 -1
  159. package/dist/components/Button/index.mjs +1 -1
  160. package/dist/components/ButtonGroup/index.mjs +1 -1
  161. package/dist/components/CardV2/index.mjs +1 -1
  162. package/dist/components/Chart/index.d.mts +9 -0
  163. package/dist/components/Chart/index.mjs +680 -0
  164. package/dist/components/Chart/index.mjs.map +1 -0
  165. package/dist/components/Checkbox/index.mjs +1 -1
  166. package/dist/components/CodeHighlight/index.mjs +1 -1
  167. package/dist/components/Combobox/index.d.mts +5 -3
  168. package/dist/components/Combobox/index.mjs +1 -1
  169. package/dist/components/DataTable/TableControls/index.d.mts +19 -19
  170. package/dist/components/DataTable/TableControls/index.mjs +2 -2
  171. package/dist/components/DataTable/index.d.mts +5 -5
  172. package/dist/components/DataTable/index.mjs +1 -1
  173. package/dist/components/DataTable/types.d.mts +1 -1
  174. package/dist/components/DatePicker/index.mjs +1 -1
  175. package/dist/components/DropdownButton/index.mjs +1 -1
  176. package/dist/components/DropdownMenu/index.d.mts +1 -1
  177. package/dist/components/DropdownMenu/index.mjs +1 -1
  178. package/dist/components/FloatingPanel/index.mjs +16 -14
  179. package/dist/components/FloatingPanel/index.mjs.map +1 -1
  180. package/dist/components/FloatingToolbar/index.mjs +1 -1
  181. package/dist/components/FormControl/index.mjs +1 -1
  182. package/dist/components/FormField/index.d.mts +4 -4
  183. package/dist/components/FormField/index.mjs +1 -1
  184. package/dist/components/HoverCopyableField/index.mjs +1 -1
  185. package/dist/components/ImageTile/index.mjs +7 -7
  186. package/dist/components/ImageTile/index.mjs.map +1 -1
  187. package/dist/components/Input/index.mjs +1 -1
  188. package/dist/components/Link/index.mjs +1 -1
  189. package/dist/components/ListBox/index.d.mts +3 -3
  190. package/dist/components/ListBox/index.mjs +1 -1
  191. package/dist/components/LoadingShimmer/index.mjs +1 -1
  192. package/dist/components/MaskedInput/index.mjs +1 -1
  193. package/dist/components/Menu/index.d.mts +1 -1
  194. package/dist/components/Modal/index.mjs +1 -1
  195. package/dist/components/PageHeader/index.mjs +1 -1
  196. package/dist/components/Pagination/index.mjs +1 -1
  197. package/dist/components/Pii/index.mjs +1 -1
  198. package/dist/components/Popover/index.mjs +1 -1
  199. package/dist/components/ProgressBar/index.mjs +20 -3
  200. package/dist/components/ProgressBar/index.mjs.map +1 -1
  201. package/dist/components/Radio/index.mjs +1 -1
  202. package/dist/components/RadioGroup/index.mjs +1 -1
  203. package/dist/components/RichTextEditor/index.mjs +5 -5
  204. package/dist/components/RightPanel/index.mjs +28 -13
  205. package/dist/components/RightPanel/index.mjs.map +1 -1
  206. package/dist/components/SegmentedControl/index.mjs +1 -1
  207. package/dist/components/Select/index.d.mts +1 -1
  208. package/dist/components/Select/index.mjs +1 -1
  209. package/dist/components/SelectionCard/index.mjs +2 -2
  210. package/dist/components/Slider/index.mjs +3 -2
  211. package/dist/components/Slider/index.mjs.map +1 -1
  212. package/dist/components/SmartTextInput/index.mjs +9 -78
  213. package/dist/components/SmartTextInput/index.mjs.map +1 -1
  214. package/dist/{safe-parse.d.mts → components/SmartTextInput/parser/safe-parse.d.mts} +1 -1
  215. package/dist/components/SmartTextInput/parser/safe-parse.mjs +30 -0
  216. package/dist/components/SmartTextInput/parser/safe-parse.mjs.map +1 -0
  217. package/dist/{tree.d.mts → components/SmartTextInput/parser/tree.d.mts} +1 -1
  218. package/dist/components/SmartTextInput/parser/tree.mjs +42 -0
  219. package/dist/components/SmartTextInput/parser/tree.mjs.map +1 -0
  220. package/dist/components/Spinner/index.mjs +1 -1
  221. package/dist/components/Sticker/index.mjs +1 -1
  222. package/dist/components/SwatchPicker/index.mjs +2 -1
  223. package/dist/components/SwatchPicker/index.mjs.map +1 -1
  224. package/dist/components/TabBar/index.mjs +1 -1
  225. package/dist/components/Table/index.mjs +1 -1
  226. package/dist/components/TableBox/index.d.mts +1 -1
  227. package/dist/components/TableBox/index.mjs +1 -1
  228. package/dist/components/TechnicalSticker/index.mjs +1 -1
  229. package/dist/components/TextArea/index.mjs +1 -1
  230. package/dist/components/Tile/index.mjs +2 -2
  231. package/dist/components/Toast/index.mjs +16 -10
  232. package/dist/components/Toast/index.mjs.map +1 -1
  233. package/dist/components/Toggle/index.mjs +1 -1
  234. package/dist/components/Tooltip/index.mjs +1 -1
  235. package/dist/components/VersionHistory/index.mjs +5 -5
  236. package/dist/compound-expression.d.mts +1 -1
  237. package/dist/{date-range-rule-value-ASr06ClE.d.mts → date-range-rule-value-DyLlMtjr.d.mts} +2 -2
  238. package/dist/date-range-rule-value.d.mts +1 -1
  239. package/dist/display.d.mts +1 -1
  240. package/dist/duration-token.d.mts +11 -0
  241. package/dist/exit-motion.d.mts +7 -0
  242. package/dist/fieldPickerOptions.d.mts +2 -2
  243. package/dist/{filter-size-context-CmFyIPCm.d.mts → filter-size-context-DVnjmuhk.d.mts} +2 -2
  244. package/dist/filter-size-context.d.mts +1 -1
  245. package/dist/{filters-DTBc0mE7.d.mts → filters-DW7pqWv3.d.mts} +2 -2
  246. package/dist/filters.d.mts +1 -1
  247. package/dist/{helpers-CBJ2AqGZ.d.mts → helpers-BTD2kXLs.d.mts} +2 -2
  248. package/dist/helpers.d.mts +1 -1
  249. package/dist/{index-OkdnW-u5.d.mts → index-B4tE0RxY.d.mts} +3 -3
  250. package/dist/{index-kIon1vPp.d.mts → index-DTM_t7OG.d.mts} +2 -2
  251. package/dist/index4.d.mts +3 -3
  252. package/dist/index5.d.mts +1 -1
  253. package/dist/index6.d.mts +14 -14
  254. package/dist/{inputFields-DpHeZiFX.d.mts → inputFields-DnBb3NhK.d.mts} +4 -4
  255. package/dist/inputFields.d.mts +1 -1
  256. package/dist/lib/TruncatedTextWithTooltip.mjs +1 -1
  257. package/dist/lib/useCloseFocus.d.mts +45 -0
  258. package/dist/lib/useCloseFocus.mjs +123 -0
  259. package/dist/lib/useCloseFocus.mjs.map +1 -0
  260. package/dist/lib/useModalInsetRight.d.mts +4 -3
  261. package/dist/lib/useModalInsetRight.mjs +7 -5
  262. package/dist/lib/useModalInsetRight.mjs.map +1 -1
  263. package/dist/lint/THIRD_PARTY_NOTICES.md +30 -0
  264. package/dist/lint/index.mjs +696 -11
  265. package/dist/lint/index.mjs.map +1 -1
  266. package/dist/lint/recommended.json +7 -1
  267. package/dist/mixins/hoverable.mjs +1 -1
  268. package/dist/mixins/hoverable.mjs.map +1 -1
  269. package/dist/mixins/input.mjs +1 -0
  270. package/dist/mixins/input.mjs.map +1 -1
  271. package/dist/mixins/menuItem.mjs +2 -0
  272. package/dist/mixins/menuItem.mjs.map +1 -1
  273. package/dist/mixins/motion.d.mts +28 -0
  274. package/dist/mixins/motion.mjs +66 -0
  275. package/dist/mixins/motion.mjs.map +1 -0
  276. package/dist/motion-origin.d.mts +7 -0
  277. package/dist/motion.d.mts +63 -0
  278. package/dist/no-layout-motion.d.mts +7 -0
  279. package/dist/no-transition-all.d.mts +7 -0
  280. package/dist/{operators-BHxKZcpD.d.mts → operators-B8_k3r69.d.mts} +10 -3
  281. package/dist/operators.d.mts +2 -2
  282. package/dist/overlay-motion.d.mts +7 -0
  283. package/dist/patterns/CardGrouping/index.mjs +6 -6
  284. package/dist/patterns/CardGrouping/index.mjs.map +1 -1
  285. package/dist/patterns/IndexTableLayout/index.mjs +23 -16
  286. package/dist/patterns/IndexTableLayout/index.mjs.map +1 -1
  287. package/dist/patterns/LayoutLoadingShimmer/index.mjs +4 -4
  288. package/dist/patterns/LayoutLoadingSpinner/index.mjs +3 -1
  289. package/dist/patterns/LayoutLoadingSpinner/index.mjs.map +1 -1
  290. package/dist/patterns/PageLayout/index.mjs +1 -1
  291. package/dist/patterns/WizardModal/index.mjs +2 -2
  292. package/dist/relative-date-label.d.mts +1 -1
  293. package/dist/{types-DLnCkvTt.d.mts → types-BJqmRXFV.d.mts} +15 -1
  294. package/dist/{types-CqcbWyUY.d.mts → types-BOsCi-kZ.d.mts} +8 -2
  295. package/dist/{types-BiqzeNsa.d.mts → types-Dws2XDz2.d.mts} +2 -2
  296. package/dist/{types-BEdERA4v.d.mts → types-NO2GRlM-.d.mts} +2 -2
  297. package/dist/types4.d.mts +1 -1
  298. package/dist/types5.d.mts +1 -1
  299. package/dist/types6.d.mts +1 -1
  300. package/dist/{url-state-CXUuK3_r.d.mts → url-state-CXPmXzIZ.d.mts} +2 -2
  301. package/dist/url-state.d.mts +1 -1
  302. package/dist/useChartColors.d.mts +30 -0
  303. package/dist/useChartSeriesVisibility.d.mts +22 -0
  304. package/dist/useChartStyles.d.mts +108 -0
  305. package/dist/useColumnConfiguration.d.mts +2 -2
  306. package/dist/useComboboxFooterAction.d.mts +1 -1
  307. package/dist/{useFilterStateV2-DBpbxAEC.d.mts → useFilterStateV2-DiTS9DTg.d.mts} +3 -3
  308. package/dist/useFilterStateV2.d.mts +1 -1
  309. package/dist/{useTableColumns-Xd14vx_h.d.mts → useTableColumns-tITjHasE.d.mts} +2 -2
  310. package/dist/useTableColumns.d.mts +1 -1
  311. package/dist/useTruncation.d.mts +1 -1
  312. package/dist/useValueControlError.d.mts +26 -0
  313. package/dist/utils.d.mts +1 -1
  314. package/dist/{validation-Tgg3AhuP.d.mts → validation-BDQdQ1cY.d.mts} +3 -3
  315. package/dist/validation.d.mts +1 -1
  316. package/dist/{value-control-resolver-XQbGCdsP.d.mts → value-control-resolver-BFJZEWDn.d.mts} +9 -3
  317. package/dist/value-control-resolver.d.mts +1 -1
  318. package/dist/value-labels.d.mts +12 -0
  319. package/dist/variables/keyframes.d.mts +2 -1
  320. package/dist/variables/keyframes.mjs +9 -1
  321. package/dist/variables/keyframes.mjs.map +1 -1
  322. package/dist/variables/transitions.d.mts +31 -1
  323. package/dist/variables/transitions.mjs +50 -1
  324. package/dist/variables/transitions.mjs.map +1 -1
  325. package/llms.txt +2 -1
  326. package/package.json +20 -4
  327. package/skills/new-screen/SKILL.md +33 -0
  328. package/skills/ui-authoring/COMPONENTS.md +19 -1
  329. package/skills/ui-authoring/PATTERNS.md +57 -36
  330. package/skills/ui-authoring/STANDARD.md +78 -4
  331. package/skills/ui-authoring/TOKENS.md +27 -24
  332. package/dist/Breadcrumbs-CMf3Uvow.mjs.map +0 -1
  333. package/dist/CardV2-CrV6eEQb.mjs.map +0 -1
  334. package/dist/Checkbox-Dr4LMKHV.mjs.map +0 -1
  335. package/dist/Combobox-CIKqTYZt.d.mts +0 -11
  336. package/dist/Combobox-Gb_j1dg6.mjs.map +0 -1
  337. package/dist/DataTable-CIZJ1vO8.mjs.map +0 -1
  338. package/dist/DropdownMenu-c8XK2Lr4.mjs.map +0 -1
  339. package/dist/FloatingToolbar-DLRaE0o7.mjs.map +0 -1
  340. package/dist/HoverCopyableField-XHC_n9tp.mjs.map +0 -1
  341. package/dist/IconButton-DxHB2g80.mjs.map +0 -1
  342. package/dist/Link-D_kCyLYX.mjs.map +0 -1
  343. package/dist/LoadingShimmer-oPIv2ESr.mjs.map +0 -1
  344. package/dist/PageLayout-DjtGrvJa.mjs.map +0 -1
  345. package/dist/Popover-DordjYNM.mjs.map +0 -1
  346. package/dist/Radio-BlEtetrr.mjs.map +0 -1
  347. package/dist/SegmentedControl-D_DA-MU1.mjs.map +0 -1
  348. package/dist/Select-DOlw_LPR.mjs.map +0 -1
  349. package/dist/TabBar-BCFO38E0.mjs.map +0 -1
  350. package/dist/Table-DPi4Dt5H.mjs.map +0 -1
  351. package/dist/TableBox-DNQsgQ8x.mjs.map +0 -1
  352. package/dist/TableControls-BrP_BqnF.mjs.map +0 -1
  353. package/dist/TechnicalSticker-Cq5jzYKQ.mjs.map +0 -1
  354. package/dist/TextArea-Dro-HH8O.mjs.map +0 -1
  355. package/dist/Toggle-D9MzTIZs.mjs.map +0 -1
  356. package/dist/Tooltip-YViXzMdm.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { o as FilterField, p as FilterSize, u as FilterRule } from "./types-DLnCkvTt.mjs";
1
+ import { o as FilterField, p as FilterSize, u as FilterRule } from "./types-BJqmRXFV.mjs";
2
2
  import * as _$react from "react";
3
3
  import { HTMLAttributes } from "react";
4
4
 
@@ -1,4 +1,4 @@
1
- import { l as FilterOperator, o as FilterField, p as FilterSize } from "./types-DLnCkvTt.mjs";
1
+ import { l as FilterOperator, o as FilterField, p as FilterSize } from "./types-BJqmRXFV.mjs";
2
2
  import { ReactNode } from "react";
3
3
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
@@ -1,4 +1,4 @@
1
- import { t as ValueControlProps } from "./types-CqcbWyUY.mjs";
1
+ import { t as ValueControlProps } from "./types-BOsCi-kZ.mjs";
2
2
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/DataTable/TableControls/FiltersV2/value-controls/FloatValueControl/FloatValueControl.d.ts
@@ -34,7 +34,8 @@ declare const FloatValueControl: ({
34
34
  operator,
35
35
  value,
36
36
  onChange,
37
- ariaLabel
37
+ ariaLabel,
38
+ errorMessage
38
39
  }: FloatValueControlProps) => _$react_jsx_runtime0.JSX.Element | null;
39
40
  //#endregion
40
41
  export { FloatValueControl, FloatValueControl as default, FloatValueControlProps };
@@ -1,15 +1,15 @@
1
1
  import { a as styled } from "./styledComponentsInterop-Cs5CCPRy.mjs";
2
- import "./variables/transitions.mjs";
2
+ import { ReducedMotionFade, TransitionEasingCurve } from "./variables/transitions.mjs";
3
3
  import { Z_INDICES } from "./lib/zindex.mjs";
4
4
  import { n as Stack } from "./Stack-Bzom2BTR.mjs";
5
- import { t as IconButton } from "./IconButton-DxHB2g80.mjs";
5
+ import { t as IconButton } from "./IconButton-Bj1fry_K.mjs";
6
6
  import Input_default from "./components/Input/index.mjs";
7
- import { n as DropdownMenu_default } from "./DropdownMenu-c8XK2Lr4.mjs";
7
+ import { n as DropdownMenu_default } from "./DropdownMenu-Ip75l4Th.mjs";
8
8
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
9
  import { BorderRadius, Color, Spacing } from "@persona/design-tokens";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { BoldIcon, CheckIcon, GridIcon, ItalicIcon, LinkIcon, ListIcon, UnlinkIcon, XIcon } from "@persona/icons";
12
- import { AnimatePresence, motion } from "framer-motion";
12
+ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
13
13
  import { PluginKey } from "@tiptap/pm/state";
14
14
  import { useEditorState } from "@tiptap/react";
15
15
  import { BubbleMenu } from "@tiptap/react/menus";
@@ -26,7 +26,7 @@ const IconContainer = styled(motion.div)`
26
26
  const InverseIconButton = styled(IconButton)`
27
27
  background-color: ${({ $selected }) => $selected ? Color.CoreSlate900 : "transparent"};
28
28
  color: ${Color.PrimaryWhite};
29
- transition: background-color ${"100ms"} ease-out;
29
+ transition: background-color ${"100ms"} ${"cubic-bezier(0.4, 0, 0.2, 1)"};
30
30
 
31
31
  &:hover:not(:disabled) {
32
32
  background-color: ${Color.CoreSlate800};
@@ -98,6 +98,33 @@ function FloatingToolbar({ editor, showOnFocus = false }) {
98
98
  const editingLinkRef = useRef(editingLink);
99
99
  const blurTimeout = useRef();
100
100
  const [pluginKey] = useState(() => new PluginKey("floatingToolbar"));
101
+ const prefersReducedMotion = useReducedMotion();
102
+ const reducedFade = {
103
+ duration: ReducedMotionFade.durationInSeconds,
104
+ ease: TransitionEasingCurve.Move
105
+ };
106
+ const swapMotion = {
107
+ initial: {
108
+ x: prefersReducedMotion ? 0 : -10,
109
+ opacity: 0
110
+ },
111
+ animate: {
112
+ x: 0,
113
+ opacity: 1
114
+ },
115
+ exit: {
116
+ x: prefersReducedMotion ? 0 : -10,
117
+ opacity: 0,
118
+ transition: prefersReducedMotion ? reducedFade : {
119
+ duration: .15,
120
+ ease: TransitionEasingCurve.Exit
121
+ }
122
+ },
123
+ transition: prefersReducedMotion ? reducedFade : {
124
+ duration: .2,
125
+ ease: TransitionEasingCurve.Enter
126
+ }
127
+ };
101
128
  useEffect(() => () => clearTimeout(blurTimeout.current), []);
102
129
  useEffect(() => {
103
130
  editingLinkRef.current = editingLink;
@@ -218,22 +245,7 @@ function FloatingToolbar({ editor, showOnFocus = false }) {
218
245
  onBlur: handleToolbarBlur,
219
246
  children: !editingLink ? /* @__PURE__ */ jsxs(IconContainer, {
220
247
  layout: true,
221
- initial: {
222
- x: -10,
223
- opacity: 0
224
- },
225
- animate: {
226
- x: 0,
227
- opacity: 1
228
- },
229
- exit: {
230
- x: -10,
231
- opacity: 0
232
- },
233
- transition: {
234
- duration: .2,
235
- ease: "easeOut"
236
- },
248
+ ...swapMotion,
237
249
  children: [
238
250
  /* @__PURE__ */ jsx(InverseIconButton, {
239
251
  onClick: () => editor.chain().focus().toggleBulletList().run(),
@@ -367,22 +379,7 @@ function FloatingToolbar({ editor, showOnFocus = false }) {
367
379
  })
368
380
  ]
369
381
  }, "main-toolbar") : /* @__PURE__ */ jsxs(IconContainer, {
370
- initial: {
371
- x: -10,
372
- opacity: 0
373
- },
374
- animate: {
375
- x: 0,
376
- opacity: 1
377
- },
378
- exit: {
379
- x: -10,
380
- opacity: 0
381
- },
382
- transition: {
383
- duration: .2,
384
- ease: "easeOut"
385
- },
382
+ ...swapMotion,
386
383
  "aria-label": "Link toolbar",
387
384
  onAnimationComplete: () => {
388
385
  if (editor && savedSelection.current) setTimeout(() => {
@@ -490,4 +487,4 @@ function FloatingToolbar({ editor, showOnFocus = false }) {
490
487
  //#endregion
491
488
  export { ensureProtocol as n, FloatingToolbar as t };
492
489
 
493
- //# sourceMappingURL=FloatingToolbar-DLRaE0o7.mjs.map
490
+ //# sourceMappingURL=FloatingToolbar-BA8Fqmrz.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingToolbar-BA8Fqmrz.mjs","names":["Input","DropdownMenu"],"sources":["../src/components/FloatingToolbar/FloatingToolbar.tsx"],"sourcesContent":["import { PluginKey } from '@tiptap/pm/state';\nimport type { EditorView } from '@tiptap/pm/view';\nimport { useEditorState, type Editor } from '@tiptap/react';\nimport { BubbleMenu } from '@tiptap/react/menus';\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport styled from 'styled-components';\n\nimport { BorderRadius, Color, Spacing } from '@persona/design-tokens';\nimport {\n BoldIcon,\n CheckIcon,\n GridIcon,\n ItalicIcon,\n LinkIcon,\n ListIcon,\n UnlinkIcon,\n XIcon,\n} from '@persona/icons';\n\nimport { IconButton } from '#src/components/Button';\nimport DropdownMenu from '#src/components/DropdownMenu';\nimport Input from '#src/components/Input';\nimport Stack from '#src/components/Stack';\nimport { Z_INDICES } from '#src/lib/zindex';\nimport {\n ReducedMotionFade,\n TransitionDuration,\n TransitionDurationInSeconds,\n TransitionEasing,\n TransitionEasingCurve,\n} from '#src/variables/transitions';\n\n// Core* colors throughout this file are intentional: the bubble toolbar is an\n// always-dark inverse surface floating over the editor, so it must not track\n// the semantic surface theme.\nconst BubbleMenuBar = styled(Stack)`\n padding: ${Spacing[1]} ${Spacing[2]};\n background-color: ${Color.CoreSlate1100};\n border-radius: ${BorderRadius.Lg};\n`;\n\nconst IconContainer = styled(motion.div)`\n display: flex;\n gap: ${Spacing[1]};\n`;\n\nconst InverseIconButton = styled(IconButton)<{ $selected?: boolean }>`\n background-color: ${({ $selected }) => ($selected ? Color.CoreSlate900 : 'transparent')};\n color: ${Color.PrimaryWhite};\n transition: background-color ${TransitionDuration.ExtraFast} ${TransitionEasing.Move};\n\n &:hover:not(:disabled) {\n background-color: ${Color.CoreSlate800};\n }\n\n &:disabled {\n background-color: transparent;\n opacity: 0.35;\n }\n`;\n\nconst InverseInput = styled(Input)`\n background-color: ${Color.CoreSlate900};\n color: ${Color.PrimaryWhite};\n\n :focus-within {\n border-color: ${Color.CoreBlue700};\n }\n ::placeholder {\n color: ${Color.TextDisabled};\n }\n\n input {\n background-color: ${Color.CoreSlate900};\n color: ${Color.PrimaryWhite};\n }\n`;\n\nconst StyledDropdownItem = styled(DropdownMenu.Item)`\n width: 100%;\n height: 30px;\n font-size: small;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n`;\n\n// Floating UI takes its offset as numbers while the spacing tokens are CSS lengths.\nconst TOOLBAR_GAP = parseInt(Spacing[1]);\n\n// Anchored to the field, the toolbar lines up with the input's left edge; over a\n// selection it sits back a notch so it does not crowd the first selected glyph.\nconst FIELD_OFFSET = { mainAxis: TOOLBAR_GAP, crossAxis: 0 };\nconst SELECTION_OFFSET = { mainAxis: TOOLBAR_GAP, crossAxis: -parseInt(Spacing[2]) };\n\n// The element EditorContent mounts the editor into — the visible field. Tiptap\n// types `options.element` loosely, so fall back to the editable root.\nconst getFieldElement = (editor: Editor): Element =>\n editor.options.element instanceof Element ? editor.options.element : editor.view.dom;\n\n// Schemes we trust as link targets. Anything else (no scheme, or an unsafe one\n// like javascript:/data:/vbscript:) is treated as a bare host and forced onto\n// https, which both preserves host:port input and neutralizes script schemes.\nconst SAFE_LINK_SCHEME = /^(https?|mailto|tel):/i;\nconst URI_SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:/;\n\nexport const ensureProtocol = (url: string): string => {\n const trimmedUrl = url.trim();\n if (!trimmedUrl) {\n return '';\n }\n // Handlebars placeholders (e.g. {{inquiry.id}}) are legitimate link targets in\n // templated messages — the template render produces the final URL, so pass\n // the expression through unvalidated. Only when nothing before the first\n // placeholder looks like an unsafe scheme: javascript:alert(1)//{{x}} would\n // otherwise smuggle a script href past the allowlist. URL parsers strip C0\n // controls, tabs and spaces before reading the scheme, so normalize the\n // prefix the same way first — java\\tscript:...{{x}} must not slip through.\n if (trimmedUrl.includes('{{')) {\n const beforePlaceholder = trimmedUrl\n .slice(0, trimmedUrl.indexOf('{{'))\n // eslint-disable-next-line no-control-regex -- mirrors how URL parsers strip C0/space before reading the scheme\n .replace(/[\\u0000-\\u0020]/g, '');\n if (!URI_SCHEME.test(beforePlaceholder) || SAFE_LINK_SCHEME.test(beforePlaceholder)) {\n return trimmedUrl;\n }\n return '';\n }\n const candidate = SAFE_LINK_SCHEME.test(trimmedUrl) ? trimmedUrl : `https://${trimmedUrl}`;\n // Re-parse so malformed input — including an unsafe scheme that can't survive\n // the https prefix — is dropped instead of applied as a broken href.\n return URL.canParse(candidate) ? candidate : '';\n};\n\ninterface FloatingToolbarProps {\n /** TipTap editor instance to operate on. */\n editor: Editor | null;\n /**\n * Keep the toolbar up the whole time the editor is focused instead of only\n * while text is selected, so the formatting actions are discoverable without\n * knowing to select first.\n */\n showOnFocus?: boolean;\n}\n\n/**\n * Floating bubble toolbar that appears on text selection or inside a table, or —\n * with `showOnFocus` — for as long as the editor is focused.\n * Keyboard shortcut: Cmd/Ctrl+Shift+U opens the link-edit row.\n */\nfunction FloatingToolbar({ editor, showOnFocus = false }: FloatingToolbarProps) {\n const [linkURL, setLinkURL] = useState('');\n const [editingLink, setEditingLink] = useState(false);\n const linkInputRef = useRef<HTMLInputElement>(null);\n const toolbarRef = useRef<HTMLDivElement>(null);\n const savedSelection = useRef<{ from: number; to: number } | null>(null);\n const editingLinkRef = useRef(editingLink);\n const blurTimeout = useRef<ReturnType<typeof setTimeout>>();\n // Lets the toolbar close its own bubble menu plugin via a `hide` meta.\n const [pluginKey] = useState(() => new PluginKey('floatingToolbar'));\n const prefersReducedMotion = useReducedMotion();\n const reducedFade = {\n duration: ReducedMotionFade.durationInSeconds,\n ease: TransitionEasingCurve.Move,\n };\n const swapMotion = {\n initial: { x: prefersReducedMotion ? 0 : -10, opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: {\n x: prefersReducedMotion ? 0 : -10,\n opacity: 0,\n transition: prefersReducedMotion\n ? reducedFade\n : { duration: TransitionDurationInSeconds.Faster, ease: TransitionEasingCurve.Exit },\n },\n transition: prefersReducedMotion\n ? reducedFade\n : { duration: TransitionDurationInSeconds.Fast, ease: TransitionEasingCurve.Enter },\n };\n\n useEffect(() => () => clearTimeout(blurTimeout.current), []);\n\n useEffect(() => {\n editingLinkRef.current = editingLink;\n }, [editingLink]);\n\n const restoreSelection = useCallback(() => {\n if (editor && savedSelection.current) {\n const { from, to } = savedSelection.current;\n editor.chain().focus().setTextSelection({ from, to }).run();\n }\n }, [editor]);\n\n const openLinkEditingMode = useCallback(() => {\n if (!editor) {\n return;\n }\n if (!editor.can().chain().toggleLink({ href: 'https://www.google.com' }).run()) {\n return;\n }\n\n const { from, to } = editor.state.selection;\n savedSelection.current = { from, to };\n\n const linkAttr = editor.getAttributes('link');\n if (linkAttr.href) {\n setLinkURL(linkAttr.href);\n }\n\n editor.chain().focus().setTextSelection({ from, to }).run();\n setEditingLink(true);\n\n setTimeout(() => {\n linkInputRef.current?.focus();\n }, 250);\n }, [editor]);\n\n // Cmd/Ctrl+Shift+U → open link mode; Escape inside link mode → cancel.\n useEffect(() => {\n if (!editor) {\n return undefined;\n }\n const dom = editor.view.dom;\n const handler = (event: KeyboardEvent) => {\n if ((event.metaKey || event.ctrlKey) && event.shiftKey && event.key.toLowerCase() === 'u') {\n event.preventDefault();\n openLinkEditingMode();\n return;\n }\n if (event.key === 'Escape' && editingLinkRef.current) {\n event.preventDefault();\n setEditingLink(false);\n setLinkURL('');\n savedSelection.current = null;\n }\n };\n dom.addEventListener('keydown', handler);\n return () => {\n dom.removeEventListener('keydown', handler);\n };\n }, [editor, openLinkEditingMode]);\n\n // Keep selection highlighted while focus is in the link input.\n useEffect(() => {\n if (!editingLink || !editor || !savedSelection.current) {\n return undefined;\n }\n restoreSelection();\n const timeoutId = setTimeout(() => {\n restoreSelection();\n editor.view.dom?.focus();\n }, 0);\n return () => clearTimeout(timeoutId);\n }, [editingLink, restoreSelection, editor]);\n\n // Pressing a toolbar button focuses that button, and the command's own\n // transaction re-runs this check before the chained `.focus()` hands focus\n // back to the editor. Ignoring focus held inside the toolbar therefore tears\n // the bar down for a frame mid-click, taking the pressed button with it.\n const isFocusWithinToolbar = useCallback(\n () => !!toolbarRef.current?.contains(document.activeElement),\n [],\n );\n\n // BubbleMenu dispatches an options-update transaction whenever these props\n // change identity, and editors that re-render per transaction would then\n // loop — so keep them stable across renders.\n const bubbleMenuOptions = useMemo(\n () => ({\n placement: 'top-start' as const,\n offset: showOnFocus ? FIELD_OFFSET : SELECTION_OFFSET,\n }),\n [showOnFocus],\n );\n\n // Sitting above the field rather than the selection: a toolbar that is up\n // for the whole time the field is focused looks jumpy if it chases the\n // caret and hops between selections.\n const getReferencedVirtualElement = useMemo(\n () =>\n showOnFocus && editor\n ? () => ({ getBoundingClientRect: () => getFieldElement(editor).getBoundingClientRect() })\n : undefined,\n [editor, showOnFocus],\n );\n\n const shouldShow = useCallback(\n ({\n editor: e,\n view,\n from,\n to,\n }: {\n editor: Editor;\n view: EditorView;\n from: number;\n to: number;\n }) => {\n if (!e.isEditable) {\n return false;\n }\n if (e.isActive('mention')) {\n return false;\n }\n // The toolbar carries the table-actions dropdown — a collapsed caret\n // inside a table must still show it or row/column controls are\n // unreachable.\n if (e.isActive('table')) {\n return true;\n }\n if (from !== to) {\n return true;\n }\n return showOnFocus && (view.hasFocus() || isFocusWithinToolbar());\n },\n [isFocusWithinToolbar, showOnFocus],\n );\n\n // Self-subscribe: standalone use can't rely on the host's useEditor options (shouldRerenderOnTransaction is off by default in Tiptap 3).\n const editorState = useEditorState({\n editor,\n selector: (snapshot) =>\n snapshot.editor && {\n isBold: snapshot.editor.isActive('bold'),\n canBold: snapshot.editor.can().chain().toggleBold().run(),\n isItalic: snapshot.editor.isActive('italic'),\n canItalic: snapshot.editor.can().chain().toggleItalic().run(),\n isLink: snapshot.editor.isActive('link'),\n isBulletList: snapshot.editor.isActive('bulletList'),\n canLink: snapshot.editor.can().chain().toggleLink({ href: 'https://www.google.com' }).run(),\n isTable: snapshot.editor.isActive('table'),\n canInsertTable: snapshot.editor\n .can()\n .chain()\n .insertTable({ rows: 3, cols: 3, withHeaderRow: true })\n .run(),\n },\n });\n\n if (!editor || !editorState) {\n return null;\n }\n\n // The plugin closes the toolbar off the editor's blur, which cannot fire again\n // once focus has moved in here, so leaving from the toolbar has to close it.\n // Focus only lands on its next target after this event, hence the tick.\n const handleToolbarBlur = () => {\n blurTimeout.current = setTimeout(() => {\n if (editor.isDestroyed || isFocusWithinToolbar() || editor.view.hasFocus()) {\n return;\n }\n editor.view.dispatch(editor.state.tr.setMeta(pluginKey, 'hide'));\n });\n };\n\n return (\n <BubbleMenu\n editor={editor}\n pluginKey={pluginKey}\n options={bubbleMenuOptions}\n getReferencedVirtualElement={getReferencedVirtualElement}\n shouldShow={shouldShow}\n // Floating UI sets no z-index on the portaled menu (Tippy used 9999).\n style={{ zIndex: Z_INDICES.modalElevated }}\n >\n <AnimatePresence>\n <BubbleMenuBar\n ref={toolbarRef}\n role='toolbar'\n aria-label='Text formatting'\n direction='horizontal'\n spacing={Spacing[1]}\n onBlur={handleToolbarBlur}\n >\n {!editingLink ? (\n <IconContainer key='main-toolbar' layout {...swapMotion}>\n <InverseIconButton\n onClick={() => editor.chain().focus().toggleBulletList().run()}\n $selected={editorState.isBulletList}\n size='sm'\n type='button'\n aria-label='Toggle bullet list'\n data-rte-menu-bar-item\n >\n <ListIcon />\n </InverseIconButton>\n <InverseIconButton\n onClick={() => editor.chain().focus().toggleBold().run()}\n disabled={!editorState.canBold}\n $selected={editorState.isBold}\n size='sm'\n type='button'\n aria-label='Toggle bold'\n data-rte-menu-bar-item\n >\n <BoldIcon />\n </InverseIconButton>\n <InverseIconButton\n onClick={() => editor.chain().focus().toggleItalic().run()}\n $selected={editorState.isItalic}\n disabled={!editorState.canItalic}\n type='button'\n size='sm'\n aria-label='Toggle italic'\n data-rte-menu-bar-item\n >\n <ItalicIcon />\n </InverseIconButton>\n <InverseIconButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n openLinkEditingMode();\n }}\n $selected={editorState.isLink}\n disabled={!editorState.canLink}\n size='sm'\n type='button'\n aria-label='Toggle link'\n data-rte-menu-bar-item\n >\n <LinkIcon />\n </InverseIconButton>\n {editorState.isTable ? (\n <DropdownMenu\n contentProps={{\n // @ts-expect-error data attribute on dropdown menu\n 'data-rte-menu-bar-item': 'table-actions-dropdown-menu',\n onCloseAutoFocus: (event) => {\n event.preventDefault();\n editor.commands.focus();\n },\n }}\n trigger={\n <InverseIconButton\n size='sm'\n type='button'\n aria-label='Table actions'\n data-rte-menu-bar-item\n $selected\n >\n <GridIcon />\n </InverseIconButton>\n }\n >\n <StyledDropdownItem\n id='floating-toolbar__tableAddRowAfter'\n variant='basic'\n data-rte-menu-bar-item='table-add-row-after'\n onClick={() => editor.chain().focus().addRowAfter().run()}\n >\n Add row below\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableAddRowBefore'\n variant='basic'\n data-rte-menu-bar-item='table-add-row-before'\n onClick={() => editor.chain().focus().addRowBefore().run()}\n >\n Add row above\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableAddColumnAfter'\n variant='basic'\n data-rte-menu-bar-item='table-add-column-after'\n onClick={() => editor.chain().focus().addColumnAfter().run()}\n >\n Add column right\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableAddColumnBefore'\n variant='basic'\n data-rte-menu-bar-item='table-add-column-before'\n onClick={() => editor.chain().focus().addColumnBefore().run()}\n >\n Add column left\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableDeleteRow'\n variant='basic'\n data-rte-menu-bar-item='table-delete-row'\n onClick={() => editor.chain().focus().deleteRow().run()}\n >\n Delete row\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableDeleteColumn'\n variant='basic'\n data-rte-menu-bar-item='table-delete-column'\n onClick={() => editor.chain().focus().deleteColumn().run()}\n >\n Delete column\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableToggleHeaderRow'\n variant='basic'\n data-rte-menu-bar-item='table-toggle-header-row'\n onClick={() => editor.chain().focus().toggleHeaderRow().run()}\n >\n Toggle header row\n </StyledDropdownItem>\n <StyledDropdownItem\n id='floating-toolbar__tableDelete'\n variant='basic'\n data-rte-menu-bar-item='table-delete'\n onClick={() => editor.chain().focus().deleteTable().run()}\n >\n Delete table\n </StyledDropdownItem>\n </DropdownMenu>\n ) : (\n <InverseIconButton\n onClick={() =>\n editor\n .chain()\n .focus()\n .insertTable({ rows: 3, cols: 3, withHeaderRow: true })\n .run()\n }\n disabled={!editorState.canInsertTable}\n size='sm'\n type='button'\n aria-label='Insert table'\n data-rte-menu-bar-item\n >\n <GridIcon />\n </InverseIconButton>\n )}\n </IconContainer>\n ) : (\n <IconContainer\n key='link-toolbar'\n {...swapMotion}\n aria-label='Link toolbar'\n onAnimationComplete={() => {\n if (editor && savedSelection.current) {\n setTimeout(() => {\n restoreSelection();\n linkInputRef.current?.focus();\n }, 10);\n }\n }}\n >\n <InverseInput\n ref={linkInputRef}\n size='sm'\n value={linkURL}\n onChange={(e) => setLinkURL(e.target.value)}\n placeholder='Click to enter URL...'\n aria-label='Link input'\n data-rte-menu-bar-item\n onClick={() => {\n linkInputRef.current?.focus();\n }}\n onFocus={() => {\n if (savedSelection.current && editor) {\n const { from, to } = savedSelection.current;\n editor.chain().setTextSelection({ from, to }).run();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && linkURL.trim() && editor && savedSelection.current) {\n e.preventDefault();\n e.stopPropagation();\n const { from, to } = savedSelection.current;\n editor\n .chain()\n .focus()\n .setTextSelection({ from, to })\n .setLink({ href: ensureProtocol(linkURL) })\n .run();\n savedSelection.current = null;\n setEditingLink(false);\n setLinkURL('');\n return;\n }\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setEditingLink(false);\n setLinkURL('');\n savedSelection.current = null;\n const { from, to } = editor.state.selection;\n editor.chain().focus().setTextSelection({ from, to }).run();\n }\n }}\n />\n <InverseIconButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (linkURL) {\n editor.chain().focus().unsetLink().run();\n }\n restoreSelection();\n setLinkURL('');\n savedSelection.current = null;\n setEditingLink(false);\n }}\n size='sm'\n type='button'\n aria-label='Cancel link'\n data-rte-menu-bar-item\n >\n {linkURL && editorState.isLink ? <UnlinkIcon /> : <XIcon />}\n </InverseIconButton>\n <InverseIconButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (linkURL.trim() && editor && savedSelection.current) {\n const { from, to } = savedSelection.current;\n editor\n .chain()\n .focus()\n .setTextSelection({ from, to })\n .setLink({ href: ensureProtocol(linkURL) })\n .run();\n } else if (editor && savedSelection.current) {\n const { from, to } = savedSelection.current;\n editor.chain().focus().setTextSelection({ from, to }).unsetLink().run();\n }\n savedSelection.current = null;\n setEditingLink(false);\n setLinkURL('');\n }}\n size='sm'\n type='button'\n aria-label='Apply link'\n data-rte-menu-bar-item\n >\n <CheckIcon />\n </InverseIconButton>\n </IconContainer>\n )}\n </BubbleMenuBar>\n </AnimatePresence>\n </BubbleMenu>\n );\n}\n\nexport default FloatingToolbar;\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,gBAAgB,OAAO,MAAM;aACtB,QAAQ,GAAG,GAAG,QAAQ,GAAG;sBAChB,MAAM,cAAc;mBACvB,aAAa,GAAG;;AAGnC,MAAM,gBAAgB,OAAO,OAAO,IAAI;;SAE/B,QAAQ,GAAG;;AAGpB,MAAM,oBAAoB,OAAO,WAAW;uBACrB,EAAE,gBAAiB,YAAY,MAAM,eAAe,cAAe;WAC/E,MAAM,aAAa;yCACgC,GAAA,+BAAyB;;;wBAG/D,MAAM,aAAa;;;;;;;;AAS3C,MAAM,eAAe,OAAOA,cAAM;sBACZ,M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AAW;MACX,0BAAA;gBAEC,WAAW,YAAY,SAAS,oBAAC,YAAD,EAAc,CAAA,GAAG,oBAAC,OAAD,EAAS,CAAA;MACzC,CAAA;KACpB,oBAAC,mBAAD;MACE,UAAU,MAAM;AACd,SAAE,gBAAgB;AAClB,SAAE,iBAAiB;AACnB,WAAI,QAAQ,MAAM,IAAI,UAAU,eAAe,SAAS;QACtD,MAAM,EAAE,MAAM,OAAO,eAAe;AACpC,eACG,OAAO,CACP,OAAO,CACP,iBAAiB;SAAE;SAAM;SAAI,CAAC,CAC9B,QAAQ,EAAE,MAAM,eAAe,QAAQ,EAAE,CAAC,CAC1C,KAAK;kBACC,UAAU,eAAe,SAAS;QAC3C,MAAM,EAAE,MAAM,OAAO,eAAe;AACpC,eAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB;SAAE;SAAM;SAAI,CAAC,CAAC,WAAW,CAAC,KAAK;;AAEzE,sBAAe,UAAU;AACzB,sBAAe,MAAM;AACrB,kBAAW,GAAG;;MAEhB,MAAK;MACL,MAAK;MACL,cAAW;MACX,0BAAA;gBAEA,oBAAC,WAAD,EAAa,CAAA;MACK,CAAA;KACN;MAtGV,eAsGU;GAEJ,CAAA,EACA,CAAA;EACP,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { a as styled, r as css } from "./styledComponentsInterop-Cs5CCPRy.mjs";
2
2
  import { semanticColor } from "./lib/semanticColor.mjs";
3
- import { a as Tooltip, n as TextWithDashedUnderline } from "./Tooltip-YViXzMdm.mjs";
3
+ import { a as Tooltip, n as TextWithDashedUnderline } from "./Tooltip-CVBxc1yf.mjs";
4
4
  import { n as useFormGroup } from "./useFormGroup-DSQkoWLh.mjs";
5
5
  import { n as useFormField, t as FormControlContext } from "./useFormField-pOVkb5BK.mjs";
6
6
  import { Children, forwardRef, isValidElement, useMemo } from "react";
@@ -181,4 +181,4 @@ const FormControl = forwardRef(function FormControl({ children, hasError, hasWar
181
181
  //#endregion
182
182
  export { FormLabel as a, FormInputContainer as i, ErrorText as n, HelperText as o, FormControl as r, WarningText as s, Container as t };
183
183
 
184
- //# sourceMappingURL=FormControl-BztNXLn6.mjs.map
184
+ //# sourceMappingURL=FormControl-BoKGiWdQ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl-BztNXLn6.mjs","names":[],"sources":["../src/components/FormControl/FormControl.tsx"],"sourcesContent":["import { Root } from '@radix-ui/react-label';\nimport { uniqueId } from 'lodash-es';\nimport {\n Children,\n type ComponentPropsWithoutRef,\n forwardRef,\n isValidElement,\n type ReactNode,\n useMemo,\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Color, Spacing, Typography } from '@persona/design-tokens';\n\nimport useFormGroup from '#src/components/ConfigFormGroup/useFormGroup';\nimport useFormField, {\n FormControlContext,\n type FormControlContextProps,\n} from '#src/components/FormControl/useFormField';\nimport Tooltip, { TextWithDashedUnderline } from '#src/components/Tooltip';\nimport { semanticColor } from '#src/lib/semanticColor';\nimport type ErrorProps from '#src/types/ErrorProps';\n\ntype LabelSizes = 'md' | 'sm';\n\ninterface StyledLabelProps {\n $size?: LabelSizes;\n}\n\nconst LabelBase = styled(Root)<StyledLabelProps>`\n ${({ $size }) => {\n switch ($size) {\n default:\n case 'md':\n return css`\n ${Typography.TextMedium};\n `;\n case 'sm':\n return css`\n ${Typography.TextSmall};\n `;\n }\n }}\n\n color: ${({ theme }) => semanticColor(theme, 'FgPrimary', theme.color.text.primary)};\n`;\n\nexport interface FormLabelProps extends ComponentPropsWithoutRef<typeof Root> {\n tooltip?: ReactNode;\n size?: LabelSizes;\n side?: 'top' | 'right' | 'bottom' | 'left';\n labelTooltipZIndex?: number;\n required?: boolean;\n}\n\nconst RequiredIndicator = styled.span`\n margin-left: ${Spacing[1]};\n vertical-align: top;\n color: ${({ theme }) => semanticColor(theme, 'FgDanger1', theme.color.variants.danger.default)};\n`;\n\nexport const FormLabel = ({\n tooltip,\n side,\n size,\n children,\n labelTooltipZIndex,\n required,\n ...props\n}: FormLabelProps) => {\n const field = useFormField({ labelId: props.id, required });\n const formGroup = useFormGroup();\n const labelProps = {\n id: field.labelId,\n htmlFor: field.inputId,\n ...props,\n };\n\n // Use labelTooltipZIndex from props, then from form group context\n const effectivelabelTooltipZIndex = labelTooltipZIndex ?? formGroup.labelTooltipZIndex;\n\n if (tooltip) {\n return (\n <Tooltip\n size={size}\n trigger={\n <LabelBase {...labelProps} $size={size}>\n <TextWithDashedUnderline>{children}</TextWithDashedUnderline>\n {field.required && <RequiredIndicator aria-hidden>*</RequiredIndicator>}\n </LabelBase>\n }\n side={side}\n {...(effectivelabelTooltipZIndex != null && { zIndex: effectivelabelTooltipZIndex })}\n >\n {tooltip}\n </Tooltip>\n );\n }\n\n return (\n <LabelBase {...labelProps} $size={size}>\n {children}\n {field.required && <RequiredIndicator aria-hidden>*</RequiredIndicator>}\n </LabelBase>\n );\n};\n\n/**\n * Used to target an input field within a FormControl.\n */\nexport const FormInputContainer = styled.div``;\n\nconst HelperTextBase = styled.div<ErrorProps>`\n ${Typography.TextSmall};\n line-height: 1;\n color: ${({ theme, hasWarning, hasError }) =>\n hasError\n ? semanticColor(theme, 'FgDanger1', theme.color.variants.danger.default)\n : hasWarning\n ? semanticColor(theme, 'FgWarning1', Color.CoreOrange900)\n : semanticColor(theme, 'FgSecondary', theme.color.text.secondary)};\n`;\n\ninterface HelperTextProps extends ComponentPropsWithoutRef<'div'>, ErrorProps {}\n\nexport const HelperText = forwardRef<HTMLDivElement, HelperTextProps>(\n function HelperText(props, ref) {\n const field = useFormField({ helperTextId: props.id });\n return (\n <HelperTextBase\n hasError={field.hasError}\n hasWarning={field.hasWarning}\n id={field.helperTextId}\n ref={ref}\n {...props}\n />\n );\n },\n);\n\nexport const ErrorText = forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n function ErrorText(props, ref) {\n const field = useFormField({ errorTextId: props.id });\n return <HelperTextBase hasError id={field.errorTextId} ref={ref} {...props} />;\n },\n);\n\nexport const WarningText = forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n function WarningText(props, ref) {\n const field = useFormField({ warningTextId: props.id });\n return <HelperTextBase hasWarning id={field.warningTextId} ref={ref} {...props} />;\n },\n);\n\nexport const Container = styled.div<{\n $configField?: boolean;\n $hasRightActions?: boolean;\n $configFieldInputWidth?: string;\n}>`\n display: flex;\n ${({ $configField, $hasRightActions, $configFieldInputWidth }) =>\n $configField\n ? $hasRightActions\n ? css`\n flex-direction: column;\n `\n : css`\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: ${Spacing[4]};\n min-width: 288px;\n\n > ${FormInputContainer} {\n display: flex;\n flex-direction: row-reverse;\n width: ${$configFieldInputWidth ?? '50%'};\n min-width: 180px;\n }\n\n &:has(textarea) {\n flex-direction: column;\n align-items: flex-start;\n gap: ${Spacing[1]};\n\n > ${FormInputContainer} {\n width: 100%;\n }\n }\n `\n : css`\n flex-direction: column;\n margin-bottom: ${Spacing[3]};\n `}\n\n > *:not(:first-child) {\n margin-top: ${({ $configField, $hasRightActions }) =>\n $hasRightActions ? Spacing[1] : $configField ? Spacing[0] : Spacing[2]};\n }\n\n > ${HelperTextBase} {\n margin-top: ${Spacing[1]};\n }\n`;\n\nexport interface FormControlBaseProps extends ErrorProps {\n inputId?: string;\n disabled?: boolean;\n /** Marks the field as required. `FormLabel` renders an asterisk. */\n required?: boolean;\n /**\n * Whether to render the form field as a config field.\n * This will remove the label and helper text.\n */\n configField?: boolean;\n /**\n * Whether the form field has right actions.\n */\n hasRightActions?: boolean;\n /**\n * Override the width of the form input container when `configField` is true.\n * Accepts any valid CSS width value (e.g. `'33%'`, `'66.67%'`).\n * Defaults to `'50%'`.\n */\n configFieldInputWidth?: string;\n}\n\nexport interface FormControlProps extends ComponentPropsWithoutRef<'div'>, FormControlBaseProps {}\n\nexport const FormControl = forwardRef<HTMLDivElement, FormControlProps>(function FormControl(\n {\n children,\n hasError,\n hasWarning,\n inputId,\n disabled,\n required,\n configField,\n hasRightActions,\n configFieldInputWidth,\n ...props\n }: FormControlProps,\n ref,\n) {\n const generatedId = useMemo(() => uniqueId('pds_form_control__'), []);\n\n const initFormField: FormControlContextProps = {\n hasError,\n hasWarning,\n disabled,\n required: required ?? false,\n inputId: inputId ?? generatedId,\n configField,\n };\n\n Children.map(children, (child: ReactNode) => {\n if (isValidElement(child)) {\n switch (child.type) {\n case FormLabel: {\n initFormField.labelId = child.props.id ?? `${initFormField.inputId}-label`;\n break;\n }\n case HelperText: {\n initFormField.helperTextId = child.props.id ?? `${initFormField.inputId}-help-text`;\n break;\n }\n case ErrorText: {\n initFormField.errorTextId = child.props.id ?? `${initFormField.inputId}-error-text`;\n break;\n }\n case WarningText: {\n initFormField.warningTextId = child.props.id ?? `${initFormField.inputId}-warning-text`;\n break;\n }\n }\n }\n });\n\n const field = useFormField(initFormField);\n\n return (\n <FormControlContext.Provider value={field}>\n <Container\n ref={ref}\n $configField={field.configField}\n $hasRightActions={hasRightActions}\n $configFieldInputWidth={configFieldInputWidth}\n {...props}\n >\n {children}\n </Container>\n </FormControlContext.Provider>\n );\n});\n\nexport default FormControl;\n"],"mappings":";;;;;;;;;;;AA6BA,MAAM,YAAY,OAAO,KAAK;KACzB,EAAE,YAAY;AACf,SAAQ,OAAR;EACE;EACA,KAAK,KACH,QAAO,GAAG;YACN,WAAW,WAAW;;EAE5B,KAAK,KACH,QAAO,GAAG;YACN,WAAW,UAAU;;;EAG7B;;YAEQ,EAAE,YAAY,cAAc,OAAO,aAAa,MAAM,MAAM,KAAK,QAAQ,CAAC;;AAWtF,MAAM,oBAAoB,OAAO,IAAI;iBACpB,QAAQ,GAAG;;YAEhB,EAAE,YAAY,cAAc,OAAO,aAAa,MAAM,MAAM,SAAS,OAAO,QAAQ,CAAC;;AAGjG,MAAa,aAAa,EACxB,SACA,MACA,MACA,UACA,oBACA,UACA,GAAG,YACiB;CACpB,MAAM,QAAQ,aAAa;EAAE,SAAS,MAAM;EAAI;EAAU,CAAC;CAC3D,MAAM,YAAY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AAC,WAAD;GACO;GACL,cAAc,MAAM;GACpB,kBAAkB;GAClB,wBAAwB;GACxB,GAAI;GAEH;GACS,CAAA;EACgB,CAAA;EAEhC"}
1
+ {"version":3,"file":"FormControl-BoKGiWdQ.mjs","names":[],"sources":["../src/components/FormControl/FormControl.tsx"],"sourcesContent":["import { Root } from '@radix-ui/react-label';\nimport { uniqueId } from 'lodash-es';\nimport {\n Children,\n type ComponentPropsWithoutRef,\n forwardRef,\n isValidElement,\n type ReactNode,\n useMemo,\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Color, Spacing, Typography } from '@persona/design-tokens';\n\nimport useFormGroup from '#src/components/ConfigFormGroup/useFormGroup';\nimport useFormField, {\n FormControlContext,\n type FormControlContextProps,\n} from '#src/components/FormControl/useFormField';\nimport Tooltip, { TextWithDashedUnderline } from '#src/components/Tooltip';\nimport { semanticColor } from '#src/lib/semanticColor';\nimport type ErrorProps from '#src/types/ErrorProps';\n\ntype LabelSizes = 'md' | 'sm';\n\ninterface StyledLabelProps {\n $size?: LabelSizes;\n}\n\nconst LabelBase = styled(Root)<StyledLabelProps>`\n ${({ $size }) => {\n switch ($size) {\n default:\n case 'md':\n return css`\n ${Typography.TextMedium};\n `;\n case 'sm':\n return css`\n ${Typography.TextSmall};\n `;\n }\n }}\n\n color: ${({ theme }) => semanticColor(theme, 'FgPrimary', theme.color.text.primary)};\n`;\n\nexport interface FormLabelProps extends ComponentPropsWithoutRef<typeof Root> {\n tooltip?: ReactNode;\n size?: LabelSizes;\n side?: 'top' | 'right' | 'bottom' | 'left';\n labelTooltipZIndex?: number;\n required?: boolean;\n}\n\nconst RequiredIndicator = styled.span`\n margin-left: ${Spacing[1]};\n vertical-align: top;\n color: ${({ theme }) => semanticColor(theme, 'FgDanger1', theme.color.variants.danger.default)};\n`;\n\nexport const FormLabel = ({\n tooltip,\n side,\n size,\n children,\n labelTooltipZIndex,\n required,\n ...props\n}: FormLabelProps) => {\n const field = useFormField({ labelId: props.id, required });\n const formGroup = useFormGroup();\n const labelProps = {\n id: field.labelId,\n htmlFor: field.inputId,\n ...props,\n };\n\n // Use labelTooltipZIndex from props, then from form group context\n const effectivelabelTooltipZIndex = labelTooltipZIndex ?? formGroup.labelTooltipZIndex;\n\n if (tooltip) {\n return (\n <Tooltip\n size={size}\n trigger={\n <LabelBase {...labelProps} $size={size}>\n <TextWithDashedUnderline>{children}</TextWithDashedUnderline>\n {field.required && <RequiredIndicator aria-hidden>*</RequiredIndicator>}\n </LabelBase>\n }\n side={side}\n {...(effectivelabelTooltipZIndex != null && { zIndex: effectivelabelTooltipZIndex })}\n >\n {tooltip}\n </Tooltip>\n );\n }\n\n return (\n <LabelBase {...labelProps} $size={size}>\n {children}\n {field.required && <RequiredIndicator aria-hidden>*</RequiredIndicator>}\n </LabelBase>\n );\n};\n\n/**\n * Used to target an input field within a FormControl.\n */\nexport const FormInputContainer = styled.div``;\n\nconst HelperTextBase = styled.div<ErrorProps>`\n ${Typography.TextSmall};\n line-height: 1;\n color: ${({ theme, hasWarning, hasError }) =>\n hasError\n ? semanticColor(theme, 'FgDanger1', theme.color.variants.danger.default)\n : hasWarning\n ? semanticColor(theme, 'FgWarning1', Color.CoreOrange900)\n : semanticColor(theme, 'FgSecondary', theme.color.text.secondary)};\n`;\n\ninterface HelperTextProps extends ComponentPropsWithoutRef<'div'>, ErrorProps {}\n\nexport const HelperText = forwardRef<HTMLDivElement, HelperTextProps>(\n function HelperText(props, ref) {\n const field = useFormField({ helperTextId: props.id });\n return (\n <HelperTextBase\n hasError={field.hasError}\n hasWarning={field.hasWarning}\n id={field.helperTextId}\n ref={ref}\n {...props}\n />\n );\n },\n);\n\nexport const ErrorText = forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n function ErrorText(props, ref) {\n const field = useFormField({ errorTextId: props.id });\n return <HelperTextBase hasError id={field.errorTextId} ref={ref} {...props} />;\n },\n);\n\nexport const WarningText = forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n function WarningText(props, ref) {\n const field = useFormField({ warningTextId: props.id });\n return <HelperTextBase hasWarning id={field.warningTextId} ref={ref} {...props} />;\n },\n);\n\nexport const Container = styled.div<{\n $configField?: boolean;\n $hasRightActions?: boolean;\n $configFieldInputWidth?: string;\n}>`\n display: flex;\n ${({ $configField, $hasRightActions, $configFieldInputWidth }) =>\n $configField\n ? $hasRightActions\n ? css`\n flex-direction: column;\n `\n : css`\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: ${Spacing[4]};\n min-width: 288px;\n\n > ${FormInputContainer} {\n display: flex;\n flex-direction: row-reverse;\n width: ${$configFieldInputWidth ?? '50%'};\n min-width: 180px;\n }\n\n &:has(textarea) {\n flex-direction: column;\n align-items: flex-start;\n gap: ${Spacing[1]};\n\n > ${FormInputContainer} {\n width: 100%;\n }\n }\n `\n : css`\n flex-direction: column;\n margin-bottom: ${Spacing[3]};\n `}\n\n > *:not(:first-child) {\n margin-top: ${({ $configField, $hasRightActions }) =>\n $hasRightActions ? Spacing[1] : $configField ? Spacing[0] : Spacing[2]};\n }\n\n > ${HelperTextBase} {\n margin-top: ${Spacing[1]};\n }\n`;\n\nexport interface FormControlBaseProps extends ErrorProps {\n inputId?: string;\n disabled?: boolean;\n /** Marks the field as required. `FormLabel` renders an asterisk. */\n required?: boolean;\n /**\n * Whether to render the form field as a config field.\n * This will remove the label and helper text.\n */\n configField?: boolean;\n /**\n * Whether the form field has right actions.\n */\n hasRightActions?: boolean;\n /**\n * Override the width of the form input container when `configField` is true.\n * Accepts any valid CSS width value (e.g. `'33%'`, `'66.67%'`).\n * Defaults to `'50%'`.\n */\n configFieldInputWidth?: string;\n}\n\nexport interface FormControlProps extends ComponentPropsWithoutRef<'div'>, FormControlBaseProps {}\n\nexport const FormControl = forwardRef<HTMLDivElement, FormControlProps>(function FormControl(\n {\n children,\n hasError,\n hasWarning,\n inputId,\n disabled,\n required,\n configField,\n hasRightActions,\n configFieldInputWidth,\n ...props\n }: FormControlProps,\n ref,\n) {\n const generatedId = useMemo(() => uniqueId('pds_form_control__'), []);\n\n const initFormField: FormControlContextProps = {\n hasError,\n hasWarning,\n disabled,\n required: required ?? false,\n inputId: inputId ?? generatedId,\n configField,\n };\n\n Children.map(children, (child: ReactNode) => {\n if (isValidElement(child)) {\n switch (child.type) {\n case FormLabel: {\n initFormField.labelId = child.props.id ?? `${initFormField.inputId}-label`;\n break;\n }\n case HelperText: {\n initFormField.helperTextId = child.props.id ?? `${initFormField.inputId}-help-text`;\n break;\n }\n case ErrorText: {\n initFormField.errorTextId = child.props.id ?? `${initFormField.inputId}-error-text`;\n break;\n }\n case WarningText: {\n initFormField.warningTextId = child.props.id ?? `${initFormField.inputId}-warning-text`;\n break;\n }\n }\n }\n });\n\n const field = useFormField(initFormField);\n\n return (\n <FormControlContext.Provider value={field}>\n <Container\n ref={ref}\n $configField={field.configField}\n $hasRightActions={hasRightActions}\n $configFieldInputWidth={configFieldInputWidth}\n {...props}\n >\n {children}\n </Container>\n </FormControlContext.Provider>\n );\n});\n\nexport default FormControl;\n"],"mappings":";;;;;;;;;;;AA6BA,MAAM,YAAY,OAAO,KAAK;KACzB,EAAE,YAAY;AACf,SAAQ,OAAR;EACE;EACA,KAAK,KACH,QAAO,GAAG;YACN,WAAW,WAAW;;EAE5B,KAAK,KACH,QAAO,GAAG;YACN,WAAW,UAAU;;;EAG7B;;YAEQ,EAAE,YAAY,cAAc,OAAO,aAAa,MAAM,MAAM,KAAK,QAAQ,CAAC;;AAWtF,MAAM,oBAAoB,OAAO,IAAI;iBACpB,QAAQ,GAAG;;YAEhB,EAAE,YAAY,cAAc,OAAO,aAAa,MAAM,MAAM,SAAS,OAAO,QAAQ,CAAC;;AAGjG,MAAa,aAAa,EACxB,SACA,MACA,MACA,UACA,oBACA,UACA,GAAG,YACiB;CACpB,MAAM,QAAQ,aAAa;EAAE,SAAS,MAAM;EAAI;EAAU,CAAC;CAC3D,MAAM,YAAY,cAAc;CAChC,MAAM,aAAa;EACjB,I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GACpB,kBAAkB;GAClB,wBAAwB;GACxB,GAAI;GAEH;GACS,CAAA;EACgB,CAAA;EAEhC"}
@@ -1,19 +1,19 @@
1
1
  import { t as HStack } from "./Stack-Bzom2BTR.mjs";
2
- import { t as IconButton } from "./IconButton-DxHB2g80.mjs";
2
+ import { t as IconButton } from "./IconButton-Bj1fry_K.mjs";
3
3
  import { n as useFormGroup } from "./useFormGroup-DSQkoWLh.mjs";
4
4
  import { t as FormControlContext } from "./useFormField-pOVkb5BK.mjs";
5
5
  import Input_default from "./components/Input/index.mjs";
6
- import { n as DropdownMenu_default } from "./DropdownMenu-c8XK2Lr4.mjs";
7
- import { t as Checkbox } from "./Checkbox-Dr4LMKHV.mjs";
8
- import { t as Combobox } from "./Combobox-Gb_j1dg6.mjs";
9
- import { n as Select } from "./Select-DOlw_LPR.mjs";
10
- import { a as FormLabel, i as FormInputContainer, n as ErrorText, o as HelperText, r as FormControl, s as WarningText } from "./FormControl-BztNXLn6.mjs";
11
- import { t as ListBox } from "./ListBox-BZp6exb8.mjs";
12
- import { t as RadioGroup } from "./RadioGroup-CMrXmmn4.mjs";
13
- import { t as SegmentedControl } from "./SegmentedControl-D_DA-MU1.mjs";
14
- import { t as TextAreaWithStyle } from "./TextArea-Dro-HH8O.mjs";
15
- import { t as Toggle } from "./Toggle-D9MzTIZs.mjs";
16
- import { t as TableBox } from "./TableBox-DNQsgQ8x.mjs";
6
+ import { n as DropdownMenu_default } from "./DropdownMenu-Ip75l4Th.mjs";
7
+ import { t as Checkbox } from "./Checkbox-BAh-wF_F.mjs";
8
+ import { t as Combobox } from "./Combobox-BNjYEAmv.mjs";
9
+ import { n as Select } from "./Select-DbWEgH5c.mjs";
10
+ import { a as FormLabel, i as FormInputContainer, n as ErrorText, o as HelperText, r as FormControl, s as WarningText } from "./FormControl-BoKGiWdQ.mjs";
11
+ import { t as ListBox } from "./ListBox-4rTgr3IJ.mjs";
12
+ import { t as RadioGroup } from "./RadioGroup-7hdcVhsp.mjs";
13
+ import { t as SegmentedControl } from "./SegmentedControl-BNOJ1FYQ.mjs";
14
+ import { t as TextAreaWithStyle } from "./TextArea-CQ1YNi2b.mjs";
15
+ import { t as Toggle } from "./Toggle-CzHoIR-n.mjs";
16
+ import { t as TableBox } from "./TableBox-D9NA-s9l.mjs";
17
17
  import { Children, Fragment, cloneElement, createContext, forwardRef, useContext, useMemo, useRef, useState } from "react";
18
18
  import { Spacing } from "@persona/design-tokens";
19
19
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -483,4 +483,4 @@ TableBoxField.Cell = TableBox.Cell;
483
483
  //#endregion
484
484
  export { CheckboxField as a, SegmentedControlField as c, TextField as d, ToggleField as f, CheckboxGroupField as i, SelectField as l, FormField as m, TableBoxField as n, ComboboxField as o, splitOutFormFieldProps as p, ListBoxField as r, RadioGroupField as s, TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL as t, TextAreaField as u };
485
485
 
486
- //# sourceMappingURL=FormField-Cf1VMvoa.mjs.map
486
+ //# sourceMappingURL=FormField-yYJFkJ6R.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormField-Cf1VMvoa.mjs","names":["Input","TextArea","DropdownMenu","DropdownMenu"],"sources":["../src/components/FormField/FormField.tsx","../src/components/FormField/inputFields.tsx","../src/components/FormField/CheckboxGroupField.tsx","../src/components/FormField/ListBoxField.tsx","../src/components/FormField/TableBoxField.tsx"],"sourcesContent":["import { type ComponentPropsWithRef, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { Spacing } from '@persona/design-tokens';\n\nimport useFormGroup from '#src/components/ConfigFormGroup/useFormGroup';\nimport FormControl, {\n ErrorText,\n type FormControlProps,\n FormInputContainer,\n FormLabel,\n HelperText,\n WarningText,\n} from '#src/components/FormControl';\nimport { HStack } from '#src/components/Stack';\n\nexport interface FormFieldBaseProps {\n /**\n * Renders `<Label>` above input\n */\n label?: ReactNode;\n\n /**\n * ID of the input element. Providing this will automatically link the label to the input.\n */\n inputId?: string;\n\n /** Marks the field as required. The label renders an asterisk; composed fields also forward `required` to their input. */\n required?: boolean;\n\n /**\n * Renders `<HelperText>` below input\n */\n helperText?: ReactNode;\n\n /**\n * Renders `<ErrorText>` below input and helper text.\n */\n errorText?: ReactNode;\n\n /**\n * Renders `<WarningText>` below input and helper text.\n */\n warningText?: ReactNode;\n\n /**\n * Should be an input of some sort\n */\n children?: ReactElement;\n\n labelProps?: ComponentPropsWithRef<typeof FormLabel>;\n helperProps?: ComponentPropsWithRef<typeof HelperText>;\n warningProps?: ComponentPropsWithRef<typeof WarningText>;\n errorProps?: ComponentPropsWithRef<typeof ErrorText>;\n\n /**\n * Whether to render the form field as a config field.\n * This will render the helper text as a tooltip.\n */\n configField?: boolean;\n\n /**\n * Override the width of the input area when `configField` is true.\n * Accepts any valid CSS width value (e.g. `'33%'`, `'66.67%'`).\n * Defaults to `'50%'`.\n */\n configFieldInputWidth?: string;\n\n /**\n * Renders actions to the right of the label.\n */\n rightActions?: ReactNode;\n}\n\nexport interface FormFieldProps extends Omit<FormControlProps, 'children'>, FormFieldBaseProps {}\n\n/**\n * Helper component with preset slots for label, input, and helper texts.\n *\n * Prefer a composed field component, such as `<TextField>`, `<SelectField>`, or\n * `<CheckboxField>`, when one is available for the input type. Use `<FormField>` directly\n * when composing a custom control or layout.\n *\n * ## Usage\n *\n * ```tsx\n * import FormField from '@persona/design-system/components/FormField';\n * ```\n */\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(function FormField(\n {\n label,\n children,\n helperText,\n warningText,\n errorText,\n labelProps,\n helperProps,\n warningProps,\n errorProps,\n configField: configFieldProp,\n configFieldInputWidth,\n rightActions,\n ...props\n }: FormFieldProps,\n ref,\n) {\n const { configField: configFieldFormGroup } = useFormGroup();\n const configField = configFieldProp ?? configFieldFormGroup;\n\n const labelElement = label ? (\n <FormLabel tooltip={configField && helperText ? helperText : undefined} {...labelProps}>\n {label}\n </FormLabel>\n ) : null;\n\n return (\n <FormControl\n hasError={!!errorText}\n hasWarning={!!warningText}\n ref={ref}\n configField={configField}\n hasRightActions={!!rightActions}\n configFieldInputWidth={configFieldInputWidth}\n {...props}\n >\n {rightActions ? (\n <HStack justify='space-between' align='center'>\n {labelElement}\n <HStack spacing={Spacing[1]}>{rightActions}</HStack>\n </HStack>\n ) : (\n labelElement\n )}\n <FormInputContainer>{children}</FormInputContainer>\n {!configField && helperText && <HelperText {...helperProps}>{helperText}</HelperText>}\n {!configField && warningText && <WarningText {...warningProps}>{warningText}</WarningText>}\n {!configField && errorText && <ErrorText {...errorProps}>{errorText}</ErrorText>}\n </FormControl>\n );\n});\n\nexport default FormField;\n","import { uniqueId } from 'lodash-es';\nimport { forwardRef, useMemo } from 'react';\n\nimport Checkbox, { type CheckboxProps } from '#src/components/Checkbox';\nimport Combobox from '#src/components/Combobox';\nimport type { ComboboxMultiSelectProps } from '#src/components/Combobox/ComboboxMultiSelect';\nimport type { ComboboxSingleSelectProps } from '#src/components/Combobox/ComboboxSingleSelect';\nimport FormField, { type FormFieldBaseProps } from '#src/components/FormField/FormField';\nimport Input, { type InputProps } from '#src/components/Input';\nimport RadioGroup, { type RadioGroupProps } from '#src/components/RadioGroup';\nimport SegmentedControl, { type SegmentedControlProps } from '#src/components/SegmentedControl';\nimport Select, { type SelectProps } from '#src/components/Select';\nimport TextArea, { type TextAreaProps } from '#src/components/TextArea';\nimport Toggle, { type ToggleProps } from '#src/components/Toggle';\n\nexport type ImplementsFormField = Omit<FormFieldBaseProps, 'children'>;\n\ntype ExtractFormFieldProps<T extends ImplementsFormField> = Pick<\n T,\n | 'label'\n | 'inputId'\n | 'required'\n | 'helperText'\n | 'errorText'\n | 'warningText'\n | 'labelProps'\n | 'helperProps'\n | 'warningProps'\n | 'errorProps'\n | 'configField'\n | 'configFieldInputWidth'\n | 'rightActions'\n>;\ntype OmitFormFieldProps<T extends ImplementsFormField> = Omit<\n T,\n Exclude<keyof ExtractFormFieldProps<T>, 'required'>\n>;\n\n/**\n * Helper to split out props that are sent to the FormField component from props sent\n * to the underlying input component.\n */\nexport const splitOutFormFieldProps = <T extends ImplementsFormField>(\n props: T,\n): {\n formFieldProps: ExtractFormFieldProps<T>;\n inputProps: OmitFormFieldProps<T>;\n} => {\n const {\n label,\n inputId,\n helperText,\n errorText,\n warningText,\n labelProps,\n helperProps,\n warningProps,\n errorProps,\n configField,\n configFieldInputWidth,\n rightActions,\n ...inputProps\n } = props;\n\n return {\n formFieldProps: {\n label,\n inputId,\n required: props.required,\n helperText,\n errorText,\n warningText,\n labelProps,\n helperProps,\n warningProps,\n errorProps,\n configField,\n configFieldInputWidth,\n rightActions,\n },\n inputProps,\n };\n};\n\nexport interface TextFieldProps extends ImplementsFormField, InputProps {}\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n function TextField(props, ref) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n const { id, ...rest } = inputProps;\n\n return (\n <FormField\n {...formFieldProps}\n labelProps={{ size: props.size, ...formFieldProps.labelProps }}\n inputId={formFieldProps.inputId ?? id}\n >\n <Input {...rest} ref={ref} />\n </FormField>\n );\n },\n);\n\nexport interface TextAreaFieldProps extends ImplementsFormField, TextAreaProps {}\n\nexport const TextAreaField = forwardRef<HTMLTextAreaElement, TextAreaFieldProps>(\n function TextAreaField(props, ref) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n const { id, ...rest } = inputProps;\n\n return (\n <FormField\n {...formFieldProps}\n labelProps={{ size: props.size, ...formFieldProps.labelProps }}\n inputId={formFieldProps.inputId ?? id}\n >\n <TextArea {...rest} ref={ref} />\n </FormField>\n );\n },\n);\n\nexport interface SelectFieldProps extends ImplementsFormField, SelectProps {}\n\nexport const SelectField = ({ id, children, ...props }: SelectFieldProps) => {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n const linkedId = useMemo(\n () => formFieldProps.inputId ?? id ?? uniqueId('pds-form-field-input-fields-select__'),\n [formFieldProps.inputId, id],\n );\n\n return (\n <FormField\n {...formFieldProps}\n inputId={linkedId}\n labelProps={{ htmlFor: linkedId, size: inputProps.size, ...formFieldProps.labelProps }}\n >\n <Select {...inputProps} id={linkedId}>\n {children}\n </Select>\n </FormField>\n );\n};\n\nexport interface RadioGroupFieldProps\n extends Omit<ImplementsFormField, 'configField'>, RadioGroupProps {}\n\nexport const RadioGroupField = ({\n label,\n helperText,\n errorText,\n warningText,\n required,\n children,\n ...props\n}: RadioGroupFieldProps) => {\n return (\n <FormField\n label={label}\n helperText={helperText}\n warningText={warningText}\n errorText={errorText}\n required={required}\n >\n <RadioGroup {...props} aria-required={required}>\n {children}\n </RadioGroup>\n </FormField>\n );\n};\n\nexport interface CheckboxFieldProps extends ImplementsFormField, CheckboxProps {\n checkboxLabel?: CheckboxProps['label'];\n}\n\nexport const CheckboxField = ({\n label,\n helperText,\n errorText,\n warningText,\n checkboxLabel,\n configField,\n labelProps,\n required,\n ...props\n}: CheckboxFieldProps) => {\n return (\n <FormField\n label={label}\n helperText={helperText}\n warningText={warningText}\n errorText={errorText}\n configField={configField}\n labelProps={labelProps}\n required={required}\n >\n <Checkbox label={checkboxLabel} required={required} {...props} />\n </FormField>\n );\n};\n\nexport interface ToggleFieldProps extends ImplementsFormField, ToggleProps {}\n\nexport const ToggleField = forwardRef<HTMLDivElement, ToggleFieldProps>(\n function ToggleField(props, ref) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n\n return (\n <FormField\n {...formFieldProps}\n labelProps={{ size: inputProps.size, ...formFieldProps.labelProps }}\n >\n <Toggle {...inputProps} ref={ref} />\n </FormField>\n );\n },\n);\n\nexport interface SegmentedControlFieldProps\n extends ImplementsFormField, Omit<SegmentedControlProps, 'children'> {\n children?: SegmentedControlProps['children'];\n}\n\nexport const SegmentedControlField = forwardRef<HTMLDivElement, SegmentedControlFieldProps>(\n function SegmentedControlField(\n {\n label,\n helperText,\n errorText,\n warningText,\n configField,\n required,\n children,\n labelProps,\n ...props\n },\n ref,\n ) {\n return (\n <FormField\n label={label}\n helperText={helperText}\n warningText={warningText}\n errorText={errorText}\n configField={configField}\n labelProps={labelProps}\n required={required}\n >\n <SegmentedControl fullWidth {...props} aria-required={required} ref={ref}>\n {children}\n </SegmentedControl>\n </FormField>\n );\n },\n);\n\nexport type ComboboxSingleSelectFieldProps<T = string> = ImplementsFormField &\n ComboboxSingleSelectProps<T>;\nexport type ComboboxMultiSelectFieldProps<T = string> = ImplementsFormField &\n ComboboxMultiSelectProps<T>;\n\nexport const ComboboxField = (\n props: ComboboxSingleSelectFieldProps | ComboboxMultiSelectFieldProps,\n) => {\n // `Combobox` registers its own id with the surrounding `FormControl`, which is what links the\n // label to it, so the field only forwards an explicit `inputId` when one is given. Each mode is\n // split separately: `multiple` discriminates the two, and a union split at once loses that.\n if (props.multiple) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n\n return (\n <FormField {...formFieldProps}>\n <Combobox {...inputProps} />\n </FormField>\n );\n }\n\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n\n return (\n <FormField {...formFieldProps}>\n <Combobox {...inputProps} />\n </FormField>\n );\n};\n","import {\n Children,\n cloneElement,\n type ComponentPropsWithRef,\n createContext,\n type ReactElement,\n type ReactNode,\n useContext,\n useRef,\n} from 'react';\nimport {\n type AriaCheckboxGroupProps,\n mergeProps,\n useCheckboxGroup,\n useCheckboxGroupItem,\n} from 'react-aria';\nimport innerText from 'react-innertext';\nimport { type CheckboxGroupState, useCheckboxGroupState } from 'react-stately';\n\nimport type { CheckboxProps } from '#src/components/Checkbox';\nimport type Checkbox from '#src/components/Checkbox';\nimport { FormControlContext } from '#src/components/FormControl/useFormField';\nimport FormField from '#src/components/FormField/FormField';\nimport type { ImplementsFormField } from '#src/components/FormField/inputFields';\n\n/* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\nconst CheckboxGroupContext = createContext<CheckboxGroupState>(null);\n\n/** Preserves the parent FormControl context (disabled, hasError, etc.) but clears\n * inputId so each Checkbox inside the group generates its own unique id. */\nconst ClearGroupInputId = ({ children }: { children: ReactNode }) => {\n const parentContext = useContext(FormControlContext);\n return (\n <FormControlContext.Provider value={{ ...parentContext, inputId: undefined }}>\n {children}\n </FormControlContext.Provider>\n );\n};\n\ninterface CheckboxGroupItemProps {\n children: ReactElement<ComponentPropsWithRef<typeof Checkbox>>;\n}\n\nconst CheckboxGroupItem = (props: CheckboxGroupItemProps) => {\n const { children } = props;\n const checkboxProps = children.props;\n\n const state = useContext(CheckboxGroupContext);\n const ref = useRef();\n const { inputProps } = useCheckboxGroupItem(\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n {\n ...checkboxProps,\n onChange: undefined,\n isDisabled: checkboxProps.disabled,\n isReadOnly: checkboxProps.readOnly,\n isRequired: checkboxProps.required,\n isIndeterminate: checkboxProps.indeterminate,\n value: String(children.props.value),\n 'aria-label': innerText(checkboxProps.label),\n },\n state,\n ref,\n );\n\n return cloneElement(\n children,\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n mergeProps(inputProps, {\n onChange: checkboxProps.onChange,\n disabled: state.isDisabled || checkboxProps.disabled,\n checked: state.isSelected(String(inputProps.value)),\n ref,\n } as ComponentPropsWithRef<typeof Checkbox>),\n );\n};\n\ninterface CheckboxGroupFieldProps\n extends\n Omit<ImplementsFormField, 'configField'>,\n Omit<\n AriaCheckboxGroupProps,\n 'description' | 'disabled' | 'isReadOnly' | 'isRequired' | 'errorMessage'\n > {\n children?: ReactElement<CheckboxProps>[];\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n}\n\nconst CheckboxGroupField = ({\n children,\n name,\n onChange,\n disabled,\n readOnly,\n required,\n ...props\n}: CheckboxGroupFieldProps) => {\n const reactAriaProps = {\n ...props,\n description: props.helperText,\n errorMessage: props.errorText,\n onChange,\n name,\n isDisabled: disabled,\n isReadOnly: readOnly,\n isRequired: required,\n };\n const state = useCheckboxGroupState(reactAriaProps);\n const { groupProps, labelProps, descriptionProps, errorMessageProps } = useCheckboxGroup(\n reactAriaProps,\n state,\n );\n\n return (\n <FormField\n labelProps={labelProps}\n helperProps={descriptionProps}\n errorProps={errorMessageProps}\n disabled={disabled}\n required={required}\n {...groupProps}\n {...props}\n >\n <ClearGroupInputId>\n <CheckboxGroupContext.Provider value={state}>\n {Children.map(children, (checkbox) => (\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n <CheckboxGroupItem>{checkbox}</CheckboxGroupItem>\n ))}\n </CheckboxGroupContext.Provider>\n </ClearGroupInputId>\n </FormField>\n );\n};\n\nexport default CheckboxGroupField;\n","import { type ReactNode, useState } from 'react';\n\nimport { MoreIcon, PlusIcon } from '@persona/icons';\n\nimport { IconButton } from '#src/components/Button';\nimport useFormGroup from '#src/components/ConfigFormGroup/useFormGroup';\nimport DropdownMenu from '#src/components/DropdownMenu';\nimport FormField from '#src/components/FormField/FormField';\nimport type { ImplementsFormField } from '#src/components/FormField/inputFields';\nimport ListBox, { type ListBoxProps } from '#src/components/ListBox';\nimport type { MenuItemProps } from '#src/components/Menu';\n\ninterface ListBoxFieldAction extends Omit<MenuItemProps, 'children'> {\n label: string;\n onClick: (selectedKeys: ListBoxProps<any>['selectedKeys']) => void;\n}\n\ninterface AddDropdownConfig {\n options: ({ label: ReactNode; value: string } & Omit<MenuItemProps, 'children'>)[];\n onSelection: (value: string) => void;\n}\n\ninterface ListBoxFieldProps<T extends object> extends ImplementsFormField, ListBoxProps<T> {\n actions?: ListBoxFieldAction[];\n addDropdownConfig?: AddDropdownConfig;\n /** Disables the add button, e.g. while the list is read-only. */\n addDisabled?: boolean;\n}\n\nconst ListBoxField = <T extends object>({\n label,\n helperText,\n errorText,\n warningText,\n labelProps,\n helperProps,\n errorProps,\n warningProps,\n inputId,\n required,\n onAdd,\n onDelete,\n deleteDisabled,\n configField: configFieldProp,\n size = 'md',\n actions = [],\n addDropdownConfig,\n addDisabled,\n selectedKeys: selectedKeysProp,\n onSelectionChange,\n defaultSelectedKeys,\n ...props\n}: ListBoxFieldProps<T>) => {\n const { configField } = useFormGroup({ configField: configFieldProp });\n const menuActions: ListBoxFieldAction[] = [...actions];\n const [selectedKeysState, setSelectedKeys] = useState(defaultSelectedKeys);\n const selectedKeys = selectedKeysProp ?? selectedKeysState;\n const effectiveSize = configField ? 'sm' : size;\n\n if (onDelete) {\n menuActions.unshift({\n label: 'Delete',\n onClick: () => onDelete(selectedKeys),\n disabled:\n deleteDisabled ||\n selectedKeys == null ||\n (typeof selectedKeys === 'object' && [...selectedKeys].length === 0),\n });\n }\n\n const addButton = (\n <IconButton size='sm' onClick={onAdd} aria-label='Add item to list' disabled={addDisabled}>\n <PlusIcon />\n </IconButton>\n );\n\n return (\n <FormField\n label={label}\n helperText={helperText}\n errorText={errorText}\n warningText={warningText}\n labelProps={labelProps}\n helperProps={helperProps}\n errorProps={errorProps}\n warningProps={warningProps}\n inputId={inputId}\n required={required}\n configField={configField}\n rightActions={\n configField && (\n <>\n {menuActions.length > 0 && (\n <DropdownMenu\n trigger={\n <IconButton aria-label='Actions' size='sm'>\n <MoreIcon />\n </IconButton>\n }\n portal\n >\n {menuActions.map((action) => (\n <DropdownMenu.Item\n key={action.label}\n {...action}\n onClick={() => action.onClick(selectedKeys)}\n size={effectiveSize}\n >\n {action.label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu>\n )}\n {onAdd && !addDropdownConfig && addButton}\n {addDropdownConfig && (\n <DropdownMenu trigger={addButton} align='start' portal>\n {addDropdownConfig.options.map((option) => (\n <DropdownMenu.Item\n key={option.value}\n {...option}\n onClick={() => addDropdownConfig.onSelection(option.value)}\n size={effectiveSize}\n >\n {option.label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu>\n )}\n </>\n )\n }\n >\n <ListBox\n id={inputId}\n fullWidth={configField}\n size={effectiveSize}\n deleteDisabled={deleteDisabled}\n // We have to control the keys so we can power the `rightActions`\n selectedKeys={selectedKeys}\n onSelectionChange={(keys) => {\n onSelectionChange?.(keys);\n setSelectedKeys(keys);\n }}\n {...props}\n />\n </FormField>\n );\n};\n\nexport default ListBoxField;\n","import { Fragment, type MouseEvent, type ReactNode, useState } from 'react';\n\nimport { IconButton } from '@persona/design-system/components/Button';\nimport { useFormGroup } from '@persona/design-system/components/ConfigFormGroup';\nimport DropdownMenu from '@persona/design-system/components/DropdownMenu';\nimport type { FormLabelProps } from '@persona/design-system/components/FormControl';\nimport type { MenuItemProps } from '@persona/design-system/components/Menu';\nimport TableBox, { type TableBoxProps } from '@persona/design-system/components/TableBox';\nimport { MoreIcon, PlusIcon } from '@persona/icons';\n\nimport FormField from './FormField';\nimport type { ImplementsFormField } from './inputFields';\n\nexport interface TableBoxFieldAction extends Omit<MenuItemProps, 'children'> {\n label: string;\n onClick: (selectedKey: TableBoxProps['selectedKey']) => void;\n}\n\nexport interface TableBoxFieldActionGroup {\n type: 'group';\n heading: string;\n actions: TableBoxFieldAction[];\n}\n\nexport type TableBoxFieldActionEntry = TableBoxFieldAction | TableBoxFieldActionGroup;\n\n/** Aria-label on TableBoxField's + button. Consumers that style or detect that\n * button (e.g. popover toggle guards) should import this rather than redefining it. */\nexport const TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL = 'Add item to table';\n\nconst isActionGroup = (action: TableBoxFieldActionEntry): action is TableBoxFieldActionGroup =>\n 'type' in action && action.type === 'group';\n\ninterface AddDropdownConfig {\n options: Array<{ label: string; value: string }>;\n onSelection: (value: string) => void;\n}\n\ninterface TableBoxFieldProps<T extends object = object>\n extends ImplementsFormField, Omit<TableBoxProps<T>, 'aria-label' | 'onCreateNewRow'> {\n onAdd?: (e: MouseEvent<HTMLButtonElement>) => void;\n onDelete?: (selectedKey: string | null) => void;\n deleteDisabled?: boolean;\n /** Actions and labeled action groups rendered in order. Empty groups are omitted. */\n actions?: TableBoxFieldActionEntry[];\n addDropdownConfig?: AddDropdownConfig;\n\n /**\n * Callback to create a new row and add it to the rows array\n * Should return the id of the newly created row\n */\n createNewRow?: () => string;\n children?: ReactNode;\n}\n\nconst TableBoxField = <T extends object = object>({\n label,\n helperText,\n errorText,\n warningText,\n labelProps: labelPropsProp,\n helperProps,\n errorProps,\n warningProps,\n inputId,\n required,\n onAdd,\n onDelete,\n deleteDisabled,\n configField: configFieldProp = true,\n actions = [],\n addDropdownConfig,\n selectedKey: selectedKeyProp,\n onSelectionChange,\n defaultSelectedKey,\n selectionMode,\n disabled,\n createNewRow,\n children,\n emptyText = 'No data',\n ...props\n}: TableBoxFieldProps<T>) => {\n const { configField } = useFormGroup({ configField: configFieldProp });\n const menuActions: TableBoxFieldActionEntry[] = [...actions];\n const [selectedKeyState, setSelectedKey] = useState(defaultSelectedKey);\n const selectedKey = selectedKeyProp ?? selectedKeyState;\n const [newRowId, setNewRowId] = useState<string | null>(null);\n const labelProps: FormLabelProps = { size: 'sm', ...labelPropsProp };\n\n const handleCreateNewRow = () => {\n if (createNewRow) {\n setNewRowId(createNewRow());\n }\n };\n\n // Handle add button click\n const handleAddClick = (e: MouseEvent<HTMLButtonElement>) => {\n if (createNewRow) {\n handleCreateNewRow();\n } else if (onAdd) {\n onAdd(e);\n }\n };\n\n if (onDelete) {\n menuActions.unshift({\n label: 'Delete',\n onClick: () => selectedKey && onDelete(selectedKey),\n disabled: deleteDisabled || selectedKey == null,\n });\n }\n const visibleMenuActions = menuActions.filter(\n (action) => !isActionGroup(action) || action.actions.length > 0,\n );\n\n const addButton = (\n <IconButton\n size='sm'\n onClick={handleAddClick}\n aria-label={TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL}\n disabled={disabled}\n >\n <PlusIcon />\n </IconButton>\n );\n\n return (\n <FormField\n label={label}\n helperText={helperText}\n errorText={errorText}\n warningText={warningText}\n labelProps={labelProps}\n helperProps={helperProps}\n errorProps={errorProps}\n warningProps={warningProps}\n inputId={inputId}\n required={required}\n rightActions={\n configField && (\n <>\n {visibleMenuActions.length > 0 && (\n <DropdownMenu\n trigger={\n <IconButton aria-label='Actions' size='sm' disabled={disabled}>\n <MoreIcon />\n </IconButton>\n }\n portal\n >\n {visibleMenuActions.map((entry, entryIndex) => {\n const previousEntry = visibleMenuActions[entryIndex - 1];\n if (isActionGroup(entry)) {\n return (\n <Fragment key={`${entry.heading}-${entryIndex}`}>\n {entryIndex > 0 && <DropdownMenu.Divider />}\n <DropdownMenu.Heading size='sm'>{entry.heading}</DropdownMenu.Heading>\n {entry.actions.map((action) => (\n <DropdownMenu.Item\n key={action.label}\n {...action}\n disabled={disabled || action.disabled}\n onClick={() => action.onClick(selectedKey)}\n size='sm'\n >\n {action.label}\n </DropdownMenu.Item>\n ))}\n </Fragment>\n );\n }\n\n return (\n <Fragment key={`${entry.label}-${entryIndex}`}>\n {previousEntry && isActionGroup(previousEntry) && <DropdownMenu.Divider />}\n <DropdownMenu.Item\n {...entry}\n disabled={disabled || entry.disabled}\n onClick={() => entry.onClick(selectedKey)}\n size='sm'\n >\n {entry.label}\n </DropdownMenu.Item>\n </Fragment>\n );\n })}\n </DropdownMenu>\n )}\n {(onAdd || createNewRow) && !addDropdownConfig && addButton}\n {addDropdownConfig && (\n <DropdownMenu trigger={addButton} portal>\n {addDropdownConfig.options.map((option) => (\n <DropdownMenu.Item\n key={option.value}\n {...option}\n onClick={() => addDropdownConfig.onSelection(option.value)}\n size='sm'\n >\n {option.label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu>\n )}\n </>\n )\n }\n >\n <TableBox\n aria-label={`${label} table`}\n // We have to control the keys so we can power the `rightActions`\n selectedKey={selectedKey}\n onSelectionChange={(key) => {\n onSelectionChange?.(key);\n setSelectedKey(key);\n }}\n selectionMode={selectionMode}\n newRowId={newRowId}\n onCreateNewRow={createNewRow ? handleCreateNewRow : undefined}\n emptyText={emptyText}\n disabled={disabled}\n {...props}\n >\n {children}\n </TableBox>\n </FormField>\n );\n};\n\n// Attach subcomponents to TableBoxField\nTableBoxField.Row = TableBox.Row;\nTableBoxField.Cell = TableBox.Cell;\n\nexport default TableBoxField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAw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V,GAAI;GAEH;GACQ,CAAA;EACD,CAAA;;AAKhB,cAAc,MAAM,SAAS;AAC7B,cAAc,OAAO,SAAS"}
1
+ {"version":3,"file":"FormField-yYJFkJ6R.mjs","names":["Input","TextArea","DropdownMenu","DropdownMenu"],"sources":["../src/components/FormField/FormField.tsx","../src/components/FormField/inputFields.tsx","../src/components/FormField/CheckboxGroupField.tsx","../src/components/FormField/ListBoxField.tsx","../src/components/FormField/TableBoxField.tsx"],"sourcesContent":["import { type ComponentPropsWithRef, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { Spacing } from '@persona/design-tokens';\n\nimport useFormGroup from '#src/components/ConfigFormGroup/useFormGroup';\nimport FormControl, {\n ErrorText,\n type FormControlProps,\n FormInputContainer,\n FormLabel,\n HelperText,\n WarningText,\n} from '#src/components/FormControl';\nimport { HStack } from '#src/components/Stack';\n\nexport interface FormFieldBaseProps {\n /**\n * Renders `<Label>` above input\n */\n label?: ReactNode;\n\n /**\n * ID of the input element. Providing this will automatically link the label to the input.\n */\n inputId?: string;\n\n /** Marks the field as required. The label renders an asterisk; composed fields also forward `required` to their input. */\n required?: boolean;\n\n /**\n * Renders `<HelperText>` below input\n */\n helperText?: ReactNode;\n\n /**\n * Renders `<ErrorText>` below input and helper text.\n */\n errorText?: ReactNode;\n\n /**\n * Renders `<WarningText>` below input and helper text.\n */\n warningText?: ReactNode;\n\n /**\n * Should be an input of some sort\n */\n children?: ReactElement;\n\n labelProps?: ComponentPropsWithRef<typeof FormLabel>;\n helperProps?: ComponentPropsWithRef<typeof HelperText>;\n warningProps?: ComponentPropsWithRef<typeof WarningText>;\n errorProps?: ComponentPropsWithRef<typeof ErrorText>;\n\n /**\n * Whether to render the form field as a config field.\n * This will render the helper text as a tooltip.\n */\n configField?: boolean;\n\n /**\n * Override the width of the input area when `configField` is true.\n * Accepts any valid CSS width value (e.g. `'33%'`, `'66.67%'`).\n * Defaults to `'50%'`.\n */\n configFieldInputWidth?: string;\n\n /**\n * Renders actions to the right of the label.\n */\n rightActions?: ReactNode;\n}\n\nexport interface FormFieldProps extends Omit<FormControlProps, 'children'>, FormFieldBaseProps {}\n\n/**\n * Helper component with preset slots for label, input, and helper texts.\n *\n * Prefer a composed field component, such as `<TextField>`, `<SelectField>`, or\n * `<CheckboxField>`, when one is available for the input type. Use `<FormField>` directly\n * when composing a custom control or layout.\n *\n * ## Usage\n *\n * ```tsx\n * import FormField from '@persona/design-system/components/FormField';\n * ```\n */\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(function FormField(\n {\n label,\n children,\n helperText,\n warningText,\n errorText,\n labelProps,\n helperProps,\n warningProps,\n errorProps,\n configField: configFieldProp,\n configFieldInputWidth,\n rightActions,\n ...props\n }: FormFieldProps,\n ref,\n) {\n const { configField: configFieldFormGroup } = useFormGroup();\n const configField = configFieldProp ?? configFieldFormGroup;\n\n const labelElement = label ? (\n <FormLabel tooltip={configField && helperText ? helperText : undefined} {...labelProps}>\n {label}\n </FormLabel>\n ) : null;\n\n return (\n <FormControl\n hasError={!!errorText}\n hasWarning={!!warningText}\n ref={ref}\n configField={configField}\n hasRightActions={!!rightActions}\n configFieldInputWidth={configFieldInputWidth}\n {...props}\n >\n {rightActions ? (\n <HStack justify='space-between' align='center'>\n {labelElement}\n <HStack spacing={Spacing[1]}>{rightActions}</HStack>\n </HStack>\n ) : (\n labelElement\n )}\n <FormInputContainer>{children}</FormInputContainer>\n {!configField && helperText && <HelperText {...helperProps}>{helperText}</HelperText>}\n {!configField && warningText && <WarningText {...warningProps}>{warningText}</WarningText>}\n {!configField && errorText && <ErrorText {...errorProps}>{errorText}</ErrorText>}\n </FormControl>\n );\n});\n\nexport default FormField;\n","import { uniqueId } from 'lodash-es';\nimport { forwardRef, useMemo } from 'react';\n\nimport Checkbox, { type CheckboxProps } from '#src/components/Checkbox';\nimport Combobox from '#src/components/Combobox';\nimport type { ComboboxMultiSelectProps } from '#src/components/Combobox/ComboboxMultiSelect';\nimport type { ComboboxSingleSelectProps } from '#src/components/Combobox/ComboboxSingleSelect';\nimport FormField, { type FormFieldBaseProps } from '#src/components/FormField/FormField';\nimport Input, { type InputProps } from '#src/components/Input';\nimport RadioGroup, { type RadioGroupProps } from '#src/components/RadioGroup';\nimport SegmentedControl, { type SegmentedControlProps } from '#src/components/SegmentedControl';\nimport Select, { type SelectProps } from '#src/components/Select';\nimport TextArea, { type TextAreaProps } from '#src/components/TextArea';\nimport Toggle, { type ToggleProps } from '#src/components/Toggle';\n\nexport type ImplementsFormField = Omit<FormFieldBaseProps, 'children'>;\n\ntype ExtractFormFieldProps<T extends ImplementsFormField> = Pick<\n T,\n | 'label'\n | 'inputId'\n | 'required'\n | 'helperText'\n | 'errorText'\n | 'warningText'\n | 'labelProps'\n | 'helperProps'\n | 'warningProps'\n | 'errorProps'\n | 'configField'\n | 'configFieldInputWidth'\n | 'rightActions'\n>;\ntype OmitFormFieldProps<T extends ImplementsFormField> = Omit<\n T,\n Exclude<keyof ExtractFormFieldProps<T>, 'required'>\n>;\n\n/**\n * Helper to split out props that are sent to the FormField component from props sent\n * to the underlying input component.\n */\nexport const splitOutFormFieldProps = <T extends ImplementsFormField>(\n props: T,\n): {\n formFieldProps: ExtractFormFieldProps<T>;\n inputProps: OmitFormFieldProps<T>;\n} => {\n const {\n label,\n inputId,\n helperText,\n errorText,\n warningText,\n labelProps,\n helperProps,\n warningProps,\n errorProps,\n configField,\n configFieldInputWidth,\n rightActions,\n ...inputProps\n } = props;\n\n return {\n formFieldProps: {\n label,\n inputId,\n required: props.required,\n helperText,\n errorText,\n warningText,\n labelProps,\n helperProps,\n warningProps,\n errorProps,\n configField,\n configFieldInputWidth,\n rightActions,\n },\n inputProps,\n };\n};\n\nexport interface TextFieldProps extends ImplementsFormField, InputProps {}\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n function TextField(props, ref) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n const { id, ...rest } = inputProps;\n\n return (\n <FormField\n {...formFieldProps}\n labelProps={{ size: props.size, ...formFieldProps.labelProps }}\n inputId={formFieldProps.inputId ?? id}\n >\n <Input {...rest} ref={ref} />\n </FormField>\n );\n },\n);\n\nexport interface TextAreaFieldProps extends ImplementsFormField, TextAreaProps {}\n\nexport const TextAreaField = forwardRef<HTMLTextAreaElement, TextAreaFieldProps>(\n function TextAreaField(props, ref) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n const { id, ...rest } = inputProps;\n\n return (\n <FormField\n {...formFieldProps}\n labelProps={{ size: props.size, ...formFieldProps.labelProps }}\n inputId={formFieldProps.inputId ?? id}\n >\n <TextArea {...rest} ref={ref} />\n </FormField>\n );\n },\n);\n\nexport interface SelectFieldProps extends ImplementsFormField, SelectProps {}\n\nexport const SelectField = ({ id, children, ...props }: SelectFieldProps) => {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n const linkedId = useMemo(\n () => formFieldProps.inputId ?? id ?? uniqueId('pds-form-field-input-fields-select__'),\n [formFieldProps.inputId, id],\n );\n\n return (\n <FormField\n {...formFieldProps}\n inputId={linkedId}\n labelProps={{ htmlFor: linkedId, size: inputProps.size, ...formFieldProps.labelProps }}\n >\n <Select {...inputProps} id={linkedId}>\n {children}\n </Select>\n </FormField>\n );\n};\n\nexport interface RadioGroupFieldProps\n extends Omit<ImplementsFormField, 'configField'>, RadioGroupProps {}\n\nexport const RadioGroupField = ({\n label,\n helperText,\n errorText,\n warningText,\n required,\n children,\n ...props\n}: RadioGroupFieldProps) => {\n return (\n <FormField\n label={label}\n helperText={helperText}\n warningText={warningText}\n errorText={errorText}\n required={required}\n >\n <RadioGroup {...props} aria-required={required}>\n {children}\n </RadioGroup>\n </FormField>\n );\n};\n\nexport interface CheckboxFieldProps extends ImplementsFormField, CheckboxProps {\n checkboxLabel?: CheckboxProps['label'];\n}\n\nexport const CheckboxField = ({\n label,\n helperText,\n errorText,\n warningText,\n checkboxLabel,\n configField,\n labelProps,\n required,\n ...props\n}: CheckboxFieldProps) => {\n return (\n <FormField\n label={label}\n helperText={helperText}\n warningText={warningText}\n errorText={errorText}\n configField={configField}\n labelProps={labelProps}\n required={required}\n >\n <Checkbox label={checkboxLabel} required={required} {...props} />\n </FormField>\n );\n};\n\nexport interface ToggleFieldProps extends ImplementsFormField, ToggleProps {}\n\nexport const ToggleField = forwardRef<HTMLDivElement, ToggleFieldProps>(\n function ToggleField(props, ref) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n\n return (\n <FormField\n {...formFieldProps}\n labelProps={{ size: inputProps.size, ...formFieldProps.labelProps }}\n >\n <Toggle {...inputProps} ref={ref} />\n </FormField>\n );\n },\n);\n\nexport interface SegmentedControlFieldProps\n extends ImplementsFormField, Omit<SegmentedControlProps, 'children'> {\n children?: SegmentedControlProps['children'];\n}\n\nexport const SegmentedControlField = forwardRef<HTMLDivElement, SegmentedControlFieldProps>(\n function SegmentedControlField(\n {\n label,\n helperText,\n errorText,\n warningText,\n configField,\n required,\n children,\n labelProps,\n ...props\n },\n ref,\n ) {\n return (\n <FormField\n label={label}\n helperText={helperText}\n warningText={warningText}\n errorText={errorText}\n configField={configField}\n labelProps={labelProps}\n required={required}\n >\n <SegmentedControl fullWidth {...props} aria-required={required} ref={ref}>\n {children}\n </SegmentedControl>\n </FormField>\n );\n },\n);\n\nexport type ComboboxSingleSelectFieldProps<T = string> = ImplementsFormField &\n ComboboxSingleSelectProps<T>;\nexport type ComboboxMultiSelectFieldProps<T = string> = ImplementsFormField &\n ComboboxMultiSelectProps<T>;\n\nexport const ComboboxField = (\n props: ComboboxSingleSelectFieldProps | ComboboxMultiSelectFieldProps,\n) => {\n // `Combobox` registers its own id with the surrounding `FormControl`, which is what links the\n // label to it, so the field only forwards an explicit `inputId` when one is given. Each mode is\n // split separately: `multiple` discriminates the two, and a union split at once loses that.\n if (props.multiple) {\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n\n return (\n <FormField {...formFieldProps}>\n <Combobox {...inputProps} />\n </FormField>\n );\n }\n\n const { formFieldProps, inputProps } = splitOutFormFieldProps(props);\n\n return (\n <FormField {...formFieldProps}>\n <Combobox {...inputProps} />\n </FormField>\n );\n};\n","import {\n Children,\n cloneElement,\n type ComponentPropsWithRef,\n createContext,\n type ReactElement,\n type ReactNode,\n useContext,\n useRef,\n} from 'react';\nimport {\n type AriaCheckboxGroupProps,\n mergeProps,\n useCheckboxGroup,\n useCheckboxGroupItem,\n} from 'react-aria';\nimport innerText from 'react-innertext';\nimport { type CheckboxGroupState, useCheckboxGroupState } from 'react-stately';\n\nimport type { CheckboxProps } from '#src/components/Checkbox';\nimport type Checkbox from '#src/components/Checkbox';\nimport { FormControlContext } from '#src/components/FormControl/useFormField';\nimport FormField from '#src/components/FormField/FormField';\nimport type { ImplementsFormField } from '#src/components/FormField/inputFields';\n\n/* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\nconst CheckboxGroupContext = createContext<CheckboxGroupState>(null);\n\n/** Preserves the parent FormControl context (disabled, hasError, etc.) but clears\n * inputId so each Checkbox inside the group generates its own unique id. */\nconst ClearGroupInputId = ({ children }: { children: ReactNode }) => {\n const parentContext = useContext(FormControlContext);\n return (\n <FormControlContext.Provider value={{ ...parentContext, inputId: undefined }}>\n {children}\n </FormControlContext.Provider>\n );\n};\n\ninterface CheckboxGroupItemProps {\n children: ReactElement<ComponentPropsWithRef<typeof Checkbox>>;\n}\n\nconst CheckboxGroupItem = (props: CheckboxGroupItemProps) => {\n const { children } = props;\n const checkboxProps = children.props;\n\n const state = useContext(CheckboxGroupContext);\n const ref = useRef();\n const { inputProps } = useCheckboxGroupItem(\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n {\n ...checkboxProps,\n onChange: undefined,\n isDisabled: checkboxProps.disabled,\n isReadOnly: checkboxProps.readOnly,\n isRequired: checkboxProps.required,\n isIndeterminate: checkboxProps.indeterminate,\n value: String(children.props.value),\n 'aria-label': innerText(checkboxProps.label),\n },\n state,\n ref,\n );\n\n return cloneElement(\n children,\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n mergeProps(inputProps, {\n onChange: checkboxProps.onChange,\n disabled: state.isDisabled || checkboxProps.disabled,\n checked: state.isSelected(String(inputProps.value)),\n ref,\n } as ComponentPropsWithRef<typeof Checkbox>),\n );\n};\n\ninterface CheckboxGroupFieldProps\n extends\n Omit<ImplementsFormField, 'configField'>,\n Omit<\n AriaCheckboxGroupProps,\n 'description' | 'disabled' | 'isReadOnly' | 'isRequired' | 'errorMessage'\n > {\n children?: ReactElement<CheckboxProps>[];\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n}\n\nconst CheckboxGroupField = ({\n children,\n name,\n onChange,\n disabled,\n readOnly,\n required,\n ...props\n}: CheckboxGroupFieldProps) => {\n const reactAriaProps = {\n ...props,\n description: props.helperText,\n errorMessage: props.errorText,\n onChange,\n name,\n isDisabled: disabled,\n isReadOnly: readOnly,\n isRequired: required,\n };\n const state = useCheckboxGroupState(reactAriaProps);\n const { groupProps, labelProps, descriptionProps, errorMessageProps } = useCheckboxGroup(\n reactAriaProps,\n state,\n );\n\n return (\n <FormField\n labelProps={labelProps}\n helperProps={descriptionProps}\n errorProps={errorMessageProps}\n disabled={disabled}\n required={required}\n {...groupProps}\n {...props}\n >\n <ClearGroupInputId>\n <CheckboxGroupContext.Provider value={state}>\n {Children.map(children, (checkbox) => (\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n <CheckboxGroupItem>{checkbox}</CheckboxGroupItem>\n ))}\n </CheckboxGroupContext.Provider>\n </ClearGroupInputId>\n </FormField>\n );\n};\n\nexport default CheckboxGroupField;\n","import { type ReactNode, useState } from 'react';\n\nimport { MoreIcon, PlusIcon } from '@persona/icons';\n\nimport { IconButton } from '#src/components/Button';\nimport useFormGroup from '#src/components/ConfigFormGroup/useFormGroup';\nimport DropdownMenu from '#src/components/DropdownMenu';\nimport FormField from '#src/components/FormField/FormField';\nimport type { ImplementsFormField } from '#src/components/FormField/inputFields';\nimport ListBox, { type ListBoxProps } from '#src/components/ListBox';\nimport type { MenuItemProps } from '#src/components/Menu';\n\ninterface ListBoxFieldAction extends Omit<MenuItemProps, 'children'> {\n label: string;\n onClick: (selectedKeys: ListBoxProps<any>['selectedKeys']) => void;\n}\n\ninterface AddDropdownConfig {\n options: ({ label: ReactNode; value: string } & Omit<MenuItemProps, 'children'>)[];\n onSelection: (value: string) => void;\n}\n\ninterface ListBoxFieldProps<T extends object> extends ImplementsFormField, ListBoxProps<T> {\n actions?: ListBoxFieldAction[];\n addDropdownConfig?: AddDropdownConfig;\n /** Disables the add button, e.g. while the list is read-only. */\n addDisabled?: boolean;\n}\n\nconst ListBoxField = <T extends object>({\n label,\n helperText,\n errorText,\n warningText,\n labelProps,\n helperProps,\n errorProps,\n warningProps,\n inputId,\n required,\n onAdd,\n onDelete,\n deleteDisabled,\n configField: configFieldProp,\n size = 'md',\n actions = [],\n addDropdownConfig,\n addDisabled,\n selectedKeys: selectedKeysProp,\n onSelectionChange,\n defaultSelectedKeys,\n ...props\n}: ListBoxFieldProps<T>) => {\n const { configField } = useFormGroup({ configField: configFieldProp });\n const menuActions: ListBoxFieldAction[] = [...actions];\n const [selectedKeysState, setSelectedKeys] = useState(defaultSelectedKeys);\n const selectedKeys = selectedKeysProp ?? selectedKeysState;\n const effectiveSize = configField ? 'sm' : size;\n\n if (onDelete) {\n menuActions.unshift({\n label: 'Delete',\n onClick: () => onDelete(selectedKeys),\n disabled:\n deleteDisabled ||\n selectedKeys == null ||\n (typeof selectedKeys === 'object' && [...selectedKeys].length === 0),\n });\n }\n\n const addButton = (\n <IconButton size='sm' onClick={onAdd} aria-label='Add item to list' disabled={addDisabled}>\n <PlusIcon />\n </IconButton>\n );\n\n return (\n <FormField\n label={label}\n helperText={helperText}\n errorText={errorText}\n warningText={warningText}\n labelProps={labelProps}\n helperProps={helperProps}\n errorProps={errorProps}\n warningProps={warningProps}\n inputId={inputId}\n required={required}\n configField={configField}\n rightActions={\n configField && (\n <>\n {menuActions.length > 0 && (\n <DropdownMenu\n trigger={\n <IconButton aria-label='Actions' size='sm'>\n <MoreIcon />\n </IconButton>\n }\n portal\n >\n {menuActions.map((action) => (\n <DropdownMenu.Item\n key={action.label}\n {...action}\n onClick={() => action.onClick(selectedKeys)}\n size={effectiveSize}\n >\n {action.label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu>\n )}\n {onAdd && !addDropdownConfig && addButton}\n {addDropdownConfig && (\n <DropdownMenu trigger={addButton} align='start' portal>\n {addDropdownConfig.options.map((option) => (\n <DropdownMenu.Item\n key={option.value}\n {...option}\n onClick={() => addDropdownConfig.onSelection(option.value)}\n size={effectiveSize}\n >\n {option.label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu>\n )}\n </>\n )\n }\n >\n <ListBox\n id={inputId}\n fullWidth={configField}\n size={effectiveSize}\n deleteDisabled={deleteDisabled}\n // We have to control the keys so we can power the `rightActions`\n selectedKeys={selectedKeys}\n onSelectionChange={(keys) => {\n onSelectionChange?.(keys);\n setSelectedKeys(keys);\n }}\n {...props}\n />\n </FormField>\n );\n};\n\nexport default ListBoxField;\n","import { Fragment, type MouseEvent, type ReactNode, useState } from 'react';\n\nimport { IconButton } from '@persona/design-system/components/Button';\nimport { useFormGroup } from '@persona/design-system/components/ConfigFormGroup';\nimport DropdownMenu from '@persona/design-system/components/DropdownMenu';\nimport type { FormLabelProps } from '@persona/design-system/components/FormControl';\nimport type { MenuItemProps } from '@persona/design-system/components/Menu';\nimport TableBox, { type TableBoxProps } from '@persona/design-system/components/TableBox';\nimport { MoreIcon, PlusIcon } from '@persona/icons';\n\nimport FormField from './FormField';\nimport type { ImplementsFormField } from './inputFields';\n\nexport interface TableBoxFieldAction extends Omit<MenuItemProps, 'children'> {\n label: string;\n onClick: (selectedKey: TableBoxProps['selectedKey']) => void;\n}\n\nexport interface TableBoxFieldActionGroup {\n type: 'group';\n heading: string;\n actions: TableBoxFieldAction[];\n}\n\nexport type TableBoxFieldActionEntry = TableBoxFieldAction | TableBoxFieldActionGroup;\n\n/** Aria-label on TableBoxField's + button. Consumers that style or detect that\n * button (e.g. popover toggle guards) should import this rather than redefining it. */\nexport const TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL = 'Add item to table';\n\nconst isActionGroup = (action: TableBoxFieldActionEntry): action is TableBoxFieldActionGroup =>\n 'type' in action && action.type === 'group';\n\ninterface AddDropdownConfig {\n options: Array<{ label: string; value: string }>;\n onSelection: (value: string) => void;\n}\n\ninterface TableBoxFieldProps<T extends object = object>\n extends ImplementsFormField, Omit<TableBoxProps<T>, 'aria-label' | 'onCreateNewRow'> {\n onAdd?: (e: MouseEvent<HTMLButtonElement>) => void;\n onDelete?: (selectedKey: string | null) => void;\n deleteDisabled?: boolean;\n /** Actions and labeled action groups rendered in order. Empty groups are omitted. */\n actions?: TableBoxFieldActionEntry[];\n addDropdownConfig?: AddDropdownConfig;\n\n /**\n * Callback to create a new row and add it to the rows array\n * Should return the id of the newly created row\n */\n createNewRow?: () => string;\n children?: ReactNode;\n}\n\nconst TableBoxField = <T extends object = object>({\n label,\n helperText,\n errorText,\n warningText,\n labelProps: labelPropsProp,\n helperProps,\n errorProps,\n warningProps,\n inputId,\n required,\n onAdd,\n onDelete,\n deleteDisabled,\n configField: configFieldProp = true,\n actions = [],\n addDropdownConfig,\n selectedKey: selectedKeyProp,\n onSelectionChange,\n defaultSelectedKey,\n selectionMode,\n disabled,\n createNewRow,\n children,\n emptyText = 'No data',\n ...props\n}: TableBoxFieldProps<T>) => {\n const { configField } = useFormGroup({ configField: configFieldProp });\n const menuActions: TableBoxFieldActionEntry[] = [...actions];\n const [selectedKeyState, setSelectedKey] = useState(defaultSelectedKey);\n const selectedKey = selectedKeyProp ?? selectedKeyState;\n const [newRowId, setNewRowId] = useState<string | null>(null);\n const labelProps: FormLabelProps = { size: 'sm', ...labelPropsProp };\n\n const handleCreateNewRow = () => {\n if (createNewRow) {\n setNewRowId(createNewRow());\n }\n };\n\n // Handle add button click\n const handleAddClick = (e: MouseEvent<HTMLButtonElement>) => {\n if (createNewRow) {\n handleCreateNewRow();\n } else if (onAdd) {\n onAdd(e);\n }\n };\n\n if (onDelete) {\n menuActions.unshift({\n label: 'Delete',\n onClick: () => selectedKey && onDelete(selectedKey),\n disabled: deleteDisabled || selectedKey == null,\n });\n }\n const visibleMenuActions = menuActions.filter(\n (action) => !isActionGroup(action) || action.actions.length > 0,\n );\n\n const addButton = (\n <IconButton\n size='sm'\n onClick={handleAddClick}\n aria-label={TABLE_BOX_FIELD_ADD_BUTTON_ARIA_LABEL}\n disabled={disabled}\n >\n <PlusIcon />\n </IconButton>\n );\n\n return (\n <FormField\n label={label}\n helperText={helperText}\n errorText={errorText}\n warningText={warningText}\n labelProps={labelProps}\n helperProps={helperProps}\n errorProps={errorProps}\n warningProps={warningProps}\n inputId={inputId}\n required={required}\n rightActions={\n configField && (\n <>\n {visibleMenuActions.length > 0 && (\n <DropdownMenu\n trigger={\n <IconButton aria-label='Actions' size='sm' disabled={disabled}>\n <MoreIcon />\n </IconButton>\n }\n portal\n >\n {visibleMenuActions.map((entry, entryIndex) => {\n const previousEntry = visibleMenuActions[entryIndex - 1];\n if (isActionGroup(entry)) {\n return (\n <Fragment key={`${entry.heading}-${entryIndex}`}>\n {entryIndex > 0 && <DropdownMenu.Divider />}\n <DropdownMenu.Heading size='sm'>{entry.heading}</DropdownMenu.Heading>\n {entry.actions.map((action) => (\n <DropdownMenu.Item\n key={action.label}\n {...action}\n disabled={disabled || action.disabled}\n onClick={() => action.onClick(selectedKey)}\n size='sm'\n >\n {action.label}\n </DropdownMenu.Item>\n ))}\n </Fragment>\n );\n }\n\n return (\n <Fragment key={`${entry.label}-${entryIndex}`}>\n {previousEntry && isActionGroup(previousEntry) && <DropdownMenu.Divider />}\n <DropdownMenu.Item\n {...entry}\n disabled={disabled || entry.disabled}\n onClick={() => entry.onClick(selectedKey)}\n size='sm'\n >\n {entry.label}\n </DropdownMenu.Item>\n </Fragment>\n );\n })}\n </DropdownMenu>\n )}\n {(onAdd || createNewRow) && !addDropdownConfig && addButton}\n {addDropdownConfig && (\n <DropdownMenu trigger={addButton} portal>\n {addDropdownConfig.options.map((option) => (\n <DropdownMenu.Item\n key={option.value}\n {...option}\n onClick={() => addDropdownConfig.onSelection(option.value)}\n size='sm'\n >\n {option.label}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu>\n )}\n </>\n )\n }\n >\n <TableBox\n aria-label={`${label} table`}\n // We have to control the keys so we can power the `rightActions`\n selectedKey={selectedKey}\n onSelectionChange={(key) => {\n onSelectionChange?.(key);\n setSelectedKey(key);\n }}\n selectionMode={selectionMode}\n newRowId={newRowId}\n onCreateNewRow={createNewRow ? handleCreateNewRow : undefined}\n emptyText={emptyText}\n disabled={disabled}\n {...props}\n >\n {children}\n </TableBox>\n </FormField>\n );\n};\n\n// Attach subcomponents to TableBoxField\nTableBoxField.Row = TableBox.Row;\nTableBoxField.Cell = TableBox.Cell;\n\nexport default TableBoxField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,MAAa,YAAY,WAA2C,SAAS,UAC3E,EACE,OACA,UACA,YACA,aACA,WACA,YACA,aACA,cACA,YACA,aAAa,iBACb,uBACA,cACA,GAAG,SAEL,KACA;CACA,MAAM,EAAE,aAAa,yBAAyB,cAAc;CAC5D,MAAM,cAAc,mBAAmB;CAEvC,MAAM,eAAe,QACnB,oBAAC,WAAD;EAAW,SAAS,eAAe,aAAa,aAAa,KAAA;EAAW,GAAI;YACzE;EACS,CAAA,GACV;AAEJ,QACE,qBAAC,aAAD;EACE,UAAU,CAAC,CAAC;EACZ,YAAY,CAAC,CAAC;EACT;EACQ;EACb,iBAAiB,CAAC,CAAC;EACI;EACvB,GAAI;YAPN;GASG,eACC,qBAAC,QAAD;IAAQ,SAAQ;IAAgB,OAAM;cAAtC,CACG,cACD,oBAAC,QAAD;KAAQ,SAAS,QAAQ;eAAK;KAAsB,CAAA,CAC7C;QAET;GAEF,oBAAC,oBAAD,EAAqB,UAA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AC1E,oBAACA,qBAAa,MAAd;MACE,GAAI;MACJ,UAAU,YAAY,MAAM;MAC5B,eAAe,MAAM,QAAQ,YAAY;MACzC,MAAK;gBAEJ,MAAM;MACW,CAAA,CACX,EAAA,EAVI,GAAG,MAAM,MAAM,GAAG,aAUtB;MAEb;IACW,CAAA;IAEf,SAAS,iBAAiB,CAAC,qBAAqB;GACjD,qBACC,oBAACA,sBAAD;IAAc,SAAS;IAAW,QAAA;cAC/B,kBAAkB,QAAQ,KAAK,WAC9B,oBAACA,qBAAa,MAAd;KAEE,GAAI;KACJ,eAAe,kBAAkB,YAAY,OAAO,MAAM;KAC1D,MAAK;eAEJ,OAAO;KACU,EANb,OAAO,MAMM,CACpB;IACW,CAAA;GAEhB,EAAA,CAAA;YAIP,oBAAC,UAAD;GACE,cAAY,GAAG,MAAM;GAER;GACb,oBAAoB,QAAQ;AAC1B,wBAAoB,IAAI;AACxB,mBAAe,IAAI;;GAEN;GACL;GACV,gBAAgB,eAAe,qBAAqB,KAAA;GACzC;GACD;GACV,GAAI;GAEH;GACQ,CAAA;EACD,CAAA;;AAKhB,cAAc,MAAM,SAAS;AAC7B,cAAc,OAAO,SAAS"}
@@ -4,8 +4,8 @@ import { i as Paragraph } from "./Text-D0vEReED.mjs";
4
4
  import { t as useToggle } from "./useToggle-1z8JE7Ym.mjs";
5
5
  import { fadeIn } from "./variables/keyframes.mjs";
6
6
  import "./variables/transitions.mjs";
7
- import { n as Button } from "./IconButton-DxHB2g80.mjs";
8
- import { s as Popover_default } from "./Popover-DordjYNM.mjs";
7
+ import { n as Button } from "./IconButton-Bj1fry_K.mjs";
8
+ import { s as Popover_default } from "./Popover-CVX-dfYb.mjs";
9
9
  import { Spacing } from "@persona/design-tokens";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { CopyIcon } from "@persona/icons";
@@ -39,8 +39,13 @@ const CopyButton = styled(Button).attrs(() => ({
39
39
  }))`
40
40
  height: ${Spacing[5]};
41
41
  width: ${Spacing[5]};
42
+ opacity: ${({ isActive }) => isActive ? 1 : 0};
42
43
  visibility: ${({ isActive }) => isActive ? "visible" : "hidden"};
43
- animation: ${fadeIn} ${"400ms"} ease-in-out;
44
+ transition: ${({ isActive }) => [...[
45
+ "background-color",
46
+ "color",
47
+ "border-color"
48
+ ].map((property) => `${property} 200ms cubic-bezier(0.4, 0, 0.2, 1)`), isActive ? `opacity 200ms cubic-bezier(0, 0, 0.2, 1), visibility 0s` : `opacity 150ms cubic-bezier(0.4, 0, 1, 1), visibility 0s linear 150ms`].join(", ")};
44
49
  svg {
45
50
  width: 14px;
46
51
  height: 14px;
@@ -51,7 +56,7 @@ const StyledCard = styled(Card_default)`
51
56
  align-items: center;
52
57
  justify-content: center;
53
58
  border-radius: 4px;
54
- animation: ${fadeIn} ${"400ms"} ease-in-out;
59
+ animation: ${fadeIn} ${"200ms"} ${"cubic-bezier(0, 0, 0.2, 1)"};
55
60
  padding: 6px;
56
61
  margin: 0;
57
62
  `;
@@ -111,4 +116,4 @@ const HoverCopyableField = ({ copyValue, confirmationText = "Copied", onCopySucc
111
116
  //#endregion
112
117
  export { HoverCopyableField as t };
113
118
 
114
- //# sourceMappingURL=HoverCopyableField-XHC_n9tp.mjs.map
119
+ //# sourceMappingURL=HoverCopyableField-X2XfKTTh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HoverCopyableField-X2XfKTTh.mjs","names":["Card","Popover"],"sources":["../src/components/HoverCopyableField/HoverCopyableField.tsx"],"sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\nimport styled from 'styled-components';\n\nimport { Spacing } from '@persona/design-tokens';\nimport { CopyIcon } from '@persona/icons';\n\nimport Button from '#src/components/Button';\nimport Card from '#src/components/Card';\nimport Popover from '#src/components/Popover';\nimport { Paragraph } from '#src/components/Text';\nimport useToggle from '#src/lib/useToggle';\nimport { fadeIn } from '#src/variables/keyframes';\nimport { TransitionDuration, TransitionEasing } from '#src/variables/transitions';\n\nexport type CopySuccessDetail = {\n text: string;\n clientX: number;\n clientY: number;\n};\n\nexport type HoverCopyableFieldProps = {\n copyValue: string | undefined;\n confirmationText?: string;\n /**\n * Called after a successful clipboard write. When provided, the Copied\n * popover is skipped so the host can own post-copy UX.\n */\n onCopySuccess?: (detail: CopySuccessDetail) => void;\n children: ReactNode;\n};\n\nconst copyToClipboard = async (text: string): Promise<boolean> => {\n try {\n if ('clipboard' in navigator) {\n await navigator.clipboard.writeText(text);\n return true;\n } else {\n return document.execCommand('copy', true, text);\n }\n } catch {\n return false;\n }\n};\n\nconst clickOrigin = (e: MouseEvent<HTMLButtonElement>): { clientX: number; clientY: number } => {\n const rect = e.currentTarget.getBoundingClientRect();\n const hasPointer = e.clientX !== 0 || e.clientY !== 0;\n return {\n clientX: hasPointer ? e.clientX : rect.left + rect.width / 2,\n clientY: rect.top,\n };\n};\n\nconst CopyableFieldContainer = styled.div`\n display: flex;\n gap: ${Spacing[1]};\n align-items: center;\n`;\n\nconst CopyButton = styled(Button).attrs(() => ({\n type: 'button',\n variant: 'inverse',\n width: 'icon',\n}))<{ isActive: boolean }>`\n height: ${Spacing[5]};\n width: ${Spacing[5]};\n opacity: ${({ isActive }) => (isActive ? 1 : 0)};\n visibility: ${({ isActive }) => (isActive ? 'visible' : 'hidden')};\n transition: ${({ isActive }) =>\n [\n ...['background-color', 'color', 'border-color'].map(\n (property) => `${property} ${TransitionDuration.Fast} ${TransitionEasing.Move}`,\n ),\n isActive\n ? `opacity ${TransitionDuration.Fast} ${TransitionEasing.Enter}, visibility 0s`\n : `opacity ${TransitionDuration.Faster} ${TransitionEasing.Exit}, visibility 0s linear ${TransitionDuration.Faster}`,\n ].join(', ')};\n svg {\n width: 14px;\n height: 14px;\n }\n`;\n\nconst StyledCard = styled(Card)`\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n animation: ${fadeIn} ${TransitionDuration.Fast} ${TransitionEasing.Enter};\n padding: 6px;\n margin: 0;\n`;\n\nconst HoverCopyableField = ({\n copyValue,\n confirmationText = 'Copied',\n onCopySuccess,\n children,\n}: HoverCopyableFieldProps) => {\n const [copyButtonActive, { enable: showCopyButton, disable: hideCopyButton }] = useToggle(false);\n const [confirmationActive, { enable: showConfirmation, disable: hideConfirmation }] =\n useToggle(false);\n\n const copyTextToClipboard = async (origin: { clientX: number; clientY: number }) => {\n if (copyValue == null) {\n return;\n }\n const copyWasSuccessful = await copyToClipboard(copyValue);\n if (!copyWasSuccessful) {\n return;\n }\n if (onCopySuccess) {\n onCopySuccess({ text: copyValue, ...origin });\n hideCopyButton();\n return;\n }\n showConfirmation();\n setTimeout(() => {\n hideCopyButton();\n hideConfirmation();\n }, 1200);\n };\n\n const copyField = (e: MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n void copyTextToClipboard(clickOrigin(e));\n };\n\n return copyValue != null && copyValue.trim().length > 0 ? (\n <CopyableFieldContainer onMouseEnter={showCopyButton} onMouseLeave={hideCopyButton}>\n {children}\n <Popover open={confirmationActive}>\n <Popover.Anchor asChild>\n <CopyButton\n id='hover-copyable-field__copy-button'\n isActive={copyButtonActive || confirmationActive}\n onClick={copyField}\n >\n <CopyIcon width={16} height={16} />\n </CopyButton>\n </Popover.Anchor>\n <Popover.Content side='top' align='center' style={{ zIndex: 2 }}>\n <StyledCard elevated>\n <Paragraph>{confirmationText}</Paragraph>\n </StyledCard>\n </Popover.Content>\n </Popover>\n </CopyableFieldContainer>\n ) : null;\n};\n\nexport default HoverCopyableField;\n"],"mappings":";;;;;;;;;;;;AA+BA,MAAM,kBAAkB,OAAO,SAAmC;AAChE,KAAI;AACF,MAAI,eAAe,WAAW;AAC5B,SAAM,UAAU,UAAU,UAAU,KAAK;AACzC,UAAO;QAEP,QAAO,SAAS,YAAY,QAAQ,MAAM,KAAK;SAE3C;AACN,SAAO;;;AAIX,MAAM,eAAe,MAA2E;CAC9F,MAAM,OAAO,EAAE,cAAc,uBAAuB;AAEpD,QAAO;EACL,SAFiB,EAAE,YAAY,KAAK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