@uxf/form 11.72.3 → 11.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +3 -1
  2. package/package.json +4 -2
  3. package/translations/translations.d.ts +389 -0
  4. package/translations/translations.js +55 -0
  5. package/_code-generator/form-code-generator.d.ts +0 -16
  6. package/_code-generator/form-code-generator.js +0 -69
  7. package/avatar-file-input/avatar-file-input.d.ts +0 -14
  8. package/avatar-file-input/avatar-file-input.js +0 -38
  9. package/avatar-file-input/avatar-file-input.stories.d.ts +0 -8
  10. package/avatar-file-input/avatar-file-input.stories.js +0 -23
  11. package/avatar-file-input/index.d.ts +0 -1
  12. package/avatar-file-input/index.js +0 -17
  13. package/bin/form-code-generator.d.ts +0 -2
  14. package/bin/form-code-generator.js +0 -55
  15. package/checkbox-button/checkbox-button.d.ts +0 -14
  16. package/checkbox-button/checkbox-button.js +0 -38
  17. package/checkbox-button/checkbox-button.stories.d.ts +0 -8
  18. package/checkbox-button/checkbox-button.stories.js +0 -24
  19. package/checkbox-button/index.d.ts +0 -1
  20. package/checkbox-button/index.js +0 -17
  21. package/checkbox-input/checkbox-input.d.ts +0 -14
  22. package/checkbox-input/checkbox-input.js +0 -38
  23. package/checkbox-input/checkbox-input.stories.d.ts +0 -8
  24. package/checkbox-input/checkbox-input.stories.js +0 -24
  25. package/checkbox-input/index.d.ts +0 -1
  26. package/checkbox-input/index.js +0 -17
  27. package/checkbox-list/checkbox-list.d.ts +0 -19
  28. package/checkbox-list/checkbox-list.js +0 -36
  29. package/checkbox-list/checkbox-list.stories.d.ts +0 -2
  30. package/checkbox-list/checkbox-list.stories.js +0 -22
  31. package/checkbox-list/index.d.ts +0 -1
  32. package/checkbox-list/index.js +0 -17
  33. package/color-radio-group/color-radio-group.d.ts +0 -13
  34. package/color-radio-group/color-radio-group.js +0 -38
  35. package/color-radio-group/color-radio-group.stories.d.ts +0 -8
  36. package/color-radio-group/color-radio-group.stories.js +0 -62
  37. package/color-radio-group/index.d.ts +0 -1
  38. package/color-radio-group/index.js +0 -17
  39. package/combobox/combobox.d.ts +0 -13
  40. package/combobox/combobox.js +0 -44
  41. package/combobox/combobox.stories.d.ts +0 -8
  42. package/combobox/combobox.stories.js +0 -30
  43. package/combobox/index.d.ts +0 -1
  44. package/combobox/index.js +0 -17
  45. package/components.d.ts +0 -127
  46. package/components.js +0 -154
  47. package/date-picker-input/date-picker-input.d.ts +0 -15
  48. package/date-picker-input/date-picker-input.js +0 -89
  49. package/date-picker-input/date-picker-input.stories.d.ts +0 -8
  50. package/date-picker-input/date-picker-input.stories.js +0 -31
  51. package/date-picker-input/index.d.ts +0 -1
  52. package/date-picker-input/index.js +0 -17
  53. package/date-range-picker-input/date-range-picker-input.d.ts +0 -12
  54. package/date-range-picker-input/date-range-picker-input.js +0 -106
  55. package/date-range-picker-input/date-range-picker-input.stories.d.ts +0 -8
  56. package/date-range-picker-input/date-range-picker-input.stories.js +0 -25
  57. package/date-range-picker-input/index.d.ts +0 -1
  58. package/date-range-picker-input/index.js +0 -17
  59. package/datetime-picker-input/datetime-picker-input.d.ts +0 -15
  60. package/datetime-picker-input/datetime-picker-input.js +0 -90
  61. package/datetime-picker-input/datetime-picker-input.stories.d.ts +0 -2
  62. package/datetime-picker-input/datetime-picker-input.stories.js +0 -28
  63. package/datetime-picker-input/index.d.ts +0 -1
  64. package/datetime-picker-input/index.js +0 -17
  65. package/dropzone/dropzone-input.d.ts +0 -13
  66. package/dropzone/dropzone-input.js +0 -59
  67. package/dropzone/dropzone-list.d.ts +0 -11
  68. package/dropzone/dropzone-list.js +0 -23
  69. package/dropzone/dropzone.stories.d.ts +0 -2
  70. package/dropzone/dropzone.stories.js +0 -50
  71. package/dropzone/index.d.ts +0 -9
  72. package/dropzone/index.js +0 -6
  73. package/file-input/file-input.d.ts +0 -14
  74. package/file-input/file-input.js +0 -38
  75. package/file-input/file-input.stories.d.ts +0 -8
  76. package/file-input/file-input.stories.js +0 -31
  77. package/file-input/index.d.ts +0 -1
  78. package/file-input/index.js +0 -17
  79. package/form/form.d.ts +0 -19
  80. package/form/form.js +0 -25
  81. package/form/form.stories.d.ts +0 -8
  82. package/form/form.stories.js +0 -24
  83. package/form/index.d.ts +0 -1
  84. package/form/index.js +0 -17
  85. package/form-id-context/form-context.d.ts +0 -7
  86. package/form-id-context/form-context.js +0 -12
  87. package/form-id-context/form-id-context.d.ts +0 -2
  88. package/form-id-context/form-id-context.js +0 -7
  89. package/form-id-context/index.d.ts +0 -1
  90. package/form-id-context/index.js +0 -17
  91. package/form-renderer/big-test-schema.d.ts +0 -33
  92. package/form-renderer/big-test-schema.js +0 -295
  93. package/form-renderer/field/base-field.d.ts +0 -4
  94. package/form-renderer/field/base-field.js +0 -70
  95. package/form-renderer/field/embedded.d.ts +0 -4
  96. package/form-renderer/field/embedded.js +0 -19
  97. package/form-renderer/field/one-to-many.d.ts +0 -4
  98. package/form-renderer/field/one-to-many.js +0 -50
  99. package/form-renderer/form-renderer.d.ts +0 -16
  100. package/form-renderer/form-renderer.js +0 -26
  101. package/form-renderer/form-renderer.stories.d.ts +0 -2
  102. package/form-renderer/form-renderer.stories.js +0 -23
  103. package/form-renderer/index.d.ts +0 -2
  104. package/form-renderer/index.js +0 -18
  105. package/form-renderer/mapper.d.ts +0 -2
  106. package/form-renderer/mapper.js +0 -30
  107. package/form-renderer/types.d.ts +0 -39
  108. package/form-renderer/types.js +0 -2
  109. package/gps-input/gps-input.d.ts +0 -20
  110. package/gps-input/gps-input.js +0 -154
  111. package/gps-input/gps-input.stories.d.ts +0 -8
  112. package/gps-input/gps-input.stories.js +0 -22
  113. package/gps-input/index.d.ts +0 -1
  114. package/gps-input/index.js +0 -17
  115. package/money-input/index.d.ts +0 -1
  116. package/money-input/index.js +0 -17
  117. package/money-input/money-input.d.ts +0 -24
  118. package/money-input/money-input.js +0 -108
  119. package/money-input/money-input.stories.d.ts +0 -2
  120. package/money-input/money-input.stories.js +0 -15
  121. package/multi-combobox/index.d.ts +0 -1
  122. package/multi-combobox/index.js +0 -17
  123. package/multi-combobox/multi-combobox.d.ts +0 -13
  124. package/multi-combobox/multi-combobox.js +0 -44
  125. package/multi-combobox/multi-combobox.stories.d.ts +0 -8
  126. package/multi-combobox/multi-combobox.stories.js +0 -54
  127. package/multi-select/index.d.ts +0 -1
  128. package/multi-select/index.js +0 -17
  129. package/multi-select/multi-select.d.ts +0 -13
  130. package/multi-select/multi-select.js +0 -39
  131. package/multi-select/multi-select.stories.d.ts +0 -8
  132. package/multi-select/multi-select.stories.js +0 -47
  133. package/number-input/index.d.ts +0 -1
  134. package/number-input/index.js +0 -17
  135. package/number-input/number-input.d.ts +0 -17
  136. package/number-input/number-input.js +0 -72
  137. package/number-input/number-input.stories.d.ts +0 -8
  138. package/number-input/number-input.stories.js +0 -24
  139. package/password-input/index.d.ts +0 -1
  140. package/password-input/index.js +0 -17
  141. package/password-input/password-input.d.ts +0 -15
  142. package/password-input/password-input.js +0 -93
  143. package/password-input/password-input.stories.d.ts +0 -8
  144. package/password-input/password-input.stories.js +0 -23
  145. package/radio-group/index.d.ts +0 -1
  146. package/radio-group/index.js +0 -17
  147. package/radio-group/radio-group.d.ts +0 -13
  148. package/radio-group/radio-group.js +0 -38
  149. package/radio-group/radio-group.stories.d.ts +0 -8
  150. package/radio-group/radio-group.stories.js +0 -38
  151. package/readmes.d.ts +0 -28
  152. package/readmes.js +0 -59
  153. package/select/index.d.ts +0 -1
  154. package/select/index.js +0 -17
  155. package/select/select.d.ts +0 -13
  156. package/select/select.js +0 -39
  157. package/select/select.stories.d.ts +0 -8
  158. package/select/select.stories.js +0 -44
  159. package/storybook/form-data-printer.d.ts +0 -6
  160. package/storybook/form-data-printer.js +0 -12
  161. package/storybook/storybook-form.d.ts +0 -8
  162. package/storybook/storybook-form.js +0 -42
  163. package/text-input/index.d.ts +0 -1
  164. package/text-input/index.js +0 -17
  165. package/text-input/text-input.d.ts +0 -33
  166. package/text-input/text-input.js +0 -57
  167. package/text-input/text-input.stories.d.ts +0 -8
  168. package/text-input/text-input.stories.js +0 -26
  169. package/textarea/index.d.ts +0 -1
  170. package/textarea/index.js +0 -17
  171. package/textarea/textarea.d.ts +0 -13
  172. package/textarea/textarea.js +0 -58
  173. package/textarea/textarea.stories.d.ts +0 -8
  174. package/textarea/textarea.stories.js +0 -22
  175. package/time-picker-input/index.d.ts +0 -1
  176. package/time-picker-input/index.js +0 -17
  177. package/time-picker-input/time-picker-input.d.ts +0 -14
  178. package/time-picker-input/time-picker-input.js +0 -77
  179. package/time-picker-input/time-picker-input.stories.d.ts +0 -8
  180. package/time-picker-input/time-picker-input.stories.js +0 -25
  181. package/toggle/index.d.ts +0 -1
  182. package/toggle/index.js +0 -17
  183. package/toggle/toggle.d.ts +0 -14
  184. package/toggle/toggle.js +0 -38
  185. package/toggle/toggle.stories.d.ts +0 -8
  186. package/toggle/toggle.stories.js +0 -23
  187. package/types.d.ts +0 -4
  188. package/types.js +0 -2
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # @uxf/form
2
2
 
