@nice2dev/ui 1.1.9 → 1.2.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 (163) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/README.md +27 -34
  3. package/dist/NiceButton-5tWvfXKl.cjs +1 -0
  4. package/dist/NiceButton-DHSgQT1_.js +112 -0
  5. package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
  6. package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
  7. package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
  8. package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
  9. package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
  10. package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
  11. package/dist/NiceColorPicker-DK30kJgy.js +486 -0
  12. package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
  13. package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
  14. package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
  15. package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
  16. package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
  17. package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
  18. package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
  19. package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
  20. package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
  21. package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
  22. package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
  23. package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
  24. package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
  25. package/dist/NiceForm-BCEXovJR.cjs +1 -0
  26. package/dist/NiceForm-D7oyWHXg.js +4820 -0
  27. package/dist/NiceForm-DUhxXArr.js +4817 -0
  28. package/dist/NiceForm-DVc0Xoly.js +4819 -0
  29. package/dist/NiceForm-qD_RKPYz.cjs +1 -0
  30. package/dist/NiceForm-uCeVmTrD.cjs +1 -0
  31. package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
  32. package/dist/NiceGantt-B_1lwEsp.js +328 -0
  33. package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
  34. package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
  35. package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
  36. package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
  37. package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
  38. package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
  39. package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
  40. package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
  41. package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
  42. package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
  43. package/dist/NiceLoginForm.css +1 -0
  44. package/dist/NiceMention-CA7CL5BI.js +11263 -0
  45. package/dist/NiceMention-CHcKRl-L.cjs +430 -0
  46. package/dist/NiceMention-DJD0BLcp.js +11269 -0
  47. package/dist/NiceMention-DcaUEMSg.cjs +430 -0
  48. package/dist/NiceMention-Dds9GQzk.cjs +430 -0
  49. package/dist/NiceMention-DlLXWddO.js +11268 -0
  50. package/dist/NiceMention.css +1 -1
  51. package/dist/NiceModal-C4p8a82e.cjs +1 -0
  52. package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
  53. package/dist/NiceModal-TNlkaL_i.js +85 -0
  54. package/dist/NiceModal-sihGCfDy.js +95 -0
  55. package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
  56. package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
  57. package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
  58. package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
  59. package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
  60. package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
  61. package/dist/NicePagination-8XsBbMNx.js +165 -0
  62. package/dist/NicePagination-CkOoXf0f.js +165 -0
  63. package/dist/NicePagination-D44waj9o.cjs +1 -0
  64. package/dist/NicePagination-D7lek1G7.cjs +1 -0
  65. package/dist/NicePagination-DdxH8KMG.js +179 -0
  66. package/dist/NicePagination-OjTEfZJE.cjs +1 -0
  67. package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
  68. package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
  69. package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
  70. package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
  71. package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
  72. package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
  73. package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
  74. package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
  75. package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
  76. package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
  77. package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
  78. package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
  79. package/dist/NiceSavedQueryPanel.css +1 -1
  80. package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
  81. package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
  82. package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
  83. package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
  84. package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
  85. package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
  86. package/dist/NiceSelect-BCbWtu1v.js +433 -0
  87. package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
  88. package/dist/NiceSelect-DZB1Rs9x.js +435 -0
  89. package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
  90. package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
  91. package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
  92. package/dist/NiceWindow-BEov3s9F.js +2094 -0
  93. package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
  94. package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
  95. package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
  96. package/dist/NiceWindow.css +1 -1
  97. package/dist/charts-C047IMVn.cjs +768 -0
  98. package/dist/charts-C44vJber.cjs +768 -0
  99. package/dist/charts-CCXSb3xk.js +4752 -0
  100. package/dist/charts-CqETcUhH.js +4752 -0
  101. package/dist/charts-DouiiHOT.cjs +768 -0
  102. package/dist/charts-XVlDwU0y.js +4732 -0
  103. package/dist/charts.cjs +1 -1
  104. package/dist/charts.mjs +8 -8
  105. package/dist/core-BL-KmGYC.js +795 -0
  106. package/dist/core-BxiH7vkV.cjs +1 -0
  107. package/dist/core-Chg-oYCr.cjs +1 -0
  108. package/dist/core-CxBnKAhs.cjs +1 -0
  109. package/dist/core-DMV6_SEE.js +795 -0
  110. package/dist/core-D_LRh59n.js +795 -0
  111. package/dist/data-branching-Km4lc8P_.cjs +1 -0
  112. package/dist/data-branching-YQtJJEtn.js +6273 -0
  113. package/dist/data-branching-oEH04O3i.js +6273 -0
  114. package/dist/data-branching-wmsbLNfa.cjs +1 -0
  115. package/dist/data-branching.cjs +1 -1
  116. package/dist/data-branching.mjs +1 -1
  117. package/dist/data.cjs +1 -1
  118. package/dist/data.d.ts +2 -53
  119. package/dist/data.mjs +3 -3
  120. package/dist/devops-Bt6EsfPa.cjs +17 -0
  121. package/dist/devops-CnZQ1rU5.js +8312 -0
  122. package/dist/devops-D5yIDM3e.js +8312 -0
  123. package/dist/devops-rVpB0ZAX.cjs +17 -0
  124. package/dist/devops.cjs +1 -1
  125. package/dist/devops.mjs +1 -1
  126. package/dist/editors.cjs +1 -1
  127. package/dist/editors.d.ts +8 -26
  128. package/dist/editors.mjs +55 -54
  129. package/dist/feedback.cjs +1 -1
  130. package/dist/feedback.d.ts +5 -0
  131. package/dist/feedback.mjs +3 -3
  132. package/dist/index.cjs +290 -290
  133. package/dist/index.css +1 -1
  134. package/dist/index.d.ts +239 -234
  135. package/dist/index.mjs +20262 -19440
  136. package/dist/lazy.cjs +1 -1
  137. package/dist/lazy.mjs +29 -29
  138. package/dist/navigation.cjs +1 -1
  139. package/dist/navigation.d.ts +4 -4
  140. package/dist/navigation.mjs +69 -69
  141. package/dist/no-code-4GtIBr6f.js +7503 -0
  142. package/dist/no-code-6WyYb3hL.cjs +331 -0
  143. package/dist/no-code-BH5oVFC6.js +8186 -0
  144. package/dist/no-code-Bdwh1vyS.cjs +332 -0
  145. package/dist/no-code-CnHG5_Vn.js +8186 -0
  146. package/dist/no-code-DMKlg1Zl.cjs +331 -0
  147. package/dist/no-code.cjs +1 -1
  148. package/dist/no-code.css +1 -1
  149. package/dist/no-code.d.ts +25 -18
  150. package/dist/no-code.mjs +3 -3
  151. package/dist/overlays.cjs +1 -1
  152. package/dist/overlays.d.ts +24 -24
  153. package/dist/overlays.mjs +24 -490
  154. package/dist/pickerCommons-0vyK1Knv.js +547 -0
  155. package/dist/pickerCommons-31hyz1gs.js +1122 -0
  156. package/dist/pickerCommons-BFbItm8o.cjs +1 -0
  157. package/dist/pickerCommons-BHirHJyn.js +548 -0
  158. package/dist/pickerCommons-BifIkPdk.cjs +1 -0
  159. package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
  160. package/dist/pickerCommons.css +1 -1
  161. package/dist/style.css +10 -7
  162. package/package.json +5 -7
  163. package/css/legacy-bg-text-aliases.css +0 -87
