@nice2dev/ui-3d 1.1.0 → 1.1.1

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 (206) hide show
  1. package/dist/cjs/collaborative/collaborativeScene.js +16 -8
  2. package/dist/cjs/collaborative/collaborativeScene.js.map +1 -1
  3. package/dist/cjs/core/i18n.js +3 -3
  4. package/dist/cjs/dance/DanceBridge.js +65 -30
  5. package/dist/cjs/dance/DanceBridge.js.map +1 -1
  6. package/dist/cjs/dance/DanceScoreEngine.js +37 -23
  7. package/dist/cjs/dance/DanceScoreEngine.js.map +1 -1
  8. package/dist/cjs/dance/PoseDetector.js +92 -49
  9. package/dist/cjs/dance/PoseDetector.js.map +1 -1
  10. package/dist/cjs/material/NiceMaterialEditor.js +134 -91
  11. package/dist/cjs/material/NiceMaterialEditor.js.map +1 -1
  12. package/dist/cjs/material/materialEditorUtils.js +86 -55
  13. package/dist/cjs/material/materialEditorUtils.js.map +1 -1
  14. package/dist/cjs/model/ModelEditor.js +16 -14
  15. package/dist/cjs/model/ModelEditor.js.map +1 -1
  16. package/dist/cjs/model/ModelEditorLeftPanel.js +21 -15
  17. package/dist/cjs/model/ModelEditorLeftPanel.js.map +1 -1
  18. package/dist/cjs/model/ModelEditorMenuBar.js +23 -10
  19. package/dist/cjs/model/ModelEditorMenuBar.js.map +1 -1
  20. package/dist/cjs/model/ModelEditorRightPanel.js +32 -27
  21. package/dist/cjs/model/ModelEditorRightPanel.js.map +1 -1
  22. package/dist/cjs/model/ModelEditorSubComponents.js +20 -20
  23. package/dist/cjs/model/ModelEditorSubComponents.js.map +1 -1
  24. package/dist/cjs/model/ModelEditorTimeline.js +12 -11
  25. package/dist/cjs/model/ModelEditorTimeline.js.map +1 -1
  26. package/dist/cjs/model/ModelEditorToolbar.js +5 -5
  27. package/dist/cjs/model/ModelEditorToolbar.js.map +1 -1
  28. package/dist/cjs/model/ModelEditorViewport.js +12 -8
  29. package/dist/cjs/model/ModelEditorViewport.js.map +1 -1
  30. package/dist/cjs/model/ModelViewer.js +16 -15
  31. package/dist/cjs/model/ModelViewer.js.map +1 -1
  32. package/dist/cjs/model/NiceArmatureEditor.js +53 -30
  33. package/dist/cjs/model/NiceArmatureEditor.js.map +1 -1
  34. package/dist/cjs/model/NiceMorphTargetEditor.js +51 -30
  35. package/dist/cjs/model/NiceMorphTargetEditor.js.map +1 -1
  36. package/dist/cjs/model/NiceOctree.js +62 -37
  37. package/dist/cjs/model/NiceOctree.js.map +1 -1
  38. package/dist/cjs/model/NicePhysicsSimulation.js +74 -36
  39. package/dist/cjs/model/NicePhysicsSimulation.js.map +1 -1
  40. package/dist/cjs/model/NiceProceduralGeometry.js +101 -31
  41. package/dist/cjs/model/NiceProceduralGeometry.js.map +1 -1
  42. package/dist/cjs/model/NiceTerrainEditor.js +88 -38
  43. package/dist/cjs/model/NiceTerrainEditor.js.map +1 -1
  44. package/dist/cjs/model/NiceWeightPainter.js +46 -24
  45. package/dist/cjs/model/NiceWeightPainter.js.map +1 -1
  46. package/dist/cjs/model/NiceXRPreview.js +89 -43
  47. package/dist/cjs/model/NiceXRPreview.js.map +1 -1
  48. package/dist/cjs/model/cadModeUtils.js +2 -2
  49. package/dist/cjs/model/cadModeUtils.js.map +1 -1
  50. package/dist/cjs/model/editorShortcuts.js +69 -35
  51. package/dist/cjs/model/editorShortcuts.js.map +1 -1
  52. package/dist/cjs/model/modelEditorTypes.js +56 -52
  53. package/dist/cjs/model/modelEditorTypes.js.map +1 -1
  54. package/dist/cjs/model/modelEditorUtils.js +356 -131
  55. package/dist/cjs/model/modelEditorUtils.js.map +1 -1
  56. package/dist/cjs/model/simsModeUtils.js +819 -74
  57. package/dist/cjs/model/simsModeUtils.js.map +1 -1
  58. package/dist/cjs/model/useModelEditor.js +501 -394
  59. package/dist/cjs/model/useModelEditor.js.map +1 -1
  60. package/dist/cjs/model/useModelViewer.js +117 -86
  61. package/dist/cjs/model/useModelViewer.js.map +1 -1
  62. package/dist/cjs/particle/NiceParticleEditor.js +126 -69
  63. package/dist/cjs/particle/NiceParticleEditor.js.map +1 -1
  64. package/dist/cjs/particle/particleEditorUtils.js +64 -27
  65. package/dist/cjs/particle/particleEditorUtils.js.map +1 -1
  66. package/dist/cjs/rendering/NiceCascadedShadows.js +35 -23
  67. package/dist/cjs/rendering/NiceCascadedShadows.js.map +1 -1
  68. package/dist/cjs/rendering/NiceRenderExport.js +26 -12
  69. package/dist/cjs/rendering/NiceRenderExport.js.map +1 -1
  70. package/dist/cjs/rendering/NiceSSAO.js +28 -23
  71. package/dist/cjs/rendering/NiceSSAO.js.map +1 -1
  72. package/dist/cjs/rendering/NiceSSR.js +22 -18
  73. package/dist/cjs/rendering/NiceSSR.js.map +1 -1
  74. package/dist/cjs/rendering/NiceWebGPURenderer.js +60 -37
  75. package/dist/cjs/rendering/NiceWebGPURenderer.js.map +1 -1
  76. package/dist/cjs/ui/dist/NiceErrorBoundary-D75yr_WE.js +572 -0
  77. package/dist/cjs/ui/dist/NiceErrorBoundary-D75yr_WE.js.map +1 -0
  78. package/dist/cjs/ui/dist/NiceForm-CKoJA6NG.js +4979 -0
  79. package/dist/cjs/ui/dist/NiceForm-CKoJA6NG.js.map +1 -0
  80. package/dist/cjs/ui/dist/NiceModal-1QX7NhyH.js +98 -0
  81. package/dist/cjs/ui/dist/NiceModal-1QX7NhyH.js.map +1 -0
  82. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5244 -0
  83. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js.map +1 -0
  84. package/dist/cjs/ui/dist/NicePagination-DbE-uOkl.js +174 -0
  85. package/dist/cjs/ui/dist/NicePagination-DbE-uOkl.js.map +1 -0
  86. package/dist/cjs/ui/dist/NicePinCodeInput-B8cI8zu8.js +10459 -0
  87. package/dist/cjs/ui/dist/NicePinCodeInput-B8cI8zu8.js.map +1 -0
  88. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6313 -0
  89. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js.map +1 -0
  90. package/dist/cjs/ui/dist/NiceTabs-DzLHzwuA.js +1639 -0
  91. package/dist/cjs/ui/dist/NiceTabs-DzLHzwuA.js.map +1 -0
  92. package/dist/cjs/ui/dist/NiceWindow-DeC83yfE.js +807 -0
  93. package/dist/cjs/ui/dist/NiceWindow-DeC83yfE.js.map +1 -0
  94. package/dist/cjs/ui/dist/charts-BAS21jkC.js +3833 -0
  95. package/dist/cjs/ui/dist/charts-BAS21jkC.js.map +1 -0
  96. package/dist/cjs/ui/dist/core-Da43q-pO.js +11683 -0
  97. package/dist/cjs/ui/dist/core-Da43q-pO.js.map +1 -0
  98. package/dist/cjs/ui/dist/index-pAuGTbuB.js +28876 -0
  99. package/dist/cjs/ui/dist/index-pAuGTbuB.js.map +1 -0
  100. package/dist/cjs/uv/NiceUVEditor.js +115 -86
  101. package/dist/cjs/uv/NiceUVEditor.js.map +1 -1
  102. package/dist/cjs/uv/uvEditorUtils.js +41 -23
  103. package/dist/cjs/uv/uvEditorUtils.js.map +1 -1
  104. package/dist/esm/collaborative/collaborativeScene.js +16 -8
  105. package/dist/esm/collaborative/collaborativeScene.js.map +1 -1
  106. package/dist/esm/dance/DanceBridge.js +55 -20
  107. package/dist/esm/dance/DanceBridge.js.map +1 -1
  108. package/dist/esm/dance/DanceScoreEngine.js +29 -15
  109. package/dist/esm/dance/DanceScoreEngine.js.map +1 -1
  110. package/dist/esm/dance/PoseDetector.js +73 -30
  111. package/dist/esm/dance/PoseDetector.js.map +1 -1
  112. package/dist/esm/material/NiceMaterialEditor.js +115 -72
  113. package/dist/esm/material/NiceMaterialEditor.js.map +1 -1
  114. package/dist/esm/material/materialEditorUtils.js +86 -55
  115. package/dist/esm/material/materialEditorUtils.js.map +1 -1
  116. package/dist/esm/model/ModelEditor.js +16 -14
  117. package/dist/esm/model/ModelEditor.js.map +1 -1
  118. package/dist/esm/model/ModelEditorLeftPanel.js +21 -15
  119. package/dist/esm/model/ModelEditorLeftPanel.js.map +1 -1
  120. package/dist/esm/model/ModelEditorMenuBar.js +23 -10
  121. package/dist/esm/model/ModelEditorMenuBar.js.map +1 -1
  122. package/dist/esm/model/ModelEditorRightPanel.js +32 -27
  123. package/dist/esm/model/ModelEditorRightPanel.js.map +1 -1
  124. package/dist/esm/model/ModelEditorSubComponents.js +17 -17
  125. package/dist/esm/model/ModelEditorSubComponents.js.map +1 -1
  126. package/dist/esm/model/ModelEditorTimeline.js +12 -11
  127. package/dist/esm/model/ModelEditorTimeline.js.map +1 -1
  128. package/dist/esm/model/ModelEditorToolbar.js +5 -5
  129. package/dist/esm/model/ModelEditorToolbar.js.map +1 -1
  130. package/dist/esm/model/ModelEditorViewport.js +12 -8
  131. package/dist/esm/model/ModelEditorViewport.js.map +1 -1
  132. package/dist/esm/model/ModelViewer.js +8 -7
  133. package/dist/esm/model/ModelViewer.js.map +1 -1
  134. package/dist/esm/model/NiceArmatureEditor.js +36 -13
  135. package/dist/esm/model/NiceArmatureEditor.js.map +1 -1
  136. package/dist/esm/model/NiceMorphTargetEditor.js +34 -13
  137. package/dist/esm/model/NiceMorphTargetEditor.js.map +1 -1
  138. package/dist/esm/model/NiceOctree.js +47 -22
  139. package/dist/esm/model/NiceOctree.js.map +1 -1
  140. package/dist/esm/model/NicePhysicsSimulation.js +51 -13
  141. package/dist/esm/model/NicePhysicsSimulation.js.map +1 -1
  142. package/dist/esm/model/NiceProceduralGeometry.js +94 -24
  143. package/dist/esm/model/NiceProceduralGeometry.js.map +1 -1
  144. package/dist/esm/model/NiceTerrainEditor.js +70 -20
  145. package/dist/esm/model/NiceTerrainEditor.js.map +1 -1
  146. package/dist/esm/model/NiceWeightPainter.js +33 -11
  147. package/dist/esm/model/NiceWeightPainter.js.map +1 -1
  148. package/dist/esm/model/NiceXRPreview.js +72 -26
  149. package/dist/esm/model/NiceXRPreview.js.map +1 -1
  150. package/dist/esm/model/cadModeUtils.js +2 -2
  151. package/dist/esm/model/cadModeUtils.js.map +1 -1
  152. package/dist/esm/model/editorShortcuts.js +69 -35
  153. package/dist/esm/model/editorShortcuts.js.map +1 -1
  154. package/dist/esm/model/modelEditorTypes.js +56 -52
  155. package/dist/esm/model/modelEditorTypes.js.map +1 -1
  156. package/dist/esm/model/modelEditorUtils.js +356 -131
  157. package/dist/esm/model/modelEditorUtils.js.map +1 -1
  158. package/dist/esm/model/simsModeUtils.js +819 -74
  159. package/dist/esm/model/simsModeUtils.js.map +1 -1
  160. package/dist/esm/model/useModelEditor.js +384 -277
  161. package/dist/esm/model/useModelEditor.js.map +1 -1
  162. package/dist/esm/model/useModelViewer.js +56 -25
  163. package/dist/esm/model/useModelViewer.js.map +1 -1
  164. package/dist/esm/particle/NiceParticleEditor.js +116 -59
  165. package/dist/esm/particle/NiceParticleEditor.js.map +1 -1
  166. package/dist/esm/particle/particleEditorUtils.js +64 -27
  167. package/dist/esm/particle/particleEditorUtils.js.map +1 -1
  168. package/dist/esm/rendering/NiceCascadedShadows.js +24 -12
  169. package/dist/esm/rendering/NiceCascadedShadows.js.map +1 -1
  170. package/dist/esm/rendering/NiceRenderExport.js +22 -8
  171. package/dist/esm/rendering/NiceRenderExport.js.map +1 -1
  172. package/dist/esm/rendering/NiceSSAO.js +11 -6
  173. package/dist/esm/rendering/NiceSSAO.js.map +1 -1
  174. package/dist/esm/rendering/NiceSSR.js +9 -5
  175. package/dist/esm/rendering/NiceSSR.js.map +1 -1
  176. package/dist/esm/rendering/NiceWebGPURenderer.js +40 -17
  177. package/dist/esm/rendering/NiceWebGPURenderer.js.map +1 -1
  178. package/dist/esm/ui/dist/NiceErrorBoundary-D75yr_WE.js +563 -0
  179. package/dist/esm/ui/dist/NiceErrorBoundary-D75yr_WE.js.map +1 -0
  180. package/dist/esm/ui/dist/NiceForm-CKoJA6NG.js +4960 -0
  181. package/dist/esm/ui/dist/NiceForm-CKoJA6NG.js.map +1 -0
  182. package/dist/esm/ui/dist/NiceModal-1QX7NhyH.js +96 -0
  183. package/dist/esm/ui/dist/NiceModal-1QX7NhyH.js.map +1 -0
  184. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5201 -0
  185. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js.map +1 -0
  186. package/dist/esm/ui/dist/NicePagination-DbE-uOkl.js +172 -0
  187. package/dist/esm/ui/dist/NicePagination-DbE-uOkl.js.map +1 -0
  188. package/dist/esm/ui/dist/NicePinCodeInput-B8cI8zu8.js +10408 -0
  189. package/dist/esm/ui/dist/NicePinCodeInput-B8cI8zu8.js.map +1 -0
  190. package/dist/esm/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6296 -0
  191. package/dist/esm/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js.map +1 -0
  192. package/dist/esm/ui/dist/NiceTabs-DzLHzwuA.js +1630 -0
  193. package/dist/esm/ui/dist/NiceTabs-DzLHzwuA.js.map +1 -0
  194. package/dist/esm/ui/dist/NiceWindow-DeC83yfE.js +796 -0
  195. package/dist/esm/ui/dist/NiceWindow-DeC83yfE.js.map +1 -0
  196. package/dist/esm/ui/dist/charts-BAS21jkC.js +3809 -0
  197. package/dist/esm/ui/dist/charts-BAS21jkC.js.map +1 -0
  198. package/dist/esm/ui/dist/core-Da43q-pO.js +11502 -0
  199. package/dist/esm/ui/dist/core-Da43q-pO.js.map +1 -0
  200. package/dist/esm/ui/dist/index-pAuGTbuB.js +28792 -0
  201. package/dist/esm/ui/dist/index-pAuGTbuB.js.map +1 -0
  202. package/dist/esm/uv/NiceUVEditor.js +91 -62
  203. package/dist/esm/uv/NiceUVEditor.js.map +1 -1
  204. package/dist/esm/uv/uvEditorUtils.js +41 -23
  205. package/dist/esm/uv/uvEditorUtils.js.map +1 -1
  206. package/package.json +2 -2
