@nice2dev/ui 1.4.14 → 1.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/{NiceColorPicker-BLwYNSXJ.cjs → NiceColorPicker-79rkvaSk.cjs} +1 -1
  3. package/dist/NiceDataGrid-B1AOjgjm.cjs +10 -0
  4. package/dist/NiceForm-fmePSeA9.cjs +1 -0
  5. package/dist/{NiceHtmlEditor-BzECmDO3.cjs → NiceHtmlEditor-By7R1wRo.cjs} +1 -1
  6. package/dist/{NiceMention-CYRqPKGU.cjs → NiceMention-i7n2BoMw.cjs} +1 -1
  7. package/dist/{NiceModuleLifecyclePanel-CiYbPcHV.cjs → NiceModuleLifecyclePanel-DVHQuhc-.cjs} +1 -1
  8. package/dist/{NicePagination-BAxwqeEd.cjs → NicePagination-D9JguOl0.cjs} +1 -1
  9. package/dist/NicePivotGrid-B_7iQJys.cjs +2 -0
  10. package/dist/NiceSavedQueryPanel-ChY4HwpM.cjs +587 -0
  11. package/dist/{NiceScheduler-BqYiHPvz.cjs → NiceScheduler-B2DamQ_L.cjs} +1 -1
  12. package/dist/backup/NiceBackupScheduler.mjs +171 -119
  13. package/dist/charts/NiceOrganizationChart.mjs +159 -59
  14. package/dist/charts/orgChartExport.mjs +71 -0
  15. package/dist/charts/tidyTree.mjs +43 -0
  16. package/dist/charts-C3Q3r8Yz.cjs +918 -0
  17. package/dist/charts.cjs +1 -1
  18. package/dist/charts.d.ts +9 -0
  19. package/dist/{core-lazy-BQexApr7.cjs → core-lazy-ChKRuEPb.cjs} +1 -1
  20. package/dist/data/NiceDataGrid.mjs +301 -320
  21. package/dist/data/NiceRowEditDialog.mjs +57 -0
  22. package/dist/data/NiceTreeGrid.mjs +478 -433
  23. package/dist/data.cjs +1 -1
  24. package/dist/data.d.ts +43 -2
  25. package/dist/{devops-cgRBnZVX.cjs → devops-o6Zm0VKB.cjs} +3 -3
  26. package/dist/devops.cjs +1 -1
  27. package/dist/editors/forms/NiceForm.mjs +216 -167
  28. package/dist/editors/inputs/NiceUpload.mjs +238 -238
  29. package/dist/editors.cjs +1 -1
  30. package/dist/editors.d.ts +13 -1
  31. package/dist/feedback.cjs +1 -1
  32. package/dist/index.cjs +254 -254
  33. package/dist/index.d.ts +198 -5
  34. package/dist/index.mjs +928 -920
  35. package/dist/lazy.cjs +1 -1
  36. package/dist/lazy.d.ts +11 -1
  37. package/dist/navigation.cjs +1 -1
  38. package/dist/no-code/NiceDataMapper.mjs +398 -361
  39. package/dist/no-code-CN_q6TcB.cjs +331 -0
  40. package/dist/no-code.cjs +1 -1
  41. package/dist/no-code.d.ts +11 -1
  42. package/dist/style.css +1 -1
  43. package/dist/tools/NicePermissionMatrix.mjs +171 -138
  44. package/dist/tools/NiceRoleEditor.mjs +334 -297
  45. package/package.json +4 -4
  46. package/dist/NiceDataGrid-D3qRQSjy.cjs +0 -10
  47. package/dist/NiceForm-BWb4LTQJ.cjs +0 -1
  48. package/dist/NicePivotGrid-Cxu5PECg.cjs +0 -152
  49. package/dist/NiceSavedQueryPanel-C1nxEmMu.cjs +0 -587
  50. package/dist/charts-BzlvCCg9.cjs +0 -768
  51. package/dist/no-code-B1jzfUF5.cjs +0 -331
