react-restyle-components 0.1.43 → 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.
Files changed (135) hide show
  1. package/lib/cjs/App.js +36 -12
  2. package/lib/cjs/App.test.js +10 -8
  3. package/lib/cjs/core-components/atoms/buttons/button.stories.js +26 -44
  4. package/lib/cjs/core-components/atoms/buttons/button.stories.js.map +1 -1
  5. package/lib/cjs/core-components/atoms/buttons/buttons.component.js +27 -9
  6. package/lib/cjs/core-components/atoms/buttons/buttons.test.js +15 -7
  7. package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +102 -35
  8. package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
  9. package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +15 -7
  10. package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +98 -37
  11. package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +17 -15
  12. package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +16 -7
  13. package/lib/cjs/core-components/atoms/form/form.component.js +571 -159
  14. package/lib/cjs/core-components/atoms/form/form.test.js +87 -59
  15. package/lib/cjs/core-components/atoms/icons/icons.component.js +40 -26
  16. package/lib/cjs/core-components/atoms/input/input-otp.component.js +118 -76
  17. package/lib/cjs/core-components/atoms/input/input-pin.component.js +180 -98
  18. package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
  19. package/lib/cjs/core-components/atoms/input/input-pin.test.js +28 -10
  20. package/lib/cjs/core-components/atoms/input/input.component.js +104 -33
  21. package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
  22. package/lib/cjs/core-components/atoms/input/input.test.js +30 -10
  23. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +127 -53
  24. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
  25. package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +16 -7
  26. package/lib/cjs/core-components/atoms/loader/loader.component.js +83 -21
  27. package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
  28. package/lib/cjs/core-components/atoms/loader/loader.test.js +11 -7
  29. package/lib/cjs/core-components/atoms/radio/radio.component.js +102 -37
  30. package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
  31. package/lib/cjs/core-components/atoms/radio/radio.test.js +15 -7
  32. package/lib/cjs/core-components/atoms/stepper/stepper.component.js +77 -34
  33. package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
  34. package/lib/cjs/core-components/atoms/stepper/stepper.test.js +16 -7
  35. package/lib/cjs/core-components/atoms/stepper/stepper.test.js.map +1 -1
  36. package/lib/cjs/core-components/atoms/tabs/tabs.component.js +95 -0
  37. package/lib/cjs/core-components/atoms/tabs/tabs.component.js.map +1 -0
  38. package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +26 -0
  39. package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -0
  40. package/lib/cjs/core-components/atoms/tabs/tabs.test.js +26 -0
  41. package/lib/cjs/core-components/atoms/tabs/tabs.test.js.map +1 -0
  42. package/lib/cjs/core-components/atoms/timer/timer.component.js +119 -92
  43. package/lib/cjs/core-components/atoms/timer/timer.test.js +20 -10
  44. package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +85 -45
  45. package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +13 -9
  46. package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
  47. package/lib/cjs/core-components/index.js +65 -26
  48. package/lib/cjs/core-components/index.js.map +1 -1
  49. 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
  50. 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
  51. 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
  52. package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +226 -0
  53. package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js.map +1 -0
  54. 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 +34 -0
  55. 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.map +1 -0
  56. package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +34 -0
  57. package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js.map +1 -0
  58. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +203 -106
  59. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
  60. package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +14 -7
  61. package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
  62. package/lib/cjs/core-utils/index.js +31 -15
  63. package/lib/cjs/core-utils/unit-test.utils.js +8 -6
  64. package/lib/cjs/index.js +31 -15
  65. package/lib/cjs/library/assets/svg/index.js +39 -13
  66. package/lib/cjs/reportWebVitals.js +1 -1
  67. package/lib/cjs/setupTests.js +1 -1
  68. package/lib/esm/App.js +34 -12
  69. package/lib/esm/App.test.js +8 -8
  70. package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -44
  71. package/lib/esm/core-components/atoms/buttons/button.stories.js.map +1 -1
  72. package/lib/esm/core-components/atoms/buttons/buttons.component.js +23 -7
  73. package/lib/esm/core-components/atoms/buttons/buttons.test.js +13 -7
  74. package/lib/esm/core-components/atoms/check-box/checkBox.component.js +65 -19
  75. package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
  76. package/lib/esm/core-components/atoms/check-box/checkBox.test.js +13 -7
  77. package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +54 -21
  78. package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
  79. package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +15 -8
  80. package/lib/esm/core-components/atoms/form/form.component.js +513 -138
  81. package/lib/esm/core-components/atoms/form/form.test.js +78 -60
  82. package/lib/esm/core-components/atoms/icons/icons.component.js +36 -24
  83. package/lib/esm/core-components/atoms/input/input-otp.component.js +80 -59
  84. package/lib/esm/core-components/atoms/input/input-pin.component.js +142 -81
  85. package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
  86. package/lib/esm/core-components/atoms/input/input-pin.test.js +26 -10
  87. package/lib/esm/core-components/atoms/input/input.component.js +66 -16
  88. package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
  89. package/lib/esm/core-components/atoms/input/input.test.js +28 -10
  90. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +95 -36
  91. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
  92. package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +14 -7
  93. package/lib/esm/core-components/atoms/loader/loader.component.js +80 -20
  94. package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
  95. package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
  96. package/lib/esm/core-components/atoms/radio/radio.component.js +65 -21
  97. package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
  98. package/lib/esm/core-components/atoms/radio/radio.test.js +13 -7
  99. package/lib/esm/core-components/atoms/stepper/stepper.component.js +74 -32
  100. package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
  101. package/lib/esm/core-components/atoms/stepper/stepper.test.js +14 -7
  102. package/lib/esm/core-components/atoms/stepper/stepper.test.js.map +1 -1
  103. package/lib/esm/core-components/atoms/tabs/tabs.component.js +47 -0
  104. package/lib/esm/core-components/atoms/tabs/tabs.component.js.map +1 -0
  105. package/lib/esm/core-components/atoms/tabs/tabs.stories.js +23 -0
  106. package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -0
  107. package/lib/esm/core-components/atoms/tabs/tabs.test.js +19 -0
  108. package/lib/esm/core-components/atoms/tabs/tabs.test.js.map +1 -0
  109. package/lib/esm/core-components/atoms/timer/timer.component.js +81 -75
  110. package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
  111. package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +46 -25
  112. package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
  113. package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
  114. package/lib/esm/core-components/index.js +19 -17
  115. package/lib/esm/core-components/index.js.map +1 -1
  116. 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
  117. 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
  118. 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
  119. package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +177 -0
  120. package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js.map +1 -0
  121. 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 +23 -0
  122. 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.map +1 -0
  123. package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +30 -0
  124. package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js.map +1 -0
  125. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +166 -90
  126. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
  127. package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +9 -7
  128. package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
  129. package/lib/esm/core-utils/index.js +2 -2
  130. package/lib/esm/core-utils/unit-test.utils.js +5 -5
  131. package/lib/esm/index.js +2 -2
  132. package/lib/esm/library/assets/svg/index.js +19 -10
  133. package/lib/esm/reportWebVitals.js +1 -1
  134. package/lib/esm/setupTests.js +2 -2
  135. package/package.json +3 -1
