@rjsf/primereact 6.0.0-beta.11

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 (265) hide show
  1. package/README.md +120 -0
  2. package/dist/index.js +1285 -0
  3. package/dist/index.js.map +7 -0
  4. package/dist/primereact.esm.js +1327 -0
  5. package/dist/primereact.esm.js.map +7 -0
  6. package/dist/primereact.umd.js +1135 -0
  7. package/lib/AddButton/AddButton.d.ts +4 -0
  8. package/lib/AddButton/AddButton.js +10 -0
  9. package/lib/AddButton/AddButton.js.map +1 -0
  10. package/lib/AddButton/index.d.ts +2 -0
  11. package/lib/AddButton/index.js +3 -0
  12. package/lib/AddButton/index.js.map +1 -0
  13. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +6 -0
  14. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +13 -0
  15. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -0
  16. package/lib/ArrayFieldItemTemplate/index.d.ts +2 -0
  17. package/lib/ArrayFieldItemTemplate/index.js +3 -0
  18. package/lib/ArrayFieldItemTemplate/index.js.map +1 -0
  19. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +6 -0
  20. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +30 -0
  21. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -0
  22. package/lib/ArrayFieldTemplate/index.d.ts +2 -0
  23. package/lib/ArrayFieldTemplate/index.js +3 -0
  24. package/lib/ArrayFieldTemplate/index.js.map +1 -0
  25. package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.d.ts +6 -0
  26. package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js +11 -0
  27. package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js.map +1 -0
  28. package/lib/ArrayFieldTitleTemplate/index.d.ts +2 -0
  29. package/lib/ArrayFieldTitleTemplate/index.js +3 -0
  30. package/lib/ArrayFieldTitleTemplate/index.js.map +1 -0
  31. package/lib/AutoCompleteWidget/AutoCompleteWidget.d.ts +7 -0
  32. package/lib/AutoCompleteWidget/AutoCompleteWidget.js +42 -0
  33. package/lib/AutoCompleteWidget/AutoCompleteWidget.js.map +1 -0
  34. package/lib/AutoCompleteWidget/index.d.ts +2 -0
  35. package/lib/AutoCompleteWidget/index.js +3 -0
  36. package/lib/AutoCompleteWidget/index.js.map +1 -0
  37. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +4 -0
  38. package/lib/BaseInputTemplate/BaseInputTemplate.js +19 -0
  39. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -0
  40. package/lib/BaseInputTemplate/index.d.ts +2 -0
  41. package/lib/BaseInputTemplate/index.js +3 -0
  42. package/lib/BaseInputTemplate/index.js.map +1 -0
  43. package/lib/CheckboxWidget/CheckboxWidget.d.ts +7 -0
  44. package/lib/CheckboxWidget/CheckboxWidget.js +23 -0
  45. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -0
  46. package/lib/CheckboxWidget/index.d.ts +2 -0
  47. package/lib/CheckboxWidget/index.js +3 -0
  48. package/lib/CheckboxWidget/index.js.map +1 -0
  49. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +7 -0
  50. package/lib/CheckboxesWidget/CheckboxesWidget.js +35 -0
  51. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -0
  52. package/lib/CheckboxesWidget/index.d.ts +2 -0
  53. package/lib/CheckboxesWidget/index.js +3 -0
  54. package/lib/CheckboxesWidget/index.js.map +1 -0
  55. package/lib/ColorWidget/ColorWidget.d.ts +6 -0
  56. package/lib/ColorWidget/ColorWidget.js +18 -0
  57. package/lib/ColorWidget/ColorWidget.js.map +1 -0
  58. package/lib/ColorWidget/index.d.ts +2 -0
  59. package/lib/ColorWidget/index.js +3 -0
  60. package/lib/ColorWidget/index.js.map +1 -0
  61. package/lib/DescriptionField/DescriptionField.d.ts +6 -0
  62. package/lib/DescriptionField/DescriptionField.js +14 -0
  63. package/lib/DescriptionField/DescriptionField.js.map +1 -0
  64. package/lib/DescriptionField/index.d.ts +2 -0
  65. package/lib/DescriptionField/index.js +3 -0
  66. package/lib/DescriptionField/index.js.map +1 -0
  67. package/lib/ErrorList/ErrorList.d.ts +6 -0
  68. package/lib/ErrorList/ErrorList.js +21 -0
  69. package/lib/ErrorList/ErrorList.js.map +1 -0
  70. package/lib/ErrorList/index.d.ts +2 -0
  71. package/lib/ErrorList/index.js +3 -0
  72. package/lib/ErrorList/index.js.map +1 -0
  73. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +6 -0
  74. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +18 -0
  75. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -0
  76. package/lib/FieldErrorTemplate/index.d.ts +2 -0
  77. package/lib/FieldErrorTemplate/index.js +3 -0
  78. package/lib/FieldErrorTemplate/index.js.map +1 -0
  79. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +6 -0
  80. package/lib/FieldHelpTemplate/FieldHelpTemplate.js +15 -0
  81. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -0
  82. package/lib/FieldHelpTemplate/index.d.ts +2 -0
  83. package/lib/FieldHelpTemplate/index.js +3 -0
  84. package/lib/FieldHelpTemplate/index.js.map +1 -0
  85. package/lib/FieldTemplate/FieldTemplate.d.ts +2 -0
  86. package/lib/FieldTemplate/FieldTemplate.js +13 -0
  87. package/lib/FieldTemplate/FieldTemplate.js.map +1 -0
  88. package/lib/FieldTemplate/index.d.ts +2 -0
  89. package/lib/FieldTemplate/index.js +3 -0
  90. package/lib/FieldTemplate/index.js.map +1 -0
  91. package/lib/GridTemplate/GridTemplate.d.ts +8 -0
  92. package/lib/GridTemplate/GridTemplate.js +69 -0
  93. package/lib/GridTemplate/GridTemplate.js.map +1 -0
  94. package/lib/GridTemplate/index.d.ts +2 -0
  95. package/lib/GridTemplate/index.js +3 -0
  96. package/lib/GridTemplate/index.js.map +1 -0
  97. package/lib/IconButton/IconButton.d.ts +7 -0
  98. package/lib/IconButton/IconButton.js +25 -0
  99. package/lib/IconButton/IconButton.js.map +1 -0
  100. package/lib/IconButton/index.d.ts +2 -0
  101. package/lib/IconButton/index.js +3 -0
  102. package/lib/IconButton/index.js.map +1 -0
  103. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -0
  104. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +7 -0
  105. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -0
  106. package/lib/MultiSchemaFieldTemplate/index.d.ts +2 -0
  107. package/lib/MultiSchemaFieldTemplate/index.js +3 -0
  108. package/lib/MultiSchemaFieldTemplate/index.js.map +1 -0
  109. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +8 -0
  110. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +18 -0
  111. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -0
  112. package/lib/ObjectFieldTemplate/index.d.ts +2 -0
  113. package/lib/ObjectFieldTemplate/index.js +3 -0
  114. package/lib/ObjectFieldTemplate/index.js.map +1 -0
  115. package/lib/PasswordWidget/PasswordWidget.d.ts +6 -0
  116. package/lib/PasswordWidget/PasswordWidget.js +17 -0
  117. package/lib/PasswordWidget/PasswordWidget.js.map +1 -0
  118. package/lib/PasswordWidget/index.d.ts +2 -0
  119. package/lib/PasswordWidget/index.js +3 -0
  120. package/lib/PasswordWidget/index.js.map +1 -0
  121. package/lib/PrimeForm/PrimeForm.d.ts +6 -0
  122. package/lib/PrimeForm/PrimeForm.js +7 -0
  123. package/lib/PrimeForm/PrimeForm.js.map +1 -0
  124. package/lib/PrimeForm/index.d.ts +2 -0
  125. package/lib/PrimeForm/index.js +3 -0
  126. package/lib/PrimeForm/index.js.map +1 -0
  127. package/lib/RadioWidget/RadioWidget.d.ts +7 -0
  128. package/lib/RadioWidget/RadioWidget.js +25 -0
  129. package/lib/RadioWidget/RadioWidget.js.map +1 -0
  130. package/lib/RadioWidget/index.d.ts +2 -0
  131. package/lib/RadioWidget/index.js +3 -0
  132. package/lib/RadioWidget/index.js.map +1 -0
  133. package/lib/RangeWidget/RangeWidget.d.ts +7 -0
  134. package/lib/RangeWidget/RangeWidget.js +21 -0
  135. package/lib/RangeWidget/RangeWidget.js.map +1 -0
  136. package/lib/RangeWidget/index.d.ts +2 -0
  137. package/lib/RangeWidget/index.js +3 -0
  138. package/lib/RangeWidget/index.js.map +1 -0
  139. package/lib/SelectWidget/SelectWidget.d.ts +7 -0
  140. package/lib/SelectWidget/SelectWidget.js +47 -0
  141. package/lib/SelectWidget/SelectWidget.js.map +1 -0
  142. package/lib/SelectWidget/index.d.ts +2 -0
  143. package/lib/SelectWidget/index.js +3 -0
  144. package/lib/SelectWidget/index.js.map +1 -0
  145. package/lib/SubmitButton/SubmitButton.d.ts +4 -0
  146. package/lib/SubmitButton/SubmitButton.js +13 -0
  147. package/lib/SubmitButton/SubmitButton.js.map +1 -0
  148. package/lib/SubmitButton/index.d.ts +2 -0
  149. package/lib/SubmitButton/index.js +3 -0
  150. package/lib/SubmitButton/index.js.map +1 -0
  151. package/lib/Templates/Templates.d.ts +4 -0
  152. package/lib/Templates/Templates.js +45 -0
  153. package/lib/Templates/Templates.js.map +1 -0
  154. package/lib/Templates/index.d.ts +2 -0
  155. package/lib/Templates/index.js +3 -0
  156. package/lib/Templates/index.js.map +1 -0
  157. package/lib/TextareaWidget/TextareaWidget.d.ts +6 -0
  158. package/lib/TextareaWidget/TextareaWidget.js +20 -0
  159. package/lib/TextareaWidget/TextareaWidget.js.map +1 -0
  160. package/lib/TextareaWidget/index.d.ts +2 -0
  161. package/lib/TextareaWidget/index.js +3 -0
  162. package/lib/TextareaWidget/index.js.map +1 -0
  163. package/lib/Theme/Theme.d.ts +5 -0
  164. package/lib/Theme/Theme.js +10 -0
  165. package/lib/Theme/Theme.js.map +1 -0
  166. package/lib/Theme/index.d.ts +2 -0
  167. package/lib/Theme/index.js +3 -0
  168. package/lib/Theme/index.js.map +1 -0
  169. package/lib/TitleField/TitleField.d.ts +6 -0
  170. package/lib/TitleField/TitleField.js +12 -0
  171. package/lib/TitleField/TitleField.js.map +1 -0
  172. package/lib/TitleField/index.d.ts +2 -0
  173. package/lib/TitleField/index.js +3 -0
  174. package/lib/TitleField/index.js.map +1 -0
  175. package/lib/UpDownWidget/UpDownWidget.d.ts +6 -0
  176. package/lib/UpDownWidget/UpDownWidget.js +19 -0
  177. package/lib/UpDownWidget/UpDownWidget.js.map +1 -0
  178. package/lib/UpDownWidget/index.d.ts +2 -0
  179. package/lib/UpDownWidget/index.js +3 -0
  180. package/lib/UpDownWidget/index.js.map +1 -0
  181. package/lib/Widgets/Widgets.d.ts +4 -0
  182. package/lib/Widgets/Widgets.js +26 -0
  183. package/lib/Widgets/Widgets.js.map +1 -0
  184. package/lib/Widgets/index.d.ts +2 -0
  185. package/lib/Widgets/index.js +3 -0
  186. package/lib/Widgets/index.js.map +1 -0
  187. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +7 -0
  188. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +20 -0
  189. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -0
  190. package/lib/WrapIfAdditionalTemplate/index.d.ts +2 -0
  191. package/lib/WrapIfAdditionalTemplate/index.js +3 -0
  192. package/lib/WrapIfAdditionalTemplate/index.js.map +1 -0
  193. package/lib/index.d.ts +6 -0
  194. package/lib/index.js +7 -0
  195. package/lib/index.js.map +1 -0
  196. package/lib/tsconfig.tsbuildinfo +1 -0
  197. package/lib/util.d.ts +5 -0
  198. package/lib/util.js +8 -0
  199. package/lib/util.js.map +1 -0
  200. package/package.json +104 -0
  201. package/src/AddButton/AddButton.tsx +23 -0
  202. package/src/AddButton/index.ts +2 -0
  203. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +40 -0
  204. package/src/ArrayFieldItemTemplate/index.ts +2 -0
  205. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +111 -0
  206. package/src/ArrayFieldTemplate/index.ts +2 -0
  207. package/src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx +25 -0
  208. package/src/ArrayFieldTitleTemplate/index.ts +2 -0
  209. package/src/AutoCompleteWidget/AutoCompleteWidget.tsx +96 -0
  210. package/src/AutoCompleteWidget/index.ts +2 -0
  211. package/src/BaseInputTemplate/BaseInputTemplate.tsx +71 -0
  212. package/src/BaseInputTemplate/index.ts +2 -0
  213. package/src/CheckboxWidget/CheckboxWidget.tsx +86 -0
  214. package/src/CheckboxWidget/index.ts +2 -0
  215. package/src/CheckboxesWidget/CheckboxesWidget.tsx +105 -0
  216. package/src/CheckboxesWidget/index.ts +2 -0
  217. package/src/ColorWidget/ColorWidget.tsx +62 -0
  218. package/src/ColorWidget/index.ts +2 -0
  219. package/src/DescriptionField/DescriptionField.tsx +22 -0
  220. package/src/DescriptionField/index.ts +2 -0
  221. package/src/ErrorList/ErrorList.tsx +44 -0
  222. package/src/ErrorList/index.ts +2 -0
  223. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +30 -0
  224. package/src/FieldErrorTemplate/index.ts +2 -0
  225. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +18 -0
  226. package/src/FieldHelpTemplate/index.ts +2 -0
  227. package/src/FieldTemplate/FieldTemplate.tsx +40 -0
  228. package/src/FieldTemplate/index.ts +2 -0
  229. package/src/GridTemplate/GridTemplate.tsx +93 -0
  230. package/src/GridTemplate/index.ts +2 -0
  231. package/src/IconButton/IconButton.tsx +47 -0
  232. package/src/IconButton/index.ts +2 -0
  233. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +17 -0
  234. package/src/MultiSchemaFieldTemplate/index.ts +2 -0
  235. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +88 -0
  236. package/src/ObjectFieldTemplate/index.ts +2 -0
  237. package/src/PasswordWidget/PasswordWidget.tsx +65 -0
  238. package/src/PasswordWidget/index.ts +2 -0
  239. package/src/PrimeForm/PrimeForm.ts +15 -0
  240. package/src/PrimeForm/index.ts +2 -0
  241. package/src/RadioWidget/RadioWidget.tsx +60 -0
  242. package/src/RadioWidget/index.ts +2 -0
  243. package/src/RangeWidget/RangeWidget.tsx +37 -0
  244. package/src/RangeWidget/index.ts +2 -0
  245. package/src/SelectWidget/SelectWidget.tsx +139 -0
  246. package/src/SelectWidget/index.ts +2 -0
  247. package/src/SubmitButton/SubmitButton.tsx +16 -0
  248. package/src/SubmitButton/index.ts +2 -0
  249. package/src/Templates/Templates.ts +52 -0
  250. package/src/Templates/index.ts +2 -0
  251. package/src/TextareaWidget/TextareaWidget.tsx +41 -0
  252. package/src/TextareaWidget/index.ts +2 -0
  253. package/src/Theme/Theme.ts +18 -0
  254. package/src/Theme/index.ts +2 -0
  255. package/src/TitleField/TitleField.tsx +23 -0
  256. package/src/TitleField/index.ts +2 -0
  257. package/src/UpDownWidget/UpDownWidget.tsx +70 -0
  258. package/src/UpDownWidget/index.ts +2 -0
  259. package/src/Widgets/Widgets.tsx +33 -0
  260. package/src/Widgets/index.ts +2 -0
  261. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +83 -0
  262. package/src/WrapIfAdditionalTemplate/index.ts +2 -0
  263. package/src/index.ts +8 -0
  264. package/src/tsconfig.json +24 -0
  265. package/src/util.tsx +11 -0
