@matheusrizzati/ui 0.1.0
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.cjs +801 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +142 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +735 -0
- package/dist/index.js.map +1 -0
- package/dist/tokens.css +58 -0
- package/dist/tokens.css.map +1 -0
- package/dist/tokens.d.cts +2 -0
- package/dist/tokens.d.ts +2 -0
- package/package.json +64 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { forwardRef, createContext, useState, useCallback, useContext } from 'react';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import * as Dialog from '@radix-ui/react-dialog';
|
|
7
|
+
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
8
|
+
|
|
9
|
+
// src/utils/cn.ts
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
13
|
+
var buttonVariants = cva(
|
|
14
|
+
[
|
|
15
|
+
"inline-flex items-center justify-center gap-2",
|
|
16
|
+
"font-medium whitespace-nowrap select-none",
|
|
17
|
+
"transition-all duration-[var(--transition-fast)]",
|
|
18
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-[var(--ring-offset)]",
|
|
19
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
20
|
+
"active:scale-[0.97]",
|
|
21
|
+
"cursor-pointer"
|
|
22
|
+
],
|
|
23
|
+
{
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
primary: [
|
|
27
|
+
"bg-[var(--color-primary)] text-[var(--color-primary-foreground)]",
|
|
28
|
+
"hover:bg-[var(--color-primary-hover)]",
|
|
29
|
+
"shadow-[var(--shadow-sm)]"
|
|
30
|
+
],
|
|
31
|
+
secondary: [
|
|
32
|
+
"bg-[var(--color-surface)] text-[var(--color-text-primary)]",
|
|
33
|
+
"border border-[var(--color-border)]",
|
|
34
|
+
"hover:bg-[var(--color-surface-hover)] hover:border-[var(--color-border-hover)]"
|
|
35
|
+
],
|
|
36
|
+
ghost: [
|
|
37
|
+
"text-[var(--color-text-secondary)]",
|
|
38
|
+
"hover:bg-[var(--color-surface)] hover:text-[var(--color-text-primary)]"
|
|
39
|
+
],
|
|
40
|
+
danger: [
|
|
41
|
+
"bg-[var(--color-danger)] text-white",
|
|
42
|
+
"hover:brightness-110",
|
|
43
|
+
"shadow-[var(--shadow-sm)]"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
sm: "h-8 px-3 text-[var(--text-xs)] rounded-[var(--radius-sm)]",
|
|
48
|
+
md: "h-9 px-4 text-[var(--text-sm)] rounded-[var(--radius)]",
|
|
49
|
+
lg: "h-11 px-6 text-[var(--text-base)] rounded-[var(--radius-md)]",
|
|
50
|
+
icon: "h-9 w-9 rounded-[var(--radius)]"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
variant: "primary",
|
|
55
|
+
size: "md"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
var Spinner = () => /* @__PURE__ */ jsxs(
|
|
60
|
+
"svg",
|
|
61
|
+
{
|
|
62
|
+
className: "animate-spin h-4 w-4",
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
fill: "none",
|
|
65
|
+
viewBox: "0 0 24 24",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"circle",
|
|
69
|
+
{
|
|
70
|
+
className: "opacity-25",
|
|
71
|
+
cx: "12",
|
|
72
|
+
cy: "12",
|
|
73
|
+
r: "10",
|
|
74
|
+
stroke: "currentColor",
|
|
75
|
+
strokeWidth: "4"
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
"path",
|
|
80
|
+
{
|
|
81
|
+
className: "opacity-75",
|
|
82
|
+
fill: "currentColor",
|
|
83
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
var Button = forwardRef(
|
|
90
|
+
({ className, variant, size, loading, disabled, children, ...props }, ref) => {
|
|
91
|
+
return /* @__PURE__ */ jsxs(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
ref,
|
|
95
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
96
|
+
disabled: disabled || loading,
|
|
97
|
+
...props,
|
|
98
|
+
children: [
|
|
99
|
+
loading && /* @__PURE__ */ jsx(Spinner, {}),
|
|
100
|
+
children
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
Button.displayName = "Button";
|
|
107
|
+
var inputVariants = cva(
|
|
108
|
+
[
|
|
109
|
+
"w-full bg-[var(--color-surface)] text-[var(--color-text-primary)]",
|
|
110
|
+
"border border-[var(--color-border)]",
|
|
111
|
+
"placeholder:text-[var(--color-text-muted)]",
|
|
112
|
+
"transition-all duration-[var(--transition-fast)]",
|
|
113
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--ring-color)] focus:border-[var(--color-primary)]",
|
|
114
|
+
"hover:border-[var(--color-border-hover)]",
|
|
115
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
116
|
+
"font-[var(--font-sans)]"
|
|
117
|
+
],
|
|
118
|
+
{
|
|
119
|
+
variants: {
|
|
120
|
+
inputSize: {
|
|
121
|
+
sm: "h-8 px-3 text-[var(--text-xs)] rounded-[var(--radius-sm)]",
|
|
122
|
+
md: "h-9 px-3 text-[var(--text-sm)] rounded-[var(--radius)]",
|
|
123
|
+
lg: "h-11 px-4 text-[var(--text-base)] rounded-[var(--radius-md)]"
|
|
124
|
+
},
|
|
125
|
+
state: {
|
|
126
|
+
default: "",
|
|
127
|
+
error: "border-[var(--color-danger)] focus:ring-[var(--color-danger)]/30"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
defaultVariants: {
|
|
131
|
+
inputSize: "md",
|
|
132
|
+
state: "default"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
var labelStyles = "block text-[var(--text-sm)] font-medium text-[var(--color-text-secondary)] mb-1.5";
|
|
137
|
+
var helperStyles = "mt-1.5 text-[var(--text-xs)] text-[var(--color-text-muted)]";
|
|
138
|
+
var errorStyles = "mt-1.5 text-[var(--text-xs)] text-[var(--color-danger)]";
|
|
139
|
+
var Input = forwardRef(
|
|
140
|
+
({
|
|
141
|
+
className,
|
|
142
|
+
inputSize,
|
|
143
|
+
state,
|
|
144
|
+
label,
|
|
145
|
+
helperText,
|
|
146
|
+
error,
|
|
147
|
+
startIcon,
|
|
148
|
+
endIcon,
|
|
149
|
+
id,
|
|
150
|
+
...props
|
|
151
|
+
}, ref) => {
|
|
152
|
+
const inputId = id || (label ? label.toLowerCase().replace(/\s+/g, "-") : void 0);
|
|
153
|
+
const effectiveState = error ? "error" : state;
|
|
154
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
155
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: labelStyles, children: label }),
|
|
156
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
157
|
+
startIcon && /* @__PURE__ */ jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-muted)]", children: startIcon }),
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
"input",
|
|
160
|
+
{
|
|
161
|
+
ref,
|
|
162
|
+
id: inputId,
|
|
163
|
+
className: cn(
|
|
164
|
+
inputVariants({ inputSize, state: effectiveState }),
|
|
165
|
+
startIcon && "pl-9",
|
|
166
|
+
endIcon && "pr-9",
|
|
167
|
+
className
|
|
168
|
+
),
|
|
169
|
+
...props
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
endIcon && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-text-muted)]", children: endIcon })
|
|
173
|
+
] }),
|
|
174
|
+
error && /* @__PURE__ */ jsx("p", { className: errorStyles, children: error }),
|
|
175
|
+
!error && helperText && /* @__PURE__ */ jsx("p", { className: helperStyles, children: helperText })
|
|
176
|
+
] });
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
Input.displayName = "Input";
|
|
180
|
+
var cardVariants = cva(
|
|
181
|
+
[
|
|
182
|
+
"rounded-[var(--radius-lg)]",
|
|
183
|
+
"transition-all duration-[var(--transition-base)]"
|
|
184
|
+
],
|
|
185
|
+
{
|
|
186
|
+
variants: {
|
|
187
|
+
variant: {
|
|
188
|
+
elevated: [
|
|
189
|
+
"bg-[var(--color-surface)] border border-[var(--color-border)]",
|
|
190
|
+
"shadow-[var(--shadow-md)]"
|
|
191
|
+
],
|
|
192
|
+
outlined: [
|
|
193
|
+
"bg-transparent border border-[var(--color-border)]"
|
|
194
|
+
],
|
|
195
|
+
ghost: [
|
|
196
|
+
"bg-[var(--color-surface)]/50"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
hoverable: {
|
|
200
|
+
true: "hover:border-[var(--color-border-hover)] hover:shadow-[var(--shadow-lg)] cursor-pointer",
|
|
201
|
+
false: ""
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
defaultVariants: {
|
|
205
|
+
variant: "elevated",
|
|
206
|
+
hoverable: false
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
var cardHeaderStyles = "px-[var(--space-lg)] pt-[var(--space-lg)] pb-[var(--space-sm)]";
|
|
211
|
+
var cardBodyStyles = "px-[var(--space-lg)] py-[var(--space-md)]";
|
|
212
|
+
var cardFooterStyles = "px-[var(--space-lg)] pt-[var(--space-sm)] pb-[var(--space-lg)] border-t border-[var(--color-border)]";
|
|
213
|
+
var Card = forwardRef(
|
|
214
|
+
({ className, variant, hoverable, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
ref,
|
|
218
|
+
className: cn(cardVariants({ variant, hoverable }), className),
|
|
219
|
+
...props
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
);
|
|
223
|
+
Card.displayName = "Card";
|
|
224
|
+
var CardHeader = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(cardHeaderStyles, className), ...props }));
|
|
225
|
+
CardHeader.displayName = "CardHeader";
|
|
226
|
+
var CardBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(cardBodyStyles, className), ...props }));
|
|
227
|
+
CardBody.displayName = "CardBody";
|
|
228
|
+
var CardFooter = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(cardFooterStyles, className), ...props }));
|
|
229
|
+
CardFooter.displayName = "CardFooter";
|
|
230
|
+
|
|
231
|
+
// src/components/modal/modal.styles.ts
|
|
232
|
+
var modalOverlayStyles = [
|
|
233
|
+
"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",
|
|
234
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
235
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
236
|
+
].join(" ");
|
|
237
|
+
var modalContentStyles = [
|
|
238
|
+
"fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2",
|
|
239
|
+
"w-full max-w-lg",
|
|
240
|
+
"bg-[var(--color-surface)] border border-[var(--color-border)]",
|
|
241
|
+
"rounded-[var(--radius-xl)] shadow-[var(--shadow-lg)]",
|
|
242
|
+
"p-[var(--space-lg)]",
|
|
243
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
244
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
|
|
245
|
+
"duration-200"
|
|
246
|
+
].join(" ");
|
|
247
|
+
var modalTitleStyles = "text-[var(--text-lg)] font-semibold text-[var(--color-text-primary)]";
|
|
248
|
+
var modalDescriptionStyles = "text-[var(--text-sm)] text-[var(--color-text-secondary)] mt-2";
|
|
249
|
+
var modalCloseStyles = [
|
|
250
|
+
"absolute right-4 top-4",
|
|
251
|
+
"rounded-[var(--radius-sm)] p-1",
|
|
252
|
+
"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",
|
|
253
|
+
"hover:bg-[var(--color-surface-hover)]",
|
|
254
|
+
"transition-colors duration-[var(--transition-fast)]",
|
|
255
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--ring-color)]"
|
|
256
|
+
].join(" ");
|
|
257
|
+
var Modal = Dialog.Root;
|
|
258
|
+
var ModalTrigger = Dialog.Trigger;
|
|
259
|
+
var ModalOverlay = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Dialog.Overlay, { ref, className: cn(modalOverlayStyles, className), ...props }));
|
|
260
|
+
ModalOverlay.displayName = "ModalOverlay";
|
|
261
|
+
var ModalContent = forwardRef(({ className, children, showClose = true, ...props }, ref) => /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
|
|
262
|
+
/* @__PURE__ */ jsx(ModalOverlay, {}),
|
|
263
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { ref, className: cn(modalContentStyles, className), ...props, children: [
|
|
264
|
+
children,
|
|
265
|
+
showClose && /* @__PURE__ */ jsxs(Dialog.Close, { className: modalCloseStyles, children: [
|
|
266
|
+
/* @__PURE__ */ jsxs(
|
|
267
|
+
"svg",
|
|
268
|
+
{
|
|
269
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
270
|
+
width: "16",
|
|
271
|
+
height: "16",
|
|
272
|
+
viewBox: "0 0 24 24",
|
|
273
|
+
fill: "none",
|
|
274
|
+
stroke: "currentColor",
|
|
275
|
+
strokeWidth: "2",
|
|
276
|
+
strokeLinecap: "round",
|
|
277
|
+
strokeLinejoin: "round",
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
280
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
285
|
+
] })
|
|
286
|
+
] })
|
|
287
|
+
] }));
|
|
288
|
+
ModalContent.displayName = "ModalContent";
|
|
289
|
+
var ModalTitle = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Dialog.Title, { ref, className: cn(modalTitleStyles, className), ...props }));
|
|
290
|
+
ModalTitle.displayName = "ModalTitle";
|
|
291
|
+
var ModalDescription = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
292
|
+
Dialog.Description,
|
|
293
|
+
{
|
|
294
|
+
ref,
|
|
295
|
+
className: cn(modalDescriptionStyles, className),
|
|
296
|
+
...props
|
|
297
|
+
}
|
|
298
|
+
));
|
|
299
|
+
ModalDescription.displayName = "ModalDescription";
|
|
300
|
+
var ModalFooter = forwardRef(
|
|
301
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
ref,
|
|
305
|
+
className: cn(
|
|
306
|
+
"flex justify-end gap-[var(--space-sm)] mt-[var(--space-lg)]",
|
|
307
|
+
className
|
|
308
|
+
),
|
|
309
|
+
...props
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
);
|
|
313
|
+
ModalFooter.displayName = "ModalFooter";
|
|
314
|
+
|
|
315
|
+
// src/components/dropdown/dropdown.styles.ts
|
|
316
|
+
var dropdownContentStyles = [
|
|
317
|
+
"z-50 min-w-[180px] overflow-hidden",
|
|
318
|
+
"bg-[var(--color-surface)] border border-[var(--color-border)]",
|
|
319
|
+
"rounded-[var(--radius-md)] shadow-[var(--shadow-lg)]",
|
|
320
|
+
"p-1",
|
|
321
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
322
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
323
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
324
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
325
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
326
|
+
"data-[side=right]:slide-in-from-left-2"
|
|
327
|
+
].join(" ");
|
|
328
|
+
var dropdownItemStyles = [
|
|
329
|
+
"relative flex items-center gap-2",
|
|
330
|
+
"rounded-[var(--radius-sm)] px-2 py-1.5",
|
|
331
|
+
"text-[var(--text-sm)] text-[var(--color-text-secondary)]",
|
|
332
|
+
"cursor-pointer select-none outline-none",
|
|
333
|
+
"transition-colors duration-[var(--transition-fast)]",
|
|
334
|
+
"data-[highlighted]:bg-[var(--color-surface-hover)] data-[highlighted]:text-[var(--color-text-primary)]",
|
|
335
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
336
|
+
].join(" ");
|
|
337
|
+
var dropdownSeparatorStyles = "my-1 h-px bg-[var(--color-border)]";
|
|
338
|
+
var dropdownLabelStyles = "px-2 py-1.5 text-[var(--text-xs)] font-semibold text-[var(--color-text-muted)]";
|
|
339
|
+
var Dropdown = DropdownMenu.Root;
|
|
340
|
+
var DropdownTrigger = DropdownMenu.Trigger;
|
|
341
|
+
var DropdownGroup = DropdownMenu.Group;
|
|
342
|
+
var DropdownContent = forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
|
|
343
|
+
DropdownMenu.Content,
|
|
344
|
+
{
|
|
345
|
+
ref,
|
|
346
|
+
sideOffset,
|
|
347
|
+
className: cn(dropdownContentStyles, className),
|
|
348
|
+
...props
|
|
349
|
+
}
|
|
350
|
+
) }));
|
|
351
|
+
DropdownContent.displayName = "DropdownContent";
|
|
352
|
+
var DropdownItem = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
353
|
+
DropdownMenu.Item,
|
|
354
|
+
{
|
|
355
|
+
ref,
|
|
356
|
+
className: cn(dropdownItemStyles, className),
|
|
357
|
+
...props
|
|
358
|
+
}
|
|
359
|
+
));
|
|
360
|
+
DropdownItem.displayName = "DropdownItem";
|
|
361
|
+
var DropdownSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
362
|
+
DropdownMenu.Separator,
|
|
363
|
+
{
|
|
364
|
+
ref,
|
|
365
|
+
className: cn(dropdownSeparatorStyles, className),
|
|
366
|
+
...props
|
|
367
|
+
}
|
|
368
|
+
));
|
|
369
|
+
DropdownSeparator.displayName = "DropdownSeparator";
|
|
370
|
+
var DropdownLabel = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
371
|
+
DropdownMenu.Label,
|
|
372
|
+
{
|
|
373
|
+
ref,
|
|
374
|
+
className: cn(dropdownLabelStyles, className),
|
|
375
|
+
...props
|
|
376
|
+
}
|
|
377
|
+
));
|
|
378
|
+
DropdownLabel.displayName = "DropdownLabel";
|
|
379
|
+
var badgeVariants = cva(
|
|
380
|
+
[
|
|
381
|
+
"inline-flex items-center font-medium",
|
|
382
|
+
"rounded-full whitespace-nowrap",
|
|
383
|
+
"transition-colors duration-[var(--transition-fast)]"
|
|
384
|
+
],
|
|
385
|
+
{
|
|
386
|
+
variants: {
|
|
387
|
+
variant: {
|
|
388
|
+
default: "bg-[var(--color-surface-raised)] text-[var(--color-text-secondary)] border border-[var(--color-border)]",
|
|
389
|
+
primary: "bg-[var(--color-primary)]/15 text-[var(--color-primary-hover)] border border-[var(--color-primary)]/25",
|
|
390
|
+
success: "bg-[var(--color-success)]/15 text-[var(--color-success)] border border-[var(--color-success)]/25",
|
|
391
|
+
warning: "bg-[var(--color-warning)]/15 text-[var(--color-warning)] border border-[var(--color-warning)]/25",
|
|
392
|
+
danger: "bg-[var(--color-danger)]/15 text-[var(--color-danger)] border border-[var(--color-danger)]/25",
|
|
393
|
+
info: "bg-[var(--color-info)]/15 text-[var(--color-info)] border border-[var(--color-info)]/25"
|
|
394
|
+
},
|
|
395
|
+
size: {
|
|
396
|
+
sm: "px-2 py-0.5 text-[10px]",
|
|
397
|
+
md: "px-2.5 py-0.5 text-[var(--text-xs)]"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
defaultVariants: {
|
|
401
|
+
variant: "default",
|
|
402
|
+
size: "md"
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
var Badge = forwardRef(
|
|
407
|
+
({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
408
|
+
"span",
|
|
409
|
+
{
|
|
410
|
+
ref,
|
|
411
|
+
className: cn(badgeVariants({ variant, size }), className),
|
|
412
|
+
...props
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
);
|
|
416
|
+
Badge.displayName = "Badge";
|
|
417
|
+
|
|
418
|
+
// src/components/tabs/tabs.styles.ts
|
|
419
|
+
var tabsListStyles = [
|
|
420
|
+
"inline-flex items-center gap-1",
|
|
421
|
+
"bg-[var(--color-bg-secondary)] p-1",
|
|
422
|
+
"rounded-[var(--radius-md)]",
|
|
423
|
+
"border border-[var(--color-border)]"
|
|
424
|
+
].join(" ");
|
|
425
|
+
var tabsTriggerStyles = [
|
|
426
|
+
"relative inline-flex items-center justify-center",
|
|
427
|
+
"px-3 py-1.5",
|
|
428
|
+
"text-[var(--text-sm)] font-medium",
|
|
429
|
+
"text-[var(--color-text-muted)]",
|
|
430
|
+
"rounded-[var(--radius)]",
|
|
431
|
+
"transition-all duration-[var(--transition-fast)]",
|
|
432
|
+
"cursor-pointer select-none",
|
|
433
|
+
"hover:text-[var(--color-text-secondary)]",
|
|
434
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)]"
|
|
435
|
+
].join(" ");
|
|
436
|
+
var tabsTriggerActiveStyles = [
|
|
437
|
+
"bg-[var(--color-surface)] text-[var(--color-text-primary)]",
|
|
438
|
+
"shadow-[var(--shadow-sm)]"
|
|
439
|
+
].join(" ");
|
|
440
|
+
var tabsContentStyles = [
|
|
441
|
+
"mt-[var(--space-md)]",
|
|
442
|
+
"focus-visible:outline-none"
|
|
443
|
+
].join(" ");
|
|
444
|
+
var TabsContext = createContext(null);
|
|
445
|
+
function useTabsContext() {
|
|
446
|
+
const ctx = useContext(TabsContext);
|
|
447
|
+
if (!ctx) throw new Error("Tabs compound components must be used within <Tabs>");
|
|
448
|
+
return ctx;
|
|
449
|
+
}
|
|
450
|
+
var Tabs = forwardRef(
|
|
451
|
+
({ value: controlledValue, defaultValue = "", onValueChange, className, children, ...props }, ref) => {
|
|
452
|
+
const [internal, setInternal] = useState(defaultValue);
|
|
453
|
+
const value = controlledValue ?? internal;
|
|
454
|
+
const handleChange = useCallback(
|
|
455
|
+
(v) => {
|
|
456
|
+
setInternal(v);
|
|
457
|
+
onValueChange?.(v);
|
|
458
|
+
},
|
|
459
|
+
[onValueChange]
|
|
460
|
+
);
|
|
461
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: { value, onValueChange: handleChange }, children: /* @__PURE__ */ jsx("div", { ref, className, ...props, children }) });
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
Tabs.displayName = "Tabs";
|
|
465
|
+
var TabsList = forwardRef(
|
|
466
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, role: "tablist", className: cn(tabsListStyles, className), ...props })
|
|
467
|
+
);
|
|
468
|
+
TabsList.displayName = "TabsList";
|
|
469
|
+
var TabsTrigger = forwardRef(
|
|
470
|
+
({ value, className, ...props }, ref) => {
|
|
471
|
+
const ctx = useTabsContext();
|
|
472
|
+
const isActive = ctx.value === value;
|
|
473
|
+
return /* @__PURE__ */ jsx(
|
|
474
|
+
"button",
|
|
475
|
+
{
|
|
476
|
+
ref,
|
|
477
|
+
role: "tab",
|
|
478
|
+
type: "button",
|
|
479
|
+
"aria-selected": isActive,
|
|
480
|
+
"data-state": isActive ? "active" : "inactive",
|
|
481
|
+
className: cn(
|
|
482
|
+
tabsTriggerStyles,
|
|
483
|
+
isActive && tabsTriggerActiveStyles,
|
|
484
|
+
className
|
|
485
|
+
),
|
|
486
|
+
onClick: () => ctx.onValueChange(value),
|
|
487
|
+
...props
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
493
|
+
var TabsContent = forwardRef(
|
|
494
|
+
({ value, className, children, ...props }, ref) => {
|
|
495
|
+
const ctx = useTabsContext();
|
|
496
|
+
if (ctx.value !== value) return null;
|
|
497
|
+
return /* @__PURE__ */ jsx(
|
|
498
|
+
"div",
|
|
499
|
+
{
|
|
500
|
+
ref,
|
|
501
|
+
role: "tabpanel",
|
|
502
|
+
"data-state": "active",
|
|
503
|
+
className: cn(tabsContentStyles, className),
|
|
504
|
+
...props,
|
|
505
|
+
children
|
|
506
|
+
}
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
TabsContent.displayName = "TabsContent";
|
|
511
|
+
|
|
512
|
+
// src/components/table/table.styles.ts
|
|
513
|
+
var tableWrapperStyles = "w-full overflow-auto rounded-[var(--radius-lg)] border border-[var(--color-border)]";
|
|
514
|
+
var tableStyles = "w-full caption-bottom text-[var(--text-sm)] border-collapse";
|
|
515
|
+
var theadStyles = "bg-[var(--color-bg-secondary)]";
|
|
516
|
+
var tbodyStyles = "[&_tr:last-child]:border-0";
|
|
517
|
+
var trStyles = [
|
|
518
|
+
"border-b border-[var(--color-border)]",
|
|
519
|
+
"transition-colors duration-[var(--transition-fast)]",
|
|
520
|
+
"hover:bg-[var(--color-surface-hover)]/50",
|
|
521
|
+
"data-[state=selected]:bg-[var(--color-primary)]/5"
|
|
522
|
+
].join(" ");
|
|
523
|
+
var thStyles = [
|
|
524
|
+
"h-10 px-4 text-left align-middle",
|
|
525
|
+
"font-medium text-[var(--color-text-muted)] text-[var(--text-xs)] uppercase tracking-wider",
|
|
526
|
+
"[&:has([role=checkbox])]:pr-0"
|
|
527
|
+
].join(" ");
|
|
528
|
+
var tdStyles = [
|
|
529
|
+
"p-4 align-middle text-[var(--color-text-secondary)]",
|
|
530
|
+
"[&:has([role=checkbox])]:pr-0"
|
|
531
|
+
].join(" ");
|
|
532
|
+
var TableWrapper = forwardRef(
|
|
533
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(tableWrapperStyles, className), ...props })
|
|
534
|
+
);
|
|
535
|
+
TableWrapper.displayName = "TableWrapper";
|
|
536
|
+
var Table = forwardRef(
|
|
537
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(TableWrapper, { children: /* @__PURE__ */ jsx("table", { ref, className: cn(tableStyles, className), ...props }) })
|
|
538
|
+
);
|
|
539
|
+
Table.displayName = "Table";
|
|
540
|
+
var Thead = forwardRef(
|
|
541
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn(theadStyles, className), ...props })
|
|
542
|
+
);
|
|
543
|
+
Thead.displayName = "Thead";
|
|
544
|
+
var Tbody = forwardRef(
|
|
545
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", { ref, className: cn(tbodyStyles, className), ...props })
|
|
546
|
+
);
|
|
547
|
+
Tbody.displayName = "Tbody";
|
|
548
|
+
var Tr = forwardRef(
|
|
549
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", { ref, className: cn(trStyles, className), ...props })
|
|
550
|
+
);
|
|
551
|
+
Tr.displayName = "Tr";
|
|
552
|
+
var Th = forwardRef(
|
|
553
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("th", { ref, className: cn(thStyles, className), ...props })
|
|
554
|
+
);
|
|
555
|
+
Th.displayName = "Th";
|
|
556
|
+
var Td = forwardRef(
|
|
557
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("td", { ref, className: cn(tdStyles, className), ...props })
|
|
558
|
+
);
|
|
559
|
+
Td.displayName = "Td";
|
|
560
|
+
|
|
561
|
+
// src/components/sidebar/sidebar.styles.ts
|
|
562
|
+
var sidebarStyles = [
|
|
563
|
+
"flex flex-col h-full",
|
|
564
|
+
"bg-[var(--color-bg-secondary)] border-r border-[var(--color-border)]",
|
|
565
|
+
"transition-all duration-[var(--transition-slow)]"
|
|
566
|
+
].join(" ");
|
|
567
|
+
var sidebarExpandedStyles = "w-[260px]";
|
|
568
|
+
var sidebarCollapsedStyles = "w-[68px]";
|
|
569
|
+
var sidebarHeaderStyles = [
|
|
570
|
+
"flex items-center gap-3",
|
|
571
|
+
"px-[var(--space-md)] h-14",
|
|
572
|
+
"border-b border-[var(--color-border)]",
|
|
573
|
+
"shrink-0"
|
|
574
|
+
].join(" ");
|
|
575
|
+
var sidebarContentStyles = "flex-1 overflow-y-auto py-[var(--space-sm)] px-[var(--space-sm)]";
|
|
576
|
+
var sidebarFooterStyles = [
|
|
577
|
+
"shrink-0",
|
|
578
|
+
"px-[var(--space-md)] py-[var(--space-sm)]",
|
|
579
|
+
"border-t border-[var(--color-border)]"
|
|
580
|
+
].join(" ");
|
|
581
|
+
var sidebarSectionStyles = "py-[var(--space-xs)]";
|
|
582
|
+
var sidebarSectionLabelStyles = [
|
|
583
|
+
"px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider",
|
|
584
|
+
"text-[var(--color-text-muted)]"
|
|
585
|
+
].join(" ");
|
|
586
|
+
var sidebarItemStyles = [
|
|
587
|
+
"flex items-center gap-3",
|
|
588
|
+
"w-full px-3 py-2",
|
|
589
|
+
"text-[var(--text-sm)] text-[var(--color-text-secondary)]",
|
|
590
|
+
"rounded-[var(--radius)]",
|
|
591
|
+
"cursor-pointer select-none",
|
|
592
|
+
"transition-all duration-[var(--transition-fast)]",
|
|
593
|
+
"hover:bg-[var(--color-surface)] hover:text-[var(--color-text-primary)]"
|
|
594
|
+
].join(" ");
|
|
595
|
+
var sidebarItemActiveStyles = [
|
|
596
|
+
"bg-[var(--color-primary)]/10 text-[var(--color-primary-hover)]",
|
|
597
|
+
"hover:bg-[var(--color-primary)]/15"
|
|
598
|
+
].join(" ");
|
|
599
|
+
var sidebarToggleStyles = [
|
|
600
|
+
"flex items-center justify-center",
|
|
601
|
+
"h-7 w-7 rounded-[var(--radius)]",
|
|
602
|
+
"text-[var(--color-text-muted)]",
|
|
603
|
+
"hover:bg-[var(--color-surface)] hover:text-[var(--color-text-primary)]",
|
|
604
|
+
"transition-colors duration-[var(--transition-fast)]",
|
|
605
|
+
"cursor-pointer"
|
|
606
|
+
].join(" ");
|
|
607
|
+
var SidebarContext = createContext({
|
|
608
|
+
collapsed: false,
|
|
609
|
+
toggle: () => {
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
function useSidebar() {
|
|
613
|
+
return useContext(SidebarContext);
|
|
614
|
+
}
|
|
615
|
+
var Sidebar = forwardRef(
|
|
616
|
+
({
|
|
617
|
+
collapsed: controlledCollapsed,
|
|
618
|
+
defaultCollapsed = false,
|
|
619
|
+
onCollapsedChange,
|
|
620
|
+
className,
|
|
621
|
+
children,
|
|
622
|
+
...props
|
|
623
|
+
}, ref) => {
|
|
624
|
+
const [internal, setInternal] = useState(defaultCollapsed);
|
|
625
|
+
const collapsed = controlledCollapsed ?? internal;
|
|
626
|
+
const toggle = useCallback(() => {
|
|
627
|
+
const next = !collapsed;
|
|
628
|
+
setInternal(next);
|
|
629
|
+
onCollapsedChange?.(next);
|
|
630
|
+
}, [collapsed, onCollapsedChange]);
|
|
631
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: { collapsed, toggle }, children: /* @__PURE__ */ jsx(
|
|
632
|
+
"aside",
|
|
633
|
+
{
|
|
634
|
+
ref,
|
|
635
|
+
className: cn(
|
|
636
|
+
sidebarStyles,
|
|
637
|
+
collapsed ? sidebarCollapsedStyles : sidebarExpandedStyles,
|
|
638
|
+
className
|
|
639
|
+
),
|
|
640
|
+
...props,
|
|
641
|
+
children
|
|
642
|
+
}
|
|
643
|
+
) });
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
Sidebar.displayName = "Sidebar";
|
|
647
|
+
var SidebarHeader = forwardRef(
|
|
648
|
+
({ className, logo, children, ...props }, ref) => {
|
|
649
|
+
const { collapsed } = useSidebar();
|
|
650
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn(sidebarHeaderStyles, className), ...props, children: [
|
|
651
|
+
logo,
|
|
652
|
+
!collapsed && children
|
|
653
|
+
] });
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
SidebarHeader.displayName = "SidebarHeader";
|
|
657
|
+
var SidebarContent = forwardRef(
|
|
658
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(sidebarContentStyles, className), ...props })
|
|
659
|
+
);
|
|
660
|
+
SidebarContent.displayName = "SidebarContent";
|
|
661
|
+
var SidebarFooter = forwardRef(
|
|
662
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn(sidebarFooterStyles, className), ...props })
|
|
663
|
+
);
|
|
664
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
665
|
+
var SidebarSection = forwardRef(
|
|
666
|
+
({ className, label, children, ...props }, ref) => {
|
|
667
|
+
const { collapsed } = useSidebar();
|
|
668
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn(sidebarSectionStyles, className), ...props, children: [
|
|
669
|
+
label && !collapsed && /* @__PURE__ */ jsx("div", { className: sidebarSectionLabelStyles, children: label }),
|
|
670
|
+
children
|
|
671
|
+
] });
|
|
672
|
+
}
|
|
673
|
+
);
|
|
674
|
+
SidebarSection.displayName = "SidebarSection";
|
|
675
|
+
var SidebarItem = forwardRef(
|
|
676
|
+
({ className, icon, active, children, ...props }, ref) => {
|
|
677
|
+
const { collapsed } = useSidebar();
|
|
678
|
+
return /* @__PURE__ */ jsxs(
|
|
679
|
+
"button",
|
|
680
|
+
{
|
|
681
|
+
ref,
|
|
682
|
+
type: "button",
|
|
683
|
+
className: cn(
|
|
684
|
+
sidebarItemStyles,
|
|
685
|
+
active && sidebarItemActiveStyles,
|
|
686
|
+
collapsed && "justify-center px-0",
|
|
687
|
+
className
|
|
688
|
+
),
|
|
689
|
+
...props,
|
|
690
|
+
children: [
|
|
691
|
+
icon,
|
|
692
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: "truncate", children })
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
SidebarItem.displayName = "SidebarItem";
|
|
699
|
+
var SidebarToggle = forwardRef(
|
|
700
|
+
({ className, ...props }, ref) => {
|
|
701
|
+
const { collapsed, toggle } = useSidebar();
|
|
702
|
+
return /* @__PURE__ */ jsx(
|
|
703
|
+
"button",
|
|
704
|
+
{
|
|
705
|
+
ref,
|
|
706
|
+
type: "button",
|
|
707
|
+
onClick: toggle,
|
|
708
|
+
className: cn(sidebarToggleStyles, className),
|
|
709
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
710
|
+
...props,
|
|
711
|
+
children: /* @__PURE__ */ jsx(
|
|
712
|
+
"svg",
|
|
713
|
+
{
|
|
714
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
715
|
+
width: "16",
|
|
716
|
+
height: "16",
|
|
717
|
+
viewBox: "0 0 24 24",
|
|
718
|
+
fill: "none",
|
|
719
|
+
stroke: "currentColor",
|
|
720
|
+
strokeWidth: "2",
|
|
721
|
+
strokeLinecap: "round",
|
|
722
|
+
strokeLinejoin: "round",
|
|
723
|
+
className: cn("transition-transform", collapsed && "rotate-180"),
|
|
724
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "15 18 9 12 15 6" })
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
);
|
|
731
|
+
SidebarToggle.displayName = "SidebarToggle";
|
|
732
|
+
|
|
733
|
+
export { Badge, Button, Card, CardBody, CardFooter, CardHeader, Dropdown, DropdownContent, DropdownGroup, DropdownItem, DropdownLabel, DropdownSeparator, DropdownTrigger, Input, Modal, ModalContent, ModalDescription, ModalFooter, ModalTitle, ModalTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarSection, SidebarToggle, Table, TableWrapper, Tabs, TabsContent, TabsList, TabsTrigger, Tbody, Td, Th, Thead, Tr, badgeVariants, buttonVariants, cardVariants, cn, inputVariants, useSidebar };
|
|
734
|
+
//# sourceMappingURL=index.js.map
|
|
735
|
+
//# sourceMappingURL=index.js.map
|