@ug666/ui-react 0.1.0 → 0.2.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/blocks/index.cjs +238 -0
- package/dist/blocks/index.cjs.map +1 -0
- package/dist/blocks/index.d.cts +86 -0
- package/dist/blocks/index.d.ts +86 -0
- package/dist/blocks/index.js +153 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/button-CaLZig8j.d.cts +22 -0
- package/dist/button-CaLZig8j.d.ts +22 -0
- package/dist/chunk-2IVRUJKO.js +377 -0
- package/dist/chunk-2IVRUJKO.js.map +1 -0
- package/dist/chunk-73WQAE3E.js +3003 -0
- package/dist/chunk-73WQAE3E.js.map +1 -0
- package/dist/chunk-RUDEZA5Q.js +62 -0
- package/dist/chunk-RUDEZA5Q.js.map +1 -0
- package/dist/chunk-S45GP6IB.js +254 -0
- package/dist/chunk-S45GP6IB.js.map +1 -0
- package/dist/components/index.cjs +3993 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +1097 -0
- package/dist/components/index.d.ts +1097 -0
- package/dist/components/index.js +330 -0
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/index.cjs +1410 -710
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +274 -1340
- package/dist/index.d.ts +274 -1340
- package/dist/index.js +385 -3229
- package/dist/index.js.map +1 -1
- package/dist/labs/index.cjs +34 -0
- package/dist/labs/index.cjs.map +1 -0
- package/dist/labs/index.d.cts +12 -0
- package/dist/labs/index.d.ts +12 -0
- package/dist/labs/index.js +9 -0
- package/dist/labs/index.js.map +1 -0
- package/dist/patterns/index.cjs +758 -0
- package/dist/patterns/index.cjs.map +1 -0
- package/dist/patterns/index.d.cts +158 -0
- package/dist/patterns/index.d.ts +158 -0
- package/dist/patterns/index.js +320 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/primitives/index.cjs +384 -0
- package/dist/primitives/index.cjs.map +1 -0
- package/dist/primitives/index.d.cts +137 -0
- package/dist/primitives/index.d.ts +137 -0
- package/dist/primitives/index.js +56 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/sidebar-vl00Z2o-.d.cts +93 -0
- package/dist/sidebar-vl00Z2o-.d.ts +93 -0
- package/dist/styles.css +2499 -0
- package/dist/tokens.css +86 -9
- package/package.json +36 -6
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/primitives/index.ts
|
|
22
|
+
var primitives_exports = {};
|
|
23
|
+
__export(primitives_exports, {
|
|
24
|
+
Badge: () => Badge,
|
|
25
|
+
Button: () => Button,
|
|
26
|
+
Card: () => Card,
|
|
27
|
+
CardContent: () => CardContent,
|
|
28
|
+
CardDescription: () => CardDescription,
|
|
29
|
+
CardFooter: () => CardFooter,
|
|
30
|
+
CardHeader: () => CardHeader,
|
|
31
|
+
CardTitle: () => CardTitle,
|
|
32
|
+
Input: () => Input,
|
|
33
|
+
Label: () => Label,
|
|
34
|
+
Separator: () => Separator,
|
|
35
|
+
Spinner: () => Spinner,
|
|
36
|
+
Tag: () => Tag,
|
|
37
|
+
UGBadge: () => Badge,
|
|
38
|
+
UGButton: () => Button,
|
|
39
|
+
UGCard: () => Card,
|
|
40
|
+
UGCardContent: () => CardContent,
|
|
41
|
+
UGCardDescription: () => CardDescription,
|
|
42
|
+
UGCardFooter: () => CardFooter,
|
|
43
|
+
UGCardHeader: () => CardHeader,
|
|
44
|
+
UGCardTitle: () => CardTitle,
|
|
45
|
+
UGInput: () => Input,
|
|
46
|
+
UGLabel: () => Label,
|
|
47
|
+
UGSeparator: () => Separator,
|
|
48
|
+
UGSpinner: () => Spinner,
|
|
49
|
+
UGTag: () => Tag,
|
|
50
|
+
badgeVariants: () => badgeVariants,
|
|
51
|
+
buttonVariants: () => buttonVariants,
|
|
52
|
+
tagVariants: () => tagVariants,
|
|
53
|
+
ugBadgeVariants: () => badgeVariants,
|
|
54
|
+
ugButtonVariants: () => buttonVariants,
|
|
55
|
+
ugTagVariants: () => tagVariants
|
|
56
|
+
});
|
|
57
|
+
module.exports = __toCommonJS(primitives_exports);
|
|
58
|
+
|
|
59
|
+
// src/components/button.tsx
|
|
60
|
+
var import_react = require("react");
|
|
61
|
+
var import_lucide_react = require("lucide-react");
|
|
62
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
63
|
+
|
|
64
|
+
// src/internal/cn.ts
|
|
65
|
+
var import_clsx = require("clsx");
|
|
66
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
67
|
+
function cn(...inputs) {
|
|
68
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/components/button.tsx
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
74
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-[background,border-color,color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
75
|
+
{
|
|
76
|
+
variants: {
|
|
77
|
+
variant: {
|
|
78
|
+
default: "bg-primary text-primary-fg shadow-sm hover:bg-primary-hover hover:shadow-md focus-visible:ring-ring",
|
|
79
|
+
destructive: "bg-danger text-danger-fg shadow-sm hover:bg-danger-hover hover:shadow-md focus-visible:ring-danger",
|
|
80
|
+
outline: "border border-border-strong bg-surface-1 text-text-primary shadow-sm hover:border-primary/55 hover:bg-surface-2 focus-visible:ring-ring/30",
|
|
81
|
+
secondary: "border border-border-base bg-surface-2 text-text-primary shadow-sm hover:bg-surface-3 focus-visible:ring-ring/30",
|
|
82
|
+
ghost: "text-text-primary hover:bg-surface-2 focus-visible:ring-ring/30",
|
|
83
|
+
link: "text-text-primary underline-offset-4 hover:underline focus-visible:ring-ring/30"
|
|
84
|
+
},
|
|
85
|
+
size: {
|
|
86
|
+
default: "h-9 px-4 py-2",
|
|
87
|
+
sm: "h-8 px-3 text-xs",
|
|
88
|
+
lg: "h-11 px-5 text-base",
|
|
89
|
+
icon: "h-9 w-9"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: {
|
|
93
|
+
variant: "default",
|
|
94
|
+
size: "default"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
var Button = (0, import_react.forwardRef)(
|
|
99
|
+
({ className, variant, size, loading = false, disabled, children, ...props }, ref) => {
|
|
100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
ref,
|
|
104
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
105
|
+
disabled: disabled || loading,
|
|
106
|
+
...props,
|
|
107
|
+
children: [
|
|
108
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "animate-spin", size: 16 }),
|
|
109
|
+
children
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
Button.displayName = "Button";
|
|
116
|
+
|
|
117
|
+
// src/components/input.tsx
|
|
118
|
+
var import_react2 = require("react");
|
|
119
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
120
|
+
var Input = (0, import_react2.forwardRef)(
|
|
121
|
+
({ className, label, error, helperText, id, ...props }, ref) => {
|
|
122
|
+
const generatedId = (0, import_react2.useId)();
|
|
123
|
+
const inputId = id ?? generatedId;
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
125
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
126
|
+
"label",
|
|
127
|
+
{
|
|
128
|
+
htmlFor: inputId,
|
|
129
|
+
className: "text-sm font-medium text-text-primary",
|
|
130
|
+
children: label
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
134
|
+
"input",
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
id: inputId,
|
|
138
|
+
className: cn(
|
|
139
|
+
"flex h-9 w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary",
|
|
140
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
|
|
141
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
142
|
+
error ? "border-danger focus-visible:ring-danger" : "border-border-strong focus-visible:ring-ring/30",
|
|
143
|
+
className
|
|
144
|
+
),
|
|
145
|
+
...props
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-danger", children: error }),
|
|
149
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-text-secondary", children: helperText })
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
Input.displayName = "Input";
|
|
154
|
+
|
|
155
|
+
// src/components/label.tsx
|
|
156
|
+
var import_react3 = require("react");
|
|
157
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
158
|
+
var Label = (0, import_react3.forwardRef)(({ className, required, children, ...props }, ref) => {
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
160
|
+
"label",
|
|
161
|
+
{
|
|
162
|
+
ref,
|
|
163
|
+
className: cn(
|
|
164
|
+
"leading-none text-sm font-medium text-text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
165
|
+
className
|
|
166
|
+
),
|
|
167
|
+
...props,
|
|
168
|
+
children: [
|
|
169
|
+
children,
|
|
170
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ml-0.5 text-danger", "aria-hidden": "true", children: "*" })
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
Label.displayName = "Label";
|
|
176
|
+
|
|
177
|
+
// src/components/card.tsx
|
|
178
|
+
var import_react4 = require("react");
|
|
179
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
180
|
+
var Card = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("rounded-lg border border-border-base bg-surface-1 shadow-sm", className), ...props });
|
|
182
|
+
});
|
|
183
|
+
var CardHeader = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("flex flex-col gap-1 px-5 py-4 border-b border-border-base", className), ...props });
|
|
185
|
+
});
|
|
186
|
+
var CardTitle = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { ref, className: cn("leading-none font-semibold text-text-primary", className), ...props });
|
|
188
|
+
});
|
|
189
|
+
var CardDescription = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
|
|
191
|
+
});
|
|
192
|
+
var CardContent = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("px-5 py-4", className), ...props });
|
|
194
|
+
});
|
|
195
|
+
var CardFooter = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("flex items-center px-5 py-4 border-t border-border-base", className), ...props });
|
|
197
|
+
});
|
|
198
|
+
Card.displayName = "Card";
|
|
199
|
+
CardHeader.displayName = "CardHeader";
|
|
200
|
+
CardTitle.displayName = "CardTitle";
|
|
201
|
+
CardDescription.displayName = "CardDescription";
|
|
202
|
+
CardContent.displayName = "CardContent";
|
|
203
|
+
CardFooter.displayName = "CardFooter";
|
|
204
|
+
|
|
205
|
+
// src/components/badge.tsx
|
|
206
|
+
var import_react5 = require("react");
|
|
207
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
208
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
209
|
+
var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
210
|
+
"inline-flex min-h-6 items-center rounded-md px-2.5 py-0.5 text-xs font-semibold leading-none transition-colors",
|
|
211
|
+
{
|
|
212
|
+
variants: {
|
|
213
|
+
variant: {
|
|
214
|
+
default: "border border-primary/20 bg-primary-soft text-primary-soft-fg",
|
|
215
|
+
secondary: "border border-border-base bg-surface-2 text-text-primary",
|
|
216
|
+
destructive: "border border-danger/20 bg-danger-soft text-danger-soft-fg",
|
|
217
|
+
outline: "border border-border-strong bg-transparent text-text-primary",
|
|
218
|
+
success: "border border-success/20 bg-success-soft text-success-soft-fg",
|
|
219
|
+
warning: "border border-warning/20 bg-warning-soft text-warning-soft-fg"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
defaultVariants: {
|
|
223
|
+
variant: "default"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
var Badge = (0, import_react5.forwardRef)(({ className, variant, ...props }, ref) => {
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { ref, className: cn(badgeVariants({ variant }), className), ...props });
|
|
229
|
+
});
|
|
230
|
+
Badge.displayName = "Badge";
|
|
231
|
+
|
|
232
|
+
// src/components/tag.tsx
|
|
233
|
+
var import_react6 = require("react");
|
|
234
|
+
var import_lucide_react2 = require("lucide-react");
|
|
235
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
236
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
237
|
+
var tagVariants = (0, import_class_variance_authority3.cva)(
|
|
238
|
+
"inline-flex items-center gap-1.5 rounded-md border font-medium leading-none transition-colors",
|
|
239
|
+
{
|
|
240
|
+
variants: {
|
|
241
|
+
variant: {
|
|
242
|
+
default: "border-border-base bg-surface-2 text-text-primary",
|
|
243
|
+
primary: "border-primary/20 bg-primary-soft text-primary-soft-fg",
|
|
244
|
+
success: "border-success/20 bg-success-soft text-success-soft-fg",
|
|
245
|
+
warning: "border-warning/20 bg-warning-soft text-warning-soft-fg",
|
|
246
|
+
destructive: "border-danger/20 bg-danger-soft text-danger-soft-fg",
|
|
247
|
+
outline: "border-border-strong bg-transparent text-text-primary"
|
|
248
|
+
},
|
|
249
|
+
size: {
|
|
250
|
+
sm: "min-h-6 px-2 text-[11px]",
|
|
251
|
+
default: "min-h-7 px-2.5 text-xs"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
defaultVariants: {
|
|
255
|
+
variant: "default",
|
|
256
|
+
size: "default"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
var Tag = (0, import_react6.forwardRef)(
|
|
261
|
+
({ variant, size, closable = false, disabled = false, color, onClose, className, children, style, ...props }, ref) => {
|
|
262
|
+
const customStyle = color ? { backgroundColor: color, color: "hsl(var(--primary-fg))", borderColor: color, ...style } : style ?? {};
|
|
263
|
+
function handleClose(event) {
|
|
264
|
+
event.stopPropagation();
|
|
265
|
+
if (!disabled) {
|
|
266
|
+
onClose?.(event);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
270
|
+
"span",
|
|
271
|
+
{
|
|
272
|
+
ref,
|
|
273
|
+
className: cn(tagVariants({ variant, size }), disabled && "cursor-not-allowed opacity-50", className),
|
|
274
|
+
style: customStyle,
|
|
275
|
+
...props,
|
|
276
|
+
children: [
|
|
277
|
+
children,
|
|
278
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
279
|
+
"button",
|
|
280
|
+
{
|
|
281
|
+
type: "button",
|
|
282
|
+
onClick: handleClose,
|
|
283
|
+
disabled,
|
|
284
|
+
className: "-mr-1 inline-flex h-4 w-4 items-center justify-center rounded-sm opacity-70 transition hover:bg-surface-3 hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:pointer-events-none",
|
|
285
|
+
"aria-label": "\u5173\u95ED\u6807\u7B7E",
|
|
286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.X, { size: 10, strokeWidth: 2.5 })
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
Tag.displayName = "Tag";
|
|
295
|
+
|
|
296
|
+
// src/components/separator.tsx
|
|
297
|
+
var import_react7 = require("react");
|
|
298
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
299
|
+
var ORIENTATION_CLASSES = {
|
|
300
|
+
horizontal: "h-px w-full bg-border-base",
|
|
301
|
+
vertical: "w-px h-full bg-border-base"
|
|
302
|
+
};
|
|
303
|
+
var Separator = (0, import_react7.forwardRef)(
|
|
304
|
+
({ orientation = "horizontal", className, ...props }, ref) => {
|
|
305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
ref,
|
|
309
|
+
role: "separator",
|
|
310
|
+
"aria-orientation": orientation,
|
|
311
|
+
className: cn(ORIENTATION_CLASSES[orientation], className),
|
|
312
|
+
...props
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
Separator.displayName = "Separator";
|
|
318
|
+
|
|
319
|
+
// src/components/spinner.tsx
|
|
320
|
+
var import_react8 = require("react");
|
|
321
|
+
var import_lucide_react3 = require("lucide-react");
|
|
322
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
323
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
324
|
+
var spinnerVariants = (0, import_class_variance_authority4.cva)("animate-spin text-text-tertiary", {
|
|
325
|
+
variants: {
|
|
326
|
+
size: {
|
|
327
|
+
sm: "h-4 w-4",
|
|
328
|
+
md: "h-6 w-6",
|
|
329
|
+
lg: "h-10 w-10"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
defaultVariants: {
|
|
333
|
+
size: "md"
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
var Spinner = (0, import_react8.forwardRef)(({ className, size, label = "\u52A0\u8F7D\u4E2D", ...props }, ref) => {
|
|
337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
338
|
+
import_lucide_react3.Loader2,
|
|
339
|
+
{
|
|
340
|
+
ref,
|
|
341
|
+
className: cn(spinnerVariants({ size }), className),
|
|
342
|
+
"aria-label": label,
|
|
343
|
+
role: "status",
|
|
344
|
+
...props
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
});
|
|
348
|
+
Spinner.displayName = "Spinner";
|
|
349
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
350
|
+
0 && (module.exports = {
|
|
351
|
+
Badge,
|
|
352
|
+
Button,
|
|
353
|
+
Card,
|
|
354
|
+
CardContent,
|
|
355
|
+
CardDescription,
|
|
356
|
+
CardFooter,
|
|
357
|
+
CardHeader,
|
|
358
|
+
CardTitle,
|
|
359
|
+
Input,
|
|
360
|
+
Label,
|
|
361
|
+
Separator,
|
|
362
|
+
Spinner,
|
|
363
|
+
Tag,
|
|
364
|
+
UGBadge,
|
|
365
|
+
UGButton,
|
|
366
|
+
UGCard,
|
|
367
|
+
UGCardContent,
|
|
368
|
+
UGCardDescription,
|
|
369
|
+
UGCardFooter,
|
|
370
|
+
UGCardHeader,
|
|
371
|
+
UGCardTitle,
|
|
372
|
+
UGInput,
|
|
373
|
+
UGLabel,
|
|
374
|
+
UGSeparator,
|
|
375
|
+
UGSpinner,
|
|
376
|
+
UGTag,
|
|
377
|
+
badgeVariants,
|
|
378
|
+
buttonVariants,
|
|
379
|
+
tagVariants,
|
|
380
|
+
ugBadgeVariants,
|
|
381
|
+
ugButtonVariants,
|
|
382
|
+
ugTagVariants
|
|
383
|
+
});
|
|
384
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/primitives/index.ts","../../src/components/button.tsx","../../src/internal/cn.ts","../../src/components/input.tsx","../../src/components/label.tsx","../../src/components/card.tsx","../../src/components/badge.tsx","../../src/components/tag.tsx","../../src/components/separator.tsx","../../src/components/spinner.tsx"],"sourcesContent":["\"use client\"\n\n/**\n * @description: React primitives 子入口 — 导出轻量高频基础组件\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-05-30\n */\n\nexport {\n Button,\n Button as UGButton,\n buttonVariants,\n buttonVariants as ugButtonVariants,\n type ButtonProps,\n type ButtonProps as UGButtonProps,\n} from '../components/button'\nexport {\n Input,\n Input as UGInput,\n type InputProps,\n type InputProps as UGInputProps,\n} from '../components/input'\nexport {\n Label,\n Label as UGLabel,\n type LabelProps,\n type LabelProps as UGLabelProps,\n} from '../components/label'\nexport {\n Card,\n Card as UGCard,\n CardHeader,\n CardHeader as UGCardHeader,\n CardTitle,\n CardTitle as UGCardTitle,\n CardDescription,\n CardDescription as UGCardDescription,\n CardContent,\n CardContent as UGCardContent,\n CardFooter,\n CardFooter as UGCardFooter,\n type CardProps,\n type CardProps as UGCardProps,\n type CardHeaderProps,\n type CardHeaderProps as UGCardHeaderProps,\n type CardTitleProps,\n type CardTitleProps as UGCardTitleProps,\n type CardDescriptionProps,\n type CardDescriptionProps as UGCardDescriptionProps,\n type CardContentProps,\n type CardContentProps as UGCardContentProps,\n type CardFooterProps,\n type CardFooterProps as UGCardFooterProps,\n} from '../components/card'\nexport {\n Badge,\n Badge as UGBadge,\n badgeVariants,\n badgeVariants as ugBadgeVariants,\n type BadgeProps,\n type BadgeProps as UGBadgeProps,\n} from '../components/badge'\nexport {\n Tag,\n Tag as UGTag,\n tagVariants,\n tagVariants as ugTagVariants,\n type TagProps,\n type TagProps as UGTagProps,\n} from '../components/tag'\nexport {\n Separator,\n Separator as UGSeparator,\n type SeparatorProps,\n type SeparatorProps as UGSeparatorProps,\n type SeparatorOrientation,\n type SeparatorOrientation as UGSeparatorOrientation,\n} from '../components/separator'\nexport {\n Spinner,\n Spinner as UGSpinner,\n type SpinnerProps,\n type SpinnerProps as UGSpinnerProps,\n} from '../components/spinner'\n","/**\n * @description: Button 按钮组件 — 基于 CVA 管理变体,支持 loading/disabled 状态\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { forwardRef } from 'react'\nimport { Loader2 } from 'lucide-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../internal/cn'\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-[background,border-color,color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n default:\n 'bg-primary text-primary-fg shadow-sm hover:bg-primary-hover hover:shadow-md focus-visible:ring-ring',\n destructive:\n 'bg-danger text-danger-fg shadow-sm hover:bg-danger-hover hover:shadow-md focus-visible:ring-danger',\n outline:\n 'border border-border-strong bg-surface-1 text-text-primary shadow-sm hover:border-primary/55 hover:bg-surface-2 focus-visible:ring-ring/30',\n secondary:\n 'border border-border-base bg-surface-2 text-text-primary shadow-sm hover:bg-surface-3 focus-visible:ring-ring/30',\n ghost:\n 'text-text-primary hover:bg-surface-2 focus-visible:ring-ring/30',\n link: 'text-text-primary underline-offset-4 hover:underline focus-visible:ring-ring/30',\n },\n size: {\n default: 'h-9 px-4 py-2',\n sm: 'h-8 px-3 text-xs',\n lg: 'h-11 px-5 text-base',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** 是否处于加载状态,加载时显示旋转图标并禁用点击 */\n loading?: boolean\n}\n\n/**\n * 通用按钮组件\n * @example\n * <Button variant=\"default\" size=\"lg\" onClick={handleClick}>确认</Button>\n * <Button variant=\"destructive\" loading>删除中...</Button>\n * <Button variant=\"outline\" size=\"sm\">取消</Button>\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, loading = false, disabled, children, ...props }, ref) => {\n return (\n <button\n ref={ref}\n className={cn(buttonVariants({ variant, size }), className)}\n disabled={disabled || loading}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" size={16} />}\n {children}\n </button>\n )\n }\n)\n\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n","/**\n * @description: React 包内部类名合并工具\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-05-27\n */\nimport { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs))\n}\n","/**\n * @description: Input 输入框组件 — 支持 label、error、helperText,error 状态边框变红\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { forwardRef, useId } from 'react'\nimport { cn } from '../internal/cn'\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n /** 输入框标签文本 */\n label?: string\n /** 错误提示文本,有值时边框变红 */\n error?: string\n /** 帮助说明文本 */\n helperText?: string\n}\n\n/**\n * 通用输入框组件\n * @example\n * <Input label=\"用户名\" placeholder=\"请输入用户名\" />\n * <Input label=\"邮箱\" error=\"邮箱格式不正确\" value={email} onChange={handleChange} />\n * <Input label=\"备注\" helperText=\"最多 200 字\" />\n */\nconst Input = forwardRef<HTMLInputElement, InputProps>(\n ({ className, label, error, helperText, id, ...props }, ref) => {\n const generatedId = useId()\n const inputId = id ?? generatedId\n\n return (\n <div className=\"flex flex-col gap-1\">\n {label && (\n <label\n htmlFor={inputId}\n className=\"text-sm font-medium text-text-primary\"\n >\n {label}\n </label>\n )}\n <input\n ref={ref}\n id={inputId}\n className={cn(\n 'flex h-9 w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n error\n ? 'border-danger focus-visible:ring-danger'\n : 'border-border-strong focus-visible:ring-ring/30',\n className\n )}\n {...props}\n />\n {error && (\n <p className=\"text-xs text-danger\">{error}</p>\n )}\n {!error && helperText && (\n <p className=\"text-xs text-text-secondary\">{helperText}</p>\n )}\n </div>\n )\n }\n)\n\nInput.displayName = 'Input'\n\nexport { Input }\n","/**\n * @description: Label 标签组件 — 支持 required 红色星号标记\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { forwardRef } from 'react'\nimport { cn } from '../internal/cn'\n\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n /** 是否为必填项,显示红色星号 */\n required?: boolean\n}\n\n/**\n * 通用标签组件\n * @example\n * <Label htmlFor=\"email\">邮箱</Label>\n * <Label htmlFor=\"name\" required>姓名</Label>\n */\nconst Label = forwardRef<HTMLLabelElement, LabelProps>(({ className, required, children, ...props }, ref) => {\n return (\n <label\n ref={ref}\n className={cn(\n 'leading-none text-sm font-medium text-text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {children}\n {required && (\n <span className=\"ml-0.5 text-danger\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )\n})\n\nLabel.displayName = 'Label'\n\nexport { Label }\n","/**\n * @description: Card 卡片组件 — 包含 Card/CardHeader/CardTitle/CardDescription/CardContent/CardFooter\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { forwardRef } from 'react'\nimport { cn } from '../internal/cn'\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement>\nexport type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>\nexport type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>\nexport type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement>\nexport type CardFooterProps = React.HTMLAttributes<HTMLDivElement>\n\n/**\n * 卡片容器\n * @example\n * <Card>\n * <CardHeader>\n * <CardTitle>标题</CardTitle>\n * <CardDescription>描述文字</CardDescription>\n * </CardHeader>\n * <CardContent>内容区域</CardContent>\n * <CardFooter>底部操作</CardFooter>\n * </Card>\n */\nconst Card = forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => {\n return <div ref={ref} className={cn('rounded-lg border border-border-base bg-surface-1 shadow-sm', className)} {...props} />\n})\n\nconst CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(({ className, ...props }, ref) => {\n return <div ref={ref} className={cn('flex flex-col gap-1 px-5 py-4 border-b border-border-base', className)} {...props} />\n})\n\nconst CardTitle = forwardRef<HTMLHeadingElement, CardTitleProps>(({ className, ...props }, ref) => {\n return <h3 ref={ref} className={cn('leading-none font-semibold text-text-primary', className)} {...props} />\n})\n\nconst CardDescription = forwardRef<HTMLParagraphElement, CardDescriptionProps>(({ className, ...props }, ref) => {\n return <p ref={ref} className={cn('text-sm text-text-secondary', className)} {...props} />\n})\n\nconst CardContent = forwardRef<HTMLDivElement, CardContentProps>(({ className, ...props }, ref) => {\n return <div ref={ref} className={cn('px-5 py-4', className)} {...props} />\n})\n\nconst CardFooter = forwardRef<HTMLDivElement, CardFooterProps>(({ className, ...props }, ref) => {\n return <div ref={ref} className={cn('flex items-center px-5 py-4 border-t border-border-base', className)} {...props} />\n})\n\nCard.displayName = 'Card'\nCardHeader.displayName = 'CardHeader'\nCardTitle.displayName = 'CardTitle'\nCardDescription.displayName = 'CardDescription'\nCardContent.displayName = 'CardContent'\nCardFooter.displayName = 'CardFooter'\n\nexport { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter }\n","/**\n * @description: Badge 徽标组件 — 基于 CVA 管理 default/secondary/destructive/outline/success/warning 变体\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { forwardRef } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../internal/cn'\n\nconst badgeVariants = cva(\n 'inline-flex min-h-6 items-center rounded-md px-2.5 py-0.5 text-xs font-semibold leading-none transition-colors',\n {\n variants: {\n variant: {\n default:\n 'border border-primary/20 bg-primary-soft text-primary-soft-fg',\n secondary:\n 'border border-border-base bg-surface-2 text-text-primary',\n destructive:\n 'border border-danger/20 bg-danger-soft text-danger-soft-fg',\n outline:\n 'border border-border-strong bg-transparent text-text-primary',\n success:\n 'border border-success/20 bg-success-soft text-success-soft-fg',\n warning:\n 'border border-warning/20 bg-warning-soft text-warning-soft-fg',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n)\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n VariantProps<typeof badgeVariants> {}\n\n/**\n * 徽标组件\n * @example\n * <Badge variant=\"default\">新品</Badge>\n * <Badge variant=\"success\">已完成</Badge>\n * <Badge variant=\"destructive\">已删除</Badge>\n * <Badge variant=\"warning\">待审核</Badge>\n */\nconst Badge = forwardRef<HTMLSpanElement, BadgeProps>(({ className, variant, ...props }, ref) => {\n return <span ref={ref} className={cn(badgeVariants({ variant }), className)} {...props} />\n})\n\nBadge.displayName = 'Badge'\n\nexport { Badge, badgeVariants }\n","/**\n * @description: Tag 标签组件 — 支持多种语义变体、可关闭交互,区别于纯展示的 Badge\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { forwardRef } from 'react'\nimport { X } from 'lucide-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../internal/cn'\n\nconst tagVariants = cva(\n 'inline-flex items-center gap-1.5 rounded-md border font-medium leading-none transition-colors',\n {\n variants: {\n variant: {\n default: 'border-border-base bg-surface-2 text-text-primary',\n primary: 'border-primary/20 bg-primary-soft text-primary-soft-fg',\n success: 'border-success/20 bg-success-soft text-success-soft-fg',\n warning: 'border-warning/20 bg-warning-soft text-warning-soft-fg',\n destructive: 'border-danger/20 bg-danger-soft text-danger-soft-fg',\n outline: 'border-border-strong bg-transparent text-text-primary',\n },\n size: {\n sm: 'min-h-6 px-2 text-[11px]',\n default: 'min-h-7 px-2.5 text-xs',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\nexport interface TagProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>,\n VariantProps<typeof tagVariants> {\n /** 是否显示关闭按钮 */\n closable?: boolean\n /** 是否禁用 */\n disabled?: boolean\n /** 自定义背景色(覆盖 variant 颜色,建议传 token CSS 变量) */\n color?: string\n /** 关闭按钮点击回调 */\n onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void\n}\n\n/**\n * 标签组件(可交互,支持关闭)\n * @example\n * <Tag>默认标签</Tag>\n * <Tag variant=\"success\">已完成</Tag>\n * <Tag variant=\"primary\" closable onClose={removeTag}>可关闭</Tag>\n * <Tag variant=\"warning\" disabled>禁用状态</Tag>\n * <Tag color=\"hsl(var(--primary))\">自定义颜色</Tag>\n */\nconst Tag = forwardRef<HTMLSpanElement, TagProps>(\n ({ variant, size, closable = false, disabled = false, color, onClose, className, children, style, ...props }, ref) => {\n const customStyle: React.CSSProperties = color\n ? { backgroundColor: color, color: 'hsl(var(--primary-fg))', borderColor: color, ...style }\n : (style ?? {})\n\n function handleClose(event: React.MouseEvent<HTMLButtonElement>) {\n event.stopPropagation()\n if (!disabled) {\n onClose?.(event)\n }\n }\n\n return (\n <span\n ref={ref}\n className={cn(tagVariants({ variant, size }), disabled && 'cursor-not-allowed opacity-50', className)}\n style={customStyle}\n {...props}\n >\n {children}\n {closable && (\n <button\n type=\"button\"\n onClick={handleClose}\n disabled={disabled}\n className=\"-mr-1 inline-flex h-4 w-4 items-center justify-center rounded-sm opacity-70 transition hover:bg-surface-3 hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:pointer-events-none\"\n aria-label=\"关闭标签\"\n >\n <X size={10} strokeWidth={2.5} />\n </button>\n )}\n </span>\n )\n }\n)\n\nTag.displayName = 'Tag'\n\nexport { Tag, tagVariants }\n","/**\n * @description: Separator 分割线组件 — 支持水平/垂直方向,纯展示组件\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { forwardRef } from 'react'\nimport { cn } from '../internal/cn'\n\n/** 分割线方向 */\nexport type SeparatorOrientation = 'horizontal' | 'vertical'\n\nexport interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /** 方向,默认 horizontal */\n orientation?: SeparatorOrientation\n}\n\n/** 各方向样式映射 */\nconst ORIENTATION_CLASSES: Record<SeparatorOrientation, string> = {\n horizontal: 'h-px w-full bg-border-base',\n vertical: 'w-px h-full bg-border-base',\n}\n\n/**\n * 分割线\n * @example\n * // 水平分割线\n * <Separator />\n *\n * // 垂直分割线(父容器需设定高度)\n * <div className=\"flex h-8 items-center gap-4\">\n * <span>左侧文字</span>\n * <Separator orientation=\"vertical\" />\n * <span>右侧文字</span>\n * </div>\n */\nconst Separator = forwardRef<HTMLDivElement, SeparatorProps>(\n ({ orientation = 'horizontal', className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation={orientation}\n className={cn(ORIENTATION_CLASSES[orientation], className)}\n {...props}\n />\n )\n }\n)\n\nSeparator.displayName = 'Separator'\n\nexport { Separator }\n","/**\n * @description: Spinner 加载旋转组件 — 基于 Loader2 图标,支持 sm/md/lg 三种尺寸\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { forwardRef } from 'react'\nimport { Loader2 } from 'lucide-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../internal/cn'\n\nconst spinnerVariants = cva('animate-spin text-text-tertiary', {\n variants: {\n size: {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-10 w-10',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n})\n\nexport interface SpinnerProps\n extends React.HTMLAttributes<SVGSVGElement>,\n VariantProps<typeof spinnerVariants> {\n /** 无障碍标签 */\n label?: string\n}\n\n/**\n * 加载旋转动画\n * @example\n * <Spinner />\n * <Spinner size=\"sm\" />\n * <Spinner size=\"lg\" className=\"text-primary\" />\n */\nconst Spinner = forwardRef<SVGSVGElement, SpinnerProps>(({ className, size, label = '加载中', ...props }, ref) => {\n return (\n <Loader2\n ref={ref}\n className={cn(spinnerVariants({ size }), className)}\n aria-label={label}\n role=\"status\"\n {...props}\n />\n )\n})\n\nSpinner.displayName = 'Spinner'\n\nexport { Spinner }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,mBAA2B;AAC3B,0BAAwB;AACxB,s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EAChB,CAAC,EAAE,cAAc,cAAc,WAAW,GAAG,MAAM,GAAG,QAAQ;AAC5D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,oBAAkB;AAAA,QAClB,WAAW,GAAG,oBAAoB,WAAW,GAAG,SAAS;AAAA,QACxD,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;;;AC5CxB,IAAAC,gBAA2B;AAC3B,IAAAC,uBAAwB;AACxB,IAAAC,mCAAuC;AAgCnC,IAAAC,sBAAA;AA7BJ,IAAM,sBAAkB,sCAAI,mCAAmC;AAAA,EAC7D,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAgBD,IAAM,cAAU,0BAAwC,CAAC,EAAE,WAAW,MAAM,QAAQ,sBAAO,GAAG,MAAM,GAAG,QAAQ;AAC7G,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,gBAAgB,EAAE,KAAK,CAAC,GAAG,SAAS;AAAA,MAClD,cAAY;AAAA,MACZ,MAAK;AAAA,MACJ,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AAED,QAAQ,cAAc;","names":["import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_class_variance_authority","import_jsx_runtime","import_react","import_lucide_react","import_class_variance_authority","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_lucide_react","import_class_variance_authority","import_jsx_runtime"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export { a as Button, B as ButtonProps, a as UGButton, B as UGButtonProps, b as buttonVariants, b as ugButtonVariants } from '../button-CaLZig8j.cjs';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
7
|
+
/** 输入框标签文本 */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** 错误提示文本,有值时边框变红 */
|
|
10
|
+
error?: string;
|
|
11
|
+
/** 帮助说明文本 */
|
|
12
|
+
helperText?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 通用输入框组件
|
|
16
|
+
* @example
|
|
17
|
+
* <Input label="用户名" placeholder="请输入用户名" />
|
|
18
|
+
* <Input label="邮箱" error="邮箱格式不正确" value={email} onChange={handleChange} />
|
|
19
|
+
* <Input label="备注" helperText="最多 200 字" />
|
|
20
|
+
*/
|
|
21
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
22
|
+
|
|
23
|
+
interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
24
|
+
/** 是否为必填项,显示红色星号 */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 通用标签组件
|
|
29
|
+
* @example
|
|
30
|
+
* <Label htmlFor="email">邮箱</Label>
|
|
31
|
+
* <Label htmlFor="name" required>姓名</Label>
|
|
32
|
+
*/
|
|
33
|
+
declare const Label: react.ForwardRefExoticComponent<LabelProps & react.RefAttributes<HTMLLabelElement>>;
|
|
34
|
+
|
|
35
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement>;
|
|
36
|
+
type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
37
|
+
type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
38
|
+
type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
39
|
+
type CardContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
40
|
+
type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
41
|
+
/**
|
|
42
|
+
* 卡片容器
|
|
43
|
+
* @example
|
|
44
|
+
* <Card>
|
|
45
|
+
* <CardHeader>
|
|
46
|
+
* <CardTitle>标题</CardTitle>
|
|
47
|
+
* <CardDescription>描述文字</CardDescription>
|
|
48
|
+
* </CardHeader>
|
|
49
|
+
* <CardContent>内容区域</CardContent>
|
|
50
|
+
* <CardFooter>底部操作</CardFooter>
|
|
51
|
+
* </Card>
|
|
52
|
+
*/
|
|
53
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
|
|
54
|
+
declare const CardHeader: react.ForwardRefExoticComponent<CardHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
declare const CardTitle: react.ForwardRefExoticComponent<CardTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
56
|
+
declare const CardDescription: react.ForwardRefExoticComponent<CardDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
57
|
+
declare const CardContent: react.ForwardRefExoticComponent<CardContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
declare const CardFooter: react.ForwardRefExoticComponent<CardFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
|
|
60
|
+
declare const badgeVariants: (props?: ({
|
|
61
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "success" | "warning" | null | undefined;
|
|
62
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
63
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 徽标组件
|
|
67
|
+
* @example
|
|
68
|
+
* <Badge variant="default">新品</Badge>
|
|
69
|
+
* <Badge variant="success">已完成</Badge>
|
|
70
|
+
* <Badge variant="destructive">已删除</Badge>
|
|
71
|
+
* <Badge variant="warning">待审核</Badge>
|
|
72
|
+
*/
|
|
73
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
74
|
+
|
|
75
|
+
declare const tagVariants: (props?: ({
|
|
76
|
+
variant?: "default" | "destructive" | "outline" | "success" | "warning" | "primary" | null | undefined;
|
|
77
|
+
size?: "default" | "sm" | null | undefined;
|
|
78
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
79
|
+
interface TagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>, VariantProps<typeof tagVariants> {
|
|
80
|
+
/** 是否显示关闭按钮 */
|
|
81
|
+
closable?: boolean;
|
|
82
|
+
/** 是否禁用 */
|
|
83
|
+
disabled?: boolean;
|
|
84
|
+
/** 自定义背景色(覆盖 variant 颜色,建议传 token CSS 变量) */
|
|
85
|
+
color?: string;
|
|
86
|
+
/** 关闭按钮点击回调 */
|
|
87
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 标签组件(可交互,支持关闭)
|
|
91
|
+
* @example
|
|
92
|
+
* <Tag>默认标签</Tag>
|
|
93
|
+
* <Tag variant="success">已完成</Tag>
|
|
94
|
+
* <Tag variant="primary" closable onClose={removeTag}>可关闭</Tag>
|
|
95
|
+
* <Tag variant="warning" disabled>禁用状态</Tag>
|
|
96
|
+
* <Tag color="hsl(var(--primary))">自定义颜色</Tag>
|
|
97
|
+
*/
|
|
98
|
+
declare const Tag: react.ForwardRefExoticComponent<TagProps & react.RefAttributes<HTMLSpanElement>>;
|
|
99
|
+
|
|
100
|
+
declare const spinnerVariants: (props?: ({
|
|
101
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
102
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
103
|
+
interface SpinnerProps extends React.HTMLAttributes<SVGSVGElement>, VariantProps<typeof spinnerVariants> {
|
|
104
|
+
/** 无障碍标签 */
|
|
105
|
+
label?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 加载旋转动画
|
|
109
|
+
* @example
|
|
110
|
+
* <Spinner />
|
|
111
|
+
* <Spinner size="sm" />
|
|
112
|
+
* <Spinner size="lg" className="text-primary" />
|
|
113
|
+
*/
|
|
114
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<SVGSVGElement>>;
|
|
115
|
+
|
|
116
|
+
/** 分割线方向 */
|
|
117
|
+
type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
118
|
+
interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
119
|
+
/** 方向,默认 horizontal */
|
|
120
|
+
orientation?: SeparatorOrientation;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 分割线
|
|
124
|
+
* @example
|
|
125
|
+
* // 水平分割线
|
|
126
|
+
* <Separator />
|
|
127
|
+
*
|
|
128
|
+
* // 垂直分割线(父容器需设定高度)
|
|
129
|
+
* <div className="flex h-8 items-center gap-4">
|
|
130
|
+
* <span>左侧文字</span>
|
|
131
|
+
* <Separator orientation="vertical" />
|
|
132
|
+
* <span>右侧文字</span>
|
|
133
|
+
* </div>
|
|
134
|
+
*/
|
|
135
|
+
declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
136
|
+
|
|
137
|
+
export { Badge, type BadgeProps, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Input, type InputProps, Label, type LabelProps, Separator, type SeparatorOrientation, type SeparatorProps, Spinner, type SpinnerProps, Tag, type TagProps, Badge as UGBadge, type BadgeProps as UGBadgeProps, Card as UGCard, CardContent as UGCardContent, type CardContentProps as UGCardContentProps, CardDescription as UGCardDescription, type CardDescriptionProps as UGCardDescriptionProps, CardFooter as UGCardFooter, type CardFooterProps as UGCardFooterProps, CardHeader as UGCardHeader, type CardHeaderProps as UGCardHeaderProps, type CardProps as UGCardProps, CardTitle as UGCardTitle, type CardTitleProps as UGCardTitleProps, Input as UGInput, type InputProps as UGInputProps, Label as UGLabel, type LabelProps as UGLabelProps, Separator as UGSeparator, type SeparatorOrientation as UGSeparatorOrientation, type SeparatorProps as UGSeparatorProps, Spinner as UGSpinner, type SpinnerProps as UGSpinnerProps, Tag as UGTag, type TagProps as UGTagProps, badgeVariants, tagVariants, badgeVariants as ugBadgeVariants, tagVariants as ugTagVariants };
|