@@ -0,0 +1,1639 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var _e = require('react');
5
+ var coreDa43qPO = require('./core-Da43q-pO.js');
6
+ var ze = require('react-dom');
7
+
8
+ const Je = _e.forwardRef(
9
+ ({
10
+ label: l,
11
+ helperText: h,
12
+ error: t,
13
+ required: d,
14
+ disabled: i,
15
+ readOnly: n,
16
+ size: a = "md",
17
+ name: y,
18
+ id: u,
19
+ className: o,
20
+ style: f,
21
+ accessMode: D,
22
+ displayStyle: z,
23
+ variant: m,
24
+ value: w,
25
+ defaultValue: R,
26
+ onChange: p,
27
+ onBlur: J,
28
+ onKeyDown: E,
29
+ placeholder: $,
30
+ type: L = "text",
31
+ maxLength: b,
32
+ prefix: F,
33
+ suffix: T,
34
+ clearable: x,
35
+ autoFocus: M,
36
+ submitOnEnter: U,
37
+ onSubmit: V,
38
+ showKeyboardHints: I,
39
+ labelPlacement: j,
40
+ errorPlacement: ae,
41
+ loading: ue,
42
+ labelWidth: ne,
43
+ controlWidth: X,
44
+ displayMode: P,
45
+ ...k
46
+ }, _) => {
47
+ const q = coreDa43qPO.h(D, u);
48
+ if (q === "hidden")
49
+ return null;
50
+ q === "disabled" && (i = true), q === "readOnly" && (n = true);
51
+ const { t: S } = coreDa43qPO.W(), A = coreDa43qPO.b(u), G = coreDa43qPO.c("input", z), se = coreDa43qPO.d("input", z), ve = m === "filled" ? "filled" : m === "underlined" ? "underlined" : "", O = _e.useCallback(() => p?.(""), [p]), Y = coreDa43qPO.i({ enabled: P, readOnly: n, disabled: i }), re = coreDa43qPO.j({
52
+ enabled: U,
53
+ onSubmit: V
54
+ }), ie = _e.useCallback(
55
+ (g) => {
56
+ re(g), E?.(g);
57
+ },
58
+ [re, E]
59
+ ), r = _e.useMemo(() => {
60
+ const g = [];
61
+ return U && g.push({ key: "Enter", description: S("shortcuts.submit", "Submit") }), x && g.push({ key: "Escape", description: S("shortcuts.clear", "Clear") }), g;
62
+ }, [U, x, S]);
63
+ return /* @__PURE__ */ jsxRuntime.jsxs(
64
+ "div",
65
+ {
66
+ className: `nice-field nice-field--${a} ${j === "left" ? "nice-field--label-left" : ""} ${j === "inside" ? "nice-field--label-inside" : ""} ${ue ? "nice-field--loading" : ""} ${o || ""}`,
67
+ style: {
68
+ ...f,
69
+ ...ne != null && {
70
+ "--nice-field-label-width": typeof ne == "number" ? `${ne}px` : ne
71
+ },
72
+ ...X != null && {
73
+ "--nice-field-control-width": typeof X == "number" ? `${X}px` : X
74
+ }
75
+ },
76
+ "aria-busy": ue || void 0,
77
+ "data-floating": j === "inside" && w ? "true" : void 0,
78
+ children: [
79
+ l && j !== "inside" && /* @__PURE__ */ jsxRuntime.jsxs(
80
+ "label",
81
+ {
82
+ htmlFor: A,
83
+ className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
84
+ children: [
85
+ l,
86
+ I && r.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(coreDa43qPO.k, { shortcuts: r, size: "sm" })
87
+ ]
88
+ }
89
+ ),
90
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-field__control", children: [
91
+ Y.isDisplay ? /* @__PURE__ */ jsxRuntime.jsx(
92
+ coreDa43qPO.D,
93
+ {
94
+ value: w ?? R ?? "",
95
+ placeholder: $,
96
+ disabled: i,
97
+ readOnly: n,
98
+ onActivate: Y.enterEdit,
99
+ ariaLabel: l
100
+ }
101
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
102
+ "div",
103
+ {
104
+ className: `nice-input nice-input--${a} nice-input--ds-${ve || se} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
105
+ style: m ? void 0 : G,
106
+ children: [
107
+ F && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-input__icon", children: F }),
108
+ /* @__PURE__ */ jsxRuntime.jsx(
109
+ "input",
110
+ {
111
+ ref: (g) => {
112
+ typeof _ == "function" ? _(g) : _ && (_.current = g), Y.autoFocusRef(g);
113
+ },
114
+ id: A,
115
+ className: "nice-input__native",
116
+ type: L,
117
+ name: y,
118
+ value: w,
119
+ defaultValue: R,
120
+ placeholder: $,
121
+ disabled: i || ue,
122
+ readOnly: n,
123
+ maxLength: b,
124
+ autoFocus: M,
125
+ "aria-invalid": !!t,
126
+ "aria-describedby": t ? `${A}-error` : h ? `${A}-helper` : void 0,
127
+ onChange: (g) => p?.(g.target.value),
128
+ onBlur: (g) => {
129
+ P && Y.exitEdit(), J?.(g);
130
+ },
131
+ onKeyDown: ie,
132
+ ...k
133
+ }
134
+ ),
135
+ x && w && /* @__PURE__ */ jsxRuntime.jsx(
136
+ "button",
137
+ {
138
+ type: "button",
139
+ className: "nice-input__clear",
140
+ onClick: O,
141
+ "aria-label": S("controls.clear", "Clear"),
142
+ children: "✕"
143
+ }
144
+ ),
145
+ T && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-input__icon", children: T }),
146
+ l && j === "inside" && /* @__PURE__ */ jsxRuntime.jsx(
147
+ "label",
148
+ {
149
+ htmlFor: A,
150
+ className: `nice-input__floating-label ${d ? "nice-input__floating-label--required" : ""}`,
151
+ children: l
152
+ }
153
+ )
154
+ ]
155
+ }
156
+ ),
157
+ ue && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-field__spinner", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-spinner nice-spinner--sm" }) }),
158
+ ae === "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${A}-error`, className: "nice-field__error", role: "alert", children: t }),
159
+ ae === "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${A}-helper`, className: "nice-field__helper", children: h })
160
+ ] }),
161
+ ae !== "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${A}-error`, className: "nice-field__error", role: "alert", children: t }),
162
+ ae !== "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${A}-helper`, className: "nice-field__helper", children: h })
163
+ ]
164
+ }
165
+ );
166
+ }
167
+ );
168
+ Je.displayName = "NiceTextInput";
169
+ const Qe = _e.forwardRef(
170
+ ({
171
+ label: l,
172
+ helperText: h,
173
+ error: t,
174
+ required: d,
175
+ disabled: i,
176
+ readOnly: n,
177
+ size: a = "md",
178
+ name: y,
179
+ id: u,
180
+ className: o,
181
+ style: f,
182
+ accessMode: D,
183
+ displayStyle: z,
184
+ value: m,
185
+ onChange: w,
186
+ onBlur: R,
187
+ onKeyDown: p,
188
+ placeholder: J,
189
+ min: E,
190
+ max: $,
191
+ step: L = 1,
192
+ precision: b,
193
+ prefix: F,
194
+ prefixType: T = "label",
195
+ prefixOptions: x,
196
+ prefixValue: M,
197
+ onPrefixChange: U,
198
+ suffix: V,
199
+ showStepper: I = true,
200
+ submitOnEnter: j,
201
+ onSubmit: ae,
202
+ showKeyboardHints: ue,
203
+ labelPlacement: ne,
204
+ errorPlacement: X,
205
+ loading: P,
206
+ labelWidth: k,
207
+ controlWidth: _,
208
+ formatPreset: q,
209
+ format: S,
210
+ suffixType: A = "label",
211
+ suffixOptions: G,
212
+ suffixValue: se,
213
+ onSuffixChange: ve,
214
+ displayMode: O
215
+ }, Y) => {
216
+ const re = coreDa43qPO.h(D, u);
217
+ if (re === "hidden")
218
+ return null;
219
+ re === "disabled" && (i = true), re === "readOnly" && (n = true);
220
+ const { t: ie } = coreDa43qPO.W(), r = coreDa43qPO.b(u), g = coreDa43qPO.c("input", z), K = coreDa43qPO.d("input", z), [C, Q] = _e.useState(false), [Z, ge] = _e.useState(null), be = coreDa43qPO.i({ enabled: O, readOnly: n, disabled: i }), pe = _e.useMemo(() => {
221
+ let c = 3;
222
+ return $ != null && (c = String(Math.abs(Math.floor($))).length), E != null && E < 0 && (c += 1), b && (c += b + 1), Math.max(3, c) + 1;
223
+ }, [$, E, b]), Me = _e.useCallback(
224
+ (c) => {
225
+ if (S)
226
+ return S(c);
227
+ if (!q)
228
+ return b != null ? c.toFixed(b) : String(c);
229
+ switch (q) {
230
+ case "integer":
231
+ return Math.round(c).toLocaleString();
232
+ case "decimal":
233
+ return c.toLocaleString(void 0, {
234
+ minimumFractionDigits: b ?? 2,
235
+ maximumFractionDigits: b ?? 2
236
+ });
237
+ case "money":
238
+ return c.toLocaleString(void 0, {
239
+ minimumFractionDigits: b ?? 2,
240
+ maximumFractionDigits: b ?? 2,
241
+ useGrouping: true
242
+ });
243
+ case "percent":
244
+ return (c * 100).toLocaleString(void 0, {
245
+ minimumFractionDigits: b ?? 0,
246
+ maximumFractionDigits: b ?? 2
247
+ }) + "%";
248
+ default:
249
+ return String(c);
250
+ }
251
+ },
252
+ [S, q, b]
253
+ ), Ce = _e.useMemo(() => C && Z !== null ? Z : m == null ? "" : C ? b != null ? m.toFixed(b) : String(m) : Me(m), [m, C, Z, Me, b]), he = m != null && m < 0, te = !!(F || T === "select" && x && x.length > 0), W = he && te && !C, He = W ? Ce.replace(/^[-−]/, "") : Ce, fe = _e.useCallback(
254
+ (c) => {
255
+ let N = c;
256
+ return E !== void 0 && (N = Math.max(E, N)), $ !== void 0 && (N = Math.min($, N)), b !== void 0 && (N = parseFloat(N.toFixed(b))), N;
257
+ },
258
+ [E, $, b]
259
+ ), Te = _e.useCallback(
260
+ (c) => {
261
+ const N = c.target.value;
262
+ if (ge(N), N === "" || N === "-" || N === "." || N === "-.") {
263
+ N === "" && w?.(null);
264
+ return;
265
+ }
266
+ const le = parseFloat(N);
267
+ if (!isNaN(le)) {
268
+ let _e = le;
269
+ E !== void 0 && (_e = Math.max(E, _e)), $ !== void 0 && (_e = Math.min($, _e)), w?.(_e);
270
+ }
271
+ },
272
+ [w, E, $]
273
+ ), Ne = _e.useCallback(() => {
274
+ const c = $e.current, N = fe((c ?? 0) + L);
275
+ $e.current = N, w?.(N);
276
+ }, [L, w, fe]), De = _e.useCallback(() => {
277
+ const c = $e.current, N = fe((c ?? 0) - L);
278
+ $e.current = N, w?.(N);
279
+ }, [L, w, fe]), $e = _e.useRef(m);
280
+ $e.current = m;
281
+ const s = _e.useRef(null), H = _e.useCallback(() => {
282
+ s.current && (clearTimeout(s.current), s.current = null);
283
+ }, []), B = _e.useCallback(
284
+ (c) => {
285
+ H();
286
+ let N = 300;
287
+ const le = () => {
288
+ c(), N = Math.max(30, N * 0.82), s.current = setTimeout(le, N);
289
+ };
290
+ s.current = setTimeout(le, 400);
291
+ },
292
+ [H]
293
+ ), me = coreDa43qPO.j({
294
+ enabled: j,
295
+ onSubmit: ae
296
+ }), Se = _e.useCallback(
297
+ (c) => {
298
+ me(c), c.key === "ArrowUp" ? (c.preventDefault(), Ne()) : c.key === "ArrowDown" && (c.preventDefault(), De()), p?.(c);
299
+ },
300
+ [me, p, Ne, De]
301
+ ), ce = _e.useMemo(() => {
302
+ const c = [];
303
+ return j && c.push(coreDa43qPO.C.submit), I && (c.push({ key: "ArrowUp", description: ie("shortcuts.increment", "Increase value") }), c.push({ key: "ArrowDown", description: ie("shortcuts.decrement", "Decrease value") })), c;
304
+ }, [j, I, ie]);
305
+ return /* @__PURE__ */ jsxRuntime.jsxs(
306
+ "div",
307
+ {
308
+ className: `nice-field nice-field--${a} ${ne === "left" ? "nice-field--label-left" : ""} ${P ? "nice-field--loading" : ""} ${o || ""}`,
309
+ style: {
310
+ ...f,
311
+ ...k != null && {
312
+ "--nice-field-label-width": typeof k == "number" ? `${k}px` : k
313
+ },
314
+ ..._ != null && {
315
+ "--nice-field-control-width": typeof _ == "number" ? `${_}px` : _
316
+ }
317
+ },
318
+ "aria-busy": P || void 0,
319
+ children: [
320
+ l && /* @__PURE__ */ jsxRuntime.jsxs(
321
+ "label",
322
+ {
323
+ htmlFor: r,
324
+ className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
325
+ children: [
326
+ l,
327
+ ue && ce.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(coreDa43qPO.k, { shortcuts: ce, size: "sm" })
328
+ ]
329
+ }
330
+ ),
331
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-field__control", children: [
332
+ be.isDisplay ? /* @__PURE__ */ jsxRuntime.jsx(
333
+ coreDa43qPO.D,
334
+ {
335
+ value: m == null ? "" : F ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
336
+ F,
337
+ Ce
338
+ ] }) : Ce,
339
+ placeholder: J,
340
+ disabled: i,
341
+ readOnly: n,
342
+ onActivate: be.enterEdit,
343
+ ariaLabel: l
344
+ }
345
+ ) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
346
+ "div",
347
+ {
348
+ className: `nice-input nice-input--number nice-input--${a} nice-input--ds-${K} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
349
+ style: g,
350
+ children: [
351
+ I && !n && /* @__PURE__ */ jsxRuntime.jsx(
352
+ "button",
353
+ {
354
+ type: "button",
355
+ className: "nice-input__clear nice-input__minus",
356
+ onClick: De,
357
+ onMouseDown: () => B(De),
358
+ onMouseUp: H,
359
+ onMouseLeave: H,
360
+ disabled: i,
361
+ "aria-label": ie("controls.decrement", "Decrement"),
362
+ children: "−"
363
+ }
364
+ ),
365
+ T === "select" && x && x.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
366
+ W && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-input__sign", children: "−" }),
367
+ /* @__PURE__ */ jsxRuntime.jsx(
368
+ "select",
369
+ {
370
+ className: "nice-input__suffix-select nice-input__icon--prefix",
371
+ value: M ?? x[0]?.value,
372
+ disabled: i,
373
+ onChange: (c) => {
374
+ const N = c.target.value, le = x.find(
375
+ (ke) => ke.value === (M ?? x[0]?.value)
376
+ ), _e = x.find((ke) => ke.value === N);
377
+ U?.(N, le?.weight, _e?.weight);
378
+ },
379
+ children: x.map((c) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: c.value, children: c.label }, c.value))
380
+ }
381
+ )
382
+ ] }) : F ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nice-input__icon nice-input__icon--prefix", children: [
383
+ W && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-input__sign", children: "−" }),
384
+ F
385
+ ] }) : null,
386
+ /* @__PURE__ */ jsxRuntime.jsx(
387
+ "input",
388
+ {
389
+ ref: (c) => {
390
+ typeof Y == "function" ? Y(c) : Y && (Y.current = c), be.autoFocusRef(c);
391
+ },
392
+ id: r,
393
+ className: "nice-input__native",
394
+ type: !C && (S || q) ? "text" : "number",
395
+ name: y,
396
+ value: He,
397
+ placeholder: J,
398
+ min: E,
399
+ max: $,
400
+ step: L,
401
+ disabled: i || P,
402
+ readOnly: n,
403
+ "aria-invalid": !!t,
404
+ onChange: Te,
405
+ onFocus: (c) => {
406
+ Q(true), ge(null), c.target.select();
407
+ },
408
+ onBlur: (c) => {
409
+ if (Q(false), ge(null), m != null && b !== void 0) {
410
+ const N = parseFloat(m.toFixed(b));
411
+ N !== m && w?.(N);
412
+ }
413
+ O && be.exitEdit(), R?.(c);
414
+ },
415
+ onKeyDown: Se,
416
+ style: { width: `${pe}ch` }
417
+ }
418
+ ),
419
+ A === "select" && G && G.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
420
+ "select",
421
+ {
422
+ className: "nice-input__suffix-select nice-input__icon--suffix",
423
+ value: se ?? G[0]?.value,
424
+ disabled: i,
425
+ onChange: (c) => {
426
+ const N = c.target.value, le = G.find(
427
+ (ke) => ke.value === (se ?? G[0]?.value)
428
+ ), _e = G.find((ke) => ke.value === N);
429
+ ve?.(N, le?.weight, _e?.weight);
430
+ },
431
+ children: G.map((c) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: c.value, children: c.label }, c.value))
432
+ }
433
+ ) : V ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-input__icon nice-input__icon--suffix", children: V }) : null,
434
+ I && !n && /* @__PURE__ */ jsxRuntime.jsx(
435
+ "button",
436
+ {
437
+ type: "button",
438
+ className: "nice-input__clear nice-input__plus",
439
+ onClick: Ne,
440
+ onMouseDown: () => B(Ne),
441
+ onMouseUp: H,
442
+ onMouseLeave: H,
443
+ disabled: i,
444
+ "aria-label": ie("controls.increment", "Increment"),
445
+ children: "+"
446
+ }
447
+ )
448
+ ]
449
+ }
450
+ ) }),
451
+ P && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-field__spinner", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-spinner nice-spinner--sm" }) }),
452
+ X === "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-field__error", role: "alert", children: t }),
453
+ X === "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-field__helper", children: h })
454
+ ] }),
455
+ X !== "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-field__error", role: "alert", children: t }),
456
+ X !== "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-field__helper", children: h })
457
+ ]
458
+ }
459
+ );
460
+ }
461
+ );
462
+ Qe.displayName = "NiceNumberInput";
463
+ const Ze = _e.forwardRef(
464
+ ({
465
+ label: l,
466
+ helperText: h,
467
+ error: t,
468
+ required: d,
469
+ disabled: i,
470
+ size: n = "md",
471
+ name: a,
472
+ id: y,
473
+ className: u,
474
+ style: o,
475
+ accessMode: f,
476
+ displayStyle: D,
477
+ options: z,
478
+ value: m,
479
+ onChange: w,
480
+ placeholder: R,
481
+ multiple: p = false,
482
+ searchable: J = false,
483
+ clearable: E = false,
484
+ emptyText: $,
485
+ maxHeight: L = 240,
486
+ optionsSource: b,
487
+ valueField: F,
488
+ labelField: T,
489
+ virtualScroll: x,
490
+ optionHeight: M = 36,
491
+ onSearch: U,
492
+ loading: V,
493
+ renderOption: I,
494
+ multipleAutosize: j = false,
495
+ showKeyboardHints: ae,
496
+ labelPlacement: ue,
497
+ errorPlacement: ne,
498
+ labelWidth: X,
499
+ controlWidth: P,
500
+ displayMode: k
501
+ }, _) => {
502
+ const q = coreDa43qPO.h(f, y);
503
+ if (q === "hidden")
504
+ return null;
505
+ (q === "disabled" || q === "readOnly") && (i = true);
506
+ const { t: S } = coreDa43qPO.W(), A = coreDa43qPO.c("input", D), G = coreDa43qPO.d("input", D), se = coreDa43qPO.b(y), ve = coreDa43qPO.i({ enabled: k, disabled: i }), [O, Y] = _e.useState(false), [re, ie] = _e.useState(""), [r, g] = _e.useState(-1), [K, C] = _e.useState(0), Q = _e.useRef(null), Z = _e.useRef(null), [ge, be] = _e.useState(null);
507
+ _e.useLayoutEffect(() => {
508
+ !V && Z.current && be(Z.current.offsetWidth);
509
+ }, [V, m, D]);
510
+ const [pe, Me] = _e.useState(null);
511
+ _e.useLayoutEffect(() => {
512
+ p && !j && Z.current && pe == null && Me(Z.current.offsetWidth);
513
+ }, [p, j, pe]);
514
+ const Ce = coreDa43qPO.l(
515
+ b ?? null,
516
+ F ?? b?.keyField ?? "id",
517
+ T ?? "name"
518
+ ), he = b ? Ce.options : (z ?? []).map(
519
+ (s) => typeof s == "string" ? { value: s, label: s } : s
520
+ );
521
+ coreDa43qPO.f(Q, () => {
522
+ Y(false), ie("");
523
+ });
524
+ const te = _e.useMemo(() => m ? Array.isArray(m) ? m : [m] : [], [m]), W = _e.useMemo(() => {
525
+ if (!re && !U || U)
526
+ return he;
527
+ const s = re.toLowerCase();
528
+ return he.filter(
529
+ (H) => H.label.toLowerCase().includes(s) || String(H.value).toLowerCase().includes(s)
530
+ );
531
+ }, [he, re, U]), He = _e.useMemo(() => {
532
+ const s = /* @__PURE__ */ new Map();
533
+ for (const H of W) {
534
+ const B = H.group || "";
535
+ s.has(B) || s.set(B, []), s.get(B).push(H);
536
+ }
537
+ return s;
538
+ }, [W]), fe = _e.useCallback(
539
+ (s) => {
540
+ if (p) {
541
+ const H = te.includes(s) ? te.filter((B) => B !== s) : [...te, s];
542
+ w?.(H);
543
+ } else
544
+ w?.(s), Y(false), ie("");
545
+ },
546
+ [p, te, w]
547
+ ), Te = _e.useCallback(
548
+ (s) => {
549
+ if (s.key === "Escape") {
550
+ Y(false), ie("");
551
+ return;
552
+ }
553
+ if (s.key === "Enter" || s.key === " ") {
554
+ if (!O) {
555
+ Y(true), s.preventDefault();
556
+ return;
557
+ }
558
+ r >= 0 && W[r] && (fe(W[r].value), s.preventDefault());
559
+ return;
560
+ }
561
+ s.key === "ArrowDown" && (s.preventDefault(), g((H) => Math.min(H + 1, W.length - 1))), s.key === "ArrowUp" && (s.preventDefault(), g((H) => Math.max(H - 1, 0)));
562
+ },
563
+ [O, r, W, fe]
564
+ ), Ne = _e.useMemo(() => te.length === 0 ? null : p ? te.map((s) => he.find((H) => H.value === s)?.label || s).join(", ") : he.find((s) => s.value === te[0])?.label || te[0], [te, he, p]), De = _e.useCallback(
565
+ (s) => {
566
+ s.stopPropagation(), w?.(p ? [] : "");
567
+ },
568
+ [w, p]
569
+ ), $e = _e.useMemo(
570
+ () => [
571
+ { key: "Enter", description: S("shortcuts.select", "Select") },
572
+ { key: "Space", description: S("shortcuts.openDropdown", "Open dropdown") },
573
+ coreDa43qPO.C.moveUp,
574
+ coreDa43qPO.C.moveDown,
575
+ coreDa43qPO.C.cancel
576
+ ],
577
+ [S]
578
+ );
579
+ return /* @__PURE__ */ jsxRuntime.jsxs(
580
+ "div",
581
+ {
582
+ className: `nice-field ${P == null ? "nice-field--select-auto" : ""} nice-field--${n} ${ue === "left" ? "nice-field--label-left" : ""} ${V ? "nice-field--loading" : ""} ${u || ""}`,
583
+ style: {
584
+ ...o,
585
+ ...X != null && {
586
+ "--nice-field-label-width": typeof X == "number" ? `${X}px` : X
587
+ },
588
+ ...P != null && {
589
+ "--nice-field-control-width": typeof P == "number" ? `${P}px` : P
590
+ },
591
+ ...V && ge != null && { "--nice-select-locked-width": `${ge}px` }
592
+ },
593
+ "aria-busy": V || void 0,
594
+ children: [
595
+ l && /* @__PURE__ */ jsxRuntime.jsxs(
596
+ "label",
597
+ {
598
+ htmlFor: se,
599
+ className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
600
+ children: [
601
+ l,
602
+ ae && /* @__PURE__ */ jsxRuntime.jsx(coreDa43qPO.k, { shortcuts: $e, size: "sm" })
603
+ ]
604
+ }
605
+ ),
606
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-field__control", children: [
607
+ ve.isDisplay ? /* @__PURE__ */ jsxRuntime.jsx(
608
+ coreDa43qPO.D,
609
+ {
610
+ value: Ne,
611
+ placeholder: R || S("controls.select", "Select..."),
612
+ disabled: i,
613
+ onActivate: () => {
614
+ ve.enterEdit(), Y(true);
615
+ },
616
+ ariaLabel: l
617
+ }
618
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-select", ref: Q, children: [
619
+ /* @__PURE__ */ jsxRuntime.jsxs(
620
+ "button",
621
+ {
622
+ ref: (s) => {
623
+ Z.current = s, typeof _ == "function" ? _(s) : _ && (_.current = s);
624
+ },
625
+ type: "button",
626
+ id: se,
627
+ role: "combobox",
628
+ "aria-expanded": O,
629
+ "aria-haspopup": "listbox",
630
+ "aria-invalid": !!t,
631
+ className: `nice-select__trigger nice-select__trigger--${n} nice-select--ds-${G} ${O ? "nice-select__trigger--open" : ""} ${t ? "nice-select__trigger--error" : ""} ${i ? "nice-select__trigger--disabled" : ""}`,
632
+ style: {
633
+ ...A,
634
+ ...p && !j && pe != null ? {
635
+ width: pe,
636
+ maxWidth: pe,
637
+ overflow: "hidden"
638
+ } : {}
639
+ },
640
+ disabled: i,
641
+ onClick: () => Y(!O),
642
+ onKeyDown: Te,
643
+ children: [
644
+ Ne ? /* @__PURE__ */ jsxRuntime.jsx(
645
+ "span",
646
+ {
647
+ style: p && !j ? {
648
+ flex: 1,
649
+ minWidth: 0,
650
+ overflow: "hidden",
651
+ textOverflow: "ellipsis",
652
+ whiteSpace: "nowrap"
653
+ } : void 0,
654
+ children: Ne
655
+ }
656
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-select__placeholder", children: R || S("controls.select", "Select...") }),
657
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
658
+ E && te.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
659
+ "span",
660
+ {
661
+ className: "nice-input__clear",
662
+ onClick: De,
663
+ role: "button",
664
+ "aria-label": S("controls.clear", "Clear"),
665
+ children: "✕"
666
+ }
667
+ ),
668
+ /* @__PURE__ */ jsxRuntime.jsx(
669
+ "svg",
670
+ {
671
+ className: `nice-select__chevron ${O ? "nice-select__chevron--open" : ""}`,
672
+ viewBox: "0 0 20 20",
673
+ fill: "currentColor",
674
+ children: /* @__PURE__ */ jsxRuntime.jsx(
675
+ "path",
676
+ {
677
+ fillRule: "evenodd",
678
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
679
+ clipRule: "evenodd"
680
+ }
681
+ )
682
+ }
683
+ )
684
+ ] })
685
+ ]
686
+ }
687
+ ),
688
+ O && /* @__PURE__ */ jsxRuntime.jsxs(
689
+ "div",
690
+ {
691
+ className: "nice-select__dropdown",
692
+ role: "listbox",
693
+ style: { maxHeight: L },
694
+ onScroll: x ? (s) => C(s.currentTarget.scrollTop) : void 0,
695
+ children: [
696
+ (J || U) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-select__search", children: /* @__PURE__ */ jsxRuntime.jsx(
697
+ "input",
698
+ {
699
+ type: "text",
700
+ value: re,
701
+ onChange: (s) => {
702
+ ie(s.target.value), g(0), U?.(s.target.value);
703
+ },
704
+ placeholder: S("controls.search", "Search..."),
705
+ autoFocus: true
706
+ }
707
+ ) }),
708
+ V && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-select__loading", children: /* @__PURE__ */ jsxRuntime.jsx(
709
+ "div",
710
+ {
711
+ className: "nice-spinner nice-spinner--sm",
712
+ style: { margin: "8px auto" }
713
+ }
714
+ ) }),
715
+ !V && W.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-select__empty", children: $ || S("controls.noResults", "No results found") }) : x && !Array.from(He.keys()).some((s) => s !== "") ? (() => {
716
+ const H = W.length * M, B = Math.max(
717
+ 0,
718
+ Math.floor(K / M) - 3
719
+ ), me = Math.min(
720
+ W.length,
721
+ Math.ceil((K + L) / M) + 3
722
+ ), Se = W.slice(B, me);
723
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: H, position: "relative" }, children: Se.map((ce, c) => {
724
+ const N = B + c, le = te.includes(ce.value);
725
+ return /* @__PURE__ */ jsxRuntime.jsx(
726
+ "div",
727
+ {
728
+ role: "option",
729
+ "aria-selected": le,
730
+ className: `nice-select__option ${le ? "nice-select__option--selected" : ""} ${N === r ? "nice-select__option--highlighted" : ""} ${ce.disabled ? "nice-select__option--disabled" : ""}`,
731
+ style: {
732
+ position: "absolute",
733
+ top: N * M,
734
+ left: 0,
735
+ right: 0,
736
+ height: M,
737
+ display: "flex",
738
+ alignItems: "center",
739
+ padding: "0 12px"
740
+ },
741
+ onClick: () => !ce.disabled && fe(String(ce.value)),
742
+ onMouseEnter: () => g(N),
743
+ children: I ? I(ce, le) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
744
+ ce.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { children: ce.icon }),
745
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1 }, children: [
746
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: ce.label }),
747
+ ce.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-select__option-desc", children: ce.description })
748
+ ] }),
749
+ le && /* @__PURE__ */ jsxRuntime.jsx(
750
+ "svg",
751
+ {
752
+ className: "nice-select__option-check",
753
+ viewBox: "0 0 20 20",
754
+ fill: "currentColor",
755
+ children: /* @__PURE__ */ jsxRuntime.jsx(
756
+ "path",
757
+ {
758
+ fillRule: "evenodd",
759
+ 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",
760
+ clipRule: "evenodd"
761
+ }
762
+ )
763
+ }
764
+ )
765
+ ] })
766
+ },
767
+ ce.value
768
+ );
769
+ }) });
770
+ })() : Array.from(He.entries()).map(([s, H]) => /* @__PURE__ */ jsxRuntime.jsxs(_e.Fragment, { children: [
771
+ s && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-select__group-label", children: s }),
772
+ H.map((B) => {
773
+ const me = te.includes(B.value), Se = W.indexOf(B);
774
+ return /* @__PURE__ */ jsxRuntime.jsx(
775
+ "div",
776
+ {
777
+ role: "option",
778
+ "aria-selected": me,
779
+ className: `nice-select__option ${me ? "nice-select__option--selected" : ""} ${Se === r ? "nice-select__option--highlighted" : ""} ${B.disabled ? "nice-select__option--disabled" : ""}`,
780
+ onClick: () => !B.disabled && fe(String(B.value)),
781
+ onMouseEnter: () => g(Se),
782
+ children: I ? I(B, me) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
783
+ B.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { children: B.icon }),
784
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1 }, children: [
785
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: B.label }),
786
+ B.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-select__option-desc", children: B.description })
787
+ ] }),
788
+ me && /* @__PURE__ */ jsxRuntime.jsx(
789
+ "svg",
790
+ {
791
+ className: "nice-select__option-check",
792
+ viewBox: "0 0 20 20",
793
+ fill: "currentColor",
794
+ children: /* @__PURE__ */ jsxRuntime.jsx(
795
+ "path",
796
+ {
797
+ fillRule: "evenodd",
798
+ 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",
799
+ clipRule: "evenodd"
800
+ }
801
+ )
802
+ }
803
+ )
804
+ ] })
805
+ },
806
+ B.value
807
+ );
808
+ })
809
+ ] }, s))
810
+ ]
811
+ }
812
+ )
813
+ ] }),
814
+ V && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-field__spinner", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-spinner nice-spinner--sm" }) }),
815
+ ne === "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${se}-error`, className: "nice-field__error", role: "alert", children: t }),
816
+ ne === "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${se}-helper`, className: "nice-field__helper", children: h })
817
+ ] }),
818
+ ne !== "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${se}-error`, className: "nice-field__error", role: "alert", children: t }),
819
+ ne !== "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${se}-helper`, className: "nice-field__helper", children: h })
820
+ ]
821
+ }
822
+ );
823
+ }
824
+ );
825
+ Ze.displayName = "NiceSelect";
826
+ const Pe = _e.forwardRef(
827
+ ({
828
+ label: l,
829
+ checked: h = false,
830
+ indeterminate: t = false,
831
+ onChange: d,
832
+ disabled: i,
833
+ readOnly: n,
834
+ loading: a,
835
+ required: y,
836
+ size: u = "md",
837
+ name: o,
838
+ id: f,
839
+ className: D,
840
+ style: z,
841
+ error: m,
842
+ helperText: w,
843
+ accessMode: R,
844
+ displayStyle: p,
845
+ showKeyboardHints: J,
846
+ labelPlacement: E,
847
+ errorPlacement: $,
848
+ labelWidth: L,
849
+ controlWidth: b
850
+ }, F) => {
851
+ const T = coreDa43qPO.h(R, f);
852
+ if (T === "hidden")
853
+ return null;
854
+ (T === "disabled" || T === "readOnly") && (i = true);
855
+ const { t: x } = coreDa43qPO.W(), M = coreDa43qPO.b(f);
856
+ coreDa43qPO.d("toggle", p);
857
+ const U = _e.useMemo(
858
+ () => [{ key: "Space", description: x("shortcuts.toggle", "Toggle") }],
859
+ [x]
860
+ ), V = _e.useCallback(
861
+ (I) => {
862
+ I && (I.indeterminate = t), typeof F == "function" ? F(I) : F && (F.current = I);
863
+ },
864
+ [t, F]
865
+ );
866
+ return /* @__PURE__ */ jsxRuntime.jsxs(
867
+ "div",
868
+ {
869
+ className: `nice-field nice-field--inline nice-field--${u} ${E === "left" ? "nice-field--label-left" : ""} ${$ === "right" ? "nice-field--error-right" : ""} ${a ? "nice-field--loading" : ""} ${D || ""}`,
870
+ style: {
871
+ ...z,
872
+ ...L != null && {
873
+ "--nice-field-label-width": typeof L == "number" ? `${L}px` : L
874
+ },
875
+ ...b != null && {
876
+ "--nice-field-control-width": typeof b == "number" ? `${b}px` : b
877
+ }
878
+ },
879
+ "aria-busy": a || void 0,
880
+ children: [
881
+ E === "left" && l && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `nice-field__label ${y ? "nice-field__label--required" : ""}`, children: l }),
882
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-field__control", children: [
883
+ /* @__PURE__ */ jsxRuntime.jsxs(
884
+ "label",
885
+ {
886
+ className: `nice-checkbox ${u !== "md" ? `nice-checkbox--${u}` : ""} ${i || a ? "nice-checkbox--disabled" : ""}`,
887
+ htmlFor: M,
888
+ children: [
889
+ /* @__PURE__ */ jsxRuntime.jsx(
890
+ "input",
891
+ {
892
+ ref: V,
893
+ id: M,
894
+ type: "checkbox",
895
+ className: "nice-checkbox__input",
896
+ name: o,
897
+ checked: h,
898
+ disabled: i || a,
899
+ readOnly: n,
900
+ "aria-invalid": !!m,
901
+ onChange: (I) => {
902
+ n || a || d?.(I.target.checked);
903
+ }
904
+ }
905
+ ),
906
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ jsxRuntime.jsx(
907
+ "svg",
908
+ {
909
+ viewBox: "0 0 12 12",
910
+ fill: "none",
911
+ stroke: "currentColor",
912
+ strokeWidth: "2",
913
+ strokeLinecap: "round",
914
+ strokeLinejoin: "round",
915
+ children: t ? /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "2 6 5 9 10 3" })
916
+ }
917
+ ) }),
918
+ E !== "left" && l && /* @__PURE__ */ jsxRuntime.jsx("span", { children: l }),
919
+ J && /* @__PURE__ */ jsxRuntime.jsx(coreDa43qPO.k, { shortcuts: U, size: "sm" })
920
+ ]
921
+ }
922
+ ),
923
+ a && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-field__spinner", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-spinner nice-spinner--sm" }) }),
924
+ $ === "right" && m && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: m }),
925
+ $ === "right" && !m && w && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${M}-helper`, className: "nice-field__helper", children: w })
926
+ ] }),
927
+ $ !== "right" && m && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: m }),
928
+ $ !== "right" && !m && w && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${M}-helper`, className: "nice-field__helper", children: w })
929
+ ]
930
+ }
931
+ );
932
+ }
933
+ );
934
+ Pe.displayName = "NiceCheckbox";
935
+ const Oe = _e.forwardRef(
936
+ ({
937
+ label: l,
938
+ checked: h = false,
939
+ onChange: t,
940
+ disabled: d,
941
+ readOnly: i,
942
+ loading: n,
943
+ required: a,
944
+ size: y = "md",
945
+ name: u,
946
+ id: o,
947
+ className: f,
948
+ style: D,
949
+ accessMode: z,
950
+ displayStyle: m,
951
+ showKeyboardHints: w,
952
+ error: R,
953
+ helperText: p,
954
+ labelPlacement: J,
955
+ errorPlacement: E,
956
+ labelWidth: $,
957
+ controlWidth: L
958
+ }, b) => {
959
+ const F = coreDa43qPO.h(z, o);
960
+ if (F === "hidden")
961
+ return null;
962
+ (F === "disabled" || F === "readOnly") && (d = true);
963
+ const { t: T } = coreDa43qPO.W(), x = coreDa43qPO.b(o);
964
+ coreDa43qPO.c("toggle", m);
965
+ const M = coreDa43qPO.d("toggle", m), U = _e.useMemo(
966
+ () => [{ key: "Space", description: T("shortcuts.toggle", "Toggle on/off") }],
967
+ [T]
968
+ );
969
+ return /* @__PURE__ */ jsxRuntime.jsxs(
970
+ "div",
971
+ {
972
+ className: `nice-field nice-field--inline nice-field--${y} ${J === "left" ? "nice-field--label-left" : ""} ${n ? "nice-field--loading" : ""} ${f || ""}`,
973
+ style: {
974
+ ...D,
975
+ ...$ != null && {
976
+ "--nice-field-label-width": typeof $ == "number" ? `${$}px` : $
977
+ },
978
+ ...L != null && {
979
+ "--nice-field-control-width": typeof L == "number" ? `${L}px` : L
980
+ }
981
+ },
982
+ "aria-busy": n || void 0,
983
+ children: [
984
+ J === "left" && l && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `nice-field__label ${a ? "nice-field__label--required" : ""}`, children: l }),
985
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-field__control", children: [
986
+ /* @__PURE__ */ jsxRuntime.jsxs(
987
+ "label",
988
+ {
989
+ className: `nice-toggle nice-toggle--ds-${M} ${y !== "md" ? `nice-toggle--${y}` : ""} ${d || n ? "nice-toggle--disabled" : ""}`,
990
+ htmlFor: x,
991
+ children: [
992
+ /* @__PURE__ */ jsxRuntime.jsx(
993
+ "input",
994
+ {
995
+ ref: b,
996
+ id: x,
997
+ type: "checkbox",
998
+ className: "nice-toggle__input",
999
+ name: u,
1000
+ checked: h,
1001
+ disabled: d || n,
1002
+ readOnly: i,
1003
+ role: "switch",
1004
+ "aria-checked": h,
1005
+ "aria-invalid": !!R,
1006
+ onChange: (V) => {
1007
+ i || n || t?.(V.target.checked);
1008
+ }
1009
+ }
1010
+ ),
1011
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-toggle__track", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-toggle__thumb" }) }),
1012
+ J !== "left" && l && /* @__PURE__ */ jsxRuntime.jsx("span", { children: l }),
1013
+ w && /* @__PURE__ */ jsxRuntime.jsx(coreDa43qPO.k, { shortcuts: U, size: "sm" })
1014
+ ]
1015
+ }
1016
+ ),
1017
+ n && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-field__spinner", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-spinner nice-spinner--sm" }) }),
1018
+ E === "right" && R && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${x}-error`, className: "nice-field__error", role: "alert", children: R }),
1019
+ E === "right" && !R && p && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${x}-helper`, className: "nice-field__helper", children: p })
1020
+ ] }),
1021
+ E !== "right" && R && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${x}-error`, className: "nice-field__error", role: "alert", children: R }),
1022
+ E !== "right" && !R && p && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${x}-helper`, className: "nice-field__helper", children: p })
1023
+ ]
1024
+ }
1025
+ );
1026
+ }
1027
+ );
1028
+ Oe.displayName = "NiceToggle";
1029
+ const We = [
1030
+ "#ef4444",
1031
+ "#f97316",
1032
+ "#f59e0b",
1033
+ "#84cc16",
1034
+ "#10b981",
1035
+ "#06b6d4",
1036
+ "#3b82f6",
1037
+ "#6366f1",
1038
+ "#8b5cf6",
1039
+ "#ec4899",
1040
+ "#64748b",
1041
+ "#1e293b"
1042
+ ];
1043
+ function en() {
1044
+ return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
1045
+ }
1046
+ function nn(l, h, t) {
1047
+ const d = l / 255, i = h / 255, n = t / 255, a = Math.max(d, i, n), y = Math.min(d, i, n), u = (a + y) / 2;
1048
+ let o = 0, f = 0;
1049
+ if (a !== y) {
1050
+ const D = a - y;
1051
+ switch (f = u > 0.5 ? D / (2 - a - y) : D / (a + y), a) {
1052
+ case d:
1053
+ o = (i - n) / D + (i < n ? 6 : 0);
1054
+ break;
1055
+ case i:
1056
+ o = (n - d) / D + 2;
1057
+ break;
1058
+ case n:
1059
+ o = (d - i) / D + 4;
1060
+ break;
1061
+ }
1062
+ o *= 60;
1063
+ }
1064
+ return { h: Math.round(o), s: Math.round(f * 100), l: Math.round(u * 100) };
1065
+ }
1066
+ function tn(l, h, t) {
1067
+ const d = h / 100, i = t / 100, n = (1 - Math.abs(2 * i - 1)) * d, a = n * (1 - Math.abs(l / 60 % 2 - 1)), y = i - n / 2;
1068
+ let u = 0, o = 0, f = 0;
1069
+ return l < 60 ? [u, o, f] = [n, a, 0] : l < 120 ? [u, o, f] = [a, n, 0] : l < 180 ? [u, o, f] = [0, n, a] : l < 240 ? [u, o, f] = [0, a, n] : l < 300 ? [u, o, f] = [a, 0, n] : [u, o, f] = [n, 0, a], {
1070
+ r: Math.round((u + y) * 255),
1071
+ g: Math.round((o + y) * 255),
1072
+ b: Math.round((f + y) * 255)
1073
+ };
1074
+ }
1075
+ function cn(l, h, t) {
1076
+ const d = l / 255, i = h / 255, n = t / 255, a = Math.max(d, i, n), y = Math.min(d, i, n), u = a - y;
1077
+ let o = 0;
1078
+ u !== 0 && (a === d ? o = (i - n) / u % 6 : a === i ? o = (n - d) / u + 2 : o = (d - i) / u + 4, o *= 60, o < 0 && (o += 360));
1079
+ const f = a === 0 ? 0 : u / a;
1080
+ return { h: Math.round(o), s: Math.round(f * 100), v: Math.round(a * 100) };
1081
+ }
1082
+ function ln(l, h, t) {
1083
+ const d = h / 100, i = t / 100, n = i * d, a = n * (1 - Math.abs(l / 60 % 2 - 1)), y = i - n;
1084
+ let u = 0, o = 0, f = 0;
1085
+ return l < 60 ? [u, o, f] = [n, a, 0] : l < 120 ? [u, o, f] = [a, n, 0] : l < 180 ? [u, o, f] = [0, n, a] : l < 240 ? [u, o, f] = [0, a, n] : l < 300 ? [u, o, f] = [a, 0, n] : [u, o, f] = [n, 0, a], {
1086
+ r: Math.round((u + y) * 255),
1087
+ g: Math.round((o + y) * 255),
1088
+ b: Math.round((f + y) * 255)
1089
+ };
1090
+ }
1091
+ function sn(l) {
1092
+ const h = /^#?([0-9a-f]{6})$/i.exec(l.trim()), t = /^#?([0-9a-f]{8})$/i.exec(l.trim());
1093
+ if (t) {
1094
+ const d = t[1];
1095
+ return {
1096
+ r: parseInt(d.slice(0, 2), 16),
1097
+ g: parseInt(d.slice(2, 4), 16),
1098
+ b: parseInt(d.slice(4, 6), 16),
1099
+ a: parseInt(d.slice(6, 8), 16) / 255
1100
+ };
1101
+ }
1102
+ if (h) {
1103
+ const d = parseInt(h[1], 16);
1104
+ return { r: d >> 16 & 255, g: d >> 8 & 255, b: d & 255, a: 1 };
1105
+ }
1106
+ return { r: 0, g: 0, b: 0, a: 1 };
1107
+ }
1108
+ function rn(l, h, t, d, i) {
1109
+ const n = (y) => Math.max(0, Math.min(255, Math.round(y))).toString(16).padStart(2, "0"), a = `#${n(l)}${n(h)}${n(t)}`;
1110
+ return i ? `${a}${n(d * 255)}` : a;
1111
+ }
1112
+ const an = _e.forwardRef(
1113
+ ({
1114
+ label: l,
1115
+ helperText: h,
1116
+ error: t,
1117
+ required: d,
1118
+ disabled: i,
1119
+ id: n,
1120
+ className: a,
1121
+ style: y,
1122
+ accessMode: u,
1123
+ displayStyle: o,
1124
+ value: f = "#3b82f6",
1125
+ onChange: D,
1126
+ presets: z = We,
1127
+ showInput: m = true,
1128
+ showRandom: w = true,
1129
+ withAlpha: R = false,
1130
+ showKeyboardHints: p,
1131
+ size: J = "md",
1132
+ labelPlacement: E,
1133
+ errorPlacement: $,
1134
+ labelWidth: L,
1135
+ controlWidth: b,
1136
+ loading: F
1137
+ }, T) => {
1138
+ const x = coreDa43qPO.h(u, n);
1139
+ if (x === "hidden")
1140
+ return null;
1141
+ (x === "disabled" || x === "readOnly") && (i = true);
1142
+ const { t: M } = coreDa43qPO.W(), U = coreDa43qPO.b(n);
1143
+ coreDa43qPO.d("input", o);
1144
+ const V = _e.useCallback(() => {
1145
+ i || D?.(en());
1146
+ }, [i, D]), [I, j] = _e.useState(false), [ae, ue] = _e.useState(null), ne = _e.useRef(null), X = _e.useRef(null);
1147
+ _e.useLayoutEffect(() => {
1148
+ if (!I || !X.current)
1149
+ return;
1150
+ const k = () => {
1151
+ const _ = X.current?.getBoundingClientRect();
1152
+ if (!_)
1153
+ return;
1154
+ const q = 280, S = 360;
1155
+ let A = _.left, G = _.bottom + 6;
1156
+ A + q > window.innerWidth - 8 && (A = Math.max(8, window.innerWidth - q - 8)), G + S > window.innerHeight - 8 && (G = Math.max(8, _.top - S - 6)), ue({ left: A, top: G });
1157
+ };
1158
+ return k(), window.addEventListener("scroll", k, true), window.addEventListener("resize", k), () => {
1159
+ window.removeEventListener("scroll", k, true), window.removeEventListener("resize", k);
1160
+ };
1161
+ }, [I]), _e.useEffect(() => {
1162
+ if (!I)
1163
+ return;
1164
+ const k = (q) => {
1165
+ const S = q.target;
1166
+ ne.current?.contains(S) || X.current?.contains(S) || j(false);
1167
+ }, _ = (q) => {
1168
+ q.key === "Escape" && j(false);
1169
+ };
1170
+ return document.addEventListener("mousedown", k), document.addEventListener("keydown", _), () => {
1171
+ document.removeEventListener("mousedown", k), document.removeEventListener("keydown", _);
1172
+ };
1173
+ }, [I]);
1174
+ const P = _e.useMemo(
1175
+ () => [
1176
+ { key: "Enter", description: M("shortcuts.openPicker", "Open color picker") },
1177
+ { key: "Arrow keys", description: M("shortcuts.navigatePresets", "Navigate presets") }
1178
+ ],
1179
+ [M]
1180
+ );
1181
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1182
+ "div",
1183
+ {
1184
+ className: `nice-field nice-field--${J} ${E === "left" ? "nice-field--label-left" : ""} ${F ? "nice-field--loading" : ""} ${a || ""}`,
1185
+ style: {
1186
+ ...y,
1187
+ ...L != null && {
1188
+ "--nice-field-label-width": typeof L == "number" ? `${L}px` : L
1189
+ },
1190
+ ...b != null && {
1191
+ "--nice-field-control-width": typeof b == "number" ? `${b}px` : b
1192
+ }
1193
+ },
1194
+ "aria-busy": F || void 0,
1195
+ children: [
1196
+ l && /* @__PURE__ */ jsxRuntime.jsxs(
1197
+ "label",
1198
+ {
1199
+ htmlFor: U,
1200
+ className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
1201
+ children: [
1202
+ l,
1203
+ p && /* @__PURE__ */ jsxRuntime.jsx(coreDa43qPO.k, { shortcuts: P, size: "sm" })
1204
+ ]
1205
+ }
1206
+ ),
1207
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-field__control", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-color-picker", children: [
1208
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-color-picker__preview-row", children: [
1209
+ /* @__PURE__ */ jsxRuntime.jsx(
1210
+ "div",
1211
+ {
1212
+ ref: X,
1213
+ className: "nice-color-picker__swatch",
1214
+ id: U,
1215
+ style: { background: f },
1216
+ onClick: (k) => {
1217
+ k.stopPropagation(), i || j((_) => !_);
1218
+ },
1219
+ onKeyDown: (k) => {
1220
+ !i && (k.key === "Enter" || k.key === " ") && (k.preventDefault(), j((_) => !_));
1221
+ },
1222
+ role: "button",
1223
+ tabIndex: 0,
1224
+ "aria-label": M("colorPicker.openPalette", "Open color palette"),
1225
+ "aria-haspopup": "dialog",
1226
+ "aria-expanded": I,
1227
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1228
+ "input",
1229
+ {
1230
+ ref: (k) => {
1231
+ typeof T == "function" ? T(k) : T && (T.current = k);
1232
+ },
1233
+ type: "hidden",
1234
+ value: f,
1235
+ disabled: i,
1236
+ readOnly: true
1237
+ }
1238
+ )
1239
+ }
1240
+ ),
1241
+ m && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-input nice-input--sm", style: { width: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(
1242
+ "input",
1243
+ {
1244
+ className: "nice-input__native",
1245
+ type: "text",
1246
+ value: f,
1247
+ disabled: i,
1248
+ onChange: (k) => D?.(k.target.value),
1249
+ maxLength: 7
1250
+ }
1251
+ ) }),
1252
+ w && /* @__PURE__ */ jsxRuntime.jsx(
1253
+ "button",
1254
+ {
1255
+ type: "button",
1256
+ className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
1257
+ onClick: V,
1258
+ disabled: i,
1259
+ title: M("colorPicker.random", "Random"),
1260
+ "aria-label": M("colorPicker.random", "Random"),
1261
+ style: {
1262
+ fontSize: "0.65rem",
1263
+ textTransform: "uppercase",
1264
+ letterSpacing: "0.05em"
1265
+ },
1266
+ children: M("colorPicker.random", "Random")
1267
+ }
1268
+ ),
1269
+ F && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-field__spinner", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-spinner nice-spinner--sm" }) }),
1270
+ $ === "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${U}-error`, className: "nice-field__error", role: "alert", children: t }),
1271
+ $ === "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${U}-helper`, className: "nice-field__helper", children: h })
1272
+ ] }),
1273
+ I && ae && typeof document < "u" && ze.createPortal(
1274
+ /* @__PURE__ */ jsxRuntime.jsx(
1275
+ "div",
1276
+ {
1277
+ ref: ne,
1278
+ className: "nice-color-picker__popup nice-color-picker__popup--portal",
1279
+ role: "dialog",
1280
+ "aria-label": M("colorPicker.palette", "Color palette"),
1281
+ style: { position: "fixed", left: ae.left, top: ae.top },
1282
+ onClick: (k) => k.stopPropagation(),
1283
+ children: (() => {
1284
+ const k = sn(f), _ = { r: k.r, g: k.g, b: k.b }, q = R ? k.a : 1, S = nn(_.r, _.g, _.b), A = cn(_.r, _.g, _.b), G = (r, g, K, C = q) => D?.(rn(r, g, K, C, R)), se = (r, g, K) => G(r, g, K), ve = (r, g, K) => {
1285
+ const C = tn(r, g, K);
1286
+ G(C.r, C.g, C.b);
1287
+ }, O = (r, g, K) => {
1288
+ const C = ln(r, g, K);
1289
+ G(C.r, C.g, C.b);
1290
+ }, Y = (r) => G(_.r, _.g, _.b, r), re = (r) => {
1291
+ if (i)
1292
+ return;
1293
+ const g = r.currentTarget, K = (Q) => {
1294
+ const Z = g.getBoundingClientRect(), ge = Math.max(0, Math.min(Z.width, Q.clientX - Z.left)), be = Math.max(0, Math.min(Z.height, Q.clientY - Z.top)), pe = Math.round(ge / Z.width * 100), Me = 100 - Math.round(be / Z.height * 100);
1295
+ O(A.h, pe, Me);
1296
+ };
1297
+ K(r);
1298
+ const C = () => {
1299
+ document.removeEventListener("pointermove", K), document.removeEventListener("pointerup", C);
1300
+ };
1301
+ document.addEventListener("pointermove", K), document.addEventListener("pointerup", C);
1302
+ }, ie = `hsl(${A.h}, 100%, 50%)`;
1303
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1304
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ jsxRuntime.jsx(
1305
+ "input",
1306
+ {
1307
+ type: "text",
1308
+ className: "nice-input__native nice-color-picker__popup-hex",
1309
+ value: f,
1310
+ disabled: i,
1311
+ onChange: (r) => D?.(r.target.value),
1312
+ maxLength: R ? 9 : 7,
1313
+ "aria-label": M("colorPicker.hexValue", "Hex value")
1314
+ }
1315
+ ) }),
1316
+ /* @__PURE__ */ jsxRuntime.jsx(
1317
+ "input",
1318
+ {
1319
+ type: "range",
1320
+ min: 0,
1321
+ max: 360,
1322
+ value: A.h,
1323
+ disabled: i,
1324
+ onChange: (r) => O(Number(r.target.value), A.s, A.v),
1325
+ className: "nice-color-picker__hue-slider",
1326
+ "aria-label": M("colorPicker.hue", "Hue")
1327
+ }
1328
+ ),
1329
+ /* @__PURE__ */ jsxRuntime.jsx(
1330
+ "div",
1331
+ {
1332
+ className: "nice-color-picker__sv",
1333
+ style: {
1334
+ background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${ie})`
1335
+ },
1336
+ onPointerDown: re,
1337
+ role: "application",
1338
+ "aria-label": M("colorPicker.svPalette", "Saturation/value palette"),
1339
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1340
+ "span",
1341
+ {
1342
+ className: "nice-color-picker__sv-marker",
1343
+ style: { left: `${A.s}%`, top: `${100 - A.v}%` }
1344
+ }
1345
+ )
1346
+ }
1347
+ ),
1348
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-color-picker__sliders", children: [
1349
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((r) => {
1350
+ const g = r === "h" ? 360 : 100, K = S[r], C = (Q) => ve(
1351
+ r === "h" ? Q : S.h,
1352
+ r === "s" ? Q : S.s,
1353
+ r === "l" ? Q : S.l
1354
+ );
1355
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-color-picker__slider-row", children: [
1356
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
1357
+ /* @__PURE__ */ jsxRuntime.jsx(
1358
+ "input",
1359
+ {
1360
+ type: "range",
1361
+ min: 0,
1362
+ max: g,
1363
+ value: K,
1364
+ disabled: i,
1365
+ onChange: (Q) => C(Number(Q.target.value))
1366
+ }
1367
+ ),
1368
+ /* @__PURE__ */ jsxRuntime.jsx(
1369
+ "input",
1370
+ {
1371
+ type: "number",
1372
+ min: 0,
1373
+ max: g,
1374
+ value: K,
1375
+ disabled: i,
1376
+ onChange: (Q) => C(Number(Q.target.value) || 0),
1377
+ className: "nice-input__native nice-color-picker__slider-num"
1378
+ }
1379
+ )
1380
+ ] }, r);
1381
+ }) }),
1382
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((r) => {
1383
+ const g = _[r], K = (C) => se(
1384
+ r === "r" ? C : _.r,
1385
+ r === "g" ? C : _.g,
1386
+ r === "b" ? C : _.b
1387
+ );
1388
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-color-picker__slider-row", children: [
1389
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
1390
+ /* @__PURE__ */ jsxRuntime.jsx(
1391
+ "input",
1392
+ {
1393
+ type: "range",
1394
+ min: 0,
1395
+ max: 255,
1396
+ value: g,
1397
+ disabled: i,
1398
+ onChange: (C) => K(Number(C.target.value))
1399
+ }
1400
+ ),
1401
+ /* @__PURE__ */ jsxRuntime.jsx(
1402
+ "input",
1403
+ {
1404
+ type: "number",
1405
+ min: 0,
1406
+ max: 255,
1407
+ value: g,
1408
+ disabled: i,
1409
+ onChange: (C) => K(Number(C.target.value) || 0),
1410
+ className: "nice-input__native nice-color-picker__slider-num"
1411
+ }
1412
+ )
1413
+ ] }, r);
1414
+ }) })
1415
+ ] }),
1416
+ R && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-color-picker__alpha-row", children: [
1417
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "nice-color-picker__slider-label", children: "A" }),
1418
+ /* @__PURE__ */ jsxRuntime.jsx(
1419
+ "input",
1420
+ {
1421
+ type: "range",
1422
+ min: 0,
1423
+ max: 100,
1424
+ value: Math.round(q * 100),
1425
+ disabled: i,
1426
+ onChange: (r) => Y(Number(r.target.value) / 100),
1427
+ className: "nice-color-picker__alpha-slider",
1428
+ style: {
1429
+ background: `linear-gradient(to right, transparent, rgb(${_.r},${_.g},${_.b}))`
1430
+ },
1431
+ "aria-label": M("colorPicker.alpha", "Alpha")
1432
+ }
1433
+ ),
1434
+ /* @__PURE__ */ jsxRuntime.jsx(
1435
+ "input",
1436
+ {
1437
+ type: "number",
1438
+ min: 0,
1439
+ max: 100,
1440
+ value: Math.round(q * 100),
1441
+ disabled: i,
1442
+ onChange: (r) => Y((Number(r.target.value) || 0) / 100),
1443
+ className: "nice-input__native nice-color-picker__slider-num"
1444
+ }
1445
+ )
1446
+ ] }),
1447
+ z.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-color-picker__popup-presets", children: z.map((r) => /* @__PURE__ */ jsxRuntime.jsx(
1448
+ "div",
1449
+ {
1450
+ className: `nice-color-picker__preset ${f === r ? "nice-color-picker__preset--active" : ""}`,
1451
+ style: { background: r },
1452
+ onClick: () => {
1453
+ D?.(r), j(false);
1454
+ },
1455
+ role: "button",
1456
+ tabIndex: 0,
1457
+ "aria-label": r,
1458
+ onKeyDown: (g) => {
1459
+ (g.key === "Enter" || g.key === " ") && (g.preventDefault(), D?.(r), j(false));
1460
+ }
1461
+ },
1462
+ r
1463
+ )) })
1464
+ ] });
1465
+ })()
1466
+ }
1467
+ ),
1468
+ document.body
1469
+ )
1470
+ ] }) }),
1471
+ $ !== "right" && t && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${U}-error`, className: "nice-field__error", role: "alert", children: t }),
1472
+ $ !== "right" && !t && h && /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${U}-helper`, className: "nice-field__helper", children: h })
1473
+ ]
1474
+ }
1475
+ );
1476
+ }
1477
+ );
1478
+ an.displayName = "NiceColorPicker";
1479
+ const on = _e.forwardRef(
1480
+ ({
1481
+ children: l,
1482
+ variant: h = "primary",
1483
+ size: t = "md",
1484
+ type: d = "button",
1485
+ disabled: i,
1486
+ loading: n,
1487
+ fullWidth: a,
1488
+ onClick: y,
1489
+ leftIcon: u,
1490
+ rightIcon: o,
1491
+ error: f,
1492
+ errorPlacement: D = "bottom",
1493
+ className: z,
1494
+ style: m,
1495
+ id: w,
1496
+ accessMode: R,
1497
+ displayStyle: p,
1498
+ ...J
1499
+ }, E) => {
1500
+ const $ = coreDa43qPO.h(R, w);
1501
+ if ($ === "hidden")
1502
+ return null;
1503
+ ($ === "disabled" || $ === "readOnly") && (i = true);
1504
+ const L = coreDa43qPO.c("button", p), b = coreDa43qPO.d("button", p), F = h !== "primary" ? (({ background: M, color: U, ...V }) => V)(
1505
+ L
1506
+ ) : L, T = /* @__PURE__ */ jsxRuntime.jsxs(
1507
+ "button",
1508
+ {
1509
+ ref: E,
1510
+ type: d,
1511
+ id: w,
1512
+ className: `nice-btn nice-btn--${h} nice-btn--${t} nice-btn--ds-${b} ${a ? "nice-btn--full-width" : ""} ${n ? "nice-btn--loading" : ""} ${f && !D ? "nice-btn--has-error" : ""} ${z || ""}`,
1513
+ style: { ...F, ...m },
1514
+ disabled: i || n,
1515
+ "aria-busy": n || void 0,
1516
+ "aria-disabled": i || n || void 0,
1517
+ onClick: y,
1518
+ ...J,
1519
+ children: [
1520
+ n && /* @__PURE__ */ jsxRuntime.jsx(
1521
+ "svg",
1522
+ {
1523
+ className: "nice-btn__spinner",
1524
+ viewBox: "0 0 24 24",
1525
+ fill: "none",
1526
+ stroke: "currentColor",
1527
+ strokeWidth: "3",
1528
+ "aria-hidden": "true",
1529
+ children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
1530
+ }
1531
+ ),
1532
+ !n && u && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: u }),
1533
+ !n && /* @__PURE__ */ jsxRuntime.jsx("span", { children: l }),
1534
+ n && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: l }),
1535
+ !n && o && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: o })
1536
+ ]
1537
+ }
1538
+ );
1539
+ if (!f)
1540
+ return T;
1541
+ const x = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-field__error", role: "alert", children: f });
1542
+ return D === "right" ? /* @__PURE__ */ jsxRuntime.jsxs(
1543
+ "span",
1544
+ {
1545
+ className: `nice-btn-field nice-btn-field--right nice-field--${t}`,
1546
+ style: {
1547
+ display: "inline-flex",
1548
+ flexDirection: "row",
1549
+ alignItems: "center",
1550
+ gap: "8px",
1551
+ width: "fit-content"
1552
+ },
1553
+ children: [
1554
+ T,
1555
+ x
1556
+ ]
1557
+ }
1558
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
1559
+ "span",
1560
+ {
1561
+ className: `nice-btn-field nice-btn-field--bottom nice-field--${t}`,
1562
+ style: {
1563
+ display: "inline-flex",
1564
+ flexDirection: "column",
1565
+ alignItems: "flex-start",
1566
+ gap: "4px",
1567
+ width: "fit-content"
1568
+ },
1569
+ children: [
1570
+ T,
1571
+ x
1572
+ ]
1573
+ }
1574
+ );
1575
+ }
1576
+ );
1577
+ on.displayName = "NiceButton";
1578
+ const fn = ({
1579
+ tabs: l,
1580
+ activeTab: h,
1581
+ onChange: t,
1582
+ variant: d = "default",
1583
+ vertical: i,
1584
+ size: n = "md",
1585
+ className: a,
1586
+ style: y,
1587
+ displayStyle: u
1588
+ }) => {
1589
+ const o = coreDa43qPO.c("tab", u), f = coreDa43qPO.d("tab", u), [D, z] = _e.useState(h || l[0]?.id), m = h ?? D, w = _e.useCallback(
1590
+ (p) => {
1591
+ z(p), t?.(p);
1592
+ },
1593
+ [t]
1594
+ ), R = l.find((p) => p.id === m)?.content;
1595
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1596
+ "div",
1597
+ {
1598
+ className: `nice-tabs nice-tabs--${n} nice-tabs--ds-${f} ${a || ""}`,
1599
+ style: { ...o, ...y, ...i ? { display: "flex", gap: 16 } : {} },
1600
+ children: [
1601
+ /* @__PURE__ */ jsxRuntime.jsx(
1602
+ "div",
1603
+ {
1604
+ className: `nice-tabs__list ${d !== "default" ? `nice-tabs__list--${d}` : ""} ${i ? "nice-tabs__list--vertical" : ""}`,
1605
+ role: "tablist",
1606
+ children: l.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(
1607
+ "button",
1608
+ {
1609
+ type: "button",
1610
+ role: "tab",
1611
+ "aria-selected": m === p.id,
1612
+ className: `nice-tabs__tab ${m === p.id ? "nice-tabs__tab--active" : ""} ${p.disabled ? "nice-tabs__tab--disabled" : ""}`,
1613
+ disabled: p.disabled,
1614
+ onClick: () => w(p.id),
1615
+ children: [
1616
+ p.icon,
1617
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: p.label }),
1618
+ p.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-tabs__badge", children: p.badge })
1619
+ ]
1620
+ },
1621
+ p.id
1622
+ ))
1623
+ }
1624
+ ),
1625
+ R && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-tabs__panel", role: "tabpanel", children: R })
1626
+ ]
1627
+ }
1628
+ );
1629
+ };
1630
+
1631
+ exports.N = Pe;
1632
+ exports.a = an;
1633
+ exports.b = Qe;
1634
+ exports.c = Ze;
1635
+ exports.d = Je;
1636
+ exports.e = Oe;
1637
+ exports.f = fn;
1638
+ exports.g = on;
1639
+ //# sourceMappingURL=NiceTabs-DzLHzwuA.js.map