react-core-ts 1.3.13 → 1.3.15

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.
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { TextAreaProps } from './commontypes';
1
+ import React from "react";
2
+ import { TextAreaProps } from "./commontypes";
3
3
  declare const ModernTextArea: React.FC<TextAreaProps>;
4
4
  export default ModernTextArea;
@@ -66,7 +66,7 @@ var ModernTextArea = function (_a) {
66
66
  setIsDisabled(disabled);
67
67
  }, [disabled]);
68
68
  var getErrors = function (err) {
69
- var errMsg = '';
69
+ var errMsg = "";
70
70
  if (err.message) {
71
71
  errMsg = err === null || err === void 0 ? void 0 : err.message;
72
72
  }
@@ -75,15 +75,15 @@ var ModernTextArea = function (_a) {
75
75
  var generateClassName = function (type) {
76
76
  var className = "resize-none ".concat(propsClassName);
77
77
  switch (type) {
78
- case 'input':
79
- className += " block text-common text-input-text font-normal px-3.5 py-2 w-full text-sm text-gray-900 bg-transparent border appearance-none focus:outline-none focus:ring-0 peer rounded-[4px] disabled:text-input-disabled disabled:bg-disabled ".concat(hideLabel ? '' : 'placeholder-transparent', " focus:placeholder-grey-secondary");
78
+ case "input":
79
+ className += " block text-common text-input-text font-normal px-3.5 py-2 w-full text-sm text-gray-900 bg-transparent border appearance-none focus:outline-none focus:ring-0 peer rounded-[4px] disabled:text-input-disabled disabled:bg-disabled ".concat(hideLabel ? "" : "placeholder-transparent", " focus:placeholder-grey-secondary");
80
80
  if (errors && errors[name]) {
81
81
  className +=
82
- ' border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 ';
82
+ " border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 ";
83
83
  }
84
84
  else {
85
85
  className +=
86
- ' text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0';
86
+ " text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0";
87
87
  }
88
88
  break;
89
89
  // case 'label': // changes made for remove bg-white from placeolder is field disable and or with data
@@ -108,27 +108,29 @@ var ModernTextArea = function (_a) {
108
108
  // className += ' text-grey-dark peer-focus:text-blue-navy';
109
109
  // }
110
110
  // break;
111
- case 'label': // changes made for remove bg-white from placeolder is field disable and or with data
112
- className += " modern-input-label peer-focus:modern-input-peer-focus-label-size absolute duration-300 transform -translate-y-4 top-2 z-1 origin-[0] px-0 \n peer-placeholder-shown:-translate-y-1/4 peer-placeholder-shown:top-1/4 peer-focus:top-1\n peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto ".concat(isDisabled ? 'cursor-pointer' : 'cursor-text peer-focus:cursor-pointer', " ").concat(!isDisabled || !checkIsEmptyField()
113
- ? 'active-input-label-bg'
111
+ case "label": // changes made for remove bg-white from placeolder is field disable and or with data
112
+ className += "modern-input-label peer-focus:modern-input-peer-focus-label-size absolute duration-300 transform -translate-y-4 top-1.5 z-1 origin-[0] px-0 \n peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/6 rtl:peer-focus:left-auto \n peer-placeholder-shown:translate-y-2 peer-placeholder-shown:top-[2px] peer-focus:top-1.5 peer-focus:-translate-y-4\" ".concat(isDisabled
113
+ ? "cursor-pointer"
114
+ : "cursor-text peer-focus:cursor-pointer", " ").concat(!isDisabled || !checkIsEmptyField()
115
+ ? "active-input-label-bg"
114
116
  : isDisabled && !checkIsEmptyField()
115
- ? 'disabled-input-label-bg'
116
- : '', " ").concat(checkIsEmptyField()
117
- ? 'modern-input-label-size'
118
- : 'modern-input-peer-focus-label-size');
117
+ ? "disabled-input-label-bg"
118
+ : "", " ").concat(checkIsEmptyField()
119
+ ? "modern-input-label-size"
120
+ : "modern-input-peer-focus-label-size");
119
121
  if (errors && errors[name]) {
120
- className += ' text-error-light ';
122
+ className += " text-error-light ";
121
123
  }
122
124
  else {
123
- className += ' text-grey-dark peer-focus:text-blue-navy';
125
+ className += " text-grey-dark peer-focus:text-blue-navy";
124
126
  }
125
127
  break;
126
- case 'message':
127
- className = ' text-error-icon ';
128
+ case "message":
129
+ className = " text-error-icon ";
128
130
  break;
129
- case 'adorement':
131
+ case "adorement":
130
132
  className +=
131
- ' absolute right-0 py-4 adorement gap-1 flex items-center ';
133
+ " absolute right-0 py-4 adorement gap-1 flex items-center ";
132
134
  break;
133
135
  default:
134
136
  break;
@@ -145,25 +147,25 @@ var ModernTextArea = function (_a) {
145
147
  // }
146
148
  var handleError = function (data) {
147
149
  var _a;
148
- if (getErrors(data[name]) === 'required' ||
149
- getErrors(data[name]) === 'Required') {
150
+ if (getErrors(data[name]) === "required" ||
151
+ getErrors(data[name]) === "Required") {
150
152
  return "".concat(label, " is ").concat(getErrors(data[name]));
151
153
  }
152
154
  else {
153
- return (_a = getErrors(data[name])) !== null && _a !== void 0 ? _a : '';
155
+ return (_a = getErrors(data[name])) !== null && _a !== void 0 ? _a : "";
154
156
  }
155
157
  };
156
158
  var textFieldRef = (0, react_1.useRef)(null); // Ref for the text field div
157
159
  (0, react_1.useEffect)(function () {
158
160
  (0, getPosition_1.applyPositionClass)(textFieldRef, isHovered);
159
161
  }, [isHovered]);
160
- return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: textFieldRef, className: " ".concat(fullwidth ? 'w-full' : 'w-auto') }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "tooltip-container" }, { children: [isHovered && errors && errors[name] && ((0, jsx_runtime_1.jsx)("span", __assign({ className: "tooltip" }, { children: errors && handleError(errors) }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "flex relative ".concat(fullwidth ? 'w-full' : 'w-auto') }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "relative w-full" }, { children: [(0, jsx_runtime_1.jsx)("textarea", __assign({ id: id, ref: inputRef, disabled: isDisabled, "data-testid": "textarea" }, register === null || register === void 0 ? void 0 : register(name, { required: required }), { placeholder: placeholder || label, rows: rows || 5, onChange: onChange, value: value, style: {
162
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: textFieldRef, className: " ".concat(fullwidth ? "w-full" : "w-auto") }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "tooltip-container" }, { children: [isHovered && errors && errors[name] && ((0, jsx_runtime_1.jsx)("span", __assign({ className: "tooltip" }, { children: errors && handleError(errors) }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "flex relative ".concat(fullwidth ? "w-full" : "w-auto") }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "relative w-full" }, { children: [(0, jsx_runtime_1.jsx)("textarea", __assign({ id: id, ref: inputRef, disabled: isDisabled, "data-testid": "textarea" }, register === null || register === void 0 ? void 0 : register(name, { required: required }), { placeholder: placeholder || label, rows: rows || 5, onChange: onChange, value: value, style: {
161
163
  paddingRight: (0, generateInnerWidth_1.getInnerWidth)(adorementRef, 11),
162
164
  height: boxHeight !== null && boxHeight !== void 0 ? boxHeight : undefined,
163
165
  minHeight: boxMinHeight !== null && boxMinHeight !== void 0 ? boxMinHeight : undefined,
164
- }, autoComplete: autoComplete ? 'on' : 'off',
166
+ }, autoComplete: autoComplete ? "on" : "off",
165
167
  // autoFocus={autoFocus}
166
- className: generateClassName('input') })), !hideLabel && ((0, jsx_runtime_1.jsxs)("label", __assign({ htmlFor: id, onClick: function () { return onLabelClick(); }, className: generateClassName('label') }, { children: [label, required ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-error" }, { children: " *" })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })))] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: generateClassName('adorement'), ref: adorementRef }, { children: errors && errors[name] && ((0, jsx_runtime_1.jsx)("div", __assign({ className: " text-error-label text-error-icon cursor-pointer relative ".concat(generateClassName('message')), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: (0, jsx_runtime_1.jsx)(customIcons_1.default, { name: "alert", type: "medium" }) }))) }))] }))] })) })));
168
+ className: generateClassName("input") })), !hideLabel && ((0, jsx_runtime_1.jsxs)("label", __assign({ htmlFor: id, onClick: function () { return onLabelClick(); }, className: generateClassName("label") }, { children: [label, required ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-error" }, { children: " *" })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })))] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: generateClassName("adorement"), ref: adorementRef }, { children: errors && errors[name] && ((0, jsx_runtime_1.jsx)("div", __assign({ className: " text-error-label text-error-icon cursor-pointer relative ".concat(generateClassName("message")), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: (0, jsx_runtime_1.jsx)(customIcons_1.default, { name: "alert", type: "medium" }) }))) }))] }))] })) })));
167
169
  };
168
170
  exports.default = ModernTextArea;
169
171
  //# sourceMappingURL=ReactTextArea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReactTextArea.js","sourceRoot":"","sources":["../src/ReactTextArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA2D;AAG3D,yEAAmD;AACnD,qEAA+D;AAC/D,uDAA6D;AAE7D,IAAM,cAAc,GAA4B,UAAC,EAsBhD;QArBC,IAAI,UAAA,EACJ,EAAE,QAAA,EACF,KAAK,WAAA,EACL,YAAQ,EAAR,IAAI,mBAAG,CAAC,KAAA,EACR,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,iBAAgB,EAAhB,SAAS,mBAAG,IAAI,KAAA,EAChB,WAAW,iBAAA,EACA,cAAc,eAAA,EACzB,QAAQ,cAAA,EACR,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA,EACpB,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,cAAc,oBAAA,EACd,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E,EAAE,EACX,OAAO,EAAE,cAAM,OAAA,YAAY,EAAE,EAAd,CAAc,EAC7B,SAAS,EAAE,iBAAiB,CAAC,OAAO,CAAC,iBAEpC,KAAK,EACL,QAAQ,CAAC,CAAC,CAAC,0CAAM,SAAS,EAAC,YAAY,wBAAU,CAAC,CAAC,CAAC,kDAAK,KACpD,CACT,KACG,EACN,yCAAK,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,YAAY,gBAC9D,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CACzB,yCACE,SAAS,EAAE,oEAA6D,iBAAiB,CACvF,SAAS,CACV,CAAE,EACH,YAAY,EAAE,cAAM,OAAA,YAAY,CAAC,IAAI,CAAC,EAAlB,CAAkB,EACtC,YAAY,EAAE,cAAM,OAAA,YAAY,CAAC,KAAK,CAAC,EAAnB,CAAmB,gBAEvC,uBAAC,qBAAW,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,GAAG,IACtC,CACP,IACG,KACF,KACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-core-ts",
3
- "version": "1.3.13",
3
+ "version": "1.3.15",
4
4
  "description": "React Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,9 +1,9 @@
1
- import React, { useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from "react";
2
2
 
3
- import { TextAreaProps } from './commontypes';
4
- import CustomIcons from './components/customIcons';
5
- import { getInnerWidth } from './utilities/generateInnerWidth';
6
- import { applyPositionClass } from './utilities/getPosition';
3
+ import { TextAreaProps } from "./commontypes";
4
+ import CustomIcons from "./components/customIcons";
5
+ import { getInnerWidth } from "./utilities/generateInnerWidth";
6
+ import { applyPositionClass } from "./utilities/getPosition";
7
7
 
8
8
  const ModernTextArea: React.FC<TextAreaProps> = ({
9
9
  name,
@@ -70,27 +70,27 @@ const ModernTextArea: React.FC<TextAreaProps> = ({
70
70
  setIsDisabled(disabled);
71
71
  }, [disabled]);
72
72
  const getErrors = (err: any) => {
73
- let errMsg = '';
73
+ let errMsg = "";
74
74
  if (err.message) {
75
75
  errMsg = err?.message;
76
76
  }
77
77
  return errMsg;
78
78
  };
79
79
  const generateClassName = (
80
- type: 'input' | 'label' | 'message' | 'adorement'
80
+ type: "input" | "label" | "message" | "adorement"
81
81
  ): string => {
82
82
  let className = `resize-none ${propsClassName}`;
83
83
  switch (type) {
84
- case 'input':
84
+ case "input":
85
85
  className += ` block text-common text-input-text font-normal px-3.5 py-2 w-full text-sm text-gray-900 bg-transparent border appearance-none focus:outline-none focus:ring-0 peer rounded-[4px] disabled:text-input-disabled disabled:bg-disabled ${
86
- hideLabel ? '' : 'placeholder-transparent'
86
+ hideLabel ? "" : "placeholder-transparent"
87
87
  } focus:placeholder-grey-secondary`;
88
88
  if (errors && errors[name]) {
89
89
  className +=
90
- ' border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 ';
90
+ " border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 ";
91
91
  } else {
92
92
  className +=
93
- ' text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0';
93
+ " text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0";
94
94
  }
95
95
  break;
96
96
  // case 'label': // changes made for remove bg-white from placeolder is field disable and or with data
@@ -116,36 +116,38 @@ const ModernTextArea: React.FC<TextAreaProps> = ({
116
116
  // className += ' text-grey-dark peer-focus:text-blue-navy';
117
117
  // }
118
118
  // break;
119
- case 'label': // changes made for remove bg-white from placeolder is field disable and or with data
120
- className += ` modern-input-label peer-focus:modern-input-peer-focus-label-size absolute duration-300 transform -translate-y-4 top-2 z-1 origin-[0] px-0
121
- peer-placeholder-shown:-translate-y-1/4 peer-placeholder-shown:top-1/4 peer-focus:top-1
122
- peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto ${
123
- isDisabled ? 'cursor-pointer' : 'cursor-text peer-focus:cursor-pointer'
124
- } ${
119
+ case "label": // changes made for remove bg-white from placeolder is field disable and or with data
120
+ className += `modern-input-label peer-focus:modern-input-peer-focus-label-size absolute duration-300 transform -translate-y-4 top-1.5 z-1 origin-[0] px-0
121
+ peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/6 rtl:peer-focus:left-auto
122
+ peer-placeholder-shown:translate-y-2 peer-placeholder-shown:top-[2px] peer-focus:top-1.5 peer-focus:-translate-y-4" ${
123
+ isDisabled
124
+ ? "cursor-pointer"
125
+ : "cursor-text peer-focus:cursor-pointer"
126
+ } ${
125
127
  !isDisabled || !checkIsEmptyField()
126
- ? 'active-input-label-bg'
128
+ ? "active-input-label-bg"
127
129
  : isDisabled && !checkIsEmptyField()
128
- ? 'disabled-input-label-bg'
129
- : ''
130
+ ? "disabled-input-label-bg"
131
+ : ""
130
132
  } ${
131
133
  checkIsEmptyField()
132
- ? 'modern-input-label-size'
133
- : 'modern-input-peer-focus-label-size'
134
+ ? "modern-input-label-size"
135
+ : "modern-input-peer-focus-label-size"
134
136
  }`;
135
137
 
136
138
  if (errors && errors[name]) {
137
- className += ' text-error-light ';
139
+ className += " text-error-light ";
138
140
  } else {
139
- className += ' text-grey-dark peer-focus:text-blue-navy';
141
+ className += " text-grey-dark peer-focus:text-blue-navy";
140
142
  }
141
143
  break;
142
144
 
143
- case 'message':
144
- className = ' text-error-icon ';
145
+ case "message":
146
+ className = " text-error-icon ";
145
147
  break;
146
- case 'adorement':
148
+ case "adorement":
147
149
  className +=
148
- ' absolute right-0 py-4 adorement gap-1 flex items-center ';
150
+ " absolute right-0 py-4 adorement gap-1 flex items-center ";
149
151
  break;
150
152
  default:
151
153
  break;
@@ -162,12 +164,12 @@ const ModernTextArea: React.FC<TextAreaProps> = ({
162
164
  // }
163
165
  const handleError = (data: any) => {
164
166
  if (
165
- getErrors(data[name]) === 'required' ||
166
- getErrors(data[name]) === 'Required'
167
+ getErrors(data[name]) === "required" ||
168
+ getErrors(data[name]) === "Required"
167
169
  ) {
168
170
  return `${label} is ${getErrors(data[name])}`;
169
171
  } else {
170
- return getErrors(data[name]) ?? '';
172
+ return getErrors(data[name]) ?? "";
171
173
  }
172
174
  };
173
175
  const textFieldRef = useRef<HTMLDivElement>(null); // Ref for the text field div
@@ -176,13 +178,13 @@ const ModernTextArea: React.FC<TextAreaProps> = ({
176
178
  applyPositionClass(textFieldRef, isHovered);
177
179
  }, [isHovered]);
178
180
  return (
179
- <div ref={textFieldRef} className={` ${fullwidth ? 'w-full' : 'w-auto'}`}>
181
+ <div ref={textFieldRef} className={` ${fullwidth ? "w-full" : "w-auto"}`}>
180
182
  <div className="tooltip-container">
181
183
  {isHovered && errors && errors[name] && (
182
184
  <span className="tooltip">{errors && handleError(errors)}</span>
183
185
  )}
184
186
 
185
- <div className={`flex relative ${fullwidth ? 'w-full' : 'w-auto'}`}>
187
+ <div className={`flex relative ${fullwidth ? "w-full" : "w-auto"}`}>
186
188
  <div className="relative w-full">
187
189
  <textarea
188
190
  id={id}
@@ -199,26 +201,26 @@ const ModernTextArea: React.FC<TextAreaProps> = ({
199
201
  height: boxHeight ?? undefined,
200
202
  minHeight: boxMinHeight ?? undefined,
201
203
  }}
202
- autoComplete={autoComplete ? 'on' : 'off'}
204
+ autoComplete={autoComplete ? "on" : "off"}
203
205
  // autoFocus={autoFocus}
204
- className={generateClassName('input')}
206
+ className={generateClassName("input")}
205
207
  />
206
208
  {!hideLabel && (
207
209
  <label
208
210
  htmlFor={id}
209
211
  onClick={() => onLabelClick()}
210
- className={generateClassName('label')}
212
+ className={generateClassName("label")}
211
213
  >
212
214
  {label}
213
215
  {required ? <span className="text-error"> *</span> : <></>}
214
216
  </label>
215
217
  )}
216
218
  </div>
217
- <div className={generateClassName('adorement')} ref={adorementRef}>
219
+ <div className={generateClassName("adorement")} ref={adorementRef}>
218
220
  {errors && errors[name] && (
219
221
  <div
220
222
  className={` text-error-label text-error-icon cursor-pointer relative ${generateClassName(
221
- 'message'
223
+ "message"
222
224
  )}`}
223
225
  onMouseEnter={() => setIsHovered(true)}
224
226
  onMouseLeave={() => setIsHovered(false)}