gbs-add-block 0.0.54 → 0.0.56

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.54)
1
+ # GBS Building Blocks 2.0 (v0.0.55)
2
2
 
3
3
  Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
4
4
 
@@ -6,10 +6,11 @@ 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.54)
9
+ ## What's New 🎉 (Ver 0.0.55)
10
10
 
11
11
  - Updated for more general installation methods
12
12
  - Fixed bug in Framework detection for more accuracy
13
+ - Style Update
13
14
 
14
15
  ## Authors
15
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbs-add-block",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "description": "React Component Library",
5
5
  "files": [
6
6
  "index.js",
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, { useRef } from "react";
8
+ import React, { useEffect, useRef } from "react";
9
9
  import {
10
10
  useDatePickerState,
11
11
  useYearMonthNavigation,
@@ -17,7 +17,7 @@ import {
17
17
  import Icon from "../icon/Icon";
18
18
  import { calender, down, leftArrows, rightArrows } from "../icon/iconPaths";
19
19
  import type { DatePickerProps } from "./types";
20
- import { primary } from "../globalStyle";
20
+ import { iconClass, popUp, primary } from "../globalStyle";
21
21
 
22
22
  export const DatePicker = ({
23
23
  selectedDateValue,
@@ -120,13 +120,13 @@ export const DatePicker = ({
120
120
  }
121
121
 
122
122
  return (
123
- <div className="relative inline-block w-full dark:bg-black" ref={dateRef}>
123
+ <div className="relative inline-block w-full" ref={dateRef}>
124
124
  <button
125
125
  type="button"
126
126
  onClick={toggleDatepicker}
127
127
  className={`${
128
128
  error ? primary["error-border"] : "border"
129
- } p-2 rounded-lg w-full flex items-center gap-2 dark:text-white ${
129
+ } p-2 rounded-lg w-full flex items-center gap-2 dark:text-white dark:bg-black ${
130
130
  disabled ? "opacity-50 cursor-not-allowed" : ""
131
131
  }`}
132
132
  disabled={disabled}
@@ -134,10 +134,12 @@ export const DatePicker = ({
134
134
  <Icon
135
135
  dimensions={{ width: "20", height: "20" }}
136
136
  elements={calender}
137
- svgClass={"stroke-gray-500 fill-none dark:stroke-white"}
137
+ svgClass={iconClass["grey-common"]}
138
138
  />
139
139
  <span className={!selectedDate ? "text-gray-400" : ""}>
140
- {selectedDate ? selectedDate.toLocaleDateString() : placeholder}
140
+ {selectedDate
141
+ ? selectedDate.toLocaleDateString("en-GB")
142
+ : placeholder}
141
143
  </span>
142
144
  </button>
143
145
  {error && <p className={primary["error-primary"]}>{error}</p>}
@@ -150,7 +152,7 @@ export const DatePicker = ({
150
152
  />
151
153
 
152
154
  {showDatepicker && !disabled && (
153
- <div className="absolute z-10 bg-white border border-gray-300 shadow-lg mt-1 w-full rounded dark:bg-black dark:text-white px-2">
155
+ <div className={popUp["pop-up-style"]}>
154
156
  <div className="flex justify-between items-center p-2">
155
157
  <button
156
158
  type="button"
@@ -237,7 +239,7 @@ export const DatePicker = ({
237
239
  onClick={() => selectYearMonth(currentYear, index)}
238
240
  className={`w-full text-left p-2 cursor-pointer rounded hover:bg-gray-200 transition duration-150 ease-in-out ${
239
241
  index === currentMonth
240
- ? "bg-black text-white hover:bg-blue-600"
242
+ ? "bg-black text-white dark:bg-zinc-500"
241
243
  : ""
242
244
  }`}
243
245
  >
@@ -256,7 +258,7 @@ export const DatePicker = ({
256
258
  onClick={() => selectYearMonth(year, currentMonth)}
257
259
  className={`w-full text-left p-2 cursor-pointer rounded hover:bg-gray-200 transition duration-150 ease-in-out ${
258
260
  year === currentYear
259
- ? "bg-black text-white hover:bg-blue-600"
261
+ ? "bg-black text-white dark:bg-zinc-500"
260
262
  : ""
261
263
  }`}
262
264
  >
@@ -296,7 +298,7 @@ export const DatePicker = ({
296
298
  disabled={isDisabled}
297
299
  className={`text-center p-1 w-8 h-8 cursor-pointer rounded-md hover:bg-gray-200 transition duration-150 ease-in-out ${
298
300
  isSelected
299
- ? "bg-black text-white hover:bg-gray-800 dark:bg-white"
301
+ ? "bg-black text-white hover:bg-gray-800 dark:bg-zinc-500"
300
302
  : ""
301
303
  } ${
302
304
  isDisabled
@@ -10,12 +10,13 @@ import { twMerge } from "tailwind-merge";
10
10
  import Icon from "../icon/Icon";
11
11
  import { eye } from "../icon/iconPaths";
12
12
  import type { InputProps } from "./types";
13
+ import { iconClass, inputStyles, primary } from "../globalStyle";
13
14
 
14
15
  export const Input = ({
15
16
  OTPField = false,
16
17
  OTPValue = "",
17
18
  OTPLength = 4,
18
- OTPClass = "w-8 h-10 m-1 border border-gray-600 rounded-lg text-center text-black",
19
+ OTPClass = inputStyles.otp,
19
20
  onOTPValueChange,
20
21
  error = undefined,
21
22
  ...props
@@ -24,11 +25,6 @@ export const Input = ({
24
25
  const [showPassword, setShowPassword] = useState(false);
25
26
  const inputRefs = useRef<(HTMLInputElement | null)[]>([]);
26
27
 
27
- const defaultClass = `bg-gray-100 p-2 rounded-lg ${
28
- error ? "border border-red-600" : ""
29
- }`;
30
-
31
- // This will update the OTP Field Value
32
28
  const updateOtpValue = (
33
29
  index: number,
34
30
  e: React.ChangeEvent<HTMLInputElement>
@@ -47,7 +43,6 @@ export const Input = ({
47
43
  }
48
44
  };
49
45
 
50
- // Function for handling keyboard navigation in OTP Field
51
46
  const handleKeydown = (
52
47
  index: number,
53
48
  e: React.KeyboardEvent<HTMLInputElement>
@@ -61,7 +56,6 @@ export const Input = ({
61
56
  }
62
57
  };
63
58
 
64
- // Password Feild Toggler
65
59
  const toggleTypeForPassword = () => {
66
60
  setShowPassword(!showPassword);
67
61
  };
@@ -69,34 +63,38 @@ export const Input = ({
69
63
  return (
70
64
  <div>
71
65
  {!OTPField ? (
72
- <div className="text-input-container w-full relative">
73
- <input
74
- className={twMerge(
75
- defaultClass,
76
- "w-full text-black focus:outline-blue-400"
66
+ <div className="text-input-container w-full relative flex flex-col">
67
+ <div className="relative">
68
+ <input
69
+ className={twMerge(
70
+ inputStyles.default,
71
+ error ? inputStyles.error : "",
72
+ "w-full text-black pr-10"
73
+ )}
74
+ {...props}
75
+ type={
76
+ props.type === "password" && showPassword ? "text" : props.type
77
+ }
78
+ />
79
+ {props.type === "password" && (
80
+ <button
81
+ type="button"
82
+ className="absolute inset-y-0 right-2 flex items-center"
83
+ onClick={toggleTypeForPassword}
84
+ >
85
+ <Icon
86
+ elements={eye}
87
+ svgClass={
88
+ error ? iconClass["error-icon"] : iconClass["grey-common"]
89
+ }
90
+ />
91
+ </button>
77
92
  )}
78
- {...props}
79
- type={
80
- props.type === "password" && showPassword ? "text" : props.type
81
- }
82
- />
83
- {/* If Type is password, this will show a password visible toggle button */}
84
- {props.type && props.type === "password" && (
85
- <button
86
- type="button"
87
- className="absolute inset-y-0 right-0 flex items-center pr-2"
88
- onClick={toggleTypeForPassword}
89
- >
90
- <Icon
91
- elements={eye}
92
- svgClass={"h-5 w-5 stroke-gray-500 fill-none dark:stroke-white"}
93
- />
94
- </button>
95
- )}
96
- {error && <div className="text-xs text-red-500">{error}</div>}
93
+ </div>
94
+ {error && <div className={primary["error-primary"]}>{error}</div>}
97
95
  </div>
98
96
  ) : (
99
- <div className="otp-container">
97
+ <div className={inputStyles.otpContainer}>
100
98
  {Array(OTPLength)
101
99
  .fill("")
102
100
  .map((_, index) => (
@@ -1,6 +1,6 @@
1
1
  export const primary = {
2
2
  "error-border": "border border-red-600",
3
- "error-primary": "text-xs text-red-500",
3
+ "error-primary": "text-xs text-red-500 pl-1",
4
4
  };
5
5
 
6
6
  export const popUp = {
@@ -9,5 +9,14 @@ 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-white",
12
+ "grey-common": "h-4 w-4 stroke-gray-500 fill-none dark:stroke-black",
13
+ "error-icon": "h-4 w-4 stroke-red-500 fill-none dark:stroke-red-500",
14
+ };
15
+
16
+ export const inputStyles = {
17
+ default: "bg-gray-100 p-2 rounded-lg focus:outline-black",
18
+ error: "border border-red-600",
19
+ otp: "w-8 h-10 m-1 border border-gray-600 rounded-lg text-center text-black",
20
+ passwordToggle: "absolute inset-y-0 right-0 flex items-center pr-2",
21
+ otpContainer: "otp-container",
13
22
  };