tailwind-ux-kit 1.0.21 → 1.0.23

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.
package/README.md CHANGED
@@ -190,6 +190,14 @@ iconContainerClass: 'bg-green-200 text-green-900 rounded-full p-2',
190
190
 
191
191
  - Horizontal & Vertical Tabs
192
192
  - Accordions
193
+ | Prop | Type | Default | Description |
194
+ | ------------------- | ----------------------------------------------- | ------- | ------------------------------------------------------------------ |
195
+ | `items` | `T[]` (`AccordionItemBase` generic) | — | Array of accordion items with id, title, content, and custom props |
196
+ | `allowMultipleOpen` | `boolean` | `false` | Allow multiple panels to be open simultaneously |
197
+ | `className` | `string` | `""` | Custom class name for the accordion container |
198
+ | `renderTitle` | `(item: T, isOpen: boolean) => React.ReactNode` | — | Custom render function for the accordion header/title |
199
+ | `renderContent` | `(item: T, isOpen: boolean) => React.ReactNode` | — | Custom render function for the accordion content |
200
+
193
201
  - FAQ Sections
194
202
 
195
203
  ### 10. Lists & Grids
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+ export interface AccordionItemBase {
3
+ id: string | number;
4
+ title?: React.ReactNode;
5
+ content?: React.ReactNode;
6
+ [key: string]: any;
7
+ }
8
+ interface AccordionProps<T extends AccordionItemBase> {
9
+ items: T[];
10
+ allowMultipleOpen?: boolean;
11
+ className?: string;
12
+ open?: (string | number)[];
13
+ onChange?: (openItems: (string | number)[]) => void;
14
+ /**
15
+ * Optional custom renderer for the title, gets the item and whether it's open
16
+ */
17
+ renderTitle?: (item: T, isOpen: boolean) => React.ReactNode;
18
+ /**
19
+ * Optional custom renderer for the content, gets the item and whether it's open
20
+ */
21
+ renderContent?: (item: T, isOpen: boolean) => React.ReactNode;
22
+ }
23
+ declare const Accordion: <T extends AccordionItemBase>({ items, allowMultipleOpen, className, open: controlledOpen, onChange, renderTitle, renderContent, }: AccordionProps<T>) => import("react/jsx-runtime").JSX.Element;
24
+ export default Accordion;
package/lib/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export { default as Button } from './components/Button';
3
3
  export { default as Dropdown } from './components/Dropdown';
4
4
  export { default as Tooltip } from './components/ToolTip';
5
5
  export { default as Badge } from './components/Badge';
6
+ export { default as Accordion } from './components/Accordion';
7
+ export type { AccordionItemBase } from './components/Accordion';
6
8
  export { default as Modal } from './components/modal/Modal';
7
9
  export { default as ModalProvider } from './components/modal/ModalProvider';
8
10
  export { useModalActions } from './components/modal/ModalActionContext';
@@ -1,27 +1,27 @@
1
1
  "use client";
