gbs-add-block 0.0.21 → 0.0.23-01-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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbs-add-block",
3
- "version": "0.0.21",
3
+ "version": "0.0.23-01-beta",
4
4
  "description": "React Component Library",
5
5
  "files": [
6
6
  "index.js",
@@ -18,15 +18,14 @@ 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
- interface ItemsProps {
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 {
27
+ id = "",
28
+ name = "",
30
29
  placeholder = "Select an Item...",
31
30
  items,
32
31
  lazy = false,
@@ -34,6 +33,7 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
34
33
  onSelect,
35
34
  selectedItem: initialSelectedItem,
36
35
  error = undefined,
36
+ onFiltering,
37
37
  } = props;
38
38
 
39
39
  const [showPopover, setShowPopover] = useState(false);
@@ -146,12 +146,12 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
146
146
  }));
147
147
 
148
148
  return (
149
- <div className="relative w-full" ref={selectRef}>
149
+ <div className="relative w-96" ref={selectRef} id={id}>
150
150
  <div className="w-full relative">
151
151
  <button
152
- className={`flex items-center ${
153
- error ? "border border-red-600" : "border"
154
- } px-4 py-2 w-full justify-between rounded-lg font-medium text-sm dark:bg-black dark:border-white dark:text-white`}
152
+ className={`${error ? primary["error-border"] : "border"} ${
153
+ selectStyle["select-button"]
154
+ }`}
155
155
  onClick={togglePopover}
156
156
  type="button"
157
157
  >
@@ -163,7 +163,7 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
163
163
  </button>
164
164
  {selectedDisplay && (
165
165
  <button
166
- className="absolute right-8 top-0 h-full flex items-center px-2 z-20"
166
+ className={selectStyle["selectedDisplay-Button"]}
167
167
  onClick={clearSelected}
168
168
  >
169
169
  <Icon
@@ -172,13 +172,13 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
172
172
  />
173
173
  </button>
174
174
  )}
175
- <p className="text-xs text-red-500">{error && error}</p>
175
+ <p className={primary["error-primary"]}>{error && error}</p>
176
176
  </div>
177
177
 
178
178
  {showPopover && (
179
- <div className="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">
179
+ <div className={popUp["pop-up-style"]}>
180
180
  {showSearch && (
181
- <div className="flex p-2 gap-1 items-center sticky top-0 bg-white border-b dark:bg-black">
181
+ <div className={selectStyle["input-parent"]}>
182
182
  <Icon
183
183
  elements={search}
184
184
  svgClass="stroke-gray-500 fill-none dark:stroke-white"
@@ -192,7 +192,10 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
192
192
  className="w-full outline-none dark:bg-black"
193
193
  ref={inputRef}
194
194
  value={searchTerm}
195
- onChange={(e) => setSearchTerm(e.target.value)}
195
+ onChange={(e) => {
196
+ setSearchTerm(e.target.value);
197
+ if (onFiltering) onFiltering(e.target.value);
198
+ }}
196
199
  />
197
200
  </div>
198
201
  )}
@@ -200,7 +203,7 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
200
203
  filteredItems.map(({ value, label }) => (
201
204
  <button
202
205
  key={value}
203
- className="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"
206
+ className={selectStyle["filter-button"]}
204
207
  onClick={() => handleSelect(value)}
205
208
  >
206
209
  <Icon
@@ -222,4 +225,4 @@ const Select = forwardRef<any, SelectProps>((props, ref) => {
222
225
  });
223
226
 
224
227
  const MemoizedSelect = memo(Select);
225
- 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
+ };
@@ -1,13 +1,17 @@
1
- interface ItemsProps {
1
+ export type ItemsProps = {
2
2
  value: string;
3
3
  label: string;
4
- }
4
+ };
5
5
 
6
6
  export type SelectProps = {
7
+ id?: string;
8
+ name?: string;
9
+ error?: undefined | string;
7
10
  placeholder?: string;
8
11
  items?: ItemsProps[] | string;
9
12
  lazy?: boolean;
10
13
  showSearch?: boolean;
11
14
  onSelect?: any;
12
15
  selectedItem?: string;
16
+ onFiltering?: any;
13
17
  };
@@ -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
- };