gbs-add-block 1.2.5 → 1.2.7
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/README.md +3 -4
- package/index.cjs +1 -0
- package/package.json +36 -30
- package/source/components/button/index.tsx +41 -24
- package/source/components/card/index.tsx +30 -9
- package/source/components/checkbox/index.tsx +24 -15
- package/source/components/datagrid/context/GridContext.tsx +38 -17
- package/source/components/datagrid/createTemplate.tsx +2 -2
- package/source/components/datagrid/hooks/usePagination.ts +0 -8
- package/source/components/datagrid/hooks/useSearch.ts +3 -3
- package/source/components/datagrid/index.tsx +2 -1
- package/source/components/datagrid/layout/GridBody.tsx +7 -4
- package/source/components/datagrid/layout/GridPagination.tsx +3 -2
- package/source/components/datagrid/layout/GridToolbar.tsx +2 -1
- package/source/components/datagrid/type.ts +18 -2
- package/source/components/datepicker/index.tsx +7 -6
- package/source/components/input/index.tsx +141 -143
- package/source/components/modal/index.tsx +151 -139
- package/source/components/modal/types.ts +18 -16
- package/source/components/multiselect/PortalDropDown.tsx +1 -0
- package/source/components/multiselect/index.tsx +5 -4
- package/source/components/navbar/AuthSection.tsx +5 -5
- package/source/components/navbar/NavItemComponent.tsx +2 -2
- package/source/components/select/PortalDropDown.tsx +20 -4
- package/source/components/select/index.tsx +6 -4
- package/source/components/select/types.ts +2 -0
- package/source/components/spinner/index.tsx +2 -2
- package/source/components/tabs/index.tsx +70 -51
- package/source/components/tabs/types.ts +15 -14
- package/source/components/textarea/index.tsx +122 -149
- package/source/components/toast/ToastComponent.tsx +26 -25
- package/source/components/toast/ToastIcon.tsx +8 -8
- package/source/components/uploader/ProgressAnimation.tsx +2 -2
- package/source/components/uploader/UploadedFilePreview.tsx +1 -1
- package/source/components/uploader/index.tsx +1 -1
- package/source/components/uploader/uploaderIcon.tsx +1 -1
- package/source/globalStyle.ts +74 -35
- package/source/icon/iconPaths.ts +6 -0
- package/source/theme.ts +40 -0
|
@@ -7,35 +7,28 @@ interface ToastProps {
|
|
|
7
7
|
toast: Toast;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
default: "
|
|
12
|
-
success: "
|
|
13
|
-
error: "
|
|
14
|
-
warning: "
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
const toastAnimation = {
|
|
18
|
-
default: "",
|
|
19
|
-
error: "animate-shake animate-once animate-duration-200",
|
|
20
|
-
success: "animate-jump-in animate-once animate-duration-200",
|
|
21
|
-
warning: "animate-jump-in animate-once animate-duration-200",
|
|
10
|
+
const leftBorderColors = {
|
|
11
|
+
default: "border-l-zinc-550 dark:border-l-zinc-600",
|
|
12
|
+
success: "border-l-emerald-500",
|
|
13
|
+
error: "border-l-rose-500",
|
|
14
|
+
warning: "border-l-amber-500",
|
|
22
15
|
} as const;
|
|
23
16
|
|
|
24
17
|
const CloseButton = ({ onDismiss }: { onDismiss: () => void }) => (
|
|
25
18
|
<button
|
|
26
19
|
onClick={onDismiss}
|
|
27
|
-
className="shrink-0 rounded-
|
|
20
|
+
className="shrink-0 rounded-md p-1 transition-colors text-zinc-400 hover:text-zinc-900 dark:hover:text-white hover:bg-zinc-100 dark:hover:bg-zinc-900 focus:outline-none"
|
|
28
21
|
>
|
|
29
22
|
<svg
|
|
30
|
-
className="h-
|
|
23
|
+
className="h-3.5 w-3.5"
|
|
31
24
|
fill="none"
|
|
32
25
|
viewBox="0 0 24 24"
|
|
33
26
|
stroke="currentColor"
|
|
27
|
+
strokeWidth={2.5}
|
|
34
28
|
>
|
|
35
29
|
<path
|
|
36
30
|
strokeLinecap="round"
|
|
37
31
|
strokeLinejoin="round"
|
|
38
|
-
strokeWidth={2}
|
|
39
32
|
d="M6 18L18 6M6 6l12 12"
|
|
40
33
|
/>
|
|
41
34
|
</svg>
|
|
@@ -58,7 +51,7 @@ export function ToastComponent({ toast }: ToastProps) {
|
|
|
58
51
|
|
|
59
52
|
if (toast.content) {
|
|
60
53
|
return (
|
|
61
|
-
<div className="relative">
|
|
54
|
+
<div className="relative pointer-events-auto rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-4 shadow-lg">
|
|
62
55
|
{toast.content}
|
|
63
56
|
<div className="absolute top-2 right-2">
|
|
64
57
|
<CloseButton onDismiss={handleDismiss} />
|
|
@@ -67,32 +60,40 @@ export function ToastComponent({ toast }: ToastProps) {
|
|
|
67
60
|
);
|
|
68
61
|
}
|
|
69
62
|
|
|
63
|
+
const borderClass = leftBorderColors[toast.type || "default"];
|
|
64
|
+
|
|
70
65
|
return (
|
|
71
66
|
<div
|
|
72
67
|
className={`
|
|
73
|
-
${bgColors[toast.type || "default"]}
|
|
74
|
-
${toastAnimation[toast.type || "default"]}
|
|
75
68
|
transform transition-all duration-300 ease-in-out
|
|
76
|
-
pointer-events-auto relative flex w-full items-
|
|
77
|
-
overflow-hidden rounded-
|
|
69
|
+
pointer-events-auto relative flex w-full items-start justify-between
|
|
70
|
+
overflow-hidden rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 px-4 py-3.5 shadow-lg
|
|
71
|
+
border-l-4 ${borderClass}
|
|
72
|
+
animate-fade-in
|
|
78
73
|
`}
|
|
79
74
|
role="alert"
|
|
80
75
|
>
|
|
81
76
|
<div className="flex items-start gap-3 w-full">
|
|
82
|
-
<
|
|
83
|
-
|
|
77
|
+
<div className="mt-0.5 shrink-0">
|
|
78
|
+
<ToastIcon type={toast.type} />
|
|
79
|
+
</div>
|
|
80
|
+
<div className="flex-1 min-w-0">
|
|
84
81
|
{toast.title && (
|
|
85
|
-
<div className="font-
|
|
82
|
+
<div className="font-bold text-sm text-zinc-900 dark:text-white tracking-tight leading-none">
|
|
86
83
|
{toast.title}
|
|
87
84
|
</div>
|
|
88
85
|
)}
|
|
89
86
|
{toast.description && (
|
|
90
|
-
<div className="text-
|
|
87
|
+
<div className="text-xs font-medium text-zinc-500 dark:text-zinc-400 mt-1">
|
|
91
88
|
{toast.description}
|
|
92
89
|
</div>
|
|
93
90
|
)}
|
|
94
91
|
</div>
|
|
95
|
-
{toast.action
|
|
92
|
+
{toast.action && (
|
|
93
|
+
<div className="shrink-0 flex items-center gap-2">
|
|
94
|
+
{toast.action}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
96
97
|
<CloseButton onDismiss={handleDismiss} />
|
|
97
98
|
</div>
|
|
98
99
|
</div>
|
|
@@ -4,20 +4,20 @@ const ToastIcon = ({ type }: { type: Toast["type"] }) => {
|
|
|
4
4
|
if (!type) return null;
|
|
5
5
|
|
|
6
6
|
const iconColors = {
|
|
7
|
-
default: "text-
|
|
8
|
-
success: "text-
|
|
9
|
-
error: "text-
|
|
10
|
-
warning: "text-
|
|
7
|
+
default: "text-zinc-500",
|
|
8
|
+
success: "text-emerald-500",
|
|
9
|
+
error: "text-rose-500",
|
|
10
|
+
warning: "text-amber-500",
|
|
11
11
|
} as const;
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<div className={`h-5 w-5 ${iconColors[type]}`}>
|
|
14
|
+
<div className={`h-4.5 w-4.5 ${iconColors[type]}`}>
|
|
15
15
|
{type === "success" && (
|
|
16
16
|
<svg
|
|
17
17
|
viewBox="0 0 24 24"
|
|
18
18
|
fill="none"
|
|
19
19
|
stroke="currentColor"
|
|
20
|
-
strokeWidth="2"
|
|
20
|
+
strokeWidth="2.5"
|
|
21
21
|
>
|
|
22
22
|
<path
|
|
23
23
|
strokeLinecap="round"
|
|
@@ -31,7 +31,7 @@ const ToastIcon = ({ type }: { type: Toast["type"] }) => {
|
|
|
31
31
|
viewBox="0 0 24 24"
|
|
32
32
|
fill="none"
|
|
33
33
|
stroke="currentColor"
|
|
34
|
-
strokeWidth="2"
|
|
34
|
+
strokeWidth="2.5"
|
|
35
35
|
>
|
|
36
36
|
<path
|
|
37
37
|
strokeLinecap="round"
|
|
@@ -45,7 +45,7 @@ const ToastIcon = ({ type }: { type: Toast["type"] }) => {
|
|
|
45
45
|
viewBox="0 0 24 24"
|
|
46
46
|
fill="none"
|
|
47
47
|
stroke="currentColor"
|
|
48
|
-
strokeWidth="2"
|
|
48
|
+
strokeWidth="2.5"
|
|
49
49
|
>
|
|
50
50
|
<path
|
|
51
51
|
strokeLinecap="round"
|
|
@@ -30,7 +30,7 @@ const AestheticProcessingAnimationWithStyles = ({
|
|
|
30
30
|
progressPercentage,
|
|
31
31
|
}: AestheticProcessingAnimationProps) => (
|
|
32
32
|
<>
|
|
33
|
-
<style
|
|
33
|
+
<style dangerouslySetInnerHTML={{ __html: `
|
|
34
34
|
@keyframes processing {
|
|
35
35
|
0% {
|
|
36
36
|
transform: translateX(-100%);
|
|
@@ -42,7 +42,7 @@ const AestheticProcessingAnimationWithStyles = ({
|
|
|
42
42
|
.animate-processing {
|
|
43
43
|
animation: processing 2s ease-in-out infinite;
|
|
44
44
|
}
|
|
45
|
-
`}
|
|
45
|
+
` }} />
|
|
46
46
|
<AestheticProcessingAnimation progressPercentage={progressPercentage} />
|
|
47
47
|
</>
|
|
48
48
|
);
|
|
@@ -105,7 +105,7 @@ export default function UploadedFilePreview({
|
|
|
105
105
|
<Icon
|
|
106
106
|
dimensions={{ width: "18", height: "18" }}
|
|
107
107
|
elements={cloudDownload}
|
|
108
|
-
svgClass={"stroke-
|
|
108
|
+
svgClass={"stroke-zinc-700 dark:stroke-zinc-400 fill-none"}
|
|
109
109
|
/>
|
|
110
110
|
</button>
|
|
111
111
|
{isRemovable && (
|
|
@@ -223,7 +223,7 @@ export const FileUploader = ({
|
|
|
223
223
|
ref={dropZoneRef}
|
|
224
224
|
className={`flex flex-col items-center border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${
|
|
225
225
|
isDragging
|
|
226
|
-
? "border-
|
|
226
|
+
? "border-black bg-zinc-50 dark:border-white dark:bg-zinc-900"
|
|
227
227
|
: "border-gray-300 hover:border-gray-400"
|
|
228
228
|
}`}
|
|
229
229
|
onClick={() => fileInputRef.current.click()}
|
|
@@ -27,7 +27,7 @@ export const GetFileIcon = ({ file, showImagePreview, previewUrls }: any) => {
|
|
|
27
27
|
<Icon
|
|
28
28
|
dimensions={{ width: "26", height: "26" }}
|
|
29
29
|
elements={fileimage}
|
|
30
|
-
svgClass={"stroke-
|
|
30
|
+
svgClass={"stroke-zinc-500 fill-none dark:stroke-white"}
|
|
31
31
|
/>
|
|
32
32
|
);
|
|
33
33
|
if (file.type === "application/pdf" || file.type.includes("pdf"))
|
package/source/globalStyle.ts
CHANGED
|
@@ -1,35 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
import { getComponentPreset } from "./theme";
|
|
2
|
+
|
|
3
|
+
const preset = getComponentPreset();
|
|
4
|
+
|
|
5
|
+
export const primary = {
|
|
6
|
+
"error-border": "border border-rose-500 focus-within:border-rose-500",
|
|
7
|
+
"error-primary": `${preset.text.error} mt-1 pl-1`,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const popUp = {
|
|
11
|
+
"pop-up-style": `${preset.surface.overlay} w-full absolute overflow-y-auto rounded-lg mt-1 scrollbar z-[90] h-44 text-sm text-slate-700 dark:text-slate-100 animate-fade-down animate-once animate-duration-200`,
|
|
12
|
+
"pop-up-style-calender": `${preset.surface.overlay} w-full absolute overflow-y-auto rounded-lg mt-1 scrollbar z-[90] h-[370px] text-slate-700 dark:text-slate-100 animate-fade-down animate-once animate-duration-200`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const iconClass = {
|
|
16
|
+
"grey-common": "h-4 w-4 stroke-slate-500 fill-none dark:stroke-slate-300",
|
|
17
|
+
"error-icon": "h-4 w-4 stroke-rose-500 fill-none dark:stroke-rose-400",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const inputStyles = {
|
|
21
|
+
default: `${preset.control} ${preset.radius} ${preset.focusRing} px-3 py-2 text-sm shadow-sm`,
|
|
22
|
+
error: "border-rose-500 focus-visible:ring-rose-500",
|
|
23
|
+
otp: `${preset.control} ${preset.radius} ${preset.focusRing} m-1 h-10 w-9 text-center text-sm font-semibold`,
|
|
24
|
+
passwordToggle: "absolute inset-y-0 right-0 flex items-center pr-2",
|
|
25
|
+
otpContainer: "otp-container flex items-center gap-1",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const selectStyle = {
|
|
29
|
+
"select-button": `${preset.control} ${preset.radius} ${preset.focusRing} flex min-h-10 w-full items-center justify-between gap-2 px-3 py-2 text-left text-sm font-medium shadow-sm`,
|
|
30
|
+
"filter-button":
|
|
31
|
+
"mt-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-zinc-700 transition-colors hover:bg-zinc-100 hover:text-black dark:text-zinc-300 dark:hover:bg-zinc-900 dark:hover:text-white",
|
|
32
|
+
"input-parent":
|
|
33
|
+
"sticky top-0 z-50 flex w-full items-center gap-1 border-b border-zinc-200 bg-white px-1 py-1 text-sm dark:border-zinc-800 dark:bg-zinc-950",
|
|
34
|
+
"selectedDisplay-Button":
|
|
35
|
+
"absolute right-8 top-1/2 z-20 flex -translate-y-1/2 items-center rounded-md p-1 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-800",
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const buttonStyles = {
|
|
39
|
+
base: `${preset.radius} ${preset.focusRing} ${preset.disabled} inline-flex items-center justify-center gap-2 font-medium transition-colors`,
|
|
40
|
+
sizes: {
|
|
41
|
+
sm: "h-8 px-3 text-xs",
|
|
42
|
+
md: "h-10 px-4 text-sm",
|
|
43
|
+
lg: "h-11 px-5 text-base",
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
primary:
|
|
47
|
+
"bg-black text-white hover:bg-zinc-900 dark:bg-white dark:text-black dark:hover:bg-zinc-100",
|
|
48
|
+
secondary:
|
|
49
|
+
"bg-zinc-900 text-white hover:bg-zinc-850 dark:bg-zinc-100 dark:text-black dark:hover:bg-zinc-200",
|
|
50
|
+
outline:
|
|
51
|
+
"border border-zinc-300 bg-white text-zinc-900 hover:bg-zinc-50 dark:border-zinc-850 dark:bg-black dark:text-zinc-100 dark:hover:bg-zinc-900",
|
|
52
|
+
ghost:
|
|
53
|
+
"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-900",
|
|
54
|
+
danger: "bg-rose-600 text-white hover:bg-rose-700",
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const cardStyles = {
|
|
59
|
+
base: `${preset.surface.raised} rounded-lg p-4`,
|
|
60
|
+
interactive: "transition-shadow hover:shadow-md hover:shadow-zinc-950/10",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const gridStyles = {
|
|
64
|
+
container: `${preset.surface.raised} flex flex-col rounded-md overflow-hidden dark:text-white`,
|
|
65
|
+
toolbar: `flex bg-white dark:bg-black justify-end space-x-2 px-4 py-3 border-b border-zinc-200 dark:border-zinc-900`,
|
|
66
|
+
pagination: `w-full flex flex-wrap justify-between items-center text-xs px-4 py-3 bg-white dark:bg-black gap-2 md:gap-4 border-t border-zinc-200 dark:border-zinc-900`,
|
|
67
|
+
tableHeader: `bg-zinc-50 dark:bg-zinc-950 text-zinc-900 dark:text-zinc-100 font-bold border-b border-zinc-200 dark:border-zinc-900 px-4 py-3 text-left text-xs uppercase tracking-wider`,
|
|
68
|
+
button: `border border-zinc-300 dark:border-zinc-800 bg-white dark:bg-zinc-950 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-900 rounded px-3 py-1.5 text-xs font-semibold cursor-pointer transition`,
|
|
69
|
+
rowEven:
|
|
70
|
+
"bg-white dark:bg-black hover:bg-zinc-50/50 dark:hover:bg-zinc-900/60 transition-colors text-black dark:text-white",
|
|
71
|
+
rowOdd:
|
|
72
|
+
"bg-zinc-50/20 dark:bg-zinc-950/20 hover:bg-zinc-50/50 dark:hover:bg-zinc-900/60 transition-colors",
|
|
73
|
+
rowSelected: "bg-zinc-100 dark:bg-zinc-900 font-semibold",
|
|
74
|
+
};
|
package/source/icon/iconPaths.ts
CHANGED
package/source/theme.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type ComponentPresetId = "gbs-basic";
|
|
2
|
+
|
|
3
|
+
export type ComponentSize = "sm" | "md" | "lg";
|
|
4
|
+
|
|
5
|
+
export type ComponentVariant =
|
|
6
|
+
| "primary"
|
|
7
|
+
| "secondary"
|
|
8
|
+
| "outline"
|
|
9
|
+
| "ghost"
|
|
10
|
+
| "danger";
|
|
11
|
+
|
|
12
|
+
export const defaultPresetId: ComponentPresetId = "gbs-basic";
|
|
13
|
+
|
|
14
|
+
export const componentPresets = {
|
|
15
|
+
"gbs-basic": {
|
|
16
|
+
id: "gbs-basic",
|
|
17
|
+
radius: "rounded-lg",
|
|
18
|
+
focusRing:
|
|
19
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black dark:focus-visible:ring-white focus-visible:ring-offset-2",
|
|
20
|
+
disabled: "disabled:cursor-not-allowed disabled:opacity-55",
|
|
21
|
+
text: {
|
|
22
|
+
label: "text-sm font-medium text-zinc-700 dark:text-zinc-300",
|
|
23
|
+
helper: "text-xs text-zinc-500",
|
|
24
|
+
error: "text-xs font-medium text-rose-600",
|
|
25
|
+
},
|
|
26
|
+
surface: {
|
|
27
|
+
raised:
|
|
28
|
+
"border border-zinc-200 bg-white shadow-sm shadow-zinc-950/5 dark:border-zinc-900 dark:bg-black",
|
|
29
|
+
subtle:
|
|
30
|
+
"border border-zinc-200 bg-zinc-50 dark:border-zinc-900 dark:bg-zinc-950",
|
|
31
|
+
overlay:
|
|
32
|
+
"border border-zinc-200 bg-white shadow-xl shadow-zinc-950/10 dark:border-zinc-900 dark:bg-zinc-950",
|
|
33
|
+
},
|
|
34
|
+
control:
|
|
35
|
+
"border border-zinc-300 bg-white text-zinc-900 transition-colors placeholder:text-zinc-400 hover:border-zinc-400 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100",
|
|
36
|
+
},
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
export const getComponentPreset = (presetId: ComponentPresetId = defaultPresetId) =>
|
|
40
|
+
componentPresets[presetId] || componentPresets[defaultPresetId];
|