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.
Files changed (140) hide show
  1. package/lib/cjs/App.js +12 -36
  2. package/lib/cjs/App.test.js +8 -10
  3. package/lib/cjs/core-components/atoms/buttons/button.stories.js +24 -26
  4. package/lib/cjs/core-components/atoms/buttons/buttons.component.js +9 -27
  5. package/lib/cjs/core-components/atoms/buttons/buttons.test.js +7 -15
  6. package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +35 -102
  7. package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
  8. package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +7 -15
  9. package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +37 -98
  10. package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +15 -17
  11. package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +7 -16
  12. package/lib/cjs/core-components/atoms/form/form.component.js +159 -571
  13. package/lib/cjs/core-components/atoms/form/form.test.js +59 -87
  14. package/lib/cjs/core-components/atoms/icons/icons.component.js +58 -41
  15. package/lib/cjs/core-components/atoms/icons/icons.component.js.map +1 -1
  16. package/lib/cjs/core-components/atoms/icons/icons.stories.js +23 -0
  17. package/lib/cjs/core-components/atoms/icons/icons.stories.js.map +1 -0
  18. package/lib/cjs/core-components/atoms/icons/icons.test.js +16 -0
  19. package/lib/cjs/core-components/atoms/icons/icons.test.js.map +1 -0
  20. package/lib/cjs/core-components/atoms/input/input-otp.component.js +76 -118
  21. package/lib/cjs/core-components/atoms/input/input-pin.component.js +98 -180
  22. package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
  23. package/lib/cjs/core-components/atoms/input/input-pin.test.js +10 -28
  24. package/lib/cjs/core-components/atoms/input/input.component.js +33 -104
  25. package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
  26. package/lib/cjs/core-components/atoms/input/input.test.js +10 -30
  27. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +53 -127
  28. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
  29. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -16
  30. package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
  31. package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
  32. package/lib/cjs/core-components/atoms/loader/loader.test.js +7 -11
  33. package/lib/cjs/core-components/atoms/radio/radio.component.js +37 -102
  34. package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
  35. package/lib/cjs/core-components/atoms/radio/radio.test.js +7 -15
  36. package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
  37. package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
  38. package/lib/cjs/core-components/atoms/stepper/stepper.test.js +7 -16
  39. package/lib/cjs/core-components/atoms/tabs/tabs.component.js +32 -81
  40. package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +16 -16
  41. package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -1
  42. package/lib/cjs/core-components/atoms/tabs/tabs.test.js +13 -20
  43. package/lib/cjs/core-components/atoms/timer/timer.component.js +92 -119
  44. package/lib/cjs/core-components/atoms/timer/timer.test.js +10 -20
  45. package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +45 -85
  46. package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +9 -13
  47. package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
  48. package/lib/cjs/core-components/index.js +27 -64
  49. 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
  50. 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
  51. 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
  52. 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
  53. 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
  54. 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
  55. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +106 -203
  56. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
  57. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -14
  58. package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
  59. package/lib/cjs/core-utils/index.js +15 -31
  60. package/lib/cjs/core-utils/unit-test.utils.js +6 -8
  61. package/lib/cjs/index.js +15 -31
  62. package/lib/cjs/library/assets/svg/DownArrow.svg +14 -0
  63. package/lib/cjs/library/assets/svg/UpArrow.svg +14 -0
  64. package/lib/cjs/library/assets/svg/checkedBox.svg +14 -0
  65. package/lib/cjs/library/assets/svg/checkedRadio.svg +13 -0
  66. package/lib/cjs/library/assets/svg/datePicker.svg +3 -0
  67. package/lib/cjs/library/assets/svg/index.js +13 -39
  68. package/lib/cjs/library/assets/svg/index.ts +38 -0
  69. package/lib/cjs/library/assets/svg/timer copy.svg +3 -0
  70. package/lib/cjs/library/assets/svg/timer.svg +3 -0
  71. package/lib/cjs/library/assets/svg/unCheckbox.svg +3 -0
  72. package/lib/cjs/library/assets/svg/uncheckRadio.svg +3 -0
  73. package/lib/cjs/reportWebVitals.js +1 -1
  74. package/lib/cjs/setupTests.js +1 -1
  75. package/lib/esm/App.js +12 -34
  76. package/lib/esm/App.test.js +8 -8
  77. package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -24
  78. package/lib/esm/core-components/atoms/buttons/buttons.component.js +7 -23
  79. package/lib/esm/core-components/atoms/buttons/buttons.test.js +7 -13
  80. package/lib/esm/core-components/atoms/check-box/checkBox.component.js +19 -65
  81. package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
  82. package/lib/esm/core-components/atoms/check-box/checkBox.test.js +7 -13
  83. package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +21 -54
  84. package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
  85. package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +8 -15
  86. package/lib/esm/core-components/atoms/form/form.component.js +138 -513
  87. package/lib/esm/core-components/atoms/form/form.test.js +60 -78
  88. package/lib/esm/core-components/atoms/icons/icons.component.js +32 -36
  89. package/lib/esm/core-components/atoms/icons/icons.component.js.map +1 -1
  90. package/lib/esm/core-components/atoms/icons/icons.stories.js +20 -0
  91. package/lib/esm/core-components/atoms/icons/icons.stories.js.map +1 -0
  92. package/lib/esm/core-components/atoms/icons/icons.test.js +11 -0
  93. package/lib/esm/core-components/atoms/icons/icons.test.js.map +1 -0
  94. package/lib/esm/core-components/atoms/input/input-otp.component.js +59 -80
  95. package/lib/esm/core-components/atoms/input/input-pin.component.js +81 -142
  96. package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
  97. package/lib/esm/core-components/atoms/input/input-pin.test.js +10 -26
  98. package/lib/esm/core-components/atoms/input/input.component.js +16 -66
  99. package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
  100. package/lib/esm/core-components/atoms/input/input.test.js +10 -28
  101. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -95
  102. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
  103. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -14
  104. package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
  105. package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
  106. package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
  107. package/lib/esm/core-components/atoms/radio/radio.component.js +21 -65
  108. package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
  109. package/lib/esm/core-components/atoms/radio/radio.test.js +7 -13
  110. package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
  111. package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
  112. package/lib/esm/core-components/atoms/stepper/stepper.test.js +7 -14
  113. package/lib/esm/core-components/atoms/tabs/tabs.component.js +15 -43
  114. package/lib/esm/core-components/atoms/tabs/tabs.stories.js +17 -17
  115. package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -1
  116. package/lib/esm/core-components/atoms/tabs/tabs.test.js +13 -18
  117. package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
  118. package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
  119. package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +25 -46
  120. package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
  121. package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
  122. package/lib/esm/core-components/index.js +19 -19
  123. 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
  124. 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
  125. 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
  126. 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
  127. 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
  128. 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
  129. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +90 -166
  130. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
  131. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -9
  132. package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
  133. package/lib/esm/core-utils/index.js +2 -2
  134. package/lib/esm/core-utils/unit-test.utils.js +5 -5
  135. package/lib/esm/index.js +2 -2
  136. package/lib/esm/library/assets/svg/index.js +10 -19
  137. package/lib/esm/reportWebVitals.js +1 -1
  138. package/lib/esm/setupTests.js +2 -2
  139. package/lib/package.json +125 -0
  140. package/package.json +3 -2
