react-restyle-components 0.1.45 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/App.js +12 -36
- package/lib/cjs/App.test.js +8 -10
- package/lib/cjs/core-components/atoms/buttons/button.stories.js +24 -26
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +9 -27
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js +7 -15
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +35 -102
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +7 -15
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +37 -98
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +15 -17
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +7 -16
- package/lib/cjs/core-components/atoms/form/form.component.js +159 -571
- package/lib/cjs/core-components/atoms/form/form.test.js +59 -87
- package/lib/cjs/core-components/atoms/icons/icons.component.js +58 -41
- package/lib/cjs/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/icons/icons.stories.js +23 -0
- package/lib/cjs/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js +16 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/input/input-otp.component.js +76 -118
- package/lib/cjs/core-components/atoms/input/input-pin.component.js +98 -180
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
- package/lib/cjs/core-components/atoms/input/input-pin.test.js +10 -28
- package/lib/cjs/core-components/atoms/input/input.component.js +33 -104
- package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
- package/lib/cjs/core-components/atoms/input/input.test.js +10 -30
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +53 -127
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -16
- package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
- package/lib/cjs/core-components/atoms/loader/loader.test.js +7 -11
- package/lib/cjs/core-components/atoms/radio/radio.component.js +37 -102
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
- package/lib/cjs/core-components/atoms/radio/radio.test.js +7 -15
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js +7 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.component.js +32 -81
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +16 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/tabs/tabs.test.js +13 -20
- package/lib/cjs/core-components/atoms/timer/timer.component.js +92 -119
- package/lib/cjs/core-components/atoms/timer/timer.test.js +10 -20
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +45 -85
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +9 -13
- package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
- package/lib/cjs/core-components/index.js +27 -64
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +106 -210
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -23
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +36 -38
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +104 -209
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -28
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +22 -24
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +106 -203
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -14
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/cjs/core-utils/index.js +15 -31
- package/lib/cjs/core-utils/unit-test.utils.js +6 -8
- package/lib/cjs/index.js +15 -31
- package/lib/cjs/library/assets/svg/DownArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/UpArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedBox.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedRadio.svg +13 -0
- package/lib/cjs/library/assets/svg/datePicker.svg +3 -0
- package/lib/cjs/library/assets/svg/index.js +13 -39
- package/lib/cjs/library/assets/svg/index.ts +38 -0
- package/lib/cjs/library/assets/svg/timer copy.svg +3 -0
- package/lib/cjs/library/assets/svg/timer.svg +3 -0
- package/lib/cjs/library/assets/svg/unCheckbox.svg +3 -0
- package/lib/cjs/library/assets/svg/uncheckRadio.svg +3 -0
- package/lib/cjs/reportWebVitals.js +1 -1
- package/lib/cjs/setupTests.js +1 -1
- package/lib/esm/App.js +12 -34
- package/lib/esm/App.test.js +8 -8
- package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -24
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +7 -23
- package/lib/esm/core-components/atoms/buttons/buttons.test.js +7 -13
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +19 -65
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js +7 -13
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +21 -54
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +8 -15
- package/lib/esm/core-components/atoms/form/form.component.js +138 -513
- package/lib/esm/core-components/atoms/form/form.test.js +60 -78
- package/lib/esm/core-components/atoms/icons/icons.component.js +32 -36
- package/lib/esm/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/esm/core-components/atoms/icons/icons.stories.js +20 -0
- package/lib/esm/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js +11 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/esm/core-components/atoms/input/input-otp.component.js +59 -80
- package/lib/esm/core-components/atoms/input/input-pin.component.js +81 -142
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
- package/lib/esm/core-components/atoms/input/input-pin.test.js +10 -26
- package/lib/esm/core-components/atoms/input/input.component.js +16 -66
- package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
- package/lib/esm/core-components/atoms/input/input.test.js +10 -28
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -95
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -14
- package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
- package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
- package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
- package/lib/esm/core-components/atoms/radio/radio.component.js +21 -65
- package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
- package/lib/esm/core-components/atoms/radio/radio.test.js +7 -13
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
- package/lib/esm/core-components/atoms/stepper/stepper.test.js +7 -14
- package/lib/esm/core-components/atoms/tabs/tabs.component.js +15 -43
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js +17 -17
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/tabs/tabs.test.js +13 -18
- package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
- package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +25 -46
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
- package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
- package/lib/esm/core-components/index.js +19 -19
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +88 -170
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -17
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +37 -38
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +86 -169
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -22
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +23 -24
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +90 -166
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/esm/core-utils/index.js +2 -2
- package/lib/esm/core-utils/unit-test.utils.js +5 -5
- package/lib/esm/index.js +2 -2
- package/lib/esm/library/assets/svg/index.js +10 -19
- package/lib/esm/reportWebVitals.js +1 -1
- package/lib/esm/setupTests.js +2 -2
- package/lib/package.json +125 -0
- package/package.json +3 -2
|
@@ -1,54 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
-
};
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
7
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
6
|
const react_1 = __importDefault(require("react"));
|
|
9
7
|
const react_2 = require("@testing-library/react");
|
|
10
8
|
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
11
9
|
const form_component_1 = require("./form.component");
|
|
12
|
-
describe(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
17
|
-
expect(checkbox).toMatchSnapshot();
|
|
18
|
-
});
|
|
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
|
+
});
|
|
19
15
|
});
|
|
20
|
-
describe(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
value
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
react_2.fireEvent.keyDown(input, {
|
|
36
|
-
key: "Escape",
|
|
37
|
-
code: "Escape",
|
|
38
|
-
keyCode: 27,
|
|
39
|
-
charCode: 27,
|
|
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();
|
|
40
31
|
});
|
|
41
|
-
react_2.fireEvent.keyPress(input, { key: "Enter", keyCode: 13 });
|
|
42
|
-
expect(input).toMatchSnapshot();
|
|
43
|
-
});
|
|
44
32
|
});
|
|
45
|
-
describe(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
50
|
-
expect(toggle).toMatchSnapshot();
|
|
51
|
-
});
|
|
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
|
+
});
|
|
52
38
|
});
|
|
53
39
|
// describe('SelectOption component', () => {
|
|
54
40
|
// it('render selectOption correctly', () => {
|
|
@@ -61,13 +47,11 @@ describe("Toggle component", () => {
|
|
|
61
47
|
// expect(select).toMatchSnapshot();
|
|
62
48
|
// });
|
|
63
49
|
// });
|
|
64
|
-
describe(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
69
|
-
expect(multi).toMatchSnapshot();
|
|
70
|
-
});
|
|
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
|
+
});
|
|
71
55
|
});
|
|
72
56
|
// describe('Clock component', () => {
|
|
73
57
|
// it('render clock correctly', () => {
|
|
@@ -77,23 +61,17 @@ describe("MultilineInput component", () => {
|
|
|
77
61
|
// expect(clock).toMatchSnapshot();
|
|
78
62
|
// });
|
|
79
63
|
// });
|
|
80
|
-
describe(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}),
|
|
86
|
-
);
|
|
87
|
-
expect(label).toMatchSnapshot();
|
|
88
|
-
});
|
|
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
|
+
});
|
|
89
69
|
});
|
|
90
|
-
describe(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
);
|
|
95
|
-
expect(inputDate).toMatchSnapshot();
|
|
96
|
-
});
|
|
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
|
+
});
|
|
97
75
|
});
|
|
98
76
|
// describe('InputDateTime component', () => {
|
|
99
77
|
// it('render inputDateTime correctly', () => {
|
|
@@ -101,28 +79,22 @@ describe("InputDate component", () => {
|
|
|
101
79
|
// expect(inputDateTime).toMatchSnapshot();
|
|
102
80
|
// });
|
|
103
81
|
// });
|
|
104
|
-
describe(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
);
|
|
109
|
-
expect(inputFile).toMatchSnapshot();
|
|
110
|
-
});
|
|
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
|
+
});
|
|
111
87
|
});
|
|
112
|
-
describe(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
117
|
-
expect(inputRadio).toMatchSnapshot();
|
|
118
|
-
});
|
|
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
|
+
});
|
|
119
93
|
});
|
|
120
|
-
describe(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
);
|
|
125
|
-
expect(inputWrapper).toMatchSnapshot();
|
|
126
|
-
});
|
|
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
|
+
});
|
|
127
99
|
});
|
|
128
|
-
//# sourceMappingURL=form.test.js.map
|
|
100
|
+
//# sourceMappingURL=form.test.js.map
|
|
@@ -1,46 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
};
|
|
7
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
29
|
exports.Icon = void 0;
|
|
9
|
-
const react_1 =
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
} catch (error) {
|
|
42
|
-
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
43
|
-
}
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
32
|
+
const __1 = require("../..");
|
|
33
|
+
const component_1 = __importDefault(require("@loadable/component"));
|
|
34
|
+
let lib = 'md';
|
|
35
|
+
const Icon = ({ nameIcon, propsIcon, tooltip = '', isDisable = false, onClick, }) => {
|
|
36
|
+
try {
|
|
37
|
+
const iconProps = Object.assign(Object.assign({}, propsIcon), { color: isDisable ? '#808080' : (propsIcon === null || propsIcon === void 0 ? void 0 : propsIcon.color) || '#ffffff' });
|
|
38
|
+
const lib = nameIcon
|
|
39
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
40
|
+
.split(' ')[0]
|
|
41
|
+
.toLocaleLowerCase();
|
|
42
|
+
// const fullLib = `react-icons/${lib}/index.js`;
|
|
43
|
+
const fullLib = `react-icons/md/index.js`;
|
|
44
|
+
let ElementIcon = (0, component_1.default)(() => { var _a; return _a = fullLib, Promise.resolve().then(() => __importStar(require(_a))); }, {
|
|
45
|
+
resolveComponent: (el) => el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
|
|
46
|
+
});
|
|
47
|
+
// ElementIcon = loadable(() => import(`react-icons/${lib}`), {
|
|
48
|
+
// resolveComponent: (el) =>
|
|
49
|
+
// el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
|
|
50
|
+
// });
|
|
51
|
+
return (react_1.default.createElement("div", { onClick: () => {
|
|
52
|
+
if (!isDisable)
|
|
53
|
+
onClick && onClick();
|
|
54
|
+
} }, !lodash_1.default.isEmpty(tooltip) ? (react_1.default.createElement(__1.Tooltip, { tooltipText: tooltip },
|
|
55
|
+
react_1.default.createElement(ElementIcon, Object.assign({}, iconProps)))) : (react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement("div", null, "Loading...") },
|
|
56
|
+
react_1.default.createElement(ElementIcon, Object.assign({}, iconProps))))));
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
60
|
+
}
|
|
44
61
|
};
|
|
45
62
|
exports.Icon = Icon;
|
|
46
|
-
//# sourceMappingURL=icons.component.js.map
|
|
63
|
+
//# sourceMappingURL=icons.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/icons/icons.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/icons/icons.component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsC;AACtC,oDAAuB;AACvB,6BAA8B;AAC9B,oEAA2C;AAW3C,IAAI,GAAG,GAAG,IAAI,CAAC;AACR,MAAM,IAAI,GAAG,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,EAAE,EACZ,SAAS,GAAG,KAAK,EACjB,OAAO,GACG,EAAe,EAAE;IAC3B,IAAI;QACF,MAAM,SAAS,mCACV,SAAS,KACZ,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,KAAI,SAAS,GAC7D,CAAC;QACF,MAAM,GAAG,GAAG,QAAQ;aACjB,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;aACtC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aACb,iBAAiB,EAAE,CAAC;QACvB,iDAAiD;QACjD,MAAM,OAAO,GAAG,yBAAyB,CAAC;QAE1C,IAAI,WAAW,GAAQ,IAAA,mBAAQ,EAAC,GAAG,EAAE,uBAAQ,OAAO,4DAAC,EAAE;YACrD,gBAAgB,EAAE,CAAC,EAAE,EAAE,EAAE,CACvB,EAAE,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SACvE,CAAC,CAAC;QACH,+DAA+D;QAC/D,8BAA8B;QAC9B,4EAA4E;QAC5E,MAAM;QAEN,OAAO,CACL,uCACE,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,CAAC,SAAS;oBAAE,OAAO,IAAI,OAAO,EAAE,CAAC;YACvC,CAAC,IAEA,CAAC,gBAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACrB,8BAAC,WAAO,IAAC,WAAW,EAAE,OAAO;YAC3B,8BAAC,WAAW,oBAAK,SAAS,EAAI,CACtB,CACX,CAAC,CAAC,CAAC,CACF,8BAAC,gBAAQ,IAAC,QAAQ,EAAE,wDAAqB;YACvC,8BAAC,WAAW,oBAAK,SAAS,EAAI,CACrB,CACZ,CACG,CACP,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,6DAAK,CAAC;KACd;AACH,CAAC,CAAC;AAhDW,QAAA,IAAI,QAgDf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Primary = void 0;
|
|
4
|
+
const icons_component_1 = require("./icons.component");
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Design System/Atoms/Icon',
|
|
7
|
+
component: icons_component_1.Icon,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
componentSubtitle: `import { Icon } from 'react-restyle-components'`,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = meta;
|
|
14
|
+
exports.Primary = {
|
|
15
|
+
args: {
|
|
16
|
+
nameIcon: 'FaHistory',
|
|
17
|
+
propsIcon: {
|
|
18
|
+
color: '#000000',
|
|
19
|
+
size: 24,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=icons.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/icons/icons.stories.tsx"],"names":[],"mappings":";;;AAEA,uDAAuC;AAEvC,MAAM,IAAI,GAAsB;IAC9B,KAAK,EAAE,0BAA0B;IACjC,SAAS,EAAE,sBAAI;IACf,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,iBAAiB,EAAE,iDAAiD;KACrE;CACF,CAAC;AACF,kBAAe,IAAI,CAAC;AAGP,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE;YACT,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,EAAE;SACT;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 _core_utils_1 = require("@core-utils");
|
|
8
|
+
const icons_component_1 = require("./icons.component");
|
|
9
|
+
it('render Icon correctly', () => {
|
|
10
|
+
const icon = (0, _core_utils_1.render)(react_1.default.createElement(icons_component_1.Icon, { nameIcon: "FaHistory", propsIcon: {
|
|
11
|
+
color: '#000000',
|
|
12
|
+
size: 24,
|
|
13
|
+
} }));
|
|
14
|
+
expect(icon).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=icons.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.test.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/icons/icons.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,6CAAmC;AACnC,uDAAuC;AACvC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAC/B,MAAM,IAAI,GAAG,IAAA,oBAAM,EACjB,8BAAC,sBAAI,IACH,QAAQ,EAAC,WAAW,EACpB,SAAS,EAAE;YACT,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,EAAE;SACT,GACD,CACH,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC,CAAC,CAAC"}
|
|
@@ -1,131 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}
|
|
21
|
-
: function (o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
});
|
|
25
|
-
var __setModuleDefault =
|
|
26
|
-
(this && this.__setModuleDefault) ||
|
|
27
|
-
(Object.create
|
|
28
|
-
? function (o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}
|
|
31
|
-
: function (o, v) {
|
|
32
|
-
o["default"] = v;
|
|
33
|
-
});
|
|
34
|
-
var __importStar =
|
|
35
|
-
(this && this.__importStar) ||
|
|
36
|
-
function (mod) {
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
19
|
if (mod && mod.__esModule) return mod;
|
|
38
20
|
var result = {};
|
|
39
|
-
if (mod != null)
|
|
40
|
-
for (var k in mod)
|
|
41
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
42
|
-
__createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
43
22
|
__setModuleDefault(result, mod);
|
|
44
23
|
return result;
|
|
45
|
-
|
|
24
|
+
};
|
|
46
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
26
|
exports.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
|