@agroshine/ags-web-ui-kit 1.0.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/README.md +75 -0
- package/dist/atoms/index.cjs +134 -0
- package/dist/atoms/index.cjs.map +1 -0
- package/dist/atoms/index.d.cts +583 -0
- package/dist/atoms/index.d.ts +583 -0
- package/dist/atoms/index.js +9 -0
- package/dist/atoms/index.js.map +1 -0
- package/dist/chunk-2KRMLIJQ.cjs +52 -0
- package/dist/chunk-2KRMLIJQ.cjs.map +1 -0
- package/dist/chunk-2TBYPKQ3.cjs +79 -0
- package/dist/chunk-2TBYPKQ3.cjs.map +1 -0
- package/dist/chunk-5FWELSEZ.js +1296 -0
- package/dist/chunk-5FWELSEZ.js.map +1 -0
- package/dist/chunk-5PEOJVY7.cjs +1502 -0
- package/dist/chunk-5PEOJVY7.cjs.map +1 -0
- package/dist/chunk-6LUGTNMH.js +259 -0
- package/dist/chunk-6LUGTNMH.js.map +1 -0
- package/dist/chunk-6O2IDBTX.js +112 -0
- package/dist/chunk-6O2IDBTX.js.map +1 -0
- package/dist/chunk-6YUNWKT3.js +26 -0
- package/dist/chunk-6YUNWKT3.js.map +1 -0
- package/dist/chunk-7R6OXNES.cjs +321 -0
- package/dist/chunk-7R6OXNES.cjs.map +1 -0
- package/dist/chunk-A3A7PJWG.cjs +13 -0
- package/dist/chunk-A3A7PJWG.cjs.map +1 -0
- package/dist/chunk-A7TDGQAB.js +557 -0
- package/dist/chunk-A7TDGQAB.js.map +1 -0
- package/dist/chunk-C4LX3XTN.cjs +1187 -0
- package/dist/chunk-C4LX3XTN.cjs.map +1 -0
- package/dist/chunk-DZW4GS2T.cjs +1340 -0
- package/dist/chunk-DZW4GS2T.cjs.map +1 -0
- package/dist/chunk-E3BTK736.cjs +174 -0
- package/dist/chunk-E3BTK736.cjs.map +1 -0
- package/dist/chunk-ERGKCXM2.cjs +267 -0
- package/dist/chunk-ERGKCXM2.cjs.map +1 -0
- package/dist/chunk-FOA46NSG.cjs +574 -0
- package/dist/chunk-FOA46NSG.cjs.map +1 -0
- package/dist/chunk-JTFCE6RA.js +1156 -0
- package/dist/chunk-JTFCE6RA.js.map +1 -0
- package/dist/chunk-KINOE57L.js +225 -0
- package/dist/chunk-KINOE57L.js.map +1 -0
- package/dist/chunk-MOED3QPY.js +11 -0
- package/dist/chunk-MOED3QPY.js.map +1 -0
- package/dist/chunk-NVR34DY2.cjs +4 -0
- package/dist/chunk-NVR34DY2.cjs.map +1 -0
- package/dist/chunk-PI3IJWBG.js +79 -0
- package/dist/chunk-PI3IJWBG.js.map +1 -0
- package/dist/chunk-PXAMTGYY.js +3 -0
- package/dist/chunk-PXAMTGYY.js.map +1 -0
- package/dist/chunk-QAZMI5VH.js +151 -0
- package/dist/chunk-QAZMI5VH.js.map +1 -0
- package/dist/chunk-QEG27NX6.js +30 -0
- package/dist/chunk-QEG27NX6.js.map +1 -0
- package/dist/chunk-THTOUSMG.cjs +52 -0
- package/dist/chunk-THTOUSMG.cjs.map +1 -0
- package/dist/chunk-UAXKB6IH.cjs +32 -0
- package/dist/chunk-UAXKB6IH.cjs.map +1 -0
- package/dist/chunk-W5IHWAMM.js +48 -0
- package/dist/chunk-W5IHWAMM.js.map +1 -0
- package/dist/chunk-X2UJQVZJ.cjs +139 -0
- package/dist/chunk-X2UJQVZJ.cjs.map +1 -0
- package/dist/chunk-X43C5OJD.js +1460 -0
- package/dist/chunk-X43C5OJD.js.map +1 -0
- package/dist/chunk-XCYSBWV4.js +56 -0
- package/dist/chunk-XCYSBWV4.js.map +1 -0
- package/dist/chunk-XX4CBCEB.cjs +102 -0
- package/dist/chunk-XX4CBCEB.cjs.map +1 -0
- package/dist/hooks/index.cjs +33 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +59 -0
- package/dist/hooks/index.d.ts +59 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +366 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/interface-DnK5S6ww.d.cts +51 -0
- package/dist/interface-DnK5S6ww.d.ts +51 -0
- package/dist/lib/index.cjs +13 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +5 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/molecules/index.cjs +123 -0
- package/dist/molecules/index.cjs.map +1 -0
- package/dist/molecules/index.d.cts +449 -0
- package/dist/molecules/index.d.ts +449 -0
- package/dist/molecules/index.js +10 -0
- package/dist/molecules/index.js.map +1 -0
- package/dist/organisms/index.cjs +102 -0
- package/dist/organisms/index.cjs.map +1 -0
- package/dist/organisms/index.d.cts +396 -0
- package/dist/organisms/index.d.ts +396 -0
- package/dist/organisms/index.js +9 -0
- package/dist/organisms/index.js.map +1 -0
- package/dist/tooltip-Bl2ZTtfg.d.cts +16 -0
- package/dist/tooltip-Bl2ZTtfg.d.ts +16 -0
- package/dist/ui/index.cjs +955 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.cts +252 -0
- package/dist/ui/index.d.ts +252 -0
- package/dist/ui/index.js +642 -0
- package/dist/ui/index.js.map +1 -0
- package/package.json +200 -0
- package/tailwind.preset.cjs +134 -0
|
@@ -0,0 +1,1502 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUAXKB6IH_cjs = require('./chunk-UAXKB6IH.cjs');
|
|
4
|
+
var chunkERGKCXM2_cjs = require('./chunk-ERGKCXM2.cjs');
|
|
5
|
+
var chunkA3A7PJWG_cjs = require('./chunk-A3A7PJWG.cjs');
|
|
6
|
+
var React5 = require('react');
|
|
7
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var lucideReact = require('lucide-react');
|
|
10
|
+
var ProgressPrimitive = require('@radix-ui/react-progress');
|
|
11
|
+
var SliderPrimitive = require('@radix-ui/react-slider');
|
|
12
|
+
var SwitchPrimitives = require('@radix-ui/react-switch');
|
|
13
|
+
var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
|
|
34
|
+
var ProgressPrimitive__namespace = /*#__PURE__*/_interopNamespace(ProgressPrimitive);
|
|
35
|
+
var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
|
|
36
|
+
var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
|
|
37
|
+
var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
|
|
38
|
+
|
|
39
|
+
var avatarVariants = classVarianceAuthority.cva(
|
|
40
|
+
"relative flex shrink-0 overflow-hidden bg-default-200 text-default-700",
|
|
41
|
+
{
|
|
42
|
+
variants: {
|
|
43
|
+
size: {
|
|
44
|
+
sm: "h-8 w-8 text-xs",
|
|
45
|
+
md: "h-10 w-10 text-sm",
|
|
46
|
+
lg: "h-12 w-12 text-base",
|
|
47
|
+
xl: "h-16 w-16 text-lg"
|
|
48
|
+
},
|
|
49
|
+
shape: {
|
|
50
|
+
circle: "rounded-full",
|
|
51
|
+
square: "rounded-md"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: { size: "md", shape: "circle" }
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
var Avatar2 = React5__namespace.forwardRef(
|
|
58
|
+
({ src, alt, fallback, size = "md", shape = "circle", className }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(chunkERGKCXM2_cjs.Avatar, { ref, className: chunkA3A7PJWG_cjs.cn(avatarVariants({ size, shape }), className), children: [
|
|
59
|
+
src ? /* @__PURE__ */ jsxRuntime.jsx(chunkERGKCXM2_cjs.AvatarImage, { src, alt }) : null,
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
chunkERGKCXM2_cjs.AvatarFallback,
|
|
62
|
+
{
|
|
63
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
64
|
+
"flex h-full w-full items-center justify-center bg-default-200 text-default-700 font-medium",
|
|
65
|
+
shape === "circle" ? "rounded-full" : "rounded-md"
|
|
66
|
+
),
|
|
67
|
+
children: fallback
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] })
|
|
71
|
+
);
|
|
72
|
+
Avatar2.displayName = "Avatar";
|
|
73
|
+
var Checkbox2 = ({
|
|
74
|
+
isSelected,
|
|
75
|
+
defaultSelected,
|
|
76
|
+
isDisabled,
|
|
77
|
+
isIndeterminate,
|
|
78
|
+
onValueChange,
|
|
79
|
+
children,
|
|
80
|
+
className,
|
|
81
|
+
classNames,
|
|
82
|
+
name,
|
|
83
|
+
value,
|
|
84
|
+
id
|
|
85
|
+
}) => {
|
|
86
|
+
const checkedProp = isIndeterminate === true ? "indeterminate" : isSelected !== void 0 ? isSelected : void 0;
|
|
87
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
88
|
+
"label",
|
|
89
|
+
{
|
|
90
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
91
|
+
"inline-flex items-center gap-2 cursor-pointer select-none",
|
|
92
|
+
isDisabled && "cursor-not-allowed opacity-60",
|
|
93
|
+
classNames?.base,
|
|
94
|
+
className
|
|
95
|
+
),
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
chunkERGKCXM2_cjs.Checkbox,
|
|
99
|
+
{
|
|
100
|
+
id,
|
|
101
|
+
name,
|
|
102
|
+
value,
|
|
103
|
+
disabled: isDisabled,
|
|
104
|
+
defaultChecked: defaultSelected,
|
|
105
|
+
checked: checkedProp,
|
|
106
|
+
onCheckedChange: (c) => onValueChange?.(Boolean(c)),
|
|
107
|
+
className: classNames?.wrapper
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkA3A7PJWG_cjs.cn("text-sm", classNames?.label), children })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
var ROW_PADDING = {
|
|
116
|
+
small: "py-1.5",
|
|
117
|
+
default: "py-2.5",
|
|
118
|
+
// canon (10px)
|
|
119
|
+
middle: "py-2.5",
|
|
120
|
+
// alias compat
|
|
121
|
+
large: "py-3.5"
|
|
122
|
+
};
|
|
123
|
+
var LABEL_TEXT = {
|
|
124
|
+
small: "text-[12px]",
|
|
125
|
+
default: "text-[13px]",
|
|
126
|
+
// canon
|
|
127
|
+
middle: "text-[13px]",
|
|
128
|
+
large: "text-sm"
|
|
129
|
+
};
|
|
130
|
+
var VALUE_TEXT = {
|
|
131
|
+
small: "text-[13px]",
|
|
132
|
+
default: "text-sm",
|
|
133
|
+
// canon (14px)
|
|
134
|
+
middle: "text-sm",
|
|
135
|
+
large: "text-base"
|
|
136
|
+
};
|
|
137
|
+
function DescRow({ label, value, size, layout, bordered, isLast }) {
|
|
138
|
+
const rowBorder = bordered ? "border-b border-border last:border-b-0" : chunkA3A7PJWG_cjs.cn("border-b border-border", isLast && "border-b-0");
|
|
139
|
+
if (layout === "vertical") {
|
|
140
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkA3A7PJWG_cjs.cn(ROW_PADDING[size], rowBorder, bordered && "px-3"), children: [
|
|
141
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkA3A7PJWG_cjs.cn("mb-1 font-normal text-muted-foreground", LABEL_TEXT[size]), children: label }),
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkA3A7PJWG_cjs.cn("font-medium text-foreground", VALUE_TEXT[size]), children: value })
|
|
143
|
+
] });
|
|
144
|
+
}
|
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
149
|
+
"grid grid-cols-[140px_1fr] items-baseline gap-3",
|
|
150
|
+
ROW_PADDING[size],
|
|
151
|
+
rowBorder
|
|
152
|
+
),
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
+
"span",
|
|
156
|
+
{
|
|
157
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
158
|
+
"font-normal text-muted-foreground",
|
|
159
|
+
LABEL_TEXT[size],
|
|
160
|
+
bordered && "-my-2.5 bg-muted/40 px-3 py-2.5"
|
|
161
|
+
),
|
|
162
|
+
children: label
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkA3A7PJWG_cjs.cn("font-medium text-foreground", VALUE_TEXT[size], bordered && "pr-3"), children: value })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
var Descriptions = React5.forwardRef(function Descriptions2({
|
|
171
|
+
title,
|
|
172
|
+
column = 1,
|
|
173
|
+
layout = "horizontal",
|
|
174
|
+
size = "default",
|
|
175
|
+
bordered = false,
|
|
176
|
+
items,
|
|
177
|
+
className
|
|
178
|
+
}, ref) {
|
|
179
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
180
|
+
"div",
|
|
181
|
+
{
|
|
182
|
+
ref,
|
|
183
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
184
|
+
"w-full",
|
|
185
|
+
bordered && "overflow-hidden rounded-md border border-border",
|
|
186
|
+
className
|
|
187
|
+
),
|
|
188
|
+
children: [
|
|
189
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
193
|
+
"mb-3 text-base font-semibold text-foreground",
|
|
194
|
+
bordered && "mb-0 border-b border-border bg-muted/40 px-3 py-2.5"
|
|
195
|
+
),
|
|
196
|
+
children: title
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
className: chunkA3A7PJWG_cjs.cn(column === 1 ? "flex flex-col" : "grid"),
|
|
203
|
+
style: column > 1 ? { gridTemplateColumns: `repeat(${column}, minmax(0, 1fr))`, columnGap: "24px" } : void 0,
|
|
204
|
+
children: items.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(React5.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
205
|
+
DescRow,
|
|
206
|
+
{
|
|
207
|
+
label: item.label,
|
|
208
|
+
value: item.children,
|
|
209
|
+
size,
|
|
210
|
+
layout,
|
|
211
|
+
bordered,
|
|
212
|
+
isLast: idx === items.length - 1
|
|
213
|
+
}
|
|
214
|
+
) }, idx))
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
Descriptions.displayName = "Descriptions";
|
|
222
|
+
var sizeClasses = {
|
|
223
|
+
small: "h-7 text-[13px] px-2.5",
|
|
224
|
+
default: "h-9 text-sm px-3",
|
|
225
|
+
large: "h-10 text-[15px] px-4"
|
|
226
|
+
};
|
|
227
|
+
var statusBorderClasses = {
|
|
228
|
+
error: "border-destructive focus-visible:ring-destructive",
|
|
229
|
+
success: "border-success-500 focus-visible:ring-success-500",
|
|
230
|
+
warning: "border-warning-500 focus-visible:ring-warning-500",
|
|
231
|
+
default: ""
|
|
232
|
+
};
|
|
233
|
+
var Input2 = React5.forwardRef(function Input3({
|
|
234
|
+
variant = "default",
|
|
235
|
+
prefix,
|
|
236
|
+
suffix,
|
|
237
|
+
allowClear = false,
|
|
238
|
+
status = "default",
|
|
239
|
+
showPasswordToggle = false,
|
|
240
|
+
type = "text",
|
|
241
|
+
disabled,
|
|
242
|
+
className,
|
|
243
|
+
name,
|
|
244
|
+
touched,
|
|
245
|
+
error,
|
|
246
|
+
externalLabel,
|
|
247
|
+
help,
|
|
248
|
+
errorMessage,
|
|
249
|
+
onChange,
|
|
250
|
+
value,
|
|
251
|
+
defaultValue,
|
|
252
|
+
...rest
|
|
253
|
+
}, ref) {
|
|
254
|
+
const [internalValue, setInternalValue] = React5.useState(defaultValue ?? "");
|
|
255
|
+
const isControlled = value !== void 0;
|
|
256
|
+
const currentValue = isControlled ? value : internalValue;
|
|
257
|
+
const [showPassword, setShowPassword] = React5.useState(false);
|
|
258
|
+
const isPasswordType = type === "password";
|
|
259
|
+
const inputType = isPasswordType && showPasswordToggle ? showPassword ? "text" : "password" : type;
|
|
260
|
+
const showClearButton = allowClear && !disabled && Boolean(currentValue);
|
|
261
|
+
const showPasswordButton = isPasswordType && showPasswordToggle && !disabled;
|
|
262
|
+
const hasRightAffix = Boolean(suffix) || showClearButton || showPasswordButton;
|
|
263
|
+
const hasLeftAffix = Boolean(prefix);
|
|
264
|
+
const messageColor2 = status === "error" ? "text-destructive" : status === "warning" ? "text-warning-700" : "";
|
|
265
|
+
const handleChange = (e) => {
|
|
266
|
+
if (!isControlled) setInternalValue(e.target.value);
|
|
267
|
+
onChange?.(e);
|
|
268
|
+
};
|
|
269
|
+
const handleClear = () => {
|
|
270
|
+
if (!isControlled) setInternalValue("");
|
|
271
|
+
onChange?.({ target: { value: "" } });
|
|
272
|
+
};
|
|
273
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
274
|
+
chunkUAXKB6IH_cjs.FormItem,
|
|
275
|
+
{
|
|
276
|
+
help: touched || error ? help : "",
|
|
277
|
+
validateStatus: touched && error ? "error" : "default",
|
|
278
|
+
label: externalLabel,
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkA3A7PJWG_cjs.cn("relative w-full", className), children: [
|
|
281
|
+
hasLeftAffix && /* @__PURE__ */ jsxRuntime.jsx(
|
|
282
|
+
"span",
|
|
283
|
+
{
|
|
284
|
+
className: "pointer-events-none absolute inset-y-0 left-0 flex items-center px-2.5 text-muted-foreground",
|
|
285
|
+
"aria-hidden": "true",
|
|
286
|
+
children: prefix
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
290
|
+
chunkERGKCXM2_cjs.Input,
|
|
291
|
+
{
|
|
292
|
+
ref,
|
|
293
|
+
name,
|
|
294
|
+
type: inputType,
|
|
295
|
+
disabled,
|
|
296
|
+
value: currentValue,
|
|
297
|
+
onChange: handleChange,
|
|
298
|
+
"aria-invalid": status === "error" || touched && Boolean(error) || void 0,
|
|
299
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
300
|
+
sizeClasses[variant],
|
|
301
|
+
statusBorderClasses[status],
|
|
302
|
+
hasLeftAffix && "pl-9",
|
|
303
|
+
hasRightAffix && "pr-9"
|
|
304
|
+
),
|
|
305
|
+
...rest
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
hasRightAffix && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute inset-y-0 right-0 flex items-center gap-1 px-2.5 text-muted-foreground", children: [
|
|
309
|
+
showClearButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
"button",
|
|
311
|
+
{
|
|
312
|
+
type: "button",
|
|
313
|
+
onClick: handleClear,
|
|
314
|
+
"aria-label": "Limpiar",
|
|
315
|
+
className: "inline-flex items-center justify-center text-muted-foreground hover:text-foreground",
|
|
316
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5" })
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
showPasswordButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
type: "button",
|
|
323
|
+
onClick: () => setShowPassword((v) => !v),
|
|
324
|
+
"aria-label": showPassword ? "Ocultar contrase\xF1a" : "Mostrar contrase\xF1a",
|
|
325
|
+
"aria-pressed": showPassword,
|
|
326
|
+
className: "inline-flex items-center justify-center text-muted-foreground hover:text-foreground",
|
|
327
|
+
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4" })
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none flex items-center text-muted-foreground", children: suffix })
|
|
331
|
+
] })
|
|
332
|
+
] }),
|
|
333
|
+
errorMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
334
|
+
"p",
|
|
335
|
+
{
|
|
336
|
+
className: chunkA3A7PJWG_cjs.cn("mt-1 text-xs", messageColor2),
|
|
337
|
+
role: status === "error" ? "alert" : void 0,
|
|
338
|
+
children: errorMessage
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
var inputNumberRootVariants = classVarianceAuthority.cva(
|
|
346
|
+
"inline-flex items-center w-full rounded border bg-background text-default-900 transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background",
|
|
347
|
+
{
|
|
348
|
+
variants: {
|
|
349
|
+
size: {
|
|
350
|
+
sm: "text-xs h-8",
|
|
351
|
+
md: "text-sm h-10",
|
|
352
|
+
lg: "text-base h-12"
|
|
353
|
+
},
|
|
354
|
+
disabled: {
|
|
355
|
+
true: "opacity-60 cursor-not-allowed bg-default-100",
|
|
356
|
+
false: ""
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
defaultVariants: { size: "md", disabled: false }
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
var inputNumberButtonVariants = classVarianceAuthority.cva(
|
|
363
|
+
"flex items-center justify-center text-default-700 hover:bg-default-100 disabled:opacity-40 disabled:cursor-not-allowed border-default-200",
|
|
364
|
+
{
|
|
365
|
+
variants: {
|
|
366
|
+
size: {
|
|
367
|
+
sm: "w-7 h-full",
|
|
368
|
+
md: "w-8 h-full",
|
|
369
|
+
lg: "w-10 h-full"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
defaultVariants: { size: "md" }
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
function clamp(v, min, max) {
|
|
376
|
+
return Math.min(max, Math.max(min, v));
|
|
377
|
+
}
|
|
378
|
+
function format(v, precision) {
|
|
379
|
+
if (precision === void 0) return String(v);
|
|
380
|
+
return v.toFixed(precision);
|
|
381
|
+
}
|
|
382
|
+
var InputNumber = React5__namespace.forwardRef(
|
|
383
|
+
({
|
|
384
|
+
value,
|
|
385
|
+
defaultValue,
|
|
386
|
+
onChange,
|
|
387
|
+
min = Number.NEGATIVE_INFINITY,
|
|
388
|
+
max = Number.POSITIVE_INFINITY,
|
|
389
|
+
step = 1,
|
|
390
|
+
size = "md",
|
|
391
|
+
disabled,
|
|
392
|
+
precision,
|
|
393
|
+
placeholder,
|
|
394
|
+
name,
|
|
395
|
+
id,
|
|
396
|
+
className
|
|
397
|
+
}, ref) => {
|
|
398
|
+
const [internal, setInternal] = React5__namespace.useState(defaultValue);
|
|
399
|
+
const current = value ?? internal;
|
|
400
|
+
const update = (next) => {
|
|
401
|
+
const c = clamp(next, min, max);
|
|
402
|
+
if (value === void 0) setInternal(c);
|
|
403
|
+
onChange?.(c);
|
|
404
|
+
};
|
|
405
|
+
const increment = () => update((current ?? 0) + step);
|
|
406
|
+
const decrement = () => update((current ?? 0) - step);
|
|
407
|
+
const handleInput = (e) => {
|
|
408
|
+
const raw = e.target.value;
|
|
409
|
+
if (raw === "") {
|
|
410
|
+
if (value === void 0) setInternal(void 0);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const num = Number(raw);
|
|
414
|
+
if (Number.isNaN(num)) return;
|
|
415
|
+
update(num);
|
|
416
|
+
};
|
|
417
|
+
const display = current === void 0 ? "" : format(current, precision);
|
|
418
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkA3A7PJWG_cjs.cn(inputNumberRootVariants({ size, disabled: !!disabled }), className), children: [
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
+
"input",
|
|
421
|
+
{
|
|
422
|
+
ref,
|
|
423
|
+
id,
|
|
424
|
+
name,
|
|
425
|
+
type: "number",
|
|
426
|
+
value: display,
|
|
427
|
+
onChange: handleInput,
|
|
428
|
+
disabled,
|
|
429
|
+
placeholder,
|
|
430
|
+
className: "flex-1 bg-transparent outline-none px-3 disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full border-l border-default-200", children: [
|
|
434
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
435
|
+
"button",
|
|
436
|
+
{
|
|
437
|
+
type: "button",
|
|
438
|
+
onClick: increment,
|
|
439
|
+
disabled: disabled || current !== void 0 && current >= max,
|
|
440
|
+
className: chunkA3A7PJWG_cjs.cn(inputNumberButtonVariants({ size }), "border-b h-1/2"),
|
|
441
|
+
tabIndex: -1,
|
|
442
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-3 w-3" })
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
446
|
+
"button",
|
|
447
|
+
{
|
|
448
|
+
type: "button",
|
|
449
|
+
onClick: decrement,
|
|
450
|
+
disabled: disabled || current !== void 0 && current <= min,
|
|
451
|
+
className: chunkA3A7PJWG_cjs.cn(inputNumberButtonVariants({ size }), "h-1/2"),
|
|
452
|
+
tabIndex: -1,
|
|
453
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-3 w-3" })
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
] })
|
|
457
|
+
] });
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
InputNumber.displayName = "InputNumber";
|
|
461
|
+
var progressTrackVariants = classVarianceAuthority.cva(
|
|
462
|
+
"relative w-full overflow-hidden rounded-full bg-default-200",
|
|
463
|
+
{
|
|
464
|
+
variants: {
|
|
465
|
+
size: {
|
|
466
|
+
sm: "h-1",
|
|
467
|
+
md: "h-2",
|
|
468
|
+
lg: "h-3"
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
defaultVariants: { size: "md" }
|
|
472
|
+
}
|
|
473
|
+
);
|
|
474
|
+
var progressIndicatorVariants = classVarianceAuthority.cva("h-full flex-1 transition-all", {
|
|
475
|
+
variants: {
|
|
476
|
+
color: {
|
|
477
|
+
primary: "bg-primary",
|
|
478
|
+
success: "bg-success",
|
|
479
|
+
warning: "bg-warning",
|
|
480
|
+
danger: "bg-destructive"
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
defaultVariants: { color: "primary" }
|
|
484
|
+
});
|
|
485
|
+
var Progress = React5__namespace.forwardRef(
|
|
486
|
+
({ value = 0, color = "primary", size = "md", showLabel, label, className }, ref) => {
|
|
487
|
+
const clamped = Math.max(0, Math.min(100, value));
|
|
488
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: chunkA3A7PJWG_cjs.cn("w-full", className), children: [
|
|
489
|
+
(label !== void 0 || showLabel) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs text-default-500 mb-1", children: [
|
|
490
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
491
|
+
showLabel && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-auto", children: [
|
|
492
|
+
clamped,
|
|
493
|
+
"%"
|
|
494
|
+
] })
|
|
495
|
+
] }),
|
|
496
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProgressPrimitive__namespace.Root, { value: clamped, className: progressTrackVariants({ size }), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
497
|
+
ProgressPrimitive__namespace.Indicator,
|
|
498
|
+
{
|
|
499
|
+
className: progressIndicatorVariants({ color }),
|
|
500
|
+
style: { transform: `translateX(-${100 - clamped}%)` }
|
|
501
|
+
}
|
|
502
|
+
) })
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
Progress.displayName = "Progress";
|
|
507
|
+
var radioItemVariants = classVarianceAuthority.cva(
|
|
508
|
+
"aspect-square h-4 w-4 rounded-full border ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
509
|
+
{
|
|
510
|
+
variants: {
|
|
511
|
+
color: {
|
|
512
|
+
primary: "border-primary text-primary data-[state=checked]:border-primary",
|
|
513
|
+
secondary: "border-secondary text-secondary data-[state=checked]:border-secondary",
|
|
514
|
+
success: "border-success text-success data-[state=checked]:border-success",
|
|
515
|
+
warning: "border-warning text-warning data-[state=checked]:border-warning",
|
|
516
|
+
danger: "border-destructive text-destructive data-[state=checked]:border-destructive"
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
defaultVariants: {
|
|
520
|
+
color: "primary"
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
var Radio = React5__namespace.forwardRef(
|
|
525
|
+
({
|
|
526
|
+
value,
|
|
527
|
+
defaultValue,
|
|
528
|
+
options,
|
|
529
|
+
onChange,
|
|
530
|
+
orientation = "vertical",
|
|
531
|
+
color = "primary",
|
|
532
|
+
className,
|
|
533
|
+
name,
|
|
534
|
+
disabled
|
|
535
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
536
|
+
chunkERGKCXM2_cjs.RadioGroup,
|
|
537
|
+
{
|
|
538
|
+
ref,
|
|
539
|
+
value,
|
|
540
|
+
defaultValue,
|
|
541
|
+
onValueChange: onChange,
|
|
542
|
+
name,
|
|
543
|
+
disabled,
|
|
544
|
+
className: chunkA3A7PJWG_cjs.cn(orientation === "horizontal" ? "flex flex-row gap-4" : "grid gap-2", className),
|
|
545
|
+
children: options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
546
|
+
"label",
|
|
547
|
+
{
|
|
548
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
549
|
+
"inline-flex items-center gap-2 text-sm cursor-pointer select-none",
|
|
550
|
+
(opt.disabled || disabled) && "cursor-not-allowed opacity-60"
|
|
551
|
+
),
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
554
|
+
chunkERGKCXM2_cjs.RadioGroupItem,
|
|
555
|
+
{
|
|
556
|
+
value: opt.value,
|
|
557
|
+
disabled: opt.disabled || disabled,
|
|
558
|
+
className: radioItemVariants({ color })
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: opt.label })
|
|
562
|
+
]
|
|
563
|
+
},
|
|
564
|
+
opt.value
|
|
565
|
+
))
|
|
566
|
+
}
|
|
567
|
+
)
|
|
568
|
+
);
|
|
569
|
+
Radio.displayName = "Radio";
|
|
570
|
+
var rateStarVariants = classVarianceAuthority.cva("transition-colors cursor-pointer", {
|
|
571
|
+
variants: {
|
|
572
|
+
size: {
|
|
573
|
+
sm: "h-4 w-4",
|
|
574
|
+
md: "h-5 w-5",
|
|
575
|
+
lg: "h-7 w-7"
|
|
576
|
+
},
|
|
577
|
+
active: {
|
|
578
|
+
true: "fill-warning text-warning",
|
|
579
|
+
false: "fill-transparent text-default-300"
|
|
580
|
+
},
|
|
581
|
+
disabled: {
|
|
582
|
+
true: "cursor-not-allowed",
|
|
583
|
+
false: ""
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
defaultVariants: { size: "md", active: false, disabled: false }
|
|
587
|
+
});
|
|
588
|
+
var Rate = React5__namespace.forwardRef(
|
|
589
|
+
({ value, defaultValue = 0, onChange, count = 5, allowHalf, disabled, size = "md", className }, ref) => {
|
|
590
|
+
const [internal, setInternal] = React5__namespace.useState(defaultValue);
|
|
591
|
+
const [hover, setHover] = React5__namespace.useState(null);
|
|
592
|
+
const current = value ?? internal;
|
|
593
|
+
const display = hover ?? current;
|
|
594
|
+
const setValue = (next) => {
|
|
595
|
+
if (disabled) return;
|
|
596
|
+
if (value === void 0) setInternal(next);
|
|
597
|
+
onChange?.(next);
|
|
598
|
+
};
|
|
599
|
+
const handleClick = (e, index) => {
|
|
600
|
+
if (!allowHalf) return setValue(index + 1);
|
|
601
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
602
|
+
const isFirstHalf = e.clientX - rect.left < rect.width / 2;
|
|
603
|
+
setValue(index + (isFirstHalf ? 0.5 : 1));
|
|
604
|
+
};
|
|
605
|
+
const handleHover = (e, index) => {
|
|
606
|
+
if (disabled) return;
|
|
607
|
+
if (!allowHalf) return setHover(index + 1);
|
|
608
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
609
|
+
const isFirstHalf = e.clientX - rect.left < rect.width / 2;
|
|
610
|
+
setHover(index + (isFirstHalf ? 0.5 : 1));
|
|
611
|
+
};
|
|
612
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
613
|
+
"div",
|
|
614
|
+
{
|
|
615
|
+
ref,
|
|
616
|
+
className: chunkA3A7PJWG_cjs.cn("inline-flex items-center gap-1", className),
|
|
617
|
+
onMouseLeave: () => setHover(null),
|
|
618
|
+
children: Array.from({ length: count }).map((_, i) => {
|
|
619
|
+
const filled = display >= i + 1;
|
|
620
|
+
const half = !filled && allowHalf && display >= i + 0.5;
|
|
621
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
type: "button",
|
|
625
|
+
disabled,
|
|
626
|
+
onClick: (e) => handleClick(e, i),
|
|
627
|
+
onMouseMove: (e) => handleHover(e, i),
|
|
628
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
629
|
+
"p-0 bg-transparent border-0 leading-none",
|
|
630
|
+
disabled && "cursor-not-allowed"
|
|
631
|
+
),
|
|
632
|
+
"aria-label": `Rate ${i + 1}`,
|
|
633
|
+
children: half ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.StarHalf, { className: rateStarVariants({ size, active: true, disabled }) }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Star, { className: rateStarVariants({ size, active: filled, disabled }) })
|
|
634
|
+
},
|
|
635
|
+
i
|
|
636
|
+
);
|
|
637
|
+
})
|
|
638
|
+
}
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
);
|
|
642
|
+
Rate.displayName = "Rate";
|
|
643
|
+
|
|
644
|
+
// src/atoms/Select/utils.ts
|
|
645
|
+
var sizeClasses2 = {
|
|
646
|
+
sm: "h-8 text-[13.5px] pl-[11px] pr-8",
|
|
647
|
+
default: "h-10 text-sm pl-[14px] pr-9",
|
|
648
|
+
lg: "h-[46px] text-[15px] pl-4 pr-10"
|
|
649
|
+
};
|
|
650
|
+
var statusBorder = {
|
|
651
|
+
error: "border-destructive focus:ring-destructive/30",
|
|
652
|
+
warning: "border-warning-500 focus:ring-warning-500/30",
|
|
653
|
+
success: "border-success-500 focus:ring-success-500/30",
|
|
654
|
+
"": "border-input hover:border-primary-200 focus:ring-ring/30"
|
|
655
|
+
};
|
|
656
|
+
var statusBorderWithin = {
|
|
657
|
+
error: "border-destructive focus-within:ring-destructive/30",
|
|
658
|
+
warning: "border-warning-500 focus-within:ring-warning-500/30",
|
|
659
|
+
success: "border-success-500 focus-within:ring-success-500/30",
|
|
660
|
+
"": "border-input hover:border-primary-200 focus-within:ring-ring/30"
|
|
661
|
+
};
|
|
662
|
+
var messageColor = {
|
|
663
|
+
error: "text-destructive",
|
|
664
|
+
warning: "text-warning-600",
|
|
665
|
+
success: "text-success-600",
|
|
666
|
+
"": ""
|
|
667
|
+
};
|
|
668
|
+
var dotColorClass = {
|
|
669
|
+
primary: "bg-primary-700",
|
|
670
|
+
success: "bg-success-700",
|
|
671
|
+
warning: "bg-warning-800",
|
|
672
|
+
danger: "bg-danger-700"
|
|
673
|
+
};
|
|
674
|
+
var chipColorClass = {
|
|
675
|
+
primary: "bg-primary-50 text-primary-700 border-primary-100",
|
|
676
|
+
success: "bg-success-50 text-success-700 border-success-200",
|
|
677
|
+
warning: "bg-warning-50 text-warning-800 border-warning-100",
|
|
678
|
+
danger: "bg-danger-50 text-danger-700 border-danger-100"
|
|
679
|
+
};
|
|
680
|
+
var leadingIconBoxClass = "flex h-[22px] w-[22px] flex-shrink-0 items-center justify-center rounded bg-primary-50 text-[11px] font-bold text-primary-700";
|
|
681
|
+
var richIconBoxClass = "flex h-[26px] w-[26px] flex-shrink-0 items-center justify-center rounded-md text-[11.5px] font-bold";
|
|
682
|
+
var metaPillClass = "ml-auto flex-shrink-0 rounded-full bg-muted px-2 py-0.5 font-mono text-[11.5px] text-muted-foreground";
|
|
683
|
+
var dropdownClass = "absolute left-0 right-0 top-[calc(100%+6px)] z-20 max-h-80 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground";
|
|
684
|
+
function Chip({ option, disabled, onRemove }) {
|
|
685
|
+
const dot = option.dotColor ?? "primary";
|
|
686
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
687
|
+
"span",
|
|
688
|
+
{
|
|
689
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
690
|
+
"inline-flex h-7 items-center gap-1.5 rounded-full border pl-2.5 pr-1.5 text-[13px] font-medium",
|
|
691
|
+
chipColorClass[dot]
|
|
692
|
+
),
|
|
693
|
+
children: [
|
|
694
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkA3A7PJWG_cjs.cn("h-1.5 w-1.5 rounded-full", dotColorClass[dot]) }),
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate max-w-[180px]", children: option.label }),
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
"button",
|
|
698
|
+
{
|
|
699
|
+
type: "button",
|
|
700
|
+
"aria-label": "Quitar",
|
|
701
|
+
onClick: (e) => {
|
|
702
|
+
e.stopPropagation();
|
|
703
|
+
if (!disabled) onRemove(option.value);
|
|
704
|
+
},
|
|
705
|
+
className: "ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full opacity-70 transition hover:bg-black/10 hover:opacity-100",
|
|
706
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
]
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
function EmptyState({
|
|
714
|
+
title = "Sin resultados",
|
|
715
|
+
subtitle = "Prueba otro t\xE9rmino de b\xFAsqueda"
|
|
716
|
+
}) {
|
|
717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-7 text-center", children: [
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Inbox, { className: "mx-auto mb-1.5 h-7 w-7 text-muted-foreground/40" }),
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[13.5px] font-medium text-foreground", children: title }),
|
|
720
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 text-xs text-muted-foreground", children: subtitle })
|
|
721
|
+
] });
|
|
722
|
+
}
|
|
723
|
+
function OptionItem({
|
|
724
|
+
option,
|
|
725
|
+
isActive,
|
|
726
|
+
isHighlighted = false,
|
|
727
|
+
variant = "select",
|
|
728
|
+
onMouseEnter,
|
|
729
|
+
onClick
|
|
730
|
+
}) {
|
|
731
|
+
const dot = option.dotColor ?? "primary";
|
|
732
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
733
|
+
"li",
|
|
734
|
+
{
|
|
735
|
+
role: "option",
|
|
736
|
+
"aria-selected": isActive,
|
|
737
|
+
onMouseEnter,
|
|
738
|
+
onClick,
|
|
739
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
740
|
+
"flex cursor-pointer items-center gap-2.5 rounded-sm px-2.5 py-2 text-sm text-foreground",
|
|
741
|
+
variant === "multiselect" && "hover:bg-accent",
|
|
742
|
+
isHighlighted && "bg-accent",
|
|
743
|
+
isActive && (variant === "select" ? "bg-primary-50 font-semibold text-primary-700" : "bg-primary-50 font-medium text-primary-700"),
|
|
744
|
+
option.disabled && "cursor-not-allowed text-muted-foreground opacity-60"
|
|
745
|
+
),
|
|
746
|
+
children: [
|
|
747
|
+
option.leadingIcon ? variant === "select" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
+
"span",
|
|
749
|
+
{
|
|
750
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
751
|
+
richIconBoxClass,
|
|
752
|
+
isActive ? "bg-primary-700 text-white" : "bg-gradient-to-br from-primary-50 to-primary-100 text-primary-700"
|
|
753
|
+
),
|
|
754
|
+
children: option.leadingIcon
|
|
755
|
+
}
|
|
756
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: leadingIconBoxClass, children: option.leadingIcon }) : option.dotColor && variant === "multiselect" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkA3A7PJWG_cjs.cn("h-2 w-2 rounded-full", dotColorClass[dot]) }) : null,
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
758
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium", children: option.label }),
|
|
759
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-normal text-muted-foreground", children: option.description })
|
|
760
|
+
] }),
|
|
761
|
+
option.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: metaPillClass, children: option.meta }),
|
|
762
|
+
isActive && variant === "multiselect" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "ml-auto h-4 w-4 flex-shrink-0 text-primary-700" }),
|
|
763
|
+
isActive && variant === "select" && !option.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto text-primary-700", "aria-hidden": true, children: "\u2713" })
|
|
764
|
+
]
|
|
765
|
+
}
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
function MultiSelectInner(props, ref) {
|
|
769
|
+
const {
|
|
770
|
+
options,
|
|
771
|
+
value,
|
|
772
|
+
onChange,
|
|
773
|
+
placeholder = "Selecciona una opci\xF3n",
|
|
774
|
+
touched,
|
|
775
|
+
error,
|
|
776
|
+
help,
|
|
777
|
+
externalLabel,
|
|
778
|
+
isSearchable = false,
|
|
779
|
+
searchable = false,
|
|
780
|
+
errorMessage,
|
|
781
|
+
status = "",
|
|
782
|
+
disabled,
|
|
783
|
+
className,
|
|
784
|
+
maxTagCount = 3,
|
|
785
|
+
onBlur
|
|
786
|
+
} = props;
|
|
787
|
+
const [open, setOpen] = React5.useState(false);
|
|
788
|
+
const [search, setSearch] = React5.useState("");
|
|
789
|
+
const rootRef = React5.useRef(null);
|
|
790
|
+
React5.useImperativeHandle(ref, () => rootRef.current);
|
|
791
|
+
const enableSearch = searchable || isSearchable;
|
|
792
|
+
React5.useEffect(() => {
|
|
793
|
+
const handleClickOutside = (e) => {
|
|
794
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) {
|
|
795
|
+
if (open) {
|
|
796
|
+
setOpen(false);
|
|
797
|
+
onBlur?.();
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
802
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
803
|
+
}, [open, onBlur]);
|
|
804
|
+
const filteredOptions = React5.useMemo(
|
|
805
|
+
() => enableSearch && search ? options.filter((opt) => opt.label.toLowerCase().includes(search.toLowerCase())) : options,
|
|
806
|
+
[options, search, enableSearch]
|
|
807
|
+
);
|
|
808
|
+
const toggleValue = (v) => {
|
|
809
|
+
if (value.includes(v)) onChange(value.filter((item) => item !== v));
|
|
810
|
+
else onChange([...value, v]);
|
|
811
|
+
};
|
|
812
|
+
const selectedOptions = React5.useMemo(
|
|
813
|
+
() => value.map((v) => options.find((o) => o.value === v)).filter(Boolean),
|
|
814
|
+
[value, options]
|
|
815
|
+
);
|
|
816
|
+
const visibleChips = selectedOptions.slice(0, maxTagCount);
|
|
817
|
+
const overflowCount = selectedOptions.length - visibleChips.length;
|
|
818
|
+
const showError = touched && error || status === "error";
|
|
819
|
+
const effectiveStatus = showError ? "error" : status;
|
|
820
|
+
const isEmpty = filteredOptions.length === 0;
|
|
821
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
822
|
+
chunkUAXKB6IH_cjs.FormItem,
|
|
823
|
+
{
|
|
824
|
+
help: touched || error ? help : "",
|
|
825
|
+
validateStatus: showError ? "error" : "default",
|
|
826
|
+
label: externalLabel,
|
|
827
|
+
children: [
|
|
828
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: chunkA3A7PJWG_cjs.cn("relative w-full", className), children: [
|
|
829
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
830
|
+
"div",
|
|
831
|
+
{
|
|
832
|
+
role: "combobox",
|
|
833
|
+
"aria-expanded": open,
|
|
834
|
+
"aria-disabled": disabled,
|
|
835
|
+
onClick: () => !disabled && setOpen(true),
|
|
836
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
837
|
+
"relative flex min-h-[40px] w-full cursor-text flex-wrap items-center gap-1.5 rounded-md border bg-background py-1 pl-2 pr-9 text-sm transition-colors",
|
|
838
|
+
"focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-offset-background",
|
|
839
|
+
statusBorderWithin[effectiveStatus],
|
|
840
|
+
open && !disabled && "border-ring",
|
|
841
|
+
disabled && "bg-muted text-muted-foreground cursor-not-allowed opacity-70"
|
|
842
|
+
),
|
|
843
|
+
children: [
|
|
844
|
+
visibleChips.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(Chip, { option: opt, disabled, onRemove: toggleValue }, String(opt.value))),
|
|
845
|
+
overflowCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex h-[26px] items-center rounded-full bg-muted px-2 text-[12.5px] font-medium text-muted-foreground", children: [
|
|
846
|
+
"+",
|
|
847
|
+
overflowCount,
|
|
848
|
+
" m\xE1s"
|
|
849
|
+
] }),
|
|
850
|
+
enableSearch ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
851
|
+
"input",
|
|
852
|
+
{
|
|
853
|
+
className: "h-7 min-w-[80px] flex-1 border-0 bg-transparent px-1.5 text-sm outline-none placeholder:text-muted-foreground",
|
|
854
|
+
value: search,
|
|
855
|
+
placeholder: selectedOptions.length === 0 ? placeholder : "",
|
|
856
|
+
disabled,
|
|
857
|
+
onChange: (e) => {
|
|
858
|
+
setSearch(e.target.value);
|
|
859
|
+
if (!open) setOpen(true);
|
|
860
|
+
},
|
|
861
|
+
onFocus: () => setOpen(true)
|
|
862
|
+
}
|
|
863
|
+
) : selectedOptions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-1.5 text-muted-foreground", children: placeholder }),
|
|
864
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
865
|
+
lucideReact.ChevronDown,
|
|
866
|
+
{
|
|
867
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
868
|
+
"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform",
|
|
869
|
+
open && "rotate-180 text-primary-700"
|
|
870
|
+
),
|
|
871
|
+
"aria-hidden": true
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
]
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
open && !disabled && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", className: dropdownClass, children: isEmpty ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, {}) : /* @__PURE__ */ jsxRuntime.jsx("ul", { children: filteredOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
878
|
+
OptionItem,
|
|
879
|
+
{
|
|
880
|
+
option,
|
|
881
|
+
variant: "multiselect",
|
|
882
|
+
isActive: value.includes(option.value),
|
|
883
|
+
onClick: () => {
|
|
884
|
+
if (option.disabled) return;
|
|
885
|
+
toggleValue(option.value);
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
String(option.value)
|
|
889
|
+
)) }) })
|
|
890
|
+
] }),
|
|
891
|
+
errorMessage && effectiveStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-destructive", children: errorMessage })
|
|
892
|
+
]
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
var MultiSelect = React5.forwardRef(MultiSelectInner);
|
|
897
|
+
function SelectInner(props, ref) {
|
|
898
|
+
const {
|
|
899
|
+
options,
|
|
900
|
+
value,
|
|
901
|
+
onChange,
|
|
902
|
+
placeholder = "Selecciona una opci\xF3n",
|
|
903
|
+
touched,
|
|
904
|
+
error,
|
|
905
|
+
help,
|
|
906
|
+
externalLabel,
|
|
907
|
+
isSearchable = false,
|
|
908
|
+
errorMessage,
|
|
909
|
+
status = "",
|
|
910
|
+
size = "default",
|
|
911
|
+
leadingIcon,
|
|
912
|
+
disabled,
|
|
913
|
+
className,
|
|
914
|
+
onBlur
|
|
915
|
+
} = props;
|
|
916
|
+
const [open, setOpen] = React5.useState(false);
|
|
917
|
+
const [search, setSearch] = React5.useState("");
|
|
918
|
+
const [activeIndex, setActiveIndex] = React5.useState(-1);
|
|
919
|
+
const rootRef = React5.useRef(null);
|
|
920
|
+
React5.useImperativeHandle(ref, () => rootRef.current);
|
|
921
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
922
|
+
React5.useEffect(() => {
|
|
923
|
+
const handleClickOutside = (e) => {
|
|
924
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) {
|
|
925
|
+
if (open) {
|
|
926
|
+
setOpen(false);
|
|
927
|
+
onBlur?.();
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
932
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
933
|
+
}, [open, onBlur]);
|
|
934
|
+
const filteredOptions = React5.useMemo(
|
|
935
|
+
() => isSearchable && search ? options.filter((opt) => opt.label.toLowerCase().includes(search.toLowerCase())) : options,
|
|
936
|
+
[options, search, isSearchable]
|
|
937
|
+
);
|
|
938
|
+
const commitSelection = (opt) => {
|
|
939
|
+
if (opt.disabled) return;
|
|
940
|
+
onChange(opt.value);
|
|
941
|
+
setOpen(false);
|
|
942
|
+
setSearch("");
|
|
943
|
+
setActiveIndex(-1);
|
|
944
|
+
};
|
|
945
|
+
const handleKeyDown = (e) => {
|
|
946
|
+
if (disabled) return;
|
|
947
|
+
if (!open && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown")) {
|
|
948
|
+
e.preventDefault();
|
|
949
|
+
setOpen(true);
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
if (!open) return;
|
|
953
|
+
if (e.key === "Escape") {
|
|
954
|
+
e.preventDefault();
|
|
955
|
+
setOpen(false);
|
|
956
|
+
} else if (e.key === "ArrowDown") {
|
|
957
|
+
e.preventDefault();
|
|
958
|
+
setActiveIndex((i) => Math.min(filteredOptions.length - 1, i + 1));
|
|
959
|
+
} else if (e.key === "ArrowUp") {
|
|
960
|
+
e.preventDefault();
|
|
961
|
+
setActiveIndex((i) => Math.max(0, i - 1));
|
|
962
|
+
} else if (e.key === "Enter") {
|
|
963
|
+
e.preventDefault();
|
|
964
|
+
const opt = filteredOptions[activeIndex];
|
|
965
|
+
if (opt) commitSelection(opt);
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
const showError = touched && error || status === "error";
|
|
969
|
+
const effectiveStatus = showError ? "error" : status;
|
|
970
|
+
const isEmpty = filteredOptions.length === 0;
|
|
971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
972
|
+
chunkUAXKB6IH_cjs.FormItem,
|
|
973
|
+
{
|
|
974
|
+
help: touched || error ? help : "",
|
|
975
|
+
validateStatus: showError ? "error" : "default",
|
|
976
|
+
label: externalLabel,
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
979
|
+
"div",
|
|
980
|
+
{
|
|
981
|
+
ref: rootRef,
|
|
982
|
+
className: chunkA3A7PJWG_cjs.cn("relative w-full", className),
|
|
983
|
+
onKeyDown: handleKeyDown,
|
|
984
|
+
tabIndex: -1,
|
|
985
|
+
children: [
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
987
|
+
"button",
|
|
988
|
+
{
|
|
989
|
+
type: "button",
|
|
990
|
+
disabled,
|
|
991
|
+
onClick: () => !disabled && setOpen((o) => !o),
|
|
992
|
+
"aria-haspopup": "listbox",
|
|
993
|
+
"aria-expanded": open,
|
|
994
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
995
|
+
"w-full flex items-center gap-2 rounded-md border bg-background text-left transition-colors",
|
|
996
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-background",
|
|
997
|
+
sizeClasses2[size],
|
|
998
|
+
statusBorder[effectiveStatus],
|
|
999
|
+
open && !disabled && "border-ring",
|
|
1000
|
+
disabled && "bg-muted text-muted-foreground cursor-not-allowed opacity-70"
|
|
1001
|
+
),
|
|
1002
|
+
children: [
|
|
1003
|
+
leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: leadingIconBoxClass, children: leadingIcon }),
|
|
1004
|
+
selectedOption ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2 truncate font-medium text-foreground", children: [
|
|
1005
|
+
selectedOption.leadingIcon && !leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: leadingIconBoxClass, children: selectedOption.leadingIcon }),
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selectedOption.label }),
|
|
1007
|
+
selectedOption.meta && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 text-[12.5px] font-normal text-muted-foreground", children: [
|
|
1008
|
+
"\xB7 ",
|
|
1009
|
+
selectedOption.meta
|
|
1010
|
+
] })
|
|
1011
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-muted-foreground", children: placeholder }),
|
|
1012
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
+
lucideReact.ChevronDown,
|
|
1014
|
+
{
|
|
1015
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
1016
|
+
"absolute right-3 h-4 w-4 text-muted-foreground transition-transform",
|
|
1017
|
+
open && "rotate-180 text-primary-700"
|
|
1018
|
+
),
|
|
1019
|
+
"aria-hidden": true
|
|
1020
|
+
}
|
|
1021
|
+
)
|
|
1022
|
+
]
|
|
1023
|
+
}
|
|
1024
|
+
),
|
|
1025
|
+
open && !disabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "listbox", className: dropdownClass, children: [
|
|
1026
|
+
isSearchable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-[-4px] z-10 -mx-1 mb-1 border-b border-border bg-popover px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1027
|
+
"input",
|
|
1028
|
+
{
|
|
1029
|
+
type: "text",
|
|
1030
|
+
autoFocus: true,
|
|
1031
|
+
value: search,
|
|
1032
|
+
onChange: (e) => {
|
|
1033
|
+
setSearch(e.target.value);
|
|
1034
|
+
setActiveIndex(0);
|
|
1035
|
+
},
|
|
1036
|
+
className: "w-full rounded-sm border border-transparent bg-muted px-2.5 py-1.5 text-[13.5px] outline-none focus:border-primary-500 focus:bg-background",
|
|
1037
|
+
placeholder: "Buscar..."
|
|
1038
|
+
}
|
|
1039
|
+
) }),
|
|
1040
|
+
isEmpty ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, {}) : /* @__PURE__ */ jsxRuntime.jsx("ul", { children: filteredOptions.map((option, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1041
|
+
OptionItem,
|
|
1042
|
+
{
|
|
1043
|
+
option,
|
|
1044
|
+
isActive: option.value === value,
|
|
1045
|
+
isHighlighted: idx === activeIndex,
|
|
1046
|
+
onMouseEnter: () => setActiveIndex(idx),
|
|
1047
|
+
onClick: () => commitSelection(option)
|
|
1048
|
+
},
|
|
1049
|
+
String(option.value)
|
|
1050
|
+
)) })
|
|
1051
|
+
] })
|
|
1052
|
+
]
|
|
1053
|
+
}
|
|
1054
|
+
),
|
|
1055
|
+
errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: chunkA3A7PJWG_cjs.cn("mt-1 text-xs", messageColor[effectiveStatus]), children: errorMessage })
|
|
1056
|
+
]
|
|
1057
|
+
}
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
var Select = React5.forwardRef(SelectInner);
|
|
1061
|
+
var Separator2 = React5__namespace.forwardRef(
|
|
1062
|
+
({ orientation = "horizontal", text, className }, ref) => {
|
|
1063
|
+
if (text && orientation === "horizontal") {
|
|
1064
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: chunkA3A7PJWG_cjs.cn("relative flex items-center w-full my-2", className), children: [
|
|
1065
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkERGKCXM2_cjs.Separator, { orientation: "horizontal", className: "flex-1" }),
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 text-xs text-muted-foreground uppercase tracking-wider bg-background", children: text }),
|
|
1067
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkERGKCXM2_cjs.Separator, { orientation: "horizontal", className: "flex-1" })
|
|
1068
|
+
] });
|
|
1069
|
+
}
|
|
1070
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1071
|
+
chunkERGKCXM2_cjs.Separator,
|
|
1072
|
+
{
|
|
1073
|
+
ref,
|
|
1074
|
+
orientation,
|
|
1075
|
+
className: chunkA3A7PJWG_cjs.cn(orientation === "vertical" ? "mx-2 h-4 inline-block" : "", className)
|
|
1076
|
+
}
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
);
|
|
1080
|
+
Separator2.displayName = "Separator";
|
|
1081
|
+
function roundedClass(r) {
|
|
1082
|
+
if (r === "sm") return "rounded-sm";
|
|
1083
|
+
if (r === "full") return "rounded-full";
|
|
1084
|
+
return "rounded-md";
|
|
1085
|
+
}
|
|
1086
|
+
function toCss(v) {
|
|
1087
|
+
if (typeof v === "number") return `${v}px`;
|
|
1088
|
+
return v;
|
|
1089
|
+
}
|
|
1090
|
+
var Skeleton2 = React5__namespace.forwardRef(
|
|
1091
|
+
({ width, height, rounded = "md", lines, className }, ref) => {
|
|
1092
|
+
if (lines && lines > 1) {
|
|
1093
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkA3A7PJWG_cjs.cn("flex flex-col gap-2", className), children: Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
|
+
chunkERGKCXM2_cjs.Skeleton,
|
|
1095
|
+
{
|
|
1096
|
+
className: chunkA3A7PJWG_cjs.cn(roundedClass(rounded), "h-3"),
|
|
1097
|
+
style: {
|
|
1098
|
+
width: i === lines - 1 ? "60%" : toCss(width) ?? "100%"
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
i
|
|
1102
|
+
)) });
|
|
1103
|
+
}
|
|
1104
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1105
|
+
chunkERGKCXM2_cjs.Skeleton,
|
|
1106
|
+
{
|
|
1107
|
+
ref,
|
|
1108
|
+
className: chunkA3A7PJWG_cjs.cn(roundedClass(rounded), className),
|
|
1109
|
+
style: { width: toCss(width), height: toCss(height) }
|
|
1110
|
+
}
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
);
|
|
1114
|
+
Skeleton2.displayName = "Skeleton";
|
|
1115
|
+
var sliderRangeVariants = classVarianceAuthority.cva("absolute h-full", {
|
|
1116
|
+
variants: {
|
|
1117
|
+
color: {
|
|
1118
|
+
primary: "bg-primary",
|
|
1119
|
+
secondary: "bg-secondary",
|
|
1120
|
+
success: "bg-success",
|
|
1121
|
+
warning: "bg-warning",
|
|
1122
|
+
danger: "bg-destructive"
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1125
|
+
defaultVariants: { color: "primary" }
|
|
1126
|
+
});
|
|
1127
|
+
var sliderThumbVariants = classVarianceAuthority.cva(
|
|
1128
|
+
"block h-3.5 w-3.5 rounded-full border-2 bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
1129
|
+
{
|
|
1130
|
+
variants: {
|
|
1131
|
+
color: {
|
|
1132
|
+
primary: "border-primary",
|
|
1133
|
+
secondary: "border-secondary",
|
|
1134
|
+
success: "border-success",
|
|
1135
|
+
warning: "border-warning",
|
|
1136
|
+
danger: "border-destructive"
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
defaultVariants: { color: "primary" }
|
|
1140
|
+
}
|
|
1141
|
+
);
|
|
1142
|
+
function toArray(v) {
|
|
1143
|
+
if (v === void 0) return void 0;
|
|
1144
|
+
return Array.isArray(v) ? v : [v];
|
|
1145
|
+
}
|
|
1146
|
+
var Slider = React5__namespace.forwardRef(
|
|
1147
|
+
({
|
|
1148
|
+
value,
|
|
1149
|
+
defaultValue,
|
|
1150
|
+
onChange,
|
|
1151
|
+
min = 0,
|
|
1152
|
+
max = 100,
|
|
1153
|
+
step = 1,
|
|
1154
|
+
color = "primary",
|
|
1155
|
+
disabled,
|
|
1156
|
+
showTooltip,
|
|
1157
|
+
className
|
|
1158
|
+
}, ref) => {
|
|
1159
|
+
const valueArr = toArray(value);
|
|
1160
|
+
const defaultArr = toArray(defaultValue);
|
|
1161
|
+
const [internal, setInternal] = React5__namespace.useState(defaultArr ?? [min]);
|
|
1162
|
+
const display = valueArr ?? internal;
|
|
1163
|
+
const handleChange = (next) => {
|
|
1164
|
+
if (valueArr === void 0) setInternal(next);
|
|
1165
|
+
if (!onChange) return;
|
|
1166
|
+
onChange(next.length === 1 ? next[0] : next);
|
|
1167
|
+
};
|
|
1168
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1169
|
+
SliderPrimitive__namespace.Root,
|
|
1170
|
+
{
|
|
1171
|
+
ref,
|
|
1172
|
+
value: valueArr,
|
|
1173
|
+
defaultValue: defaultArr,
|
|
1174
|
+
onValueChange: handleChange,
|
|
1175
|
+
min,
|
|
1176
|
+
max,
|
|
1177
|
+
step,
|
|
1178
|
+
disabled,
|
|
1179
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
1180
|
+
"relative flex w-full touch-none select-none items-center",
|
|
1181
|
+
disabled && "opacity-50",
|
|
1182
|
+
className
|
|
1183
|
+
),
|
|
1184
|
+
children: [
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: sliderRangeVariants({ color }) }) }),
|
|
1186
|
+
display.map((v, i) => /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: sliderThumbVariants({ color }), children: showTooltip && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -top-7 left-1/2 -translate-x-1/2 rounded bg-default-900 text-default-50 px-1.5 py-0.5 text-xs whitespace-nowrap", children: v }) }, i))
|
|
1187
|
+
]
|
|
1188
|
+
}
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
);
|
|
1192
|
+
Slider.displayName = "Slider";
|
|
1193
|
+
var switchRootVariants = classVarianceAuthority.cva(
|
|
1194
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-default-200",
|
|
1195
|
+
{
|
|
1196
|
+
variants: {
|
|
1197
|
+
color: {
|
|
1198
|
+
primary: "data-[state=checked]:bg-primary",
|
|
1199
|
+
secondary: "data-[state=checked]:bg-secondary",
|
|
1200
|
+
success: "data-[state=checked]:bg-success",
|
|
1201
|
+
warning: "data-[state=checked]:bg-warning",
|
|
1202
|
+
danger: "data-[state=checked]:bg-destructive"
|
|
1203
|
+
},
|
|
1204
|
+
size: {
|
|
1205
|
+
sm: "h-5 w-9",
|
|
1206
|
+
md: "h-6 w-11",
|
|
1207
|
+
lg: "h-7 w-14"
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
defaultVariants: { color: "primary", size: "md" }
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
var switchThumbVariants = classVarianceAuthority.cva(
|
|
1214
|
+
"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=unchecked]:translate-x-0",
|
|
1215
|
+
{
|
|
1216
|
+
variants: {
|
|
1217
|
+
size: {
|
|
1218
|
+
sm: "h-4 w-4 data-[state=checked]:translate-x-4",
|
|
1219
|
+
md: "h-5 w-5 data-[state=checked]:translate-x-5",
|
|
1220
|
+
lg: "h-6 w-6 data-[state=checked]:translate-x-7"
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
defaultVariants: { size: "md" }
|
|
1224
|
+
}
|
|
1225
|
+
);
|
|
1226
|
+
var Switch = React5__namespace.forwardRef(
|
|
1227
|
+
({
|
|
1228
|
+
checked,
|
|
1229
|
+
defaultChecked,
|
|
1230
|
+
onChange,
|
|
1231
|
+
color = "primary",
|
|
1232
|
+
size = "md",
|
|
1233
|
+
label,
|
|
1234
|
+
disabled,
|
|
1235
|
+
className,
|
|
1236
|
+
name,
|
|
1237
|
+
id
|
|
1238
|
+
}, ref) => {
|
|
1239
|
+
const control = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1240
|
+
SwitchPrimitives__namespace.Root,
|
|
1241
|
+
{
|
|
1242
|
+
ref,
|
|
1243
|
+
id,
|
|
1244
|
+
name,
|
|
1245
|
+
checked,
|
|
1246
|
+
defaultChecked,
|
|
1247
|
+
onCheckedChange: onChange,
|
|
1248
|
+
disabled,
|
|
1249
|
+
className: chunkA3A7PJWG_cjs.cn(switchRootVariants({ color, size }), !label && className),
|
|
1250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitives__namespace.Thumb, { className: switchThumbVariants({ size }) })
|
|
1251
|
+
}
|
|
1252
|
+
);
|
|
1253
|
+
if (!label) return control;
|
|
1254
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1255
|
+
"label",
|
|
1256
|
+
{
|
|
1257
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
1258
|
+
"inline-flex items-center gap-2 text-sm cursor-pointer select-none",
|
|
1259
|
+
disabled && "cursor-not-allowed opacity-60",
|
|
1260
|
+
className
|
|
1261
|
+
),
|
|
1262
|
+
children: [
|
|
1263
|
+
control,
|
|
1264
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
1265
|
+
]
|
|
1266
|
+
}
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
);
|
|
1270
|
+
Switch.displayName = "Switch";
|
|
1271
|
+
var variantMap = {
|
|
1272
|
+
default: "bg-default-100 text-foreground border-default-200",
|
|
1273
|
+
success: "bg-success-50 text-success-800 border-success-200",
|
|
1274
|
+
warning: "bg-warning-50 text-warning-800 border-warning-200",
|
|
1275
|
+
danger: "bg-danger-50 text-danger-800 border-danger-200"
|
|
1276
|
+
};
|
|
1277
|
+
var Tag = ({ icon, onClose, variant, children }) => {
|
|
1278
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1279
|
+
chunkERGKCXM2_cjs.Badge,
|
|
1280
|
+
{
|
|
1281
|
+
variant: "outline",
|
|
1282
|
+
className: chunkA3A7PJWG_cjs.cn("gap-2 px-3 py-1 text-sm rounded-md border", variantMap[variant]),
|
|
1283
|
+
children: [
|
|
1284
|
+
icon,
|
|
1285
|
+
children,
|
|
1286
|
+
onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1287
|
+
"button",
|
|
1288
|
+
{
|
|
1289
|
+
type: "button",
|
|
1290
|
+
onClick: onClose,
|
|
1291
|
+
className: "ml-1 inline-flex items-center justify-center rounded hover:bg-black/10",
|
|
1292
|
+
"aria-label": "close",
|
|
1293
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
|
|
1294
|
+
}
|
|
1295
|
+
)
|
|
1296
|
+
]
|
|
1297
|
+
}
|
|
1298
|
+
);
|
|
1299
|
+
};
|
|
1300
|
+
var sizeClasses3 = {
|
|
1301
|
+
small: "text-[13px] py-1.5 px-2.5",
|
|
1302
|
+
default: "text-sm py-2 px-3",
|
|
1303
|
+
large: "text-[15px] py-2.5 px-4"
|
|
1304
|
+
};
|
|
1305
|
+
var statusBorderClasses2 = {
|
|
1306
|
+
error: "border-destructive focus-visible:ring-destructive",
|
|
1307
|
+
success: "border-success-500 focus-visible:ring-success-500",
|
|
1308
|
+
warning: "border-warning-500 focus-visible:ring-warning-500",
|
|
1309
|
+
default: ""
|
|
1310
|
+
};
|
|
1311
|
+
var Textarea2 = React5.forwardRef(function Textarea3({
|
|
1312
|
+
size = "default",
|
|
1313
|
+
allowClear = false,
|
|
1314
|
+
status = "default",
|
|
1315
|
+
autoSize = false,
|
|
1316
|
+
disabled,
|
|
1317
|
+
className,
|
|
1318
|
+
name,
|
|
1319
|
+
touched,
|
|
1320
|
+
error,
|
|
1321
|
+
externalLabel,
|
|
1322
|
+
help,
|
|
1323
|
+
errorMessage,
|
|
1324
|
+
onChange,
|
|
1325
|
+
value,
|
|
1326
|
+
defaultValue,
|
|
1327
|
+
rows = 3,
|
|
1328
|
+
...rest
|
|
1329
|
+
}, ref) {
|
|
1330
|
+
const [internalValue, setInternalValue] = React5.useState(defaultValue ?? "");
|
|
1331
|
+
const isControlled = value !== void 0;
|
|
1332
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1333
|
+
const innerRef = React5.useRef(null);
|
|
1334
|
+
const setRefs = React5.useCallback(
|
|
1335
|
+
(node) => {
|
|
1336
|
+
innerRef.current = node;
|
|
1337
|
+
if (typeof ref === "function") ref(node);
|
|
1338
|
+
else if (ref) ref.current = node;
|
|
1339
|
+
},
|
|
1340
|
+
[ref]
|
|
1341
|
+
);
|
|
1342
|
+
React5.useEffect(() => {
|
|
1343
|
+
if (autoSize && innerRef.current) {
|
|
1344
|
+
innerRef.current.style.height = "auto";
|
|
1345
|
+
innerRef.current.style.height = `${innerRef.current.scrollHeight}px`;
|
|
1346
|
+
}
|
|
1347
|
+
}, [currentValue, autoSize]);
|
|
1348
|
+
const showClearButton = allowClear && !disabled && Boolean(currentValue);
|
|
1349
|
+
const messageColor2 = status === "error" ? "text-destructive" : status === "warning" ? "text-warning-700" : "";
|
|
1350
|
+
const handleChange = (e) => {
|
|
1351
|
+
if (!isControlled) setInternalValue(e.target.value);
|
|
1352
|
+
onChange?.(e);
|
|
1353
|
+
};
|
|
1354
|
+
const handleClear = () => {
|
|
1355
|
+
if (!isControlled) setInternalValue("");
|
|
1356
|
+
onChange?.({ target: { value: "" } });
|
|
1357
|
+
innerRef.current?.focus();
|
|
1358
|
+
};
|
|
1359
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1360
|
+
chunkUAXKB6IH_cjs.FormItem,
|
|
1361
|
+
{
|
|
1362
|
+
help: touched || error ? help : "",
|
|
1363
|
+
validateStatus: touched && error ? "error" : "default",
|
|
1364
|
+
label: externalLabel,
|
|
1365
|
+
children: [
|
|
1366
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkA3A7PJWG_cjs.cn("relative w-full", className), children: [
|
|
1367
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1368
|
+
chunkERGKCXM2_cjs.Textarea,
|
|
1369
|
+
{
|
|
1370
|
+
ref: setRefs,
|
|
1371
|
+
name,
|
|
1372
|
+
disabled,
|
|
1373
|
+
rows,
|
|
1374
|
+
value: currentValue,
|
|
1375
|
+
onChange: handleChange,
|
|
1376
|
+
"aria-invalid": status === "error" || touched && Boolean(error) || void 0,
|
|
1377
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
1378
|
+
sizeClasses3[size],
|
|
1379
|
+
statusBorderClasses2[status],
|
|
1380
|
+
autoSize && "resize-none overflow-hidden",
|
|
1381
|
+
showClearButton && "pr-9"
|
|
1382
|
+
),
|
|
1383
|
+
...rest
|
|
1384
|
+
}
|
|
1385
|
+
),
|
|
1386
|
+
showClearButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1387
|
+
"button",
|
|
1388
|
+
{
|
|
1389
|
+
type: "button",
|
|
1390
|
+
onClick: handleClear,
|
|
1391
|
+
"aria-label": "Limpiar",
|
|
1392
|
+
className: "absolute right-2 top-2 inline-flex items-center justify-center text-muted-foreground hover:text-foreground",
|
|
1393
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5" })
|
|
1394
|
+
}
|
|
1395
|
+
)
|
|
1396
|
+
] }),
|
|
1397
|
+
errorMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1398
|
+
"p",
|
|
1399
|
+
{
|
|
1400
|
+
className: chunkA3A7PJWG_cjs.cn("mt-1 text-xs", messageColor2),
|
|
1401
|
+
role: status === "error" ? "alert" : void 0,
|
|
1402
|
+
children: errorMessage
|
|
1403
|
+
}
|
|
1404
|
+
)
|
|
1405
|
+
]
|
|
1406
|
+
}
|
|
1407
|
+
);
|
|
1408
|
+
});
|
|
1409
|
+
function mapSize(size) {
|
|
1410
|
+
if (size === "sm") return "sm";
|
|
1411
|
+
if (size === "lg") return "lg";
|
|
1412
|
+
return "default";
|
|
1413
|
+
}
|
|
1414
|
+
var Toggle = React5__namespace.forwardRef(
|
|
1415
|
+
({
|
|
1416
|
+
pressed,
|
|
1417
|
+
defaultPressed,
|
|
1418
|
+
onChange,
|
|
1419
|
+
variant = "default",
|
|
1420
|
+
size = "md",
|
|
1421
|
+
disabled,
|
|
1422
|
+
className,
|
|
1423
|
+
children,
|
|
1424
|
+
...rest
|
|
1425
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1426
|
+
TogglePrimitive__namespace.Root,
|
|
1427
|
+
{
|
|
1428
|
+
ref,
|
|
1429
|
+
pressed,
|
|
1430
|
+
defaultPressed,
|
|
1431
|
+
onPressedChange: onChange,
|
|
1432
|
+
disabled,
|
|
1433
|
+
className: chunkA3A7PJWG_cjs.cn(chunkERGKCXM2_cjs.toggleVariants({ variant, size: mapSize(size) }), className),
|
|
1434
|
+
...rest,
|
|
1435
|
+
children
|
|
1436
|
+
}
|
|
1437
|
+
)
|
|
1438
|
+
);
|
|
1439
|
+
Toggle.displayName = "Toggle";
|
|
1440
|
+
function mapSize2(size) {
|
|
1441
|
+
if (size === "sm") return "sm";
|
|
1442
|
+
if (size === "lg") return "lg";
|
|
1443
|
+
return "default";
|
|
1444
|
+
}
|
|
1445
|
+
var ToggleGroup2 = React5__namespace.forwardRef((props, ref) => {
|
|
1446
|
+
const { options, variant = "default", size = "md", disabled, className } = props;
|
|
1447
|
+
const sharedItems = options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(chunkERGKCXM2_cjs.ToggleGroupItem, { value: opt.value, disabled: opt.disabled || disabled, children: opt.label }, opt.value));
|
|
1448
|
+
if (props.type === "single") {
|
|
1449
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1450
|
+
chunkERGKCXM2_cjs.ToggleGroup,
|
|
1451
|
+
{
|
|
1452
|
+
ref,
|
|
1453
|
+
type: "single",
|
|
1454
|
+
value: props.value,
|
|
1455
|
+
defaultValue: props.defaultValue,
|
|
1456
|
+
onValueChange: (v) => props.onChange?.(v),
|
|
1457
|
+
variant,
|
|
1458
|
+
size: mapSize2(size),
|
|
1459
|
+
disabled,
|
|
1460
|
+
className: chunkA3A7PJWG_cjs.cn(className),
|
|
1461
|
+
children: sharedItems
|
|
1462
|
+
}
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1466
|
+
chunkERGKCXM2_cjs.ToggleGroup,
|
|
1467
|
+
{
|
|
1468
|
+
ref,
|
|
1469
|
+
type: "multiple",
|
|
1470
|
+
value: props.value,
|
|
1471
|
+
defaultValue: props.defaultValue,
|
|
1472
|
+
onValueChange: (v) => props.onChange?.(v),
|
|
1473
|
+
variant,
|
|
1474
|
+
size: mapSize2(size),
|
|
1475
|
+
disabled,
|
|
1476
|
+
className: chunkA3A7PJWG_cjs.cn(className),
|
|
1477
|
+
children: sharedItems
|
|
1478
|
+
}
|
|
1479
|
+
);
|
|
1480
|
+
});
|
|
1481
|
+
ToggleGroup2.displayName = "ToggleGroup";
|
|
1482
|
+
|
|
1483
|
+
exports.Avatar = Avatar2;
|
|
1484
|
+
exports.Checkbox = Checkbox2;
|
|
1485
|
+
exports.Descriptions = Descriptions;
|
|
1486
|
+
exports.Input = Input2;
|
|
1487
|
+
exports.InputNumber = InputNumber;
|
|
1488
|
+
exports.MultiSelect = MultiSelect;
|
|
1489
|
+
exports.Progress = Progress;
|
|
1490
|
+
exports.Radio = Radio;
|
|
1491
|
+
exports.Rate = Rate;
|
|
1492
|
+
exports.Select = Select;
|
|
1493
|
+
exports.Separator = Separator2;
|
|
1494
|
+
exports.Skeleton = Skeleton2;
|
|
1495
|
+
exports.Slider = Slider;
|
|
1496
|
+
exports.Switch = Switch;
|
|
1497
|
+
exports.Tag = Tag;
|
|
1498
|
+
exports.Textarea = Textarea2;
|
|
1499
|
+
exports.Toggle = Toggle;
|
|
1500
|
+
exports.ToggleGroup = ToggleGroup2;
|
|
1501
|
+
//# sourceMappingURL=chunk-5PEOJVY7.cjs.map
|
|
1502
|
+
//# sourceMappingURL=chunk-5PEOJVY7.cjs.map
|