@cube-dev/ui-kit 0.179.0 → 0.181.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (686) hide show
  1. package/dist/CHANGELOG.md +28 -0
  2. package/dist/_internal/hooks/use-debounced-value.js +1 -1
  3. package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
  4. package/dist/_internal/hooks/use-event.js +1 -1
  5. package/dist/_internal/hooks/use-is-first-render.js +1 -1
  6. package/dist/_internal/hooks/use-sync-ref.js +1 -1
  7. package/dist/_internal/hooks/use-timer/timer.js +1 -1
  8. package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
  9. package/dist/_internal/hooks/use-warn.js +1 -1
  10. package/dist/components/Block.js +1 -1
  11. package/dist/components/CollectionItem.js +1 -1
  12. package/dist/components/GlobalStyles.js +1 -1
  13. package/dist/components/GridProvider.js +1 -1
  14. package/dist/components/HiddenInput.js +1 -1
  15. package/dist/components/Root.js +1 -1
  16. package/dist/components/actions/Action/Action.js +1 -1
  17. package/dist/components/actions/Banner/Banner.js +1 -1
  18. package/dist/components/actions/Button/Button.d.ts +1 -0
  19. package/dist/components/actions/Button/Button.js +3 -3
  20. package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
  21. package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
  22. package/dist/components/actions/ButtonSplit/context.js +1 -1
  23. package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
  24. package/dist/components/actions/CommandMenu/styled.js +1 -1
  25. package/dist/components/actions/ItemAction/ItemAction.js +1 -1
  26. package/dist/components/actions/ItemActionContext.js +1 -1
  27. package/dist/components/actions/ItemActionsWrapper.js +1 -1
  28. package/dist/components/actions/ItemButton/ItemButton.js +1 -1
  29. package/dist/components/actions/Link/Link.js +1 -1
  30. package/dist/components/actions/Menu/Menu.js +1 -1
  31. package/dist/components/actions/Menu/MenuItem.js +1 -1
  32. package/dist/components/actions/Menu/MenuSection.js +1 -1
  33. package/dist/components/actions/Menu/MenuTrigger.js +1 -1
  34. package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
  35. package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
  36. package/dist/components/actions/Menu/context.js +1 -1
  37. package/dist/components/actions/Menu/styled.js +1 -1
  38. package/dist/components/actions/actions-run.js +1 -1
  39. package/dist/components/actions/index.js +1 -1
  40. package/dist/components/actions/use-action.js +1 -1
  41. package/dist/components/actions/use-anchored-menu.js +1 -1
  42. package/dist/components/actions/use-context-menu.js +1 -1
  43. package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
  44. package/dist/components/content/Alert/Alert.js +1 -1
  45. package/dist/components/content/Alert/use-alert.js +1 -1
  46. package/dist/components/content/Avatar/Avatar.js +1 -1
  47. package/dist/components/content/Badge/Badge.js +1 -1
  48. package/dist/components/content/Card/Card.js +1 -1
  49. package/dist/components/content/Content.js +1 -1
  50. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
  51. package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
  52. package/dist/components/content/Disclosure/Disclosure.js +1 -1
  53. package/dist/components/content/Divider.js +1 -1
  54. package/dist/components/content/Footer.js +1 -1
  55. package/dist/components/content/Header.js +1 -1
  56. package/dist/components/content/HotKeys/HotKeys.js +1 -1
  57. package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
  58. package/dist/components/content/InlineInput/InlineInput.js +1 -1
  59. package/dist/components/content/Item/Item.js +2 -2
  60. package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
  61. package/dist/components/content/ItemCard/ItemCard.js +1 -1
  62. package/dist/components/content/Layout/GridLayout.js +1 -1
  63. package/dist/components/content/Layout/Layout.js +1 -1
  64. package/dist/components/content/Layout/LayoutBlock.js +1 -1
  65. package/dist/components/content/Layout/LayoutCenter.js +1 -1
  66. package/dist/components/content/Layout/LayoutContainer.js +1 -1
  67. package/dist/components/content/Layout/LayoutContent.js +1 -1
  68. package/dist/components/content/Layout/LayoutContext.js +1 -1
  69. package/dist/components/content/Layout/LayoutFlex.js +1 -1
  70. package/dist/components/content/Layout/LayoutFooter.js +1 -1
  71. package/dist/components/content/Layout/LayoutGrid.js +1 -1
  72. package/dist/components/content/Layout/LayoutHeader.js +1 -1
  73. package/dist/components/content/Layout/LayoutPane.js +1 -1
  74. package/dist/components/content/Layout/LayoutPanel.js +2 -2
  75. package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
  76. package/dist/components/content/Layout/LayoutToolbar.js +1 -1
  77. package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
  78. package/dist/components/content/Layout/index.js +1 -1
  79. package/dist/components/content/Layout/utils.js +1 -1
  80. package/dist/components/content/Paragraph.js +1 -1
  81. package/dist/components/content/Placeholder/Placeholder.js +1 -1
  82. package/dist/components/content/PrismCode/PrismCode.js +1 -1
  83. package/dist/components/content/PrismCode/prismSetup.js +1 -1
  84. package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
  85. package/dist/components/content/Result/Result.js +1 -1
  86. package/dist/components/content/Skeleton/Skeleton.js +1 -1
  87. package/dist/components/content/Tag/Tag.js +1 -1
  88. package/dist/components/content/Text.js +1 -1
  89. package/dist/components/content/TextItem/TextItem.js +1 -1
  90. package/dist/components/content/Title.js +1 -1
  91. package/dist/components/content/Tree/Tree.js +1 -1
  92. package/dist/components/content/Tree/TreeNode.js +1 -1
  93. package/dist/components/content/Tree/styled.js +1 -1
  94. package/dist/components/content/Tree/tree-index.js +1 -1
  95. package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
  96. package/dist/components/content/Tree/use-load-data.js +1 -1
  97. package/dist/components/content/highlightText.js +1 -1
  98. package/dist/components/content/use-auto-tooltip.js +1 -1
  99. package/dist/components/data/DataTable/DataTable.js +1 -1
  100. package/dist/components/data/ItemTable/ItemTable.js +1 -1
  101. package/dist/components/data/ItemTable/ItemTableBulkBar.js +1 -1
  102. package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
  103. package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
  104. package/dist/components/data/ItemTable/ItemTableToolbar.js +1 -1
  105. package/dist/components/data/TableBase/ColumnResizer.js +1 -1
  106. package/dist/components/data/TableBase/RowCollection.js +1 -1
  107. package/dist/components/data/TableBase/TableHeaderCell.js +1 -1
  108. package/dist/components/data/TableBase/TableRow.js +1 -1
  109. package/dist/components/data/TableBase/TableView.js +1 -1
  110. package/dist/components/data/TableBase/column-menu.js +1 -1
  111. package/dist/components/data/TableBase/column-tint.js +1 -1
  112. package/dist/components/data/TableBase/row-menu.js +1 -1
  113. package/dist/components/data/TableBase/styled.d.ts +2 -1
  114. package/dist/components/data/TableBase/styled.js +1 -1
  115. package/dist/components/data/TableBase/table-tree.js +1 -1
  116. package/dist/components/data/TableBase/types.js +1 -1
  117. package/dist/components/data/TableBase/use-cell-selection.d.ts +1 -0
  118. package/dist/components/data/TableBase/use-cell-selection.js +0 -0
  119. package/dist/components/data/TableBase/use-column-order.js +1 -1
  120. package/dist/components/data/TableBase/use-container-width.js +1 -1
  121. package/dist/components/data/TableBase/use-row-move-animation.js +1 -1
  122. package/dist/components/data/TableBase/use-scrollability.js +1 -1
  123. package/dist/components/data/TableBase/use-table-columns.js +1 -1
  124. package/dist/components/data/TableBase/use-table-search.js +1 -1
  125. package/dist/components/data/TableBase/use-table-selection.js +1 -1
  126. package/dist/components/data/TableBase/use-table-sort.js +1 -1
  127. package/dist/components/data/TableBase/use-table-sorts.js +1 -1
  128. package/dist/components/data/TableBase/use-table-storage.js +1 -1
  129. package/dist/components/data/TableBase/use-table-tree-state.js +1 -1
  130. package/dist/components/fields/Checkbox/Checkbox.d.ts +10 -1
  131. package/dist/components/fields/Checkbox/Checkbox.js +4 -5
  132. package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
  133. package/dist/components/fields/Checkbox/CheckboxGroup.d.ts +1 -1
  134. package/dist/components/fields/Checkbox/CheckboxGroup.js +3 -3
  135. package/dist/components/fields/Checkbox/CheckboxGroup.js.map +1 -1
  136. package/dist/components/fields/Checkbox/context.js +1 -1
  137. package/dist/components/fields/ColorInput/ColorInput.d.ts +1 -1
  138. package/dist/components/fields/ColorInput/ColorInput.js +1 -1
  139. package/dist/components/fields/ColorInput/ColorInput.js.map +1 -1
  140. package/dist/components/fields/ColorPicker/ColorPicker.d.ts +1 -1
  141. package/dist/components/fields/ColorPicker/ColorPicker.js +1 -1
  142. package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
  143. package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
  144. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +1 -1
  145. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +1 -1
  146. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
  147. package/dist/components/fields/ComboBox/ComboBox.d.ts +1 -1
  148. package/dist/components/fields/ComboBox/ComboBox.js +8 -2
  149. package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
  150. package/dist/components/fields/CommandTextArea/CommandTextArea.js +2 -2
  151. package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +1 -1
  152. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  153. package/dist/components/fields/CommandTextArea/caretPosition.js.map +1 -1
  154. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
  155. package/dist/components/fields/DatePicker/DateInput.d.ts +1 -1
  156. package/dist/components/fields/DatePicker/DateInput.js +1 -1
  157. package/dist/components/fields/DatePicker/DateInput.js.map +1 -1
  158. package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
  159. package/dist/components/fields/DatePicker/DatePicker.d.ts +1 -1
  160. package/dist/components/fields/DatePicker/DatePicker.js +1 -1
  161. package/dist/components/fields/DatePicker/DatePicker.js.map +1 -1
  162. package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
  163. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  164. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  165. package/dist/components/fields/DatePicker/DatePickerInput.js.map +1 -1
  166. package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
  167. package/dist/components/fields/DatePicker/DateRangePicker.d.ts +4 -1
  168. package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
  169. package/dist/components/fields/DatePicker/DateRangePicker.js.map +1 -1
  170. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.d.ts +4 -1
  171. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
  172. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js.map +1 -1
  173. package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
  174. package/dist/components/fields/DatePicker/PeriodPicker.d.ts +1 -1
  175. package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
  176. package/dist/components/fields/DatePicker/PeriodPicker.js.map +1 -1
  177. package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
  178. package/dist/components/fields/DatePicker/TimeInput.d.ts +1 -1
  179. package/dist/components/fields/DatePicker/TimeInput.js +1 -1
  180. package/dist/components/fields/DatePicker/TimeInput.js.map +1 -1
  181. package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
  182. package/dist/components/fields/DatePicker/YearPicker.js +1 -1
  183. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  184. package/dist/components/fields/DatePicker/period.js +1 -1
  185. package/dist/components/fields/DatePicker/props.js +1 -1
  186. package/dist/components/fields/DatePicker/utils.js +1 -1
  187. package/dist/components/fields/FileInput/FileInput.d.ts +6 -1
  188. package/dist/components/fields/FileInput/FileInput.js +38 -29
  189. package/dist/components/fields/FileInput/FileInput.js.map +1 -1
  190. package/dist/components/fields/FilterListBox/FilterListBox.d.ts +1 -1
  191. package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
  192. package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
  193. package/dist/components/fields/FilterPicker/FilterPicker.d.ts +1 -1
  194. package/dist/components/fields/FilterPicker/FilterPicker.js +8 -5
  195. package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
  196. package/dist/components/fields/Input/Input.js +1 -1
  197. package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
  198. package/dist/components/fields/ListBox/ListBox.d.ts +1 -1
  199. package/dist/components/fields/ListBox/ListBox.js +5 -3
  200. package/dist/components/fields/ListBox/ListBox.js.map +1 -1
  201. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
  202. package/dist/components/fields/ListBoxPopover/index.d.ts +1 -0
  203. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  204. package/dist/components/fields/ListBoxPopover/useCompositeFocus.d.ts +2 -0
  205. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
  206. package/dist/components/fields/NumberInput/NumberInput.d.ts +3 -1
  207. package/dist/components/fields/NumberInput/NumberInput.js +3 -3
  208. package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
  209. package/dist/components/fields/NumberInput/StepButton.js +1 -1
  210. package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
  211. package/dist/components/fields/Picker/Picker.d.ts +1 -1
  212. package/dist/components/fields/Picker/Picker.js +8 -5
  213. package/dist/components/fields/Picker/Picker.js.map +1 -1
  214. package/dist/components/fields/RadioGroup/Radio.js +1 -1
  215. package/dist/components/fields/RadioGroup/RadioGroup.d.ts +1 -1
  216. package/dist/components/fields/RadioGroup/RadioGroup.js +3 -3
  217. package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
  218. package/dist/components/fields/RadioGroup/context.js +1 -1
  219. package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
  220. package/dist/components/fields/SearchInput/SearchInput.js +1 -1
  221. package/dist/components/fields/Select/Select.d.ts +1 -1
  222. package/dist/components/fields/Select/Select.js +16 -2
  223. package/dist/components/fields/Select/Select.js.map +1 -1
  224. package/dist/components/fields/Slider/Gradation.js +1 -1
  225. package/dist/components/fields/Slider/HueSlider.js +1 -1
  226. package/dist/components/fields/Slider/RangeSlider.js +1 -1
  227. package/dist/components/fields/Slider/Slider.js +1 -1
  228. package/dist/components/fields/Slider/SliderBase.js +2 -2
  229. package/dist/components/fields/Slider/SliderBase.js.map +1 -1
  230. package/dist/components/fields/Slider/SliderThumb.js +1 -1
  231. package/dist/components/fields/Slider/SliderTrack.js +1 -1
  232. package/dist/components/fields/Slider/elements.js +1 -1
  233. package/dist/components/fields/Slider/index.js +1 -1
  234. package/dist/components/fields/Slider/types.d.ts +1 -1
  235. package/dist/components/fields/Switch/Switch.d.ts +5 -1
  236. package/dist/components/fields/Switch/Switch.js +1 -1
  237. package/dist/components/fields/Switch/Switch.js.map +1 -1
  238. package/dist/components/fields/TextArea/TextArea.d.ts +2 -0
  239. package/dist/components/fields/TextArea/TextArea.js +1 -1
  240. package/dist/components/fields/TextArea/TextArea.js.map +1 -1
  241. package/dist/components/fields/TextInput/TextInput.d.ts +4 -1
  242. package/dist/components/fields/TextInput/TextInput.js +1 -1
  243. package/dist/components/fields/TextInput/TextInput.js.map +1 -1
  244. package/dist/components/fields/TextInput/TextInputBase.d.ts +1 -1
  245. package/dist/components/fields/TextInput/TextInputBase.js +1 -1
  246. package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
  247. package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
  248. package/dist/components/fields/TextInputMapper/TextInputMapper.d.ts +1 -1
  249. package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
  250. package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
  251. package/dist/components/fields/TriggerActions.js +1 -1
  252. package/dist/components/fields/color/ColorPanel.js +1 -1
  253. package/dist/components/fields/color/channels.js +1 -1
  254. package/dist/components/fields/color/color.js +1 -1
  255. package/dist/components/fields/color/context.js +1 -1
  256. package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
  257. package/dist/components/form/Form/Field.d.ts +2 -0
  258. package/dist/components/form/Form/Field.js +1 -1
  259. package/dist/components/form/Form/Field.js.map +1 -1
  260. package/dist/components/form/Form/Form.d.ts +38 -2
  261. package/dist/components/form/Form/Form.js +86 -16
  262. package/dist/components/form/Form/Form.js.map +1 -1
  263. package/dist/components/form/Form/ModernFormRoot.d.ts +24 -0
  264. package/dist/components/form/Form/ModernFormRoot.js +115 -0
  265. package/dist/components/form/Form/ModernFormRoot.js.map +1 -0
  266. package/dist/components/form/Form/ResetButton/ResetButton.d.ts +2 -1
  267. package/dist/components/form/Form/ResetButton/ResetButton.js +17 -2
  268. package/dist/components/form/Form/ResetButton/ResetButton.js.map +1 -1
  269. package/dist/components/form/Form/SubmitButton/SubmitButton.d.ts +4 -1
  270. package/dist/components/form/Form/SubmitButton/SubmitButton.js +18 -3
  271. package/dist/components/form/Form/SubmitButton/SubmitButton.js.map +1 -1
  272. package/dist/components/form/Form/SubmitError.d.ts +8 -2
  273. package/dist/components/form/Form/SubmitError.js +33 -3
  274. package/dist/components/form/Form/SubmitError.js.map +1 -1
  275. package/dist/components/form/Form/backend.d.ts +25 -0
  276. package/dist/components/form/Form/backend.js +30 -0
  277. package/dist/components/form/Form/backend.js.map +1 -0
  278. package/dist/components/form/Form/index.d.ts +26 -8
  279. package/dist/components/form/Form/index.js +10 -2
  280. package/dist/components/form/Form/index.js.map +1 -1
  281. package/dist/components/form/Form/modern/actions.js +59 -0
  282. package/dist/components/form/Form/modern/actions.js.map +1 -0
  283. package/dist/components/form/Form/modern/context.d.ts +12 -0
  284. package/dist/components/form/Form/modern/context.js +14 -0
  285. package/dist/components/form/Form/modern/context.js.map +1 -0
  286. package/dist/components/form/Form/modern/controller.d.ts +34 -0
  287. package/dist/components/form/Form/modern/controller.js +59 -0
  288. package/dist/components/form/Form/modern/controller.js.map +1 -0
  289. package/dist/components/form/Form/modern/field-binding.js +59 -0
  290. package/dist/components/form/Form/modern/field-binding.js.map +1 -0
  291. package/dist/components/form/Form/modern/field.d.ts +30 -0
  292. package/dist/components/form/Form/modern/field.js +23 -0
  293. package/dist/components/form/Form/modern/field.js.map +1 -0
  294. package/dist/components/form/Form/modern/path-types.d.ts +16 -0
  295. package/dist/components/form/Form/modern/react.d.ts +26 -0
  296. package/dist/components/form/Form/modern/react.js +45 -0
  297. package/dist/components/form/Form/modern/react.js.map +1 -0
  298. package/dist/components/form/Form/modern/read-types.d.ts +11 -0
  299. package/dist/components/form/Form/modern/store.js +876 -0
  300. package/dist/components/form/Form/modern/store.js.map +1 -0
  301. package/dist/components/form/Form/modern/types.d.ts +189 -0
  302. package/dist/components/form/Form/modern/validation.d.ts +28 -0
  303. package/dist/components/form/Form/modern/validation.js +41 -0
  304. package/dist/components/form/Form/modern/validation.js.map +1 -0
  305. package/dist/components/form/Form/modern/values.d.ts +7 -0
  306. package/dist/components/form/Form/modern/values.js +158 -0
  307. package/dist/components/form/Form/modern/values.js.map +1 -0
  308. package/dist/components/form/Form/use-field/types.d.ts +4 -1
  309. package/dist/components/form/Form/use-field/use-field-binding.js +97 -0
  310. package/dist/components/form/Form/use-field/use-field-binding.js.map +1 -0
  311. package/dist/components/form/Form/use-field/use-field-props.d.ts +14 -1
  312. package/dist/components/form/Form/use-field/use-field-props.js +80 -52
  313. package/dist/components/form/Form/use-field/use-field-props.js.map +1 -1
  314. package/dist/components/form/Form/use-field/use-field.d.ts +9 -1
  315. package/dist/components/form/Form/use-field/use-field.js +47 -22
  316. package/dist/components/form/Form/use-field/use-field.js.map +1 -1
  317. package/dist/components/form/Form/use-form.d.ts +4 -1
  318. package/dist/components/form/Form/use-form.js +6 -2
  319. package/dist/components/form/Form/use-form.js.map +1 -1
  320. package/dist/components/form/Form/validation.js +2 -2
  321. package/dist/components/form/Label.js +1 -1
  322. package/dist/components/form/index.d.ts +11 -3
  323. package/dist/components/form/validation/ValidationIndicator.js +1 -1
  324. package/dist/components/form/validation/resolve-validation-props.js +1 -1
  325. package/dist/components/form/validation/use-validation-props.js +1 -1
  326. package/dist/components/form/wrapper.js +1 -1
  327. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
  328. package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
  329. package/dist/components/layout/Board/Board.js +1 -1
  330. package/dist/components/layout/Board/BoardProvider.js +1 -1
  331. package/dist/components/layout/Board/BoardResponsive.js +1 -1
  332. package/dist/components/layout/Board/Widget.js +1 -1
  333. package/dist/components/layout/Board/WidgetHost.js +1 -1
  334. package/dist/components/layout/Board/board-context.js +1 -1
  335. package/dist/components/layout/Board/board-store.js +1 -1
  336. package/dist/components/layout/Board/grid-core/calculate.js +1 -1
  337. package/dist/components/layout/Board/grid-core/collision-modes.js +1 -1
  338. package/dist/components/layout/Board/grid-core/collision.js +1 -1
  339. package/dist/components/layout/Board/grid-core/compactors.js +1 -1
  340. package/dist/components/layout/Board/grid-core/constraints.js +1 -1
  341. package/dist/components/layout/Board/grid-core/group-move.js +1 -1
  342. package/dist/components/layout/Board/grid-core/layout.js +1 -1
  343. package/dist/components/layout/Board/grid-core/placement.js +1 -1
  344. package/dist/components/layout/Board/grid-core/sort.js +1 -1
  345. package/dist/components/layout/Board/index.js +1 -1
  346. package/dist/components/layout/Board/responsive-utils.js +1 -1
  347. package/dist/components/layout/Board/use-board-layout.js +1 -1
  348. package/dist/components/layout/Board/use-board-registry.js +1 -1
  349. package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
  350. package/dist/components/layout/Board/use-board-selection.js +1 -1
  351. package/dist/components/layout/Flex.js +1 -1
  352. package/dist/components/layout/Flow.js +1 -1
  353. package/dist/components/layout/Grid.js +1 -1
  354. package/dist/components/layout/Panel.js +1 -1
  355. package/dist/components/layout/Prefix.js +1 -1
  356. package/dist/components/layout/ResizablePanel.js +1 -1
  357. package/dist/components/layout/Space.js +1 -1
  358. package/dist/components/layout/Suffix.js +1 -1
  359. package/dist/components/navigation/Pagination/Pagination.js +1 -1
  360. package/dist/components/navigation/Pagination/use-pagination.js +1 -1
  361. package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
  362. package/dist/components/navigation/Tabs/TabButton.js +1 -1
  363. package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
  364. package/dist/components/navigation/Tabs/TabPanel.js +1 -1
  365. package/dist/components/navigation/Tabs/TabPicker.js +1 -1
  366. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  367. package/dist/components/navigation/Tabs/TabsAction.js +1 -1
  368. package/dist/components/navigation/Tabs/TabsContext.js +1 -1
  369. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  370. package/dist/components/navigation/Tabs/styled.js +1 -1
  371. package/dist/components/navigation/Tabs/types.js +1 -1
  372. package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
  373. package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
  374. package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
  375. package/dist/components/other/Calendar/Calendar.js +1 -1
  376. package/dist/components/other/Calendar/CalendarCell.js +1 -1
  377. package/dist/components/other/Calendar/CalendarGrid.js +1 -1
  378. package/dist/components/other/Calendar/CalendarHeader.js +1 -1
  379. package/dist/components/other/Calendar/CalendarPanel.js +1 -1
  380. package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
  381. package/dist/components/other/Calendar/PeriodGrid.js +1 -1
  382. package/dist/components/other/Calendar/RangeCalendar.js +1 -1
  383. package/dist/components/other/Calendar/styled.js +1 -1
  384. package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
  385. package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
  386. package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
  387. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
  388. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
  389. package/dist/components/overlays/Dialog/Dialog.js +1 -1
  390. package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
  391. package/dist/components/overlays/Dialog/DialogForm.js +1 -1
  392. package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
  393. package/dist/components/overlays/Dialog/context.js +1 -1
  394. package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
  395. package/dist/components/overlays/Modal/Modal.d.ts +2 -1
  396. package/dist/components/overlays/Modal/Modal.js +1 -1
  397. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  398. package/dist/components/overlays/Modal/Overlay.d.ts +1 -0
  399. package/dist/components/overlays/Modal/Overlay.js +8 -2
  400. package/dist/components/overlays/Modal/Overlay.js.map +1 -1
  401. package/dist/components/overlays/Modal/Popover.js +4 -2
  402. package/dist/components/overlays/Modal/Popover.js.map +1 -1
  403. package/dist/components/overlays/Modal/Tray.js +1 -1
  404. package/dist/components/overlays/Modal/Underlay.js +1 -1
  405. package/dist/components/overlays/Modal/types.d.ts +1 -0
  406. package/dist/components/overlays/Notifications/Notification.js +1 -1
  407. package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
  408. package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
  409. package/dist/components/overlays/Notifications/NotificationContext.d.ts +2 -0
  410. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  411. package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
  412. package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
  413. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  414. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
  415. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  416. package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
  417. package/dist/components/overlays/Notifications/index.js +1 -1
  418. package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
  419. package/dist/components/overlays/Notifications/use-notifications.js +1 -1
  420. package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
  421. package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
  422. package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
  423. package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
  424. package/dist/components/overlays/Toast/ToastItem.js +1 -1
  425. package/dist/components/overlays/Toast/index.js +1 -1
  426. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  427. package/dist/components/overlays/Toast/useToast.js +1 -1
  428. package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
  429. package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
  430. package/dist/components/overlays/Tooltip/TooltipTrigger.js +12 -2
  431. package/dist/components/overlays/Tooltip/TooltipTrigger.js.map +1 -1
  432. package/dist/components/overlays/Tooltip/context.js +1 -1
  433. package/dist/components/portal/Portal.js +1 -1
  434. package/dist/components/portal/PortalProvider.d.ts +2 -0
  435. package/dist/components/portal/PortalProvider.js +1 -1
  436. package/dist/components/portal/index.d.ts +1 -0
  437. package/dist/components/portal/usePortal.js +1 -1
  438. package/dist/components/shared/DraggableCollection.js +1 -1
  439. package/dist/components/shared/InvalidIcon.js +1 -1
  440. package/dist/components/shared/ValidIcon.js +1 -1
  441. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
  442. package/dist/components/status/Spin/Cube.js +1 -1
  443. package/dist/components/status/Spin/InternalSpinner.js +1 -1
  444. package/dist/components/status/Spin/Spin.js +1 -1
  445. package/dist/components/status/Spin/SpinsContainer.js +1 -1
  446. package/dist/data/item-themes.js +1 -1
  447. package/dist/data/themes.js +1 -1
  448. package/dist/eslint-plugin/defaults.generated.js +1 -1
  449. package/dist/eslint-plugin/index.js +1 -1
  450. package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
  451. package/dist/i18n/I18nProvider.js +1 -1
  452. package/dist/i18n/createFormatter.js +1 -1
  453. package/dist/i18n/index.js +1 -1
  454. package/dist/i18n/instance.js +1 -1
  455. package/dist/i18n/locales/de-DE/uikit.js +1 -1
  456. package/dist/i18n/locales/en-US/uikit.js +1 -1
  457. package/dist/i18n/locales/es-ES/uikit.js +1 -1
  458. package/dist/i18n/locales/es-MX/uikit.js +1 -1
  459. package/dist/i18n/locales/fr-FR/uikit.js +1 -1
  460. package/dist/i18n/locales/it-IT/uikit.js +1 -1
  461. package/dist/i18n/locales/ja-JP/uikit.js +1 -1
  462. package/dist/i18n/locales/nb-NO/uikit.js +1 -1
  463. package/dist/i18n/locales/pt-BR/uikit.js +1 -1
  464. package/dist/i18n/locales/pt-PT/uikit.js +1 -1
  465. package/dist/i18n/locales/sv-SE/uikit.js +1 -1
  466. package/dist/i18n/locales/vi-VN/uikit.js +1 -1
  467. package/dist/i18n/locales.js +1 -1
  468. package/dist/i18n/useFormatter.js +1 -1
  469. package/dist/i18n/useI18n.js +1 -1
  470. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  471. package/dist/icons/AdjustmentsIcon.js +1 -1
  472. package/dist/icons/AiIcon.js +1 -1
  473. package/dist/icons/AreaChartIcon.js +1 -1
  474. package/dist/icons/ArrowNarrowDownIcon.js +1 -1
  475. package/dist/icons/ArrowNarrowUpIcon.js +1 -1
  476. package/dist/icons/BackwardIcon.js +1 -1
  477. package/dist/icons/BarChartIcon.js +1 -1
  478. package/dist/icons/BellFilledIcon.js +1 -1
  479. package/dist/icons/BellIcon.js +1 -1
  480. package/dist/icons/BooleanIcon.js +1 -1
  481. package/dist/icons/CalendarEditIcon.js +1 -1
  482. package/dist/icons/CalendarIcon.js +1 -1
  483. package/dist/icons/CaretDownIcon.js +1 -1
  484. package/dist/icons/CaretUpIcon.js +1 -1
  485. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  486. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  487. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  488. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  489. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  490. package/dist/icons/ChartBarLineIcon.js +1 -1
  491. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  492. package/dist/icons/ChartBarStackedIcon.js +1 -1
  493. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  494. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  495. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  496. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  497. package/dist/icons/ChartBubbleIcon.js +1 -1
  498. package/dist/icons/ChartDonut2Icon.js +1 -1
  499. package/dist/icons/ChartFunnelIcon.js +1 -1
  500. package/dist/icons/ChartHeatmapIcon.js +1 -1
  501. package/dist/icons/ChartKPIIcon.js +1 -1
  502. package/dist/icons/ChartPie2Icon.js +1 -1
  503. package/dist/icons/ChartScatterIcon.js +1 -1
  504. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  505. package/dist/icons/CheckCircleIcon.js +1 -1
  506. package/dist/icons/CheckIcon.js +1 -1
  507. package/dist/icons/CircleFilledIcon.js +1 -1
  508. package/dist/icons/ClearIcon.js +1 -1
  509. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  510. package/dist/icons/CloseCircleIcon.js +1 -1
  511. package/dist/icons/CloseIcon.js +1 -1
  512. package/dist/icons/CodeIcon.js +1 -1
  513. package/dist/icons/ColumnTotalIcon.js +1 -1
  514. package/dist/icons/CopyIcon.js +1 -1
  515. package/dist/icons/CountIcon.js +1 -1
  516. package/dist/icons/CubeIcon.js +1 -1
  517. package/dist/icons/CubePauseIcon.js +1 -1
  518. package/dist/icons/CubePlayIcon.js +1 -1
  519. package/dist/icons/CurrencyDollarIcon.js +1 -1
  520. package/dist/icons/DangerIcon.js +1 -1
  521. package/dist/icons/DashboardIcon.js +1 -1
  522. package/dist/icons/DatabaseIcon.js +1 -1
  523. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  524. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  525. package/dist/icons/DirectionIcon.js +1 -1
  526. package/dist/icons/DonutIcon.js +1 -1
  527. package/dist/icons/DownIcon.js +1 -1
  528. package/dist/icons/EditIcon.js +1 -1
  529. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  530. package/dist/icons/ExclamationCircleIcon.js +1 -1
  531. package/dist/icons/ExclamationIcon.js +1 -1
  532. package/dist/icons/EyeIcon.js +1 -1
  533. package/dist/icons/EyeInvisibleIcon.js +1 -1
  534. package/dist/icons/FilterIcon.js +1 -1
  535. package/dist/icons/FolderFilledIcon.js +1 -1
  536. package/dist/icons/FolderIcon.js +1 -1
  537. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  538. package/dist/icons/FolderOpenIcon.js +1 -1
  539. package/dist/icons/ForwardIcon.js +1 -1
  540. package/dist/icons/GripVerticalIcon.js +1 -1
  541. package/dist/icons/HierarchyIcon.js +1 -1
  542. package/dist/icons/HierarchyOpenIcon.js +1 -1
  543. package/dist/icons/Icon.js +1 -1
  544. package/dist/icons/InfoCircleIcon.js +1 -1
  545. package/dist/icons/InfoIcon.js +1 -1
  546. package/dist/icons/KeyIcon.js +1 -1
  547. package/dist/icons/LeftIcon.js +1 -1
  548. package/dist/icons/LineChartIcon.js +1 -1
  549. package/dist/icons/LoadingIcon.js +1 -1
  550. package/dist/icons/LockFilledIcon.js +1 -1
  551. package/dist/icons/LockIcon.js +1 -1
  552. package/dist/icons/MoreIcon.js +1 -1
  553. package/dist/icons/NotAllowedIcon.js +1 -1
  554. package/dist/icons/Number123Icon.js +1 -1
  555. package/dist/icons/NumberIcon.js +1 -1
  556. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  557. package/dist/icons/PauseCircleIcon.js +1 -1
  558. package/dist/icons/PauseIcon.js +1 -1
  559. package/dist/icons/PercentageIcon.js +1 -1
  560. package/dist/icons/PieChartIcon.js +1 -1
  561. package/dist/icons/PipetteIcon.js +1 -1
  562. package/dist/icons/PlayCircleIcon.js +1 -1
  563. package/dist/icons/PlayIcon.js +1 -1
  564. package/dist/icons/PlusIcon.js +1 -1
  565. package/dist/icons/ProgressBarIcon.js +1 -1
  566. package/dist/icons/ReloadIcon.js +1 -1
  567. package/dist/icons/ReportIcon.js +1 -1
  568. package/dist/icons/ReturnIcon.js +1 -1
  569. package/dist/icons/RightIcon.js +1 -1
  570. package/dist/icons/RowTotalsIcon.js +1 -1
  571. package/dist/icons/SchemeIcon.js +1 -1
  572. package/dist/icons/SearchIcon.js +1 -1
  573. package/dist/icons/SemanticQueryIcon.js +1 -1
  574. package/dist/icons/SettingsIcon.js +1 -1
  575. package/dist/icons/ShieldFilledIcon.js +1 -1
  576. package/dist/icons/ShieldIcon.js +1 -1
  577. package/dist/icons/SlashIcon.js +1 -1
  578. package/dist/icons/SparklesIcon.js +1 -1
  579. package/dist/icons/SqlIcon.js +1 -1
  580. package/dist/icons/StatsIcon.js +1 -1
  581. package/dist/icons/StopIcon.js +1 -1
  582. package/dist/icons/StringIcon.js +1 -1
  583. package/dist/icons/SubtotalsIcon.js +1 -1
  584. package/dist/icons/SwitchIcon.js +1 -1
  585. package/dist/icons/TableIcon.js +1 -1
  586. package/dist/icons/ThumbsDownIcon.js +1 -1
  587. package/dist/icons/ThumbsUpIcon.js +1 -1
  588. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  589. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  590. package/dist/icons/ThunderboltIcon.js +1 -1
  591. package/dist/icons/TimeIcon.js +1 -1
  592. package/dist/icons/TrashIcon.js +1 -1
  593. package/dist/icons/UnlockIcon.js +1 -1
  594. package/dist/icons/UpIcon.js +1 -1
  595. package/dist/icons/UserGroupIcon.js +1 -1
  596. package/dist/icons/UserIcon.js +1 -1
  597. package/dist/icons/UserLockIcon.js +1 -1
  598. package/dist/icons/ViewIcon.js +1 -1
  599. package/dist/icons/WarningFilledIcon.js +1 -1
  600. package/dist/icons/WarningIcon.js +1 -1
  601. package/dist/icons/wrap-icon.js +1 -1
  602. package/dist/index.d.ts +13 -4
  603. package/dist/index.js +4 -4
  604. package/dist/probe/canonicalize.js +1 -1
  605. package/dist/probe/css.js +1 -1
  606. package/dist/probe/index.js +1 -1
  607. package/dist/provider.js +1 -1
  608. package/dist/providers/TrackingProvider.js +1 -1
  609. package/dist/providers/navigationAdapter.default.js +1 -1
  610. package/dist/shared/form.d.ts +28 -6
  611. package/dist/shared/index.d.ts +1 -1
  612. package/dist/tokens/all-tokens.js +1 -1
  613. package/dist/tokens/base.js +1 -1
  614. package/dist/tokens/color-seed.js +1 -1
  615. package/dist/tokens/color-theme.js +1 -1
  616. package/dist/tokens/colors.js +1 -1
  617. package/dist/tokens/layout.js +1 -1
  618. package/dist/tokens/lazy-styles.js +1 -1
  619. package/dist/tokens/legacy-color.js +1 -1
  620. package/dist/tokens/palette-config.js +1 -1
  621. package/dist/tokens/palette.js +1 -1
  622. package/dist/tokens/resolve.js +1 -1
  623. package/dist/tokens/shadows.js +1 -1
  624. package/dist/tokens/sizes.js +1 -1
  625. package/dist/tokens/spacing.js +1 -1
  626. package/dist/tokens/typography.js +1 -1
  627. package/dist/utils/ResizeSensor.js +1 -1
  628. package/dist/utils/colors.js +1 -1
  629. package/dist/utils/dotize.js +1 -1
  630. package/dist/utils/is-dev-env.js +1 -1
  631. package/dist/utils/modules.js +1 -1
  632. package/dist/utils/promise.js +1 -1
  633. package/dist/utils/raf.js +1 -1
  634. package/dist/utils/random.js +1 -1
  635. package/dist/utils/range.js +1 -1
  636. package/dist/utils/react/RenderCache.js +1 -1
  637. package/dist/utils/react/Slots.js +1 -1
  638. package/dist/utils/react/chain.js +1 -1
  639. package/dist/utils/react/disabledProps.js +1 -1
  640. package/dist/utils/react/escapePropagation.js +39 -0
  641. package/dist/utils/react/escapePropagation.js.map +1 -0
  642. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  643. package/dist/utils/react/index.js +1 -1
  644. package/dist/utils/react/interactions.js +1 -1
  645. package/dist/utils/react/isTextOnly.js +1 -1
  646. package/dist/utils/react/mapProps.js +1 -1
  647. package/dist/utils/react/mergeProps.js +1 -1
  648. package/dist/utils/react/nullableValue.js +1 -1
  649. package/dist/utils/react/programmaticFocus.js +58 -0
  650. package/dist/utils/react/programmaticFocus.js.map +1 -0
  651. package/dist/utils/react/resolveIcon.js +1 -1
  652. package/dist/utils/react/sharedStore.js +1 -1
  653. package/dist/utils/react/useBufferedValue.js +1 -1
  654. package/dist/utils/react/useCombinedRefs.js +1 -1
  655. package/dist/utils/react/useControlledFocusVisible.js +1 -1
  656. package/dist/utils/react/useEventBus.js +1 -1
  657. package/dist/utils/react/useId.js +1 -1
  658. package/dist/utils/react/useIsDarwin.js +1 -1
  659. package/dist/utils/react/useKeySymbols.js +1 -1
  660. package/dist/utils/react/useLayoutEffect.js +1 -1
  661. package/dist/utils/react/useLocalStorage.js +1 -1
  662. package/dist/utils/react/useMergeStyles.js +1 -1
  663. package/dist/utils/react/useOverlayEscapeGuard.js +41 -0
  664. package/dist/utils/react/useOverlayEscapeGuard.js.map +1 -0
  665. package/dist/utils/react/usePopoverSync.js +1 -1
  666. package/dist/utils/react/useQaProps.js +1 -1
  667. package/dist/utils/react/useScheme.js +1 -1
  668. package/dist/utils/react/useViewportSize.js +1 -1
  669. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  670. package/dist/utils/selection.js +1 -1
  671. package/dist/utils/styles.js +1 -1
  672. package/dist/utils/tree.js +1 -1
  673. package/dist/utils/warnings.js +1 -1
  674. package/dist/version.js +3 -3
  675. package/docs/CreateComponent.md +4 -0
  676. package/docs/FieldProperties.md +25 -13
  677. package/docs/Usage.md +17 -29
  678. package/docs/components/fields/FileInput.md +4 -0
  679. package/docs/components/form/Field.md +2 -2
  680. package/docs/components/form/Form.md +26 -2
  681. package/docs/components/form/FormInstance.md +5 -9
  682. package/docs/components/form/ModernForm.md +269 -0
  683. package/docs/modern-form-guide.md +269 -0
  684. package/docs/modern-form-migration.md +65 -0
  685. package/docs/modern-form-typecheck.md +35 -0
  686. package/package.json +12 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","names":[],"sources":["../../../../../src/components/form/Form/modern/store.ts"],"sourcesContent":["import { FORM_BACKEND } from '../backend';\n\nimport { rulesSignature, runRules } from './validation';\nimport {\n createValueSnapshotter,\n defineValue,\n formValueEqual,\n freezeContainer,\n getFieldKey,\n hasPath,\n isPlainObject,\n normalizePath,\n pathValueChanged,\n readonlySet,\n readPath,\n sameMembers,\n writePath,\n} from './values';\n\nimport type { FormValues } from './read-types';\nimport type {\n CallbackBinding,\n FieldState,\n FormCallbacks,\n FormChange,\n FormState,\n FormStore,\n FormStoreOptions,\n ModernFieldValidationResult,\n ModernSubmitResult,\n ModernValidationResult,\n RegistrationOptions,\n RegistrationToken,\n SetValueOptions,\n SubmissionToken,\n ValidationToken,\n} from './types';\nimport type { FormPath } from './values';\n\ninterface PreparedRegistration<ErrorValue>\n extends Omit<RegistrationOptions<ErrorValue>, 'dependsOn'> {\n readonly dependsOn?: readonly (readonly string[])[];\n}\n\ninterface Registration<ErrorValue> {\n options: PreparedRegistration<ErrorValue>;\n signature: string;\n order: number;\n defaultConsidered: boolean;\n}\n\ninterface FieldRecord<ErrorValue> {\n name: string;\n path: readonly string[];\n /** Defaults create aggregate metadata; explicit commands/fields own guards. */\n explicit: boolean;\n registrations: Set<Registration<ErrorValue>>;\n owner?: Registration<ErrorValue>;\n fieldDefault?: { value: unknown };\n touched: boolean;\n errors: readonly ErrorValue[];\n status: FieldState['status'];\n validationRevision: number;\n validation?: AbortController;\n reads?: Map<string, readonly string[]>;\n readsAll?: boolean;\n}\n\nconst EMPTY_ERRORS = Object.freeze([]);\nconst EMPTY_OBJECT = Object.freeze({});\nconst EMPTY_FIELDS = Object.freeze(Object.create(null)) as Readonly<\n Record<string, never>\n>;\n\nfunction related(a: readonly string[], b: readonly string[]): boolean {\n return a\n .slice(0, Math.min(a.length, b.length))\n .every((key, index) => key === b[index]);\n}\n\nfunction sameDependencies(\n a: readonly unknown[] = [],\n b: readonly unknown[] = [],\n) {\n return (\n a.length === b.length &&\n a.every((value, index) => Object.is(value, b[index]))\n );\n}\n\nfunction samePaths(\n a: readonly (readonly string[])[] = [],\n b: readonly (readonly string[])[] = [],\n) {\n return (\n a.length === b.length &&\n a.every((path, index) => sameDependencies(path, b[index]))\n );\n}\n\ninterface ActivePath {\n terminal: boolean;\n children: Map<string, ActivePath>;\n}\n\n/** Only traverse path ancestors; a field's value (even cyclic data) is a leaf. */\nfunction projectActive(\n value: unknown,\n path: ActivePath,\n previous: unknown,\n): unknown {\n if (path.terminal) return value;\n const result: Record<string, unknown> | unknown[] = Array.isArray(value)\n ? []\n : {};\n if (isPlainObject(value) || Array.isArray(value)) {\n for (const [key, child] of path.children) {\n if (!Object.hasOwn(value, key)) continue;\n defineValue(\n result,\n key,\n projectActive(\n Reflect.get(value, key),\n child,\n readPath(previous, [key]),\n ),\n );\n }\n }\n return formValueEqual(result, previous) ? previous : freezeContainer(result);\n}\n\n/**\n * Framework-neutral store, registration ownership, and async pipelines.\n * Not exported from the package; React receives the public command facade.\n */\nexport function createFormStore<\n T extends object = Record<string, unknown>,\n ErrorValue = unknown,\n>(\n inputOptions: FormStoreOptions<T, ErrorValue> = {},\n): FormStore<T, ErrorValue> {\n const options = { ...inputOptions };\n const ownValue = createValueSnapshotter();\n const records = new Map<string, FieldRecord<ErrorValue>>();\n // Subscription identity belongs to the registration, not to the callback.\n const listeners = new Set<{ notify: () => void }>();\n let values: object = ownValue(options.defaultValues ?? {});\n let defaults = values;\n let submitError: unknown;\n let submission: AbortController | undefined;\n let binding: { callbacks: FormCallbacks<T, ErrorValue> } | undefined;\n let order = 0;\n let depth = 0;\n let notifying = false;\n let disposed = false;\n let pending = false;\n let changes: FormChange[] = [];\n const cancellations = new Set<AbortController>();\n\n let state: FormState<T, ErrorValue> = Object.freeze({\n values: values as FormValues<T>,\n defaultValues: defaults as FormValues<T>,\n activeValues: EMPTY_OBJECT as FormValues<T>,\n fields: EMPTY_FIELDS,\n dirtyFields: readonlySet<string>([]),\n touchedFields: readonlySet<string>([]),\n isDirty: false,\n isTouched: false,\n isValid: false,\n isInvalid: false,\n isValidating: false,\n isSubmitting: false,\n canReset: false,\n submitError: undefined,\n revision: 0,\n });\n\n function assertLive() {\n if (disposed) throw new Error('Cannot use a disposed modern form store.');\n }\n\n function report(error: unknown) {\n try {\n if (options.onListenerError) options.onListenerError(error);\n else console.error('[form-store] Listener failed', error);\n } catch (reportError) {\n // An error reporter must not break delivery to the remaining listeners.\n console.error('[form-store] Error reporter failed', reportError);\n }\n }\n\n function developmentError(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n try {\n if (options.onDevelopmentError) options.onDevelopmentError(message);\n else console.error(`[form-store] ${message}`);\n } catch (error) {\n report(error);\n }\n }\n\n function ensure(path: FormPath, explicit = true): FieldRecord<ErrorValue> {\n const normalized = normalizePath(path);\n const name = getFieldKey(normalized);\n let record = records.get(name);\n if (!record) {\n record = {\n name,\n path: normalized,\n explicit,\n registrations: new Set(),\n touched: false,\n errors: EMPTY_ERRORS,\n status: 'unvalidated',\n validationRevision: 0,\n };\n records.set(name, record);\n }\n record.explicit ||= explicit;\n return record;\n }\n\n function dirty(record: FieldRecord<ErrorValue>): boolean {\n return (\n hasPath(values, record.path) &&\n !(record.owner?.options.isEqual ?? formValueEqual)(\n readPath(values, record.path),\n readPath(defaults, record.path),\n )\n );\n }\n\n function invalidate(record: FieldRecord<ErrorValue>, keepErrors = false) {\n const controller = record.validation;\n record.validation = undefined;\n record.reads = undefined;\n record.readsAll = false;\n record.validationRevision++;\n record.status = 'unvalidated';\n if (!keepErrors) record.errors = EMPTY_ERRORS;\n // Abort handlers are user code. Deliver them after the complete snapshot\n // publishes, so they cannot interleave writes with the command cancelling\n // them (or resurrect a token that command later overwrites).\n if (controller) cancellations.add(controller);\n }\n\n function cancelPending() {\n for (const controller of Array.from(cancellations)) {\n cancellations.delete(controller);\n controller.abort();\n }\n }\n\n function dependencyChanged(\n record: FieldRecord<ErrorValue>,\n previous: object,\n ) {\n return (\n record.owner?.options.dependsOn?.some((path) =>\n pathValueChanged(previous, values, path),\n ) ?? false\n );\n }\n\n function validationReadChanged(\n record: FieldRecord<ErrorValue>,\n previous: object,\n ) {\n if (!record.validation) return false;\n if (record.readsAll && previous !== values) return true;\n for (const path of record.reads?.values() ?? []) {\n if (pathValueChanged(previous, values, path)) return true;\n }\n return false;\n }\n\n function invalidateRelated(\n path: readonly string[],\n previous: object,\n config?: SetValueOptions,\n ) {\n for (const record of records.values()) {\n const dependency = dependencyChanged(record, previous);\n const fieldChanged =\n related(path, record.path) ||\n pathValueChanged(previous, values, record.path);\n if (\n fieldChanged ||\n dependency ||\n validationReadChanged(record, previous)\n ) {\n const revalidate =\n (fieldChanged || dependency) &&\n !!config &&\n !!record.registrations.size &&\n (config.validate === 'always' ||\n (config.validate !== 'never' &&\n (record.owner?.options.validateTrigger === 'onChange' ||\n !!record.errors.length ||\n (dependency && record.status !== 'unvalidated'))));\n invalidate(record, revalidate);\n if (revalidate) void validateRecord(record, false);\n }\n }\n }\n\n function activeValues(): object {\n const tree: ActivePath = { terminal: false, children: new Map() };\n // A registered parent includes its complete object, including inactive\n // descendants. Register only the leaves to submit only those leaves.\n for (const record of records.values()) {\n if (!record.registrations.size || !hasPath(values, record.path)) continue;\n let node = tree;\n for (const key of record.path) {\n let child = node.children.get(key);\n if (!child) {\n child = { terminal: false, children: new Map() };\n node.children.set(key, child);\n }\n node = child;\n }\n node.terminal = true;\n }\n return projectActive(values, tree, state.activeValues) as object;\n }\n\n function buildSnapshot(): FormState<T, ErrorValue> {\n const fields: Record<string, FieldState<ErrorValue>> = Object.create(null);\n const dirtyNames = new Set<string>();\n const touchedNames = new Set<string>();\n let activeCount = 0;\n let validCount = 0;\n let invalid = false;\n let validating = false;\n let resettable = submitError != null;\n for (const record of records.values()) {\n const field: FieldState<ErrorValue> = {\n name: record.name,\n value: readPath(values, record.path),\n defaultValue: readPath(defaults, record.path),\n errors: record.errors,\n status: record.status,\n touched: record.touched,\n dirty: dirty(record),\n active: record.registrations.size > 0,\n registrationCount: record.registrations.size,\n validationRevision: record.validationRevision,\n };\n const previous = state.fields[record.name];\n Object.defineProperty(fields, record.name, {\n value: formValueEqual(field, previous)\n ? previous\n : Object.freeze(field),\n enumerable: true,\n });\n if (field.dirty) dirtyNames.add(record.name);\n if (field.touched) touchedNames.add(record.name);\n resettable ||=\n field.dirty ||\n field.touched ||\n !!field.errors.length ||\n field.status !== 'unvalidated';\n if (field.active) {\n activeCount++;\n if (field.status === 'valid') validCount++;\n invalid ||= field.status === 'invalid';\n validating ||= field.status === 'validating';\n }\n }\n const next: FormState<T, ErrorValue> = {\n values: values as FormValues<T>,\n defaultValues: defaults as FormValues<T>,\n activeValues: activeValues() as FormValues<T>,\n fields: formValueEqual(fields, state.fields)\n ? state.fields\n : Object.freeze(fields),\n dirtyFields: sameMembers(dirtyNames, state.dirtyFields)\n ? state.dirtyFields\n : readonlySet(dirtyNames),\n touchedFields: sameMembers(touchedNames, state.touchedFields)\n ? state.touchedFields\n : readonlySet(touchedNames),\n isDirty: dirtyNames.size > 0,\n isTouched: touchedNames.size > 0,\n isValid: activeCount > 0 && validCount === activeCount,\n isInvalid: invalid,\n isValidating: validating,\n isSubmitting: !!submission,\n canReset: !submission && resettable,\n submitError,\n revision: state.revision,\n };\n if (formValueEqual(next, state)) return state;\n return Object.freeze({ ...next, revision: state.revision + 1 });\n }\n\n function flush() {\n if (depth || notifying || disposed) return;\n notifying = true;\n try {\n while ((pending || cancellations.size) && !disposed) {\n pending = false;\n const events = changes;\n changes = [];\n const previous = state;\n state = buildSnapshot();\n const published = state;\n if (state !== previous) {\n for (const listener of Array.from(listeners)) {\n if (!listeners.has(listener)) continue;\n try {\n listener.notify();\n } catch (error) {\n report(error);\n }\n }\n }\n if (events.length && !disposed && resolveCallbacks().onValuesChange) {\n // One callback per transaction; names are unioned, user source wins,\n // and the final command supplies the transaction's kind.\n const change: FormChange = Object.freeze({\n names: Object.freeze(\n Array.from(new Set(events.flatMap((event) => event.names))),\n ),\n source: events.some((event) => event.source === 'user')\n ? 'user'\n : 'program',\n kind: events[events.length - 1].kind,\n });\n try {\n const result = resolveCallbacks().onValuesChange?.(\n published.values,\n change,\n );\n if (result) Promise.resolve(result).catch(report);\n } catch (error) {\n report(error);\n }\n }\n cancelPending();\n }\n } finally {\n notifying = false;\n }\n }\n\n function batch(fn: () => void) {\n assertLive();\n depth++;\n try {\n fn();\n } finally {\n depth--;\n pending = true;\n flush();\n }\n }\n\n function event(\n names: string[],\n kind: FormChange['kind'],\n source: FormChange['source'] = 'program',\n ) {\n if (names.length) changes.push({ names, kind, source });\n }\n\n function write(\n path: FormPath,\n value: unknown,\n config: SetValueOptions = {},\n ): boolean {\n const normalized = normalizePath(path);\n const previous = values;\n const next = writePath(values, normalized, ownValue(value));\n const record = ensure(normalized);\n const changed = next !== values;\n if (changed) {\n values = next;\n invalidateRelated(record.path, previous, config);\n }\n if (config.touch ?? config.source === 'user') record.touched = true;\n if (changed && (config.notify ?? config.source === 'user')) {\n event([record.name], 'set', config.source);\n }\n return changed;\n }\n\n function setValue(path: FormPath, value: unknown, config?: SetValueOptions) {\n // Validate paths before entering a transaction (no partial invalid writes).\n const normalized = normalizePath(path);\n const prepared = { ...config };\n batch(() => {\n write(normalized, value, prepared);\n });\n }\n\n function setValues(next: Partial<T>, config?: SetValueOptions) {\n assertLive();\n const prepared = { ...config };\n const entries = Object.entries(next).map(\n ([name, value]) => [normalizePath(name), ownValue(value)] as const,\n );\n // Copying input or an invalid array-length write can throw. Check every\n // value/path before the first write, including when inside an outer batch.\n let checked = values;\n for (const [path, value] of entries)\n checked = writePath(checked, path, value);\n batch(() => {\n for (const [path, value] of entries) write(path, value, prepared);\n });\n }\n\n function prepareRegistration(\n path: FormPath,\n config: RegistrationOptions<ErrorValue>,\n ): PreparedRegistration<ErrorValue> {\n const prepared = {\n ...config,\n deps: config.deps ? Object.freeze([...config.deps]) : undefined,\n dependsOn: config.dependsOn?.map((dependency) =>\n Object.freeze(normalizePath(dependency)),\n ),\n rules: config.rules?.map((rule) =>\n Object.freeze({\n ...rule,\n ...(rule.enum ? { enum: Object.freeze([...rule.enum]) } : {}),\n }),\n ),\n };\n if (Object.hasOwn(prepared, 'defaultValue')) {\n prepared.defaultValue = ownValue(prepared.defaultValue);\n const normalized = normalizePath(path);\n if (!hasPath(values, normalized) && !hasPath(defaults, normalized)) {\n writePath(values, normalized, prepared.defaultValue);\n writePath(defaults, normalized, prepared.defaultValue);\n }\n }\n return prepared;\n }\n\n function seed(\n record: FieldRecord<ErrorValue>,\n registration: Registration<ErrorValue>,\n ) {\n if (\n registration.defaultConsidered ||\n !Object.hasOwn(registration.options, 'defaultValue')\n )\n return;\n registration.defaultConsidered = true;\n const value = ownValue(registration.options.defaultValue);\n if (!hasPath(values, record.path) && !hasPath(defaults, record.path)) {\n const previous = values;\n values = writePath(values, record.path, value);\n defaults = writePath(defaults, record.path, value);\n record.fieldDefault = { value };\n invalidateRelated(record.path, previous);\n } else if (\n record.fieldDefault &&\n record.registrations.size > 1 &&\n !formValueEqual(record.fieldDefault.value, value)\n ) {\n developmentError(\n `Field \"${record.name}\" registered with conflicting defaultValue; the first default is kept.`,\n );\n }\n }\n\n function register(\n path: FormPath,\n config: RegistrationOptions<ErrorValue> = {},\n ): RegistrationToken<ErrorValue> {\n assertLive();\n const normalized = normalizePath(path);\n const prepared = prepareRegistration(normalized, config);\n const signature = rulesSignature(prepared.rules, {\n hashFunctions: prepared.rulesKey === undefined,\n });\n const record = ensure(normalized);\n const registration: Registration<ErrorValue> = {\n options: prepared,\n signature,\n order: ++order,\n defaultConsidered: false,\n };\n let released = false;\n batch(() => {\n record.registrations.add(registration);\n record.owner = registration;\n seed(record, registration);\n invalidate(record);\n });\n return Object.freeze({\n name: record.name,\n get released() {\n return released || disposed;\n },\n update(next: RegistrationOptions<ErrorValue>) {\n if (released || disposed) return;\n const prepared = prepareRegistration(record.path, next);\n const signature = rulesSignature(prepared.rules, {\n hashFunctions: prepared.rulesKey === undefined,\n });\n const validationChanged =\n registration.signature !== signature ||\n registration.options.rulesKey !== prepared.rulesKey ||\n !sameDependencies(registration.options.deps, prepared.deps) ||\n !samePaths(registration.options.dependsOn, prepared.dependsOn) ||\n registration.options.validationDelay !== prepared.validationDelay ||\n registration.options.validateTrigger !== prepared.validateTrigger ||\n registration.options.errorPolicy !== prepared.errorPolicy;\n const hasNewDefault =\n !registration.defaultConsidered &&\n Object.hasOwn(prepared, 'defaultValue');\n if (\n !hasNewDefault &&\n !validationChanged &&\n (registration.options.preserve ?? true) ===\n (prepared.preserve ?? true) &&\n registration.options.isEqual === prepared.isEqual\n ) {\n // Keep the latest closures/messages without invalidating equivalent rules.\n registration.options = prepared;\n return;\n }\n batch(() => {\n registration.options = prepared;\n registration.signature = signature;\n registration.order = ++order;\n // Only an ownership change invalidates; equivalent options pushed\n // after every React commit must not cause a publication loop.\n const revalidate =\n validationChanged && record.status !== 'unvalidated';\n if (record.owner !== registration || validationChanged)\n invalidate(record, revalidate);\n record.owner = registration;\n seed(record, registration);\n if (revalidate) void validateRecord(record, false);\n });\n },\n release(config: { deferValueRemoval?: boolean } = {}) {\n if (released || disposed) return;\n released = true;\n batch(() => {\n record.registrations.delete(registration);\n if (record.owner === registration) {\n record.owner = Array.from(record.registrations).sort(\n (a, b) => b.order - a.order,\n )[0];\n invalidate(record);\n }\n if (!record.registrations.size) {\n if (registration.options.preserve === false) {\n const removeValue = () => {\n const previous = values;\n values = writePath(values, record.path, undefined, true);\n record.touched = false;\n invalidateRelated(record.path, previous, { validate: 'auto' });\n if (!hasPath(defaults, record.path))\n records.delete(record.name);\n };\n if (config.deferValueRemoval) {\n // Unregister and abort immediately. Only destructive retention\n // cleanup waits one microtask, allowing Strict Mode's effect\n // replay to reconnect without losing the current value.\n const revision = record.validationRevision;\n queueMicrotask(() => {\n if (\n !disposed &&\n records.get(record.name) === record &&\n !record.registrations.size &&\n record.validationRevision === revision\n )\n batch(removeValue);\n });\n } else removeValue();\n }\n if (\n !hasPath(values, record.path) &&\n !hasPath(defaults, record.path)\n )\n records.delete(record.name);\n }\n });\n },\n });\n }\n\n function replaceDefaults(next: Partial<T>) {\n const entries = Object.keys(next);\n entries.forEach((name) => normalizePath(name));\n defaults = ownValue(next);\n for (const name of entries) ensure(name, false);\n for (const record of records.values()) record.fieldDefault = undefined;\n }\n\n function setDefaultValues(\n next: Partial<T>,\n config: { currentValues?: 'preserve' | 'replace' } = {},\n ) {\n const replace = config.currentValues === 'replace';\n batch(() => {\n replaceDefaults(next);\n if (replace) {\n values = defaults;\n for (const record of records.values()) {\n invalidate(record);\n record.touched = false;\n }\n event(Array.from(records.keys()), 'defaults');\n }\n });\n }\n\n function adoptDefaultValues(\n next: Partial<T>,\n config: {\n when?: 'untouched' | 'clean' | 'always';\n preserveDirty?: boolean;\n } = {},\n ) {\n const when = config.when ?? 'untouched';\n const preserveDirty = config.preserveDirty ?? false;\n batch(() => {\n // Retain edits at the narrowest guarded field path. This also protects a\n // nested edited leaf when the server replaces its containing object.\n const candidates = Array.from(records.values());\n const preserved = candidates\n .filter((record) => {\n // An implicitly tracked parent must not shield untouched siblings\n // when an explicit nested field is the actual edited control.\n if (\n !record.explicit &&\n candidates.some(\n (child) =>\n child.explicit &&\n child.path.length > record.path.length &&\n related(record.path, child.path),\n )\n )\n return false;\n return (\n (when === 'untouched' && record.touched) ||\n (when === 'clean' && dirty(record)) ||\n (preserveDirty && dirty(record))\n );\n })\n .map((record) => ({\n path: record.path,\n exists: hasPath(values, record.path),\n value: readPath(values, record.path),\n }));\n const previous = values;\n replaceDefaults(next);\n values = defaults;\n for (const saved of preserved.sort(\n (a, b) => a.path.length - b.path.length,\n )) {\n values = writePath(values, saved.path, saved.value, !saved.exists);\n }\n const names: string[] = [];\n for (const record of records.values()) {\n const changed = pathValueChanged(previous, values, record.path);\n if (\n changed ||\n dependencyChanged(record, previous) ||\n validationReadChanged(record, previous)\n )\n invalidate(record);\n if (changed) names.push(record.name);\n }\n event(names, 'adopt');\n });\n }\n\n function reset(config: { values?: Partial<T> } = {}) {\n batch(() => {\n if (Object.hasOwn(config, 'values')) replaceDefaults(config.values ?? {});\n values = defaults;\n const names = Array.from(records.keys());\n for (const record of records.values()) {\n invalidate(record);\n record.touched = false;\n if (!record.registrations.size && !hasPath(values, record.path))\n records.delete(record.name);\n }\n const previous = submission;\n submission = undefined;\n submitError = undefined;\n if (previous) cancellations.add(previous);\n event(names, 'reset');\n });\n }\n\n function setFieldErrors(path: FormPath, errors: readonly ErrorValue[]) {\n assertLive();\n const copied = errors.length ? Object.freeze([...errors]) : EMPTY_ERRORS;\n batch(() => {\n const record = ensure(path);\n const status = copied.length ? 'invalid' : 'valid';\n if (record.status === status && formValueEqual(record.errors, copied))\n return;\n invalidate(record);\n record.errors = copied;\n record.status = status;\n });\n }\n\n function startValidation(path: FormPath): ValidationToken<ErrorValue> {\n assertLive();\n const record = records.get(getFieldKey(path));\n if (!record?.registrations.size)\n throw new Error('Only active form fields can validate.');\n const controller = new AbortController();\n batch(() => {\n invalidate(record, true);\n record.validation = controller;\n record.status = 'validating';\n });\n const current = () =>\n !disposed &&\n record.validation === controller &&\n !controller.signal.aborted;\n return Object.freeze({\n signal: controller.signal,\n complete(errors: readonly ErrorValue[]) {\n if (!current()) return false;\n const copied = errors.length\n ? Object.freeze([...errors])\n : EMPTY_ERRORS;\n batch(() => {\n record.validation = undefined;\n record.reads = undefined;\n record.readsAll = false;\n record.errors = copied;\n record.status = copied.length ? 'invalid' : 'valid';\n });\n return true;\n },\n cancel() {\n if (current())\n batch(() => {\n invalidate(record, true);\n });\n },\n });\n }\n\n function startSubmission(): SubmissionToken | undefined {\n assertLive();\n if (submission) return undefined;\n const controller = new AbortController();\n batch(() => {\n submission = controller;\n submitError = undefined;\n });\n return Object.freeze({\n signal: controller.signal,\n complete(result?: { error: unknown }) {\n if (disposed || submission !== controller || controller.signal.aborted)\n return false;\n const error = result?.error;\n batch(() => {\n submission = undefined;\n submitError = error;\n });\n return true;\n },\n });\n }\n\n function validateRecord(\n record: FieldRecord<ErrorValue>,\n immediate: boolean,\n parentSignal?: AbortSignal,\n ): Promise<ModernFieldValidationResult<ErrorValue>> {\n const result = (errors: readonly ErrorValue[], stale = false) => ({\n name: record.name,\n errors,\n isValid: !stale && !errors.length,\n stale,\n });\n if (parentSignal?.aborted)\n return Promise.resolve(result(EMPTY_ERRORS, true));\n const config = record.owner?.options;\n const rules = config?.rules ?? [];\n const token = startValidation(record.path);\n const revision = record.validationRevision;\n if (token.signal.aborted || parentSignal?.aborted) {\n token.cancel();\n return Promise.resolve(result(EMPTY_ERRORS, true));\n }\n if (!rules.length) {\n record.reads = undefined;\n record.readsAll = false;\n const committed = token.complete(EMPTY_ERRORS);\n return Promise.resolve(\n result(\n EMPTY_ERRORS,\n !committed || record.validationRevision !== revision,\n ),\n );\n }\n const validationValues = values;\n const reads = new Map<string, readonly string[]>();\n record.reads = reads;\n record.readsAll = false;\n const value = readPath(validationValues, record.path);\n return new Promise((resolve) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n let settled = false;\n const finish = (errors: readonly ErrorValue[], stale: boolean) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n token.signal.removeEventListener('abort', abort);\n parentSignal?.removeEventListener('abort', cancel);\n resolve(result(errors, stale));\n };\n const abort = () => finish(EMPTY_ERRORS, true);\n const cancel = () => token.cancel();\n token.signal.addEventListener('abort', abort, { once: true });\n parentSignal?.addEventListener('abort', cancel, { once: true });\n const run = async () => {\n timer = undefined;\n const errors = await runRules(\n value,\n rules,\n {\n name: record.name,\n signal: token.signal,\n getValue: (path) => {\n const normalized = normalizePath(path);\n if (!settled && !token.signal.aborted) {\n reads.set(getFieldKey(normalized), normalized);\n if (pathValueChanged(validationValues, values, normalized))\n token.cancel();\n }\n return readPath(validationValues, normalized);\n },\n getValues: () => {\n if (!settled && !token.signal.aborted) {\n record.readsAll = true;\n if (values !== validationValues) token.cancel();\n }\n return validationValues as FormValues<T>;\n },\n },\n config?.errorPolicy ?? options.errorPolicy ?? 'first',\n );\n if (!settled) {\n const committed = token.complete(errors);\n finish(\n Object.freeze(errors),\n !committed ||\n record.validationRevision !== revision ||\n !!parentSignal?.aborted,\n );\n }\n };\n const delay = immediate ? 0 : config?.validationDelay ?? 0;\n if (delay > 0) timer = setTimeout(() => void run(), delay);\n else void run();\n });\n }\n\n function validate(\n paths?: readonly FormPath[],\n config: { immediate?: boolean; signal?: AbortSignal } = {},\n ): Promise<ModernValidationResult<ErrorValue>> {\n assertLive();\n const targets = paths\n ? Array.from(new Set(paths.map(getFieldKey))).map((key) =>\n records.get(key),\n )\n : Array.from(records.values());\n const active = targets.filter(\n (record): record is FieldRecord<ErrorValue> =>\n !!record?.registrations.size,\n );\n let runs: Promise<ModernFieldValidationResult<ErrorValue>>[] = [];\n let revisions: number[] = [];\n batch(() => {\n runs = active.map((record) =>\n validateRecord(record, config.immediate ?? true, config.signal),\n );\n // Capture before publishing: a synchronous subscriber can edit/reset.\n revisions = active.map((record) => record.validationRevision);\n });\n return Promise.all(runs).then((results) => {\n const fields = results.map((result, index) => {\n const record = active[index];\n return record.validationRevision === revisions[index] &&\n !!record.registrations.size &&\n !config.signal?.aborted\n ? result\n : { ...result, stale: true, isValid: false };\n });\n return {\n fields,\n stale: fields.some((field) => field.stale) || !!config.signal?.aborted,\n isValid: !!fields.length && fields.every((field) => field.isValid),\n };\n });\n }\n\n function resolveCallbacks(): FormCallbacks<T, ErrorValue> {\n return { ...options, ...binding?.callbacks };\n }\n\n function cancelSubmission() {\n batch(() => {\n if (submission) cancellations.add(submission);\n submission = undefined;\n });\n }\n\n function bindCallbacks(\n callbacks: FormCallbacks<T, ErrorValue>,\n ): CallbackBinding<T, ErrorValue> {\n assertLive();\n if (binding)\n developmentError(\n 'A second Form root owns this controller; the newest callback binding wins.',\n );\n const own = { callbacks: { ...callbacks } };\n binding = own;\n let released = false;\n return Object.freeze({\n update(next: FormCallbacks<T, ErrorValue>) {\n if (!released && !disposed && binding === own)\n own.callbacks = { ...next };\n },\n release() {\n if (released || disposed) return;\n released = true;\n if (binding === own) {\n binding = undefined;\n cancelSubmission();\n }\n },\n });\n }\n\n async function submit(\n config: { include?: 'active' | 'all' } = {},\n ): Promise<ModernSubmitResult<ErrorValue>> {\n const token = startSubmission();\n if (!token) return { status: 'ignored', reason: 'submitting' };\n const include = config.include ?? 'active';\n // Cancellation settles promptly even if a validator or callback ignores its signal.\n return new Promise((resolve) => {\n let settled = false;\n const finish = (result: ModernSubmitResult<ErrorValue>) => {\n if (settled) return;\n settled = true;\n token.signal.removeEventListener('abort', abort);\n resolve(result);\n };\n const abort = () => finish({ status: 'stale' });\n token.signal.addEventListener('abort', abort, { once: true });\n if (token.signal.aborted) {\n abort();\n return;\n }\n const run = async () => {\n const pendingValidation = validate(undefined, { signal: token.signal });\n const validatedRecords = Array.from(records.values()).filter(\n (record) => record.registrations.size,\n );\n const revisions = validatedRecords.map(\n (record) => record.validationRevision,\n );\n const validation = await pendingValidation;\n if (settled) return;\n const changedSinceValidation =\n validatedRecords.length !== validation.fields.length ||\n validatedRecords.length !==\n Array.from(records.values()).filter(\n (record) => record.registrations.size,\n ).length ||\n validatedRecords.some(\n (record, index) =>\n !record.registrations.size ||\n record.validationRevision !== revisions[index],\n );\n if (validation.stale || changedSinceValidation) {\n token.complete();\n finish({ status: 'stale' });\n return;\n }\n const callbacks = resolveCallbacks();\n let result: ModernSubmitResult<ErrorValue>;\n if (!validation.isValid) {\n const errors = Object.fromEntries(\n validation.fields\n .filter((field) => !field.isValid)\n .map((field) => [field.name, field.errors]),\n );\n result = { status: 'invalid', errors: Object.freeze(errors) };\n try {\n await callbacks.onSubmitFailed?.({\n status: 'invalid',\n errors: Object.freeze(errors),\n });\n } catch (error) {\n report(error);\n }\n if (!settled) {\n token.complete();\n finish(result);\n }\n return;\n }\n try {\n await callbacks.onSubmit?.(\n (include === 'all' ? values : activeValues()) as FormValues<T>,\n { include, signal: token.signal },\n );\n result = { status: 'submitted' };\n } catch (error) {\n if (settled) return;\n // Keep the guard active while failure callbacks run.\n batch(() => {\n submitError = error;\n });\n try {\n await callbacks.onSubmitFailed?.({ status: 'failed', error });\n } catch (failure) {\n report(failure);\n }\n result = { status: 'failed', error };\n }\n if (!settled) {\n token.complete(\n result.status === 'failed' ? { error: result.error } : undefined,\n );\n finish(result);\n }\n };\n void run().catch((error) => {\n if (!settled) {\n token.complete({ error });\n finish({ status: 'failed', error });\n }\n });\n });\n }\n\n function subscribe(listener: () => void) {\n assertLive();\n const entry = { notify: listener };\n listeners.add(entry);\n return () => {\n listeners.delete(entry);\n };\n }\n\n function dispose() {\n if (disposed) return;\n disposed = true;\n listeners.clear();\n binding = undefined;\n changes = [];\n pending = false;\n for (const record of records.values()) {\n record.registrations.clear();\n record.owner = undefined;\n invalidate(record);\n }\n const previous = submission;\n submission = undefined;\n if (previous) cancellations.add(previous);\n state = buildSnapshot();\n records.clear();\n cancelPending();\n }\n\n for (const name of Object.keys(values)) ensure(name, false);\n state = buildSnapshot();\n\n return Object.freeze({\n [FORM_BACKEND]: 'modern' as const,\n getSnapshot: () => state,\n getFieldSnapshot: (path: FormPath) => state.fields[getFieldKey(path)],\n getValue: (path: FormPath) => readPath(values, normalizePath(path)),\n getValues: () => values as FormValues<T>,\n getActiveValues: () => activeValues() as FormValues<T>,\n subscribe,\n subscribeSelector<Selected>(\n selector: (snapshot: FormState<T, ErrorValue>) => Selected,\n listener: (value: Selected, previous: Selected) => void,\n isEqual: (a: Selected, b: Selected) => boolean = Object.is,\n ) {\n let selected = selector(state);\n return subscribe(() => {\n const next = selector(state);\n if (isEqual(selected, next)) return;\n const previous = selected;\n selected = next;\n listener(next, previous);\n });\n },\n register,\n validate,\n submit,\n bindCallbacks,\n updateCallbacks(callbacks: FormCallbacks<T, ErrorValue>) {\n options.onSubmit = callbacks.onSubmit;\n options.onSubmitFailed = callbacks.onSubmitFailed;\n options.onValuesChange = callbacks.onValuesChange;\n },\n blur(path: FormPath) {\n const record = records.get(getFieldKey(path));\n if (!record?.registrations.size) return;\n batch(() => {\n record.touched = true;\n if ((record.owner?.options.validateTrigger ?? 'onBlur') === 'onBlur')\n void validateRecord(record, false);\n });\n },\n setValue,\n setValues,\n batch,\n setDefaultValues,\n adoptDefaultValues,\n reset,\n touch(path: FormPath, touched = true) {\n batch(() => {\n ensure(path).touched = touched;\n });\n },\n setFieldErrors,\n clearFieldErrors: (path: FormPath) => setFieldErrors(path, EMPTY_ERRORS),\n startValidation,\n startSubmission,\n setSubmitError(error: unknown) {\n batch(() => {\n submitError = error;\n });\n },\n clearSubmitError() {\n batch(() => {\n submitError = undefined;\n });\n },\n dispose,\n debug: Object.freeze({\n listenerCount: () => listeners.size,\n registrationCount: () =>\n Array.from(records.values()).reduce(\n (count, record) => count + record.registrations.size,\n 0,\n ),\n }),\n }) as FormStore<T, ErrorValue>;\n}\n"],"mappings":";;;;;;AAoEA,MAAM,eAAe,OAAO,OAAO,EAAE,CAAC;AACtC,MAAM,eAAe,OAAO,OAAO,EAAE,CAAC;AACtC,MAAM,eAAe,OAAO,OAAO,OAAO,OAAO,KAAK,CAAC;AAIvD,SAAS,QAAQ,GAAsB,GAA+B;AACpE,QAAO,EACJ,MAAM,GAAG,KAAK,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CACtC,OAAO,KAAK,UAAU,QAAQ,EAAE,OAAO;;AAG5C,SAAS,iBACP,IAAwB,EAAE,EAC1B,IAAwB,EAAE,EAC1B;AACA,QACE,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,OAAO,UAAU,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;;AAIzD,SAAS,UACP,IAAoC,EAAE,EACtC,IAAoC,EAAE,EACtC;AACA,QACE,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,MAAM,UAAU,iBAAiB,MAAM,EAAE,OAAO,CAAC;;;AAU9D,SAAS,cACP,OACA,MACA,UACS;AACT,KAAI,KAAK,SAAU,QAAO;CAC1B,MAAM,SAA8C,MAAM,QAAQ,MAAM,GACpE,EAAE,GACF,EAAE;AACN,KAAI,cAAc,MAAM,IAAI,MAAM,QAAQ,MAAM,CAC9C,MAAK,MAAM,CAAC,KAAK,UAAU,KAAK,UAAU;AACxC,MAAI,CAAC,OAAO,OAAO,OAAO,IAAI,CAAE;AAChC,cACE,QACA,KACA,cACE,QAAQ,IAAI,OAAO,IAAI,EACvB,OACA,SAAS,UAAU,CAAC,I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AAmB,SAAmB,eAAe,MAAM,aAAa;EACxE;EACA;EACA,eAAe,OAAgB;AAC7B,eAAY;AACV,kBAAc;KACd;;EAEJ,mBAAmB;AACjB,eAAY;AACV,kBAAc;KACd;;EAEJ;EACA,OAAO,OAAO,OAAO;GACnB,qBAAqB,UAAU;GAC/B,yBACE,MAAM,KAAK,QAAQ,QAAQ,CAAC,CAAC,QAC1B,OAAO,WAAW,QAAQ,OAAO,cAAc,MAChD,EACD;GACJ,CAAC;EACH,CAAC"}
@@ -0,0 +1,189 @@
1
+
2
+ import { ModernFormBrand } from "../backend.js";
3
+ import { FormPath } from "./values.js";
4
+ import { FormValues } from "./read-types.js";
5
+ import { ModernValidationRule } from "./validation.js";
6
+
7
+ //#region src/components/form/Form/modern/types.d.ts
8
+ type FieldStatus = 'unvalidated' | 'validating' | 'valid' | 'invalid';
9
+ interface FieldState<ErrorValue = unknown> {
10
+ readonly name: string;
11
+ readonly value: unknown;
12
+ readonly defaultValue: unknown;
13
+ readonly errors: readonly ErrorValue[];
14
+ readonly status: FieldStatus;
15
+ readonly touched: boolean;
16
+ readonly dirty: boolean;
17
+ readonly active: boolean;
18
+ readonly registrationCount: number;
19
+ readonly validationRevision: number;
20
+ }
21
+ interface FormState<T extends object, ErrorValue = unknown> {
22
+ readonly values: FormValues<T>;
23
+ readonly activeValues: FormValues<T>;
24
+ readonly defaultValues: FormValues<T>;
25
+ readonly fields: Readonly<Record<string, FieldState<ErrorValue>>>;
26
+ readonly dirtyFields: ReadonlySet<string>;
27
+ readonly touchedFields: ReadonlySet<string>;
28
+ readonly isDirty: boolean;
29
+ readonly isTouched: boolean;
30
+ readonly isValid: boolean;
31
+ readonly isInvalid: boolean;
32
+ readonly isValidating: boolean;
33
+ readonly isSubmitting: boolean;
34
+ /** Reset would clear edits, touched/validation state, or a submit error; false while submitting. */
35
+ readonly canReset: boolean;
36
+ readonly submitError: unknown;
37
+ readonly revision: number;
38
+ }
39
+ interface RegistrationOptions<ErrorValue = unknown> {
40
+ readonly rules?: readonly ModernValidationRule<ErrorValue>[];
41
+ /** Manual function revision, skipping source comparison. Declarative constraints are always compared. */
42
+ readonly rulesKey?: string;
43
+ /** Field paths that trigger revalidation after this field has been validated. Declare conditional reads too. */
44
+ readonly dependsOn?: readonly FormPath[];
45
+ /** External validator inputs, compared by Object.is. */
46
+ readonly deps?: readonly unknown[];
47
+ readonly validationDelay?: number;
48
+ readonly validateTrigger?: 'onBlur' | 'onChange' | 'onSubmit';
49
+ readonly errorPolicy?: 'first' | 'all';
50
+ readonly defaultValue?: unknown;
51
+ readonly preserve?: boolean;
52
+ readonly isEqual?: (a: unknown, b: unknown) => boolean;
53
+ }
54
+ interface RegistrationToken<ErrorValue = unknown> {
55
+ readonly name: string;
56
+ readonly released: boolean;
57
+ update(options: RegistrationOptions<ErrorValue>): void;
58
+ /** React effect replay can reconnect before the queued value removal. */
59
+ release(options?: {
60
+ deferValueRemoval?: boolean;
61
+ }): void;
62
+ }
63
+ interface FormChange {
64
+ readonly names: readonly string[];
65
+ readonly source: 'user' | 'program';
66
+ readonly kind: 'set' | 'reset' | 'adopt' | 'defaults';
67
+ }
68
+ interface SetValueOptions {
69
+ readonly validate?: 'auto' | 'always' | 'never';
70
+ readonly source?: FormChange['source'];
71
+ readonly touch?: boolean;
72
+ readonly notify?: boolean;
73
+ }
74
+ interface ModernSubmitContext {
75
+ readonly include: 'active' | 'all';
76
+ readonly signal: AbortSignal;
77
+ }
78
+ interface FormCallbacks<T extends object, ErrorValue = unknown> {
79
+ /** Form.useController commits the latest callback after each render. */
80
+ readonly onSubmit?: (values: FormValues<T>, context: ModernSubmitContext) => void | Promise<void>;
81
+ /** Form.useController commits the latest callback after each render. */
82
+ readonly onSubmitFailed?: (failure: ModernSubmitFailure<ErrorValue>) => void | Promise<void>;
83
+ /** Form.useController commits the latest callback after each render. */
84
+ readonly onValuesChange?: (values: FormValues<T>, change: FormChange) => void | Promise<void>;
85
+ }
86
+ type ModernSubmitFailure<ErrorValue = unknown> = {
87
+ status: 'invalid';
88
+ errors: Readonly<Record<string, readonly ErrorValue[]>>;
89
+ } | {
90
+ status: 'failed';
91
+ error: unknown;
92
+ };
93
+ interface CallbackBinding<T extends object, ErrorValue = unknown> {
94
+ update(callbacks: FormCallbacks<T, ErrorValue>): void;
95
+ release(): void;
96
+ }
97
+ interface ModernFieldValidationResult<ErrorValue = unknown> {
98
+ readonly name: string;
99
+ readonly errors: readonly ErrorValue[];
100
+ readonly isValid: boolean;
101
+ readonly stale: boolean;
102
+ }
103
+ interface ModernValidationResult<ErrorValue = unknown> {
104
+ readonly fields: readonly ModernFieldValidationResult<ErrorValue>[];
105
+ readonly isValid: boolean;
106
+ readonly stale: boolean;
107
+ }
108
+ type ModernSubmitResult<ErrorValue = unknown> = ModernSubmitFailure<ErrorValue> | {
109
+ status: 'ignored';
110
+ reason: 'submitting';
111
+ } | {
112
+ status: 'stale';
113
+ } | {
114
+ status: 'submitted';
115
+ };
116
+ interface FormStoreOptions<T extends object, ErrorValue = unknown> extends FormCallbacks<T, ErrorValue> {
117
+ /** Initial default policy; later hook renders do not change it. Fields can override it. */
118
+ readonly errorPolicy?: 'first' | 'all';
119
+ /** Initial values only. Use setDefaultValues/adoptDefaultValues/reset to change them. */
120
+ readonly defaultValues?: Partial<T>;
121
+ /** Initial listener-error handler; later hook renders do not change it. */
122
+ readonly onListenerError?: (error: unknown) => void;
123
+ /** Initial development-error handler; later hook renders do not change it. */
124
+ readonly onDevelopmentError?: (message: string) => void;
125
+ }
126
+ /** Internal state token owned by the validation pipeline. */
127
+ interface ValidationToken<ErrorValue> {
128
+ readonly signal: AbortSignal;
129
+ complete(errors: readonly ErrorValue[]): boolean;
130
+ cancel(): void;
131
+ }
132
+ /** A reset/disposal invalidates the token so a late completion cannot publish. */
133
+ interface SubmissionToken {
134
+ readonly signal: AbortSignal;
135
+ complete(result?: {
136
+ error: unknown;
137
+ }): boolean;
138
+ }
139
+ /** Internal until the React/controller API lands in subsequent phases. */
140
+ interface FormStore<T extends object = Record<string, unknown>, ErrorValue = unknown> extends ModernFormBrand {
141
+ getSnapshot(): FormState<T, ErrorValue>;
142
+ getFieldSnapshot(path: FormPath): FieldState<ErrorValue> | undefined;
143
+ getValue<K extends keyof T & string>(name: K): T[K] | undefined;
144
+ getValue(path: FormPath): unknown;
145
+ getValues(): FormValues<T>;
146
+ getActiveValues(): FormValues<T>;
147
+ subscribe(listener: () => void): () => void;
148
+ subscribeSelector<Selected>(selector: (state: FormState<T, ErrorValue>) => Selected, listener: (value: Selected, previous: Selected) => void, isEqual?: (a: Selected, b: Selected) => boolean): () => void;
149
+ register(path: FormPath, options?: RegistrationOptions<ErrorValue>): RegistrationToken<ErrorValue>;
150
+ validate(paths?: readonly FormPath[], options?: {
151
+ immediate?: boolean;
152
+ signal?: AbortSignal;
153
+ }): Promise<ModernValidationResult<ErrorValue>>;
154
+ submit(options?: {
155
+ include?: 'active' | 'all';
156
+ }): Promise<ModernSubmitResult<ErrorValue>>;
157
+ blur(path: FormPath): void;
158
+ bindCallbacks(callbacks: FormCallbacks<T, ErrorValue>): CallbackBinding<T, ErrorValue>;
159
+ updateCallbacks(callbacks: FormCallbacks<T, ErrorValue>): void;
160
+ setValue(path: FormPath, value: unknown, options?: SetValueOptions): void;
161
+ setValues(values: Partial<T>, options?: SetValueOptions): void;
162
+ /** Synchronous notification transaction; completed writes commit even if fn throws. */
163
+ batch(fn: () => void): void;
164
+ setDefaultValues(values: Partial<T>, options?: {
165
+ currentValues?: 'preserve' | 'replace';
166
+ }): void;
167
+ adoptDefaultValues(values: Partial<T>, options?: {
168
+ when?: 'untouched' | 'clean' | 'always';
169
+ preserveDirty?: boolean;
170
+ }): void;
171
+ reset(options?: {
172
+ values?: Partial<T>;
173
+ }): void;
174
+ touch(path: FormPath, touched?: boolean): void;
175
+ setFieldErrors(path: FormPath, errors: readonly ErrorValue[]): void;
176
+ clearFieldErrors(path: FormPath): void;
177
+ startValidation(path: FormPath): ValidationToken<ErrorValue>;
178
+ startSubmission(): SubmissionToken | undefined;
179
+ setSubmitError(error: unknown): void;
180
+ clearSubmitError(): void;
181
+ dispose(): void;
182
+ readonly debug: {
183
+ listenerCount(): number;
184
+ registrationCount(): number;
185
+ };
186
+ }
187
+ //#endregion
188
+ export { FieldState, FormCallbacks, FormChange, FormState, FormStore, FormStoreOptions, ModernFieldValidationResult, ModernSubmitContext, ModernSubmitFailure, ModernSubmitResult, ModernValidationResult, RegistrationOptions, SetValueOptions };
189
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,28 @@
1
+
2
+ import { FormPath } from "./values.js";
3
+ import { FormValues } from "./read-types.js";
4
+
5
+ //#region src/components/form/Form/modern/validation.d.ts
6
+ interface ModernValidationContext<T extends object = Record<string, unknown>> {
7
+ readonly name: string;
8
+ readonly signal: AbortSignal;
9
+ getValue(path: FormPath): unknown;
10
+ getValues(): FormValues<T>;
11
+ }
12
+ /** Library-neutral: return an error, or throw/reject; undefined/null means success. */
13
+ interface ModernValidationRule<ErrorValue = unknown> {
14
+ required?: boolean;
15
+ min?: number;
16
+ max?: number;
17
+ len?: number;
18
+ pattern?: RegExp;
19
+ type?: string;
20
+ enum?: readonly unknown[];
21
+ whitespace?: boolean;
22
+ transform?: (value: any) => unknown;
23
+ message?: ErrorValue;
24
+ validator?: (rule: ModernValidationRule<ErrorValue>, value: any, context: ModernValidationContext<any>) => ErrorValue | void | Promise<ErrorValue | void>;
25
+ }
26
+ //#endregion
27
+ export { ModernValidationContext, ModernValidationRule };
28
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1,41 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.181.0 | Cube Dev Team */
2
+ import { applyRule } from "../validation.js";
3
+
4
+ //#region src/components/form/Form/modern/validation.ts
5
+ /** Compare constraints and function source; captures still need deps/rulesKey. */
6
+ function rulesSignature(rules = [], { hashFunctions = true } = {}) {
7
+ const seen = /* @__PURE__ */ new Set();
8
+ const signature = (value) => {
9
+ if (typeof value === "function") return hashFunctions ? `function:${value.toString()}` : "function";
10
+ if (value instanceof RegExp) return `regexp:${value.source}/${value.flags}`;
11
+ if (!value || typeof value !== "object") return `${typeof value}:${String(value)}`;
12
+ if (seen.has(value)) return "cycle";
13
+ seen.add(value);
14
+ const result = JSON.stringify(Object.keys(value).filter((key) => key !== "message").sort().map((key) => [key, signature(Reflect.get(value, key))]));
15
+ seen.delete(value);
16
+ return result;
17
+ };
18
+ return signature(rules);
19
+ }
20
+ async function runRules(value, rules, context, policy) {
21
+ const errors = [];
22
+ for (const rule of rules) {
23
+ if (context.signal.aborted) break;
24
+ const { validator, transform, ...checks } = rule;
25
+ try {
26
+ const transformed = transform ? transform(value) : value;
27
+ await applyRule(transformed, checks, void 0);
28
+ if (context.signal.aborted) break;
29
+ const result = await validator?.(rule, transformed, context);
30
+ if (result !== void 0 && result !== null && result !== "") errors.push(result);
31
+ } catch (error) {
32
+ errors.push((error instanceof Error ? error.message || rule.message : error) ?? rule.message ?? (rule.required ? "Required" : "Invalid value"));
33
+ }
34
+ if (errors.length && policy === "first") break;
35
+ }
36
+ return errors;
37
+ }
38
+
39
+ //#endregion
40
+ export { rulesSignature, runRules };
41
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","names":[],"sources":["../../../../../src/components/form/Form/modern/validation.ts"],"sourcesContent":["import { applyRule } from '../validation';\n\nimport type { FormValues } from './read-types';\nimport type { FormPath } from './values';\n\nexport interface ModernValidationContext<\n T extends object = Record<string, unknown>,\n> {\n readonly name: string;\n readonly signal: AbortSignal;\n getValue(path: FormPath): unknown;\n getValues(): FormValues<T>;\n}\n\n/** Library-neutral: return an error, or throw/reject; undefined/null means success. */\nexport interface ModernValidationRule<ErrorValue = unknown> {\n required?: boolean;\n min?: number;\n max?: number;\n len?: number;\n pattern?: RegExp;\n type?: string;\n enum?: readonly unknown[];\n whitespace?: boolean;\n transform?: (value: any) => unknown;\n message?: ErrorValue;\n validator?: (\n rule: ModernValidationRule<ErrorValue>,\n value: any,\n context: ModernValidationContext<any>,\n ) => ErrorValue | void | Promise<ErrorValue | void>;\n}\n\n/** Compare constraints and function source; captures still need deps/rulesKey. */\nexport function rulesSignature<ErrorValue>(\n rules: readonly ModernValidationRule<ErrorValue>[] = [],\n { hashFunctions = true }: { hashFunctions?: boolean } = {},\n): string {\n const seen = new Set<object>();\n const signature = (value: unknown): string => {\n if (typeof value === 'function')\n return hashFunctions ? `function:${value.toString()}` : 'function';\n if (value instanceof RegExp) return `regexp:${value.source}/${value.flags}`;\n if (!value || typeof value !== 'object')\n return `${typeof value}:${String(value)}`;\n if (seen.has(value)) return 'cycle';\n seen.add(value);\n const result = JSON.stringify(\n Object.keys(value)\n .filter((key) => key !== 'message')\n .sort()\n .map((key) => [key, signature(Reflect.get(value, key))]),\n );\n seen.delete(value);\n return result;\n };\n return signature(rules);\n}\n\nexport async function runRules<ErrorValue>(\n value: unknown,\n rules: readonly ModernValidationRule<ErrorValue>[],\n context: ModernValidationContext<any>,\n policy: 'first' | 'all',\n): Promise<ErrorValue[]> {\n const errors: ErrorValue[] = [];\n for (const rule of rules) {\n if (context.signal.aborted) break;\n const { validator, transform, ...checks } = rule;\n try {\n const transformed = transform ? transform(value) : value;\n await applyRule(transformed, checks, undefined);\n if (context.signal.aborted) break;\n const result = await validator?.(rule, transformed, context);\n if (result !== undefined && result !== null && result !== '')\n errors.push(result as ErrorValue);\n } catch (error) {\n errors.push(\n ((error instanceof Error ? error.message || rule.message : error) ??\n rule.message ??\n (rule.required ? 'Required' : 'Invalid value')) as ErrorValue,\n );\n }\n if (errors.length && policy === 'first') break;\n }\n return errors;\n}\n"],"mappings":";;;;;AAkCA,SAAgB,eACd,QAAqD,EAAE,EACvD,EAAE,gBAAgB,SAAsC,EAAE,EAClD;CACR,MAAM,uBAAO,IAAI,KAAa;CAC9B,MAAM,aAAa,UAA2B;AAC5C,MAAI,OAAO,UAAU,WACnB,QAAO,gBAAgB,YAAY,MAAM,UAAU,KAAK;AAC1D,MAAI,iBAAiB,OAAQ,QAAO,UAAU,MAAM,OAAO,GAAG,MAAM;AACpE,MAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO,GAAG,OAAO,MAAM,GAAG,OAAO,MAAM;AACzC,MAAI,KAAK,IAAI,MAAM,CAAE,QAAO;AAC5B,OAAK,IAAI,MAAM;EACf,MAAM,SAAS,KAAK,UAClB,OAAO,KAAK,MAAM,CACf,QAAQ,QAAQ,QAAQ,UAAU,CAClC,MAAM,CACN,KAAK,QAAQ,CAAC,KAAK,UAAU,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,CAC3D;AACD,OAAK,OAAO,MAAM;AAClB,SAAO;;AAET,QAAO,UAAU,MAAM;;AAGzB,eAAsB,SACpB,OACA,OACA,SACA,QACuB;CACvB,MAAM,SAAuB,EAAE;AAC/B,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,QAAQ,OAAO,QAAS;EAC5B,MAAM,EAAE,WAAW,WAAW,GAAG,WAAW;AAC5C,MAAI;GACF,MAAM,cAAc,YAAY,UAAU,MAAM,GAAG;AACnD,SAAM,UAAU,aAAa,QAAQ,OAAU;AAC/C,OAAI,QAAQ,OAAO,QAAS;GAC5B,MAAM,SAAS,MAAM,YAAY,MAAM,aAAa,QAAQ;AAC5D,OAAI,WAAW,UAAa,WAAW,QAAQ,WAAW,GACxD,QAAO,KAAK,OAAqB;WAC5B,OAAO;AACd,UAAO,MACH,iBAAiB,QAAQ,MAAM,WAAW,KAAK,UAAU,UACzD,KAAK,YACJ,KAAK,WAAW,aAAa,iBACjC;;AAEH,MAAI,OAAO,UAAU,WAAW,QAAS;;AAE3C,QAAO"}
@@ -0,0 +1,7 @@
1
+
2
+ //#region src/components/form/Form/modern/values.d.ts
3
+ /** A string is a literal field name; tuples explicitly address nested values. */
4
+ type FormPath = string | readonly (string | number)[];
5
+ //#endregion
6
+ export { FormPath };
7
+ //# sourceMappingURL=values.d.ts.map
@@ -0,0 +1,158 @@
1
+ /** @license MIT | @cube-dev/ui-kit v0.181.0 | Cube Dev Team */
2
+ //#region src/components/form/Form/modern/values.ts
3
+ const ownedContainers = /* @__PURE__ */ new WeakSet();
4
+ function freezeContainer(value) {
5
+ ownedContainers.add(value);
6
+ return Object.freeze(value);
7
+ }
8
+ function isPlainObject(value) {
9
+ if (!value || typeof value !== "object") return false;
10
+ const prototype = Object.getPrototypeOf(value);
11
+ return prototype === Object.prototype || prototype === null;
12
+ }
13
+ function isContainer(value) {
14
+ return Array.isArray(value) || isPlainObject(value);
15
+ }
16
+ function enumerableKeys(value) {
17
+ return Reflect.ownKeys(value).filter((key) => Object.prototype.propertyIsEnumerable.call(value, key));
18
+ }
19
+ /** Preserve the special non-enumerable descriptor of an array's length. */
20
+ function defineValue(container, key, value) {
21
+ Object.defineProperty(container, key, Array.isArray(container) && key === "length" ? { value } : {
22
+ value,
23
+ enumerable: true,
24
+ writable: true,
25
+ configurable: true
26
+ });
27
+ }
28
+ function emptyCopy(value) {
29
+ return Array.isArray(value) ? new Array(value.length) : Object.create(Object.getPrototypeOf(value));
30
+ }
31
+ function copyContainer(value) {
32
+ const copy = emptyCopy(value);
33
+ for (const key of enumerableKeys(value)) defineValue(copy, key, Reflect.get(value, key));
34
+ return copy;
35
+ }
36
+ /** The ADR's default dirty comparator: Object.is, then one structural level. */
37
+ function formValueEqual(a, b) {
38
+ if (Object.is(a, b)) return true;
39
+ if (!isContainer(a) || !isContainer(b)) return false;
40
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
41
+ if (Array.isArray(a) && Array.isArray(b) && a.length !== b.length) return false;
42
+ const keys = enumerableKeys(a);
43
+ return keys.length === enumerableKeys(b).length && keys.every((key) => Object.hasOwn(b, key) && Object.is(Reflect.get(a, key), Reflect.get(b, key)));
44
+ }
45
+ function normalizePath(path) {
46
+ const parts = typeof path === "string" ? [path] : path;
47
+ if (!parts.length) throw new Error("A form field path must not be empty.");
48
+ return Object.freeze(Array.from(parts, (part) => {
49
+ if (typeof part !== "string" && (!Number.isSafeInteger(part) || part < 0)) throw new Error("A numeric form path segment must be a non-negative safe integer.");
50
+ const key = String(part);
51
+ if (key === "__proto__" || key === "prototype" || key === "constructor") throw new Error(`Unsafe form path segment: ${key}`);
52
+ return key;
53
+ }));
54
+ }
55
+ /** Escaping keeps literal dotted names distinct from nested tuple paths. */
56
+ function getFieldKey(path) {
57
+ return normalizePath(path).map((part) => part.replace(/\\/g, "\\\\").replace(/\./g, "\\.")).join(".");
58
+ }
59
+ /** Inverse of getFieldKey, for stable keys produced by this module. */
60
+ function getFieldPath(key) {
61
+ const path = [""];
62
+ for (let index = 0; index < key.length; index++) {
63
+ const part = key[index];
64
+ if (part === ".") path.push("");
65
+ else path[path.length - 1] += part === "\\" ? key[++index] : part;
66
+ }
67
+ return Object.freeze(path);
68
+ }
69
+ function readPath(root, path) {
70
+ let value = root;
71
+ for (const key of path) {
72
+ if (!isContainer(value) || !Object.hasOwn(value, key)) return void 0;
73
+ value = Reflect.get(value, key);
74
+ }
75
+ return value;
76
+ }
77
+ function hasPath(root, path) {
78
+ const parent = readPath(root, path.slice(0, -1));
79
+ return isContainer(parent) && Object.hasOwn(parent, path[path.length - 1]);
80
+ }
81
+ /** Missing and explicitly undefined values are distinct form states. */
82
+ function pathValueChanged(previous, next, path) {
83
+ return !Object.is(readPath(previous, path), readPath(next, path)) || hasPath(previous, path) !== hasPath(next, path);
84
+ }
85
+ /** Copy just the ancestor chain. Array deletion leaves indices in place. */
86
+ function writePath(root, path, value, remove = false) {
87
+ function write(current, depth) {
88
+ const key = path[depth];
89
+ const container = isContainer(current) ? current : void 0;
90
+ const exists = !!container && Object.hasOwn(container, key);
91
+ const previous = exists ? Reflect.get(container, key) : void 0;
92
+ if (remove && !exists) return current;
93
+ const last = depth === path.length - 1;
94
+ const next = last ? value : write(previous, depth + 1);
95
+ if (!remove && exists && Object.is(previous, next)) return current;
96
+ if (remove && !last && Object.is(previous, next)) return current;
97
+ if (remove && last && Array.isArray(container) && key === "length") return current;
98
+ const copy = container ? copyContainer(container) : depth > 0 && /^(0|[1-9]\d*)$/.test(key) ? [] : {};
99
+ if (remove && last) Reflect.deleteProperty(copy, key);
100
+ else defineValue(copy, key, next);
101
+ return freezeContainer(copy);
102
+ }
103
+ return write(root, 0);
104
+ }
105
+ /**
106
+ * Own plain data without freezing caller-owned objects. Non-plain values (dates,
107
+ * files, ReactNode errors, etc.) are opaque and must be treated as immutable.
108
+ * Reusing an input reference means reusing its value, just like React state.
109
+ */
110
+ function createValueSnapshotter() {
111
+ const copies = /* @__PURE__ */ new WeakMap();
112
+ function snapshot(value) {
113
+ const pending = /* @__PURE__ */ new WeakMap();
114
+ const entries = [];
115
+ function clone(input) {
116
+ if (!isContainer(input) || ownedContainers.has(input)) return input;
117
+ if (copies.has(input)) return copies.get(input);
118
+ if (pending.has(input)) return pending.get(input);
119
+ const copy = emptyCopy(input);
120
+ pending.set(input, copy);
121
+ entries.push([input, copy]);
122
+ for (const key of enumerableKeys(input)) defineValue(copy, key, clone(Reflect.get(input, key)));
123
+ return copy;
124
+ }
125
+ const result = clone(value);
126
+ for (const [input, copy] of entries) {
127
+ freezeContainer(copy);
128
+ copies.set(input, copy);
129
+ }
130
+ return result;
131
+ }
132
+ return snapshot;
133
+ }
134
+ /** Object.freeze(new Set()) still permits add/delete. Hide the writable set. */
135
+ function readonlySet(values) {
136
+ const set = new Set(values);
137
+ const view = Object.freeze({
138
+ get size() {
139
+ return set.size;
140
+ },
141
+ has: (value) => set.has(value),
142
+ entries: () => set.entries(),
143
+ keys: () => set.keys(),
144
+ values: () => set.values(),
145
+ [Symbol.iterator]: () => set[Symbol.iterator](),
146
+ forEach: (callback, thisArg) => {
147
+ set.forEach((value) => callback.call(thisArg, value, value, view));
148
+ }
149
+ });
150
+ return view;
151
+ }
152
+ function sameMembers(a, b) {
153
+ return a.size === b.size && Array.from(a).every((value) => b.has(value));
154
+ }
155
+
156
+ //#endregion
157
+ export { createValueSnapshotter, defineValue, formValueEqual, freezeContainer, getFieldKey, getFieldPath, hasPath, isPlainObject, normalizePath, pathValueChanged, readPath, readonlySet, sameMembers, writePath };
158
+ //# sourceMappingURL=values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.js","names":[],"sources":["../../../../../src/components/form/Form/modern/values.ts"],"sourcesContent":["/** A string is a literal field name; tuples explicitly address nested values. */\nexport type FormPath = string | readonly (string | number)[];\n\ntype Container = Record<string, unknown> | unknown[];\n\n// Path copies and ingress copies share ownership, including across stores.\n// A WeakSet does not keep old snapshots alive after subscribers release them.\nconst ownedContainers = new WeakSet<object>();\n\nexport function freezeContainer<T extends object>(value: T): T {\n ownedContainers.add(value);\n return Object.freeze(value);\n}\n\nexport function isPlainObject(\n value: unknown,\n): value is Record<string, unknown> {\n if (!value || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction isContainer(value: unknown): value is Container {\n return Array.isArray(value) || isPlainObject(value);\n}\n\nfunction enumerableKeys(value: object): (string | symbol)[] {\n return Reflect.ownKeys(value).filter((key) =>\n Object.prototype.propertyIsEnumerable.call(value, key),\n );\n}\n\n/** Preserve the special non-enumerable descriptor of an array's length. */\nexport function defineValue(\n container: object,\n key: PropertyKey,\n value: unknown,\n) {\n Object.defineProperty(\n container,\n key,\n Array.isArray(container) && key === 'length'\n ? { value }\n : { value, enumerable: true, writable: true, configurable: true },\n );\n}\n\nfunction emptyCopy(value: Container): Container {\n return Array.isArray(value)\n ? new Array(value.length)\n : Object.create(Object.getPrototypeOf(value));\n}\n\nfunction copyContainer(value: Container): Container {\n const copy = emptyCopy(value);\n for (const key of enumerableKeys(value))\n defineValue(copy, key, Reflect.get(value, key));\n return copy;\n}\n\n/** The ADR's default dirty comparator: Object.is, then one structural level. */\nexport function formValueEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (!isContainer(a) || !isContainer(b)) return false;\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n if (Array.isArray(a) && Array.isArray(b) && a.length !== b.length)\n return false;\n const keys = enumerableKeys(a);\n return (\n keys.length === enumerableKeys(b).length &&\n keys.every(\n (key) =>\n Object.hasOwn(b, key) &&\n Object.is(Reflect.get(a, key), Reflect.get(b, key)),\n )\n );\n}\n\nexport function normalizePath(path: FormPath): readonly string[] {\n const parts = typeof path === 'string' ? [path] : path;\n if (!parts.length) throw new Error('A form field path must not be empty.');\n return Object.freeze(\n Array.from(parts, (part) => {\n if (\n typeof part !== 'string' &&\n (!Number.isSafeInteger(part) || part < 0)\n ) {\n throw new Error(\n 'A numeric form path segment must be a non-negative safe integer.',\n );\n }\n const key = String(part);\n if (key === '__proto__' || key === 'prototype' || key === 'constructor') {\n throw new Error(`Unsafe form path segment: ${key}`);\n }\n return key;\n }),\n );\n}\n\n/** Escaping keeps literal dotted names distinct from nested tuple paths. */\nexport function getFieldKey(path: FormPath): string {\n return normalizePath(path)\n .map((part) => part.replace(/\\\\/g, '\\\\\\\\').replace(/\\./g, '\\\\.'))\n .join('.');\n}\n\n/** Inverse of getFieldKey, for stable keys produced by this module. */\nexport function getFieldPath(key: string): readonly string[] {\n const path = [''];\n for (let index = 0; index < key.length; index++) {\n const part = key[index];\n if (part === '.') path.push('');\n else path[path.length - 1] += part === '\\\\' ? key[++index] : part;\n }\n return Object.freeze(path);\n}\n\nexport function readPath(root: unknown, path: readonly string[]): unknown {\n let value = root;\n for (const key of path) {\n if (!isContainer(value) || !Object.hasOwn(value, key)) return undefined;\n value = Reflect.get(value, key);\n }\n return value;\n}\n\nexport function hasPath(root: unknown, path: readonly string[]): boolean {\n const parent = readPath(root, path.slice(0, -1));\n return isContainer(parent) && Object.hasOwn(parent, path[path.length - 1]);\n}\n\n/** Missing and explicitly undefined values are distinct form states. */\nexport function pathValueChanged(\n previous: object,\n next: object,\n path: readonly string[],\n): boolean {\n return (\n !Object.is(readPath(previous, path), readPath(next, path)) ||\n hasPath(previous, path) !== hasPath(next, path)\n );\n}\n\n/** Copy just the ancestor chain. Array deletion leaves indices in place. */\nexport function writePath(\n root: object,\n path: readonly string[],\n value: unknown,\n remove = false,\n): object {\n function write(current: unknown, depth: number): unknown {\n const key = path[depth];\n const container = isContainer(current) ? current : undefined;\n const exists = !!container && Object.hasOwn(container, key);\n const previous = exists ? Reflect.get(container!, key) : undefined;\n if (remove && !exists) return current;\n const last = depth === path.length - 1;\n const next = last ? value : write(previous, depth + 1);\n if (!remove && exists && Object.is(previous, next)) return current;\n if (remove && !last && Object.is(previous, next)) return current;\n // Array length cannot be removed, even for preserve:false registrations.\n if (remove && last && Array.isArray(container) && key === 'length')\n return current;\n const copy: Container = container\n ? copyContainer(container)\n : depth > 0 && /^(0|[1-9]\\d*)$/.test(key)\n ? []\n : {};\n if (remove && last) Reflect.deleteProperty(copy, key);\n else defineValue(copy, key, next);\n return freezeContainer(copy);\n }\n return write(root, 0) as object;\n}\n\n/**\n * Own plain data without freezing caller-owned objects. Non-plain values (dates,\n * files, ReactNode errors, etc.) are opaque and must be treated as immutable.\n * Reusing an input reference means reusing its value, just like React state.\n */\nexport function createValueSnapshotter() {\n const copies = new WeakMap<object, unknown>();\n function snapshot<T>(value: T): T {\n // Commit the ownership cache only after the entire graph copied. A throwing\n // getter must not leave an incomplete, mutable snapshot cached for a retry.\n const pending = new WeakMap<object, object>();\n const entries: [object, object][] = [];\n function clone(input: unknown): unknown {\n if (!isContainer(input) || ownedContainers.has(input)) return input;\n if (copies.has(input)) return copies.get(input);\n if (pending.has(input)) return pending.get(input);\n const copy = emptyCopy(input);\n pending.set(input, copy);\n entries.push([input, copy]);\n for (const key of enumerableKeys(input)) {\n defineValue(copy, key, clone(Reflect.get(input, key)));\n }\n return copy;\n }\n const result = clone(value);\n for (const [input, copy] of entries) {\n freezeContainer(copy);\n copies.set(input, copy);\n }\n return result as T;\n }\n return snapshot;\n}\n\n/** Object.freeze(new Set()) still permits add/delete. Hide the writable set. */\nexport function readonlySet<T>(values: Iterable<T>): ReadonlySet<T> {\n const set = new Set(values);\n const view: ReadonlySet<T> = Object.freeze({\n get size() {\n return set.size;\n },\n has: (value: T) => set.has(value),\n entries: () => set.entries(),\n keys: () => set.keys(),\n values: () => set.values(),\n [Symbol.iterator]: () => set[Symbol.iterator](),\n forEach: (\n callback: (value: T, key: T, set: ReadonlySet<T>) => void,\n thisArg?: unknown,\n ) => {\n set.forEach((value) => callback.call(thisArg, value, value, view));\n },\n });\n return view;\n}\n\nexport function sameMembers<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean {\n return a.size === b.size && Array.from(a).every((value) => b.has(value));\n}\n"],"mappings":";;AAOA,MAAM,kCAAkB,IAAI,SAAiB;AAE7C,SAAgB,gBAAkC,OAAa;AAC7D,iBAAgB,IAAI,MAAM;AAC1B,QAAO,OAAO,OAAO,MAAM;;AAG7B,SAAgB,cACd,OACkC;AAClC,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;CAChD,MAAM,YAAY,OAAO,eAAe,MAAM;AAC9C,QAAO,cAAc,OAAO,aAAa,cAAc;;AAGzD,SAAS,YAAY,OAAoC;AACvD,QAAO,MAAM,QAAQ,MAAM,IAAI,cAAc,MAAM;;AAGrD,SAAS,eAAe,OAAoC;AAC1D,QAAO,QAAQ,QAAQ,MAAM,CAAC,QAAQ,QACpC,OAAO,UAAU,qBAAqB,KAAK,OAAO,IAAI,CACvD;;;AAIH,SAAgB,YACd,WACA,KACA,OACA;AACA,QAAO,eACL,WACA,KACA,MAAM,QAAQ,UAAU,IAAI,QAAQ,WAChC,EAAE,OAAO,GACT;EAAE;EAAO,YAAY;EAAM,UAAU;EAAM,cAAc;EAAM,CACpE;;AAGH,SAAS,UAAU,OAA6B;AAC9C,QAAO,MAAM,QAAQ,MAAM,GACvB,IAAI,MAAM,MAAM,OAAO,GACvB,OAAO,OAAO,OAAO,eAAe,MAAM,CAAC;;AAGjD,SAAS,cAAc,OAA6B;CAClD,MAAM,OAAO,UAAU,MAAM;AAC7B,MAAK,MAAM,OAAO,eAAe,MAAM,CACrC,a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AAa,IAAI,IAAI,MAAM;EACjC,eAAe,IAAI,SAAS;EAC5B,YAAY,IAAI,MAAM;EACtB,cAAc,IAAI,QAAQ;GACzB,OAAO,iBAAiB,IAAI,OAAO,WAAW;EAC/C,UACE,UACA,YACG;AACH,OAAI,SAAS,UAAU,SAAS,KAAK,SAAS,OAAO,OAAO,KAAK,CAAC;;EAErE,CAAC;AACF,QAAO;;AAGT,SAAgB,YAAe,GAAmB,GAA4B;AAC5E,QAAO,EAAE,SAAS,EAAE,QAAQ,MAAM,KAAK,EAAE,CAAC,OAAO,UAAU,EAAE,IAAI,MAAM,CAAC"}
@@ -1,4 +1,5 @@
1
1
 
2
+ import { FormController } from "../modern/controller.js";
2
3
  import { FieldCoreProps, NecessityIndicator, ValidateTrigger, ValidationProps, ValidationState } from "../../../../shared/form.js";
3
4
  import "../../../../shared/index.js";
4
5
  import { CubeFieldData, FieldTypes } from "../types.js";
@@ -10,7 +11,7 @@ interface UseFieldProps<T extends FieldTypes> extends FieldCoreProps, Validation
10
11
  /** The initial value of the input. */
11
12
  defaultValue?: any;
12
13
  /** The form instance */
13
- form?: CubeFormInstance<T>;
14
+ form?: CubeFormInstance<T> | FormController<any>;
14
15
  /**
15
16
  * The validation state of the field
16
17
  * @deprecated Use `isInvalid` / `isValid` instead.
@@ -18,6 +19,8 @@ interface UseFieldProps<T extends FieldTypes> extends FieldCoreProps, Validation
18
19
  validationState?: ValidationState;
19
20
  /** Whether to show valid state */
20
21
  showValid?: boolean;
22
+ /** Explicit loading presentation overrides the modern validation state. */
23
+ isLoading?: boolean;
21
24
  /** On which event perform the validation for the field */
22
25
  validateTrigger?: ValidateTrigger;
23
26
  /**