react-restyle-components 0.1.35 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/README.md +3 -7
  2. package/lib/cjs/App.js +12 -36
  3. package/lib/cjs/App.test.js +8 -10
  4. package/lib/cjs/core-components/atoms/buttons/button.stories.js +32 -26
  5. package/lib/cjs/core-components/atoms/buttons/button.stories.js.map +1 -1
  6. package/lib/cjs/core-components/atoms/buttons/buttons.component.js +6 -17
  7. package/lib/cjs/core-components/atoms/buttons/buttons.component.js.map +1 -1
  8. package/lib/cjs/core-components/atoms/buttons/buttons.test.js +14 -0
  9. package/lib/cjs/core-components/atoms/buttons/buttons.test.js.map +1 -0
  10. package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +10 -27
  11. package/lib/cjs/core-components/atoms/check-box/checkBox.component.js.map +1 -1
  12. package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +14 -28
  13. package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js.map +1 -1
  14. package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +14 -0
  15. package/lib/cjs/core-components/atoms/check-box/checkBox.test.js.map +1 -0
  16. package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +38 -98
  17. package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js.map +1 -1
  18. package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +17 -24
  19. package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js.map +1 -1
  20. package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +15 -0
  21. package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js.map +1 -0
  22. package/lib/cjs/core-components/atoms/form/form.component.js +194 -0
  23. package/lib/cjs/core-components/atoms/form/form.component.js.map +1 -0
  24. package/lib/cjs/core-components/atoms/form/form.test.js +100 -0
  25. package/lib/cjs/core-components/atoms/form/form.test.js.map +1 -0
  26. package/lib/cjs/core-components/atoms/input/input-otp.component.js +76 -118
  27. package/lib/cjs/core-components/atoms/input/input-pin.component.js +94 -174
  28. package/lib/cjs/core-components/atoms/input/input-pin.stories.js +12 -22
  29. package/lib/cjs/core-components/atoms/input/input-pin.stories.js.map +1 -1
  30. package/lib/cjs/core-components/atoms/input/input-pin.test.js +18 -0
  31. package/lib/cjs/core-components/atoms/input/input-pin.test.js.map +1 -0
  32. package/lib/cjs/core-components/atoms/input/input.component.js +13 -65
  33. package/lib/cjs/core-components/atoms/input/input.stories.js +14 -21
  34. package/lib/cjs/core-components/atoms/input/input.stories.js.map +1 -1
  35. package/lib/cjs/core-components/atoms/input/input.test.js +18 -0
  36. package/lib/cjs/core-components/atoms/input/input.test.js.map +1 -0
  37. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +54 -134
  38. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js.map +1 -1
  39. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -19
  40. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js.map +1 -1
  41. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +14 -0
  42. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js.map +1 -0
  43. package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
  44. package/lib/cjs/core-components/atoms/loader/loader.stories.js +9 -19
  45. package/lib/cjs/core-components/atoms/loader/loader.stories.js.map +1 -1
  46. package/lib/cjs/core-components/atoms/loader/loader.test.js +14 -0
  47. package/lib/cjs/core-components/atoms/loader/loader.test.js.map +1 -0
  48. package/lib/cjs/core-components/atoms/radio/radio.component.js +7 -22
  49. package/lib/cjs/core-components/atoms/radio/radio.component.js.map +1 -1
  50. package/lib/cjs/core-components/atoms/radio/radio.stories.js +9 -27
  51. package/lib/cjs/core-components/atoms/radio/radio.stories.js.map +1 -1
  52. package/lib/cjs/core-components/atoms/radio/radio.test.js +14 -0
  53. package/lib/cjs/core-components/atoms/radio/radio.test.js.map +1 -0
  54. package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
  55. package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +14 -22
  56. package/lib/cjs/core-components/atoms/stepper/stepper.stories.js.map +1 -1
  57. package/lib/cjs/core-components/atoms/stepper/stepper.test.js +13 -0
  58. package/lib/cjs/core-components/atoms/stepper/stepper.test.js.map +1 -0
  59. package/lib/cjs/core-components/atoms/timer/timer.component.js +93 -120
  60. package/lib/cjs/core-components/atoms/timer/timer.component.js.map +1 -1
  61. package/lib/cjs/core-components/atoms/timer/timer.test.js +20 -0
  62. package/lib/cjs/core-components/atoms/timer/timer.test.js.map +1 -0
  63. package/lib/cjs/core-components/index.js +32 -35
  64. package/lib/cjs/core-components/index.js.map +1 -1
  65. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +129 -0
  66. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js.map +1 -0
  67. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +14 -0
  68. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js.map +1 -0
  69. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +16 -0
  70. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js.map +1 -0
  71. package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +165 -0
  72. package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js.map +1 -0
  73. package/lib/cjs/core-utils/index.js +15 -31
  74. package/lib/cjs/core-utils/unit-test.utils.js +6 -8
  75. package/lib/cjs/index.js +15 -31
  76. package/lib/cjs/library/assets/svg/index.js +41 -0
  77. package/lib/cjs/library/assets/svg/index.js.map +1 -0
  78. package/lib/cjs/reportWebVitals.js +29 -52
  79. package/lib/cjs/reportWebVitals.js.map +1 -1
  80. package/lib/cjs/setupTests.js +1 -1
  81. package/lib/esm/App.js +12 -34
  82. package/lib/esm/App.test.js +8 -8
  83. package/lib/esm/core-components/atoms/buttons/button.stories.js +30 -20
  84. package/lib/esm/core-components/atoms/buttons/button.stories.js.map +1 -1
  85. package/lib/esm/core-components/atoms/buttons/buttons.component.js +4 -13
  86. package/lib/esm/core-components/atoms/buttons/buttons.component.js.map +1 -1
  87. package/lib/esm/core-components/atoms/buttons/buttons.test.js +9 -0
  88. package/lib/esm/core-components/atoms/buttons/buttons.test.js.map +1 -0
  89. package/lib/esm/core-components/atoms/check-box/checkBox.component.js +8 -20
  90. package/lib/esm/core-components/atoms/check-box/checkBox.component.js.map +1 -1
  91. package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +14 -19
  92. package/lib/esm/core-components/atoms/check-box/checkBox.stories.js.map +1 -1
  93. package/lib/esm/core-components/atoms/check-box/checkBox.test.js +9 -0
  94. package/lib/esm/core-components/atoms/check-box/checkBox.test.js.map +1 -0
  95. package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +20 -52
  96. package/lib/esm/core-components/atoms/date-picker/date-picker.component.js.map +1 -1
  97. package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +15 -19
  98. package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js.map +1 -1
  99. package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +10 -0
  100. package/lib/esm/core-components/atoms/date-picker/date-picker.test.js.map +1 -0
  101. package/lib/esm/core-components/atoms/form/form.component.js +155 -0
  102. package/lib/esm/core-components/atoms/form/form.component.js.map +1 -0
  103. package/lib/esm/core-components/atoms/form/form.test.js +95 -0
  104. package/lib/esm/core-components/atoms/form/form.test.js.map +1 -0
  105. package/lib/esm/core-components/atoms/input/input-otp.component.js +59 -80
  106. package/lib/esm/core-components/atoms/input/input-pin.component.js +77 -136
  107. package/lib/esm/core-components/atoms/input/input-pin.stories.js +13 -17
  108. package/lib/esm/core-components/atoms/input/input-pin.stories.js.map +1 -1
  109. package/lib/esm/core-components/atoms/input/input-pin.test.js +13 -0
  110. package/lib/esm/core-components/atoms/input/input-pin.test.js.map +1 -0
  111. package/lib/esm/core-components/atoms/input/input.component.js +12 -62
  112. package/lib/esm/core-components/atoms/input/input.stories.js +15 -16
  113. package/lib/esm/core-components/atoms/input/input.stories.js.map +1 -1
  114. package/lib/esm/core-components/atoms/input/input.test.js +13 -0
  115. package/lib/esm/core-components/atoms/input/input.test.js.map +1 -0
  116. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -96
  117. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js.map +1 -1
  118. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +14 -14
  119. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js.map +1 -1
  120. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +9 -0
  121. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js.map +1 -0
  122. package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
  123. package/lib/esm/core-components/atoms/loader/loader.stories.js +10 -14
  124. package/lib/esm/core-components/atoms/loader/loader.stories.js.map +1 -1
  125. package/lib/esm/core-components/atoms/loader/loader.test.js +9 -0
  126. package/lib/esm/core-components/atoms/loader/loader.test.js.map +1 -0
  127. package/lib/esm/core-components/atoms/radio/radio.component.js +5 -12
  128. package/lib/esm/core-components/atoms/radio/radio.component.js.map +1 -1
  129. package/lib/esm/core-components/atoms/radio/radio.stories.js +10 -19
  130. package/lib/esm/core-components/atoms/radio/radio.stories.js.map +1 -1
  131. package/lib/esm/core-components/atoms/radio/radio.test.js +9 -0
  132. package/lib/esm/core-components/atoms/radio/radio.test.js.map +1 -0
  133. package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
  134. package/lib/esm/core-components/atoms/stepper/stepper.stories.js +15 -17
  135. package/lib/esm/core-components/atoms/stepper/stepper.stories.js.map +1 -1
  136. package/lib/esm/core-components/atoms/stepper/stepper.test.js +8 -0
  137. package/lib/esm/core-components/atoms/stepper/stepper.test.js.map +1 -0
  138. package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
  139. package/lib/esm/core-components/atoms/timer/timer.component.js.map +1 -1
  140. package/lib/esm/core-components/atoms/timer/timer.test.js +15 -0
  141. package/lib/esm/core-components/atoms/timer/timer.test.js.map +1 -0
  142. package/lib/esm/core-components/index.js +15 -12
  143. package/lib/esm/core-components/index.js.map +1 -1
  144. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +102 -0
  145. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js.map +1 -0
  146. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +11 -0
  147. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js.map +1 -0
  148. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +11 -0
  149. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js.map +1 -0
  150. package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +162 -0
  151. package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js.map +1 -0
  152. package/lib/esm/core-utils/index.js +2 -2
  153. package/lib/esm/core-utils/unit-test.utils.js +5 -5
  154. package/lib/esm/index.js +2 -2
  155. package/lib/esm/library/assets/svg/index.js +28 -0
  156. package/lib/esm/library/assets/svg/index.js.map +1 -0
  157. package/lib/esm/reportWebVitals.js +10 -10
  158. package/lib/esm/reportWebVitals.js.map +1 -1
  159. package/lib/esm/setupTests.js +2 -2
  160. package/package.json +46 -33
  161. package/lib/cjs/core-components/atoms/buttons/buttons.component.test.js +0 -22
  162. package/lib/cjs/core-components/atoms/buttons/buttons.component.test.js.map +0 -1
  163. package/lib/cjs/core-components/atoms/check-box/checkBox.component.test.js +0 -21
  164. package/lib/cjs/core-components/atoms/check-box/checkBox.component.test.js.map +0 -1
  165. package/lib/cjs/core-components/atoms/date-picker/date-picker.component.test.js +0 -23
  166. package/lib/cjs/core-components/atoms/date-picker/date-picker.component.test.js.map +0 -1
  167. package/lib/cjs/core-components/atoms/input/input-pin.component.test.js +0 -36
  168. package/lib/cjs/core-components/atoms/input/input-pin.component.test.js.map +0 -1
  169. package/lib/cjs/core-components/atoms/input/input.component.test.js +0 -38
  170. package/lib/cjs/core-components/atoms/input/input.component.test.js.map +0 -1
  171. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.test.js +0 -23
  172. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.test.js.map +0 -1
  173. package/lib/cjs/core-components/atoms/loader/loader.component.test.js +0 -18
  174. package/lib/cjs/core-components/atoms/loader/loader.component.test.js.map +0 -1
  175. package/lib/cjs/core-components/atoms/radio/radio.component.test.js +0 -21
  176. package/lib/cjs/core-components/atoms/radio/radio.component.test.js.map +0 -1
  177. package/lib/cjs/core-components/atoms/stepper/stepper.component.test.js +0 -22
  178. package/lib/cjs/core-components/atoms/stepper/stepper.component.test.js.map +0 -1
  179. package/lib/cjs/core-components/atoms/timer/timer.component.test.js +0 -30
  180. package/lib/cjs/core-components/atoms/timer/timer.component.test.js.map +0 -1
  181. package/lib/esm/core-components/atoms/buttons/buttons.component.test.js +0 -15
  182. package/lib/esm/core-components/atoms/buttons/buttons.component.test.js.map +0 -1
  183. package/lib/esm/core-components/atoms/check-box/checkBox.component.test.js +0 -11
  184. package/lib/esm/core-components/atoms/check-box/checkBox.component.test.js.map +0 -1
  185. package/lib/esm/core-components/atoms/date-picker/date-picker.component.test.js +0 -16
  186. package/lib/esm/core-components/atoms/date-picker/date-picker.component.test.js.map +0 -1
  187. package/lib/esm/core-components/atoms/input/input-pin.component.test.js +0 -29
  188. package/lib/esm/core-components/atoms/input/input-pin.component.test.js.map +0 -1
  189. package/lib/esm/core-components/atoms/input/input.component.test.js +0 -31
  190. package/lib/esm/core-components/atoms/input/input.component.test.js.map +0 -1
  191. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.test.js +0 -16
  192. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.test.js.map +0 -1
  193. package/lib/esm/core-components/atoms/loader/loader.component.test.js +0 -9
  194. package/lib/esm/core-components/atoms/loader/loader.component.test.js.map +0 -1
  195. package/lib/esm/core-components/atoms/radio/radio.component.test.js +0 -11
  196. package/lib/esm/core-components/atoms/radio/radio.component.test.js.map +0 -1
  197. package/lib/esm/core-components/atoms/stepper/stepper.component.test.js +0 -15
  198. package/lib/esm/core-components/atoms/stepper/stepper.component.test.js.map +0 -1
  199. package/lib/esm/core-components/atoms/timer/timer.component.test.js +0 -15
  200. package/lib/esm/core-components/atoms/timer/timer.component.test.js.map +0 -1
