@axtec/components 0.1.7 → 0.1.10
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 +1 -0
- package/dist/components/AgentChat/AgentChat.d.ts +32 -0
- package/dist/components/AgentChat/index.d.ts +1 -0
- package/dist/components/AgentPanel/AgentPanel.d.ts +44 -0
- package/dist/components/AgentPanel/index.d.ts +1 -0
- package/dist/components/OptionDivider/OptionDivider.d.ts +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.css +1 -1
- package/dist/index.js +161 -157
- package/dist/index.js.map +1 -1
- package/dist/index10.js +77 -99
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +91 -36
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +97 -75
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +38 -24
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +76 -16
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +24 -38
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +18 -72
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +36 -47
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +73 -13
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +47 -151
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +12 -17
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +148 -40
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +18 -50
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +41 -74
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +46 -216
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +73 -46
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +212 -70
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +51 -23
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +74 -74
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +19 -28
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +62 -76
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +28 -55
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +87 -40
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +57 -45
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +40 -47
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +47 -27
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +52 -54
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +28 -49
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +54 -13
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +46 -79
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +13 -49
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +80 -17
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +48 -33
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +17 -11
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +34 -15
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +16 -89
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +15 -69
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +85 -116
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +69 -40
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +120 -42
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/index50.js +39 -55
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +39 -11
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +53 -62
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +16 -54
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +64 -36
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +54 -66
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +37 -22
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +63 -101
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +16 -67
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +99 -213
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +1 -1
- package/dist/index60.js +67 -62
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +206 -224
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +62 -96
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +233 -33
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +98 -14
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +35 -59
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +16 -59
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +57 -72
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +58 -106
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +70 -43
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +157 -69
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +101 -40
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +44 -72
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +47 -53
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +70 -62
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +46 -28
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +67 -13
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +35 -2263
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +17 -0
- package/dist/index77.js.map +1 -0
- package/dist/index78.js +2267 -0
- package/dist/index78.js.map +1 -0
- package/dist/index8.js +377 -70
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +60 -77
- package/dist/index9.js.map +1 -1
- package/package.json +1 -1
package/dist/index25.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index25.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index25.js","sources":["../src/components/ConfirmModal/ConfirmModal.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\nimport {\n Dialog,\n DialogPanel,\n DialogTitle,\n Transition,\n TransitionChild,\n} from '@headlessui/react'\nimport { ExclamationTriangleIcon } from '@heroicons/react/24/outline'\nimport { cn } from '@/lib/utils'\nimport { Button } from '../Button/Button'\n\nexport interface ConfirmModalProps {\n open: boolean\n onClose: () => void\n onConfirm: () => void\n title: string\n message?: string | ReactNode\n confirmText?: string\n cancelText?: string\n /** Show warning icon */\n showIcon?: boolean\n /** Destructive action styling (red confirm button) */\n destructive?: boolean\n /** Loading state for confirm button */\n isLoading?: boolean\n className?: string\n}\n\nexport function ConfirmModal({\n open,\n onClose,\n onConfirm,\n title,\n message,\n confirmText = 'Confirm',\n cancelText = 'Cancel',\n showIcon = false,\n destructive = false,\n isLoading = false,\n className,\n}: ConfirmModalProps) {\n return (\n <Transition show={open} as={Fragment}>\n <Dialog onClose={onClose} className=\"relative z-50\">\n {/* Backdrop */}\n <TransitionChild\n as={Fragment}\n enter=\"ease-out duration-300\"\n enterFrom=\"opacity-0\"\n enterTo=\"opacity-100\"\n leave=\"ease-in duration-200\"\n leaveFrom=\"opacity-100\"\n leaveTo=\"opacity-0\"\n >\n <div className=\"fixed inset-0 bg-black/50\" aria-hidden=\"true\" />\n </TransitionChild>\n\n {/* Modal */}\n <div className=\"fixed inset-0 flex items-center justify-center p-4\">\n <TransitionChild\n as={Fragment}\n enter=\"ease-out duration-300\"\n enterFrom=\"opacity-0 scale-95\"\n enterTo=\"opacity-100 scale-100\"\n leave=\"ease-in duration-200\"\n leaveFrom=\"opacity-100 scale-100\"\n leaveTo=\"opacity-0 scale-95\"\n >\n <DialogPanel\n className={cn(\n 'w-full max-w-md bg-white rounded-2xl shadow-xl p-6',\n 'transform transition-all',\n className\n )}\n >\n <div className={cn(showIcon && 'flex gap-4')}>\n {/* Icon */}\n {showIcon && (\n <div className=\"flex-shrink-0\">\n <div className=\"rounded-full bg-amber-100 p-2\">\n <ExclamationTriangleIcon className=\"h-6 w-6 text-amber-600\" />\n </div>\n </div>\n )}\n\n <div className=\"flex-1\">\n {/* Title */}\n <DialogTitle className=\"text-lg font-semibold text-slate-900 mb-2\">\n {title}\n </DialogTitle>\n\n {/* Message */}\n {message && (\n <div className=\"text-sm text-slate-600 mb-6\">{message}</div>\n )}\n </div>\n </div>\n\n {/* Buttons */}\n <div className=\"flex justify-end gap-3 mt-6\">\n <Button variant=\"outline\" onClick={onClose} disabled={isLoading}>\n {cancelText}\n </Button>\n <Button\n variant={destructive ? 'danger' : 'primary'}\n onClick={onConfirm}\n isLoading={isLoading}\n >\n {confirmText}\n </Button>\n </div>\n </DialogPanel>\n </TransitionChild>\n </div>\n </Dialog>\n </Transition>\n )\n}\n"],"names":["ConfirmModal","open","onClose","onConfirm","title","message","confirmText","cancelText","showIcon","destructive","isLoading","className","jsx","Transition","Fragment","jsxs","Dialog","TransitionChild","DialogPanel","cn","ExclamationTriangleIcon","DialogTitle","Button"],"mappings":";;;;;;AA6BO,SAASA,EAAa;AAAA,EAC3B,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,WAAAC;AACF,GAAsB;AACpB,SACE,gBAAAC,EAACC,GAAA,EAAW,MAAMZ,GAAM,IAAIa,GAC1B,UAAA,gBAAAC,EAACC,GAAA,EAAO,SAAAd,GAAkB,WAAU,iBAElC,UAAA;AAAA,IAAA,gBAAAU;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,IAAIH;AAAA,QACJ,OAAM;AAAA,QACN,WAAU;AAAA,QACV,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,WAAU;AAAA,QACV,SAAQ;AAAA,QAER,UAAA,gBAAAF,EAAC,OAAA,EAAI,WAAU,6BAA4B,eAAY,OAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,IAIhE,gBAAAA,EAAC,OAAA,EAAI,WAAU,sDACb,UAAA,gBAAAA;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,IAAIH;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
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { jsxs as f, jsx as n, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useRef as B, useEffect as G } from "react";
|
|
3
|
+
import { cn as w } from "./index3.js";
|
|
4
|
+
import { CalendarIcon as Q, ChevronLeftIcon as U, ChevronRightIcon as V } from "@heroicons/react/24/outline";
|
|
5
|
+
const F = [
|
|
6
|
+
"January",
|
|
7
|
+
"February",
|
|
8
|
+
"March",
|
|
9
|
+
"April",
|
|
10
|
+
"May",
|
|
11
|
+
"June",
|
|
12
|
+
"July",
|
|
13
|
+
"August",
|
|
14
|
+
"September",
|
|
15
|
+
"October",
|
|
16
|
+
"November",
|
|
17
|
+
"December"
|
|
18
|
+
], X = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Z = (s, l) => new Date(s, l + 1, 0).getDate(), _ = (s, l) => new Date(s, l, 1).getDay(), ee = (s, l) => {
|
|
19
|
+
const i = String(s.getDate()).padStart(2, "0"), r = String(s.getMonth() + 1).padStart(2, "0"), g = s.getFullYear();
|
|
20
|
+
switch (l) {
|
|
21
|
+
case "MM/DD/YYYY":
|
|
22
|
+
return `${r}/${i}/${g}`;
|
|
23
|
+
case "YYYY-MM-DD":
|
|
24
|
+
return `${g}-${r}-${i}`;
|
|
25
|
+
default:
|
|
26
|
+
return `${i}/${r}/${g}`;
|
|
27
|
+
}
|
|
28
|
+
}, te = (s) => {
|
|
29
|
+
if (!s) return null;
|
|
30
|
+
const l = [
|
|
31
|
+
/^(\d{2})\/(\d{2})\/(\d{4})$/,
|
|
32
|
+
// DD/MM/YYYY
|
|
33
|
+
/^(\d{4})-(\d{2})-(\d{2})$/
|
|
34
|
+
// YYYY-MM-DD
|
|
35
|
+
];
|
|
36
|
+
for (const i of l) {
|
|
37
|
+
const r = s.match(i);
|
|
38
|
+
if (r)
|
|
39
|
+
return i.source.includes("^(\\d{4})") ? new Date(parseInt(r[1]), parseInt(r[2]) - 1, parseInt(r[3])) : new Date(parseInt(r[3]), parseInt(r[2]) - 1, parseInt(r[1]));
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}, ae = ({
|
|
43
|
+
value: s,
|
|
44
|
+
onChange: l,
|
|
45
|
+
label: i,
|
|
46
|
+
placeholder: r = "DD/MM/YYYY",
|
|
47
|
+
disabled: g = !1,
|
|
48
|
+
error: Y,
|
|
49
|
+
disableFutureDates: I = !1,
|
|
50
|
+
disablePastDates: $ = !1,
|
|
51
|
+
format: k = "DD/MM/YYYY",
|
|
52
|
+
className: j
|
|
53
|
+
}) => {
|
|
54
|
+
const u = /* @__PURE__ */ new Date(), h = s ? te(s) : null, [S, M] = D(!1), [m, p] = D("days"), [o, y] = D((h == null ? void 0 : h.getFullYear()) ?? u.getFullYear()), [a, b] = D((h == null ? void 0 : h.getMonth()) ?? u.getMonth()), [x, O] = D(h), v = B(null);
|
|
55
|
+
G(() => {
|
|
56
|
+
const t = (e) => {
|
|
57
|
+
v.current && !v.current.contains(e.target) && (M(!1), p("days"));
|
|
58
|
+
};
|
|
59
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
60
|
+
}, []);
|
|
61
|
+
const E = (t) => {
|
|
62
|
+
const e = new Date(o, a, t);
|
|
63
|
+
O(e), l(ee(e, k)), M(!1);
|
|
64
|
+
}, T = (t) => {
|
|
65
|
+
b(t), p("days");
|
|
66
|
+
}, A = (t) => {
|
|
67
|
+
y(t), p("months");
|
|
68
|
+
}, J = () => {
|
|
69
|
+
m === "days" ? a === 0 ? (b(11), y(o - 1)) : b(a - 1) : m === "years" && y(o - 12);
|
|
70
|
+
}, L = () => {
|
|
71
|
+
m === "days" ? a === 11 ? (b(0), y(o + 1)) : b(a + 1) : m === "years" && y(o + 12);
|
|
72
|
+
}, R = (t) => {
|
|
73
|
+
const e = new Date(u.getFullYear(), u.getMonth(), u.getDate());
|
|
74
|
+
return !!(I && t > e || $ && t < e);
|
|
75
|
+
}, P = Z(o, a), W = _(o, a), z = () => {
|
|
76
|
+
const t = [];
|
|
77
|
+
for (let e = 0; e < W; e++)
|
|
78
|
+
t.push(/* @__PURE__ */ n("div", { className: "w-8 h-8" }, `empty-${e}`));
|
|
79
|
+
for (let e = 1; e <= P; e++) {
|
|
80
|
+
const c = new Date(o, a, e), d = x && c.getDate() === x.getDate() && c.getMonth() === x.getMonth() && c.getFullYear() === x.getFullYear(), C = c.getDate() === u.getDate() && c.getMonth() === u.getMonth() && c.getFullYear() === u.getFullYear(), N = R(c);
|
|
81
|
+
t.push(
|
|
82
|
+
/* @__PURE__ */ n(
|
|
83
|
+
"button",
|
|
26
84
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
85
|
+
type: "button",
|
|
86
|
+
disabled: N,
|
|
87
|
+
onClick: () => E(e),
|
|
88
|
+
className: w(
|
|
89
|
+
"w-8 h-8 rounded-full text-sm flex items-center justify-center",
|
|
90
|
+
"transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
91
|
+
d && "bg-primary-500 text-white",
|
|
92
|
+
!d && C && "border border-primary-500 text-primary-500",
|
|
93
|
+
!d && !C && !N && "hover:bg-slate-100",
|
|
94
|
+
N && "text-slate-300 cursor-not-allowed"
|
|
32
95
|
),
|
|
33
|
-
children:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type: "button",
|
|
37
|
-
onClick: e.onClick,
|
|
38
|
-
disabled: s,
|
|
39
|
-
className: o(
|
|
40
|
-
"w-full flex items-center gap-2 px-4 py-2 text-sm text-left",
|
|
41
|
-
"transition-colors duration-150",
|
|
42
|
-
u && "bg-slate-50",
|
|
43
|
-
s && "opacity-50 cursor-not-allowed",
|
|
44
|
-
e.danger ? "text-red-600 hover:bg-red-50" : "text-slate-700"
|
|
45
|
-
),
|
|
46
|
-
children: [
|
|
47
|
-
e.icon && /* @__PURE__ */ t("span", { className: "flex-shrink-0 w-5 h-5", children: e.icon }),
|
|
48
|
-
e.label
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
) }, e.key))
|
|
52
|
-
}
|
|
96
|
+
children: e
|
|
97
|
+
},
|
|
98
|
+
e
|
|
53
99
|
)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function k({ children: r, className: n }) {
|
|
59
|
-
return /* @__PURE__ */ a(
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return t;
|
|
103
|
+
}, H = () => F.map((t, e) => /* @__PURE__ */ n(
|
|
60
104
|
"button",
|
|
61
105
|
{
|
|
62
106
|
type: "button",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
107
|
+
onClick: () => T(e),
|
|
108
|
+
className: w(
|
|
109
|
+
"px-3 py-2 rounded text-sm",
|
|
110
|
+
"transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
111
|
+
a === e && "bg-primary-500 text-white",
|
|
112
|
+
a !== e && "hover:bg-slate-100"
|
|
69
113
|
),
|
|
70
|
-
children:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
114
|
+
children: t.slice(0, 3)
|
|
115
|
+
},
|
|
116
|
+
t
|
|
117
|
+
)), K = () => {
|
|
118
|
+
const t = o - 6, e = [];
|
|
119
|
+
for (let c = 0; c < 12; c++) {
|
|
120
|
+
const d = t + c;
|
|
121
|
+
e.push(
|
|
122
|
+
/* @__PURE__ */ n(
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
type: "button",
|
|
126
|
+
onClick: () => A(d),
|
|
127
|
+
className: w(
|
|
128
|
+
"px-3 py-2 rounded text-sm",
|
|
129
|
+
"transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
130
|
+
o === d && "bg-primary-500 text-white",
|
|
131
|
+
o !== d && "hover:bg-slate-100"
|
|
132
|
+
),
|
|
133
|
+
children: d
|
|
134
|
+
},
|
|
135
|
+
d
|
|
136
|
+
)
|
|
137
|
+
);
|
|
74
138
|
}
|
|
75
|
-
|
|
76
|
-
}
|
|
139
|
+
return e;
|
|
140
|
+
};
|
|
141
|
+
return /* @__PURE__ */ f("div", { ref: v, className: w("relative", j), children: [
|
|
142
|
+
i && /* @__PURE__ */ n("label", { className: "block text-sm font-semibold text-slate-700 mb-1.5", children: i }),
|
|
143
|
+
/* @__PURE__ */ f(
|
|
144
|
+
"button",
|
|
145
|
+
{
|
|
146
|
+
type: "button",
|
|
147
|
+
disabled: g,
|
|
148
|
+
onClick: () => M(!S),
|
|
149
|
+
className: w(
|
|
150
|
+
"w-full flex items-center justify-between px-4 py-2.5",
|
|
151
|
+
"bg-white border rounded-lg text-left",
|
|
152
|
+
"transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
153
|
+
Y ? "border-red-500" : "border-slate-300",
|
|
154
|
+
g && "bg-slate-100 cursor-not-allowed opacity-60"
|
|
155
|
+
),
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ n("span", { className: s ? "text-slate-900" : "text-slate-400", children: s || r }),
|
|
158
|
+
/* @__PURE__ */ n(Q, { className: "w-5 h-5 text-slate-400" })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
Y && /* @__PURE__ */ n("p", { className: "text-sm text-red-500 mt-1", children: Y }),
|
|
163
|
+
S && /* @__PURE__ */ f("div", { className: "absolute z-50 mt-2 p-4 bg-white border border-slate-200 rounded-lg shadow-lg", children: [
|
|
164
|
+
/* @__PURE__ */ f("div", { className: "flex items-center justify-between mb-4", children: [
|
|
165
|
+
/* @__PURE__ */ n(
|
|
166
|
+
"button",
|
|
167
|
+
{
|
|
168
|
+
type: "button",
|
|
169
|
+
onClick: J,
|
|
170
|
+
className: "p-1 rounded hover:bg-slate-100",
|
|
171
|
+
children: /* @__PURE__ */ n(U, { className: "w-5 h-5" })
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ f("div", { className: "flex gap-1", children: [
|
|
175
|
+
m !== "months" && /* @__PURE__ */ n(
|
|
176
|
+
"button",
|
|
177
|
+
{
|
|
178
|
+
type: "button",
|
|
179
|
+
onClick: () => p("months"),
|
|
180
|
+
className: "px-2 py-1 text-sm font-medium hover:bg-slate-100 rounded",
|
|
181
|
+
children: F[a]
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ n(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
type: "button",
|
|
188
|
+
onClick: () => p("years"),
|
|
189
|
+
className: "px-2 py-1 text-sm font-medium hover:bg-slate-100 rounded",
|
|
190
|
+
children: o
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ n(
|
|
195
|
+
"button",
|
|
196
|
+
{
|
|
197
|
+
type: "button",
|
|
198
|
+
onClick: L,
|
|
199
|
+
className: "p-1 rounded hover:bg-slate-100",
|
|
200
|
+
children: /* @__PURE__ */ n(V, { className: "w-5 h-5" })
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] }),
|
|
204
|
+
m === "days" && /* @__PURE__ */ f(q, { children: [
|
|
205
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-7 gap-1 mb-2", children: X.map((t) => /* @__PURE__ */ n(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
className: "w-8 h-8 flex items-center justify-center text-xs font-medium text-slate-500",
|
|
209
|
+
children: t
|
|
210
|
+
},
|
|
211
|
+
t
|
|
212
|
+
)) }),
|
|
213
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-7 gap-1", children: z() })
|
|
214
|
+
] }),
|
|
215
|
+
m === "months" && /* @__PURE__ */ n("div", { className: "grid grid-cols-3 gap-2", children: H() }),
|
|
216
|
+
m === "years" && /* @__PURE__ */ n("div", { className: "grid grid-cols-3 gap-2", children: K() })
|
|
217
|
+
] })
|
|
218
|
+
] });
|
|
219
|
+
};
|
|
77
220
|
export {
|
|
78
|
-
|
|
79
|
-
k as DropdownButton
|
|
221
|
+
ae as DatePicker
|
|
80
222
|
};
|
|
81
223
|
//# sourceMappingURL=index26.js.map
|
package/dist/index26.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index26.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\nimport { Menu, MenuButton, MenuItems, MenuItem, Transition } from '@headlessui/react'\nimport { ChevronDownIcon } from '@heroicons/react/20/solid'\nimport { cn } from '@/lib/utils'\n\nexport interface DropdownItem {\n key: string\n label: ReactNode\n onClick?: () => void\n icon?: ReactNode\n disabled?: boolean\n danger?: boolean\n}\n\nexport interface DropdownProps {\n trigger: ReactNode\n items: DropdownItem[]\n align?: 'left' | 'right'\n className?: string\n}\n\nexport function Dropdown({\n trigger,\n items,\n align = 'left',\n className,\n}: DropdownProps) {\n return (\n <Menu as=\"div\" className={cn('relative inline-block text-left', className)}>\n <MenuButton as={Fragment}>{trigger}</MenuButton>\n <Transition\n as={Fragment}\n enter=\"transition ease-out duration-100\"\n enterFrom=\"transform opacity-0 scale-95\"\n enterTo=\"transform opacity-100 scale-100\"\n leave=\"transition ease-in duration-75\"\n leaveFrom=\"transform opacity-100 scale-100\"\n leaveTo=\"transform opacity-0 scale-95\"\n >\n <MenuItems\n className={cn(\n 'absolute z-10 mt-2 w-56 origin-top-right',\n 'bg-white rounded-lg border border-slate-200 shadow-lg',\n 'py-1 focus:outline-none',\n align === 'right' ? 'right-0' : 'left-0'\n )}\n >\n {items.map((item) => (\n <MenuItem key={item.key} disabled={item.disabled}>\n {({ active, disabled }) => (\n <button\n type=\"button\"\n onClick={item.onClick}\n disabled={disabled}\n className={cn(\n 'w-full flex items-center gap-2 px-4 py-2 text-sm text-left',\n 'transition-colors duration-150',\n active && 'bg-slate-50',\n disabled && 'opacity-50 cursor-not-allowed',\n item.danger\n ? 'text-red-600 hover:bg-red-50'\n : 'text-slate-700'\n )}\n >\n {item.icon && (\n <span className=\"flex-shrink-0 w-5 h-5\">{item.icon}</span>\n )}\n {item.label}\n </button>\n )}\n </MenuItem>\n ))}\n </MenuItems>\n </Transition>\n </Menu>\n )\n}\n\n// Convenience component for the default dropdown button trigger\nexport interface DropdownButtonProps {\n children: ReactNode\n className?: string\n}\n\nexport function DropdownButton({ children, className }: DropdownButtonProps) {\n return (\n <button\n type=\"button\"\n className={cn(\n 'inline-flex items-center gap-2 px-4 py-2',\n 'bg-white border border-slate-300 rounded-lg',\n 'text-sm font-medium text-slate-700',\n 'hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2',\n className\n )}\n >\n {children}\n <ChevronDownIcon className=\"h-5 w-5 text-slate-400\" />\n </button>\n )\n}\n"],"names":["Dropdown","trigger","items","align","className","jsxs","Menu","cn","jsx","MenuButton","Fragment","Transition","MenuItems","item","MenuItem","active","disabled","DropdownButton","children","ChevronDownIcon"],"mappings":";;;;;AAqBO,SAASA,EAAS;AAAA,EACvB,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC;AACF,GAAkB;AAChB,SACE,gBAAAC,EAACC,KAAK,IAAG,OAAM,WAAWC,EAAG,mCAAmCH,CAAS,GACvE,UAAA;AAAA,IAAA,gBAAAI,EAACC,GAAA,EAAW,IAAIC,GAAW,UAAAT,GAAQ;AAAA,IACnC,gBAAAO;AAAA,MAACG;AAAA,MAAA;AAAA,QAC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26.js","sources":["../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import { useState, useRef, useEffect } from 'react'\nimport { cn } from '@/lib/utils'\nimport { CalendarIcon, ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline'\n\nexport interface DatePickerProps {\n value?: string\n onChange: (date: string) => void\n label?: string\n placeholder?: string\n disabled?: boolean\n error?: string\n disableFutureDates?: boolean\n disablePastDates?: boolean\n format?: 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY-MM-DD'\n className?: string\n}\n\nconst MONTHS = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December'\n]\n\nconst WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']\n\nconst getDaysInMonth = (year: number, month: number) => {\n return new Date(year, month + 1, 0).getDate()\n}\n\nconst getFirstDayOfMonth = (year: number, month: number) => {\n return new Date(year, month, 1).getDay()\n}\n\nconst formatDate = (date: Date, format: string) => {\n const day = String(date.getDate()).padStart(2, '0')\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const year = date.getFullYear()\n\n switch (format) {\n case 'MM/DD/YYYY':\n return `${month}/${day}/${year}`\n case 'YYYY-MM-DD':\n return `${year}-${month}-${day}`\n default:\n return `${day}/${month}/${year}`\n }\n}\n\nconst parseDate = (dateString: string): Date | null => {\n if (!dateString) return null\n\n // Try different formats\n const formats = [\n /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/, // DD/MM/YYYY\n /^(\\d{4})-(\\d{2})-(\\d{2})$/, // YYYY-MM-DD\n ]\n\n for (const regex of formats) {\n const match = dateString.match(regex)\n if (match) {\n if (regex.source.includes('^(\\\\d{4})')) {\n // YYYY-MM-DD\n return new Date(parseInt(match[1]), parseInt(match[2]) - 1, parseInt(match[3]))\n } else {\n // DD/MM/YYYY\n return new Date(parseInt(match[3]), parseInt(match[2]) - 1, parseInt(match[1]))\n }\n }\n }\n return null\n}\n\nexport const DatePicker = ({\n value,\n onChange,\n label,\n placeholder = 'DD/MM/YYYY',\n disabled = false,\n error,\n disableFutureDates = false,\n disablePastDates = false,\n format = 'DD/MM/YYYY',\n className,\n}: DatePickerProps) => {\n const today = new Date()\n const parsedValue = value ? parseDate(value) : null\n\n const [isOpen, setIsOpen] = useState(false)\n const [viewMode, setViewMode] = useState<'days' | 'months' | 'years'>('days')\n const [viewYear, setViewYear] = useState(parsedValue?.getFullYear() ?? today.getFullYear())\n const [viewMonth, setViewMonth] = useState(parsedValue?.getMonth() ?? today.getMonth())\n const [selectedDate, setSelectedDate] = useState<Date | null>(parsedValue)\n const containerRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setIsOpen(false)\n setViewMode('days')\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }, [])\n\n const handleDateSelect = (day: number) => {\n const newDate = new Date(viewYear, viewMonth, day)\n setSelectedDate(newDate)\n onChange(formatDate(newDate, format))\n setIsOpen(false)\n }\n\n const handleMonthSelect = (monthIndex: number) => {\n setViewMonth(monthIndex)\n setViewMode('days')\n }\n\n const handleYearSelect = (year: number) => {\n setViewYear(year)\n setViewMode('months')\n }\n\n const navigatePrevious = () => {\n if (viewMode === 'days') {\n if (viewMonth === 0) {\n setViewMonth(11)\n setViewYear(viewYear - 1)\n } else {\n setViewMonth(viewMonth - 1)\n }\n } else if (viewMode === 'years') {\n setViewYear(viewYear - 12)\n }\n }\n\n const navigateNext = () => {\n if (viewMode === 'days') {\n if (viewMonth === 11) {\n setViewMonth(0)\n setViewYear(viewYear + 1)\n } else {\n setViewMonth(viewMonth + 1)\n }\n } else if (viewMode === 'years') {\n setViewYear(viewYear + 12)\n }\n }\n\n const isDateDisabled = (date: Date) => {\n const todayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate())\n if (disableFutureDates && date > todayStart) return true\n if (disablePastDates && date < todayStart) return true\n return false\n }\n\n const daysInMonth = getDaysInMonth(viewYear, viewMonth)\n const firstDay = getFirstDayOfMonth(viewYear, viewMonth)\n\n const renderDays = () => {\n const days = []\n\n // Empty cells before first day\n for (let i = 0; i < firstDay; i++) {\n days.push(<div key={`empty-${i}`} className=\"w-8 h-8\" />)\n }\n\n // Days of month\n for (let day = 1; day <= daysInMonth; day++) {\n const date = new Date(viewYear, viewMonth, day)\n const isSelected = selectedDate &&\n date.getDate() === selectedDate.getDate() &&\n date.getMonth() === selectedDate.getMonth() &&\n date.getFullYear() === selectedDate.getFullYear()\n const isToday =\n date.getDate() === today.getDate() &&\n date.getMonth() === today.getMonth() &&\n date.getFullYear() === today.getFullYear()\n const isDisabled = isDateDisabled(date)\n\n days.push(\n <button\n key={day}\n type=\"button\"\n disabled={isDisabled}\n onClick={() => handleDateSelect(day)}\n className={cn(\n 'w-8 h-8 rounded-full text-sm flex items-center justify-center',\n 'transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500',\n isSelected && 'bg-primary-500 text-white',\n !isSelected && isToday && 'border border-primary-500 text-primary-500',\n !isSelected && !isToday && !isDisabled && 'hover:bg-slate-100',\n isDisabled && 'text-slate-300 cursor-not-allowed'\n )}\n >\n {day}\n </button>\n )\n }\n\n return days\n }\n\n const renderMonths = () => {\n return MONTHS.map((month, index) => (\n <button\n key={month}\n type=\"button\"\n onClick={() => handleMonthSelect(index)}\n className={cn(\n 'px-3 py-2 rounded text-sm',\n 'transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500',\n viewMonth === index && 'bg-primary-500 text-white',\n viewMonth !== index && 'hover:bg-slate-100'\n )}\n >\n {month.slice(0, 3)}\n </button>\n ))\n }\n\n const renderYears = () => {\n const startYear = viewYear - 6\n const years = []\n for (let i = 0; i < 12; i++) {\n const year = startYear + i\n years.push(\n <button\n key={year}\n type=\"button\"\n onClick={() => handleYearSelect(year)}\n className={cn(\n 'px-3 py-2 rounded text-sm',\n 'transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500',\n viewYear === year && 'bg-primary-500 text-white',\n viewYear !== year && 'hover:bg-slate-100'\n )}\n >\n {year}\n </button>\n )\n }\n return years\n }\n\n return (\n <div ref={containerRef} className={cn('relative', className)}>\n {label && (\n <label className=\"block text-sm font-semibold text-slate-700 mb-1.5\">\n {label}\n </label>\n )}\n\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => setIsOpen(!isOpen)}\n className={cn(\n 'w-full flex items-center justify-between px-4 py-2.5',\n 'bg-white border rounded-lg text-left',\n 'transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500',\n error ? 'border-red-500' : 'border-slate-300',\n disabled && 'bg-slate-100 cursor-not-allowed opacity-60'\n )}\n >\n <span className={value ? 'text-slate-900' : 'text-slate-400'}>\n {value || placeholder}\n </span>\n <CalendarIcon className=\"w-5 h-5 text-slate-400\" />\n </button>\n\n {error && (\n <p className=\"text-sm text-red-500 mt-1\">{error}</p>\n )}\n\n {isOpen && (\n <div className=\"absolute z-50 mt-2 p-4 bg-white border border-slate-200 rounded-lg shadow-lg\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-4\">\n <button\n type=\"button\"\n onClick={navigatePrevious}\n className=\"p-1 rounded hover:bg-slate-100\"\n >\n <ChevronLeftIcon className=\"w-5 h-5\" />\n </button>\n\n <div className=\"flex gap-1\">\n {viewMode !== 'months' && (\n <button\n type=\"button\"\n onClick={() => setViewMode('months')}\n className=\"px-2 py-1 text-sm font-medium hover:bg-slate-100 rounded\"\n >\n {MONTHS[viewMonth]}\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => setViewMode('years')}\n className=\"px-2 py-1 text-sm font-medium hover:bg-slate-100 rounded\"\n >\n {viewYear}\n </button>\n </div>\n\n <button\n type=\"button\"\n onClick={navigateNext}\n className=\"p-1 rounded hover:bg-slate-100\"\n >\n <ChevronRightIcon className=\"w-5 h-5\" />\n </button>\n </div>\n\n {/* Calendar content */}\n {viewMode === 'days' && (\n <>\n <div className=\"grid grid-cols-7 gap-1 mb-2\">\n {WEEKDAYS.map((day) => (\n <div\n key={day}\n className=\"w-8 h-8 flex items-center justify-center text-xs font-medium text-slate-500\"\n >\n {day}\n </div>\n ))}\n </div>\n <div className=\"grid grid-cols-7 gap-1\">\n {renderDays()}\n </div>\n </>\n )}\n\n {viewMode === 'months' && (\n <div className=\"grid grid-cols-3 gap-2\">\n {renderMonths()}\n </div>\n )}\n\n {viewMode === 'years' && (\n <div className=\"grid grid-cols-3 gap-2\">\n {renderYears()}\n </div>\n )}\n </div>\n )}\n </div>\n )\n}\n"],"names":["MONTHS","WEEKDAYS","getDaysInMonth","year","month","getFirstDayOfMonth","formatDate","date","format","day","parseDate","dateString","formats","regex","match","DatePicker","value","onChange","label","placeholder","disabled","error","disableFutureDates","disablePastDates","className","today","parsedValue","isOpen","setIsOpen","useState","viewMode","setViewMode","viewYear","setViewYear","viewMonth","setViewMonth","selectedDate","setSelectedDate","containerRef","useRef","useEffect","handleClickOutside","event","handleDateSelect","newDate","handleMonthSelect","monthIndex","handleYearSelect","navigatePrevious","navigateNext","isDateDisabled","todayStart","daysInMonth","firstDay","renderDays","days","i","isSelected","isToday","isDisabled","jsx","cn","renderMonths","index","renderYears","startYear","years","jsxs","CalendarIcon","ChevronLeftIcon","ChevronRightIcon","Fragment"],"mappings":";;;;AAiBA,MAAMA,IAAS;AAAA,EACb;AAAA,EAAW;AAAA,EAAY;AAAA,EAAS;AAAA,EAAS;AAAA,EAAO;AAAA,EAChD;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAa;AAAA,EAAW;AAAA,EAAY;AACxD,GAEMC,IAAW,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI,GAEpDC,IAAiB,CAACC,GAAcC,MAC7B,IAAI,KAAKD,GAAMC,IAAQ,GAAG,CAAC,EAAE,QAAA,GAGhCC,IAAqB,CAACF,GAAcC,MACjC,IAAI,KAAKD,GAAMC,GAAO,CAAC,EAAE,OAAA,GAG5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,gBAAAW,EAACU,GAAA,EAAiB,WAAU,UAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACxC,GACF;AAAA,MAGCxC,MAAa,UACZ,gBAAAqC,EAAAI,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAX,EAAC,SAAI,WAAU,+BACZ,UAAA3D,EAAS,IAAI,CAACQ,MACb,gBAAAmD;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YAET,UAAAnD;AAAA,UAAA;AAAA,UAHIA;AAAA,QAAA,CAKR,GACH;AAAA,QACA,gBAAAmD,EAAC,OAAA,EAAI,WAAU,0BACZ,cAAW,CACd;AAAA,MAAA,GACF;AAAA,MAGD9B,MAAa,YACZ,gBAAA8B,EAAC,SAAI,WAAU,0BACZ,eACH;AAAA,MAGD9B,MAAa,WACZ,gBAAA8B,EAAC,SAAI,WAAU,0BACZ,cAAY,CACf;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
|
package/dist/index27.js
CHANGED
|
@@ -1,27 +1,55 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as s, Fragment as h, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as i } from "./index3.js";
|
|
3
|
+
import { XMarkIcon as f } from "@heroicons/react/24/outline";
|
|
4
|
+
const u = ({
|
|
5
|
+
isOpen: a,
|
|
6
|
+
onClose: l,
|
|
7
|
+
children: n,
|
|
8
|
+
width: e = 680,
|
|
9
|
+
position: r = "right",
|
|
10
|
+
className: o
|
|
11
|
+
}) => {
|
|
12
|
+
const c = typeof e == "number" ? `${e}px` : e;
|
|
13
|
+
return /* @__PURE__ */ s(h, { children: [
|
|
14
|
+
a && /* @__PURE__ */ t(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: "fixed inset-0 z-40 bg-black/55 transition-opacity",
|
|
18
|
+
onClick: l
|
|
19
|
+
}
|
|
16
20
|
),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/* @__PURE__ */ s(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: i(
|
|
25
|
+
"fixed top-0 z-50 h-screen bg-white shadow-2xl",
|
|
26
|
+
"transition-transform duration-300 ease-in-out",
|
|
27
|
+
r === "right" ? "right-0" : "left-0",
|
|
28
|
+
a ? "translate-x-0" : r === "right" ? "translate-x-full" : "-translate-x-full",
|
|
29
|
+
o
|
|
30
|
+
),
|
|
31
|
+
style: { width: c },
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
onClick: l,
|
|
37
|
+
className: i(
|
|
38
|
+
"absolute top-8 z-50 border-0 bg-transparent cursor-pointer",
|
|
39
|
+
"flex items-center justify-center",
|
|
40
|
+
r === "right" ? "right-9" : "left-9"
|
|
41
|
+
),
|
|
42
|
+
"aria-label": "Close drawer",
|
|
43
|
+
children: /* @__PURE__ */ t(f, { className: "w-6 h-6 text-slate-500 hover:text-slate-700" })
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ t("div", { className: "h-screen overflow-y-auto overflow-x-hidden", children: n })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
};
|
|
24
52
|
export {
|
|
25
|
-
|
|
53
|
+
u as Drawer
|
|
26
54
|
};
|
|
27
55
|
//# sourceMappingURL=index27.js.map
|
package/dist/index27.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index27.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index27.js","sources":["../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { type ReactNode } from 'react'\nimport { cn } from '@/lib/utils'\nimport { XMarkIcon } from '@heroicons/react/24/outline'\n\nexport interface DrawerProps {\n isOpen: boolean\n onClose: () => void\n children: ReactNode\n width?: number | string\n position?: 'left' | 'right'\n className?: string\n}\n\nexport const Drawer = ({\n isOpen,\n onClose,\n children,\n width = 680,\n position = 'right',\n className,\n}: DrawerProps) => {\n const widthStyle = typeof width === 'number' ? `${width}px` : width\n\n return (\n <>\n {/* Backdrop */}\n {isOpen && (\n <div\n className=\"fixed inset-0 z-40 bg-black/55 transition-opacity\"\n onClick={onClose}\n />\n )}\n\n {/* Drawer panel */}\n <div\n className={cn(\n 'fixed top-0 z-50 h-screen bg-white shadow-2xl',\n 'transition-transform duration-300 ease-in-out',\n position === 'right' ? 'right-0' : 'left-0',\n isOpen\n ? 'translate-x-0'\n : position === 'right'\n ? 'translate-x-full'\n : '-translate-x-full',\n className\n )}\n style={{ width: widthStyle }}\n >\n <button\n onClick={onClose}\n className={cn(\n 'absolute top-8 z-50 border-0 bg-transparent cursor-pointer',\n 'flex items-center justify-center',\n position === 'right' ? 'right-9' : 'left-9'\n )}\n aria-label=\"Close drawer\"\n >\n <XMarkIcon className=\"w-6 h-6 text-slate-500 hover:text-slate-700\" />\n </button>\n\n <div className=\"h-screen overflow-y-auto overflow-x-hidden\">\n {children}\n </div>\n </div>\n </>\n )\n}\n"],"names":["Drawer","isOpen","onClose","children","width","position","className","widthStyle","jsxs","Fragment","jsx","cn","XMarkIcon"],"mappings":";;;AAaO,MAAMA,IAAS,CAAC;AAAA,EACrB,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AAAA,EACX,WAAAC;AACF,MAAmB;AACjB,QAAMC,IAAa,OAAOH,KAAU,WAAW,GAAGA,CAAK,OAAOA;AAE9D,SACE,gBAAAI,EAAAC,GAAA,EAEG,UAAA;AAAA,IAAAR,KACC,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,SAASR;AAAA,MAAA;AAAA,IAAA;AAAA,IAKb,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWG;AAAA,UACT;AAAA,UACA;AAAA,UACAN,MAAa,UAAU,YAAY;AAAA,UACnCJ,IACI,kBACAI,MAAa,UACX,qBACA;AAAA,UACNC;AAAA,QAAA;AAAA,QAEF,OAAO,EAAE,OAAOC,EAAA;AAAA,QAEhB,UAAA;AAAA,UAAA,gBAAAG;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAASR;AAAA,cACT,WAAWS;AAAA,gBACT;AAAA,gBACA;AAAA,gBACAN,MAAa,UAAU,YAAY;AAAA,cAAA;AAAA,cAErC,cAAW;AAAA,cAEX,UAAA,gBAAAK,EAACE,GAAA,EAAU,WAAU,8CAAA,CAA8C;AAAA,YAAA;AAAA,UAAA;AAAA,UAGrE,gBAAAF,EAAC,OAAA,EAAI,WAAU,8CACZ,UAAAP,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|