xmlui 0.7.14 → 0.7.16

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 (393) hide show
  1. package/dist/{apiInterceptorWorker-FBzCR_-x.mjs → apiInterceptorWorker-21XItUaB.mjs} +1 -1
  2. package/dist/{grammar.tmLanguage-D3zpG8BQ.mjs → grammar.tmLanguage-Qpdanc5_.mjs} +6 -6
  3. package/dist/{index-rxu3P0l4.mjs → index-CFCUmuUo.mjs} +10368 -10074
  4. package/dist/index.css +1 -1
  5. package/dist/scripts/bin/build.js +17 -7
  6. package/dist/scripts/bin/vite-ueml-plugin.js +17 -7
  7. package/dist/scripts/bin/viteConfig.js +17 -7
  8. package/dist/scripts/package.json +209 -0
  9. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +51 -0
  10. package/dist/scripts/src/components/APICall/APICall.js +74 -0
  11. package/dist/scripts/src/components/APICall/APICallNative.js +31 -0
  12. package/dist/scripts/src/components/Accordion/Accordion.js +78 -0
  13. package/dist/scripts/src/components/Accordion/AccordionContext.js +20 -0
  14. package/dist/scripts/src/components/Accordion/AccordionItem.js +28 -0
  15. package/dist/scripts/src/components/Accordion/AccordionItemNative.js +79 -0
  16. package/dist/scripts/src/components/Accordion/AccordionNative.js +122 -0
  17. package/dist/scripts/src/components/Alert/Alert.js +42 -0
  18. package/dist/scripts/src/components/Alert/AlertNative.js +8 -0
  19. package/dist/scripts/src/components/Animation/Animation.js +59 -0
  20. package/dist/scripts/src/components/Animation/AnimationNative.js +75 -0
  21. package/dist/scripts/src/components/App/App.js +76 -0
  22. package/dist/scripts/src/components/App/AppLayoutContext.js +49 -0
  23. package/dist/scripts/src/components/App/AppNative.js +204 -0
  24. package/dist/scripts/src/components/App/AppStateContext.js +9 -0
  25. package/dist/scripts/src/components/App/Sheet.js +99 -0
  26. package/dist/scripts/src/components/AppHeader/AppHeader.js +59 -0
  27. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +58 -0
  28. package/dist/scripts/src/components/AppState/AppState.js +26 -0
  29. package/dist/scripts/src/components/AppState/AppStateNative.js +24 -0
  30. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +83 -0
  31. package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +16 -0
  32. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +225 -0
  33. package/dist/scripts/src/components/Avatar/Avatar.js +47 -0
  34. package/dist/scripts/src/components/Avatar/AvatarNative.js +40 -0
  35. package/dist/scripts/src/components/Backdrop/Backdrop.js +31 -0
  36. package/dist/scripts/src/components/Backdrop/BackdropNative.js +14 -0
  37. package/dist/scripts/src/components/Badge/Badge.js +58 -0
  38. package/dist/scripts/src/components/Badge/BadgeNative.js +22 -0
  39. package/dist/scripts/src/components/BarChart/BarChart.js +49 -0
  40. package/dist/scripts/src/components/BarChart/BarChartNative.js +176 -0
  41. package/dist/scripts/src/components/Bookmark/Bookmark.js +23 -0
  42. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +24 -0
  43. package/dist/scripts/src/components/Breakout/Breakout.js +16 -0
  44. package/dist/scripts/src/components/Breakout/BreakoutNative.js +12 -0
  45. package/dist/scripts/src/components/Button/Button.js +142 -0
  46. package/dist/scripts/src/components/Button/ButtonNative.js +88 -0
  47. package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +41 -0
  48. package/dist/scripts/src/components/ButtonGroup/ButtonGroupNative.js +8 -0
  49. package/dist/scripts/src/components/Card/Card.js +57 -0
  50. package/dist/scripts/src/components/Card/CardNative.js +26 -0
  51. package/dist/scripts/src/components/Carousel/Carousel.js +68 -0
  52. package/dist/scripts/src/components/Carousel/CarouselItem.js +16 -0
  53. package/dist/scripts/src/components/Carousel/CarouselItemNative.js +13 -0
  54. package/dist/scripts/src/components/Carousel/CarouselNative.js +163 -0
  55. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +24 -0
  56. package/dist/scripts/src/components/ChangeListener/ChangeListenerNative.js +26 -0
  57. package/dist/scripts/src/components/Chart/Chart.js +24 -0
  58. package/dist/scripts/src/components/Chart/ChartNative.js +165 -0
  59. package/dist/scripts/src/components/Checkbox/Checkbox.js +68 -0
  60. package/dist/scripts/src/components/Column/Column.js +34 -0
  61. package/dist/scripts/src/components/Column/ColumnNative.js +38 -0
  62. package/dist/scripts/src/components/Column/TableContext.js +12 -0
  63. package/dist/scripts/src/components/ComponentProvider.js +503 -0
  64. package/dist/scripts/src/components/ComponentRegistryContext.js +44 -0
  65. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +38 -0
  66. package/dist/scripts/src/components/ContentSeparator/ContentSeparatorNative.js +16 -0
  67. package/dist/scripts/src/components/DatePicker/DatePicker.js +62 -0
  68. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +196 -0
  69. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +125 -0
  70. package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +95 -0
  71. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +26 -0
  72. package/dist/scripts/src/components/EmojiSelector/EmojiSelectorNative.js +52 -0
  73. package/dist/scripts/src/components/FileInput/FileInput.js +64 -0
  74. package/dist/scripts/src/components/FileInput/FileInputNative.js +128 -0
  75. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +46 -0
  76. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +112 -0
  77. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +53 -0
  78. package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +108 -0
  79. package/dist/scripts/src/components/Footer/Footer.js +35 -0
  80. package/dist/scripts/src/components/Footer/FooterNative.js +20 -0
  81. package/dist/scripts/src/components/Form/Form.js +89 -0
  82. package/dist/scripts/src/components/Form/FormContext.js +9 -0
  83. package/dist/scripts/src/components/Form/FormNative.js +317 -0
  84. package/dist/scripts/src/components/Form/formActions.js +114 -0
  85. package/dist/scripts/src/components/FormItem/FormItem.js +125 -0
  86. package/dist/scripts/src/components/FormItem/FormItemNative.js +157 -0
  87. package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
  88. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +40 -0
  89. package/dist/scripts/src/components/FormItem/Validations.js +351 -0
  90. package/dist/scripts/src/components/FormSection/FormSection.js +41 -0
  91. package/dist/scripts/src/components/Heading/Heading.js +258 -0
  92. package/dist/scripts/src/components/Heading/HeadingNative.js +47 -0
  93. package/dist/scripts/src/components/HoverCard/HoverCard.js +19 -0
  94. package/dist/scripts/src/components/HoverCard/HovercardNative.js +44 -0
  95. package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
  96. package/dist/scripts/src/components/Icon/Attach.js +10 -0
  97. package/dist/scripts/src/components/Icon/Binding.js +11 -0
  98. package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
  99. package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
  100. package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
  101. package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
  102. package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
  103. package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
  104. package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
  105. package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
  106. package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
  107. package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
  108. package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
  109. package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
  110. package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
  111. package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
  112. package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
  113. package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
  114. package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
  115. package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
  116. package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
  117. package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
  118. package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
  119. package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
  120. package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
  121. package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
  122. package/dist/scripts/src/components/Icon/Icon.js +32 -0
  123. package/dist/scripts/src/components/Icon/IconNative.js +102 -0
  124. package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
  125. package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
  126. package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
  127. package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
  128. package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
  129. package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
  130. package/dist/scripts/src/components/Icon/NoSortIcon.js +8 -0
  131. package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
  132. package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
  133. package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
  134. package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
  135. package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
  136. package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
  137. package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
  138. package/dist/scripts/src/components/Icon/SortAscendingIcon.js +8 -0
  139. package/dist/scripts/src/components/Icon/SortDescendingIcon.js +8 -0
  140. package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
  141. package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
  142. package/dist/scripts/src/components/Icon/TrendingDownIcon.js +10 -0
  143. package/dist/scripts/src/components/Icon/TrendingLevelIcon.js +10 -0
  144. package/dist/scripts/src/components/Icon/TrendingUpIcon.js +10 -0
  145. package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
  146. package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
  147. package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
  148. package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
  149. package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
  150. package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
  151. package/dist/scripts/src/components/IconInfoCard/IconInfoCard.js +39 -0
  152. package/dist/scripts/src/components/IconProvider.js +264 -0
  153. package/dist/scripts/src/components/IconRegistryContext.js +317 -0
  154. package/dist/scripts/src/components/Image/Image.js +35 -0
  155. package/dist/scripts/src/components/Image/ImageNative.js +15 -0
  156. package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
  157. package/dist/scripts/src/components/Items/Items.js +33 -0
  158. package/dist/scripts/src/components/Items/ItemsNative.js +29 -0
  159. package/dist/scripts/src/components/Link/Link.js +64 -0
  160. package/dist/scripts/src/components/Link/LinkNative.js +26 -0
  161. package/dist/scripts/src/components/List/List.js +81 -0
  162. package/dist/scripts/src/components/List/ListNative.js +425 -0
  163. package/dist/scripts/src/components/Logo/Logo.js +16 -0
  164. package/dist/scripts/src/components/Logo/LogoNative.js +15 -0
  165. package/dist/scripts/src/components/Map/Map.js +75 -0
  166. package/dist/scripts/src/components/Map/world_countries.json +45307 -0
  167. package/dist/scripts/src/components/Markdown/Markdown.js +45 -0
  168. package/dist/scripts/src/components/Markdown/MarkdownNative.js +107 -0
  169. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
  170. package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
  171. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +64 -0
  172. package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +167 -0
  173. package/dist/scripts/src/components/ModalDialog/ModalVisibilityContext.js +60 -0
  174. package/dist/scripts/src/components/NavGroup/NavGroup.js +34 -0
  175. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +91 -0
  176. package/dist/scripts/src/components/NavLink/NavLink.js +71 -0
  177. package/dist/scripts/src/components/NavLink/NavLinkNative.js +61 -0
  178. package/dist/scripts/src/components/NavPanel/NavPanel.js +31 -0
  179. package/dist/scripts/src/components/NavPanel/NavPanelNative.js +74 -0
  180. package/dist/scripts/src/components/NoResult/NoResult.js +38 -0
  181. package/dist/scripts/src/components/NoResult/NoResultNative.js +13 -0
  182. package/dist/scripts/src/components/NumberBox/NumberBox.js +61 -0
  183. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +336 -0
  184. package/dist/scripts/src/components/NumberBox/numberbox-abstractions.js +74 -0
  185. package/dist/scripts/src/components/OffCanvas/OffCanvas.js +57 -0
  186. package/dist/scripts/src/components/OffCanvas/OffCanvasNative.js +48 -0
  187. package/dist/scripts/src/components/Option/Option.js +33 -0
  188. package/dist/scripts/src/components/Option/OptionTypeProvider.js +16 -0
  189. package/dist/scripts/src/components/PageHeader/PageHeader.js +36 -0
  190. package/dist/scripts/src/components/PageMetaTitle/PageMetaTilteNative.js +9 -0
  191. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +18 -0
  192. package/dist/scripts/src/components/Pages/Pages.js +33 -0
  193. package/dist/scripts/src/components/Pages/PagesNative.js +69 -0
  194. package/dist/scripts/src/components/PieChart/PieChart.js +45 -0
  195. package/dist/scripts/src/components/PieChart/PieChartNative.js +165 -0
  196. package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +24 -0
  197. package/dist/scripts/src/components/PositionedContainer/PositionedContainerNative.js +14 -0
  198. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +36 -0
  199. package/dist/scripts/src/components/ProgressBar/ProgressBarNative.js +12 -0
  200. package/dist/scripts/src/components/Queue/Queue.js +71 -0
  201. package/dist/scripts/src/components/Queue/QueueNative.js +278 -0
  202. package/dist/scripts/src/components/Queue/queueActions.js +87 -0
  203. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +68 -0
  204. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +103 -0
  205. package/dist/scripts/src/components/Range/Range.js +56 -0
  206. package/dist/scripts/src/components/Range/RangeNative.js +8 -0
  207. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +21 -0
  208. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +131 -0
  209. package/dist/scripts/src/components/Redirect/Redirect.js +20 -0
  210. package/dist/scripts/src/components/Select/OptionContext.js +12 -0
  211. package/dist/scripts/src/components/Select/Select.js +98 -0
  212. package/dist/scripts/src/components/Select/SelectContext.js +9 -0
  213. package/dist/scripts/src/components/Select/SelectNative.js +213 -0
  214. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +22 -0
  215. package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +94 -0
  216. package/dist/scripts/src/components/Slider/Slider.js +54 -0
  217. package/dist/scripts/src/components/Slider/SliderNative.js +8 -0
  218. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +19 -0
  219. package/dist/scripts/src/components/SpaceFiller/SpaceFillerNative.js +10 -0
  220. package/dist/scripts/src/components/Spinner/Spinner.js +42 -0
  221. package/dist/scripts/src/components/Spinner/SpinnerNative.js +32 -0
  222. package/dist/scripts/src/components/Splitter/Splitter.js +89 -0
  223. package/dist/scripts/src/components/Splitter/SplitterNative.js +159 -0
  224. package/dist/scripts/src/components/Splitter/utils.js +17 -0
  225. package/dist/scripts/src/components/Stack/Stack.js +110 -0
  226. package/dist/scripts/src/components/Stack/StackNative.js +39 -0
  227. package/dist/scripts/src/components/StateViewer/StateViewerNative.js +19 -0
  228. package/dist/scripts/src/components/StickyBox/StickyBox.js +30 -0
  229. package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +15 -0
  230. package/dist/scripts/src/components/Switch/Switch.js +72 -0
  231. package/dist/scripts/src/components/Table/Table.js +184 -0
  232. package/dist/scripts/src/components/Table/TableNative.js +470 -0
  233. package/dist/scripts/src/components/Table/useRowSelection.js +245 -0
  234. package/dist/scripts/src/components/TableHeader/TableHeader.js +34 -0
  235. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +74 -0
  236. package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +56 -0
  237. package/dist/scripts/src/components/Tabs/TabContext.js +45 -0
  238. package/dist/scripts/src/components/Tabs/TabItem.js +20 -0
  239. package/dist/scripts/src/components/Tabs/TabItemNative.js +24 -0
  240. package/dist/scripts/src/components/Tabs/Tabs.js +55 -0
  241. package/dist/scripts/src/components/Tabs/TabsNative.js +72 -0
  242. package/dist/scripts/src/components/Text/Text.js +122 -0
  243. package/dist/scripts/src/components/Text/TextNative.js +124 -0
  244. package/dist/scripts/src/components/TextArea/TextArea.js +65 -0
  245. package/dist/scripts/src/components/TextArea/TextAreaNative.js +176 -0
  246. package/dist/scripts/src/components/TextArea/TextAreaResizable.js +73 -0
  247. package/dist/scripts/src/components/TextArea/useComposedRef.js +60 -0
  248. package/dist/scripts/src/components/TextBox/TextBox.js +85 -0
  249. package/dist/scripts/src/components/TextBox/TextBoxNative.js +109 -0
  250. package/dist/scripts/src/components/Theme/NotificationToast.js +50 -0
  251. package/dist/scripts/src/components/Theme/Theme.js +43 -0
  252. package/dist/scripts/src/components/Theme/ThemeNative.js +126 -0
  253. package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +115 -0
  254. package/dist/scripts/src/components/ThemeChanger/ToneChangerButton.js +28 -0
  255. package/dist/scripts/src/components/Toggle/Toggle.js +98 -0
  256. package/dist/scripts/src/components/Toolbar/Toolbar.js +32 -0
  257. package/dist/scripts/src/components/ToolbarButton/ToolbarButton.js +38 -0
  258. package/dist/scripts/src/components/Tree/TreeComponent.js +32 -0
  259. package/dist/scripts/src/components/Tree/TreeNative.js +69 -0
  260. package/dist/scripts/src/components/TrendLabel/TrendLabel.js +37 -0
  261. package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
  262. package/dist/scripts/src/components/abstractions.js +151 -0
  263. package/dist/scripts/src/components/chart-color-schemes.js +43 -0
  264. package/dist/scripts/src/components/component-utils.js +17 -0
  265. package/dist/scripts/src/components/container-helpers.js +25 -0
  266. package/dist/scripts/src/components/metadata-helpers.js +245 -0
  267. package/dist/scripts/src/components/slot-helpers.js +22 -0
  268. package/dist/scripts/src/components-core/ApiBoundComponent.js +194 -0
  269. package/dist/scripts/src/components-core/AppContext.js +16 -0
  270. package/dist/scripts/src/components-core/AppRoot.js +424 -0
  271. package/dist/scripts/src/components-core/ComponentBed.js +325 -0
  272. package/dist/scripts/src/components-core/ComponentDecorator.js +90 -0
  273. package/dist/scripts/src/components-core/CompoundComponent.js +144 -0
  274. package/dist/scripts/src/components-core/DebugViewProvider.js +43 -0
  275. package/dist/scripts/src/components-core/EngineError.js +91 -0
  276. package/dist/scripts/src/components-core/ErrorBoundary.js +59 -0
  277. package/dist/scripts/src/components-core/Fragment.js +15 -0
  278. package/dist/scripts/src/components-core/InspectorContext.js +176 -0
  279. package/dist/scripts/src/components-core/InvalidComponent.js +17 -0
  280. package/dist/scripts/src/components-core/LoaderComponent.js +92 -0
  281. package/dist/scripts/src/components-core/RestApiProxy.js +354 -0
  282. package/dist/scripts/src/components-core/ScrollContext.js +11 -0
  283. package/dist/scripts/src/components-core/Slot.js +17 -0
  284. package/dist/scripts/src/components-core/StandaloneApp.js +589 -0
  285. package/dist/scripts/src/components-core/StandaloneComponentManager.js +51 -0
  286. package/dist/scripts/src/components-core/TableOfContentsContext.js +110 -0
  287. package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
  288. package/dist/scripts/src/components-core/XmluiCodeHighlighter.js +110 -0
  289. package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
  290. package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
  291. package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
  292. package/dist/scripts/src/components-core/abstractions/standalone.js +2 -0
  293. package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
  294. package/dist/scripts/src/components-core/action/APICall.js +283 -0
  295. package/dist/scripts/src/components-core/action/FileDownloadAction.js +80 -0
  296. package/dist/scripts/src/components-core/action/FileUploadAction.js +88 -0
  297. package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
  298. package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
  299. package/dist/scripts/src/components-core/action/actions.js +15 -0
  300. package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
  301. package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
  302. package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
  303. package/dist/scripts/src/components-core/component-hooks.js +25 -0
  304. package/dist/scripts/src/components-core/constants.js +18 -0
  305. package/dist/scripts/src/components-core/container/Container.js +1241 -0
  306. package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
  307. package/dist/scripts/src/components-core/container/collectFnVarDeps.js +49 -0
  308. package/dist/scripts/src/components-core/container/valueExtractor.js +205 -0
  309. package/dist/scripts/src/components-core/descriptorHelper.js +72 -0
  310. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +198 -0
  311. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
  312. package/dist/scripts/src/components-core/interception/Backend.js +129 -0
  313. package/dist/scripts/src/components-core/interception/Errors.js +129 -0
  314. package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
  315. package/dist/scripts/src/components-core/interception/IndexedDb.js +205 -0
  316. package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
  317. package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
  318. package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
  319. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
  320. package/dist/scripts/src/components-core/loader/ApiLoader.js +54 -0
  321. package/dist/scripts/src/components-core/loader/DataLoader.js +149 -0
  322. package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +62 -0
  323. package/dist/scripts/src/components-core/loader/Loader.js +126 -0
  324. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +40 -0
  325. package/dist/scripts/src/components-core/loader/PageableLoader.js +262 -0
  326. package/dist/scripts/src/components-core/markup-check.js +279 -0
  327. package/dist/scripts/src/components-core/renderers.js +45 -0
  328. package/dist/scripts/src/components-core/reportEngineError.js +62 -0
  329. package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
  330. package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
  331. package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
  332. package/dist/scripts/src/components-core/script-runner/asyncProxy.js +149 -0
  333. package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
  334. package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
  335. package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
  336. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +593 -0
  337. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +497 -0
  338. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +482 -0
  339. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +766 -0
  340. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
  341. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +752 -0
  342. package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
  343. package/dist/scripts/src/components-core/script-runner/syncProxy.js +31 -0
  344. package/dist/scripts/src/components-core/script-runner/visitors.js +361 -0
  345. package/dist/scripts/src/components-core/theming/ThemeContext.js +53 -0
  346. package/dist/scripts/src/components-core/theming/ThemeProvider.js +335 -0
  347. package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
  348. package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
  349. package/dist/scripts/src/components-core/theming/hvar.js +105 -0
  350. package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
  351. package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
  352. package/dist/scripts/src/components-core/theming/themes/palette.js +55 -0
  353. package/dist/scripts/src/components-core/theming/themes/root.js +287 -0
  354. package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
  355. package/dist/scripts/src/components-core/theming/themes/theme-colors.js +561 -0
  356. package/dist/scripts/src/components-core/theming/themes/xmlui.js +58 -0
  357. package/dist/scripts/src/components-core/theming/transformThemeVars.js +300 -0
  358. package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +35 -0
  359. package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
  360. package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
  361. package/dist/scripts/src/components-core/utils/classnames.js +58 -0
  362. package/dist/scripts/src/components-core/utils/compound-utils.js +11 -0
  363. package/dist/scripts/src/components-core/utils/css-utils.js +163 -0
  364. package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
  365. package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
  366. package/dist/scripts/src/components-core/utils/hooks.js +249 -0
  367. package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
  368. package/dist/scripts/src/components-core/utils/misc.js +472 -0
  369. package/dist/scripts/src/components-core/utils/request-params.js +70 -0
  370. package/dist/scripts/src/components-core/utils/statementUtils.js +221 -0
  371. package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
  372. package/dist/scripts/src/index.js +69 -0
  373. package/dist/scripts/src/parsers/common/GenericToken.js +2 -0
  374. package/dist/scripts/src/parsers/scripting-exp/TokenType.js +112 -0
  375. package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
  376. package/dist/scripts/src/parsers/style-parser/StyleLexer.js +623 -0
  377. package/dist/scripts/src/parsers/style-parser/StyleParser.js +1036 -0
  378. package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
  379. package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
  380. package/dist/scripts/src/parsers/style-parser/style-compiler.js +558 -0
  381. package/dist/scripts/src/parsers/style-parser/tokens.js +43 -0
  382. package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +7 -0
  383. package/dist/scripts/src/parsers/xmlui-parser/transform.js +80 -32
  384. package/dist/scripts/src/syntax/grammar.tmLanguage.json +348 -0
  385. package/dist/scripts/src/syntax/textMate/xmlui.json +630 -0
  386. package/dist/style.css +1 -1
  387. package/dist/xmlui-metadata.mjs +2636 -2563
  388. package/dist/xmlui-metadata.umd.js +16 -16
  389. package/dist/xmlui-standalone.umd.js +186 -186
  390. package/dist/xmlui.d.ts +1868 -13
  391. package/dist/xmlui.mjs +1 -1
  392. package/package.json +5 -5
  393. package/dist/xmlui.umd.js +0 -293
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.FormItem = void 0;
15
+ exports.CustomFormItem = CustomFormItem;
16
+ const jsx_runtime_1 = require("react/jsx-runtime");
17
+ const react_1 = require("react");
18
+ const FormContext_1 = require("@components/Form/FormContext");
19
+ const TextBoxNative_1 = require("@components/TextBox/TextBoxNative");
20
+ const Toggle_1 = require("@components/Toggle/Toggle");
21
+ const FileInputNative_1 = require("@components/FileInput/FileInputNative");
22
+ const NumberBoxNative_1 = require("@components/NumberBox/NumberBoxNative");
23
+ const SelectNative_1 = require("@components/Select/SelectNative");
24
+ const RadioGroupNative_1 = require("@components/RadioGroup/RadioGroupNative");
25
+ const HelperText_1 = require("@components/FormItem/HelperText");
26
+ const react_2 = require("@formkit/auto-animate/react");
27
+ const Validations_1 = require("./Validations");
28
+ const formActions_1 = require("@components/Form/formActions");
29
+ const TextAreaNative_1 = require("@components/TextArea/TextAreaNative");
30
+ const misc_1 = require("@components-core/utils/misc");
31
+ const ItemWithLabel_1 = require("./ItemWithLabel");
32
+ const DatePickerNative_1 = require("@components/DatePicker/DatePickerNative");
33
+ const FormNative_1 = require("@components/Form/FormNative");
34
+ const valueExtractor_1 = require("@components-core/container/valueExtractor");
35
+ const AutoCompleteNative_1 = require("@components/AutoComplete/AutoCompleteNative");
36
+ const DEFAULT_LABEL_POSITIONS = {
37
+ checkbox: "end",
38
+ };
39
+ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
40
+ var { style, bindTo, type = "text", label, enabled = true, labelPosition, labelWidth, labelBreak = true, children, validations, onValidate, customValidationsDebounce, validationMode, registerComponentApi, maxTextLength } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength"]);
41
+ const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || value.itemLabelWidth);
42
+ const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value.itemLabelBreak);
43
+ const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || value.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type]);
44
+ const initialValueFromSubject = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.originalSubject, bindTo));
45
+ const initialValue = initialValueFromSubject === undefined ? rest.initialValue : initialValueFromSubject;
46
+ const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, bindTo));
47
+ const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[bindTo]);
48
+ const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
49
+ const formEnabled = (0, FormContext_1.useFormContextPart)((value) => value.enabled);
50
+ const isEnabled = enabled && formEnabled;
51
+ (0, react_1.useEffect)(() => {
52
+ dispatch((0, formActions_1.fieldInitialized)(bindTo, initialValue));
53
+ }, [bindTo, dispatch, initialValue]);
54
+ (0, Validations_1.useValidation)(validations, onValidate, value, dispatch, bindTo, customValidationsDebounce);
55
+ const onStateChange = (0, react_1.useCallback)(({ value }, options) => {
56
+ //we already handled the initial value in the useEffect with fieldInitialized(...);
57
+ if (!(options === null || options === void 0 ? void 0 : options.initial)) {
58
+ dispatch((0, formActions_1.fieldChanged)(bindTo, value));
59
+ }
60
+ }, [bindTo, dispatch]);
61
+ (0, react_1.useEffect)(() => {
62
+ return () => {
63
+ dispatch((0, formActions_1.fieldRemoved)(bindTo));
64
+ };
65
+ }, [bindTo, dispatch]);
66
+ const { validationStatus, isHelperTextShown } = (0, Validations_1.useValidationDisplay)(bindTo, value, validationResult, validationMode);
67
+ let formControl = null;
68
+ switch (type) {
69
+ case "select": {
70
+ formControl = ((0, jsx_runtime_1.jsx)(SelectNative_1.Select, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, children: children })));
71
+ break;
72
+ }
73
+ case "autocomplete": {
74
+ formControl = ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, children: children })));
75
+ break;
76
+ }
77
+ case "datePicker": {
78
+ formControl = ((0, jsx_runtime_1.jsx)(DatePickerNative_1.DatePicker, Object.assign({}, rest, { value: value, updateState: onStateChange,
79
+ // registerComponentApi={registerComponentApi}
80
+ enabled: isEnabled, validationStatus: validationStatus })));
81
+ break;
82
+ }
83
+ case "radioGroup": {
84
+ formControl = ((0, jsx_runtime_1.jsx)(RadioGroupNative_1.RadioGroup, Object.assign({}, rest, { value: value, updateState: onStateChange,
85
+ // registerComponentApi={registerComponentApi}
86
+ enabled: isEnabled, validationStatus: validationStatus, children: children })));
87
+ break;
88
+ }
89
+ case "number":
90
+ case "integer": {
91
+ formControl = ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, integersOnly: type === "integer", validationStatus: validationStatus, min: validations.minValue, max: validations.maxValue, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength })));
92
+ break;
93
+ }
94
+ case "switch":
95
+ case "checkbox": {
96
+ formControl = ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, Object.assign({}, rest, { value: value, updateState: onStateChange,
97
+ // registerComponentApi={registerComponentApi}
98
+ enabled: isEnabled, validationStatus: validationStatus, variant: type })));
99
+ break;
100
+ }
101
+ case "file": {
102
+ formControl = ((0, jsx_runtime_1.jsx)(FileInputNative_1.FileInput, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, multiple: (0, valueExtractor_1.asOptionalBoolean)(rest.multiple, false) })));
103
+ break;
104
+ }
105
+ case "text": {
106
+ formControl = ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength })));
107
+ break;
108
+ }
109
+ case "password": {
110
+ formControl = ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, Object.assign({}, rest, { type: "password", value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength })));
111
+ break;
112
+ }
113
+ case "textarea": {
114
+ formControl = ((0, jsx_runtime_1.jsx)(TextAreaNative_1.TextArea, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength })));
115
+ break;
116
+ }
117
+ case "custom": {
118
+ formControl = children;
119
+ break;
120
+ }
121
+ default: {
122
+ console.warn(`unknown form item type ${type}`);
123
+ formControl = (0, jsx_runtime_1.jsx)("div", { children: value });
124
+ break;
125
+ }
126
+ }
127
+ const onFocus = (0, misc_1.useEvent)(() => {
128
+ dispatch((0, formActions_1.fieldFocused)(bindTo));
129
+ });
130
+ const onBlur = (0, misc_1.useEvent)(() => {
131
+ dispatch((0, formActions_1.fieldLostFocus)(bindTo));
132
+ });
133
+ const [animateContainerRef] = (0, react_2.useAutoAnimate)({ duration: 100 });
134
+ return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { labelPosition: labelPositionValue, label: label, labelWidth: labelWidthValue, labelBreak: labelBreakValue, enabled: isEnabled, required: validations.required, validationInProgress: validationResult === null || validationResult === void 0 ? void 0 : validationResult.partial, onFocus: onFocus, onBlur: onBlur, style: style, validationResult: (0, jsx_runtime_1.jsx)("div", { ref: animateContainerRef, children: isHelperTextShown &&
135
+ (validationResult === null || validationResult === void 0 ? void 0 : validationResult.validations.map((singleValidation, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [singleValidation.isValid && !!singleValidation.validMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.validMessage, status: "valid", style: { opacity: singleValidation.stale ? 0.5 : undefined } })), !singleValidation.isValid && !!singleValidation.invalidMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.invalidMessage, status: singleValidation.severity, style: { opacity: singleValidation.stale ? 0.5 : undefined } }))] }, i)))) }), children: formControl }));
136
+ });
137
+ function CustomFormItem({ renderChild, node, bindTo, }) {
138
+ const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, bindTo));
139
+ const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[bindTo]);
140
+ const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
141
+ const decoratedMetadata = (0, react_1.useMemo)(() => {
142
+ return {
143
+ type: "Container",
144
+ uid: "formFieldContainer - " + bindTo,
145
+ vars: node.vars,
146
+ contextVars: {
147
+ $value: value,
148
+ $setValue: (newValue) => {
149
+ dispatch((0, formActions_1.fieldChanged)(bindTo, newValue));
150
+ },
151
+ $validationResult: validationResult,
152
+ },
153
+ children: node.children,
154
+ };
155
+ }, [bindTo, dispatch, node.children, node.vars, validationResult, value]);
156
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: renderChild(decoratedMetadata) });
157
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HelperText = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
9
+ const HelperText_module_scss_1 = __importDefault(require("./HelperText.module.scss"));
10
+ const WarningIcon_1 = require("@components/Icon/WarningIcon");
11
+ const ErrorIcon_1 = require("@components/Icon/ErrorIcon");
12
+ const HelperText = ({ text = "", status, style }) => {
13
+ const renderStatusIcon = () => {
14
+ if (status === "warning") {
15
+ return (0, jsx_runtime_1.jsx)(WarningIcon_1.WarningIcon, { color: "var(--xmlui-color-warning)" });
16
+ }
17
+ else if (status === "error") {
18
+ return (0, jsx_runtime_1.jsx)(ErrorIcon_1.ErrorIcon, { color: "var(--xmlui-color-error)" });
19
+ }
20
+ };
21
+ return ((0, jsx_runtime_1.jsxs)("div", { style: style, className: (0, classnames_1.default)(HelperText_module_scss_1.default.helper, {
22
+ [HelperText_module_scss_1.default.valid]: status === "valid",
23
+ [HelperText_module_scss_1.default.warning]: status === "warning",
24
+ [HelperText_module_scss_1.default.error]: status === "error",
25
+ }), children: [status && (0, jsx_runtime_1.jsx)("div", { style: { flexShrink: 0 }, children: renderStatusIcon() }), text && (0, jsx_runtime_1.jsx)("div", { className: HelperText_module_scss_1.default.helperText, children: text })] }));
26
+ };
27
+ exports.HelperText = HelperText;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ItemWithLabel = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const react_2 = require("react");
10
+ const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
11
+ const FormItem_module_scss_1 = __importDefault(require("./FormItem.module.scss"));
12
+ const SpinnerNative_1 = require("@components/Spinner/SpinnerNative");
13
+ const react_slot_1 = require("@radix-ui/react-slot");
14
+ const numberRegex = /^[0-9]+$/;
15
+ exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel({ id, labelPosition = "top", style, label, labelBreak = true, labelWidth, enabled = true, required = false, children, validationInProgress = false, shrinkToLabel = false, onFocus, onBlur, labelStyle, validationResult, }, ref) {
16
+ const generatedId = (0, react_2.useId)();
17
+ const inputId = id || generatedId;
18
+ if (label === undefined) {
19
+ return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { style: style, id: inputId, onFocus: onFocus, onBlur: onBlur, ref: ref, children: children }));
20
+ // return cloneElement(children as ReactElement, {
21
+ // ...mergeProps((children as ReactElement).props, {
22
+ // style,
23
+ // id: inputId,
24
+ // onFocus: onFocus,
25
+ // onBlur: onBlur
26
+ // }),
27
+ // });
28
+ }
29
+ return ((0, jsx_runtime_1.jsxs)("div", { style: style, ref: ref, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(FormItem_module_scss_1.default.container, {
30
+ [FormItem_module_scss_1.default.top]: labelPosition === "top",
31
+ [FormItem_module_scss_1.default.bottom]: labelPosition === "bottom",
32
+ [FormItem_module_scss_1.default.start]: labelPosition === "start",
33
+ [FormItem_module_scss_1.default.end]: labelPosition === "end",
34
+ [FormItem_module_scss_1.default.shrinkToLabel]: shrinkToLabel,
35
+ }), onFocus: onFocus, onBlur: onBlur, children: [label && ((0, jsx_runtime_1.jsxs)("label", { htmlFor: inputId, onClick: () => document.getElementById(inputId).focus(), style: Object.assign(Object.assign({}, labelStyle), { width: labelWidth && numberRegex.test(labelWidth) ? `${labelWidth}px` : labelWidth, flexShrink: labelWidth !== undefined ? 0 : undefined }), className: (0, classnames_1.default)(FormItem_module_scss_1.default.inputLabel, {
36
+ [FormItem_module_scss_1.default.required]: required,
37
+ [FormItem_module_scss_1.default.disabled]: !enabled,
38
+ [FormItem_module_scss_1.default.labelBreak]: labelBreak,
39
+ }), children: [label, " ", required && (0, jsx_runtime_1.jsx)("span", { className: FormItem_module_scss_1.default.requiredMark, children: "*" }), validationInProgress && ((0, jsx_runtime_1.jsx)(SpinnerNative_1.Spinner, { style: { height: "1em", width: "1em", marginLeft: "1em", alignSelf: "center" } }))] })), react_2.Children.only((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { id: inputId, children: children }))] }), validationResult] }));
40
+ });
@@ -0,0 +1,351 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useValidation = useValidation;
13
+ exports.useValidationDisplay = useValidationDisplay;
14
+ exports.parseSeverity = parseSeverity;
15
+ exports.groupInvalidValidationResultsBySeverity = groupInvalidValidationResultsBySeverity;
16
+ const lodash_es_1 = require("lodash-es");
17
+ const FormContext_1 = require("@components/Form/FormContext");
18
+ const react_1 = require("react");
19
+ const misc_1 = require("@components-core/utils/misc");
20
+ const constants_1 = require("@components-core/constants");
21
+ const formActions_1 = require("@components/Form/formActions");
22
+ function isInputEmpty(value) {
23
+ if (value === undefined || value === null || value === "")
24
+ return true;
25
+ if (typeof value === "string")
26
+ return value.trim().length === 0;
27
+ return (0, lodash_es_1.isEmpty)(value);
28
+ }
29
+ function isMinLengthValid(value = "", boundary) {
30
+ if (typeof value === "string") {
31
+ return value.length >= boundary;
32
+ }
33
+ console.warn("minLength can only be used on strings");
34
+ return true;
35
+ }
36
+ function isMaxLengthValid(value = "", boundary) {
37
+ if (typeof value === "string") {
38
+ return value.length <= boundary;
39
+ }
40
+ console.warn("maxLength can only be used on strings");
41
+ return true;
42
+ }
43
+ function isMinValueValid(value = "", minValue) {
44
+ if (typeof value !== "string" && !(0, lodash_es_1.isNumber)(value)) {
45
+ console.warn("Range can only be used on strings and numbers");
46
+ }
47
+ return Number(value) >= minValue;
48
+ }
49
+ function isMaxValueValid(value = "", maxValue) {
50
+ if (typeof value !== "string" && !(0, lodash_es_1.isNumber)(value)) {
51
+ console.warn("Range can only be used on strings and numbers");
52
+ }
53
+ return Number(value) <= maxValue;
54
+ }
55
+ function isRegexValid(value = "", regex) {
56
+ if (typeof value === "string") {
57
+ const _value = stringToRegex(regex).test(value);
58
+ return _value;
59
+ }
60
+ console.warn("Regex can only be used on strings");
61
+ return true;
62
+ // Source: https://stackoverflow.com/questions/17250815/how-to-check-if-the-input-string-is-a-valid-regular-expression
63
+ function stringToRegex(s) {
64
+ const m = s.match(/^([/~@;%#'])(.*?)\1([gimsuy]*)$/);
65
+ return m ? new RegExp(m[2], m[3]) : new RegExp(s);
66
+ }
67
+ }
68
+ class FormItemValidator {
69
+ constructor(validations, onValidate, value) {
70
+ this.validations = validations;
71
+ this.onValidate = onValidate;
72
+ this.value = value;
73
+ this.preValidate = () => {
74
+ const requiredResult = this.validateRequired();
75
+ let validationResults = [requiredResult];
76
+ if (!requiredResult || requiredResult.isValid) {
77
+ validationResults.push(this.validateLength(), this.validateRange(), this.validatePattern(), this.validateRegex());
78
+ }
79
+ validationResults = validationResults.filter(result => result !== undefined);
80
+ return {
81
+ isValid: validationResults.find(result => !result.isValid) === undefined,
82
+ validatedValue: this.value,
83
+ partial: this.onValidate !== undefined,
84
+ validations: validationResults
85
+ };
86
+ };
87
+ this.validate = () => __awaiter(this, void 0, void 0, function* () {
88
+ const preValidateResult = this.preValidate();
89
+ const constValidationResult = (yield this.validateCustom()) || [];
90
+ preValidateResult.validations.push(...constValidationResult.map(res => (Object.assign(Object.assign({}, res), { async: true }))));
91
+ return {
92
+ isValid: preValidateResult.validations.find(result => !result.isValid) === undefined,
93
+ validatedValue: this.value,
94
+ partial: false,
95
+ validations: preValidateResult.validations
96
+ };
97
+ });
98
+ }
99
+ validateRequired() {
100
+ const { required, requiredInvalidMessage } = this.validations;
101
+ if (!required) {
102
+ return undefined;
103
+ }
104
+ return {
105
+ isValid: !isInputEmpty(this.value),
106
+ invalidMessage: requiredInvalidMessage || "This field is required",
107
+ severity: "error"
108
+ };
109
+ }
110
+ validateLength() {
111
+ const { minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity = "error" } = this.validations;
112
+ if (minLength === undefined && maxLength === undefined) {
113
+ return undefined;
114
+ }
115
+ if (minLength !== undefined && maxLength === undefined) {
116
+ return {
117
+ isValid: isMinLengthValid(this.value, minLength),
118
+ invalidMessage: lengthInvalidMessage || `Input should be at least ${minLength} ${pluralize(minLength, "character")}`,
119
+ severity: lengthInvalidSeverity
120
+ };
121
+ }
122
+ if (minLength === undefined && maxLength !== undefined) {
123
+ return {
124
+ isValid: isMaxLengthValid(this.value, maxLength),
125
+ invalidMessage: lengthInvalidMessage || `Input should be up to ${maxLength} ${pluralize(maxLength, "character")}`,
126
+ severity: lengthInvalidSeverity
127
+ };
128
+ }
129
+ return {
130
+ isValid: isMinLengthValid(this.value, minLength) && isMaxLengthValid(this.value, maxLength),
131
+ invalidMessage: lengthInvalidMessage || `Input length should be between ${minLength} and ${maxLength}`,
132
+ severity: lengthInvalidSeverity
133
+ };
134
+ }
135
+ validateRange() {
136
+ const { minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity = "error" } = this.validations;
137
+ if (minValue === undefined && maxValue === undefined) {
138
+ return undefined;
139
+ }
140
+ if (minValue !== undefined && maxValue === undefined) {
141
+ return {
142
+ isValid: isMinValueValid(this.value, minValue),
143
+ invalidMessage: rangeInvalidMessage || `Input should be bigger than ${minValue}`,
144
+ severity: rangeInvalidSeverity
145
+ };
146
+ }
147
+ if (minValue === undefined && maxValue !== undefined) {
148
+ return {
149
+ isValid: isMaxValueValid(this.value, maxValue),
150
+ invalidMessage: rangeInvalidMessage || `Input should be smaller than ${maxValue}`,
151
+ severity: rangeInvalidSeverity
152
+ };
153
+ }
154
+ return {
155
+ isValid: isMinValueValid(this.value, minValue) && isMaxValueValid(this.value, maxValue),
156
+ invalidMessage: rangeInvalidMessage || `Input should be between ${minValue} and ${maxValue}`,
157
+ severity: rangeInvalidSeverity
158
+ };
159
+ }
160
+ validatePattern() {
161
+ const { pattern, patternInvalidMessage, patternInvalidSeverity = "error" } = this.validations;
162
+ if (!pattern) {
163
+ return undefined;
164
+ }
165
+ switch (pattern.toLowerCase()) {
166
+ case "email":
167
+ return {
168
+ isValid: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(this.value),
169
+ invalidMessage: patternInvalidMessage || "Not a valid email address",
170
+ severity: patternInvalidSeverity
171
+ };
172
+ case "phone":
173
+ return {
174
+ isValid: /^[a-zA-Z0-9#*)(+.\-_&']+$/g.test(this.value),
175
+ invalidMessage: patternInvalidMessage || "Not a valid phone number",
176
+ severity: patternInvalidSeverity
177
+ };
178
+ case "url":
179
+ let url;
180
+ try {
181
+ url = new URL(this.value);
182
+ }
183
+ catch (e) { }
184
+ if (!url || (url.protocol && !["http:", "https:"].includes(url.protocol))) {
185
+ return {
186
+ isValid: false,
187
+ invalidMessage: "Not a valid URL",
188
+ severity: patternInvalidSeverity
189
+ };
190
+ }
191
+ return {
192
+ isValid: true,
193
+ severity: "valid"
194
+ };
195
+ default: {
196
+ console.warn("Unknown pattern provided");
197
+ return {
198
+ isValid: true,
199
+ severity: "valid"
200
+ };
201
+ }
202
+ }
203
+ }
204
+ validateRegex() {
205
+ const { regex, regexInvalidMessage, regexInvalidSeverity = "error" } = this.validations;
206
+ if (regex === undefined) {
207
+ return undefined;
208
+ }
209
+ return {
210
+ isValid: isRegexValid(this.value, regex),
211
+ invalidMessage: regexInvalidMessage || "Input is not in the correct format",
212
+ severity: regexInvalidSeverity
213
+ };
214
+ }
215
+ validateCustom() {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ if (!this.onValidate) {
218
+ return undefined;
219
+ }
220
+ const validationFnResult = yield this.onValidate(this.value);
221
+ if (typeof validationFnResult === "boolean") {
222
+ return [
223
+ {
224
+ isValid: validationFnResult,
225
+ invalidMessage: "Invalid input",
226
+ severity: "error"
227
+ }
228
+ ];
229
+ }
230
+ if (!(0, lodash_es_1.isArray)(validationFnResult)) {
231
+ return [validationFnResult];
232
+ }
233
+ return validationFnResult;
234
+ });
235
+ }
236
+ }
237
+ function asyncValidate(validations, onValidate, deferredValue) {
238
+ return __awaiter(this, void 0, void 0, function* () {
239
+ const validator = new FormItemValidator(validations, onValidate, deferredValue);
240
+ // console.log("calling async validate with ", deferredValue);
241
+ return yield validator.validate();
242
+ });
243
+ }
244
+ function useValidation(validations, onValidate, value, dispatch, bindTo, throttleWaitInMs = 0) {
245
+ const deferredValue = (0, react_1.useDeferredValue)(value);
246
+ const throttledAsyncValidate = (0, react_1.useMemo)(() => {
247
+ if (throttleWaitInMs !== 0) {
248
+ return (0, misc_1.asyncThrottle)(asyncValidate, throttleWaitInMs, {
249
+ trailing: true,
250
+ leading: true
251
+ });
252
+ }
253
+ return asyncValidate;
254
+ }, [throttleWaitInMs]);
255
+ (0, react_1.useEffect)(function runAllValidations() {
256
+ const validator = new FormItemValidator(validations, onValidate, deferredValue);
257
+ let ignore = false;
258
+ const partialResult = validator.preValidate();
259
+ if (!ignore) {
260
+ dispatch((0, formActions_1.fieldValidated)(bindTo, partialResult));
261
+ if (partialResult.partial) {
262
+ (() => __awaiter(this, void 0, void 0, function* () {
263
+ const result = yield throttledAsyncValidate(validations, onValidate, deferredValue);
264
+ if (!ignore) {
265
+ // console.log(`async validation result for ${bindTo}`, result);
266
+ dispatch((0, formActions_1.fieldValidated)(bindTo, result));
267
+ }
268
+ }))();
269
+ }
270
+ }
271
+ return () => {
272
+ ignore = true;
273
+ };
274
+ }, [bindTo, deferredValue, dispatch, onValidate, throttledAsyncValidate, validations]);
275
+ }
276
+ function useValidationDisplay(bindTo, value, validationResult, validationMode = "errorLate") {
277
+ const interactionFlags = (0, FormContext_1.useFormContextPart)(value => value.interactionFlags[bindTo]) || constants_1.EMPTY_OBJECT;
278
+ const forceShowValidationResult = interactionFlags.forceShowValidationResult;
279
+ const focused = interactionFlags.focused;
280
+ const isValidLostFocus = interactionFlags.isValidLostFocus;
281
+ const isValidOnFocus = interactionFlags.isValidOnFocus;
282
+ const invalidToValid = interactionFlags.invalidToValid;
283
+ const validationInProgress = !validationResult || validationResult.validatedValue !== value;
284
+ const isDirty = interactionFlags.isDirty;
285
+ const isValid = (validationResult === null || validationResult === void 0 ? void 0 : validationResult.isValid) === true;
286
+ let highestValidationSeverity = "none";
287
+ for (const val of (validationResult === null || validationResult === void 0 ? void 0 : validationResult.validations) || []) {
288
+ if (val.isValid) {
289
+ continue;
290
+ }
291
+ if (highestValidationSeverity !== "error" && val.severity === "warning") {
292
+ highestValidationSeverity = "warning";
293
+ }
294
+ if (val.severity === "error") {
295
+ highestValidationSeverity = "error";
296
+ break;
297
+ }
298
+ }
299
+ let isHelperTextShown = false;
300
+ switch (validationMode) {
301
+ case "errorLate":
302
+ isHelperTextShown = isDirty && (focused ? !invalidToValid && !isValidOnFocus : !isValidLostFocus);
303
+ break;
304
+ case "onChanged":
305
+ isHelperTextShown = isDirty;
306
+ break;
307
+ case "onLostFocus":
308
+ isHelperTextShown = isDirty && ((!focused && !isValid) || (!isValidLostFocus && !isValid));
309
+ }
310
+ isHelperTextShown = isHelperTextShown || forceShowValidationResult;
311
+ const [prevStableShown, setPrevStableShown] = (0, react_1.useState)(isHelperTextShown);
312
+ if (prevStableShown !== isHelperTextShown && !validationInProgress) {
313
+ setPrevStableShown(isHelperTextShown);
314
+ }
315
+ if (validationInProgress) {
316
+ isHelperTextShown = prevStableShown;
317
+ }
318
+ return {
319
+ isHelperTextShown,
320
+ validationStatus: isHelperTextShown ? highestValidationSeverity : "none"
321
+ };
322
+ }
323
+ function parseSeverity(severity) {
324
+ if (severity === undefined) {
325
+ return undefined;
326
+ }
327
+ if (severity === "error" || severity === "warning" || severity === "valid" || severity === "none") {
328
+ return severity;
329
+ }
330
+ return "none";
331
+ }
332
+ function groupInvalidValidationResultsBySeverity(validationResults) {
333
+ const ret = {
334
+ error: [],
335
+ warning: [],
336
+ valid: [],
337
+ none: []
338
+ };
339
+ Object.entries(validationResults).forEach(([field, validationResult]) => {
340
+ validationResult.validations.forEach(singleValidationResult => {
341
+ if (!singleValidationResult.isValid) {
342
+ ret[singleValidationResult.severity] = ret[singleValidationResult.severity] || [];
343
+ ret[singleValidationResult.severity].push(singleValidationResult);
344
+ }
345
+ });
346
+ });
347
+ return ret;
348
+ }
349
+ function pluralize(count, word) {
350
+ return count === 1 ? word : word + "s";
351
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formSectionRenderer = exports.FormSectionMd = void 0;
4
+ const ComponentDefs_1 = require("@abstractions/ComponentDefs");
5
+ const compound_utils_1 = require("@components-core/utils/compound-utils");
6
+ // --- We cannot use this with nextra
7
+ // import componentSource from "./FormSection.xmlui?raw";
8
+ const COMP = "FormSection";
9
+ exports.FormSectionMd = (0, ComponentDefs_1.createMetadata)({
10
+ status: "experimental",
11
+ description: `The \`${COMP}\` is a component that groups cohesive elements together within ` +
12
+ `a \`Form\`. This grouping is indicated visually: the child components of the \`${COMP}\` ` +
13
+ `are placed in a [\`FlowLayout\`](./FlowLayout.mdx) component.`,
14
+ });
15
+ const componentSource = `
16
+ <Component name="FormSection">
17
+ <VStack paddingBottom="{$props.paddingBottom ?? '1rem'}" gap="0">
18
+ <Heading
19
+ when="{!!$props.heading}"
20
+ marginBottom="$space-tight"
21
+ level="{$props.headingLevel ?? 'h3'}"
22
+ fontWeight="{$props.headingWeight ?? 'bold'}"
23
+ value="{$props.heading}" />
24
+ <Text
25
+ when="{!!$props.info}"
26
+ fontSize="{$props.infoFontSize ?? '0.8rem'}"
27
+ paddingBottom="$space-normal"
28
+ value="{$props.info}" />
29
+ <FlowLayout
30
+ paddingTop="{$props.paddingTop ?? '$space-normal'}"
31
+ columnGap="{$props.columnGap ?? '3rem'}"
32
+ rowGap="{$props.rowGap ?? '$space-normal'}" >
33
+ <Slot />
34
+ </FlowLayout>
35
+ </VStack>
36
+ </Component>
37
+ `;
38
+ exports.formSectionRenderer = {
39
+ compoundComponentDef: (0, compound_utils_1.compoundComponentDefFromSource)(COMP, componentSource),
40
+ metadata: exports.FormSectionMd,
41
+ };