gbs-add-block 0.0.22 → 0.0.23-beta
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/index.js +6 -0
- package/package.json +1 -1
- package/source/components/select/index.tsx +13 -16
- package/source/components/select/style.ts +10 -0
- package/source/components/select/types.ts +2 -2
- package/source/globalStyle.ts +9 -0
- package/source/index.ts +0 -15
- package/source/types.ts +0 -108
package/index.js
CHANGED
|
@@ -59,6 +59,12 @@ function copyCommonFiles() {
|
|
|
59
59
|
fs.copySync(utilsSrc, utilsDest, { overwrite: true });
|
|
60
60
|
console.log(`utils.ts copied successfully to ${utilsDest}`);
|
|
61
61
|
|
|
62
|
+
// Copy GlobalStyles
|
|
63
|
+
const globalStyleSrc = path.join(SOURCE_PATH, "..", "globalStyle.ts");
|
|
64
|
+
const globalStyleDest = path.join(DEST_PATH, "globalStyle.ts");
|
|
65
|
+
fs.copySync(globalStyleSrc, globalStyleDest, { overwrite: true });
|
|
66
|
+
console.log(`utils.ts copied successfully to ${globalStyleDest}`);
|
|
67
|
+
|
|
62
68
|
// Copy icon folder
|
|
63
69
|
const iconSrc = path.join(SOURCE_PATH, "..", "icon");
|
|
64
70
|
const iconDest = path.join(DEST_PATH, "icon");
|
package/package.json
CHANGED
|
@@ -18,12 +18,9 @@ import React, {
|
|
|
18
18
|
import Icon from "../icon/Icon";
|
|
19
19
|
import { check, search, upDown, x } from "../icon/iconPaths";
|
|
20
20
|
import { getSourceData } from "../utils";
|
|
21
|
-
import type { SelectProps } from "./types";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value: string;
|
|
25
|
-
label: string;
|
|
26
|
-
}
|
|
21
|
+
import type { ItemsProps, SelectProps } from "./types";
|
|
22
|
+
import { selectStyle } from "./style";
|
|
23
|
+
import { popUp, primary } from "../../globalStyle";
|
|
27
24
|
|
|
28
25
|
const Select = forwardRef<any, SelectProps>((props, ref) => {
|
|
29
26
|
const {
|
|
@@ -149,12 +146,12 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
|
|
|
149
146
|
}));
|
|
150
147
|
|
|
151
148
|
return (
|
|
152
|
-
<div className="relative w-
|
|
149
|
+
<div className="relative w-96" ref={selectRef} id={id}>
|
|
153
150
|
<div className="w-full relative">
|
|
154
151
|
<button
|
|
155
|
-
className={
|
|
156
|
-
|
|
157
|
-
}
|
|
152
|
+
className={`${error ? primary["error-border"] : "border"} ${
|
|
153
|
+
selectStyle["select-button"]
|
|
154
|
+
}`}
|
|
158
155
|
onClick={togglePopover}
|
|
159
156
|
type="button"
|
|
160
157
|
>
|
|
@@ -166,7 +163,7 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
|
|
|
166
163
|
</button>
|
|
167
164
|
{selectedDisplay && (
|
|
168
165
|
<button
|
|
169
|
-
className="
|
|
166
|
+
className={selectStyle["selectedDisplay-Button"]}
|
|
170
167
|
onClick={clearSelected}
|
|
171
168
|
>
|
|
172
169
|
<Icon
|
|
@@ -175,13 +172,13 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
|
|
|
175
172
|
/>
|
|
176
173
|
</button>
|
|
177
174
|
)}
|
|
178
|
-
<p className="
|
|
175
|
+
<p className={primary["error-primary"]}>{error && error}</p>
|
|
179
176
|
</div>
|
|
180
177
|
|
|
181
178
|
{showPopover && (
|
|
182
|
-
<div className="
|
|
179
|
+
<div className={popUp["pop-up-style"]}>
|
|
183
180
|
{showSearch && (
|
|
184
|
-
<div className="
|
|
181
|
+
<div className={selectStyle["input-parent"]}>
|
|
185
182
|
<Icon
|
|
186
183
|
elements={search}
|
|
187
184
|
svgClass="stroke-gray-500 fill-none dark:stroke-white"
|
|
@@ -206,7 +203,7 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
|
|
|
206
203
|
filteredItems.map(({ value, label }) => (
|
|
207
204
|
<button
|
|
208
205
|
key={value}
|
|
209
|
-
className="
|
|
206
|
+
className={selectStyle["filter-button"]}
|
|
210
207
|
onClick={() => handleSelect(value)}
|
|
211
208
|
>
|
|
212
209
|
<Icon
|
|
@@ -228,4 +225,4 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
|
|
|
228
225
|
});
|
|
229
226
|
|
|
230
227
|
const MemoizedSelect = memo(Select);
|
|
231
|
-
export { MemoizedSelect as Select };
|
|
228
|
+
export { MemoizedSelect as Select };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const selectStyle = {
|
|
2
|
+
"select-button":
|
|
3
|
+
"flex items-center px-4 py-2 w-full justify-between rounded-lg font-medium text-sm dark:bg-black dark:border-white dark:text-white",
|
|
4
|
+
"filter-button":
|
|
5
|
+
"flex items-center w-full px-2 py-1 text-left hover:bg-blue-100 gap-2 rounded-lg mt-1 text-sm dark:hover:bg-blue-600",
|
|
6
|
+
"input-parent":
|
|
7
|
+
"flex p-2 gap-1 items-center sticky top-0 bg-white border-b dark:bg-black",
|
|
8
|
+
"selectedDisplay-Button":
|
|
9
|
+
"absolute right-8 top-0 h-full flex items-center px-2 z-20",
|
|
10
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const primary = {
|
|
2
|
+
"error-border": "border border-red-600",
|
|
3
|
+
"error-primary": "text-xs text-red-500",
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export const popUp = {
|
|
7
|
+
"pop-up-style":
|
|
8
|
+
"w-full absolute overflow-y-auto border px-2 rounded-lg mt-[1px] scrollbar bg-white z-50 scrollbar h-auto dark:bg-black dark:text-white animate-fade-down animate-once animate-duration-200",
|
|
9
|
+
};
|
package/source/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Re-Export Components here
|
|
2
|
-
export * from "./components/grid/Grid";
|
|
3
|
-
export * from "./components/datepicker";
|
|
4
|
-
export * from "./components/dialog";
|
|
5
|
-
export * from "./components/darkmode";
|
|
6
|
-
export * from "./components/select";
|
|
7
|
-
export * from "./components/input";
|
|
8
|
-
export * from "./components/button";
|
|
9
|
-
export * from "./components/multiselect";
|
|
10
|
-
export * from "./components/spinner";
|
|
11
|
-
export * from "./components/dialog";
|
|
12
|
-
export * from "./components/modal";
|
|
13
|
-
export * from "./components/toast";
|
|
14
|
-
export * from "./components/checkbox";
|
|
15
|
-
export { default as useToast } from "./components/toast/useToast";
|
package/source/types.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { InputHTMLAttributes } from "react";
|
|
2
|
-
|
|
3
|
-
// Sepecify types for components here
|
|
4
|
-
interface PageSettingsProps {
|
|
5
|
-
pageNumber: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type GridProps = {
|
|
9
|
-
dataSource: any[] | string;
|
|
10
|
-
columns?: any[];
|
|
11
|
-
pageSettings: PageSettingsProps;
|
|
12
|
-
enableSearch?: boolean;
|
|
13
|
-
lazy?: boolean;
|
|
14
|
-
enableExcelExport?: boolean;
|
|
15
|
-
excelName?: string;
|
|
16
|
-
enablePdfExport?: boolean;
|
|
17
|
-
pdfName?: string;
|
|
18
|
-
gridContainerClass?: string;
|
|
19
|
-
gridButtonClass?: string;
|
|
20
|
-
gridHeaderClass?: string;
|
|
21
|
-
gridGlobalSearchButtonClass?: string;
|
|
22
|
-
gridPaginationButtonClass?: string;
|
|
23
|
-
pdfOptions?: any;
|
|
24
|
-
isFetching?: boolean;
|
|
25
|
-
showPagination?: boolean;
|
|
26
|
-
selectAll?: boolean;
|
|
27
|
-
onSelectRow?: (value: any) => void;
|
|
28
|
-
tableHeaderStyle?: string;
|
|
29
|
-
gridColumnStyleSelectAll?: string;
|
|
30
|
-
gridColumnStyle?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type DatePickerProps = {
|
|
34
|
-
placeholder?: string | undefined;
|
|
35
|
-
selectedDate?: Date;
|
|
36
|
-
minDate?: Date | null;
|
|
37
|
-
maxDate?: Date | null;
|
|
38
|
-
yearLimitStart?: number;
|
|
39
|
-
yearLimitEnd?: number;
|
|
40
|
-
onDateChange?: any;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
interface ItemsProps {
|
|
44
|
-
value: string;
|
|
45
|
-
label: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type SelectProps = {
|
|
49
|
-
placeholder?: string;
|
|
50
|
-
items?: ItemsProps[] | string;
|
|
51
|
-
lazy?: boolean;
|
|
52
|
-
showSearch?: boolean;
|
|
53
|
-
onSelect?: any;
|
|
54
|
-
selectedItem?: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type InputProps = {
|
|
58
|
-
OTPField?: boolean;
|
|
59
|
-
OTPValue?: string;
|
|
60
|
-
OTPLength?: number;
|
|
61
|
-
OTPClass?: string;
|
|
62
|
-
onOTPValueChange?: (value: string) => void;
|
|
63
|
-
} & InputHTMLAttributes<HTMLInputElement>;
|
|
64
|
-
|
|
65
|
-
export type MultiSelectProps = {
|
|
66
|
-
placeholder?: string;
|
|
67
|
-
items?: ItemsProps[] | string;
|
|
68
|
-
lazy?: boolean;
|
|
69
|
-
showSearch?: boolean;
|
|
70
|
-
onSelect?: any;
|
|
71
|
-
truncate?: boolean;
|
|
72
|
-
selectedItems?: string[];
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type SpinnerProps = {
|
|
76
|
-
size?: string;
|
|
77
|
-
color?: string;
|
|
78
|
-
fullCircleColor?: string;
|
|
79
|
-
dotColor?: string;
|
|
80
|
-
duration?: string;
|
|
81
|
-
type?: "circle" | "circle-bg" | "dot" | "stroke";
|
|
82
|
-
strokeColor?: string;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export type ModalProps = {
|
|
86
|
-
showModal?: boolean;
|
|
87
|
-
modalTitle?: string;
|
|
88
|
-
autoclose?: boolean;
|
|
89
|
-
modalClass?: string;
|
|
90
|
-
modalContentClass?: string;
|
|
91
|
-
classModalContent?: string;
|
|
92
|
-
modalTitleClass?: string;
|
|
93
|
-
classModalTitle?: string;
|
|
94
|
-
children?: React.ReactNode;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export type DialogProps = {
|
|
98
|
-
showDialog?: boolean;
|
|
99
|
-
dialogMessage?: string;
|
|
100
|
-
dialogActionOne?: string;
|
|
101
|
-
dialogActionTwo?: string;
|
|
102
|
-
onDialogActionOneClick?: () => void;
|
|
103
|
-
onDialogActionTwoClick?: () => void;
|
|
104
|
-
dialogClass?: string;
|
|
105
|
-
dialogContentClass?: string;
|
|
106
|
-
dialogActionOneStyle?: string;
|
|
107
|
-
dialogActionTwoStyle?: string;
|
|
108
|
-
};
|