@lax-wp/design-system 0.13.76 → 0.14.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 (35) hide show
  1. package/dist/components/data-display/modal/Modal.cjs.js +1 -1
  2. package/dist/components/data-display/modal/Modal.cjs.js.map +1 -1
  3. package/dist/components/data-display/modal/Modal.es.js +50 -47
  4. package/dist/components/data-display/modal/Modal.es.js.map +1 -1
  5. package/dist/components/data-display/resizable-sidebar/ResizableSidebar.cjs.js +1 -1
  6. package/dist/components/data-display/resizable-sidebar/ResizableSidebar.cjs.js.map +1 -1
  7. package/dist/components/data-display/resizable-sidebar/ResizableSidebar.d.ts +2 -0
  8. package/dist/components/data-display/resizable-sidebar/ResizableSidebar.es.js +124 -120
  9. package/dist/components/data-display/resizable-sidebar/ResizableSidebar.es.js.map +1 -1
  10. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
  11. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
  12. package/dist/components/forms/currency-input/CurrencyInputField.es.js +35 -35
  13. package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
  14. package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
  15. package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
  16. package/dist/components/forms/master-data-input/MasterDataInputField.es.js +44 -44
  17. package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
  18. package/dist/components/modal/drawer/Drawer.cjs.js +1 -1
  19. package/dist/components/modal/drawer/Drawer.cjs.js.map +1 -1
  20. package/dist/components/modal/drawer/Drawer.es.js +40 -39
  21. package/dist/components/modal/drawer/Drawer.es.js.map +1 -1
  22. package/dist/components/navigation/accordion/Accordion.cjs.js +1 -1
  23. package/dist/components/navigation/accordion/Accordion.cjs.js.map +1 -1
  24. package/dist/components/navigation/accordion/Accordion.es.js +0 -1
  25. package/dist/components/navigation/accordion/Accordion.es.js.map +1 -1
  26. package/dist/hooks/useResponsiveWidth.cjs.js +2 -0
  27. package/dist/hooks/useResponsiveWidth.cjs.js.map +1 -0
  28. package/dist/hooks/useResponsiveWidth.d.ts +5 -0
  29. package/dist/hooks/useResponsiveWidth.es.js +24 -0
  30. package/dist/hooks/useResponsiveWidth.es.js.map +1 -0
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.es.js +296 -293
  34. package/dist/index.es.js.map +1 -1
  35. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
