@saptanshuwanjari/react-component-library 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +37 -20
- package/dist/index.d.ts +37 -20
- package/dist/index.js +797 -585
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +752 -542
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -3
package/dist/index.js
CHANGED
|
@@ -4,14 +4,18 @@ var React2 = require('react');
|
|
|
4
4
|
var zod = require('@hookform/resolvers/zod');
|
|
5
5
|
var reactHookForm = require('react-hook-form');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var LabelPrimitive = require('@radix-ui/react-label');
|
|
8
8
|
var clsx = require('clsx');
|
|
9
9
|
var tailwindMerge = require('tailwind-merge');
|
|
10
|
-
var
|
|
10
|
+
var lucideReact = require('lucide-react');
|
|
11
11
|
var classVarianceAuthority = require('class-variance-authority');
|
|
12
12
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
13
|
-
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
14
13
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
14
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
15
|
+
var reactDayPicker = require('react-day-picker');
|
|
16
|
+
var dateFns = require('date-fns');
|
|
17
|
+
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
18
|
+
var reactTable = require('@tanstack/react-table');
|
|
15
19
|
|
|
16
20
|
function _interopNamespace(e) {
|
|
17
21
|
if (e && e.__esModule) return e;
|
|
@@ -32,9 +36,11 @@ function _interopNamespace(e) {
|
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
39
|
+
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
35
40
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
36
|
-
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
37
41
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
42
|
+
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
43
|
+
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
38
44
|
|
|
39
45
|
// src/components/form/root.tsx
|
|
40
46
|
var FormContext = React2.createContext(null);
|
|
@@ -95,17 +101,34 @@ function useFormCtx() {
|
|
|
95
101
|
if (!ctx) throw new Error("Form components must be used inside Form.Root");
|
|
96
102
|
return ctx;
|
|
97
103
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
function cn(...inputs) {
|
|
105
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
106
|
+
}
|
|
107
|
+
function Label({
|
|
108
|
+
className,
|
|
109
|
+
...props
|
|
110
|
+
}) {
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
112
|
+
LabelPrimitive__namespace.Root,
|
|
113
|
+
{
|
|
114
|
+
"data-slot": "label",
|
|
115
|
+
className: cn(
|
|
116
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
117
|
+
className
|
|
118
|
+
),
|
|
119
|
+
...props
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
101
123
|
function Field({
|
|
102
124
|
name,
|
|
103
125
|
label,
|
|
104
126
|
children
|
|
105
127
|
}) {
|
|
106
128
|
const form = useFormCtx();
|
|
107
|
-
|
|
108
|
-
|
|
129
|
+
const error = form.formState.errors[name];
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
131
|
+
label ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: String(name), children: label }) : null,
|
|
109
132
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
110
133
|
reactHookForm.Controller,
|
|
111
134
|
{
|
|
@@ -114,17 +137,26 @@ function Field({
|
|
|
114
137
|
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(field) })
|
|
115
138
|
}
|
|
116
139
|
),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
140
|
+
error?.message && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: error.message })
|
|
118
141
|
] });
|
|
119
142
|
}
|
|
120
143
|
var field_default = Field;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
function Input({ className, type, ...props }) {
|
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
+
"input",
|
|
147
|
+
{
|
|
148
|
+
type,
|
|
149
|
+
"data-slot": "input",
|
|
150
|
+
className: cn(
|
|
151
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
152
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
153
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
154
|
+
className
|
|
155
|
+
),
|
|
156
|
+
...props
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
128
160
|
var InputField = React2.memo(function InputField2({
|
|
129
161
|
name,
|
|
130
162
|
label,
|
|
@@ -150,6 +182,166 @@ var InputField = React2.memo(function InputField2({
|
|
|
150
182
|
) });
|
|
151
183
|
});
|
|
152
184
|
var input_field_default = InputField;
|
|
185
|
+
function setRef(ref, value) {
|
|
186
|
+
if (typeof ref === "function") {
|
|
187
|
+
return ref(value);
|
|
188
|
+
} else if (ref !== null && ref !== void 0) {
|
|
189
|
+
ref.current = value;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function composeRefs(...refs) {
|
|
193
|
+
return (node) => {
|
|
194
|
+
let hasCleanup = false;
|
|
195
|
+
const cleanups = refs.map((ref) => {
|
|
196
|
+
const cleanup = setRef(ref, node);
|
|
197
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
198
|
+
hasCleanup = true;
|
|
199
|
+
}
|
|
200
|
+
return cleanup;
|
|
201
|
+
});
|
|
202
|
+
if (hasCleanup) {
|
|
203
|
+
return () => {
|
|
204
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
205
|
+
const cleanup = cleanups[i];
|
|
206
|
+
if (typeof cleanup == "function") {
|
|
207
|
+
cleanup();
|
|
208
|
+
} else {
|
|
209
|
+
setRef(refs[i], null);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
// @__NO_SIDE_EFFECTS__
|
|
217
|
+
function createSlot(ownerName) {
|
|
218
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
219
|
+
const Slot2 = React2__namespace.forwardRef((props, forwardedRef) => {
|
|
220
|
+
const { children, ...slotProps } = props;
|
|
221
|
+
const childrenArray = React2__namespace.Children.toArray(children);
|
|
222
|
+
const slottable = childrenArray.find(isSlottable);
|
|
223
|
+
if (slottable) {
|
|
224
|
+
const newElement = slottable.props.children;
|
|
225
|
+
const newChildren = childrenArray.map((child) => {
|
|
226
|
+
if (child === slottable) {
|
|
227
|
+
if (React2__namespace.Children.count(newElement) > 1) return React2__namespace.Children.only(null);
|
|
228
|
+
return React2__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
229
|
+
} else {
|
|
230
|
+
return child;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React2__namespace.isValidElement(newElement) ? React2__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
234
|
+
}
|
|
235
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
236
|
+
});
|
|
237
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
238
|
+
return Slot2;
|
|
239
|
+
}
|
|
240
|
+
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
241
|
+
// @__NO_SIDE_EFFECTS__
|
|
242
|
+
function createSlotClone(ownerName) {
|
|
243
|
+
const SlotClone = React2__namespace.forwardRef((props, forwardedRef) => {
|
|
244
|
+
const { children, ...slotProps } = props;
|
|
245
|
+
if (React2__namespace.isValidElement(children)) {
|
|
246
|
+
const childrenRef = getElementRef(children);
|
|
247
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
248
|
+
if (children.type !== React2__namespace.Fragment) {
|
|
249
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
250
|
+
}
|
|
251
|
+
return React2__namespace.cloneElement(children, props2);
|
|
252
|
+
}
|
|
253
|
+
return React2__namespace.Children.count(children) > 1 ? React2__namespace.Children.only(null) : null;
|
|
254
|
+
});
|
|
255
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
256
|
+
return SlotClone;
|
|
257
|
+
}
|
|
258
|
+
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
259
|
+
function isSlottable(child) {
|
|
260
|
+
return React2__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
261
|
+
}
|
|
262
|
+
function mergeProps(slotProps, childProps) {
|
|
263
|
+
const overrideProps = { ...childProps };
|
|
264
|
+
for (const propName in childProps) {
|
|
265
|
+
const slotPropValue = slotProps[propName];
|
|
266
|
+
const childPropValue = childProps[propName];
|
|
267
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
268
|
+
if (isHandler) {
|
|
269
|
+
if (slotPropValue && childPropValue) {
|
|
270
|
+
overrideProps[propName] = (...args) => {
|
|
271
|
+
const result = childPropValue(...args);
|
|
272
|
+
slotPropValue(...args);
|
|
273
|
+
return result;
|
|
274
|
+
};
|
|
275
|
+
} else if (slotPropValue) {
|
|
276
|
+
overrideProps[propName] = slotPropValue;
|
|
277
|
+
}
|
|
278
|
+
} else if (propName === "style") {
|
|
279
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
280
|
+
} else if (propName === "className") {
|
|
281
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return { ...slotProps, ...overrideProps };
|
|
285
|
+
}
|
|
286
|
+
function getElementRef(element) {
|
|
287
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
288
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
289
|
+
if (mayWarn) {
|
|
290
|
+
return element.ref;
|
|
291
|
+
}
|
|
292
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
293
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
294
|
+
if (mayWarn) {
|
|
295
|
+
return element.props.ref;
|
|
296
|
+
}
|
|
297
|
+
return element.props.ref || element.ref;
|
|
298
|
+
}
|
|
299
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
300
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
301
|
+
{
|
|
302
|
+
variants: {
|
|
303
|
+
variant: {
|
|
304
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
305
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
306
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
307
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
308
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
309
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
310
|
+
},
|
|
311
|
+
size: {
|
|
312
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
313
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
314
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
315
|
+
icon: "size-9",
|
|
316
|
+
"icon-sm": "size-8",
|
|
317
|
+
"icon-lg": "size-10"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
defaultVariants: {
|
|
321
|
+
variant: "default",
|
|
322
|
+
size: "default"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
function Button({
|
|
327
|
+
className,
|
|
328
|
+
variant = "default",
|
|
329
|
+
size = "default",
|
|
330
|
+
asChild = false,
|
|
331
|
+
...props
|
|
332
|
+
}) {
|
|
333
|
+
const Comp = asChild ? Slot : "button";
|
|
334
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
335
|
+
Comp,
|
|
336
|
+
{
|
|
337
|
+
"data-slot": "button",
|
|
338
|
+
"data-variant": variant,
|
|
339
|
+
"data-size": size,
|
|
340
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
341
|
+
...props
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
}
|
|
153
345
|
var PasswordField = React2.memo(function PasswordField2({
|
|
154
346
|
name,
|
|
155
347
|
label,
|
|
@@ -157,37 +349,45 @@ var PasswordField = React2.memo(function PasswordField2({
|
|
|
157
349
|
}) {
|
|
158
350
|
const [show, setShow] = React2.useState(false);
|
|
159
351
|
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
352
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none z-10", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
161
353
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
162
|
-
|
|
354
|
+
Input,
|
|
163
355
|
{
|
|
164
356
|
id: String(name),
|
|
165
357
|
type: show ? "text" : "password",
|
|
166
358
|
...field,
|
|
167
359
|
value: field.value ?? "",
|
|
168
360
|
placeholder,
|
|
169
|
-
className: "
|
|
361
|
+
className: "pl-10 pr-10"
|
|
170
362
|
}
|
|
171
363
|
),
|
|
172
364
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
-
|
|
365
|
+
Button,
|
|
174
366
|
{
|
|
367
|
+
variant: "ghost",
|
|
368
|
+
size: "sm",
|
|
175
369
|
type: "button",
|
|
176
370
|
onClick: () => setShow(!show),
|
|
177
|
-
className: "absolute right-
|
|
371
|
+
className: "absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0 text-muted-foreground hover:text-foreground",
|
|
178
372
|
children: show ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4" })
|
|
179
373
|
}
|
|
180
374
|
)
|
|
181
375
|
] }) });
|
|
182
376
|
});
|
|
183
377
|
var password_field_default = PasswordField;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
378
|
+
function Textarea({ className, ...props }) {
|
|
379
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
380
|
+
"textarea",
|
|
381
|
+
{
|
|
382
|
+
"data-slot": "textarea",
|
|
383
|
+
className: cn(
|
|
384
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
385
|
+
className
|
|
386
|
+
),
|
|
387
|
+
...props
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
}
|
|
191
391
|
var TextareaField = React2.memo(function TextareaField2({
|
|
192
392
|
name,
|
|
193
393
|
label,
|
|
@@ -209,72 +409,197 @@ var TextareaField = React2.memo(function TextareaField2({
|
|
|
209
409
|
) });
|
|
210
410
|
});
|
|
211
411
|
var textarea_field_default = TextareaField;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{
|
|
215
|
-
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
216
|
-
onChange: (e) => onValueChange(e.target.value),
|
|
217
|
-
value,
|
|
218
|
-
children
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
var SelectValue = ({ placeholder }) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder });
|
|
222
|
-
var SelectItem = ({ value, children }) => /* @__PURE__ */ jsxRuntime.jsx("option", { value, children });
|
|
223
|
-
var Input2 = ({ className = "", ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
224
|
-
"input",
|
|
225
|
-
{
|
|
226
|
-
className: `flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ${className}`,
|
|
227
|
-
...props
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
var SelectField = React2.memo(function SelectField2({
|
|
231
|
-
name,
|
|
232
|
-
label,
|
|
233
|
-
placeholder = "Select an option",
|
|
234
|
-
options
|
|
412
|
+
function Select({
|
|
413
|
+
...props
|
|
235
414
|
}) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
id: String(name),
|
|
241
|
-
value: options.find((opt) => opt.value === field.value)?.label ?? "",
|
|
242
|
-
placeholder,
|
|
243
|
-
disabled: true,
|
|
244
|
-
className: "bg-background/50 opacity-80"
|
|
245
|
-
}
|
|
246
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(Select, { onValueChange: field.onChange, value: field.value ?? "", children: [
|
|
247
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder }),
|
|
248
|
-
options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
249
|
-
] }) });
|
|
250
|
-
});
|
|
251
|
-
var select_field_default = SelectField;
|
|
252
|
-
var ShadField2 = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children });
|
|
253
|
-
var FieldError2 = ({ children }) => children ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children }) : null;
|
|
254
|
-
var Checkbox = ({ checked, onCheckedChange, disabled, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
-
"input",
|
|
256
|
-
{
|
|
257
|
-
type: "checkbox",
|
|
258
|
-
id,
|
|
259
|
-
checked,
|
|
260
|
-
onChange: (e) => onCheckedChange?.(e.target.checked),
|
|
261
|
-
disabled,
|
|
262
|
-
className: "h-4 w-4 rounded border-gray-300"
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
var CheckboxField = React2.memo(function CheckboxField2({
|
|
266
|
-
name,
|
|
267
|
-
label,
|
|
268
|
-
description
|
|
415
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
|
|
416
|
+
}
|
|
417
|
+
function SelectValue({
|
|
418
|
+
...props
|
|
269
419
|
}) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
420
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { "data-slot": "select-value", ...props });
|
|
421
|
+
}
|
|
422
|
+
function SelectTrigger({
|
|
423
|
+
className,
|
|
424
|
+
size = "default",
|
|
425
|
+
children,
|
|
426
|
+
...props
|
|
427
|
+
}) {
|
|
428
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
429
|
+
SelectPrimitive__namespace.Trigger,
|
|
430
|
+
{
|
|
431
|
+
"data-slot": "select-trigger",
|
|
432
|
+
"data-size": size,
|
|
433
|
+
className: cn(
|
|
434
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
435
|
+
className
|
|
436
|
+
),
|
|
437
|
+
...props,
|
|
438
|
+
children: [
|
|
439
|
+
children,
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
function SelectContent({
|
|
446
|
+
className,
|
|
447
|
+
children,
|
|
448
|
+
position = "item-aligned",
|
|
449
|
+
align = "center",
|
|
450
|
+
...props
|
|
451
|
+
}) {
|
|
452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
453
|
+
SelectPrimitive__namespace.Content,
|
|
454
|
+
{
|
|
455
|
+
"data-slot": "select-content",
|
|
456
|
+
className: cn(
|
|
457
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
458
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
459
|
+
className
|
|
460
|
+
),
|
|
461
|
+
position,
|
|
462
|
+
align,
|
|
463
|
+
...props,
|
|
464
|
+
children: [
|
|
465
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
|
|
466
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
467
|
+
SelectPrimitive__namespace.Viewport,
|
|
468
|
+
{
|
|
469
|
+
className: cn(
|
|
470
|
+
"p-1",
|
|
471
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
472
|
+
),
|
|
473
|
+
children
|
|
474
|
+
}
|
|
475
|
+
),
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
|
|
477
|
+
]
|
|
478
|
+
}
|
|
479
|
+
) });
|
|
480
|
+
}
|
|
481
|
+
function SelectItem({
|
|
482
|
+
className,
|
|
483
|
+
children,
|
|
484
|
+
...props
|
|
485
|
+
}) {
|
|
486
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
487
|
+
SelectPrimitive__namespace.Item,
|
|
488
|
+
{
|
|
489
|
+
"data-slot": "select-item",
|
|
490
|
+
className: cn(
|
|
491
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
492
|
+
className
|
|
493
|
+
),
|
|
494
|
+
...props,
|
|
495
|
+
children: [
|
|
496
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
497
|
+
"span",
|
|
498
|
+
{
|
|
499
|
+
"data-slot": "select-item-indicator",
|
|
500
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
501
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) })
|
|
502
|
+
}
|
|
503
|
+
),
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
function SelectScrollUpButton({
|
|
510
|
+
className,
|
|
511
|
+
...props
|
|
512
|
+
}) {
|
|
513
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
514
|
+
SelectPrimitive__namespace.ScrollUpButton,
|
|
515
|
+
{
|
|
516
|
+
"data-slot": "select-scroll-up-button",
|
|
517
|
+
className: cn(
|
|
518
|
+
"flex cursor-default items-center justify-center py-1",
|
|
519
|
+
className
|
|
520
|
+
),
|
|
521
|
+
...props,
|
|
522
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "size-4" })
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
function SelectScrollDownButton({
|
|
527
|
+
className,
|
|
528
|
+
...props
|
|
529
|
+
}) {
|
|
530
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
+
SelectPrimitive__namespace.ScrollDownButton,
|
|
532
|
+
{
|
|
533
|
+
"data-slot": "select-scroll-down-button",
|
|
534
|
+
className: cn(
|
|
535
|
+
"flex cursor-default items-center justify-center py-1",
|
|
536
|
+
className
|
|
537
|
+
),
|
|
538
|
+
...props,
|
|
539
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4" })
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
var SelectField = React2.memo(function SelectField2({
|
|
544
|
+
name,
|
|
545
|
+
label,
|
|
546
|
+
placeholder = "Select an option",
|
|
547
|
+
options
|
|
548
|
+
}) {
|
|
549
|
+
const { isEditing } = useFormCtx();
|
|
550
|
+
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => !isEditing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
551
|
+
Input,
|
|
552
|
+
{
|
|
553
|
+
id: String(name),
|
|
554
|
+
value: options.find((opt) => opt.value === field.value)?.label ?? "",
|
|
555
|
+
placeholder,
|
|
556
|
+
readOnly: true,
|
|
557
|
+
disabled: true,
|
|
558
|
+
className: "bg-background/50 opacity-80"
|
|
559
|
+
}
|
|
560
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(Select, { onValueChange: field.onChange, value: field.value ?? "", children: [
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder }) }),
|
|
562
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
563
|
+
] }) });
|
|
564
|
+
});
|
|
565
|
+
var select_field_default = SelectField;
|
|
566
|
+
function Checkbox({
|
|
567
|
+
className,
|
|
568
|
+
...props
|
|
569
|
+
}) {
|
|
570
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
CheckboxPrimitive__namespace.Root,
|
|
572
|
+
{
|
|
573
|
+
"data-slot": "checkbox",
|
|
574
|
+
className: cn(
|
|
575
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
576
|
+
className
|
|
577
|
+
),
|
|
578
|
+
...props,
|
|
579
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
+
CheckboxPrimitive__namespace.Indicator,
|
|
581
|
+
{
|
|
582
|
+
"data-slot": "checkbox-indicator",
|
|
583
|
+
className: "grid place-content-center text-current transition-none",
|
|
584
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-3.5" })
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
var CheckboxField = React2.memo(function CheckboxField2({
|
|
591
|
+
name,
|
|
592
|
+
label,
|
|
593
|
+
description
|
|
594
|
+
}) {
|
|
595
|
+
const form = useFormCtx();
|
|
596
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
597
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
598
|
+
reactHookForm.Controller,
|
|
599
|
+
{
|
|
600
|
+
control: form.control,
|
|
601
|
+
name,
|
|
602
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
278
603
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
279
604
|
Checkbox,
|
|
280
605
|
{
|
|
@@ -286,10 +611,10 @@ var CheckboxField = React2.memo(function CheckboxField2({
|
|
|
286
611
|
),
|
|
287
612
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5 leading-none", children: [
|
|
288
613
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
-
|
|
614
|
+
Label,
|
|
290
615
|
{
|
|
291
616
|
htmlFor: String(name),
|
|
292
|
-
className: "
|
|
617
|
+
className: "cursor-pointer",
|
|
293
618
|
children: label
|
|
294
619
|
}
|
|
295
620
|
),
|
|
@@ -298,88 +623,296 @@ var CheckboxField = React2.memo(function CheckboxField2({
|
|
|
298
623
|
] })
|
|
299
624
|
}
|
|
300
625
|
),
|
|
301
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
626
|
+
form.formState.errors[name]?.message && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: form.formState.errors[name]?.message })
|
|
302
627
|
] });
|
|
303
628
|
});
|
|
304
629
|
var checkbox_field_default = CheckboxField;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
{
|
|
308
|
-
className: `inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium h-10 px-4 py-2 border ${className}`,
|
|
309
|
-
...props,
|
|
310
|
-
children
|
|
311
|
-
}
|
|
312
|
-
);
|
|
313
|
-
var DateField = React2.memo(function DateField2({
|
|
314
|
-
name,
|
|
315
|
-
label,
|
|
316
|
-
placeholder = "Select date"
|
|
630
|
+
function Popover({
|
|
631
|
+
...props
|
|
317
632
|
}) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
"input",
|
|
633
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
|
|
634
|
+
}
|
|
635
|
+
function PopoverTrigger({
|
|
636
|
+
...props
|
|
637
|
+
}) {
|
|
638
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
639
|
+
}
|
|
640
|
+
function PopoverContent({
|
|
641
|
+
className,
|
|
642
|
+
align = "center",
|
|
643
|
+
sideOffset = 4,
|
|
644
|
+
...props
|
|
645
|
+
}) {
|
|
646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
647
|
+
PopoverPrimitive__namespace.Content,
|
|
334
648
|
{
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
649
|
+
"data-slot": "popover-content",
|
|
650
|
+
align,
|
|
651
|
+
sideOffset,
|
|
652
|
+
className: cn(
|
|
653
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
654
|
+
className
|
|
655
|
+
),
|
|
656
|
+
...props
|
|
340
657
|
}
|
|
341
658
|
) });
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
var InputGroupAddon = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 flex items-center", children });
|
|
353
|
-
var InputGroupInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(Input3, { className: "pl-10", ...props });
|
|
354
|
-
var FileField = React2.memo(function FileField2({
|
|
355
|
-
name,
|
|
356
|
-
label,
|
|
357
|
-
accept,
|
|
358
|
-
multiple
|
|
659
|
+
}
|
|
660
|
+
function Calendar({
|
|
661
|
+
className,
|
|
662
|
+
classNames,
|
|
663
|
+
showOutsideDays = true,
|
|
664
|
+
captionLayout = "label",
|
|
665
|
+
buttonVariant = "ghost",
|
|
666
|
+
formatters,
|
|
667
|
+
components,
|
|
668
|
+
...props
|
|
359
669
|
}) {
|
|
360
|
-
const
|
|
361
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
670
|
+
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
671
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
672
|
+
reactDayPicker.DayPicker,
|
|
673
|
+
{
|
|
674
|
+
showOutsideDays,
|
|
675
|
+
className: cn(
|
|
676
|
+
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
677
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
678
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
679
|
+
className
|
|
680
|
+
),
|
|
681
|
+
captionLayout,
|
|
682
|
+
formatters: {
|
|
683
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
684
|
+
...formatters
|
|
685
|
+
},
|
|
686
|
+
classNames: {
|
|
687
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
688
|
+
months: cn(
|
|
689
|
+
"flex gap-4 flex-col md:flex-row relative",
|
|
690
|
+
defaultClassNames.months
|
|
376
691
|
),
|
|
377
|
-
|
|
378
|
-
|
|
692
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
693
|
+
nav: cn(
|
|
694
|
+
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
695
|
+
defaultClassNames.nav
|
|
696
|
+
),
|
|
697
|
+
button_previous: cn(
|
|
698
|
+
buttonVariants({ variant: buttonVariant }),
|
|
699
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
700
|
+
defaultClassNames.button_previous
|
|
701
|
+
),
|
|
702
|
+
button_next: cn(
|
|
703
|
+
buttonVariants({ variant: buttonVariant }),
|
|
704
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
705
|
+
defaultClassNames.button_next
|
|
706
|
+
),
|
|
707
|
+
month_caption: cn(
|
|
708
|
+
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
709
|
+
defaultClassNames.month_caption
|
|
710
|
+
),
|
|
711
|
+
dropdowns: cn(
|
|
712
|
+
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
713
|
+
defaultClassNames.dropdowns
|
|
714
|
+
),
|
|
715
|
+
dropdown_root: cn(
|
|
716
|
+
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
717
|
+
defaultClassNames.dropdown_root
|
|
718
|
+
),
|
|
719
|
+
dropdown: cn(
|
|
720
|
+
"absolute bg-popover inset-0 opacity-0",
|
|
721
|
+
defaultClassNames.dropdown
|
|
722
|
+
),
|
|
723
|
+
caption_label: cn(
|
|
724
|
+
"select-none font-medium",
|
|
725
|
+
captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
726
|
+
defaultClassNames.caption_label
|
|
727
|
+
),
|
|
728
|
+
table: "w-full border-collapse",
|
|
729
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
730
|
+
weekday: cn(
|
|
731
|
+
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
732
|
+
defaultClassNames.weekday
|
|
733
|
+
),
|
|
734
|
+
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
735
|
+
week_number_header: cn(
|
|
736
|
+
"select-none w-(--cell-size)",
|
|
737
|
+
defaultClassNames.week_number_header
|
|
738
|
+
),
|
|
739
|
+
week_number: cn(
|
|
740
|
+
"text-[0.8rem] select-none text-muted-foreground",
|
|
741
|
+
defaultClassNames.week_number
|
|
742
|
+
),
|
|
743
|
+
day: cn(
|
|
744
|
+
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
745
|
+
props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
746
|
+
defaultClassNames.day
|
|
747
|
+
),
|
|
748
|
+
range_start: cn(
|
|
749
|
+
"rounded-l-md bg-accent",
|
|
750
|
+
defaultClassNames.range_start
|
|
751
|
+
),
|
|
752
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
753
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
754
|
+
today: cn(
|
|
755
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
756
|
+
defaultClassNames.today
|
|
757
|
+
),
|
|
758
|
+
outside: cn(
|
|
759
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
760
|
+
defaultClassNames.outside
|
|
761
|
+
),
|
|
762
|
+
disabled: cn(
|
|
763
|
+
"text-muted-foreground opacity-50",
|
|
764
|
+
defaultClassNames.disabled
|
|
765
|
+
),
|
|
766
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
767
|
+
...classNames
|
|
768
|
+
},
|
|
769
|
+
components: {
|
|
770
|
+
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
771
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
772
|
+
"div",
|
|
773
|
+
{
|
|
774
|
+
"data-slot": "calendar",
|
|
775
|
+
ref: rootRef,
|
|
776
|
+
className: cn(className2),
|
|
777
|
+
...props2
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
},
|
|
781
|
+
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
782
|
+
if (orientation === "left") {
|
|
783
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
784
|
+
}
|
|
785
|
+
if (orientation === "right") {
|
|
786
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
787
|
+
lucideReact.ChevronRightIcon,
|
|
788
|
+
{
|
|
789
|
+
className: cn("size-4", className2),
|
|
790
|
+
...props2
|
|
791
|
+
}
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
795
|
+
},
|
|
796
|
+
DayButton: CalendarDayButton,
|
|
797
|
+
WeekNumber: ({ children, ...props2 }) => {
|
|
798
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props2, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
799
|
+
},
|
|
800
|
+
...components
|
|
801
|
+
},
|
|
802
|
+
...props
|
|
379
803
|
}
|
|
380
|
-
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
function CalendarDayButton({
|
|
807
|
+
className,
|
|
808
|
+
day,
|
|
809
|
+
modifiers,
|
|
810
|
+
...props
|
|
811
|
+
}) {
|
|
812
|
+
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
813
|
+
const ref = React2__namespace.useRef(null);
|
|
814
|
+
React2__namespace.useEffect(() => {
|
|
815
|
+
if (modifiers.focused) ref.current?.focus();
|
|
816
|
+
}, [modifiers.focused]);
|
|
817
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
818
|
+
Button,
|
|
819
|
+
{
|
|
820
|
+
ref,
|
|
821
|
+
variant: "ghost",
|
|
822
|
+
size: "icon",
|
|
823
|
+
"data-day": day.date.toLocaleDateString(),
|
|
824
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
825
|
+
"data-range-start": modifiers.range_start,
|
|
826
|
+
"data-range-end": modifiers.range_end,
|
|
827
|
+
"data-range-middle": modifiers.range_middle,
|
|
828
|
+
className: cn(
|
|
829
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
830
|
+
defaultClassNames.day,
|
|
831
|
+
className
|
|
832
|
+
),
|
|
833
|
+
...props
|
|
834
|
+
}
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
var DateField = React2.memo(function DateField2({
|
|
838
|
+
name,
|
|
839
|
+
label,
|
|
840
|
+
placeholder = "Pick a date"
|
|
841
|
+
}) {
|
|
842
|
+
const { isEditing } = useFormCtx();
|
|
843
|
+
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => !isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
844
|
+
Button,
|
|
845
|
+
{
|
|
846
|
+
type: "button",
|
|
847
|
+
variant: "outline",
|
|
848
|
+
className: cn(
|
|
849
|
+
"w-full justify-start text-left font-normal bg-background/50",
|
|
850
|
+
!field.value && "text-muted-foreground"
|
|
851
|
+
),
|
|
852
|
+
disabled: true,
|
|
853
|
+
children: [
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
855
|
+
field.value ? dateFns.format(new Date(field.value), "PPP") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: placeholder })
|
|
856
|
+
]
|
|
857
|
+
}
|
|
858
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
860
|
+
Button,
|
|
861
|
+
{
|
|
862
|
+
variant: "outline",
|
|
863
|
+
className: cn(
|
|
864
|
+
"w-full justify-start text-left font-normal",
|
|
865
|
+
!field.value && "text-muted-foreground"
|
|
866
|
+
),
|
|
867
|
+
children: [
|
|
868
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
869
|
+
field.value ? dateFns.format(new Date(field.value), "PPP") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: placeholder })
|
|
870
|
+
]
|
|
871
|
+
}
|
|
872
|
+
) }),
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
874
|
+
Calendar,
|
|
875
|
+
{
|
|
876
|
+
mode: "single",
|
|
877
|
+
selected: field.value ? new Date(field.value) : void 0,
|
|
878
|
+
onSelect: field.onChange,
|
|
879
|
+
initialFocus: true
|
|
880
|
+
}
|
|
881
|
+
) })
|
|
882
|
+
] }) });
|
|
883
|
+
});
|
|
884
|
+
var date_field_default = DateField;
|
|
885
|
+
var FileField = React2.memo(function FileField2({
|
|
886
|
+
name,
|
|
887
|
+
label,
|
|
888
|
+
accept,
|
|
889
|
+
multiple
|
|
890
|
+
}) {
|
|
891
|
+
const { isEditing } = useFormCtx();
|
|
892
|
+
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => {
|
|
893
|
+
const files = field.value;
|
|
894
|
+
const filename = files && files.length ? multiple ? `${files.length} files` : files[0].name : "";
|
|
895
|
+
if (!isEditing) {
|
|
896
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
|
|
897
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "absolute left-3 text-muted-foreground h-4 w-4 z-10" }),
|
|
898
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
899
|
+
Input,
|
|
900
|
+
{
|
|
901
|
+
id: `${String(name)}_display`,
|
|
902
|
+
type: "text",
|
|
903
|
+
value: filename,
|
|
904
|
+
placeholder: accept ? `Accepts ${accept}` : "No file selected",
|
|
905
|
+
readOnly: true,
|
|
906
|
+
disabled: true,
|
|
907
|
+
className: "bg-background/50 opacity-80 pl-10"
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] });
|
|
911
|
+
}
|
|
912
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
|
|
913
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "absolute left-3 text-muted-foreground h-4 w-4 z-10 pointer-events-none" }),
|
|
381
914
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
382
|
-
|
|
915
|
+
Input,
|
|
383
916
|
{
|
|
384
917
|
id: String(name),
|
|
385
918
|
type: "file",
|
|
@@ -388,23 +921,59 @@ var FileField = React2.memo(function FileField2({
|
|
|
388
921
|
onChange: (e) => field.onChange(e.target.files),
|
|
389
922
|
onBlur: field.onBlur,
|
|
390
923
|
name: field.name,
|
|
391
|
-
ref: field.ref
|
|
924
|
+
ref: field.ref,
|
|
925
|
+
className: "pl-10"
|
|
392
926
|
}
|
|
393
|
-
)
|
|
394
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "text-muted-foreground h-4 w-4" }) })
|
|
927
|
+
)
|
|
395
928
|
] });
|
|
396
929
|
} });
|
|
397
930
|
});
|
|
398
931
|
var file_field_default = FileField;
|
|
399
|
-
function
|
|
400
|
-
|
|
932
|
+
function Avatar({
|
|
933
|
+
className,
|
|
934
|
+
...props
|
|
935
|
+
}) {
|
|
936
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
937
|
+
AvatarPrimitive__namespace.Root,
|
|
938
|
+
{
|
|
939
|
+
"data-slot": "avatar",
|
|
940
|
+
className: cn(
|
|
941
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
942
|
+
className
|
|
943
|
+
),
|
|
944
|
+
...props
|
|
945
|
+
}
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
function AvatarImage({
|
|
949
|
+
className,
|
|
950
|
+
...props
|
|
951
|
+
}) {
|
|
952
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
953
|
+
AvatarPrimitive__namespace.Image,
|
|
954
|
+
{
|
|
955
|
+
"data-slot": "avatar-image",
|
|
956
|
+
className: cn("aspect-square size-full", className),
|
|
957
|
+
...props
|
|
958
|
+
}
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
function AvatarFallback({
|
|
962
|
+
className,
|
|
963
|
+
...props
|
|
964
|
+
}) {
|
|
965
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
966
|
+
AvatarPrimitive__namespace.Fallback,
|
|
967
|
+
{
|
|
968
|
+
"data-slot": "avatar-fallback",
|
|
969
|
+
className: cn(
|
|
970
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
971
|
+
className
|
|
972
|
+
),
|
|
973
|
+
...props
|
|
974
|
+
}
|
|
975
|
+
);
|
|
401
976
|
}
|
|
402
|
-
var Avatar = ({ className, children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className), children });
|
|
403
|
-
var AvatarImage = ({ src, alt }) => src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt, className: "aspect-square h-full w-full" }) : null;
|
|
404
|
-
var AvatarFallback = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted", children });
|
|
405
|
-
var Label = ({ htmlFor, children, className }) => /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor, className, children });
|
|
406
|
-
var Input4 = (props) => /* @__PURE__ */ jsxRuntime.jsx("input", { ...props });
|
|
407
|
-
var Button2 = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("button", { className: "px-3 py-1 text-sm rounded hover:bg-accent", ...props, children });
|
|
408
977
|
var ProfilePictureField = React2.memo(function ProfilePictureField2({
|
|
409
978
|
name,
|
|
410
979
|
label,
|
|
@@ -435,7 +1004,7 @@ var ProfilePictureField = React2.memo(function ProfilePictureField2({
|
|
|
435
1004
|
}
|
|
436
1005
|
),
|
|
437
1006
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
438
|
-
|
|
1007
|
+
Input,
|
|
439
1008
|
{
|
|
440
1009
|
id: String(name),
|
|
441
1010
|
type: "file",
|
|
@@ -458,8 +1027,10 @@ var ProfilePictureField = React2.memo(function ProfilePictureField2({
|
|
|
458
1027
|
}
|
|
459
1028
|
),
|
|
460
1029
|
displayUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
461
|
-
|
|
1030
|
+
Button,
|
|
462
1031
|
{
|
|
1032
|
+
variant: "ghost",
|
|
1033
|
+
size: "sm",
|
|
463
1034
|
type: "button",
|
|
464
1035
|
onClick: () => {
|
|
465
1036
|
field.onChange(null);
|
|
@@ -473,7 +1044,7 @@ var ProfilePictureField = React2.memo(function ProfilePictureField2({
|
|
|
473
1044
|
} });
|
|
474
1045
|
});
|
|
475
1046
|
var profile_picture_field_default = ProfilePictureField;
|
|
476
|
-
var
|
|
1047
|
+
var Button2 = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
1048
|
"button",
|
|
478
1049
|
{
|
|
479
1050
|
className: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium 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 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2",
|
|
@@ -486,23 +1057,15 @@ function Submit({ children, ...props }) {
|
|
|
486
1057
|
const isPending = form.isPending || form.formState.isSubmitting;
|
|
487
1058
|
const { isEditing } = form;
|
|
488
1059
|
if (!isEditing) return null;
|
|
489
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", disabled: isPending || props.disabled, ...props, children: isPending ? "Submitting..." : children });
|
|
490
1061
|
}
|
|
491
1062
|
var submit_default = Submit;
|
|
492
|
-
var Button4 = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
493
|
-
"button",
|
|
494
|
-
{
|
|
495
|
-
className: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium 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 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2",
|
|
496
|
-
...props,
|
|
497
|
-
children
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
1063
|
function EditButton({ children, formId, ...props }) {
|
|
501
1064
|
const ctx = React2.useContext(FormContext);
|
|
502
1065
|
if (ctx) {
|
|
503
1066
|
const { isEditing, setIsEditing } = ctx;
|
|
504
1067
|
if (isEditing) return null;
|
|
505
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1068
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: () => setIsEditing?.(true), ...props, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
506
1069
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4 mr-2" }),
|
|
507
1070
|
"Edit Profile"
|
|
508
1071
|
] }) });
|
|
@@ -524,27 +1087,20 @@ function EditButton({ children, formId, ...props }) {
|
|
|
524
1087
|
}
|
|
525
1088
|
}, 100);
|
|
526
1089
|
};
|
|
527
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1090
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: handleClick, ...props, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
528
1091
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4 mr-2" }),
|
|
529
1092
|
"Edit Profile"
|
|
530
1093
|
] }) });
|
|
531
1094
|
}
|
|
532
1095
|
var edit_button_default = EditButton;
|
|
533
|
-
var Button5 = ({ children, className = "", ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
534
|
-
"button",
|
|
535
|
-
{
|
|
536
|
-
className: `inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2 ${className}`,
|
|
537
|
-
...props,
|
|
538
|
-
children
|
|
539
|
-
}
|
|
540
|
-
);
|
|
541
1096
|
function CancelButton({ children, ...props }) {
|
|
542
1097
|
const { isEditing, setIsEditing, reset } = useFormCtx();
|
|
543
1098
|
if (!isEditing) return null;
|
|
544
1099
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
545
|
-
|
|
1100
|
+
Button,
|
|
546
1101
|
{
|
|
547
1102
|
type: "button",
|
|
1103
|
+
variant: "outline",
|
|
548
1104
|
onClick: () => {
|
|
549
1105
|
reset();
|
|
550
1106
|
setIsEditing?.(false);
|
|
@@ -558,17 +1114,30 @@ function CancelButton({ children, ...props }) {
|
|
|
558
1114
|
);
|
|
559
1115
|
}
|
|
560
1116
|
var cancel_button_default = CancelButton;
|
|
561
|
-
function LinkField({ label, link, LinkComponent }) {
|
|
1117
|
+
function LinkField({ label, link, LinkComponent, className }) {
|
|
562
1118
|
const LinkTag = LinkComponent || "a";
|
|
563
|
-
const linkProps =
|
|
564
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
+
const linkProps = { href: link };
|
|
1120
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
+
LinkTag,
|
|
1122
|
+
{
|
|
1123
|
+
...linkProps,
|
|
1124
|
+
className: cn("text-sm text-primary hover:underline", className),
|
|
1125
|
+
children: label
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
565
1128
|
}
|
|
566
1129
|
var link_field_default = LinkField;
|
|
567
|
-
|
|
1130
|
+
function FieldGroup({ children, className, title }) {
|
|
1131
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4", className), children: [
|
|
1132
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-medium", children: title }),
|
|
1133
|
+
children
|
|
1134
|
+
] });
|
|
1135
|
+
}
|
|
568
1136
|
var field_group_default = FieldGroup;
|
|
569
1137
|
|
|
570
1138
|
// src/components/form/index.ts
|
|
571
1139
|
var Form = Object.assign(root_default, {
|
|
1140
|
+
Root: root_default,
|
|
572
1141
|
Field: field_default,
|
|
573
1142
|
InputField: input_field_default,
|
|
574
1143
|
PasswordField: password_field_default,
|
|
@@ -593,7 +1162,7 @@ function useDataTable() {
|
|
|
593
1162
|
}
|
|
594
1163
|
return context;
|
|
595
1164
|
}
|
|
596
|
-
function
|
|
1165
|
+
function Root7({
|
|
597
1166
|
columns,
|
|
598
1167
|
data,
|
|
599
1168
|
filters = [],
|
|
@@ -663,368 +1232,7 @@ function Root2({
|
|
|
663
1232
|
}
|
|
664
1233
|
);
|
|
665
1234
|
}
|
|
666
|
-
var root_default2 =
|
|
667
|
-
function Input5({ className, type, ...props }) {
|
|
668
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
669
|
-
"input",
|
|
670
|
-
{
|
|
671
|
-
type,
|
|
672
|
-
"data-slot": "input",
|
|
673
|
-
className: cn(
|
|
674
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
675
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
676
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
677
|
-
className
|
|
678
|
-
),
|
|
679
|
-
...props
|
|
680
|
-
}
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
function setRef(ref, value) {
|
|
684
|
-
if (typeof ref === "function") {
|
|
685
|
-
return ref(value);
|
|
686
|
-
} else if (ref !== null && ref !== void 0) {
|
|
687
|
-
ref.current = value;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
function composeRefs(...refs) {
|
|
691
|
-
return (node) => {
|
|
692
|
-
let hasCleanup = false;
|
|
693
|
-
const cleanups = refs.map((ref) => {
|
|
694
|
-
const cleanup = setRef(ref, node);
|
|
695
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
696
|
-
hasCleanup = true;
|
|
697
|
-
}
|
|
698
|
-
return cleanup;
|
|
699
|
-
});
|
|
700
|
-
if (hasCleanup) {
|
|
701
|
-
return () => {
|
|
702
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
703
|
-
const cleanup = cleanups[i];
|
|
704
|
-
if (typeof cleanup == "function") {
|
|
705
|
-
cleanup();
|
|
706
|
-
} else {
|
|
707
|
-
setRef(refs[i], null);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
// @__NO_SIDE_EFFECTS__
|
|
715
|
-
function createSlot(ownerName) {
|
|
716
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
717
|
-
const Slot2 = React2__namespace.forwardRef((props, forwardedRef) => {
|
|
718
|
-
const { children, ...slotProps } = props;
|
|
719
|
-
const childrenArray = React2__namespace.Children.toArray(children);
|
|
720
|
-
const slottable = childrenArray.find(isSlottable);
|
|
721
|
-
if (slottable) {
|
|
722
|
-
const newElement = slottable.props.children;
|
|
723
|
-
const newChildren = childrenArray.map((child) => {
|
|
724
|
-
if (child === slottable) {
|
|
725
|
-
if (React2__namespace.Children.count(newElement) > 1) return React2__namespace.Children.only(null);
|
|
726
|
-
return React2__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
727
|
-
} else {
|
|
728
|
-
return child;
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React2__namespace.isValidElement(newElement) ? React2__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
732
|
-
}
|
|
733
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
734
|
-
});
|
|
735
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
736
|
-
return Slot2;
|
|
737
|
-
}
|
|
738
|
-
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
739
|
-
// @__NO_SIDE_EFFECTS__
|
|
740
|
-
function createSlotClone(ownerName) {
|
|
741
|
-
const SlotClone = React2__namespace.forwardRef((props, forwardedRef) => {
|
|
742
|
-
const { children, ...slotProps } = props;
|
|
743
|
-
if (React2__namespace.isValidElement(children)) {
|
|
744
|
-
const childrenRef = getElementRef(children);
|
|
745
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
746
|
-
if (children.type !== React2__namespace.Fragment) {
|
|
747
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
748
|
-
}
|
|
749
|
-
return React2__namespace.cloneElement(children, props2);
|
|
750
|
-
}
|
|
751
|
-
return React2__namespace.Children.count(children) > 1 ? React2__namespace.Children.only(null) : null;
|
|
752
|
-
});
|
|
753
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
754
|
-
return SlotClone;
|
|
755
|
-
}
|
|
756
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
757
|
-
function isSlottable(child) {
|
|
758
|
-
return React2__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
759
|
-
}
|
|
760
|
-
function mergeProps(slotProps, childProps) {
|
|
761
|
-
const overrideProps = { ...childProps };
|
|
762
|
-
for (const propName in childProps) {
|
|
763
|
-
const slotPropValue = slotProps[propName];
|
|
764
|
-
const childPropValue = childProps[propName];
|
|
765
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
766
|
-
if (isHandler) {
|
|
767
|
-
if (slotPropValue && childPropValue) {
|
|
768
|
-
overrideProps[propName] = (...args) => {
|
|
769
|
-
const result = childPropValue(...args);
|
|
770
|
-
slotPropValue(...args);
|
|
771
|
-
return result;
|
|
772
|
-
};
|
|
773
|
-
} else if (slotPropValue) {
|
|
774
|
-
overrideProps[propName] = slotPropValue;
|
|
775
|
-
}
|
|
776
|
-
} else if (propName === "style") {
|
|
777
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
778
|
-
} else if (propName === "className") {
|
|
779
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return { ...slotProps, ...overrideProps };
|
|
783
|
-
}
|
|
784
|
-
function getElementRef(element) {
|
|
785
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
786
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
787
|
-
if (mayWarn) {
|
|
788
|
-
return element.ref;
|
|
789
|
-
}
|
|
790
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
791
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
792
|
-
if (mayWarn) {
|
|
793
|
-
return element.props.ref;
|
|
794
|
-
}
|
|
795
|
-
return element.props.ref || element.ref;
|
|
796
|
-
}
|
|
797
|
-
var buttonVariants = classVarianceAuthority.cva(
|
|
798
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
799
|
-
{
|
|
800
|
-
variants: {
|
|
801
|
-
variant: {
|
|
802
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
803
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
804
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
805
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
806
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
807
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
808
|
-
},
|
|
809
|
-
size: {
|
|
810
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
811
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
812
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
813
|
-
icon: "size-9",
|
|
814
|
-
"icon-sm": "size-8",
|
|
815
|
-
"icon-lg": "size-10"
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
defaultVariants: {
|
|
819
|
-
variant: "default",
|
|
820
|
-
size: "default"
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
);
|
|
824
|
-
function Button6({
|
|
825
|
-
className,
|
|
826
|
-
variant = "default",
|
|
827
|
-
size = "default",
|
|
828
|
-
asChild = false,
|
|
829
|
-
...props
|
|
830
|
-
}) {
|
|
831
|
-
const Comp = asChild ? Slot : "button";
|
|
832
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
833
|
-
Comp,
|
|
834
|
-
{
|
|
835
|
-
"data-slot": "button",
|
|
836
|
-
"data-variant": variant,
|
|
837
|
-
"data-size": size,
|
|
838
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
839
|
-
...props
|
|
840
|
-
}
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
function Select2({
|
|
844
|
-
...props
|
|
845
|
-
}) {
|
|
846
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
|
|
847
|
-
}
|
|
848
|
-
function SelectValue2({
|
|
849
|
-
...props
|
|
850
|
-
}) {
|
|
851
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { "data-slot": "select-value", ...props });
|
|
852
|
-
}
|
|
853
|
-
function SelectTrigger({
|
|
854
|
-
className,
|
|
855
|
-
size = "default",
|
|
856
|
-
children,
|
|
857
|
-
...props
|
|
858
|
-
}) {
|
|
859
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
860
|
-
SelectPrimitive__namespace.Trigger,
|
|
861
|
-
{
|
|
862
|
-
"data-slot": "select-trigger",
|
|
863
|
-
"data-size": size,
|
|
864
|
-
className: cn(
|
|
865
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
866
|
-
className
|
|
867
|
-
),
|
|
868
|
-
...props,
|
|
869
|
-
children: [
|
|
870
|
-
children,
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
872
|
-
]
|
|
873
|
-
}
|
|
874
|
-
);
|
|
875
|
-
}
|
|
876
|
-
function SelectContent({
|
|
877
|
-
className,
|
|
878
|
-
children,
|
|
879
|
-
position = "item-aligned",
|
|
880
|
-
align = "center",
|
|
881
|
-
...props
|
|
882
|
-
}) {
|
|
883
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
884
|
-
SelectPrimitive__namespace.Content,
|
|
885
|
-
{
|
|
886
|
-
"data-slot": "select-content",
|
|
887
|
-
className: cn(
|
|
888
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
889
|
-
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
890
|
-
className
|
|
891
|
-
),
|
|
892
|
-
position,
|
|
893
|
-
align,
|
|
894
|
-
...props,
|
|
895
|
-
children: [
|
|
896
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
|
|
897
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
898
|
-
SelectPrimitive__namespace.Viewport,
|
|
899
|
-
{
|
|
900
|
-
className: cn(
|
|
901
|
-
"p-1",
|
|
902
|
-
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
903
|
-
),
|
|
904
|
-
children
|
|
905
|
-
}
|
|
906
|
-
),
|
|
907
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
|
|
908
|
-
]
|
|
909
|
-
}
|
|
910
|
-
) });
|
|
911
|
-
}
|
|
912
|
-
function SelectItem2({
|
|
913
|
-
className,
|
|
914
|
-
children,
|
|
915
|
-
...props
|
|
916
|
-
}) {
|
|
917
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
918
|
-
SelectPrimitive__namespace.Item,
|
|
919
|
-
{
|
|
920
|
-
"data-slot": "select-item",
|
|
921
|
-
className: cn(
|
|
922
|
-
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
923
|
-
className
|
|
924
|
-
),
|
|
925
|
-
...props,
|
|
926
|
-
children: [
|
|
927
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
928
|
-
"span",
|
|
929
|
-
{
|
|
930
|
-
"data-slot": "select-item-indicator",
|
|
931
|
-
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
932
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) })
|
|
933
|
-
}
|
|
934
|
-
),
|
|
935
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
|
|
936
|
-
]
|
|
937
|
-
}
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
function SelectScrollUpButton({
|
|
941
|
-
className,
|
|
942
|
-
...props
|
|
943
|
-
}) {
|
|
944
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
945
|
-
SelectPrimitive__namespace.ScrollUpButton,
|
|
946
|
-
{
|
|
947
|
-
"data-slot": "select-scroll-up-button",
|
|
948
|
-
className: cn(
|
|
949
|
-
"flex cursor-default items-center justify-center py-1",
|
|
950
|
-
className
|
|
951
|
-
),
|
|
952
|
-
...props,
|
|
953
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "size-4" })
|
|
954
|
-
}
|
|
955
|
-
);
|
|
956
|
-
}
|
|
957
|
-
function SelectScrollDownButton({
|
|
958
|
-
className,
|
|
959
|
-
...props
|
|
960
|
-
}) {
|
|
961
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
962
|
-
SelectPrimitive__namespace.ScrollDownButton,
|
|
963
|
-
{
|
|
964
|
-
"data-slot": "select-scroll-down-button",
|
|
965
|
-
className: cn(
|
|
966
|
-
"flex cursor-default items-center justify-center py-1",
|
|
967
|
-
className
|
|
968
|
-
),
|
|
969
|
-
...props,
|
|
970
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4" })
|
|
971
|
-
}
|
|
972
|
-
);
|
|
973
|
-
}
|
|
974
|
-
function Popover({
|
|
975
|
-
...props
|
|
976
|
-
}) {
|
|
977
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
|
|
978
|
-
}
|
|
979
|
-
function PopoverTrigger({
|
|
980
|
-
...props
|
|
981
|
-
}) {
|
|
982
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
983
|
-
}
|
|
984
|
-
function PopoverContent({
|
|
985
|
-
className,
|
|
986
|
-
align = "center",
|
|
987
|
-
sideOffset = 4,
|
|
988
|
-
...props
|
|
989
|
-
}) {
|
|
990
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
991
|
-
PopoverPrimitive__namespace.Content,
|
|
992
|
-
{
|
|
993
|
-
"data-slot": "popover-content",
|
|
994
|
-
align,
|
|
995
|
-
sideOffset,
|
|
996
|
-
className: cn(
|
|
997
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
998
|
-
className
|
|
999
|
-
),
|
|
1000
|
-
...props
|
|
1001
|
-
}
|
|
1002
|
-
) });
|
|
1003
|
-
}
|
|
1004
|
-
function Checkbox2({
|
|
1005
|
-
className,
|
|
1006
|
-
...props
|
|
1007
|
-
}) {
|
|
1008
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1009
|
-
CheckboxPrimitive__namespace.Root,
|
|
1010
|
-
{
|
|
1011
|
-
"data-slot": "checkbox",
|
|
1012
|
-
className: cn(
|
|
1013
|
-
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
1014
|
-
className
|
|
1015
|
-
),
|
|
1016
|
-
...props,
|
|
1017
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1018
|
-
CheckboxPrimitive__namespace.Indicator,
|
|
1019
|
-
{
|
|
1020
|
-
"data-slot": "checkbox-indicator",
|
|
1021
|
-
className: "grid place-content-center text-current transition-none",
|
|
1022
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-3.5" })
|
|
1023
|
-
}
|
|
1024
|
-
)
|
|
1025
|
-
}
|
|
1026
|
-
);
|
|
1027
|
-
}
|
|
1235
|
+
var root_default2 = Root7;
|
|
1028
1236
|
function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeChange }) {
|
|
1029
1237
|
let contextStr;
|
|
1030
1238
|
try {
|
|
@@ -1036,22 +1244,24 @@ function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeC
|
|
|
1036
1244
|
});
|
|
1037
1245
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border rounded-md bg-background", children: [
|
|
1038
1246
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
-
|
|
1247
|
+
Button,
|
|
1040
1248
|
{
|
|
1041
1249
|
variant: mode === "table" ? "secondary" : "ghost",
|
|
1042
1250
|
size: "sm",
|
|
1043
1251
|
onClick: () => setMode("table"),
|
|
1044
1252
|
className: "rounded-r-none h-8 px-2 lg:px-3",
|
|
1253
|
+
"aria-label": "Switch to table view",
|
|
1045
1254
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { className: "h-4 w-4" })
|
|
1046
1255
|
}
|
|
1047
1256
|
),
|
|
1048
1257
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
|
-
|
|
1258
|
+
Button,
|
|
1050
1259
|
{
|
|
1051
1260
|
variant: mode === "grid" ? "secondary" : "ghost",
|
|
1052
1261
|
size: "sm",
|
|
1053
1262
|
onClick: () => setMode("grid"),
|
|
1054
1263
|
className: "rounded-l-none h-8 px-2 lg:px-3",
|
|
1264
|
+
"aria-label": "Switch to grid view",
|
|
1055
1265
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutGrid, { className: "h-4 w-4" })
|
|
1056
1266
|
}
|
|
1057
1267
|
)
|
|
@@ -1078,7 +1288,7 @@ function Toolbar({ viewOptions } = {}) {
|
|
|
1078
1288
|
};
|
|
1079
1289
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 py-4", children: [
|
|
1080
1290
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1081
|
-
|
|
1291
|
+
Input,
|
|
1082
1292
|
{
|
|
1083
1293
|
placeholder: "Search...",
|
|
1084
1294
|
value: table.getState().globalFilter ?? "",
|
|
@@ -1089,7 +1299,7 @@ function Toolbar({ viewOptions } = {}) {
|
|
|
1089
1299
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4", children: [
|
|
1090
1300
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-wrap flex-1", children: [
|
|
1091
1301
|
filters.map((filter) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: filter.multiSelect ? /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
1092
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1302
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", className: "h-8 border-dashed", children: [
|
|
1093
1303
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SlidersHorizontal, { className: "h-4 w-4 mr-2" }),
|
|
1094
1304
|
filter.label,
|
|
1095
1305
|
activeFilters[filter.id] && (Array.isArray(activeFilters[filter.id]) ? activeFilters[filter.id].length > 0 : true) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1 rounded-sm bg-primary px-1 text-xs text-primary-foreground", children: Array.isArray(activeFilters[filter.id]) ? activeFilters[filter.id].length : 1 })
|
|
@@ -1102,16 +1312,16 @@ function Toolbar({ viewOptions } = {}) {
|
|
|
1102
1312
|
onClick: () => handleMultiFilterToggle(filter.id, option.value),
|
|
1103
1313
|
children: [
|
|
1104
1314
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1105
|
-
|
|
1315
|
+
Checkbox,
|
|
1106
1316
|
{
|
|
1107
1317
|
id: `${filter.id}-${option.value}`,
|
|
1108
|
-
checked: Array.isArray(activeFilters[filter.id]) && activeFilters[filter.id].includes(option.value)
|
|
1109
|
-
onCheckedChange: () => handleMultiFilterToggle(filter.id, option.value)
|
|
1318
|
+
checked: Array.isArray(activeFilters[filter.id]) && activeFilters[filter.id].includes(option.value)
|
|
1110
1319
|
}
|
|
1111
1320
|
),
|
|
1112
1321
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
1322
|
"label",
|
|
1114
1323
|
{
|
|
1324
|
+
htmlFor: `${filter.id}-${option.value}`,
|
|
1115
1325
|
className: "text-sm cursor-pointer flex-1",
|
|
1116
1326
|
children: option.label
|
|
1117
1327
|
}
|
|
@@ -1133,24 +1343,24 @@ function Toolbar({ viewOptions } = {}) {
|
|
|
1133
1343
|
] })
|
|
1134
1344
|
] }) })
|
|
1135
1345
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1136
|
-
|
|
1346
|
+
Select,
|
|
1137
1347
|
{
|
|
1138
1348
|
value: activeFilters[filter.id] || "all",
|
|
1139
1349
|
onValueChange: (value) => handleFilterChange(filter.id, value),
|
|
1140
1350
|
children: [
|
|
1141
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[150px] border-dashed", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1351
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[150px] border-dashed", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: filter.placeholder || filter.label }) }),
|
|
1142
1352
|
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
|
|
1143
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: "all", children: [
|
|
1144
1354
|
"All ",
|
|
1145
1355
|
filter.label
|
|
1146
1356
|
] }),
|
|
1147
|
-
filter.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1357
|
+
filter.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
1148
1358
|
] })
|
|
1149
1359
|
]
|
|
1150
1360
|
}
|
|
1151
1361
|
) }, filter.id)),
|
|
1152
1362
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
1153
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1363
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", className: "h-8 ml-auto sm:ml-0", children: [
|
|
1154
1364
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4 mr-2" }),
|
|
1155
1365
|
"Columns"
|
|
1156
1366
|
] }) }),
|
|
@@ -1158,7 +1368,7 @@ function Toolbar({ viewOptions } = {}) {
|
|
|
1158
1368
|
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-medium text-sm", children: "Toggle Columns" }),
|
|
1159
1369
|
table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1160
1370
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1161
|
-
|
|
1371
|
+
Checkbox,
|
|
1162
1372
|
{
|
|
1163
1373
|
id: column.id,
|
|
1164
1374
|
checked: column.getIsVisible(),
|
|
@@ -1175,13 +1385,13 @@ function Toolbar({ viewOptions } = {}) {
|
|
|
1175
1385
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1176
1386
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm text-muted-foreground whitespace-nowrap hidden sm:inline-block", children: "Rows" }),
|
|
1177
1387
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1178
|
-
|
|
1388
|
+
Select,
|
|
1179
1389
|
{
|
|
1180
1390
|
value: String(table.getState().pagination.pageSize),
|
|
1181
1391
|
onValueChange: (value) => table.setPageSize(Number(value)),
|
|
1182
1392
|
children: [
|
|
1183
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-16 h-8", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1184
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: [10, 20, 30, 40, 50].map((size) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1393
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-16 h-8", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
1394
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: [10, 20, 30, 40, 50].map((size) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(size), children: size }, size)) })
|
|
1185
1395
|
]
|
|
1186
1396
|
}
|
|
1187
1397
|
)
|
|
@@ -1311,6 +1521,7 @@ function GridView({ renderCard, columns = 3, gap = 16 }) {
|
|
|
1311
1521
|
);
|
|
1312
1522
|
}
|
|
1313
1523
|
function DefaultCard({ item }) {
|
|
1524
|
+
if (typeof item !== "object" || item === null) return null;
|
|
1314
1525
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: Object.entries(item).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1315
1526
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-medium", children: [
|
|
1316
1527
|
key,
|
|
@@ -1347,7 +1558,7 @@ function Pagination() {
|
|
|
1347
1558
|
] }),
|
|
1348
1559
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1349
1560
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1350
|
-
|
|
1561
|
+
Button,
|
|
1351
1562
|
{
|
|
1352
1563
|
variant: "outline",
|
|
1353
1564
|
size: "sm",
|
|
@@ -1363,7 +1574,7 @@ function Pagination() {
|
|
|
1363
1574
|
table.getPageCount()
|
|
1364
1575
|
] }),
|
|
1365
1576
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1366
|
-
|
|
1577
|
+
Button,
|
|
1367
1578
|
{
|
|
1368
1579
|
variant: "outline",
|
|
1369
1580
|
size: "sm",
|
|
@@ -1379,6 +1590,7 @@ var pagination_default = Pagination;
|
|
|
1379
1590
|
|
|
1380
1591
|
// src/components/data-table/index.tsx
|
|
1381
1592
|
var DataTable = Object.assign(root_default2, {
|
|
1593
|
+
Root: root_default2,
|
|
1382
1594
|
Toolbar: toolbar_default,
|
|
1383
1595
|
Content: content_default,
|
|
1384
1596
|
TableView: table_view_default,
|