3
+ > **Note:** This package contains translations. For proper functionality, you must use the `TranslationsProvider` from `@uxf/core-react/translations`. See the [core-react documentation](https://fe.uxf.dev/docs/core-react) for more information.
4
+
3
5
  ## [Documentation](https://ui.uxf.dev)
4
6
 
5
7
  ## How to install
6
8
 
7
9
  ```bash
8
10
  yarn add @uxf/form
9
- ```
11
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/form",
3
- "version": "11.72.3",
3
+ "version": "11.74.0",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,7 +16,9 @@
16
16
  },
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@uxf/ui": "11.72.3",
19
+ "@uxf/core": "11.72.3",
20
+ "@uxf/core-react": "11.74.0",
21
+ "@uxf/ui": "11.74.0",
20
22
  "coordinate-parser": "1.0.7",
21
23
  "dayjs": "1.11.13",
22
24
  "react-hook-form": "7.53.0"
@@ -0,0 +1,389 @@
1
+ declare const _default: {
2
+ "uxf-form-toggle": {
3
+ validation: {
4
+ required: {
5
+ cs: string;
6
+ en: string;
7
+ sk: string;
8
+ de: string;
9
+ };
10
+ };
11
+ };
12
+ "uxf-form-time-picker-input": {
13
+ validation: {
14
+ required: {
15
+ cs: string;
16
+ en: string;
17
+ sk: string;
18
+ de: string;
19
+ };
20
+ "invalid-time-format": {
21
+ cs: string;
22
+ en: string;
23
+ sk: string;
24
+ de: string;
25
+ };
26
+ };
27
+ };
28
+ "uxf-form-textarea": {
29
+ validation: {
30
+ required: {
31
+ cs: string;
32
+ en: string;
33
+ sk: string;
34
+ de: string;
35
+ };
36
+ };
37
+ };
38
+ "uxf-form-text-input": {
39
+ validation: {
40
+ required: {
41
+ cs: string;
42
+ en: string;
43
+ sk: string;
44
+ de: string;
45
+ };
46
+ "invalid-email": {
47
+ cs: string;
48
+ en: string;
49
+ sk: string;
50
+ de: string;
51
+ };
52
+ "invalid-phone": {
53
+ cs: string;
54
+ en: string;
55
+ sk: string;
56
+ de: string;
57
+ };
58
+ "invalid-url": {
59
+ cs: string;
60
+ en: string;
61
+ sk: string;
62
+ de: string;
63
+ };
64
+ };
65
+ };
66
+ "uxf-form-select": {
67
+ validation: {
68
+ required: {
69
+ cs: string;
70
+ en: string;
71
+ sk: string;
72
+ de: string;
73
+ };
74
+ };
75
+ };
76
+ "uxf-form-radio-group": {
77
+ validation: {
78
+ required: {
79
+ cs: string;
80
+ en: string;
81
+ sk: string;
82
+ de: string;
83
+ };
84
+ };
85
+ };
86
+ "uxf-form-password-input": {
87
+ validation: {
88
+ required: {
89
+ cs: string;
90
+ en: string;
91
+ sk: string;
92
+ de: string;
93
+ };
94
+ "min-length": {
95
+ cs: string;
96
+ en: string;
97
+ sk: string;
98
+ de: string;
99
+ };
100
+ };
101
+ };
102
+ "uxf-form-number-input": {
103
+ validation: {
104
+ required: {
105
+ cs: string;
106
+ en: string;
107
+ sk: string;
108
+ de: string;
109
+ };
110
+ "max-value": {
111
+ cs: string;
112
+ en: string;
113
+ sk: string;
114
+ de: string;
115
+ };
116
+ "min-value": {
117
+ cs: string;
118
+ en: string;
119
+ sk: string;
120
+ de: string;
121
+ };
122
+ };
123
+ };
124
+ "uxf-form-multi-select": {
125
+ validation: {
126
+ required: {
127
+ cs: string;
128
+ en: string;
129
+ sk: string;
130
+ de: string;
131
+ };
132
+ };
133
+ };
134
+ "uxf-form-multi-combobox": {
135
+ validation: {
136
+ required: {
137
+ cs: string;
138
+ en: string;
139
+ sk: string;
140
+ de: string;
141
+ };
142
+ };
143
+ };
144
+ "uxf-form-money-input": {
145
+ validation: {
146
+ required: {
147
+ cs: string;
148
+ en: string;
149
+ sk: string;
150
+ de: string;
151
+ };
152
+ };
153
+ };
154
+ "uxf-form-gps-input": {
155
+ validation: {
156
+ "supported-formats": {
157
+ cs: string;
158
+ en: string;
159
+ sk: string;
160
+ de: string;
161
+ };
162
+ required: {
163
+ cs: string;
164
+ en: string;
165
+ sk: string;
166
+ de: string;
167
+ };
168
+ "empty-coordinates": {
169
+ cs: string;
170
+ en: string;
171
+ sk: string;
172
+ de: string;
173
+ };
174
+ "invalid-coordinates": {
175
+ cs: string;
176
+ en: string;
177
+ sk: string;
178
+ de: string;
179
+ };
180
+ };
181
+ };
182
+ "uxf-form-form-renderer": {
183
+ "file-upload-error": {
184
+ cs: string;
185
+ en: string;
186
+ sk: string;
187
+ de: string;
188
+ };
189
+ "submit-button": {
190
+ cs: string;
191
+ en: string;
192
+ sk: string;
193
+ de: string;
194
+ };
195
+ fields: {
196
+ "one-to-many": {
197
+ "delete-item": {
198
+ cs: string;
199
+ en: string;
200
+ sk: string;
201
+ de: string;
202
+ };
203
+ "add-item": {
204
+ cs: string;
205
+ en: string;
206
+ sk: string;
207
+ de: string;
208
+ };
209
+ };
210
+ };
211
+ };
212
+ "uxf-form-file-input": {
213
+ validation: {
214
+ required: {
215
+ cs: string;
216
+ en: string;
217
+ sk: string;
218
+ de: string;
219
+ };
220
+ };
221
+ };
222
+ "uxf-form-dropzone": {
223
+ validation: {
224
+ required: {
225
+ cs: string;
226
+ en: string;
227
+ sk: string;
228
+ de: string;
229
+ };
230
+ "max-files-count": {
231
+ cs: string;
232
+ en: string;
233
+ sk: string;
234
+ de: string;
235
+ };
236
+ "min-files-count": {
237
+ cs: string;
238
+ en: string;
239
+ sk: string;
240
+ de: string;
241
+ };
242
+ "upload-not-completed": {
243
+ cs: string;
244
+ en: string;
245
+ sk: string;
246
+ de: string;
247
+ };
248
+ };
249
+ };
250
+ "uxf-form-datetime-picker-input": {
251
+ validation: {
252
+ required: {
253
+ cs: string;
254
+ en: string;
255
+ sk: string;
256
+ de: string;
257
+ };
258
+ "invalid-datetime-format": {
259
+ cs: string;
260
+ en: string;
261
+ sk: string;
262
+ de: string;
263
+ };
264
+ "min-date": {
265
+ cs: string;
266
+ en: string;
267
+ sk: string;
268
+ de: string;
269
+ };
270
+ "max-date": {
271
+ cs: string;
272
+ en: string;
273
+ sk: string;
274
+ de: string;
275
+ };
276
+ };
277
+ };
278
+ "uxf-form-date-range-picker-input": {
279
+ validation: {
280
+ required: {
281
+ cs: string;
282
+ en: string;
283
+ sk: string;
284
+ de: string;
285
+ };
286
+ "invalid-date-range-format": {
287
+ cs: string;
288
+ en: string;
289
+ sk: string;
290
+ de: string;
291
+ };
292
+ "invalid-date-range-order": {
293
+ cs: string;
294
+ en: string;
295
+ sk: string;
296
+ de: string;
297
+ };
298
+ };
299
+ };
300
+ "uxf-form-date-picker-input": {
301
+ validation: {
302
+ required: {
303
+ cs: string;
304
+ en: string;
305
+ sk: string;
306
+ de: string;
307
+ };
308
+ "invalid-date-format": {
309
+ cs: string;
310
+ en: string;
311
+ sk: string;
312
+ de: string;
313
+ };
314
+ "min-date": {
315
+ cs: string;
316
+ en: string;
317
+ sk: string;
318
+ de: string;
319
+ };
320
+ "max-date": {
321
+ cs: string;
322
+ en: string;
323
+ sk: string;
324
+ de: string;
325
+ };
326
+ };
327
+ };
328
+ "uxf-form-combobox": {
329
+ validation: {
330
+ required: {
331
+ cs: string;
332
+ en: string;
333
+ sk: string;
334
+ de: string;
335
+ };
336
+ };
337
+ };
338
+ "uxf-form-color-radio-group": {
339
+ validation: {
340
+ required: {
341
+ cs: string;
342
+ en: string;
343
+ sk: string;
344
+ de: string;
345
+ };
346
+ };
347
+ };
348
+ "uxf-form-checkbox-list": {
349
+ validation: {
350
+ required: {
351
+ cs: string;
352
+ en: string;
353
+ sk: string;
354
+ de: string;
355
+ };
356
+ };
357
+ };
358
+ "uxf-form-checkbox-input": {
359
+ validation: {
360
+ required: {
361
+ cs: string;
362
+ en: string;
363
+ sk: string;
364
+ de: string;
365
+ };
366
+ };
367
+ };
368
+ "uxf-form-checkbox-button": {
369
+ validation: {
370
+ required: {
371
+ cs: string;
372
+ en: string;
373
+ sk: string;
374
+ de: string;
375
+ };
376
+ };
377
+ };
378
+ "uxf-form-avatar-file-input": {
379
+ validation: {
380
+ required: {
381
+ cs: string;
382
+ en: string;
383
+ sk: string;
384
+ de: string;
385
+ };
386
+ };
387
+ };
388
+ };
389
+ export default _default;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const translations_1 = __importDefault(require("@uxf/form/avatar-file-input/translations"));
7
+ const translations_2 = __importDefault(require("@uxf/form/checkbox-button/translations"));
8
+ const translations_3 = __importDefault(require("@uxf/form/checkbox-input/translations"));
9
+ const translations_4 = __importDefault(require("@uxf/form/checkbox-list/translations"));
10
+ const translations_5 = __importDefault(require("@uxf/form/color-radio-group/translations"));
11
+ const translations_6 = __importDefault(require("@uxf/form/combobox/translations"));
12
+ const translations_7 = __importDefault(require("@uxf/form/date-picker-input/translations"));
13
+ const translations_8 = __importDefault(require("@uxf/form/date-range-picker-input/translations"));
14
+ const translations_9 = __importDefault(require("@uxf/form/datetime-picker-input/translations"));
15
+ const translations_10 = __importDefault(require("@uxf/form/dropzone/translations"));
16
+ const translations_11 = __importDefault(require("@uxf/form/file-input/translations"));
17
+ const translations_12 = __importDefault(require("@uxf/form/form-renderer/translations"));
18
+ const translations_13 = __importDefault(require("@uxf/form/gps-input/translations"));
19
+ const translations_14 = __importDefault(require("@uxf/form/money-input/translations"));
20
+ const translations_15 = __importDefault(require("@uxf/form/multi-combobox/translations"));
21
+ const translations_16 = __importDefault(require("@uxf/form/multi-select/translations"));
22
+ const translations_17 = __importDefault(require("@uxf/form/number-input/translations"));
23
+ const translations_18 = __importDefault(require("@uxf/form/password-input/translations"));
24
+ const translations_19 = __importDefault(require("@uxf/form/radio-group/translations"));
25
+ const translations_20 = __importDefault(require("@uxf/form/select/translations"));
26
+ const translations_21 = __importDefault(require("@uxf/form/text-input/translations"));
27
+ const translations_22 = __importDefault(require("@uxf/form/textarea/translations"));
28
+ const translations_23 = __importDefault(require("@uxf/form/time-picker-input/translations"));
29
+ const translations_24 = __importDefault(require("@uxf/form/toggle/translations"));
30
+ exports.default = {
31
+ ...translations_1.default,
32
+ ...translations_2.default,
33
+ ...translations_3.default,
34
+ ...translations_4.default,
35
+ ...translations_5.default,
36
+ ...translations_6.default,
37
+ ...translations_7.default,
38
+ ...translations_8.default,
39
+ ...translations_9.default,
40
+ ...translations_10.default,
41
+ ...translations_11.default,
42
+ ...translations_12.default,
43
+ ...translations_13.default,
44
+ ...translations_14.default,
45
+ ...translations_15.default,
46
+ ...translations_16.default,
47
+ ...translations_17.default,
48
+ ...translations_18.default,
49
+ ...translations_19.default,
50
+ ...translations_20.default,
51
+ ...translations_21.default,
52
+ ...translations_22.default,
53
+ ...translations_23.default,
54
+ ...translations_24.default,
55
+ };
@@ -1,16 +0,0 @@
1
- import { components } from "../components";
2
- export interface FieldDefinition {
3
- type: keyof typeof components;
4
- name: string;
5
- label: string;
6
- isRequired?: boolean;
7
- }
8
- export declare class FormCodeGenerator {
9
- private formName;
10
- private fields;
11
- constructor(formName: string);
12
- getFieldsCount(): number;
13
- add(field: FieldDefinition): this;
14
- generateComponent(field: FieldDefinition): string | null;
15
- generate(): string;
16
- }
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormCodeGenerator = void 0;
4
- function unique(value, index, array) {
5
- return array.indexOf(value) === index;
6
- }
7
- function camelize(text) {
8
- return text
9
- .split(/[-_]+/)
10
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
11
- .join("");
12
- }
13
- class FormCodeGenerator {
14
- constructor(formName) {
15
- this.fields = [];
16
- this.formName = formName;
17
- }
18
- getFieldsCount() {
19
- return this.fields.length;
20
- }
21
- add(field) {
22
- this.fields.push(field);
23
- return this;
24
- }
25
- generateComponent(field) {
26
- return `<${camelize(field.type)} control={formApi.control} name="${field.name}" label="${field.label}" ${field.isRequired ? "isRequired " : ""}/>`;
27
- }
28
- generate() {
29
- const componentName = camelize(this.formName);
30
- return `import React from "react";
31
- import { Form } from "@uxf/form/form";
32
- import { useForm, SubmitHandler } from "react-hook-form";
33
- ${this.fields
34
- .map((field) => field.type)
35
- .filter(unique)
36
- .map((type) => `import { ${camelize(type)}, ${camelize(type)}Value } from "@uxf/form/${type}";`)
37
- .join("\n")}
38
-
39
- export interface ${componentName}Data {
40
- ${this.fields.map((field) => ` ${field.name}: ${camelize(field.type)}Value;`).join("\n")}
41
- }
42
-
43
- export interface ${componentName}Props {
44
- onSubmit: SubmitHandler<${componentName}Data>;
45
- defaultValues: ${componentName}Data;
46
- }
47
-
48
- export function mapToFormData(values: any): ${componentName}Data {
49
- return {
50
- ${this.fields.map((field) => ` ${field.name}: values.TODO`).join(",\n")}
51
- }
52
- }
53
-
54
- export function ${componentName}(props: ${componentName}Props)
55
- {
56
- const formApi = useForm({
57
- defaultValues: props.defaultValues,
58
- });
59
-
60
- return (
61
- <Form formApi={formApi} onSubmit={props.onSubmit} id="${this.formName}">
62
- ${this.fields.map((field) => ` ${this.generateComponent(field)}`).join("\n")}
63
- </Form>
64
- );
65
- }
66
- `;
67
- }
68
- }
69
- exports.FormCodeGenerator = FormCodeGenerator;
@@ -1,14 +0,0 @@
1
- import { FileResponse } from "@uxf/core/types";
2
- import { AvatarFileInputProps as UIAvatarFileInputProps } from "@uxf/ui/avatar-file-input";
3
- import React from "react";
4
- import { FieldValues } from "react-hook-form";
5
- import { ControlProps } from "../types";
6
- export type AvatarFileInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIAvatarFileInputProps, "isFocused" | "isInvalid" | "onChange" | "value"> & {
7
- onChange?: UIAvatarFileInputProps["onChange"];
8
- requiredMessage?: string;
9
- };
10
- export type AvatarFileInputValue = FileResponse | null;
11
- export declare function AvatarFileInput<FormData extends FieldValues>(props: AvatarFileInputProps<FormData>): React.JSX.Element;
12
- export declare namespace AvatarFileInput {
13
- var displayName: string;
14
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.AvatarFileInput = AvatarFileInput;
8
- const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
9
- const avatar_file_input_1 = require("@uxf/ui/avatar-file-input");
10
- const react_1 = __importDefault(require("react"));
11
- const react_hook_form_1 = require("react-hook-form");
12
- const form_context_1 = require("../form-id-context/form-context");
13
- function AvatarFileInput(props) {
14
- var _a, _b, _c;
15
- const formContext = (0, form_context_1.useFormContext)();
16
- const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
17
- const { field, fieldState } = (0, react_hook_form_1.useController)({
18
- control: props.control,
19
- name: props.name,
20
- rules: {
21
- required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
22
- ...props.rules,
23
- },
24
- shouldUnregister: props.shouldUnregister,
25
- });
26
- const onBlur = (event) => {
27
- var _a;
28
- field.onBlur();
29
- (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
30
- };
31
- const onChange = (value, event) => {
32
- var _a;
33
- field.onChange(value);
34
- (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
35
- };
36
- return (react_1.default.createElement(avatar_file_input_1.AvatarFileInput, { accept: props.accept, "aria-describedby": props["aria-describedby"], className: props.className, customControls: props.customControls, form: props.form, helperText: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : props.helperText, hiddenLabel: props.hiddenLabel, icon: props.icon, id: id, isDisabled: formContext.isFormDisabled || props.isDisabled, isInvalid: (0, is_not_nil_1.isNotNil)(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, maxFileSize: props.maxFileSize, name: field.name, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, onUploadError: props.onUploadError, onUploadFile: props.onUploadFile, ref: field.ref, removeFileLabel: props.removeFileLabel, selectFileLabel: props.selectFileLabel, value: field.value, variant: props.variant }));
37
- }
38
- AvatarFileInput.displayName = "UxfFormAvatarFileInput";
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { AvatarFileInput } from "./avatar-file-input";
3
- declare const _default: {
4
- title: string;
5
- component: typeof AvatarFileInput;
6
- };
7
- export default _default;
8
- export declare function Default(): React.JSX.Element;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Default = Default;
7
- const button_1 = require("@uxf/ui/button");
8
- const upload_file_mock_1 = require("@uxf/ui/utils/mocks/upload-file.mock");
9
- const react_1 = __importDefault(require("react"));
10
- const storybook_form_1 = require("../storybook/storybook-form");
11
- const avatar_file_input_1 = require("./avatar-file-input");
12
- exports.default = {
13
- title: "Form/AvatarFileInput",
14
- component: avatar_file_input_1.AvatarFileInput,
15
- };
16
- function Default() {
17
- const storyFormAvatarFileInputs = (control, mode) => (react_1.default.createElement("div", { className: "space-y-4" },
18
- react_1.default.createElement(avatar_file_input_1.AvatarFileInput, { control: control, label: "Default file input", name: `default-${mode}`, onUploadFile: upload_file_mock_1.uploadFile }),
19
- react_1.default.createElement(avatar_file_input_1.AvatarFileInput, { control: control, id: `required-${mode}`, isRequired: true, label: "Required file input", name: `required-${mode}`, onUploadFile: upload_file_mock_1.uploadFile }),
20
- react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
21
- return (react_1.default.createElement(storybook_form_1.StorybookForm, null, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
22
- react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyFormAvatarFileInputs(control, "light"))))));
23
- }
@@ -1 +0,0 @@
1
- export * from "./avatar-file-input";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./avatar-file-input"), exports);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};