package/dist/devops.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./devops-cgRBnZVX.cjs");exports.NiceBranchManager=e.NiceBranchManager;exports.NiceGitBlame=e.NiceGitBlame;exports.NiceGitConflictResolver=e.NiceGitConflictResolver;exports.NiceGitDiffViewer=e.NiceGitDiffViewer;exports.NiceGitGraph=e.NiceGitGraph;exports.NiceGitHooks=e.NiceGitHooks;exports.NiceMergeRequestBuilder=e.NiceMergeRequestBuilder;exports.NicePipelineEditor=e.NicePipelineEditor;exports.NicePipelineMonitor=e.NicePipelineMonitor;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./devops-o6Zm0VKB.cjs");exports.NiceBranchManager=e.NiceBranchManager;exports.NiceGitBlame=e.NiceGitBlame;exports.NiceGitConflictResolver=e.NiceGitConflictResolver;exports.NiceGitDiffViewer=e.NiceGitDiffViewer;exports.NiceGitGraph=e.NiceGitGraph;exports.NiceGitHooks=e.NiceGitHooks;exports.NiceMergeRequestBuilder=e.NiceMergeRequestBuilder;exports.NicePipelineEditor=e.NicePipelineEditor;exports.NicePipelineMonitor=e.NicePipelineMonitor;
@@ -1,119 +1,147 @@
1
- import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
- import { useNiceTranslation as ke, useNiceAccessMode as qe, useNiceRecord as Te } from "@nice2dev/ui-core";
3
- import { useMemo as N, useState as R, useRef as $, useEffect as j, useCallback as _ } from "react";
4
- import { NiceButton as D } from "../../buttons/NiceButton.mjs";
5
- import { NiceTabs as xe } from "../../navigation/NiceTabs.mjs";
6
- import { NiceAutocomplete as Se } from "../inputs/NiceAutocomplete.mjs";
7
- import { NiceCheckbox as Ae } from "../inputs/NiceCheckbox.mjs";
8
- import { NiceMaskedInput as Re } from "../inputs/NiceMaskedInput.mjs";
9
- import { NiceNumberInput as te } from "../inputs/NiceNumberInput.mjs";
10
- import { NicePasswordInput as we } from "../inputs/NicePasswordInput.mjs";
11
- import { NiceRadioGroup as Pe } from "../inputs/NiceRadioGroup.mjs";
12
- import { NiceRating as Ie } from "../inputs/NiceRating.mjs";
13
- import { NiceSelect as Le } from "../inputs/NiceSelect.mjs";
14
- import { NiceSlider as Ge } from "../inputs/NiceSlider.mjs";
15
- import { NiceTagBox as Ee } from "../inputs/NiceTagBox.mjs";
16
- import { NiceTextArea as Me } from "../inputs/NiceTextArea.mjs";
17
- import { NiceTextInput as w } from "../inputs/NiceTextInput.mjs";
18
- import { NiceToggle as $e } from "../inputs/NiceToggle.mjs";
19
- import { NiceUpload as je } from "../inputs/NiceUpload.mjs";
20
- import { NiceAddress as De } from "../pickers/NiceAddress.mjs";
21
- import { NiceColorPicker as Fe } from "../pickers/NiceColorPicker.mjs";
22
- import { NiceCountryPicker as Be } from "../pickers/NiceCountryPicker.mjs";
23
- import { NiceDateTimePicker as F } from "../pickers/NiceDateTimePicker.mjs";
24
- const He = [], Ve = ({
25
- items: B = He,
26
- data: H,
27
- onFieldChange: C,
28
- onSubmit: y,
29
- dataSource: V,
30
- recordKey: U,
31
- columns: k = 1,
32
- responsiveColumns: q,
33
- gap: ne = 16,
34
- labelPosition: oe = "top",
35
- size: f = "md",
36
- readOnly: p,
37
- disabled: h,
38
- className: ae,
39
- style: W,
40
- accessMode: ce,
41
- id: se,
42
- autoSaveDelay: P,
43
- onDirtyChange: O,
44
- showActions: ie,
45
- submitLabel: le,
46
- resetLabel: ue,
47
- onCancel: Y,
48
- cancelLabel: me,
49
- "data-testid": de
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { useNiceTranslation as Se, useNiceAccessMode as Ae, useNiceRecord as Ie } from "@nice2dev/ui-core";
3
+ import { useMemo as q, useState as E, useRef as U, useEffect as O, useCallback as h, useId as Le } from "react";
4
+ import { NiceButton as V } from "../../buttons/NiceButton.mjs";
5
+ import { NiceTabs as Re } from "../../navigation/NiceTabs.mjs";
6
+ import { NiceAutocomplete as we } from "../inputs/NiceAutocomplete.mjs";
7
+ import { NiceCheckbox as Fe } from "../inputs/NiceCheckbox.mjs";
8
+ import { NiceMaskedInput as $e } from "../inputs/NiceMaskedInput.mjs";
9
+ import { NiceNumberInput as ce } from "../inputs/NiceNumberInput.mjs";
10
+ import { NicePasswordInput as Ee } from "../inputs/NicePasswordInput.mjs";
11
+ import { NiceRadioGroup as Oe } from "../inputs/NiceRadioGroup.mjs";
12
+ import { NiceRating as Pe } from "../inputs/NiceRating.mjs";
13
+ import { NiceSelect as Ge } from "../inputs/NiceSelect.mjs";
14
+ import { NiceSlider as De } from "../inputs/NiceSlider.mjs";
15
+ import { NiceTagBox as Me } from "../inputs/NiceTagBox.mjs";
16
+ import { NiceTextArea as je } from "../inputs/NiceTextArea.mjs";
17
+ import { NiceTextInput as P } from "../inputs/NiceTextInput.mjs";
18
+ import { NiceToggle as Be } from "../inputs/NiceToggle.mjs";
19
+ import { NiceUpload as He } from "../inputs/NiceUpload.mjs";
20
+ import { NiceAddress as Ue } from "../pickers/NiceAddress.mjs";
21
+ import { NiceColorPicker as Ve } from "../pickers/NiceColorPicker.mjs";
22
+ import { NiceCountryPicker as We } from "../pickers/NiceCountryPicker.mjs";
23
+ import { NiceDateTimePicker as W } from "../pickers/NiceDateTimePicker.mjs";
24
+ const Ye = [], Je = [
25
+ 'input:not([type="hidden"]), select, textarea',
26
+ '[role="combobox"], [role="spinbutton"], [role="slider"], [role="switch"], [role="radiogroup"], [role="listbox"], [role="textbox"]',
27
+ 'button, [tabindex]:not([tabindex="-1"])'
28
+ ];
29
+ function Qe(x) {
30
+ for (const T of Je) {
31
+ const d = x.querySelector(T);
32
+ if (d)
33
+ return d;
34
+ }
35
+ return null;
36
+ }
37
+ const Xe = ({
38
+ items: x = Ye,
39
+ data: T,
40
+ onFieldChange: d,
41
+ onSubmit: k,
42
+ dataSource: Y,
43
+ recordKey: J,
44
+ columns: S = 1,
45
+ responsiveColumns: A,
46
+ gap: se = 16,
47
+ labelPosition: ie = "top",
48
+ size: v = "md",
49
+ readOnly: g,
50
+ disabled: N,
51
+ className: le,
52
+ style: Q,
53
+ accessMode: ue,
54
+ id: de,
55
+ autoSaveDelay: G,
56
+ onDirtyChange: X,
57
+ showActions: fe,
58
+ submitLabel: me,
59
+ resetLabel: pe,
60
+ onCancel: Z,
61
+ cancelLabel: he,
62
+ "data-testid": be
50
63
  }) => {
51
- const { t: I } = ke(), fe = le ?? I("form.submit", "Submit"), pe = ue ?? I("form.reset", "Reset"), he = me ?? I("form.cancel", "Cancel"), L = qe(ce, se), ve = L === "hidden";
52
- L === "disabled" && (h = !0), L === "readOnly" && (p = !0);
53
- const i = Te(V ?? null, U), l = !!V && U != null, s = N(
54
- () => l ? i.editData : H ?? {},
55
- [l, i.editData, H]
56
- ), [J] = R(() => ({ ...s })), [v, Q] = R([]), b = N(() => Object.keys(s).some((e) => s[e] !== J[e]), [s, J]), X = $(!1);
57
- j(() => {
58
- b !== X.current && (X.current = b, O?.(b));
59
- }, [b, O]);
60
- const g = $(null), Z = _(() => {
61
- P && (g.current && clearTimeout(g.current), g.current = setTimeout(() => {
62
- l ? i.save() : y?.(s);
63
- }, P));
64
- }, [P, l, i, y, s]), K = _(
64
+ const { t: D } = Se(), ve = me ?? D("form.submit", "Submit"), ge = pe ?? D("form.reset", "Reset"), Ne = he ?? D("form.cancel", "Cancel"), M = Ae(ue, de), _e = M === "hidden";
65
+ M === "disabled" && (N = !0), M === "readOnly" && (g = !0);
66
+ const l = Ie(Y ?? null, J), u = !!Y && J != null, s = q(
67
+ () => u ? l.editData : T ?? {},
68
+ [u, l.editData, T]
69
+ ), [K] = E(() => ({ ...s })), [_, z] = E([]), y = q(() => Object.keys(s).some((e) => s[e] !== K[e]), [s, K]), ee = U(!1);
70
+ O(() => {
71
+ y !== ee.current && (ee.current = y, X?.(y));
72
+ }, [y, X]);
73
+ const C = U(null), re = h(() => {
74
+ G && (C.current && clearTimeout(C.current), C.current = setTimeout(() => {
75
+ u ? l.save() : k?.(s);
76
+ }, G));
77
+ }, [G, u, l, k, s]), te = h(
65
78
  (e, t) => {
66
- p || h || (Q((n) => [...n, { field: e, prev: s[e] }]), l ? i.set(e, t) : C?.(e, t), Z());
79
+ g || N || (z((n) => [...n, { field: e, prev: s[e] }]), u ? l.set(e, t) : d?.(e, t), re());
67
80
  },
68
- [l, i, C, p, h, s, Z]
69
- ), be = _(() => {
70
- if (v.length === 0)
81
+ [u, l, d, g, N, s, re]
82
+ ), ye = h(() => {
83
+ if (_.length === 0)
71
84
  return;
72
- const e = v[v.length - 1];
73
- Q((t) => t.slice(0, -1)), l ? i.set(e.field, e.prev) : C?.(e.field, e.prev);
74
- }, [v, l, i, C]), ge = _(
85
+ const e = _[_.length - 1];
86
+ z((t) => t.slice(0, -1)), u ? l.set(e.field, e.prev) : d?.(e.field, e.prev);
87
+ }, [_, u, l, d]), Ce = h(
75
88
  (e) => {
76
- e.preventDefault(), g.current && clearTimeout(g.current), l ? i.save() : y?.(s);
89
+ e.preventDefault(), C.current && clearTimeout(C.current), u ? l.save() : k?.(s);
77
90
  },
78
- [s, y, l, i]
79
- ), G = $(null), [Ne, E] = R(k);
80
- j(() => {
81
- if (!q || !G.current) {
82
- E(k);
91
+ [s, k, u, l]
92
+ ), I = U(null), L = Le(), R = h((e) => `${L}-f-${e}`, [L]), j = h((e) => `${L}-l-${e}`, [L]);
93
+ O(() => {
94
+ const e = I.current;
95
+ e && e.querySelectorAll(".nice-form__item[data-field]").forEach((t) => {
96
+ const n = t.dataset.field ?? "", m = [...t.children], c = m.find((r) => r.classList.contains("nice-form__label")), a = m.find((r) => r.classList.contains("nice-form__control")), i = a ? Qe(a) : null;
97
+ !c || !i || (i.id || (i.id = R(n)), c.htmlFor !== i.id && (c.htmlFor = i.id), i.getAttribute("aria-labelledby") || i.setAttribute("aria-labelledby", c.id));
98
+ });
99
+ });
100
+ const [qe, B] = E(S);
101
+ O(() => {
102
+ if (!A || !I.current) {
103
+ B(S);
83
104
  return;
84
105
  }
85
- const e = G.current, t = new ResizeObserver((n) => {
86
- const A = n[0]?.contentRect.width ?? 0, c = Object.keys(q).map(Number).sort((a, r) => r - a);
106
+ const e = I.current, t = new ResizeObserver((n) => {
107
+ const m = n[0]?.contentRect.width ?? 0, c = Object.keys(A).map(Number).sort((a, i) => i - a);
87
108
  for (const a of c)
88
- if (A >= a) {
89
- E(q[a]);
109
+ if (m >= a) {
110
+ B(A[a]);
90
111
  return;
91
112
  }
92
- E(k);
113
+ B(S);
93
114
  });
94
115
  return t.observe(e), () => t.disconnect();
95
- }, [q, k]);
96
- const d = N(
97
- () => B.filter((e) => !(e.visible === !1 || e.visibleWhen && !e.visibleWhen(s))),
98
- [B, s]
99
- ), z = N(() => {
116
+ }, [A, S]);
117
+ const b = q(
118
+ () => x.filter((e) => !(e.visible === !1 || e.hidden || e.visibleWhen && !e.visibleWhen(s))),
119
+ [x, s]
120
+ ), ne = q(() => {
100
121
  const e = [];
101
122
  let t = null;
102
- for (const n of d)
123
+ for (const n of b)
103
124
  !t || t.name !== n.group ? (t = { name: n.group, items: [n] }, e.push(t)) : t.items.push(n);
104
125
  return e;
105
- }, [d]), _e = _(
126
+ }, [b]), xe = h(
106
127
  (e) => {
107
- const t = s[e.field] !== void 0 ? s[e.field] : e.defaultValue, n = (r) => K(e.field, r);
128
+ const t = s[e.field] !== void 0 ? s[e.field] : e.defaultValue, n = (r) => te(e.field, r);
108
129
  if (e.render)
109
- return e.render(t, n);
110
- const A = e.type || "text", c = e.options?.map(
130
+ return e.render(t, n, {
131
+ id: R(e.field),
132
+ labelId: j(e.field)
133
+ });
134
+ const m = e.type || "text", c = e.options?.map(
111
135
  (r) => typeof r == "string" ? { label: r, value: r } : { label: r.label, value: String(r.value) }
112
- ), a = { size: f, disabled: h, readOnly: p };
113
- switch (A) {
136
+ ), a = {
137
+ size: v,
138
+ disabled: N || e.disabled,
139
+ readOnly: g || e.readOnly
140
+ }, i = e.placeholder;
141
+ switch (m) {
114
142
  case "number":
115
143
  return /* @__PURE__ */ o(
116
- te,
144
+ ce,
117
145
  {
118
146
  ...a,
119
147
  value: t ?? null,
@@ -123,7 +151,7 @@ const He = [], Ve = ({
123
151
  );
124
152
  case "currency":
125
153
  return /* @__PURE__ */ o(
126
- te,
154
+ ce,
127
155
  {
128
156
  ...a,
129
157
  value: t ?? null,
@@ -136,10 +164,19 @@ const He = [], Ve = ({
136
164
  }
137
165
  );
138
166
  case "textarea":
139
- return /* @__PURE__ */ o(Me, { ...a, value: t ?? "", onChange: (r) => n(r), rows: 3 });
167
+ return /* @__PURE__ */ o(
168
+ je,
169
+ {
170
+ ...a,
171
+ value: t ?? "",
172
+ onChange: (r) => n(r),
173
+ rows: 3,
174
+ placeholder: i
175
+ }
176
+ );
140
177
  case "address":
141
178
  return /* @__PURE__ */ o(
142
- De,
179
+ Ue,
143
180
  {
144
181
  ...a,
145
182
  value: t ?? {},
@@ -150,17 +187,18 @@ const He = [], Ve = ({
150
187
  );
151
188
  case "select":
152
189
  return /* @__PURE__ */ o(
153
- Le,
190
+ Ge,
154
191
  {
155
192
  ...a,
156
193
  value: t ?? "",
157
194
  onChange: (r) => n(r),
158
- options: c ?? []
195
+ options: c ?? [],
196
+ placeholder: i
159
197
  }
160
198
  );
161
199
  case "autocomplete":
162
200
  return /* @__PURE__ */ o(
163
- Se,
201
+ we,
164
202
  {
165
203
  ...a,
166
204
  value: t ?? "",
@@ -170,7 +208,7 @@ const He = [], Ve = ({
170
208
  );
171
209
  case "radio":
172
210
  return /* @__PURE__ */ o(
173
- Pe,
211
+ Oe,
174
212
  {
175
213
  ...a,
176
214
  value: t ?? "",
@@ -180,7 +218,7 @@ const He = [], Ve = ({
180
218
  );
181
219
  case "checkbox":
182
220
  return /* @__PURE__ */ o(
183
- Ae,
221
+ Fe,
184
222
  {
185
223
  ...a,
186
224
  checked: !!t,
@@ -189,12 +227,12 @@ const He = [], Ve = ({
189
227
  }
190
228
  );
191
229
  case "toggle":
192
- return /* @__PURE__ */ o($e, { ...a, checked: !!t, onChange: (r) => n(r) });
230
+ return /* @__PURE__ */ o(Be, { ...a, checked: !!t, onChange: (r) => n(r) });
193
231
  case "date":
194
- return /* @__PURE__ */ o(F, { ...a, value: t ?? "", onChange: (r) => n(r) });
232
+ return /* @__PURE__ */ o(W, { ...a, value: t ?? "", onChange: (r) => n(r) });
195
233
  case "time":
196
234
  return /* @__PURE__ */ o(
197
- F,
235
+ W,
198
236
  {
199
237
  ...a,
200
238
  dateFormatPreset: "time",
@@ -204,7 +242,7 @@ const He = [], Ve = ({
204
242
  );
205
243
  case "datetime":
206
244
  return /* @__PURE__ */ o(
207
- F,
245
+ W,
208
246
  {
209
247
  ...a,
210
248
  dateFormatPreset: "datetime-local",
@@ -214,7 +252,7 @@ const He = [], Ve = ({
214
252
  );
215
253
  case "color":
216
254
  return /* @__PURE__ */ o(
217
- Fe,
255
+ Ve,
218
256
  {
219
257
  ...a,
220
258
  value: t ?? "var(--nice-text-primary, #000000)",
@@ -223,7 +261,7 @@ const He = [], Ve = ({
223
261
  );
224
262
  case "slider":
225
263
  return /* @__PURE__ */ o(
226
- Ge,
264
+ De,
227
265
  {
228
266
  ...a,
229
267
  value: typeof t == "number" ? t : 0,
@@ -232,7 +270,7 @@ const He = [], Ve = ({
232
270
  );
233
271
  case "rating":
234
272
  return /* @__PURE__ */ o(
235
- Ie,
273
+ Pe,
236
274
  {
237
275
  ...a,
238
276
  value: typeof t == "number" ? t : 0,
@@ -241,7 +279,7 @@ const He = [], Ve = ({
241
279
  );
242
280
  case "password":
243
281
  return /* @__PURE__ */ o(
244
- we,
282
+ Ee,
245
283
  {
246
284
  ...a,
247
285
  value: t ?? "",
@@ -252,7 +290,7 @@ const He = [], Ve = ({
252
290
  case "phone":
253
291
  case "tel":
254
292
  return /* @__PURE__ */ o(
255
- w,
293
+ P,
256
294
  {
257
295
  ...a,
258
296
  type: "tel",
@@ -262,10 +300,10 @@ const He = [], Ve = ({
262
300
  }
263
301
  );
264
302
  case "country":
265
- return /* @__PURE__ */ o(Be, { ...a, value: t ?? "", onChange: (r) => n(r) });
303
+ return /* @__PURE__ */ o(We, { ...a, value: t ?? "", onChange: (r) => n(r) });
266
304
  case "tags":
267
305
  return /* @__PURE__ */ o(
268
- Ee,
306
+ Me,
269
307
  {
270
308
  ...a,
271
309
  value: Array.isArray(t) ? t : [],
@@ -275,7 +313,7 @@ const He = [], Ve = ({
275
313
  );
276
314
  case "masked":
277
315
  return /* @__PURE__ */ o(
278
- Re,
316
+ $e,
279
317
  {
280
318
  ...a,
281
319
  value: t ?? "",
@@ -284,21 +322,22 @@ const He = [], Ve = ({
284
322
  }
285
323
  );
286
324
  case "file":
287
- return /* @__PURE__ */ o(je, { ...a, onFilesSelected: (r) => n(r) });
325
+ return /* @__PURE__ */ o(He, { ...a, onFilesSelected: (r) => n(r) });
288
326
  case "email":
289
327
  return /* @__PURE__ */ o(
290
- w,
328
+ P,
291
329
  {
292
330
  ...a,
293
331
  type: "email",
294
332
  value: t ?? "",
295
333
  onChange: (r) => n(r),
296
- required: e.required
334
+ required: e.required,
335
+ placeholder: i
297
336
  }
298
337
  );
299
338
  case "url":
300
339
  return /* @__PURE__ */ o(
301
- w,
340
+ P,
302
341
  {
303
342
  ...a,
304
343
  type: "url",
@@ -309,117 +348,127 @@ const He = [], Ve = ({
309
348
  );
310
349
  default:
311
350
  return /* @__PURE__ */ o(
312
- w,
351
+ P,
313
352
  {
314
353
  ...a,
315
354
  value: t ?? "",
316
355
  onChange: (r) => n(r),
317
- required: e.required
356
+ required: e.required,
357
+ placeholder: i
318
358
  }
319
359
  );
320
360
  }
321
361
  },
322
- [s, K, h, p, f]
323
- ), T = (e) => /* @__PURE__ */ m(
362
+ [s, te, N, g, v, R, j]
363
+ ), w = (e) => /* @__PURE__ */ p(
324
364
  "div",
325
365
  {
326
366
  className: "nice-form__item",
367
+ "data-field": e.field,
327
368
  style: { gridColumn: e.colSpan ? `span ${e.colSpan}` : void 0 },
328
369
  children: [
329
- e.label && /* @__PURE__ */ m("label", { className: "nice-form__label", children: [
330
- e.label,
331
- e.required && /* @__PURE__ */ o("span", { className: "nice-field__required", children: "*" })
332
- ] }),
333
- /* @__PURE__ */ o("div", { className: "nice-form__control", children: _e(e) }),
370
+ e.label && e.type !== "checkbox" && /* @__PURE__ */ p(
371
+ "label",
372
+ {
373
+ className: "nice-form__label",
374
+ id: j(e.field),
375
+ htmlFor: R(e.field),
376
+ children: [
377
+ e.label,
378
+ e.required && /* @__PURE__ */ o("span", { className: "nice-field__required", children: "*" })
379
+ ]
380
+ }
381
+ ),
382
+ /* @__PURE__ */ o("div", { className: "nice-form__control", children: xe(e) }),
334
383
  e.hint && /* @__PURE__ */ o("div", { className: "nice-form__hint", children: e.hint })
335
384
  ]
336
385
  },
337
386
  e.field
338
- ), x = {
387
+ ), F = {
339
388
  display: "grid",
340
- gridTemplateColumns: `repeat(${Ne}, 1fr)`,
341
- gap: ne
342
- }, ee = z.some((e) => e.name != null), u = N(() => {
389
+ gridTemplateColumns: `repeat(${qe}, 1fr)`,
390
+ gap: se
391
+ }, oe = ne.some((e) => e.name != null), f = q(() => {
343
392
  const e = /* @__PURE__ */ new Set(), t = [];
344
- for (const n of d)
393
+ for (const n of b)
345
394
  n.tab && !e.has(n.tab) && (e.add(n.tab), t.push(n.tab));
346
395
  return t;
347
- }, [d]), S = u.length > 0, [M, re] = R("");
348
- j(() => {
349
- S && !u.includes(M) && re(u[0]);
350
- }, [S, u, M]);
351
- const Ce = (e) => {
396
+ }, [b]), $ = f.length > 0, [H, ae] = E("");
397
+ O(() => {
398
+ $ && !f.includes(H) && ae(f[0]);
399
+ }, [$, f, H]);
400
+ const Te = (e) => {
352
401
  const t = [];
353
402
  let n = null;
354
403
  for (const c of e)
355
404
  !n || n.name !== c.group ? (n = { name: c.group, items: [c] }, t.push(n)) : n.items.push(c);
356
- return t.some((c) => c.name != null) ? t.map((c, a) => /* @__PURE__ */ m(
405
+ return t.some((c) => c.name != null) ? t.map((c, a) => /* @__PURE__ */ p(
357
406
  "fieldset",
358
407
  {
359
408
  className: c.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
360
409
  children: [
361
410
  c.name && /* @__PURE__ */ o("legend", { className: "nice-form__group-title", children: c.name }),
362
- /* @__PURE__ */ o("div", { style: x, children: c.items.map(T) })
411
+ /* @__PURE__ */ o("div", { style: F, children: c.items.map(w) })
363
412
  ]
364
413
  },
365
414
  a
366
- )) : /* @__PURE__ */ o("div", { style: x, children: e.map(T) });
367
- }, ye = ie ? /* @__PURE__ */ m("div", { className: "nice-form__actions", children: [
368
- /* @__PURE__ */ m("div", { className: "nice-form__actions-left", children: [
369
- Y && /* @__PURE__ */ o(D, { type: "button", variant: "secondary", size: f, onClick: Y, children: he }),
415
+ )) : /* @__PURE__ */ o("div", { style: F, children: e.map(w) });
416
+ }, ke = fe ? /* @__PURE__ */ p("div", { className: "nice-form__actions", children: [
417
+ /* @__PURE__ */ p("div", { className: "nice-form__actions-left", children: [
418
+ Z && /* @__PURE__ */ o(V, { type: "button", variant: "secondary", size: v, onClick: Z, children: Ne }),
370
419
  /* @__PURE__ */ o(
371
- D,
420
+ V,
372
421
  {
373
422
  type: "button",
374
423
  variant: "ghost",
375
- size: f,
376
- onClick: be,
377
- disabled: v.length === 0,
378
- children: pe
424
+ size: v,
425
+ onClick: ye,
426
+ disabled: _.length === 0,
427
+ children: ge
379
428
  }
380
429
  )
381
430
  ] }),
382
- /* @__PURE__ */ o("div", { className: "nice-form__actions-right", children: /* @__PURE__ */ o(D, { type: "submit", variant: "primary", size: f, children: fe }) })
431
+ /* @__PURE__ */ o("div", { className: "nice-form__actions-right", children: /* @__PURE__ */ o(V, { type: "submit", variant: "primary", size: v, children: ve }) })
383
432
  ] }) : null;
384
- return ve ? null : /* @__PURE__ */ m(
433
+ return _e ? null : /* @__PURE__ */ p(
385
434
  "form",
386
435
  {
387
- ref: G,
388
- className: `nice-form nice-form--label-${oe}${b ? " nice-form--dirty" : ""} ${ae || ""}`,
389
- style: ee || S ? { ...W } : { ...x, ...W },
390
- onSubmit: ge,
391
- "data-testid": de,
436
+ ref: I,
437
+ className: `nice-form nice-form--label-${ie}${y ? " nice-form--dirty" : ""} ${le || ""}`,
438
+ style: oe || $ ? { ...Q } : { ...F, ...Q },
439
+ onSubmit: Ce,
440
+ "data-testid": be,
392
441
  noValidate: !0,
393
442
  children: [
394
- S ? /* @__PURE__ */ o(
395
- xe,
443
+ $ ? /* @__PURE__ */ o(
444
+ Re,
396
445
  {
397
446
  className: "nice-form__tabs",
398
- activeTab: M || u[0],
399
- onChange: re,
400
- tabs: u.map((e) => ({
447
+ activeTab: H || f[0],
448
+ onChange: ae,
449
+ tabs: f.map((e) => ({
401
450
  id: e,
402
451
  label: e,
403
- content: /* @__PURE__ */ o("div", { className: "nice-form__tab-panel", children: Ce(d.filter((t) => (t.tab ?? u[0]) === e)) })
452
+ content: /* @__PURE__ */ o("div", { className: "nice-form__tab-panel", children: Te(b.filter((t) => (t.tab ?? f[0]) === e)) })
404
453
  }))
405
454
  }
406
- ) : ee ? z.map((e, t) => /* @__PURE__ */ m(
455
+ ) : oe ? ne.map((e, t) => /* @__PURE__ */ p(
407
456
  "fieldset",
408
457
  {
409
458
  className: e.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
410
459
  children: [
411
460
  e.name && /* @__PURE__ */ o("legend", { className: "nice-form__group-title", children: e.name }),
412
- /* @__PURE__ */ o("div", { style: x, children: e.items.map(T) })
461
+ /* @__PURE__ */ o("div", { style: F, children: e.items.map(w) })
413
462
  ]
414
463
  },
415
464
  t
416
- )) : d.map(T),
417
- ye
465
+ )) : b.map(w),
466
+ ke
418
467
  ]
419
468
  }
420
469
  );
421
470
  };
422
- process.env.NODE_ENV !== "production" && (Ve.displayName = "NiceForm");
471
+ process.env.NODE_ENV !== "production" && (Xe.displayName = "NiceForm");
423
472
  export {
424
- Ve as NiceForm
473
+ Xe as NiceForm
425
474
  };