@@ -1,54 +1,40 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
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("Checkbox component", () => {
13
- it("render checkbox correctly", () => {
14
- const checkbox = (0, react_2.render)(
15
- react_1.default.createElement(form_component_1.CheckBox, null),
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("Input component", () => {
21
- it("render input correctly", () => {
22
- const inputComp = (0, react_2.render)(
23
- react_1.default.createElement(form_component_1.Input, {
24
- type: "text",
25
- value: "test",
26
- onChange: (val) => jest.fn(),
27
- onBlur: (value) => jest.fn(),
28
- onKeyDown: (val) => jest.fn(),
29
- }),
30
- );
31
- const input = inputComp.getByTestId("INPT");
32
- react_2.fireEvent.change(input, { target: { value: "check" } });
33
- user_event_1.default.type(input, "value");
34
- react_2.fireEvent.blur(input);
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("Toggle component", () => {
46
- it("render toggle correctly", () => {
47
- const toggle = (0, react_2.render)(
48
- react_1.default.createElement(form_component_1.Toggle, null),
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("MultilineInput component", () => {
65
- it("render multilineInput correctly", () => {
66
- const multi = (0, react_2.render)(
67
- react_1.default.createElement(form_component_1.MultilineInput, null),
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("Label component", () => {
81
- it("render label correctly", () => {
82
- const label = (0, react_2.render)(
83
- react_1.default.createElement(form_component_1.Label, {
84
- htmlFor: "vsdvrf",
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("InputDate component", () => {
91
- it("render inputDate correctly", () => {
92
- const inputDate = (0, react_2.render)(
93
- react_1.default.createElement(form_component_1.InputDate, null),
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("InputFile component", () => {
105
- it("render inputFile correctly", () => {
106
- const inputFile = (0, react_2.render)(
107
- react_1.default.createElement(form_component_1.InputFile, null),
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("InputRadio component", () => {
113
- it("render inputRadio correctly", () => {
114
- const inputRadio = (0, react_2.render)(
115
- react_1.default.createElement(form_component_1.InputRadio, null),
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("InputWrapper component", () => {
121
- it("render inputWrapper correctly", () => {
122
- const inputWrapper = (0, react_2.render)(
123
- react_1.default.createElement(form_component_1.InputWrapper, null),
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 __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
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 = __importDefault(require("react"));
10
- const Icon = ({
11
- nameIcon,
12
- propsIcon,
13
- tooltip = "",
14
- isDisable = false,
15
- onClick,
16
- }) => {
17
- try {
18
- const iconProps = Object.assign(Object.assign({}, propsIcon), {
19
- color: isDisable
20
- ? "#808080"
21
- : (propsIcon === null || propsIcon === void 0
22
- ? void 0
23
- : propsIcon.color) || "#ffffff",
24
- });
25
- const lib = nameIcon
26
- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
27
- .split(" ")[0]
28
- .toLocaleLowerCase();
29
- // const ElementIcon: any = loadable(
30
- // () => import(`react-icons/${lib}/index.js`),
31
- // {
32
- // resolveComponent: (el) =>
33
- // el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
34
- // }
35
- // );
36
- return react_1.default.createElement("div", {
37
- onClick: () => {
38
- if (!isDisable) onClick && onClick();
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":";;;;;;AAAA,kDAA0B;AAcnB,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,qCAAqC;QACrC,iDAAiD;QACjD,MAAM;QACN,gCAAgC;QAChC,8EAA8E;QAC9E,MAAM;QACN,KAAK;QACL,OAAO,CACL,uCACE,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,CAAC,SAAS;oBAAE,OAAO,IAAI,OAAO,EAAE,CAAC;YACvC,CAAC,GASG,CACP,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,6DAAK,CAAC;KACd;AACH,CAAC,CAAC;AAzCW,QAAA,IAAI,QAyCf"}
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
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (
9
- !desc ||
10
- ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11
- ) {
12
- desc = {
13
- enumerable: true,
14
- get: function () {
15
- return m[k];
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
- const pinLength = 6;
53
- const Pin_Min_Value = 0;
54
- const Pin_Max_Value = 9;
55
- const BACKSPACE_Key = "Backspace";
56
- const inputRefs = (0, react_1.useRef)([]);
57
- (0, react_1.useEffect)(() => {
58
- const ref = inputRefs.current[0];
59
- if (ref) {
60
- ref.focus();
61
- }
62
- }, []);
63
- const changePinFocus = (pinIndex) => {
64
- const ref = inputRefs.current[pinIndex];
65
- if (ref) {
66
- ref.focus();
67
- }
68
- };
69
- const onChange = (event, index) => {
70
- const value = event.target.value;
71
- const pinNumber = Number(value.trim());
72
- if (isNaN(pinNumber) || value.length === 0) {
73
- return;
74
- }
75
- if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
76
- onPinChanged(pinNumber, index);
77
- if (index < pinLength - 1) {
78
- changePinFocus(index + 1);
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
- onChange: (event) => onChange(event, index),
124
- value: pin[index] || "",
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