react-restyle-components 0.1.58 → 0.1.60

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 (79) hide show
  1. package/lib/package.json +4 -5
  2. package/package.json +5 -6
  3. package/src/App.css +38 -0
  4. package/src/App.test.tsx +9 -0
  5. package/src/App.tsx +26 -0
  6. package/src/core-components/atoms/buttons/button.stories.tsx +42 -0
  7. package/src/core-components/atoms/buttons/buttons.component.tsx +33 -0
  8. package/src/core-components/atoms/buttons/buttons.test.tsx +13 -0
  9. package/src/core-components/atoms/check-box/checkBox.component.tsx +54 -0
  10. package/src/core-components/atoms/check-box/checkBox.stories.tsx +29 -0
  11. package/src/core-components/atoms/check-box/checkBox.test.tsx +11 -0
  12. package/src/core-components/atoms/date-picker/date-picker.component.tsx +60 -0
  13. package/src/core-components/atoms/date-picker/date-picker.stories.tsx +23 -0
  14. package/src/core-components/atoms/date-picker/date-picker.test.tsx +17 -0
  15. package/src/core-components/atoms/form/form.component.tsx +604 -0
  16. package/src/core-components/atoms/form/form.test.tsx +120 -0
  17. package/src/core-components/atoms/icons/icons.component.tsx +65 -0
  18. package/src/core-components/atoms/icons/icons.stories.tsx +24 -0
  19. package/src/core-components/atoms/icons/icons.test.tsx +15 -0
  20. package/src/core-components/atoms/input/input-otp.component.tsx +107 -0
  21. package/src/core-components/atoms/input/input-otp.styles.css +35 -0
  22. package/src/core-components/atoms/input/input-pin.component.tsx +144 -0
  23. package/src/core-components/atoms/input/input-pin.stories.tsx +25 -0
  24. package/src/core-components/atoms/input/input-pin.test.tsx +30 -0
  25. package/src/core-components/atoms/input/input.component.tsx +74 -0
  26. package/src/core-components/atoms/input/input.stories.tsx +26 -0
  27. package/src/core-components/atoms/input/input.styles.css +35 -0
  28. package/src/core-components/atoms/input/input.test.tsx +32 -0
  29. package/src/core-components/atoms/input-dropdown/input-dropdown.component.tsx +91 -0
  30. package/src/core-components/atoms/input-dropdown/input-dropdown.stories.tsx +22 -0
  31. package/src/core-components/atoms/input-dropdown/input-dropdown.test.tsx +16 -0
  32. package/src/core-components/atoms/loader/loader.component.tsx +78 -0
  33. package/src/core-components/atoms/loader/loader.stories.tsx +18 -0
  34. package/src/core-components/atoms/loader/loader.test.tsx +9 -0
  35. package/src/core-components/atoms/radio/radio.component.tsx +48 -0
  36. package/src/core-components/atoms/radio/radio.stories.tsx +27 -0
  37. package/src/core-components/atoms/radio/radio.test.tsx +11 -0
  38. package/src/core-components/atoms/stepper/stepper.component.tsx +72 -0
  39. package/src/core-components/atoms/stepper/stepper.stories.tsx +23 -0
  40. package/src/core-components/atoms/stepper/stepper.test.tsx +14 -0
  41. package/src/core-components/atoms/tabs/tabs.component.tsx +41 -0
  42. package/src/core-components/atoms/tabs/tabs.stories.tsx +27 -0
  43. package/src/core-components/atoms/tabs/tabs.test.tsx +19 -0
  44. package/src/core-components/atoms/timer/timer.component.tsx +89 -0
  45. package/src/core-components/atoms/timer/timer.test.tsx +16 -0
  46. package/src/core-components/atoms/tooltip/tooltip.component.test.tsx +10 -0
  47. package/src/core-components/atoms/tooltip/tooltip.component.tsx +54 -0
  48. package/src/core-components/atoms/tooltip/tooltip.stories.tsx +18 -0
  49. package/src/core-components/index.ts +21 -0
  50. package/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.tsx +18 -0
  51. package/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.tsx +182 -0
  52. package/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.tsx +55 -0
  53. package/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.tsx +23 -0
  54. package/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.tsx +190 -0
  55. package/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.tsx +35 -0
  56. package/src/core-components/molecules/css-multiline-input/css-multiline-input.component.tsx +135 -0
  57. package/src/core-components/molecules/css-multiline-input/css-multiline-input.stories.tsx +18 -0
  58. package/src/core-components/molecules/css-multiline-input/css-multiline-input.test.tsx +11 -0
  59. package/src/core-components/molecules/css-multiline-input/css-properties.ts +177 -0
  60. package/src/core-utils/index.ts +1 -0
  61. package/src/core-utils/unit-test.utils.tsx +12 -0
  62. package/src/custom.d.ts +4 -0
  63. package/src/index.css +17 -0
  64. package/src/index.ts +1 -0
  65. package/src/index.tsx +18 -0
  66. package/src/library/assets/svg/DownArrow.svg +14 -0
  67. package/src/library/assets/svg/UpArrow.svg +14 -0
  68. package/src/library/assets/svg/checkedBox.svg +14 -0
  69. package/src/library/assets/svg/checkedRadio.svg +13 -0
  70. package/src/library/assets/svg/datePicker.svg +3 -0
  71. package/src/library/assets/svg/index.ts +38 -0
  72. package/src/library/assets/svg/timer copy.svg +3 -0
  73. package/src/library/assets/svg/timer.svg +3 -0
  74. package/src/library/assets/svg/unCheckbox.svg +3 -0
  75. package/src/library/assets/svg/uncheckRadio.svg +3 -0
  76. package/src/logo.svg +1 -0
  77. package/src/react-app-env.d.ts +1 -0
  78. package/src/reportWebVitals.ts +16 -0
  79. package/src/setupTests.ts +5 -0
