react-restyle-components 0.1.45 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/App.js +12 -36
- package/lib/cjs/App.test.js +8 -10
- package/lib/cjs/core-components/atoms/buttons/button.stories.js +24 -26
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +9 -27
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js +7 -15
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +35 -102
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +7 -15
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +37 -98
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +15 -17
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +7 -16
- package/lib/cjs/core-components/atoms/form/form.component.js +159 -571
- package/lib/cjs/core-components/atoms/form/form.test.js +59 -87
- package/lib/cjs/core-components/atoms/icons/icons.component.js +58 -41
- package/lib/cjs/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/icons/icons.stories.js +23 -0
- package/lib/cjs/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js +16 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/input/input-otp.component.js +76 -118
- package/lib/cjs/core-components/atoms/input/input-pin.component.js +98 -180
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
- package/lib/cjs/core-components/atoms/input/input-pin.test.js +10 -28
- package/lib/cjs/core-components/atoms/input/input.component.js +33 -104
- package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
- package/lib/cjs/core-components/atoms/input/input.test.js +10 -30
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +53 -127
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -16
- package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
- package/lib/cjs/core-components/atoms/loader/loader.test.js +7 -11
- package/lib/cjs/core-components/atoms/radio/radio.component.js +37 -102
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
- package/lib/cjs/core-components/atoms/radio/radio.test.js +7 -15
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js +7 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.component.js +32 -81
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +16 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/tabs/tabs.test.js +13 -20
- package/lib/cjs/core-components/atoms/timer/timer.component.js +92 -119
- package/lib/cjs/core-components/atoms/timer/timer.test.js +10 -20
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +45 -85
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +9 -13
- package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
- package/lib/cjs/core-components/index.js +27 -64
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +106 -210
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -23
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +36 -38
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +104 -209
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -28
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +22 -24
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +106 -203
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -14
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/cjs/core-utils/index.js +15 -31
- package/lib/cjs/core-utils/unit-test.utils.js +6 -8
- package/lib/cjs/index.js +15 -31
- package/lib/cjs/library/assets/svg/DownArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/UpArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedBox.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedRadio.svg +13 -0
- package/lib/cjs/library/assets/svg/datePicker.svg +3 -0
- package/lib/cjs/library/assets/svg/index.js +13 -39
- package/lib/cjs/library/assets/svg/index.ts +38 -0
- package/lib/cjs/library/assets/svg/timer copy.svg +3 -0
- package/lib/cjs/library/assets/svg/timer.svg +3 -0
- package/lib/cjs/library/assets/svg/unCheckbox.svg +3 -0
- package/lib/cjs/library/assets/svg/uncheckRadio.svg +3 -0
- package/lib/cjs/reportWebVitals.js +1 -1
- package/lib/cjs/setupTests.js +1 -1
- package/lib/esm/App.js +12 -34
- package/lib/esm/App.test.js +8 -8
- package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -24
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +7 -23
- package/lib/esm/core-components/atoms/buttons/buttons.test.js +7 -13
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +19 -65
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js +7 -13
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +21 -54
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +8 -15
- package/lib/esm/core-components/atoms/form/form.component.js +138 -513
- package/lib/esm/core-components/atoms/form/form.test.js +60 -78
- package/lib/esm/core-components/atoms/icons/icons.component.js +32 -36
- package/lib/esm/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/esm/core-components/atoms/icons/icons.stories.js +20 -0
- package/lib/esm/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js +11 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/esm/core-components/atoms/input/input-otp.component.js +59 -80
- package/lib/esm/core-components/atoms/input/input-pin.component.js +81 -142
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
- package/lib/esm/core-components/atoms/input/input-pin.test.js +10 -26
- package/lib/esm/core-components/atoms/input/input.component.js +16 -66
- package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
- package/lib/esm/core-components/atoms/input/input.test.js +10 -28
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -95
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -14
- package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
- package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
- package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
- package/lib/esm/core-components/atoms/radio/radio.component.js +21 -65
- package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
- package/lib/esm/core-components/atoms/radio/radio.test.js +7 -13
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
- package/lib/esm/core-components/atoms/stepper/stepper.test.js +7 -14
- package/lib/esm/core-components/atoms/tabs/tabs.component.js +15 -43
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js +17 -17
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/tabs/tabs.test.js +13 -18
- package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
- package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +25 -46
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
- package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
- package/lib/esm/core-components/index.js +19 -19
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +88 -170
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -17
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +37 -38
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +86 -169
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -22
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +23 -24
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +90 -166
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/esm/core-utils/index.js +2 -2
- package/lib/esm/core-utils/unit-test.utils.js +5 -5
- package/lib/esm/index.js +2 -2
- package/lib/esm/library/assets/svg/index.js +10 -19
- package/lib/esm/reportWebVitals.js +1 -1
- package/lib/esm/setupTests.js +2 -2
- package/lib/package.json +125 -0
- package/package.json +3 -2
|
@@ -1,16 +1,9 @@
|
|
|
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
|
-
|
|
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();
|
|
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(React.createElement(InputDropdown, { title: "Source of funds", items: ['Bank account', 'UPI', 'Credit Card'], hasError: true, onChange: () => jest.fn() }));
|
|
7
|
+
expect(inputDropDown).toMatchSnapshot();
|
|
15
8
|
});
|
|
16
|
-
//# sourceMappingURL=input-dropdown.test.js.map
|
|
9
|
+
//# sourceMappingURL=input-dropdown.test.js.map
|
|
@@ -1,48 +1,16 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Container, Row, Spinner } from
|
|
3
|
-
export const Loader = () =>
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Container, Row, Spinner } from 'reactstrap';
|
|
3
|
+
export const Loader = () => (React.createElement(Container, { fluid: true, className: "vh-50 d-flex" },
|
|
4
|
+
React.createElement(Row, { className: "justify-content-center align-self-center w-100 text-center" },
|
|
5
|
+
React.createElement(Spinner, { color: "primary" }))));
|
|
15
6
|
export const ModalLoader = () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
`
|
|
7
|
+
return (React.createElement(React.Fragment, null,
|
|
8
|
+
React.createElement(React.Fragment, null,
|
|
9
|
+
React.createElement("div", { className: "justify-center items-center flex overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none" },
|
|
10
|
+
React.createElement("div", { className: "relative mx-auto " },
|
|
11
|
+
React.createElement("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none" },
|
|
12
|
+
React.createElement("div", { className: "relative p-2 flex-auto flex flex-col items-center" },
|
|
13
|
+
React.createElement("style", null, `
|
|
46
14
|
.spinner .background {
|
|
47
15
|
fill: #555;
|
|
48
16
|
}
|
|
@@ -74,40 +42,12 @@ export const ModalLoader = () => {
|
|
|
74
42
|
transform: rotate(360deg);
|
|
75
43
|
}
|
|
76
44
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
);
|
|
45
|
+
`),
|
|
46
|
+
React.createElement("svg", { className: "spinner", width: "100", height: "100", viewBox: "0 0 100 100" },
|
|
47
|
+
React.createElement("circle", { className: "background", cx: "0", cy: "0" }),
|
|
48
|
+
React.createElement("path", { className: "line", 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" })),
|
|
49
|
+
' ',
|
|
50
|
+
React.createElement("span", { style: { marginTop: -15 } }, "loading ..."))))),
|
|
51
|
+
React.createElement("div", { className: "opacity-25 fixed inset-0 z-40 bg-black" }))));
|
|
112
52
|
};
|
|
113
|
-
//# sourceMappingURL=loader.component.js.map
|
|
53
|
+
//# 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,66 +1,22 @@
|
|
|
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
|
-
|
|
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
|
-
);
|
|
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(React.Fragment, null,
|
|
8
|
+
React.createElement(InputWrapper, { label: title }, list === null || list === void 0 ? void 0 : list.map((item, index) => (React.createElement("div", { className: `${className} flex items-center mb-1`, onClick: () => {
|
|
9
|
+
const result = list === null || list === void 0 ? void 0 : list.map((e, i) => {
|
|
10
|
+
if (i == index)
|
|
11
|
+
return Object.assign(Object.assign({}, e), { checked: true });
|
|
12
|
+
else
|
|
13
|
+
return Object.assign(Object.assign({}, e), { checked: false });
|
|
14
|
+
});
|
|
15
|
+
setList(result);
|
|
16
|
+
onChange(result === null || result === void 0 ? void 0 : result.find((item) => item.checked));
|
|
17
|
+
}, key: index },
|
|
18
|
+
React.createElement("div", { className: "flex flex-row gap-1 items-center" },
|
|
19
|
+
item.checked ? (React.createElement(CheckedRadio, { width: width, height: width })) : (React.createElement(UncheckRadio, { width: width, height: width })),
|
|
20
|
+
React.createElement("span", { className: "text-4xs" }, item === null || item === void 0 ? void 0 : item.title))))))));
|
|
65
21
|
};
|
|
66
|
-
//# sourceMappingURL=radio.component.js.map
|
|
22
|
+
//# sourceMappingURL=radio.component.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Radio } from
|
|
1
|
+
import { Radio } from './radio.component';
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: 'Design System/Atoms/Radio',
|
|
4
|
+
component: Radio,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { Radio } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
args: {
|
|
13
|
+
title: 'Source',
|
|
14
|
+
data: [
|
|
15
|
+
{ title: 'Salary', checked: false },
|
|
16
|
+
{ title: 'Business', checked: false },
|
|
17
|
+
],
|
|
18
|
+
onChange: (item) => {
|
|
19
|
+
console.log({ item });
|
|
20
|
+
},
|
|
20
21
|
},
|
|
21
|
-
},
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=radio.stories.js.map
|
|
23
|
+
//# sourceMappingURL=radio.stories.js.map
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { Radio } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
title: "Title",
|
|
9
|
-
data: [],
|
|
10
|
-
onChange: () => jest.fn(),
|
|
11
|
-
}),
|
|
12
|
-
);
|
|
13
|
-
expect(radio).toMatchSnapshot();
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render } from '@core-utils';
|
|
4
|
+
import { Radio } from './radio.component';
|
|
5
|
+
it('render Radio correctly', () => {
|
|
6
|
+
const radio = render(React.createElement(Radio, { title: "Title", data: [], onChange: () => jest.fn() }));
|
|
7
|
+
expect(radio).toMatchSnapshot();
|
|
14
8
|
});
|
|
15
|
-
//# sourceMappingURL=radio.test.js.map
|
|
9
|
+
//# sourceMappingURL=radio.test.js.map
|
|
@@ -1,77 +1,35 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
export const Stepper = ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const finalClass = `${className} w-full px-4 sm:px-8`;
|
|
9
|
-
const progressClass =
|
|
10
|
-
"absolute my-4 top-1/2 left-0 h-0.5 transform -translate-y-1/2 bg-orange transition-width ease-in-out duration-500";
|
|
11
|
-
const Steps =
|
|
12
|
-
steps === null || steps === void 0
|
|
13
|
-
? void 0
|
|
14
|
-
: steps.map((step, index) => {
|
|
15
|
-
let stepClass =
|
|
16
|
-
"inline-block transform -translate-x-1/2 pt-1 w-8 h-8 rounded-full text-center";
|
|
17
|
-
if (index < currentStep)
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const Stepper = ({ className = '', steps, currentStep = 1, onStepClick, }) => {
|
|
3
|
+
const finalClass = `${className} w-full px-4 sm:px-8`;
|
|
4
|
+
const progressClass = 'absolute my-4 top-1/2 left-0 h-0.5 transform -translate-y-1/2 bg-orange transition-width ease-in-out duration-500';
|
|
5
|
+
const Steps = steps === null || steps === void 0 ? void 0 : steps.map((step, index) => {
|
|
6
|
+
let stepClass = 'inline-block transform -translate-x-1/2 pt-1 w-8 h-8 rounded-full text-center';
|
|
7
|
+
if (index < currentStep)
|
|
18
8
|
stepClass +=
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
' font-medium border border-orange bg-background-secondary text-gray';
|
|
10
|
+
else if (index > currentStep)
|
|
21
11
|
stepClass +=
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
stepClass +=
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
return React.createElement(
|
|
47
|
-
"div",
|
|
48
|
-
{ className: finalClass },
|
|
49
|
-
React.createElement(
|
|
50
|
-
"div",
|
|
51
|
-
{ className: "w-full relative" },
|
|
52
|
-
React.createElement(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
className: progressClass,
|
|
56
|
-
style: {
|
|
57
|
-
width: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
React.createElement("div", {
|
|
61
|
-
className:
|
|
62
|
-
"w-3 h-3 bg-orange rounded-full absolute right-0 top-1/2 transform translate-x-1/2 -translate-y-1/2",
|
|
63
|
-
}),
|
|
64
|
-
),
|
|
65
|
-
React.createElement("div", {
|
|
66
|
-
className:
|
|
67
|
-
"absolute h-0.5 my-4 top-1/2 left-0 transform -translate-y-1/2 bg-gray-dark-secondary transition-width ease-in-out duration-500",
|
|
68
|
-
style: {
|
|
69
|
-
marginLeft: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
70
|
-
width: `${100 - (currentStep / (steps.length - 1)) * 100}%`,
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
),
|
|
74
|
-
React.createElement("div", { className: "relative sm:block" }, Steps),
|
|
75
|
-
);
|
|
12
|
+
' font-medium border border-gray-dark-secondary text-gray bg-background-secondary';
|
|
13
|
+
else if (currentStep === index)
|
|
14
|
+
stepClass += ' font-medium bg-orange text-white';
|
|
15
|
+
if (typeof onStepClick === 'function')
|
|
16
|
+
stepClass += ' cursor-pointer';
|
|
17
|
+
return (React.createElement("div", { key: step, style: { left: `${(index / (steps.length - 1)) * 100}%` }, className: "absolute" },
|
|
18
|
+
React.createElement("span", { className: `${stepClass} font-nunitoSansRegular text-4xs text-center`, onClick: () => {
|
|
19
|
+
if (typeof onStepClick === 'function')
|
|
20
|
+
onStepClick(index + 1, step);
|
|
21
|
+
} }, step)));
|
|
22
|
+
});
|
|
23
|
+
return (React.createElement("div", { className: finalClass },
|
|
24
|
+
React.createElement("div", { className: "w-full relative" },
|
|
25
|
+
React.createElement("div", { className: progressClass, style: {
|
|
26
|
+
width: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
27
|
+
} },
|
|
28
|
+
React.createElement("div", { className: "w-3 h-3 bg-orange rounded-full absolute right-0 top-1/2 transform translate-x-1/2 -translate-y-1/2" })),
|
|
29
|
+
React.createElement("div", { className: 'absolute h-0.5 my-4 top-1/2 left-0 transform -translate-y-1/2 bg-gray-dark-secondary transition-width ease-in-out duration-500', style: {
|
|
30
|
+
marginLeft: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
31
|
+
width: `${100 - (currentStep / (steps.length - 1)) * 100}%`,
|
|
32
|
+
} })),
|
|
33
|
+
React.createElement("div", { className: "relative sm:block" }, Steps)));
|
|
76
34
|
};
|
|
77
|
-
//# sourceMappingURL=stepper.component.js.map
|
|
35
|
+
//# sourceMappingURL=stepper.component.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Stepper } from
|
|
1
|
+
import { Stepper } from './stepper.component';
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: 'Design System/Atoms/Stepper',
|
|
4
|
+
component: Stepper,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { Stepper } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
args: {
|
|
13
|
+
steps: ['1', '2', '3', '4'],
|
|
14
|
+
currentStep: 2,
|
|
15
|
+
onStepClick: (currentStep, step) => { },
|
|
16
|
+
className: 'mt-4',
|
|
17
|
+
},
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=stepper.stories.js.map
|
|
19
|
+
//# sourceMappingURL=stepper.stories.js.map
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { Stepper } from
|
|
4
|
-
it(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
steps: ["1", "2", "3", "4"],
|
|
8
|
-
currentStep: 3,
|
|
9
|
-
onStepClick: () => jest.fn(),
|
|
10
|
-
className: "mt-4",
|
|
11
|
-
}),
|
|
12
|
-
);
|
|
13
|
-
expect(stepper).toMatchSnapshot();
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@core-utils';
|
|
3
|
+
import { Stepper } from './stepper.component';
|
|
4
|
+
it('render Stepper correctly', () => {
|
|
5
|
+
const stepper = render(React.createElement(Stepper, { steps: ['1', '2', '3', '4'], currentStep: 3, onStepClick: () => jest.fn(), className: "mt-4" }));
|
|
6
|
+
expect(stepper).toMatchSnapshot();
|
|
14
7
|
});
|
|
15
|
-
//# sourceMappingURL=stepper.test.js.map
|
|
8
|
+
//# sourceMappingURL=stepper.test.js.map
|
|
@@ -1,47 +1,19 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Icon } from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Icon } from '../..';
|
|
3
3
|
export const Tabs = ({ options, onSelect }) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
className:
|
|
12
|
-
"flex flex-wrap items-center justify-center -mb-px text-sm font-medium text-center text-black cursor-pointer gap-2",
|
|
13
|
-
},
|
|
14
|
-
options === null || options === void 0
|
|
15
|
-
? void 0
|
|
16
|
-
: options.map((item, index) =>
|
|
17
|
-
React.createElement(
|
|
18
|
-
"li",
|
|
19
|
-
{ key: index, className: "bg-[#EF4444] rounded-md" },
|
|
20
|
-
React.createElement(
|
|
21
|
-
"div",
|
|
22
|
-
{
|
|
23
|
-
className: `inline-flex items-center justify-center p-3 border-b-2 gap-1 ${
|
|
24
|
-
item.title == selected
|
|
25
|
-
? "text-white font-bold md:text-md border-primary active"
|
|
26
|
-
: " text-gray-200 md:text-md border-transparent"
|
|
27
|
-
}`,
|
|
28
|
-
onClick: () => {
|
|
4
|
+
const [selected, setSelected] = useState(options[0].title);
|
|
5
|
+
return (React.createElement("div", { className: "flex justify-center" },
|
|
6
|
+
React.createElement("ul", { className: "flex flex-wrap items-center justify-center -mb-px text-sm font-medium text-center text-black cursor-pointer gap-2" }, options === null || options === void 0 ? void 0 : options.map((item, index) => (React.createElement("li", { key: index, className: "bg-[#EF4444] rounded-md" },
|
|
7
|
+
React.createElement("div", { className: `inline-flex items-center justify-center p-3 border-b-2 gap-1 ${item.title == selected
|
|
8
|
+
? 'text-white font-bold md:text-md border-primary active'
|
|
9
|
+
: ' text-gray-200 md:text-md border-transparent'}`, onClick: () => {
|
|
29
10
|
setSelected(item.title);
|
|
30
11
|
onSelect(item.title);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
size: 24,
|
|
38
|
-
},
|
|
39
|
-
}),
|
|
40
|
-
item.title,
|
|
41
|
-
),
|
|
42
|
-
),
|
|
43
|
-
),
|
|
44
|
-
),
|
|
45
|
-
);
|
|
12
|
+
} },
|
|
13
|
+
React.createElement(Icon, { nameIcon: item.icon, propsIcon: {
|
|
14
|
+
color: item.title == selected ? '#ffffff' : '#000000',
|
|
15
|
+
size: 24,
|
|
16
|
+
} }),
|
|
17
|
+
item.title)))))));
|
|
46
18
|
};
|
|
47
|
-
//# sourceMappingURL=tabs.component.js.map
|
|
19
|
+
//# sourceMappingURL=tabs.component.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Tabs } from
|
|
1
|
+
import { Tabs } from './tabs.component';
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: 'Design System/Atoms/Tabs',
|
|
4
|
+
component: Tabs,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { Tabs } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
args: {
|
|
13
|
+
options: [
|
|
14
|
+
// {title: 'Work History', icon: 'FaHistory'},
|
|
15
|
+
// {title: 'Book Order', icon: 'FaBook'},
|
|
16
|
+
{ title: 'Make Frame', icon: 'MdFilterFrames' },
|
|
17
|
+
],
|
|
18
|
+
onSelect: (item) => {
|
|
19
|
+
console.log({ item });
|
|
20
|
+
}
|
|
20
21
|
},
|
|
21
|
-
},
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=tabs.stories.js.map
|
|
23
|
+
//# sourceMappingURL=tabs.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/tabs/tabs.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"tabs.stories.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/tabs/tabs.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAKtC,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,OAAO,EAAC;YACN,8CAA8C;YAC9C,yCAAyC;YACzC,EAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAC;SAC9C;QACD,QAAQ,EAAC,CAAC,IAAI,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;QAEtB,CAAC;KACF;CACF,CAAC"}
|