@persona/design-system 0.5.0 → 0.5.1

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 (559) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/{Action-C2waxwIy.d.mts → Action-C2FTJhnQ.d.mts} +3 -3
  3. package/dist/Action.d.mts +1 -1
  4. package/dist/AdvancedFilterRuleRow.d.mts +2 -2
  5. package/dist/AdvancedFilterRulesPopover.d.mts +2 -2
  6. package/dist/ArrayValueControl.d.mts +1 -1
  7. package/dist/Attribute.d.mts +8 -6
  8. package/dist/{Badge-CM2TzkdE.mjs → Badge-BtNIvtDZ.mjs} +3 -3
  9. package/dist/{Badge-CM2TzkdE.mjs.map → Badge-BtNIvtDZ.mjs.map} +1 -1
  10. package/dist/BooleanValueControl.d.mts +1 -1
  11. package/dist/{Breadcrumb-Df06cTnA.d.mts → Breadcrumb-BlAhp45l.d.mts} +1 -1
  12. package/dist/Breadcrumb.d.mts +1 -1
  13. package/dist/{Breadcrumbs-BEYQlGbW.mjs → Breadcrumbs-ClKHNIr-.mjs} +15 -14
  14. package/dist/Breadcrumbs-ClKHNIr-.mjs.map +1 -0
  15. package/dist/{Breadcrumbs-D_Gzd4_J.d.mts → Breadcrumbs-DdZ14ZFw.d.mts} +2 -2
  16. package/dist/Breadcrumbs.d.mts +1 -1
  17. package/dist/{Button-CRFbWv3l.d.mts → Button-CTgyA3gc.d.mts} +5 -4
  18. package/dist/Button.d.mts +1 -1
  19. package/dist/{Calendar-DjnoZVcT.d.mts → Calendar-_gM6U5ET.d.mts} +1 -1
  20. package/dist/Calendar.d.mts +1 -1
  21. package/dist/CalendarBase.d.mts +1 -1
  22. package/dist/Card-Dorym91P.d.mts +75 -0
  23. package/dist/{Card-CKrJtn1f.mjs → Card-vQIPtdXi.mjs} +12 -10
  24. package/dist/Card-vQIPtdXi.mjs.map +1 -0
  25. package/dist/Card.d.mts +1 -1
  26. package/dist/Card2.d.mts +1 -1
  27. package/dist/{CardV2-B2wx1NE3.mjs → CardV2-CFTjYWoO.mjs} +18 -17
  28. package/dist/CardV2-CFTjYWoO.mjs.map +1 -0
  29. package/dist/{Checkbox-DwZEsi7x.mjs → Checkbox-CyeitZ5q.mjs} +26 -22
  30. package/dist/Checkbox-CyeitZ5q.mjs.map +1 -0
  31. package/dist/{Checkbox-CwPXPLCi.d.mts → Checkbox-DRJXDs2T.d.mts} +1 -1
  32. package/dist/Checkbox.d.mts +1 -1
  33. package/dist/CheckboxGroupField.d.mts +1 -1
  34. package/dist/ChoicesValueControl.d.mts +1 -1
  35. package/dist/CodeHighlight.d.mts +40 -0
  36. package/dist/{Combobox-BQN5OwB-.d.mts → Combobox-DX4DLe1b.d.mts} +3 -3
  37. package/dist/{Combobox-CKaVX-32.mjs → Combobox-Ddas5FN-.mjs} +22 -21
  38. package/dist/Combobox-Ddas5FN-.mjs.map +1 -0
  39. package/dist/Combobox.d.mts +2 -2
  40. package/dist/{ComboboxBase-nfHr19x-.d.mts → ComboboxBase-Ds_i3K2m.d.mts} +18 -29
  41. package/dist/ComboboxBase.d.mts +1 -1
  42. package/dist/{ComboboxMultiSelect-DRNj2Mtx.d.mts → ComboboxMultiSelect-S6oFJcOS.d.mts} +2 -2
  43. package/dist/ComboboxMultiSelect.d.mts +1 -1
  44. package/dist/{ComboboxSingleSelect-BkhbEx-F.d.mts → ComboboxSingleSelect-DFzCwW1Y.d.mts} +4 -4
  45. package/dist/ComboboxSingleSelect.d.mts +1 -1
  46. package/dist/{CompactBar-CyHbWTv4.d.mts → CompactBar-DEqItiZr.d.mts} +3 -3
  47. package/dist/CompactBar.d.mts +1 -1
  48. package/dist/{ConfigFormGroup-CmCRJyse.mjs → ConfigFormGroup-DcsM-u8o.mjs} +2 -2
  49. package/dist/{ConfigFormGroup-CmCRJyse.mjs.map → ConfigFormGroup-DcsM-u8o.mjs.map} +1 -1
  50. package/dist/{ControlBar-DwAhPcb5.d.mts → ControlBar-BVG5Pbvh.d.mts} +2 -2
  51. package/dist/ControlBar.d.mts +1 -1
  52. package/dist/DataTable.d.mts +17 -6
  53. package/dist/{DateField-tOyrGcx1.d.mts → DateField-CBCo8_d3.d.mts} +2 -2
  54. package/dist/DateField.d.mts +1 -1
  55. package/dist/{DatePicker-Bs9JODNg.d.mts → DatePicker-BZ4_I4Db.d.mts} +2 -2
  56. package/dist/{DatePicker-D2SfjS-N.mjs → DatePicker-DTT-mJ8r.mjs} +45 -34
  57. package/dist/DatePicker-DTT-mJ8r.mjs.map +1 -0
  58. package/dist/DatePicker.d.mts +1 -1
  59. package/dist/{DateRangePicker-BT6-j8V7.d.mts → DateRangePicker-BMKJquPT.d.mts} +3 -3
  60. package/dist/DateRangePicker.d.mts +1 -1
  61. package/dist/DateRangeValueControl.d.mts +2 -2
  62. package/dist/DateValueControl.d.mts +1 -1
  63. package/dist/{DropdownButton-dpGAmVlN.mjs → DropdownButton-DV5if_uG.mjs} +3 -3
  64. package/dist/{DropdownButton-dpGAmVlN.mjs.map → DropdownButton-DV5if_uG.mjs.map} +1 -1
  65. package/dist/DropdownButton.d.mts +2 -2
  66. package/dist/{DropdownMenu-RTxQ0Zu1.d.mts → DropdownMenu-CbhEzWy1.d.mts} +3 -3
  67. package/dist/{DropdownMenu-CyxizDxJ.mjs → DropdownMenu-DovtBJBs.mjs} +3 -3
  68. package/dist/{DropdownMenu-CyxizDxJ.mjs.map → DropdownMenu-DovtBJBs.mjs.map} +1 -1
  69. package/dist/DropdownMenu.d.mts +1 -1
  70. package/dist/{ErrorProps-C9T857Wk.d.mts → ErrorProps-7eWoxSes.d.mts} +1 -1
  71. package/dist/ErrorProps.d.mts +1 -1
  72. package/dist/{FieldRegistry-D6niLExM.d.mts → FieldRegistry-BslyuPZw.d.mts} +2 -2
  73. package/dist/FieldRegistry.d.mts +1 -1
  74. package/dist/{FilterBar-DfBV7yKM.d.mts → FilterBar-DjZE4PoB.d.mts} +4 -4
  75. package/dist/FilterBar.d.mts +1 -1
  76. package/dist/FilterPickerMenu.d.mts +2 -2
  77. package/dist/FilterPill.d.mts +1 -1
  78. package/dist/FilterPopover.d.mts +1 -1
  79. package/dist/FloatValueControl.d.mts +1 -1
  80. package/dist/{FormControl-DQFefbrI.mjs → FormControl-BvRzRknE.mjs} +6 -5
  81. package/dist/FormControl-BvRzRknE.mjs.map +1 -0
  82. package/dist/{FormControl-BMYRsFkI.d.mts → FormControl-gpLZZpNs.d.mts} +3 -3
  83. package/dist/FormControl.d.mts +1 -1
  84. package/dist/FormControlLabel.d.mts +2 -2
  85. package/dist/{FormField-C7bW-O6H.mjs → FormField-BDJ6zNE6.mjs} +14 -14
  86. package/dist/{FormField-C7bW-O6H.mjs.map → FormField-BDJ6zNE6.mjs.map} +1 -1
  87. package/dist/{FormField-C1DaUT5U.d.mts → FormField-CZXKvCGt.d.mts} +2 -2
  88. package/dist/FormField.d.mts +1 -1
  89. package/dist/{Header-BKk3qESS.d.mts → Header-1laYnwRP.d.mts} +2 -2
  90. package/dist/Header.d.mts +1 -1
  91. package/dist/{HelperTooltip-CD_yy7Hp.d.mts → HelperTooltip-BPJS3EwC.d.mts} +2 -2
  92. package/dist/HelperTooltip.d.mts +1 -1
  93. package/dist/{HoverCopyableField-Bgt639FR.mjs → HoverCopyableField-WP6DPjy1.mjs} +8 -8
  94. package/dist/{HoverCopyableField-Bgt639FR.mjs.map → HoverCopyableField-WP6DPjy1.mjs.map} +1 -1
  95. package/dist/{IconButton-BnSEV7eR.mjs → IconButton-CnJNIJVQ.mjs} +124 -25
  96. package/dist/IconButton-CnJNIJVQ.mjs.map +1 -0
  97. package/dist/{IconButton-Bh-JJ-0x.d.mts → IconButton-PnrnqQ1s.d.mts} +2 -2
  98. package/dist/IconButton.d.mts +1 -1
  99. package/dist/ImageTile.d.mts +1 -1
  100. package/dist/InlineCombobox.d.mts +1 -1
  101. package/dist/InlineInput.d.mts +1 -1
  102. package/dist/{Input-D7of_GtJ.mjs → Input-DbfwNzS_.mjs} +11 -9
  103. package/dist/Input-DbfwNzS_.mjs.map +1 -0
  104. package/dist/{Input-1bDdMAgO.d.mts → Input-Diztxhle.d.mts} +5 -9
  105. package/dist/Input.d.mts +1 -1
  106. package/dist/{InputProps-BBShwi8N.d.mts → InputProps-BILq1X-n.d.mts} +2 -2
  107. package/dist/InputProps.d.mts +1 -1
  108. package/dist/IntegerValueControl.d.mts +1 -1
  109. package/dist/{ListBox-jzXQDraS.mjs → ListBox-CXh9Jfb-.mjs} +36 -28
  110. package/dist/ListBox-CXh9Jfb-.mjs.map +1 -0
  111. package/dist/{ListBox-DeFHRX2T.d.mts → ListBox-P1eTecdo.d.mts} +3 -3
  112. package/dist/ListBox.d.mts +1 -1
  113. package/dist/ListBoxField.d.mts +2 -2
  114. package/dist/{LoadingShimmer-a2Hv0kAq.mjs → LoadingShimmer-DeVCDCjT.mjs} +13 -5
  115. package/dist/LoadingShimmer-DeVCDCjT.mjs.map +1 -0
  116. package/dist/LoadingShimmer.d.mts +2 -2
  117. package/dist/{LogicRow-BOhB0uNS.d.mts → LogicRow-DtZYOzQ8.d.mts} +3 -3
  118. package/dist/LogicRow.d.mts +1 -1
  119. package/dist/MaskedInput.d.mts +2 -2
  120. package/dist/MatchHighlight.d.mts +1 -1
  121. package/dist/{Menu-DVI8l-4Q.mjs → Menu-CAGTCBqj.mjs} +42 -25
  122. package/dist/Menu-CAGTCBqj.mjs.map +1 -0
  123. package/dist/{Menu-BCVhmNEe.d.mts → Menu-_loh8pe3.d.mts} +4 -4
  124. package/dist/Menu.d.mts +1 -1
  125. package/dist/{MiddleTruncatedText-DnF7F_1D.mjs → MiddleTruncatedText-CO58jrNF.mjs} +2 -2
  126. package/dist/{MiddleTruncatedText-DnF7F_1D.mjs.map → MiddleTruncatedText-CO58jrNF.mjs.map} +1 -1
  127. package/dist/Modal.d.mts +4 -4
  128. package/dist/{PageHeader-BpGT-BM0.mjs → PageHeader-wpvRRTaa.mjs} +9 -6
  129. package/dist/PageHeader-wpvRRTaa.mjs.map +1 -0
  130. package/dist/PageHeader.d.mts +2 -2
  131. package/dist/PageLayout.d.mts +1 -1
  132. package/dist/{PageSelector-D6tffcGW.d.mts → PageSelector-CIa3Zts9.d.mts} +3 -3
  133. package/dist/PageSelector.d.mts +1 -1
  134. package/dist/{Pagination-BkjmybcI.d.mts → Pagination-C2eZEM7K.d.mts} +2 -2
  135. package/dist/{Pagination-CVRTcKSG.mjs → Pagination-wjr3W3xf.mjs} +9 -8
  136. package/dist/Pagination-wjr3W3xf.mjs.map +1 -0
  137. package/dist/Pagination.d.mts +1 -1
  138. package/dist/{Pii-CA7aCuYT.mjs → Pii-Bm-qkweh.mjs} +2 -2
  139. package/dist/{Pii-CA7aCuYT.mjs.map → Pii-Bm-qkweh.mjs.map} +1 -1
  140. package/dist/{PillShell-CVqpZ5iV.d.mts → PillShell-D6dN9sWk.d.mts} +2 -2
  141. package/dist/PillShell.d.mts +1 -1
  142. package/dist/{Popover-DlXyKYL5.mjs → Popover-DUyzmq3e.mjs} +9 -5
  143. package/dist/Popover-DUyzmq3e.mjs.map +1 -0
  144. package/dist/{PseudoClassProps-BPdn-ofQ.d.mts → PseudoClassProps-DnlHhW5u.d.mts} +1 -1
  145. package/dist/PseudoClassProps.d.mts +1 -1
  146. package/dist/{Radio-DYGEt0FT.mjs → Radio-CkugnL91.mjs} +21 -17
  147. package/dist/Radio-CkugnL91.mjs.map +1 -0
  148. package/dist/{RadioGroup-pegXtLwD.mjs → RadioGroup-8dI8gljw.mjs} +3 -3
  149. package/dist/{RadioGroup-pegXtLwD.mjs.map → RadioGroup-8dI8gljw.mjs.map} +1 -1
  150. package/dist/{RadioGroup-DYIfRj02.d.mts → RadioGroup-Dg_gydUp.d.mts} +1 -1
  151. package/dist/RadioGroup.d.mts +1 -1
  152. package/dist/RangeCalendar.d.mts +1 -1
  153. package/dist/RangeCalendarPresets.d.mts +1 -1
  154. package/dist/RuleEditorFields.d.mts +2 -2
  155. package/dist/RulesPill.d.mts +1 -1
  156. package/dist/{SearchInput-Dc90GLTF.d.mts → SearchInput-CNg109M5.d.mts} +2 -2
  157. package/dist/SearchInput.d.mts +1 -1
  158. package/dist/SectionHeading.d.mts +1 -1
  159. package/dist/{SegmentedControl-DIHonamg.d.mts → SegmentedControl-BBIHKcvo.d.mts} +1 -1
  160. package/dist/{SegmentedControl-DwbltwDQ.mjs → SegmentedControl-DQE0hN57.mjs} +9 -8
  161. package/dist/SegmentedControl-DQE0hN57.mjs.map +1 -0
  162. package/dist/SegmentedControl.d.mts +1 -1
  163. package/dist/{Select-CBVvPyRJ.mjs → Select-D9OVjzPR.mjs} +15 -14
  164. package/dist/Select-D9OVjzPR.mjs.map +1 -0
  165. package/dist/{Select-DwqWnWBi.d.mts → Select-wnr46ROZ.d.mts} +3 -3
  166. package/dist/Select.d.mts +1 -1
  167. package/dist/{Spacer-BsK8tTwA.mjs → Spacer-D58qwuXR.mjs} +2 -2
  168. package/dist/{Spacer-BsK8tTwA.mjs.map → Spacer-D58qwuXR.mjs.map} +1 -1
  169. package/dist/{Spinner-e725Rxkd.mjs → Spinner-gBNWIwOn.mjs} +6 -8
  170. package/dist/Spinner-gBNWIwOn.mjs.map +1 -0
  171. package/dist/{Stack-Bre2oiov.mjs → Stack-BqQndGI9.mjs} +2 -2
  172. package/dist/{Stack-Bre2oiov.mjs.map → Stack-BqQndGI9.mjs.map} +1 -1
  173. package/dist/{Stack-6eOrxjJi.d.mts → Stack-DgC83-nw.d.mts} +2 -2
  174. package/dist/Stack.d.mts +1 -1
  175. package/dist/{Sticker-By3F8Aip.mjs → Sticker-BDyejPZa.mjs} +159 -14
  176. package/dist/Sticker-BDyejPZa.mjs.map +1 -0
  177. package/dist/{Sticker-Ep6N4Exq.d.mts → Sticker-qvWkqEMw.d.mts} +5 -5
  178. package/dist/Sticker.d.mts +1 -1
  179. package/dist/StringValueControl.d.mts +1 -1
  180. package/dist/Tab.d.mts +3 -4
  181. package/dist/{TabBar-CWF65Tv4.mjs → TabBar-B__54oO3.mjs} +17 -16
  182. package/dist/TabBar-B__54oO3.mjs.map +1 -0
  183. package/dist/TabBarIconButton.d.mts +1 -5
  184. package/dist/{Table-BOcWdwpv.d.mts → Table-CPvIH27_.d.mts} +1 -1
  185. package/dist/{Table-nWd5ZVbm.mjs → Table-CqIi5mVF.mjs} +86 -39
  186. package/dist/Table-CqIi5mVF.mjs.map +1 -0
  187. package/dist/Table.d.mts +1 -1
  188. package/dist/{TableBody-BFPFaZnD.d.mts → TableBody-CQYijW_3.d.mts} +1 -1
  189. package/dist/TableBody.d.mts +1 -1
  190. package/dist/{TableBox-Bd-H5oyh.mjs → TableBox-C-8RxZT4.mjs} +56 -46
  191. package/dist/TableBox-C-8RxZT4.mjs.map +1 -0
  192. package/dist/TableBox.d.mts +2 -2
  193. package/dist/{TableBoxCell-Cjlc_xJz.d.mts → TableBoxCell-CQ3zT1jG.d.mts} +7 -7
  194. package/dist/TableBoxCell.d.mts +1 -1
  195. package/dist/TableBoxField.d.mts +3 -3
  196. package/dist/{TableBoxRow-CKDjNUsU.d.mts → TableBoxRow-ClK2pceY.d.mts} +3 -3
  197. package/dist/TableBoxRow.d.mts +1 -1
  198. package/dist/{TableBoxRowActions-BJ8ue3Bk.d.mts → TableBoxRowActions-CoF3DuUQ.d.mts} +2 -2
  199. package/dist/TableBoxRowActions.d.mts +1 -1
  200. package/dist/{index-CvBvfQAY.d.mts → TableCell-BQv4ASkE.d.mts} +5 -26
  201. package/dist/TableCell.d.mts +1 -1
  202. package/dist/{TableControls-D8xMNgyS.d.mts → TableControls-CtEL3ioz.d.mts} +3 -3
  203. package/dist/{TableControls-BnesnTue.mjs → TableControls-DplArh-9.mjs} +76 -64
  204. package/dist/TableControls-DplArh-9.mjs.map +1 -0
  205. package/dist/TableControls.d.mts +1 -1
  206. package/dist/{TableControlsContext-ChFsFEjR.d.mts → TableControlsContext-X-Lupvc6.d.mts} +2 -2
  207. package/dist/TableControlsContext.d.mts +1 -1
  208. package/dist/{TableHead-CWDxuy5V.d.mts → TableHead-DLLn0zoP.d.mts} +1 -1
  209. package/dist/TableHead.d.mts +1 -1
  210. package/dist/{TableHeaderCell-C_sIU1d7.d.mts → TableHeaderCell-DiJ2jyw4.d.mts} +3 -1
  211. package/dist/TableHeaderCell.d.mts +1 -1
  212. package/dist/{TableLayout-CgGhKU_A.d.mts → TableLayout-BgnUz8NO.d.mts} +1 -1
  213. package/dist/TableLayout.d.mts +1 -1
  214. package/dist/{TableRow-B1UKlbze.d.mts → TableRow-Dgg8hGy5.d.mts} +2 -2
  215. package/dist/TableRow.d.mts +1 -1
  216. package/dist/TableTH.d.mts +1 -1
  217. package/dist/{TableViewConfigurationDropdown-BqB7pOh8.d.mts → TableViewConfigurationDropdown-DRxd562-.d.mts} +2 -2
  218. package/dist/TableViewConfigurationDropdown.d.mts +1 -1
  219. package/dist/{TechnicalSticker-Ct2WnNzJ.mjs → TechnicalSticker-D6MO_IfT.mjs} +27 -22
  220. package/dist/TechnicalSticker-D6MO_IfT.mjs.map +1 -0
  221. package/dist/{Text-B0orb-cZ.mjs → Text-Dn_p7ZvT.mjs} +16 -12
  222. package/dist/Text-Dn_p7ZvT.mjs.map +1 -0
  223. package/dist/{Text-BzzUdBdc.d.mts → Text-tgFz40XD.d.mts} +4 -4
  224. package/dist/Text.d.mts +1 -1
  225. package/dist/{TextArea-CGpY5xqX.d.mts → TextArea-BxxXQSwP.d.mts} +2 -2
  226. package/dist/{TextArea-CospIXEO.mjs → TextArea-CYirq-B2.mjs} +2 -2
  227. package/dist/{TextArea-CospIXEO.mjs.map → TextArea-CYirq-B2.mjs.map} +1 -1
  228. package/dist/TextArea.d.mts +1 -1
  229. package/dist/{TextUnderlineTooltip-DZYGjJq1.d.mts → TextUnderlineTooltip-DQVYsLqM.d.mts} +3 -3
  230. package/dist/TextUnderlineTooltip.d.mts +1 -1
  231. package/dist/Tile.d.mts +1 -1
  232. package/dist/Toast.d.mts +1 -1
  233. package/dist/{Toggle-BjAivdyX.d.mts → Toggle-BmUl78kH.d.mts} +1 -1
  234. package/dist/{Toggle-Do5z1VcO.mjs → Toggle-CqgFNIYS.mjs} +19 -10
  235. package/dist/Toggle-CqgFNIYS.mjs.map +1 -0
  236. package/dist/Toggle.d.mts +1 -1
  237. package/dist/{Tooltip-DSKGD33G.mjs → Tooltip-BsuYG0fw.mjs} +12 -9
  238. package/dist/Tooltip-BsuYG0fw.mjs.map +1 -0
  239. package/dist/{Tooltip-n3XkX4dp.d.mts → Tooltip-eSaiYjxT.d.mts} +3 -3
  240. package/dist/Tooltip.d.mts +1 -1
  241. package/dist/{TruncatedText-C-MJPIRi.d.mts → TruncatedText-B2v53Y11.d.mts} +2 -2
  242. package/dist/{codec-B0dZTwlG.d.mts → codec-D5qlDVgU.d.mts} +2 -2
  243. package/dist/codec.d.mts +1 -1
  244. package/dist/color-fQTsW4gq.d.mts +20 -0
  245. package/dist/components/Attribute/index.mjs +34 -9
  246. package/dist/components/Attribute/index.mjs.map +1 -1
  247. package/dist/components/Badge/index.mjs +1 -1
  248. package/dist/components/Banner/index.mjs +19 -8
  249. package/dist/components/Banner/index.mjs.map +1 -1
  250. package/dist/components/BottomPanel/index.mjs +4 -4
  251. package/dist/components/Breadcrumbs/index.d.mts +1 -1
  252. package/dist/components/Breadcrumbs/index.mjs +1 -1
  253. package/dist/components/Button/index.d.mts +2 -2
  254. package/dist/components/Button/index.mjs +1 -1
  255. package/dist/components/ButtonGroup/index.mjs +12 -4
  256. package/dist/components/ButtonGroup/index.mjs.map +1 -1
  257. package/dist/components/Card/index.d.mts +2 -2
  258. package/dist/components/Card/index.mjs +1 -1
  259. package/dist/components/CardV2/index.d.mts +1 -1
  260. package/dist/components/CardV2/index.mjs +1 -1
  261. package/dist/components/Checkbox/index.d.mts +1 -1
  262. package/dist/components/Checkbox/index.mjs +1 -1
  263. package/dist/components/CodeHighlight/PrismWithLanguages.d.mts +2 -0
  264. package/dist/components/CodeHighlight/PrismWithLanguages.mjs +48 -0
  265. package/dist/components/CodeHighlight/PrismWithLanguages.mjs.map +1 -0
  266. package/dist/components/CodeHighlight/index.d.mts +2 -0
  267. package/dist/components/CodeHighlight/index.mjs +381 -0
  268. package/dist/components/CodeHighlight/index.mjs.map +1 -0
  269. package/dist/components/Combobox/index.d.mts +2 -2
  270. package/dist/components/Combobox/index.mjs +1 -1
  271. package/dist/components/ConfigFormGroup/index.mjs +1 -1
  272. package/dist/components/DataTable/TableControls/index.d.mts +19 -19
  273. package/dist/components/DataTable/TableControls/index.mjs +1 -1
  274. package/dist/components/DataTable/index.mjs +84 -44
  275. package/dist/components/DataTable/index.mjs.map +1 -1
  276. package/dist/components/DataTable/types.d.mts +2 -2
  277. package/dist/components/DatePicker/index.d.mts +4 -4
  278. package/dist/components/DatePicker/index.mjs +1 -1
  279. package/dist/components/DropdownButton/index.mjs +1 -1
  280. package/dist/components/DropdownMenu/index.d.mts +1 -1
  281. package/dist/components/DropdownMenu/index.mjs +1 -1
  282. package/dist/components/FloatingPanel/index.mjs +5 -5
  283. package/dist/components/FormControl/index.d.mts +2 -2
  284. package/dist/components/FormControl/index.mjs +1 -1
  285. package/dist/components/FormField/index.d.mts +1 -1
  286. package/dist/components/FormField/index.mjs +1 -1
  287. package/dist/components/Grid/index.mjs +1 -1
  288. package/dist/components/HoverCopyableField/index.mjs +1 -1
  289. package/dist/components/ImageTile/index.mjs +18 -17
  290. package/dist/components/ImageTile/index.mjs.map +1 -1
  291. package/dist/components/Input/index.d.mts +1 -1
  292. package/dist/components/Input/index.mjs +1 -1
  293. package/dist/components/Link/index.mjs +7 -8
  294. package/dist/components/Link/index.mjs.map +1 -1
  295. package/dist/components/ListBox/index.d.mts +3 -3
  296. package/dist/components/ListBox/index.mjs +1 -1
  297. package/dist/components/LoadingShimmer/index.mjs +1 -1
  298. package/dist/components/MaskedInput/index.mjs +1 -1
  299. package/dist/components/MatchHighlight/index.mjs +6 -4
  300. package/dist/components/MatchHighlight/index.mjs.map +1 -1
  301. package/dist/components/Menu/index.d.mts +1 -1
  302. package/dist/components/Menu/index.mjs +1 -1
  303. package/dist/components/Modal/index.mjs +10 -8
  304. package/dist/components/Modal/index.mjs.map +1 -1
  305. package/dist/components/PageHeader/index.mjs +1 -1
  306. package/dist/components/Pagination/index.d.mts +3 -3
  307. package/dist/components/Pagination/index.mjs +1 -1
  308. package/dist/components/Pii/index.mjs +1 -1
  309. package/dist/components/Popover/index.mjs +1 -1
  310. package/dist/components/ProgressBar/index.mjs +16 -19
  311. package/dist/components/ProgressBar/index.mjs.map +1 -1
  312. package/dist/components/ProgressIndicator/index.mjs +25 -19
  313. package/dist/components/ProgressIndicator/index.mjs.map +1 -1
  314. package/dist/components/Radio/index.mjs +1 -1
  315. package/dist/components/RadioGroup/index.d.mts +1 -1
  316. package/dist/components/RadioGroup/index.mjs +1 -1
  317. package/dist/components/RightPanel/index.mjs +5 -5
  318. package/dist/components/SegmentedControl/index.d.mts +1 -1
  319. package/dist/components/SegmentedControl/index.mjs +1 -1
  320. package/dist/components/Select/index.d.mts +1 -1
  321. package/dist/components/Select/index.mjs +1 -1
  322. package/dist/components/Slider/index.mjs +22 -13
  323. package/dist/components/Slider/index.mjs.map +1 -1
  324. package/dist/components/SmartTextInput/PillType.d.mts +10 -0
  325. package/dist/components/SmartTextInput/PillType.mjs +31 -0
  326. package/dist/components/SmartTextInput/PillType.mjs.map +1 -0
  327. package/dist/components/SmartTextInput/parser/method-chain/parser.d.mts +21 -0
  328. package/dist/components/SmartTextInput/parser/method-chain/parser.mjs +2 -0
  329. package/dist/components/SmartTextInput/parser/method-chain/types.d.mts +105 -0
  330. package/dist/components/SmartTextInput/parser/method-chain/types.mjs +31 -0
  331. package/dist/components/SmartTextInput/parser/method-chain/types.mjs.map +1 -0
  332. package/dist/components/SmartTextInput/parser/smart-text/parser.d.mts +17 -0
  333. package/dist/components/SmartTextInput/parser/smart-text/parser.mjs +814 -0
  334. package/dist/components/SmartTextInput/parser/smart-text/parser.mjs.map +1 -0
  335. package/dist/components/SmartTextInput/parser/smart-text/types.d.mts +72 -0
  336. package/dist/components/SmartTextInput/parser/smart-text/types.mjs +38 -0
  337. package/dist/components/SmartTextInput/parser/smart-text/types.mjs.map +1 -0
  338. package/dist/components/Spacer/index.mjs +1 -1
  339. package/dist/components/Spinner/index.mjs +1 -1
  340. package/dist/components/Stack/index.d.mts +1 -1
  341. package/dist/components/Stack/index.mjs +1 -1
  342. package/dist/components/StatusIndicator/index.mjs +112 -13
  343. package/dist/components/StatusIndicator/index.mjs.map +1 -1
  344. package/dist/components/Sticker/index.d.mts +1 -1
  345. package/dist/components/Sticker/index.mjs +1 -1
  346. package/dist/components/SwatchPicker/index.mjs +5 -4
  347. package/dist/components/SwatchPicker/index.mjs.map +1 -1
  348. package/dist/components/TabBar/index.mjs +1 -1
  349. package/dist/components/Table/index.d.mts +8 -7
  350. package/dist/components/Table/index.mjs +1 -1
  351. package/dist/components/TableBox/index.d.mts +2 -2
  352. package/dist/components/TableBox/index.mjs +1 -1
  353. package/dist/components/TechnicalSticker/index.mjs +1 -1
  354. package/dist/components/Text/index.d.mts +1 -1
  355. package/dist/components/Text/index.mjs +1 -1
  356. package/dist/components/TextArea/index.d.mts +1 -1
  357. package/dist/components/TextArea/index.mjs +1 -1
  358. package/dist/components/Tile/index.mjs +9 -8
  359. package/dist/components/Tile/index.mjs.map +1 -1
  360. package/dist/components/Toast/index.mjs +18 -12
  361. package/dist/components/Toast/index.mjs.map +1 -1
  362. package/dist/components/Toggle/index.d.mts +1 -1
  363. package/dist/components/Toggle/index.mjs +1 -1
  364. package/dist/components/Tooltip/index.d.mts +3 -3
  365. package/dist/components/Tooltip/index.mjs +1 -1
  366. package/dist/compound-expression.d.mts +1 -1
  367. package/dist/{constants-Bs94Jw4y.d.mts → constants-zZyl7QbX.d.mts} +1 -1
  368. package/dist/constants.d.mts +1 -1
  369. package/dist/{date-filter-BbWgAXy3.mjs → date-filter-DMZnJwGs.mjs} +1 -1
  370. package/dist/{date-filter-BbWgAXy3.mjs.map → date-filter-DMZnJwGs.mjs.map} +1 -1
  371. package/dist/{date-range-rule-value-DBEEWTQp.d.mts → date-range-rule-value-zJaa_jR9.d.mts} +2 -2
  372. package/dist/date-range-rule-value.d.mts +1 -1
  373. package/dist/{date-rule-intent-BArNGT2E.d.mts → date-rule-intent-CdWv68my.d.mts} +3 -3
  374. package/dist/date-rule-intent.d.mts +1 -1
  375. package/dist/display.d.mts +1 -1
  376. package/dist/fieldPickerOptions.d.mts +2 -2
  377. package/dist/fieldSchemaTypes-COEJOqYL.d.mts +39 -0
  378. package/dist/{filter-size-context-D1UhTwOG.d.mts → filter-size-context-DYkfYMkX.d.mts} +2 -2
  379. package/dist/filter-size-context.d.mts +1 -1
  380. package/dist/helpers.d.mts +1 -1
  381. package/dist/{index-I_Cy3X5R.d.mts → index-BJr_obTf.d.mts} +3 -3
  382. package/dist/{index-DASkW991.d.mts → index-BX8dSNcy.d.mts} +2 -2
  383. package/dist/index-DxIXll2Z.d.mts +21 -0
  384. package/dist/index.d.mts +1 -1
  385. package/dist/index2.d.mts +1 -1
  386. package/dist/index3.d.mts +3 -3
  387. package/dist/index4.d.mts +1 -1
  388. package/dist/index5.d.mts +14 -14
  389. package/dist/{input-M7BEIewR.d.mts → input-DN_8iHVD.d.mts} +3 -3
  390. package/dist/inputFields.d.mts +10 -10
  391. package/dist/jsonSchema-B1VonQij.d.mts +222 -0
  392. package/dist/lib/GlobalStyles.mjs +1 -1
  393. package/dist/lib/HeadlessAriaButton.d.mts +1 -2
  394. package/dist/lib/HeadlessAriaButton.mjs +1 -1
  395. package/dist/lib/MiddleTruncatedText.mjs +1 -1
  396. package/dist/lib/PDSProvider.d.mts +1 -1
  397. package/dist/lib/PDSProvider.mjs +1 -1
  398. package/dist/lib/TruncatedText.d.mts +1 -1
  399. package/dist/lib/TruncatedText.mjs +1 -1
  400. package/dist/lib/TruncatedTextWithTooltip.d.mts +1 -1
  401. package/dist/lib/TruncatedTextWithTooltip.mjs +1 -1
  402. package/dist/lib/color.d.mts +2 -0
  403. package/dist/lib/color.mjs +21 -0
  404. package/dist/lib/color.mjs.map +1 -0
  405. package/dist/lib/date-filter/index.d.mts +2 -2
  406. package/dist/lib/date-filter/index.mjs +1 -1
  407. package/dist/lib/errorReporter.d.mts +7 -0
  408. package/dist/lib/errorReporter.mjs +15 -0
  409. package/dist/lib/errorReporter.mjs.map +1 -0
  410. package/dist/lib/fieldSchemaTypes.d.mts +2 -0
  411. package/dist/lib/fieldSchemaTypes.mjs +41 -0
  412. package/dist/lib/fieldSchemaTypes.mjs.map +1 -0
  413. package/dist/lib/jsonSchema.d.mts +2 -0
  414. package/dist/lib/jsonSchema.mjs +260 -0
  415. package/dist/lib/jsonSchema.mjs.map +1 -0
  416. package/dist/lib/message.d.mts +1 -1
  417. package/dist/lib/methodChain.d.mts +66 -0
  418. package/dist/lib/methodChain.mjs +239 -0
  419. package/dist/lib/methodChain.mjs.map +1 -0
  420. package/dist/lib/methodChainNormalize.d.mts +14 -0
  421. package/dist/lib/methodChainNormalize.mjs +53 -0
  422. package/dist/lib/methodChainNormalize.mjs.map +1 -0
  423. package/dist/lib/methodChainTypes.d.mts +23 -0
  424. package/dist/lib/methodChainTypes.mjs +0 -0
  425. package/dist/lib/objectSchemaTypes.d.mts +2 -0
  426. package/dist/lib/objectSchemaTypes.mjs +0 -0
  427. package/dist/lib/pseudoClass.d.mts +1 -1
  428. package/dist/lib/selectHelper.mjs.map +1 -1
  429. package/dist/lib/semanticColor.d.mts +2 -0
  430. package/dist/lib/semanticColor.mjs +17 -0
  431. package/dist/lib/semanticColor.mjs.map +1 -0
  432. package/dist/lib/useControlled.mjs.map +1 -1
  433. package/dist/{message-CyxgAWZl.d.mts → message-DfEpU8lV.d.mts} +1 -1
  434. package/dist/mixins/focus.d.mts +4 -4
  435. package/dist/mixins/focus.mjs +7 -5
  436. package/dist/mixins/focus.mjs.map +1 -1
  437. package/dist/mixins/hoverable.d.mts +2 -2
  438. package/dist/mixins/hoverable.mjs +2 -2
  439. package/dist/mixins/input.d.mts +1 -1
  440. package/dist/mixins/input.mjs +56 -23
  441. package/dist/mixins/input.mjs.map +1 -1
  442. package/dist/mixins/menuItem.d.mts +2 -2
  443. package/dist/mixins/menuItem.mjs +78 -50
  444. package/dist/mixins/menuItem.mjs.map +1 -1
  445. package/dist/mixins/print/index.mjs +4 -2
  446. package/dist/mixins/print/index.mjs.map +1 -1
  447. package/dist/mixins/text.d.mts +1 -1
  448. package/dist/mixins/text.mjs +1 -1
  449. package/dist/{operators-CXkmvFpP.d.mts → operators-F8X0hyQB.d.mts} +2 -2
  450. package/dist/operators.d.mts +1 -1
  451. package/dist/palette-BANY1Xfs.d.mts +21 -0
  452. package/dist/palette.d.mts +2 -0
  453. package/dist/parser-Kxos6siN.mjs +2156 -0
  454. package/dist/parser-Kxos6siN.mjs.map +1 -0
  455. package/dist/patterns/LayoutLoadingShimmer/index.mjs +6 -6
  456. package/dist/patterns/LayoutLoadingSpinner/index.mjs +1 -1
  457. package/dist/patterns/PageLayout/index.mjs +1 -1
  458. package/dist/relative-date-label.d.mts +1 -1
  459. package/dist/semantic-Dy7mTyBP.d.mts +133 -0
  460. package/dist/semanticColor-DkVQjcbc.d.mts +29 -0
  461. package/dist/{styledComponentsInterop-8zScIQyC.mjs → styledComponentsInterop-NxwFjeA4.mjs} +2 -2
  462. package/dist/{styledComponentsInterop-8zScIQyC.mjs.map → styledComponentsInterop-NxwFjeA4.mjs.map} +1 -1
  463. package/dist/{text-DjTGRUM1.d.mts → text-BaQdW8qa.d.mts} +1 -1
  464. package/dist/{theme-Biwx2eJZ.d.mts → theme-D02MOaH6.d.mts} +22 -5
  465. package/dist/theme.d.mts +2 -2
  466. package/dist/theme.mjs +22 -1
  467. package/dist/theme.mjs.map +1 -1
  468. package/dist/tone.d.mts +17 -0
  469. package/dist/{types-V8UJX-rk.d.mts → types-1_JSe9Wr.d.mts} +2 -2
  470. package/dist/{types-DBBfOCX1.d.mts → types-C2s9yhgO.d.mts} +2 -2
  471. package/dist/{types-Bsf1VsW6.d.mts → types-COeginAF.d.mts} +1 -1
  472. package/dist/{types-Df0D37uh.d.mts → types-CtLY82w5.d.mts} +1 -1
  473. package/dist/{types-Ds43XULD.d.mts → types-Ok2lRZeu.d.mts} +1 -1
  474. package/dist/types.d.mts +1 -1
  475. package/dist/types2.d.mts +1 -1
  476. package/dist/types3.d.mts +1 -1
  477. package/dist/types4.d.mts +1 -1
  478. package/dist/types5.d.mts +1 -1
  479. package/dist/{url-state-M64mdtQ2.d.mts → url-state-DP78aDol.d.mts} +2 -2
  480. package/dist/url-state.d.mts +1 -1
  481. package/dist/useComboboxFooterAction.d.mts +1 -1
  482. package/dist/{useFilterStateV2-gALqONXf.d.mts → useFilterStateV2-DC2rGXHK.d.mts} +3 -3
  483. package/dist/useFilterStateV2.d.mts +1 -1
  484. package/dist/{useFormField-Bo7oHMof.d.mts → useFormField--_14te0K.d.mts} +2 -2
  485. package/dist/useFormField.d.mts +1 -1
  486. package/dist/{useTableBoxDragAndDrop-BrJFRSaG.d.mts → useTableBoxDragAndDrop-DkCxC7Mi.d.mts} +1 -1
  487. package/dist/useTableBoxDragAndDrop.d.mts +1 -1
  488. package/dist/{useToggle-Bo3yd14Y.mjs → useToggle-0zLL1E7s.mjs} +1 -1
  489. package/dist/{useToggle-Bo3yd14Y.mjs.map → useToggle-0zLL1E7s.mjs.map} +1 -1
  490. package/dist/useTruncation.d.mts +1 -1
  491. package/dist/{utilities-BHMNnJ8h.d.mts → utilities-C1hOxjt_.d.mts} +1 -1
  492. package/dist/utilities.d.mts +1 -1
  493. package/dist/utils/storybook.mjs +1 -1
  494. package/dist/utils/storybook.mjs.map +1 -1
  495. package/dist/utils/testing.mjs.map +1 -1
  496. package/dist/utils.d.mts +1 -1
  497. package/dist/{validation-BCBIvN6H.d.mts → validation-CpDsI-TM.d.mts} +3 -3
  498. package/dist/validation.d.mts +1 -1
  499. package/dist/{value-control-resolver-qKTH1ErF.d.mts → value-control-resolver-DhaqxKmK.d.mts} +2 -2
  500. package/dist/value-control-resolver.d.mts +1 -1
  501. package/dist/variables/effect.d.mts +14 -3
  502. package/dist/variables/effect.mjs +5 -3
  503. package/dist/variables/effect.mjs.map +1 -1
  504. package/dist/variables/keyframes.mjs +1 -1
  505. package/dist/variables/semantic.d.mts +2 -0
  506. package/dist/variables/semantic.mjs +241 -0
  507. package/dist/variables/semantic.mjs.map +1 -0
  508. package/package.json +68 -7
  509. package/skills/ui-authoring/COMPONENTS.md +1 -1
  510. package/skills/ui-authoring/TOKENS.md +1 -1
  511. package/dist/Breadcrumbs-BEYQlGbW.mjs.map +0 -1
  512. package/dist/Card-BoGV5tY2.d.mts +0 -52
  513. package/dist/Card-CKrJtn1f.mjs.map +0 -1
  514. package/dist/CardV2-B2wx1NE3.mjs.map +0 -1
  515. package/dist/Checkbox-DwZEsi7x.mjs.map +0 -1
  516. package/dist/Combobox-CKaVX-32.mjs.map +0 -1
  517. package/dist/DatePicker-D2SfjS-N.mjs.map +0 -1
  518. package/dist/FormControl-DQFefbrI.mjs.map +0 -1
  519. package/dist/IconButton-BnSEV7eR.mjs.map +0 -1
  520. package/dist/Input-D7of_GtJ.mjs.map +0 -1
  521. package/dist/ListBox-jzXQDraS.mjs.map +0 -1
  522. package/dist/LoadingShimmer-a2Hv0kAq.mjs.map +0 -1
  523. package/dist/Menu-DVI8l-4Q.mjs.map +0 -1
  524. package/dist/PageHeader-BpGT-BM0.mjs.map +0 -1
  525. package/dist/Pagination-CVRTcKSG.mjs.map +0 -1
  526. package/dist/Popover-DlXyKYL5.mjs.map +0 -1
  527. package/dist/Radio-DYGEt0FT.mjs.map +0 -1
  528. package/dist/SegmentedControl-DwbltwDQ.mjs.map +0 -1
  529. package/dist/Select-CBVvPyRJ.mjs.map +0 -1
  530. package/dist/Spinner-e725Rxkd.mjs.map +0 -1
  531. package/dist/Sticker-By3F8Aip.mjs.map +0 -1
  532. package/dist/TabBar-CWF65Tv4.mjs.map +0 -1
  533. package/dist/Table-nWd5ZVbm.mjs.map +0 -1
  534. package/dist/TableBox-Bd-H5oyh.mjs.map +0 -1
  535. package/dist/TableControls-BnesnTue.mjs.map +0 -1
  536. package/dist/TechnicalSticker-Ct2WnNzJ.mjs.map +0 -1
  537. package/dist/Text-B0orb-cZ.mjs.map +0 -1
  538. package/dist/Toggle-Do5z1VcO.mjs.map +0 -1
  539. package/dist/Tooltip-DSKGD33G.mjs.map +0 -1
  540. /package/dist/{index-8SLBz2NH.d.mts → index-1-AkepUA.d.mts} +0 -0
  541. /package/dist/{index-Bt4QNofW.d.mts → index-BFnNtGdX.d.mts} +0 -0
  542. /package/dist/{index-BwAfCVZH2.d.mts → index-BO_854F2.d.mts} +0 -0
  543. /package/dist/{index-BwFl_eS0.d.mts → index-BPiqSRRl.d.mts} +0 -0
  544. /package/dist/{index-CCKHlTA4.d.mts → index-BSVhZrWN.d.mts} +0 -0
  545. /package/dist/{index-CDGG7lCB.d.mts → index-BYd3Btr1.d.mts} +0 -0
  546. /package/dist/{index-CRo77wc3.d.mts → index-B_BBnMou.d.mts} +0 -0
  547. /package/dist/{index-CX869wwk.d.mts → index-BrGZHEgX.d.mts} +0 -0
  548. /package/dist/{index-D13oYj4_.d.mts → index-Ci-uuV07.d.mts} +0 -0
  549. /package/dist/{index-D4DUvwPf.d.mts → index-CknANNvQ2.d.mts} +0 -0
  550. /package/dist/{index-D7UbuJwP.d.mts → index-CtJuGxUp.d.mts} +0 -0
  551. /package/dist/{index-DA6_cwf8.d.mts → index-CuYZJcK3.d.mts} +0 -0
  552. /package/dist/{index-DMRtRo7y.d.mts → index-DWfPppPU.d.mts} +0 -0
  553. /package/dist/{index-Dflz2i1X.d.mts → index-DYX_PQ7T2.d.mts} +0 -0
  554. /package/dist/{index-DvmLVvRD.d.mts → index-DZlqSwCF.d.mts} +0 -0
  555. /package/dist/{index-Es5nKSSL.d.mts → index-De7MV8-j.d.mts} +0 -0
  556. /package/dist/{index-Wc1llEvP.d.mts → index-Deol7ZWO.d.mts} +0 -0
  557. /package/dist/{index-dhjtMp5F.d.mts → index-N-OgGgfF.d.mts} +0 -0
  558. /package/dist/{index-e6k85DKM.d.mts → index-VWno75SQ.d.mts} +0 -0
  559. /package/dist/{index-ehD5GjMH.d.mts → index-hcx6LMSC.d.mts} +0 -0
