gbs-add-block 0.0.90 → 0.0.93

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 CHANGED
@@ -1,4 +1,4 @@
1
- # GBS Building Blocks 2.0 (v0.0.90)
1
+ # GBS Building Blocks 2.0 (v0.0.93)
2
2
 
3
3
  Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
4
4
 
@@ -6,7 +6,7 @@ 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://blackmax-designs.gitbook.io/building-block-v2.0)
8
8
 
9
- ## What's New 🎉 (Ver 0.0.90)
9
+ ## What's New 🎉 (Ver 0.0.93)
10
10
 
11
11
  - Updated for bug fixes.
12
12
 
package/index.cjs CHANGED
@@ -27,7 +27,6 @@ const CONFIG = {
27
27
  "FormRenderer",
28
28
  "MaterialInput",
29
29
  "ContextMenu",
30
- "Skeleton",
31
30
  "Navbar",
32
31
  "DataGrid",
33
32
  "BreadCrumb",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbs-add-block",
3
- "version": "0.0.90",
3
+ "version": "0.0.93",
4
4
  "description": "React Component Library",
5
5
  "type": "module",
6
6
  "files": [
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, { useEffect, useRef } from "react";
8
+ import React, { useRef } from "react";
9
9
  import {
10
10
  useDatePickerState,
11
11
  useYearMonthNavigation,
@@ -15,7 +15,7 @@ import {
15
15
  applyScrollbarStyles,
16
16
  } from "@grampro/headless-helpers";
17
17
  import Icon from "../icon/Icon";
18
- import { calender, down, leftArrows, rightArrows, x } from "../icon/iconPaths";
18
+ import { calender, down, leftArrow, rightArrow, x } from "../icon/iconPaths";
19
19
  import type { DatePickerProps } from "./types";
20
20
  import { iconClass, popUp, primary } from "../globalStyle";
21
21
 
@@ -139,7 +139,7 @@ export const DatePicker = ({
139
139
  type="button"
140
140
  onClick={toggleDatepicker}
141
141
  disabled={disabled}
142
- className="flex items-center gap-2 w-full"
142
+ className="flex items-center gap-2 w-full cursor-pointer"
143
143
  >
144
144
  <Icon
145
145
  dimensions={{ width: "20", height: "20" }}
@@ -147,9 +147,11 @@ export const DatePicker = ({
147
147
  svgClass={iconClass["grey-common"]}
148
148
  />
149
149
  <span className={!selectedDate ? "text-gray-400 text-sm" : ""}>
150
- {selectedDate
151
- ? selectedDate.toLocaleDateString("en-GB")
152
- : placeholder}
150
+ {selectedDate ? (
151
+ <span className="text-sm">{selectedDate.toLocaleDateString("en-GB")}</span>
152
+ ) : (
153
+ placeholder
154
+ )}
153
155
  </span>
154
156
  </button>
155
157
 
@@ -173,33 +175,6 @@ export const DatePicker = ({
173
175
  {showDatepicker && !disabled && (
174
176
  <div className={popUp["pop-up-style"]}>
175
177
  <div className="flex justify-between items-center p-2">
176
- <button
177
- type="button"
178
- onClick={prevMonth}
179
- disabled={isAtYearLimit(
180
- "prev",
181
- currentMonth,
182
- currentYear,
183
- yearLimitStart,
184
- yearLimitEnd
185
- )}
186
- className={`text-gray-500 hover:text-gray-700 w-8 h-8 rounded-full flex items-center justify-center hover:bg-gray-100 ${
187
- isAtYearLimit(
188
- "prev",
189
- currentMonth,
190
- currentYear,
191
- yearLimitStart,
192
- yearLimitEnd
193
- )
194
- ? "opacity-50"
195
- : ""
196
- }`}
197
- >
198
- <Icon
199
- elements={leftArrows}
200
- svgClass={"stroke-black fill-none dark:stroke-white"}
201
- />
202
- </button>
203
178
  <div className="flex items-center space-x-2">
204
179
  <span className="text-md font-semibold">
205
180
  {new Date(currentYear, currentMonth).toLocaleString("default", {
@@ -215,36 +190,70 @@ export const DatePicker = ({
215
190
  <Icon
216
191
  elements={down}
217
192
  svgClass={"stroke-black fill-none dark:stroke-white"}
193
+ dimensions={{ width: "20", height: "20" }}
218
194
  />
219
195
  </button>
220
196
  </div>
221
- <button
222
- type="button"
223
- onClick={nextMonth}
224
- disabled={isAtYearLimit(
225
- "next",
226
- currentMonth,
227
- currentYear,
228
- yearLimitStart,
229
- yearLimitEnd
230
- )}
231
- className={`text-gray-500 hover:text-gray-700 w-8 h-8 rounded-full flex items-center justify-center hover:bg-gray-100 ${
232
- isAtYearLimit(
197
+
198
+ <div className="flex items-center space-x-2">
199
+ <button
200
+ type="button"
201
+ onClick={prevMonth}
202
+ disabled={isAtYearLimit(
203
+ "prev",
204
+ currentMonth,
205
+ currentYear,
206
+ yearLimitStart,
207
+ yearLimitEnd
208
+ )}
209
+ className={`text-gray-500 hover:text-gray-700 w-8 h-8 rounded-full flex items-center justify-center hover:bg-gray-100 ${
210
+ isAtYearLimit(
211
+ "prev",
212
+ currentMonth,
213
+ currentYear,
214
+ yearLimitStart,
215
+ yearLimitEnd
216
+ )
217
+ ? "opacity-50"
218
+ : ""
219
+ }`}
220
+ >
221
+ <Icon
222
+ elements={leftArrow}
223
+ svgClass={"stroke-black fill-none dark:stroke-white"}
224
+ dimensions={{ width: "20", height: "20" }}
225
+ />
226
+ </button>
227
+
228
+ <button
229
+ type="button"
230
+ onClick={nextMonth}
231
+ disabled={isAtYearLimit(
233
232
  "next",
234
233
  currentMonth,
235
234
  currentYear,
236
235
  yearLimitStart,
237
236
  yearLimitEnd
238
- )
239
- ? "opacity-50"
240
- : ""
241
- }`}
242
- >
243
- <Icon
244
- elements={rightArrows}
245
- svgClass={"stroke-black fill-none dark:stroke-white"}
246
- />
247
- </button>
237
+ )}
238
+ className={`text-gray-500 hover:text-gray-700 w-8 h-8 rounded-full flex items-center justify-center hover:bg-gray-100 ${
239
+ isAtYearLimit(
240
+ "next",
241
+ currentMonth,
242
+ currentYear,
243
+ yearLimitStart,
244
+ yearLimitEnd
245
+ )
246
+ ? "opacity-50"
247
+ : ""
248
+ }`}
249
+ >
250
+ <Icon
251
+ elements={rightArrow}
252
+ svgClass={"stroke-black fill-none dark:stroke-white"}
253
+ dimensions={{ width: "20", height: "20" }}
254
+ />
255
+ </button>
256
+ </div>
248
257
  </div>
249
258
  {showYearMonthPicker ? (
250
259
  <div className="flex p-2 h-[224px] scrollbar">
@@ -351,4 +360,4 @@ export const DatePicker = ({
351
360
  )}
352
361
  </div>
353
362
  );
354
- };
363
+ };
@@ -9,7 +9,7 @@ export const popUp = {
9
9
  };
10
10
 
11
11
  export const iconClass = {
12
- "grey-common": "h-4 w-4 stroke-gray-500 fill-none dark:stroke-black",
12
+ "grey-common": "h-4 w-4 stroke-gray-500 fill-none dark:stroke-white",
13
13
  "error-icon": "h-4 w-4 stroke-red-500 fill-none dark:stroke-red-500",
14
14
  };
15
15
 
@@ -1,95 +0,0 @@
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, { useMemo, memo } from "react";
9
-
10
- type SkeletonType = "text" | "circle" | "rectangle";
11
-
12
- interface SkeletonProps {
13
- type?: SkeletonType;
14
- lines?: number;
15
- height?: string | number;
16
- width?: string | number;
17
- className?: string;
18
- style?: React.CSSProperties;
19
- animationDuration?: number;
20
- keyframes?: string;
21
- }
22
-
23
- export const Skeleton: React.FC<SkeletonProps> = memo(
24
- ({
25
- type = "text",
26
- lines = 1,
27
- height,
28
- width,
29
- className = "",
30
- style = {},
31
- animationDuration = 1.5,
32
- keyframes = `
33
- @keyframes pulse {
34
- 0% { opacity: 0.6; }
35
- 50% { opacity: 1; }
36
- 100% { opacity: 0.6; }
37
- }
38
- `,
39
- }) => {
40
- const getStyle = useMemo(() => {
41
- const baseStyle: React.CSSProperties = {
42
- backgroundColor: "#e0e0e0",
43
- borderRadius: "4px",
44
- animation: `pulse ${animationDuration}s ease-in-out 0.5s infinite`,
45
- width: width || "100%",
46
- ...style,
47
- };
48
-
49
- switch (type) {
50
- case "text":
51
- return {
52
- ...baseStyle,
53
- height: height || "16px",
54
- marginBottom: "8px",
55
- };
56
- case "circle":
57
- return {
58
- ...baseStyle,
59
- height: height || "48px",
60
- width: width || "48px",
61
- borderRadius: "50%",
62
- };
63
- case "rectangle":
64
- return {
65
- ...baseStyle,
66
- height: height || "120px",
67
- };
68
- default:
69
- return baseStyle;
70
- }
71
- }, [type, height, width, style, animationDuration]);
72
-
73
- const renderLines = useMemo(() => {
74
- if (type !== "text" || lines <= 1) return null;
75
-
76
- return Array.from({ length: lines - 1 }, (_, index) => (
77
- <div
78
- key={index}
79
- className={`skeleton-line ${className}`}
80
- style={getStyle}
81
- />
82
- ));
83
- }, [type, lines, className, getStyle]);
84
-
85
- return (
86
- <div className="skeleton-wrapper" style={{ width: "100%" }}>
87
- <style>{keyframes}</style>
88
- <div className={`skeleton ${className}`} style={getStyle} />
89
- {renderLines}
90
- </div>
91
- );
92
- }
93
- );
94
-
95
- Skeleton.displayName = "Skeleton";