2
- import { jsxs as x, jsx as g } from "react/jsx-runtime";
3
- import y, { forwardRef as oe, useState as w, useRef as M, useMemo as I, useCallback as h, useEffect as S, createContext as Z, useContext as W } from "react";
4
- const se = oe((e, n) => {
2
+ import { jsxs as x, jsx as u } from "react/jsx-runtime";
3
+ import w, { forwardRef as se, useState as h, useRef as M, useMemo as z, useCallback as m, useEffect as O, createContext as Z, useContext as W } from "react";
4
+ const ae = se((e, n) => {
5
5
  const {
6
6
  label: r,
7
7
  id: t,
8
- inputSize: o = "md",
9
- shape: d = "rounded",
10
- validate: u,
11
- onValidatedChange: a,
12
- className: s = "",
8
+ inputSize: s = "md",
9
+ shape: g = "rounded",
10
+ validate: f,
11
+ onValidatedChange: l,
12
+ className: a = "",
13
13
  icon: i,
14
- iconPosition: l = "left",
15
- floatingLabelStyle: c,
16
- onChange: p,
17
- isValid: f,
14
+ iconPosition: d = "left",
15
+ floatingLabelStyle: o,
16
+ onChange: c,
17
+ isValid: p,
18
18
  isInvalid: b,
19
- feedback: m,
19
+ feedback: y,
20
20
  feedbackType: v = "invalid",
21
21
  ...C
22
- } = e, [k, j] = w("default"), L = (O) => {
23
- const T = O.target.value, $ = (u == null ? void 0 : u(T)) ?? "default";
24
- j($), a == null || a(O, $), p == null || p(O);
22
+ } = e, [S, L] = h("default"), j = (k) => {
23
+ const A = k.target.value, $ = (f == null ? void 0 : f(A)) ?? "default";
24
+ L($), l == null || l(k, $), c == null || c(k);
25
25
  }, P = {
26
26
  xs: "text-xs px-2 py-1",
27
27
  sm: "text-sm px-3 py-1.5",
@@ -31,20 +31,20 @@ const se = oe((e, n) => {
31
31
  flat: "rounded-none",
32
32
  rounded: "rounded-md",
33
33
  pill: "rounded-full"
34
- }, q = {
34
+ }, J = {
35
35
  filled: "rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",
36
36
  outlined: "rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",
37
37
  standard: "px-0 py-2.5 bg-transparent border-0 border-b-2"
38
- }, J = {
38
+ }, Q = {
39
39
  filled: "absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
40
40
  outlined: "absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",
41
41
  standard: "absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"
42
- }, Q = (O, T, $) => {
42
+ }, V = (k, A, $) => {
43
43
  if ($)
44
44
  return "border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";
45
- if (T)
45
+ if (A)
46
46
  return "border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";
47
- switch (O) {
47
+ switch (k) {
48
48
  case "error":
49
49
  return "border-red-500 bg-red-50 focus:ring-red-500";
50
50
  case "warning":
@@ -54,57 +54,57 @@ const se = oe((e, n) => {
54
54
  default:
55
55
  return "border-gray-300 focus:ring-blue-500";
56
56
  }
57
- }, V = P[o] || P.md, ee = E[d] || E.flat, te = Q(k, f, b), re = l === "start" || l === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", ne = i && (l === "start" || l === "left") ? "ps-10" : i ? "pe-10" : "", R = t ?? `input-${(r == null ? void 0 : r.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, N = !!c;
57
+ }, ee = P[s] || P.md, te = E[g] || E.flat, re = V(S, p, b), ne = d === "start" || d === "left" ? "left-0 ps-3.5" : "right-0 pe-3.5", oe = i && (d === "start" || d === "left") ? "ps-10" : i ? "pe-10" : "", R = t ?? `input-${(r == null ? void 0 : r.toLowerCase().replace(/\s+/g, "-")) || Math.random().toString(36).slice(2)}`, N = !!o;
58
58
  return /* @__PURE__ */ x("div", { className: `w-full relative ${N ? "z-0" : ""}`, children: [
59
- !N && r && /* @__PURE__ */ g(
59
+ !N && r && /* @__PURE__ */ u(
60
60
  "label",
61
61
  {
62
62
  htmlFor: R,
63
- className: `block mb-1 font-light text-sm ${f ? "text-green-700 dark:text-green-500" : b ? "text-red-700 dark:text-red-500" : "text-gray-700"}`,
63
+ className: `block mb-1 font-light text-sm ${p ? "text-green-700 dark:text-green-500" : b ? "text-red-700 dark:text-red-500" : "text-gray-700"}`,
64
64
  children: r
65
65
  }
66
66
  ),
67
67
  /* @__PURE__ */ x("div", { className: "relative w-full", children: [
68
- i && /* @__PURE__ */ g(
68
+ i && /* @__PURE__ */ u(
69
69
  "div",
70
70
  {
71
- className: `absolute inset-y-0 flex items-center ${re}`,
72
- children: /* @__PURE__ */ g("span", { className: "text-gray-500", children: i })
71
+ className: `absolute inset-y-0 flex items-center ${ne}`,
72
+ children: /* @__PURE__ */ u("span", { className: "text-gray-500", children: i })
73
73
  }
74
74
  ),
75
- /* @__PURE__ */ g(
75
+ /* @__PURE__ */ u(
76
76
  "input",
77
77
  {
78
78
  ...C,
79
79
  id: R,
80
80
  ref: n,
81
81
  placeholder: N ? " " : C.placeholder,
82
- onChange: L,
82
+ onChange: j,
83
83
  className: `border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
84
- ${N && c ? q[c] : V}
85
- ${ne} ${ee} ${te} ${s}`
84
+ ${N && o ? J[o] : ee}
85
+ ${oe} ${te} ${re} ${a}`
86
86
  }
87
87
  ),
88
- N && r && c && /* @__PURE__ */ g(
88
+ N && r && o && /* @__PURE__ */ u(
89
89
  "label",
90
90
  {
91
91
  htmlFor: R,
92
- className: `ms-1 ${J[c]} ${s}`,
92
+ className: `ms-1 ${Q[o]} ${a}`,
93
93
  children: r
94
94
  }
95
95
  )
96
96
  ] }),
97
- m && /* @__PURE__ */ g(
97
+ y && /* @__PURE__ */ u(
98
98
  "p",
99
99
  {
100
100
  className: `mt-1 text-xs ${v === "invalid" ? "text-red-600 dark:text-red-500" : "text-green-600 dark:text-green-500"}`,
101
- children: m
101
+ children: y
102
102
  }
103
103
  )
104
104
  ] });
105
105
  });
106
- se.displayName = "Input";
107
- const ae = {
106
+ ae.displayName = "Input";
107
+ const le = {
108
108
  primary: "bg-blue-600 text-white hover:bg-blue-700",
109
109
  secondary: "bg-gray-600 text-white hover:bg-gray-700",
110
110
  success: "bg-green-600 text-white hover:bg-green-700",
@@ -122,13 +122,13 @@ const ae = {
122
122
  "outline-info": "border border-cyan-600 text-cyan-600 hover:bg-cyan-50",
123
123
  "outline-dark": "border border-gray-900 text-gray-900 hover:bg-gray-100",
124
124
  "outline-light": "border border-gray-100 text-gray-500 hover:bg-gray-200"
125
- }, le = {
125
+ }, ie = {
126
126
  xs: "px-3 py-2 text-xs",
127
127
  sm: "px-3 py-2 text-sm",
128
128
  md: "px-5 py-2.5 text-sm",
129
129
  lg: "px-5 py-3 text-base",
130
130
  xl: "px-6 py-3.5 text-base"
131
- }, ie = {
131
+ }, ce = {
132
132
  flat: "shadow-none",
133
133
  rounded: "rounded-md",
134
134
  pill: "rounded-full",
@@ -138,23 +138,23 @@ const ae = {
138
138
  variant: n = "primary",
139
139
  size: r = "md",
140
140
  type: t = "button",
141
- shape: o = "rounded",
142
- className: d = "",
143
- isLoading: u = !1,
144
- disabled: a = !1,
145
- ...s
141
+ shape: s = "rounded",
142
+ className: g = "",
143
+ isLoading: f = !1,
144
+ disabled: l = !1,
145
+ ...a
146
146
  }) => {
147
- const i = a || u, l = [
147
+ const i = l || f, d = [
148
148
  "inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",
149
- ae[n],
150
- le[r],
151
- ie[o],
152
- o === "flat" ? "shadow-none" : "shadow-sm",
149
+ le[n],
150
+ ie[r],
151
+ ce[s],
152
+ s === "flat" ? "shadow-none" : "shadow-sm",
153
153
  i ? "opacity-50 cursor-not-allowed pointer-events-none" : "",
154
- d
154
+ g
155
155
  ].filter(Boolean).join(" ");
156
- return /* @__PURE__ */ x("button", { type: t, className: l, disabled: i, ...s, children: [
157
- u && /* @__PURE__ */ x(
156
+ return /* @__PURE__ */ x("button", { type: t, className: d, disabled: i, ...a, children: [
157
+ f && /* @__PURE__ */ x(
158
158
  "svg",
159
159
  {
160
160
  "aria-hidden": "true",
@@ -164,14 +164,14 @@ const ae = {
164
164
  fill: "none",
165
165
  xmlns: "http://www.w3.org/2000/svg",
166
166
  children: [
167
- /* @__PURE__ */ g(
167
+ /* @__PURE__ */ u(
168
168
  "path",
169
169
  {
170
170
  d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
171
171
  fill: "currentColor"
172
172
  }
173
173
  ),
174
- /* @__PURE__ */ g(
174
+ /* @__PURE__ */ u(
175
175
  "path",
176
176
  {
177
177
  d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
@@ -183,12 +183,12 @@ const ae = {
183
183
  ),
184
184
  e
185
185
  ] });
186
- }, Le = ({
186
+ }, Pe = ({
187
187
  label: e,
188
188
  children: n,
189
189
  position: r = "right"
190
190
  }) => {
191
- const [t, o] = w(!1), [d, u] = w(!1), a = M(null), s = M(null), i = I(() => {
191
+ const [t, s] = h(!1), [g, f] = h(!1), l = M(null), a = M(null), i = z(() => {
192
192
  switch (r) {
193
193
  case "left":
194
194
  return "left-0";
@@ -198,59 +198,59 @@ const ae = {
198
198
  default:
199
199
  return "right-0";
200
200
  }
201
- }, [r]), l = h((f) => {
202
- const b = f.target;
203
- a.current && !a.current.contains(b) && s.current && !s.current.contains(b) && o(!1);
204
- }, []), c = h(() => {
205
- if (!s.current || !a.current) return;
206
- const f = s.current.getBoundingClientRect(), b = a.current.getBoundingClientRect(), m = window.innerHeight - f.bottom, v = f.top;
207
- u(
208
- m < b.height && v > b.height
201
+ }, [r]), d = m((p) => {
202
+ const b = p.target;
203
+ l.current && !l.current.contains(b) && a.current && !a.current.contains(b) && s(!1);
204
+ }, []), o = m(() => {
205
+ if (!a.current || !l.current) return;
206
+ const p = a.current.getBoundingClientRect(), b = l.current.getBoundingClientRect(), y = window.innerHeight - p.bottom, v = p.top;
207
+ f(
208
+ y < b.height && v > b.height
209
209
  );
210
210
  }, []);
211
- S(() => {
211
+ O(() => {
212
212
  if (t)
213
- return c(), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), () => {
214
- window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0);
213
+ return o(), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
214
+ window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
215
215
  };
216
- }, [t, c]), S(() => (document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l)), [l]);
217
- const p = h(() => o((f) => !f), []);
216
+ }, [t, o]), O(() => (document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d)), [d]);
217
+ const c = m(() => s((p) => !p), []);
218
218
  return /* @__PURE__ */ x("div", { className: "relative flex items-center", children: [
219
- /* @__PURE__ */ g("button", { ref: s, onClick: p, children: e }),
220
- t && /* @__PURE__ */ g(
219
+ /* @__PURE__ */ u("button", { ref: a, onClick: c, children: e }),
220
+ t && /* @__PURE__ */ u(
221
221
  "div",
222
222
  {
223
- ref: a,
223
+ ref: l,
224
224
  className: `absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
225
- ${d ? "bottom-full mb-2" : "top-full mt-2"}
225
+ ${g ? "bottom-full mb-2" : "top-full mt-2"}
226
226
  ${i}`,
227
227
  children: n
228
228
  }
229
229
  )
230
230
  ] });
231
- }, Pe = ({
231
+ }, Ee = ({
232
232
  children: e,
233
233
  content: n,
234
234
  position: r = "top",
235
235
  className: t = "",
236
- tooltipClass: o = "",
237
- tooltipStyle: d = {}
236
+ tooltipClass: s = "",
237
+ tooltipStyle: g = {}
238
238
  }) => {
239
- const u = M(null), a = M(null);
240
- S(() => {
241
- const i = u.current, l = a.current;
242
- if (!i || !l) return;
243
- const c = () => {
244
- l.style.opacity = "1", l.style.visibility = "visible";
245
- }, p = () => {
246
- l.style.opacity = "0", l.style.visibility = "hidden";
239
+ const f = M(null), l = M(null);
240
+ O(() => {
241
+ const i = f.current, d = l.current;
242
+ if (!i || !d) return;
243
+ const o = () => {
244
+ d.style.opacity = "1", d.style.visibility = "visible";
245
+ }, c = () => {
246
+ d.style.opacity = "0", d.style.visibility = "hidden";
247
247
  };
248
- return i.addEventListener("mouseenter", c), i.addEventListener("mouseleave", p), () => {
249
- i.removeEventListener("mouseenter", c), i.removeEventListener("mouseleave", p);
248
+ return i.addEventListener("mouseenter", o), i.addEventListener("mouseleave", c), () => {
249
+ i.removeEventListener("mouseenter", o), i.removeEventListener("mouseleave", c);
250
250
  };
251
251
  }, []);
252
- const s = (i) => {
253
- const l = {
252
+ const a = (i) => {
253
+ const d = {
254
254
  position: "absolute",
255
255
  opacity: 0,
256
256
  visibility: "hidden",
@@ -270,7 +270,7 @@ const ae = {
270
270
  switch (i) {
271
271
  case "top":
272
272
  return {
273
- ...l,
273
+ ...d,
274
274
  bottom: "100%",
275
275
  left: "50%",
276
276
  transform: "translateX(-50%)",
@@ -278,7 +278,7 @@ const ae = {
278
278
  };
279
279
  case "bottom":
280
280
  return {
281
- ...l,
281
+ ...d,
282
282
  top: "100%",
283
283
  left: "50%",
284
284
  transform: "translateX(-50%)",
@@ -286,7 +286,7 @@ const ae = {
286
286
  };
287
287
  case "left":
288
288
  return {
289
- ...l,
289
+ ...d,
290
290
  right: "100%",
291
291
  top: "50%",
292
292
  transform: "translateY(-50%)",
@@ -294,33 +294,33 @@ const ae = {
294
294
  };
295
295
  case "right":
296
296
  return {
297
- ...l,
297
+ ...d,
298
298
  left: "100%",
299
299
  top: "50%",
300
300
  transform: "translateY(-50%)",
301
301
  marginLeft: "8px"
302
302
  };
303
303
  default:
304
- return l;
304
+ return d;
305
305
  }
306
306
  };
307
- return /* @__PURE__ */ x("div", { ref: u, className: `relative inline-block ${t}`, children: [
307
+ return /* @__PURE__ */ x("div", { ref: f, className: `relative inline-block ${t}`, children: [
308
308
  e,
309
- /* @__PURE__ */ g(
309
+ /* @__PURE__ */ u(
310
310
  "div",
311
311
  {
312
- ref: a,
312
+ ref: l,
313
313
  role: "tooltip",
314
- className: o,
314
+ className: s,
315
315
  style: {
316
- ...s(r),
317
- ...d
316
+ ...a(r),
317
+ ...g
318
318
  },
319
319
  children: n
320
320
  }
321
321
  )
322
322
  ] });
323
- }, ce = {
323
+ }, de = {
324
324
  primary: "bg-blue-500 text-white",
325
325
  secondary: "bg-gray-500 text-white",
326
326
  success: "bg-green-500 text-white",
@@ -338,141 +338,61 @@ const ae = {
338
338
  "outline-info": "border border-cyan-500 text-cyan-500 bg-transparent",
339
339
  "outline-dark": "border border-black text-black bg-transparent",
340
340
  "outline-light": "border border-gray-100 text-gray-800 bg-transparent"
341
- }, de = {
341
+ }, ue = {
342
342
  xs: "text-xs px-2 py-0.5",
343
343
  sm: "text-sm px-2.5 py-0.5",
344
344
  md: "text-base px-3 py-1",
345
345
  lg: "text-lg px-3.5 py-1.5",
346
346
  xl: "text-xl px-4 py-2"
347
- }, ue = {
347
+ }, ge = {
348
348
  flat: "rounded-none",
349
349
  rounded: "rounded-sm",
350
350
  pill: "rounded-full",
351
351
  circle: "rounded-full p-2 w-8 h-8 justify-center"
352
- }, Ee = ({
352
+ }, $e = ({
353
353
  label: e,
354
354
  variant: n = "primary",
355
355
  size: r = "sm",
356
356
  shape: t = "rounded",
357
- icon: o,
358
- dismissible: d,
359
- onDismiss: u,
360
- className: a = "",
361
- ...s
357
+ icon: s,
358
+ dismissible: g,
359
+ onDismiss: f,
360
+ className: l = "",
361
+ ...a
362
362
  }) => {
363
- const i = !e && !!o, l = `inline-flex items-center font-medium ${ce[n] || ""} ${de[r] || ""} ${ue[t] || ""} ${i ? "justify-center p-2 w-8 h-8" : ""} ` + a;
364
- return /* @__PURE__ */ x("span", { className: l.trim(), ...s, children: [
365
- o && /* @__PURE__ */ g("span", { className: e ? "mr-1" : "", children: o }),
363
+ const i = !e && !!s, d = `inline-flex items-center font-medium ${de[n] || ""} ${ue[r] || ""} ${ge[t] || ""} ${i ? "justify-center p-2 w-8 h-8" : ""} ` + l;
364
+ return /* @__PURE__ */ x("span", { className: d.trim(), ...a, children: [
365
+ s && /* @__PURE__ */ u("span", { className: e ? "mr-1" : "", children: s }),
366
366
  e,
367
- d && /* @__PURE__ */ g(
367
+ g && /* @__PURE__ */ u(
368
368
  "button",
369
369
  {
370
370
  type: "button",
371
- onClick: u,
371
+ onClick: f,
372
372
  className: "ml-2 text-xs font-bold leading-none focus:outline-none",
373
373
  children: "×"
374
374
  }
375
375
  )
376
376
  ] });
377
- }, G = Z(null), H = () => W(G), X = Z(null), Y = () => W(X);
378
- function $e({
379
- id: e,
380
- title: n,
381
- children: r,
382
- standalone: t = !1,
383
- showFloatingClose: o = !1,
384
- containerClasses: d = "",
385
- onClose: u
386
- }) {
387
- const a = Y(), s = H(), i = !t && !!a && !!s, [l, c] = w(!1), p = i ? a.isOpen(e) : l, f = i ? a.getModalData(e) : null, b = () => {
388
- i ? s.closeModal(e) : c(!1), u == null || u();
389
- };
390
- return S(() => (p ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
391
- document.body.style.overflow = "";
392
- }), [p]), p ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ x(
393
- "div",
394
- {
395
- className: `bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${d}`,
396
- children: [
397
- /* @__PURE__ */ x("div", { className: "flex justify-between items-center relative", children: [
398
- n && /* @__PURE__ */ g("h2", { className: "text-lg font-semibold", children: n }),
399
- o && /* @__PURE__ */ g(
400
- "button",
401
- {
402
- onClick: b,
403
- className: "text-gray-500 hover:text-gray-700 absolute top-2 right-3",
404
- "aria-label": "Close modal",
405
- children: "✕"
406
- }
407
- )
408
- ] }),
409
- /* @__PURE__ */ g("div", { className: "mt-3 text-sm text-gray-700", children: typeof r == "function" ? r({ modalData: f }) : r })
410
- ]
411
- }
412
- ) }) : null;
413
- }
414
- function Me({
415
- children: e
416
- }) {
417
- const [n, r] = w({}), [t, o] = w({}), d = h((c, p) => {
418
- r((f) => ({ ...f, [c]: !0 })), p && o((f) => ({ ...f, [c]: p }));
419
- }, []), u = h((c) => {
420
- r((p) => ({ ...p, [c]: !1 })), o((p) => {
421
- const f = { ...p };
422
- return delete f[c], f;
423
- });
424
- }, []), a = h((c) => !!n[c], [n]), s = h(
425
- (c) => t[c],
426
- [t]
427
- ), i = I(
428
- () => ({ openModal: d, closeModal: u }),
429
- [d, u]
430
- ), l = I(
431
- () => ({ isOpen: a, getModalData: s }),
432
- [a, s]
433
- );
434
- return /* @__PURE__ */ g(G.Provider, { value: i, children: /* @__PURE__ */ g(X.Provider, { value: l, children: e }) });
435
- }
436
- function ze(e) {
437
- const { openModal: n, closeModal: r } = H(), { isOpen: t, getModalData: o } = Y();
438
- return {
439
- open: (d) => n(e, d),
440
- close: () => r(e),
441
- isOpen: t(e),
442
- data: o(e)
443
- };
444
- }
445
- let _ = null, A = {};
446
- function ge(e) {
447
- _ = e;
448
- }
449
- function De(e) {
450
- A = { ...A, ...e };
451
- }
452
- function pe() {
453
- return A;
454
- }
455
- function Re(e, n, r = 3e3, t) {
456
- _ ? _(e, n, r, t) : console.warn("Toast system is not mounted");
457
- }
458
- var K = {
377
+ };
378
+ var G = {
459
379
  color: void 0,
460
380
  size: void 0,
461
381
  className: void 0,
462
382
  style: void 0,
463
383
  attr: void 0
464
- }, B = y.createContext && /* @__PURE__ */ y.createContext(K), fe = ["attr", "size", "title"];
465
- function be(e, n) {
384
+ }, B = w.createContext && /* @__PURE__ */ w.createContext(G), fe = ["attr", "size", "title"];
385
+ function pe(e, n) {
466
386
  if (e == null) return {};
467
- var r = xe(e, n), t, o;
387
+ var r = be(e, n), t, s;
468
388
  if (Object.getOwnPropertySymbols) {
469
- var d = Object.getOwnPropertySymbols(e);
470
- for (o = 0; o < d.length; o++)
471
- t = d[o], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
389
+ var g = Object.getOwnPropertySymbols(e);
390
+ for (s = 0; s < g.length; s++)
391
+ t = g[s], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
472
392
  }
473
393
  return r;
474
394
  }
475
- function xe(e, n) {
395
+ function be(e, n) {
476
396
  if (e == null) return {};
477
397
  var r = {};
478
398
  for (var t in e)
@@ -482,22 +402,22 @@ function xe(e, n) {
482
402
  }
483
403
  return r;
484
404
  }
485
- function z() {
486
- return z = Object.assign ? Object.assign.bind() : function(e) {
405
+ function I() {
406
+ return I = Object.assign ? Object.assign.bind() : function(e) {
487
407
  for (var n = 1; n < arguments.length; n++) {
488
408
  var r = arguments[n];
489
409
  for (var t in r)
490
410
  Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]);
491
411
  }
492
412
  return e;
493
- }, z.apply(this, arguments);
413
+ }, I.apply(this, arguments);
494
414
  }
495
415
  function F(e, n) {
496
416
  var r = Object.keys(e);
497
417
  if (Object.getOwnPropertySymbols) {
498
418
  var t = Object.getOwnPropertySymbols(e);
499
- n && (t = t.filter(function(o) {
500
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
419
+ n && (t = t.filter(function(s) {
420
+ return Object.getOwnPropertyDescriptor(e, s).enumerable;
501
421
  })), r.push.apply(r, t);
502
422
  }
503
423
  return r;
@@ -506,21 +426,21 @@ function D(e) {
506
426
  for (var n = 1; n < arguments.length; n++) {
507
427
  var r = arguments[n] != null ? arguments[n] : {};
508
428
  n % 2 ? F(Object(r), !0).forEach(function(t) {
509
- me(e, t, r[t]);
429
+ xe(e, t, r[t]);
510
430
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : F(Object(r)).forEach(function(t) {
511
431
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
512
432
  });
513
433
  }
514
434
  return e;
515
435
  }
516
- function me(e, n, r) {
517
- return n = he(n), n in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e;
436
+ function xe(e, n, r) {
437
+ return n = me(n), n in e ? Object.defineProperty(e, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = r, e;
518
438
  }
519
- function he(e) {
520
- var n = ye(e, "string");
439
+ function me(e) {
440
+ var n = he(e, "string");
521
441
  return typeof n == "symbol" ? n : n + "";
522
442
  }
523
- function ye(e, n) {
443
+ function he(e, n) {
524
444
  if (typeof e != "object" || !e) return e;
525
445
  var r = e[Symbol.toPrimitive];
526
446
  if (r !== void 0) {
@@ -530,77 +450,222 @@ function ye(e, n) {
530
450
  }
531
451
  return (n === "string" ? String : Number)(e);
532
452
  }
533
- function U(e) {
534
- return e && e.map((n, r) => /* @__PURE__ */ y.createElement(n.tag, D({
453
+ function H(e) {
454
+ return e && e.map((n, r) => /* @__PURE__ */ w.createElement(n.tag, D({
535
455
  key: r
536
- }, n.attr), U(n.child)));
456
+ }, n.attr), H(n.child)));
537
457
  }
538
- function we(e) {
539
- return (n) => /* @__PURE__ */ y.createElement(ve, z({
458
+ function U(e) {
459
+ return (n) => /* @__PURE__ */ w.createElement(ye, I({
540
460
  attr: D({}, e.attr)
541
- }, n), U(e.child));
461
+ }, n), H(e.child));
542
462
  }
543
- function ve(e) {
463
+ function ye(e) {
544
464
  var n = (r) => {
545
465
  var {
546
466
  attr: t,
547
- size: o,
548
- title: d
549
- } = e, u = be(e, fe), a = o || r.size || "1em", s;
550
- return r.className && (s = r.className), e.className && (s = (s ? s + " " : "") + e.className), /* @__PURE__ */ y.createElement("svg", z({
467
+ size: s,
468
+ title: g
469
+ } = e, f = pe(e, fe), l = s || r.size || "1em", a;
470
+ return r.className && (a = r.className), e.className && (a = (a ? a + " " : "") + e.className), /* @__PURE__ */ w.createElement("svg", I({
551
471
  stroke: "currentColor",
552
472
  fill: "currentColor",
553
473
  strokeWidth: "0"
554
- }, r.attr, t, u, {
555
- className: s,
474
+ }, r.attr, t, f, {
475
+ className: a,
556
476
  style: D(D({
557
477
  color: e.color || r.color
558
478
  }, r.style), e.style),
559
- height: a,
560
- width: a,
479
+ height: l,
480
+ width: l,
561
481
  xmlns: "http://www.w3.org/2000/svg"
562
- }), d && /* @__PURE__ */ y.createElement("title", null, d), e.children);
482
+ }), g && /* @__PURE__ */ w.createElement("title", null, g), e.children);
483
+ };
484
+ return B !== void 0 ? /* @__PURE__ */ w.createElement(B.Consumer, null, (r) => n(r)) : n(G);
485
+ }
486
+ function we(e) {
487
+ return U({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z" }, child: [] }] })(e);
488
+ }
489
+ const Me = ({
490
+ items: e,
491
+ allowMultipleOpen: n = !1,
492
+ className: r = "",
493
+ open: t,
494
+ onChange: s,
495
+ renderTitle: g,
496
+ renderContent: f
497
+ }) => {
498
+ const [l, a] = h(/* @__PURE__ */ new Set()), i = z(() => t ? new Set(t) : l, [t, l]), d = m(
499
+ (o) => {
500
+ const c = new Set(i);
501
+ c.has(o) ? c.delete(o) : (n || c.clear(), c.add(o)), t && s ? s(Array.from(c)) : a(c);
502
+ },
503
+ [i, t, s, n]
504
+ );
505
+ return /* @__PURE__ */ u(
506
+ "div",
507
+ {
508
+ className: "accordion",
509
+ role: "region",
510
+ "aria-multiselectable": n,
511
+ children: e.map((o) => {
512
+ const c = i.has(o.id), p = `accordion-heading-${o.id}`, b = `accordion-panel-${o.id}`;
513
+ return /* @__PURE__ */ x(
514
+ "div",
515
+ {
516
+ className: `accordion-item mb-2 border rounded border-gray-300 dark:border-gray-700 ${r}`,
517
+ children: [
518
+ /* @__PURE__ */ u("h3", { id: p, children: /* @__PURE__ */ x(
519
+ "button",
520
+ {
521
+ type: "button",
522
+ "aria-expanded": c,
523
+ "aria-controls": b,
524
+ onClick: () => d(o.id),
525
+ className: "flex justify-between items-center w-full p-4 font-medium text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-500 gap-3",
526
+ children: [
527
+ g ? g(o, c) : o.title,
528
+ /* @__PURE__ */ u(we, {})
529
+ ]
530
+ }
531
+ ) }),
532
+ /* @__PURE__ */ u(
533
+ "div",
534
+ {
535
+ id: b,
536
+ role: "region",
537
+ "aria-labelledby": p,
538
+ hidden: !c,
539
+ className: "p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400",
540
+ children: f ? f(o, c) : o.content
541
+ }
542
+ )
543
+ ]
544
+ },
545
+ o.id
546
+ );
547
+ })
548
+ }
549
+ );
550
+ }, X = Z(null), Y = () => W(X), K = Z(null), q = () => W(K);
551
+ function ze({
552
+ id: e,
553
+ title: n,
554
+ children: r,
555
+ standalone: t = !1,
556
+ showFloatingClose: s = !1,
557
+ containerClasses: g = "",
558
+ onClose: f
559
+ }) {
560
+ const l = q(), a = Y(), i = !t && !!l && !!a, [d, o] = h(!1), c = i ? l.isOpen(e) : d, p = i ? l.getModalData(e) : null, b = () => {
561
+ i ? a.closeModal(e) : o(!1), f == null || f();
563
562
  };
564
- return B !== void 0 ? /* @__PURE__ */ y.createElement(B.Consumer, null, (r) => n(r)) : n(K);
563
+ return O(() => (c ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
564
+ document.body.style.overflow = "";
565
+ }), [c]), c ? /* @__PURE__ */ u("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ x(
566
+ "div",
567
+ {
568
+ className: `bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${g}`,
569
+ children: [
570
+ /* @__PURE__ */ x("div", { className: "flex justify-between items-center relative", children: [
571
+ n && /* @__PURE__ */ u("h2", { className: "text-lg font-semibold", children: n }),
572
+ s && /* @__PURE__ */ u(
573
+ "button",
574
+ {
575
+ onClick: b,
576
+ className: "text-gray-500 hover:text-gray-700 absolute top-2 right-3",
577
+ "aria-label": "Close modal",
578
+ children: "✕"
579
+ }
580
+ )
581
+ ] }),
582
+ /* @__PURE__ */ u("div", { className: "mt-3 text-sm text-gray-700", children: typeof r == "function" ? r({ modalData: p }) : r })
583
+ ]
584
+ }
585
+ ) }) : null;
586
+ }
587
+ function Ie({
588
+ children: e
589
+ }) {
590
+ const [n, r] = h({}), [t, s] = h({}), g = m((o, c) => {
591
+ r((p) => ({ ...p, [o]: !0 })), c && s((p) => ({ ...p, [o]: c }));
592
+ }, []), f = m((o) => {
593
+ r((c) => ({ ...c, [o]: !1 })), s((c) => {
594
+ const p = { ...c };
595
+ return delete p[o], p;
596
+ });
597
+ }, []), l = m((o) => !!n[o], [n]), a = m(
598
+ (o) => t[o],
599
+ [t]
600
+ ), i = z(
601
+ () => ({ openModal: g, closeModal: f }),
602
+ [g, f]
603
+ ), d = z(
604
+ () => ({ isOpen: l, getModalData: a }),
605
+ [l, a]
606
+ );
607
+ return /* @__PURE__ */ u(X.Provider, { value: i, children: /* @__PURE__ */ u(K.Provider, { value: d, children: e }) });
608
+ }
609
+ function De(e) {
610
+ const { openModal: n, closeModal: r } = Y(), { isOpen: t, getModalData: s } = q();
611
+ return {
612
+ open: (g) => n(e, g),
613
+ close: () => r(e),
614
+ isOpen: t(e),
615
+ data: s(e)
616
+ };
617
+ }
618
+ let T = null, _ = {};
619
+ function ve(e) {
620
+ T = e;
621
+ }
622
+ function Re(e) {
623
+ _ = { ..._, ...e };
624
+ }
625
+ function Ce() {
626
+ return _;
627
+ }
628
+ function Ae(e, n, r = 3e3, t) {
629
+ T ? T(e, n, r, t) : console.warn("Toast system is not mounted");
565
630
  }
566
- function Ce(e) {
567
- return we({ attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(e);
631
+ function Ne(e) {
632
+ return U({ attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(e);
568
633
  }
569
- const Ne = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
634
+ const ke = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
570
635
  const n = Math.random() * 16 | 0;
571
636
  return (e === "x" ? n : n & 3 | 8).toString(16);
572
637
  }), Te = () => {
573
- const [e, n] = w([]);
574
- S(() => {
575
- ge((t, o, d, u) => {
576
- const a = Ne();
577
- n((s) => [...s, { id: a, type: t, message: o, config: u }]), setTimeout(() => {
578
- n((s) => s.filter((i) => i.id !== a));
579
- }, d);
638
+ const [e, n] = h([]);
639
+ O(() => {
640
+ ve((t, s, g, f) => {
641
+ const l = ke();
642
+ n((a) => [...a, { id: l, type: t, message: s, config: f }]), setTimeout(() => {
643
+ n((a) => a.filter((i) => i.id !== l));
644
+ }, g);
580
645
  });
581
646
  }, []);
582
- const r = pe();
583
- return /* @__PURE__ */ g("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
584
- var s, i, l, c, p, f, b, m, v, C, k, j, L;
585
- const o = ((s = t.config) == null ? void 0 : s.icon) || ((i = r.icons) == null ? void 0 : i[t.type]) || Oe(t.type), d = ((l = t.config) == null ? void 0 : l.bgColor) || ((p = (c = r.colors) == null ? void 0 : c[t.type]) == null ? void 0 : p.bg) || "bg-white dark:bg-gray-800", u = ((f = t.config) == null ? void 0 : f.textColor) || ((m = (b = r.colors) == null ? void 0 : b[t.type]) == null ? void 0 : m.text) || "text-gray-700 dark:text-gray-300", a = ((v = t.config) == null ? void 0 : v.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
647
+ const r = Ce();
648
+ return /* @__PURE__ */ u("div", { className: "fixed top-5 right-5 z-[9999] flex flex-col gap-2", children: e.map((t) => {
649
+ var a, i, d, o, c, p, b, y, v, C, S, L, j;
650
+ const s = ((a = t.config) == null ? void 0 : a.icon) || ((i = r.icons) == null ? void 0 : i[t.type]) || Oe(t.type), g = ((d = t.config) == null ? void 0 : d.bgColor) || ((c = (o = r.colors) == null ? void 0 : o[t.type]) == null ? void 0 : c.bg) || "bg-white dark:bg-gray-800", f = ((p = t.config) == null ? void 0 : p.textColor) || ((y = (b = r.colors) == null ? void 0 : b[t.type]) == null ? void 0 : y.text) || "text-gray-700 dark:text-gray-300", l = ((v = t.config) == null ? void 0 : v.iconContainerClass) || "w-8 h-8 mr-3 text-xl flex items-center justify-center";
586
651
  return /* @__PURE__ */ x(
587
652
  "div",
588
653
  {
589
- className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${d} ${u}`,
654
+ className: `flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${g} ${f}`,
590
655
  children: [
591
- /* @__PURE__ */ g("div", { className: a, children: o }),
656
+ /* @__PURE__ */ u("div", { className: l, children: s }),
592
657
  /* @__PURE__ */ x("div", { className: "flex-1 me-3", children: [
593
- ((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */ g("div", { className: "font-semibold text-black", children: t.config.title }),
594
- ((k = t.config) == null ? void 0 : k.description) && /* @__PURE__ */ g("div", { className: "text-sm text-gray-500", children: t.config.description }),
595
- !((j = t.config) != null && j.title) && !((L = t.config) != null && L.description) && /* @__PURE__ */ g("div", { className: "text-sm", children: t.message })
658
+ ((C = t.config) == null ? void 0 : C.title) && /* @__PURE__ */ u("div", { className: "font-semibold text-black", children: t.config.title }),
659
+ ((S = t.config) == null ? void 0 : S.description) && /* @__PURE__ */ u("div", { className: "text-sm text-gray-500", children: t.config.description }),
660
+ !((L = t.config) != null && L.title) && !((j = t.config) != null && j.description) && /* @__PURE__ */ u("div", { className: "text-sm", children: t.message })
596
661
  ] }),
597
- /* @__PURE__ */ g(
662
+ /* @__PURE__ */ u(
598
663
  "button",
599
664
  {
600
665
  onClick: () => n((P) => P.filter((E) => E.id !== t.id)),
601
666
  className: "ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white",
602
667
  "aria-label": "Close",
603
- children: /* @__PURE__ */ g(Ce, { size: 18 })
668
+ children: /* @__PURE__ */ u(Ne, { size: 18 })
604
669
  }
605
670
  )
606
671
  ]
@@ -622,17 +687,18 @@ function Oe(e) {
622
687
  }
623
688
  }
624
689
  export {
625
- Ee as Badge,
690
+ Me as Accordion,
691
+ $e as Badge,
626
692
  je as Button,
627
- Le as Dropdown,
628
- se as Input,
629
- $e as Modal,
630
- Me as ModalProvider,
693
+ Pe as Dropdown,
694
+ ae as Input,
695
+ ze as Modal,
696
+ Ie as ModalProvider,
631
697
  Te as Toast,
632
- Pe as Tooltip,
633
- De as setToastDefaults,
634
- Re as showToast,
635
- H as useModalActions,
636
- ze as useModalInstance,
637
- Y as useModalState
698
+ Ee as Tooltip,
699
+ Re as setToastDefaults,
700
+ Ae as showToast,
701
+ Y as useModalActions,
702
+ De as useModalInstance,
703
+ q as useModalState
638
704
  };
@@ -1,5 +1,5 @@
1
- (function(x,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],o):(x=typeof globalThis<"u"?globalThis:x||self,o(x.TailwindUiKit={},x.jsxRuntime,x.React))})(this,function(x,o,s){"use strict";"use client";const A=s.forwardRef((e,n)=>{const{label:r,id:t,inputSize:l="md",shape:f="rounded",validate:g,onValidatedChange:i,className:a="",icon:d,iconPosition:c="left",floatingLabelStyle:u,onChange:b,isValid:p,isInvalid:h,feedback:m,feedbackType:y="invalid",...w}=e,[O,k]=s.useState("default"),j=C=>{const I=C.target.value,P=(g==null?void 0:g(I))??"default";k(P),i==null||i(C,P),b==null||b(C)},E={xs:"text-xs px-2 py-1",sm:"text-sm px-3 py-1.5",md:"text-sm px-3 py-3",lg:"text-lg px-5 py-3"},M={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},ye={filled:"rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",outlined:"rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",standard:"px-0 py-2.5 bg-transparent border-0 border-b-2"},we={filled:"absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",outlined:"absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",standard:"absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"},ve=(C,I,P)=>{if(P)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(I)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(C){case"error":return"border-red-500 bg-red-50 focus:ring-red-500";case"warning":return"border-yellow-500 bg-yellow-50 focus:ring-yellow-500";case"success":return"border-green-500 bg-green-50 focus:ring-green-500";default:return"border-gray-300 focus:ring-blue-500"}},Ce=E[l]||E.md,Se=M[f]||M.flat,Ne=ve(O,p,h),Oe=c==="start"||c==="left"?"left-0 ps-3.5":"right-0 pe-3.5",ke=d&&(c==="start"||c==="left")?"ps-10":d?"pe-10":"",D=t??`input-${(r==null?void 0:r.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,v=!!u;return o.jsxs("div",{className:`w-full relative ${v?"z-0":""}`,children:[!v&&r&&o.jsx("label",{htmlFor:D,className:`block mb-1 font-light text-sm ${p?"text-green-700 dark:text-green-500":h?"text-red-700 dark:text-red-500":"text-gray-700"}`,children:r}),o.jsxs("div",{className:"relative w-full",children:[d&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${Oe}`,children:o.jsx("span",{className:"text-gray-500",children:d})}),o.jsx("input",{...w,id:D,ref:n,placeholder:v?" ":w.placeholder,onChange:j,className:`border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
2
- ${v&&u?ye[u]:Ce}
3
- ${ke} ${Se} ${Ne} ${a}`}),v&&r&&u&&o.jsx("label",{htmlFor:D,className:`ms-1 ${we[u]} ${a}`,children:r})]}),m&&o.jsx("p",{className:`mt-1 text-xs ${y==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:m})]})});A.displayName="Input";const H={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",success:"bg-green-600 text-white hover:bg-green-700",danger:"bg-red-600 text-white hover:bg-red-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-cyan-600 text-white hover:bg-cyan-700",dark:"bg-gray-900 text-white hover:bg-black",light:"bg-gray-100 text-black hover:bg-gray-200",link:"bg-transparent text-blue-600 hover:underline [&&]:p-0 [&&]:shadow-none","outline-primary":"border border-blue-600 text-blue-600 hover:bg-blue-50","outline-secondary":"border border-gray-600 text-gray-600 hover:bg-gray-50","outline-success":"border border-green-600 text-green-600 hover:bg-green-50","outline-danger":"border border-red-600 text-red-600 hover:bg-red-50","outline-warning":"border border-yellow-500 text-yellow-600 hover:bg-yellow-50","outline-info":"border border-cyan-600 text-cyan-600 hover:bg-cyan-50","outline-dark":"border border-gray-900 text-gray-900 hover:bg-gray-100","outline-light":"border border-gray-100 text-gray-500 hover:bg-gray-200"},q={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},K={flat:"shadow-none",rounded:"rounded-md",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},U=({children:e,variant:n="primary",size:r="md",type:t="button",shape:l="rounded",className:f="",isLoading:g=!1,disabled:i=!1,...a})=>{const d=i||g,c=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",H[n],q[r],K[l],l==="flat"?"shadow-none":"shadow-sm",d?"opacity-50 cursor-not-allowed pointer-events-none":"",f].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:c,disabled:d,...a,children:[g&&o.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),e]})},X=({label:e,children:n,position:r="right"})=>{const[t,l]=s.useState(!1),[f,g]=s.useState(!1),i=s.useRef(null),a=s.useRef(null),d=s.useMemo(()=>{switch(r){case"left":return"left-0";case"center":return"left-1/2 transform -translate-x-1/2";case"right":default:return"right-0"}},[r]),c=s.useCallback(p=>{const h=p.target;i.current&&!i.current.contains(h)&&a.current&&!a.current.contains(h)&&l(!1)},[]),u=s.useCallback(()=>{if(!a.current||!i.current)return;const p=a.current.getBoundingClientRect(),h=i.current.getBoundingClientRect(),m=window.innerHeight-p.bottom,y=p.top;g(m<h.height&&y>h.height)},[]);s.useEffect(()=>{if(t)return u(),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[t,u]),s.useEffect(()=>(document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[c]);const b=s.useCallback(()=>l(p=>!p),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:a,onClick:b,children:e}),t&&o.jsx("div",{ref:i,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
1
+ (function(x,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],o):(x=typeof globalThis<"u"?globalThis:x||self,o(x.TailwindUiKit={},x.jsxRuntime,x.React))})(this,function(x,o,a){"use strict";"use client";const A=a.forwardRef((e,n)=>{const{label:r,id:t,inputSize:l="md",shape:f="rounded",validate:b,onValidatedChange:c,className:i="",icon:d,iconPosition:g="left",floatingLabelStyle:s,onChange:u,isValid:p,isInvalid:h,feedback:y,feedbackType:m="invalid",...w}=e,[k,O]=a.useState("default"),j=C=>{const D=C.target.value,M=(b==null?void 0:b(D))??"default";O(M),c==null||c(C,M),u==null||u(C)},L={xs:"text-xs px-2 py-1",sm:"text-sm px-3 py-1.5",md:"text-sm px-3 py-3",lg:"text-lg px-5 py-3"},E={flat:"rounded-none",rounded:"rounded-md",pill:"rounded-full"},ve={filled:"rounded-t-lg px-2.5 pb-2.5 pt-5 bg-gray-50 border-b-2",outlined:"rounded-lg px-2.5 pb-2.5 pt-4 bg-transparent border",standard:"px-0 py-2.5 bg-transparent border-0 border-b-2"},Ce={filled:"absolute duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",outlined:"absolute duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-placeholder-shown:scale-100 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 peer-focus:text-blue-600",standard:"absolute duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 peer-focus:text-blue-600"},Se=(C,D,M)=>{if(M)return"border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";if(D)return"border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";switch(C){case"error":return"border-red-500 bg-red-50 focus:ring-red-500";case"warning":return"border-yellow-500 bg-yellow-50 focus:ring-yellow-500";case"success":return"border-green-500 bg-green-50 focus:ring-green-500";default:return"border-gray-300 focus:ring-blue-500"}},Ne=L[l]||L.md,ke=E[f]||E.flat,Oe=Se(k,p,h),je=g==="start"||g==="left"?"left-0 ps-3.5":"right-0 pe-3.5",Le=d&&(g==="start"||g==="left")?"ps-10":d?"pe-10":"",z=t??`input-${(r==null?void 0:r.toLowerCase().replace(/\s+/g,"-"))||Math.random().toString(36).slice(2)}`,v=!!s;return o.jsxs("div",{className:`w-full relative ${v?"z-0":""}`,children:[!v&&r&&o.jsx("label",{htmlFor:z,className:`block mb-1 font-light text-sm ${p?"text-green-700 dark:text-green-500":h?"text-red-700 dark:text-red-500":"text-gray-700"}`,children:r}),o.jsxs("div",{className:"relative w-full",children:[d&&o.jsx("div",{className:`absolute inset-y-0 flex items-center ${je}`,children:o.jsx("span",{className:"text-gray-500",children:d})}),o.jsx("input",{...w,id:z,ref:n,placeholder:v?" ":w.placeholder,onChange:j,className:`border peer w-full block font-light appearance-none focus:outline-none focus:ring-0 transition
2
+ ${v&&s?ve[s]:Ne}
3
+ ${Le} ${ke} ${Oe} ${i}`}),v&&r&&s&&o.jsx("label",{htmlFor:z,className:`ms-1 ${Ce[s]} ${i}`,children:r})]}),y&&o.jsx("p",{className:`mt-1 text-xs ${m==="invalid"?"text-red-600 dark:text-red-500":"text-green-600 dark:text-green-500"}`,children:y})]})});A.displayName="Input";const U={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",success:"bg-green-600 text-white hover:bg-green-700",danger:"bg-red-600 text-white hover:bg-red-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-cyan-600 text-white hover:bg-cyan-700",dark:"bg-gray-900 text-white hover:bg-black",light:"bg-gray-100 text-black hover:bg-gray-200",link:"bg-transparent text-blue-600 hover:underline [&&]:p-0 [&&]:shadow-none","outline-primary":"border border-blue-600 text-blue-600 hover:bg-blue-50","outline-secondary":"border border-gray-600 text-gray-600 hover:bg-gray-50","outline-success":"border border-green-600 text-green-600 hover:bg-green-50","outline-danger":"border border-red-600 text-red-600 hover:bg-red-50","outline-warning":"border border-yellow-500 text-yellow-600 hover:bg-yellow-50","outline-info":"border border-cyan-600 text-cyan-600 hover:bg-cyan-50","outline-dark":"border border-gray-900 text-gray-900 hover:bg-gray-100","outline-light":"border border-gray-100 text-gray-500 hover:bg-gray-200"},q={xs:"px-3 py-2 text-xs",sm:"px-3 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},K={flat:"shadow-none",rounded:"rounded-md",pill:"rounded-full",circle:"rounded-full w-10 h-10 p-0 flex items-center justify-center"},X=({children:e,variant:n="primary",size:r="md",type:t="button",shape:l="rounded",className:f="",isLoading:b=!1,disabled:c=!1,...i})=>{const d=c||b,g=["inline-flex items-center justify-center font-normal transition duration-150 cursor-pointer",U[n],q[r],K[l],l==="flat"?"shadow-none":"shadow-sm",d?"opacity-50 cursor-not-allowed pointer-events-none":"",f].filter(Boolean).join(" ");return o.jsxs("button",{type:t,className:g,disabled:d,...i,children:[b&&o.jsxs("svg",{"aria-hidden":"true",role:"status",className:"inline w-4 h-4 me-3 text-gray-200 animate-spin dark:text-gray-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"#1C64F2"})]}),e]})},Y=({label:e,children:n,position:r="right"})=>{const[t,l]=a.useState(!1),[f,b]=a.useState(!1),c=a.useRef(null),i=a.useRef(null),d=a.useMemo(()=>{switch(r){case"left":return"left-0";case"center":return"left-1/2 transform -translate-x-1/2";case"right":default:return"right-0"}},[r]),g=a.useCallback(p=>{const h=p.target;c.current&&!c.current.contains(h)&&i.current&&!i.current.contains(h)&&l(!1)},[]),s=a.useCallback(()=>{if(!i.current||!c.current)return;const p=i.current.getBoundingClientRect(),h=c.current.getBoundingClientRect(),y=window.innerHeight-p.bottom,m=p.top;b(y<h.height&&m>h.height)},[]);a.useEffect(()=>{if(t)return s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[t,s]),a.useEffect(()=>(document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)),[g]);const u=a.useCallback(()=>l(p=>!p),[]);return o.jsxs("div",{className:"relative flex items-center",children:[o.jsx("button",{ref:i,onClick:u,children:e}),t&&o.jsx("div",{ref:c,className:`absolute z-10 bg-white rounded-sm shadow-md overflow-hidden
4
4
  ${f?"bottom-full mb-2":"top-full mt-2"}
5
- ${d}`,children:n})]})},Y=({children:e,content:n,position:r="top",className:t="",tooltipClass:l="",tooltipStyle:f={}})=>{const g=s.useRef(null),i=s.useRef(null);s.useEffect(()=>{const d=g.current,c=i.current;if(!d||!c)return;const u=()=>{c.style.opacity="1",c.style.visibility="visible"},b=()=>{c.style.opacity="0",c.style.visibility="hidden"};return d.addEventListener("mouseenter",u),d.addEventListener("mouseleave",b),()=>{d.removeEventListener("mouseenter",u),d.removeEventListener("mouseleave",b)}},[]);const a=d=>{const c={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(d){case"top":return{...c,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...c,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...c,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...c,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return c}};return o.jsxs("div",{ref:g,className:`relative inline-block ${t}`,children:[e,o.jsx("div",{ref:i,role:"tooltip",className:l,style:{...a(r),...f},children:n})]})},J={primary:"bg-blue-500 text-white",secondary:"bg-gray-500 text-white",success:"bg-green-500 text-white",danger:"bg-red-500 text-white",warning:"bg-yellow-400 text-black",info:"bg-cyan-500 text-white",dark:"bg-black text-white",light:"bg-gray-100 text-gray-800",link:"bg-transparent text-blue-500 underline","outline-primary":"border border-blue-500 text-blue-500 bg-transparent","outline-secondary":"border border-gray-500 text-gray-500 bg-transparent","outline-success":"border border-green-500 text-green-500 bg-transparent","outline-danger":"border border-red-500 text-red-500 bg-transparent","outline-warning":"border border-yellow-400 text-yellow-500 bg-transparent","outline-info":"border border-cyan-500 text-cyan-500 bg-transparent","outline-dark":"border border-black text-black bg-transparent","outline-light":"border border-gray-100 text-gray-800 bg-transparent"},Q={xs:"text-xs px-2 py-0.5",sm:"text-sm px-2.5 py-0.5",md:"text-base px-3 py-1",lg:"text-lg px-3.5 py-1.5",xl:"text-xl px-4 py-2"},V={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},R=({label:e,variant:n="primary",size:r="sm",shape:t="rounded",icon:l,dismissible:f,onDismiss:g,className:i="",...a})=>{const d=!e&&!!l,c=`inline-flex items-center font-medium ${J[n]||""} ${Q[r]||""} ${V[t]||""} ${d?"justify-center p-2 w-8 h-8":""} `+i;return o.jsxs("span",{className:c.trim(),...a,children:[l&&o.jsx("span",{className:e?"mr-1":"",children:l}),e,f&&o.jsx("button",{type:"button",onClick:g,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})},B=s.createContext(null),L=()=>s.useContext(B),_=s.createContext(null),T=()=>s.useContext(_);function ee({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:l=!1,containerClasses:f="",onClose:g}){const i=T(),a=L(),d=!t&&!!i&&!!a,[c,u]=s.useState(!1),b=d?i.isOpen(e):c,p=d?i.getModalData(e):null,h=()=>{d?a.closeModal(e):u(!1),g==null||g()};return s.useEffect(()=>(b?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[b]),b?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${f}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),l&&o.jsx("button",{onClick:h,className:"text-gray-500 hover:text-gray-700 absolute top-2 right-3","aria-label":"Close modal",children:"✕"})]}),o.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof r=="function"?r({modalData:p}):r})]})}):null}function te({children:e}){const[n,r]=s.useState({}),[t,l]=s.useState({}),f=s.useCallback((u,b)=>{r(p=>({...p,[u]:!0})),b&&l(p=>({...p,[u]:b}))},[]),g=s.useCallback(u=>{r(b=>({...b,[u]:!1})),l(b=>{const p={...b};return delete p[u],p})},[]),i=s.useCallback(u=>!!n[u],[n]),a=s.useCallback(u=>t[u],[t]),d=s.useMemo(()=>({openModal:f,closeModal:g}),[f,g]),c=s.useMemo(()=>({isOpen:i,getModalData:a}),[i,a]);return o.jsx(B.Provider,{value:d,children:o.jsx(_.Provider,{value:c,children:e})})}function re(e){const{openModal:n,closeModal:r}=L(),{isOpen:t,getModalData:l}=T();return{open:f=>n(e,f),close:()=>r(e),isOpen:t(e),data:l(e)}}let $=null,z={};function ne(e){$=e}function oe(e){z={...z,...e}}function se(){return z}function le(e,n,r=3e3,t){$?$(e,n,r,t):console.warn("Toast system is not mounted")}var F={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Z=s.createContext&&s.createContext(F),ae=["attr","size","title"];function ie(e,n){if(e==null)return{};var r=ce(e,n),t,l;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(l=0;l<f.length;l++)t=f[l],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function ce(e,n){if(e==null)return{};var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;r[t]=e[t]}return r}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},S.apply(this,arguments)}function W(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,t)}return r}function N(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?W(Object(r),!0).forEach(function(t){de(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function de(e,n,r){return n=ue(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ue(e){var n=fe(e,"string");return typeof n=="symbol"?n:n+""}function fe(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var t=r.call(e,n);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function G(e){return e&&e.map((n,r)=>s.createElement(n.tag,N({key:r},n.attr),G(n.child)))}function ge(e){return n=>s.createElement(be,S({attr:N({},e.attr)},n),G(e.child))}function be(e){var n=r=>{var{attr:t,size:l,title:f}=e,g=ie(e,ae),i=l||r.size||"1em",a;return r.className&&(a=r.className),e.className&&(a=(a?a+" ":"")+e.className),s.createElement("svg",S({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,g,{className:a,style:N(N({color:e.color||r.color},r.style),e.style),height:i,width:i,xmlns:"http://www.w3.org/2000/svg"}),f&&s.createElement("title",null,f),e.children)};return Z!==void 0?s.createElement(Z.Consumer,null,r=>n(r)):n(F)}function pe(e){return ge({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const xe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),he=()=>{const[e,n]=s.useState([]);s.useEffect(()=>{ne((t,l,f,g)=>{const i=xe();n(a=>[...a,{id:i,type:t,message:l,config:g}]),setTimeout(()=>{n(a=>a.filter(d=>d.id!==i))},f)})},[]);const r=se();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var a,d,c,u,b,p,h,m,y,w,O,k,j;const l=((a=t.config)==null?void 0:a.icon)||((d=r.icons)==null?void 0:d[t.type])||me(t.type),f=((c=t.config)==null?void 0:c.bgColor)||((b=(u=r.colors)==null?void 0:u[t.type])==null?void 0:b.bg)||"bg-white dark:bg-gray-800",g=((p=t.config)==null?void 0:p.textColor)||((m=(h=r.colors)==null?void 0:h[t.type])==null?void 0:m.text)||"text-gray-700 dark:text-gray-300",i=((y=t.config)==null?void 0:y.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return o.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${f} ${g}`,children:[o.jsx("div",{className:i,children:l}),o.jsxs("div",{className:"flex-1 me-3",children:[((w=t.config)==null?void 0:w.title)&&o.jsx("div",{className:"font-semibold text-black",children:t.config.title}),((O=t.config)==null?void 0:O.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:t.config.description}),!((k=t.config)!=null&&k.title)&&!((j=t.config)!=null&&j.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(E=>E.filter(M=>M.id!==t.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:o.jsx(pe,{size:18})})]},t.id)})})};function me(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}x.Badge=R,x.Button=U,x.Dropdown=X,x.Input=A,x.Modal=ee,x.ModalProvider=te,x.Toast=he,x.Tooltip=Y,x.setToastDefaults=oe,x.showToast=le,x.useModalActions=L,x.useModalInstance=re,x.useModalState=T,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
5
+ ${d}`,children:n})]})},J=({children:e,content:n,position:r="top",className:t="",tooltipClass:l="",tooltipStyle:f={}})=>{const b=a.useRef(null),c=a.useRef(null);a.useEffect(()=>{const d=b.current,g=c.current;if(!d||!g)return;const s=()=>{g.style.opacity="1",g.style.visibility="visible"},u=()=>{g.style.opacity="0",g.style.visibility="hidden"};return d.addEventListener("mouseenter",s),d.addEventListener("mouseleave",u),()=>{d.removeEventListener("mouseenter",s),d.removeEventListener("mouseleave",u)}},[]);const i=d=>{const g={position:"absolute",opacity:0,visibility:"hidden",transition:"opacity 0.2s ease",maxWidth:"240px",whiteSpace:"normal",wordBreak:"break-word",padding:"8px 12px",fontSize:"0.875rem",backgroundColor:"black",color:"white",borderRadius:"4px",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.15)",zIndex:9999,width:"max-content"};switch(d){case"top":return{...g,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};case"bottom":return{...g,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"left":return{...g,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"right":return{...g,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};default:return g}};return o.jsxs("div",{ref:b,className:`relative inline-block ${t}`,children:[e,o.jsx("div",{ref:c,role:"tooltip",className:l,style:{...i(r),...f},children:n})]})},Q={primary:"bg-blue-500 text-white",secondary:"bg-gray-500 text-white",success:"bg-green-500 text-white",danger:"bg-red-500 text-white",warning:"bg-yellow-400 text-black",info:"bg-cyan-500 text-white",dark:"bg-black text-white",light:"bg-gray-100 text-gray-800",link:"bg-transparent text-blue-500 underline","outline-primary":"border border-blue-500 text-blue-500 bg-transparent","outline-secondary":"border border-gray-500 text-gray-500 bg-transparent","outline-success":"border border-green-500 text-green-500 bg-transparent","outline-danger":"border border-red-500 text-red-500 bg-transparent","outline-warning":"border border-yellow-400 text-yellow-500 bg-transparent","outline-info":"border border-cyan-500 text-cyan-500 bg-transparent","outline-dark":"border border-black text-black bg-transparent","outline-light":"border border-gray-100 text-gray-800 bg-transparent"},V={xs:"text-xs px-2 py-0.5",sm:"text-sm px-2.5 py-0.5",md:"text-base px-3 py-1",lg:"text-lg px-3.5 py-1.5",xl:"text-xl px-4 py-2"},R={flat:"rounded-none",rounded:"rounded-sm",pill:"rounded-full",circle:"rounded-full p-2 w-8 h-8 justify-center"},ee=({label:e,variant:n="primary",size:r="sm",shape:t="rounded",icon:l,dismissible:f,onDismiss:b,className:c="",...i})=>{const d=!e&&!!l,g=`inline-flex items-center font-medium ${Q[n]||""} ${V[r]||""} ${R[t]||""} ${d?"justify-center p-2 w-8 h-8":""} `+c;return o.jsxs("span",{className:g.trim(),...i,children:[l&&o.jsx("span",{className:e?"mr-1":"",children:l}),e,f&&o.jsx("button",{type:"button",onClick:b,className:"ml-2 text-xs font-bold leading-none focus:outline-none",children:"×"})]})};var B={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_=a.createContext&&a.createContext(B),te=["attr","size","title"];function re(e,n){if(e==null)return{};var r=ne(e,n),t,l;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(l=0;l<f.length;l++)t=f[l],!(n.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function ne(e,n){if(e==null)return{};var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;r[t]=e[t]}return r}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},S.apply(this,arguments)}function F(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,t)}return r}function N(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?F(Object(r),!0).forEach(function(t){oe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function oe(e,n,r){return n=se(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function se(e){var n=ae(e,"string");return typeof n=="symbol"?n:n+""}function ae(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var t=r.call(e,n);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Z(e){return e&&e.map((n,r)=>a.createElement(n.tag,N({key:r},n.attr),Z(n.child)))}function W(e){return n=>a.createElement(le,S({attr:N({},e.attr)},n),Z(e.child))}function le(e){var n=r=>{var{attr:t,size:l,title:f}=e,b=re(e,te),c=l||r.size||"1em",i;return r.className&&(i=r.className),e.className&&(i=(i?i+" ":"")+e.className),a.createElement("svg",S({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,t,b,{className:i,style:N(N({color:e.color||r.color},r.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),f&&a.createElement("title",null,f),e.children)};return _!==void 0?a.createElement(_.Consumer,null,r=>n(r)):n(B)}function ie(e){return W({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(e)}const ce=({items:e,allowMultipleOpen:n=!1,className:r="",open:t,onChange:l,renderTitle:f,renderContent:b})=>{const[c,i]=a.useState(new Set),d=a.useMemo(()=>t?new Set(t):c,[t,c]),g=a.useCallback(s=>{const u=new Set(d);u.has(s)?u.delete(s):(n||u.clear(),u.add(s)),t&&l?l(Array.from(u)):i(u)},[d,t,l,n]);return o.jsx("div",{className:"accordion",role:"region","aria-multiselectable":n,children:e.map(s=>{const u=d.has(s.id),p=`accordion-heading-${s.id}`,h=`accordion-panel-${s.id}`;return o.jsxs("div",{className:`accordion-item mb-2 border rounded border-gray-300 dark:border-gray-700 ${r}`,children:[o.jsx("h3",{id:p,children:o.jsxs("button",{type:"button","aria-expanded":u,"aria-controls":h,onClick:()=>g(s.id),className:"flex justify-between items-center w-full p-4 font-medium text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-500 gap-3",children:[f?f(s,u):s.title,o.jsx(ie,{})]})}),o.jsx("div",{id:h,role:"region","aria-labelledby":p,hidden:!u,className:"p-4 border-t border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400",children:b?b(s,u):s.content})]},s.id)})})},G=a.createContext(null),P=()=>a.useContext(G),H=a.createContext(null),$=()=>a.useContext(H);function de({id:e,title:n,children:r,standalone:t=!1,showFloatingClose:l=!1,containerClasses:f="",onClose:b}){const c=$(),i=P(),d=!t&&!!c&&!!i,[g,s]=a.useState(!1),u=d?c.isOpen(e):g,p=d?c.getModalData(e):null,h=()=>{d?i.closeModal(e):s(!1),b==null||b()};return a.useEffect(()=>(u?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[u]),u?o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]",children:o.jsxs("div",{className:`bg-white rounded-lg shadow-lg w-full max-w-md p-4 transform transition-all duration-300 scale-100 ${f}`,children:[o.jsxs("div",{className:"flex justify-between items-center relative",children:[n&&o.jsx("h2",{className:"text-lg font-semibold",children:n}),l&&o.jsx("button",{onClick:h,className:"text-gray-500 hover:text-gray-700 absolute top-2 right-3","aria-label":"Close modal",children:"✕"})]}),o.jsx("div",{className:"mt-3 text-sm text-gray-700",children:typeof r=="function"?r({modalData:p}):r})]})}):null}function ue({children:e}){const[n,r]=a.useState({}),[t,l]=a.useState({}),f=a.useCallback((s,u)=>{r(p=>({...p,[s]:!0})),u&&l(p=>({...p,[s]:u}))},[]),b=a.useCallback(s=>{r(u=>({...u,[s]:!1})),l(u=>{const p={...u};return delete p[s],p})},[]),c=a.useCallback(s=>!!n[s],[n]),i=a.useCallback(s=>t[s],[t]),d=a.useMemo(()=>({openModal:f,closeModal:b}),[f,b]),g=a.useMemo(()=>({isOpen:c,getModalData:i}),[c,i]);return o.jsx(G.Provider,{value:d,children:o.jsx(H.Provider,{value:g,children:e})})}function ge(e){const{openModal:n,closeModal:r}=P(),{isOpen:t,getModalData:l}=$();return{open:f=>n(e,f),close:()=>r(e),isOpen:t(e),data:l(e)}}let I=null,T={};function fe(e){I=e}function be(e){T={...T,...e}}function pe(){return T}function xe(e,n,r=3e3,t){I?I(e,n,r,t):console.warn("Toast system is not mounted")}function he(e){return W({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const ye=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),me=()=>{const[e,n]=a.useState([]);a.useEffect(()=>{fe((t,l,f,b)=>{const c=ye();n(i=>[...i,{id:c,type:t,message:l,config:b}]),setTimeout(()=>{n(i=>i.filter(d=>d.id!==c))},f)})},[]);const r=pe();return o.jsx("div",{className:"fixed top-5 right-5 z-[9999] flex flex-col gap-2",children:e.map(t=>{var i,d,g,s,u,p,h,y,m,w,k,O,j;const l=((i=t.config)==null?void 0:i.icon)||((d=r.icons)==null?void 0:d[t.type])||we(t.type),f=((g=t.config)==null?void 0:g.bgColor)||((u=(s=r.colors)==null?void 0:s[t.type])==null?void 0:u.bg)||"bg-white dark:bg-gray-800",b=((p=t.config)==null?void 0:p.textColor)||((y=(h=r.colors)==null?void 0:h[t.type])==null?void 0:y.text)||"text-gray-700 dark:text-gray-300",c=((m=t.config)==null?void 0:m.iconContainerClass)||"w-8 h-8 mr-3 text-xl flex items-center justify-center";return o.jsxs("div",{className:`flex items-center w-full max-w-xs p-4 text-sm rounded-lg shadow ${f} ${b}`,children:[o.jsx("div",{className:c,children:l}),o.jsxs("div",{className:"flex-1 me-3",children:[((w=t.config)==null?void 0:w.title)&&o.jsx("div",{className:"font-semibold text-black",children:t.config.title}),((k=t.config)==null?void 0:k.description)&&o.jsx("div",{className:"text-sm text-gray-500",children:t.config.description}),!((O=t.config)!=null&&O.title)&&!((j=t.config)!=null&&j.description)&&o.jsx("div",{className:"text-sm",children:t.message})]}),o.jsx("button",{onClick:()=>n(L=>L.filter(E=>E.id!==t.id)),className:"ml-auto text-gray-400 hover:text-gray-700 dark:text-gray-500 dark:hover:text-white","aria-label":"Close",children:o.jsx(he,{size:18})})]},t.id)})})};function we(e){switch(e){case"success":return"✅";case"error":return"❌";case"warning":return"⚠️";case"info":return"ℹ️"}}x.Accordion=ce,x.Badge=ee,x.Button=X,x.Dropdown=Y,x.Input=A,x.Modal=de,x.ModalProvider=ue,x.Toast=me,x.Tooltip=J,x.setToastDefaults=be,x.showToast=xe,x.useModalActions=P,x.useModalInstance=ge,x.useModalState=$,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-ux-kit",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "main": "lib/tailwind-ux-kit.es.js",
5
5
  "module": "lib/tailwind-ux-kit.umd.js",
6
6
  "types": "lib/tailwind-ux-kit.es.d.ts",