@@ -0,0 +1,95 @@
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
+ });
10
+ });
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();
26
+ });
27
+ });
28
+ describe('Toggle component', () => {
29
+ it('render toggle correctly', () => {
30
+ const toggle = render(React.createElement(Toggle, null));
31
+ expect(toggle).toMatchSnapshot();
32
+ });
33
+ });
34
+ // describe('SelectOption component', () => {
35
+ // it('render selectOption correctly', () => {
36
+ // const select = render(
37
+ // <SelectOption key='test' onChange={value => jest.fn()} value='test' />,
38
+ // );
39
+ // const selectOption = select.getByTestId('SELECT');
40
+ // fireEvent.change(selectOption, {target: {value: 'check'}});
41
+ // userEvent.type(selectOption, 'value');
42
+ // expect(select).toMatchSnapshot();
43
+ // });
44
+ // });
45
+ describe('MultilineInput component', () => {
46
+ it('render multilineInput correctly', () => {
47
+ const multi = render(React.createElement(MultilineInput, null));
48
+ expect(multi).toMatchSnapshot();
49
+ });
50
+ });
51
+ // describe('Clock component', () => {
52
+ // it('render clock correctly', () => {
53
+ // const clock = render(
54
+ // <Clock value='2022-02-20' onChange={value => jest.fn()} />,
55
+ // );
56
+ // expect(clock).toMatchSnapshot();
57
+ // });
58
+ // });
59
+ describe('Label component', () => {
60
+ it('render label correctly', () => {
61
+ const label = render(React.createElement(Label, { htmlFor: "vsdvrf" }));
62
+ expect(label).toMatchSnapshot();
63
+ });
64
+ });
65
+ describe('InputDate component', () => {
66
+ it('render inputDate correctly', () => {
67
+ const inputDate = render(React.createElement(InputDate, null));
68
+ expect(inputDate).toMatchSnapshot();
69
+ });
70
+ });
71
+ // describe('InputDateTime component', () => {
72
+ // it('render inputDateTime correctly', () => {
73
+ // const inputDateTime = render(<InputDateTime />);
74
+ // expect(inputDateTime).toMatchSnapshot();
75
+ // });
76
+ // });
77
+ describe('InputFile component', () => {
78
+ it('render inputFile correctly', () => {
79
+ const inputFile = render(React.createElement(InputFile, null));
80
+ expect(inputFile).toMatchSnapshot();
81
+ });
82
+ });
83
+ describe('InputRadio component', () => {
84
+ it('render inputRadio correctly', () => {
85
+ const inputRadio = render(React.createElement(InputRadio, null));
86
+ expect(inputRadio).toMatchSnapshot();
87
+ });
88
+ });
89
+ describe('InputWrapper component', () => {
90
+ it('render inputWrapper correctly', () => {
91
+ const inputWrapper = render(React.createElement(InputWrapper, null));
92
+ expect(inputWrapper).toMatchSnapshot();
93
+ });
94
+ });
95
+ //# sourceMappingURL=form.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.test.js","sourceRoot":"","sources":["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M,CAAC,oBAAC,YAAY,OAAG,CAAC,CAAC;QAC9C,MAAM,CAAC,YAAY,CAAC,CAAC,eAAe,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,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
@@ -1,138 +1,79 @@
1
1
  /* eslint-disable */