@@ -1,23 +1,23 @@
1
- import { Radio } from './radio.component';
1
+ import { Radio } from "./radio.component";
2
2
  const meta = {
3
- title: 'Design System/Atoms/Radio',
4
- component: Radio,
5
- tags: ['autodocs'],
6
- parameters: {
7
- componentSubtitle: `import { Radio } from 'react-restyle-components'`,
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
- 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
- },
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 });
21
20
  },
21
+ },
22
22
  };
23
- //# sourceMappingURL=radio.stories.js.map
23
+ //# sourceMappingURL=radio.stories.js.map
@@ -1,9 +1,15 @@
1
1
  /* eslint-disable testing-library/render-result-naming-convention */
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();
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(
7
+ React.createElement(Radio, {
8
+ title: "Title",
9
+ data: [],
10
+ onChange: () => jest.fn(),
11
+ }),
12
+ );
13
+ expect(radio).toMatchSnapshot();
8
14
  });
9
- //# sourceMappingURL=radio.test.js.map
15
+ //# sourceMappingURL=radio.test.js.map
@@ -1,35 +1,77 @@
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)
1
+ import React from "react";
2
+ export const Stepper = ({
3
+ className = "",
4
+ steps,
5
+ currentStep = 1,
6
+ onStepClick,
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)
8
18
  stepClass +=
9
- ' font-medium border border-orange bg-background-secondary text-gray';
10
- else if (index > currentStep)
19
+ " font-medium border border-orange bg-background-secondary text-gray";
20
+ else if (index > currentStep)
11
21
  stepClass +=
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)));
22
+ " font-medium border border-gray-dark-secondary text-gray bg-background-secondary";
23
+ else if (currentStep === index)
24
+ stepClass += " font-medium bg-orange text-white";
25
+ if (typeof onStepClick === "function") stepClass += " cursor-pointer";
26
+ return React.createElement(
27
+ "div",
28
+ {
29
+ key: step,
30
+ style: { left: `${(index / (steps.length - 1)) * 100}%` },
31
+ className: "absolute",
32
+ },
33
+ React.createElement(
34
+ "span",
35
+ {
36
+ className: `${stepClass} font-nunitoSansRegular text-4xs text-center`,
37
+ onClick: () => {
38
+ if (typeof onStepClick === "function")
39
+ onStepClick(index + 1, step);
40
+ },
41
+ },
42
+ step,
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
+ );
34
76
  };