@@ -0,0 +1,1135 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('primereact/button'), require('@rjsf/utils'), require('react/jsx-runtime'), require('primereact/fieldset'), require('primereact/inputtext'), require('primereact/message'), require('primereact/icons/timescircle'), require('primereact/divider'), require('react'), require('primereact/autocomplete'), require('primereact/checkbox'), require('primereact/colorpicker'), require('primereact/password'), require('primereact/radiobutton'), require('primereact/slider'), require('primereact/dropdown'), require('primereact/multiselect'), require('primereact/inputtextarea'), require('primereact/inputnumber')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'primereact/button', '@rjsf/utils', 'react/jsx-runtime', 'primereact/fieldset', 'primereact/inputtext', 'primereact/message', 'primereact/icons/timescircle', 'primereact/divider', 'react', 'primereact/autocomplete', 'primereact/checkbox', 'primereact/colorpicker', 'primereact/password', 'primereact/radiobutton', 'primereact/slider', 'primereact/dropdown', 'primereact/multiselect', 'primereact/inputtextarea', 'primereact/inputnumber'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/primereact"] = {}, global.core, global.button, global.utils, global.jsxRuntime, global.fieldset, global.inputtext, global.message, global.timescircle, global.divider, global.react, global.autocomplete, global.checkbox, global.colorpicker, global.password, global.radiobutton, global.slider, global.dropdown, global.multiselect, global.inputtextarea, global.inputnumber));
5
+ })(this, (function (exports, core, button, utils, jsxRuntime, fieldset, inputtext, message, timescircle, divider, react, autocomplete, checkbox, colorpicker, password, radiobutton, slider, dropdown, multiselect, inputtextarea, inputnumber) { 'use strict';
6
+
7
+ // src/PrimeForm/PrimeForm.ts
8
+ function AddButton({
9
+ uiSchema,
10
+ registry,
11
+ color,
12
+ ...props
13
+ }) {
14
+ const { translateString } = registry;
15
+ return /* @__PURE__ */ jsxRuntime.jsx(
16
+ button.Button,
17
+ {
18
+ label: translateString(utils.TranslatableString.AddItemButton),
19
+ icon: "pi pi-plus",
20
+ outlined: true,
21
+ severity: "secondary",
22
+ size: "small",
23
+ ...props
24
+ }
25
+ );
26
+ }
27
+ function ArrayFieldItemTemplate(props) {
28
+ const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
29
+ const uiOptions = utils.getUiOptions(uiSchema);
30
+ const ArrayFieldItemButtonsTemplate = utils.getTemplate(
31
+ "ArrayFieldItemButtonsTemplate",
32
+ registry,
33
+ uiOptions
34
+ );
35
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
36
+ hasToolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", right: 0, top: "-10px" }, children: hasToolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexDirection: "row" }, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) }) }),
37
+ children
38
+ ] });
39
+ }
40
+ function ArrayFieldTemplate(props) {
41
+ const {
42
+ uiSchema,
43
+ idSchema,
44
+ canAdd,
45
+ className,
46
+ disabled,
47
+ items,
48
+ onAddClick,
49
+ readonly,
50
+ schema,
51
+ title,
52
+ registry,
53
+ required,
54
+ ...rest
55
+ } = props;
56
+ const uiOptions = utils.getUiOptions(uiSchema);
57
+ const ArrayFieldDescriptionTemplate = utils.getTemplate(
58
+ "ArrayFieldDescriptionTemplate",
59
+ registry,
60
+ uiOptions
61
+ );
62
+ const ArrayFieldItemTemplate2 = utils.getTemplate(
63
+ "ArrayFieldItemTemplate",
64
+ registry,
65
+ uiOptions
66
+ );
67
+ const ArrayFieldTitleTemplate2 = utils.getTemplate(
68
+ "ArrayFieldTitleTemplate",
69
+ registry,
70
+ uiOptions
71
+ );
72
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
73
+ /* @__PURE__ */ jsxRuntime.jsx(
74
+ ArrayFieldTitleTemplate2,
75
+ {
76
+ idSchema,
77
+ title: uiOptions.title || title,
78
+ schema,
79
+ uiSchema,
80
+ required,
81
+ registry
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsxRuntime.jsxs(fieldset.Fieldset, { ...rest, className: `${className}${utils.isFixedItems(schema) ? "" : " sortable-form-fields"}`, children: [
85
+ /* @__PURE__ */ jsxRuntime.jsx(
86
+ ArrayFieldDescriptionTemplate,
87
+ {
88
+ idSchema,
89
+ description: uiOptions.description || schema.description,
90
+ schema,
91
+ uiSchema,
92
+ registry
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
96
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: items && items.map(({ key, uiSchema: itemUiSchema = {}, ...props2 }) => {
97
+ const mergedUiSchema = {
98
+ ...itemUiSchema,
99
+ [utils.UI_OPTIONS_KEY]: {
100
+ ...itemUiSchema[utils.UI_OPTIONS_KEY]
101
+ }
102
+ };
103
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...props2, uiSchema: mergedUiSchema }, key);
104
+ }) }),
105
+ canAdd && /* @__PURE__ */ jsxRuntime.jsx(
106
+ "div",
107
+ {
108
+ style: {
109
+ marginTop: "1rem",
110
+ position: "relative",
111
+ textAlign: "right"
112
+ },
113
+ children: /* @__PURE__ */ jsxRuntime.jsx(
114
+ AddButton,
115
+ {
116
+ id: utils.buttonId(idSchema, "add"),
117
+ className: "rjsf-array-item-add",
118
+ onClick: onAddClick,
119
+ disabled: disabled || readonly,
120
+ uiSchema,
121
+ registry
122
+ }
123
+ )
124
+ }
125
+ )
126
+ ] }, `array-item-list-${idSchema.$id}`)
127
+ ] })
128
+ ] });
129
+ }
130
+ function BaseInputTemplate(props) {
131
+ const {
132
+ id,
133
+ placeholder,
134
+ value,
135
+ required,
136
+ readonly,
137
+ disabled,
138
+ onChange,
139
+ onChangeOverride,
140
+ onBlur,
141
+ onFocus,
142
+ autofocus,
143
+ options,
144
+ schema,
145
+ type,
146
+ registry,
147
+ rawErrors = []
148
+ } = props;
149
+ const { AutoCompleteWidget: AutoCompleteWidget2 } = registry.widgets;
150
+ if (Array.isArray(schema.examples)) {
151
+ return /* @__PURE__ */ jsxRuntime.jsx(AutoCompleteWidget2, { ...props });
152
+ }
153
+ const inputProps = utils.getInputProps(schema, type, options);
154
+ const primeProps = options.prime || {};
155
+ const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
156
+ const _onBlur = () => onBlur && onBlur(id, value);
157
+ const _onFocus = () => onFocus && onFocus(id, value);
158
+ return /* @__PURE__ */ jsxRuntime.jsx(
159
+ inputtext.InputText,
160
+ {
161
+ id,
162
+ name: id,
163
+ placeholder,
164
+ ...primeProps,
165
+ ...inputProps,
166
+ required,
167
+ autoFocus: autofocus,
168
+ disabled: disabled || readonly,
169
+ list: schema.examples ? utils.examplesId(id) : void 0,
170
+ value: value || value === 0 ? value : "",
171
+ invalid: rawErrors.length > 0,
172
+ onChange: onChangeOverride || _onChange,
173
+ onBlur: _onBlur,
174
+ onFocus: _onFocus,
175
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
176
+ }
177
+ );
178
+ }
179
+ function DescriptionField(props) {
180
+ const { id, description, registry, uiSchema } = props;
181
+ if (!description) {
182
+ return null;
183
+ }
184
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { id, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichDescription, { description, registry, uiSchema }) });
185
+ }
186
+ function ErrorList({
187
+ errors,
188
+ registry
189
+ }) {
190
+ const { translateString } = registry;
191
+ const content = /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
192
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", gap: "0.5rem" }, children: [
193
+ /* @__PURE__ */ jsxRuntime.jsx(timescircle.TimesCircleIcon, { style: { width: "1.5rem", height: "1.5rem" } }),
194
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-message-summary", children: translateString(utils.TranslatableString.ErrorsLabel) })
195
+ ] }),
196
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "p-message-list", children: errors.map((error, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: error.stack }, `error-${index}`)) })
197
+ ] });
198
+ return /* @__PURE__ */ jsxRuntime.jsx(
199
+ message.Message,
200
+ {
201
+ className: "p-message",
202
+ style: {
203
+ borderStyle: "solid",
204
+ borderColor: "#ff5757",
205
+ borderWidth: "0 0 0 6px",
206
+ width: "100%",
207
+ justifyContent: "start",
208
+ marginBottom: "1rem"
209
+ },
210
+ severity: "error",
211
+ content
212
+ }
213
+ );
214
+ }
215
+ function IconButton(props) {
216
+ const { icon, iconType, uiSchema, registry, ...otherProps } = props;
217
+ return /* @__PURE__ */ jsxRuntime.jsx(button.Button, { icon: `pi pi-${icon}`, rounded: true, text: true, severity: "secondary", ...otherProps });
218
+ }
219
+ function CopyButton(props) {
220
+ const {
221
+ registry: { translateString }
222
+ } = props;
223
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: "copy" });
224
+ }
225
+ function MoveDownButton(props) {
226
+ const {
227
+ registry: { translateString }
228
+ } = props;
229
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveDownButton), ...props, icon: "angle-down" });
230
+ }
231
+ function MoveUpButton(props) {
232
+ const {
233
+ registry: { translateString }
234
+ } = props;
235
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveUpButton), ...props, icon: "angle-up" });
236
+ }
237
+ function RemoveButton(props) {
238
+ const {
239
+ registry: { translateString }
240
+ } = props;
241
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.RemoveButton), ...props, icon: "trash" });
242
+ }
243
+ function FieldErrorTemplate({ errors, idSchema }) {
244
+ if (errors && errors.length > 0) {
245
+ const id = utils.errorId(idSchema);
246
+ const content = errors.map((error, i) => {
247
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: error }, i);
248
+ });
249
+ return /* @__PURE__ */ jsxRuntime.jsx(
250
+ message.Message,
251
+ {
252
+ id,
253
+ severity: "error",
254
+ style: { justifyContent: "left" },
255
+ text: content,
256
+ pt: { text: { style: { fontSize: "smaller" } } }
257
+ }
258
+ );
259
+ }
260
+ return null;
261
+ }
262
+ function FieldHelpTemplate(props) {
263
+ const { idSchema, help } = props;
264
+ if (help) {
265
+ const id = utils.helpId(idSchema);
266
+ return /* @__PURE__ */ jsxRuntime.jsx("small", { id, children: help });
267
+ }
268
+ return null;
269
+ }
270
+ function Label({ id, text, required }) {
271
+ if (!text) {
272
+ return null;
273
+ }
274
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, children: [
275
+ text,
276
+ " ",
277
+ required ? "*" : ""
278
+ ] });
279
+ }
280
+ function FieldTemplate(props) {
281
+ const { children, errors, help, displayLabel, description, rawDescription, hidden, uiSchema, registry } = props;
282
+ const uiOptions = utils.getUiOptions(uiSchema);
283
+ const WrapIfAdditionalTemplate2 = utils.getTemplate(
284
+ "WrapIfAdditionalTemplate",
285
+ registry,
286
+ uiOptions
287
+ );
288
+ if (hidden) {
289
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "none" }, children });
290
+ }
291
+ return /* @__PURE__ */ jsxRuntime.jsx(WrapIfAdditionalTemplate2, { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem", marginBottom: "1rem" }, children: [
292
+ displayLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { id: props.id, text: props.label, required: props.required }),
293
+ children,
294
+ displayLabel && rawDescription && /* @__PURE__ */ jsxRuntime.jsx("small", { children: description }),
295
+ errors,
296
+ help
297
+ ] }) });
298
+ }
299
+ function MultiSchemaFieldTemplate(props) {
300
+ const { selector, optionSchemaField } = props;
301
+ return /* @__PURE__ */ jsxRuntime.jsxs(fieldset.Fieldset, { children: [
302
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "1rem" }, children: selector }),
303
+ optionSchemaField
304
+ ] });
305
+ }
306
+ function ObjectFieldTemplate(props) {
307
+ const {
308
+ description,
309
+ onAddClick,
310
+ title,
311
+ properties,
312
+ disabled,
313
+ readonly,
314
+ required,
315
+ uiSchema,
316
+ schema,
317
+ formData,
318
+ idSchema,
319
+ registry
320
+ } = props;
321
+ const uiOptions = utils.getUiOptions(uiSchema);
322
+ const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
323
+ const DescriptionFieldTemplate = utils.getTemplate(
324
+ "DescriptionFieldTemplate",
325
+ registry,
326
+ uiOptions
327
+ );
328
+ const {
329
+ ButtonTemplates: { AddButton: AddButton2 }
330
+ } = registry.templates;
331
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
332
+ title && /* @__PURE__ */ jsxRuntime.jsx(
333
+ TitleFieldTemplate,
334
+ {
335
+ id: utils.titleId(idSchema),
336
+ title,
337
+ required,
338
+ schema,
339
+ uiSchema,
340
+ registry
341
+ }
342
+ ),
343
+ description && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
344
+ DescriptionFieldTemplate,
345
+ {
346
+ id: utils.descriptionId(idSchema),
347
+ description,
348
+ schema,
349
+ uiSchema,
350
+ registry
351
+ }
352
+ ) }),
353
+ properties.map((prop) => prop.content),
354
+ utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "1rem", textAlign: "right" }, children: /* @__PURE__ */ jsxRuntime.jsx(
355
+ AddButton2,
356
+ {
357
+ id: utils.buttonId(idSchema, "add"),
358
+ className: "rjsf-object-property-expand",
359
+ icon: "pi pi-plus",
360
+ onClick: onAddClick(schema),
361
+ disabled: disabled || readonly,
362
+ registry
363
+ }
364
+ ) })
365
+ ] });
366
+ }
367
+ function SubmitButton({ uiSchema }) {
368
+ const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
369
+ if (norender) {
370
+ return null;
371
+ }
372
+ return /* @__PURE__ */ jsxRuntime.jsx(button.Button, { type: "submit", label: submitText, ...submitButtonProps });
373
+ }
374
+ function TitleField({
375
+ id,
376
+ title,
377
+ uiSchema,
378
+ required
379
+ }) {
380
+ const uiOptions = utils.getUiOptions(uiSchema);
381
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { id, children: [
382
+ /* @__PURE__ */ jsxRuntime.jsxs("h5", { style: { margin: 0, fontSize: id === utils.titleId("root") ? "1.5rem" : "1.2rem" }, children: [
383
+ uiOptions.title || title,
384
+ " ",
385
+ required ? "*" : ""
386
+ ] }),
387
+ /* @__PURE__ */ jsxRuntime.jsx(divider.Divider, { pt: { root: { style: { marginTop: "0.5rem" } } } })
388
+ ] });
389
+ }
390
+ function WrapIfAdditionalTemplate({
391
+ classNames,
392
+ style,
393
+ children,
394
+ disabled,
395
+ id,
396
+ label,
397
+ onDropPropertyClick,
398
+ onKeyChange,
399
+ readonly,
400
+ required,
401
+ schema,
402
+ registry
403
+ }) {
404
+ const { templates, translateString } = registry;
405
+ const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
406
+ const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
407
+ const additional = utils.ADDITIONAL_PROPERTY_FLAG in schema;
408
+ if (!additional) {
409
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
410
+ }
411
+ const handleBlur = ({ target }) => onKeyChange(target.value);
412
+ return /* @__PURE__ */ jsxRuntime.jsxs(
413
+ "div",
414
+ {
415
+ className: classNames,
416
+ style: { ...style, display: "flex", alignItems: "center", gap: "1rem" },
417
+ children: [
418
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1 }, children: [
419
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: `${id}-key`, style: { display: "block", marginBottom: "0.5rem" }, children: keyLabel }),
420
+ /* @__PURE__ */ jsxRuntime.jsx(
421
+ inputtext.InputText,
422
+ {
423
+ id: `${id}-key`,
424
+ name: `${id}-key`,
425
+ defaultValue: label,
426
+ disabled: disabled || readonly,
427
+ onBlur: !readonly ? handleBlur : void 0,
428
+ required,
429
+ style: { width: "100%" }
430
+ }
431
+ )
432
+ ] }),
433
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1 }, children }),
434
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
435
+ RemoveButton2,
436
+ {
437
+ id: utils.buttonId(id, "remove"),
438
+ className: "rjsf-object-property-remove",
439
+ disabled: disabled || readonly,
440
+ onClick: onDropPropertyClick(label),
441
+ registry
442
+ }
443
+ ) })
444
+ ]
445
+ },
446
+ `${id}-key`
447
+ );
448
+ }
449
+ function ArrayFieldTitleTemplate({ title, uiSchema, required, idSchema }) {
450
+ const uiOptions = utils.getUiOptions(uiSchema);
451
+ return /* @__PURE__ */ jsxRuntime.jsxs("h5", { id: utils.titleId(idSchema), style: { margin: 0, fontSize: "1.5rem", marginBottom: "0.2rem" }, children: [
452
+ uiOptions.title || title,
453
+ " ",
454
+ required ? "*" : ""
455
+ ] });
456
+ }
457
+ var breakpoints = {
458
+ xs: 0,
459
+ sm: 576,
460
+ md: 768,
461
+ lg: 992,
462
+ xl: 1200
463
+ };
464
+ function getBreakpoint(width) {
465
+ if (width >= breakpoints.xl) {
466
+ return "xl";
467
+ }
468
+ if (width >= breakpoints.lg) {
469
+ return "lg";
470
+ }
471
+ if (width >= breakpoints.md) {
472
+ return "md";
473
+ }
474
+ if (width >= breakpoints.sm) {
475
+ return "sm";
476
+ }
477
+ return "xs";
478
+ }
479
+ function getResponsiveSpan(spanDef, breakpoint) {
480
+ return spanDef[breakpoint] ?? spanDef.xl ?? spanDef.lg ?? spanDef.md ?? spanDef.sm ?? spanDef.xs ?? 12;
481
+ }
482
+ function getInitialWidth() {
483
+ return typeof window !== "undefined" ? window.innerWidth : breakpoints.xs;
484
+ }
485
+ function GridTemplate(props) {
486
+ return props.column ? GridTemplateColumn(props) : GridTemplateRow(props);
487
+ }
488
+ function GridTemplateRow(props) {
489
+ const { children, column, uiSchema, style, ...rest } = props;
490
+ const layoutGrid = uiSchema?.["ui:layoutGrid"] ?? {};
491
+ const totalColumns = layoutGrid.columns ?? 12;
492
+ const gap = layoutGrid.gap ?? "16px";
493
+ return /* @__PURE__ */ jsxRuntime.jsx(
494
+ "div",
495
+ {
496
+ style: {
497
+ display: "grid",
498
+ gridTemplateColumns: `repeat(${totalColumns}, 1fr)`,
499
+ alignItems: "start",
500
+ gap,
501
+ ...style ?? {}
502
+ },
503
+ ...rest,
504
+ children
505
+ }
506
+ );
507
+ }
508
+ function GridTemplateColumn(props) {
509
+ const { children, column, uiSchema, xs, sm, md, lg, xl, style, ...rest } = props;
510
+ const [breakpoint, setBreakpoint] = react.useState(() => getBreakpoint(getInitialWidth()));
511
+ react.useEffect(() => {
512
+ if (typeof window === "undefined") {
513
+ return;
514
+ }
515
+ const handleResize = () => setBreakpoint(getBreakpoint(window.innerWidth));
516
+ window.addEventListener("resize", handleResize);
517
+ return () => window.removeEventListener("resize", handleResize);
518
+ }, []);
519
+ const span = getResponsiveSpan(props, breakpoint);
520
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { gridColumn: `span ${span} / span ${span}`, ...style ?? {} }, ...rest, children });
521
+ }
522
+
523
+ // src/Templates/Templates.ts
524
+ function generateTemplates() {
525
+ return {
526
+ ArrayFieldItemTemplate,
527
+ ArrayFieldTemplate,
528
+ ArrayFieldTitleTemplate,
529
+ BaseInputTemplate,
530
+ ButtonTemplates: {
531
+ AddButton,
532
+ CopyButton,
533
+ MoveDownButton,
534
+ MoveUpButton,
535
+ RemoveButton,
536
+ SubmitButton
537
+ },
538
+ DescriptionFieldTemplate: DescriptionField,
539
+ ErrorListTemplate: ErrorList,
540
+ FieldErrorTemplate,
541
+ FieldHelpTemplate,
542
+ FieldTemplate,
543
+ MultiSchemaFieldTemplate,
544
+ ObjectFieldTemplate,
545
+ TitleFieldTemplate: TitleField,
546
+ WrapIfAdditionalTemplate,
547
+ GridTemplate
548
+ };
549
+ }
550
+ var Templates_default = generateTemplates();
551
+ function AutoCompleteWidget(props) {
552
+ const {
553
+ id,
554
+ placeholder,
555
+ value,
556
+ required,
557
+ readonly,
558
+ disabled,
559
+ onChange,
560
+ onChangeOverride,
561
+ onBlur,
562
+ onFocus,
563
+ autofocus,
564
+ options,
565
+ schema,
566
+ type,
567
+ rawErrors = []
568
+ } = props;
569
+ const inputProps = utils.getInputProps(schema, type, options);
570
+ const primeProps = options.prime || {};
571
+ const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
572
+ const _onBlur = () => onBlur && onBlur(id, value);
573
+ const _onFocus = () => onFocus && onFocus(id, value);
574
+ const examples = schema.examples.concat(
575
+ schema.default && !schema.examples.includes(schema.default.toString()) ? [schema.default.toString()] : []
576
+ );
577
+ const [items, setItems] = react.useState([]);
578
+ const search = (event) => {
579
+ setItems(examples.filter((example) => example.toString().toLowerCase().includes(event.query.toLowerCase())));
580
+ };
581
+ return /* @__PURE__ */ jsxRuntime.jsx(
582
+ autocomplete.AutoComplete,
583
+ {
584
+ id,
585
+ name: id,
586
+ placeholder,
587
+ ...primeProps,
588
+ ...inputProps,
589
+ loadingIcon: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
590
+ required,
591
+ autoFocus: autofocus,
592
+ disabled: disabled || readonly,
593
+ suggestions: items,
594
+ completeMethod: search,
595
+ value: value || value === 0 ? value : "",
596
+ dropdown: true,
597
+ invalid: rawErrors.length > 0,
598
+ onChange: onChangeOverride || _onChange,
599
+ onBlur: _onBlur,
600
+ onFocus: _onFocus,
601
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples),
602
+ pt: {
603
+ root: {
604
+ className: "p-dropdown"
605
+ },
606
+ input: {
607
+ root: {
608
+ style: { border: "none" }
609
+ }
610
+ },
611
+ dropdownButton: {
612
+ root: {
613
+ className: "p-button-text p-button-secondary"
614
+ }
615
+ }
616
+ }
617
+ }
618
+ );
619
+ }
620
+ function CheckboxWidget(props) {
621
+ const {
622
+ id,
623
+ value,
624
+ disabled,
625
+ readonly,
626
+ label = "",
627
+ hideLabel,
628
+ autofocus,
629
+ onChange,
630
+ onBlur,
631
+ options,
632
+ onFocus,
633
+ schema,
634
+ uiSchema,
635
+ registry
636
+ } = props;
637
+ const DescriptionFieldTemplate = utils.getTemplate(
638
+ "DescriptionFieldTemplate",
639
+ registry,
640
+ options
641
+ );
642
+ const required = utils.schemaRequiresTrueValue(schema);
643
+ const _onChange = (e) => onChange && onChange(e.checked);
644
+ const _onBlur = () => onBlur && onBlur(id, value);
645
+ const _onFocus = () => onFocus && onFocus(id, value);
646
+ const checked = value === "true" || value === true;
647
+ const description = options.description ?? schema.description;
648
+ const primeProps = options.prime || {};
649
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
650
+ !hideLabel && !!description && /* @__PURE__ */ jsxRuntime.jsx(
651
+ DescriptionFieldTemplate,
652
+ {
653
+ id: utils.descriptionId(id),
654
+ description,
655
+ schema,
656
+ uiSchema,
657
+ registry
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "row", gap: "0.5rem", alignItems: "center" }, children: [
661
+ /* @__PURE__ */ jsxRuntime.jsx(
662
+ checkbox.Checkbox,
663
+ {
664
+ inputId: id,
665
+ name: id,
666
+ ...primeProps,
667
+ disabled: disabled || readonly,
668
+ autoFocus: autofocus,
669
+ checked: typeof value === "undefined" ? false : checked,
670
+ onChange: _onChange,
671
+ onBlur: _onBlur,
672
+ onFocus: _onFocus,
673
+ required,
674
+ "aria-describedby": utils.ariaDescribedByIds(id)
675
+ }
676
+ ),
677
+ utils.labelValue(/* @__PURE__ */ jsxRuntime.jsx(Label, { id, text: label }), hideLabel, false)
678
+ ] })
679
+ ] });
680
+ }
681
+ function CheckboxesWidget(props) {
682
+ const {
683
+ id,
684
+ disabled,
685
+ options,
686
+ value,
687
+ autofocus,
688
+ readonly,
689
+ onChange,
690
+ onBlur,
691
+ onFocus,
692
+ schema,
693
+ uiSchema,
694
+ registry,
695
+ hideLabel
696
+ } = props;
697
+ const { enumOptions, enumDisabled } = options;
698
+ const primeProps = options.prime || {};
699
+ const checkboxesValues = Array.isArray(value) ? value : [value];
700
+ const _onChange = (index) => (e) => {
701
+ if (e.checked) {
702
+ onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
703
+ } else {
704
+ onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
705
+ }
706
+ };
707
+ const DescriptionFieldTemplate = utils.getTemplate(
708
+ "DescriptionFieldTemplate",
709
+ registry,
710
+ options
711
+ );
712
+ const _onBlur = () => onBlur(id, value);
713
+ const _onFocus = () => onFocus(id, value);
714
+ const description = options.description ?? schema.description;
715
+ return /* @__PURE__ */ jsxRuntime.jsxs(
716
+ "div",
717
+ {
718
+ id,
719
+ style: { display: "flex", flexDirection: "column", gap: "1rem", marginTop: "0.5rem", marginBottom: "0.5rem" },
720
+ children: [
721
+ !hideLabel && !!description && /* @__PURE__ */ jsxRuntime.jsx(
722
+ DescriptionFieldTemplate,
723
+ {
724
+ id: utils.descriptionId(id),
725
+ description,
726
+ schema,
727
+ uiSchema,
728
+ registry
729
+ }
730
+ ),
731
+ Array.isArray(enumOptions) && enumOptions.map((option, index) => {
732
+ const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
733
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
734
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "row", gap: "0.5rem", alignItems: "center" }, children: [
735
+ /* @__PURE__ */ jsxRuntime.jsx(
736
+ checkbox.Checkbox,
737
+ {
738
+ inputId: utils.optionId(id, index),
739
+ name: id,
740
+ ...primeProps,
741
+ value: option.value,
742
+ checked,
743
+ disabled: disabled || itemDisabled || readonly,
744
+ autoFocus: autofocus && index === 0,
745
+ onChange: _onChange(index),
746
+ onBlur: _onBlur,
747
+ onFocus: _onFocus,
748
+ "aria-describedby": utils.ariaDescribedByIds(id)
749
+ }
750
+ ),
751
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { id: utils.optionId(id, index), text: option.label })
752
+ ] }, index);
753
+ })
754
+ ]
755
+ }
756
+ );
757
+ }
758
+ function ColorWidget(props) {
759
+ const {
760
+ id,
761
+ placeholder,
762
+ value,
763
+ required,
764
+ readonly,
765
+ disabled,
766
+ onChange,
767
+ onChangeOverride,
768
+ onBlur,
769
+ onFocus,
770
+ autofocus,
771
+ options,
772
+ schema,
773
+ type
774
+ } = props;
775
+ const inputProps = utils.getInputProps(schema, type, options);
776
+ const { inline } = options;
777
+ const primeProps = options.prime || {};
778
+ const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
779
+ const _onBlur = () => onBlur && onBlur(id, value);
780
+ const _onFocus = () => onFocus && onFocus(id, value);
781
+ return /* @__PURE__ */ jsxRuntime.jsx(
782
+ colorpicker.ColorPicker,
783
+ {
784
+ id,
785
+ name: id,
786
+ placeholder,
787
+ ...primeProps,
788
+ ...inputProps,
789
+ required,
790
+ inline,
791
+ autoFocus: autofocus,
792
+ disabled: disabled || readonly,
793
+ value: value || "",
794
+ onChange: onChangeOverride || _onChange,
795
+ onBlur: _onBlur,
796
+ onFocus: _onFocus,
797
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
798
+ }
799
+ );
800
+ }
801
+ function PasswordWidget(props) {
802
+ const {
803
+ id,
804
+ placeholder,
805
+ value,
806
+ required,
807
+ readonly,
808
+ disabled,
809
+ onChange,
810
+ onChangeOverride,
811
+ onBlur,
812
+ onFocus,
813
+ autofocus,
814
+ options,
815
+ schema,
816
+ type,
817
+ rawErrors = []
818
+ } = props;
819
+ const inputProps = utils.getInputProps(schema, type, options);
820
+ const primeProps = options.prime || {};
821
+ const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
822
+ const _onBlur = () => onBlur && onBlur(id, value);
823
+ const _onFocus = () => onFocus && onFocus(id, value);
824
+ return /* @__PURE__ */ jsxRuntime.jsx(
825
+ password.Password,
826
+ {
827
+ id,
828
+ name: id,
829
+ placeholder,
830
+ ...primeProps,
831
+ ...inputProps,
832
+ required,
833
+ autoFocus: autofocus,
834
+ disabled: disabled || readonly,
835
+ value: value || "",
836
+ invalid: rawErrors.length > 0,
837
+ onChange: onChangeOverride || _onChange,
838
+ onBlur: _onBlur,
839
+ onFocus: _onFocus,
840
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples),
841
+ pt: { root: { style: { display: "flex", flexDirection: "column" } } }
842
+ }
843
+ );
844
+ }
845
+ function RadioWidget(props) {
846
+ const { id, value, disabled, readonly, onChange, onBlur, onFocus, options } = props;
847
+ const primeProps = options.prime || {};
848
+ const { enumOptions, enumDisabled, emptyValue } = options;
849
+ const _onChange = (e) => {
850
+ onChange(utils.enumOptionsValueForIndex(e.value, enumOptions, emptyValue));
851
+ };
852
+ const _onBlur = () => onBlur(id, value);
853
+ const _onFocus = () => onFocus(id, value);
854
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "row", gap: "1rem" }, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
855
+ const checked = utils.enumOptionsIsSelected(option.value, value);
856
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
857
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
858
+ /* @__PURE__ */ jsxRuntime.jsx(
859
+ radiobutton.RadioButton,
860
+ {
861
+ inputId: utils.optionId(id, index),
862
+ name: id,
863
+ ...primeProps,
864
+ onFocus: _onFocus,
865
+ onBlur: _onBlur,
866
+ onChange: _onChange,
867
+ value: String(index),
868
+ checked,
869
+ disabled: disabled || itemDisabled || readonly,
870
+ "aria-describedby": utils.ariaDescribedByIds(id)
871
+ }
872
+ ),
873
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: utils.optionId(id, index), style: { marginLeft: "8px" }, children: option.label })
874
+ ] }, index);
875
+ }) });
876
+ }
877
+ function RangeWidget(props) {
878
+ const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, id } = props;
879
+ const primeProps = options.prime || {};
880
+ const sliderProps = { value, id, ...utils.rangeSpec(schema) };
881
+ const _onChange = (e) => {
882
+ onChange(e.value ?? options.emptyValue);
883
+ };
884
+ const _onBlur = ({ target }) => onBlur(id, target && target.value);
885
+ const _onFocus = ({ target }) => onFocus(id, target && target.value);
886
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
887
+ slider.Slider,
888
+ {
889
+ ...primeProps,
890
+ disabled: disabled || readonly,
891
+ onMouseDown: (e) => e.stopPropagation(),
892
+ onChange: _onChange,
893
+ onBlur: _onBlur,
894
+ onFocus: _onFocus,
895
+ ...sliderProps,
896
+ "aria-describedby": utils.ariaDescribedByIds(id)
897
+ }
898
+ ) });
899
+ }
900
+ function SelectWidget(props) {
901
+ const { multiple = false } = props;
902
+ return multiple ? /* @__PURE__ */ jsxRuntime.jsx(MultiSelectWidget, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(SingleSelectWidget, { ...props });
903
+ }
904
+ function SingleSelectWidget({
905
+ schema,
906
+ id,
907
+ name,
908
+ // remove this from dropdownProps
909
+ options,
910
+ label,
911
+ hideLabel,
912
+ required,
913
+ disabled,
914
+ placeholder,
915
+ readonly,
916
+ value,
917
+ multiple,
918
+ autofocus,
919
+ onChange,
920
+ onBlur,
921
+ onFocus,
922
+ errorSchema,
923
+ rawErrors = [],
924
+ registry,
925
+ uiSchema,
926
+ hideError,
927
+ formContext,
928
+ ...dropdownProps
929
+ }) {
930
+ const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
931
+ const primeProps = options.prime || {};
932
+ multiple = typeof multiple === "undefined" ? false : multiple;
933
+ const emptyValue = multiple ? [] : "";
934
+ const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
935
+ const _onChange = (e) => onChange(utils.enumOptionsValueForIndex(e.value, enumOptions, optEmptyVal));
936
+ const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, optEmptyVal));
937
+ const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, optEmptyVal));
938
+ const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
939
+ const { ...dropdownRemainingProps } = dropdownProps;
940
+ return /* @__PURE__ */ jsxRuntime.jsx(
941
+ dropdown.Dropdown,
942
+ {
943
+ id,
944
+ name: id,
945
+ ...primeProps,
946
+ value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
947
+ options: (enumOptions ?? []).map(({ value: value2, label: label2 }, i) => ({
948
+ label: label2,
949
+ value: String(i),
950
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
951
+ })),
952
+ onChange: _onChange,
953
+ onBlur: _onBlur,
954
+ onFocus: _onFocus,
955
+ placeholder,
956
+ disabled: disabled || readonly,
957
+ autoFocus: autofocus,
958
+ "aria-describedby": utils.ariaDescribedByIds(id),
959
+ ...dropdownRemainingProps
960
+ }
961
+ );
962
+ }
963
+ function MultiSelectWidget({
964
+ id,
965
+ options,
966
+ disabled,
967
+ placeholder,
968
+ readonly,
969
+ value,
970
+ multiple = false,
971
+ autofocus,
972
+ onChange,
973
+ onBlur,
974
+ onFocus
975
+ }) {
976
+ const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
977
+ const primeProps = options.prime || {};
978
+ const emptyValue = multiple ? [] : "";
979
+ const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
980
+ const _onChange = (e) => onChange(utils.enumOptionsValueForIndex(e.value, enumOptions, optEmptyVal));
981
+ const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, optEmptyVal));
982
+ const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, optEmptyVal));
983
+ const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
984
+ return /* @__PURE__ */ jsxRuntime.jsx(
985
+ multiselect.MultiSelect,
986
+ {
987
+ id,
988
+ name: id,
989
+ ...primeProps,
990
+ value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
991
+ options: (enumOptions ?? []).map(({ value: value2, label }, i) => ({
992
+ label,
993
+ value: String(i),
994
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
995
+ })),
996
+ onChange: _onChange,
997
+ onBlur: _onBlur,
998
+ onFocus: _onFocus,
999
+ placeholder,
1000
+ disabled: disabled || readonly,
1001
+ autoFocus: autofocus,
1002
+ display: options.display === "chip" ? "chip" : "comma",
1003
+ "aria-describedby": utils.ariaDescribedByIds(id),
1004
+ pt: { root: { style: { position: "relative" } } }
1005
+ }
1006
+ );
1007
+ }
1008
+ function TextareaWidget(props) {
1009
+ const { id, value, required, disabled, readonly, autofocus, onChange, onBlur, onFocus, options } = props;
1010
+ const primeProps = options.prime || {};
1011
+ let rows = 5;
1012
+ if (typeof options.rows === "string" || typeof options.rows === "number") {
1013
+ rows = Number(options.rows);
1014
+ }
1015
+ const handleChange = (event) => {
1016
+ onChange(event.target.value === "" ? options.emptyValue : event.target.value);
1017
+ };
1018
+ return /* @__PURE__ */ jsxRuntime.jsx(
1019
+ inputtextarea.InputTextarea,
1020
+ {
1021
+ id,
1022
+ ...primeProps,
1023
+ value: value || "",
1024
+ required,
1025
+ disabled: disabled || readonly,
1026
+ autoFocus: autofocus,
1027
+ rows,
1028
+ onChange: handleChange,
1029
+ onBlur: onBlur && ((event) => onBlur(id, event.target.value)),
1030
+ onFocus: onFocus && ((event) => onFocus(id, event.target.value))
1031
+ }
1032
+ );
1033
+ }
1034
+ function UpDownWidget(props) {
1035
+ const {
1036
+ id,
1037
+ placeholder,
1038
+ value,
1039
+ required,
1040
+ readonly,
1041
+ disabled,
1042
+ onChange,
1043
+ onChangeOverride,
1044
+ onBlur,
1045
+ onFocus,
1046
+ autofocus,
1047
+ options,
1048
+ schema,
1049
+ type,
1050
+ rawErrors = []
1051
+ } = props;
1052
+ const inputProps = utils.getInputProps(schema, type, options);
1053
+ const { showButtons, buttonLayout, useGrouping, minFractionDigits, maxFractionDigits, locale, currency } = options;
1054
+ const primeProps = options.prime || {};
1055
+ const _onChange = (event) => onChange(event.value === null ? options.emptyValue : value);
1056
+ const _onBlur = () => onBlur && onBlur(id, value);
1057
+ const _onFocus = () => onFocus && onFocus(id, value);
1058
+ return /* @__PURE__ */ jsxRuntime.jsx(
1059
+ inputnumber.InputNumber,
1060
+ {
1061
+ id,
1062
+ name: id,
1063
+ ...primeProps,
1064
+ placeholder,
1065
+ step: isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step),
1066
+ required,
1067
+ autoFocus: autofocus,
1068
+ disabled: disabled || readonly,
1069
+ style: buttonLayout === "vertical" ? { width: "4em" } : {},
1070
+ showButtons: typeof showButtons === "undefined" ? true : !!showButtons,
1071
+ buttonLayout: buttonLayout ?? "stacked",
1072
+ useGrouping: !!useGrouping,
1073
+ minFractionDigits,
1074
+ maxFractionDigits,
1075
+ locale,
1076
+ mode: currency ? "currency" : "decimal",
1077
+ currency,
1078
+ value: isNaN(Number(value)) ? null : Number(value),
1079
+ invalid: rawErrors.length > 0,
1080
+ onChange: onChangeOverride || _onChange,
1081
+ onBlur: _onBlur,
1082
+ onFocus: _onFocus,
1083
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
1084
+ }
1085
+ );
1086
+ }
1087
+
1088
+ // src/Widgets/Widgets.tsx
1089
+ function generateWidgets() {
1090
+ return {
1091
+ AutoCompleteWidget,
1092
+ CheckboxWidget,
1093
+ CheckboxesWidget,
1094
+ ColorWidget,
1095
+ PasswordWidget,
1096
+ RadioWidget,
1097
+ RangeWidget,
1098
+ SelectWidget,
1099
+ TextareaWidget,
1100
+ UpDownWidget
1101
+ };
1102
+ }
1103
+ var Widgets_default = generateWidgets();
1104
+
1105
+ // src/Theme/Theme.ts
1106
+ function generateTheme() {
1107
+ return {
1108
+ templates: generateTemplates(),
1109
+ widgets: generateWidgets()
1110
+ };
1111
+ }
1112
+ var Theme_default = generateTheme();
1113
+
1114
+ // src/PrimeForm/PrimeForm.ts
1115
+ function generateForm() {
1116
+ return core.withTheme(generateTheme());
1117
+ }
1118
+ var PrimeForm_default = generateForm();
1119
+
1120
+ // src/index.ts
1121
+ var index_default = PrimeForm_default;
1122
+
1123
+ exports.Form = PrimeForm_default;
1124
+ exports.Templates = Templates_default;
1125
+ exports.Theme = Theme_default;
1126
+ exports.Widgets = Widgets_default;
1127
+ exports.default = index_default;
1128
+ exports.generateForm = generateForm;
1129
+ exports.generateTemplates = generateTemplates;
1130
+ exports.generateTheme = generateTheme;
1131
+ exports.generateWidgets = generateWidgets;
1132
+
1133
+ Object.defineProperty(exports, '__esModule', { value: true });
1134
+
1135
+ }));