gbs-add-block 1.2.5 → 1.2.6
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/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/datepicker/index.tsx +2 -1
- 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 +2 -1
- package/source/components/multiselect/index.tsx +3 -2
- package/source/components/select/PortalDropDown.tsx +21 -5
- package/source/components/select/index.tsx +8 -6
- package/source/components/select/types.ts +2 -0
- 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/globalStyle.ts +60 -34
- package/source/icon/iconPaths.ts +6 -0
- package/source/theme.ts +40 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v1.2.
|
|
1
|
+
# GBS Building Blocks 2.0 (v1.2.6)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,10 +6,9 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
|
|
|
6
6
|
|
|
7
7
|
For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://gramprokit.vercel.app)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 1.2.
|
|
9
|
+
## What's New 🎉 (Ver 1.2.6)
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
- Data Grid Style Update
|
|
11
|
+
- UI Update (Canditate update for next major change 2.0.0)
|
|
13
12
|
|
|
14
13
|
## Authors
|
|
15
14
|
|
package/package.json
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gbs-add-block",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "React Component Library",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"index.cjs",
|
|
8
|
-
"source"
|
|
9
|
-
],
|
|
10
|
-
"engines": {
|
|
11
|
-
"node": ">=17"
|
|
12
|
-
},
|
|
13
|
-
"bin": {
|
|
14
|
-
"gbs-add-block": "index.cjs"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [],
|
|
20
|
-
"author": "Anandhu Remanan",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"fs-extra": "^11.0.4",
|
|
24
|
-
"path": "^0.12.7",
|
|
25
|
-
"yargs": "^17.7.2"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "gbs-add-block",
|
|
3
|
+
"version": "1.2.6",
|
|
4
|
+
"description": "React Component Library",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.cjs",
|
|
8
|
+
"source"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=17"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"gbs-add-block": "index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "Anandhu Remanan",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"fs-extra": "^11.0.4",
|
|
24
|
+
"path": "^0.12.7",
|
|
25
|
+
"yargs": "^17.7.2",
|
|
26
|
+
"@grampro/headless-helpers": "^1.0.21",
|
|
27
|
+
"tailwind-merge": "^3.6.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/fs-extra": "^11.0.4"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-dom": "^19.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,25 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
buttonClass
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
import { buttonStyles } from "../../globalStyle";
|
|
11
|
+
import type { ComponentSize, ComponentVariant } from "../../theme";
|
|
12
|
+
|
|
13
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
variant?: ComponentVariant;
|
|
16
|
+
size?: ComponentSize;
|
|
17
|
+
buttonClass?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Button = ({
|
|
21
|
+
children,
|
|
22
|
+
variant = "primary",
|
|
23
|
+
size = "md",
|
|
24
|
+
buttonClass,
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: ButtonProps) => {
|
|
28
|
+
return (
|
|
29
|
+
<button
|
|
30
|
+
className={twMerge(
|
|
31
|
+
buttonStyles.base,
|
|
32
|
+
buttonStyles.sizes[size],
|
|
33
|
+
buttonStyles.variants[variant],
|
|
34
|
+
className,
|
|
35
|
+
buttonClass
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</button>
|
|
41
|
+
);
|
|
25
42
|
};
|
|
@@ -1,10 +1,31 @@
|
|
|
1
|
-
import React, { type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import React, { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { cardStyles } from "../../globalStyle";
|
|
4
|
+
|
|
5
|
+
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
cardClass?: string;
|
|
8
|
+
interactive?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function Card({
|
|
12
|
+
children,
|
|
13
|
+
cardClass,
|
|
14
|
+
className,
|
|
15
|
+
interactive = false,
|
|
16
|
+
...props
|
|
17
|
+
}: CardProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={twMerge(
|
|
21
|
+
cardStyles.base,
|
|
22
|
+
interactive ? cardStyles.interactive : "",
|
|
23
|
+
className,
|
|
24
|
+
cardClass
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
10
31
|
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, { type InputHTMLAttributes } from "react";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { type InputHTMLAttributes } from "react";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
|
|
11
|
+
export const Checkbox = ({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: InputHTMLAttributes<HTMLInputElement>) => {
|
|
15
|
+
return (
|
|
16
|
+
<input
|
|
17
|
+
type="checkbox"
|
|
18
|
+
className={twMerge(
|
|
19
|
+
"h-5 w-5 cursor-pointer rounded border-slate-300 text-sky-600 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-55",
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
16
25
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import Icon from "../icon/Icon";
|
|
18
18
|
import { calender, down, leftArrow, rightArrow, x } from "../icon/iconPaths";
|
|
19
19
|
import type { DatePickerProps } from "./types";
|
|
20
|
-
import { iconClass, popUp, primary } from "
|
|
20
|
+
import { iconClass, popUp, primary } from "../../globalStyle";
|
|
21
21
|
|
|
22
22
|
export const DatePicker = ({
|
|
23
23
|
selectedDateValue,
|
|
@@ -362,3 +362,4 @@ export const DatePicker = ({
|
|
|
362
362
|
</div>
|
|
363
363
|
);
|
|
364
364
|
};
|
|
365
|
+
|
|
@@ -1,144 +1,142 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, { useState, useRef } from "react";
|
|
9
|
-
import { twMerge } from "tailwind-merge";
|
|
10
|
-
import Icon from "../icon/Icon";
|
|
11
|
-
import { eye, search } from "../icon/iconPaths";
|
|
12
|
-
import type { InputProps } from "./types";
|
|
13
|
-
import { iconClass, inputStyles, primary } from "
|
|
14
|
-
|
|
15
|
-
export const Input = ({
|
|
16
|
-
OTPField = false,
|
|
17
|
-
OTPValue = "",
|
|
18
|
-
OTPLength = 4,
|
|
19
|
-
OTPClass = inputStyles.otp,
|
|
20
|
-
onOTPValueChange,
|
|
21
|
-
error = undefined,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const [
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
newOtpValues
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { useState, useRef } from "react";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
import Icon from "../icon/Icon";
|
|
11
|
+
import { eye, search } from "../icon/iconPaths";
|
|
12
|
+
import type { InputProps } from "./types";
|
|
13
|
+
import { iconClass, inputStyles, primary } from "../../globalStyle";
|
|
14
|
+
|
|
15
|
+
export const Input = ({
|
|
16
|
+
OTPField = false,
|
|
17
|
+
OTPValue = "",
|
|
18
|
+
OTPLength = 4,
|
|
19
|
+
OTPClass = inputStyles.otp,
|
|
20
|
+
onOTPValueChange,
|
|
21
|
+
error = undefined,
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: InputProps) => {
|
|
25
|
+
const [otpValues, setOtpValues] = useState(new Array(OTPLength).fill(""));
|
|
26
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
27
|
+
const inputRefs = useRef<(HTMLInputElement | null)[]>([]);
|
|
28
|
+
|
|
29
|
+
const updateOtpValue = (
|
|
30
|
+
index: number,
|
|
31
|
+
e: React.ChangeEvent<HTMLInputElement>
|
|
32
|
+
) => {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
const input = e.target;
|
|
35
|
+
if (input) {
|
|
36
|
+
const newOtpValues = [...otpValues];
|
|
37
|
+
newOtpValues[index] = input.value;
|
|
38
|
+
setOtpValues(newOtpValues);
|
|
39
|
+
if (index < OTPLength - 1 && input.value) {
|
|
40
|
+
inputRefs.current[index + 1]?.focus();
|
|
41
|
+
}
|
|
42
|
+
OTPValue = newOtpValues.join("");
|
|
43
|
+
if (onOTPValueChange) onOTPValueChange(OTPValue);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handleKeydown = (
|
|
48
|
+
index: number,
|
|
49
|
+
e: React.KeyboardEvent<HTMLInputElement>
|
|
50
|
+
) => {
|
|
51
|
+
if (e.key === "Backspace" && otpValues[index] === "" && index > 0) {
|
|
52
|
+
inputRefs.current[index - 1]?.focus();
|
|
53
|
+
} else if (e.key === "ArrowLeft" && index > 0) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
inputRefs.current[index - 1]?.focus();
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
const inputEl = inputRefs.current[index - 1];
|
|
58
|
+
if (inputEl) {
|
|
59
|
+
const length = inputEl.value.length;
|
|
60
|
+
inputEl.setSelectionRange(length, length);
|
|
61
|
+
}
|
|
62
|
+
}, 0);
|
|
63
|
+
} else if (e.key === "ArrowRight" && index < OTPLength - 1) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
inputRefs.current[index + 1]?.focus();
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
const inputEl = inputRefs.current[index + 1];
|
|
68
|
+
if (inputEl) {
|
|
69
|
+
const length = inputEl.value.length;
|
|
70
|
+
inputEl.setSelectionRange(length, length);
|
|
71
|
+
}
|
|
72
|
+
}, 0);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const toggleTypeForPassword = () => {
|
|
77
|
+
setShowPassword(!showPassword);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div>
|
|
82
|
+
{!OTPField ? (
|
|
83
|
+
<div className="text-input-container relative flex w-full flex-col">
|
|
84
|
+
<div className="relative">
|
|
85
|
+
<input
|
|
86
|
+
className={twMerge(
|
|
87
|
+
inputStyles.default,
|
|
88
|
+
error ? inputStyles.error : "",
|
|
89
|
+
"w-full pr-10",
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
type={
|
|
94
|
+
props.type === "password" && showPassword ? "text" : props.type
|
|
95
|
+
}
|
|
96
|
+
/>
|
|
97
|
+
{props.type === "search" && (
|
|
98
|
+
<div className="absolute inset-y-0 right-2 flex items-center">
|
|
99
|
+
<Icon elements={search} svgClass={iconClass["grey-common"]} />
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
{props.type === "password" && (
|
|
103
|
+
<button
|
|
104
|
+
type="button"
|
|
105
|
+
className="absolute inset-y-0 right-2 flex items-center rounded-md p-1"
|
|
106
|
+
onClick={toggleTypeForPassword}
|
|
107
|
+
>
|
|
108
|
+
<Icon
|
|
109
|
+
elements={eye}
|
|
110
|
+
svgClass={
|
|
111
|
+
error ? iconClass["error-icon"] : iconClass["grey-common"]
|
|
112
|
+
}
|
|
113
|
+
/>
|
|
114
|
+
</button>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
{error && <div className={primary["error-primary"]}>{error}</div>}
|
|
118
|
+
</div>
|
|
119
|
+
) : (
|
|
120
|
+
<div className={inputStyles.otpContainer}>
|
|
121
|
+
{Array(OTPLength)
|
|
122
|
+
.fill("")
|
|
123
|
+
.map((_, index) => (
|
|
124
|
+
<input
|
|
125
|
+
key={index}
|
|
126
|
+
type="text"
|
|
127
|
+
maxLength={1}
|
|
128
|
+
pattern="[0-9]*"
|
|
129
|
+
value={otpValues[index]}
|
|
130
|
+
onChange={(e) => updateOtpValue(index, e)}
|
|
131
|
+
onKeyDown={(e) => handleKeydown(index, e)}
|
|
132
|
+
ref={(ref) => {
|
|
133
|
+
inputRefs.current[index] = ref;
|
|
134
|
+
}}
|
|
135
|
+
className={OTPClass}
|
|
136
|
+
/>
|
|
137
|
+
))}
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
144
142
|
};
|