@@ -0,0 +1,433 @@
1
+ import { jsxs as a, jsx as n, Fragment as Ne } from "react/jsx-runtime";
2
+ import { NiceThemeContext as je, useNiceAccessMode as He, useNiceTranslation as Ke, useComponentDisplayStyle as We, useComponentDisplayClass as qe, useControlId as Be, useDisplayModeEdit as Ue, useNiceLookupSource as Pe, COMMON_SHORTCUTS as ue, NiceKeyboardHint as Ve, DisplayModeView as Ge, NiceIcon as xe } from "@nice2dev/ui-core";
3
+ import Je, { useRef as se, useState as m, useContext as Qe, useLayoutEffect as he, useEffect as Xe, forwardRef as Ye, useMemo as W, useCallback as fe } from "react";
4
+ import { createPortal as Ze } from "react-dom";
5
+ function en(h) {
6
+ const i = h?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");
7
+ if (!i)
8
+ return "";
9
+ const r = i.getAttribute("data-theme");
10
+ return r === "dark" || i.classList.contains("nice-dark") || i.classList.contains("dark") ? "nice-dark" : r === "light" || i.classList.contains("nice-light") ? "nice-light" : "";
11
+ }
12
+ function nn(h, i, r, q) {
13
+ const _ = q?.maxHeight ?? 320, B = q?.anchorKey, T = se(null), [U, ce] = m(null), [le, P] = m(!1), [I, re] = m(""), k = Qe(je)?.portalTarget ?? (typeof document < "u" ? document.body : null), v = se(r);
14
+ return v.current = r, he(() => {
15
+ if (!h || !i.current)
16
+ return;
17
+ re(en(i.current)), P(!1);
18
+ const c = () => {
19
+ const y = i.current;
20
+ if (!y)
21
+ return;
22
+ const l = y.getBoundingClientRect(), A = T.current?.offsetHeight ?? _;
23
+ let L = l.bottom;
24
+ L + A > window.innerHeight - 8 && l.top - A > 8 && (L = l.top - A);
25
+ let $ = l.left;
26
+ $ + l.width > window.innerWidth - 8 && ($ = Math.max(8, window.innerWidth - l.width - 8)), ce(
27
+ (d) => d && d.left === $ && d.top === L && d.width === l.width ? d : { left: $, top: L, width: l.width }
28
+ );
29
+ };
30
+ c();
31
+ const E = requestAnimationFrame(() => {
32
+ c(), P(!0);
33
+ }), g = (y) => {
34
+ const l = y.target;
35
+ l instanceof Node && (T.current?.contains(l) || i.current?.contains(l)) || v.current();
36
+ }, p = () => v.current();
37
+ return window.addEventListener("scroll", g, !0), window.addEventListener("resize", p), () => {
38
+ cancelAnimationFrame(E), window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", p);
39
+ };
40
+ }, [h, i, _, B]), Xe(() => {
41
+ if (!h)
42
+ return;
43
+ const c = (g) => {
44
+ const p = g.target;
45
+ i.current?.contains(p) || T.current?.contains(p) || (p instanceof Element ? p : p?.parentElement ?? null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]') || v.current();
46
+ }, E = (g) => {
47
+ g.key === "Escape" && v.current();
48
+ };
49
+ return document.addEventListener("mousedown", c), document.addEventListener("keydown", E), () => {
50
+ document.removeEventListener("mousedown", c), document.removeEventListener("keydown", E);
51
+ };
52
+ }, [h, i]), { popupRef: T, coords: U, ready: le, themeClass: I, portalTarget: k };
53
+ }
54
+ const be = Ye(
55
+ ({
56
+ label: h,
57
+ helperText: i,
58
+ error: r,
59
+ required: q,
60
+ disabled: _,
61
+ size: B = "md",
62
+ name: T,
63
+ id: U,
64
+ className: ce,
65
+ style: le,
66
+ accessMode: P,
67
+ displayStyle: I,
68
+ options: re,
69
+ value: b,
70
+ onChange: k,
71
+ placeholder: v,
72
+ multiple: c = !1,
73
+ searchable: E = !0,
74
+ clearable: g = !1,
75
+ emptyText: p,
76
+ maxHeight: y = 240,
77
+ optionsSource: l,
78
+ valueField: A,
79
+ labelField: L,
80
+ virtualScroll: $,
81
+ optionHeight: d = 36,
82
+ onSearch: O,
83
+ loading: w,
84
+ renderOption: V,
85
+ multipleAutosize: G = !1,
86
+ showKeyboardHints: ke,
87
+ labelPlacement: $e,
88
+ errorPlacement: J,
89
+ labelWidth: Q,
90
+ controlWidth: F,
91
+ displayMode: Ce
92
+ }, X) => {
93
+ const oe = He(P, U), Ee = oe === "hidden";
94
+ (oe === "disabled" || oe === "readOnly") && (_ = !0);
95
+ const { t: N } = Ke(), Le = We("input", I), Me = qe("input", I), M = Be(U), pe = Ue({ enabled: Ce, disabled: _ }), [x, S] = m(!1), [Y, Z] = m(""), [D, z] = m(-1), [me, Se] = m(0), _e = se(null), j = se(null), [ve, De] = m(null);
96
+ he(() => {
97
+ !w && j.current && De(j.current.offsetWidth);
98
+ }, [w, b, I]);
99
+ const [H, Re] = m(null);
100
+ he(() => {
101
+ c && !G && j.current && H == null && Re(j.current.offsetWidth);
102
+ }, [c, G, H]);
103
+ const Te = Pe(
104
+ l ?? null,
105
+ A ?? l?.keyField ?? "id",
106
+ L ?? "name"
107
+ ), C = l ? Te.options : (re ?? []).map(
108
+ (e) => typeof e == "string" ? { value: e, label: e } : e
109
+ ), { popupRef: Ie, coords: K, ready: ge, themeClass: ee, portalTarget: ye } = nn(
110
+ x,
111
+ _e,
112
+ () => {
113
+ S(!1), Z("");
114
+ }
115
+ ), o = W(() => b ? Array.isArray(b) ? b : [b] : [], [b]), u = W(() => {
116
+ if (!Y && !O || O)
117
+ return C;
118
+ const e = Y.toLowerCase();
119
+ return C.filter(
120
+ (s) => s.label.toLowerCase().includes(e) || String(s.value).toLowerCase().includes(e)
121
+ );
122
+ }, [C, Y, O]), we = W(() => {
123
+ const e = /* @__PURE__ */ new Map();
124
+ for (const s of u) {
125
+ const t = s.group || "";
126
+ e.has(t) || e.set(t, []), e.get(t).push(s);
127
+ }
128
+ return e;
129
+ }, [u]), ne = fe(
130
+ (e) => {
131
+ if (c) {
132
+ const s = o.includes(e) ? o.filter((t) => t !== e) : [...o, e];
133
+ k?.(s);
134
+ } else
135
+ k?.(e), S(!1), Z("");
136
+ },
137
+ [c, o, k]
138
+ ), Ae = fe(
139
+ (e) => {
140
+ if (e.key === "Escape") {
141
+ S(!1), Z("");
142
+ return;
143
+ }
144
+ if (e.key === "Enter" || e.key === " ") {
145
+ if (!x) {
146
+ S(!0), e.preventDefault();
147
+ return;
148
+ }
149
+ D >= 0 && u[D] && (ne(u[D].value), e.preventDefault());
150
+ return;
151
+ }
152
+ e.key === "ArrowDown" && (e.preventDefault(), z((s) => Math.min(s + 1, u.length - 1))), e.key === "ArrowUp" && (e.preventDefault(), z((s) => Math.max(s - 1, 0)));
153
+ },
154
+ [x, D, u, ne]
155
+ ), ae = W(() => o.length === 0 ? null : c ? o.map((e) => C.find((s) => s.value === e)?.label || e).join(", ") : C.find((e) => e.value === o[0])?.label || o[0], [o, C, c]), Oe = fe(
156
+ (e) => {
157
+ e.stopPropagation(), k?.(c ? [] : "");
158
+ },
159
+ [k, c]
160
+ ), Fe = W(
161
+ () => [
162
+ { key: "Enter", description: N("shortcuts.select", "Select") },
163
+ { key: "Space", description: N("shortcuts.openDropdown", "Open dropdown") },
164
+ ue.moveUp,
165
+ ue.moveDown,
166
+ ue.cancel
167
+ ],
168
+ [N]
169
+ );
170
+ return Ee ? null : /* @__PURE__ */ a(
171
+ "div",
172
+ {
173
+ className: `nice-field ${F == null ? "nice-field--select-auto" : ""} nice-field--${B} ${$e === "left" ? "nice-field--label-left" : ""} ${w ? "nice-field--loading" : ""} ${ce || ""}`,
174
+ style: {
175
+ ...le,
176
+ ...Q != null && {
177
+ "--nice-field-label-width": typeof Q == "number" ? `${Q}px` : Q
178
+ },
179
+ ...F != null && {
180
+ "--nice-field-control-width": typeof F == "number" ? `${F}px` : F
181
+ },
182
+ ...w && ve != null && { "--nice-select-locked-width": `${ve}px` }
183
+ },
184
+ "aria-busy": w || void 0,
185
+ children: [
186
+ h && /* @__PURE__ */ a(
187
+ "label",
188
+ {
189
+ htmlFor: M,
190
+ className: `nice-field__label ${q ? "nice-field__label--required" : ""}`,
191
+ children: [
192
+ h,
193
+ ke && /* @__PURE__ */ n(Ve, { shortcuts: Fe, size: "sm" })
194
+ ]
195
+ }
196
+ ),
197
+ /* @__PURE__ */ a("div", { className: "nice-field__control", children: [
198
+ pe.isDisplay ? /* @__PURE__ */ n(
199
+ Ge,
200
+ {
201
+ value: ae,
202
+ placeholder: v || N("controls.select", "Select..."),
203
+ disabled: _,
204
+ onActivate: () => {
205
+ pe.enterEdit(), S(!0);
206
+ },
207
+ ariaLabel: h
208
+ }
209
+ ) : /* @__PURE__ */ a("div", { className: "nice-select", ref: _e, children: [
210
+ /* @__PURE__ */ a(
211
+ "button",
212
+ {
213
+ ref: (e) => {
214
+ j.current = e, typeof X == "function" ? X(e) : X && (X.current = e);
215
+ },
216
+ type: "button",
217
+ id: M,
218
+ role: "combobox",
219
+ "aria-expanded": x,
220
+ "aria-haspopup": "listbox",
221
+ "aria-invalid": !!r,
222
+ className: `nice-select__trigger nice-select__trigger--${B} nice-select--ds-${Me} ${x ? "nice-select__trigger--open" : ""} ${r ? "nice-select__trigger--error" : ""} ${_ ? "nice-select__trigger--disabled" : ""}`,
223
+ style: {
224
+ ...Le,
225
+ ...c && !G && H != null ? {
226
+ width: H,
227
+ maxWidth: H,
228
+ overflow: "hidden"
229
+ } : {}
230
+ },
231
+ disabled: _,
232
+ onClick: () => S(!x),
233
+ onKeyDown: Ae,
234
+ children: [
235
+ ae ? /* @__PURE__ */ n(
236
+ "span",
237
+ {
238
+ style: c && !G ? {
239
+ flex: 1,
240
+ minWidth: 0,
241
+ overflow: "hidden",
242
+ textOverflow: "ellipsis",
243
+ whiteSpace: "nowrap"
244
+ } : void 0,
245
+ children: ae
246
+ }
247
+ ) : /* @__PURE__ */ n("span", { className: "nice-select__placeholder", children: v || N("controls.select", "Select...") }),
248
+ /* @__PURE__ */ a("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
249
+ g && o.length > 0 && /* @__PURE__ */ n(
250
+ "span",
251
+ {
252
+ className: "nice-input__clear",
253
+ onClick: Oe,
254
+ role: "button",
255
+ "aria-label": N("controls.clear", "Clear"),
256
+ children: /* @__PURE__ */ n(xe, { name: "close", size: 14 })
257
+ }
258
+ ),
259
+ /* @__PURE__ */ n(
260
+ "span",
261
+ {
262
+ className: `nice-select__chevron ${x ? "nice-select__chevron--open" : ""}`,
263
+ children: /* @__PURE__ */ n(xe, { name: "chevron-down", size: 16 })
264
+ }
265
+ )
266
+ ] })
267
+ ]
268
+ }
269
+ ),
270
+ x && K && ye && Ze(
271
+ /* @__PURE__ */ a(
272
+ "div",
273
+ {
274
+ ref: Ie,
275
+ className: `nice-select__dropdown${ee ? ` ${ee}` : ""}`,
276
+ "data-theme": ee === "nice-dark" ? "dark" : ee === "nice-light" ? "light" : void 0,
277
+ role: "listbox",
278
+ style: {
279
+ maxHeight: y,
280
+ position: "fixed",
281
+ left: K.left,
282
+ top: K.top,
283
+ width: K.width,
284
+ minWidth: K.width,
285
+ zIndex: 1e3,
286
+ // Hidden until measured so the estimate frame never paints above.
287
+ opacity: ge ? 1 : 0,
288
+ pointerEvents: ge ? void 0 : "none"
289
+ },
290
+ onScroll: $ ? (e) => Se(e.currentTarget.scrollTop) : void 0,
291
+ children: [
292
+ (E || O) && /* @__PURE__ */ n("div", { className: "nice-select__search", children: /* @__PURE__ */ n(
293
+ "input",
294
+ {
295
+ type: "text",
296
+ value: Y,
297
+ onChange: (e) => {
298
+ Z(e.target.value), z(0), O?.(e.target.value);
299
+ },
300
+ placeholder: N("controls.search", "Search..."),
301
+ autoFocus: !0
302
+ }
303
+ ) }),
304
+ w && /* @__PURE__ */ n("div", { className: "nice-select__loading", children: /* @__PURE__ */ n(
305
+ "div",
306
+ {
307
+ className: "nice-spinner nice-spinner--sm",
308
+ style: { margin: "8px auto" }
309
+ }
310
+ ) }),
311
+ !w && u.length === 0 ? /* @__PURE__ */ n("div", { className: "nice-select__empty", children: p || N("controls.noResults", "No results found") }) : $ && !Array.from(we.keys()).some((e) => e !== "") ? (() => {
312
+ const s = u.length * d, t = Math.max(
313
+ 0,
314
+ Math.floor(me / d) - 3
315
+ ), R = Math.min(
316
+ u.length,
317
+ Math.ceil((me + y) / d) + 3
318
+ ), te = u.slice(t, R);
319
+ return /* @__PURE__ */ n("div", { style: { height: s, position: "relative" }, children: te.map((f, ze) => {
320
+ const de = t + ze, ie = o.includes(f.value);
321
+ return /* @__PURE__ */ n(
322
+ "div",
323
+ {
324
+ role: "option",
325
+ "aria-selected": ie,
326
+ className: `nice-select__option ${ie ? "nice-select__option--selected" : ""} ${de === D ? "nice-select__option--highlighted" : ""} ${f.disabled ? "nice-select__option--disabled" : ""}`,
327
+ style: {
328
+ position: "absolute",
329
+ top: de * d,
330
+ left: 0,
331
+ right: 0,
332
+ height: d,
333
+ display: "flex",
334
+ alignItems: "center",
335
+ padding: "0 12px"
336
+ },
337
+ onClick: () => !f.disabled && ne(String(f.value)),
338
+ onMouseEnter: () => z(de),
339
+ children: V ? V(f, ie) : /* @__PURE__ */ a(Ne, { children: [
340
+ f.icon && /* @__PURE__ */ n("span", { children: f.icon }),
341
+ /* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
342
+ /* @__PURE__ */ n("div", { children: f.label }),
343
+ f.description && /* @__PURE__ */ n("div", { className: "nice-select__option-desc", children: f.description })
344
+ ] }),
345
+ ie && /* @__PURE__ */ n(
346
+ "svg",
347
+ {
348
+ className: "nice-select__option-check",
349
+ viewBox: "0 0 20 20",
350
+ fill: "currentColor",
351
+ children: /* @__PURE__ */ n(
352
+ "path",
353
+ {
354
+ fillRule: "evenodd",
355
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
356
+ clipRule: "evenodd"
357
+ }
358
+ )
359
+ }
360
+ )
361
+ ] })
362
+ },
363
+ f.value
364
+ );
365
+ }) });
366
+ })() : Array.from(we.entries()).map(([e, s]) => /* @__PURE__ */ a(Je.Fragment, { children: [
367
+ e && /* @__PURE__ */ n("div", { className: "nice-select__group-label", children: e }),
368
+ s.map((t) => {
369
+ const R = o.includes(t.value), te = u.indexOf(t);
370
+ return /* @__PURE__ */ n(
371
+ "div",
372
+ {
373
+ role: "option",
374
+ "aria-selected": R,
375
+ className: `nice-select__option ${R ? "nice-select__option--selected" : ""} ${te === D ? "nice-select__option--highlighted" : ""} ${t.disabled ? "nice-select__option--disabled" : ""}`,
376
+ onClick: () => !t.disabled && ne(String(t.value)),
377
+ onMouseEnter: () => z(te),
378
+ children: V ? V(t, R) : /* @__PURE__ */ a(Ne, { children: [
379
+ t.icon && /* @__PURE__ */ n("span", { children: t.icon }),
380
+ /* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
381
+ /* @__PURE__ */ n("div", { children: t.label }),
382
+ t.description && /* @__PURE__ */ n("div", { className: "nice-select__option-desc", children: t.description })
383
+ ] }),
384
+ R && /* @__PURE__ */ n(
385
+ "svg",
386
+ {
387
+ className: "nice-select__option-check",
388
+ viewBox: "0 0 20 20",
389
+ fill: "currentColor",
390
+ children: /* @__PURE__ */ n(
391
+ "path",
392
+ {
393
+ fillRule: "evenodd",
394
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
395
+ clipRule: "evenodd"
396
+ }
397
+ )
398
+ }
399
+ )
400
+ ] })
401
+ },
402
+ t.value
403
+ );
404
+ })
405
+ ] }, e))
406
+ ]
407
+ }
408
+ ),
409
+ ye
410
+ )
411
+ ] }),
412
+ w && /* @__PURE__ */ n("span", { className: "nice-field__spinner", children: /* @__PURE__ */ n("span", { className: "nice-spinner nice-spinner--sm" }) }),
413
+ J === "right" && r && /* @__PURE__ */ n("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: r }),
414
+ J === "right" && !r && i && /* @__PURE__ */ n("div", { id: `${M}-helper`, className: "nice-field__helper", children: i })
415
+ ] }),
416
+ J !== "right" && r && /* @__PURE__ */ n("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: r }),
417
+ J !== "right" && !r && i && /* @__PURE__ */ n("div", { id: `${M}-helper`, className: "nice-field__helper", children: i })
418
+ ]
419
+ }
420
+ );
421
+ }
422
+ );
423
+ be.displayName = "NiceSelect";
424
+ const rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
425
+ __proto__: null,
426
+ NiceSelect: be
427
+ }, Symbol.toStringTag, { value: "Module" }));
428
+ export {
429
+ be as N,
430
+ rn as a,
431
+ en as s,
432
+ nn as u
433
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),o=require("@nice2dev/ui-core"),s=require("react"),Te=require("react-dom");function _e(p){const i=p?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");if(!i)return"";const a=i.getAttribute("data-theme");return a==="dark"||i.classList.contains("nice-dark")||i.classList.contains("dark")?"nice-dark":a==="light"||i.classList.contains("nice-light")?"nice-light":""}function ve(p,i,a,K){const x=K?.maxHeight??320,U=K?.anchorKey,D=s.useRef(null),[W,ne]=s.useState(null),[ie,B]=s.useState(!1),[T,ce]=s.useState(""),b=s.useContext(o.NiceThemeContext)?.portalTarget??(typeof document<"u"?document.body:null),_=s.useRef(a);return _.current=a,s.useLayoutEffect(()=>{if(!p||!i.current)return;ce(_e(i.current)),B(!1);const l=()=>{const g=i.current;if(!g)return;const r=g.getBoundingClientRect(),O=D.current?.offsetHeight??x;let M=r.bottom;M+O>window.innerHeight-8&&r.top-O>8&&(M=r.top-O);let k=r.left;k+r.width>window.innerWidth-8&&(k=Math.max(8,window.innerWidth-r.width-8)),ne(u=>u&&u.left===k&&u.top===M&&u.width===r.width?u:{left:k,top:M,width:r.width})};l();const S=requestAnimationFrame(()=>{l(),B(!0)}),v=g=>{const r=g.target;r instanceof Node&&(D.current?.contains(r)||i.current?.contains(r))||_.current()},m=()=>_.current();return window.addEventListener("scroll",v,!0),window.addEventListener("resize",m),()=>{cancelAnimationFrame(S),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",m)}},[p,i,x,U]),s.useEffect(()=>{if(!p)return;const l=v=>{const m=v.target;i.current?.contains(m)||D.current?.contains(m)||(m instanceof Element?m:m?.parentElement??null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]')||_.current()},S=v=>{v.key==="Escape"&&_.current()};return document.addEventListener("mousedown",l),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",S)}},[p,i]),{popupRef:D,coords:W,ready:ie,themeClass:T,portalTarget:b}}const ae=s.forwardRef(({label:p,helperText:i,error:a,required:K,disabled:x,size:U="md",name:D,id:W,className:ne,style:ie,accessMode:B,displayStyle:T,options:ce,value:N,onChange:b,placeholder:_,multiple:l=!1,searchable:S=!0,clearable:v=!1,emptyText:m,maxHeight:g=240,optionsSource:r,valueField:O,labelField:M,virtualScroll:k,optionHeight:u=36,onSearch:I,loading:y,renderOption:P,multipleAutosize:V=!1,showKeyboardHints:ge,labelPlacement:ye,errorPlacement:G,labelWidth:J,controlWidth:A,displayMode:we},Q)=>{const le=o.useNiceAccessMode(B,W),je=le==="hidden";(le==="disabled"||le==="readOnly")&&(x=!0);const{t:w}=o.useNiceTranslation(),Ne=o.useComponentDisplayStyle("input",T),be=o.useComponentDisplayClass("input",T),$=o.useControlId(W),de=o.useDisplayModeEdit({enabled:we,disabled:x}),[j,E]=s.useState(!1),[X,Y]=s.useState(""),[L,F]=s.useState(-1),[ue,ke]=s.useState(0),fe=s.useRef(null),q=s.useRef(null),[he,Ce]=s.useState(null);s.useLayoutEffect(()=>{!y&&q.current&&Ce(q.current.offsetWidth)},[y,N,T]);const[H,Se]=s.useState(null);s.useLayoutEffect(()=>{l&&!V&&q.current&&H==null&&Se(q.current.offsetWidth)},[l,V,H]);const Me=o.useNiceLookupSource(r??null,O??r?.keyField??"id",M??"name"),C=r?Me.options:(ce??[]).map(e=>typeof e=="string"?{value:e,label:e}:e),{popupRef:$e,coords:z,ready:pe,themeClass:Z,portalTarget:me}=ve(j,fe,()=>{E(!1),Y("")}),d=s.useMemo(()=>N?Array.isArray(N)?N:[N]:[],[N]),f=s.useMemo(()=>{if(!X&&!I||I)return C;const e=X.toLowerCase();return C.filter(c=>c.label.toLowerCase().includes(e)||String(c.value).toLowerCase().includes(e))},[C,X,I]),xe=s.useMemo(()=>{const e=new Map;for(const c of f){const n=c.group||"";e.has(n)||e.set(n,[]),e.get(n).push(c)}return e},[f]),ee=s.useCallback(e=>{if(l){const c=d.includes(e)?d.filter(n=>n!==e):[...d,e];b?.(c)}else b?.(e),E(!1),Y("")},[l,d,b]),Ee=s.useCallback(e=>{if(e.key==="Escape"){E(!1),Y("");return}if(e.key==="Enter"||e.key===" "){if(!j){E(!0),e.preventDefault();return}L>=0&&f[L]&&(ee(f[L].value),e.preventDefault());return}e.key==="ArrowDown"&&(e.preventDefault(),F(c=>Math.min(c+1,f.length-1))),e.key==="ArrowUp"&&(e.preventDefault(),F(c=>Math.max(c-1,0)))},[j,L,f,ee]),re=s.useMemo(()=>d.length===0?null:l?d.map(e=>C.find(c=>c.value===e)?.label||e).join(", "):C.find(e=>e.value===d[0])?.label||d[0],[d,C,l]),Le=s.useCallback(e=>{e.stopPropagation(),b?.(l?[]:"")},[b,l]),Re=s.useMemo(()=>[{key:"Enter",description:w("shortcuts.select","Select")},{key:"Space",description:w("shortcuts.openDropdown","Open dropdown")},o.COMMON_SHORTCUTS.moveUp,o.COMMON_SHORTCUTS.moveDown,o.COMMON_SHORTCUTS.cancel],[w]);return je?null:t.jsxs("div",{className:`nice-field ${A==null?"nice-field--select-auto":""} nice-field--${U} ${ye==="left"?"nice-field--label-left":""} ${y?"nice-field--loading":""} ${ne||""}`,style:{...ie,...J!=null&&{"--nice-field-label-width":typeof J=="number"?`${J}px`:J},...A!=null&&{"--nice-field-control-width":typeof A=="number"?`${A}px`:A},...y&&he!=null&&{"--nice-select-locked-width":`${he}px`}},"aria-busy":y||void 0,children:[p&&t.jsxs("label",{htmlFor:$,className:`nice-field__label ${K?"nice-field__label--required":""}`,children:[p,ge&&t.jsx(o.NiceKeyboardHint,{shortcuts:Re,size:"sm"})]}),t.jsxs("div",{className:"nice-field__control",children:[de.isDisplay?t.jsx(o.DisplayModeView,{value:re,placeholder:_||w("controls.select","Select..."),disabled:x,onActivate:()=>{de.enterEdit(),E(!0)},ariaLabel:p}):t.jsxs("div",{className:"nice-select",ref:fe,children:[t.jsxs("button",{ref:e=>{q.current=e,typeof Q=="function"?Q(e):Q&&(Q.current=e)},type:"button",id:$,role:"combobox","aria-expanded":j,"aria-haspopup":"listbox","aria-invalid":!!a,className:`nice-select__trigger nice-select__trigger--${U} nice-select--ds-${be} ${j?"nice-select__trigger--open":""} ${a?"nice-select__trigger--error":""} ${x?"nice-select__trigger--disabled":""}`,style:{...Ne,...l&&!V&&H!=null?{width:H,maxWidth:H,overflow:"hidden"}:{}},disabled:x,onClick:()=>E(!j),onKeyDown:Ee,children:[re?t.jsx("span",{style:l&&!V?{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:void 0,children:re}):t.jsx("span",{className:"nice-select__placeholder",children:_||w("controls.select","Select...")}),t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[v&&d.length>0&&t.jsx("span",{className:"nice-input__clear",onClick:Le,role:"button","aria-label":w("controls.clear","Clear"),children:t.jsx(o.NiceIcon,{name:"close",size:14})}),t.jsx("span",{className:`nice-select__chevron ${j?"nice-select__chevron--open":""}`,children:t.jsx(o.NiceIcon,{name:"chevron-down",size:16})})]})]}),j&&z&&me&&Te.createPortal(t.jsxs("div",{ref:$e,className:`nice-select__dropdown${Z?` ${Z}`:""}`,"data-theme":Z==="nice-dark"?"dark":Z==="nice-light"?"light":void 0,role:"listbox",style:{maxHeight:g,position:"fixed",left:z.left,top:z.top,width:z.width,minWidth:z.width,zIndex:1e3,opacity:pe?1:0,pointerEvents:pe?void 0:"none"},onScroll:k?e=>ke(e.currentTarget.scrollTop):void 0,children:[(S||I)&&t.jsx("div",{className:"nice-select__search",children:t.jsx("input",{type:"text",value:X,onChange:e=>{Y(e.target.value),F(0),I?.(e.target.value)},placeholder:w("controls.search","Search..."),autoFocus:!0})}),y&&t.jsx("div",{className:"nice-select__loading",children:t.jsx("div",{className:"nice-spinner nice-spinner--sm",style:{margin:"8px auto"}})}),!y&&f.length===0?t.jsx("div",{className:"nice-select__empty",children:m||w("controls.noResults","No results found")}):k&&!Array.from(xe.keys()).some(e=>e!=="")?(()=>{const c=f.length*u,n=Math.max(0,Math.floor(ue/u)-3),R=Math.min(f.length,Math.ceil((ue+g)/u)+3),te=f.slice(n,R);return t.jsx("div",{style:{height:c,position:"relative"},children:te.map((h,De)=>{const oe=n+De,se=d.includes(h.value);return t.jsx("div",{role:"option","aria-selected":se,className:`nice-select__option ${se?"nice-select__option--selected":""} ${oe===L?"nice-select__option--highlighted":""} ${h.disabled?"nice-select__option--disabled":""}`,style:{position:"absolute",top:oe*u,left:0,right:0,height:u,display:"flex",alignItems:"center",padding:"0 12px"},onClick:()=>!h.disabled&&ee(String(h.value)),onMouseEnter:()=>F(oe),children:P?P(h,se):t.jsxs(t.Fragment,{children:[h.icon&&t.jsx("span",{children:h.icon}),t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{children:h.label}),h.description&&t.jsx("div",{className:"nice-select__option-desc",children:h.description})]}),se&&t.jsx("svg",{className:"nice-select__option-check",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})]})},h.value)})})})():Array.from(xe.entries()).map(([e,c])=>t.jsxs(s.Fragment,{children:[e&&t.jsx("div",{className:"nice-select__group-label",children:e}),c.map(n=>{const R=d.includes(n.value),te=f.indexOf(n);return t.jsx("div",{role:"option","aria-selected":R,className:`nice-select__option ${R?"nice-select__option--selected":""} ${te===L?"nice-select__option--highlighted":""} ${n.disabled?"nice-select__option--disabled":""}`,onClick:()=>!n.disabled&&ee(String(n.value)),onMouseEnter:()=>F(te),children:P?P(n,R):t.jsxs(t.Fragment,{children:[n.icon&&t.jsx("span",{children:n.icon}),t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{children:n.label}),n.description&&t.jsx("div",{className:"nice-select__option-desc",children:n.description})]}),R&&t.jsx("svg",{className:"nice-select__option-check",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})]})},n.value)})]},e))]}),me)]}),y&&t.jsx("span",{className:"nice-field__spinner",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),G==="right"&&a&&t.jsx("div",{id:`${$}-error`,className:"nice-field__error",role:"alert",children:a}),G==="right"&&!a&&i&&t.jsx("div",{id:`${$}-helper`,className:"nice-field__helper",children:i})]}),G!=="right"&&a&&t.jsx("div",{id:`${$}-error`,className:"nice-field__error",role:"alert",children:a}),G!=="right"&&!a&&i&&t.jsx("div",{id:`${$}-helper`,className:"nice-field__helper",children:i})]})});ae.displayName="NiceSelect";const Oe=Object.freeze(Object.defineProperty({__proto__:null,NiceSelect:ae},Symbol.toStringTag,{value:"Module"}));exports.NiceSelect=ae;exports.NiceSelect$1=Oe;exports.scopeThemeClass=_e;exports.useAnchoredPopup=ve;