35
- //# sourceMappingURL=stepper.component.js.map
77
+ //# sourceMappingURL=stepper.component.js.map
@@ -1,19 +1,19 @@
1
- import { Stepper } from './stepper.component';
1
+ import { Stepper } from "./stepper.component";
2
2
  const meta = {
3
- title: 'Design System/Atoms/Stepper',
4
- component: Stepper,
5
- tags: ['autodocs'],
6
- parameters: {
7
- componentSubtitle: `import { Stepper } from 'react-restyle-components'`,
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
- args: {
13
- steps: ['1', '2', '3', '4'],
14
- currentStep: 2,
15
- onStepClick: (currentStep, step) => { },
16
- className: 'mt-4',
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,8 +1,15 @@
1
- import React from 'react';
2
- import { render } from '@core-utils';
3
- import { Stepper } from './stepper.component';
4
- it('rende 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();
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(
6
+ React.createElement(Stepper, {
7
+ steps: ["1", "2", "3", "4"],
8
+ currentStep: 3,
9
+ onStepClick: () => jest.fn(),
10
+ className: "mt-4",
11
+ }),
12
+ );
13
+ expect(stepper).toMatchSnapshot();
7
14
  });
8
- //# sourceMappingURL=stepper.test.js.map
15
+ //# sourceMappingURL=stepper.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stepper.test.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/stepper/stepper.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAC5C,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,MAAM,CACpB,oBAAC,OAAO,IACN,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC3B,WAAW,EAAE,CAAC,EACd,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAC5B,SAAS,EAAC,MAAM,GAChB,CACH,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;AACpC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"stepper.test.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/stepper/stepper.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAC5C,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,MAAM,CACpB,oBAAC,OAAO,IACN,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC3B,WAAW,EAAE,CAAC,EACd,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAC5B,SAAS,EAAC,MAAM,GAChB,CACH,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;AACpC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ import React, { useState } from "react";
2
+ import { Icon } from "../..";
3
+ export const Tabs = ({ options, onSelect }) => {
4
+ const [selected, setSelected] = useState(options[0].title);
5
+ return React.createElement(
6
+ "div",
7
+ { className: "flex justify-center" },
8
+ React.createElement(
9
+ "ul",
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: () => {
29
+ setSelected(item.title);
30
+ onSelect(item.title);
31
+ },
32
+ },
33
+ React.createElement(Icon, {
34
+ nameIcon: item.icon,
35
+ propsIcon: {
36
+ color: item.title == selected ? "#ffffff" : "#000000",
37
+ size: 24,
38
+ },
39
+ }),
40
+ item.title,
41
+ ),
42
+ ),
43
+ ),
44
+ ),
45
+ );
46
+ };
47
+ //# sourceMappingURL=tabs.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.component.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/tabs/tabs.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,OAAO,CAAC;AAO3B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAY,EAAE,EAAE;IACrD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,CACL,6BAAK,SAAS,EAAC,qBAAqB;QAClC,4BAAI,SAAS,EAAC,mHAAmH,IAC9H,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7B,4BAAI,GAAG,EAAE,KAAK,EAAE,SAAS,EAAC,yBAAyB;YACjD,6BACE,SAAS,EAAE,gEACT,IAAI,CAAC,KAAK,IAAI,QAAQ;oBACpB,CAAC,CAAC,wDAAwD;oBAC1D,CAAC,CAAC,+CACN,EAAE,EACF,OAAO,EAAE,GAAG,EAAE;oBACZ,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACxB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;gBAED,oBAAC,IAAI,IACH,QAAQ,EAAE,IAAI,CAAC,IAAI,EACnB,SAAS,EAAE;wBACT,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;wBACrD,IAAI,EAAE,EAAE;qBACT,GACD;gBACD,IAAI,CAAC,KAAK,CACP,CACH,CACN,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Tabs } from "./tabs.component";
2
+ const meta = {
3
+ title: "Design System/Atoms/Tabs",
4
+ component: Tabs,
5
+ tags: ["autodocs"],
6
+ parameters: {
7
+ componentSubtitle: `import { Tabs } from 'react-restyle-components'`,
8
+ },
9
+ };
10
+ export default meta;
11
+ export const Primary = {
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
+ },
21
+ },
22
+ };
23
+ //# sourceMappingURL=tabs.stories.js.map
@@ -0,0 +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;AAEtC,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,EAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAC;YAC1C,EAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAC;YACrC,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"}
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { render } from "@core-utils";
3
+ import { Tabs } from "./tabs.component";
4
+ it("render Tabs correctly", () => {
5
+ const tabs = render(
6
+ React.createElement(Tabs, {
7
+ options: [
8
+ { title: "Work History", icon: "FaHistory" },
9
+ { title: "Book Order", icon: "FaBook" },
10
+ { title: "Make Frame", icon: "MdFilterFrames" },
11
+ ],
12
+ onSelect: (item) => {
13
+ console.log({ item });
14
+ },
15
+ }),
16
+ );
17
+ expect(tabs).toMatchSnapshot();
18
+ });
19
+ //# sourceMappingURL=tabs.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.test.js","sourceRoot":"","sources":["../../../../../src/core-components/atoms/tabs/tabs.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AACtC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,CACjB,oBAAC,IAAI,IACL,OAAO,EAAE;YACP,EAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAC;YAC1C,EAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAC;YACrC,EAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAC;SAC9C,EACD,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;YACjB,OAAO,CAAC,GAAG,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;QAEtB,CAAC,GACC,CACH,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC,CAAC,CAAC"}
@@ -1,80 +1,86 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  /* eslint-disable @typescript-eslint/no-unused-expressions */
3
- import React, { useEffect, useState, useImperativeHandle } from 'react';
4
- import { TimerSVG } from '../../../library/assets/svg';
3
+ import React, { useEffect, useState, useImperativeHandle } from "react";
4
+ import { TimerSVG } from "../../../library/assets/svg";
5
5
  // eslint-disable-next-line react/display-name
