react-restyle-components 0.1.35 → 0.1.37
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 +3 -7
- 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 +32 -26
- package/lib/cjs/core-components/atoms/buttons/button.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +6 -17
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js +14 -0
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +10 -27
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +14 -28
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +14 -0
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +38 -98
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +17 -24
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +15 -0
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/form/form.component.js +194 -0
- package/lib/cjs/core-components/atoms/form/form.component.js.map +1 -0
- package/lib/cjs/core-components/atoms/form/form.test.js +100 -0
- package/lib/cjs/core-components/atoms/form/form.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 +94 -174
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +12 -22
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/input/input-pin.test.js +18 -0
- package/lib/cjs/core-components/atoms/input/input-pin.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/input/input.component.js +13 -65
- package/lib/cjs/core-components/atoms/input/input.stories.js +14 -21
- package/lib/cjs/core-components/atoms/input/input.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/input/input.test.js +18 -0
- package/lib/cjs/core-components/atoms/input/input.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +54 -134
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -19
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +14 -0
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +9 -19
- package/lib/cjs/core-components/atoms/loader/loader.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/loader/loader.test.js +14 -0
- package/lib/cjs/core-components/atoms/loader/loader.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/radio/radio.component.js +7 -22
- package/lib/cjs/core-components/atoms/radio/radio.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +9 -27
- package/lib/cjs/core-components/atoms/radio/radio.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/radio/radio.test.js +14 -0
- package/lib/cjs/core-components/atoms/radio/radio.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +14 -22
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js +13 -0
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/timer/timer.component.js +93 -120
- package/lib/cjs/core-components/atoms/timer/timer.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/timer/timer.test.js +20 -0
- package/lib/cjs/core-components/atoms/timer/timer.test.js.map +1 -0
- package/lib/cjs/core-components/index.js +32 -35
- package/lib/cjs/core-components/index.js.map +1 -1
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +129 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js.map +1 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +14 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js.map +1 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +16 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js.map +1 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +165 -0
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js.map +1 -0
- 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/index.js +41 -0
- package/lib/cjs/library/assets/svg/index.js.map +1 -0
- package/lib/cjs/reportWebVitals.js +29 -52
- package/lib/cjs/reportWebVitals.js.map +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 +30 -20
- package/lib/esm/core-components/atoms/buttons/button.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +4 -13
- package/lib/esm/core-components/atoms/buttons/buttons.component.js.map +1 -1
- package/lib/esm/core-components/atoms/buttons/buttons.test.js +9 -0
- package/lib/esm/core-components/atoms/buttons/buttons.test.js.map +1 -0
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +8 -20
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js.map +1 -1
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +14 -19
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js +9 -0
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js.map +1 -0
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +20 -52
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js.map +1 -1
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +15 -19
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +10 -0
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js.map +1 -0
- package/lib/esm/core-components/atoms/form/form.component.js +155 -0
- package/lib/esm/core-components/atoms/form/form.component.js.map +1 -0
- package/lib/esm/core-components/atoms/form/form.test.js +95 -0
- package/lib/esm/core-components/atoms/form/form.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 +77 -136
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +13 -17
- package/lib/esm/core-components/atoms/input/input-pin.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/input/input-pin.test.js +13 -0
- package/lib/esm/core-components/atoms/input/input-pin.test.js.map +1 -0
- package/lib/esm/core-components/atoms/input/input.component.js +12 -62
- package/lib/esm/core-components/atoms/input/input.stories.js +15 -16
- package/lib/esm/core-components/atoms/input/input.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/input/input.test.js +13 -0
- package/lib/esm/core-components/atoms/input/input.test.js.map +1 -0
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -96
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js.map +1 -1
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +14 -14
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +9 -0
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js.map +1 -0
- package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
- package/lib/esm/core-components/atoms/loader/loader.stories.js +10 -14
- package/lib/esm/core-components/atoms/loader/loader.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/loader/loader.test.js +9 -0
- package/lib/esm/core-components/atoms/loader/loader.test.js.map +1 -0
- package/lib/esm/core-components/atoms/radio/radio.component.js +5 -12
- package/lib/esm/core-components/atoms/radio/radio.component.js.map +1 -1
- package/lib/esm/core-components/atoms/radio/radio.stories.js +10 -19
- package/lib/esm/core-components/atoms/radio/radio.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/radio/radio.test.js +9 -0
- package/lib/esm/core-components/atoms/radio/radio.test.js.map +1 -0
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +15 -17
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/stepper/stepper.test.js +8 -0
- package/lib/esm/core-components/atoms/stepper/stepper.test.js.map +1 -0
- package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
- package/lib/esm/core-components/atoms/timer/timer.component.js.map +1 -1
- package/lib/esm/core-components/atoms/timer/timer.test.js +15 -0
- package/lib/esm/core-components/atoms/timer/timer.test.js.map +1 -0
- package/lib/esm/core-components/index.js +15 -12
- package/lib/esm/core-components/index.js.map +1 -1
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +102 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js.map +1 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +11 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js.map +1 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +11 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js.map +1 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +162 -0
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js.map +1 -0
- 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 +28 -0
- package/lib/esm/library/assets/svg/index.js.map +1 -0
- package/lib/esm/reportWebVitals.js +10 -10
- package/lib/esm/reportWebVitals.js.map +1 -1
- package/lib/esm/setupTests.js +2 -2
- package/package.json +46 -33
- package/lib/cjs/core-components/atoms/buttons/buttons.component.test.js +0 -22
- package/lib/cjs/core-components/atoms/buttons/buttons.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.test.js +0 -21
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.test.js +0 -23
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/input/input-pin.component.test.js +0 -36
- package/lib/cjs/core-components/atoms/input/input-pin.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/input/input.component.test.js +0 -38
- package/lib/cjs/core-components/atoms/input/input.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.test.js +0 -23
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/loader/loader.component.test.js +0 -18
- package/lib/cjs/core-components/atoms/loader/loader.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/radio/radio.component.test.js +0 -21
- package/lib/cjs/core-components/atoms/radio/radio.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/stepper/stepper.component.test.js +0 -22
- package/lib/cjs/core-components/atoms/stepper/stepper.component.test.js.map +0 -1
- package/lib/cjs/core-components/atoms/timer/timer.component.test.js +0 -30
- package/lib/cjs/core-components/atoms/timer/timer.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/buttons/buttons.component.test.js +0 -15
- package/lib/esm/core-components/atoms/buttons/buttons.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/check-box/checkBox.component.test.js +0 -11
- package/lib/esm/core-components/atoms/check-box/checkBox.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.test.js +0 -16
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/input/input-pin.component.test.js +0 -29
- package/lib/esm/core-components/atoms/input/input-pin.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/input/input.component.test.js +0 -31
- package/lib/esm/core-components/atoms/input/input.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.test.js +0 -16
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/loader/loader.component.test.js +0 -9
- package/lib/esm/core-components/atoms/loader/loader.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/radio/radio.component.test.js +0 -11
- package/lib/esm/core-components/atoms/radio/radio.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/stepper/stepper.component.test.js +0 -15
- package/lib/esm/core-components/atoms/stepper/stepper.component.test.js.map +0 -1
- package/lib/esm/core-components/atoms/timer/timer.component.test.js +0 -15
- package/lib/esm/core-components/atoms/timer/timer.component.test.js.map +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
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) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DeliveryScheduleToggle = exports.Toggle = exports.InputFile = exports.CheckBox = exports.InputDate = exports.InputRadio = exports.MultilineInput1 = exports.MultilineInput = exports.Input2 = exports.Input1 = exports.InputPassword = exports.Input = exports.InputWrapper = exports.Label = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
32
|
+
const Label = (props) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
33
|
+
react_1.default.createElement("label", { htmlFor: props.htmlFor, className: `${props.hasError ? 'text-red-400' : 'text-current'} block text-3xs font-medium mb-1`, style: Object.assign({}, props.style) }, props.children)));
|
|
34
|
+
exports.Label = Label;
|
|
35
|
+
const InputWrapper = (props) => (react_1.default.createElement("div", { className: props.className, ref: props.ref },
|
|
36
|
+
react_1.default.createElement(exports.Label, { htmlFor: props.id || '', hasError: props.hasError, style: Object.assign({}, props.style) },
|
|
37
|
+
react_1.default.createElement("span", { className: "dark:text-white w-10" }, props.label)),
|
|
38
|
+
props.children));
|
|
39
|
+
exports.InputWrapper = InputWrapper;
|
|
40
|
+
exports.Input = react_1.default.forwardRef((props, ref) => {
|
|
41
|
+
const handleKeyPress = (e) => {
|
|
42
|
+
const key = e.key;
|
|
43
|
+
const regex = props.pattern;
|
|
44
|
+
if (regex && !(regex === null || regex === void 0 ? void 0 : regex.test(key))) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, hasError: props.hasError, style: props.wrapperStyle, className: props.labelClassName },
|
|
49
|
+
react_1.default.createElement("input", { type: props.type || 'text', id: props.id, ref: props.inputRef, "data-testid": "INPT", autoFocus: (props === null || props === void 0 ? void 0 : props.isAutoFocus) || false, name: props.name, style: props.style, defaultValue: props.defaultValue, placeholder: props.placeholder, required: props.required || false, disabled: props.disabled || false, autoComplete: "given-name", maxLength: props.maxLength, value: props.value, onChange: (e) => props.onChange && props.onChange(e.target.value), onKeyPress: (e) => handleKeyPress(e), className: `${props.className} leading-4 p-2 dark:bg-boxdark focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md `, onBlur: (e) => props.onBlur && props.onBlur(e.target.value), onKeyDown: props.onKeyDown && props.onKeyDown })));
|
|
50
|
+
});
|
|
51
|
+
exports.InputPassword = react_1.default.forwardRef((props, ref) => {
|
|
52
|
+
const [showPassword, setShowPassword] = (0, react_1.useState)(false);
|
|
53
|
+
const handleMouseDown = () => {
|
|
54
|
+
setShowPassword(true);
|
|
55
|
+
};
|
|
56
|
+
const handleMouseUp = () => {
|
|
57
|
+
setShowPassword(false);
|
|
58
|
+
};
|
|
59
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, hasError: props.hasError, style: props.wrapperStyle, className: props.labelClassName },
|
|
60
|
+
react_1.default.createElement("div", { className: "flex items-center relative" },
|
|
61
|
+
react_1.default.createElement("input", { type: showPassword ? 'text' : 'password', id: props.id, ref: props.inputRef, "data-testid": "INPT", autoFocus: (props === null || props === void 0 ? void 0 : props.isAutoFocus) || false, name: props.name, style: props.style, defaultValue: props.defaultValue, placeholder: props.placeholder, required: props.required || false, disabled: props.disabled || false, autoComplete: "given-name", maxLength: props.maxLength, value: props.value, onChange: (e) => props.onChange && props.onChange(e.target.value),
|
|
62
|
+
// onKeyPress={e => handleKeyPress(e)}
|
|
63
|
+
className: `${props.className} leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md dark:bg-boxdark`, onBlur: (e) => props.onBlur && props.onBlur(e.target.value), onKeyDown: props.onKeyDown && props.onKeyDown }),
|
|
64
|
+
react_1.default.createElement("div", { className: "flex absolute right-3" },
|
|
65
|
+
react_1.default.createElement("svg", { className: "h-6 dark:bg-boxdark", fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 576 512", onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp }, showPassword ? (react_1.default.createElement("path", { fill: "currentColor", d: "M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z" })) : (react_1.default.createElement("path", { fill: "currentColor", d: "M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z" })))))));
|
|
66
|
+
});
|
|
67
|
+
exports.Input1 = react_1.default.forwardRef((props, ref) => {
|
|
68
|
+
const handleKeyPress = (e) => {
|
|
69
|
+
const key = e.key;
|
|
70
|
+
const regex = props.pattern;
|
|
71
|
+
if (regex && !(regex === null || regex === void 0 ? void 0 : regex.test(key))) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, hasError: props.hasError, style: props.wrapperStyle, className: props.labelClassName },
|
|
76
|
+
react_1.default.createElement("input", { type: props.type || 'text', id: props.id, ref: props.inputRef, "data-testid": "INPT", autoFocus: (props === null || props === void 0 ? void 0 : props.isAutoFocus) || false, name: props.name, style: props.style, defaultValue: props.defaultValue, placeholder: props.placeholder, required: props.required || false, disabled: props.disabled || false, autoComplete: "given-name", maxLength: props.maxLength, value: props.value, onChange: (e) => props.onChange && props.onChange(e.target.value), onKeyPress: (e) => handleKeyPress(e), className: `${props.className} leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md dark:text-black`, onBlur: (e) => props.onBlur && props.onBlur(e), onKeyDown: props.onKeyDown })));
|
|
77
|
+
});
|
|
78
|
+
exports.Input2 = react_1.default.forwardRef((props, ref) => {
|
|
79
|
+
const [isBlur, setIsBlur] = (0, react_1.useState)(true);
|
|
80
|
+
const handleKeyPress = (e) => {
|
|
81
|
+
const key = e.key;
|
|
82
|
+
const regex = props.pattern;
|
|
83
|
+
if (regex && !(regex === null || regex === void 0 ? void 0 : regex.test(key))) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const handleBlur = (value) => {
|
|
88
|
+
props.onBlur && isBlur && props.onBlur(value);
|
|
89
|
+
};
|
|
90
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, hasError: props.hasError, style: props.wrapperStyle, className: props.labelClassName },
|
|
91
|
+
react_1.default.createElement("input", { type: props.type || 'text', id: props.id, ref: props.inputRef, "data-testid": "INPT", autoFocus: (props === null || props === void 0 ? void 0 : props.isAutoFocus) || false, name: props.name, style: props.style, defaultValue: props.defaultValue, placeholder: props.placeholder, required: props.required || false, disabled: props.disabled || false, autoComplete: "given-name", maxLength: props.maxLength, value: props.value, onChange: (e) => {
|
|
92
|
+
setIsBlur(true);
|
|
93
|
+
props.onChange && props.onChange(e.target.value);
|
|
94
|
+
}, onKeyPress: (e) => handleKeyPress(e), className: `${props.className} leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md dark:text-black`, onKeyDown: (e) => {
|
|
95
|
+
if (e.keyCode == 13) {
|
|
96
|
+
setIsBlur(false);
|
|
97
|
+
props.onBlur && props.onBlur(e.target.value);
|
|
98
|
+
}
|
|
99
|
+
props.onKeyDown && props.onKeyDown(e);
|
|
100
|
+
}, onBlur: (e) => {
|
|
101
|
+
handleBlur(e.target.value);
|
|
102
|
+
} })));
|
|
103
|
+
});
|
|
104
|
+
const MultilineInput = (props) => (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, className: props.className },
|
|
105
|
+
react_1.default.createElement("textarea", { id: props.id, autoComplete: "given-name", value: props.value, disabled: props.disabled, style: props.style, rows: props.rows, onKeyUp: props.onKeyUp && props.onKeyUp, placeholder: props.placeholder, onChange: (e) => props.onChange && props.onChange(e.target.value), onBlur: (e) => props.onBlur && props.onBlur(e.target.value), className: `leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md dark:bg-boxdark`, defaultValue: props.defaultValue })));
|
|
106
|
+
exports.MultilineInput = MultilineInput;
|
|
107
|
+
const MultilineInput1 = (props) => (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, className: props.className },
|
|
108
|
+
react_1.default.createElement("textarea", { id: props.id, autoComplete: "given-name", value: props.value, disabled: props.disabled, style: props.style, rows: props.rows, placeholder: props.placeholder, onChange: (e) => props.onChange && props.onChange(e.target.value), onBlur: (e) => props.onBlur && props.onBlur(e), className: `leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md`, defaultValue: props.defaultValue })));
|
|
109
|
+
exports.MultilineInput1 = MultilineInput1;
|
|
110
|
+
const InputRadio = (props) => {
|
|
111
|
+
var _a;
|
|
112
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, style: props.labelStyle }, (_a = props.values) === null || _a === void 0 ? void 0 : _a.map((item, key) => (react_1.default.createElement("div", { className: "flex items-center gap-2", key: key, onClick: () => {
|
|
113
|
+
props.onChange && props.onChange(item.value);
|
|
114
|
+
} },
|
|
115
|
+
react_1.default.createElement("input", { key: key, type: "radio", id: props.id, name: props.name, value: item.value, checked: item.value == props.value ? true : false, onChange: () => props.onChange && props.onChange(item.value), className: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" }),
|
|
116
|
+
react_1.default.createElement(exports.Label, { htmlFor: props.id || '', style: { marginTop: 6 } }, item.label))))));
|
|
117
|
+
};
|
|
118
|
+
exports.InputRadio = InputRadio;
|
|
119
|
+
const InputDate = ({ name, value, placeholder, use12Hours = true, label, id, hasError, disabled, format, onChange, onFocusRemove, }) => (react_1.default.createElement(exports.InputWrapper, { label: label, id: id, hasError: hasError },
|
|
120
|
+
react_1.default.createElement("input", { type: "date", id: id, name: name, disabled: disabled || false, value: value, onChange: (e) => onChange && onChange(e), className: `leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${hasError ? 'border-red ' : 'border-gray-300'} rounded-md` })));
|
|
121
|
+
exports.InputDate = InputDate;
|
|
122
|
+
const CheckBox = (props) => {
|
|
123
|
+
return (react_1.default.createElement("div", null,
|
|
124
|
+
react_1.default.createElement("input", { key: props.id, onClick: props.handleCheckChieldElement, type: "checkbox", checked: props.isChecked, value: props.value }),
|
|
125
|
+
' ',
|
|
126
|
+
props.value));
|
|
127
|
+
};
|
|
128
|
+
exports.CheckBox = CheckBox;
|
|
129
|
+
const InputFile = (props) => (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id },
|
|
130
|
+
react_1.default.createElement("input", { type: "file", id: props.id, name: props.name, disabled: props.disabled || false, accept: props.accept, value: props.value, onChange: (e) => props.onChange && props.onChange(e), className: `leading-4 p-2 focus:outline-none focus:ring block w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md`, multiple: props.multiple })));
|
|
131
|
+
exports.InputFile = InputFile;
|
|
132
|
+
const Toggle = (props) => {
|
|
133
|
+
const [toggle, setToggle] = (0, react_1.useState)(props.value);
|
|
134
|
+
const { onChange, disabled, className, isToggleLabel = true } = props;
|
|
135
|
+
(0, react_1.useEffect)(() => {
|
|
136
|
+
setToggle(props.value);
|
|
137
|
+
}, [props.value]);
|
|
138
|
+
const triggerToggle = () => {
|
|
139
|
+
if (disabled) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
setToggle(!toggle);
|
|
143
|
+
if (typeof onChange === 'function') {
|
|
144
|
+
onChange(!toggle);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const toggleClasses = (0, classnames_1.default)('wrg-toggle ', {
|
|
148
|
+
'wrg-toggle--checked': toggle,
|
|
149
|
+
'wrg-toggle--disabled': disabled,
|
|
150
|
+
}, className);
|
|
151
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, style: props.style },
|
|
152
|
+
react_1.default.createElement("div", { onClick: triggerToggle, className: toggleClasses },
|
|
153
|
+
react_1.default.createElement("div", { className: 'wrg-toggle-container ' +
|
|
154
|
+
(toggle ? 'bg-green-700' : 'bg-black dark:bg-white') }, isToggleLabel && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
155
|
+
react_1.default.createElement("div", { className: "wrg-toggle-check" },
|
|
156
|
+
react_1.default.createElement("span", { className: "text-white ml-1" }, "Yes")),
|
|
157
|
+
react_1.default.createElement("div", { className: "wrg-toggle-uncheck" },
|
|
158
|
+
react_1.default.createElement("span", { className: "dark:text-black" }, "No"))))),
|
|
159
|
+
react_1.default.createElement("div", { className: `wrg-toggle-circle dark:bg-black ${toggle ? 'ml-1' : 'mr-1'} ` }),
|
|
160
|
+
react_1.default.createElement("input", { type: "checkbox", "aria-label": "Toggle Button", className: "wrg-toggle-input" }))));
|
|
161
|
+
};
|
|
162
|
+
exports.Toggle = Toggle;
|
|
163
|
+
const DeliveryScheduleToggle = (props) => {
|
|
164
|
+
const [toggle, setToggle] = (0, react_1.useState)(props.value);
|
|
165
|
+
const { onChange, disabled, className, isToggleLabel = true } = props;
|
|
166
|
+
(0, react_1.useEffect)(() => {
|
|
167
|
+
setToggle(props.value);
|
|
168
|
+
}, [props.value]);
|
|
169
|
+
const triggerToggle = () => {
|
|
170
|
+
if (disabled) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
setToggle(!toggle);
|
|
174
|
+
if (typeof onChange === 'function') {
|
|
175
|
+
onChange(!toggle);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const toggleClasses = (0, classnames_1.default)('wrg-toggle1 ', {
|
|
179
|
+
'wrg-toggle--checked1': toggle,
|
|
180
|
+
'wrg-toggle--disabled1': disabled,
|
|
181
|
+
}, className);
|
|
182
|
+
return (react_1.default.createElement(exports.InputWrapper, { label: props.label, id: props.id, style: props.style },
|
|
183
|
+
react_1.default.createElement("div", { onClick: triggerToggle, className: toggleClasses },
|
|
184
|
+
react_1.default.createElement("div", { className: 'wrg-toggle-container1 ' +
|
|
185
|
+
(toggle ? 'bg-green-700' : 'bg-black dark:bg-white') }, isToggleLabel && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
186
|
+
react_1.default.createElement("div", { className: "wrg-toggle-check1" },
|
|
187
|
+
react_1.default.createElement("span", { className: "text-white ml-1" }, "Departments")),
|
|
188
|
+
react_1.default.createElement("div", { className: "wrg-toggle-uncheck1" },
|
|
189
|
+
react_1.default.createElement("span", { className: "dark:text-black" }, "Patients"))))),
|
|
190
|
+
react_1.default.createElement("div", { className: `wrg-toggle-circle1 dark:bg-black ${toggle ? 'ml-1' : 'mr-1'} ` }),
|
|
191
|
+
react_1.default.createElement("input", { type: "checkbox", "aria-label": "Toggle Button", className: "wrg-toggle-input1" }))));
|
|
192
|
+
};
|
|
193
|
+
exports.DeliveryScheduleToggle = DeliveryScheduleToggle;
|
|
194
|
+
//# sourceMappingURL=form.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/form/form.component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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AC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MACpB,IAAI,GACC;YACP,yCACE,IAAI,EAAC,UAAU,gBACJ,eAAe,EAC1B,SAAS,EAAC,mBAAmB,GAC7B,CACE,CACO,CAChB,CAAC;AACJ,CAAC,CAAC;AA5DW,QAAA,sBAAsB,0BA4DjC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const react_2 = require("@testing-library/react");
|
|
8
|
+
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
9
|
+
const form_component_1 = require("./form.component");
|
|
10
|
+
describe('Checkbox component', () => {
|
|
11
|
+
it('render checkbox correctly', () => {
|
|
12
|
+
const checkbox = (0, react_2.render)(react_1.default.createElement(form_component_1.CheckBox, null));
|
|
13
|
+
expect(checkbox).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
describe('Input component', () => {
|
|
17
|
+
it('render input correctly', () => {
|
|
18
|
+
const inputComp = (0, react_2.render)(react_1.default.createElement(form_component_1.Input, { type: "text", value: "test", onChange: (val) => jest.fn(), onBlur: (value) => jest.fn(), onKeyDown: (val) => jest.fn() }));
|
|
19
|
+
const input = inputComp.getByTestId('INPT');
|
|
20
|
+
react_2.fireEvent.change(input, { target: { value: 'check' } });
|
|
21
|
+
user_event_1.default.type(input, 'value');
|
|
22
|
+
react_2.fireEvent.blur(input);
|
|
23
|
+
react_2.fireEvent.keyDown(input, {
|
|
24
|
+
key: 'Escape',
|
|
25
|
+
code: 'Escape',
|
|
26
|
+
keyCode: 27,
|
|
27
|
+
charCode: 27,
|
|
28
|
+
});
|
|
29
|
+
react_2.fireEvent.keyPress(input, { key: 'Enter', keyCode: 13 });
|
|
30
|
+
expect(input).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('Toggle component', () => {
|
|
34
|
+
it('render toggle correctly', () => {
|
|
35
|
+
const toggle = (0, react_2.render)(react_1.default.createElement(form_component_1.Toggle, null));
|
|
36
|
+
expect(toggle).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
// describe('SelectOption component', () => {
|
|
40
|
+
// it('render selectOption correctly', () => {
|
|
41
|
+
// const select = render(
|
|
42
|
+
// <SelectOption key='test' onChange={value => jest.fn()} value='test' />,
|
|
43
|
+
// );
|
|
44
|
+
// const selectOption = select.getByTestId('SELECT');
|
|
45
|
+
// fireEvent.change(selectOption, {target: {value: 'check'}});
|
|
46
|
+
// userEvent.type(selectOption, 'value');
|
|
47
|
+
// expect(select).toMatchSnapshot();
|
|
48
|
+
// });
|
|
49
|
+
// });
|
|
50
|
+
describe('MultilineInput component', () => {
|
|
51
|
+
it('render multilineInput correctly', () => {
|
|
52
|
+
const multi = (0, react_2.render)(react_1.default.createElement(form_component_1.MultilineInput, null));
|
|
53
|
+
expect(multi).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
// describe('Clock component', () => {
|
|
57
|
+
// it('render clock correctly', () => {
|
|
58
|
+
// const clock = render(
|
|
59
|
+
// <Clock value='2022-02-20' onChange={value => jest.fn()} />,
|
|
60
|
+
// );
|
|
61
|
+
// expect(clock).toMatchSnapshot();
|
|
62
|
+
// });
|
|
63
|
+
// });
|
|
64
|
+
describe('Label component', () => {
|
|
65
|
+
it('render label correctly', () => {
|
|
66
|
+
const label = (0, react_2.render)(react_1.default.createElement(form_component_1.Label, { htmlFor: "vsdvrf" }));
|
|
67
|
+
expect(label).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('InputDate component', () => {
|
|
71
|
+
it('render inputDate correctly', () => {
|
|
72
|
+
const inputDate = (0, react_2.render)(react_1.default.createElement(form_component_1.InputDate, null));
|
|
73
|
+
expect(inputDate).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
// describe('InputDateTime component', () => {
|
|
77
|
+
// it('render inputDateTime correctly', () => {
|
|
78
|
+
// const inputDateTime = render(<InputDateTime />);
|
|
79
|
+
// expect(inputDateTime).toMatchSnapshot();
|
|
80
|
+
// });
|
|
81
|
+
// });
|
|
82
|
+
describe('InputFile component', () => {
|
|
83
|
+
it('render inputFile correctly', () => {
|
|
84
|
+
const inputFile = (0, react_2.render)(react_1.default.createElement(form_component_1.InputFile, null));
|
|
85
|
+
expect(inputFile).toMatchSnapshot();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe('InputRadio component', () => {
|
|
89
|
+
it('render inputRadio correctly', () => {
|
|
90
|
+
const inputRadio = (0, react_2.render)(react_1.default.createElement(form_component_1.InputRadio, null));
|
|
91
|
+
expect(inputRadio).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
describe('InputWrapper component', () => {
|
|
95
|
+
it('render inputWrapper correctly', () => {
|
|
96
|
+
const inputWrapper = (0, react_2.render)(react_1.default.createElement(form_component_1.InputWrapper, null));
|
|
97
|
+
expect(inputWrapper).toMatchSnapshot();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=form.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.test.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/form/form.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,kDAAyD;AACzD,6EAAoD;AACpD,qDAU0B;AAE1B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAC,8BAAC,yBAAQ,OAAG,CAAC,CAAC;QACtC,MAAM,CAAC,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c);
|
|
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.InputOtp = void 0;
|
|
48
27
|
/* eslint-disable no-console */
|
|
49
28
|
const react_1 = __importStar(require("react"));
|
|
50
29
|
require("./input-otp.styles.css");
|
|
51
|
-
const InputOtp = ({ className, pin, onPinChanged }) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const onKeyDown = (event, index) => {
|
|
83
|
-
console.log({ event, index });
|
|
84
|
-
const keyboardKeyCode = event.nativeEvent.code;
|
|
85
|
-
if (keyboardKeyCode != BACKSPACE_Key) return;
|
|
86
|
-
if (pin[index] === undefined) {
|
|
87
|
-
changePinFocus(index - 1);
|
|
88
|
-
} else {
|
|
89
|
-
onPinChanged(undefined, index);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
return react_1.default.createElement(
|
|
93
|
-
"div",
|
|
94
|
-
{ className: `${className} relative` },
|
|
95
|
-
react_1.default.createElement(
|
|
96
|
-
"div",
|
|
97
|
-
{
|
|
98
|
-
className:
|
|
99
|
-
"flex space-x-1 bg-background-secondary rounded-lg outline-offset-8",
|
|
100
|
-
},
|
|
101
|
-
Array.from({ length: pinLength }, (_, index) =>
|
|
102
|
-
react_1.default.createElement("input", {
|
|
103
|
-
"data-testid": "onPinChanged",
|
|
104
|
-
className:
|
|
105
|
-
"pt-3 pb-2 block w-full px-0 text-5xl font-extrabold border-b-0 text-orange mt-0 bg-transparent text-center z-20 appearance-none focus:outline-none font-nunitoSansRegular",
|
|
106
|
-
onKeyDown: (event) => onKeyDown(event, index),
|
|
107
|
-
key: index,
|
|
108
|
-
onMouseUp: () => {
|
|
109
|
-
if (pin.join("").length <= 0) {
|
|
110
|
-
changePinFocus(0);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
onClick: () => {
|
|
114
|
-
if (pin.join("").length <= 0) {
|
|
115
|
-
onPinChanged(undefined, 0);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
ref: (el) => {
|
|
119
|
-
if (el) {
|
|
120
|
-
inputRefs.current[index] = el;
|
|
30
|
+
const InputOtp = ({ className, pin, onPinChanged, }) => {
|
|
31
|
+
const pinLength = 6;
|
|
32
|
+
const Pin_Min_Value = 0;
|
|
33
|
+
const Pin_Max_Value = 9;
|
|
34
|
+
const BACKSPACE_Key = 'Backspace';
|
|
35
|
+
const inputRefs = (0, react_1.useRef)([]);
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
37
|
+
const ref = inputRefs.current[0];
|
|
38
|
+
if (ref) {
|
|
39
|
+
ref.focus();
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
const changePinFocus = (pinIndex) => {
|
|
43
|
+
const ref = inputRefs.current[pinIndex];
|
|
44
|
+
if (ref) {
|
|
45
|
+
ref.focus();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const onChange = (event, index) => {
|
|
49
|
+
const value = event.target.value;
|
|
50
|
+
const pinNumber = Number(value.trim());
|
|
51
|
+
if (isNaN(pinNumber) || value.length === 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
|
|
55
|
+
onPinChanged(pinNumber, index);
|
|
56
|
+
if (index < pinLength - 1) {
|
|
57
|
+
changePinFocus(index + 1);
|
|
121
58
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const onKeyDown = (event, index) => {
|
|
62
|
+
console.log({ event, index });
|
|
63
|
+
const keyboardKeyCode = event.nativeEvent.code;
|
|
64
|
+
if (keyboardKeyCode != BACKSPACE_Key)
|
|
65
|
+
return;
|
|
66
|
+
if (pin[index] === undefined) {
|
|
67
|
+
changePinFocus(index - 1);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
onPinChanged(undefined, index);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return (react_1.default.createElement("div", { className: `${className} relative` },
|
|
74
|
+
react_1.default.createElement("div", { className: "flex space-x-1 bg-background-secondary rounded-lg outline-offset-8" }, Array.from({ length: pinLength }, (_, index) => (react_1.default.createElement("input", { "data-testid": "onPinChanged", className: "pt-3 pb-2 block w-full px-0 text-5xl font-extrabold border-b-0 text-orange mt-0 bg-transparent text-center z-20 appearance-none focus:outline-none font-nunitoSansRegular", onKeyDown: (event) => onKeyDown(event, index), key: index, onMouseUp: () => {
|
|
75
|
+
if (pin.join('').length <= 0) {
|
|
76
|
+
changePinFocus(0);
|
|
77
|
+
}
|
|
78
|
+
}, onClick: () => {
|
|
79
|
+
if (pin.join('').length <= 0) {
|
|
80
|
+
onPinChanged(undefined, 0);
|
|
81
|
+
}
|
|
82
|
+
}, ref: (el) => {
|
|
83
|
+
if (el) {
|
|
84
|
+
inputRefs.current[index] = el;
|
|
85
|
+
}
|
|
86
|
+
}, onChange: (event) => onChange(event, index), value: pin[index] || '' }))))));
|
|
129
87
|
};
|
|
130
88
|
exports.InputOtp = InputOtp;
|
|
131
|
-
//# sourceMappingURL=input-otp.component.js.map
|
|
89
|
+
//# sourceMappingURL=input-otp.component.js.map
|