package/lib/package.json CHANGED
@@ -3,8 +3,8 @@
3
3
  "version": "0.1.56",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
- "main": "lib/cjs/index.js",
7
- "module": "lib/esm/index.js",
6
+ "main": "lib/cjs/core-components/index.js",
7
+ "types": "lib/cjs/core-components/index.d.ts",
8
8
  "author": {
9
9
  "email": "onlyappasaheb4@gmail.com",
10
10
  "name": "Lakade Appasaheb",
@@ -59,9 +59,8 @@
59
59
  "web-vitals": "*"
60
60
  },
61
61
  "files": [
62
- "*.md",
63
- "lib",
64
- "*.css"
62
+ "src/",
63
+ "lib/"
65
64
  ],
66
65
  "sideEffects": [
67
66
  "**/*.css"
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "react-restyle-components",
3
- "version": "0.1.58",
3
+ "version": "0.1.60",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
- "main": "lib/cjs/index.js",
7
- "module": "lib/esm/index.js",
6
+ "main": "lib/cjs/core-components/index.js",
7
+ "types": "lib/cjs/core-components/index.d.ts",
8
8
  "author": {
9
9
  "email": "onlyappasaheb4@gmail.com",
10
10
  "name": "Lakade Appasaheb",
@@ -59,9 +59,8 @@
59
59
  "web-vitals": "*"
60
60
  },
61
61
  "files": [
62
- "*.md",
63
- "lib",
64
- "*.css"
62
+ "src/",
63
+ "lib/"
65
64
  ],
66
65
  "sideEffects": [
67
66
  "**/*.css"
package/src/App.css ADDED
@@ -0,0 +1,38 @@
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from './App';
4
+
5
+ test('renders learn react link', () => {
6
+ render(<App />);
7
+ const linkElement = screen.getByText(/learn react/i);
8
+ expect(linkElement).toBeInTheDocument();
9
+ });
package/src/App.tsx ADDED
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import logo from './logo.svg';
3
+ import './App.css';
4
+
5
+ function App() {
6
+ return (
7
+ <div className="App">
8
+ <header className="App-header">
9
+ <img src={logo as any} className="App-logo" alt="logo" />
10
+ <p>
11
+ Edit <code>src/App.tsx</code> and save to reload.
12
+ </p>
13
+ <a
14
+ className="App-link"
15
+ href="https://reactjs.org"
16
+ target="_blank"
17
+ rel="noopener noreferrer"
18
+ >
19
+ Learn React
20
+ </a>
21
+ </header>
22
+ </div>
23
+ );
24
+ }
25
+
26
+ export default App;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import type {Meta, StoryObj} from '@storybook/react';
3
+ import {Button} from './buttons.component';
4
+ // import {Title, Component, Source, Canvas, ArgTypes} from '@storybook/blocks';
5
+ import {fn} from '@storybook/test';
6
+
7
+ const meta: Meta<typeof Button> = {
8
+ title: 'Design System/Atoms/Button',
9
+ component: Button,
10
+ tags: ['autodocs'],
11
+ args: {
12
+ className: 'w-40',
13
+ },
14
+ parameters: {
15
+ componentSubtitle: `import { Button } from 'react-restyle-components'`,
16
+ },
17
+ };
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof Button>;
21
+
22
+ export const Primary: Story = {
23
+ // parameters: {
24
+ // backgrounds: {
25
+ // default: 'dark',
26
+ // },
27
+ // },
28
+ args: {
29
+ disable: false,
30
+ type: 'solid' || 'outline',
31
+ children: <span>Primary</span>,
32
+ onClick: fn(),
33
+ },
34
+ };
35
+
36
+ // export const Disable: Story = {
37
+ // args: {
38
+ // ...Primary.args,
39
+ // children: <span>Disable</span>,
40
+ // disable: true,
41
+ // },
42
+ // };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ interface ButtonProps {
3
+ type?: 'solid' | 'outline';
4
+ className?: any;
5
+ disable?: boolean;
6
+ onClick: () => void;
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ export const Button = ({
11
+ type = 'solid',
12
+ className = 'w-40',
13
+ disable = false,
14
+ onClick,
15
+ children,
16
+ }: ButtonProps) => {
17
+ const buttonColorClass =
18
+ type === 'solid'
19
+ ? 'text-white bg-[#007BFF] hover:bg-[#007BFF] hover:shadow-lg text-white'
20
+ : 'dark:text-white text-black border border-gray-400 hover:shadow-lg';
21
+ return (
22
+ <button
23
+ data-testid="buttonElement"
24
+ disabled={disable}
25
+ className={`${className} rounded-100px px-3 py-1 text-md ${buttonColorClass} pt-2 pb-2 font-nunitoSansRegular ${
26
+ disable ? 'opacity-50' : 'opacity-100'
27
+ }`}
28
+ onClick={() => onClick()}
29
+ >
30
+ {children}
31
+ </button>
32
+ );
33
+ };
@@ -0,0 +1,13 @@
1
+ /* eslint-disable testing-library/render-result-naming-convention */
2
+ import React from 'react';
3
+ import {render} from '@core-utils';
4
+ import {Button} from './buttons.component';
5
+
6
+ it('render Button correctly', () => {
7
+ const button = render(
8
+ <Button className="bg-gray-light w-40" onClick={() => jest.fn()}>
9
+ Permanent Address
10
+ </Button>
11
+ );
12
+ expect(button).toMatchSnapshot();
13
+ });
@@ -0,0 +1,54 @@
1
+ import React, {useState} from 'react';
2
+ import {UnCheckbox, CheckedBox} from '../../../library/assets/svg';
3
+ import {InputWrapper} from '../form/form.component';
4
+ interface CheckBoxProps {
5
+ title: string;
6
+ data: Array<any>;
7
+ className?: string;
8
+ disable?: boolean;
9
+ onChange: (items: any) => void;
10
+ }
11
+
12
+ export const CheckBox = ({
13
+ title = 'Banks',
14
+ data = [{title: 'SBI Bank', checked: false}],
15
+ className,
16
+ onChange,
17
+ }: CheckBoxProps) => {
18
+ const [list, setList] = useState(data);
19
+ const width = 20;
20
+
21
+ return (
22
+ <InputWrapper label={title}>
23
+ {list?.map((item, index) => (
24
+ <div
25
+ className={`${className} flex flex-row items-center `}
26
+ onClick={() => {
27
+ const result = list?.map((e, i) => {
28
+ if (i == index) return {...e, checked: !item.checked};
29
+ else return {...e};
30
+ });
31
+ setList(result);
32
+ onChange(result?.filter((item) => item.checked));
33
+ }}
34
+ key={index}
35
+ >
36
+ <div className="flex mt-1">
37
+ {item.checked ? (
38
+ <CheckedBox
39
+ width={width}
40
+ height={width}
41
+ fill="#E7503D"
42
+ stroke="E7503D"
43
+ />
44
+ ) : (
45
+ <UnCheckbox width={width} height={width} />
46
+ )}
47
+ </div>
48
+
49
+ <span>{item?.title}</span>
50
+ </div>
51
+ ))}
52
+ </InputWrapper>
53
+ );
54
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import type {Meta, StoryObj} from '@storybook/react';
3
+ import {CheckBox} from './checkBox.component';
4
+
5
+ const meta: Meta<typeof CheckBox> = {
6
+ title: 'Design System/Atoms/CheckBox',
7
+ component: CheckBox,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ componentSubtitle: `import { CheckBox } from 'react-restyle-components'`,
11
+ },
12
+ };
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof CheckBox>;
16
+
17
+ export const Primary1: Story = {
18
+ args: {
19
+ title: 'Banks',
20
+ data: [
21
+ {title: 'SBI Bank', checked: false},
22
+ {title: 'ICICI Bank', checked: false},
23
+ ],
24
+ disable: false,
25
+ onChange: (item) => {
26
+ console.log({item});
27
+ },
28
+ },
29
+ };
@@ -0,0 +1,11 @@
1
+ /* eslint-disable testing-library/render-result-naming-convention */
2
+ import React from 'react';
3
+ import {render} from '@core-utils';
4
+ import {CheckBox} from './checkBox.component';
5
+
6
+ it('render CheckBox correctly', () => {
7
+ const checkbox = render(
8
+ <CheckBox title="Title" data={[]} onChange={() => jest.fn()} />
9
+ );
10
+ expect(checkbox).toMatchSnapshot();
11
+ });
@@ -0,0 +1,60 @@
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
+
8
+ interface DatePickerProps {
9
+ title: string;
10
+ value?: string;
11
+ className?: string;
12
+ disable?: boolean;
13
+ showFormat?: string;
14
+ placeholder?: string;
15
+ }
16
+
17
+ export const DatePickerComp = ({
18
+ title = 'Title',
19
+ className,
20
+ disable,
21
+ value,
22
+ showFormat = 'yyyy-MM-dd',
23
+ placeholder = 'Select Date',
24
+ }: DatePickerProps) => {
25
+ const [pickedDate, setPickedDate] = useState(value && dayjs(value).toDate());
26
+
27
+ const CustomInput = forwardRef((props: any, ref: any) => {
28
+ return (
29
+ <div
30
+ onClick={!disable && props.onClick}
31
+ ref={ref}
32
+ className=" border-gray-light place-items-center border rounded-md px-2 flex "
33
+ >
34
+ <label className="mr-3 font-nunitoSansRegular text-primaryCharcoal text-lg">
35
+ {props.value || props.placeholder}
36
+ </label>
37
+ <DatePickerSvg width={15} height={15} />
38
+ </div>
39
+ );
40
+ });
41
+ CustomInput.displayName = 'CustomInput';
42
+
43
+ const handleChanges = (date) => {
44
+ setPickedDate(date);
45
+ };
46
+
47
+ return (
48
+ <InputWrapper label={title}>
49
+ <div className={`${className} flex zIndex-999`}>
50
+ <DatePicker
51
+ selected={pickedDate || new Date()}
52
+ dateFormat={showFormat}
53
+ placeholder={placeholder}
54
+ onChange={handleChanges}
55
+ customInput={<CustomInput />}
56
+ />
57
+ </div>
58
+ </InputWrapper>
59
+ );
60
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import dayjs from 'dayjs';
3
+ import type {Meta, StoryObj} from '@storybook/react';
4
+ import {DatePickerComp} from './date-picker.component';
5
+
6
+ const meta: Meta<typeof DatePickerComp> = {
7
+ title: 'Design System/Atoms/DatePicker',
8
+ component: DatePickerComp,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ componentSubtitle: `import { DatePickerComp } from 'react-restyle-components'`,
12
+ },
13
+ };
14
+ export default meta;
15
+ type Story = StoryObj<typeof DatePickerComp>;
16
+
17
+ export const Primary: Story = {
18
+ args: {
19
+ title: 'Date',
20
+ value: dayjs().format('YYYY-MM-DD'),
21
+ showFormat: 'dd-MM-yyyy',
22
+ },
23
+ };
@@ -0,0 +1,17 @@
1
+ /* eslint-disable testing-library/render-result-naming-convention */
2
+ import React from 'react';
3
+ import {render} from '@core-utils';
4
+ import {DatePickerComp} from './date-picker.component';
5
+ import dayjs from 'dayjs';
6
+
7
+ it('render DatePicker correctly', () => {
8
+ const datepicker = render(
9
+ <DatePickerComp
10
+ title="Date"
11
+ className="mt-6"
12
+ value={dayjs().format('YYYY-MM-DD')}
13
+ showFormat={'dd-MM-yyyy'}
14
+ />
15
+ );
16
+ expect(datepicker).toMatchSnapshot();
17
+ });