nexstruct 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +122 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/package.json +99 -0
- package/scaffold/generator.js +409 -0
- package/scaffold/index.js +20 -0
- package/scaffold/prompts.js +108 -0
- package/templates/api/axios/src/api/axios/client.api.ts +30 -0
- package/templates/api/axios/src/api/axios/users.api.ts +15 -0
- package/templates/api/fetch/src/api/fetch/client.api.ts +68 -0
- package/templates/api/fetch/src/api/fetch/users.api.ts +15 -0
- package/templates/api/trpc/src/api/trpc/client.api.ts +4 -0
- package/templates/api/trpc/src/api/trpc/router.api.ts +15 -0
- package/templates/api/trpc/src/api/trpc/server.client.api.ts +4 -0
- package/templates/api/trpc/src/providers/trpc.provider.tsx +24 -0
- package/templates/auth/clerk/src/auth/clerk/auth.service.ts +4 -0
- package/templates/auth/clerk/src/hooks/use-auth.hook.ts +13 -0
- package/templates/auth/clerk/src/middleware.ts +7 -0
- package/templates/auth/clerk/src/providers/auth.provider.tsx +6 -0
- package/templates/auth/next-auth/src/app/api/auth/[...nextauth]/route.ts +5 -0
- package/templates/auth/next-auth/src/auth/next-auth/auth.service.ts +45 -0
- package/templates/auth/next-auth/src/hooks/use-session.hook.ts +13 -0
- package/templates/auth/next-auth/src/providers/session.provider.tsx +6 -0
- package/templates/forms/formik/src/components/forms/login-form.component.tsx +30 -0
- package/templates/forms/formik/src/forms/formik/hooks/use-form-config.hook.ts +7 -0
- package/templates/forms/formik/src/forms/formik/schemas/example.schema.ts +8 -0
- package/templates/forms/react-hook-form/src/components/forms/login-form.component.tsx +27 -0
- package/templates/forms/react-hook-form/src/forms/react-hook-form/hooks/use-form.hook.ts +13 -0
- package/templates/forms/react-hook-form/src/forms/react-hook-form/schemas/example.schema.ts +15 -0
- package/templates/nextjs-base/next.config.ts +5 -0
- package/templates/nextjs-base/postcss.config.mjs +9 -0
- package/templates/nextjs-base/src/app/_components/navbar.tsx +88 -0
- package/templates/nextjs-base/src/app/_components/sidebar.tsx +223 -0
- package/templates/nextjs-base/src/app/error.tsx +39 -0
- package/templates/nextjs-base/src/app/globals.css +71 -0
- package/templates/nextjs-base/src/app/layout.tsx +21 -0
- package/templates/nextjs-base/src/app/loading.tsx +13 -0
- package/templates/nextjs-base/src/app/not-found.tsx +22 -0
- package/templates/nextjs-base/src/app/page.tsx +10 -0
- package/templates/nextjs-base/tailwind.config.ts +69 -0
- package/templates/shared/src/components/common/theme-toggle.component.tsx +31 -0
- package/templates/shared/src/components/common/toast/custom-message.component.tsx +18 -0
- package/templates/shared/src/components/common/toast/index.ts +8 -0
- package/templates/shared/src/components/common/toast/toast-message.component.tsx +112 -0
- package/templates/shared/src/hooks/use-debounce.hook.ts +12 -0
- package/templates/shared/src/hooks/use-fetch.hook.ts +42 -0
- package/templates/shared/src/hooks/use-intersection-observer.hook.ts +39 -0
- package/templates/shared/src/hooks/use-local-storage.hook.ts +30 -0
- package/templates/shared/src/hooks/use-media-query.hook.ts +26 -0
- package/templates/shared/src/hooks/use-toggle.hook.ts +12 -0
- package/templates/shared/src/lib/utils.util.ts +361 -0
- package/templates/shared/src/providers/theme.provider.tsx +17 -0
- package/templates/shared/src/providers/toast.provider.tsx +32 -0
- package/templates/shared/src/types/common.type.ts +34 -0
- package/templates/state/context/src/store/context/auth.context.tsx +47 -0
- package/templates/state/context/src/store/context/counter.context.tsx +41 -0
- package/templates/state/context/src/store/context/index.ts +2 -0
- package/templates/state/redux/src/providers/redux.provider.tsx +7 -0
- package/templates/state/redux/src/store/redux/hooks.store.ts +5 -0
- package/templates/state/redux/src/store/redux/index.ts +4 -0
- package/templates/state/redux/src/store/redux/slices/api.slice.ts +8 -0
- package/templates/state/redux/src/store/redux/slices/counter.slice.ts +24 -0
- package/templates/state/redux/src/store/redux/store.store.ts +13 -0
- package/templates/state/zustand/src/store/zustand/counter.store.ts +15 -0
- package/templates/state/zustand/src/store/zustand/index.ts +2 -0
- package/templates/state/zustand/src/store/zustand/user.store.ts +32 -0
- package/templates/ui/antd/COMPONENT_GUIDE.md +326 -0
- package/templates/ui/antd/src/app/examples/dialog/page.tsx +205 -0
- package/templates/ui/antd/src/app/examples/form/page.tsx +160 -0
- package/templates/ui/antd/src/app/examples/layout.tsx +125 -0
- package/templates/ui/antd/src/app/examples/page.tsx +64 -0
- package/templates/ui/antd/src/app/examples/table/page.tsx +118 -0
- package/templates/ui/antd/src/app/page.tsx +283 -0
- package/templates/ui/antd/src/components/common/DynamicTable/dynamic-table.component.tsx +79 -0
- package/templates/ui/antd/src/components/common/button/action-button.component.tsx +63 -0
- package/templates/ui/antd/src/components/common/dialog/dialog-wrapper.component.tsx +63 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/check-field.component.tsx +55 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/date-picker-field.component.tsx +80 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/limit-field.component.tsx +26 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/multi-check-field.component.tsx +56 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/number-field.component.tsx +100 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/otp-field.component.tsx +63 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/password-field.component.tsx +106 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/phone-number-field.component.tsx +78 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/radio-field.component.tsx +55 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/range-date-picker.component.tsx +66 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/search-field.component.tsx +24 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/select-field.component.tsx +82 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/single-check-field.component.tsx +50 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/single-select-field.component.tsx +86 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/string-number-field.component.tsx +80 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/switch-field.component.tsx +62 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/text-area-field.component.tsx +85 -0
- package/templates/ui/antd/src/components/common/fields/assets/components/text-field.component.tsx +88 -0
- package/templates/ui/antd/src/components/common/fields/assets/interface/input-props.type.ts +233 -0
- package/templates/ui/antd/src/components/common/fields/cusInputField.component.tsx +40 -0
- package/templates/ui/antd/src/components/common/pagination/pagination.component.tsx +27 -0
- package/templates/ui/antd/src/components/ui/avatar.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/badge.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/button.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/card.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/checkbox.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/dialog.component.tsx +9 -0
- package/templates/ui/antd/src/components/ui/dropdown-menu.component.tsx +10 -0
- package/templates/ui/antd/src/components/ui/form.component.tsx +12 -0
- package/templates/ui/antd/src/components/ui/input.component.tsx +13 -0
- package/templates/ui/antd/src/components/ui/label.component.tsx +18 -0
- package/templates/ui/antd/src/components/ui/popover.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/progress.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/radio-group.component.tsx +10 -0
- package/templates/ui/antd/src/components/ui/scroll-area.component.tsx +25 -0
- package/templates/ui/antd/src/components/ui/select.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/separator.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/sheet.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/switch.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/table.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/tabs.component.tsx +8 -0
- package/templates/ui/antd/src/components/ui/textarea.component.tsx +9 -0
- package/templates/ui/antd/src/components/ui/tooltip.component.tsx +8 -0
- package/templates/ui/antd/src/lib/theme.util.ts +40 -0
- package/templates/ui/antd/src/providers/antd.provider.tsx +13 -0
- package/templates/ui/mui/src/app/examples/layout.tsx +113 -0
- package/templates/ui/mui/src/app/examples/page.tsx +716 -0
- package/templates/ui/mui/src/app/page.tsx +298 -0
- package/templates/ui/mui/src/components/common/DynamicTable/dynamic-table.component.tsx +131 -0
- package/templates/ui/mui/src/components/common/button/action-button.component.tsx +57 -0
- package/templates/ui/mui/src/components/common/dialog/dialog-wrapper.component.tsx +55 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/check-field.component.tsx +51 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/date-picker-field.component.tsx +50 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/multi-check-field.component.tsx +14 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/number-field.component.tsx +59 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/password-field.component.tsx +87 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/phone-number-field.component.tsx +48 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/radio-field.component.tsx +37 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/search-field.component.tsx +41 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/select-field.component.tsx +77 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/single-check-field.component.tsx +39 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/single-select-field.component.tsx +56 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/string-number-field.component.tsx +52 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/switch-field.component.tsx +35 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/text-area-field.component.tsx +46 -0
- package/templates/ui/mui/src/components/common/fields/assets/components/text-field.component.tsx +51 -0
- package/templates/ui/mui/src/components/common/fields/assets/interface/input-props.type.ts +193 -0
- package/templates/ui/mui/src/components/common/fields/cusInputField.component.tsx +34 -0
- package/templates/ui/mui/src/components/common/pagination/pagination.component.tsx +59 -0
- package/templates/ui/mui/src/components/ui/avatar.component.tsx +19 -0
- package/templates/ui/mui/src/components/ui/badge.component.tsx +18 -0
- package/templates/ui/mui/src/components/ui/button.component.tsx +22 -0
- package/templates/ui/mui/src/components/ui/card.component.tsx +39 -0
- package/templates/ui/mui/src/components/ui/checkbox.component.tsx +21 -0
- package/templates/ui/mui/src/components/ui/dialog.component.tsx +38 -0
- package/templates/ui/mui/src/components/ui/dropdown-menu.component.tsx +43 -0
- package/templates/ui/mui/src/components/ui/form.component.tsx +98 -0
- package/templates/ui/mui/src/components/ui/input.component.tsx +15 -0
- package/templates/ui/mui/src/components/ui/label.component.tsx +15 -0
- package/templates/ui/mui/src/components/ui/popover.component.tsx +20 -0
- package/templates/ui/mui/src/components/ui/progress.component.tsx +19 -0
- package/templates/ui/mui/src/components/ui/radio-group.component.tsx +25 -0
- package/templates/ui/mui/src/components/ui/scroll-area.component.tsx +27 -0
- package/templates/ui/mui/src/components/ui/select.component.tsx +26 -0
- package/templates/ui/mui/src/components/ui/separator.component.tsx +11 -0
- package/templates/ui/mui/src/components/ui/sheet.component.tsx +44 -0
- package/templates/ui/mui/src/components/ui/switch.component.tsx +23 -0
- package/templates/ui/mui/src/components/ui/table.component.tsx +34 -0
- package/templates/ui/mui/src/components/ui/tabs.component.tsx +38 -0
- package/templates/ui/mui/src/components/ui/textarea.component.tsx +18 -0
- package/templates/ui/mui/src/components/ui/tooltip.component.tsx +24 -0
- package/templates/ui/mui/src/lib/theme.util.ts +73 -0
- package/templates/ui/mui/src/providers/mui.provider.tsx +13 -0
- package/templates/ui/shadcn/COMPONENT_GUIDE.md +306 -0
- package/templates/ui/shadcn/src/app/examples/dialog/page.tsx +122 -0
- package/templates/ui/shadcn/src/app/examples/form/page.tsx +107 -0
- package/templates/ui/shadcn/src/app/examples/layout.tsx +24 -0
- package/templates/ui/shadcn/src/app/examples/page.tsx +30 -0
- package/templates/ui/shadcn/src/app/examples/table/page.tsx +77 -0
- package/templates/ui/shadcn/src/app/page.tsx +20 -0
- package/templates/ui/shadcn/src/components/common/DynamicTable/dynamic-table.component.tsx +136 -0
- package/templates/ui/shadcn/src/components/common/button/action-button.component.tsx +68 -0
- package/templates/ui/shadcn/src/components/common/dialog/dialog-wrapper.component.tsx +58 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/check-field.component.tsx +52 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/date-picker-field.component.tsx +62 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/dynamic-file-upload-field.component.tsx +152 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/limit-field.component.tsx +73 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/multi-check-field.component.tsx +46 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/number-field.component.tsx +124 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/otp-field.component.tsx +61 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/password-field.component.tsx +110 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/phone-number-field.component.tsx +90 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/radio-field.component.tsx +41 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/range-date-picker.component.tsx +71 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/rich-text-editor.component.tsx +91 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/search-field.component.tsx +34 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/select-field.component.tsx +231 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/single-check-field.component.tsx +42 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/single-select-field.component.tsx +82 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/string-number-field.component.tsx +68 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/switch-field.component.tsx +61 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-field.component.tsx +62 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-with-file.component.tsx +142 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/text-field.component.tsx +80 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/tiny-editor.component.tsx +51 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-profile-picture.component.tsx +103 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-video-file.component.tsx +86 -0
- package/templates/ui/shadcn/src/components/common/fields/assets/interface/input-props.type.ts +198 -0
- package/templates/ui/shadcn/src/components/common/fields/cusInputField.component.tsx +52 -0
- package/templates/ui/shadcn/src/components/common/pagination/pagination.component.tsx +68 -0
- package/templates/ui/shadcn/src/components/ui/avatar.component.tsx +37 -0
- package/templates/ui/shadcn/src/components/ui/badge.component.tsx +28 -0
- package/templates/ui/shadcn/src/components/ui/button.component.tsx +52 -0
- package/templates/ui/shadcn/src/components/ui/card.component.tsx +46 -0
- package/templates/ui/shadcn/src/components/ui/checkbox.component.tsx +25 -0
- package/templates/ui/shadcn/src/components/ui/dialog.component.tsx +98 -0
- package/templates/ui/shadcn/src/components/ui/dropdown-menu.component.tsx +163 -0
- package/templates/ui/shadcn/src/components/ui/form.component.tsx +110 -0
- package/templates/ui/shadcn/src/components/ui/input-otp.component.tsx +64 -0
- package/templates/ui/shadcn/src/components/ui/input.component.tsx +23 -0
- package/templates/ui/shadcn/src/components/ui/label.component.tsx +23 -0
- package/templates/ui/shadcn/src/components/ui/popover.component.tsx +27 -0
- package/templates/ui/shadcn/src/components/ui/progress.component.tsx +22 -0
- package/templates/ui/shadcn/src/components/ui/radio-group.component.tsx +33 -0
- package/templates/ui/shadcn/src/components/ui/scroll-area.component.tsx +37 -0
- package/templates/ui/shadcn/src/components/ui/select.component.tsx +139 -0
- package/templates/ui/shadcn/src/components/ui/separator.component.tsx +23 -0
- package/templates/ui/shadcn/src/components/ui/sheet.component.tsx +89 -0
- package/templates/ui/shadcn/src/components/ui/switch.component.tsx +26 -0
- package/templates/ui/shadcn/src/components/ui/table.component.tsx +71 -0
- package/templates/ui/shadcn/src/components/ui/tabs.component.tsx +52 -0
- package/templates/ui/shadcn/src/components/ui/textarea.component.tsx +20 -0
- package/templates/ui/shadcn/src/components/ui/tooltip.component.tsx +25 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
import { FormControl, FormField, FormItem, FormMessage } from '@/components/ui/form.component';
|
|
5
|
+
import { Button } from '@/components/ui/button.component';
|
|
6
|
+
import { UploadCloud, X, FileVideo } from 'lucide-react';
|
|
7
|
+
import { useRef, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
interface UploadVideoFileProps {
|
|
10
|
+
form: any;
|
|
11
|
+
name: string;
|
|
12
|
+
labelName?: string;
|
|
13
|
+
optional?: boolean;
|
|
14
|
+
maxSizeMB?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* UploadVideoFile — Video upload with preview.
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ Stores a data URL string in the form value, NOT a raw File object.
|
|
21
|
+
*/
|
|
22
|
+
export const UploadVideoFile = ({
|
|
23
|
+
form, name, labelName, optional = true, maxSizeMB = 50,
|
|
24
|
+
}: UploadVideoFileProps) => {
|
|
25
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
26
|
+
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
|
|
27
|
+
const value = form.watch(name);
|
|
28
|
+
|
|
29
|
+
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
30
|
+
const file = e.target.files?.[0];
|
|
31
|
+
if (!file) return;
|
|
32
|
+
if (file.size > maxSizeMB * 1024 * 1024) {
|
|
33
|
+
alert(`File exceeds ${maxSizeMB}MB limit`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Store a blob URL string in form — NOT the File object
|
|
38
|
+
const url = URL.createObjectURL(file);
|
|
39
|
+
form.setValue(name, url, { shouldValidate: true });
|
|
40
|
+
setPreviewUrl(url);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handleRemove = () => {
|
|
44
|
+
form.setValue(name, null, { shouldValidate: true });
|
|
45
|
+
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
|
46
|
+
setPreviewUrl(null);
|
|
47
|
+
if (inputRef.current) inputRef.current.value = '';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const displayUrl = previewUrl ?? (typeof value === 'string' ? value : null);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<FormField
|
|
54
|
+
control={form.control}
|
|
55
|
+
name={name}
|
|
56
|
+
render={() => (
|
|
57
|
+
<FormItem>
|
|
58
|
+
{labelName && (
|
|
59
|
+
<label className="font-semibold leading-6 text-[14px] tracking-[0.02em]">
|
|
60
|
+
{labelName}
|
|
61
|
+
{!optional && <span className="text-destructive"> *</span>}
|
|
62
|
+
</label>
|
|
63
|
+
)}
|
|
64
|
+
{displayUrl ? (
|
|
65
|
+
<div className="relative">
|
|
66
|
+
<video src={displayUrl} controls className="w-full max-h-64 rounded-lg" />
|
|
67
|
+
<Button type="button" size="icon" variant="ghost" className="absolute top-2 right-2 h-8 w-8 bg-background/80"
|
|
68
|
+
onClick={handleRemove}>
|
|
69
|
+
<X className="h-4 w-4" />
|
|
70
|
+
</Button>
|
|
71
|
+
</div>
|
|
72
|
+
) : (
|
|
73
|
+
<div className="border-2 border-dashed rounded-lg p-8 text-center hover:border-primary/50 transition-colors cursor-pointer"
|
|
74
|
+
onClick={() => inputRef.current?.click()}>
|
|
75
|
+
<UploadCloud className="h-10 w-10 mx-auto text-muted-foreground" />
|
|
76
|
+
<p className="mt-2 text-sm text-muted-foreground">Click to upload video</p>
|
|
77
|
+
<p className="text-xs text-muted-foreground">Max {maxSizeMB}MB</p>
|
|
78
|
+
<input ref={inputRef} type="file" accept="video/*" className="hidden" onChange={handleFileChange} />
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
<FormMessage />
|
|
82
|
+
</FormItem>
|
|
83
|
+
)}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
export interface TextInputProps {
|
|
2
|
+
form?: any;
|
|
3
|
+
name?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
labelName?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
viewOnly?: boolean;
|
|
9
|
+
disableLabelFormatting?: boolean;
|
|
10
|
+
customMessage?: React.ReactNode;
|
|
11
|
+
isArray?: boolean;
|
|
12
|
+
leftIcon?: React.ReactNode;
|
|
13
|
+
rightIcon?: React.ReactNode;
|
|
14
|
+
value?: string;
|
|
15
|
+
setValue?: (value: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TextAreaInputProps {
|
|
19
|
+
form?: any;
|
|
20
|
+
name?: string;
|
|
21
|
+
labelName?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
viewOnly?: boolean;
|
|
26
|
+
rows?: number;
|
|
27
|
+
disableLabelFormatting?: boolean;
|
|
28
|
+
customMessage?: React.ReactNode;
|
|
29
|
+
value?: string;
|
|
30
|
+
setValue?: (value: string) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NumberInputProps {
|
|
34
|
+
form?: any;
|
|
35
|
+
name?: string;
|
|
36
|
+
labelName?: string;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
required?: boolean;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
viewOnly?: boolean;
|
|
41
|
+
disableLabelFormatting?: boolean;
|
|
42
|
+
numberType?: 'float' | 'integer';
|
|
43
|
+
customMessage?: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface PasswordInputProps {
|
|
47
|
+
form?: any;
|
|
48
|
+
name?: string;
|
|
49
|
+
labelName?: string;
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
required?: boolean;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
disableLabelFormatting?: boolean;
|
|
54
|
+
mode?: 'normal' | 'validate';
|
|
55
|
+
customMessage?: React.ReactNode;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SingleSelectProps {
|
|
59
|
+
form?: any;
|
|
60
|
+
name?: string;
|
|
61
|
+
labelName?: string;
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
required?: boolean;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
options?: string[];
|
|
66
|
+
viewOnly?: boolean;
|
|
67
|
+
isLoading?: boolean;
|
|
68
|
+
defaultValue?: any;
|
|
69
|
+
onValueChange?: (value: any) => void;
|
|
70
|
+
disableLabelFormatting?: boolean;
|
|
71
|
+
customMessage?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface SelectFieldProps {
|
|
75
|
+
form: any;
|
|
76
|
+
name: string;
|
|
77
|
+
labelName?: string;
|
|
78
|
+
required?: boolean;
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
options?: { value: string; label: string; image?: string; flag?: string; disabled?: boolean }[] | string[];
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
showSearch?: boolean;
|
|
83
|
+
type?: 'single' | 'multiple';
|
|
84
|
+
viewOnly?: boolean;
|
|
85
|
+
onValueChange?: (value: string | string[]) => void;
|
|
86
|
+
isLoading?: boolean;
|
|
87
|
+
onSearch?: (query: string) => void;
|
|
88
|
+
customMessage?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface SwitchProps {
|
|
92
|
+
form?: any;
|
|
93
|
+
name?: string;
|
|
94
|
+
labelName?: string;
|
|
95
|
+
required?: boolean;
|
|
96
|
+
disabled?: boolean;
|
|
97
|
+
viewOnly?: boolean;
|
|
98
|
+
disableLabelFormatting?: boolean;
|
|
99
|
+
customMessage?: React.ReactNode;
|
|
100
|
+
description?: string;
|
|
101
|
+
border?: boolean;
|
|
102
|
+
value?: boolean;
|
|
103
|
+
setValue?: (value: boolean) => void;
|
|
104
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface CheckboxProps {
|
|
108
|
+
form?: any;
|
|
109
|
+
name: string;
|
|
110
|
+
labelName?: string;
|
|
111
|
+
required?: boolean;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
options?: { label: string; value: string }[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface RadioProps {
|
|
117
|
+
form?: any;
|
|
118
|
+
name: string;
|
|
119
|
+
labelName?: string;
|
|
120
|
+
required?: boolean;
|
|
121
|
+
disabled?: boolean;
|
|
122
|
+
options?: { label: string; value: string }[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface DatePickerProps {
|
|
126
|
+
form?: any;
|
|
127
|
+
name?: string;
|
|
128
|
+
labelName?: string;
|
|
129
|
+
placeholder?: string;
|
|
130
|
+
required?: boolean;
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
viewOnly?: boolean;
|
|
133
|
+
disableLabelFormatting?: boolean;
|
|
134
|
+
customMessage?: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface PhoneNumberProps {
|
|
138
|
+
form?: any;
|
|
139
|
+
name?: string;
|
|
140
|
+
labelName?: string;
|
|
141
|
+
placeholder?: string;
|
|
142
|
+
required?: boolean;
|
|
143
|
+
disabled?: boolean;
|
|
144
|
+
viewOnly?: boolean;
|
|
145
|
+
disableLabelFormatting?: boolean;
|
|
146
|
+
customMessage?: string;
|
|
147
|
+
defaultCountry?: string;
|
|
148
|
+
disableCountryCode?: boolean;
|
|
149
|
+
disableDropdown?: boolean;
|
|
150
|
+
onValueChange?: (value: string) => void;
|
|
151
|
+
isLoading?: boolean;
|
|
152
|
+
hasPhone?: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface SearchFieldProps {
|
|
156
|
+
form?: any;
|
|
157
|
+
name?: string;
|
|
158
|
+
placeholder?: string;
|
|
159
|
+
onSearch?: (value: string) => void;
|
|
160
|
+
value?: string;
|
|
161
|
+
setValue?: (value: string) => void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface InputInterface {
|
|
165
|
+
Text: TextInputProps;
|
|
166
|
+
TextArea: TextAreaInputProps;
|
|
167
|
+
Number: NumberInputProps;
|
|
168
|
+
Password: PasswordInputProps;
|
|
169
|
+
SingleSelect: SingleSelectProps;
|
|
170
|
+
PhoneNumber: PhoneNumberProps;
|
|
171
|
+
Switch: SwitchProps;
|
|
172
|
+
DatePicker: DatePickerProps;
|
|
173
|
+
Search: SearchFieldProps;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface FieldPropsInterface {
|
|
177
|
+
form?: any;
|
|
178
|
+
name: string;
|
|
179
|
+
placeholder?: string;
|
|
180
|
+
labelName?: string;
|
|
181
|
+
description?: string;
|
|
182
|
+
border?: boolean;
|
|
183
|
+
options?: string[];
|
|
184
|
+
required?: boolean;
|
|
185
|
+
disabled?: boolean;
|
|
186
|
+
isArray?: boolean;
|
|
187
|
+
style?: string;
|
|
188
|
+
defaultValue?: any;
|
|
189
|
+
viewOnly?: boolean;
|
|
190
|
+
rows?: number;
|
|
191
|
+
disableLabelFormatting?: boolean;
|
|
192
|
+
maxLength?: number;
|
|
193
|
+
suffix?: string;
|
|
194
|
+
mode?: 'normal' | 'validate';
|
|
195
|
+
customMessage?: React.ReactNode;
|
|
196
|
+
onValueChange?: (value: any) => void;
|
|
197
|
+
isLoading?: boolean;
|
|
198
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Text } from "./assets/components/text-field.component";
|
|
2
|
+
import { TextArea } from "./assets/components/text-area-field.component";
|
|
3
|
+
import { Number } from "./assets/components/number-field.component";
|
|
4
|
+
import { StringNumber } from "./assets/components/string-number-field.component";
|
|
5
|
+
import { Password } from "./assets/components/password-field.component";
|
|
6
|
+
import { SingleSelectField } from "./assets/components/single-select-field.component";
|
|
7
|
+
import { SelectField } from "./assets/components/select-field.component";
|
|
8
|
+
import { SwitchField } from "./assets/components/switch-field.component";
|
|
9
|
+
import { RadioField } from "./assets/components/radio-field.component";
|
|
10
|
+
import { CheckField } from "./assets/components/check-field.component";
|
|
11
|
+
import { MultiCheckField } from "./assets/components/multi-check-field.component";
|
|
12
|
+
import { SingleCheckField } from "./assets/components/single-check-field.component";
|
|
13
|
+
import { SearchField } from "./assets/components/search-field.component";
|
|
14
|
+
import { DatePickerField } from "./assets/components/date-picker-field.component";
|
|
15
|
+
import { PhoneNumber } from "./assets/components/phone-number-field.component";
|
|
16
|
+
import { OTP } from "./assets/components/otp-field.component";
|
|
17
|
+
import { RangeDatePicker } from "./assets/components/range-date-picker.component";
|
|
18
|
+
import { LimitField } from "./assets/components/limit-field.component";
|
|
19
|
+
import { TextAreaWithFile } from "./assets/components/text-area-with-file.component";
|
|
20
|
+
import { UploadProfilePicture } from "./assets/components/upload-profile-picture.component";
|
|
21
|
+
import { UploadVideoFile } from "./assets/components/upload-video-file.component";
|
|
22
|
+
import { DynamicFileUploadField } from "./assets/components/dynamic-file-upload-field.component";
|
|
23
|
+
import { RichTextEditor } from "./assets/components/rich-text-editor.component";
|
|
24
|
+
import { TinyEditor } from "./assets/components/tiny-editor.component";
|
|
25
|
+
|
|
26
|
+
export const CustomField = {
|
|
27
|
+
Text,
|
|
28
|
+
TextArea,
|
|
29
|
+
Number,
|
|
30
|
+
StringNumber,
|
|
31
|
+
Password,
|
|
32
|
+
SingleSelectField,
|
|
33
|
+
SelectField,
|
|
34
|
+
SwitchField,
|
|
35
|
+
RadioField,
|
|
36
|
+
CheckField,
|
|
37
|
+
MultiCheckField,
|
|
38
|
+
SingleCheckField,
|
|
39
|
+
SearchField,
|
|
40
|
+
CommonSearch: SearchField,
|
|
41
|
+
DatePickerField,
|
|
42
|
+
RangeDatePicker,
|
|
43
|
+
PhoneNumber,
|
|
44
|
+
OTP,
|
|
45
|
+
LimitField,
|
|
46
|
+
TextAreaWithFile,
|
|
47
|
+
UploadProfilePicture,
|
|
48
|
+
UploadVideoFile,
|
|
49
|
+
DynamicFileUploadField,
|
|
50
|
+
RichTextEditor,
|
|
51
|
+
TinyEditor,
|
|
52
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
+
import { Button } from '@/components/ui/button.component';
|
|
5
|
+
import { cn } from '@/lib/utils.util';
|
|
6
|
+
|
|
7
|
+
interface PaginationProps {
|
|
8
|
+
currentPage: number;
|
|
9
|
+
totalPages: number;
|
|
10
|
+
setCurrentPage: (page: number) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function Pagination({ currentPage, totalPages, setCurrentPage }: PaginationProps) {
|
|
14
|
+
if (totalPages <= 1) return null;
|
|
15
|
+
|
|
16
|
+
const getPageNumbers = () => {
|
|
17
|
+
const pages: (number | 'ellipsis')[] = [];
|
|
18
|
+
const delta = 2;
|
|
19
|
+
const left = Math.max(2, currentPage - delta);
|
|
20
|
+
const right = Math.min(totalPages - 1, currentPage + delta);
|
|
21
|
+
|
|
22
|
+
pages.push(1);
|
|
23
|
+
if (left > 2) pages.push('ellipsis');
|
|
24
|
+
for (let i = left; i <= right; i++) pages.push(i);
|
|
25
|
+
if (right < totalPages - 1) pages.push('ellipsis');
|
|
26
|
+
if (totalPages > 1) pages.push(totalPages);
|
|
27
|
+
|
|
28
|
+
return pages;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="flex items-center justify-center gap-1">
|
|
33
|
+
<Button
|
|
34
|
+
variant="outline"
|
|
35
|
+
size="icon"
|
|
36
|
+
className="h-8 w-8"
|
|
37
|
+
disabled={currentPage <= 1}
|
|
38
|
+
onClick={() => setCurrentPage(currentPage - 1)}
|
|
39
|
+
>
|
|
40
|
+
<ChevronLeft className="h-4 w-4" />
|
|
41
|
+
</Button>
|
|
42
|
+
{getPageNumbers().map((page, idx) =>
|
|
43
|
+
page === 'ellipsis' ? (
|
|
44
|
+
<span key={`ellipsis-${idx}`} className="px-2 text-muted-foreground">...</span>
|
|
45
|
+
) : (
|
|
46
|
+
<Button
|
|
47
|
+
key={page}
|
|
48
|
+
variant={currentPage === page ? 'default' : 'outline'}
|
|
49
|
+
size="icon"
|
|
50
|
+
className="h-8 w-8"
|
|
51
|
+
onClick={() => setCurrentPage(page)}
|
|
52
|
+
>
|
|
53
|
+
{page}
|
|
54
|
+
</Button>
|
|
55
|
+
)
|
|
56
|
+
)}
|
|
57
|
+
<Button
|
|
58
|
+
variant="outline"
|
|
59
|
+
size="icon"
|
|
60
|
+
className="h-8 w-8"
|
|
61
|
+
disabled={currentPage >= totalPages}
|
|
62
|
+
onClick={() => setCurrentPage(currentPage + 1)}
|
|
63
|
+
>
|
|
64
|
+
<ChevronRight className="h-4 w-4" />
|
|
65
|
+
</Button>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
+
import { cn } from '@/lib/utils.util';
|
|
4
|
+
|
|
5
|
+
const Avatar = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<AvatarPrimitive.Root
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
));
|
|
15
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
16
|
+
|
|
17
|
+
const AvatarImage = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
20
|
+
>(({ className, ...props }, ref) => (
|
|
21
|
+
<AvatarPrimitive.Image ref={ref} className={cn('aspect-square h-full w-full', className)} {...props} />
|
|
22
|
+
));
|
|
23
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
24
|
+
|
|
25
|
+
const AvatarFallback = React.forwardRef<
|
|
26
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
27
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
28
|
+
>(({ className, ...props }, ref) => (
|
|
29
|
+
<AvatarPrimitive.Fallback
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cn('flex h-full w-full items-center justify-center rounded-full bg-muted', className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
));
|
|
35
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
36
|
+
|
|
37
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '@/lib/utils.util';
|
|
4
|
+
|
|
5
|
+
const badgeVariants = cva(
|
|
6
|
+
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
|
11
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
12
|
+
destructive: 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
13
|
+
outline: 'text-foreground',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: { variant: 'default' },
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export interface BadgeProps
|
|
21
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
22
|
+
VariantProps<typeof badgeVariants> {}
|
|
23
|
+
|
|
24
|
+
const Badge = ({ className, variant, ...props }: BadgeProps) => (
|
|
25
|
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '@/lib/utils.util';
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
'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',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
12
|
+
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
13
|
+
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
14
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
15
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
16
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: 'h-10 px-4 py-2',
|
|
20
|
+
sm: 'h-9 rounded-md px-3',
|
|
21
|
+
lg: 'h-11 rounded-md px-8',
|
|
22
|
+
icon: 'h-10 w-10',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: 'default',
|
|
27
|
+
size: 'default',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export interface ButtonProps
|
|
33
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
34
|
+
VariantProps<typeof buttonVariants> {
|
|
35
|
+
asChild?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
39
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
40
|
+
const Comp = asChild ? Slot : 'button';
|
|
41
|
+
return (
|
|
42
|
+
<Comp
|
|
43
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
44
|
+
ref={ref}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
Button.displayName = 'Button';
|
|
51
|
+
|
|
52
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cn } from '@/lib/utils.util';
|
|
3
|
+
|
|
4
|
+
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
5
|
+
({ className, ...props }, ref) => (
|
|
6
|
+
<div ref={ref} className={cn('rounded-lg border bg-card text-card-foreground shadow-sm', className)} {...props} />
|
|
7
|
+
)
|
|
8
|
+
);
|
|
9
|
+
Card.displayName = 'Card';
|
|
10
|
+
|
|
11
|
+
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
12
|
+
({ className, ...props }, ref) => (
|
|
13
|
+
<div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
CardHeader.displayName = 'CardHeader';
|
|
17
|
+
|
|
18
|
+
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
19
|
+
({ className, ...props }, ref) => (
|
|
20
|
+
<h3 ref={ref} className={cn('text-2xl font-semibold leading-none tracking-tight', className)} {...props} />
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
CardTitle.displayName = 'CardTitle';
|
|
24
|
+
|
|
25
|
+
const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
|
26
|
+
({ className, ...props }, ref) => (
|
|
27
|
+
<p ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
CardDescription.displayName = 'CardDescription';
|
|
31
|
+
|
|
32
|
+
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
33
|
+
({ className, ...props }, ref) => (
|
|
34
|
+
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
CardContent.displayName = 'CardContent';
|
|
38
|
+
|
|
39
|
+
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
40
|
+
({ className, ...props }, ref) => (
|
|
41
|
+
<div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
CardFooter.displayName = 'CardFooter';
|
|
45
|
+
|
|
46
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import { Check } from 'lucide-react';
|
|
4
|
+
import { cn } from '@/lib/utils.util';
|
|
5
|
+
|
|
6
|
+
const Checkbox = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<CheckboxPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
'peer h-4 w-4 shrink-0 rounded-sm border border-primary 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 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
|
|
19
|
+
<Check className="h-4 w-4" />
|
|
20
|
+
</CheckboxPrimitive.Indicator>
|
|
21
|
+
</CheckboxPrimitive.Root>
|
|
22
|
+
));
|
|
23
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
24
|
+
|
|
25
|
+
export { Checkbox };
|