@customafk/lunas-ui 0.0.2-x → 0.0.2-z
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/Atoms/Command/index.d.ts +7 -7
- package/dist/Atoms/Form/index.js +32 -21
- package/dist/Atoms/UserAvatar/index.js +2 -2
- package/dist/Authentication/SignIn/index.js +30 -21
- package/dist/Authentication/SignUp/index.d.ts +4 -4
- package/dist/Authentication/SignUp/index.js +30 -21
- package/dist/Molecules/AuthenForm/index.js +30 -21
- package/dist/Molecules/UserDropdown/index.js +2 -2
- package/dist/Organisms/Header/index.d.ts +1 -0
- package/dist/Organisms/Header/index.js +9 -6
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
|
8
8
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
9
|
} & {
|
|
10
10
|
asChild?: boolean;
|
|
11
|
-
}, "key" |
|
|
11
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
12
12
|
label?: string;
|
|
13
13
|
shouldFilter?: boolean;
|
|
14
14
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -26,7 +26,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
26
26
|
ref?: React.Ref<HTMLInputElement>;
|
|
27
27
|
} & {
|
|
28
28
|
asChild?: boolean;
|
|
29
|
-
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "
|
|
29
|
+
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
30
30
|
value?: string;
|
|
31
31
|
onValueChange?: (search: string) => void;
|
|
32
32
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -36,7 +36,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
36
36
|
ref?: React.Ref<HTMLDivElement>;
|
|
37
37
|
} & {
|
|
38
38
|
asChild?: boolean;
|
|
39
|
-
}, "key" |
|
|
39
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
40
40
|
label?: string;
|
|
41
41
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
42
42
|
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -45,14 +45,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
|
45
45
|
ref?: React.Ref<HTMLDivElement>;
|
|
46
46
|
} & {
|
|
47
47
|
asChild?: boolean;
|
|
48
|
-
}, "key" |
|
|
48
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
49
49
|
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
50
50
|
children?: React.ReactNode;
|
|
51
51
|
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
52
52
|
ref?: React.Ref<HTMLDivElement>;
|
|
53
53
|
} & {
|
|
54
54
|
asChild?: boolean;
|
|
55
|
-
}, "key" |
|
|
55
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
|
|
56
56
|
heading?: React.ReactNode;
|
|
57
57
|
value?: string;
|
|
58
58
|
forceMount?: boolean;
|
|
@@ -61,7 +61,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
|
|
|
61
61
|
ref?: React.Ref<HTMLDivElement>;
|
|
62
62
|
} & {
|
|
63
63
|
asChild?: boolean;
|
|
64
|
-
}, "key" |
|
|
64
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
65
65
|
alwaysRender?: boolean;
|
|
66
66
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
67
|
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -70,7 +70,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
70
70
|
ref?: React.Ref<HTMLDivElement>;
|
|
71
71
|
} & {
|
|
72
72
|
asChild?: boolean;
|
|
73
|
-
}, "key" |
|
|
73
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
|
|
74
74
|
disabled?: boolean;
|
|
75
75
|
onSelect?: (value: string) => void;
|
|
76
76
|
value?: string;
|
package/dist/Atoms/Form/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// packages/Atoms/Form/index.tsx
|
|
2
4
|
import * as React2 from "react";
|
|
3
5
|
import {
|
|
4
|
-
Controller
|
|
5
|
-
FormProvider
|
|
6
|
-
useFormContext
|
|
6
|
+
Controller,
|
|
7
|
+
FormProvider,
|
|
8
|
+
useFormContext
|
|
7
9
|
} from "react-hook-form";
|
|
8
10
|
|
|
9
11
|
// packages/Atoms/Label/index.tsx
|
|
@@ -266,17 +268,17 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
266
268
|
// packages/Atoms/Form/index.tsx
|
|
267
269
|
import { Slot } from "@radix-ui/react-slot";
|
|
268
270
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
269
|
-
var Form =
|
|
271
|
+
var Form = FormProvider;
|
|
270
272
|
var FormFieldContext = React2.createContext({});
|
|
271
273
|
var FormField = ({
|
|
272
274
|
...props
|
|
273
275
|
}) => {
|
|
274
|
-
return /* @__PURE__ */ jsx2(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx2(
|
|
276
|
+
return /* @__PURE__ */ jsx2(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx2(Controller, { ...props }) });
|
|
275
277
|
};
|
|
276
278
|
var useFormField = () => {
|
|
277
279
|
const fieldContext = React2.useContext(FormFieldContext);
|
|
278
280
|
const itemContext = React2.useContext(FormItemContext);
|
|
279
|
-
const { getFieldState, formState } =
|
|
281
|
+
const { getFieldState, formState } = useFormContext();
|
|
280
282
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
281
283
|
if (!fieldContext) {
|
|
282
284
|
throw new Error("useFormField should be used within <FormField>");
|
|
@@ -293,55 +295,64 @@ var useFormField = () => {
|
|
|
293
295
|
};
|
|
294
296
|
var FormItemContext = React2.createContext({});
|
|
295
297
|
var FormItem = React2.forwardRef(
|
|
296
|
-
({ className, ...props },
|
|
298
|
+
({ className, ...props }, ref) => {
|
|
297
299
|
const id = React2.useId();
|
|
298
|
-
return /* @__PURE__ */ jsx2(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx2("div", { ref
|
|
300
|
+
return /* @__PURE__ */ jsx2(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx2("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
299
301
|
}
|
|
300
302
|
);
|
|
301
303
|
FormItem.displayName = "FormItem";
|
|
302
|
-
var FormLabel = React2.forwardRef(({ className, ...props },
|
|
304
|
+
var FormLabel = React2.forwardRef(({ className, ...props }, ref) => {
|
|
303
305
|
const { error, formItemId } = useFormField();
|
|
304
306
|
return /* @__PURE__ */ jsx2(
|
|
305
307
|
Label,
|
|
306
308
|
{
|
|
307
|
-
ref
|
|
308
|
-
className: cn(error && "text-destructive", className),
|
|
309
|
+
ref,
|
|
310
|
+
className: cn(error && "text-ui-destructive-500", className),
|
|
309
311
|
htmlFor: formItemId,
|
|
310
312
|
...props
|
|
311
313
|
}
|
|
312
314
|
);
|
|
313
315
|
});
|
|
314
316
|
FormLabel.displayName = "FormLabel";
|
|
315
|
-
var FormControl = React2.forwardRef(({ ...props },
|
|
316
|
-
const { formItemId } = useFormField();
|
|
317
|
-
return /* @__PURE__ */ jsx2(
|
|
317
|
+
var FormControl = React2.forwardRef(({ ...props }, ref) => {
|
|
318
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
319
|
+
return /* @__PURE__ */ jsx2(
|
|
320
|
+
Slot,
|
|
321
|
+
{
|
|
322
|
+
ref,
|
|
323
|
+
id: formItemId,
|
|
324
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
325
|
+
"aria-invalid": !!error,
|
|
326
|
+
...props
|
|
327
|
+
}
|
|
328
|
+
);
|
|
318
329
|
});
|
|
319
330
|
FormControl.displayName = "FormControl";
|
|
320
|
-
var FormDescription = React2.forwardRef(({ className, ...props },
|
|
331
|
+
var FormDescription = React2.forwardRef(({ className, ...props }, ref) => {
|
|
321
332
|
const { formDescriptionId } = useFormField();
|
|
322
333
|
return /* @__PURE__ */ jsx2(
|
|
323
334
|
"p",
|
|
324
335
|
{
|
|
325
|
-
ref
|
|
336
|
+
ref,
|
|
326
337
|
id: formDescriptionId,
|
|
327
|
-
className: cn("text-
|
|
338
|
+
className: cn("text-sm text-ui-text-500", className),
|
|
328
339
|
...props
|
|
329
340
|
}
|
|
330
341
|
);
|
|
331
342
|
});
|
|
332
343
|
FormDescription.displayName = "FormDescription";
|
|
333
|
-
var FormMessage = React2.forwardRef(({ className, children, ...props },
|
|
344
|
+
var FormMessage = React2.forwardRef(({ className, children, ...props }, ref) => {
|
|
334
345
|
const { error, formMessageId } = useFormField();
|
|
335
346
|
const body = error ? String(error?.message) : children;
|
|
336
347
|
if (!body) {
|
|
337
|
-
return
|
|
348
|
+
return null;
|
|
338
349
|
}
|
|
339
350
|
return /* @__PURE__ */ jsx2(
|
|
340
351
|
"p",
|
|
341
352
|
{
|
|
342
|
-
ref
|
|
353
|
+
ref,
|
|
343
354
|
id: formMessageId,
|
|
344
|
-
className: cn("text-
|
|
355
|
+
className: cn("text-sm font-medium text-ui-destructive-500", className),
|
|
345
356
|
...props,
|
|
346
357
|
children: body
|
|
347
358
|
}
|
|
@@ -444,7 +444,7 @@ var UserAvatar = memo(({ fullname, email, src: source, size, isButton = true })
|
|
|
444
444
|
"enabled:hover:shadow-ui-flat",
|
|
445
445
|
"enabled:hover:scale-110"
|
|
446
446
|
),
|
|
447
|
-
children: source ? /* @__PURE__ */ jsx2(
|
|
447
|
+
children: source ? /* @__PURE__ */ jsx2(AvatarIcon_default, { bgColor: color_hash_default.hex(fullname + email), size }) : /* @__PURE__ */ jsx2(
|
|
448
448
|
"img",
|
|
449
449
|
{
|
|
450
450
|
style: { width: size, height: size },
|
|
@@ -452,7 +452,7 @@ var UserAvatar = memo(({ fullname, email, src: source, size, isButton = true })
|
|
|
452
452
|
src: source,
|
|
453
453
|
alt: fullname
|
|
454
454
|
}
|
|
455
|
-
)
|
|
455
|
+
)
|
|
456
456
|
}
|
|
457
457
|
);
|
|
458
458
|
});
|
|
@@ -335,9 +335,9 @@ var Button_default = Button;
|
|
|
335
335
|
// packages/Atoms/Form/index.tsx
|
|
336
336
|
import * as React2 from "react";
|
|
337
337
|
import {
|
|
338
|
-
Controller
|
|
339
|
-
FormProvider
|
|
340
|
-
useFormContext
|
|
338
|
+
Controller,
|
|
339
|
+
FormProvider,
|
|
340
|
+
useFormContext
|
|
341
341
|
} from "react-hook-form";
|
|
342
342
|
|
|
343
343
|
// packages/Atoms/Label/index.tsx
|
|
@@ -354,17 +354,17 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
354
354
|
// packages/Atoms/Form/index.tsx
|
|
355
355
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
356
356
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
357
|
-
var Form =
|
|
357
|
+
var Form = FormProvider;
|
|
358
358
|
var FormFieldContext = React2.createContext({});
|
|
359
359
|
var FormField = ({
|
|
360
360
|
...props
|
|
361
361
|
}) => {
|
|
362
|
-
return /* @__PURE__ */ jsx3(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx3(
|
|
362
|
+
return /* @__PURE__ */ jsx3(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx3(Controller, { ...props }) });
|
|
363
363
|
};
|
|
364
364
|
var useFormField = () => {
|
|
365
365
|
const fieldContext = React2.useContext(FormFieldContext);
|
|
366
366
|
const itemContext = React2.useContext(FormItemContext);
|
|
367
|
-
const { getFieldState, formState } =
|
|
367
|
+
const { getFieldState, formState } = useFormContext();
|
|
368
368
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
369
369
|
if (!fieldContext) {
|
|
370
370
|
throw new Error("useFormField should be used within <FormField>");
|
|
@@ -381,55 +381,64 @@ var useFormField = () => {
|
|
|
381
381
|
};
|
|
382
382
|
var FormItemContext = React2.createContext({});
|
|
383
383
|
var FormItem = React2.forwardRef(
|
|
384
|
-
({ className, ...props },
|
|
384
|
+
({ className, ...props }, ref) => {
|
|
385
385
|
const id = React2.useId();
|
|
386
|
-
return /* @__PURE__ */ jsx3(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx3("div", { ref
|
|
386
|
+
return /* @__PURE__ */ jsx3(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx3("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
387
387
|
}
|
|
388
388
|
);
|
|
389
389
|
FormItem.displayName = "FormItem";
|
|
390
|
-
var FormLabel = React2.forwardRef(({ className, ...props },
|
|
390
|
+
var FormLabel = React2.forwardRef(({ className, ...props }, ref) => {
|
|
391
391
|
const { error, formItemId } = useFormField();
|
|
392
392
|
return /* @__PURE__ */ jsx3(
|
|
393
393
|
Label,
|
|
394
394
|
{
|
|
395
|
-
ref
|
|
396
|
-
className: cn(error && "text-destructive", className),
|
|
395
|
+
ref,
|
|
396
|
+
className: cn(error && "text-ui-destructive-500", className),
|
|
397
397
|
htmlFor: formItemId,
|
|
398
398
|
...props
|
|
399
399
|
}
|
|
400
400
|
);
|
|
401
401
|
});
|
|
402
402
|
FormLabel.displayName = "FormLabel";
|
|
403
|
-
var FormControl = React2.forwardRef(({ ...props },
|
|
404
|
-
const { formItemId } = useFormField();
|
|
405
|
-
return /* @__PURE__ */ jsx3(
|
|
403
|
+
var FormControl = React2.forwardRef(({ ...props }, ref) => {
|
|
404
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
405
|
+
return /* @__PURE__ */ jsx3(
|
|
406
|
+
Slot2,
|
|
407
|
+
{
|
|
408
|
+
ref,
|
|
409
|
+
id: formItemId,
|
|
410
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
411
|
+
"aria-invalid": !!error,
|
|
412
|
+
...props
|
|
413
|
+
}
|
|
414
|
+
);
|
|
406
415
|
});
|
|
407
416
|
FormControl.displayName = "FormControl";
|
|
408
|
-
var FormDescription = React2.forwardRef(({ className, ...props },
|
|
417
|
+
var FormDescription = React2.forwardRef(({ className, ...props }, ref) => {
|
|
409
418
|
const { formDescriptionId } = useFormField();
|
|
410
419
|
return /* @__PURE__ */ jsx3(
|
|
411
420
|
"p",
|
|
412
421
|
{
|
|
413
|
-
ref
|
|
422
|
+
ref,
|
|
414
423
|
id: formDescriptionId,
|
|
415
|
-
className: cn("text-
|
|
424
|
+
className: cn("text-sm text-ui-text-500", className),
|
|
416
425
|
...props
|
|
417
426
|
}
|
|
418
427
|
);
|
|
419
428
|
});
|
|
420
429
|
FormDescription.displayName = "FormDescription";
|
|
421
|
-
var FormMessage = React2.forwardRef(({ className, children, ...props },
|
|
430
|
+
var FormMessage = React2.forwardRef(({ className, children, ...props }, ref) => {
|
|
422
431
|
const { error, formMessageId } = useFormField();
|
|
423
432
|
const body = error ? String(error?.message) : children;
|
|
424
433
|
if (!body) {
|
|
425
|
-
return
|
|
434
|
+
return null;
|
|
426
435
|
}
|
|
427
436
|
return /* @__PURE__ */ jsx3(
|
|
428
437
|
"p",
|
|
429
438
|
{
|
|
430
|
-
ref
|
|
439
|
+
ref,
|
|
431
440
|
id: formMessageId,
|
|
432
|
-
className: cn("text-
|
|
441
|
+
className: cn("text-sm font-medium text-ui-destructive-500", className),
|
|
433
442
|
...props,
|
|
434
443
|
children: body
|
|
435
444
|
}
|
|
@@ -7,23 +7,23 @@ declare const SignUpSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7
7
|
password: z.ZodEffects<z.ZodString, string, string>;
|
|
8
8
|
confirmPassword: z.ZodString;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
email: string;
|
|
11
10
|
fullname: string;
|
|
11
|
+
email: string;
|
|
12
12
|
password: string;
|
|
13
13
|
confirmPassword: string;
|
|
14
14
|
}, {
|
|
15
|
-
email: string;
|
|
16
15
|
fullname: string;
|
|
16
|
+
email: string;
|
|
17
17
|
password: string;
|
|
18
18
|
confirmPassword: string;
|
|
19
19
|
}>, {
|
|
20
|
-
email: string;
|
|
21
20
|
fullname: string;
|
|
21
|
+
email: string;
|
|
22
22
|
password: string;
|
|
23
23
|
confirmPassword: string;
|
|
24
24
|
}, {
|
|
25
|
-
email: string;
|
|
26
25
|
fullname: string;
|
|
26
|
+
email: string;
|
|
27
27
|
password: string;
|
|
28
28
|
confirmPassword: string;
|
|
29
29
|
}>;
|
|
@@ -370,9 +370,9 @@ var Button_default = Button;
|
|
|
370
370
|
// packages/Atoms/Form/index.tsx
|
|
371
371
|
import * as React2 from "react";
|
|
372
372
|
import {
|
|
373
|
-
Controller
|
|
374
|
-
FormProvider
|
|
375
|
-
useFormContext
|
|
373
|
+
Controller,
|
|
374
|
+
FormProvider,
|
|
375
|
+
useFormContext
|
|
376
376
|
} from "react-hook-form";
|
|
377
377
|
|
|
378
378
|
// packages/Atoms/Label/index.tsx
|
|
@@ -389,17 +389,17 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
389
389
|
// packages/Atoms/Form/index.tsx
|
|
390
390
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
391
391
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
392
|
-
var Form =
|
|
392
|
+
var Form = FormProvider;
|
|
393
393
|
var FormFieldContext = React2.createContext({});
|
|
394
394
|
var FormField = ({
|
|
395
395
|
...props
|
|
396
396
|
}) => {
|
|
397
|
-
return /* @__PURE__ */ jsx4(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx4(
|
|
397
|
+
return /* @__PURE__ */ jsx4(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx4(Controller, { ...props }) });
|
|
398
398
|
};
|
|
399
399
|
var useFormField = () => {
|
|
400
400
|
const fieldContext = React2.useContext(FormFieldContext);
|
|
401
401
|
const itemContext = React2.useContext(FormItemContext);
|
|
402
|
-
const { getFieldState, formState } =
|
|
402
|
+
const { getFieldState, formState } = useFormContext();
|
|
403
403
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
404
404
|
if (!fieldContext) {
|
|
405
405
|
throw new Error("useFormField should be used within <FormField>");
|
|
@@ -416,55 +416,64 @@ var useFormField = () => {
|
|
|
416
416
|
};
|
|
417
417
|
var FormItemContext = React2.createContext({});
|
|
418
418
|
var FormItem = React2.forwardRef(
|
|
419
|
-
({ className, ...props },
|
|
419
|
+
({ className, ...props }, ref) => {
|
|
420
420
|
const id = React2.useId();
|
|
421
|
-
return /* @__PURE__ */ jsx4(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx4("div", { ref
|
|
421
|
+
return /* @__PURE__ */ jsx4(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx4("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
422
422
|
}
|
|
423
423
|
);
|
|
424
424
|
FormItem.displayName = "FormItem";
|
|
425
|
-
var FormLabel = React2.forwardRef(({ className, ...props },
|
|
425
|
+
var FormLabel = React2.forwardRef(({ className, ...props }, ref) => {
|
|
426
426
|
const { error, formItemId } = useFormField();
|
|
427
427
|
return /* @__PURE__ */ jsx4(
|
|
428
428
|
Label,
|
|
429
429
|
{
|
|
430
|
-
ref
|
|
431
|
-
className: cn(error && "text-destructive", className),
|
|
430
|
+
ref,
|
|
431
|
+
className: cn(error && "text-ui-destructive-500", className),
|
|
432
432
|
htmlFor: formItemId,
|
|
433
433
|
...props
|
|
434
434
|
}
|
|
435
435
|
);
|
|
436
436
|
});
|
|
437
437
|
FormLabel.displayName = "FormLabel";
|
|
438
|
-
var FormControl = React2.forwardRef(({ ...props },
|
|
439
|
-
const { formItemId } = useFormField();
|
|
440
|
-
return /* @__PURE__ */ jsx4(
|
|
438
|
+
var FormControl = React2.forwardRef(({ ...props }, ref) => {
|
|
439
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
440
|
+
return /* @__PURE__ */ jsx4(
|
|
441
|
+
Slot2,
|
|
442
|
+
{
|
|
443
|
+
ref,
|
|
444
|
+
id: formItemId,
|
|
445
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
446
|
+
"aria-invalid": !!error,
|
|
447
|
+
...props
|
|
448
|
+
}
|
|
449
|
+
);
|
|
441
450
|
});
|
|
442
451
|
FormControl.displayName = "FormControl";
|
|
443
|
-
var FormDescription = React2.forwardRef(({ className, ...props },
|
|
452
|
+
var FormDescription = React2.forwardRef(({ className, ...props }, ref) => {
|
|
444
453
|
const { formDescriptionId } = useFormField();
|
|
445
454
|
return /* @__PURE__ */ jsx4(
|
|
446
455
|
"p",
|
|
447
456
|
{
|
|
448
|
-
ref
|
|
457
|
+
ref,
|
|
449
458
|
id: formDescriptionId,
|
|
450
|
-
className: cn("text-
|
|
459
|
+
className: cn("text-sm text-ui-text-500", className),
|
|
451
460
|
...props
|
|
452
461
|
}
|
|
453
462
|
);
|
|
454
463
|
});
|
|
455
464
|
FormDescription.displayName = "FormDescription";
|
|
456
|
-
var FormMessage = React2.forwardRef(({ className, children, ...props },
|
|
465
|
+
var FormMessage = React2.forwardRef(({ className, children, ...props }, ref) => {
|
|
457
466
|
const { error, formMessageId } = useFormField();
|
|
458
467
|
const body = error ? String(error?.message) : children;
|
|
459
468
|
if (!body) {
|
|
460
|
-
return
|
|
469
|
+
return null;
|
|
461
470
|
}
|
|
462
471
|
return /* @__PURE__ */ jsx4(
|
|
463
472
|
"p",
|
|
464
473
|
{
|
|
465
|
-
ref
|
|
474
|
+
ref,
|
|
466
475
|
id: formMessageId,
|
|
467
|
-
className: cn("text-
|
|
476
|
+
className: cn("text-sm font-medium text-ui-destructive-500", className),
|
|
468
477
|
...props,
|
|
469
478
|
children: body
|
|
470
479
|
}
|
|
@@ -931,9 +931,9 @@ var Button_default = Button;
|
|
|
931
931
|
// packages/Atoms/Form/index.tsx
|
|
932
932
|
import * as React2 from "react";
|
|
933
933
|
import {
|
|
934
|
-
Controller
|
|
935
|
-
FormProvider
|
|
936
|
-
useFormContext
|
|
934
|
+
Controller,
|
|
935
|
+
FormProvider,
|
|
936
|
+
useFormContext
|
|
937
937
|
} from "react-hook-form";
|
|
938
938
|
|
|
939
939
|
// packages/Atoms/Label/index.tsx
|
|
@@ -950,17 +950,17 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
950
950
|
// packages/Atoms/Form/index.tsx
|
|
951
951
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
952
952
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
953
|
-
var Form =
|
|
953
|
+
var Form = FormProvider;
|
|
954
954
|
var FormFieldContext = React2.createContext({});
|
|
955
955
|
var FormField = ({
|
|
956
956
|
...props
|
|
957
957
|
}) => {
|
|
958
|
-
return /* @__PURE__ */ jsx12(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx12(
|
|
958
|
+
return /* @__PURE__ */ jsx12(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx12(Controller, { ...props }) });
|
|
959
959
|
};
|
|
960
960
|
var useFormField = () => {
|
|
961
961
|
const fieldContext = React2.useContext(FormFieldContext);
|
|
962
962
|
const itemContext = React2.useContext(FormItemContext);
|
|
963
|
-
const { getFieldState, formState } =
|
|
963
|
+
const { getFieldState, formState } = useFormContext();
|
|
964
964
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
965
965
|
if (!fieldContext) {
|
|
966
966
|
throw new Error("useFormField should be used within <FormField>");
|
|
@@ -977,55 +977,64 @@ var useFormField = () => {
|
|
|
977
977
|
};
|
|
978
978
|
var FormItemContext = React2.createContext({});
|
|
979
979
|
var FormItem = React2.forwardRef(
|
|
980
|
-
({ className, ...props },
|
|
980
|
+
({ className, ...props }, ref) => {
|
|
981
981
|
const id = React2.useId();
|
|
982
|
-
return /* @__PURE__ */ jsx12(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx12("div", { ref
|
|
982
|
+
return /* @__PURE__ */ jsx12(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx12("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
983
983
|
}
|
|
984
984
|
);
|
|
985
985
|
FormItem.displayName = "FormItem";
|
|
986
|
-
var FormLabel = React2.forwardRef(({ className, ...props },
|
|
986
|
+
var FormLabel = React2.forwardRef(({ className, ...props }, ref) => {
|
|
987
987
|
const { error, formItemId } = useFormField();
|
|
988
988
|
return /* @__PURE__ */ jsx12(
|
|
989
989
|
Label,
|
|
990
990
|
{
|
|
991
|
-
ref
|
|
992
|
-
className: cn(error && "text-destructive", className),
|
|
991
|
+
ref,
|
|
992
|
+
className: cn(error && "text-ui-destructive-500", className),
|
|
993
993
|
htmlFor: formItemId,
|
|
994
994
|
...props
|
|
995
995
|
}
|
|
996
996
|
);
|
|
997
997
|
});
|
|
998
998
|
FormLabel.displayName = "FormLabel";
|
|
999
|
-
var FormControl = React2.forwardRef(({ ...props },
|
|
1000
|
-
const { formItemId } = useFormField();
|
|
1001
|
-
return /* @__PURE__ */ jsx12(
|
|
999
|
+
var FormControl = React2.forwardRef(({ ...props }, ref) => {
|
|
1000
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
1001
|
+
return /* @__PURE__ */ jsx12(
|
|
1002
|
+
Slot2,
|
|
1003
|
+
{
|
|
1004
|
+
ref,
|
|
1005
|
+
id: formItemId,
|
|
1006
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
1007
|
+
"aria-invalid": !!error,
|
|
1008
|
+
...props
|
|
1009
|
+
}
|
|
1010
|
+
);
|
|
1002
1011
|
});
|
|
1003
1012
|
FormControl.displayName = "FormControl";
|
|
1004
|
-
var FormDescription = React2.forwardRef(({ className, ...props },
|
|
1013
|
+
var FormDescription = React2.forwardRef(({ className, ...props }, ref) => {
|
|
1005
1014
|
const { formDescriptionId } = useFormField();
|
|
1006
1015
|
return /* @__PURE__ */ jsx12(
|
|
1007
1016
|
"p",
|
|
1008
1017
|
{
|
|
1009
|
-
ref
|
|
1018
|
+
ref,
|
|
1010
1019
|
id: formDescriptionId,
|
|
1011
|
-
className: cn("text-
|
|
1020
|
+
className: cn("text-sm text-ui-text-500", className),
|
|
1012
1021
|
...props
|
|
1013
1022
|
}
|
|
1014
1023
|
);
|
|
1015
1024
|
});
|
|
1016
1025
|
FormDescription.displayName = "FormDescription";
|
|
1017
|
-
var FormMessage = React2.forwardRef(({ className, children, ...props },
|
|
1026
|
+
var FormMessage = React2.forwardRef(({ className, children, ...props }, ref) => {
|
|
1018
1027
|
const { error, formMessageId } = useFormField();
|
|
1019
1028
|
const body = error ? String(error?.message) : children;
|
|
1020
1029
|
if (!body) {
|
|
1021
|
-
return
|
|
1030
|
+
return null;
|
|
1022
1031
|
}
|
|
1023
1032
|
return /* @__PURE__ */ jsx12(
|
|
1024
1033
|
"p",
|
|
1025
1034
|
{
|
|
1026
|
-
ref
|
|
1035
|
+
ref,
|
|
1027
1036
|
id: formMessageId,
|
|
1028
|
-
className: cn("text-
|
|
1037
|
+
className: cn("text-sm font-medium text-ui-destructive-500", className),
|
|
1029
1038
|
...props,
|
|
1030
1039
|
children: body
|
|
1031
1040
|
}
|
|
@@ -607,7 +607,7 @@ var UserAvatar = memo2(({ fullname, email, src: source, size, isButton = true })
|
|
|
607
607
|
"enabled:hover:shadow-ui-flat",
|
|
608
608
|
"enabled:hover:scale-110"
|
|
609
609
|
),
|
|
610
|
-
children: source ? /* @__PURE__ */ jsx5(
|
|
610
|
+
children: source ? /* @__PURE__ */ jsx5(AvatarIcon_default, { bgColor: color_hash_default.hex(fullname + email), size }) : /* @__PURE__ */ jsx5(
|
|
611
611
|
"img",
|
|
612
612
|
{
|
|
613
613
|
style: { width: size, height: size },
|
|
@@ -615,7 +615,7 @@ var UserAvatar = memo2(({ fullname, email, src: source, size, isButton = true })
|
|
|
615
615
|
src: source,
|
|
616
616
|
alt: fullname
|
|
617
617
|
}
|
|
618
|
-
)
|
|
618
|
+
)
|
|
619
619
|
}
|
|
620
620
|
);
|
|
621
621
|
});
|
|
@@ -39,6 +39,7 @@ interface IHeaderProps {
|
|
|
39
39
|
onShowAllProduct?: () => void;
|
|
40
40
|
onCartCheckout?: () => void;
|
|
41
41
|
onCartShowAll?: () => void;
|
|
42
|
+
onCartTypeSelected?: (value: 'ORDER' | 'IN_STOCK') => void;
|
|
42
43
|
onCategorySelected?: (slug: string) => void;
|
|
43
44
|
}
|
|
44
45
|
declare const Header: FC<IHeaderProps>;
|
|
@@ -1467,7 +1467,8 @@ var CartSheet = ({
|
|
|
1467
1467
|
inStock,
|
|
1468
1468
|
order,
|
|
1469
1469
|
onCheckout,
|
|
1470
|
-
onShowAll
|
|
1470
|
+
onShowAll,
|
|
1471
|
+
onTypeSelected
|
|
1471
1472
|
}) => {
|
|
1472
1473
|
const formattedMoney = new Intl.NumberFormat("vi-VN").format(moneyTotal ?? 0);
|
|
1473
1474
|
const formattedQuantity = new Intl.NumberFormat("vi-VN").format(quantityTotal ?? 0);
|
|
@@ -1489,8 +1490,8 @@ var CartSheet = ({
|
|
|
1489
1490
|
className: "relative flex w-full flex-col items-center overflow-auto",
|
|
1490
1491
|
children: [
|
|
1491
1492
|
/* @__PURE__ */ jsxs9(TabsList, { className: "h-fit w-[90%] *:w-1/2", children: [
|
|
1492
|
-
/* @__PURE__ */ jsx18(TabsTrigger, { value: "order", children: "H\xE0ng \u0111\u1EB7t tr\u01B0\u1EDBc" }),
|
|
1493
|
-
/* @__PURE__ */ jsx18(TabsTrigger, { value: "in_stock", children: "H\xE0ng c\xF3 s\u1EB5n" })
|
|
1493
|
+
/* @__PURE__ */ jsx18(TabsTrigger, { value: "order", onClick: () => onTypeSelected?.("ORDER"), children: "H\xE0ng \u0111\u1EB7t tr\u01B0\u1EDBc" }),
|
|
1494
|
+
/* @__PURE__ */ jsx18(TabsTrigger, { value: "in_stock", onClick: () => onTypeSelected?.("IN_STOCK"), children: "H\xE0ng c\xF3 s\u1EB5n" })
|
|
1494
1495
|
] }),
|
|
1495
1496
|
/* @__PURE__ */ jsxs9(ScrollArea, { className: "relative w-full", children: [
|
|
1496
1497
|
/* @__PURE__ */ jsx18(TabsContent, { value: "order", className: "w-full overflow-auto px-2", children: order }),
|
|
@@ -2061,7 +2062,7 @@ var UserAvatar = memo7(({ fullname, email, src: source, size, isButton = true })
|
|
|
2061
2062
|
"enabled:hover:shadow-ui-flat",
|
|
2062
2063
|
"enabled:hover:scale-110"
|
|
2063
2064
|
),
|
|
2064
|
-
children: source ? /* @__PURE__ */ jsx24(
|
|
2065
|
+
children: source ? /* @__PURE__ */ jsx24(AvatarIcon_default, { bgColor: color_hash_default.hex(fullname + email), size }) : /* @__PURE__ */ jsx24(
|
|
2065
2066
|
"img",
|
|
2066
2067
|
{
|
|
2067
2068
|
style: { width: size, height: size },
|
|
@@ -2069,7 +2070,7 @@ var UserAvatar = memo7(({ fullname, email, src: source, size, isButton = true })
|
|
|
2069
2070
|
src: source,
|
|
2070
2071
|
alt: fullname
|
|
2071
2072
|
}
|
|
2072
|
-
)
|
|
2073
|
+
)
|
|
2073
2074
|
}
|
|
2074
2075
|
);
|
|
2075
2076
|
});
|
|
@@ -2391,6 +2392,7 @@ var Header = memo9((props) => {
|
|
|
2391
2392
|
onCartCheckout,
|
|
2392
2393
|
onCartShowAll,
|
|
2393
2394
|
onShowAllProduct,
|
|
2395
|
+
onCartTypeSelected,
|
|
2394
2396
|
onCategorySelected
|
|
2395
2397
|
} = props;
|
|
2396
2398
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -2475,7 +2477,8 @@ var Header = memo9((props) => {
|
|
|
2475
2477
|
inStock: cartInStock,
|
|
2476
2478
|
moneyTotal: cartsAmountTotal,
|
|
2477
2479
|
onCheckout: onCartCheckout,
|
|
2478
|
-
onShowAll: onCartShowAll
|
|
2480
|
+
onShowAll: onCartShowAll,
|
|
2481
|
+
onTypeSelected: onCartTypeSelected
|
|
2479
2482
|
}
|
|
2480
2483
|
)
|
|
2481
2484
|
]
|