6
6
  export const Timer = React.forwardRef(({ onClear }, ref) => {
7
- const width = 15;
8
- const [minute, setMinute] = useState('00');
9
- const [second, setSecond] = useState('10');
10
- useEffect(() => {
11
- const sec = parseInt(second);
12
- const min = parseInt(minute);
13
- const countDown = setInterval(() => {
14
- if (min === 0 && sec === 0) {
15
- setMinute('00');
16
- setSecond('00');
17
- clearInterval(countDown);
18
- onClear && onClear();
19
- }
20
- else {
21
- let secondstTmp = (sec - 1).toString();
22
- if (secondstTmp.length === 1) {
23
- secondstTmp = '0'.concat(secondstTmp);
24
- }
25
- setSecond(secondstTmp);
26
- if (sec === 0) {
27
- setSecond('59');
28
- const m = (min - 1).toString();
29
- setMinute('0' + m);
30
- }
31
- }
32
- }, 1000);
33
- return () => {
34
- clearInterval(countDown);
35
- };
36
- });
37
- useImperativeHandle(ref, () => ({
38
- updateState() {
39
- setMinute('02');
40
- setSecond('00');
41
- },
42
- resetTimer() {
43
- // eslint-disable-next-line no-console
44
- const sec = parseInt(second);
45
- const min = parseInt(minute === '00' ? '02' : minute);
46
- const countDown = setInterval(() => {
47
- // eslint-disable-next-line no-console
48
- if (min === 0 && sec === 0) {
49
- setMinute('00');
50
- setSecond('00');
51
- clearInterval(countDown);
52
- onClear && onClear();
53
- }
54
- else {
55
- let secondstTmp = (sec - 1).toString();
56
- if (secondstTmp.length === 1) {
57
- secondstTmp = '0'.concat(secondstTmp);
58
- }
59
- setSecond(secondstTmp);
60
- if (sec === 0) {
61
- setSecond('59');
62
- const m = (min - 1).toString();
63
- setMinute('0' + m);
64
- }
65
- }
66
- }, 1000);
67
- return () => {
68
- clearInterval(countDown);
69
- };
70
- },
71
- }));
72
- return (React.createElement("div", { className: "flex flex-row items-center" },
73
- React.createElement(TimerSVG, { width: width, height: width, fill: "#E7503D" }),
74
- React.createElement("div", { className: "ml-2 flex flex-row" },
75
- React.createElement("span", null,
76
- minute,
77
- ":"),
78
- React.createElement("span", null, second))));
7
+ const width = 15;
8
+ const [minute, setMinute] = useState("00");
9
+ const [second, setSecond] = useState("10");
10
+ useEffect(() => {
11
+ const sec = parseInt(second);
12
+ const min = parseInt(minute);
13
+ const countDown = setInterval(() => {
14
+ if (min === 0 && sec === 0) {
15
+ setMinute("00");
16
+ setSecond("00");
17
+ clearInterval(countDown);
18
+ onClear && onClear();
19
+ } else {
20
+ let secondstTmp = (sec - 1).toString();
21
+ if (secondstTmp.length === 1) {
22
+ secondstTmp = "0".concat(secondstTmp);
23
+ }
24
+ setSecond(secondstTmp);
25
+ if (sec === 0) {
26
+ setSecond("59");
27
+ const m = (min - 1).toString();
28
+ setMinute("0" + m);
29
+ }
30
+ }
31
+ }, 1000);
32
+ return () => {
33
+ clearInterval(countDown);
34
+ };
35
+ });
36
+ useImperativeHandle(ref, () => ({
37
+ updateState() {
38
+ setMinute("02");
39
+ setSecond("00");
40
+ },
41
+ resetTimer() {
42
+ // eslint-disable-next-line no-console
43
+ const sec = parseInt(second);
44
+ const min = parseInt(minute === "00" ? "02" : minute);
45
+ const countDown = setInterval(() => {
46
+ // eslint-disable-next-line no-console
47
+ if (min === 0 && sec === 0) {
48
+ setMinute("00");
49
+ setSecond("00");
50
+ clearInterval(countDown);
51
+ onClear && onClear();
52
+ } else {
53
+ let secondstTmp = (sec - 1).toString();
54
+ if (secondstTmp.length === 1) {
55
+ secondstTmp = "0".concat(secondstTmp);
56
+ }
57
+ setSecond(secondstTmp);
58
+ if (sec === 0) {
59
+ setSecond("59");
60
+ const m = (min - 1).toString();
61
+ setMinute("0" + m);
62
+ }
63
+ }
64
+ }, 1000);
65
+ return () => {
66
+ clearInterval(countDown);
67
+ };
68
+ },
69
+ }));
70
+ return React.createElement(
71
+ "div",
72
+ { className: "flex flex-row items-center" },
73
+ React.createElement(TimerSVG, {
74
+ width: width,
75
+ height: width,
76
+ fill: "#E7503D",
77
+ }),
78
+ React.createElement(
79
+ "div",
80
+ { className: "ml-2 flex flex-row" },
81
+ React.createElement("span", null, minute, ":"),
82
+ React.createElement("span", null, second),
83
+ ),
84
+ );
79
85
  });
