react-restyle-components 0.1.45 → 0.1.47
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/lib/cjs/App.js +12 -36
- package/lib/cjs/App.test.js +8 -10
- package/lib/cjs/core-components/atoms/buttons/button.stories.js +24 -26
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +9 -27
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js +7 -15
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +35 -102
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +7 -15
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +37 -98
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +15 -17
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +7 -16
- package/lib/cjs/core-components/atoms/form/form.component.js +159 -571
- package/lib/cjs/core-components/atoms/form/form.test.js +59 -87
- package/lib/cjs/core-components/atoms/icons/icons.component.js +58 -41
- package/lib/cjs/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/icons/icons.stories.js +23 -0
- package/lib/cjs/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js +16 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/input/input-otp.component.js +76 -118
- package/lib/cjs/core-components/atoms/input/input-pin.component.js +98 -180
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
- package/lib/cjs/core-components/atoms/input/input-pin.test.js +10 -28
- package/lib/cjs/core-components/atoms/input/input.component.js +33 -104
- package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
- package/lib/cjs/core-components/atoms/input/input.test.js +10 -30
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +53 -127
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -16
- package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
- package/lib/cjs/core-components/atoms/loader/loader.test.js +7 -11
- package/lib/cjs/core-components/atoms/radio/radio.component.js +37 -102
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
- package/lib/cjs/core-components/atoms/radio/radio.test.js +7 -15
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js +7 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.component.js +32 -81
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +16 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/tabs/tabs.test.js +13 -20
- package/lib/cjs/core-components/atoms/timer/timer.component.js +92 -119
- package/lib/cjs/core-components/atoms/timer/timer.test.js +10 -20
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +45 -85
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +9 -13
- package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
- package/lib/cjs/core-components/index.js +27 -64
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +106 -210
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -23
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +36 -38
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +104 -209
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -28
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +22 -24
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +106 -203
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -14
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/cjs/core-utils/index.js +15 -31
- package/lib/cjs/core-utils/unit-test.utils.js +6 -8
- package/lib/cjs/index.js +15 -31
- package/lib/cjs/library/assets/svg/DownArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/UpArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedBox.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedRadio.svg +13 -0
- package/lib/cjs/library/assets/svg/datePicker.svg +3 -0
- package/lib/cjs/library/assets/svg/index.js +13 -39
- package/lib/cjs/library/assets/svg/index.ts +38 -0
- package/lib/cjs/library/assets/svg/timer copy.svg +3 -0
- package/lib/cjs/library/assets/svg/timer.svg +3 -0
- package/lib/cjs/library/assets/svg/unCheckbox.svg +3 -0
- package/lib/cjs/library/assets/svg/uncheckRadio.svg +3 -0
- package/lib/cjs/reportWebVitals.js +1 -1
- package/lib/cjs/setupTests.js +1 -1
- package/lib/esm/App.js +12 -34
- package/lib/esm/App.test.js +8 -8
- package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -24
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +7 -23
- package/lib/esm/core-components/atoms/buttons/buttons.test.js +7 -13
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +19 -65
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js +7 -13
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +21 -54
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +8 -15
- package/lib/esm/core-components/atoms/form/form.component.js +138 -513
- package/lib/esm/core-components/atoms/form/form.test.js +60 -78
- package/lib/esm/core-components/atoms/icons/icons.component.js +32 -36
- package/lib/esm/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/esm/core-components/atoms/icons/icons.stories.js +20 -0
- package/lib/esm/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js +11 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/esm/core-components/atoms/input/input-otp.component.js +59 -80
- package/lib/esm/core-components/atoms/input/input-pin.component.js +81 -142
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
- package/lib/esm/core-components/atoms/input/input-pin.test.js +10 -26
- package/lib/esm/core-components/atoms/input/input.component.js +16 -66
- package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
- package/lib/esm/core-components/atoms/input/input.test.js +10 -28
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -95
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -14
- package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
- package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
- package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
- package/lib/esm/core-components/atoms/radio/radio.component.js +21 -65
- package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
- package/lib/esm/core-components/atoms/radio/radio.test.js +7 -13
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
- package/lib/esm/core-components/atoms/stepper/stepper.test.js +7 -14
- package/lib/esm/core-components/atoms/tabs/tabs.component.js +15 -43
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js +17 -17
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/tabs/tabs.test.js +13 -18
- package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
- package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +25 -46
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
- package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
- package/lib/esm/core-components/index.js +19 -19
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +88 -170
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -17
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +37 -38
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +86 -169
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -22
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +23 -24
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +90 -166
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/esm/core-utils/index.js +2 -2
- package/lib/esm/core-utils/unit-test.utils.js +5 -5
- package/lib/esm/index.js +2 -2
- package/lib/esm/library/assets/svg/index.js +10 -19
- package/lib/esm/reportWebVitals.js +1 -1
- package/lib/esm/setupTests.js +2 -2
- package/lib/package.json +124 -0
- package/package.json +4 -4
|
@@ -1,193 +1,111 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}
|
|
21
|
-
: function (o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
});
|
|
25
|
-
var __setModuleDefault =
|
|
26
|
-
(this && this.__setModuleDefault) ||
|
|
27
|
-
(Object.create
|
|
28
|
-
? function (o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}
|
|
31
|
-
: function (o, v) {
|
|
32
|
-
o["default"] = v;
|
|
33
|
-
});
|
|
34
|
-
var __importStar =
|
|
35
|
-
(this && this.__importStar) ||
|
|
36
|
-
function (mod) {
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
19
|
if (mod && mod.__esModule) return mod;
|
|
38
20
|
var result = {};
|
|
39
|
-
if (mod != null)
|
|
40
|
-
for (var k in mod)
|
|
41
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
42
|
-
__createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
43
22
|
__setModuleDefault(result, mod);
|
|
44
23
|
return result;
|
|
45
|
-
|
|
24
|
+
};
|
|
46
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
26
|
exports.InputPin = void 0;
|
|
48
27
|
/* eslint-disable */
|
|
49
28
|
const react_1 = __importStar(require("react"));
|
|
50
29
|
require("./input.styles.css");
|
|
51
|
-
const InputPin = ({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
const changePinFocus = (pinIndex) => {
|
|
75
|
-
const ref = inputRefs.current[pinIndex];
|
|
76
|
-
if (ref) {
|
|
77
|
-
ref.focus();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const onChange = (event, index) => {
|
|
81
|
-
var _a;
|
|
82
|
-
const previousValue = event.target.defaultValue;
|
|
83
|
-
const valueArray = event.target.value.split("");
|
|
84
|
-
const output = removeValuesFromArray(valueArray, previousValue);
|
|
85
|
-
const value = valueArray.pop();
|
|
86
|
-
if (!value) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const pinNumber = Number(value);
|
|
90
|
-
if (isNaN(pinNumber) || value.length === 0) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
pin.current[
|
|
94
|
-
(_a = pin.current) === null || _a === void 0 ? void 0 : _a.length
|
|
95
|
-
] = value;
|
|
96
|
-
setReload(!reload);
|
|
97
|
-
if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
|
|
98
|
-
onPinChanged(pin.current, index);
|
|
99
|
-
if (index < pinLength - 1) {
|
|
100
|
-
changePinFocus(index + 1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const onKeyDown = (event, index) => {
|
|
105
|
-
const keyboardKeyCode = event.nativeEvent.code;
|
|
106
|
-
if (keyboardKeyCode != BACKSPACE_Key) return;
|
|
107
|
-
if (pin.current[index] !== undefined && keyboardKeyCode === BACKSPACE_Key) {
|
|
108
|
-
changePinFocus(index - 1);
|
|
109
|
-
}
|
|
110
|
-
if (pin.current[index] === undefined) {
|
|
111
|
-
changePinFocus(index - 1);
|
|
112
|
-
} else {
|
|
113
|
-
onPinChanged(undefined, index);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
return react_1.default.createElement(
|
|
117
|
-
"div",
|
|
118
|
-
{ className: `${className} relative` },
|
|
119
|
-
react_1.default.createElement(
|
|
120
|
-
"label",
|
|
121
|
-
{
|
|
122
|
-
className:
|
|
123
|
-
"duration-300 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md",
|
|
124
|
-
},
|
|
125
|
-
title,
|
|
126
|
-
),
|
|
127
|
-
react_1.default.createElement(
|
|
128
|
-
"div",
|
|
129
|
-
{ className: "flex space-x-1" },
|
|
130
|
-
Array.from({ length: pinLength }, (_, index) => {
|
|
30
|
+
const InputPin = ({ title, className, defaultPin, errorMsg, defaultMsg, hasError, onPinChanged, }) => {
|
|
31
|
+
const pin = (0, react_1.useRef)([]);
|
|
32
|
+
const [reload, setReload] = (0, react_1.useState)(false);
|
|
33
|
+
const pinLength = 12;
|
|
34
|
+
const Pin_Min_Value = 0;
|
|
35
|
+
const Pin_Max_Value = 9;
|
|
36
|
+
const BACKSPACE_Key = 'Backspace';
|
|
37
|
+
const inputRefs = (0, react_1.useRef)([]);
|
|
38
|
+
const removeValuesFromArray = (valuesArray, value) => {
|
|
39
|
+
const valueIndex = valuesArray.findIndex((entry) => entry === value);
|
|
40
|
+
if (valueIndex === -1) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
valuesArray.splice(valueIndex, 1);
|
|
44
|
+
};
|
|
45
|
+
const changePinFocus = (pinIndex) => {
|
|
46
|
+
const ref = inputRefs.current[pinIndex];
|
|
47
|
+
if (ref) {
|
|
48
|
+
ref.focus();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const onChange = (event, index) => {
|
|
131
52
|
var _a;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"span",
|
|
187
|
-
{ className: "text-sm text-4xs font-nunitoSansRegular", id: "error" },
|
|
188
|
-
`${defaultMsg || ""}`,
|
|
189
|
-
),
|
|
190
|
-
);
|
|
53
|
+
const previousValue = event.target.defaultValue;
|
|
54
|
+
const valueArray = event.target.value.split('');
|
|
55
|
+
const output = removeValuesFromArray(valueArray, previousValue);
|
|
56
|
+
const value = valueArray.pop();
|
|
57
|
+
if (!value) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const pinNumber = Number(value);
|
|
61
|
+
if (isNaN(pinNumber) || value.length === 0) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
pin.current[(_a = pin.current) === null || _a === void 0 ? void 0 : _a.length] = value;
|
|
65
|
+
setReload(!reload);
|
|
66
|
+
if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
|
|
67
|
+
onPinChanged(pin.current, index);
|
|
68
|
+
if (index < pinLength - 1) {
|
|
69
|
+
changePinFocus(index + 1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const onKeyDown = (event, index) => {
|
|
74
|
+
const keyboardKeyCode = event.nativeEvent.code;
|
|
75
|
+
if (keyboardKeyCode != BACKSPACE_Key)
|
|
76
|
+
return;
|
|
77
|
+
if (pin.current[index] !== undefined && keyboardKeyCode === BACKSPACE_Key) {
|
|
78
|
+
changePinFocus(index - 1);
|
|
79
|
+
}
|
|
80
|
+
if (pin.current[index] === undefined) {
|
|
81
|
+
changePinFocus(index - 1);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
onPinChanged(undefined, index);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return (react_1.default.createElement("div", { className: `${className} relative` },
|
|
88
|
+
react_1.default.createElement("label", { className: "duration-300 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md" }, title),
|
|
89
|
+
react_1.default.createElement("div", { className: "flex space-x-1" }, Array.from({ length: pinLength }, (_, index) => {
|
|
90
|
+
var _a;
|
|
91
|
+
return (react_1.default.createElement("div", { className: "flex space-x-1 max-w-full items-stretch", key: index },
|
|
92
|
+
react_1.default.createElement("input", { "data-testid": "inputElementPin", type: "tel", className: "pb-2 block w-4 px-0 mt-0 bg-transparent text-center border-0 border-b z-20 appearance-none rounded-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ", onKeyUp: (event) => onKeyDown(event, index), key: index, onMouseUp: () => {
|
|
93
|
+
if (pin.current.join('').length <= 0) {
|
|
94
|
+
changePinFocus(0);
|
|
95
|
+
}
|
|
96
|
+
}, onClick: () => {
|
|
97
|
+
if (pin.current.join('').length <= 0) {
|
|
98
|
+
onPinChanged(undefined, 0);
|
|
99
|
+
}
|
|
100
|
+
}, ref: (el) => {
|
|
101
|
+
if (el) {
|
|
102
|
+
inputRefs.current[index] = el;
|
|
103
|
+
}
|
|
104
|
+
}, onChange: (event) => onChange(event, index), value: ((_a = pin.current[index]) === null || _a === void 0 ? void 0 : _a.toString()) || '' }),
|
|
105
|
+
react_1.default.createElement("div", { className: "invisible" }, (index + 1) % 4 === 0 ? 'ss' : null)));
|
|
106
|
+
})),
|
|
107
|
+
hasError && (hasError === null || hasError === void 0 ? void 0 : hasError.type) !== 'required' && (react_1.default.createElement("span", { className: "text-sm text-red text-4xs font-nunitoSansRegular", id: "error" }, `${errorMsg || ''}`)),
|
|
108
|
+
(!hasError || (hasError === null || hasError === void 0 ? void 0 : hasError.type) === 'required') && (react_1.default.createElement("span", { className: "text-sm text-4xs font-nunitoSansRegular", id: "error" }, `${defaultMsg || ''}`))));
|
|
191
109
|
};
|
|
192
110
|
exports.InputPin = InputPin;
|
|
193
|
-
//# sourceMappingURL=input-pin.component.js.map
|
|
111
|
+
//# sourceMappingURL=input-pin.component.js.map
|
|
@@ -3,22 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Primary = void 0;
|
|
4
4
|
const input_pin_component_1 = require("./input-pin.component");
|
|
5
5
|
const meta = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
title: 'Design System/Atoms/InputPin',
|
|
7
|
+
component: input_pin_component_1.InputPin,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
componentSubtitle: `import { InputPin } from 'react-restyle-components'`,
|
|
11
|
+
},
|
|
12
12
|
};
|
|
13
13
|
exports.default = meta;
|
|
14
14
|
exports.Primary = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
args: {
|
|
16
|
+
title: 'Enter your Aadhaar Number',
|
|
17
|
+
hasError: true,
|
|
18
|
+
defaultPin: [],
|
|
19
|
+
onPinChanged: (item) => {
|
|
20
|
+
console.log({ item });
|
|
21
|
+
},
|
|
21
22
|
},
|
|
22
|
-
},
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=input-pin.stories.js.map
|
|
24
|
+
//# sourceMappingURL=input-pin.stories.js.map
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
-
};
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
7
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
6
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
9
7
|
const react_1 = __importDefault(require("react"));
|
|
10
8
|
const _core_utils_1 = require("@core-utils");
|
|
11
9
|
const input_pin_component_1 = require("./input-pin.component");
|
|
12
|
-
it(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
title: "Enter your Aadhaar Number",
|
|
16
|
-
hasError: false,
|
|
17
|
-
errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number",
|
|
18
|
-
onPinChanged: () => jest.fn(),
|
|
19
|
-
defaultPin: [],
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
22
|
-
expect(pinInput).toMatchSnapshot();
|
|
10
|
+
it('render InputOtp correctly without error', () => {
|
|
11
|
+
const pinInput = (0, _core_utils_1.render)(react_1.default.createElement(input_pin_component_1.InputPin, { title: "Enter your Aadhaar Number", hasError: false, errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number", onPinChanged: () => jest.fn(), defaultPin: [] }));
|
|
12
|
+
expect(pinInput).toMatchSnapshot();
|
|
23
13
|
});
|
|
24
|
-
it(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
title: "Enter your Aadhaar Number",
|
|
28
|
-
hasError: true,
|
|
29
|
-
errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number",
|
|
30
|
-
onPinChanged: () => jest.fn(),
|
|
31
|
-
defaultPin: [],
|
|
32
|
-
}),
|
|
33
|
-
);
|
|
34
|
-
expect(pinInput).toMatchSnapshot();
|
|
14
|
+
it('render InputOtp correctly with error', () => {
|
|
15
|
+
const pinInput = (0, _core_utils_1.render)(react_1.default.createElement(input_pin_component_1.InputPin, { title: "Enter your Aadhaar Number", hasError: true, errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number", onPinChanged: () => jest.fn(), defaultPin: [] }));
|
|
16
|
+
expect(pinInput).toMatchSnapshot();
|
|
35
17
|
});
|
|
36
|
-
//# sourceMappingURL=input-pin.test.js.map
|
|
18
|
+
//# sourceMappingURL=input-pin.test.js.map
|
|
@@ -1,116 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}
|
|
21
|
-
: function (o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
});
|
|
25
|
-
var __setModuleDefault =
|
|
26
|
-
(this && this.__setModuleDefault) ||
|
|
27
|
-
(Object.create
|
|
28
|
-
? function (o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}
|
|
31
|
-
: function (o, v) {
|
|
32
|
-
o["default"] = v;
|
|
33
|
-
});
|
|
34
|
-
var __importStar =
|
|
35
|
-
(this && this.__importStar) ||
|
|
36
|
-
function (mod) {
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
19
|
if (mod && mod.__esModule) return mod;
|
|
38
20
|
var result = {};
|
|
39
|
-
if (mod != null)
|
|
40
|
-
for (var k in mod)
|
|
41
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
42
|
-
__createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
43
22
|
__setModuleDefault(result, mod);
|
|
44
23
|
return result;
|
|
45
|
-
|
|
24
|
+
};
|
|
46
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
26
|
exports.Input = void 0;
|
|
48
27
|
/* eslint-disable no-console */
|
|
49
28
|
const react_1 = __importStar(require("react"));
|
|
50
29
|
require("./input.styles.css");
|
|
51
|
-
const Input = ({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}) => {
|
|
65
|
-
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
66
|
-
const onKeyUpValue = (event) => {
|
|
67
|
-
onChange(event.target.value);
|
|
68
|
-
};
|
|
69
|
-
return react_1.default.createElement(
|
|
70
|
-
"div",
|
|
71
|
-
{ className: `${className} relative` },
|
|
72
|
-
react_1.default.createElement("input", {
|
|
73
|
-
"data-testid": "inputElement",
|
|
74
|
-
type: "text",
|
|
75
|
-
name: "name",
|
|
76
|
-
value: value,
|
|
77
|
-
placeholder: " ",
|
|
78
|
-
disabled: disable,
|
|
79
|
-
className: `pt-3 pb-2 bg-transparent block w-full px-0 mt-0 rounded-none border-0 border-b appearance-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ${inputStyle}`,
|
|
80
|
-
onChange: (e) => {
|
|
81
|
-
setValue(e.target.value);
|
|
82
|
-
onChange && onChange(e.target.value);
|
|
83
|
-
},
|
|
84
|
-
onKeyUp: onKeyUpValue,
|
|
85
|
-
onBlur: (e) => onBlur && onBlur(e.target.value),
|
|
86
|
-
autoComplete: autoComplete,
|
|
87
|
-
maxLength: maxlength,
|
|
88
|
-
}),
|
|
89
|
-
react_1.default.createElement(
|
|
90
|
-
"label",
|
|
91
|
-
{
|
|
92
|
-
className:
|
|
93
|
-
"absolute duration-300 top-3 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md",
|
|
94
|
-
},
|
|
95
|
-
title,
|
|
96
|
-
),
|
|
97
|
-
hasError &&
|
|
98
|
-
(hasError === null || hasError === void 0 ? void 0 : hasError.type) !==
|
|
99
|
-
"required" &&
|
|
100
|
-
react_1.default.createElement(
|
|
101
|
-
"span",
|
|
102
|
-
{ className: "text-sm text-red text-4xs", id: "error" },
|
|
103
|
-
`${errorMsg || ""}`,
|
|
104
|
-
),
|
|
105
|
-
(!hasError ||
|
|
106
|
-
(hasError === null || hasError === void 0 ? void 0 : hasError.type) ===
|
|
107
|
-
"required") &&
|
|
108
|
-
react_1.default.createElement(
|
|
109
|
-
"span",
|
|
110
|
-
{ className: "text-sm text-4xs", id: "error" },
|
|
111
|
-
`${defaultMsg || ""}`,
|
|
112
|
-
),
|
|
113
|
-
);
|
|
30
|
+
const Input = ({ title, defaultValue, className, disable, hasError, errorMsg, defaultMsg, inputStyle, autoComplete, maxlength = 40, onChange, onBlur, }) => {
|
|
31
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
32
|
+
const onKeyUpValue = (event) => {
|
|
33
|
+
onChange(event.target.value);
|
|
34
|
+
};
|
|
35
|
+
return (react_1.default.createElement("div", { className: `${className} relative` },
|
|
36
|
+
react_1.default.createElement("input", { "data-testid": "inputElement", type: "text", name: "name", value: value, placeholder: " ", disabled: disable, className: `pt-3 pb-2 bg-transparent block w-full px-0 mt-0 rounded-none border-0 border-b appearance-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ${inputStyle}`, onChange: (e) => {
|
|
37
|
+
setValue(e.target.value);
|
|
38
|
+
onChange && onChange(e.target.value);
|
|
39
|
+
}, onKeyUp: onKeyUpValue, onBlur: (e) => onBlur && onBlur(e.target.value), autoComplete: autoComplete, maxLength: maxlength }),
|
|
40
|
+
react_1.default.createElement("label", { className: "absolute duration-300 top-3 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md" }, title),
|
|
41
|
+
hasError && (hasError === null || hasError === void 0 ? void 0 : hasError.type) !== 'required' && (react_1.default.createElement("span", { className: "text-sm text-red text-4xs", id: "error" }, `${errorMsg || ''}`)),
|
|
42
|
+
(!hasError || (hasError === null || hasError === void 0 ? void 0 : hasError.type) === 'required') && (react_1.default.createElement("span", { className: "text-sm text-4xs", id: "error" }, `${defaultMsg || ''}`))));
|
|
114
43
|
};
|
|
115
44
|
exports.Input = Input;
|
|
116
|
-
//# sourceMappingURL=input.component.js.map
|
|
45
|
+
//# sourceMappingURL=input.component.js.map
|
|
@@ -3,23 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Primary = void 0;
|
|
4
4
|
const input_component_1 = require("./input.component");
|
|
5
5
|
const meta = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
title: 'Design System/Atoms/Input',
|
|
7
|
+
component: input_component_1.Input,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
9
|
};
|
|
10
10
|
exports.default = meta;
|
|
11
11
|
exports.Primary = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
args: {
|
|
13
|
+
className: 'mt-4',
|
|
14
|
+
title: 'Enter your Pan Number',
|
|
15
|
+
hasError: true,
|
|
16
|
+
defaultValue: '',
|
|
17
|
+
onChange: (item) => {
|
|
18
|
+
console.log({ item });
|
|
19
|
+
},
|
|
20
|
+
onBlur: (item) => {
|
|
21
|
+
console.log({ item });
|
|
22
|
+
},
|
|
19
23
|
},
|
|
20
|
-
onBlur: (item) => {
|
|
21
|
-
console.log({ item });
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=input.stories.js.map
|
|
25
|
+
//# sourceMappingURL=input.stories.js.map
|
|
@@ -1,38 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
-
};
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
7
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
6
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
9
7
|
const react_1 = __importDefault(require("react"));
|
|
10
8
|
const _core_utils_1 = require("@core-utils");
|
|
11
9
|
const input_component_1 = require("./input.component");
|
|
12
|
-
it(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: "h-1 relative top-1 border-red-600 border-b-0 dummy",
|
|
16
|
-
title: "input",
|
|
17
|
-
hasError: false,
|
|
18
|
-
defaultValue: "",
|
|
19
|
-
inputStyle: " border-b-0 invisible ",
|
|
20
|
-
onChange: () => jest.fn(),
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
23
|
-
expect(input).toMatchSnapshot();
|
|
10
|
+
it('render Input correctly without error', () => {
|
|
11
|
+
const input = (0, _core_utils_1.render)(react_1.default.createElement(input_component_1.Input, { className: "h-1 relative top-1 border-red-600 border-b-0 dummy", title: 'input', hasError: false, defaultValue: '', inputStyle: " border-b-0 invisible ", onChange: () => jest.fn() }));
|
|
12
|
+
expect(input).toMatchSnapshot();
|
|
24
13
|
});
|
|
25
|
-
it(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
className: "h-1 relative top-1 border-red-600 border-b-0 dummy",
|
|
29
|
-
title: "input",
|
|
30
|
-
hasError: true,
|
|
31
|
-
defaultValue: "",
|
|
32
|
-
inputStyle: " border-b-0 invisible ",
|
|
33
|
-
onChange: () => jest.fn(),
|
|
34
|
-
}),
|
|
35
|
-
);
|
|
36
|
-
expect(input).toMatchSnapshot();
|
|
14
|
+
it('render Input correctly with error', () => {
|
|
15
|
+
const input = (0, _core_utils_1.render)(react_1.default.createElement(input_component_1.Input, { className: "h-1 relative top-1 border-red-600 border-b-0 dummy", title: 'input', hasError: true, defaultValue: '', inputStyle: " border-b-0 invisible ", onChange: () => jest.fn() }));
|
|
16
|
+
expect(input).toMatchSnapshot();
|
|
37
17
|
});
|
|
38
|
-
//# sourceMappingURL=input.test.js.map
|
|
18
|
+
//# sourceMappingURL=input.test.js.map
|