@@ -0,0 +1,260 @@
1
+ import "./fieldSchemaTypes.mjs";
2
+ import { startCase } from "lodash-es";
3
+ //#region lib/jsonSchema.ts
4
+ let JsonSchemaTypes = /* @__PURE__ */ function(JsonSchemaTypes) {
5
+ JsonSchemaTypes["Array"] = "array";
6
+ JsonSchemaTypes["Boolean"] = "boolean";
7
+ JsonSchemaTypes["Integer"] = "integer";
8
+ JsonSchemaTypes["Number"] = "number";
9
+ JsonSchemaTypes["Object"] = "object";
10
+ JsonSchemaTypes["String"] = "string";
11
+ JsonSchemaTypes["Null"] = "null";
12
+ return JsonSchemaTypes;
13
+ }({});
14
+ const EMPTY_JSON_SCHEMA_OBJECT = {
15
+ type: "object",
16
+ properties: {}
17
+ };
18
+ const isJsonSchemaObject = (schema) => {
19
+ return "type" in schema && schema.type === "object";
20
+ };
21
+ const isJsonSchemaArray = (schema) => {
22
+ return "type" in schema && schema.type === "array";
23
+ };
24
+ /** Returns true for non-primitive schemas (object, array, or $ref to a platform object). */
25
+ const isNonPrimitiveSchema = (schema) => isJsonSchemaObject(schema) || isJsonSchemaArray(schema) || isJsonSchemaRef(schema);
26
+ const isFileType = (fieldType) => fieldType === "file";
27
+ const isFileField = (schema) => "fieldType" in schema && isFileType(schema.fieldType);
28
+ const isArrayWithFileItems = (schema) => isJsonSchemaArray(schema) && !!schema.items && typeof schema.items === "object" && "fieldType" in schema.items && isFileType(schema.items.fieldType);
29
+ /** ImageGallery accepts file schemas or arrays of file items. */
30
+ const isFileSchema = (schema) => isFileField(schema) || isArrayWithFileItems(schema);
31
+ const isJsonSchemaRef = (schema) => {
32
+ return "$ref" in schema;
33
+ };
34
+ const isJsonSchemaPlatformObject = (schema) => {
35
+ return isJsonSchemaRef(schema) && "objectKey" in schema;
36
+ };
37
+ const isJsonSchemaString = (schema) => {
38
+ return "type" in schema && schema.type === "string";
39
+ };
40
+ const isJsonSchemaDate = (schema) => {
41
+ return "type" in schema && schema.type === "string" && "format" in schema && schema.format === "date";
42
+ };
43
+ const isJsonSchemaDateTime = (schema) => {
44
+ return "type" in schema && schema.type === "string" && "format" in schema && schema.format === "date-time";
45
+ };
46
+ const isJsonSchemaSecret = (schema) => {
47
+ return "type" in schema && schema.type === "string" && "format" in schema && schema.format === "secret";
48
+ };
49
+ const isOneOfSchema = (schema) => {
50
+ return "oneOf" in schema && schema.oneOf != null && Array.isArray(schema.oneOf);
51
+ };
52
+ const isOneOfStringSchema = (schema) => {
53
+ return isJsonSchemaString(schema) && "oneOf" in schema && schema.oneOf != null && Array.isArray(schema.oneOf);
54
+ };
55
+ const isFunctionSchema = (schema) => {
56
+ return schema && "function" in schema && !!schema.function;
57
+ };
58
+ const genericArrayItemSchema = (object, schema) => {
59
+ if (!("genericType" in schema) || schema.genericType !== "array_item_schema") return null;
60
+ const array = withNameableType(object);
61
+ return array != null && isJsonSchemaArray(array) && isSubschema(array.items) ? array.items : null;
62
+ };
63
+ const isPrecedingSchema = (schema) => {
64
+ return "genericType" in schema && schema.genericType === "preceding_schema";
65
+ };
66
+ const isGenericParameterSchema = (schema) => {
67
+ return "genericType" in schema && schema.genericType === "parameter_schema" && "position" in schema;
68
+ };
69
+ const isConvertedTypeSchema = (schema) => {
70
+ return "genericType" in schema && schema.genericType === "converted_type" && "schemaByValue" in schema;
71
+ };
72
+ const isJsonSchemaChoices = (schema) => {
73
+ return "type" in schema && schema.type === "string" && "enum" in schema;
74
+ };
75
+ const isJsonSchemaInteger = (schema) => {
76
+ return "type" in schema && schema.type === "integer";
77
+ };
78
+ const isJsonSchemaNumber = (schema) => {
79
+ return "type" in schema && schema.type === "number";
80
+ };
81
+ const isJsonSchemaBoolean = (schema) => {
82
+ return "type" in schema && schema.type === "boolean";
83
+ };
84
+ const functionParametersFromJsonSchema = (functionSchema, currentSchema) => {
85
+ if (!isFunctionSchema(functionSchema)) return [];
86
+ const paramTypes = functionSchema.properties.parameterTypes;
87
+ const orderedParams = [];
88
+ Object.entries(paramTypes.properties).forEach(([title, paramObject]) => {
89
+ orderedParams[paramObject.position] = {
90
+ title,
91
+ ...genericArrayItemSchema(currentSchema, paramObject) ?? paramObject
92
+ };
93
+ });
94
+ return orderedParams;
95
+ };
96
+ const getArrayItemType = (schema) => {
97
+ if (!isJsonSchemaArray(schema) || !("type" in schema.items) || schema.items.type == null) return null;
98
+ const itemType = schema.items.type;
99
+ switch (itemType) {
100
+ case "boolean":
101
+ case "integer":
102
+ case "number":
103
+ case "object":
104
+ case "string": return itemType;
105
+ case "array": return null;
106
+ default: return null;
107
+ }
108
+ };
109
+ /**
110
+ * Display labels for field-backed schemas, whose JSON type alone is too coarse to identify them:
111
+ * every file and relation field serializes as `object`, so only `fieldType` distinguishes a document
112
+ * from a selfie from a plain hash. Shared by both the array-item and object branches below so a type
113
+ * can't be labelled two ways depending on whether it is wrapped in an array.
114
+ *
115
+ * Values follow `FIELD_SCHEMA_TYPE_DISPLAY` in `front-end/lib/fields` so the same field reads the same in the
116
+ * field-schema editor and in these pickers. They are duplicated rather than imported because
117
+ * `front-end/lib/fields` imports this module, and `fieldSchemaTypes` is deliberately dependency-free.
118
+ *
119
+ * These are names, so they are intentionally finer-grained than `getDataTypeFromJsonSchema`, which
120
+ * resolves the same schemas to a rendering strategy: it has no relation case (base `Field::Relation`
121
+ * lands on `DataType.Hash`) and folds NFC into `DataType.GovernmentId`. A label wants to be as
122
+ * specific as the schema allows; a DataType wants to be as specific as the renderer supports.
123
+ *
124
+ * The base `Field::Relation` appears when a producer erases the concrete subtype; "Relation" is
125
+ * vague but still truer than the bare JSON type.
126
+ */
127
+ const FIELD_TYPE_LABELS = {
128
+ ["Field::Relation::Document::Generic"]: "Document",
129
+ ["file"]: "File",
130
+ ["Field::Relation::Document::GovernmentId"]: "Government ID",
131
+ ["Field::Relation::Document::GovernmentIdNfc"]: "Government ID NFC",
132
+ ["hash"]: "Hash",
133
+ ["json"]: "JSON",
134
+ ["Field::Relation"]: "Relation",
135
+ ["Field::Relation::Selfie"]: "Selfie"
136
+ };
137
+ /**
138
+ * Names the field types that are all `type: 'string'` in JSON Schema and are told apart only by a
139
+ * marker, so an item inside an array reads the same as it would on its own. Returns null for a
140
+ * plain string, leaving the caller to fall back to the JSON type.
141
+ */
142
+ const stringSubtypeLabel = (schema) => {
143
+ if (!isJsonSchemaString(schema)) return null;
144
+ if (schema.fieldType === "choices") return "Choices";
145
+ if (schema.fieldType === "email-address" || schema.format === "email") return "Email Address";
146
+ if (schema.format === "date-time") return "Datetime";
147
+ if (schema.format === "date") return "Date";
148
+ if (schema.format === "secret") return "Secret";
149
+ return null;
150
+ };
151
+ /**
152
+ * An `items` slot holds a boolean in JSON Schema 2020-12, and anything at all in a hand-written
153
+ * schema, so a label rule can only treat it as a schema once it is an object.
154
+ */
155
+ const isSubschema = (items) => items != null && typeof items === "object";
156
+ /**
157
+ * Restates a `type` union as the single type it names, so a caller can apply one label rule to a
158
+ * nullable schema and its non-nullable form alike. Returns null when the type names nothing a label
159
+ * can use: no `type` at all, or a union wider than nullable.
160
+ */
161
+ const withNameableType = (schema) => {
162
+ if (!("type" in schema)) return null;
163
+ const type = schema.type;
164
+ const nameable = typeof type === "string" ? type : getNonNullableType(schema);
165
+ if (nameable == null) return null;
166
+ return {
167
+ ...schema,
168
+ type: nameable
169
+ };
170
+ };
171
+ const humanizeSchemaType = ({ schema, parentSchema = {} }) => {
172
+ if ("function" in schema && schema.function) return "Function";
173
+ const format = (typeName, { asArray = false } = {}) => {
174
+ return startCase(typeName.split("/")[0]) + (asArray ? "[]" : "");
175
+ };
176
+ const formatObjectKey = (objectKey, options = {}) => typeof objectKey === "string" ? format(objectKey, options) : "Unsupported";
177
+ if ("genericType" in schema && schema.genericType === "array_item_schema") {
178
+ const parent = withNameableType(parentSchema);
179
+ if (parent != null && isJsonSchemaArray(parent) && isSubschema(parent.items)) {
180
+ if ("objectKey" in parent.items && parent.items.objectKey) return formatObjectKey(parent.items.objectKey);
181
+ if ("type" in parent.items) {
182
+ const items = withNameableType(parent.items);
183
+ return items == null ? "Unsupported" : stringSubtypeLabel(items) ?? format(items.type);
184
+ }
185
+ }
186
+ }
187
+ if (isJsonSchemaRef(schema) && schema.objectKey) return formatObjectKey(schema.objectKey);
188
+ if (!("type" in schema)) return "";
189
+ const named = withNameableType(schema);
190
+ if (named == null) return "Unsupported";
191
+ if (isJsonSchemaArray(named)) {
192
+ if (named.fieldType === "multi-choices") return "Multi Choices";
193
+ if (isSubschema(named.items)) {
194
+ if ("objectKey" in named.items && named.items.objectKey) return formatObjectKey(named.items.objectKey, { asArray: true });
195
+ const items = withNameableType(named.items);
196
+ if (items != null) {
197
+ if (isJsonSchemaObject(items)) return `${(items.fieldType && FIELD_TYPE_LABELS[items.fieldType]) ?? "Hash"}[]`;
198
+ const itemLabel = stringSubtypeLabel(items);
199
+ if (itemLabel) return `${itemLabel}[]`;
200
+ return format(items.type, { asArray: true });
201
+ }
202
+ }
203
+ }
204
+ if (isJsonSchemaString(named)) {
205
+ if ("objectKey" in named && named.objectKey != null) return formatObjectKey(named.objectKey);
206
+ const label = stringSubtypeLabel(named);
207
+ if (label) return label;
208
+ }
209
+ if (isJsonSchemaObject(named)) {
210
+ if (named.objectKey) return formatObjectKey(named.objectKey);
211
+ const label = named.fieldType && FIELD_TYPE_LABELS[named.fieldType];
212
+ if (label) return label;
213
+ }
214
+ return format(named.type);
215
+ };
216
+ const getNonNullableType = (schema) => {
217
+ if (!schema || !("type" in schema)) return null;
218
+ const type = schema.type;
219
+ if (!Array.isArray(type)) return null;
220
+ if (type.length !== 2 || !type.includes("null")) return null;
221
+ const nonNullable = type.find((t) => t !== "null");
222
+ return typeof nonNullable === "string" ? nonNullable : null;
223
+ };
224
+ /**
225
+ * Unwraps an exactly-nullable platform-object union — a `oneOf` of one `$ref`
226
+ * member and one `null` member — to its `$ref` member. Any other shape
227
+ * (arbitrary unions, multiple refs, inline members) returns null so it is
228
+ * never treated as a single receiver type.
229
+ */
230
+ const getNonNullableRefSchema = (schema) => {
231
+ if (!schema || !("oneOf" in schema) || !Array.isArray(schema.oneOf)) return null;
232
+ if ("type" in schema || schema.oneOf.length !== 2) return null;
233
+ const nullMembers = schema.oneOf.filter((member) => "type" in member && member.type === "null");
234
+ if (nullMembers.length !== 1) return null;
235
+ const refMember = schema.oneOf.find((member) => !nullMembers.includes(member));
236
+ return refMember && isJsonSchemaRef(refMember) ? refMember : null;
237
+ };
238
+ const isSchemaTypeAllowed = (schema, allowedTypes) => {
239
+ if (!schema) return false;
240
+ const nonNullable = getNonNullableType(schema);
241
+ if (nonNullable) return allowedTypes.includes(nonNullable);
242
+ if ("type" in schema && !Array.isArray(schema.type) && allowedTypes.includes(schema.type)) return true;
243
+ if ("format" in schema && typeof schema.format === "string") return allowedTypes.includes(schema.format);
244
+ return false;
245
+ };
246
+ const extendSchema = (schemaMap, schemaToAdd) => {
247
+ return Object.fromEntries(Object.entries(schemaMap).map(([key, schema]) => {
248
+ return [key, {
249
+ ...schema,
250
+ properties: {
251
+ ...schema?.properties,
252
+ ...schemaToAdd[key]
253
+ }
254
+ }];
255
+ }));
256
+ };
257
+ //#endregion
258
+ export { EMPTY_JSON_SCHEMA_OBJECT, JsonSchemaTypes, extendSchema, functionParametersFromJsonSchema, genericArrayItemSchema, getArrayItemType, getNonNullableRefSchema, getNonNullableType, humanizeSchemaType, isArrayWithFileItems, isConvertedTypeSchema, isFileField, isFileSchema, isFileType, isFunctionSchema, isGenericParameterSchema, isJsonSchemaArray, isJsonSchemaBoolean, isJsonSchemaChoices, isJsonSchemaDate, isJsonSchemaDateTime, isJsonSchemaInteger, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPlatformObject, isJsonSchemaRef, isJsonSchemaSecret, isJsonSchemaString, isNonPrimitiveSchema, isOneOfSchema, isOneOfStringSchema, isPrecedingSchema, isSchemaTypeAllowed };
259
+
260
+ //# sourceMappingURL=jsonSchema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonSchema.mjs","names":[],"sources":["../../lib/jsonSchema.ts"],"sourcesContent":["import { startCase } from 'lodash-es';\n\nimport { FieldSchemaType } from './fieldSchemaTypes';\nimport type {\n FunctionConvertedTypeSchema,\n FunctionGenericParameterSchema,\n FunctionJsonSchema,\n FunctionParameterJsonSchema,\n FunctionReturnTypeJsonSchema,\n ObjectSchemaMap,\n} from './objectSchemaTypes';\n/**\n * Consumers with a known set of platform object keys can narrow `objectKey`\n * via declaration merging:\n *\n * declare module '@persona/design-system/lib/jsonSchema' {\n * interface JsonSchemaObjectKeyRegistry { objectKey: MyObjectKeyEnum }\n * }\n */\nexport interface JsonSchemaObjectKeyRegistry {}\n\nexport type JsonSchemaObjectKey = JsonSchemaObjectKeyRegistry extends {\n objectKey: infer K extends string;\n}\n ? K\n : string;\n\nexport enum JsonSchemaTypes {\n Array = 'array',\n Boolean = 'boolean',\n Integer = 'integer',\n Number = 'number',\n Object = 'object',\n String = 'string',\n Null = 'null',\n}\n\nexport type JsonSchemaBasicTypes =\n | JsonSchemaTypes.Boolean\n | JsonSchemaTypes.Integer\n | JsonSchemaTypes.Number\n | JsonSchemaTypes.String;\n\nexport interface JsonSchemaBase {\n title?: string;\n description?: string;\n examples?: (string | number)[];\n oneOf?: JsonSchema[];\n $ref?: string;\n $id?: string;\n id?: string; // custom\n // TODO: This likely should be a `JsonSchema` not an object containing only `type` but currently\n // only simple objects with a `type` property are expected.\n // Setting the correct type causes too-deep type recursion errors elsewhere.\n serializedSchema?: { type: JsonSchemaTypes } | null; // custom;\n default?: unknown;\n readOnly?: boolean;\n}\n\nexport interface JsonSchemaArray<ItemSchema = JsonSchema> extends JsonSchemaBase {\n type: JsonSchemaTypes.Array;\n items: ItemSchema;\n uniqueItems?: boolean;\n fieldType?: FieldSchemaType.Array | FieldSchemaType.MultiChoices; // custom\n default?: unknown[];\n supportedFunctions?: string[];\n}\n\nexport interface JsonSchemaBoolean extends JsonSchemaBase {\n type: JsonSchemaTypes.Boolean;\n fieldType?: FieldSchemaType.Boolean; // custom\n default?: boolean;\n}\n\nexport interface JsonSchemaInteger extends JsonSchemaBase {\n type: JsonSchemaTypes.Integer;\n enum?: number[];\n minimum?: number;\n maximum?: number;\n fieldType?: FieldSchemaType.Integer; // custom\n default?: number;\n}\n\nexport interface JsonSchemaNumber extends JsonSchemaBase {\n type: JsonSchemaTypes.Number;\n enum?: number[];\n minimum?: number;\n maximum?: number;\n fieldType?: FieldSchemaType.Number; // custom\n default?: number;\n}\n\nexport interface JsonSchemaNull extends JsonSchemaBase {\n type: JsonSchemaTypes.Null;\n default?: null;\n}\n\nexport interface JsonSchemaObject<PropertySchema = JsonSchema> extends JsonSchemaBase {\n type: JsonSchemaTypes.Object;\n properties: Record<string, PropertySchema>;\n required?: string[];\n // custom\n objectKey?: JsonSchemaObjectKey;\n // custom\n fieldType?:\n | FieldSchemaType.File\n | FieldSchemaType.Hash\n | FieldSchemaType.Json\n | FieldSchemaType.Relation\n | FieldSchemaType.DocumentGeneric\n | FieldSchemaType.GovernmentId\n | FieldSchemaType.GovernmentIdNfc\n | FieldSchemaType.Selfie;\n // custom\n isVariable?: boolean;\n // custom: picker subtitle for a chain root; generated root `description`s\n // otherwise just repeat the label and are hidden\n rootDescription?: string;\n additionalProperties?: boolean;\n baseSupportedFunctions?: string[];\n}\n\nexport const EMPTY_JSON_SCHEMA_OBJECT: JsonSchemaObject = {\n type: JsonSchemaTypes.Object,\n properties: {},\n};\n\nexport interface JsonSchemaString extends JsonSchemaBase {\n type: JsonSchemaTypes.String;\n enum?: string[];\n oneOf?: JsonSchemaConst[];\n const?: string;\n format?: string;\n group?: string; // custom\n labels?: string[]; // custom\n maxLength?: number | null;\n fieldType?:\n | FieldSchemaType.Choices\n | FieldSchemaType.Date\n | FieldSchemaType.Datetime\n | FieldSchemaType.EmailAddress\n | FieldSchemaType.String; // custom\n default?: string;\n}\n\nexport interface JsonSchemaAnyOf extends JsonSchemaBase {\n anyOf: JsonSchema[];\n}\n\nexport interface JsonSchemaConst extends JsonSchemaBase {\n const: string;\n}\n\nexport interface JsonSchemaRef extends JsonSchemaBase {\n $ref: string;\n // custom\n objectKey?: JsonSchemaObjectKey;\n}\n\nexport type JsonSchemaEmpty = Record<string, never>;\n\nexport type JsonSchemaBasic =\n | JsonSchemaBoolean\n | JsonSchemaInteger\n | JsonSchemaNumber\n | JsonSchemaString;\n\n// This is an explicit type for json schemas that only use the standard types.\n// e.g. All subschemas will have a `type` attribute.\n// This is useful for when you know you won't be dealing with any uncommon schemas like anyOf.\nexport type JsonSchemaCore =\n | JsonSchemaArray<JsonSchemaCore>\n | JsonSchemaBoolean\n | JsonSchemaInteger\n | JsonSchemaNumber\n | JsonSchemaObject<JsonSchemaCore>\n | JsonSchemaString;\n\nexport type JsonSchema =\n | JsonSchemaArray\n | JsonSchemaBoolean\n | JsonSchemaInteger\n | JsonSchemaNumber\n | JsonSchemaObject\n | JsonSchemaString\n | JsonSchemaAnyOf\n | JsonSchemaConst\n | JsonSchemaRef\n | JsonSchemaBase;\n\nexport const isJsonSchemaObject = (schema: JsonSchema): schema is JsonSchemaObject => {\n return 'type' in schema && schema.type === JsonSchemaTypes.Object;\n};\n\nexport const isJsonSchemaArray = (schema: JsonSchema): schema is JsonSchemaArray => {\n return 'type' in schema && schema.type === JsonSchemaTypes.Array;\n};\n\n/** Returns true for non-primitive schemas (object, array, or $ref to a platform object). */\nexport const isNonPrimitiveSchema = (schema: JsonSchema): boolean =>\n isJsonSchemaObject(schema) || isJsonSchemaArray(schema) || isJsonSchemaRef(schema);\n\nexport const isFileType = (\n fieldType: FieldSchemaType | undefined,\n): fieldType is FieldSchemaType.File => fieldType === FieldSchemaType.File;\n\nexport const isFileField = (schema: JsonSchema): boolean =>\n 'fieldType' in schema && isFileType(schema.fieldType);\n\nexport const isArrayWithFileItems = (schema: JsonSchema): boolean =>\n isJsonSchemaArray(schema) &&\n !!schema.items &&\n typeof schema.items === 'object' &&\n 'fieldType' in schema.items &&\n isFileType(schema.items.fieldType);\n\n/** ImageGallery accepts file schemas or arrays of file items. */\nexport const isFileSchema = (schema: JsonSchema): boolean =>\n isFileField(schema) || isArrayWithFileItems(schema);\n\nexport const isJsonSchemaRef = (schema: JsonSchema): schema is JsonSchemaRef => {\n return '$ref' in schema;\n};\n\nexport const isJsonSchemaPlatformObject = (schema: JsonSchema): schema is JsonSchemaRef => {\n return isJsonSchemaRef(schema) && 'objectKey' in schema;\n};\n\nexport const isJsonSchemaString = (schema: JsonSchema): schema is JsonSchemaString => {\n return 'type' in schema && schema.type === JsonSchemaTypes.String;\n};\n\nexport const isJsonSchemaDate = (schema: JsonSchema): schema is JsonSchemaString => {\n return (\n 'type' in schema &&\n schema.type === JsonSchemaTypes.String &&\n 'format' in schema &&\n schema.format === 'date'\n );\n};\n\nexport const isJsonSchemaDateTime = (schema: JsonSchema): schema is JsonSchemaString => {\n return (\n 'type' in schema &&\n schema.type === JsonSchemaTypes.String &&\n 'format' in schema &&\n schema.format === 'date-time'\n );\n};\n\nexport const isJsonSchemaSecret = (schema: JsonSchema): schema is JsonSchemaString => {\n return (\n 'type' in schema &&\n schema.type === JsonSchemaTypes.String &&\n 'format' in schema &&\n schema.format === 'secret'\n );\n};\n\nexport const isOneOfSchema = (\n schema: JsonSchema,\n): schema is JsonSchemaBase & { oneOf: JsonSchemaConst[] } => {\n return 'oneOf' in schema && schema.oneOf != null && Array.isArray(schema.oneOf);\n};\n\nexport const isOneOfStringSchema = (\n schema: JsonSchema,\n): schema is JsonSchemaString & { oneOf: JsonSchemaConst[] } => {\n return (\n isJsonSchemaString(schema) &&\n 'oneOf' in schema &&\n schema.oneOf != null &&\n Array.isArray(schema.oneOf)\n );\n};\n\nexport const isFunctionSchema = (schema: JsonSchema): schema is FunctionJsonSchema => {\n return schema && 'function' in schema && !!schema.function;\n};\n\nexport const genericArrayItemSchema = (\n object: JsonSchema,\n schema: FunctionParameterJsonSchema | FunctionReturnTypeJsonSchema,\n): JsonSchema | null => {\n if (!('genericType' in schema) || schema.genericType !== 'array_item_schema') {\n return null;\n }\n const array = withNameableType(object);\n return array != null && isJsonSchemaArray(array) && isSubschema(array.items) ? array.items : null;\n};\n\nexport const isPrecedingSchema = (\n schema: FunctionParameterJsonSchema | FunctionReturnTypeJsonSchema,\n) => {\n return 'genericType' in schema && schema.genericType === 'preceding_schema';\n};\n\nexport const isGenericParameterSchema = (\n schema: FunctionParameterJsonSchema | FunctionReturnTypeJsonSchema,\n): schema is FunctionGenericParameterSchema => {\n return (\n 'genericType' in schema && schema.genericType === 'parameter_schema' && 'position' in schema\n );\n};\n\nexport const isConvertedTypeSchema = (\n schema: FunctionParameterJsonSchema | FunctionReturnTypeJsonSchema,\n): schema is FunctionConvertedTypeSchema => {\n return (\n 'genericType' in schema && schema.genericType === 'converted_type' && 'schemaByValue' in schema\n );\n};\n\nexport const isJsonSchemaChoices = (schema: JsonSchema): schema is JsonSchemaString => {\n return 'type' in schema && schema.type === JsonSchemaTypes.String && 'enum' in schema;\n};\n\nexport const isJsonSchemaInteger = (schema: JsonSchema): schema is JsonSchemaInteger => {\n return 'type' in schema && schema.type === JsonSchemaTypes.Integer;\n};\n\nexport const isJsonSchemaNumber = (schema: JsonSchema): schema is JsonSchemaNumber => {\n return 'type' in schema && schema.type === JsonSchemaTypes.Number;\n};\n\nexport const isJsonSchemaBoolean = (schema: JsonSchema): schema is JsonSchemaBoolean => {\n return 'type' in schema && schema.type === JsonSchemaTypes.Boolean;\n};\n\nexport const functionParametersFromJsonSchema = (\n functionSchema: JsonSchema,\n currentSchema: JsonSchema,\n): JsonSchema[] => {\n if (!isFunctionSchema(functionSchema)) {\n return [];\n }\n\n const paramTypes = functionSchema.properties.parameterTypes;\n const orderedParams: JsonSchema[] = [];\n Object.entries(paramTypes.properties).forEach(([title, paramObject]) => {\n orderedParams[paramObject.position] = {\n title,\n ...(genericArrayItemSchema(currentSchema, paramObject) ?? paramObject),\n };\n });\n return orderedParams;\n};\n\nexport const getArrayItemType = (schema: JsonSchema): JsonSchemaTypes | null => {\n if (!isJsonSchemaArray(schema) || !('type' in schema.items) || schema.items.type == null) {\n return null;\n }\n\n const itemType = schema.items.type;\n\n switch (itemType) {\n case JsonSchemaTypes.Boolean:\n case JsonSchemaTypes.Integer:\n case JsonSchemaTypes.Number:\n case JsonSchemaTypes.Object:\n case JsonSchemaTypes.String:\n return itemType;\n case JsonSchemaTypes.Array:\n // Nested arrays are not supported for simple array item types\n return null;\n default:\n return null;\n }\n};\n\n/**\n * Display labels for field-backed schemas, whose JSON type alone is too coarse to identify them:\n * every file and relation field serializes as `object`, so only `fieldType` distinguishes a document\n * from a selfie from a plain hash. Shared by both the array-item and object branches below so a type\n * can't be labelled two ways depending on whether it is wrapped in an array.\n *\n * Values follow `FIELD_SCHEMA_TYPE_DISPLAY` in `front-end/lib/fields` so the same field reads the same in the\n * field-schema editor and in these pickers. They are duplicated rather than imported because\n * `front-end/lib/fields` imports this module, and `fieldSchemaTypes` is deliberately dependency-free.\n *\n * These are names, so they are intentionally finer-grained than `getDataTypeFromJsonSchema`, which\n * resolves the same schemas to a rendering strategy: it has no relation case (base `Field::Relation`\n * lands on `DataType.Hash`) and folds NFC into `DataType.GovernmentId`. A label wants to be as\n * specific as the schema allows; a DataType wants to be as specific as the renderer supports.\n *\n * The base `Field::Relation` appears when a producer erases the concrete subtype; \"Relation\" is\n * vague but still truer than the bare JSON type.\n */\nconst FIELD_TYPE_LABELS: Partial<Record<FieldSchemaType, string>> = {\n [FieldSchemaType.DocumentGeneric]: 'Document',\n [FieldSchemaType.File]: 'File',\n [FieldSchemaType.GovernmentId]: 'Government ID',\n [FieldSchemaType.GovernmentIdNfc]: 'Government ID NFC',\n [FieldSchemaType.Hash]: 'Hash',\n [FieldSchemaType.Json]: 'JSON',\n [FieldSchemaType.Relation]: 'Relation',\n [FieldSchemaType.Selfie]: 'Selfie',\n};\n\n/**\n * Names the field types that are all `type: 'string'` in JSON Schema and are told apart only by a\n * marker, so an item inside an array reads the same as it would on its own. Returns null for a\n * plain string, leaving the caller to fall back to the JSON type.\n */\nconst stringSubtypeLabel = (schema: JsonSchema): string | null => {\n if (!isJsonSchemaString(schema)) {\n return null;\n }\n if (schema.fieldType === FieldSchemaType.Choices) {\n return 'Choices';\n }\n // The backend platform-object schema sends both markers for an email address; a schema built\n // from a field schema on the client sends `format` alone.\n if (schema.fieldType === FieldSchemaType.EmailAddress || schema.format === 'email') {\n return 'Email Address';\n }\n if (schema.format === 'date-time') {\n return 'Datetime';\n }\n if (schema.format === 'date') {\n return 'Date';\n }\n if (schema.format === 'secret') {\n return 'Secret';\n }\n return null;\n};\n\n/**\n * An `items` slot holds a boolean in JSON Schema 2020-12, and anything at all in a hand-written\n * schema, so a label rule can only treat it as a schema once it is an object.\n */\nconst isSubschema = (items: unknown): items is JsonSchema =>\n items != null && typeof items === 'object';\n\n/**\n * Restates a `type` union as the single type it names, so a caller can apply one label rule to a\n * nullable schema and its non-nullable form alike. Returns null when the type names nothing a label\n * can use: no `type` at all, or a union wider than nullable.\n */\nconst withNameableType = (\n schema: JsonSchema | FunctionJsonSchema,\n): (JsonSchema & { type: JsonSchemaTypes }) | null => {\n if (!('type' in schema)) {\n return null;\n }\n const type = schema.type as JsonSchemaTypes | JsonSchemaTypes[];\n const nameable = typeof type === 'string' ? type : getNonNullableType(schema);\n if (nameable == null) {\n return null;\n }\n const named = { ...schema, type: nameable };\n return named as JsonSchema & { type: JsonSchemaTypes };\n};\n\nexport const humanizeSchemaType = ({\n schema,\n parentSchema = {},\n}: {\n schema: JsonSchema | FunctionJsonSchema;\n parentSchema?: JsonSchema;\n}): string => {\n if ('function' in schema && schema.function) {\n return 'Function';\n }\n\n const format = (typeName: string, { asArray = false }: { asArray?: boolean } = {}): string => {\n return startCase(typeName.split('/')[0]) + (asArray ? '[]' : '');\n };\n\n // Unlike a `type`, an `objectKey` is never narrowed before it gets here, and a customer-authored\n // schema can hold anything in it.\n const formatObjectKey = (objectKey: unknown, options: { asArray?: boolean } = {}): string =>\n typeof objectKey === 'string' ? format(objectKey, options) : 'Unsupported';\n\n if ('genericType' in schema && schema.genericType === 'array_item_schema') {\n const parent = withNameableType(parentSchema);\n\n if (parent != null && isJsonSchemaArray(parent) && isSubschema(parent.items)) {\n if ('objectKey' in parent.items && parent.items.objectKey) {\n return formatObjectKey(parent.items.objectKey);\n }\n\n if ('type' in parent.items) {\n // The option here is the item itself, so an item type that names nothing leaves no outer\n // type to fall back on.\n const items = withNameableType(parent.items);\n return items == null ? 'Unsupported' : (stringSubtypeLabel(items) ?? format(items.type));\n }\n }\n }\n\n if (isJsonSchemaRef(schema) && schema.objectKey) {\n return formatObjectKey(schema.objectKey);\n }\n\n if (!('type' in schema)) {\n return '';\n }\n\n // Resolved before any rule reads the type, so a nullable schema is labelled the same way whether\n // it stands alone or sits in an array.\n const named = withNameableType(schema);\n if (named == null) {\n // TODO(PLO-345): return one label per non-null type for multi-non-null schemas.\n return 'Unsupported';\n }\n\n if (isJsonSchemaArray(named)) {\n if (named.fieldType === FieldSchemaType.MultiChoices) {\n return 'Multi Choices';\n }\n\n if (isSubschema(named.items)) {\n if ('objectKey' in named.items && named.items.objectKey) {\n return formatObjectKey(named.items.objectKey, { asArray: true });\n }\n\n // An item schema with no nameable type leaves the array reading as its own `Array` type,\n // which is still true of the value.\n const items = withNameableType(named.items);\n if (items != null) {\n // Object items are named by their `fieldType`; ones without a recognized marker read as\n // `Hash[]` rather than `Object[]`, since a bare `object` says nothing useful to a reader.\n if (isJsonSchemaObject(items)) {\n const itemLabel = items.fieldType && FIELD_TYPE_LABELS[items.fieldType];\n return `${itemLabel ?? 'Hash'}[]`;\n }\n\n const itemLabel = stringSubtypeLabel(items);\n if (itemLabel) {\n return `${itemLabel}[]`;\n }\n\n return format(items.type, { asArray: true });\n }\n }\n }\n\n if (isJsonSchemaString(named)) {\n if ('objectKey' in named && named.objectKey != null) {\n return formatObjectKey(named.objectKey);\n }\n const label = stringSubtypeLabel(named);\n if (label) {\n return label;\n }\n }\n\n if (isJsonSchemaObject(named)) {\n if (named.objectKey) {\n return formatObjectKey(named.objectKey);\n }\n\n // An untagged object has no field type to name it, so it falls through to its JSON type.\n const label = named.fieldType && FIELD_TYPE_LABELS[named.fieldType];\n if (label) {\n return label;\n }\n }\n\n return format(named.type);\n};\n\nexport const getNonNullableType = (\n schema: JsonSchema | FunctionJsonSchema | null | undefined,\n): JsonSchemaTypes | null => {\n if (!schema || !('type' in schema)) {\n return null;\n }\n const type = schema.type as JsonSchemaTypes | JsonSchemaTypes[];\n if (!Array.isArray(type)) {\n return null;\n }\n if (type.length !== 2 || !type.includes(JsonSchemaTypes.Null)) {\n return null;\n }\n // Only the cast above makes a member a `JsonSchemaTypes`; a hand-written schema can put anything\n // in the union, and callers splat this into a `type` their own callers then read as a name.\n const nonNullable = type.find((t) => t !== JsonSchemaTypes.Null);\n return typeof nonNullable === 'string' ? nonNullable : null;\n};\n\n/**\n * Unwraps an exactly-nullable platform-object union — a `oneOf` of one `$ref`\n * member and one `null` member — to its `$ref` member. Any other shape\n * (arbitrary unions, multiple refs, inline members) returns null so it is\n * never treated as a single receiver type.\n */\nexport const getNonNullableRefSchema = (\n schema: JsonSchema | null | undefined,\n): JsonSchemaRef | null => {\n if (!schema || !('oneOf' in schema) || !Array.isArray(schema.oneOf)) {\n return null;\n }\n if ('type' in schema || schema.oneOf.length !== 2) {\n return null;\n }\n const nullMembers: JsonSchema[] = schema.oneOf.filter(\n (member) => 'type' in member && (member.type as JsonSchemaTypes) === JsonSchemaTypes.Null,\n );\n if (nullMembers.length !== 1) {\n return null;\n }\n const refMember = schema.oneOf.find((member) => !nullMembers.includes(member));\n return refMember && isJsonSchemaRef(refMember) ? refMember : null;\n};\n\nexport const isSchemaTypeAllowed = (\n schema: JsonSchema | FunctionJsonSchema | null | undefined,\n allowedTypes: readonly string[],\n): boolean => {\n if (!schema) {\n return false;\n }\n const nonNullable = getNonNullableType(schema);\n if (nonNullable) {\n return allowedTypes.includes(nonNullable);\n }\n if ('type' in schema && !Array.isArray(schema.type) && allowedTypes.includes(schema.type)) {\n return true;\n }\n if ('format' in schema && typeof schema.format === 'string') {\n return allowedTypes.includes(schema.format);\n }\n return false;\n};\n\nexport const extendSchema = (\n schemaMap: ObjectSchemaMap,\n schemaToAdd: Partial<Record<keyof typeof schemaMap, Record<string, JsonSchema>>>,\n): ObjectSchemaMap => {\n return Object.fromEntries(\n Object.entries(schemaMap).map(([key, schema]) => {\n return [\n key,\n {\n ...schema,\n properties: {\n ...schema?.properties,\n ...schemaToAdd[key],\n },\n },\n ];\n }),\n );\n};\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import { t as MessageType } from "../message-CyxgAWZl.mjs";
1
+ import { t as MessageType } from "../message-DfEpU8lV.mjs";
2
2
  export { MessageType };
