@axtec/components 0.1.5 → 0.1.7
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 +6 -0
- package/dist/components/OptionDivider/OptionDivider.d.ts +5 -0
- package/dist/components/OptionDivider/index.d.ts +1 -0
- package/dist/components/SelectionCard/SelectionCard.d.ts +13 -0
- package/dist/components/SelectionCard/index.d.ts +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.css +1 -1
- package/dist/index.js +106 -102
- package/dist/index.js.map +1 -1
- package/dist/index12.js +1 -1
- package/dist/index3.js +2 -2
- package/dist/index43.js +12 -14
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +11 -87
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +91 -69
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +68 -121
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +118 -36
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +40 -44
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +44 -56
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +56 -16
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +16 -65
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +62 -51
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +54 -37
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +37 -66
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +63 -19
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +19 -101
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +99 -213
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +67 -62
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +206 -224
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +62 -96
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +233 -33
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +98 -14
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +35 -59
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +16 -59
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +57 -72
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +58 -106
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +70 -43
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +101 -40
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +44 -72
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +47 -53
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +70 -62
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +46 -28
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +67 -13
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +35 -2263
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +17 -0
- package/dist/index75.js.map +1 -0
- package/dist/index76.js +2267 -0
- package/dist/index76.js.map +1 -0
- package/package.json +1 -1
package/dist/index56.js
CHANGED
|
@@ -1,107 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: i,
|
|
9
|
-
onChange: m,
|
|
10
|
-
label: c,
|
|
11
|
-
placeholder: u = "Select an option",
|
|
12
|
-
error: o,
|
|
13
|
-
disabled: d,
|
|
14
|
-
className: p
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as i } from "./index3.js";
|
|
3
|
+
function b({
|
|
4
|
+
children: r,
|
|
5
|
+
withBorder: e = !1,
|
|
6
|
+
leftBorder: o = !1,
|
|
7
|
+
className: t
|
|
15
8
|
}) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"relative w-full py-2.5 pl-4 pr-10 text-left text-base",
|
|
25
|
-
"bg-white border rounded-lg cursor-pointer",
|
|
26
|
-
"transition-colors duration-200",
|
|
27
|
-
"focus:outline-none focus:ring-2 focus:ring-offset-0",
|
|
28
|
-
o ? "border-red-500 focus:border-red-500 focus:ring-red-500" : "border-slate-300 focus:border-primary-500 focus:ring-primary-500",
|
|
29
|
-
d && "bg-slate-50 cursor-not-allowed opacity-50"
|
|
30
|
-
),
|
|
31
|
-
children: [
|
|
32
|
-
/* @__PURE__ */ e(
|
|
33
|
-
"span",
|
|
34
|
-
{
|
|
35
|
-
className: t(
|
|
36
|
-
"block truncate",
|
|
37
|
-
!a && "text-slate-400"
|
|
38
|
-
),
|
|
39
|
-
children: (a == null ? void 0 : a.label) || u
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
/* @__PURE__ */ e("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3", children: /* @__PURE__ */ e(
|
|
43
|
-
w,
|
|
44
|
-
{
|
|
45
|
-
className: "h-5 w-5 text-slate-400",
|
|
46
|
-
"aria-hidden": "true"
|
|
47
|
-
}
|
|
48
|
-
) })
|
|
49
|
-
]
|
|
50
|
-
}
|
|
9
|
+
return /* @__PURE__ */ a(
|
|
10
|
+
"h2",
|
|
11
|
+
{
|
|
12
|
+
className: i(
|
|
13
|
+
"text-2xl font-semibold text-slate-900",
|
|
14
|
+
e && "pb-3 border-b-2 border-primary-500",
|
|
15
|
+
o && "pl-3 border-l-4 border-primary-500",
|
|
16
|
+
t
|
|
51
17
|
),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
as: h,
|
|
56
|
-
leave: "transition ease-in duration-100",
|
|
57
|
-
leaveFrom: "opacity-100",
|
|
58
|
-
leaveTo: "opacity-0",
|
|
59
|
-
children: /* @__PURE__ */ e(
|
|
60
|
-
v,
|
|
61
|
-
{
|
|
62
|
-
className: t(
|
|
63
|
-
"absolute z-10 mt-1 w-full max-h-60 overflow-auto",
|
|
64
|
-
"bg-white rounded-lg border border-slate-200 shadow-lg",
|
|
65
|
-
"py-1 text-base",
|
|
66
|
-
"focus:outline-none"
|
|
67
|
-
),
|
|
68
|
-
children: n.map((r) => /* @__PURE__ */ e(
|
|
69
|
-
N,
|
|
70
|
-
{
|
|
71
|
-
value: r.value,
|
|
72
|
-
disabled: r.disabled,
|
|
73
|
-
className: ({ active: l, selected: b }) => t(
|
|
74
|
-
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
75
|
-
"transition-colors duration-150",
|
|
76
|
-
l && "bg-primary-50",
|
|
77
|
-
b && "bg-primary-50 text-primary-900",
|
|
78
|
-
r.disabled && "opacity-50 cursor-not-allowed"
|
|
79
|
-
),
|
|
80
|
-
children: ({ selected: l }) => /* @__PURE__ */ s(f, { children: [
|
|
81
|
-
/* @__PURE__ */ e(
|
|
82
|
-
"span",
|
|
83
|
-
{
|
|
84
|
-
className: t(
|
|
85
|
-
"block truncate",
|
|
86
|
-
l ? "font-semibold" : "font-normal"
|
|
87
|
-
),
|
|
88
|
-
children: r.label
|
|
89
|
-
}
|
|
90
|
-
),
|
|
91
|
-
l && /* @__PURE__ */ e("span", { className: "absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600", children: /* @__PURE__ */ e(k, { className: "h-5 w-5", "aria-hidden": "true" }) })
|
|
92
|
-
] })
|
|
93
|
-
},
|
|
94
|
-
r.value
|
|
95
|
-
))
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
] }) }),
|
|
101
|
-
o && /* @__PURE__ */ e("p", { className: "mt-1.5 text-sm text-red-600", children: o })
|
|
102
|
-
] });
|
|
18
|
+
children: r
|
|
19
|
+
}
|
|
20
|
+
);
|
|
103
21
|
}
|
|
104
22
|
export {
|
|
105
|
-
|
|
23
|
+
b as SectionHeading
|
|
106
24
|
};
|
|
107
25
|
//# sourceMappingURL=index56.js.map
|
package/dist/index56.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index56.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index56.js","sources":["../src/components/Typography/SectionHeading.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\nimport type { ReactNode } from 'react'\n\nexport interface SectionHeadingProps {\n children: ReactNode\n /** Bottom border accent */\n withBorder?: boolean\n /** Left border accent (RealtorIQ style) */\n leftBorder?: boolean\n className?: string\n}\n\nexport function SectionHeading({\n children,\n withBorder = false,\n leftBorder = false,\n className,\n}: SectionHeadingProps) {\n return (\n <h2\n className={cn(\n 'text-2xl font-semibold text-slate-900',\n withBorder && 'pb-3 border-b-2 border-primary-500',\n leftBorder && 'pl-3 border-l-4 border-primary-500',\n className\n )}\n >\n {children}\n </h2>\n )\n}\n"],"names":["SectionHeading","children","withBorder","leftBorder","className","jsx","cn"],"mappings":";;AAYO,SAASA,EAAe;AAAA,EAC7B,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,WAAAC;AACF,GAAwB;AACtB,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAJ,KAAc;AAAA,QACdC,KAAc;AAAA,QACdC;AAAA,MAAA;AAAA,MAGD,UAAAH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
package/dist/index57.js
CHANGED
|
@@ -1,221 +1,107 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
) });
|
|
32
|
-
}, E = ({
|
|
33
|
-
children: t,
|
|
34
|
-
showToggle: r = !0,
|
|
35
|
-
className: a
|
|
36
|
-
}) => {
|
|
37
|
-
const { isOpen: s, toggle: i } = p();
|
|
38
|
-
return /* @__PURE__ */ m(
|
|
39
|
-
"div",
|
|
40
|
-
{
|
|
41
|
-
className: l(
|
|
42
|
-
"flex items-center border-b border-slate-200 h-16",
|
|
43
|
-
s ? "px-4 justify-between" : "px-2 justify-center",
|
|
44
|
-
a
|
|
45
|
-
),
|
|
46
|
-
children: [
|
|
47
|
-
s && t,
|
|
48
|
-
r && /* @__PURE__ */ e(
|
|
49
|
-
"button",
|
|
50
|
-
{
|
|
51
|
-
onClick: i,
|
|
52
|
-
className: "p-2 rounded-lg hover:bg-slate-200 transition-colors cursor-pointer flex-shrink-0",
|
|
53
|
-
"aria-label": s ? "Collapse sidebar" : "Expand sidebar",
|
|
54
|
-
children: s ? /* @__PURE__ */ e(y, { className: "h-5 w-5 text-slate-500" }) : /* @__PURE__ */ e(N, { className: "h-5 w-5 text-slate-500" })
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
}, F = ({ children: t, className: r }) => /* @__PURE__ */ e("nav", { className: l("flex-1 py-4", r), children: /* @__PURE__ */ e("ul", { className: "flex flex-col space-y-1 px-2", children: t }) }), z = ({ label: t, children: r, className: a }) => {
|
|
61
|
-
const { isOpen: s } = p();
|
|
62
|
-
return /* @__PURE__ */ m("div", { className: l("mt-4 first:mt-0", a), children: [
|
|
63
|
-
t && s && /* @__PURE__ */ e("div", { className: "px-3 mb-2 text-xs font-semibold uppercase tracking-wider text-slate-400", children: t }),
|
|
64
|
-
!t && s && /* @__PURE__ */ e("div", { className: "border-t border-slate-200 mx-3 mb-2" }),
|
|
65
|
-
/* @__PURE__ */ e("ul", { className: "flex flex-col space-y-1", children: r })
|
|
66
|
-
] });
|
|
67
|
-
}, B = ({
|
|
68
|
-
label: t,
|
|
69
|
-
icon: r,
|
|
70
|
-
active: a = !1,
|
|
71
|
-
href: s,
|
|
72
|
-
onClick: i,
|
|
73
|
-
as: c,
|
|
74
|
-
badge: o,
|
|
75
|
-
className: d
|
|
76
|
-
}) => {
|
|
77
|
-
const { isOpen: n } = p(), x = l(
|
|
78
|
-
"flex items-center rounded-lg transition-all duration-200 cursor-pointer group w-full",
|
|
79
|
-
n ? "px-3 py-2.5" : "px-2 py-2.5 justify-center",
|
|
80
|
-
a ? "bg-accent-tint text-accent-tint-dark" : "text-slate-600 hover:bg-slate-200 hover:text-slate-900",
|
|
81
|
-
d
|
|
82
|
-
), u = /* @__PURE__ */ m(f, { children: [
|
|
83
|
-
r && /* @__PURE__ */ e(
|
|
84
|
-
r,
|
|
85
|
-
{
|
|
86
|
-
className: l(
|
|
87
|
-
"h-5 w-5 flex-shrink-0 transition-colors",
|
|
88
|
-
a ? "text-primary-500" : "text-slate-500 group-hover:text-slate-700"
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
),
|
|
92
|
-
n && /* @__PURE__ */ e(
|
|
93
|
-
"span",
|
|
94
|
-
{
|
|
95
|
-
className: l(
|
|
96
|
-
"ml-3 text-sm font-medium truncate",
|
|
97
|
-
a ? "text-accent-tint-dark" : ""
|
|
98
|
-
),
|
|
99
|
-
children: t
|
|
100
|
-
}
|
|
101
|
-
),
|
|
102
|
-
n && o !== void 0 && /* @__PURE__ */ e("span", { className: "ml-auto text-xs font-semibold bg-accent-tint text-accent-tint-dark rounded-full px-2 py-0.5", children: o })
|
|
103
|
-
] });
|
|
104
|
-
return s && c ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(c, { href: s, className: x, title: n ? void 0 : t, children: u }) }) : s ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("a", { href: s, className: x, title: n ? void 0 : t, onClick: i, children: u }) }) : /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
105
|
-
"button",
|
|
106
|
-
{
|
|
107
|
-
onClick: i,
|
|
108
|
-
className: x,
|
|
109
|
-
title: n ? void 0 : t,
|
|
110
|
-
children: u
|
|
111
|
-
}
|
|
112
|
-
) });
|
|
113
|
-
}, G = ({
|
|
114
|
-
label: t,
|
|
115
|
-
icon: r,
|
|
116
|
-
active: a = !1,
|
|
117
|
-
defaultOpen: s = !1,
|
|
118
|
-
children: i,
|
|
119
|
-
className: c
|
|
120
|
-
}) => {
|
|
121
|
-
const { isOpen: o } = p(), [d, n] = b(s);
|
|
122
|
-
return /* @__PURE__ */ m("li", { className: c, children: [
|
|
123
|
-
/* @__PURE__ */ m(
|
|
124
|
-
"button",
|
|
125
|
-
{
|
|
126
|
-
onClick: () => n(!d),
|
|
127
|
-
className: l(
|
|
128
|
-
"flex items-center rounded-lg transition-all duration-200 cursor-pointer group w-full",
|
|
129
|
-
o ? "px-3 py-2.5" : "px-2 py-2.5 justify-center",
|
|
130
|
-
a ? "text-accent-tint-dark" : "text-slate-600 hover:bg-slate-200 hover:text-slate-900"
|
|
131
|
-
),
|
|
132
|
-
title: o ? void 0 : t,
|
|
133
|
-
children: [
|
|
134
|
-
r && /* @__PURE__ */ e(
|
|
135
|
-
r,
|
|
136
|
-
{
|
|
137
|
-
className: l(
|
|
138
|
-
"h-5 w-5 flex-shrink-0 transition-colors",
|
|
139
|
-
a ? "text-primary-500" : "text-slate-500 group-hover:text-slate-700"
|
|
140
|
-
)
|
|
141
|
-
}
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as h } from "react";
|
|
3
|
+
import { Listbox as x, ListboxButton as g, Transition as y, ListboxOptions as v, ListboxOption as N } from "@headlessui/react";
|
|
4
|
+
import { ChevronUpDownIcon as w, CheckIcon as k } from "@heroicons/react/20/solid";
|
|
5
|
+
import { cn as t } from "./index3.js";
|
|
6
|
+
function S({
|
|
7
|
+
options: n,
|
|
8
|
+
value: i,
|
|
9
|
+
onChange: m,
|
|
10
|
+
label: c,
|
|
11
|
+
placeholder: u = "Select an option",
|
|
12
|
+
error: o,
|
|
13
|
+
disabled: d,
|
|
14
|
+
className: p
|
|
15
|
+
}) {
|
|
16
|
+
const a = n.find((r) => r.value === i);
|
|
17
|
+
return /* @__PURE__ */ s("div", { className: t("w-full", p), children: [
|
|
18
|
+
c && /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: c }),
|
|
19
|
+
/* @__PURE__ */ e(x, { value: i, onChange: m, disabled: d, children: /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
20
|
+
/* @__PURE__ */ s(
|
|
21
|
+
g,
|
|
22
|
+
{
|
|
23
|
+
className: t(
|
|
24
|
+
"relative w-full py-2.5 pl-4 pr-10 text-left text-base",
|
|
25
|
+
"bg-white border rounded-lg cursor-pointer",
|
|
26
|
+
"transition-colors duration-200",
|
|
27
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-0",
|
|
28
|
+
o ? "border-red-500 focus:border-red-500 focus:ring-red-500" : "border-slate-300 focus:border-primary-500 focus:ring-primary-500",
|
|
29
|
+
d && "bg-slate-50 cursor-not-allowed opacity-50"
|
|
142
30
|
),
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */ e("span", { className: "ml-3 text-sm font-medium truncate", children: t }),
|
|
31
|
+
children: [
|
|
145
32
|
/* @__PURE__ */ e(
|
|
146
|
-
|
|
33
|
+
"span",
|
|
147
34
|
{
|
|
148
|
-
className:
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
)
|
|
35
|
+
className: t(
|
|
36
|
+
"block truncate",
|
|
37
|
+
!a && "text-slate-400"
|
|
38
|
+
),
|
|
39
|
+
children: (a == null ? void 0 : a.label) || u
|
|
152
40
|
}
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ e("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3", children: /* @__PURE__ */ e(
|
|
43
|
+
w,
|
|
44
|
+
{
|
|
45
|
+
className: "h-5 w-5 text-slate-400",
|
|
46
|
+
"aria-hidden": "true"
|
|
47
|
+
}
|
|
48
|
+
) })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ e(
|
|
53
|
+
y,
|
|
54
|
+
{
|
|
55
|
+
as: h,
|
|
56
|
+
leave: "transition ease-in duration-100",
|
|
57
|
+
leaveFrom: "opacity-100",
|
|
58
|
+
leaveTo: "opacity-0",
|
|
59
|
+
children: /* @__PURE__ */ e(
|
|
60
|
+
v,
|
|
61
|
+
{
|
|
62
|
+
className: t(
|
|
63
|
+
"absolute z-10 mt-1 w-full max-h-60 overflow-auto",
|
|
64
|
+
"bg-white rounded-lg border border-slate-200 shadow-lg",
|
|
65
|
+
"py-1 text-base",
|
|
66
|
+
"focus:outline-none"
|
|
67
|
+
),
|
|
68
|
+
children: n.map((r) => /* @__PURE__ */ e(
|
|
69
|
+
N,
|
|
70
|
+
{
|
|
71
|
+
value: r.value,
|
|
72
|
+
disabled: r.disabled,
|
|
73
|
+
className: ({ active: l, selected: b }) => t(
|
|
74
|
+
"relative cursor-pointer select-none py-2.5 pl-10 pr-4",
|
|
75
|
+
"transition-colors duration-150",
|
|
76
|
+
l && "bg-primary-50",
|
|
77
|
+
b && "bg-primary-50 text-primary-900",
|
|
78
|
+
r.disabled && "opacity-50 cursor-not-allowed"
|
|
79
|
+
),
|
|
80
|
+
children: ({ selected: l }) => /* @__PURE__ */ s(f, { children: [
|
|
81
|
+
/* @__PURE__ */ e(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
className: t(
|
|
85
|
+
"block truncate",
|
|
86
|
+
l ? "font-semibold" : "font-normal"
|
|
87
|
+
),
|
|
88
|
+
children: r.label
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
l && /* @__PURE__ */ e("span", { className: "absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600", children: /* @__PURE__ */ e(k, { className: "h-5 w-5", "aria-hidden": "true" }) })
|
|
92
|
+
] })
|
|
93
|
+
},
|
|
94
|
+
r.value
|
|
95
|
+
))
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }) }),
|
|
101
|
+
o && /* @__PURE__ */ e("p", { className: "mt-1.5 text-sm text-red-600", children: o })
|
|
208
102
|
] });
|
|
209
|
-
}
|
|
103
|
+
}
|
|
210
104
|
export {
|
|
211
|
-
|
|
212
|
-
P as SidebarCard,
|
|
213
|
-
H as SidebarFooter,
|
|
214
|
-
G as SidebarGroup,
|
|
215
|
-
E as SidebarHeader,
|
|
216
|
-
B as SidebarItem,
|
|
217
|
-
F as SidebarNav,
|
|
218
|
-
z as SidebarSection,
|
|
219
|
-
p as useSidebar
|
|
105
|
+
S as Select
|
|
220
106
|
};
|
|
221
107
|
//# sourceMappingURL=index57.js.map
|
package/dist/index57.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index57.js","sources":["../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useState,\n type ReactNode,\n type ComponentType,\n type SVGProps,\n type MouseEvent,\n} from 'react'\nimport { cn } from '@/lib/utils'\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n} from '@heroicons/react/24/outline'\n\n// ─── Context ────────────────────────────────────────────────────────────────\n\ninterface SidebarContextValue {\n isOpen: boolean\n setIsOpen: (open: boolean) => void\n toggle: () => void\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null)\n\nexport const useSidebar = () => {\n const ctx = useContext(SidebarContext)\n if (!ctx) throw new Error('useSidebar must be used within a <Sidebar>')\n return ctx\n}\n\n// ─── Sidebar (root) ─────────────────────────────────────────────────────────\n\nexport interface SidebarProps {\n children: ReactNode\n /** Start collapsed */\n defaultOpen?: boolean\n /** Controlled open state */\n open?: boolean\n /** Controlled callback */\n onOpenChange?: (open: boolean) => void\n /** Render inline (relative position) instead of fixed — useful for embedding in a layout container */\n inline?: boolean\n className?: string\n}\n\nexport const Sidebar = ({\n children,\n defaultOpen = true,\n open,\n onOpenChange,\n inline = false,\n className,\n}: SidebarProps) => {\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = open !== undefined ? open : internalOpen\n\n const setIsOpen = (value: boolean) => {\n if (onOpenChange) onOpenChange(value)\n else setInternalOpen(value)\n }\n\n const toggle = () => setIsOpen(!isOpen)\n\n return (\n <SidebarContext.Provider value={{ isOpen, setIsOpen, toggle }}>\n <div\n className={cn(\n 'flex flex-col justify-between bg-slate-50 border-r border-slate-200 transition-all duration-300 ease-in-out',\n inline\n ? 'relative h-full'\n : 'hidden md:flex fixed top-0 left-0 z-10 h-screen',\n isOpen ? 'w-64' : 'w-16',\n className\n )}\n >\n <div className=\"flex flex-col h-full\">\n {children}\n </div>\n </div>\n </SidebarContext.Provider>\n )\n}\n\n// ─── SidebarHeader ──────────────────────────────────────────────────────────\n\nexport interface SidebarHeaderProps {\n children?: ReactNode\n /** Show the built-in collapse toggle button (default: true) */\n showToggle?: boolean\n className?: string\n}\n\nexport const SidebarHeader = ({\n children,\n showToggle = true,\n className,\n}: SidebarHeaderProps) => {\n const { isOpen, toggle } = useSidebar()\n\n return (\n <div\n className={cn(\n 'flex items-center border-b border-slate-200 h-16',\n isOpen ? 'px-4 justify-between' : 'px-2 justify-center',\n className\n )}\n >\n {isOpen && children}\n {showToggle && (\n <button\n onClick={toggle}\n className=\"p-2 rounded-lg hover:bg-slate-200 transition-colors cursor-pointer flex-shrink-0\"\n aria-label={isOpen ? 'Collapse sidebar' : 'Expand sidebar'}\n >\n {isOpen ? (\n <ChevronLeftIcon className=\"h-5 w-5 text-slate-500\" />\n ) : (\n <ChevronRightIcon className=\"h-5 w-5 text-slate-500\" />\n )}\n </button>\n )}\n </div>\n )\n}\n\n// ─── SidebarNav ─────────────────────────────────────────────────────────────\n\nexport interface SidebarNavProps {\n children: ReactNode\n className?: string\n}\n\nexport const SidebarNav = ({ children, className }: SidebarNavProps) => (\n <nav className={cn('flex-1 py-4', className)}>\n <ul className=\"flex flex-col space-y-1 px-2\">\n {children}\n </ul>\n </nav>\n)\n\n// ─── SidebarSection ─────────────────────────────────────────────────────────\n\nexport interface SidebarSectionProps {\n /** Section label (hidden when collapsed) */\n label?: string\n children: ReactNode\n className?: string\n}\n\nexport const SidebarSection = ({ label, children, className }: SidebarSectionProps) => {\n const { isOpen } = useSidebar()\n\n return (\n <div className={cn('mt-4 first:mt-0', className)}>\n {label && isOpen && (\n <div className=\"px-3 mb-2 text-xs font-semibold uppercase tracking-wider text-slate-400\">\n {label}\n </div>\n )}\n {!label && isOpen && <div className=\"border-t border-slate-200 mx-3 mb-2\" />}\n <ul className=\"flex flex-col space-y-1\">\n {children}\n </ul>\n </div>\n )\n}\n\n// ─── SidebarItem ────────────────────────────────────────────────────────────\n\ntype HeroIcon = ComponentType<SVGProps<SVGSVGElement> & { title?: string; titleId?: string }>\n\nexport interface SidebarItemProps {\n /** Menu item label */\n label: string\n /** Heroicon component */\n icon?: HeroIcon\n /** Whether this item is currently active */\n active?: boolean\n /** URL — renders as an anchor. Omit for button behavior. */\n href?: string\n /** Click handler */\n onClick?: (e: MouseEvent) => void\n /** Custom link renderer for framework integration (Next.js Link, React Router, etc.) */\n as?: ComponentType<{ href: string; className: string; title?: string; children: ReactNode }>\n /** Badge count shown to the right of the label */\n badge?: number | string\n className?: string\n}\n\nexport const SidebarItem = ({\n label,\n icon: Icon,\n active = false,\n href,\n onClick,\n as: LinkComponent,\n badge,\n className,\n}: SidebarItemProps) => {\n const { isOpen } = useSidebar()\n\n const itemClasses = cn(\n 'flex items-center rounded-lg transition-all duration-200 cursor-pointer group w-full',\n isOpen ? 'px-3 py-2.5' : 'px-2 py-2.5 justify-center',\n active\n ? 'bg-accent-tint text-accent-tint-dark'\n : 'text-slate-600 hover:bg-slate-200 hover:text-slate-900',\n className\n )\n\n const content = (\n <>\n {Icon && (\n <Icon\n className={cn(\n 'h-5 w-5 flex-shrink-0 transition-colors',\n active ? 'text-primary-500' : 'text-slate-500 group-hover:text-slate-700'\n )}\n />\n )}\n {isOpen && (\n <span\n className={cn(\n 'ml-3 text-sm font-medium truncate',\n active ? 'text-accent-tint-dark' : ''\n )}\n >\n {label}\n </span>\n )}\n {isOpen && badge !== undefined && (\n <span className=\"ml-auto text-xs font-semibold bg-accent-tint text-accent-tint-dark rounded-full px-2 py-0.5\">\n {badge}\n </span>\n )}\n </>\n )\n\n // Use custom link component (e.g. Next.js <Link>)\n if (href && LinkComponent) {\n return (\n <li>\n <LinkComponent href={href} className={itemClasses} title={!isOpen ? label : undefined}>\n {content}\n </LinkComponent>\n </li>\n )\n }\n\n // Plain anchor\n if (href) {\n return (\n <li>\n <a href={href} className={itemClasses} title={!isOpen ? label : undefined} onClick={onClick}>\n {content}\n </a>\n </li>\n )\n }\n\n // Button\n return (\n <li>\n <button\n onClick={onClick}\n className={itemClasses}\n title={!isOpen ? label : undefined}\n >\n {content}\n </button>\n </li>\n )\n}\n\n// ─── SidebarGroup (collapsible sub-menu) ────────────────────────────────────\n\nexport interface SidebarGroupProps {\n /** Group label */\n label: string\n /** Heroicon component */\n icon?: HeroIcon\n /** Whether any child item is active (highlights the group) */\n active?: boolean\n /** Start expanded */\n defaultOpen?: boolean\n children: ReactNode\n className?: string\n}\n\nexport const SidebarGroup = ({\n label,\n icon: Icon,\n active = false,\n defaultOpen = false,\n children,\n className,\n}: SidebarGroupProps) => {\n const { isOpen: sidebarOpen } = useSidebar()\n const [expanded, setExpanded] = useState(defaultOpen)\n\n return (\n <li className={className}>\n <button\n onClick={() => setExpanded(!expanded)}\n className={cn(\n 'flex items-center rounded-lg transition-all duration-200 cursor-pointer group w-full',\n sidebarOpen ? 'px-3 py-2.5' : 'px-2 py-2.5 justify-center',\n active\n ? 'text-accent-tint-dark'\n : 'text-slate-600 hover:bg-slate-200 hover:text-slate-900'\n )}\n title={!sidebarOpen ? label : undefined}\n >\n {Icon && (\n <Icon\n className={cn(\n 'h-5 w-5 flex-shrink-0 transition-colors',\n active ? 'text-primary-500' : 'text-slate-500 group-hover:text-slate-700'\n )}\n />\n )}\n {sidebarOpen && (\n <>\n <span className=\"ml-3 text-sm font-medium truncate\">{label}</span>\n <ChevronRightIcon\n className={cn(\n 'ml-auto h-4 w-4 text-slate-400 transition-transform duration-200',\n expanded && 'rotate-90'\n )}\n />\n </>\n )}\n </button>\n {sidebarOpen && expanded && (\n <ul className=\"mt-1 ml-4 pl-3 border-l border-slate-200 space-y-1\">\n {children}\n </ul>\n )}\n </li>\n )\n}\n\n// ─── SidebarFooter ──────────────────────────────────────────────────────────\n\nexport interface SidebarFooterProps {\n children: ReactNode\n className?: string\n}\n\nexport const SidebarFooter = ({ children, className }: SidebarFooterProps) => (\n <div className={cn('p-3', className)}>\n {children}\n </div>\n)\n\n// ─── SidebarCard ────────────────────────────────────────────────────────────\n\nexport interface SidebarCardProps {\n /** Icon shown in both states */\n icon?: HeroIcon\n /** Title for the card */\n title: string\n /** Description text */\n description?: string\n /** Optional button label */\n buttonLabel?: string\n /** Optional button click handler */\n onAction?: () => void\n /** Custom content (replaces the button when sidebar is open) */\n children?: ReactNode\n className?: string\n}\n\nexport const SidebarCard = ({\n icon: Icon,\n title,\n description,\n buttonLabel,\n onAction,\n children,\n className,\n}: SidebarCardProps) => {\n const { isOpen } = useSidebar()\n\n if (!isOpen) {\n // Collapsed: show icon button if there's an action, otherwise just the icon\n if (onAction) {\n return (\n <button\n onClick={onAction}\n className={cn(\n 'w-full p-2 rounded-lg bg-primary-500 text-white hover:bg-primary-600 transition-colors cursor-pointer flex items-center justify-center',\n className\n )}\n title={title}\n >\n {Icon ? <Icon className=\"h-5 w-5\" /> : <span className=\"text-xs font-bold\">{title.charAt(0)}</span>}\n </button>\n )\n }\n return (\n <div\n className={cn(\n 'w-full p-2 rounded-lg bg-primary-500 text-white flex items-center justify-center',\n className\n )}\n title={title}\n >\n {Icon ? <Icon className=\"h-5 w-5\" /> : <span className=\"text-xs font-bold\">{title.charAt(0)}</span>}\n </div>\n )\n }\n\n const hasBody = children || (buttonLabel && onAction)\n\n return (\n <div className={cn('p-4 rounded-xl bg-gradient-to-br from-primary-500 to-primary-500/80 text-white', className)}>\n <div className={cn('flex items-center gap-2', (description || hasBody) && 'mb-2')}>\n {Icon && <Icon className=\"h-5 w-5\" />}\n <span className=\"font-semibold text-sm\">{title}</span>\n </div>\n {description && (\n <p className={cn('text-xs text-white/90', hasBody && 'mb-3')}>{description}</p>\n )}\n {children ? (\n children\n ) : buttonLabel && onAction ? (\n <button\n onClick={onAction}\n className=\"w-full bg-white text-primary-600 px-3 py-2 rounded-lg font-semibold text-sm hover:bg-white/90 transition-colors cursor-pointer\"\n >\n {buttonLabel}\n </button>\n ) : null}\n </div>\n )\n}\n"],"names":["SidebarContext","createContext","useSidebar","ctx","useContext","Sidebar","children","defaultOpen","open","onOpenChange","inline","className","internalOpen","setInternalOpen","useState","isOpen","setIsOpen","value","toggle","jsx","cn","SidebarHeader","showToggle","jsxs","ChevronLeftIcon","ChevronRightIcon","SidebarNav","SidebarSection","label","SidebarItem","Icon","active","href","onClick","LinkComponent","badge","itemClasses","content","Fragment","SidebarGroup","sidebarOpen","expanded","setExpanded","SidebarFooter","SidebarCard","title","description","buttonLabel","onAction","hasBody"],"mappings":";;;;AAuBA,MAAMA,IAAiBC,EAA0C,IAAI,GAExDC,IAAa,MAAM;AAC9B,QAAMC,IAAMC,EAAWJ,CAAc;AACrC,MAAI,CAACG,EAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAOA;AACT,GAiBaE,IAAU,CAAC;AAAA,EACtB,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC;AACF,MAAoB;AAClB,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAASP,CAAW,GACtDQ,IAASP,MAAS,SAAYA,IAAOI,GAErCI,IAAY,CAACC,MAAmB;AACpC,IAAIR,MAA2BQ,CAAK,MACfA,CAAK;AAAA,EAC5B,GAEMC,IAAS,MAAMF,EAAU,CAACD,CAAM;AAEtC,SACE,gBAAAI,EAACnB,EAAe,UAAf,EAAwB,OAAO,EAAE,QAAAe,GAAQ,WAAAC,GAAW,QAAAE,KACnD,UAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAV,IACI,oBACA;AAAA,QACJK,IAAS,SAAS;AAAA,QAClBJ;AAAA,MAAA;AAAA,MAGF,UAAA,gBAAAQ,EAAC,OAAA,EAAI,WAAU,wBACZ,UAAAb,EAAA,CACH;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,GAWae,IAAgB,CAAC;AAAA,EAC5B,UAAAf;AAAA,EACA,YAAAgB,IAAa;AAAA,EACb,WAAAX;AACF,MAA0B;AACxB,QAAM,EAAE,QAAAI,GAAQ,QAAAG,EAAA,IAAWhB,EAAA;AAE3B,SACE,gBAAAqB;A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AAU;AAAA,QAET,UAAAD;AAAA,MAAA;AAAA,IAAA,IAED;AAAA,EAAA,GACN;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index57.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["import { Fragment } from 'react'\nimport {\n Listbox,\n ListboxButton,\n ListboxOptions,\n ListboxOption,\n Transition,\n} from '@headlessui/react'\nimport { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid'\nimport { cn } from '@/lib/utils'\n\nexport interface SelectOption {\n value: string\n label: string\n disabled?: boolean\n}\n\nexport interface SelectProps {\n options: SelectOption[]\n value?: string\n onChange?: (value: string) => void\n label?: string\n placeholder?: string\n error?: string\n disabled?: boolean\n className?: string\n}\n\nexport function Select({\n options,\n value,\n onChange,\n label,\n placeholder = 'Select an option',\n error,\n disabled,\n className,\n}: SelectProps) {\n const selectedOption = options.find((opt) => opt.value === value)\n\n return (\n <div className={cn('w-full', className)}>\n {label && (\n <label className=\"block text-sm font-medium text-slate-700 mb-1.5\">\n {label}\n </label>\n )}\n <Listbox value={value} onChange={onChange} disabled={disabled}>\n <div className=\"relative\">\n <ListboxButton\n className={cn(\n 'relative w-full py-2.5 pl-4 pr-10 text-left text-base',\n 'bg-white border rounded-lg cursor-pointer',\n 'transition-colors duration-200',\n 'focus:outline-none focus:ring-2 focus:ring-offset-0',\n error\n ? 'border-red-500 focus:border-red-500 focus:ring-red-500'\n : 'border-slate-300 focus:border-primary-500 focus:ring-primary-500',\n disabled && 'bg-slate-50 cursor-not-allowed opacity-50'\n )}\n >\n <span\n className={cn(\n 'block truncate',\n !selectedOption && 'text-slate-400'\n )}\n >\n {selectedOption?.label || placeholder}\n </span>\n <span className=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3\">\n <ChevronUpDownIcon\n className=\"h-5 w-5 text-slate-400\"\n aria-hidden=\"true\"\n />\n </span>\n </ListboxButton>\n <Transition\n as={Fragment}\n leave=\"transition ease-in duration-100\"\n leaveFrom=\"opacity-100\"\n leaveTo=\"opacity-0\"\n >\n <ListboxOptions\n className={cn(\n 'absolute z-10 mt-1 w-full max-h-60 overflow-auto',\n 'bg-white rounded-lg border border-slate-200 shadow-lg',\n 'py-1 text-base',\n 'focus:outline-none'\n )}\n >\n {options.map((option) => (\n <ListboxOption\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className={({ active, selected }) =>\n cn(\n 'relative cursor-pointer select-none py-2.5 pl-10 pr-4',\n 'transition-colors duration-150',\n active && 'bg-primary-50',\n selected && 'bg-primary-50 text-primary-900',\n option.disabled && 'opacity-50 cursor-not-allowed'\n )\n }\n >\n {({ selected }) => (\n <>\n <span\n className={cn(\n 'block truncate',\n selected ? 'font-semibold' : 'font-normal'\n )}\n >\n {option.label}\n </span>\n {selected && (\n <span className=\"absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600\">\n <CheckIcon className=\"h-5 w-5\" aria-hidden=\"true\" />\n </span>\n )}\n </>\n )}\n </ListboxOption>\n ))}\n </ListboxOptions>\n </Transition>\n </div>\n </Listbox>\n {error && <p className=\"mt-1.5 text-sm text-red-600\">{error}</p>}\n </div>\n )\n}\n"],"names":["Select","options","value","onChange","label","placeholder","error","disabled","className","selectedOption","opt","cn","jsx","Listbox","jsxs","ListboxButton","ChevronUpDownIcon","Transition","Fragment","ListboxOptions","option","ListboxOption","active","selected","CheckIcon"],"mappings":";;;;;AA4BO,SAASA,EAAO;AAAA,EACrB,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,GAAgB;AACd,QAAMC,IAAiBR,EAAQ,KAAK,CAACS,MAAQA,EAAI,UAAUR,CAAK;AAEhE,2BACG,OAAA,EAAI,WAAWS,EAAG,UAAUH,CAAS,GACnC,UAAA;AAAA,IAAAJ,KACC,gBAAAQ,EAAC,SAAA,EAAM,WAAU,mDACd,UAAAR,G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