@saptanshuwanjari/react-component-library 0.1.6 → 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.d.mts +51 -22
- package/dist/index.d.ts +51 -22
- package/dist/index.js +1097 -845
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +870 -620
- 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,73 +409,198 @@ 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
|
-
|
|
278
|
-
|
|
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: [
|
|
603
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
279
604
|
Checkbox,
|
|
280
605
|
{
|
|
281
606
|
id: String(name),
|
|
@@ -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,730 +623,653 @@ 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
|
-
type: "button",
|
|
324
|
-
id: String(name),
|
|
325
|
-
className: "w-full justify-between font-normal bg-background/50 border-border/50",
|
|
326
|
-
disabled: true,
|
|
327
|
-
children: [
|
|
328
|
-
field.value ? new Date(field.value).toLocaleDateString() : placeholder,
|
|
329
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
330
|
-
]
|
|
331
|
-
}
|
|
332
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
333
|
-
"input",
|
|
334
|
-
{
|
|
335
|
-
type: "date",
|
|
336
|
-
id: String(name),
|
|
337
|
-
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
338
|
-
value: field.value ? new Date(field.value).toISOString().split("T")[0] : "",
|
|
339
|
-
onChange: (e) => field.onChange(e.target.value ? new Date(e.target.value) : null)
|
|
340
|
-
}
|
|
341
|
-
) });
|
|
342
|
-
});
|
|
343
|
-
var date_field_default = DateField;
|
|
344
|
-
var Input3 = ({ className = "", ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
-
"input",
|
|
346
|
-
{
|
|
347
|
-
className: `flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ${className}`,
|
|
348
|
-
...props
|
|
349
|
-
}
|
|
350
|
-
);
|
|
351
|
-
var InputGroup = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex items-center", children });
|
|
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
|
|
633
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
|
|
634
|
+
}
|
|
635
|
+
function PopoverTrigger({
|
|
636
|
+
...props
|
|
359
637
|
}) {
|
|
360
|
-
|
|
361
|
-
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => {
|
|
362
|
-
const files = field.value;
|
|
363
|
-
const filename = files && files.length ? files[0].name : "";
|
|
364
|
-
if (!isEditing) {
|
|
365
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
366
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
367
|
-
Input3,
|
|
368
|
-
{
|
|
369
|
-
id: `${String(name)}_display`,
|
|
370
|
-
type: "text",
|
|
371
|
-
value: filename,
|
|
372
|
-
placeholder: accept ? `Accepts ${accept}` : "No file selected",
|
|
373
|
-
disabled: true,
|
|
374
|
-
className: "bg-background/50 opacity-80 pl-10"
|
|
375
|
-
}
|
|
376
|
-
),
|
|
377
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "text-muted-foreground h-4 w-4" }) })
|
|
378
|
-
] });
|
|
379
|
-
}
|
|
380
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
381
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
382
|
-
InputGroupInput,
|
|
383
|
-
{
|
|
384
|
-
id: String(name),
|
|
385
|
-
type: "file",
|
|
386
|
-
accept,
|
|
387
|
-
multiple,
|
|
388
|
-
onChange: (e) => field.onChange(e.target.files),
|
|
389
|
-
onBlur: field.onBlur,
|
|
390
|
-
name: field.name,
|
|
391
|
-
ref: field.ref
|
|
392
|
-
}
|
|
393
|
-
),
|
|
394
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "text-muted-foreground h-4 w-4" }) })
|
|
395
|
-
] });
|
|
396
|
-
} });
|
|
397
|
-
});
|
|
398
|
-
var file_field_default = FileField;
|
|
399
|
-
function cn(...inputs) {
|
|
400
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
638
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
401
639
|
}
|
|
402
|
-
|
|
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
|
-
var ProfilePictureField = React2.memo(function ProfilePictureField2({
|
|
409
|
-
name,
|
|
410
|
-
label,
|
|
640
|
+
function PopoverContent({
|
|
411
641
|
className,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const { isEditing } = useFormCtx();
|
|
416
|
-
const [preview, setPreview] = React2.useState(null);
|
|
417
|
-
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => {
|
|
418
|
-
const currentValue = field.value;
|
|
419
|
-
const displayUrl = preview || (typeof currentValue === "string" ? currentValue : null);
|
|
420
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col items-center gap-4", className), children: [
|
|
421
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: cn("h-24 w-24", avatarClassName), children: [
|
|
422
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: displayUrl || "", alt: "Profile picture" }),
|
|
423
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: fallback })
|
|
424
|
-
] }),
|
|
425
|
-
isEditing && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
426
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
427
|
-
Label,
|
|
428
|
-
{
|
|
429
|
-
htmlFor: String(name),
|
|
430
|
-
className: "cursor-pointer inline-flex items-center gap-2 rounded-md border border-input bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground",
|
|
431
|
-
children: [
|
|
432
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "h-4 w-4" }),
|
|
433
|
-
"Upload Picture"
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
),
|
|
437
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
438
|
-
Input4,
|
|
439
|
-
{
|
|
440
|
-
id: String(name),
|
|
441
|
-
type: "file",
|
|
442
|
-
accept: "image/*",
|
|
443
|
-
className: "hidden",
|
|
444
|
-
onChange: (e) => {
|
|
445
|
-
const file = e.target.files?.[0];
|
|
446
|
-
if (file) {
|
|
447
|
-
field.onChange(file);
|
|
448
|
-
const reader = new FileReader();
|
|
449
|
-
reader.onloadend = () => {
|
|
450
|
-
setPreview(reader.result);
|
|
451
|
-
};
|
|
452
|
-
reader.readAsDataURL(file);
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
onBlur: field.onBlur,
|
|
456
|
-
name: field.name,
|
|
457
|
-
ref: field.ref
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
displayUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
461
|
-
Button2,
|
|
462
|
-
{
|
|
463
|
-
type: "button",
|
|
464
|
-
onClick: () => {
|
|
465
|
-
field.onChange(null);
|
|
466
|
-
setPreview(null);
|
|
467
|
-
},
|
|
468
|
-
children: "Remove"
|
|
469
|
-
}
|
|
470
|
-
)
|
|
471
|
-
] })
|
|
472
|
-
] });
|
|
473
|
-
} });
|
|
474
|
-
});
|
|
475
|
-
var profile_picture_field_default = ProfilePictureField;
|
|
476
|
-
var Button3 = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
|
-
"button",
|
|
478
|
-
{
|
|
479
|
-
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",
|
|
480
|
-
...props,
|
|
481
|
-
children
|
|
482
|
-
}
|
|
483
|
-
);
|
|
484
|
-
function Submit({ children, ...props }) {
|
|
485
|
-
const form = useFormCtx();
|
|
486
|
-
const isPending = form.isPending || form.formState.isSubmitting;
|
|
487
|
-
const { isEditing } = form;
|
|
488
|
-
if (!isEditing) return null;
|
|
489
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Button3, { type: "submit", disabled: isPending || props.disabled, ...props, children: isPending ? "Submitting..." : children });
|
|
490
|
-
}
|
|
491
|
-
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
|
-
function EditButton({ children, formId, ...props }) {
|
|
501
|
-
const ctx = React2.useContext(FormContext);
|
|
502
|
-
if (ctx) {
|
|
503
|
-
const { isEditing, setIsEditing } = ctx;
|
|
504
|
-
if (isEditing) return null;
|
|
505
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Button4, { type: "button", onClick: () => setIsEditing?.(true), ...props, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
506
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4 mr-2" }),
|
|
507
|
-
"Edit Profile"
|
|
508
|
-
] }) });
|
|
509
|
-
}
|
|
510
|
-
const handleClick = () => {
|
|
511
|
-
const key = formId ?? DEFAULT_FORM_KEY;
|
|
512
|
-
const immediate = formRegistry.get(key);
|
|
513
|
-
if (immediate) return immediate(true);
|
|
514
|
-
let attempts = 0;
|
|
515
|
-
const maxAttempts = 20;
|
|
516
|
-
const interval = setInterval(() => {
|
|
517
|
-
attempts += 1;
|
|
518
|
-
const setter = formRegistry.get(key);
|
|
519
|
-
if (setter) {
|
|
520
|
-
setter(true);
|
|
521
|
-
clearInterval(interval);
|
|
522
|
-
} else if (attempts >= maxAttempts) {
|
|
523
|
-
clearInterval(interval);
|
|
524
|
-
}
|
|
525
|
-
}, 100);
|
|
526
|
-
};
|
|
527
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Button4, { type: "button", onClick: handleClick, ...props, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
528
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4 mr-2" }),
|
|
529
|
-
"Edit Profile"
|
|
530
|
-
] }) });
|
|
531
|
-
}
|
|
532
|
-
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
|
-
function CancelButton({ children, ...props }) {
|
|
542
|
-
const { isEditing, setIsEditing, reset } = useFormCtx();
|
|
543
|
-
if (!isEditing) return null;
|
|
544
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
545
|
-
Button5,
|
|
546
|
-
{
|
|
547
|
-
type: "button",
|
|
548
|
-
onClick: () => {
|
|
549
|
-
reset();
|
|
550
|
-
setIsEditing?.(false);
|
|
551
|
-
},
|
|
552
|
-
...props,
|
|
553
|
-
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
554
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4 mr-2" }),
|
|
555
|
-
"Cancel"
|
|
556
|
-
] })
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
var cancel_button_default = CancelButton;
|
|
561
|
-
function LinkField({ label, link, LinkComponent }) {
|
|
562
|
-
const LinkTag = LinkComponent || "a";
|
|
563
|
-
const linkProps = LinkComponent ? { href: link } : { href: link };
|
|
564
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LinkTag, { ...linkProps, className: "text-sm text-primary hover:underline", children: label });
|
|
565
|
-
}
|
|
566
|
-
var link_field_default = LinkField;
|
|
567
|
-
var FieldGroup = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children });
|
|
568
|
-
var field_group_default = FieldGroup;
|
|
569
|
-
|
|
570
|
-
// src/components/form/index.ts
|
|
571
|
-
var Form = Object.assign(root_default, {
|
|
572
|
-
Field: field_default,
|
|
573
|
-
InputField: input_field_default,
|
|
574
|
-
PasswordField: password_field_default,
|
|
575
|
-
TextareaField: textarea_field_default,
|
|
576
|
-
SelectField: select_field_default,
|
|
577
|
-
CheckboxField: checkbox_field_default,
|
|
578
|
-
DateField: date_field_default,
|
|
579
|
-
FileField: file_field_default,
|
|
580
|
-
ProfilePictureField: profile_picture_field_default,
|
|
581
|
-
Submit: submit_default,
|
|
582
|
-
EditButton: edit_button_default,
|
|
583
|
-
CancelButton: cancel_button_default,
|
|
584
|
-
Group: field_group_default,
|
|
585
|
-
LinkField: link_field_default
|
|
586
|
-
});
|
|
587
|
-
var form_default = Form;
|
|
588
|
-
var DataTableContext = React2.createContext(null);
|
|
589
|
-
function useDataTable() {
|
|
590
|
-
const context = React2.useContext(DataTableContext);
|
|
591
|
-
if (!context) {
|
|
592
|
-
throw new Error("DataTable components must be used within DataTable.Root");
|
|
593
|
-
}
|
|
594
|
-
return context;
|
|
595
|
-
}
|
|
596
|
-
function Root2({
|
|
597
|
-
columns,
|
|
598
|
-
data,
|
|
599
|
-
filters = [],
|
|
600
|
-
defaultViewMode = "table",
|
|
601
|
-
defaultPageSize = 10,
|
|
602
|
-
children
|
|
642
|
+
align = "center",
|
|
643
|
+
sideOffset = 4,
|
|
644
|
+
...props
|
|
603
645
|
}) {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
const [columnFilters, setColumnFilters] = React2.useState([]);
|
|
607
|
-
const [columnVisibility, setColumnVisibility] = React2.useState({});
|
|
608
|
-
const [globalFilter, setGlobalFilter] = React2.useState("");
|
|
609
|
-
const [pagination, setPagination] = React2.useState({ pageIndex: 0, pageSize: defaultPageSize });
|
|
610
|
-
const [activeFilters, setActiveFilters] = React2.useState({});
|
|
611
|
-
const filteredData = React2.useMemo(() => {
|
|
612
|
-
if (Object.keys(activeFilters).length === 0) return data;
|
|
613
|
-
return data.filter((row) => {
|
|
614
|
-
return Object.entries(activeFilters).every(([filterId, filterValue]) => {
|
|
615
|
-
if (!filterValue || Array.isArray(filterValue) && filterValue.length === 0) {
|
|
616
|
-
return true;
|
|
617
|
-
}
|
|
618
|
-
const rowValue = row[filterId];
|
|
619
|
-
if (Array.isArray(filterValue)) {
|
|
620
|
-
return filterValue.includes(String(rowValue));
|
|
621
|
-
}
|
|
622
|
-
return String(rowValue) === String(filterValue);
|
|
623
|
-
});
|
|
624
|
-
});
|
|
625
|
-
}, [data, activeFilters]);
|
|
626
|
-
const table = reactTable.useReactTable({
|
|
627
|
-
data: filteredData,
|
|
628
|
-
columns,
|
|
629
|
-
state: {
|
|
630
|
-
sorting,
|
|
631
|
-
columnFilters,
|
|
632
|
-
columnVisibility,
|
|
633
|
-
globalFilter,
|
|
634
|
-
pagination
|
|
635
|
-
},
|
|
636
|
-
onSortingChange: setSorting,
|
|
637
|
-
onColumnFiltersChange: setColumnFilters,
|
|
638
|
-
onColumnVisibilityChange: setColumnVisibility,
|
|
639
|
-
onGlobalFilterChange: setGlobalFilter,
|
|
640
|
-
onPaginationChange: setPagination,
|
|
641
|
-
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
642
|
-
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
643
|
-
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
644
|
-
getPaginationRowModel: reactTable.getPaginationRowModel()
|
|
645
|
-
});
|
|
646
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
647
|
-
DataTableContext.Provider,
|
|
648
|
-
{
|
|
649
|
-
value: {
|
|
650
|
-
table,
|
|
651
|
-
viewMode,
|
|
652
|
-
setViewMode,
|
|
653
|
-
filters,
|
|
654
|
-
activeFilters,
|
|
655
|
-
setActiveFilters
|
|
656
|
-
},
|
|
657
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children })
|
|
658
|
-
}
|
|
659
|
-
);
|
|
660
|
-
}
|
|
661
|
-
var root_default2 = Root2;
|
|
662
|
-
function Input5({ className, type, ...props }) {
|
|
663
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
664
|
-
"input",
|
|
646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
647
|
+
PopoverPrimitive__namespace.Content,
|
|
665
648
|
{
|
|
666
|
-
|
|
667
|
-
|
|
649
|
+
"data-slot": "popover-content",
|
|
650
|
+
align,
|
|
651
|
+
sideOffset,
|
|
668
652
|
className: cn(
|
|
669
|
-
"
|
|
670
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
671
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
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",
|
|
672
654
|
className
|
|
673
655
|
),
|
|
674
656
|
...props
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
|
-
function
|
|
679
|
-
if (typeof ref === "function") {
|
|
680
|
-
return ref(value);
|
|
681
|
-
} else if (ref !== null && ref !== void 0) {
|
|
682
|
-
ref.current = value;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
function composeRefs(...refs) {
|
|
686
|
-
return (node) => {
|
|
687
|
-
let hasCleanup = false;
|
|
688
|
-
const cleanups = refs.map((ref) => {
|
|
689
|
-
const cleanup = setRef(ref, node);
|
|
690
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
691
|
-
hasCleanup = true;
|
|
692
|
-
}
|
|
693
|
-
return cleanup;
|
|
694
|
-
});
|
|
695
|
-
if (hasCleanup) {
|
|
696
|
-
return () => {
|
|
697
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
698
|
-
const cleanup = cleanups[i];
|
|
699
|
-
if (typeof cleanup == "function") {
|
|
700
|
-
cleanup();
|
|
701
|
-
} else {
|
|
702
|
-
setRef(refs[i], null);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
// @__NO_SIDE_EFFECTS__
|
|
710
|
-
function createSlot(ownerName) {
|
|
711
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
712
|
-
const Slot2 = React2__namespace.forwardRef((props, forwardedRef) => {
|
|
713
|
-
const { children, ...slotProps } = props;
|
|
714
|
-
const childrenArray = React2__namespace.Children.toArray(children);
|
|
715
|
-
const slottable = childrenArray.find(isSlottable);
|
|
716
|
-
if (slottable) {
|
|
717
|
-
const newElement = slottable.props.children;
|
|
718
|
-
const newChildren = childrenArray.map((child) => {
|
|
719
|
-
if (child === slottable) {
|
|
720
|
-
if (React2__namespace.Children.count(newElement) > 1) return React2__namespace.Children.only(null);
|
|
721
|
-
return React2__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
722
|
-
} else {
|
|
723
|
-
return child;
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React2__namespace.isValidElement(newElement) ? React2__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
727
|
-
}
|
|
728
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
729
|
-
});
|
|
730
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
731
|
-
return Slot2;
|
|
732
|
-
}
|
|
733
|
-
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
734
|
-
// @__NO_SIDE_EFFECTS__
|
|
735
|
-
function createSlotClone(ownerName) {
|
|
736
|
-
const SlotClone = React2__namespace.forwardRef((props, forwardedRef) => {
|
|
737
|
-
const { children, ...slotProps } = props;
|
|
738
|
-
if (React2__namespace.isValidElement(children)) {
|
|
739
|
-
const childrenRef = getElementRef(children);
|
|
740
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
741
|
-
if (children.type !== React2__namespace.Fragment) {
|
|
742
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
743
|
-
}
|
|
744
|
-
return React2__namespace.cloneElement(children, props2);
|
|
745
|
-
}
|
|
746
|
-
return React2__namespace.Children.count(children) > 1 ? React2__namespace.Children.only(null) : null;
|
|
747
|
-
});
|
|
748
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
749
|
-
return SlotClone;
|
|
750
|
-
}
|
|
751
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
752
|
-
function isSlottable(child) {
|
|
753
|
-
return React2__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
754
|
-
}
|
|
755
|
-
function mergeProps(slotProps, childProps) {
|
|
756
|
-
const overrideProps = { ...childProps };
|
|
757
|
-
for (const propName in childProps) {
|
|
758
|
-
const slotPropValue = slotProps[propName];
|
|
759
|
-
const childPropValue = childProps[propName];
|
|
760
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
761
|
-
if (isHandler) {
|
|
762
|
-
if (slotPropValue && childPropValue) {
|
|
763
|
-
overrideProps[propName] = (...args) => {
|
|
764
|
-
const result = childPropValue(...args);
|
|
765
|
-
slotPropValue(...args);
|
|
766
|
-
return result;
|
|
767
|
-
};
|
|
768
|
-
} else if (slotPropValue) {
|
|
769
|
-
overrideProps[propName] = slotPropValue;
|
|
770
|
-
}
|
|
771
|
-
} else if (propName === "style") {
|
|
772
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
773
|
-
} else if (propName === "className") {
|
|
774
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
return { ...slotProps, ...overrideProps };
|
|
778
|
-
}
|
|
779
|
-
function getElementRef(element) {
|
|
780
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
781
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
782
|
-
if (mayWarn) {
|
|
783
|
-
return element.ref;
|
|
784
|
-
}
|
|
785
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
786
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
787
|
-
if (mayWarn) {
|
|
788
|
-
return element.props.ref;
|
|
789
|
-
}
|
|
790
|
-
return element.props.ref || element.ref;
|
|
791
|
-
}
|
|
792
|
-
var buttonVariants = classVarianceAuthority.cva(
|
|
793
|
-
"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",
|
|
794
|
-
{
|
|
795
|
-
variants: {
|
|
796
|
-
variant: {
|
|
797
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
798
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
799
|
-
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",
|
|
800
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
801
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
802
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
803
|
-
},
|
|
804
|
-
size: {
|
|
805
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
806
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
807
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
808
|
-
icon: "size-9",
|
|
809
|
-
"icon-sm": "size-8",
|
|
810
|
-
"icon-lg": "size-10"
|
|
811
|
-
}
|
|
812
|
-
},
|
|
813
|
-
defaultVariants: {
|
|
814
|
-
variant: "default",
|
|
815
|
-
size: "default"
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
);
|
|
819
|
-
function Button6({
|
|
657
|
+
}
|
|
658
|
+
) });
|
|
659
|
+
}
|
|
660
|
+
function Calendar({
|
|
820
661
|
className,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
662
|
+
classNames,
|
|
663
|
+
showOutsideDays = true,
|
|
664
|
+
captionLayout = "label",
|
|
665
|
+
buttonVariant = "ghost",
|
|
666
|
+
formatters,
|
|
667
|
+
components,
|
|
824
668
|
...props
|
|
825
669
|
}) {
|
|
826
|
-
const
|
|
670
|
+
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
827
671
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
828
|
-
|
|
672
|
+
reactDayPicker.DayPicker,
|
|
829
673
|
{
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
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
|
|
691
|
+
),
|
|
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
|
+
},
|
|
834
802
|
...props
|
|
835
803
|
}
|
|
836
804
|
);
|
|
837
805
|
}
|
|
838
|
-
function
|
|
839
|
-
...props
|
|
840
|
-
}) {
|
|
841
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
|
|
842
|
-
}
|
|
843
|
-
function SelectValue2({
|
|
844
|
-
...props
|
|
845
|
-
}) {
|
|
846
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { "data-slot": "select-value", ...props });
|
|
847
|
-
}
|
|
848
|
-
function SelectTrigger({
|
|
806
|
+
function CalendarDayButton({
|
|
849
807
|
className,
|
|
850
|
-
|
|
851
|
-
|
|
808
|
+
day,
|
|
809
|
+
modifiers,
|
|
852
810
|
...props
|
|
853
811
|
}) {
|
|
854
|
-
|
|
855
|
-
|
|
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,
|
|
856
819
|
{
|
|
857
|
-
|
|
858
|
-
"
|
|
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,
|
|
859
828
|
className: cn(
|
|
860
|
-
"
|
|
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,
|
|
861
831
|
className
|
|
862
832
|
),
|
|
863
|
-
...props
|
|
864
|
-
children: [
|
|
865
|
-
children,
|
|
866
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
867
|
-
]
|
|
833
|
+
...props
|
|
868
834
|
}
|
|
869
835
|
);
|
|
870
836
|
}
|
|
871
|
-
function
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
align = "center",
|
|
876
|
-
...props
|
|
837
|
+
var DateField = React2.memo(function DateField2({
|
|
838
|
+
name,
|
|
839
|
+
label,
|
|
840
|
+
placeholder = "Pick a date"
|
|
877
841
|
}) {
|
|
878
|
-
|
|
879
|
-
|
|
842
|
+
const { isEditing } = useFormCtx();
|
|
843
|
+
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => !isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
844
|
+
Button,
|
|
880
845
|
{
|
|
881
|
-
|
|
846
|
+
type: "button",
|
|
847
|
+
variant: "outline",
|
|
882
848
|
className: cn(
|
|
883
|
-
"
|
|
884
|
-
|
|
885
|
-
className
|
|
849
|
+
"w-full justify-start text-left font-normal bg-background/50",
|
|
850
|
+
!field.value && "text-muted-foreground"
|
|
886
851
|
),
|
|
887
|
-
|
|
888
|
-
align,
|
|
889
|
-
...props,
|
|
852
|
+
disabled: true,
|
|
890
853
|
children: [
|
|
891
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
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" }),
|
|
892
898
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
893
|
-
|
|
899
|
+
Input,
|
|
894
900
|
{
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
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"
|
|
900
908
|
}
|
|
901
|
-
)
|
|
902
|
-
|
|
903
|
-
]
|
|
909
|
+
)
|
|
910
|
+
] });
|
|
904
911
|
}
|
|
905
|
-
|
|
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" }),
|
|
914
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
915
|
+
Input,
|
|
916
|
+
{
|
|
917
|
+
id: String(name),
|
|
918
|
+
type: "file",
|
|
919
|
+
accept,
|
|
920
|
+
multiple,
|
|
921
|
+
onChange: (e) => field.onChange(e.target.files),
|
|
922
|
+
onBlur: field.onBlur,
|
|
923
|
+
name: field.name,
|
|
924
|
+
ref: field.ref,
|
|
925
|
+
className: "pl-10"
|
|
926
|
+
}
|
|
927
|
+
)
|
|
928
|
+
] });
|
|
929
|
+
} });
|
|
930
|
+
});
|
|
931
|
+
var file_field_default = FileField;
|
|
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
|
+
);
|
|
906
947
|
}
|
|
907
|
-
function
|
|
948
|
+
function AvatarImage({
|
|
908
949
|
className,
|
|
909
|
-
children,
|
|
910
950
|
...props
|
|
911
951
|
}) {
|
|
912
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
913
|
-
|
|
952
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
953
|
+
AvatarPrimitive__namespace.Image,
|
|
914
954
|
{
|
|
915
|
-
"data-slot": "
|
|
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",
|
|
916
969
|
className: cn(
|
|
917
|
-
"
|
|
970
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
918
971
|
className
|
|
919
972
|
),
|
|
920
|
-
...props
|
|
921
|
-
|
|
973
|
+
...props
|
|
974
|
+
}
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
var ProfilePictureField = React2.memo(function ProfilePictureField2({
|
|
978
|
+
name,
|
|
979
|
+
label,
|
|
980
|
+
className,
|
|
981
|
+
avatarClassName,
|
|
982
|
+
fallback = "User"
|
|
983
|
+
}) {
|
|
984
|
+
const { isEditing } = useFormCtx();
|
|
985
|
+
const [preview, setPreview] = React2.useState(null);
|
|
986
|
+
return /* @__PURE__ */ jsxRuntime.jsx(field_default, { name, label, children: (field) => {
|
|
987
|
+
const currentValue = field.value;
|
|
988
|
+
const displayUrl = preview || (typeof currentValue === "string" ? currentValue : null);
|
|
989
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col items-center gap-4", className), children: [
|
|
990
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: cn("h-24 w-24", avatarClassName), children: [
|
|
991
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: displayUrl || "", alt: "Profile picture" }),
|
|
992
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: fallback })
|
|
993
|
+
] }),
|
|
994
|
+
isEditing && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
996
|
+
Label,
|
|
997
|
+
{
|
|
998
|
+
htmlFor: String(name),
|
|
999
|
+
className: "cursor-pointer inline-flex items-center gap-2 rounded-md border border-input bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground",
|
|
1000
|
+
children: [
|
|
1001
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "h-4 w-4" }),
|
|
1002
|
+
"Upload Picture"
|
|
1003
|
+
]
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
922
1006
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
923
|
-
|
|
1007
|
+
Input,
|
|
924
1008
|
{
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1009
|
+
id: String(name),
|
|
1010
|
+
type: "file",
|
|
1011
|
+
accept: "image/*",
|
|
1012
|
+
className: "hidden",
|
|
1013
|
+
onChange: (e) => {
|
|
1014
|
+
const file = e.target.files?.[0];
|
|
1015
|
+
if (file) {
|
|
1016
|
+
field.onChange(file);
|
|
1017
|
+
const reader = new FileReader();
|
|
1018
|
+
reader.onloadend = () => {
|
|
1019
|
+
setPreview(reader.result);
|
|
1020
|
+
};
|
|
1021
|
+
reader.readAsDataURL(file);
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
onBlur: field.onBlur,
|
|
1025
|
+
name: field.name,
|
|
1026
|
+
ref: field.ref
|
|
928
1027
|
}
|
|
929
1028
|
),
|
|
930
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1029
|
+
displayUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1030
|
+
Button,
|
|
1031
|
+
{
|
|
1032
|
+
variant: "ghost",
|
|
1033
|
+
size: "sm",
|
|
1034
|
+
type: "button",
|
|
1035
|
+
onClick: () => {
|
|
1036
|
+
field.onChange(null);
|
|
1037
|
+
setPreview(null);
|
|
1038
|
+
},
|
|
1039
|
+
children: "Remove"
|
|
1040
|
+
}
|
|
1041
|
+
)
|
|
1042
|
+
] })
|
|
1043
|
+
] });
|
|
1044
|
+
} });
|
|
1045
|
+
});
|
|
1046
|
+
var profile_picture_field_default = ProfilePictureField;
|
|
1047
|
+
var Button2 = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1048
|
+
"button",
|
|
1049
|
+
{
|
|
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",
|
|
1051
|
+
...props,
|
|
1052
|
+
children
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
function Submit({ children, ...props }) {
|
|
1056
|
+
const form = useFormCtx();
|
|
1057
|
+
const isPending = form.isPending || form.formState.isSubmitting;
|
|
1058
|
+
const { isEditing } = form;
|
|
1059
|
+
if (!isEditing) return null;
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", disabled: isPending || props.disabled, ...props, children: isPending ? "Submitting..." : children });
|
|
934
1061
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1062
|
+
var submit_default = Submit;
|
|
1063
|
+
function EditButton({ children, formId, ...props }) {
|
|
1064
|
+
const ctx = React2.useContext(FormContext);
|
|
1065
|
+
if (ctx) {
|
|
1066
|
+
const { isEditing, setIsEditing } = ctx;
|
|
1067
|
+
if (isEditing) return null;
|
|
1068
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: () => setIsEditing?.(true), ...props, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1069
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4 mr-2" }),
|
|
1070
|
+
"Edit Profile"
|
|
1071
|
+
] }) });
|
|
1072
|
+
}
|
|
1073
|
+
const handleClick = () => {
|
|
1074
|
+
const key = formId ?? DEFAULT_FORM_KEY;
|
|
1075
|
+
const immediate = formRegistry.get(key);
|
|
1076
|
+
if (immediate) return immediate(true);
|
|
1077
|
+
let attempts = 0;
|
|
1078
|
+
const maxAttempts = 20;
|
|
1079
|
+
const interval = setInterval(() => {
|
|
1080
|
+
attempts += 1;
|
|
1081
|
+
const setter = formRegistry.get(key);
|
|
1082
|
+
if (setter) {
|
|
1083
|
+
setter(true);
|
|
1084
|
+
clearInterval(interval);
|
|
1085
|
+
} else if (attempts >= maxAttempts) {
|
|
1086
|
+
clearInterval(interval);
|
|
1087
|
+
}
|
|
1088
|
+
}, 100);
|
|
1089
|
+
};
|
|
1090
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: handleClick, ...props, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1091
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4 mr-2" }),
|
|
1092
|
+
"Edit Profile"
|
|
1093
|
+
] }) });
|
|
1094
|
+
}
|
|
1095
|
+
var edit_button_default = EditButton;
|
|
1096
|
+
function CancelButton({ children, ...props }) {
|
|
1097
|
+
const { isEditing, setIsEditing, reset } = useFormCtx();
|
|
1098
|
+
if (!isEditing) return null;
|
|
939
1099
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
940
|
-
|
|
1100
|
+
Button,
|
|
941
1101
|
{
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1102
|
+
type: "button",
|
|
1103
|
+
variant: "outline",
|
|
1104
|
+
onClick: () => {
|
|
1105
|
+
reset();
|
|
1106
|
+
setIsEditing?.(false);
|
|
1107
|
+
},
|
|
947
1108
|
...props,
|
|
948
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
1109
|
+
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1110
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4 mr-2" }),
|
|
1111
|
+
"Cancel"
|
|
1112
|
+
] })
|
|
949
1113
|
}
|
|
950
1114
|
);
|
|
951
1115
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1116
|
+
var cancel_button_default = CancelButton;
|
|
1117
|
+
function LinkField({ label, link, LinkComponent, className }) {
|
|
1118
|
+
const LinkTag = LinkComponent || "a";
|
|
1119
|
+
const linkProps = { href: link };
|
|
956
1120
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
957
|
-
|
|
1121
|
+
LinkTag,
|
|
958
1122
|
{
|
|
959
|
-
|
|
960
|
-
className: cn(
|
|
961
|
-
|
|
962
|
-
className
|
|
963
|
-
),
|
|
964
|
-
...props,
|
|
965
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4" })
|
|
1123
|
+
...linkProps,
|
|
1124
|
+
className: cn("text-sm text-primary hover:underline", className),
|
|
1125
|
+
children: label
|
|
966
1126
|
}
|
|
967
1127
|
);
|
|
968
1128
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
...props
|
|
976
|
-
}) {
|
|
977
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
1129
|
+
var link_field_default = LinkField;
|
|
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
|
+
] });
|
|
978
1135
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1136
|
+
var field_group_default = FieldGroup;
|
|
1137
|
+
|
|
1138
|
+
// src/components/form/index.ts
|
|
1139
|
+
var Form = Object.assign(root_default, {
|
|
1140
|
+
Root: root_default,
|
|
1141
|
+
Field: field_default,
|
|
1142
|
+
InputField: input_field_default,
|
|
1143
|
+
PasswordField: password_field_default,
|
|
1144
|
+
TextareaField: textarea_field_default,
|
|
1145
|
+
SelectField: select_field_default,
|
|
1146
|
+
CheckboxField: checkbox_field_default,
|
|
1147
|
+
DateField: date_field_default,
|
|
1148
|
+
FileField: file_field_default,
|
|
1149
|
+
ProfilePictureField: profile_picture_field_default,
|
|
1150
|
+
Submit: submit_default,
|
|
1151
|
+
EditButton: edit_button_default,
|
|
1152
|
+
CancelButton: cancel_button_default,
|
|
1153
|
+
Group: field_group_default,
|
|
1154
|
+
LinkField: link_field_default
|
|
1155
|
+
});
|
|
1156
|
+
var form_default = Form;
|
|
1157
|
+
var DataTableContext = React2.createContext(null);
|
|
1158
|
+
function useDataTable() {
|
|
1159
|
+
const context = React2.useContext(DataTableContext);
|
|
1160
|
+
if (!context) {
|
|
1161
|
+
throw new Error("DataTable components must be used within DataTable.Root");
|
|
1162
|
+
}
|
|
1163
|
+
return context;
|
|
998
1164
|
}
|
|
999
|
-
function
|
|
1000
|
-
|
|
1001
|
-
|
|
1165
|
+
function Root7({
|
|
1166
|
+
columns,
|
|
1167
|
+
data,
|
|
1168
|
+
filters = [],
|
|
1169
|
+
defaultViewMode = "table",
|
|
1170
|
+
viewMode: controlledViewMode,
|
|
1171
|
+
onViewModeChange: controlledOnViewModeChange,
|
|
1172
|
+
defaultPageSize = 10,
|
|
1173
|
+
children
|
|
1002
1174
|
}) {
|
|
1175
|
+
const [internalViewMode, setInternalViewMode] = React2.useState(defaultViewMode);
|
|
1176
|
+
const [sorting, setSorting] = React2.useState([]);
|
|
1177
|
+
const [columnFilters, setColumnFilters] = React2.useState([]);
|
|
1178
|
+
const [columnVisibility, setColumnVisibility] = React2.useState({});
|
|
1179
|
+
const [globalFilter, setGlobalFilter] = React2.useState("");
|
|
1180
|
+
const [pagination, setPagination] = React2.useState({ pageIndex: 0, pageSize: defaultPageSize });
|
|
1181
|
+
const [activeFilters, setActiveFilters] = React2.useState({});
|
|
1182
|
+
const isControlled = controlledViewMode !== void 0 && controlledOnViewModeChange !== void 0;
|
|
1183
|
+
const viewMode = isControlled ? controlledViewMode : internalViewMode;
|
|
1184
|
+
const setViewMode = isControlled ? controlledOnViewModeChange : setInternalViewMode;
|
|
1185
|
+
const filteredData = React2.useMemo(() => {
|
|
1186
|
+
if (Object.keys(activeFilters).length === 0) return data;
|
|
1187
|
+
return data.filter((row) => {
|
|
1188
|
+
return Object.entries(activeFilters).every(([filterId, filterValue]) => {
|
|
1189
|
+
if (!filterValue || Array.isArray(filterValue) && filterValue.length === 0) {
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
const rowValue = row[filterId];
|
|
1193
|
+
if (Array.isArray(filterValue)) {
|
|
1194
|
+
return filterValue.includes(String(rowValue));
|
|
1195
|
+
}
|
|
1196
|
+
return String(rowValue) === String(filterValue);
|
|
1197
|
+
});
|
|
1198
|
+
});
|
|
1199
|
+
}, [data, activeFilters]);
|
|
1200
|
+
const table = reactTable.useReactTable({
|
|
1201
|
+
data: filteredData,
|
|
1202
|
+
columns,
|
|
1203
|
+
state: {
|
|
1204
|
+
sorting,
|
|
1205
|
+
columnFilters,
|
|
1206
|
+
columnVisibility,
|
|
1207
|
+
globalFilter,
|
|
1208
|
+
pagination
|
|
1209
|
+
},
|
|
1210
|
+
onSortingChange: setSorting,
|
|
1211
|
+
onColumnFiltersChange: setColumnFilters,
|
|
1212
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
1213
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
1214
|
+
onPaginationChange: setPagination,
|
|
1215
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
1216
|
+
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
1217
|
+
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
1218
|
+
getPaginationRowModel: reactTable.getPaginationRowModel()
|
|
1219
|
+
});
|
|
1003
1220
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
-
|
|
1221
|
+
DataTableContext.Provider,
|
|
1005
1222
|
{
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
"data-slot": "checkbox-indicator",
|
|
1016
|
-
className: "grid place-content-center text-current transition-none",
|
|
1017
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-3.5" })
|
|
1018
|
-
}
|
|
1019
|
-
)
|
|
1223
|
+
value: {
|
|
1224
|
+
table,
|
|
1225
|
+
viewMode,
|
|
1226
|
+
setViewMode,
|
|
1227
|
+
filters,
|
|
1228
|
+
activeFilters,
|
|
1229
|
+
setActiveFilters
|
|
1230
|
+
},
|
|
1231
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children })
|
|
1020
1232
|
}
|
|
1021
1233
|
);
|
|
1022
1234
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1235
|
+
var root_default2 = Root7;
|
|
1236
|
+
function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeChange }) {
|
|
1237
|
+
let contextStr;
|
|
1238
|
+
try {
|
|
1239
|
+
contextStr = useDataTable();
|
|
1240
|
+
} catch (e) {
|
|
1241
|
+
}
|
|
1242
|
+
const mode = propViewMode ?? contextStr?.viewMode ?? "table";
|
|
1243
|
+
const setMode = propOnViewModeChange ?? contextStr?.setViewMode ?? (() => {
|
|
1244
|
+
});
|
|
1245
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border rounded-md bg-background", children: [
|
|
1246
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1247
|
+
Button,
|
|
1248
|
+
{
|
|
1249
|
+
variant: mode === "table" ? "secondary" : "ghost",
|
|
1250
|
+
size: "sm",
|
|
1251
|
+
onClick: () => setMode("table"),
|
|
1252
|
+
className: "rounded-r-none h-8 px-2 lg:px-3",
|
|
1253
|
+
"aria-label": "Switch to table view",
|
|
1254
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { className: "h-4 w-4" })
|
|
1255
|
+
}
|
|
1256
|
+
),
|
|
1257
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1258
|
+
Button,
|
|
1259
|
+
{
|
|
1260
|
+
variant: mode === "grid" ? "secondary" : "ghost",
|
|
1261
|
+
size: "sm",
|
|
1262
|
+
onClick: () => setMode("grid"),
|
|
1263
|
+
className: "rounded-l-none h-8 px-2 lg:px-3",
|
|
1264
|
+
"aria-label": "Switch to grid view",
|
|
1265
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutGrid, { className: "h-4 w-4" })
|
|
1266
|
+
}
|
|
1267
|
+
)
|
|
1268
|
+
] });
|
|
1269
|
+
}
|
|
1270
|
+
var view_options_default = ViewOptions;
|
|
1271
|
+
function Toolbar({ viewOptions } = {}) {
|
|
1272
|
+
const { table, filters, activeFilters, setActiveFilters } = useDataTable();
|
|
1025
1273
|
const handleFilterChange = (filterId, value) => {
|
|
1026
1274
|
setActiveFilters((prev) => ({
|
|
1027
1275
|
...prev,
|
|
@@ -1038,115 +1286,116 @@ function Toolbar() {
|
|
|
1038
1286
|
return { ...prev, [filterId]: newValues };
|
|
1039
1287
|
});
|
|
1040
1288
|
};
|
|
1041
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
1042
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
1043
|
-
|
|
1289
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 py-4", children: [
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1291
|
+
Input,
|
|
1044
1292
|
{
|
|
1045
1293
|
placeholder: "Search...",
|
|
1046
1294
|
value: table.getState().globalFilter ?? "",
|
|
1047
1295
|
onChange: (e) => table.setGlobalFilter(e.target.value),
|
|
1048
|
-
className: "w-full"
|
|
1296
|
+
className: "w-full max-w-sm"
|
|
1049
1297
|
}
|
|
1050
1298
|
) }),
|
|
1051
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center
|
|
1052
|
-
|
|
1053
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1054
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1299
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4", children: [
|
|
1300
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-wrap flex-1", children: [
|
|
1301
|
+
filters.map((filter) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: filter.multiSelect ? /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
1302
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", className: "h-8 border-dashed", children: [
|
|
1303
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SlidersHorizontal, { className: "h-4 w-4 mr-2" }),
|
|
1304
|
+
filter.label,
|
|
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 })
|
|
1306
|
+
] }) }),
|
|
1307
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[200px] p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1", children: [
|
|
1308
|
+
filter.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1309
|
+
"div",
|
|
1310
|
+
{
|
|
1311
|
+
className: "flex items-center space-x-2 rounded-sm px-2 py-1.5 hover:bg-accent cursor-pointer",
|
|
1312
|
+
onClick: () => handleMultiFilterToggle(filter.id, option.value),
|
|
1313
|
+
children: [
|
|
1314
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1315
|
+
Checkbox,
|
|
1316
|
+
{
|
|
1317
|
+
id: `${filter.id}-${option.value}`,
|
|
1318
|
+
checked: Array.isArray(activeFilters[filter.id]) && activeFilters[filter.id].includes(option.value)
|
|
1319
|
+
}
|
|
1320
|
+
),
|
|
1321
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1322
|
+
"label",
|
|
1323
|
+
{
|
|
1324
|
+
htmlFor: `${filter.id}-${option.value}`,
|
|
1325
|
+
className: "text-sm cursor-pointer flex-1",
|
|
1326
|
+
children: option.label
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1329
|
+
]
|
|
1330
|
+
},
|
|
1331
|
+
option.value
|
|
1332
|
+
)),
|
|
1333
|
+
activeFilters[filter.id] && (Array.isArray(activeFilters[filter.id]) ? activeFilters[filter.id].length > 0 : false) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1334
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-px bg-border my-1" }),
|
|
1070
1335
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1071
|
-
"
|
|
1336
|
+
"div",
|
|
1072
1337
|
{
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
children:
|
|
1338
|
+
className: "px-2 py-1.5 text-center text-sm cursor-pointer hover:bg-accent rounded-sm",
|
|
1339
|
+
onClick: () => setActiveFilters((prev) => ({ ...prev, [filter.id]: [] })),
|
|
1340
|
+
children: "Clear filters"
|
|
1076
1341
|
}
|
|
1077
1342
|
)
|
|
1078
|
-
] }
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
onValueChange: (value) => handleFilterChange(filter.id, value),
|
|
1083
|
-
children: [
|
|
1084
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue2, { placeholder: filter.placeholder || "Select..." }) }),
|
|
1085
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
|
|
1086
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectItem2, { value: "all", children: "All" }),
|
|
1087
|
-
filter.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem2, { value: option.value, children: option.label }, option.value))
|
|
1088
|
-
] })
|
|
1089
|
-
]
|
|
1090
|
-
}
|
|
1091
|
-
)
|
|
1092
|
-
] }, filter.id))
|
|
1093
|
-
] }) })
|
|
1094
|
-
] }),
|
|
1095
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
1096
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button6, { variant: "outline", size: "sm", children: [
|
|
1097
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4 mr-2" }),
|
|
1098
|
-
"Columns"
|
|
1099
|
-
] }) }),
|
|
1100
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-56", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1101
|
-
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-medium text-sm", children: "Toggle Columns" }),
|
|
1102
|
-
table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1103
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1104
|
-
Checkbox2,
|
|
1105
|
-
{
|
|
1106
|
-
id: column.id,
|
|
1107
|
-
checked: column.getIsVisible(),
|
|
1108
|
-
onCheckedChange: (value) => column.toggleVisibility(!!value)
|
|
1109
|
-
}
|
|
1110
|
-
),
|
|
1111
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: column.id, className: "text-sm cursor-pointer", children: column.id })
|
|
1112
|
-
] }, column.id))
|
|
1113
|
-
] }) })
|
|
1114
|
-
] }),
|
|
1115
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border rounded-md", children: [
|
|
1116
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1117
|
-
Button6,
|
|
1118
|
-
{
|
|
1119
|
-
variant: viewMode === "table" ? "default" : "ghost",
|
|
1120
|
-
size: "sm",
|
|
1121
|
-
onClick: () => setViewMode("table"),
|
|
1122
|
-
className: "rounded-r-none",
|
|
1123
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { className: "h-4 w-4" })
|
|
1124
|
-
}
|
|
1125
|
-
),
|
|
1126
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1127
|
-
Button6,
|
|
1128
|
-
{
|
|
1129
|
-
variant: viewMode === "grid" ? "default" : "ghost",
|
|
1130
|
-
size: "sm",
|
|
1131
|
-
onClick: () => setViewMode("grid"),
|
|
1132
|
-
className: "rounded-l-none",
|
|
1133
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutGrid, { className: "h-4 w-4" })
|
|
1134
|
-
}
|
|
1135
|
-
)
|
|
1136
|
-
] }),
|
|
1137
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1138
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm text-muted-foreground", children: "Rows" }),
|
|
1139
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1140
|
-
Select2,
|
|
1343
|
+
] })
|
|
1344
|
+
] }) })
|
|
1345
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1346
|
+
Select,
|
|
1141
1347
|
{
|
|
1142
|
-
value:
|
|
1143
|
-
onValueChange: (value) =>
|
|
1348
|
+
value: activeFilters[filter.id] || "all",
|
|
1349
|
+
onValueChange: (value) => handleFilterChange(filter.id, value),
|
|
1144
1350
|
children: [
|
|
1145
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-
|
|
1146
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1351
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[150px] border-dashed", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: filter.placeholder || filter.label }) }),
|
|
1352
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: "all", children: [
|
|
1354
|
+
"All ",
|
|
1355
|
+
filter.label
|
|
1356
|
+
] }),
|
|
1357
|
+
filter.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
1358
|
+
] })
|
|
1147
1359
|
]
|
|
1148
1360
|
}
|
|
1149
|
-
)
|
|
1361
|
+
) }, filter.id)),
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
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: [
|
|
1364
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4 mr-2" }),
|
|
1365
|
+
"Columns"
|
|
1366
|
+
] }) }),
|
|
1367
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-56", align: "end", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1368
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-medium text-sm", children: "Toggle Columns" }),
|
|
1369
|
+
table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1371
|
+
Checkbox,
|
|
1372
|
+
{
|
|
1373
|
+
id: column.id,
|
|
1374
|
+
checked: column.getIsVisible(),
|
|
1375
|
+
onCheckedChange: (value) => column.toggleVisibility(!!value)
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: column.id, className: "text-sm cursor-pointer", children: column.id })
|
|
1379
|
+
] }, column.id))
|
|
1380
|
+
] }) })
|
|
1381
|
+
] })
|
|
1382
|
+
] }),
|
|
1383
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1384
|
+
viewOptions ? viewOptions : /* @__PURE__ */ jsxRuntime.jsx(ViewOptions, {}),
|
|
1385
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1386
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm text-muted-foreground whitespace-nowrap hidden sm:inline-block", children: "Rows" }),
|
|
1387
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1388
|
+
Select,
|
|
1389
|
+
{
|
|
1390
|
+
value: String(table.getState().pagination.pageSize),
|
|
1391
|
+
onValueChange: (value) => table.setPageSize(Number(value)),
|
|
1392
|
+
children: [
|
|
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)) })
|
|
1395
|
+
]
|
|
1396
|
+
}
|
|
1397
|
+
)
|
|
1398
|
+
] })
|
|
1150
1399
|
] })
|
|
1151
1400
|
] })
|
|
1152
1401
|
] });
|
|
@@ -1272,6 +1521,7 @@ function GridView({ renderCard, columns = 3, gap = 16 }) {
|
|
|
1272
1521
|
);
|
|
1273
1522
|
}
|
|
1274
1523
|
function DefaultCard({ item }) {
|
|
1524
|
+
if (typeof item !== "object" || item === null) return null;
|
|
1275
1525
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: Object.entries(item).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1276
1526
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-medium", children: [
|
|
1277
1527
|
key,
|
|
@@ -1308,7 +1558,7 @@ function Pagination() {
|
|
|
1308
1558
|
] }),
|
|
1309
1559
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1310
1560
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1311
|
-
|
|
1561
|
+
Button,
|
|
1312
1562
|
{
|
|
1313
1563
|
variant: "outline",
|
|
1314
1564
|
size: "sm",
|
|
@@ -1324,7 +1574,7 @@ function Pagination() {
|
|
|
1324
1574
|
table.getPageCount()
|
|
1325
1575
|
] }),
|
|
1326
1576
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1327
|
-
|
|
1577
|
+
Button,
|
|
1328
1578
|
{
|
|
1329
1579
|
variant: "outline",
|
|
1330
1580
|
size: "sm",
|
|
@@ -1340,11 +1590,13 @@ var pagination_default = Pagination;
|
|
|
1340
1590
|
|
|
1341
1591
|
// src/components/data-table/index.tsx
|
|
1342
1592
|
var DataTable = Object.assign(root_default2, {
|
|
1593
|
+
Root: root_default2,
|
|
1343
1594
|
Toolbar: toolbar_default,
|
|
1344
1595
|
Content: content_default,
|
|
1345
1596
|
TableView: table_view_default,
|
|
1346
1597
|
GridView: grid_view_default,
|
|
1347
|
-
Pagination: pagination_default
|
|
1598
|
+
Pagination: pagination_default,
|
|
1599
|
+
ViewOptions: view_options_default
|
|
1348
1600
|
});
|
|
1349
1601
|
var data_table_default = DataTable;
|
|
1350
1602
|
|