@@ -0,0 +1,66 @@
1
+ import { ASTNodeType } from "../components/SmartTextInput/parser/method-chain/types.mjs";
2
+ import { n as JsonSchema } from "../jsonSchema-B1VonQij.mjs";
3
+ import { ArrayNode, Chain, CustomFunctionNode, FunctionNode, FunctionParamType, IdentifierNode, MethodChainNode, NumberNode, StringNode } from "./methodChainTypes.mjs";
4
+
5
+ //#region components/SmartTextInput/parser/method-chain/parser.d.ts
6
+ declare class SyntaxError extends Error {
7
+ expected: string[];
8
+ found: string;
9
+ location: {
10
+ start: number;
11
+ end: number;
12
+ };
13
+ }
14
+ //#endregion
15
+ //#region lib/methodChain.d.ts
16
+ declare const methodChainCache: {
17
+ [key: string]: Chain;
18
+ };
19
+ declare const MethodChainNodeTypes: {
20
+ readonly Chain: ASTNodeType.Chain;
21
+ readonly String: ASTNodeType.String;
22
+ readonly Number: ASTNodeType.Number;
23
+ readonly Identifier: ASTNodeType.Identifier;
24
+ readonly Function: ASTNodeType.Function;
25
+ readonly CustomFunction: ASTNodeType.CustomFunction;
26
+ readonly Array: ASTNodeType.Array;
27
+ };
28
+ declare const EMPTY_METHOD_CHAIN: Chain;
29
+ type MethodChainLiteral = string | number | (string | number)[];
30
+ declare const isFunctionNode: (node: MethodChainNode) => node is FunctionNode;
31
+ declare const isCustomFunctionNode: (node: MethodChainNode) => node is CustomFunctionNode;
32
+ declare const isIdentifierNode: (node: MethodChainNode) => node is IdentifierNode;
33
+ declare const isStringNode: (node: FunctionParamType) => node is StringNode;
34
+ declare const isArrayNode: (node: FunctionParamType) => node is ArrayNode;
35
+ declare const containsFunctionNode: (methodChain: Chain, ...functionNames: string[]) => boolean;
36
+ /**
37
+ * Returns true if the string contains any function node (e.g. `.at(...)`) when parsed
38
+ * as a method chain. Use this to detect whether a field path must be treated as an
39
+ * opaque key rather than split on `.` for Lodash set/get operations.
40
+ */
41
+ declare const pathContainsFunctionNode: (path: string) => boolean;
42
+ declare const isEmpty: (methodChain: Chain) => boolean;
43
+ declare const getFunctionParams: (methodChain: Chain, ...functionNames: string[]) => Record<string, MethodChainLiteral[]>;
44
+ declare const removeFunctionNode: (methodChain: Chain, functionName: string) => Chain;
45
+ declare const isValid: (methodChain: string) => boolean;
46
+ /**
47
+ * The parsed chain, or undefined when it will not parse. Callers that read a chain while it is being
48
+ * authored hold half-typed input, where a throw is noise rather than an error.
49
+ */
50
+ declare const tryParseMethodChain: (methodChain: string) => Chain | undefined;
51
+ /** The object a chain is rooted at: `current_case.inquiries` -> `current_case`. */
52
+ declare const methodChainRootName: (methodChain: string) => string | undefined;
53
+ declare const parseMethodChain: (methodChain: string) => Chain;
54
+ declare const methodChainToString: (methodChain: Chain | StringNode | NumberNode | ArrayNode) => string;
55
+ declare const appendedMethodChain: (parentChain: Chain, appended: string | MethodChainNode) => Chain;
56
+ declare const parseWithPartialOption: (path: string) => {
57
+ methodChain: Chain;
58
+ partial: string;
59
+ valid: boolean;
60
+ };
61
+ declare const pathIsNormative: (path: string) => boolean;
62
+ declare const getSyntaxError: () => typeof SyntaxError;
63
+ declare const methodChainNodeToJsonSchema: (node: StringNode | NumberNode | ArrayNode) => JsonSchema | null;
64
+ //#endregion
65
+ export { ArrayNode, Chain, CustomFunctionNode, EMPTY_METHOD_CHAIN, FunctionNode, FunctionParamType, IdentifierNode, MethodChainNode, MethodChainNodeTypes, NumberNode, StringNode, appendedMethodChain, containsFunctionNode, getFunctionParams, getSyntaxError, isArrayNode, isCustomFunctionNode, isEmpty, isFunctionNode, isIdentifierNode, isStringNode, isValid, methodChainCache, methodChainNodeToJsonSchema, methodChainRootName, methodChainToString, parseMethodChain, parseWithPartialOption, pathContainsFunctionNode, pathIsNormative, removeFunctionNode, tryParseMethodChain };
66
+ //# sourceMappingURL=methodChain.d.mts.map
@@ -0,0 +1,239 @@
1
+ import { i as peg$parse, n as peg$SyntaxError } from "../parser-Kxos6siN.mjs";
2
+ import { reportError } from "./errorReporter.mjs";
3
+ import "./jsonSchema.mjs";
4
+ import "../components/SmartTextInput/parser/method-chain/types.mjs";
5
+ import { normalizeChain } from "./methodChainNormalize.mjs";
6
+ import { last } from "lodash-es";
7
+ //#region lib/methodChain.ts
8
+ function assertNever(value) {
9
+ const dump = typeof value === "object" ? JSON.stringify(value) : value;
10
+ reportError(/* @__PURE__ */ new TypeError(`assertNever non-exhaustive match: ${dump}`));
11
+ }
12
+ const methodChainCache = {};
13
+ const MethodChainNodeTypes = {
14
+ Chain: "chain",
15
+ String: "string",
16
+ Number: "number",
17
+ Identifier: "identifier",
18
+ Function: "function",
19
+ CustomFunction: "custom_function",
20
+ Array: "array"
21
+ };
22
+ const EMPTY_METHOD_CHAIN = {
23
+ type: MethodChainNodeTypes.Chain,
24
+ links: []
25
+ };
26
+ const isFunctionNode = (node) => node.type === MethodChainNodeTypes.Function;
27
+ const isCustomFunctionNode = (node) => node.type === MethodChainNodeTypes.CustomFunction;
28
+ const isIdentifierNode = (node) => node.type === MethodChainNodeTypes.Identifier;
29
+ const isStringNode = (node) => node.type === MethodChainNodeTypes.String;
30
+ const isArrayNode = (node) => node.type === MethodChainNodeTypes.Array;
31
+ const containsFunctionNode = (methodChain, ...functionNames) => methodChain.links.some((link) => isFunctionNode(link) && functionNames.includes(link.name));
32
+ /**
33
+ * Returns true if the string contains any function node (e.g. `.at(...)`) when parsed
34
+ * as a method chain. Use this to detect whether a field path must be treated as an
35
+ * opaque key rather than split on `.` for Lodash set/get operations.
36
+ */
37
+ const pathContainsFunctionNode = (path) => {
38
+ try {
39
+ return parseMethodChain(path).links.some((link) => link.type === MethodChainNodeTypes.Function || link.type === MethodChainNodeTypes.CustomFunction);
40
+ } catch {
41
+ return false;
42
+ }
43
+ };
44
+ const isEmpty = (methodChain) => methodChain.links.length === 0;
45
+ const getFunctionParams = (methodChain, ...functionNames) => {
46
+ return Object.fromEntries(methodChain.links.filter((link) => isFunctionNode(link)).filter((link) => functionNames.includes(link.name)).map((link) => [link.name, flattenParamsToString(link.params)]));
47
+ };
48
+ const removeFunctionNode = (methodChain, functionName) => {
49
+ return {
50
+ type: MethodChainNodeTypes.Chain,
51
+ links: methodChain.links.filter((link) => link.type !== MethodChainNodeTypes.Function || link.name !== functionName)
52
+ };
53
+ };
54
+ const flattenParamsToString = (params) => {
55
+ const result = [];
56
+ for (const param of params) switch (param.type) {
57
+ case MethodChainNodeTypes.Chain:
58
+ result.push(...flattenChainToString(param));
59
+ break;
60
+ case MethodChainNodeTypes.String:
61
+ case MethodChainNodeTypes.Number:
62
+ result.push(param.value);
63
+ break;
64
+ case MethodChainNodeTypes.Array:
65
+ result.push(param.items.map((item) => item.value));
66
+ break;
67
+ }
68
+ return result;
69
+ };
70
+ const flattenChainToString = (methodChain) => methodChain.links.map((link) => {
71
+ switch (link.type) {
72
+ case MethodChainNodeTypes.Function:
73
+ case MethodChainNodeTypes.CustomFunction: return flattenParamsToString(link.params);
74
+ case MethodChainNodeTypes.Identifier: return link.name;
75
+ }
76
+ }).flat();
77
+ const isValid = (methodChain) => {
78
+ try {
79
+ parseMethodChain(methodChain);
80
+ return true;
81
+ } catch {
82
+ return false;
83
+ }
84
+ };
85
+ /**
86
+ * The parsed chain, or undefined when it will not parse. Callers that read a chain while it is being
87
+ * authored hold half-typed input, where a throw is noise rather than an error.
88
+ */
89
+ const tryParseMethodChain = (methodChain) => {
90
+ try {
91
+ return parseMethodChain(methodChain);
92
+ } catch {
93
+ return;
94
+ }
95
+ };
96
+ /** The object a chain is rooted at: `current_case.inquiries` -> `current_case`. */
97
+ const methodChainRootName = (methodChain) => {
98
+ const [root] = tryParseMethodChain(methodChain)?.links ?? [];
99
+ return root && isIdentifierNode(root) ? root.name : void 0;
100
+ };
101
+ const parseMethodChain = (methodChain) => {
102
+ if (!methodChain || methodChain === "") return EMPTY_METHOD_CHAIN;
103
+ if (!methodChainCache[methodChain]) methodChainCache[methodChain] = normalizeChain(peg$parse(methodChain, { strict: true }));
104
+ return methodChainCache[methodChain];
105
+ };
106
+ const memberToString = (value) => {
107
+ return `'${value.replace(/'/g, "\\'")}'`;
108
+ };
109
+ const expandExponentialNotation = (str) => {
110
+ const match = /^(-?)(\d)(?:\.(\d+))?e([+-]\d+)$/.exec(str);
111
+ if (!match) return str;
112
+ const [, sign, leadingDigit, fractionDigits = "", exponentStr] = match;
113
+ const digits = leadingDigit + fractionDigits;
114
+ const exponent = Number(exponentStr);
115
+ if (exponent < 0) return `${sign}0.${"0".repeat(-exponent - 1)}${digits}`;
116
+ return `${sign}${digits}${"0".repeat(exponent - fractionDigits.length)}`;
117
+ };
118
+ const numberLiteralToString = (value) => {
119
+ if (!Number.isFinite(value)) return `${value}`;
120
+ const str = value.toString();
121
+ return /e/i.test(str) ? expandExponentialNotation(str) : str;
122
+ };
123
+ const methodChainToString = (methodChain) => {
124
+ switch (methodChain.type) {
125
+ case MethodChainNodeTypes.String: return methodChain.value;
126
+ case MethodChainNodeTypes.Number: return numberLiteralToString(methodChain.value);
127
+ case MethodChainNodeTypes.Array: return `[${methodChain.items.map((item) => item.type === MethodChainNodeTypes.String ? memberToString(item.value) : `#${numberLiteralToString(item.value)}`).join(", ")}]`;
128
+ default: {
129
+ const regex = /* @__PURE__ */ new RegExp("^@?[a-zA-Z0-9_-]+$");
130
+ return methodChain.links.map((link, index) => {
131
+ switch (link.type) {
132
+ case MethodChainNodeTypes.Identifier: {
133
+ const fullName = `${link.prefix ?? ""}${link.name}`;
134
+ return index === 0 ? fullName : regex.test(fullName) ? `.${fullName}` : `['${fullName.replace(/'/g, "\\'")}']`;
135
+ }
136
+ case MethodChainNodeTypes.Function: return `.${link.name}(${link.params.map((param) => {
137
+ switch (param.type) {
138
+ case MethodChainNodeTypes.String: return memberToString(param.value);
139
+ case MethodChainNodeTypes.Number: return `#${numberLiteralToString(param.value)}`;
140
+ case MethodChainNodeTypes.Chain:
141
+ case MethodChainNodeTypes.Array: return methodChainToString(param);
142
+ }
143
+ }).join(", ")})`;
144
+ case MethodChainNodeTypes.CustomFunction: {
145
+ const paramStr = link.params.map((param) => {
146
+ switch (param.type) {
147
+ case MethodChainNodeTypes.String: return memberToString(param.value);
148
+ case MethodChainNodeTypes.Number: return `#${numberLiteralToString(param.value)}`;
149
+ case MethodChainNodeTypes.Chain:
150
+ case MethodChainNodeTypes.Array: return methodChainToString(param);
151
+ }
152
+ }).join(", ");
153
+ return [
154
+ index === 0 ? "" : ".",
155
+ `@${link.name}`,
156
+ link.params.length === 0 ? "" : `(${paramStr})`
157
+ ].join("");
158
+ }
159
+ default: assertNever(link);
160
+ }
161
+ }).join("");
162
+ }
163
+ }
164
+ };
165
+ const appendedMethodChain = (parentChain, appended) => {
166
+ const buildNode = (name) => {
167
+ if (name.startsWith("@")) return {
168
+ type: MethodChainNodeTypes.CustomFunction,
169
+ name: name.slice(1),
170
+ params: []
171
+ };
172
+ return {
173
+ type: MethodChainNodeTypes.Identifier,
174
+ name
175
+ };
176
+ };
177
+ return {
178
+ type: MethodChainNodeTypes.Chain,
179
+ links: [...parentChain.links, typeof appended === "string" ? buildNode(appended) : appended]
180
+ };
181
+ };
182
+ const parseWithPartialOption = (path) => {
183
+ if (isValid(path)) {
184
+ const methodChain = parseMethodChain(path);
185
+ return {
186
+ methodChain: {
187
+ type: MethodChainNodeTypes.Chain,
188
+ links: methodChain.links.slice(0, methodChain.links.length - 1)
189
+ },
190
+ partial: last(methodChain.links)?.name || "",
191
+ valid: true
192
+ };
193
+ }
194
+ const rawParse = (input) => {
195
+ return normalizeChain(peg$parse(input, { strict: true }));
196
+ };
197
+ try {
198
+ if (path.endsWith(".")) return {
199
+ methodChain: rawParse(path.slice(0, -1)),
200
+ partial: "",
201
+ valid: true
202
+ };
203
+ if (path.lastIndexOf("[") > path.lastIndexOf("]")) {
204
+ const partialString = path.slice(path.lastIndexOf("[") + 2);
205
+ const partialValue = partialString.endsWith("'") ? partialString.slice(0, -1) : partialString;
206
+ return {
207
+ methodChain: rawParse(path.slice(0, path.lastIndexOf("["))),
208
+ partial: partialValue,
209
+ valid: true
210
+ };
211
+ }
212
+ } catch {}
213
+ return {
214
+ methodChain: EMPTY_METHOD_CHAIN,
215
+ partial: path,
216
+ valid: false
217
+ };
218
+ };
219
+ const pathIsNormative = (path) => {
220
+ return path.split(".").every((part) => /^[a-zA-Z0-9_-]+$/.test(part));
221
+ };
222
+ const getSyntaxError = () => peg$SyntaxError;
223
+ const methodChainNodeToJsonSchema = (node) => {
224
+ if (node.type === MethodChainNodeTypes.String) return { type: "string" };
225
+ else if (node.type === MethodChainNodeTypes.Number) return { type: "number" };
226
+ else if (node.type === MethodChainNodeTypes.Array) if (node.items.length > 0) return {
227
+ type: "array",
228
+ items: node.items[0].type === MethodChainNodeTypes.String ? { type: "string" } : { type: "number" }
229
+ };
230
+ else return {
231
+ type: "array",
232
+ items: { type: "string" }
233
+ };
234
+ return null;
235
+ };
236
+ //#endregion
237
+ export { EMPTY_METHOD_CHAIN, MethodChainNodeTypes, appendedMethodChain, containsFunctionNode, getFunctionParams, getSyntaxError, isArrayNode, isCustomFunctionNode, isEmpty, isFunctionNode, isIdentifierNode, isStringNode, isValid, methodChainCache, methodChainNodeToJsonSchema, methodChainRootName, methodChainToString, parseMethodChain, parseWithPartialOption, pathContainsFunctionNode, pathIsNormative, removeFunctionNode, tryParseMethodChain };
238
+
239
+ //# sourceMappingURL=methodChain.mjs.map