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,31 +1,31 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Button } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "./buttons.component";
|
|
3
3
|
// import {Title, Component, Source, Canvas, ArgTypes} from '@storybook/blocks';
|
|
4
|
-
import { fn } from
|
|
4
|
+
import { fn } from "@storybook/test";
|
|
5
5
|
const meta = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
title: "Design System/Atoms/Button",
|
|
7
|
+
component: Button,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
args: {
|
|
10
|
+
className: "w-40",
|
|
11
|
+
},
|
|
12
|
+
parameters: {
|
|
13
|
+
componentSubtitle: `import { Button } from 'react-restyle-components'`,
|
|
14
|
+
},
|
|
15
15
|
};
|
|
16
16
|
export default meta;
|
|
17
17
|
export const Primary = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
// parameters: {
|
|
19
|
+
// backgrounds: {
|
|
20
|
+
// default: 'dark',
|
|
21
|
+
// },
|
|
22
|
+
// },
|
|
23
|
+
args: {
|
|
24
|
+
disable: false,
|
|
25
|
+
type: "solid" || "outline",
|
|
26
|
+
children: React.createElement("span", null, "Primary"),
|
|
27
|
+
onClick: fn(),
|
|
28
|
+
},
|
|
29
29
|
};
|
|
30
30
|
// export const Disable: Story = {
|
|
31
31
|
// args: {
|
|
@@ -34,4 +34,4 @@ export const Primary = {
|
|
|
34
34
|
// disable: true,
|
|
35
35
|
// },
|
|
36
36
|
// };
|
|
37
|
-
//# sourceMappingURL=button.stories.js.map
|
|
37
|
+
//# sourceMappingURL=button.stories.js.map
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
export const Button = ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const Button = ({
|
|
3
|
+
type = "solid",
|
|
4
|
+
className = "w-40",
|
|
5
|
+
disable = false,
|
|
6
|
+
onClick,
|
|
7
|
+
children,
|
|
8
|
+
}) => {
|
|
9
|
+
const buttonColorClass =
|
|
10
|
+
type === "solid"
|
|
11
|
+
? "text-white bg-[#007BFF] hover:bg-[#007BFF] hover:shadow-lg text-white"
|
|
12
|
+
: "dark:text-white text-black border border-gray-400 hover:shadow-lg";
|
|
13
|
+
return React.createElement(
|
|
14
|
+
"button",
|
|
15
|
+
{
|
|
16
|
+
"data-testid": "buttonElement",
|
|
17
|
+
disabled: disable,
|
|
18
|
+
className: `${className} rounded-100px px-3 py-1 text-md ${buttonColorClass} pt-2 pb-2 font-nunitoSansRegular ${disable ? "opacity-50" : "opacity-100"}`,
|
|
19
|
+
onClick: () => onClick(),
|
|
20
|
+
},
|
|
21
|
+
children,
|
|
22
|
+
);
|
|
7
23
|
};
|
|
8
|
-
//# sourceMappingURL=buttons.component.js.map
|
|
24
|
+
//# sourceMappingURL=buttons.component.js.map
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { Button } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@core-utils";
|
|
4
|
+
import { Button } from "./buttons.component";
|
|
5
|
+
it("render Button correctly", () => {
|
|
6
|
+
const button = render(
|
|
7
|
+
React.createElement(
|
|
8
|
+
Button,
|
|
9
|
+
{ className: "bg-gray-light w-40", onClick: () => jest.fn() },
|
|
10
|
+
"Permanent Address",
|
|
11
|
+
),
|
|
12
|
+
);
|
|
13
|
+
expect(button).toMatchSnapshot();
|
|
8
14
|
});
|
|
9
|
-
//# sourceMappingURL=buttons.test.js.map
|
|
15
|
+
//# sourceMappingURL=buttons.test.js.map
|
|
@@ -1,20 +1,66 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { UnCheckbox, CheckedBox } from
|
|
3
|
-
import { InputWrapper } from
|
|
4
|
-
export const CheckBox = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { UnCheckbox, CheckedBox } from "../../../library/assets/svg";
|
|
3
|
+
import { InputWrapper } from "../form/form.component";
|
|
4
|
+
export const CheckBox = ({
|
|
5
|
+
title = "Banks",
|
|
6
|
+
data = [{ title: "SBI Bank", checked: false }],
|
|
7
|
+
className,
|
|
8
|
+
onChange,
|
|
9
|
+
}) => {
|
|
10
|
+
const [list, setList] = useState(data);
|
|
11
|
+
const width = 20;
|
|
12
|
+
return React.createElement(
|
|
13
|
+
InputWrapper,
|
|
14
|
+
{ label: title },
|
|
15
|
+
list === null || list === void 0
|
|
16
|
+
? void 0
|
|
17
|
+
: list.map((item, index) =>
|
|
18
|
+
React.createElement(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: `${className} flex flex-row items-center `,
|
|
22
|
+
onClick: () => {
|
|
23
|
+
const result =
|
|
24
|
+
list === null || list === void 0
|
|
25
|
+
? void 0
|
|
26
|
+
: list.map((e, i) => {
|
|
27
|
+
if (i == index)
|
|
28
|
+
return Object.assign(Object.assign({}, e), {
|
|
29
|
+
checked: !item.checked,
|
|
30
|
+
});
|
|
31
|
+
else return Object.assign({}, e);
|
|
32
|
+
});
|
|
33
|
+
setList(result);
|
|
34
|
+
onChange(
|
|
35
|
+
result === null || result === void 0
|
|
36
|
+
? void 0
|
|
37
|
+
: result.filter((item) => item.checked),
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
key: index,
|
|
41
|
+
},
|
|
42
|
+
React.createElement(
|
|
43
|
+
"div",
|
|
44
|
+
{ className: "flex mt-1" },
|
|
45
|
+
item.checked
|
|
46
|
+
? React.createElement(CheckedBox, {
|
|
47
|
+
width: width,
|
|
48
|
+
height: width,
|
|
49
|
+
fill: "#E7503D",
|
|
50
|
+
stroke: "E7503D",
|
|
51
|
+
})
|
|
52
|
+
: React.createElement(UnCheckbox, {
|
|
53
|
+
width: width,
|
|
54
|
+
height: width,
|
|
55
|
+
}),
|
|
56
|
+
),
|
|
57
|
+
React.createElement(
|
|
58
|
+
"span",
|
|
59
|
+
null,
|
|
60
|
+
item === null || item === void 0 ? void 0 : item.title,
|
|
61
|
+
),
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
19
65
|
};
|
|
20
|
-
//# sourceMappingURL=checkBox.component.js.map
|
|
66
|
+
//# sourceMappingURL=checkBox.component.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { CheckBox } from
|
|
1
|
+
import { CheckBox } from "./checkBox.component";
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: "Design System/Atoms/CheckBox",
|
|
4
|
+
component: CheckBox,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { CheckBox } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary1 = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
12
|
+
args: {
|
|
13
|
+
title: "Banks",
|
|
14
|
+
data: [
|
|
15
|
+
{ title: "SBI Bank", checked: false },
|
|
16
|
+
{ title: "ICICI Bank", checked: false },
|
|
17
|
+
],
|
|
18
|
+
disable: false,
|
|
19
|
+
onChange: (item) => {
|
|
20
|
+
console.log({ item });
|
|
22
21
|
},
|
|
22
|
+
},
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=checkBox.stories.js.map
|
|
24
|
+
//# sourceMappingURL=checkBox.stories.js.map
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { CheckBox } from
|
|
5
|
-
it(
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@core-utils";
|
|
4
|
+
import { CheckBox } from "./checkBox.component";
|
|
5
|
+
it("render CheckBox correctly", () => {
|
|
6
|
+
const checkbox = render(
|
|
7
|
+
React.createElement(CheckBox, {
|
|
8
|
+
title: "Title",
|
|
9
|
+
data: [],
|
|
10
|
+
onChange: () => jest.fn(),
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
expect(checkbox).toMatchSnapshot();
|
|
8
14
|
});
|
|
9
|
-
//# sourceMappingURL=checkBox.test.js.map
|
|
15
|
+
//# sourceMappingURL=checkBox.test.js.map
|
|
@@ -1,22 +1,55 @@
|
|
|
1
|
-
import React, { useState, forwardRef } from
|
|
2
|
-
import DatePicker from
|
|
3
|
-
import
|
|
4
|
-
import { DatePickerSvg } from
|
|
5
|
-
import dayjs from
|
|
6
|
-
import { InputWrapper } from
|
|
7
|
-
export const DatePickerComp = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import React, { useState, forwardRef } from "react";
|
|
2
|
+
import DatePicker from "react-datepicker";
|
|
3
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
4
|
+
import { DatePickerSvg } from "../../../library/assets/svg";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
import { InputWrapper } from "../form/form.component";
|
|
7
|
+
export const DatePickerComp = ({
|
|
8
|
+
title = "Title",
|
|
9
|
+
className,
|
|
10
|
+
disable,
|
|
11
|
+
value,
|
|
12
|
+
showFormat = "yyyy-MM-dd",
|
|
13
|
+
placeholder = "Select Date",
|
|
14
|
+
}) => {
|
|
15
|
+
const [pickedDate, setPickedDate] = useState(value && dayjs(value).toDate());
|
|
16
|
+
const CustomInput = forwardRef((props, ref) => {
|
|
17
|
+
return React.createElement(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
onClick: !disable && props.onClick,
|
|
21
|
+
ref: ref,
|
|
22
|
+
className:
|
|
23
|
+
" border-gray-light place-items-center border rounded-md px-2 flex ",
|
|
24
|
+
},
|
|
25
|
+
React.createElement(
|
|
26
|
+
"label",
|
|
27
|
+
{
|
|
28
|
+
className: "mr-3 font-nunitoSansRegular text-primaryCharcoal text-lg",
|
|
29
|
+
},
|
|
30
|
+
props.value || props.placeholder,
|
|
31
|
+
),
|
|
32
|
+
React.createElement(DatePickerSvg, { width: 15, height: 15 }),
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
CustomInput.displayName = "CustomInput";
|
|
36
|
+
const handleChanges = (date) => {
|
|
37
|
+
setPickedDate(date);
|
|
38
|
+
};
|
|
39
|
+
return React.createElement(
|
|
40
|
+
InputWrapper,
|
|
41
|
+
{ label: title },
|
|
42
|
+
React.createElement(
|
|
43
|
+
"div",
|
|
44
|
+
{ className: `${className} flex zIndex-999` },
|
|
45
|
+
React.createElement(DatePicker, {
|
|
46
|
+
selected: pickedDate || new Date(),
|
|
47
|
+
dateFormat: showFormat,
|
|
48
|
+
placeholder: placeholder,
|
|
49
|
+
onChange: handleChanges,
|
|
50
|
+
customInput: React.createElement(CustomInput, null),
|
|
51
|
+
}),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
21
54
|
};
|
|
22
|
-
//# sourceMappingURL=date-picker.component.js.map
|
|
55
|
+
//# sourceMappingURL=date-picker.component.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import dayjs from
|
|
2
|
-
import { DatePickerComp } from
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { DatePickerComp } from "./date-picker.component";
|
|
3
3
|
const meta = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
title: "Design System/Atoms/DatePicker",
|
|
5
|
+
component: DatePickerComp,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
parameters: {
|
|
8
|
+
componentSubtitle: `import { DatePickerComp } from 'react-restyle-components'`,
|
|
9
|
+
},
|
|
10
10
|
};
|
|
11
11
|
export default meta;
|
|
12
12
|
export const Primary = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
args: {
|
|
14
|
+
title: "Date",
|
|
15
|
+
value: dayjs().format("YYYY-MM-DD"),
|
|
16
|
+
showFormat: "dd-MM-yyyy",
|
|
17
|
+
},
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=date-picker.stories.js.map
|
|
19
|
+
//# sourceMappingURL=date-picker.stories.js.map
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import React from
|
|
3
|
-
import { render } from
|
|
4
|
-
import { DatePickerComp } from
|
|
5
|
-
import dayjs from
|
|
6
|
-
it(
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render } from "@core-utils";
|
|
4
|
+
import { DatePickerComp } from "./date-picker.component";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
it("render DatePicker correctly", () => {
|
|
7
|
+
const datepicker = render(
|
|
8
|
+
React.createElement(DatePickerComp, {
|
|
9
|
+
title: "Date",
|
|
10
|
+
className: "mt-6",
|
|
11
|
+
value: dayjs().format("YYYY-MM-DD"),
|
|
12
|
+
showFormat: "dd-MM-yyyy",
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
expect(datepicker).toMatchSnapshot();
|
|
9
16
|
});
|
|
10
|
-
//# sourceMappingURL=date-picker.test.js.map
|
|
17
|
+
//# sourceMappingURL=date-picker.test.js.map
|