80
- //# sourceMappingURL=timer.component.js.map
86
+ //# sourceMappingURL=timer.component.js.map
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable testing-library/await-async-query */
2
2
  /* eslint-disable testing-library/prefer-screen-queries */
3
3
  /* eslint-disable testing-library/render-result-naming-convention */
4
- import React from 'react';
5
- import { render } from '@core-utils';
6
- import { Timer as TimerComp } from './timer.component';
7
- it('render Timer correctly', () => {
8
- const time = render(React.createElement(TimerComp, { onClear: () => { } }));
9
- expect(time).toMatchSnapshot();
4
+ import React from "react";
5
+ import { render } from "@core-utils";
6
+ import { Timer as TimerComp } from "./timer.component";
7
+ it("render Timer correctly", () => {
8
+ const time = render(React.createElement(TimerComp, { onClear: () => {} }));
9
+ expect(time).toMatchSnapshot();
10
10
  });
11
- it('render Timer with minute correctly', () => {
12
- const time = render(React.createElement(TimerComp, { onClear: () => { } }));
13
- expect(time.findByText('minute')).toBeTruthy();
11
+ it("render Timer with minute correctly", () => {
12
+ const time = render(React.createElement(TimerComp, { onClear: () => {} }));
13
+ expect(time.findByText("minute")).toBeTruthy();
14
14
  });
15
- //# sourceMappingURL=timer.test.js.map
15
+ //# sourceMappingURL=timer.test.js.map
@@ -1,26 +1,47 @@
1
- import React from 'react';
2
- import * as Material from '@mui/material';
3
- export const Tooltip = ({ tooltipText, position = 'bottom-start', children, }) => {
4
- const positionRef = React.useRef({
5
- x: 0,
6
- y: 0,
7
- });
8
- const popperRef = React.useRef(null);
9
- const areaRef = React.useRef(null);
10
- const handleMouseMove = (event) => {
11
- positionRef.current = { x: event.clientX, y: event.clientY };
12
- if (popperRef.current != null) {
13
- popperRef.current.update();
14
- }
15
- };
16
- return (React.createElement(Material.Tooltip, { title: tooltipText, placement: "bottom-start", arrow: true, PopperProps: {
17
- popperRef,
18
- anchorEl: {
19
- getBoundingClientRect: () => {
20
- return new DOMRect(positionRef.current.x, areaRef.current.getBoundingClientRect().y + 22, 0, 0);
21
- },
22
- },
23
- } },
24
- React.createElement(Material.Box, { ref: areaRef, onMouseMove: handleMouseMove }, children)));
1
+ import React from "react";
2
+ import * as Material from "@mui/material";
3
+ export const Tooltip = ({
4
+ tooltipText,
5
+ position = "bottom-start",
6
+ children,
7
+ }) => {
8
+ const positionRef = React.useRef({
9
+ x: 0,
10
+ y: 0,
11
+ });
12
+ const popperRef = React.useRef(null);
13
+ const areaRef = React.useRef(null);
14
+ const handleMouseMove = (event) => {
15
+ positionRef.current = { x: event.clientX, y: event.clientY };
16
+ if (popperRef.current != null) {
17
+ popperRef.current.update();
18
+ }
19
+ };
20
+ return React.createElement(
21
+ Material.Tooltip,
22
+ {
23
+ title: tooltipText,
24
+ placement: "bottom-start",
25
+ arrow: true,
26
+ PopperProps: {
27
+ popperRef,
28
+ anchorEl: {
29
+ getBoundingClientRect: () => {
30
+ return new DOMRect(
31
+ positionRef.current.x,
32
+ areaRef.current.getBoundingClientRect().y + 22,
33
+ 0,
34
+ 0,
35
+ );
36
+ },
37
+ },
38
+ },
39
+ },
40
+ React.createElement(
41
+ Material.Box,
42
+ { ref: areaRef, onMouseMove: handleMouseMove },
43
+ children,
44
+ ),
45
+ );
25
46
  };
26
- //# sourceMappingURL=tooltip.component.js.map
47
+ //# sourceMappingURL=tooltip.component.js.map
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { Tooltip } from './tooltip.component';
4
- describe('Tooltip component', () => {
5
- it('render tooltip correctly', () => {
6
- const tooltip = render(React.createElement(Tooltip, null));
7
- expect(tooltip).toMatchSnapshot();
8
- });
1
+ import React from "react";
2
+ import { render } from "@testing-library/react";
3
+ import { Tooltip } from "./tooltip.component";
4
+ describe("Tooltip component", () => {
5
+ it("render tooltip correctly", () => {
6
+ const tooltip = render(React.createElement(Tooltip, null));
7
+ expect(tooltip).toMatchSnapshot();
8
+ });
9
9
  });
10
- //# sourceMappingURL=tooltip.component.test.js.map
10
+ //# sourceMappingURL=tooltip.component.test.js.map