react-restyle-components 0.1.28 → 0.1.31
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 +20 -8
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +17 -6
- package/lib/cjs/core-components/atoms/buttons/buttons.component.test.js +15 -7
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +27 -11
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.test.js +14 -7
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +22 -9
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +98 -38
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.test.js +15 -7
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +18 -8
- package/lib/cjs/core-components/atoms/input/input-otp.component.js +119 -77
- package/lib/cjs/core-components/atoms/input/input-otp.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/input/input-otp.styles.css +35 -0
- package/lib/cjs/core-components/atoms/input/input-pin.component.js +174 -94
- package/lib/cjs/core-components/atoms/input/input-pin.component.test.js +28 -10
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +17 -9
- package/lib/cjs/core-components/atoms/input/input.component.js +65 -13
- package/lib/cjs/core-components/atoms/input/input.component.test.js +30 -10
- package/lib/cjs/core-components/atoms/input/input.stories.js +16 -7
- package/lib/cjs/core-components/atoms/input/input.styles.css +35 -0
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +134 -58
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.test.js +16 -7
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +14 -7
- package/lib/cjs/core-components/atoms/loader/loader.component.js +83 -21
- package/lib/cjs/core-components/atoms/loader/loader.component.test.js +11 -7
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +14 -8
- package/lib/cjs/core-components/atoms/radio/radio.component.js +22 -8
- package/lib/cjs/core-components/atoms/radio/radio.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/radio/radio.component.test.js +14 -7
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +22 -10
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +77 -34
- package/lib/cjs/core-components/atoms/stepper/stepper.component.test.js +16 -7
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +15 -7
- package/lib/cjs/core-components/atoms/timer/timer.component.js +120 -93
- package/lib/cjs/core-components/atoms/timer/timer.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/timer/timer.component.test.js +20 -10
- package/lib/cjs/core-components/index.js +35 -16
- 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/reportWebVitals.js +52 -29
- 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 +17 -7
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +13 -4
- package/lib/esm/core-components/atoms/buttons/buttons.component.test.js +13 -7
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +20 -9
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js.map +1 -1
- package/lib/esm/core-components/atoms/check-box/checkBox.component.test.js +9 -7
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +16 -8
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +52 -20
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js.map +1 -1
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.test.js +14 -8
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +16 -8
- package/lib/esm/core-components/atoms/input/input-otp.component.js +80 -59
- package/lib/esm/core-components/atoms/input/input-otp.component.js.map +1 -1
- package/lib/esm/core-components/atoms/input/input-otp.styles.css +35 -0
- package/lib/esm/core-components/atoms/input/input-pin.component.js +136 -77
- package/lib/esm/core-components/atoms/input/input-pin.component.test.js +26 -10
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +14 -8
- package/lib/esm/core-components/atoms/input/input.component.js +62 -12
- package/lib/esm/core-components/atoms/input/input.component.test.js +28 -10
- package/lib/esm/core-components/atoms/input/input.stories.js +13 -6
- package/lib/esm/core-components/atoms/input/input.styles.css +35 -0
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +96 -37
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js.map +1 -1
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.test.js +14 -7
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +11 -6
- package/lib/esm/core-components/atoms/loader/loader.component.js +80 -20
- package/lib/esm/core-components/atoms/loader/loader.component.test.js +7 -7
- package/lib/esm/core-components/atoms/loader/loader.stories.js +11 -7
- package/lib/esm/core-components/atoms/radio/radio.component.js +12 -6
- package/lib/esm/core-components/atoms/radio/radio.component.js.map +1 -1
- package/lib/esm/core-components/atoms/radio/radio.component.test.js +9 -7
- package/lib/esm/core-components/atoms/radio/radio.stories.js +16 -9
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +74 -32
- package/lib/esm/core-components/atoms/stepper/stepper.component.test.js +14 -7
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +12 -6
- package/lib/esm/core-components/atoms/timer/timer.component.js +81 -75
- package/lib/esm/core-components/atoms/timer/timer.component.js.map +1 -1
- package/lib/esm/core-components/atoms/timer/timer.component.test.js +10 -10
- package/lib/esm/core-components/index.js +12 -12
- 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/reportWebVitals.js +10 -10
- package/lib/esm/setupTests.js +2 -2
- package/package.json +20 -4
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
exports.Primary = void 0;
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
10
|
const loader_component_1 = require("./loader.component");
|
|
9
11
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
10
12
|
exports.default = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
title: "Atoms/Loader",
|
|
14
|
+
component: loader_component_1.Loader,
|
|
13
15
|
};
|
|
14
16
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
15
|
-
const Primary = () =>
|
|
16
|
-
|
|
17
|
+
const Primary = () =>
|
|
18
|
+
react_1.default.createElement(
|
|
19
|
+
"div",
|
|
20
|
+
{ className: "flex flex-row" },
|
|
21
|
+
react_1.default.createElement(loader_component_1.Loader, null)
|
|
22
|
+
);
|
|
17
23
|
exports.Primary = Primary;
|
|
18
|
-
//# sourceMappingURL=loader.stories.js.map
|
|
24
|
+
//# sourceMappingURL=loader.stories.js.map
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
exports.Radio = void 0;
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const checkedRadio_svg_1 = require("
|
|
9
|
-
const uncheckRadio_svg_1 = require("
|
|
10
|
+
const checkedRadio_svg_1 = require("@assets/svg/checkedRadio.svg");
|
|
11
|
+
const uncheckRadio_svg_1 = require("@assets/svg/uncheckRadio.svg");
|
|
10
12
|
const Radio = ({ className, checked, onChange }) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const width = 20;
|
|
14
|
+
return react_1.default.createElement(
|
|
15
|
+
"div",
|
|
16
|
+
{ className: `${className} flex flex-row mr-2`, onClick: onChange },
|
|
17
|
+
checked
|
|
18
|
+
? react_1.default.createElement(checkedRadio_svg_1.ReactComponent, {
|
|
19
|
+
width: width,
|
|
20
|
+
height: width,
|
|
21
|
+
})
|
|
22
|
+
: react_1.default.createElement(uncheckRadio_svg_1.ReactComponent, {
|
|
23
|
+
width: width,
|
|
24
|
+
height: width,
|
|
25
|
+
})
|
|
26
|
+
);
|
|
13
27
|
};
|
|
14
28
|
exports.Radio = Radio;
|
|
15
|
-
//# sourceMappingURL=radio.component.js.map
|
|
29
|
+
//# sourceMappingURL=radio.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/radio/radio.component.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/radio/radio.component.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mEAA4E;AAC5E,mEAA4E;AAQrE,MAAM,KAAK,GAAG,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAa,EAAE,EAAE;IAClE,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,OAAO,CACL,uCAAK,SAAS,EAAE,GAAG,SAAS,qBAAqB,EAAE,OAAO,EAAE,QAAQ,IACjE,OAAO,CAAC,CAAC,CAAC,CACT,8BAAC,iCAAY,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAI,CAC9C,CAAC,CAAC,CAAC,CACF,8BAAC,iCAAY,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAI,CAC9C,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,KAAK,SAWhB"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
10
|
const _core_utils_1 = require("@core-utils");
|
|
9
11
|
const radio_component_1 = require("./radio.component");
|
|
10
|
-
it(
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
it("render XB_Radio correctly", () => {
|
|
13
|
+
const radio = (0, _core_utils_1.render)(
|
|
14
|
+
react_1.default.createElement(radio_component_1.Radio, {
|
|
15
|
+
checked: true,
|
|
16
|
+
onChange: () => jest.fn(),
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
expect(radio).toMatchSnapshot();
|
|
13
20
|
});
|
|
14
|
-
//# sourceMappingURL=radio.component.test.js.map
|
|
21
|
+
//# sourceMappingURL=radio.component.test.js.map
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
exports.Primary = void 0;
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
10
|
const radio_component_1 = require("./radio.component");
|
|
9
11
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
10
12
|
exports.default = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
title: "Atoms/Radio",
|
|
14
|
+
component: radio_component_1.Radio,
|
|
13
15
|
};
|
|
14
16
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
15
|
-
const Primary = () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const Primary = () =>
|
|
18
|
+
react_1.default.createElement(
|
|
19
|
+
react_1.default.Fragment,
|
|
20
|
+
null,
|
|
21
|
+
react_1.default.createElement(
|
|
22
|
+
"div",
|
|
23
|
+
{ className: "flex flex-row" },
|
|
24
|
+
react_1.default.createElement(radio_component_1.Radio, {
|
|
25
|
+
checked: true,
|
|
26
|
+
onChange: () => {},
|
|
27
|
+
}),
|
|
28
|
+
react_1.default.createElement("span", null, "Married")
|
|
29
|
+
)
|
|
30
|
+
);
|
|
19
31
|
exports.Primary = Primary;
|
|
20
|
-
//# sourceMappingURL=radio.stories.js.map
|
|
32
|
+
//# sourceMappingURL=radio.stories.js.map
|
|
@@ -1,42 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
exports.Stepper = void 0;
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const Stepper = ({ className =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const Stepper = ({ className = "", steps, currentStep = 1, onStepClick }) => {
|
|
11
|
+
const finalClass = `${className} w-full px-4 sm:px-8`;
|
|
12
|
+
const progressClass =
|
|
13
|
+
"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";
|
|
14
|
+
const Steps =
|
|
15
|
+
steps === null || steps === void 0
|
|
16
|
+
? void 0
|
|
17
|
+
: steps.map((step, index) => {
|
|
18
|
+
let stepClass =
|
|
19
|
+
"inline-block transform -translate-x-1/2 pt-1 w-8 h-8 rounded-full text-center";
|
|
20
|
+
if (index < currentStep)
|
|
14
21
|
stepClass +=
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
" font-medium border border-orange bg-background-secondary text-gray";
|
|
23
|
+
else if (index > currentStep)
|
|
17
24
|
stepClass +=
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
stepClass +=
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
" font-medium border border-gray-dark-secondary text-gray bg-background-secondary";
|
|
26
|
+
else if (currentStep === index)
|
|
27
|
+
stepClass += " font-medium bg-orange text-white";
|
|
28
|
+
if (typeof onStepClick === "function") stepClass += " cursor-pointer";
|
|
29
|
+
return react_1.default.createElement(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
key: step,
|
|
33
|
+
style: { left: `${(index / (steps.length - 1)) * 100}%` },
|
|
34
|
+
className: "absolute",
|
|
35
|
+
},
|
|
36
|
+
react_1.default.createElement(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: `${stepClass} font-nunitoSansRegular text-4xs text-center`,
|
|
40
|
+
onClick: () => {
|
|
41
|
+
if (typeof onStepClick === "function")
|
|
42
|
+
onStepClick(index + 1, step);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
step
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
return react_1.default.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{ className: finalClass },
|
|
52
|
+
react_1.default.createElement(
|
|
53
|
+
"div",
|
|
54
|
+
{ className: "w-full relative" },
|
|
55
|
+
react_1.default.createElement(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: progressClass,
|
|
59
|
+
style: {
|
|
60
|
+
width: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
react_1.default.createElement("div", {
|
|
64
|
+
className:
|
|
65
|
+
"w-3 h-3 bg-orange rounded-full absolute right-0 top-1/2 transform translate-x-1/2 -translate-y-1/2",
|
|
66
|
+
})
|
|
67
|
+
),
|
|
68
|
+
react_1.default.createElement("div", {
|
|
69
|
+
className:
|
|
70
|
+
"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",
|
|
71
|
+
style: {
|
|
72
|
+
marginLeft: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
73
|
+
width: `${100 - (currentStep / (steps.length - 1)) * 100}%`,
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
),
|
|
77
|
+
react_1.default.createElement(
|
|
78
|
+
"div",
|
|
79
|
+
{ className: "relative sm:block" },
|
|
80
|
+
Steps
|
|
81
|
+
)
|
|
82
|
+
);
|
|
40
83
|
};
|
|
41
84
|
exports.Stepper = Stepper;
|
|
42
|
-
//# sourceMappingURL=stepper.component.js.map
|
|
85
|
+
//# sourceMappingURL=stepper.component.js.map
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
const react_1 = __importDefault(require("react"));
|
|
7
9
|
const _core_utils_1 = require("@core-utils");
|
|
8
10
|
const stepper_component_1 = require("./stepper.component");
|
|
9
|
-
it(
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
it("render XB_Stepper correctly", () => {
|
|
12
|
+
const stepper = (0, _core_utils_1.render)(
|
|
13
|
+
react_1.default.createElement(stepper_component_1.Stepper, {
|
|
14
|
+
steps: ["1", "2", "3", "4"],
|
|
15
|
+
currentStep: 3,
|
|
16
|
+
onStepClick: () => jest.fn(),
|
|
17
|
+
className: "mt-4",
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
expect(stepper).toMatchSnapshot();
|
|
12
21
|
});
|
|
13
|
-
//# sourceMappingURL=stepper.component.test.js.map
|
|
22
|
+
//# sourceMappingURL=stepper.component.test.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
exports.Primary = void 0;
|
|
7
9
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -10,10 +12,16 @@ const react_1 = __importDefault(require("react"));
|
|
|
10
12
|
const stepper_component_1 = require("./stepper.component");
|
|
11
13
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
12
14
|
exports.default = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
title: "Atoms/Stepper",
|
|
16
|
+
component: stepper_component_1.Stepper,
|
|
15
17
|
};
|
|
16
18
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
17
|
-
const Primary = () =>
|
|
19
|
+
const Primary = () =>
|
|
20
|
+
react_1.default.createElement(stepper_component_1.Stepper, {
|
|
21
|
+
steps: ["1", "2", "3", "4"],
|
|
22
|
+
currentStep: 2,
|
|
23
|
+
onStepClick: (currentStep, step) => {},
|
|
24
|
+
className: "mt-4",
|
|
25
|
+
});
|
|
18
26
|
exports.Primary = Primary;
|
|
19
|
-
//# sourceMappingURL=stepper.stories.js.map
|
|
27
|
+
//# sourceMappingURL=stepper.stories.js.map
|
|
@@ -1,106 +1,133 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (
|
|
9
|
+
!desc ||
|
|
10
|
+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
11
|
+
) {
|
|
12
|
+
desc = {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return m[k];
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}
|
|
21
|
+
: function (o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
});
|
|
25
|
+
var __setModuleDefault =
|
|
26
|
+
(this && this.__setModuleDefault) ||
|
|
27
|
+
(Object.create
|
|
28
|
+
? function (o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}
|
|
31
|
+
: function (o, v) {
|
|
32
|
+
o["default"] = v;
|
|
33
|
+
});
|
|
34
|
+
var __importStar =
|
|
35
|
+
(this && this.__importStar) ||
|
|
36
|
+
function (mod) {
|
|
19
37
|
if (mod && mod.__esModule) return mod;
|
|
20
38
|
var result = {};
|
|
21
|
-
if (mod != null)
|
|
39
|
+
if (mod != null)
|
|
40
|
+
for (var k in mod)
|
|
41
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
42
|
+
__createBinding(result, mod, k);
|
|
22
43
|
__setModuleDefault(result, mod);
|
|
23
44
|
return result;
|
|
24
|
-
};
|
|
45
|
+
};
|
|
25
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
47
|
exports.Timer = void 0;
|
|
27
48
|
/* eslint-disable react/prop-types */
|
|
28
49
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
29
50
|
const react_1 = __importStar(require("react"));
|
|
30
|
-
const timer_svg_1 = require("
|
|
51
|
+
const timer_svg_1 = require("@assets/svg/timer.svg");
|
|
31
52
|
// eslint-disable-next-line react/display-name
|
|
32
53
|
exports.Timer = react_1.default.forwardRef(({ onClear }, ref) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
54
|
+
const width = 15;
|
|
55
|
+
const [minute, setMinute] = (0, react_1.useState)("00");
|
|
56
|
+
const [second, setSecond] = (0, react_1.useState)("10");
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
const sec = parseInt(second);
|
|
59
|
+
const min = parseInt(minute);
|
|
60
|
+
const countDown = setInterval(() => {
|
|
61
|
+
if (min === 0 && sec === 0) {
|
|
62
|
+
setMinute("00");
|
|
63
|
+
setSecond("00");
|
|
64
|
+
clearInterval(countDown);
|
|
65
|
+
onClear && onClear();
|
|
66
|
+
} else {
|
|
67
|
+
let secondstTmp = (sec - 1).toString();
|
|
68
|
+
if (secondstTmp.length === 1) {
|
|
69
|
+
secondstTmp = "0".concat(secondstTmp);
|
|
70
|
+
}
|
|
71
|
+
setSecond(secondstTmp);
|
|
72
|
+
if (sec === 0) {
|
|
73
|
+
setSecond("59");
|
|
74
|
+
const m = (min - 1).toString();
|
|
75
|
+
setMinute("0" + m);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, 1000);
|
|
79
|
+
return () => {
|
|
80
|
+
clearInterval(countDown);
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
84
|
+
updateState() {
|
|
85
|
+
setMinute("02");
|
|
86
|
+
setSecond("00");
|
|
87
|
+
},
|
|
88
|
+
resetTimer() {
|
|
89
|
+
// eslint-disable-next-line no-console
|
|
90
|
+
const sec = parseInt(second);
|
|
91
|
+
const min = parseInt(minute === "00" ? "02" : minute);
|
|
92
|
+
const countDown = setInterval(() => {
|
|
93
|
+
// eslint-disable-next-line no-console
|
|
94
|
+
if (min === 0 && sec === 0) {
|
|
95
|
+
setMinute("00");
|
|
96
|
+
setSecond("00");
|
|
97
|
+
clearInterval(countDown);
|
|
98
|
+
onClear && onClear();
|
|
99
|
+
} else {
|
|
100
|
+
let secondstTmp = (sec - 1).toString();
|
|
101
|
+
if (secondstTmp.length === 1) {
|
|
102
|
+
secondstTmp = "0".concat(secondstTmp);
|
|
103
|
+
}
|
|
104
|
+
setSecond(secondstTmp);
|
|
105
|
+
if (sec === 0) {
|
|
106
|
+
setSecond("59");
|
|
107
|
+
const m = (min - 1).toString();
|
|
108
|
+
setMinute("0" + m);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, 1000);
|
|
112
|
+
return () => {
|
|
113
|
+
clearInterval(countDown);
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
}));
|
|
117
|
+
return react_1.default.createElement(
|
|
118
|
+
"div",
|
|
119
|
+
{ className: "flex flex-row items-center" },
|
|
120
|
+
react_1.default.createElement(timer_svg_1.ReactComponent, {
|
|
121
|
+
width: width,
|
|
122
|
+
height: width,
|
|
123
|
+
fill: "#E7503D",
|
|
124
|
+
}),
|
|
125
|
+
react_1.default.createElement(
|
|
126
|
+
"div",
|
|
127
|
+
{ className: "ml-2 flex flex-row" },
|
|
128
|
+
react_1.default.createElement("span", null, minute, ":"),
|
|
129
|
+
react_1.default.createElement("span", null, second)
|
|
130
|
+
)
|
|
131
|
+
);
|
|
105
132
|
});
|
|
106
|
-
//# sourceMappingURL=timer.component.js.map
|
|
133
|
+
//# sourceMappingURL=timer.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/timer/timer.component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,6DAA6D;AAC7D,+CAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"timer.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/timer/timer.component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,6DAA6D;AAC7D,+CAA2E;AAC3E,qDAAiE;AAMjE,8CAA8C;AACjC,QAAA,KAAK,GAAG,eAAK,CAAC,UAAU,CACnC,CAAC,EAAC,OAAO,EAAa,EAAE,GAAa,EAAE,EAAE;IACvC,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAE3C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,GAAG,GAAW,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,GAAG,GAAW,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;YACjC,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE;gBAC1B,SAAS,CAAC,IAAI,CAAC,CAAC;gBAChB,SAAS,CAAC,IAAI,CAAC,CAAC;gBAChB,aAAa,CAAC,SAAS,CAAC,CAAC;gBACzB,OAAO,IAAI,OAAO,EAAE,CAAC;aACtB;iBAAM;gBACL,IAAI,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACvC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;iBACvC;gBACD,SAAS,CAAC,WAAW,CAAC,CAAC;gBACvB,IAAI,GAAG,KAAK,CAAC,EAAE;oBACb,SAAS,CAAC,IAAI,CAAC,CAAC;oBAChB,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;oBAC/B,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;iBACpB;aACF;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACT,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,WAAW;YACT,SAAS,CAAC,IAAI,CAAC,CAAC;YAChB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;QACD,UAAU;YACR,sCAAsC;YACtC,MAAM,GAAG,GAAW,QAAQ,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,GAAG,GAAW,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC9D,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;gBACjC,sCAAsC;gBACtC,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE;oBAC1B,SAAS,CAAC,IAAI,CAAC,CAAC;oBAChB,SAAS,CAAC,IAAI,CAAC,CAAC;oBAChB,aAAa,CAAC,SAAS,CAAC,CAAC;oBACzB,OAAO,IAAI,OAAO,EAAE,CAAC;iBACtB;qBAAM;oBACL,IAAI,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;oBACvC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;wBAC5B,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;qBACvC;oBACD,SAAS,CAAC,WAAW,CAAC,CAAC;oBACvB,IAAI,GAAG,KAAK,CAAC,EAAE;wBACb,SAAS,CAAC,IAAI,CAAC,CAAC;wBAChB,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;wBAC/B,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;qBACpB;iBACF;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,OAAO,GAAG,EAAE;gBACV,aAAa,CAAC,SAAS,CAAC,CAAC;YAC3B,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO,CACL,uCAAK,SAAS,EAAC,4BAA4B;QACzC,8BAAC,0BAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAC,SAAS,GAAG;QACxD,uCAAK,SAAS,EAAC,oBAAoB;YACjC;gBAAO,MAAM;oBAAS;YACtB,4CAAO,MAAM,CAAQ,CACjB,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
5
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
8
|
/* eslint-disable testing-library/await-async-query */
|
|
7
9
|
/* eslint-disable testing-library/prefer-screen-queries */
|
|
@@ -9,12 +11,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
11
|
const react_1 = __importDefault(require("react"));
|
|
10
12
|
const _core_utils_1 = require("@core-utils");
|
|
11
13
|
const timer_component_1 = require("./timer.component");
|
|
12
|
-
it(
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
it("render Timer correctly", () => {
|
|
15
|
+
const time = (0, _core_utils_1.render)(
|
|
16
|
+
react_1.default.createElement(timer_component_1.Timer, {
|
|
17
|
+
onClear: () => {},
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
expect(time).toMatchSnapshot();
|
|
15
21
|
});
|
|
16
|
-
it(
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
it("render Timer with minute correctly", () => {
|
|
23
|
+
const time = (0, _core_utils_1.render)(
|
|
24
|
+
react_1.default.createElement(timer_component_1.Timer, {
|
|
25
|
+
onClear: () => {},
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
expect(time.findByText("minute")).toBeTruthy();
|
|
19
29
|
});
|
|
20
|
-
//# sourceMappingURL=timer.component.test.js.map
|
|
30
|
+
//# sourceMappingURL=timer.component.test.js.map
|