2
- import React, { useRef } from "react";
3
- import "./input.styles.css";
4
- export const InputPin = ({
5
- title,
6
- className,
7
- pin,
8
- errorMsg,
9
- defaultMsg,
10
- hasError,
11
- onPinChanged,
12
- }) => {
13
- const pinLength = 12;
14
- const Pin_Min_Value = 0;
15
- const Pin_Max_Value = 9;
16
- const BACKSPACE_Key = "Backspace";
17
- const inputRefs = useRef([]);
18
- const removeValuesFromArray = (valuesArray, value) => {
19
- const valueIndex = valuesArray.findIndex((entry) => entry === value);
20
- if (valueIndex === -1) {
21
- return;
22
- }
23
- valuesArray.splice(valueIndex, 1);
24
- };
25
- const changePinFocus = (pinIndex) => {
26
- const ref = inputRefs.current[pinIndex];
27
- if (ref) {
28
- ref.focus();
29
- }
30
- };
31
- const onChange = (event, index) => {
32
- const previousValue = event.target.defaultValue;
33
- const valueArray = event.target.value.split("");
34
- removeValuesFromArray(valueArray, previousValue);
35
- const value = valueArray.pop();
36
- if (!value) {
37
- return;
38
- }
39
- const pinNumber = Number(value);
40
- if (isNaN(pinNumber) || value.length === 0) {
41
- return;
42
- }
43
- if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
44
- onPinChanged(pinNumber, index);
45
- if (index < pinLength - 1) {
46
- changePinFocus(index + 1);
47
- }
48
- }
49
- };
50
- const onKeyDown = (event, index) => {
51
- const keyboardKeyCode = event.nativeEvent.code;
52
- if (keyboardKeyCode != BACKSPACE_Key) return;
53
- if (pin[index] !== undefined && keyboardKeyCode === BACKSPACE_Key) {
54
- changePinFocus(index - 1);
55
- }
56
- if (pin[index] === undefined) {
57
- changePinFocus(index - 1);
58
- } else {
59
- onPinChanged(undefined, index);
60
- }
61
- };
62
- return React.createElement(
63
- "div",
64
- { className: `${className} relative` },
65
- React.createElement(
66
- "label",
67
- {
68
- className:
69
- "duration-300 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md",
70
- },
71
- title
72
- ),
73
- React.createElement(
74
- "div",
75
- { className: "flex space-x-1" },
76
- Array.from({ length: pinLength }, (_, index) => {
77
- var _a;
78
- return React.createElement(
79
- "div",
80
- { className: "flex space-x-1 max-w-full items-stretch", key: index },
81
- React.createElement("input", {
82
- "data-testid": "inputElementPin",
83
- type: "tel",
84
- className:
85
- "pb-2 block w-4 px-0 mt-0 bg-transparent text-center border-0 border-b z-20 appearance-none rounded-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ",
86
- onKeyUp: (event) => onKeyDown(event, index),
87
- key: index,
88
- onMouseUp: () => {
89
- if (pin.join("").length <= 0) {
90
- changePinFocus(0);
91
- }
92
- },
93
- onClick: () => {
94
- if (pin.join("").length <= 0) {
95
- onPinChanged(undefined, 0);
96
- }
97
- },
98
- ref: (el) => {
99
- if (el) {
100
- inputRefs.current[index] = el;
101
- }
102
- },
103
- onChange: (event) => onChange(event, index),
104
- value:
105
- ((_a = pin[index]) === null || _a === void 0
106
- ? void 0
107
- : _a.toString()) || "",
108
- }),
109
- React.createElement(
110
- "div",
111
- { className: "invisible" },
112
- (index + 1) % 4 === 0 ? "ss" : null
113
- )
114
- );
115
- })
116
- ),
117
- hasError &&
118
- (hasError === null || hasError === void 0 ? void 0 : hasError.type) !==
119
- "required" &&
120
- React.createElement(
121
- "span",
122
- {
123
- className: "text-sm text-red text-4xs font-nunitoSansRegular",
124
- id: "error",
125
- },
126
- `${errorMsg || ""}`
127
- ),
128
- (!hasError ||
129
- (hasError === null || hasError === void 0 ? void 0 : hasError.type) ===
130
- "required") &&
131
- React.createElement(
132
- "span",
133
- { className: "text-sm text-4xs font-nunitoSansRegular", id: "error" },
134
- `${defaultMsg || ""}`
135
- )
136
- );
2
+ import React, { useRef } from 'react';
3
+ import './input.styles.css';
4
+ export const InputPin = ({ title, className, pin, errorMsg, defaultMsg, hasError, onPinChanged, }) => {
5
+ const pinLength = 12;
6
+ const Pin_Min_Value = 0;
7
+ const Pin_Max_Value = 9;
8
+ const BACKSPACE_Key = 'Backspace';
9
+ const inputRefs = useRef([]);
10
+ const removeValuesFromArray = (valuesArray, value) => {
11
+ const valueIndex = valuesArray.findIndex((entry) => entry === value);
12
+ if (valueIndex === -1) {
13
+ return;
14
+ }
15
+ valuesArray.splice(valueIndex, 1);
16
+ };
17
+ const changePinFocus = (pinIndex) => {
18
+ const ref = inputRefs.current[pinIndex];
19
+ if (ref) {
20
+ ref.focus();
21
+ }
22
+ };
23
+ const onChange = (event, index) => {
24
+ const previousValue = event.target.defaultValue;
25
+ const valueArray = event.target.value.split('');
26
+ removeValuesFromArray(valueArray, previousValue);
27
+ const value = valueArray.pop();
28
+ if (!value) {
29
+ return;
30
+ }
31
+ const pinNumber = Number(value);
32
+ if (isNaN(pinNumber) || value.length === 0) {
33
+ return;
34
+ }
35
+ if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
36
+ onPinChanged(pinNumber, index);
37
+ if (index < pinLength - 1) {
38
+ changePinFocus(index + 1);
39
+ }
40
+ }
41
+ };
42
+ const onKeyDown = (event, index) => {
43
+ const keyboardKeyCode = event.nativeEvent.code;
44
+ if (keyboardKeyCode != BACKSPACE_Key)
45
+ return;
46
+ if (pin[index] !== undefined && keyboardKeyCode === BACKSPACE_Key) {
47
+ changePinFocus(index - 1);
48
+ }
49
+ if (pin[index] === undefined) {
50
+ changePinFocus(index - 1);
51
+ }
52
+ else {
53
+ onPinChanged(undefined, index);
54
+ }
55
+ };
56
+ return (React.createElement("div", { className: `${className} relative` },
57
+ React.createElement("label", { className: "duration-300 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md" }, title),
58
+ React.createElement("div", { className: "flex space-x-1" }, Array.from({ length: pinLength }, (_, index) => {
59
+ var _a;
60
+ return (React.createElement("div", { className: "flex space-x-1 max-w-full items-stretch", key: index },
61
+ React.createElement("input", { "data-testid": "inputElementPin", type: "tel", className: "pb-2 block w-4 px-0 mt-0 bg-transparent text-center border-0 border-b z-20 appearance-none rounded-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ", onKeyUp: (event) => onKeyDown(event, index), key: index, onMouseUp: () => {
62
+ if (pin.join('').length <= 0) {
63
+ changePinFocus(0);
64
+ }
65
+ }, onClick: () => {
66
+ if (pin.join('').length <= 0) {
67
+ onPinChanged(undefined, 0);
68
+ }
69
+ }, ref: (el) => {
70
+ if (el) {
71
+ inputRefs.current[index] = el;
72
+ }
73
+ }, onChange: (event) => onChange(event, index), value: ((_a = pin[index]) === null || _a === void 0 ? void 0 : _a.toString()) || '' }),
74
+ React.createElement("div", { className: "invisible" }, (index + 1) % 4 === 0 ? 'ss' : null)));
75
+ })),
76
+ hasError && (hasError === null || hasError === void 0 ? void 0 : hasError.type) !== 'required' && (React.createElement("span", { className: "text-sm text-red text-4xs font-nunitoSansRegular", id: "error" }, `${errorMsg || ''}`)),
77
+ (!hasError || (hasError === null || hasError === void 0 ? void 0 : hasError.type) === 'required') && (React.createElement("span", { className: "text-sm text-4xs font-nunitoSansRegular", id: "error" }, `${defaultMsg || ''}`))));
137
78
  };
