react-restyle-components 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/App.js +36 -12
- package/lib/cjs/App.test.js +10 -8
- package/lib/cjs/core-components/atoms/buttons/button.stories.js +26 -24
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +27 -9
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js +15 -7
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +102 -35
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +15 -7
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +98 -37
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +17 -15
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +16 -7
- package/lib/cjs/core-components/atoms/form/form.component.js +571 -159
- package/lib/cjs/core-components/atoms/form/form.test.js +87 -59
- package/lib/cjs/core-components/atoms/icons/icons.component.js +40 -26
- package/lib/cjs/core-components/atoms/input/input-otp.component.js +118 -76
- package/lib/cjs/core-components/atoms/input/input-pin.component.js +180 -98
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
- package/lib/cjs/core-components/atoms/input/input-pin.test.js +28 -10
- package/lib/cjs/core-components/atoms/input/input.component.js +104 -33
- package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
- package/lib/cjs/core-components/atoms/input/input.test.js +30 -10
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +127 -53
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +16 -7
- package/lib/cjs/core-components/atoms/loader/loader.component.js +83 -21
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
- package/lib/cjs/core-components/atoms/loader/loader.test.js +11 -7
- package/lib/cjs/core-components/atoms/radio/radio.component.js +102 -37
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
- package/lib/cjs/core-components/atoms/radio/radio.test.js +15 -7
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +77 -34
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js +16 -7
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js.map +1 -1
- package/lib/cjs/core-components/atoms/tabs/tabs.component.js +95 -0
- package/lib/cjs/core-components/atoms/tabs/tabs.component.js.map +1 -0
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +26 -0
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -0
- package/lib/cjs/core-components/atoms/tabs/tabs.test.js +26 -0
- package/lib/cjs/core-components/atoms/tabs/tabs.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/timer/timer.component.js +119 -92
- package/lib/cjs/core-components/atoms/timer/timer.test.js +20 -10
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +85 -45
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +13 -9
- package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
- package/lib/cjs/core-components/index.js +65 -27
- package/lib/cjs/core-components/index.js.map +1 -1
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +210 -106
- 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 +23 -9
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +38 -36
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +209 -104
- 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 +28 -16
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +24 -22
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +203 -106
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +14 -7
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/cjs/core-utils/index.js +31 -15
- package/lib/cjs/core-utils/unit-test.utils.js +8 -6
- package/lib/cjs/index.js +31 -15
- package/lib/cjs/library/assets/svg/index.js +39 -13
- package/lib/cjs/reportWebVitals.js +1 -1
- package/lib/cjs/setupTests.js +1 -1
- package/lib/esm/App.js +34 -12
- package/lib/esm/App.test.js +8 -8
- package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -24
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +23 -7
- package/lib/esm/core-components/atoms/buttons/buttons.test.js +13 -7
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +65 -19
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js +13 -7
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +54 -21
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +15 -8
- package/lib/esm/core-components/atoms/form/form.component.js +513 -138
- package/lib/esm/core-components/atoms/form/form.test.js +78 -60
- package/lib/esm/core-components/atoms/icons/icons.component.js +36 -24
- package/lib/esm/core-components/atoms/input/input-otp.component.js +80 -59
- package/lib/esm/core-components/atoms/input/input-pin.component.js +142 -81
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
- package/lib/esm/core-components/atoms/input/input-pin.test.js +26 -10
- package/lib/esm/core-components/atoms/input/input.component.js +66 -16
- package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
- package/lib/esm/core-components/atoms/input/input.test.js +28 -10
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +95 -36
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +14 -7
- package/lib/esm/core-components/atoms/loader/loader.component.js +80 -20
- package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
- package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
- package/lib/esm/core-components/atoms/radio/radio.component.js +65 -21
- package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
- package/lib/esm/core-components/atoms/radio/radio.test.js +13 -7
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +74 -32
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
- package/lib/esm/core-components/atoms/stepper/stepper.test.js +14 -7
- package/lib/esm/core-components/atoms/stepper/stepper.test.js.map +1 -1
- package/lib/esm/core-components/atoms/tabs/tabs.component.js +47 -0
- package/lib/esm/core-components/atoms/tabs/tabs.component.js.map +1 -0
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js +23 -0
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -0
- package/lib/esm/core-components/atoms/tabs/tabs.test.js +19 -0
- package/lib/esm/core-components/atoms/tabs/tabs.test.js.map +1 -0
- package/lib/esm/core-components/atoms/timer/timer.component.js +81 -75
- package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +46 -25
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
- package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
- package/lib/esm/core-components/index.js +19 -18
- package/lib/esm/core-components/index.js.map +1 -1
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +170 -88
- 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 +17 -9
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +38 -37
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +169 -86
- 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 +22 -16
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +24 -23
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +166 -90
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +9 -7
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/esm/core-utils/index.js +2 -2
- package/lib/esm/core-utils/unit-test.utils.js +5 -5
- package/lib/esm/index.js +2 -2
- package/lib/esm/library/assets/svg/index.js +19 -10
- package/lib/esm/reportWebVitals.js +1 -1
- package/lib/esm/setupTests.js +2 -2
- package/package.json +3 -1
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { InputPin } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
7
|
+
React.createElement(InputPin, {
|
|
8
|
+
title: "Enter your Aadhaar Number",
|
|
9
|
+
hasError: false,
|
|
10
|
+
errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number",
|
|
11
|
+
onPinChanged: () => jest.fn(),
|
|
12
|
+
defaultPin: [],
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
expect(pinInput).toMatchSnapshot();
|
|
8
16
|
});
|
|
9
|
-
it(
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
it("render InputOtp correctly with error", () => {
|
|
18
|
+
const pinInput = render(
|
|
19
|
+
React.createElement(InputPin, {
|
|
20
|
+
title: "Enter your Aadhaar Number",
|
|
21
|
+
hasError: true,
|
|
22
|
+
errorMsg: "Uh oh! You\u2019ve entered an invalid aadhaar number",
|
|
23
|
+
onPinChanged: () => jest.fn(),
|
|
24
|
+
defaultPin: [],
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
expect(pinInput).toMatchSnapshot();
|
|
12
28
|
});
|
|
13
|
-
//# sourceMappingURL=input-pin.test.js.map
|
|
29
|
+
//# sourceMappingURL=input-pin.test.js.map
|
|
@@ -1,18 +1,68 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import React, { useState } from
|
|
3
|
-
import
|
|
4
|
-
export const Input = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import "./input.styles.css";
|
|
4
|
+
export const Input = ({
|
|
5
|
+
title,
|
|
6
|
+
defaultValue,
|
|
7
|
+
className,
|
|
8
|
+
disable,
|
|
9
|
+
hasError,
|
|
10
|
+
errorMsg,
|
|
11
|
+
defaultMsg,
|
|
12
|
+
inputStyle,
|
|
13
|
+
autoComplete,
|
|
14
|
+
maxlength = 40,
|
|
15
|
+
onChange,
|
|
16
|
+
onBlur,
|
|
17
|
+
}) => {
|
|
18
|
+
const [value, setValue] = useState(defaultValue);
|
|
19
|
+
const onKeyUpValue = (event) => {
|
|
20
|
+
onChange(event.target.value);
|
|
21
|
+
};
|
|
22
|
+
return React.createElement(
|
|
23
|
+
"div",
|
|
24
|
+
{ className: `${className} relative` },
|
|
25
|
+
React.createElement("input", {
|
|
26
|
+
"data-testid": "inputElement",
|
|
27
|
+
type: "text",
|
|
28
|
+
name: "name",
|
|
29
|
+
value: value,
|
|
30
|
+
placeholder: " ",
|
|
31
|
+
disabled: disable,
|
|
32
|
+
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}`,
|
|
33
|
+
onChange: (e) => {
|
|
34
|
+
setValue(e.target.value);
|
|
35
|
+
onChange && onChange(e.target.value);
|
|
36
|
+
},
|
|
37
|
+
onKeyUp: onKeyUpValue,
|
|
38
|
+
onBlur: (e) => onBlur && onBlur(e.target.value),
|
|
39
|
+
autoComplete: autoComplete,
|
|
40
|
+
maxLength: maxlength,
|
|
41
|
+
}),
|
|
42
|
+
React.createElement(
|
|
43
|
+
"label",
|
|
44
|
+
{
|
|
45
|
+
className:
|
|
46
|
+
"absolute duration-300 top-3 -z-1 origin-0 text-gray-dark-secondary font-nunitoSansRegular text-md",
|
|
47
|
+
},
|
|
48
|
+
title,
|
|
49
|
+
),
|
|
50
|
+
hasError &&
|
|
51
|
+
(hasError === null || hasError === void 0 ? void 0 : hasError.type) !==
|
|
52
|
+
"required" &&
|
|
53
|
+
React.createElement(
|
|
54
|
+
"span",
|
|
55
|
+
{ className: "text-sm text-red text-4xs", id: "error" },
|
|
56
|
+
`${errorMsg || ""}`,
|
|
57
|
+
),
|
|
58
|
+
(!hasError ||
|
|
59
|
+
(hasError === null || hasError === void 0 ? void 0 : hasError.type) ===
|
|
60
|
+
"required") &&
|
|
61
|
+
React.createElement(
|
|
62
|
+
"span",
|
|
63
|
+
{ className: "text-sm text-4xs", id: "error" },
|
|
64
|
+
`${defaultMsg || ""}`,
|
|
65
|
+
),
|
|
66
|
+
);
|
|
17
67
|
};
|
|
18
|
-
//# sourceMappingURL=input.component.js.map
|
|
68
|
+
//# sourceMappingURL=input.component.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Input } from
|
|
1
|
+
import { Input } from "./input.component";
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
title: "Design System/Atoms/Input",
|
|
4
|
+
component: Input,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
6
|
};
|
|
7
7
|
export default meta;
|
|
8
8
|
export const Primary = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
onBlur: (item) => {
|
|
18
|
-
console.log({ item });
|
|
19
|
-
},
|
|
9
|
+
args: {
|
|
10
|
+
className: "mt-4",
|
|
11
|
+
title: "Enter your Pan Number",
|
|
12
|
+
hasError: true,
|
|
13
|
+
defaultValue: "",
|
|
14
|
+
onChange: (item) => {
|
|
15
|
+
console.log({ item });
|
|
20
16
|
},
|
|
17
|
+
onBlur: (item) => {
|
|
18
|
+
console.log({ item });
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=input.stories.js.map
|
|
22
|
+
//# sourceMappingURL=input.stories.js.map
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { Input } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@core-utils";
|
|
4
|
+
import { Input } from "./input.component";
|
|
5
|
+
it("render Input correctly without error", () => {
|
|
6
|
+
const input = render(
|
|
7
|
+
React.createElement(Input, {
|
|
8
|
+
className: "h-1 relative top-1 border-red-600 border-b-0 dummy",
|
|
9
|
+
title: "input",
|
|
10
|
+
hasError: false,
|
|
11
|
+
defaultValue: "",
|
|
12
|
+
inputStyle: " border-b-0 invisible ",
|
|
13
|
+
onChange: () => jest.fn(),
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
expect(input).toMatchSnapshot();
|
|
8
17
|
});
|
|
9
|
-
it(
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
it("render Input correctly with error", () => {
|
|
19
|
+
const input = render(
|
|
20
|
+
React.createElement(Input, {
|
|
21
|
+
className: "h-1 relative top-1 border-red-600 border-b-0 dummy",
|
|
22
|
+
title: "input",
|
|
23
|
+
hasError: true,
|
|
24
|
+
defaultValue: "",
|
|
25
|
+
inputStyle: " border-b-0 invisible ",
|
|
26
|
+
onChange: () => jest.fn(),
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
expect(input).toMatchSnapshot();
|
|
12
30
|
});
|
|
13
|
-
//# sourceMappingURL=input.test.js.map
|
|
31
|
+
//# sourceMappingURL=input.test.js.map
|
|
@@ -1,37 +1,96 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from
|
|
2
|
-
import { UpArrow, DownArrow } from
|
|
3
|
-
export const InputDropdown = ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
2
|
+
import { UpArrow, DownArrow } from "../../../library/assets/svg";
|
|
3
|
+
export const InputDropdown = ({
|
|
4
|
+
items,
|
|
5
|
+
className,
|
|
6
|
+
hasError,
|
|
7
|
+
title,
|
|
8
|
+
onChange,
|
|
9
|
+
}) => {
|
|
10
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
11
|
+
const [value, setValue] = useState("");
|
|
12
|
+
const useOutsideAlerter = (ref) => {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
function handleClickOutside(event) {
|
|
15
|
+
if (
|
|
16
|
+
ref.current &&
|
|
17
|
+
!ref.current.contains(event.target) &&
|
|
18
|
+
isOpen &&
|
|
19
|
+
isOpen
|
|
20
|
+
)
|
|
21
|
+
setIsOpen(!isOpen);
|
|
22
|
+
}
|
|
23
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
24
|
+
return () => {
|
|
25
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
26
|
+
};
|
|
27
|
+
}, [ref]);
|
|
28
|
+
};
|
|
29
|
+
const wrapperRef = useRef(null);
|
|
30
|
+
useOutsideAlerter(wrapperRef);
|
|
31
|
+
return React.createElement(
|
|
32
|
+
"div",
|
|
33
|
+
{ className: `${className} relative` },
|
|
34
|
+
React.createElement(
|
|
35
|
+
"div",
|
|
36
|
+
{ className: "flex flex-row items-center " },
|
|
37
|
+
React.createElement("input", {
|
|
38
|
+
type: "text",
|
|
39
|
+
name: "name",
|
|
40
|
+
placeholder: title,
|
|
41
|
+
value: value,
|
|
42
|
+
className:
|
|
43
|
+
" pt-3 pb-2 w-full px-0 mt-0 bg-transparent border-gray-secondary border-0 border-b appearance-none focus:outline-none focus:ring-0 font-nunitoSansRegular text-md",
|
|
44
|
+
onClick: () => {
|
|
45
|
+
setIsOpen(!isOpen);
|
|
46
|
+
},
|
|
47
|
+
onChange: (event) => onChange && onChange(event.target.value),
|
|
48
|
+
}),
|
|
49
|
+
!isOpen &&
|
|
50
|
+
React.createElement("img", {
|
|
51
|
+
src: UpArrow,
|
|
52
|
+
className: "absolute h-4 w-4 right-0",
|
|
53
|
+
}),
|
|
54
|
+
isOpen &&
|
|
55
|
+
React.createElement("img", {
|
|
56
|
+
src: DownArrow,
|
|
57
|
+
className: "absolute h-4 w-4 right-0",
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
isOpen &&
|
|
61
|
+
React.createElement(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className:
|
|
65
|
+
"z-10 w-full absolute text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700",
|
|
66
|
+
ref: wrapperRef,
|
|
67
|
+
},
|
|
68
|
+
React.createElement(
|
|
69
|
+
"ul",
|
|
70
|
+
{ className: "py-1" },
|
|
71
|
+
items.map((item, index) =>
|
|
72
|
+
React.createElement(
|
|
73
|
+
"li",
|
|
74
|
+
{
|
|
75
|
+
key: index,
|
|
76
|
+
className:
|
|
77
|
+
"block py-2 px-4 text-md hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 font-nunitoSansRegular",
|
|
78
|
+
onClick: () => {
|
|
79
|
+
setValue(item);
|
|
80
|
+
setIsOpen(!isOpen);
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
item,
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
),
|
|
87
|
+
),
|
|
88
|
+
hasError &&
|
|
89
|
+
React.createElement(
|
|
90
|
+
"span",
|
|
91
|
+
{ className: "text-primaryCharcoal text-4xs", id: "error" },
|
|
92
|
+
`${title} is required`,
|
|
93
|
+
),
|
|
94
|
+
);
|
|
36
95
|
};
|
|
37
|
-
//# sourceMappingURL=input-dropdown.component.js.map
|
|
96
|
+
//# sourceMappingURL=input-dropdown.component.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { InputDropdown } from
|
|
1
|
+
import { InputDropdown } from "./input-dropdown.component";
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: "Design System/Atoms/InputDropdown",
|
|
4
|
+
component: InputDropdown,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { InputDropdown } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
args: {
|
|
13
|
+
title: "Source of funds",
|
|
14
|
+
items: ["Bank account", "UPI", "Credit Card"],
|
|
15
|
+
hasError: true,
|
|
16
|
+
},
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=input-dropdown.stories.js.map
|
|
18
|
+
//# sourceMappingURL=input-dropdown.stories.js.map
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { InputDropdown } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@core-utils";
|
|
4
|
+
import { InputDropdown } from "./input-dropdown.component";
|
|
5
|
+
it("render InputDropdown correctly", () => {
|
|
6
|
+
const inputDropDown = render(
|
|
7
|
+
React.createElement(InputDropdown, {
|
|
8
|
+
title: "Source of funds",
|
|
9
|
+
items: ["Bank account", "UPI", "Credit Card"],
|
|
10
|
+
hasError: true,
|
|
11
|
+
onChange: () => jest.fn(),
|
|
12
|
+
}),
|
|
13
|
+
);
|
|
14
|
+
expect(inputDropDown).toMatchSnapshot();
|
|
8
15
|
});
|
|
9
|
-
//# sourceMappingURL=input-dropdown.test.js.map
|
|
16
|
+
//# sourceMappingURL=input-dropdown.test.js.map
|
|
@@ -1,16 +1,48 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Container, Row, Spinner } from
|
|
3
|
-
export const Loader = () =>
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Container, Row, Spinner } from "reactstrap";
|
|
3
|
+
export const Loader = () =>
|
|
4
|
+
React.createElement(
|
|
5
|
+
Container,
|
|
6
|
+
{ fluid: true, className: "vh-50 d-flex" },
|
|
7
|
+
React.createElement(
|
|
8
|
+
Row,
|
|
9
|
+
{
|
|
10
|
+
className: "justify-content-center align-self-center w-100 text-center",
|
|
11
|
+
},
|
|
12
|
+
React.createElement(Spinner, { color: "primary" }),
|
|
13
|
+
),
|
|
14
|
+
);
|
|
6
15
|
export const ModalLoader = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
return React.createElement(
|
|
17
|
+
React.Fragment,
|
|
18
|
+
null,
|
|
19
|
+
React.createElement(
|
|
20
|
+
React.Fragment,
|
|
21
|
+
null,
|
|
22
|
+
React.createElement(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className:
|
|
26
|
+
"justify-center items-center flex overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none",
|
|
27
|
+
},
|
|
28
|
+
React.createElement(
|
|
29
|
+
"div",
|
|
30
|
+
{ className: "relative mx-auto " },
|
|
31
|
+
React.createElement(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className:
|
|
35
|
+
"border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none",
|
|
36
|
+
},
|
|
37
|
+
React.createElement(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: "relative p-2 flex-auto flex flex-col items-center",
|
|
41
|
+
},
|
|
42
|
+
React.createElement(
|
|
43
|
+
"style",
|
|
44
|
+
null,
|
|
45
|
+
`
|
|
14
46
|
.spinner .background {
|
|
15
47
|
fill: #555;
|
|
16
48
|
}
|
|
@@ -42,12 +74,40 @@ export const ModalLoader = () => {
|
|
|
42
74
|
transform: rotate(360deg);
|
|
43
75
|
}
|
|
44
76
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
77
|
+
`,
|
|
78
|
+
),
|
|
79
|
+
React.createElement(
|
|
80
|
+
"svg",
|
|
81
|
+
{
|
|
82
|
+
className: "spinner",
|
|
83
|
+
width: "100",
|
|
84
|
+
height: "100",
|
|
85
|
+
viewBox: "0 0 100 100",
|
|
86
|
+
},
|
|
87
|
+
React.createElement("circle", {
|
|
88
|
+
className: "background",
|
|
89
|
+
cx: "0",
|
|
90
|
+
cy: "0",
|
|
91
|
+
}),
|
|
92
|
+
React.createElement("path", {
|
|
93
|
+
className: "line",
|
|
94
|
+
d: "M 37.5,50 C 37.5,43.096441 43.096441,37.5 50,37.5 C 56.903559,37.5 62.5,43.096441 62.5,50 C 62.5,56.903559 56.903559,62.5 50,62.5 C 43.096441,62.5 37.5,56.903559 37.5,50",
|
|
95
|
+
}),
|
|
96
|
+
),
|
|
97
|
+
" ",
|
|
98
|
+
React.createElement(
|
|
99
|
+
"span",
|
|
100
|
+
{ style: { marginTop: -15 } },
|
|
101
|
+
"loading ...",
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
),
|
|
106
|
+
),
|
|
107
|
+
React.createElement("div", {
|
|
108
|
+
className: "opacity-25 fixed inset-0 z-40 bg-black",
|
|
109
|
+
}),
|
|
110
|
+
),
|
|
111
|
+
);
|
|
52
112
|
};
|
|
53
|
-
//# sourceMappingURL=loader.component.js.map
|
|
113
|
+
//# sourceMappingURL=loader.component.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Loader } from
|
|
1
|
+
import { Loader } from "./loader.component";
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: "Design System/Atoms/Loader",
|
|
4
|
+
component: Loader,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { Loader } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary = {
|
|
12
|
-
|
|
12
|
+
args: {},
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=loader.stories.js.map
|
|
14
|
+
//# sourceMappingURL=loader.stories.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { Loader } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@core-utils";
|
|
4
|
+
import { Loader } from "./loader.component";
|
|
5
|
+
it("render Loader correctly", () => {
|
|
6
|
+
const loader = render(React.createElement(Loader, null));
|
|
7
|
+
expect(loader).toMatchSnapshot();
|
|
8
8
|
});
|
|
9
|
-
//# sourceMappingURL=loader.test.js.map
|
|
9
|
+
//# sourceMappingURL=loader.test.js.map
|
|
@@ -1,22 +1,66 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { CheckedRadio, UncheckRadio } from
|
|
3
|
-
import { InputWrapper } from
|
|
4
|
-
export const Radio = ({ title =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { CheckedRadio, UncheckRadio } from "../../../library/assets/svg";
|
|
3
|
+
import { InputWrapper } from "../form/form.component";
|
|
4
|
+
export const Radio = ({ title = "Source", data = [], className, onChange }) => {
|
|
5
|
+
const [list, setList] = useState(data);
|
|
6
|
+
const width = 20;
|
|
7
|
+
return React.createElement(
|
|
8
|
+
React.Fragment,
|
|
9
|
+
null,
|
|
10
|
+
React.createElement(
|
|
11
|
+
InputWrapper,
|
|
12
|
+
{ label: title },
|
|
13
|
+
list === null || list === void 0
|
|
14
|
+
? void 0
|
|
15
|
+
: list.map((item, index) =>
|
|
16
|
+
React.createElement(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: `${className} flex items-center mb-1`,
|
|
20
|
+
onClick: () => {
|
|
21
|
+
const result =
|
|
22
|
+
list === null || list === void 0
|
|
23
|
+
? void 0
|
|
24
|
+
: list.map((e, i) => {
|
|
25
|
+
if (i == index)
|
|
26
|
+
return Object.assign(Object.assign({}, e), {
|
|
27
|
+
checked: true,
|
|
28
|
+
});
|
|
29
|
+
else
|
|
30
|
+
return Object.assign(Object.assign({}, e), {
|
|
31
|
+
checked: false,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
setList(result);
|
|
35
|
+
onChange(
|
|
36
|
+
result === null || result === void 0
|
|
37
|
+
? void 0
|
|
38
|
+
: result.find((item) => item.checked),
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
key: index,
|
|
42
|
+
},
|
|
43
|
+
React.createElement(
|
|
44
|
+
"div",
|
|
45
|
+
{ className: "flex flex-row gap-1 items-center" },
|
|
46
|
+
item.checked
|
|
47
|
+
? React.createElement(CheckedRadio, {
|
|
48
|
+
width: width,
|
|
49
|
+
height: width,
|
|
50
|
+
})
|
|
51
|
+
: React.createElement(UncheckRadio, {
|
|
52
|
+
width: width,
|
|
53
|
+
height: width,
|
|
54
|
+
}),
|
|
55
|
+
React.createElement(
|
|
56
|
+
"span",
|
|
57
|
+
{ className: "text-4xs" },
|
|
58
|
+
item === null || item === void 0 ? void 0 : item.title,
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
),
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
21
65
|
};
|
|
22
|
-
//# sourceMappingURL=radio.component.js.map
|
|
66
|
+
//# sourceMappingURL=radio.component.js.map
|