@la-batcave/ui 3.1.2
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 +95 -0
- package/dist/Alert.d.ts +27 -0
- package/dist/Alert.js +56 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +40 -0
- package/dist/Badge.d.ts +56 -0
- package/dist/Badge.js +74 -0
- package/dist/Button.d.ts +53 -0
- package/dist/Button.js +66 -0
- package/dist/Card.d.ts +18 -0
- package/dist/Card.js +98 -0
- package/dist/CodeBlock.d.ts +45 -0
- package/dist/CodeBlock.js +306 -0
- package/dist/Collapse.d.ts +58 -0
- package/dist/Collapse.js +89 -0
- package/dist/Combobox.d.ts +44 -0
- package/dist/Combobox.js +409 -0
- package/dist/DarkMode.d.ts +59 -0
- package/dist/DarkMode.js +56 -0
- package/dist/DatePicker.d.ts +48 -0
- package/dist/DatePicker.js +2954 -0
- package/dist/Dialog.d.ts +119 -0
- package/dist/Dialog.js +337 -0
- package/dist/Drawer.d.ts +28 -0
- package/dist/Drawer.js +1126 -0
- package/dist/Dropdown.d.ts +23 -0
- package/dist/Dropdown.js +247 -0
- package/dist/EasyForm.d.ts +138 -0
- package/dist/EasyForm.js +286 -0
- package/dist/HoverCard.d.ts +10 -0
- package/dist/HoverCard.js +195 -0
- package/dist/Input.d.ts +230 -0
- package/dist/Input.js +2216 -0
- package/dist/LogViewer.d.ts +57 -0
- package/dist/LogViewer.js +120 -0
- package/dist/Menubar.d.ts +32 -0
- package/dist/Menubar.js +398 -0
- package/dist/Navbar.d.ts +20 -0
- package/dist/Navbar.js +31 -0
- package/dist/Pagination.d.ts +78 -0
- package/dist/Pagination.js +106 -0
- package/dist/Popover.d.ts +11 -0
- package/dist/Popover.js +28 -0
- package/dist/ProgressBar.d.ts +35 -0
- package/dist/ProgressBar.js +210 -0
- package/dist/Resizable.d.ts +23 -0
- package/dist/Resizable.js +1532 -0
- package/dist/Separator.d.ts +4 -0
- package/dist/Separator.js +46 -0
- package/dist/Sheet.d.ts +29 -0
- package/dist/Sheet.js +104 -0
- package/dist/Sidebar.d.ts +117 -0
- package/dist/Sidebar.js +237 -0
- package/dist/Skeleton.d.ts +57 -0
- package/dist/Skeleton.js +47 -0
- package/dist/Table.d.ts +71 -0
- package/dist/Table.js +94 -0
- package/dist/Tabs.d.ts +76 -0
- package/dist/Tabs.js +202 -0
- package/dist/Toast.d.ts +54 -0
- package/dist/Toast.js +827 -0
- package/dist/Tooltip.d.ts +29 -0
- package/dist/Tooltip.js +352 -0
- package/dist/Typography.d.ts +101 -0
- package/dist/Typography.js +123 -0
- package/dist/Widget.d.ts +133 -0
- package/dist/Widget.js +207 -0
- package/dist/_shared/Combination-D_l4PLF_.js +676 -0
- package/dist/_shared/index-B03TCNO5.js +142 -0
- package/dist/_shared/index-B1f-hyuh.js +31 -0
- package/dist/_shared/index-BC7vfx-u.js +13 -0
- package/dist/_shared/index-BrLJJgkl.js +67 -0
- package/dist/_shared/index-C0gNQvxa.js +269 -0
- package/dist/_shared/index-C3aZemLI.js +268 -0
- package/dist/_shared/index-CXeb1OMI.js +198 -0
- package/dist/_shared/index-CukUn3R0.js +626 -0
- package/dist/_shared/index-DLcqcWxM.js +29 -0
- package/dist/_shared/index-DlSuDb9N.js +283 -0
- package/dist/_shared/index-V-Ajw7Ac.js +79 -0
- package/dist/_shared/index-uPOYJZpG.js +34 -0
- package/dist/_shared/index-uu9PT5Nu.js +1588 -0
- package/dist/_shared/utils-eGXXUFl7.js +2935 -0
- package/dist/backgrounds/Aurora.d.ts +7 -0
- package/dist/backgrounds/Aurora.js +126 -0
- package/dist/backgrounds/Iridescence.d.ts +7 -0
- package/dist/backgrounds/Iridescence.js +77 -0
- package/dist/backgrounds/Lightning.d.ts +8 -0
- package/dist/backgrounds/Lightning.js +75 -0
- package/dist/backgrounds/LiquidChrome.d.ts +9 -0
- package/dist/backgrounds/LiquidChrome.js +89 -0
- package/dist/backgrounds/Particles.d.ts +15 -0
- package/dist/backgrounds/Particles.js +137 -0
- package/dist/backgrounds/PixelSnow.d.ts +9 -0
- package/dist/backgrounds/PixelSnow.js +52 -0
- package/dist/backgrounds/Silk.d.ts +8 -0
- package/dist/backgrounds/Silk.js +92 -0
- package/dist/backgrounds/Squares.d.ts +9 -0
- package/dist/backgrounds/Squares.js +75 -0
- package/dist/backgrounds/Threads.d.ts +7 -0
- package/dist/backgrounds/Threads.js +110 -0
- package/dist/backgrounds/Waves.d.ts +14 -0
- package/dist/backgrounds/Waves.js +139 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +318 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as h, Fragment as C, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { useState as v, useCallback as w } from "react";
|
|
4
|
+
import { c as y } from "./_shared/utils-eGXXUFl7.js";
|
|
5
|
+
import { Card as S } from "./Card.js";
|
|
6
|
+
import { File as j, Check as k, Copy as N } from "lucide-react";
|
|
7
|
+
const x = {
|
|
8
|
+
js: [
|
|
9
|
+
{ pattern: /(\/\/.*$)/gm, type: "comment" },
|
|
10
|
+
{ pattern: /(\/\*[\s\S]*?\*\/)/gm, type: "comment" },
|
|
11
|
+
{ pattern: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)/g, type: "string" },
|
|
12
|
+
{ pattern: /\b(\d+(?:\.\d+)?)\b/g, type: "number" },
|
|
13
|
+
{ pattern: /\b(const|let|var|function|return|if|else|for|while|do|switch|case|break|continue|new|delete|typeof|instanceof|in|of|class|extends|super|import|export|from|default|async|await|try|catch|finally|throw|yield|this|null|undefined|true|false|void)\b/g, type: "keyword" },
|
|
14
|
+
{ pattern: /\b(console|window|document|Array|Object|String|Number|Boolean|Promise|Map|Set|RegExp|Error|JSON|Math)\b/g, type: "builtin" },
|
|
15
|
+
{ pattern: /([a-zA-Z_$][\w$]*)\s*(?=\()/g, type: "function" },
|
|
16
|
+
{ pattern: /(<\/?)([a-zA-Z][\w.]*)/g, type: "tag" }
|
|
17
|
+
],
|
|
18
|
+
jsx: "js",
|
|
19
|
+
ts: "js",
|
|
20
|
+
tsx: "js",
|
|
21
|
+
typescript: "js",
|
|
22
|
+
javascript: "js",
|
|
23
|
+
css: [
|
|
24
|
+
{ pattern: /(\/\*[\s\S]*?\*\/)/gm, type: "comment" },
|
|
25
|
+
{ pattern: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, type: "string" },
|
|
26
|
+
{ pattern: /(\d+(?:\.\d+)?(?:px|em|rem|%|vh|vw|ch|ex|deg|s|ms)?)\b/g, type: "number" },
|
|
27
|
+
{ pattern: /([@#.:][\w-]+)/g, type: "selector" },
|
|
28
|
+
{ pattern: /\b(var|calc|rgb|rgba|hsl|hsla|url|linear-gradient|radial-gradient)\b/g, type: "builtin" },
|
|
29
|
+
{ pattern: /(--[\w-]+)/g, type: "property" },
|
|
30
|
+
{ pattern: /\b(!important)\b/g, type: "keyword" }
|
|
31
|
+
],
|
|
32
|
+
html: [
|
|
33
|
+
{ pattern: /(<!--[\s\S]*?-->)/g, type: "comment" },
|
|
34
|
+
{ pattern: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, type: "string" },
|
|
35
|
+
{ pattern: /(<\/?)(\w[\w-]*)/g, type: "tag" },
|
|
36
|
+
{ pattern: /([\w-]+)(?==)/g, type: "property" }
|
|
37
|
+
],
|
|
38
|
+
json: [
|
|
39
|
+
{ pattern: /("(?:[^"\\]|\\.)*")\s*:/g, type: "property" },
|
|
40
|
+
{ pattern: /:\s*("(?:[^"\\]|\\.)*")/g, type: "string" },
|
|
41
|
+
{ pattern: /\b(\d+(?:\.\d+)?)\b/g, type: "number" },
|
|
42
|
+
{ pattern: /\b(true|false|null)\b/g, type: "keyword" }
|
|
43
|
+
],
|
|
44
|
+
bash: [
|
|
45
|
+
{ pattern: /(#.*$)/gm, type: "comment" },
|
|
46
|
+
{ pattern: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, type: "string" },
|
|
47
|
+
{ pattern: /\b(if|then|else|elif|fi|for|while|do|done|case|esac|function|return|in|select|until|export|source|alias|unalias|readonly)\b/g, type: "keyword" },
|
|
48
|
+
{ pattern: /(\$[\w{][\w}]*)/g, type: "builtin" },
|
|
49
|
+
{ pattern: /^(\s*[\w.-]+)/gm, type: "function" }
|
|
50
|
+
],
|
|
51
|
+
sh: "bash",
|
|
52
|
+
shell: "bash",
|
|
53
|
+
python: [
|
|
54
|
+
{ pattern: /(#.*$)/gm, type: "comment" },
|
|
55
|
+
{ pattern: /("""[\s\S]*?"""|'''[\s\S]*?''')/g, type: "string" },
|
|
56
|
+
{ pattern: /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, type: "string" },
|
|
57
|
+
{ pattern: /\b(\d+(?:\.\d+)?)\b/g, type: "number" },
|
|
58
|
+
{ pattern: /\b(def|class|if|elif|else|for|while|return|import|from|as|try|except|finally|raise|with|yield|lambda|pass|break|continue|and|or|not|is|in|True|False|None|self|async|await)\b/g, type: "keyword" },
|
|
59
|
+
{ pattern: /\b(print|len|range|type|int|str|float|list|dict|set|tuple|bool|input|open|super|isinstance|hasattr|getattr|setattr)\b/g, type: "builtin" },
|
|
60
|
+
{ pattern: /([a-zA-Z_]\w*)\s*(?=\()/g, type: "function" }
|
|
61
|
+
],
|
|
62
|
+
py: "python"
|
|
63
|
+
}, T = {
|
|
64
|
+
comment: "var(--codeblock-comment, var(--muted-foreground))",
|
|
65
|
+
string: "var(--codeblock-string, var(--success))",
|
|
66
|
+
number: "var(--codeblock-number, var(--info))",
|
|
67
|
+
keyword: "var(--codeblock-keyword, var(--primary))",
|
|
68
|
+
builtin: "var(--codeblock-builtin, var(--warning))",
|
|
69
|
+
function: "var(--codeblock-function, var(--info))",
|
|
70
|
+
tag: "var(--codeblock-tag, var(--destructive))",
|
|
71
|
+
selector: "var(--codeblock-selector, var(--primary))",
|
|
72
|
+
property: "var(--codeblock-property, var(--foreground))"
|
|
73
|
+
};
|
|
74
|
+
function L(a) {
|
|
75
|
+
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
76
|
+
}
|
|
77
|
+
function $(a) {
|
|
78
|
+
let n = x[a];
|
|
79
|
+
for (; typeof n == "string"; )
|
|
80
|
+
n = x[n];
|
|
81
|
+
return n || null;
|
|
82
|
+
}
|
|
83
|
+
function E(a, n) {
|
|
84
|
+
const r = L(a);
|
|
85
|
+
if (!n) return r;
|
|
86
|
+
const i = $(n);
|
|
87
|
+
if (!i) return r;
|
|
88
|
+
const p = [];
|
|
89
|
+
for (const t of i) {
|
|
90
|
+
const m = new RegExp(t.pattern.source, t.pattern.flags);
|
|
91
|
+
let u;
|
|
92
|
+
for (; (u = m.exec(r)) !== null; ) {
|
|
93
|
+
const e = u.length > 1 ? 1 : 0, g = u[e], f = u.index + (e > 0 ? u[0].indexOf(g) : 0);
|
|
94
|
+
p.push({
|
|
95
|
+
start: f,
|
|
96
|
+
end: f + g.length,
|
|
97
|
+
text: g,
|
|
98
|
+
type: t.type
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
p.sort((t, m) => t.start - m.start || m.end - t.end);
|
|
103
|
+
const o = [];
|
|
104
|
+
let d = 0;
|
|
105
|
+
for (const t of p)
|
|
106
|
+
t.start >= d && (o.push(t), d = t.end);
|
|
107
|
+
let c = "", l = 0;
|
|
108
|
+
for (const t of o)
|
|
109
|
+
t.start > l && (c += r.slice(l, t.start)), c += `<span style="color:${T[t.type]}">${t.text}</span>`, l = t.end;
|
|
110
|
+
return l < r.length && (c += r.slice(l)), c;
|
|
111
|
+
}
|
|
112
|
+
const z = {
|
|
113
|
+
js: "JavaScript",
|
|
114
|
+
jsx: "JSX",
|
|
115
|
+
ts: "TypeScript",
|
|
116
|
+
tsx: "TSX",
|
|
117
|
+
javascript: "JavaScript",
|
|
118
|
+
typescript: "TypeScript",
|
|
119
|
+
css: "CSS",
|
|
120
|
+
html: "HTML",
|
|
121
|
+
json: "JSON",
|
|
122
|
+
bash: "Bash",
|
|
123
|
+
sh: "Shell",
|
|
124
|
+
shell: "Shell",
|
|
125
|
+
python: "Python",
|
|
126
|
+
py: "Python"
|
|
127
|
+
};
|
|
128
|
+
function O({ text: a, className: n }) {
|
|
129
|
+
const [r, i] = v(!1), p = w(async () => {
|
|
130
|
+
try {
|
|
131
|
+
await navigator.clipboard.writeText(a), i(!0), setTimeout(() => i(!1), 2e3);
|
|
132
|
+
} catch {
|
|
133
|
+
const o = document.createElement("textarea");
|
|
134
|
+
o.value = a, o.style.position = "fixed", o.style.opacity = "0", document.body.appendChild(o), o.select(), document.execCommand("copy"), document.body.removeChild(o), i(!0), setTimeout(() => i(!1), 2e3);
|
|
135
|
+
}
|
|
136
|
+
}, [a]);
|
|
137
|
+
return /* @__PURE__ */ s(
|
|
138
|
+
"button",
|
|
139
|
+
{
|
|
140
|
+
onClick: p,
|
|
141
|
+
className: y(
|
|
142
|
+
"inline-flex items-center justify-center rounded-md p-1.5",
|
|
143
|
+
"text-muted-foreground hover:text-foreground",
|
|
144
|
+
"bg-transparent hover:bg-secondary",
|
|
145
|
+
"transition-all duration-150",
|
|
146
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
147
|
+
n
|
|
148
|
+
),
|
|
149
|
+
"aria-label": r ? "Copied" : "Copy code",
|
|
150
|
+
children: r ? /* @__PURE__ */ s(k, { className: "size-3.5 text-success" }) : /* @__PURE__ */ s(N, { className: "size-3.5" })
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function A({
|
|
155
|
+
number: a,
|
|
156
|
+
content: n,
|
|
157
|
+
rawText: r,
|
|
158
|
+
highlighted: i,
|
|
159
|
+
showLineNumbers: p,
|
|
160
|
+
diff: o
|
|
161
|
+
}) {
|
|
162
|
+
const d = o === "add", c = o === "remove", [l, t] = v(!1), m = w(async (u) => {
|
|
163
|
+
u.stopPropagation();
|
|
164
|
+
try {
|
|
165
|
+
await navigator.clipboard.writeText(r);
|
|
166
|
+
} catch {
|
|
167
|
+
const e = document.createElement("textarea");
|
|
168
|
+
e.value = r, e.style.position = "fixed", e.style.opacity = "0", document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
|
|
169
|
+
}
|
|
170
|
+
t(!0), setTimeout(() => t(!1), 1500);
|
|
171
|
+
}, [r]);
|
|
172
|
+
return /* @__PURE__ */ h(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
className: y(
|
|
176
|
+
"group/line flex min-h-[1.625rem] leading-relaxed relative",
|
|
177
|
+
"transition-colors duration-75",
|
|
178
|
+
i && "bg-primary/8",
|
|
179
|
+
d && "bg-success/15",
|
|
180
|
+
c && "bg-destructive/15",
|
|
181
|
+
!i && !d && !c && "hover:bg-secondary/50"
|
|
182
|
+
),
|
|
183
|
+
children: [
|
|
184
|
+
o !== void 0 && /* @__PURE__ */ s(
|
|
185
|
+
"span",
|
|
186
|
+
{
|
|
187
|
+
className: y(
|
|
188
|
+
"select-none w-5 shrink-0 text-center text-xs leading-relaxed",
|
|
189
|
+
d && "text-success",
|
|
190
|
+
c && "text-destructive"
|
|
191
|
+
),
|
|
192
|
+
children: d ? "+" : c ? "-" : " "
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
p && /* @__PURE__ */ s(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
className: y(
|
|
199
|
+
"select-none shrink-0 w-10 pr-3 text-right text-xs leading-relaxed tabular-nums",
|
|
200
|
+
"text-muted-foreground",
|
|
201
|
+
i && "text-primary/60"
|
|
202
|
+
),
|
|
203
|
+
children: a
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ s(
|
|
207
|
+
"span",
|
|
208
|
+
{
|
|
209
|
+
className: "flex-1 pr-8 pl-3",
|
|
210
|
+
dangerouslySetInnerHTML: { __html: n }
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ s(
|
|
214
|
+
"button",
|
|
215
|
+
{
|
|
216
|
+
onClick: m,
|
|
217
|
+
className: y(
|
|
218
|
+
"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 rounded",
|
|
219
|
+
"text-muted-foreground hover:text-foreground",
|
|
220
|
+
"opacity-0 group-hover/line:opacity-100",
|
|
221
|
+
"transition-opacity duration-100 cursor-pointer",
|
|
222
|
+
l && "opacity-100"
|
|
223
|
+
),
|
|
224
|
+
"aria-label": "Copy line",
|
|
225
|
+
children: l ? /* @__PURE__ */ s(k, { className: "size-3 text-success" }) : /* @__PURE__ */ s(N, { className: "size-3" })
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
function P({
|
|
233
|
+
children: a,
|
|
234
|
+
filename: n,
|
|
235
|
+
language: r,
|
|
236
|
+
lineNumbers: i = !0,
|
|
237
|
+
highlightLines: p = [],
|
|
238
|
+
showCopyButton: o = !0,
|
|
239
|
+
className: d,
|
|
240
|
+
"aria-label": c
|
|
241
|
+
}) {
|
|
242
|
+
const l = typeof a == "string" ? a.replace(/\n$/, "") : "", t = l.split(`
|
|
243
|
+
`), m = t.some(
|
|
244
|
+
(e) => /^[+-][^+-]/.test(e) || /^[+-]$/.test(e)
|
|
245
|
+
), u = t.map((e, g) => {
|
|
246
|
+
let f, b = e;
|
|
247
|
+
return m && (e.startsWith("+") ? (f = "add", b = e.slice(1)) : e.startsWith("-") ? (f = "remove", b = e.slice(1)) : e.startsWith(" ") && (b = e.slice(1))), {
|
|
248
|
+
number: g + 1,
|
|
249
|
+
raw: b,
|
|
250
|
+
highlighted: p.includes(g + 1),
|
|
251
|
+
diff: f,
|
|
252
|
+
html: E(b, r)
|
|
253
|
+
};
|
|
254
|
+
});
|
|
255
|
+
return /* @__PURE__ */ h(
|
|
256
|
+
S,
|
|
257
|
+
{
|
|
258
|
+
className: y(
|
|
259
|
+
"overflow-hidden !p-0 !gap-0",
|
|
260
|
+
"text-sm font-mono",
|
|
261
|
+
d
|
|
262
|
+
),
|
|
263
|
+
role: "region",
|
|
264
|
+
"aria-label": c || (n ? `Code: ${n}` : "Code block"),
|
|
265
|
+
children: [
|
|
266
|
+
(n || o) && /* @__PURE__ */ h(
|
|
267
|
+
"div",
|
|
268
|
+
{
|
|
269
|
+
className: y(
|
|
270
|
+
"flex items-center justify-between gap-2",
|
|
271
|
+
"px-3 py-2 border-b border-border",
|
|
272
|
+
"bg-secondary/30"
|
|
273
|
+
),
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-2 min-w-0 text-xs text-muted-foreground", children: [
|
|
276
|
+
n && /* @__PURE__ */ h(C, { children: [
|
|
277
|
+
/* @__PURE__ */ s(j, { className: "size-3.5 text-muted-foreground shrink-0" }),
|
|
278
|
+
/* @__PURE__ */ s("span", { className: "truncate", children: n })
|
|
279
|
+
] }),
|
|
280
|
+
n && r && /* @__PURE__ */ s("span", { children: " — " }),
|
|
281
|
+
r && /* @__PURE__ */ s("span", { children: z[r] || r })
|
|
282
|
+
] }),
|
|
283
|
+
o && /* @__PURE__ */ s(O, { text: l })
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ s("div", { className: "overflow-x-auto", children: /* @__PURE__ */ s("pre", { className: "m-0 py-3 text-[13px] leading-relaxed", children: /* @__PURE__ */ s("code", { children: u.map((e) => /* @__PURE__ */ s(
|
|
288
|
+
A,
|
|
289
|
+
{
|
|
290
|
+
number: e.number,
|
|
291
|
+
content: e.html,
|
|
292
|
+
rawText: e.raw,
|
|
293
|
+
highlighted: e.highlighted,
|
|
294
|
+
showLineNumbers: i,
|
|
295
|
+
diff: e.diff
|
|
296
|
+
},
|
|
297
|
+
e.number
|
|
298
|
+
)) }) }) })
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
export {
|
|
304
|
+
P as CodeBlock,
|
|
305
|
+
O as CopyButton
|
|
306
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface CollapseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3
|
+
/** Header text displayed in the trigger button. */
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
/** Icon component displayed before the title. */
|
|
6
|
+
icon?: React.ComponentType<{
|
|
7
|
+
size?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
}>;
|
|
10
|
+
/** Whether the collapse is open by default (uncontrolled mode). @default false */
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
/** Controlled open state. When provided, the component becomes controlled. */
|
|
13
|
+
open?: boolean;
|
|
14
|
+
/** Callback fired when the open state changes (controlled mode). */
|
|
15
|
+
onOpenChange?: (open: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface CollapseGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
/** When true, only one Collapse can be open at a time. Opening one closes the others. @default false */
|
|
19
|
+
accordion?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Animated collapsible panel with smooth height transition.
|
|
23
|
+
* Supports both controlled and uncontrolled modes.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Uncontrolled
|
|
27
|
+
* <Collapse title="Details" icon={Info}>
|
|
28
|
+
* <p>Hidden content revealed on click.</p>
|
|
29
|
+
* </Collapse>
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Controlled
|
|
33
|
+
* const [open, setOpen] = useState(false);
|
|
34
|
+
* <Collapse title="Settings" open={open} onOpenChange={setOpen}>
|
|
35
|
+
* <p>Controlled collapse content.</p>
|
|
36
|
+
* </Collapse>
|
|
37
|
+
*/
|
|
38
|
+
declare function Collapse({ title, children, icon: Icon, defaultOpen, open: controlledOpen, onOpenChange, className, ...props }: CollapseProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Layout wrapper that spaces multiple Collapse components vertically.
|
|
41
|
+
* Set `accordion` to enable single-open behavior.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Standard group (multiple can be open)
|
|
45
|
+
* <CollapseGroup>
|
|
46
|
+
* <Collapse title="Section 1">Content 1</Collapse>
|
|
47
|
+
* <Collapse title="Section 2">Content 2</Collapse>
|
|
48
|
+
* </CollapseGroup>
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Accordion mode (only one open at a time)
|
|
52
|
+
* <CollapseGroup accordion>
|
|
53
|
+
* <Collapse title="Section 1">Content 1</Collapse>
|
|
54
|
+
* <Collapse title="Section 2">Content 2</Collapse>
|
|
55
|
+
* </CollapseGroup>
|
|
56
|
+
*/
|
|
57
|
+
declare function CollapseGroup({ children, accordion, className, ...props }: CollapseGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export { Collapse, CollapseGroup };
|
package/dist/Collapse.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as k, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as H, useState as v, useRef as j, useId as q, useContext as z, useCallback as I, useEffect as w } from "react";
|
|
4
|
+
import { ChevronDown as F } from "lucide-react";
|
|
5
|
+
import { c as b } from "./_shared/utils-eGXXUFl7.js";
|
|
6
|
+
const y = H(null);
|
|
7
|
+
function G({
|
|
8
|
+
title: p,
|
|
9
|
+
children: x,
|
|
10
|
+
icon: s,
|
|
11
|
+
defaultOpen: r = !1,
|
|
12
|
+
open: n,
|
|
13
|
+
onOpenChange: i,
|
|
14
|
+
className: g,
|
|
15
|
+
...l
|
|
16
|
+
}) {
|
|
17
|
+
const [c, h] = v(r), C = j(null), [A, a] = v(r ? "auto" : "0px"), d = q(), o = z(y), u = n !== void 0, f = o !== null && !u, m = u ? n : f ? o.openId === d : c, E = I(() => {
|
|
18
|
+
u ? i?.(!n) : f ? o.toggle(d) : h((t) => !t);
|
|
19
|
+
}, [u, n, i, f, o, d]);
|
|
20
|
+
return w(() => {
|
|
21
|
+
f && r && o.openId === null && o.toggle(d);
|
|
22
|
+
}, []), w(() => {
|
|
23
|
+
const t = C.current;
|
|
24
|
+
if (t)
|
|
25
|
+
if (m) {
|
|
26
|
+
a(`${t.scrollHeight}px`);
|
|
27
|
+
const N = () => a("auto");
|
|
28
|
+
return t.addEventListener("transitionend", N, { once: !0 }), () => t.removeEventListener("transitionend", N);
|
|
29
|
+
} else
|
|
30
|
+
a(`${t.scrollHeight}px`), requestAnimationFrame(() => {
|
|
31
|
+
requestAnimationFrame(() => {
|
|
32
|
+
a("0px");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}, [m]), /* @__PURE__ */ k(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: b(
|
|
39
|
+
"bg-card/85 backdrop-blur-xl border border-border rounded-lg overflow-hidden transition-colors hover:border-secondary",
|
|
40
|
+
g
|
|
41
|
+
),
|
|
42
|
+
...l,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ k(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
onClick: E,
|
|
49
|
+
"aria-expanded": m,
|
|
50
|
+
className: "flex items-center gap-3 w-full px-4 py-3 text-left text-sm font-medium text-foreground cursor-pointer",
|
|
51
|
+
children: [
|
|
52
|
+
s && /* @__PURE__ */ e("span", { className: "text-muted-foreground shrink-0 inline-flex items-center", children: /* @__PURE__ */ e(s, { size: 16 }) }),
|
|
53
|
+
/* @__PURE__ */ e("span", { className: "flex-1 min-w-0", children: p }),
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
F,
|
|
56
|
+
{
|
|
57
|
+
size: 16,
|
|
58
|
+
className: b(
|
|
59
|
+
"text-muted-foreground shrink-0 transition-transform duration-200",
|
|
60
|
+
m && "rotate-180"
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ e(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
ref: C,
|
|
71
|
+
style: { height: A },
|
|
72
|
+
className: "overflow-hidden transition-[height] duration-200 ease-in-out",
|
|
73
|
+
children: /* @__PURE__ */ e("div", { className: "px-4 pb-4 text-sm text-muted-foreground", children: x })
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function P({ children: p, accordion: x = !1, className: s, ...r }) {
|
|
81
|
+
const [n, i] = v(null), g = I((c) => {
|
|
82
|
+
i((h) => h === c ? null : c);
|
|
83
|
+
}, []), l = /* @__PURE__ */ e("div", { className: b("flex flex-col gap-2", s), ...r, children: p });
|
|
84
|
+
return x ? /* @__PURE__ */ e(y.Provider, { value: { openId: n, toggle: g }, children: l }) : l;
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
G as Collapse,
|
|
88
|
+
P as CollapseGroup
|
|
89
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ComboboxOption {
|
|
3
|
+
/** The value submitted when this option is selected. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** The display label for this option. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Optional icon component rendered before the label. */
|
|
8
|
+
icon?: React.ComponentType<{
|
|
9
|
+
className?: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export interface ComboboxProps {
|
|
13
|
+
/** Available options to search and select from. */
|
|
14
|
+
options: ComboboxOption[];
|
|
15
|
+
/** Controlled selected value. */
|
|
16
|
+
value: string;
|
|
17
|
+
/** Callback fired when the selected value changes. */
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
/** Placeholder text for the search input. @default "Rechercher..." */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/** Message shown when no options match the search query. @default "Aucun resultat." */
|
|
22
|
+
emptyMessage?: string;
|
|
23
|
+
/** Whether the combobox is disabled. @default false */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Additional CSS classes for the trigger button. */
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Searchable select dropdown combining cmdk for filtering and Radix Popover
|
|
30
|
+
* for positioning. Styled to match the Input component.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <Combobox
|
|
34
|
+
* options={[
|
|
35
|
+
* { value: "docker", label: "Docker" },
|
|
36
|
+
* { value: "totanus", label: "Totanus" },
|
|
37
|
+
* ]}
|
|
38
|
+
* value={selected}
|
|
39
|
+
* onChange={setSelected}
|
|
40
|
+
* placeholder="Rechercher un service..."
|
|
41
|
+
* />
|
|
42
|
+
*/
|
|
43
|
+
declare function Combobox({ options, value, onChange, placeholder, emptyMessage, disabled, className, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export { Combobox };
|