138
- //# sourceMappingURL=input-pin.component.js.map
79
+ //# sourceMappingURL=input-pin.component.js.map
@@ -1,19 +1,15 @@
1
- import React from "react";
2
- import { InputPin } from "./input-pin.component";
3
- // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
4
- export default {
5
- title: "Atoms/InputPin",
6
- component: InputPin,
1
+ import { InputPin } from './input-pin.component';
2
+ const meta = {
3
+ title: 'Design System/Atoms/InputPin',
4
+ component: InputPin,
5
+ tags: ['autodocs'],
7
6
  };
8
- const pin = new Array(12);
9
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
10
- export const Primary = () =>
11
- React.createElement(InputPin, {
12
- title: "Enter your Aadhaar Number",
13
- hasError: true,
14
- onPinChanged: (value) => {
15
- console.log({ value });
7
+ export default meta;
8
+ export const Primary = {
9
+ args: {
10
+ title: 'Enter your Aadhaar Number',
11
+ hasError: true,
12
+ pin: new Array(12),
16
13
  },
17
- pin: pin,
18
- });
19
- //# sourceMappingURL=input-pin.stories.js.map
14
+ };
15
+ //# sourceMappingURL=input-pin.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-pin.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/input/input-pin.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,0GAA0G;AAC1G,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,QAAQ;CACc,CAAC;AAEpC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AAE1B,2GAA2G;AAC3G,MAAM,CAAC,MAAM,OAAO,GAAoC,GAAG,EAAE,CAAC,CAC5D,oBAAC,QAAQ,IACP,KAAK,EAAC,2BAA2B,EACjC,QAAQ,EAAE,IAAI,EACd,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;QACtB,OAAO,CAAC,GAAG,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC;IACvB,CAAC,EACD,GAAG,EAAE,GAAG,GACR,CACH,CAAC"}
1
+ {"version":3,"file":"input-pin.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/input/input-pin.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,MAAM,IAAI,GAA0B;IAClC,KAAK,EAAE,8BAA8B;IACrC,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AACF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,2BAA2B;QAClC,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,IAAI,KAAK,CAAC,EAAE,CAAC;KACnB;CACF,CAAC"}
@@ -0,0 +1,13 @@
1
+ /* eslint-disable testing-library/render-result-naming-convention */
2
+ import React from 'react';
3
+ import { render } from '@core-utils';
4
+ import { InputPin } from './input-pin.component';
5
+ it('render InputOtp correctly without error', () => {
6
+ const pinInput = render(React.createElement(InputPin, { title: "Enter your Aadhaar Number", hasError: false, errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number", onPinChanged: () => jest.fn(), pin: new Array(12) }));
7
+ expect(pinInput).toMatchSnapshot();
8
+ });
9
+ it('render InputOtp correctly with error', () => {
10
+ const pinInput = render(React.createElement(InputPin, { title: "Enter your Aadhaar Number", hasError: true, errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number", onPinChanged: () => jest.fn(), pin: new Array(12) }));
11
+ expect(pinInput).toMatchSnapshot();
12
+ });
13
+ //# sourceMappingURL=input-pin.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-pin.test.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/input/input-pin.test.tsx"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACjD,MAAM,QAAQ,GAAG,MAAM,CACrB,oBAAC,QAAQ,IACP,KAAK,EAAC,2BAA2B,EACjC,QAAQ,EAAE,KAAK,EACf,QAAQ,EAAC,sDAAiD,EAC1D,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAC7B,GAAG,EAAE,IAAI,KAAK,CAAC,EAAE,CAAC,GAClB,CACH,CAAC;IACF,MAAM,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;IAC9C,MAAM,QAAQ,GAAG,MAAM,CACrB,oBAAC,QAAQ,IACP,KAAK,EAAC,2BAA2B,EACjC,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAC,sDAAiD,EAC1D,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAC7B,GAAG,EAAE,IAAI,KAAK,CAAC,EAAE,CAAC,GAClB,CACH,CAAC;IACF,MAAM,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,CAAC;AACrC,CAAC,CAAC,CAAC"}
@@ -1,64 +1,14 @@
1
1
  /* eslint-disable no-console */
2
- import React from "react";
3
- import "./input.styles.css";
4
- export const Input = ({
5
- title,
6
- value,
7
- className,
8
- disable,
9
- hasError,
10
- errorMsg,
11
- defaultMsg,
12
- inputStyle,
13
- autoComplete,
14
- maxlength = 40,
15
- onChange,
16
- onBlur,
17
- }) => {
18
- const onKeyUpValue = (event) => {
19
- onChange(event.target.value);
20
- };
21
- return React.createElement(
22
- "div",
23
- { className: `${className} relative` },
24
- React.createElement("input", {
25
- "data-testid": "inputElement",
26
- type: "text",
27
- name: "name",
28
- value: value,
29
- placeholder: " ",
30
- disabled: disable,
31
- className: `pt-3 pb-2 bg-transparent block w-full px-0 mt-0 rounded-none border-0 border-b appearance-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ${inputStyle}`,
32
- onChange: (e) => onChange && onChange(e.target.value),
33
- onKeyUp: onKeyUpValue,
34
- onBlur: (e) => onBlur && onBlur(e.target.value),
35
- autoComplete: autoComplete,
36
- maxLength: maxlength,
37
- }),
38
- React.createElement(
39
- "label",
40
- {
41
- className:
42
- "absolute duration-300 top-3 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md",
43
- },
44
- title
45
- ),
46
- hasError &&
47
- (hasError === null || hasError === void 0 ? void 0 : hasError.type) !==
48
- "required" &&
49
- React.createElement(
50
- "span",
51
- { className: "text-sm text-red text-4xs", id: "error" },
52
- `${errorMsg || ""}`
53
- ),
54
- (!hasError ||
55
- (hasError === null || hasError === void 0 ? void 0 : hasError.type) ===
56
- "required") &&
57
- React.createElement(
58
- "span",
59
- { className: "text-sm text-4xs", id: "error" },
60
- `${defaultMsg || ""}`
61
- )
62
- );
2
+ import React from 'react';
3
+ import './input.styles.css';
4
+ export const Input = ({ title, value, className, disable, hasError, errorMsg, defaultMsg, inputStyle, autoComplete, maxlength = 40, onChange, onBlur, }) => {
5
+ const onKeyUpValue = (event) => {
6
+ onChange(event.target.value);
7
+ };
8
+ return (React.createElement("div", { className: `${className} relative` },
9
+ React.createElement("input", { "data-testid": "inputElement", type: "text", name: "name", value: value, placeholder: " ", disabled: disable, className: `pt-3 pb-2 bg-transparent block w-full px-0 mt-0 rounded-none border-0 border-b appearance-none focus:outline-none focus:ring-0 focus:border-gray-secondary border-gray-secondary font-nunitoSansRegular ${inputStyle}`, onChange: (e) => onChange && onChange(e.target.value), onKeyUp: onKeyUpValue, onBlur: (e) => onBlur && onBlur(e.target.value), autoComplete: autoComplete, maxLength: maxlength }),
10
+ React.createElement("label", { className: "absolute duration-300 top-3 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md" }, title),
11
+ hasError && (hasError === null || hasError === void 0 ? void 0 : hasError.type) !== 'required' && (React.createElement("span", { className: "text-sm text-red text-4xs", id: "error" }, `${errorMsg || ''}`)),
12
+ (!hasError || (hasError === null || hasError === void 0 ? void 0 : hasError.type) === 'required') && (React.createElement("span", { className: "text-sm text-4xs", id: "error" }, `${defaultMsg || ''}`))));
63
13
  };
64
- //# sourceMappingURL=input.component.js.map
14
+ //# sourceMappingURL=input.component.js.map
@@ -1,17 +1,16 @@
1
- import React from "react";
2
- import { Input } from "./input.component";
3
- // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
4
- export default {
5
- title: "Atoms/Input",
6
- component: Input,
1
+ import { Input } from './input.component';
2
+ const meta = {
3
+ title: 'Design System/Atoms/Input',
4
+ component: Input,
5
+ tags: ['autodocs'],
7
6
  };
8
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
9
- export const Primary = () =>
10
- React.createElement(Input, {
11
- className: "mt-4",
12
- title: "Enter your Pan Number",
13
- hasError: true,
14
- value: "",
15
- onChange: (panNumber) => console.log({ panNumber }),
16
- });
17
- //# sourceMappingURL=input.stories.js.map
7
+ export default meta;
8
+ export const Primary = {
9
+ args: {
10
+ className: 'mt-4',
11
+ title: 'Enter your Pan Number',
12
+ hasError: true,
13
+ value: '',
14
+ },
15
+ };
16
+ //# sourceMappingURL=input.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/input/input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAExC,0GAA0G;AAC1G,eAAe;IACb,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,KAAK;CACc,CAAC;AAEjC,2GAA2G;AAC3G,MAAM,CAAC,MAAM,OAAO,GAAiC,GAAG,EAAE,CAAC,CACzD,oBAAC,KAAK,IACJ,SAAS,EAAC,MAAM,EAChB,KAAK,EAAC,uBAAuB,EAC7B,QAAQ,EAAE,IAAI,EACd,KAAK,EAAC,EAAE,EACR,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC,SAAS,EAAC,CAAC,GACjD,CACH,CAAC"}
1
+ {"version":3,"file":"input.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/input/input.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAExC,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AACF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,EAAE;KACV;CACF,CAAC"}