@saptanshuwanjari/react-component-library 0.1.8 → 0.1.9

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