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,53 +1,35 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
4
- import {
5
- CheckBox,
6
- Input,
7
- Toggle,
8
- MultilineInput,
9
- Label,
10
- InputDate,
11
- InputFile,
12
- InputRadio,
13
- InputWrapper,
14
- } from "./form.component";
15
- describe("Checkbox component", () => {
16
- it("render checkbox correctly", () => {
17
- const checkbox = render(React.createElement(CheckBox, null));
18
- expect(checkbox).toMatchSnapshot();
19
- });
1
+ import React from 'react';
2
+ import { render, fireEvent } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { CheckBox, Input, Toggle, MultilineInput, Label, InputDate, InputFile, InputRadio, InputWrapper, } from './form.component';
5
+ describe('Checkbox component', () => {
6
+ it('render checkbox correctly', () => {
7
+ const checkbox = render(React.createElement(CheckBox, null));
8
+ expect(checkbox).toMatchSnapshot();
9
+ });
20
10
  });
21
- describe("Input component", () => {
22
- it("render input correctly", () => {
23
- const inputComp = render(
24
- React.createElement(Input, {
25
- type: "text",
26
- value: "test",
27
- onChange: (val) => jest.fn(),
28
- onBlur: (value) => jest.fn(),
29
- onKeyDown: (val) => jest.fn(),
30
- }),
31
- );
32
- const input = inputComp.getByTestId("INPT");
33
- fireEvent.change(input, { target: { value: "check" } });
34
- userEvent.type(input, "value");
35
- fireEvent.blur(input);
36
- fireEvent.keyDown(input, {
37
- key: "Escape",
38
- code: "Escape",
39
- keyCode: 27,
40
- charCode: 27,
11
+ describe('Input component', () => {
12
+ it('render input correctly', () => {
13
+ const inputComp = render(React.createElement(Input, { type: "text", value: "test", onChange: (val) => jest.fn(), onBlur: (value) => jest.fn(), onKeyDown: (val) => jest.fn() }));
14
+ const input = inputComp.getByTestId('INPT');
15
+ fireEvent.change(input, { target: { value: 'check' } });
16
+ userEvent.type(input, 'value');
17
+ fireEvent.blur(input);
18
+ fireEvent.keyDown(input, {
19
+ key: 'Escape',
20
+ code: 'Escape',
21
+ keyCode: 27,
22
+ charCode: 27,
23
+ });
24
+ fireEvent.keyPress(input, { key: 'Enter', keyCode: 13 });
25
+ expect(input).toMatchSnapshot();
41
26
  });
42
- fireEvent.keyPress(input, { key: "Enter", keyCode: 13 });
43
- expect(input).toMatchSnapshot();
44
- });
45
27
  });
46
- describe("Toggle component", () => {
47
- it("render toggle correctly", () => {
48
- const toggle = render(React.createElement(Toggle, null));
49
- expect(toggle).toMatchSnapshot();
50
- });
28
+ describe('Toggle component', () => {
29
+ it('render toggle correctly', () => {
30
+ const toggle = render(React.createElement(Toggle, null));
31
+ expect(toggle).toMatchSnapshot();
32
+ });
51
33
  });
52
34
  // describe('SelectOption component', () => {
53
35
  // it('render selectOption correctly', () => {
@@ -60,11 +42,11 @@ describe("Toggle component", () => {
60
42
  // expect(select).toMatchSnapshot();
61
43
  // });
62
44
  // });
63
- describe("MultilineInput component", () => {
64
- it("render multilineInput correctly", () => {
65
- const multi = render(React.createElement(MultilineInput, null));
66
- expect(multi).toMatchSnapshot();
67
- });
45
+ describe('MultilineInput component', () => {
46
+ it('render multilineInput correctly', () => {
47
+ const multi = render(React.createElement(MultilineInput, null));
48
+ expect(multi).toMatchSnapshot();
49
+ });
68
50
  });
69
51
  // describe('Clock component', () => {
70
52
  // it('render clock correctly', () => {
@@ -74,17 +56,17 @@ describe("MultilineInput component", () => {
74
56
  // expect(clock).toMatchSnapshot();
75
57
  // });
76
58
  // });
77
- describe("Label component", () => {
78
- it("render label correctly", () => {
79
- const label = render(React.createElement(Label, { htmlFor: "vsdvrf" }));
80
- expect(label).toMatchSnapshot();
81
- });
59
+ describe('Label component', () => {
60
+ it('render label correctly', () => {
61
+ const label = render(React.createElement(Label, { htmlFor: "vsdvrf" }));
62
+ expect(label).toMatchSnapshot();
63
+ });
82
64
  });
83
- describe("InputDate component", () => {
84
- it("render inputDate correctly", () => {
85
- const inputDate = render(React.createElement(InputDate, null));
86
- expect(inputDate).toMatchSnapshot();
87
- });
65
+ describe('InputDate component', () => {
66
+ it('render inputDate correctly', () => {
67
+ const inputDate = render(React.createElement(InputDate, null));
68
+ expect(inputDate).toMatchSnapshot();
69
+ });
88
70
  });
89
71
  // describe('InputDateTime component', () => {
90
72
  // it('render inputDateTime correctly', () => {
@@ -92,22 +74,22 @@ describe("InputDate component", () => {
92
74
  // expect(inputDateTime).toMatchSnapshot();
93
75
  // });
94
76
  // });
95
- describe("InputFile component", () => {
96
- it("render inputFile correctly", () => {
97
- const inputFile = render(React.createElement(InputFile, null));
98
- expect(inputFile).toMatchSnapshot();
99
- });
77
+ describe('InputFile component', () => {
78
+ it('render inputFile correctly', () => {
79
+ const inputFile = render(React.createElement(InputFile, null));
80
+ expect(inputFile).toMatchSnapshot();
81
+ });
100
82
  });
101
- describe("InputRadio component", () => {
102
- it("render inputRadio correctly", () => {
103
- const inputRadio = render(React.createElement(InputRadio, null));
104
- expect(inputRadio).toMatchSnapshot();
105
- });
83
+ describe('InputRadio component', () => {
84
+ it('render inputRadio correctly', () => {
85
+ const inputRadio = render(React.createElement(InputRadio, null));
86
+ expect(inputRadio).toMatchSnapshot();
87
+ });
106
88
  });
107
- describe("InputWrapper component", () => {
108
- it("render inputWrapper correctly", () => {
109
- const inputWrapper = render(React.createElement(InputWrapper, null));
110
- expect(inputWrapper).toMatchSnapshot();
111
- });
89
+ describe('InputWrapper component', () => {
90
+ it('render inputWrapper correctly', () => {
91
+ const inputWrapper = render(React.createElement(InputWrapper, null));
92
+ expect(inputWrapper).toMatchSnapshot();
93
+ });
112
94
  });
113
- //# sourceMappingURL=form.test.js.map
95
+ //# sourceMappingURL=form.test.js.map
@@ -1,37 +1,33 @@
1
- import React from "react";
2
- export const Icon = ({
3
- nameIcon,
4
- propsIcon,
5
- tooltip = "",
6
- isDisable = false,
7
- onClick,
8
- }) => {
9
- try {
10
- const iconProps = Object.assign(Object.assign({}, propsIcon), {
11
- color: isDisable
12
- ? "#808080"
13
- : (propsIcon === null || propsIcon === void 0
14
- ? void 0
15
- : propsIcon.color) || "#ffffff",
16
- });
17
- const lib = nameIcon
18
- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
19
- .split(" ")[0]
20
- .toLocaleLowerCase();
21
- // const ElementIcon: any = loadable(
22
- // () => import(`react-icons/${lib}/index.js`),
23
- // {
24
- // resolveComponent: (el) =>
25
- // el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
26
- // }
27
- // );
28
- return React.createElement("div", {
29
- onClick: () => {
30
- if (!isDisable) onClick && onClick();
31
- },
32
- });
33
- } catch (error) {
34
- return React.createElement(React.Fragment, null);
35
- }
1
+ import React, { Suspense } from 'react';
2
+ import _ from 'lodash';
3
+ import { Tooltip } from '../..';
4
+ import loadable from '@loadable/component';
5
+ let lib = 'md';
6
+ export const Icon = ({ nameIcon, propsIcon, tooltip = '', isDisable = false, onClick, }) => {
7
+ try {
8
+ const iconProps = Object.assign(Object.assign({}, propsIcon), { color: isDisable ? '#808080' : (propsIcon === null || propsIcon === void 0 ? void 0 : propsIcon.color) || '#ffffff' });
9
+ const lib = nameIcon
10
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
11
+ .split(' ')[0]
12
+ .toLocaleLowerCase();
13
+ // const fullLib = `react-icons/${lib}/index.js`;
14
+ const fullLib = `react-icons/md/index.js`;
15
+ let ElementIcon = loadable(() => import(fullLib), {
16
+ resolveComponent: (el) => el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
17
+ });
18
+ // ElementIcon = loadable(() => import(`react-icons/${lib}`), {
19
+ // resolveComponent: (el) =>
20
+ // el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
21
+ // });
22
+ return (React.createElement("div", { onClick: () => {
23
+ if (!isDisable)
24
+ onClick && onClick();
25
+ } }, !_.isEmpty(tooltip) ? (React.createElement(Tooltip, { tooltipText: tooltip },
26
+ React.createElement(ElementIcon, Object.assign({}, iconProps)))) : (React.createElement(Suspense, { fallback: React.createElement("div", null, "Loading...") },
27
+ React.createElement(ElementIcon, Object.assign({}, iconProps))))));
28
+ }
29
+ catch (error) {
30
+ return React.createElement(React.Fragment, null);
31
+ }
36
32
  };
37
- //# sourceMappingURL=icons.component.js.map
33
+ //# 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,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,MAAM,CAAC,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,6BACE,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,yCAAK,CAAC;KACd;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"icons.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/icons/icons.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAW3C,IAAI,GAAG,GAAG,IAAI,CAAC;AACf,MAAM,CAAC,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,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,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,6BACE,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,CAAC,SAAS;oBAAE,OAAO,IAAI,OAAO,EAAE,CAAC;YACvC,CAAC,IAEA,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACrB,oBAAC,OAAO,IAAC,WAAW,EAAE,OAAO;YAC3B,oBAAC,WAAW,oBAAK,SAAS,EAAI,CACtB,CACX,CAAC,CAAC,CAAC,CACF,oBAAC,QAAQ,IAAC,QAAQ,EAAE,8CAAqB;YACvC,oBAAC,WAAW,oBAAK,SAAS,EAAI,CACrB,CACZ,CACG,CACP,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,yCAAK,CAAC;KACd;AACH,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Icon } from './icons.component';
2
+ const meta = {
3
+ title: 'Design System/Atoms/Icon',
4
+ component: Icon,
5
+ tags: ['autodocs'],
6
+ parameters: {
7
+ componentSubtitle: `import { Icon } from 'react-restyle-components'`,
8
+ },
9
+ };
10
+ export default meta;
11
+ export const Primary = {
12
+ args: {
13
+ nameIcon: 'FaHistory',
14
+ propsIcon: {
15
+ color: '#000000',
16
+ size: 24,
17
+ },
18
+ },
19
+ };
20
+ //# 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,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,MAAM,IAAI,GAAsB;IAC9B,KAAK,EAAE,0BAA0B;IACjC,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,iBAAiB,EAAE,iDAAiD;KACrE;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,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,11 @@
1
+ import React from 'react';
2
+ import { render } from '@core-utils';
3
+ import { Icon } from './icons.component';
4
+ it('render Icon correctly', () => {
5
+ const icon = render(React.createElement(Icon, { nameIcon: "FaHistory", propsIcon: {
6
+ color: '#000000',
7
+ size: 24,
8
+ } }));
9
+ expect(icon).toMatchSnapshot();
10
+ });
11
+ //# 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,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,CACjB,oBAAC,IAAI,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,83 +1,62 @@
1
1
  /* eslint-disable no-console */
2
- import React, { useEffect, useRef } from "react";
3
- import "./input-otp.styles.css";
4
- export const InputOtp = ({ className, pin, onPinChanged }) => {
5
- const pinLength = 6;
6
- const Pin_Min_Value = 0;
7
- const Pin_Max_Value = 9;
8
- const BACKSPACE_Key = "Backspace";
9
- const inputRefs = useRef([]);
10
- useEffect(() => {
11
- const ref = inputRefs.current[0];
12
- if (ref) {
13
- ref.focus();
14
- }
15
- }, []);
16
- const changePinFocus = (pinIndex) => {
17
- const ref = inputRefs.current[pinIndex];
18
- if (ref) {
19
- ref.focus();
20
- }
21
- };
22
- const onChange = (event, index) => {
23
- const value = event.target.value;
24
- const pinNumber = Number(value.trim());
25
- if (isNaN(pinNumber) || value.length === 0) {
26
- return;
27
- }
28
- if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
29
- onPinChanged(pinNumber, index);
30
- if (index < pinLength - 1) {
31
- changePinFocus(index + 1);
32
- }
33
- }
34
- };
35
- const onKeyDown = (event, index) => {
36
- console.log({ event, index });
37
- const keyboardKeyCode = event.nativeEvent.code;
38
- if (keyboardKeyCode != BACKSPACE_Key) return;
39
- if (pin[index] === undefined) {
40
- changePinFocus(index - 1);
41
- } else {
42
- onPinChanged(undefined, index);
43
- }
44
- };
45
- return React.createElement(
46
- "div",
47
- { className: `${className} relative` },
48
- React.createElement(
49
- "div",
50
- {
51
- className:
52
- "flex space-x-1 bg-background-secondary rounded-lg outline-offset-8",
53
- },
54
- Array.from({ length: pinLength }, (_, index) =>
55
- React.createElement("input", {
56
- "data-testid": "onPinChanged",
57
- className:
58
- "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",
59
- onKeyDown: (event) => onKeyDown(event, index),
60
- key: index,
61
- onMouseUp: () => {
62
- if (pin.join("").length <= 0) {
63
- changePinFocus(0);
2
+ import React, { useEffect, useRef } from 'react';
3
+ import './input-otp.styles.css';
4
+ export const InputOtp = ({ className, pin, onPinChanged, }) => {
5
+ const pinLength = 6;
6
+ const Pin_Min_Value = 0;
7
+ const Pin_Max_Value = 9;
8
+ const BACKSPACE_Key = 'Backspace';
9
+ const inputRefs = useRef([]);
10
+ useEffect(() => {
11
+ const ref = inputRefs.current[0];
12
+ if (ref) {
13
+ ref.focus();
14
+ }
15
+ }, []);
16
+ const changePinFocus = (pinIndex) => {
17
+ const ref = inputRefs.current[pinIndex];
18
+ if (ref) {
19
+ ref.focus();
20
+ }
21
+ };
22
+ const onChange = (event, index) => {
23
+ const value = event.target.value;
24
+ const pinNumber = Number(value.trim());
25
+ if (isNaN(pinNumber) || value.length === 0) {
26
+ return;
27
+ }
28
+ if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
29
+ onPinChanged(pinNumber, index);
30
+ if (index < pinLength - 1) {
31
+ changePinFocus(index + 1);
64
32
  }
65
- },
66
- onClick: () => {
67
- if (pin.join("").length <= 0) {
68
- onPinChanged(undefined, 0);
69
- }
70
- },
71
- ref: (el) => {
72
- if (el) {
73
- inputRefs.current[index] = el;
74
- }
75
- },
76
- onChange: (event) => onChange(event, index),
77
- value: pin[index] || "",
78
- }),
79
- ),
80
- ),
81
- );
33
+ }
34
+ };
35
+ const onKeyDown = (event, index) => {
36
+ console.log({ event, index });
37
+ const keyboardKeyCode = event.nativeEvent.code;
38
+ if (keyboardKeyCode != BACKSPACE_Key)
39
+ return;
40
+ if (pin[index] === undefined) {
41
+ changePinFocus(index - 1);
42
+ }
43
+ else {
44
+ onPinChanged(undefined, index);
45
+ }
46
+ };
47
+ return (React.createElement("div", { className: `${className} relative` },
48
+ React.createElement("div", { className: "flex space-x-1 bg-background-secondary rounded-lg outline-offset-8" }, Array.from({ length: pinLength }, (_, index) => (React.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: () => {
49
+ if (pin.join('').length <= 0) {
50
+ changePinFocus(0);
51
+ }
52
+ }, onClick: () => {
53
+ if (pin.join('').length <= 0) {
54
+ onPinChanged(undefined, 0);
55
+ }
56
+ }, ref: (el) => {
57
+ if (el) {
58
+ inputRefs.current[index] = el;
59
+ }
60
+ }, onChange: (event) => onChange(event, index), value: pin[index] || '' }))))));
82
61
  };
83
- //# sourceMappingURL=input-otp.component.js.map
62
+ //# sourceMappingURL=input-otp.component.js.map