react-restyle-components 0.1.84 → 0.1.86
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/index.d.ts +2 -0
- package/lib/cjs/index.js +18 -0
- package/lib/cjs/src/App.d.ts +4 -0
- package/lib/cjs/src/App.js +15 -0
- package/lib/cjs/src/core-components/atoms/buttons/button.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/buttons/button.stories.js +42 -0
- package/lib/cjs/src/core-components/atoms/buttons/buttons.component.d.ts +11 -0
- package/lib/cjs/src/core-components/atoms/buttons/buttons.component.js +15 -0
- package/lib/cjs/src/core-components/atoms/buttons/buttons.test.js +13 -0
- package/lib/cjs/src/core-components/atoms/check-box/checkBox.component.d.ts +11 -0
- package/lib/cjs/src/core-components/atoms/check-box/checkBox.component.js +47 -0
- package/lib/cjs/src/core-components/atoms/check-box/checkBox.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/check-box/checkBox.stories.js +26 -0
- package/lib/cjs/src/core-components/atoms/check-box/checkBox.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/check-box/checkBox.test.js +13 -0
- package/lib/cjs/src/core-components/atoms/date-picker/date-picker.component.d.ts +13 -0
- package/lib/cjs/src/core-components/atoms/date-picker/date-picker.component.js +52 -0
- package/lib/cjs/src/core-components/atoms/date-picker/date-picker.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/date-picker/date-picker.stories.js +24 -0
- package/lib/cjs/src/core-components/atoms/date-picker/date-picker.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/date-picker/date-picker.test.js +14 -0
- package/lib/cjs/src/core-components/atoms/form/form.component.d.ts +102 -0
- package/lib/cjs/src/core-components/atoms/form/form.component.js +192 -0
- package/lib/cjs/src/core-components/atoms/form/form.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/form/form.test.js +99 -0
- package/lib/cjs/src/core-components/atoms/icons/icons.component.d.ts +11 -0
- package/lib/cjs/src/core-components/atoms/icons/icons.component.js +66 -0
- package/lib/cjs/src/core-components/atoms/icons/icons.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/icons/icons.stories.js +22 -0
- package/lib/cjs/src/core-components/atoms/icons/icons.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/icons/icons.test.js +15 -0
- package/lib/cjs/src/core-components/atoms/input/input-otp.component.d.ts +15 -0
- package/lib/cjs/src/core-components/atoms/input/input-otp.component.js +88 -0
- package/lib/cjs/src/core-components/atoms/input/input-pin.component.d.ts +16 -0
- package/lib/cjs/src/core-components/atoms/input/input-pin.component.js +107 -0
- package/lib/cjs/src/core-components/atoms/input/input-pin.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/input/input-pin.stories.js +23 -0
- package/lib/cjs/src/core-components/atoms/input/input-pin.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/input/input-pin.test.js +17 -0
- package/lib/cjs/src/core-components/atoms/input/input.component.d.ts +19 -0
- package/lib/cjs/src/core-components/atoms/input/input.component.js +45 -0
- package/lib/cjs/src/core-components/atoms/input/input.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/input/input.stories.js +24 -0
- package/lib/cjs/src/core-components/atoms/input/input.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/input/input.test.js +17 -0
- package/lib/cjs/src/core-components/atoms/input-dropdown/input-dropdown.component.d.ts +11 -0
- package/lib/cjs/src/core-components/atoms/input-dropdown/input-dropdown.component.js +64 -0
- package/lib/cjs/src/core-components/atoms/input-dropdown/input-dropdown.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/input-dropdown/input-dropdown.stories.js +20 -0
- package/lib/cjs/src/core-components/atoms/input-dropdown/input-dropdown.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/input-dropdown/input-dropdown.test.js +13 -0
- package/lib/cjs/src/core-components/atoms/loader/loader.component.d.ts +4 -0
- package/lib/cjs/src/core-components/atoms/loader/loader.component.js +61 -0
- package/lib/cjs/src/core-components/atoms/loader/loader.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/loader/loader.stories.js +16 -0
- package/lib/cjs/src/core-components/atoms/loader/loader.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/loader/loader.test.js +13 -0
- package/lib/cjs/src/core-components/atoms/radio/radio.component.d.ts +10 -0
- package/lib/cjs/src/core-components/atoms/radio/radio.component.js +49 -0
- package/lib/cjs/src/core-components/atoms/radio/radio.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/radio/radio.stories.js +25 -0
- package/lib/cjs/src/core-components/atoms/radio/radio.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/radio/radio.test.js +13 -0
- package/lib/cjs/src/core-components/atoms/stepper/stepper.component.d.ts +10 -0
- package/lib/cjs/src/core-components/atoms/stepper/stepper.component.js +42 -0
- package/lib/cjs/src/core-components/atoms/stepper/stepper.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/stepper/stepper.stories.js +21 -0
- package/lib/cjs/src/core-components/atoms/stepper/stepper.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/stepper/stepper.test.js +12 -0
- package/lib/cjs/src/core-components/atoms/tabs/tabs.component.d.ts +11 -0
- package/lib/cjs/src/core-components/atoms/tabs/tabs.component.js +46 -0
- package/lib/cjs/src/core-components/atoms/tabs/tabs.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/tabs/tabs.stories.js +25 -0
- package/lib/cjs/src/core-components/atoms/tabs/tabs.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/tabs/tabs.test.js +18 -0
- package/lib/cjs/src/core-components/atoms/timer/timer.component.d.ts +7 -0
- package/lib/cjs/src/core-components/atoms/timer/timer.component.js +106 -0
- package/lib/cjs/src/core-components/atoms/timer/timer.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/timer/timer.test.js +19 -0
- package/lib/cjs/src/core-components/atoms/tooltip/tooltip.component.d.ts +10 -0
- package/lib/cjs/src/core-components/atoms/tooltip/tooltip.component.js +56 -0
- package/lib/cjs/src/core-components/atoms/tooltip/tooltip.component.test.d.ts +1 -0
- package/lib/cjs/src/core-components/atoms/tooltip/tooltip.component.test.js +14 -0
- package/lib/cjs/src/core-components/atoms/tooltip/tooltip.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/atoms/tooltip/tooltip.stories.js +16 -0
- package/lib/cjs/src/core-components/index.d.ts +24 -0
- package/lib/cjs/src/core-components/index.js +53 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts +18 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +119 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.d.ts +1 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +14 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +48 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.d.ts +17 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +120 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.d.ts +1 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +21 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +31 -0
- package/lib/cjs/src/core-components/molecules/autocomplete/autocomplete.d.ts +9 -0
- package/lib/cjs/src/core-components/molecules/autocomplete/autocomplete.js +144 -0
- package/lib/cjs/src/core-components/molecules/autocomplete/autocomplete.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/autocomplete/autocomplete.stories.js +20 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-multiline-input.component.d.ts +12 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-multiline-input.component.js +124 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-multiline-input.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +16 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-multiline-input.test.d.ts +1 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-multiline-input.test.js +15 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-properties.d.ts +8931 -0
- package/lib/cjs/src/core-components/molecules/css-multiline-input/css-properties.js +164 -0
- package/lib/cjs/src/core-components/molecules/modal-confirm/modal-confirm.component.d.ts +12 -0
- package/lib/cjs/src/core-components/molecules/modal-confirm/modal-confirm.component.js +60 -0
- package/lib/cjs/src/core-components/molecules/modal-confirm/modal-confirm.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/modal-confirm/modal-confirm.stories.js +23 -0
- package/lib/cjs/src/core-components/molecules/modal-confirm/modal-confirm.test.d.ts +1 -0
- package/lib/cjs/src/core-components/molecules/modal-confirm/modal-confirm.test.js +15 -0
- package/lib/cjs/src/core-components/molecules/multi-select/multi-select.component.d.ts +9 -0
- package/lib/cjs/src/core-components/molecules/multi-select/multi-select.component.js +79 -0
- package/lib/cjs/src/core-components/molecules/multi-select/multi-select.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/multi-select/multi-select.stories.js +22 -0
- package/lib/cjs/src/core-components/molecules/multi-select/multi-select.test.d.ts +1 -0
- package/lib/cjs/src/core-components/molecules/multi-select/multi-select.test.js +15 -0
- package/lib/cjs/src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.d.ts +10 -0
- package/lib/cjs/src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.js +88 -0
- package/lib/cjs/src/core-components/molecules/multi-select-with-field/multi-select-with-field.stories.d.ts +6 -0
- package/lib/cjs/src/core-components/molecules/multi-select-with-field/multi-select-with-field.stories.js +23 -0
- package/lib/cjs/src/core-components/molecules/multi-select-with-field/multi-select-with-field.test.d.ts +1 -0
- package/lib/cjs/src/core-components/molecules/multi-select-with-field/multi-select-with-field.test.js +17 -0
- package/lib/cjs/src/core-utils/index.d.ts +1 -0
- package/lib/cjs/src/core-utils/index.js +17 -0
- package/lib/cjs/src/core-utils/unit-test.utils.d.ts +4 -0
- package/lib/cjs/src/core-utils/unit-test.utils.js +16 -0
- package/lib/cjs/src/index.d.ts +1 -0
- package/lib/cjs/src/index.js +17 -0
- package/lib/cjs/src/library/assets/svg/index.d.ts +9 -0
- package/lib/cjs/src/library/assets/svg/index.js +40 -0
- package/lib/cjs/src/reportWebVitals.d.ts +3 -0
- package/lib/cjs/src/reportWebVitals.js +37 -0
- package/lib/cjs/src/setupTests.d.ts +1 -0
- package/lib/cjs/src/setupTests.js +7 -0
- package/lib/package.json +24 -97
- package/lib/src/App.js +5 -9
- package/lib/src/core-components/atoms/buttons/buttons.component.d.ts +1 -1
- package/lib/src/core-components/atoms/buttons/buttons.component.js +1 -1
- package/lib/src/core-components/atoms/check-box/checkBox.component.d.ts +1 -1
- package/lib/src/core-components/atoms/check-box/checkBox.component.js +2 -2
- package/lib/src/core-components/atoms/check-box/checkBox.stories.d.ts +1 -1
- package/lib/src/core-components/atoms/check-box/checkBox.stories.js +1 -1
- package/lib/src/core-components/atoms/date-picker/date-picker.component.d.ts +1 -1
- package/lib/src/core-components/atoms/date-picker/date-picker.component.js +1 -1
- package/lib/src/core-components/atoms/form/form.component.d.ts +2 -2
- package/lib/src/core-components/atoms/form/form.component.js +2 -2
- package/lib/src/core-components/atoms/icons/icons.component.d.ts +1 -2
- package/lib/src/core-components/atoms/icons/icons.component.js +1 -1
- package/lib/src/core-components/atoms/input/input-otp.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input/input-otp.component.js +1 -1
- package/lib/src/core-components/atoms/input/input-pin.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input/input-pin.component.js +1 -1
- package/lib/src/core-components/atoms/input/input.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input/input.component.js +1 -1
- package/lib/src/core-components/atoms/input-dropdown/input-dropdown.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input-dropdown/input-dropdown.component.js +1 -1
- package/lib/src/core-components/atoms/loader/loader.component.d.ts +1 -1
- package/lib/src/core-components/atoms/loader/loader.component.js +1 -1
- package/lib/src/core-components/atoms/radio/radio.component.d.ts +1 -1
- package/lib/src/core-components/atoms/radio/radio.component.js +1 -1
- package/lib/src/core-components/atoms/stepper/stepper.component.d.ts +1 -1
- package/lib/src/core-components/atoms/stepper/stepper.component.js +1 -1
- package/lib/src/core-components/atoms/tabs/tabs.component.d.ts +1 -1
- package/lib/src/core-components/atoms/tabs/tabs.component.js +1 -1
- package/lib/src/core-components/atoms/timer/timer.component.d.ts +1 -1
- package/lib/src/core-components/atoms/timer/timer.component.js +1 -1
- package/lib/src/core-components/atoms/tooltip/tooltip.component.d.ts +1 -1
- package/lib/src/core-components/atoms/tooltip/tooltip.component.js +1 -1
- package/lib/src/core-components/index.d.ts +2 -1
- package/lib/src/core-components/index.js +2 -1
- package/lib/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.d.ts +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +1 -1
- package/lib/src/core-components/molecules/autocomplete/autocomplete.css +46 -0
- package/lib/src/core-components/molecules/autocomplete/autocomplete.d.ts +9 -0
- package/lib/src/core-components/molecules/autocomplete/autocomplete.js +117 -0
- package/lib/src/core-components/molecules/autocomplete/autocomplete.stories.d.ts +6 -0
- package/lib/src/core-components/molecules/autocomplete/autocomplete.stories.js +17 -0
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.d.ts +1 -1
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.js +1 -1
- package/lib/src/core-components/molecules/modal-confirm/modal-confirm.component.d.ts +2 -1
- package/lib/src/core-components/molecules/modal-confirm/modal-confirm.component.js +2 -2
- package/lib/src/core-components/molecules/modal-confirm/modal-confirm.stories.d.ts +1 -1
- package/lib/src/core-components/molecules/modal-confirm/modal-confirm.stories.js +1 -1
- package/lib/src/index.css +17 -4
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +12 -1
- package/lib/src/reportWebVitals.d.ts +3 -1
- package/lib/src/reportWebVitals.js +12 -2
- package/lib/src/tc.css +1 -0
- package/lib/tc.css +1 -1
- package/package.json +23 -96
- package/lib/src/App.test.js +0 -8
- /package/lib/{src/App.test.d.ts → cjs/src/core-components/atoms/buttons/buttons.test.d.ts} +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.InputPin = void 0;
|
|
27
|
+
/* eslint-disable */
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
require("./input.styles.css");
|
|
30
|
+
require("../../../tc.css");
|
|
31
|
+
const InputPin = ({ title, className, defaultPin, errorMsg, defaultMsg, hasError, onPinChanged, }) => {
|
|
32
|
+
const pin = (0, react_1.useRef)([]);
|
|
33
|
+
const [reload, setReload] = (0, react_1.useState)(false);
|
|
34
|
+
const pinLength = 12;
|
|
35
|
+
const Pin_Min_Value = 0;
|
|
36
|
+
const Pin_Max_Value = 9;
|
|
37
|
+
const BACKSPACE_Key = 'Backspace';
|
|
38
|
+
const inputRefs = (0, react_1.useRef)([]);
|
|
39
|
+
const removeValuesFromArray = (valuesArray, value) => {
|
|
40
|
+
const valueIndex = valuesArray.findIndex((entry) => entry === value);
|
|
41
|
+
if (valueIndex === -1) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
valuesArray.splice(valueIndex, 1);
|
|
45
|
+
};
|
|
46
|
+
const changePinFocus = (pinIndex) => {
|
|
47
|
+
const ref = inputRefs.current[pinIndex];
|
|
48
|
+
if (ref) {
|
|
49
|
+
ref.focus();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const onChange = (event, index) => {
|
|
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[pin.current?.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) => (react_1.default.createElement("div", { className: "flex space-x-1 max-w-full items-stretch", key: index },
|
|
90
|
+
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: () => {
|
|
91
|
+
if (pin.current.join('').length <= 0) {
|
|
92
|
+
changePinFocus(0);
|
|
93
|
+
}
|
|
94
|
+
}, onClick: () => {
|
|
95
|
+
if (pin.current.join('').length <= 0) {
|
|
96
|
+
onPinChanged(undefined, 0);
|
|
97
|
+
}
|
|
98
|
+
}, ref: (el) => {
|
|
99
|
+
if (el) {
|
|
100
|
+
inputRefs.current[index] = el;
|
|
101
|
+
}
|
|
102
|
+
}, onChange: (event) => onChange(event, index), value: pin.current[index]?.toString() || '' }),
|
|
103
|
+
react_1.default.createElement("div", { className: "invisible" }, (index + 1) % 4 === 0 ? 'ss' : null))))),
|
|
104
|
+
hasError && hasError?.type !== 'required' && (react_1.default.createElement("span", { className: "text-sm text-red text-4xs font-nunitoSansRegular", id: "error" }, `${errorMsg || ''}`)),
|
|
105
|
+
(!hasError || hasError?.type === 'required') && (react_1.default.createElement("span", { className: "text-sm text-4xs font-nunitoSansRegular", id: "error" }, `${defaultMsg || ''}`))));
|
|
106
|
+
};
|
|
107
|
+
exports.InputPin = InputPin;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Primary = void 0;
|
|
4
|
+
const input_pin_component_1 = require("./input-pin.component");
|
|
5
|
+
const meta = {
|
|
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
|
+
};
|
|
13
|
+
exports.default = meta;
|
|
14
|
+
exports.Primary = {
|
|
15
|
+
args: {
|
|
16
|
+
title: 'Enter your Aadhaar Number',
|
|
17
|
+
hasError: true,
|
|
18
|
+
defaultPin: [],
|
|
19
|
+
onPinChanged: (item) => {
|
|
20
|
+
console.log({ item });
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/* eslint-disable testing-library/render-result-naming-convention */
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const _core_utils_1 = require("@core-utils");
|
|
9
|
+
const input_pin_component_1 = require("./input-pin.component");
|
|
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();
|
|
13
|
+
});
|
|
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();
|
|
17
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './input.styles.css';
|
|
3
|
+
import '../../../tc.css';
|
|
4
|
+
interface InputProps {
|
|
5
|
+
title: string;
|
|
6
|
+
defaultValue: string;
|
|
7
|
+
hasError?: any;
|
|
8
|
+
errorMsg?: string;
|
|
9
|
+
defaultMsg?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
disable?: boolean;
|
|
12
|
+
inputStyle?: string;
|
|
13
|
+
autoComplete?: 'off' | 'on';
|
|
14
|
+
maxlength?: number;
|
|
15
|
+
onChange: (value: any) => void;
|
|
16
|
+
onBlur?: (value: any) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const Input: ({ title, defaultValue, className, disable, hasError, errorMsg, defaultMsg, inputStyle, autoComplete, maxlength, onChange, onBlur, }: InputProps) => React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Input = void 0;
|
|
27
|
+
/* eslint-disable no-console */
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
require("./input.styles.css");
|
|
30
|
+
require("../../../tc.css");
|
|
31
|
+
const Input = ({ title, defaultValue, className, disable, hasError, errorMsg, defaultMsg, inputStyle, autoComplete, maxlength = 40, onChange, onBlur, }) => {
|
|
32
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
33
|
+
const onKeyUpValue = (event) => {
|
|
34
|
+
onChange(event.target.value);
|
|
35
|
+
};
|
|
36
|
+
return (react_1.default.createElement("div", { className: `${className} relative` },
|
|
37
|
+
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) => {
|
|
38
|
+
setValue(e.target.value);
|
|
39
|
+
onChange && onChange(e.target.value);
|
|
40
|
+
}, onKeyUp: onKeyUpValue, onBlur: (e) => onBlur && onBlur(e.target.value), autoComplete: autoComplete, maxLength: maxlength }),
|
|
41
|
+
react_1.default.createElement("label", { className: "absolute duration-300 top-3 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md" }, title),
|
|
42
|
+
hasError && hasError?.type !== 'required' && (react_1.default.createElement("span", { className: "text-sm text-red text-4xs", id: "error" }, `${errorMsg || ''}`)),
|
|
43
|
+
(!hasError || hasError?.type === 'required') && (react_1.default.createElement("span", { className: "text-sm text-4xs", id: "error" }, `${defaultMsg || ''}`))));
|
|
44
|
+
};
|
|
45
|
+
exports.Input = Input;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Primary = void 0;
|
|
4
|
+
const input_component_1 = require("./input.component");
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Design System/Atoms/Input',
|
|
7
|
+
component: input_component_1.Input,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
exports.default = meta;
|
|
11
|
+
exports.Primary = {
|
|
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
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/* eslint-disable testing-library/render-result-naming-convention */
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const _core_utils_1 = require("@core-utils");
|
|
9
|
+
const input_component_1 = require("./input.component");
|
|
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();
|
|
13
|
+
});
|
|
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();
|
|
17
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../tc.css';
|
|
3
|
+
interface InputDropdownProps {
|
|
4
|
+
title: string;
|
|
5
|
+
items: Array<string>;
|
|
6
|
+
hasError?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onChange?: (item: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const InputDropdown: ({ items, className, hasError, title, onChange, }: InputDropdownProps) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.InputDropdown = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const svg_1 = require("../../../library/assets/svg");
|
|
29
|
+
require("../../../tc.css");
|
|
30
|
+
const InputDropdown = ({ items, className, hasError, title, onChange, }) => {
|
|
31
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
32
|
+
const [value, setValue] = (0, react_1.useState)('');
|
|
33
|
+
const useOutsideAlerter = (ref) => {
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
function handleClickOutside(event) {
|
|
36
|
+
if (ref.current &&
|
|
37
|
+
!ref.current.contains(event.target) &&
|
|
38
|
+
isOpen &&
|
|
39
|
+
isOpen)
|
|
40
|
+
setIsOpen(!isOpen);
|
|
41
|
+
}
|
|
42
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
43
|
+
return () => {
|
|
44
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
45
|
+
};
|
|
46
|
+
}, [ref]);
|
|
47
|
+
};
|
|
48
|
+
const wrapperRef = (0, react_1.useRef)(null);
|
|
49
|
+
useOutsideAlerter(wrapperRef);
|
|
50
|
+
return (react_1.default.createElement("div", { className: `${className} relative` },
|
|
51
|
+
react_1.default.createElement("div", { className: "flex flex-row items-center " },
|
|
52
|
+
react_1.default.createElement("input", { type: "text", name: "name", placeholder: title, value: value, className: " pt-3 pb-2 w-full px-0 mt-0 bg-transparent border-gray-secondary border-0 border-b appearance-none focus:outline-none focus:ring-0 font-nunitoSansRegular text-md", onClick: () => {
|
|
53
|
+
setIsOpen(!isOpen);
|
|
54
|
+
}, onChange: (event) => onChange && onChange(event.target.value) }),
|
|
55
|
+
!isOpen && (react_1.default.createElement("img", { src: svg_1.UpArrow, className: "absolute h-4 w-4 right-0" })),
|
|
56
|
+
isOpen && (react_1.default.createElement("img", { src: svg_1.DownArrow, className: "absolute h-4 w-4 right-0" }))),
|
|
57
|
+
isOpen && (react_1.default.createElement("div", { className: "z-10 w-full absolute text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700", ref: wrapperRef },
|
|
58
|
+
react_1.default.createElement("ul", { className: "py-1" }, items.map((item, index) => (react_1.default.createElement("li", { key: index, className: "block py-2 px-4 text-md hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 font-nunitoSansRegular", onClick: () => {
|
|
59
|
+
setValue(item);
|
|
60
|
+
setIsOpen(!isOpen);
|
|
61
|
+
} }, item)))))),
|
|
62
|
+
hasError && (react_1.default.createElement("span", { className: "text-primaryCharcoal text-4xs", id: "error" }, `${title} is required`))));
|
|
63
|
+
};
|
|
64
|
+
exports.InputDropdown = InputDropdown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { InputDropdown } from './input-dropdown.component';
|
|
3
|
+
declare const meta: Meta<typeof InputDropdown>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof InputDropdown>;
|
|
6
|
+
export declare const Primary: Story;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Primary = void 0;
|
|
4
|
+
const input_dropdown_component_1 = require("./input-dropdown.component");
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Design System/Atoms/InputDropdown',
|
|
7
|
+
component: input_dropdown_component_1.InputDropdown,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
componentSubtitle: `import { InputDropdown } from 'react-restyle-components'`,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = meta;
|
|
14
|
+
exports.Primary = {
|
|
15
|
+
args: {
|
|
16
|
+
title: 'Source of funds',
|
|
17
|
+
items: ['Bank account', 'UPI', 'Credit Card'],
|
|
18
|
+
hasError: true,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/* eslint-disable testing-library/render-result-naming-convention */
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const _core_utils_1 = require("@core-utils");
|
|
9
|
+
const input_dropdown_component_1 = require("./input-dropdown.component");
|
|
10
|
+
it('render InputDropdown correctly', () => {
|
|
11
|
+
const inputDropDown = (0, _core_utils_1.render)(react_1.default.createElement(input_dropdown_component_1.InputDropdown, { title: "Source of funds", items: ['Bank account', 'UPI', 'Credit Card'], hasError: true, onChange: () => jest.fn() }));
|
|
12
|
+
expect(inputDropDown).toMatchSnapshot();
|
|
13
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
exports.ModalLoader = exports.Loader = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const reactstrap_1 = require("reactstrap");
|
|
9
|
+
require("../../../tc.css");
|
|
10
|
+
const Loader = () => (react_1.default.createElement(reactstrap_1.Container, { fluid: true, className: "vh-50 d-flex" },
|
|
11
|
+
react_1.default.createElement(reactstrap_1.Row, { className: "justify-content-center align-self-center w-100 text-center" },
|
|
12
|
+
react_1.default.createElement(reactstrap_1.Spinner, { color: "primary" }))));
|
|
13
|
+
exports.Loader = Loader;
|
|
14
|
+
const ModalLoader = () => {
|
|
15
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
16
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
+
react_1.default.createElement("div", { className: "justify-center items-center flex overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none" },
|
|
18
|
+
react_1.default.createElement("div", { className: "relative mx-auto " },
|
|
19
|
+
react_1.default.createElement("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none" },
|
|
20
|
+
react_1.default.createElement("div", { className: "relative p-2 flex-auto flex flex-col items-center" },
|
|
21
|
+
react_1.default.createElement("style", null, `
|
|
22
|
+
.spinner .background {
|
|
23
|
+
fill: #555;
|
|
24
|
+
}
|
|
25
|
+
.spinner .line {
|
|
26
|
+
animation: PacMan 5s infinite;
|
|
27
|
+
fill: none;
|
|
28
|
+
stroke: #d26188;
|
|
29
|
+
stroke-width: 25;
|
|
30
|
+
}
|
|
31
|
+
.spinner .spinner {
|
|
32
|
+
animation: Spin 2s infinite linear;
|
|
33
|
+
}
|
|
34
|
+
@keyframes PacMan {
|
|
35
|
+
0% {
|
|
36
|
+
stroke-dasharray: 79px 79;
|
|
37
|
+
}
|
|
38
|
+
50% {
|
|
39
|
+
stroke-dasharray: 1px 79;
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
stroke-dasharray: 79px 79;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
@keyframes Spin {
|
|
46
|
+
0% {
|
|
47
|
+
transform: rotate(0deg);
|
|
48
|
+
}
|
|
49
|
+
100% {
|
|
50
|
+
transform: rotate(360deg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`),
|
|
54
|
+
react_1.default.createElement("svg", { className: "spinner", width: "100", height: "100", viewBox: "0 0 100 100" },
|
|
55
|
+
react_1.default.createElement("circle", { className: "background", cx: "0", cy: "0" }),
|
|
56
|
+
react_1.default.createElement("path", { className: "line", d: "M 37.5,50 C 37.5,43.096441 43.096441,37.5 50,37.5 C 56.903559,37.5 62.5,43.096441 62.5,50 C 62.5,56.903559 56.903559,62.5 50,62.5 C 43.096441,62.5 37.5,56.903559 37.5,50" })),
|
|
57
|
+
' ',
|
|
58
|
+
react_1.default.createElement("span", { style: { marginTop: -15 } }, "loading ..."))))),
|
|
59
|
+
react_1.default.createElement("div", { className: "opacity-25 fixed inset-0 z-40 bg-black" }))));
|
|
60
|
+
};
|
|
61
|
+
exports.ModalLoader = ModalLoader;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Primary = void 0;
|
|
4
|
+
const loader_component_1 = require("./loader.component");
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Design System/Atoms/Loader',
|
|
7
|
+
component: loader_component_1.Loader,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
componentSubtitle: `import { Loader } from 'react-restyle-components'`,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = meta;
|
|
14
|
+
exports.Primary = {
|
|
15
|
+
args: {},
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/* eslint-disable testing-library/render-result-naming-convention */
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const _core_utils_1 = require("@core-utils");
|
|
9
|
+
const loader_component_1 = require("./loader.component");
|
|
10
|
+
it('render Loader correctly', () => {
|
|
11
|
+
const loader = (0, _core_utils_1.render)(react_1.default.createElement(loader_component_1.Loader, null));
|
|
12
|
+
expect(loader).toMatchSnapshot();
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../tc.css';
|
|
3
|
+
interface RadioProps {
|
|
4
|
+
title: string;
|
|
5
|
+
data: Array<any>;
|
|
6
|
+
className?: string;
|
|
7
|
+
onChange: (item: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Radio: ({ title, data, className, onChange, }: RadioProps) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Radio = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const svg_1 = require("../../../library/assets/svg");
|
|
29
|
+
const form_component_1 = require("../form/form.component");
|
|
30
|
+
require("../../../tc.css");
|
|
31
|
+
const Radio = ({ title = 'Source', data = [], className, onChange, }) => {
|
|
32
|
+
const [list, setList] = (0, react_1.useState)(data);
|
|
33
|
+
const width = 20;
|
|
34
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
35
|
+
react_1.default.createElement(form_component_1.InputWrapper, { label: title }, list?.map((item, index) => (react_1.default.createElement("div", { className: `${className} flex items-center mb-1`, onClick: () => {
|
|
36
|
+
const result = list?.map((e, i) => {
|
|
37
|
+
if (i == index)
|
|
38
|
+
return { ...e, checked: true };
|
|
39
|
+
else
|
|
40
|
+
return { ...e, checked: false };
|
|
41
|
+
});
|
|
42
|
+
setList(result);
|
|
43
|
+
onChange(result?.find((item) => item.checked));
|
|
44
|
+
}, key: index },
|
|
45
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-1 items-center" },
|
|
46
|
+
item.checked ? (react_1.default.createElement(svg_1.CheckedRadio, { width: width, height: width })) : (react_1.default.createElement(svg_1.UncheckRadio, { width: width, height: width })),
|
|
47
|
+
react_1.default.createElement("span", { className: "text-4xs" }, item?.title))))))));
|
|
48
|
+
};
|
|
49
|
+
exports.Radio = Radio;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Primary = void 0;
|
|
4
|
+
const radio_component_1 = require("./radio.component");
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Design System/Atoms/Radio',
|
|
7
|
+
component: radio_component_1.Radio,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
componentSubtitle: `import { Radio } from 'react-restyle-components'`,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = meta;
|
|
14
|
+
exports.Primary = {
|
|
15
|
+
args: {
|
|
16
|
+
title: 'Source',
|
|
17
|
+
data: [
|
|
18
|
+
{ title: 'Salary', checked: false },
|
|
19
|
+
{ title: 'Business', checked: false },
|
|
20
|
+
],
|
|
21
|
+
onChange: (item) => {
|
|
22
|
+
console.log({ item });
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/* eslint-disable testing-library/render-result-naming-convention */
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const _core_utils_1 = require("@core-utils");
|
|
9
|
+
const radio_component_1 = require("./radio.component");
|
|
10
|
+
it('render Radio correctly', () => {
|
|
11
|
+
const radio = (0, _core_utils_1.render)(react_1.default.createElement(radio_component_1.Radio, { title: "Title", data: [], onChange: () => jest.fn() }));
|
|
12
|
+
expect(radio).toMatchSnapshot();
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../tc.css';
|
|
3
|
+
interface StepperProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
steps: Array<string>;
|
|
6
|
+
currentStep: number;
|
|
7
|
+
onStepClick: (currentStep: any, index: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Stepper: ({ className, steps, currentStep, onStepClick, }: StepperProps) => React.JSX.Element;
|
|
10
|
+
export {};
|