- import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import b from "../../../_virtual/index.es.js";
3
- import { AnimatePresence as A, motion as I } from "framer-motion";
4
- import { forwardRef as B, useRef as H, useState as L, useEffect as p } from "react";
5
- import M from "react-dom";
6
- import { Resizable as R } from "re-resizable";
7
- const T = () => /* @__PURE__ */ i("div", { className: "cursor-ew-resize flex items-center justify-center rounded-full bg-[#1018288F] bg-opacity-55 w-8 h-8 shadow-200 border-[1.5px] border-[#FFFFFF3D]", children: /* @__PURE__ */ N(
1
+ import { jsx as r, jsxs as W } from "react/jsx-runtime";
2
+ import m from "../../../_virtual/index.es.js";
3
+ import { AnimatePresence as M, motion as R } from "framer-motion";
4
+ import { forwardRef as B, useRef as H, useState as L, useEffect as v } from "react";
5
+ import T from "react-dom";
6
+ import { Resizable as q } from "re-resizable";
7
+ import { useResponsiveWidth as N } from "../../../hooks/useResponsiveWidth.es.js";
8
+ const U = () => /* @__PURE__ */ r("div", { className: "cursor-ew-resize flex items-center justify-center rounded-full bg-[#1018288F] bg-opacity-55 w-8 h-8 shadow-200 border-[1.5px] border-[#FFFFFF3D]", children: /* @__PURE__ */ W(
8
9
  "svg",
9
10
  {
10
11
  width: "20",
@@ -13,8 +14,8 @@ const T = () => /* @__PURE__ */ i("div", { className: "cursor-ew-resize flex ite
13
14
  fill: "none",
14
15
  xmlns: "http://www.w3.org/2000/svg",
15
16
  children: [
16
- /* @__PURE__ */ i("mask", { id: "mask0_36675_12", maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "20", height: "20", children: /* @__PURE__ */ i("rect", { y: "20", width: "20", height: "20", transform: "rotate(-90 0 20)", fill: "#D9D9D9" }) }),
17
- /* @__PURE__ */ i("g", { mask: "url(#mask0_36675_12)", children: /* @__PURE__ */ i(
17
+ /* @__PURE__ */ r("mask", { id: "mask0_36675_12", maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "20", height: "20", children: /* @__PURE__ */ r("rect", { y: "20", width: "20", height: "20", transform: "rotate(-90 0 20)", fill: "#D9D9D9" }) }),
18
+ /* @__PURE__ */ r("g", { mask: "url(#mask0_36675_12)", children: /* @__PURE__ */ r(
18
19
  "path",
19
20
  {
20
21
  d: "M15.9583 10L12.7292 6.77084C12.5625 6.60418 12.4792 6.40973 12.4792 6.18751C12.4792 5.96529 12.5625 5.77084 12.7292 5.60418C12.8958 5.43751 13.0938 5.35418 13.3229 5.35418C13.5521 5.35418 13.75 5.43751 13.9167 5.60418L17.1458 8.81251C17.4653 9.13195 17.625 9.52779 17.625 10C17.625 10.4722 17.4653 10.8681 17.1458 11.1875L13.9167 14.4167C13.75 14.5833 13.5521 14.6632 13.3229 14.6563C13.0938 14.6493 12.8958 14.5625 12.7292 14.3958C12.5625 14.2292 12.4792 14.0313 12.4792 13.8021C12.4792 13.5729 12.5625 13.375 12.7292 13.2083L15.9583 10ZM4.04167 10L7.25 13.2083C7.41667 13.375 7.49653 13.5695 7.48958 13.7917C7.48264 14.0139 7.40278 14.2083 7.25 14.375C7.08333 14.5417 6.88542 14.6285 6.65625 14.6354C6.42708 14.6424 6.22917 14.5625 6.0625 14.3958L2.85417 11.1875C2.53472 10.8681 2.375 10.4722 2.375 10C2.375 9.52779 2.53472 9.13195 2.85417 8.81251L6.0625 5.60418C6.22917 5.43751 6.42708 5.35765 6.65625 5.36459C6.88542 5.37154 7.08333 5.45834 7.25 5.62501C7.40278 5.79168 7.48264 5.98612 7.48958 6.20834C7.49653 6.43057 7.41667 6.62501 7.25 6.79168L4.04167 10Z",
@@ -23,20 +24,20 @@ const T = () => /* @__PURE__ */ i("div", { className: "cursor-ew-resize flex ite
23
24
  ) })
24
25
  ]
25
26
  }
26
- ) }), W = (e, t) => {
27
- const r = document.getElementById(e);
28
- r ? t(r) : requestAnimationFrame(() => {
27
+ ) }), Z = (e, t) => {
28
+ const i = document.getElementById(e);
29
+ i ? t(i) : requestAnimationFrame(() => {
29
30
  const n = document.getElementById(e);
30
31
  n && t(n);
31
32
  });
32
- }, q = (e, t) => {
33
+ }, $ = (e, t) => {
33
34
  if (e.current) {
34
35
  if (t)
35
36
  localStorage.setItem("resizable-sidebar-width-before-fullscreen", String(e.current.size?.width));
36
37
  else {
37
- const r = localStorage.getItem("resizable-sidebar-width-before-fullscreen");
38
- if (r) {
39
- e.current.updateSize({ width: r, height: "100%" });
38
+ const i = localStorage.getItem("resizable-sidebar-width-before-fullscreen");
39
+ if (i) {
40
+ e.current.updateSize({ width: i, height: "100%" });
40
41
  return;
41
42
  }
42
43
  }
@@ -45,176 +46,179 @@ const T = () => /* @__PURE__ */ i("div", { className: "cursor-ew-resize flex ite
45
46
  height: "100%"
46
47
  });
47
48
  }
48
- }, U = (e, t, r, n, l, f) => {
49
- const [c, o] = L(!1), [s, a] = L(null);
50
- return p(() => {
49
+ }, G = (e, t, i, n, s, w) => {
50
+ const [d, a] = L(!1), [l, o] = L(null);
51
+ return v(() => {
51
52
  if (!e || typeof window > "u") {
52
- a(null);
53
+ o(null);
53
54
  return;
54
55
  }
55
- W(e, a);
56
- }, [e]), p(() => {
57
- q(l, r);
58
- }, [r]), p(() => {
56
+ Z(e, o);
57
+ }, [e]), v(() => {
58
+ $(s, i);
59
+ }, [i]), v(() => {
59
60
  if (e && t) {
60
- const d = requestAnimationFrame(() => {
61
- o(!0);
61
+ const c = requestAnimationFrame(() => {
62
+ a(!0);
62
63
  });
63
64
  return () => {
64
- cancelAnimationFrame(d), o(!1);
65
+ cancelAnimationFrame(c), a(!1);
65
66
  };
66
67
  }
67
- e || o(!0), t || o(!1);
68
- }, [t, e]), p(() => {
69
- l.current?.size?.width && n && n(l.current.size.width);
70
- }, [l.current?.size?.width, n]), { shouldRenderSidebar: c, portalTarget: s };
71
- }, Z = ({
68
+ e || a(!0), t || a(!1);
69
+ }, [t, e]), v(() => {
70
+ s.current?.size?.width && n && n(s.current.size.width);
71
+ }, [s.current?.size?.width, n]), { shouldRenderSidebar: d, portalTarget: l };
72
+ }, J = ({
72
73
  isOpen: e,
73
74
  header: t,
74
- id: r,
75
+ id: i,
75
76
  ref: n,
76
- className: l,
77
- containerClassName: f,
78
- widthStyle: c,
79
- heightStyle: o,
80
- motionVariants: s,
81
- resizableRef: a,
82
- fullScreen: d,
83
- maxResizableWidth: m,
84
- minWidth: w,
77
+ className: s,
78
+ containerClassName: w,
79
+ headerClassName: d,
80
+ widthStyle: a,
81
+ heightStyle: l,
82
+ motionVariants: o,
83
+ resizableRef: c,
84
+ fullScreen: u,
85
+ maxResizableWidth: g,
86
+ minWidth: b,
85
87
  handleKey: h,
86
88
  onDragEnd: x,
87
- onResize: g,
88
- children: v
89
- }) => /* @__PURE__ */ i(A, { children: e && /* @__PURE__ */ i(
90
- I.div,
89
+ onResize: p,
90
+ children: y
91
+ }) => /* @__PURE__ */ r(M, { children: e && /* @__PURE__ */ r(
92
+ R.div,
91
93
  {
92
94
  ref: n,
93
- id: r,
94
- initial: s.initial,
95
- animate: s.animate,
96
- exit: s.exit,
95
+ id: i,
96
+ initial: o.initial,
97
+ animate: o.animate,
98
+ exit: o.exit,
97
99
  transition: { type: "tween", duration: 0.3 },
98
- className: b(
100
+ className: m(
99
101
  "flex-shrink-0 z-50 relative bg-white border-neutral-200 dark:bg-black-800 dark:border-black-700",
100
- d ? "fixed w-full transition translate-x-4 duration-300" : "sticky",
101
- l
102
+ u ? "fixed w-full transition translate-x-4 duration-300" : "sticky",
103
+ s
102
104
  ),
103
105
  style: {
104
- width: c,
105
- height: o
106
+ width: a,
107
+ height: l
106
108
  },
107
- children: /* @__PURE__ */ i(
108
- R,
109
+ children: /* @__PURE__ */ r(
110
+ q,
109
111
  {
110
- onResize: (u) => {
111
- u.stopPropagation();
112
- const y = a.current?.size?.width;
113
- g && g(y || w);
112
+ onResize: (f) => {
113
+ f.stopPropagation();
114
+ const k = c.current?.size?.width;
115
+ p && p(k || b);
114
116
  },
115
- onResizeStart: (u) => {
116
- u.stopPropagation();
117
+ onResizeStart: (f) => {
118
+ f.stopPropagation();
117
119
  },
118
- ref: a,
119
- maxWidth: d ? m : m * 0.75,
120
- minWidth: w,
121
- minHeight: o,
122
- maxHeight: o,
123
- enable: d ? {} : { [h]: !0 },
120
+ ref: c,
121
+ maxWidth: u ? g : g * 0.75,
122
+ minWidth: b,
123
+ minHeight: l,
124
+ maxHeight: l,
125
+ enable: u ? {} : { [h]: !0 },
124
126
  handleClasses: {
125
- [h]: b(
127
+ [h]: m(
126
128
  "relative w-6 -left-1 flex items-center justify-center bg-transparent transition-colors cursor-ew-resize group z-[9999] hover:bg-neutral-200 dark:hover:bg-neutral-700"
127
129
  )
128
130
  },
129
131
  handleComponent: {
130
- [h]: /* @__PURE__ */ i(
132
+ [h]: /* @__PURE__ */ r(
131
133
  "div",
132
134
  {
133
- className: b(
135
+ className: m(
134
136
  "absolute -left-2.5 top-1/2 -translate-y-1/2 flex items-center justify-center w-8 h-12 cursor-ew-resize opacity-0 group-hover:opacity-100 hover:opacity-100 active:opacity-100 transition-opacity z-[9999]",
135
137
  h === "left" && "-right-2.5 -left-auto"
136
138
  ),
137
- children: /* @__PURE__ */ i(T, {})
139
+ children: /* @__PURE__ */ r(U, {})
138
140
  }
139
141
  )
140
142
  },
141
143
  className: "!h-full",
142
144
  onResizeStop: x || void 0,
143
- children: /* @__PURE__ */ N(
145
+ children: /* @__PURE__ */ W(
144
146
  "div",
145
147
  {
146
- className: b(
148
+ className: m(
147
149
  "h-full w-full flex flex-col overflow-hidden @container/sidebar border-b border-neutral-200 dark:border-black-700 bg-white dark:bg-black-800 dark:border",
148
- f
150
+ w
149
151
  ),
150
152
  children: [
151
- t ? /* @__PURE__ */ i("div", { className: "py-4 px-6", children: t || null }) : null,
152
- /* @__PURE__ */ i("div", { className: "flex-1 overflow-y-auto overflow-x-hidden", children: v })
153
+ t ? /* @__PURE__ */ r("div", { className: m("py-4 px-6", d), children: t || null }) : null,
154
+ /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto overflow-x-hidden", children: y })
153
155
  ]
154
156
  }
155
157
  )
156
158
  }
157
159
  )
158
160
  }
159
- ) }), $ = B(
161
+ ) }), Q = B(
160
162
  ({
161
163
  isOpen: e,
162
164
  children: t,
163
- fullScreen: r = !1,
165
+ fullScreen: i = !1,
164
166
  defaultSize: n = void 0,
165
- minWidth: l = 400,
166
- onDragEnd: f = null,
167
- onResize: c,
168
- className: o,
169
- placement: s = "right",
170
- parentContainer: a,
171
- header: d,
172
- id: m,
173
- containerClassName: w,
167
+ minWidth: s = 400,
168
+ onDragEnd: w = null,
169
+ onResize: d,
170
+ className: a,
171
+ placement: l = "right",
172
+ parentContainer: o,
173
+ header: c,
174
+ id: u,
175
+ containerClassName: g,
176
+ headerClassName: b,
174
177
  ignoreParentContainerHeight: h = !1,
175
178
  height: x,
176
- isMainSidebarExpanded: g = !1,
177
- mainSidebarExpandedWidth: v = 280,
178
- mainSidebarCollapsedWidth: u = 80,
179
- navbarHeight: y = 64
180
- }, D) => {
181
- const j = g ? v : u, C = H(null), { shouldRenderSidebar: S, portalTarget: z } = U(
182
- a,
179
+ isMainSidebarExpanded: p = !1,
180
+ mainSidebarExpandedWidth: y = 280,
181
+ mainSidebarCollapsedWidth: f = 80,
182
+ navbarHeight: k = 64
183
+ }, j) => {
184
+ const E = p ? y : f, S = H(null), { shouldRenderSidebar: z, portalTarget: F } = G(
185
+ o,
183
186
  e,
184
- r,
185
- c,
186
- C
187
- ), E = typeof window < "u" ? window.innerWidth - j : 0, P = n, k = s === "right", _ = x || (a && !h ? "100%" : `calc(100vh - ${y}px)`), F = /* @__PURE__ */ i(
188
- Z,
187
+ i,
188
+ d,
189
+ S
190
+ ), P = typeof window < "u" ? window.innerWidth - E : 0, _ = N(s), A = N(n), C = l === "right", I = x || (o && !h ? "100%" : `calc(100vh - ${k}px)`), D = /* @__PURE__ */ r(
191
+ J,
189
192
  {
190
193
  isOpen: e,
191
- header: d,
192
- id: m,
193
- ref: D,
194
- className: o,
195
- containerClassName: w,
196
- widthStyle: P,
197
- heightStyle: _,
194
+ header: c,
195
+ id: u,
196
+ ref: j,
197
+ className: a,
198
+ containerClassName: g,
199
+ headerClassName: b,
200
+ widthStyle: A,
201
+ heightStyle: I,
198
202
  motionVariants: {
199
- initial: { x: k ? "100%" : "-100%" },
203
+ initial: { x: C ? "100%" : "-100%" },
200
204
  animate: { x: 0 },
201
- exit: { x: k ? "100%" : "-100%" }
205
+ exit: { x: C ? "100%" : "-100%" }
202
206
  },
203
- resizableRef: C,
204
- fullScreen: r,
205
- maxResizableWidth: E,
206
- minWidth: l,
207
- handleKey: k ? "left" : "right",
208
- onDragEnd: f,
209
- onResize: c,
207
+ resizableRef: S,
208
+ fullScreen: i,
209
+ maxResizableWidth: P,
210
+ minWidth: _,
211
+ handleKey: C ? "left" : "right",
212
+ onDragEnd: w,
213
+ onResize: d,
210
214
  children: t
211
215
  }
212
216
  );
213
- return a ? !S || !z ? null : M.createPortal(F, z) : S ? F : null;
217
+ return o ? !z || !F ? null : T.createPortal(D, F) : z ? D : null;
214
218
  }
215
219
  );
216
- $.displayName = "ResizableSidebar";
220
+ Q.displayName = "ResizableSidebar";
217
221
  export {
218
- $ as ResizableSidebar
222
+ Q as ResizableSidebar
219
223
  };
220
224
  //# sourceMappingURL=ResizableSidebar.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResizableSidebar.es.js","sources":["../../../../src/components/data-display/resizable-sidebar/ResizableSidebar.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Resizable } from \"re-resizable\";\n\n/**\n * Sidebar placement options\n */\nexport type ResizableSidebarPlacement = \"left\" | \"right\";\n\n/**\n * Props for the ResizableSidebar component\n */\nexport interface ResizableSidebarProps {\n /** Whether the sidebar is open */\n isOpen: boolean;\n /** Content to display in the sidebar */\n children: React.ReactNode;\n /** Whether to display in full screen mode */\n fullScreen?: boolean;\n /** Callback when drag/resize ends */\n onDragEnd?: (() => void) | null;\n /** Callback when resize occurs */\n onResize?: (width: number) => void;\n /** Additional CSS classes for the wrapper */\n className?: string;\n /** Default size of the sidebar */\n defaultSize?: string;\n /** Minimum width of the sidebar */\n minWidth?: number;\n /** Placement of the sidebar */\n placement?: ResizableSidebarPlacement;\n /** Parent container ID for portal rendering */\n parentContainer?: string;\n /** Header content */\n header?: React.ReactNode;\n /** Unique ID for the sidebar */\n id?: string;\n /** Additional CSS classes for the container */\n containerClassName?: string;\n /** Whether to ignore parent container height */\n ignoreParentContainerHeight?: boolean;\n /** Custom height */\n height?: string;\n /** Whether the main sidebar is expanded (affects max width calculation) */\n isMainSidebarExpanded?: boolean;\n /** Width of the main sidebar when expanded */\n mainSidebarExpandedWidth?: number;\n /** Width of the main sidebar when collapsed */\n mainSidebarCollapsedWidth?: number;\n /** Height offset for navbar */\n navbarHeight?: number;\n}\n\n/**\n * Drag handle component for the resizable sidebar\n */\nconst DragHandle = () => {\n return (\n <div className=\"cursor-ew-resize flex items-center justify-center rounded-full bg-[#1018288F] bg-opacity-55 w-8 h-8 shadow-200 border-[1.5px] border-[#FFFFFF3D]\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <mask id=\"mask0_36675_12\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"20\" height=\"20\">\n <rect y=\"20\" width=\"20\" height=\"20\" transform=\"rotate(-90 0 20)\" fill=\"#D9D9D9\" />\n </mask>\n <g mask=\"url(#mask0_36675_12)\">\n <path\n d=\"M15.9583 10L12.7292 6.77084C12.5625 6.60418 12.4792 6.40973 12.4792 6.18751C12.4792 5.96529 12.5625 5.77084 12.7292 5.60418C12.8958 5.43751 13.0938 5.35418 13.3229 5.35418C13.5521 5.35418 13.75 5.43751 13.9167 5.60418L17.1458 8.81251C17.4653 9.13195 17.625 9.52779 17.625 10C17.625 10.4722 17.4653 10.8681 17.1458 11.1875L13.9167 14.4167C13.75 14.5833 13.5521 14.6632 13.3229 14.6563C13.0938 14.6493 12.8958 14.5625 12.7292 14.3958C12.5625 14.2292 12.4792 14.0313 12.4792 13.8021C12.4792 13.5729 12.5625 13.375 12.7292 13.2083L15.9583 10ZM4.04167 10L7.25 13.2083C7.41667 13.375 7.49653 13.5695 7.48958 13.7917C7.48264 14.0139 7.40278 14.2083 7.25 14.375C7.08333 14.5417 6.88542 14.6285 6.65625 14.6354C6.42708 14.6424 6.22917 14.5625 6.0625 14.3958L2.85417 11.1875C2.53472 10.8681 2.375 10.4722 2.375 10C2.375 9.52779 2.53472 9.13195 2.85417 8.81251L6.0625 5.60418C6.22917 5.43751 6.42708 5.35765 6.65625 5.36459C6.88542 5.37154 7.08333 5.45834 7.25 5.62501C7.40278 5.79168 7.48264 5.98612 7.48958 6.20834C7.49653 6.43057 7.41667 6.62501 7.25 6.79168L4.04167 10Z\"\n fill=\"white\"\n />\n </g>\n </svg>\n </div>\n );\n};\n\n/**\n * ResizableSidebar component displays a resizable sidebar panel\n *\n * @example\n * ```tsx\n * <ResizableSidebar\n * isOpen={isOpen}\n * onClose={() => setIsOpen(false)}\n * placement=\"right\"\n * minWidth={300}\n * >\n * <div>Sidebar content</div>\n * </ResizableSidebar>\n * ```\n */\n// Helper functions to reduce cognitive complexity\nconst findParentContainer = (parentContainer: string, setPortalTarget: (target: HTMLElement | null) => void) => {\n const el = document.getElementById(parentContainer);\n if (el) {\n setPortalTarget(el);\n } else {\n requestAnimationFrame(() => {\n const retryEl = document.getElementById(parentContainer);\n if (retryEl) setPortalTarget(retryEl);\n });\n }\n};\n\nconst handleFullScreenToggle = (resizableRef: React.RefObject<React.ElementRef<typeof Resizable>>, fullScreen: boolean) => {\n if (!resizableRef.current) return;\n\n if (fullScreen) {\n localStorage.setItem(\"resizable-sidebar-width-before-fullscreen\", String(resizableRef.current.size?.width));\n } else {\n const width = localStorage.getItem(\"resizable-sidebar-width-before-fullscreen\");\n if (width) {\n resizableRef.current.updateSize({ width: width, height: \"100%\" });\n return;\n }\n }\n resizableRef.current.updateSize({\n width: fullScreen ? \"100vw\" : \"\",\n height: \"100%\",\n });\n};\n\nconst useSidebarEffects = (\n parentContainer: string | undefined,\n isOpen: boolean,\n fullScreen: boolean,\n onResize: ((width: number) => void) | undefined,\n resizableRef: React.RefObject<React.ElementRef<typeof Resizable>>,\n _minWidth: number\n) => {\n const [shouldRenderSidebar, setShouldRenderSidebar] = useState(false);\n const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!parentContainer || typeof window === \"undefined\") {\n setPortalTarget(null);\n return;\n }\n findParentContainer(parentContainer, setPortalTarget);\n }, [parentContainer]);\n\n useEffect(() => {\n handleFullScreenToggle(resizableRef, fullScreen);\n }, [fullScreen]);\n\n useEffect(() => {\n if (parentContainer && isOpen) {\n const frame = requestAnimationFrame(() => {\n setShouldRenderSidebar(true);\n });\n return () => {\n cancelAnimationFrame(frame);\n setShouldRenderSidebar(false);\n };\n }\n\n if (!parentContainer) {\n setShouldRenderSidebar(true);\n }\n\n if (!isOpen) {\n setShouldRenderSidebar(false);\n }\n }, [isOpen, parentContainer]);\n\n useEffect(() => {\n if (resizableRef.current?.size?.width && onResize) {\n onResize(resizableRef.current.size.width);\n }\n }, [resizableRef.current?.size?.width, onResize]);\n\n return { shouldRenderSidebar, portalTarget };\n};\n\nconst SidebarContent = ({\n isOpen,\n header,\n id,\n ref,\n className,\n containerClassName,\n widthStyle,\n heightStyle,\n motionVariants,\n resizableRef,\n fullScreen,\n maxResizableWidth,\n minWidth,\n handleKey,\n onDragEnd,\n onResize,\n children,\n}: {\n isOpen: boolean;\n header?: React.ReactNode;\n id?: string;\n ref: React.Ref<HTMLDivElement>;\n className?: string;\n containerClassName?: string;\n widthStyle?: string;\n heightStyle: string;\n motionVariants: any;\n resizableRef: React.RefObject<React.ElementRef<typeof Resizable>>;\n fullScreen: boolean;\n maxResizableWidth: number;\n minWidth: number;\n handleKey: string;\n onDragEnd?: (() => void) | null;\n onResize?: (width: number) => void;\n children: React.ReactNode;\n}) => (\n <AnimatePresence>\n {isOpen && (\n <motion.div\n ref={ref}\n id={id}\n initial={motionVariants.initial}\n animate={motionVariants.animate}\n exit={motionVariants.exit}\n transition={{ type: \"tween\", duration: 0.3 }}\n className={cn(\n \"flex-shrink-0 z-50 relative bg-white border-neutral-200 dark:bg-black-800 dark:border-black-700\",\n fullScreen ? \"fixed w-full transition translate-x-4 duration-300\" : \"sticky\",\n className,\n )}\n style={{\n width: widthStyle,\n height: heightStyle,\n }}\n >\n <Resizable\n onResize={(e) => {\n e.stopPropagation();\n const width = resizableRef.current?.size?.width;\n if (onResize) {\n onResize(width || minWidth);\n }\n }}\n onResizeStart={(e) => {\n e.stopPropagation();\n }}\n ref={resizableRef}\n maxWidth={fullScreen ? maxResizableWidth : maxResizableWidth * 0.75}\n minWidth={minWidth}\n minHeight={heightStyle}\n maxHeight={heightStyle}\n enable={fullScreen ? {} : { [handleKey]: true }}\n handleClasses={{\n [handleKey]: cn(\n \"relative w-6 -left-1 flex items-center justify-center bg-transparent transition-colors cursor-ew-resize group z-[9999] hover:bg-neutral-200 dark:hover:bg-neutral-700\",\n ),\n }}\n handleComponent={{\n [handleKey]: (\n <div\n className={cn(\n \"absolute -left-2.5 top-1/2 -translate-y-1/2 flex items-center justify-center w-8 h-12 cursor-ew-resize opacity-0 group-hover:opacity-100 hover:opacity-100 active:opacity-100 transition-opacity z-[9999]\",\n handleKey === \"left\" && \"-right-2.5 -left-auto\",\n )}\n >\n <DragHandle />\n </div>\n ),\n }}\n className=\"!h-full\"\n onResizeStop={onDragEnd || undefined}\n >\n <div\n className={cn(\n \"h-full w-full flex flex-col overflow-hidden @container/sidebar border-b border-neutral-200 dark:border-black-700 bg-white dark:bg-black-800 dark:border\",\n containerClassName,\n )}\n >\n {header ? <div className=\"py-4 px-6\">{header || null}</div> : null}\n <div className=\"flex-1 overflow-y-auto overflow-x-hidden\">{children}</div>\n </div>\n </Resizable>\n </motion.div>\n )} \n </AnimatePresence>\n);\n\nexport const ResizableSidebar = forwardRef<HTMLDivElement, ResizableSidebarProps>(\n (\n {\n isOpen,\n children,\n fullScreen = false,\n defaultSize = undefined,\n minWidth = 400,\n onDragEnd = null,\n onResize,\n className,\n placement = \"right\",\n parentContainer,\n header,\n id,\n containerClassName,\n ignoreParentContainerHeight = false,\n height,\n isMainSidebarExpanded = false,\n mainSidebarExpandedWidth = 280,\n mainSidebarCollapsedWidth = 80,\n navbarHeight = 64,\n },\n ref\n ) => {\n const mainSidebarWidth = isMainSidebarExpanded ? mainSidebarExpandedWidth : mainSidebarCollapsedWidth;\n const resizableRef = useRef<React.ElementRef<typeof Resizable>>(null);\n const { shouldRenderSidebar, portalTarget } = useSidebarEffects(\n parentContainer,\n isOpen,\n fullScreen,\n onResize,\n resizableRef,\n minWidth\n );\n\n const maxResizableWidth = typeof window !== \"undefined\" ? window.innerWidth - mainSidebarWidth : 0;\n\n const widthStyle = defaultSize;\n const isRight = placement === \"right\";\n const heightStyle = height || (parentContainer && !ignoreParentContainerHeight ? \"100%\" : `calc(100vh - ${navbarHeight}px)`);\n\n const motionVariants = {\n initial: { x: isRight ? \"100%\" : \"-100%\" },\n animate: { x: 0 },\n exit: { x: isRight ? \"100%\" : \"-100%\" },\n };\n\n const handleKey = isRight ? \"left\" : \"right\";\n\n const sidebarContent = (\n <SidebarContent\n isOpen={isOpen}\n header={header}\n id={id}\n ref={ref}\n className={className}\n containerClassName={containerClassName}\n widthStyle={widthStyle}\n heightStyle={heightStyle}\n motionVariants={motionVariants}\n resizableRef={resizableRef}\n fullScreen={fullScreen}\n maxResizableWidth={maxResizableWidth}\n minWidth={minWidth}\n handleKey={handleKey}\n onDragEnd={onDragEnd}\n onResize={onResize}\n >\n {children}\n </SidebarContent>\n );\n\n if (parentContainer) {\n if (!shouldRenderSidebar || !portalTarget) return null;\n return ReactDOM.createPortal(sidebarContent, portalTarget);\n }\n\n if (!shouldRenderSidebar) return null;\n\n return sidebarContent;\n }\n);\n\nResizableSidebar.displayName = \"ResizableSidebar\";\n"],"names":["DragHandle","jsx","jsxs","findParentContainer","parentContainer","setPortalTarget","el","retryEl","handleFullScreenToggle","resizableRef","fullScreen","width","useSidebarEffects","isOpen","onResize","_minWidth","shouldRenderSidebar","setShouldRenderSidebar","useState","portalTarget","useEffect","frame","SidebarContent","header","id","ref","className","containerClassName","widthStyle","heightStyle","motionVariants","maxResizableWidth","minWidth","handleKey","onDragEnd","children","AnimatePresence","motion","cn","Resizable","e","ResizableSidebar","forwardRef","defaultSize","placement","ignoreParentContainerHeight","height","isMainSidebarExpanded","mainSidebarExpandedWidth","mainSidebarCollapsedWidth","navbarHeight","mainSidebarWidth","useRef","isRight","sidebarContent","ReactDOM"],"mappings":";;;;;;AA0DA,MAAMA,IAAa,MAEf,gBAAAC,EAAC,OAAA,EAAI,WAAU,oJACb,UAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IAEN,UAAA;AAAA,MAAA,gBAAAD,EAAC,QAAA,EAAK,IAAG,kBAAiB,WAAU,kBAAiB,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MACjF,UAAA,gBAAAA,EAAC,QAAA,EAAK,GAAE,MAAK,OAAM,MAAK,QAAO,MAAK,WAAU,oBAAmB,MAAK,UAAA,CAAU,EAAA,CAClF;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,YAAAC;AAAA,QACA,mBAAAqB;AAAA,QACA,UAAAC;AAAA,QACA,WAjBcqB,IAAU,SAAS;AAAA,QAkBjC,WAAAnB;AAAA,QACA,UAAApB;AAAA,QAEC,UAAAqB;AAAA,MAAA;AAAA,IAAA;AAIL,WAAI/B,IACE,CAACY,KAAuB,CAACG,IAAqB,OAC3CoC,EAAS,aAAaD,GAAgBnC,CAAY,IAGtDH,IAEEsC,IAF0B;AAAA,EAGnC;AACF;AAEAb,EAAiB,cAAc;"}
1
+ {"version":3,"file":"ResizableSidebar.es.js","sources":["../../../../src/components/data-display/resizable-sidebar/ResizableSidebar.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Resizable } from \"re-resizable\";\n\nimport { useResponsiveWidth } from \"../../../hooks/useResponsiveWidth\";\n\n/**\n * Sidebar placement options\n */\nexport type ResizableSidebarPlacement = \"left\" | \"right\";\n\n/**\n * Props for the ResizableSidebar component\n */\nexport interface ResizableSidebarProps {\n /** Whether the sidebar is open */\n isOpen: boolean;\n /** Content to display in the sidebar */\n children: React.ReactNode;\n /** Whether to display in full screen mode */\n fullScreen?: boolean;\n /** Callback when drag/resize ends */\n onDragEnd?: (() => void) | null;\n /** Callback when resize occurs */\n onResize?: (width: number) => void;\n /** Additional CSS classes for the wrapper */\n className?: string;\n /** Default size of the sidebar */\n defaultSize?: string;\n /** Minimum width of the sidebar */\n minWidth?: number;\n /** Placement of the sidebar */\n placement?: ResizableSidebarPlacement;\n /** Parent container ID for portal rendering */\n parentContainer?: string;\n /** Header content */\n header?: React.ReactNode;\n /** Unique ID for the sidebar */\n id?: string;\n /** Additional CSS classes for the container */\n containerClassName?: string;\n /** Additional CSS classes for the header wrapper */\n headerClassName?: string;\n /** Whether to ignore parent container height */\n ignoreParentContainerHeight?: boolean;\n /** Custom height */\n height?: string;\n /** Whether the main sidebar is expanded (affects max width calculation) */\n isMainSidebarExpanded?: boolean;\n /** Width of the main sidebar when expanded */\n mainSidebarExpandedWidth?: number;\n /** Width of the main sidebar when collapsed */\n mainSidebarCollapsedWidth?: number;\n /** Height offset for navbar */\n navbarHeight?: number;\n}\n\n/**\n * Drag handle component for the resizable sidebar\n */\nconst DragHandle = () => {\n return (\n <div className=\"cursor-ew-resize flex items-center justify-center rounded-full bg-[#1018288F] bg-opacity-55 w-8 h-8 shadow-200 border-[1.5px] border-[#FFFFFF3D]\">\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <mask id=\"mask0_36675_12\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"20\" height=\"20\">\n <rect y=\"20\" width=\"20\" height=\"20\" transform=\"rotate(-90 0 20)\" fill=\"#D9D9D9\" />\n </mask>\n <g mask=\"url(#mask0_36675_12)\">\n <path\n d=\"M15.9583 10L12.7292 6.77084C12.5625 6.60418 12.4792 6.40973 12.4792 6.18751C12.4792 5.96529 12.5625 5.77084 12.7292 5.60418C12.8958 5.43751 13.0938 5.35418 13.3229 5.35418C13.5521 5.35418 13.75 5.43751 13.9167 5.60418L17.1458 8.81251C17.4653 9.13195 17.625 9.52779 17.625 10C17.625 10.4722 17.4653 10.8681 17.1458 11.1875L13.9167 14.4167C13.75 14.5833 13.5521 14.6632 13.3229 14.6563C13.0938 14.6493 12.8958 14.5625 12.7292 14.3958C12.5625 14.2292 12.4792 14.0313 12.4792 13.8021C12.4792 13.5729 12.5625 13.375 12.7292 13.2083L15.9583 10ZM4.04167 10L7.25 13.2083C7.41667 13.375 7.49653 13.5695 7.48958 13.7917C7.48264 14.0139 7.40278 14.2083 7.25 14.375C7.08333 14.5417 6.88542 14.6285 6.65625 14.6354C6.42708 14.6424 6.22917 14.5625 6.0625 14.3958L2.85417 11.1875C2.53472 10.8681 2.375 10.4722 2.375 10C2.375 9.52779 2.53472 9.13195 2.85417 8.81251L6.0625 5.60418C6.22917 5.43751 6.42708 5.35765 6.65625 5.36459C6.88542 5.37154 7.08333 5.45834 7.25 5.62501C7.40278 5.79168 7.48264 5.98612 7.48958 6.20834C7.49653 6.43057 7.41667 6.62501 7.25 6.79168L4.04167 10Z\"\n fill=\"white\"\n />\n </g>\n </svg>\n </div>\n );\n};\n\n/**\n * ResizableSidebar component displays a resizable sidebar panel\n *\n * @example\n * ```tsx\n * <ResizableSidebar\n * isOpen={isOpen}\n * onClose={() => setIsOpen(false)}\n * placement=\"right\"\n * minWidth={300}\n * >\n * <div>Sidebar content</div>\n * </ResizableSidebar>\n * ```\n */\n// Helper functions to reduce cognitive complexity\nconst findParentContainer = (parentContainer: string, setPortalTarget: (target: HTMLElement | null) => void) => {\n const el = document.getElementById(parentContainer);\n if (el) {\n setPortalTarget(el);\n } else {\n requestAnimationFrame(() => {\n const retryEl = document.getElementById(parentContainer);\n if (retryEl) setPortalTarget(retryEl);\n });\n }\n};\n\nconst handleFullScreenToggle = (resizableRef: React.RefObject<React.ElementRef<typeof Resizable>>, fullScreen: boolean) => {\n if (!resizableRef.current) return;\n\n if (fullScreen) {\n localStorage.setItem(\"resizable-sidebar-width-before-fullscreen\", String(resizableRef.current.size?.width));\n } else {\n const width = localStorage.getItem(\"resizable-sidebar-width-before-fullscreen\");\n if (width) {\n resizableRef.current.updateSize({ width: width, height: \"100%\" });\n return;\n }\n }\n resizableRef.current.updateSize({\n width: fullScreen ? \"100vw\" : \"\",\n height: \"100%\",\n });\n};\n\nconst useSidebarEffects = (\n parentContainer: string | undefined,\n isOpen: boolean,\n fullScreen: boolean,\n onResize: ((width: number) => void) | undefined,\n resizableRef: React.RefObject<React.ElementRef<typeof Resizable>>,\n _minWidth: number\n) => {\n const [shouldRenderSidebar, setShouldRenderSidebar] = useState(false);\n const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!parentContainer || typeof window === \"undefined\") {\n setPortalTarget(null);\n return;\n }\n findParentContainer(parentContainer, setPortalTarget);\n }, [parentContainer]);\n\n useEffect(() => {\n handleFullScreenToggle(resizableRef, fullScreen);\n }, [fullScreen]);\n\n useEffect(() => {\n if (parentContainer && isOpen) {\n const frame = requestAnimationFrame(() => {\n setShouldRenderSidebar(true);\n });\n return () => {\n cancelAnimationFrame(frame);\n setShouldRenderSidebar(false);\n };\n }\n\n if (!parentContainer) {\n setShouldRenderSidebar(true);\n }\n\n if (!isOpen) {\n setShouldRenderSidebar(false);\n }\n }, [isOpen, parentContainer]);\n\n useEffect(() => {\n if (resizableRef.current?.size?.width && onResize) {\n onResize(resizableRef.current.size.width);\n }\n }, [resizableRef.current?.size?.width, onResize]);\n\n return { shouldRenderSidebar, portalTarget };\n};\n\nconst SidebarContent = ({\n isOpen,\n header,\n id,\n ref,\n className,\n containerClassName,\n headerClassName,\n widthStyle,\n heightStyle,\n motionVariants,\n resizableRef,\n fullScreen,\n maxResizableWidth,\n minWidth,\n handleKey,\n onDragEnd,\n onResize,\n children,\n}: {\n isOpen: boolean;\n header?: React.ReactNode;\n id?: string;\n ref: React.Ref<HTMLDivElement>;\n className?: string;\n containerClassName?: string;\n headerClassName?: string;\n widthStyle?: string | number;\n heightStyle: string;\n motionVariants: any;\n resizableRef: React.RefObject<React.ElementRef<typeof Resizable>>;\n fullScreen: boolean;\n maxResizableWidth: number;\n minWidth: number;\n handleKey: string;\n onDragEnd?: (() => void) | null;\n onResize?: (width: number) => void;\n children: React.ReactNode;\n}) => (\n <AnimatePresence>\n {isOpen && (\n <motion.div\n ref={ref}\n id={id}\n initial={motionVariants.initial}\n animate={motionVariants.animate}\n exit={motionVariants.exit}\n transition={{ type: \"tween\", duration: 0.3 }}\n className={cn(\n \"flex-shrink-0 z-50 relative bg-white border-neutral-200 dark:bg-black-800 dark:border-black-700\",\n fullScreen ? \"fixed w-full transition translate-x-4 duration-300\" : \"sticky\",\n className,\n )}\n style={{\n width: widthStyle,\n height: heightStyle,\n }}\n >\n <Resizable\n onResize={(e) => {\n e.stopPropagation();\n const width = resizableRef.current?.size?.width;\n if (onResize) {\n onResize(width || minWidth);\n }\n }}\n onResizeStart={(e) => {\n e.stopPropagation();\n }}\n ref={resizableRef}\n maxWidth={fullScreen ? maxResizableWidth : maxResizableWidth * 0.75}\n minWidth={minWidth}\n minHeight={heightStyle}\n maxHeight={heightStyle}\n enable={fullScreen ? {} : { [handleKey]: true }}\n handleClasses={{\n [handleKey]: cn(\n \"relative w-6 -left-1 flex items-center justify-center bg-transparent transition-colors cursor-ew-resize group z-[9999] hover:bg-neutral-200 dark:hover:bg-neutral-700\",\n ),\n }}\n handleComponent={{\n [handleKey]: (\n <div\n className={cn(\n \"absolute -left-2.5 top-1/2 -translate-y-1/2 flex items-center justify-center w-8 h-12 cursor-ew-resize opacity-0 group-hover:opacity-100 hover:opacity-100 active:opacity-100 transition-opacity z-[9999]\",\n handleKey === \"left\" && \"-right-2.5 -left-auto\",\n )}\n >\n <DragHandle />\n </div>\n ),\n }}\n className=\"!h-full\"\n onResizeStop={onDragEnd || undefined}\n >\n <div\n className={cn(\n \"h-full w-full flex flex-col overflow-hidden @container/sidebar border-b border-neutral-200 dark:border-black-700 bg-white dark:bg-black-800 dark:border\",\n containerClassName,\n )}\n >\n {header ? <div className={cn(\"py-4 px-6\", headerClassName)}>{header || null}</div> : null}\n <div className=\"flex-1 overflow-y-auto overflow-x-hidden\">{children}</div>\n </div>\n </Resizable>\n </motion.div>\n )} \n </AnimatePresence>\n);\n\nexport const ResizableSidebar = forwardRef<HTMLDivElement, ResizableSidebarProps>(\n (\n {\n isOpen,\n children,\n fullScreen = false,\n defaultSize = undefined,\n minWidth = 400,\n onDragEnd = null,\n onResize,\n className,\n placement = \"right\",\n parentContainer,\n header,\n id,\n containerClassName,\n headerClassName,\n ignoreParentContainerHeight = false,\n height,\n isMainSidebarExpanded = false,\n mainSidebarExpandedWidth = 280,\n mainSidebarCollapsedWidth = 80,\n navbarHeight = 64,\n },\n ref\n ) => {\n const mainSidebarWidth = isMainSidebarExpanded ? mainSidebarExpandedWidth : mainSidebarCollapsedWidth;\n const resizableRef = useRef<React.ElementRef<typeof Resizable>>(null);\n const { shouldRenderSidebar, portalTarget } = useSidebarEffects(\n parentContainer,\n isOpen,\n fullScreen,\n onResize,\n resizableRef,\n minWidth\n );\n\n const maxResizableWidth = typeof window !== \"undefined\" ? window.innerWidth - mainSidebarWidth : 0;\n\n // Passed sizes are the desktop maximum; both the drag floor and the open\n // width shrink by viewport breakpoint.\n const responsiveMinWidth = useResponsiveWidth(minWidth);\n const responsiveDefaultSize = useResponsiveWidth(defaultSize);\n\n const widthStyle = responsiveDefaultSize;\n const isRight = placement === \"right\";\n const heightStyle = height || (parentContainer && !ignoreParentContainerHeight ? \"100%\" : `calc(100vh - ${navbarHeight}px)`);\n\n const motionVariants = {\n initial: { x: isRight ? \"100%\" : \"-100%\" },\n animate: { x: 0 },\n exit: { x: isRight ? \"100%\" : \"-100%\" },\n };\n\n const handleKey = isRight ? \"left\" : \"right\";\n\n const sidebarContent = (\n <SidebarContent\n isOpen={isOpen}\n header={header}\n id={id}\n ref={ref}\n className={className}\n containerClassName={containerClassName}\n headerClassName={headerClassName}\n widthStyle={widthStyle}\n heightStyle={heightStyle}\n motionVariants={motionVariants}\n resizableRef={resizableRef}\n fullScreen={fullScreen}\n maxResizableWidth={maxResizableWidth}\n minWidth={responsiveMinWidth}\n handleKey={handleKey}\n onDragEnd={onDragEnd}\n onResize={onResize}\n >\n {children}\n </SidebarContent>\n );\n\n if (parentContainer) {\n if (!shouldRenderSidebar || !portalTarget) return null;\n return ReactDOM.createPortal(sidebarContent, portalTarget);\n }\n\n if (!shouldRenderSidebar) return null;\n\n return sidebarContent;\n }\n);\n\nResizableSidebar.displayName = \"ResizableSidebar\";\n"],"names":["DragHandle","jsx","jsxs","findParentContainer","parentContainer","setPortalTarget","el","retryEl","handleFullScreenToggle","resizableRef","fullScreen","width","useSidebarEffects","isOpen","onResize","_minWidth","shouldRenderSidebar","setShouldRenderSidebar","useState","portalTarget","useEffect","frame","SidebarContent","header","id","ref","className","containerClassName","headerClassName","widthStyle","heightStyle","motionVariants","maxResizableWidth","minWidth","handleKey","onDragEnd","children","AnimatePresence","motion","cn","Resizable","e","ResizableSidebar","forwardRef","defaultSize","placement","ignoreParentContainerHeight","height","isMainSidebarExpanded","mainSidebarExpandedWidth","mainSidebarCollapsedWidth","navbarHeight","mainSidebarWidth","useRef","responsiveMinWidth","useResponsiveWidth","isRight","sidebarContent","ReactDOM"],"mappings":";;;;;;;AA8DA,MAAMA,IAAa,MAEf,gBAAAC,EAAC,OAAA,EAAI,WAAU,oJACb,UAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IAEN,UAAA;AAAA,MAAA,gBAAAD,EAAC,QAAA,EAAK,IAAG,kBAAiB,WAAU,kBAAiB,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MACjF,UAAA,gBAAAA,EAAC,QAAA,EAAK,GAAE,MAAK,OAAM,MAAK,QAAO,MAAK,WAAU,oBAAmB,MAAK,UAAA,CAAU,EAAA,CAClF;AAAA,MACA,gBAAAA,EAAC,KAAA,EAAE,MAAK,wBACN,UAAA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,QAAA;AAAA,MAAA,EACP,CACF;AAAA,IAAA;AAAA,EAAA;AAAA,GAEJ,GAoBEE,IAAsB,CAACC,GAAyBC,MAA0D;AAC9G,QAAMC,IAAK,SAAS,eAAeF,CAAe;AAClD,EAAIE,IACFD,EAAgBC,CAAE,IAElB,sBAAsB,MAAM;AAC1B,UAAMC,IAAU,SAAS,eAAeH,CAAe;AACvD,IAAIG,OAAyBA,CAAO;AAAA,EACtC,CAAC;AAEL,GAEMC,IAAyB,CAACC,GAAmEC,MAAwB;AACz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,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../../_virtual/index.cjs.js"),l=require("react"),M=require("antd"),ke=require("react-i18next"),Se=require("../../data-display/typography/Typography.cjs.js"),je=require("../../data-display/label/Label.cjs.js"),Q=require("./currency.constant.cjs.js"),X=require("@mui/icons-material"),Ee=require("../../icons/AIExtractedIndicator.cjs.js"),Ce=require("../../icons/AIStarIcon.cjs.js"),we=require("../../icons/HelpIcon.cjs.js"),Z=require("../../tooltip/Tooltip.cjs.js"),m=require("../../../utils/confidenceScoreUtils.cjs.js"),Ne=require("../search-bar/SearchBar.cjs.js"),_e=require("../../buttons/option-button/OptionButton.cjs.js"),T=require("../../../utils/countryFlags.cjs.js"),Ie=require("../shared/InputLabel.cjs.js"),Be=require("../../../utils/formatters.cjs.js"),V=l.forwardRef(({id:c,label:F,value:o,onChange:B,errorMessage:i,defaultValue:x,required:k=!1,isRequiredConditional:G=!1,tags:ee,className:re,originalCase:q=!1,tooltip:A,simpleMode:te=!1,inputFieldClassName:d="",isAiExtracted:ae=!1,confidenceScore:S,confidenceType:f="high",confidenceTooltip:j,sourceMeta:oe=[],onConfidenceScoreClick:ne,isGTN:E=!1,gtnName:le=null,allowMultiCurrency:$=!1,placeholder:se,disabled:ce=!1,currencyCode:u="USD",inputStyle:de,labelClassName:z,isLiveField:ie=!1,onBlur:ue,autoFocus:D=!1,isRecording:L=!1,isPlaying:O=!1,onAddGTNToDocument:C,riskDetails:s,isRiskAnalysisOpen:p=!1,RiskDetailsCard:U,labelExtra:be,inputEmphasis:w="default",...W},H)=>{const{t:me}=ke.useTranslation(),xe=w==="modified"&&!i&&!(p&&s?.color),fe=w==="deleted"&&!i&&!(p&&s?.color),pe=w==="success"&&!i&&!(p&&s?.color),[b,R]=l.useState(!1),[ge,he]=l.useState([]),[N,K]=l.useState(""),[a,P]=l.useState(u||"USD"),[v,_]=l.useState(!1),ve=r=>{if(C){const t={key:le,value:Be.formatCurrency(r,a)};C(t)}},g=r=>{if(r==null)return"";const t=Number(r);return isNaN(t)?r:t?.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},I=r=>{const t=r.target.value,h=t===""||t===null||t===void 0?0:Number(t);B(h,a);const y=document.getElementById(c);if(y&&y.setAttribute("data-selected-value",JSON.stringify({value:h,currency_code:a})),y&&(L||O)){const Fe=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:h,currency_code:a},type:"change"}});y.dispatchEvent(Fe)}},J=()=>{R(!0)},Y=()=>{R(!1),(o==null||o==="")&&I({target:{value:"0.00"}}),ue?.()},ye=()=>{const r="pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0";return i?n(r,"rounded-md border-red-300 bg-white dark:bg-black-600",d):p&&s?.color?n(r,`rounded-md border-${s.color}-300 bg-${s.color}-50`,"text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800",d):fe?n(r,"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254,202,202,0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)]",d):xe?n(r,"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254,223,137,0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)]",d):pe?n(r,"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187,247,208,0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)]",d):n(r,"rounded-lg border-gray-300 dark:border-black-600 bg-white dark:bg-black-600 text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",d)};return l.useEffect(()=>{u&&P(u)},[u]),l.useEffect(()=>{if(a){const r=o===""||o===null||o===void 0?0:Number(o);u!==a&&B(r,a);const t=document.getElementById(c);if(t&&(t.setAttribute("data-selected-value",JSON.stringify({value:r,currency_code:a})),L||O)){const h=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:r,currency_code:a},type:"change"}});t.dispatchEvent(h)}}},[a]),l.useEffect(()=>{const r=Q.CURRENCIES.filter(t=>(t.value+" - "+t.label).toLowerCase().includes(N.toLowerCase())).map(t=>({label:e.jsx(_e.OptionButton,{text:`${t.value} - ${t.label}`,icon:T.getFlagComponent(t.value),showTick:a===t.value,onClick:()=>P(t.value),className:"text-black-900 dark:text-white"}),key:t.value}));he(r)},[N,a]),l.useEffect(()=>{K("")},[a]),te?e.jsxs("label",{id:c,className:`mb-1 text-xs font-medium text-gray-600 h-full inline-flex items-center gap-1 ${q?"":"capitalize"} ${z||""}`,children:[e.jsx("span",{className:"absolute inset-y-0 left-1 top-0.5 flex items-center pl-3",children:"$"}),e.jsx("input",{...W,ref:H,type:b?"number":"text",required:k,className:n(d,"pl-8 h-8"),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?o:g(o),...x&&!o?{defaultValue:b?x:g(x)}:{},id:c||F,autoFocus:D})]}):e.jsxs("div",{className:n("flex gap-0.5 relative",v&&E?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[E&&!v?e.jsx("div",{className:"size-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:n("w-full flex flex-col",re),children:[e.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${q?"":"uppercase"} ${z||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Ie.InputLabel,{label:F||"",required:k||!1,isRequiredConditional:G||!1}),ie&&e.jsx(X.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),ae&&!m.shouldShowConfidenceScore(S)&&e.jsx(Ee.AIExtractedIndicator,{}),e.jsx(je.Label,{labels:ee}),A&&e.jsx(Z,{placement:"top",title:A,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(we.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),be]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[m.shouldShowConfidenceScore(S)&&f?e.jsx(Z,{placement:"top-end",title:j??"",hideTooltip:j==null,className:"cursor-pointer",children:e.jsxs("div",{className:n("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",m.getConfidenceScoreBadgeClass(f)),onClick:()=>ne?.(oe),children:[e.jsx(Ce.AIStarIcon,{size:12,fill:m.getConfidenceScoreBadgeColor(f),fillSecondary:m.getConfidenceScoreBadgeFill(f)}),e.jsxs("span",{className:n("text-xs font-medium leading-4",m.getConfidenceScoreBadgeTextColor(f)),children:[S,"%"]})]})}):null,E&&v&&C?e.jsx("button",{id:"btn-currency-input-add-to-document",className:"cursor-pointer",onClick:()=>ve(g(o)),type:"button",children:e.jsx(M.Tooltip,{placement:"top",title:me("Add to document"),children:e.jsx(X.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),e.jsxs("label",{className:"relative block",children:[e.jsx("span",{className:"absolute inset-y-0 left-1 flex items-center pl-3 text-neutral-900 dark:text-white",children:Q.CURRENCY_SYMBOLS[a]}),e.jsx("input",{...W,ref:H,placeholder:se,type:b?"number":"text",required:k,disabled:ce,className:ye(),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?o:g(o),defaultValue:b?x:g(x),id:c||F,style:de,autoComplete:"off",autoFocus:D}),e.jsx("span",{className:`absolute inset-y-0 right-2 flex items-center z-[1000] h-full cursor-pointer dark:text-black-200 ${$?"cursor-pointer":""}`,children:$?e.jsx(M.Dropdown,{menu:{items:[...ge]},trigger:["click"],overlayClassName:"row-option-cell",placement:"bottomRight",overlayStyle:{zIndex:999},getPopupContainer:r=>r.parentElement,popupRender:r=>e.jsxs("div",{className:"[&>*:nth-child(2)]:!shadow-none [&>*:nth-child(2)>*]:!px-2 flex flex-col gap-2 p-2 bg-white dark:bg-black-700 border border-solid border-neutral-200 dark:border-black-600 max-h-[200px] w-[330px] text-ellipsis overflow-y-auto z-[999] rounded-md",children:[e.jsx(Ne.SearchBar,{id:"search-bar-currency-input",value:N,onChange:t=>K(t),className:"mb-2"}),r]}),children:e.jsxs("div",{className:"pl-4 pr-2 py-1.5 text-sm text-gray-700 dark:text-black-200 flex items-center gap-1",children:[T.getFlagComponent(a)," ",a]})}):a})]}),i&&e.jsx(Se.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:i})]}),v&&s&&p&&U&&e.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:r=>r.stopPropagation(),onMouseDown:r=>r.preventDefault(),onKeyDown:r=>{r.key==="Escape"&&_(!1)},children:e.jsx(U,{riskDetails:s})})]})});V.displayName="CurrencyInputField";exports.CurrencyInputField=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../../_virtual/index.cjs.js"),l=require("react"),M=require("antd"),ke=require("react-i18next"),Se=require("../../data-display/typography/Typography.cjs.js"),je=require("../../data-display/label/Label.cjs.js"),Q=require("./currency.constant.cjs.js"),X=require("@mui/icons-material"),Ee=require("../../icons/AIExtractedIndicator.cjs.js"),Ce=require("../../icons/AIStarIcon.cjs.js"),we=require("../../icons/HelpIcon.cjs.js"),Z=require("../../tooltip/Tooltip.cjs.js"),m=require("../../../utils/confidenceScoreUtils.cjs.js"),Ne=require("../search-bar/SearchBar.cjs.js"),_e=require("../../buttons/option-button/OptionButton.cjs.js"),T=require("../../../utils/countryFlags.cjs.js"),Ie=require("../shared/InputLabel.cjs.js"),Be=require("../../../utils/formatters.cjs.js"),V=l.forwardRef(({id:c,label:F,value:a,onChange:B,errorMessage:i,defaultValue:x,required:k=!1,isRequiredConditional:G=!1,tags:ee,className:re,originalCase:q=!1,tooltip:A,simpleMode:te=!1,inputFieldClassName:d="",isAiExtracted:oe=!1,confidenceScore:S,confidenceType:f="high",confidenceTooltip:j,sourceMeta:ae=[],onConfidenceScoreClick:ne,isGTN:E=!1,gtnName:le=null,allowMultiCurrency:$=!1,placeholder:se,disabled:ce=!1,currencyCode:u="USD",inputStyle:de,labelClassName:z,isLiveField:ie=!1,onBlur:ue,autoFocus:D=!1,isRecording:L=!1,isPlaying:O=!1,onAddGTNToDocument:C,riskDetails:s,isRiskAnalysisOpen:p=!1,RiskDetailsCard:U,labelExtra:be,inputEmphasis:w="default",...W},H)=>{const{t:me}=ke.useTranslation(),xe=w==="modified"&&!i&&!(p&&s?.color),fe=w==="deleted"&&!i&&!(p&&s?.color),pe=w==="success"&&!i&&!(p&&s?.color),[b,R]=l.useState(!1),[ge,he]=l.useState([]),[N,K]=l.useState(""),[o,P]=l.useState(u||"USD"),[v,_]=l.useState(!1),ve=r=>{if(C){const t={key:le,value:Be.formatCurrency(r,o)};C(t)}},g=r=>{if(r==null)return"";const t=Number(r);return isNaN(t)?r:t?.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},I=r=>{const t=r.target.value,h=t===""||t===null||t===void 0?0:Number(t);B(h,o);const y=document.getElementById(c);if(y&&y.setAttribute("data-selected-value",JSON.stringify({value:h,currency_code:o})),y&&(L||O)){const Fe=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:h,currency_code:o},type:"change"}});y.dispatchEvent(Fe)}},J=()=>{R(!0)},Y=()=>{R(!1),(a==null||a==="")&&I({target:{value:"0.00"}}),ue?.()},ye=()=>{const r="pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0";return i?n(r,"rounded-md border-red-300 bg-white dark:bg-black-600",d):p&&s?.color?n(r,`rounded-md border-${s.color}-300 bg-${s.color}-50`,"text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800",d):fe?n(r,"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254,202,202,0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)]",d):xe?n(r,"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254,223,137,0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)]",d):pe?n(r,"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187,247,208,0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)]",d):n(r,"rounded-lg border-gray-300 dark:border-black-600 bg-white dark:bg-black-600 text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",d)};return l.useEffect(()=>{u&&P(u)},[u]),l.useEffect(()=>{if(o){const r=a===""||a===null||a===void 0?0:Number(a);u!==o&&B(r,o);const t=document.getElementById(c);if(t&&(t.setAttribute("data-selected-value",JSON.stringify({value:r,currency_code:o})),L||O)){const h=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:r,currency_code:o},type:"change"}});t.dispatchEvent(h)}}},[o]),l.useEffect(()=>{const r=Q.CURRENCIES.filter(t=>(t.value+" - "+t.label).toLowerCase().includes(N.toLowerCase())).map(t=>({label:e.jsx(_e.OptionButton,{text:`${t.value} - ${t.label}`,icon:T.getFlagComponent(t.value),showTick:o===t.value,onClick:()=>P(t.value),className:"text-black-900 dark:text-white"}),key:t.value}));he(r)},[N,o]),l.useEffect(()=>{K("")},[o]),te?e.jsxs("label",{id:c,className:`mb-1 text-xs font-medium text-gray-600 h-full inline-flex items-center gap-1 ${q?"":"capitalize"} ${z||""}`,children:[e.jsx("span",{className:"absolute inset-y-0 left-1 top-0.5 flex items-center pl-3",children:"$"}),e.jsx("input",{...W,ref:H,type:b?"number":"text",required:k,className:n(d,"pl-8 h-8"),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?a:g(a),...x&&!a?{defaultValue:b?x:g(x)}:{},id:c||F,autoFocus:D})]}):e.jsxs("div",{className:n("flex gap-0.5 relative",v&&E?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[E&&!v?e.jsx("div",{className:"size-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:n("w-full flex flex-col",re),children:[e.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${q?"":"uppercase"} ${z||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Ie.InputLabel,{label:F||"",required:k||!1,isRequiredConditional:G||!1}),ie&&e.jsx(X.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),oe&&!m.shouldShowConfidenceScore(S)&&e.jsx(Ee.AIExtractedIndicator,{}),e.jsx(je.Label,{labels:ee}),A&&e.jsx(Z,{placement:"top",title:A,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(we.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),be]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[m.shouldShowConfidenceScore(S)&&f?e.jsx(Z,{placement:"top-end",title:j??"",hideTooltip:j==null,className:"cursor-pointer",children:e.jsxs("div",{className:n("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",m.getConfidenceScoreBadgeClass(f)),onClick:()=>ne?.(ae),children:[e.jsx(Ce.AIStarIcon,{size:12,fill:m.getConfidenceScoreBadgeColor(f),fillSecondary:m.getConfidenceScoreBadgeFill(f)}),e.jsxs("span",{className:n("text-xs font-medium leading-4",m.getConfidenceScoreBadgeTextColor(f)),children:[S,"%"]})]})}):null,E&&v&&C?e.jsx("button",{id:"btn-currency-input-add-to-document",className:"cursor-pointer",onClick:()=>ve(g(a)),type:"button",children:e.jsx(M.Tooltip,{placement:"top",title:me("Add to document"),children:e.jsx(X.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),e.jsxs("label",{className:"relative block",children:[e.jsx("span",{className:"absolute inset-y-0 left-1 flex items-center pl-3 text-neutral-900 dark:text-white",children:Q.CURRENCY_SYMBOLS[o]}),e.jsx("input",{...W,ref:H,placeholder:se,type:b?"number":"text",required:k,disabled:ce,className:ye(),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?a:g(a),defaultValue:b?x:g(x),id:c||F,style:de,autoComplete:"off",autoFocus:D}),e.jsx("span",{className:`absolute inset-y-0 right-2 flex items-center h-full cursor-pointer dark:text-black-200 ${$?"cursor-pointer":""}`,children:$?e.jsx(M.Dropdown,{menu:{items:[...ge]},trigger:["click"],overlayClassName:"row-option-cell",placement:"bottomRight",overlayStyle:{zIndex:999},getPopupContainer:()=>document.body,popupRender:r=>e.jsxs("div",{className:"[&>*:nth-child(2)]:!shadow-none [&>*:nth-child(2)>*]:!px-2 flex flex-col gap-2 p-2 bg-white dark:bg-black-700 border border-solid border-neutral-200 dark:border-black-600 max-h-[200px] w-[330px] text-ellipsis overflow-y-auto z-[999] rounded-md",children:[e.jsx(Ne.SearchBar,{id:"search-bar-currency-input",value:N,onChange:t=>K(t),className:"mb-2"}),r]}),children:e.jsxs("div",{className:"pl-4 pr-2 py-1.5 text-sm text-gray-700 dark:text-black-200 flex items-center gap-1",children:[T.getFlagComponent(o)," ",o]})}):o})]}),i&&e.jsx(Se.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:i})]}),v&&s&&p&&U&&e.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:r=>r.stopPropagation(),onMouseDown:r=>r.preventDefault(),onKeyDown:r=>{r.key==="Escape"&&_(!1)},children:e.jsx(U,{riskDetails:s})})]})});V.displayName="CurrencyInputField";exports.CurrencyInputField=V;
2
2
  //# sourceMappingURL=CurrencyInputField.cjs.js.map