@pibit.ai/cure-design-system 0.6.17 → 0.6.19
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/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +236 -226
- package/dist/patterns/alert/alert.d.ts +39 -0
- package/dist/patterns/alert/alert.d.ts.map +1 -0
- package/dist/patterns/alert/alert.js +80 -0
- package/dist/patterns/alert/index.d.ts +2 -0
- package/dist/patterns/alert/index.d.ts.map +1 -0
- package/dist/patterns/breadcrumbs/breadcrumb-item.d.ts +16 -0
- package/dist/patterns/breadcrumbs/breadcrumb-item.d.ts.map +1 -0
- package/dist/patterns/breadcrumbs/breadcrumb-item.js +120 -0
- package/dist/patterns/breadcrumbs/breadcrumbs.d.ts +20 -0
- package/dist/patterns/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/patterns/breadcrumbs/breadcrumbs.js +41 -0
- package/dist/patterns/breadcrumbs/context.d.ts +6 -0
- package/dist/patterns/breadcrumbs/context.d.ts.map +1 -0
- package/dist/patterns/breadcrumbs/context.js +8 -0
- package/dist/patterns/breadcrumbs/index.d.ts +4 -0
- package/dist/patterns/breadcrumbs/index.d.ts.map +1 -0
- package/dist/patterns/page-header/index.d.ts +2 -0
- package/dist/patterns/page-header/index.d.ts.map +1 -0
- package/dist/patterns/page-header/page-header.d.ts +18 -0
- package/dist/patterns/page-header/page-header.d.ts.map +1 -0
- package/dist/patterns/page-header/page-header.js +52 -0
- package/dist/patterns/sub-sidebar/index.d.ts +3 -0
- package/dist/patterns/sub-sidebar/index.d.ts.map +1 -0
- package/dist/patterns/sub-sidebar/sub-sidebar.d.ts +16 -0
- package/dist/patterns/sub-sidebar/sub-sidebar.d.ts.map +1 -0
- package/dist/patterns/sub-sidebar/sub-sidebar.js +283 -0
- package/dist/patterns/sub-sidebar/types.d.ts +47 -0
- package/dist/patterns/sub-sidebar/types.d.ts.map +1 -0
- package/dist/primitives/close-button/close-button.d.ts +8 -0
- package/dist/primitives/close-button/close-button.d.ts.map +1 -0
- package/dist/primitives/close-button/close-button.js +29 -0
- package/dist/primitives/close-button/index.d.ts +2 -0
- package/dist/primitives/close-button/index.d.ts.map +1 -0
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { jsxs as o, jsx as r, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useEffect as z, Fragment as m } from "react";
|
|
3
|
+
import { Minus as F, Plus as I } from "@untitledui/icons";
|
|
4
|
+
import { CollapseLeft as D } from "../../primitives/custom-icon/icons/collapse-left.js";
|
|
5
|
+
import { CollapseRight as H } from "../../primitives/custom-icon/icons/collapse-right.js";
|
|
6
|
+
import { cx as n } from "../../utils/cn.js";
|
|
7
|
+
import { ButtonUtility as K } from "../../primitives/button/button-utility.js";
|
|
8
|
+
const q = ({
|
|
9
|
+
href: i,
|
|
10
|
+
className: c,
|
|
11
|
+
children: p
|
|
12
|
+
}) => /* @__PURE__ */ r("a", { href: i, className: c, children: p }), B = (i, c) => c, W = ({
|
|
13
|
+
config: i,
|
|
14
|
+
currentPath: c,
|
|
15
|
+
isCollapsed: p,
|
|
16
|
+
onCollapsedChange: k,
|
|
17
|
+
renderLink: x = q,
|
|
18
|
+
guard: h = B,
|
|
19
|
+
className: C
|
|
20
|
+
}) => {
|
|
21
|
+
const [E, b] = A(/* @__PURE__ */ new Set()), y = (a) => c === a || c.startsWith(a + "/"), u = (a) => a.map((t) => t.href).filter((t) => !!t).filter(y).sort((t, l) => l.length - t.length)[0] ?? null, w = () => {
|
|
22
|
+
var e;
|
|
23
|
+
const a = !p;
|
|
24
|
+
k(a), (e = i.onToggleCollapse) == null || e.call(i, a);
|
|
25
|
+
};
|
|
26
|
+
z(() => {
|
|
27
|
+
const a = /* @__PURE__ */ new Set();
|
|
28
|
+
i.sections.forEach((e) => {
|
|
29
|
+
e.items.forEach((t) => {
|
|
30
|
+
var l;
|
|
31
|
+
if ((l = t.items) != null && l.length && u(t.items) !== null) {
|
|
32
|
+
const d = t.href || t.label;
|
|
33
|
+
a.add(d);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}), b((e) => {
|
|
37
|
+
const t = new Set(e);
|
|
38
|
+
return a.forEach((l) => t.add(l)), t;
|
|
39
|
+
});
|
|
40
|
+
}, [c, i.sections]);
|
|
41
|
+
const f = (a) => {
|
|
42
|
+
const e = a.href || a.label;
|
|
43
|
+
b((t) => {
|
|
44
|
+
const l = new Set(t);
|
|
45
|
+
return l.has(e) ? l.delete(e) : l.add(e), l;
|
|
46
|
+
});
|
|
47
|
+
}, v = (a) => {
|
|
48
|
+
var e;
|
|
49
|
+
return (e = a.items) != null && e.length && u(a.items) !== null ? !0 : a.href ? y(a.href) : !1;
|
|
50
|
+
}, j = (a, e) => u(e) === a;
|
|
51
|
+
return /* @__PURE__ */ o(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: n(
|
|
55
|
+
"h-full flex-shrink-0 bg-white border-r border-[#EDEFF4] relative transition-all duration-300 ease-in-out",
|
|
56
|
+
p ? "w-0 border-r-0" : i.width || "w-[296px]",
|
|
57
|
+
C
|
|
58
|
+
),
|
|
59
|
+
children: [
|
|
60
|
+
i.collapsible !== !1 && p && /* @__PURE__ */ r(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
onClick: w,
|
|
64
|
+
className: "absolute -right-5 top-5 z-20 flex h-6 w-6 items-center justify-center transition-all duration-300 cursor-pointer",
|
|
65
|
+
"aria-label": "Expand sidebar",
|
|
66
|
+
children: /* @__PURE__ */ r(
|
|
67
|
+
H,
|
|
68
|
+
{
|
|
69
|
+
color: "var(--color-fg-quaternary)",
|
|
70
|
+
className: "h-4 w-4 text-gray-400 hover:text-gray-600"
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ o(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: n(
|
|
79
|
+
"pl-4 h-full flex flex-col overflow-hidden transition-opacity duration-300",
|
|
80
|
+
p ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
81
|
+
),
|
|
82
|
+
children: [
|
|
83
|
+
i.title && /* @__PURE__ */ o("div", { className: "pt-6 pb-4 relative flex-shrink-0 flex items-center justify-between", children: [
|
|
84
|
+
/* @__PURE__ */ r("h2", { className: "pl-1.5 text-primary font-semibold text-md leading-7 whitespace-nowrap", children: i.title }),
|
|
85
|
+
i.collapsible !== !1 && /* @__PURE__ */ r(
|
|
86
|
+
"button",
|
|
87
|
+
{
|
|
88
|
+
onClick: w,
|
|
89
|
+
className: "flex h-5 w-5 items-center justify-center transition-all duration-300 hover:scale-110 cursor-pointer",
|
|
90
|
+
"aria-label": "Collapse sidebar",
|
|
91
|
+
children: /* @__PURE__ */ r(
|
|
92
|
+
D,
|
|
93
|
+
{
|
|
94
|
+
color: "var(--color-fg-quaternary)",
|
|
95
|
+
className: "h-4 w-4 text-gray-400 hover:text-gray-600"
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ r("nav", { className: "flex-1 pb-4 pr-2 overflow-y-auto overflow-x-hidden", children: i.sections.map((a) => /* @__PURE__ */ r(m, { children: h(
|
|
102
|
+
(a == null ? void 0 : a.permissions) || [],
|
|
103
|
+
/* @__PURE__ */ o("div", { className: n("mb-6"), children: [
|
|
104
|
+
/* @__PURE__ */ r("div", { className: "py-0.5 px-2", children: /* @__PURE__ */ r("p", { className: "font-medium text-[10px] text-[var(--color-text-tertiary)] uppercase tracking-[1.3px] whitespace-nowrap", children: a.label }) }),
|
|
105
|
+
/* @__PURE__ */ r("ul", { className: "space-y-1", children: a.items.map((e) => {
|
|
106
|
+
const t = e.href || e.label, l = E.has(t), N = e.items && e.items.length > 0, d = v(e);
|
|
107
|
+
return N ? /* @__PURE__ */ r(m, { children: h(
|
|
108
|
+
e.permissions || [],
|
|
109
|
+
/* @__PURE__ */ o(
|
|
110
|
+
"li",
|
|
111
|
+
{
|
|
112
|
+
className: n(
|
|
113
|
+
e.disabled && "opacity-30 cursor-not-allowed",
|
|
114
|
+
"text-xs"
|
|
115
|
+
),
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ o(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
className: n(
|
|
121
|
+
"flex items-center justify-between px-1 py-2 rounded-md transition-colors cursor-pointer",
|
|
122
|
+
d ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
|
|
123
|
+
e.disabled ? "cursor-not-allowed" : ""
|
|
124
|
+
),
|
|
125
|
+
role: "button",
|
|
126
|
+
tabIndex: e.disabled ? -1 : 0,
|
|
127
|
+
"aria-expanded": l,
|
|
128
|
+
"aria-disabled": e.disabled || void 0,
|
|
129
|
+
onClick: (s) => {
|
|
130
|
+
s.stopPropagation(), !e.disabled && f(e);
|
|
131
|
+
},
|
|
132
|
+
onKeyDown: (s) => {
|
|
133
|
+
if (s.key === "Enter" || s.key === " ") {
|
|
134
|
+
if (s.stopPropagation(), e.disabled) return;
|
|
135
|
+
f(e);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ r("span", { className: "whitespace-nowrap text-primary font-medium", children: e.label }),
|
|
140
|
+
/* @__PURE__ */ r(
|
|
141
|
+
K,
|
|
142
|
+
{
|
|
143
|
+
onClick: (s) => {
|
|
144
|
+
s.stopPropagation(), !e.disabled && f(e);
|
|
145
|
+
},
|
|
146
|
+
className: n(
|
|
147
|
+
"rounded-md bg-secondary",
|
|
148
|
+
e.disabled ? "cursor-not-allowed" : ""
|
|
149
|
+
),
|
|
150
|
+
size: "xs",
|
|
151
|
+
icon: l ? /* @__PURE__ */ r(F, { size: 12 }) : /* @__PURE__ */ r(I, { size: 12 })
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
l && h(
|
|
158
|
+
e.permissions || [],
|
|
159
|
+
/* @__PURE__ */ o("ul", { className: "mt-0.5 ml-4 space-y-0.5 relative", children: [
|
|
160
|
+
/* @__PURE__ */ r("div", { className: "absolute left-2 top-[15px] bottom-[15px] w-px bg-[var(--color-utility-gray-200)]" }),
|
|
161
|
+
e.items.map((s) => {
|
|
162
|
+
const g = j(
|
|
163
|
+
s.href,
|
|
164
|
+
e.items
|
|
165
|
+
);
|
|
166
|
+
return /* @__PURE__ */ r(m, { children: h(
|
|
167
|
+
s.permissions || [],
|
|
168
|
+
/* @__PURE__ */ r("li", { className: "relative", children: x({
|
|
169
|
+
href: s.href,
|
|
170
|
+
className: n(
|
|
171
|
+
"flex items-center pl-6 pr-2 py-2 rounded-md transition-colors relative",
|
|
172
|
+
g ? "text-primary font-medium" : "text-primary hover:bg-active"
|
|
173
|
+
),
|
|
174
|
+
children: /* @__PURE__ */ o(S, { children: [
|
|
175
|
+
/* @__PURE__ */ r(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: n(
|
|
179
|
+
"absolute left-1.5 top-1/2 -translate-y-1/2 w-1.5 h-1.5 rounded-full z-10",
|
|
180
|
+
g ? "bg-[var(--color-fg-primary)]" : "bg-[var(--color-utility-gray-200)]"
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ r("span", { className: "whitespace-nowrap", children: s.label })
|
|
185
|
+
] })
|
|
186
|
+
}) }),
|
|
187
|
+
null
|
|
188
|
+
) }, s.href);
|
|
189
|
+
})
|
|
190
|
+
] }),
|
|
191
|
+
null
|
|
192
|
+
)
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
null
|
|
197
|
+
) }, t) : /* @__PURE__ */ r(m, { children: h(
|
|
198
|
+
e.permissions || [],
|
|
199
|
+
/* @__PURE__ */ r(
|
|
200
|
+
"li",
|
|
201
|
+
{
|
|
202
|
+
className: n(
|
|
203
|
+
e.disabled && "opacity-30 cursor-not-allowed",
|
|
204
|
+
"text-xs"
|
|
205
|
+
),
|
|
206
|
+
children: e.href ? e.disabled ? /* @__PURE__ */ r(
|
|
207
|
+
"span",
|
|
208
|
+
{
|
|
209
|
+
className: n(
|
|
210
|
+
"flex items-center justify-between px-2 py-2 rounded-md transition-colors cursor-not-allowed",
|
|
211
|
+
d ? "bg-active text-primary" : "text-primary"
|
|
212
|
+
),
|
|
213
|
+
"aria-disabled": "true",
|
|
214
|
+
children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap font-medium", children: e.label })
|
|
215
|
+
}
|
|
216
|
+
) : x({
|
|
217
|
+
href: e.href,
|
|
218
|
+
className: n(
|
|
219
|
+
"flex items-center justify-between px-2 py-2 rounded-md transition-colors",
|
|
220
|
+
d ? "bg-active text-primary" : "text-primary hover:bg-active",
|
|
221
|
+
e.disabled ? "opacity-30 cursor-not-allowed" : ""
|
|
222
|
+
),
|
|
223
|
+
children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap font-medium", children: e.label })
|
|
224
|
+
}) : /* @__PURE__ */ r(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
onClick: () => {
|
|
228
|
+
var s;
|
|
229
|
+
return !e.disabled && ((s = e.onClick) == null ? void 0 : s.call(e));
|
|
230
|
+
},
|
|
231
|
+
className: n(
|
|
232
|
+
"w-full flex items-center justify-between px-2 py-2 rounded-md text-sm transition-colors cursor-pointer",
|
|
233
|
+
d ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
|
|
234
|
+
e.disabled ? "opacity-30 cursor-not-allowed" : ""
|
|
235
|
+
),
|
|
236
|
+
children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap", children: e.label })
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
e.showDisabled ? /* @__PURE__ */ r(
|
|
242
|
+
"span",
|
|
243
|
+
{
|
|
244
|
+
className: n(
|
|
245
|
+
"flex items-center justify-between opacity-30 px-2 py-2 rounded-md transition-colors cursor-not-allowed text-xs whitespace-nowrap font-medium",
|
|
246
|
+
d ? "bg-active text-primary" : "text-primary"
|
|
247
|
+
),
|
|
248
|
+
"aria-disabled": "true",
|
|
249
|
+
children: e.label
|
|
250
|
+
}
|
|
251
|
+
) : null
|
|
252
|
+
) }, t);
|
|
253
|
+
}) })
|
|
254
|
+
] }),
|
|
255
|
+
a.showDisabled ? /* @__PURE__ */ o("div", { className: n("mb-6"), children: [
|
|
256
|
+
/* @__PURE__ */ r("div", { className: "py-0.5 px-2", children: /* @__PURE__ */ r("p", { className: "font-medium text-[10px] text-[var(--color-text-tertiary)] uppercase tracking-[1.3px] whitespace-nowrap", children: a.label }) }),
|
|
257
|
+
/* @__PURE__ */ r("ul", { className: "", children: a.items.map((e) => {
|
|
258
|
+
const t = e.href || e.label, l = v(e);
|
|
259
|
+
return /* @__PURE__ */ r(
|
|
260
|
+
"span",
|
|
261
|
+
{
|
|
262
|
+
className: n(
|
|
263
|
+
"flex items-center justify-between opacity-30 px-2 py-2 rounded-md transition-colors cursor-not-allowed text-xs whitespace-nowrap font-medium",
|
|
264
|
+
l ? "bg-active text-primary" : "text-primary"
|
|
265
|
+
),
|
|
266
|
+
"aria-disabled": "true",
|
|
267
|
+
children: e.label
|
|
268
|
+
},
|
|
269
|
+
t
|
|
270
|
+
);
|
|
271
|
+
}) })
|
|
272
|
+
] }) : null
|
|
273
|
+
) }, a.id)) })
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
export {
|
|
282
|
+
W as SubSidebar
|
|
283
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SubSidebarItem {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
/** Child links, shown in a collapsible group under the item. */
|
|
6
|
+
items?: SubSidebarChildItem[];
|
|
7
|
+
/** For an item without `href`. */
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Passed to `guard`. */
|
|
11
|
+
permissions?: string[];
|
|
12
|
+
/** When `guard` denies the item, show it greyed out instead of hiding it. */
|
|
13
|
+
showDisabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SubSidebarChildItem {
|
|
16
|
+
label: string;
|
|
17
|
+
href: string;
|
|
18
|
+
permissions?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface SubSidebarSection {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
items: SubSidebarItem[];
|
|
24
|
+
permissions?: string[];
|
|
25
|
+
/** When `guard` denies the section, show its items greyed out instead of hiding it. */
|
|
26
|
+
showDisabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface SubSidebarConfig {
|
|
29
|
+
title?: string;
|
|
30
|
+
sections: SubSidebarSection[];
|
|
31
|
+
/** A width class for the expanded sidebar. Default `w-[296px]`. */
|
|
32
|
+
width?: string;
|
|
33
|
+
/** Default true: the title row gets a collapse button, and the collapsed sidebar an expand button. */
|
|
34
|
+
collapsible?: boolean;
|
|
35
|
+
onToggleCollapse?: (collapsed: boolean) => void;
|
|
36
|
+
}
|
|
37
|
+
export interface SubSidebarLinkProps {
|
|
38
|
+
href: string;
|
|
39
|
+
className: string;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Decides whether `content` renders for `permissions`, returning `fallback` (or nothing) when it doesn't. An empty
|
|
44
|
+
* `permissions` array means no restriction.
|
|
45
|
+
*/
|
|
46
|
+
export type SubSidebarGuard = (permissions: string[], content: ReactNode, fallback: ReactNode) => ReactNode;
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/patterns/sub-sidebar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC9B,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,uFAAuF;IACvF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sGAAsG;IACtG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,SAAS,KAChB,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ButtonProps as AriaButtonProps } from 'react-aria-components';
|
|
2
|
+
export interface CloseButtonProps extends AriaButtonProps {
|
|
3
|
+
theme?: "light" | "dark";
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CloseButton: ({ label, className, size, theme, ...otherProps }: CloseButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=close-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close-button.d.ts","sourceRoot":"","sources":["../../../src/primitives/close-button/close-button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAmBlG,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,GAAI,kDAAmE,gBAAgB,4CAiB9G,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { X as f } from "@untitledui/icons";
|
|
3
|
+
import { Button as c } from "react-aria-components";
|
|
4
|
+
import { cx as t } from "../../utils/cn.js";
|
|
5
|
+
const r = {
|
|
6
|
+
xs: { root: "size-7", icon: "size-4" },
|
|
7
|
+
sm: { root: "size-9", icon: "size-5" },
|
|
8
|
+
md: { root: "size-10", icon: "size-5" },
|
|
9
|
+
lg: { root: "size-11", icon: "size-6" }
|
|
10
|
+
}, a = {
|
|
11
|
+
light: "text-fg-quaternary hover:bg-primary_hover hover:text-fg-quaternary_hover focus-visible:outline-2 focus-visible:outline-offset-2 outline-focus-ring",
|
|
12
|
+
dark: "text-fg-white/70 hover:text-fg-white hover:bg-white/20 focus-visible:outline-2 focus-visible:outline-offset-2 outline-focus-ring"
|
|
13
|
+
}, v = ({ label: n, className: o, size: e = "sm", theme: s = "light", ...u }) => /* @__PURE__ */ i(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
...u,
|
|
17
|
+
"aria-label": n || "Close",
|
|
18
|
+
className: (l) => t(
|
|
19
|
+
"flex cursor-pointer items-center justify-center rounded-lg p-2 transition duration-100 ease-linear focus:outline-hidden",
|
|
20
|
+
r[e].root,
|
|
21
|
+
a[s],
|
|
22
|
+
typeof o == "function" ? o(l) : o
|
|
23
|
+
),
|
|
24
|
+
children: /* @__PURE__ */ i(f, { "aria-hidden": "true", className: t("shrink-0 transition-inherit-all", r[e].icon) })
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
v as CloseButton
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/close-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|