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