groovinads-ui 1.2.75 → 1.9.1

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 (90) hide show
  1. package/README.md +628 -236
  2. package/dist/index.es.js +2 -15
  3. package/dist/index.js +2 -15
  4. package/index.d.ts +364 -0
  5. package/package.json +87 -79
  6. package/.babelrc +0 -3
  7. package/.eslintignore +0 -2
  8. package/.eslintrc.cjs +0 -32
  9. package/.prettierignore +0 -9
  10. package/.prettierrc +0 -7
  11. package/.storybook/main.js +0 -19
  12. package/.storybook/preview-head.html +0 -6
  13. package/.storybook/preview.js +0 -13
  14. package/.yarn/releases/yarn-4.1.1.cjs +0 -893
  15. package/.yarnrc.yml +0 -3
  16. package/rollup.config.mjs +0 -42
  17. package/src/components/Button/Button.jsx +0 -78
  18. package/src/components/Button/index.js +0 -3
  19. package/src/components/Dropdowns/DropdownComponent.jsx +0 -135
  20. package/src/components/Dropdowns/DropdownFilter.jsx +0 -304
  21. package/src/components/Dropdowns/DropdownMultiSelect.jsx +0 -304
  22. package/src/components/Dropdowns/DropdownSimpleDatePicker.jsx +0 -175
  23. package/src/components/Dropdowns/DropdownsDatePicker/DropdownDatePicker.jsx +0 -313
  24. package/src/components/Dropdowns/DropdownsDatePicker/PeriodAndDetailDropdowns.tsx +0 -351
  25. package/src/components/Dropdowns/DropdownsDatePicker/index.js +0 -3
  26. package/src/components/Dropdowns/index.js +0 -7
  27. package/src/components/Inputs/Checkbox.jsx +0 -55
  28. package/src/components/Inputs/Input.jsx +0 -155
  29. package/src/components/Inputs/InputChip.jsx +0 -168
  30. package/src/components/Inputs/InputEmail.jsx +0 -175
  31. package/src/components/Inputs/Radio.jsx +0 -57
  32. package/src/components/Inputs/Switch.jsx +0 -70
  33. package/src/components/Inputs/Textarea.jsx +0 -68
  34. package/src/components/Inputs/index.js +0 -9
  35. package/src/components/Labels/Alert.jsx +0 -62
  36. package/src/components/Labels/Icon.jsx +0 -76
  37. package/src/components/Labels/LoginSource.jsx +0 -19
  38. package/src/components/Labels/PillComponent.jsx +0 -47
  39. package/src/components/Labels/Spinner.jsx +0 -35
  40. package/src/components/Labels/StatusIcon.jsx +0 -66
  41. package/src/components/Labels/index.js +0 -8
  42. package/src/components/Navigation/Dropdowns/DeckDropdown.jsx +0 -210
  43. package/src/components/Navigation/Dropdowns/DropdownClient.jsx +0 -171
  44. package/src/components/Navigation/Dropdowns/UserDropdown.jsx +0 -69
  45. package/src/components/Navigation/Dropdowns/index.js +0 -5
  46. package/src/components/Navigation/Navbar.jsx +0 -81
  47. package/src/components/Navigation/Sidebar.jsx +0 -201
  48. package/src/components/Navigation/Stepper.jsx +0 -22
  49. package/src/components/Navigation/Tabnav.jsx +0 -73
  50. package/src/components/Navigation/index.js +0 -6
  51. package/src/components/Toasts/Toast/ToastCardComponent.jsx +0 -47
  52. package/src/components/Toasts/ToastComponent.jsx +0 -45
  53. package/src/components/Toasts/ToastProgress.jsx +0 -118
  54. package/src/components/Toasts/index.js +0 -4
  55. package/src/components/index.js +0 -50
  56. package/src/hooks/index.js +0 -4
  57. package/src/hooks/useGetBaseDomain.jsx +0 -9
  58. package/src/hooks/useTextFormatter.jsx +0 -48
  59. package/src/index.js +0 -51
  60. package/src/services/components.services.js +0 -29
  61. package/src/services/helpers.js +0 -32
  62. package/src/services/index.jsx +0 -10
  63. package/src/services/url.path.js +0 -29
  64. package/src/stories/Alert.stories.jsx +0 -11
  65. package/src/stories/Button.stories.jsx +0 -20
  66. package/src/stories/Checkbox.stories.jsx +0 -17
  67. package/src/stories/DropdownComponent.stories.jsx +0 -89
  68. package/src/stories/DropdownDatePicker.stories.jsx +0 -69
  69. package/src/stories/DropdownFilter.stories.jsx +0 -60
  70. package/src/stories/DropdownMultiSelect.stories.jsx +0 -72
  71. package/src/stories/DropdownSimpleDatePicker.stories.jsx +0 -64
  72. package/src/stories/Icon.stories.jsx +0 -11
  73. package/src/stories/Input.stories.jsx +0 -20
  74. package/src/stories/InputChip.stories.jsx +0 -44
  75. package/src/stories/InputEmail.stories.jsx +0 -27
  76. package/src/stories/Layout.stories.jsx +0 -73
  77. package/src/stories/LoginSource.stories.jsx +0 -11
  78. package/src/stories/Navbar.stories.jsx +0 -24
  79. package/src/stories/PillComponent.stories.jsx +0 -22
  80. package/src/stories/Radio.stories.jsx +0 -18
  81. package/src/stories/Sidebar.stories.jsx +0 -169
  82. package/src/stories/Spinner.stories.jsx +0 -11
  83. package/src/stories/StatusIcon.stories.jsx +0 -11
  84. package/src/stories/Stepper.stories.jsx +0 -16
  85. package/src/stories/Switch.stories.jsx +0 -17
  86. package/src/stories/Tabnav.stories.jsx +0 -55
  87. package/src/stories/Textarea.stories.jsx +0 -20
  88. package/src/stories/ToastComponent.stories.jsx +0 -62
  89. package/src/stories/ToastProgress.stories.jsx +0 -11
  90. package/version.js +0 -8
@@ -1,45 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- // BOOTSTRAP
5
- import { ToastContainer } from 'react-bootstrap';
6
-
7
- // COMPONENTS
8
- import ToastCardComponent from './Toast/ToastCardComponent';
9
-
10
- const ToastComponent = ({ toast, position = 'bottom-end' }) => {
11
- const [toastsHistory, setToastsHistory] = useState([]);
12
-
13
- useEffect(() => {
14
- if (toast) setToastsHistory([...toastsHistory, toast]);
15
- }, [toast]);
16
-
17
- return (
18
- <ToastContainer position={position}>
19
- {toastsHistory.map(
20
- ({ variant = 'info', autoClose = true, children, className }, i) => (
21
- <ToastCardComponent
22
- variant={variant}
23
- autoClose={autoClose}
24
- children={children}
25
- className={className}
26
- position={position}
27
- key={children + variant + i}
28
- />
29
- ),
30
- )}
31
- </ToastContainer>
32
- );
33
- };
34
-
35
- ToastComponent.propTypes = {
36
- toast: PropTypes.object,
37
- position: PropTypes.oneOf([
38
- 'top-start',
39
- 'top-end',
40
- 'bottom-start',
41
- 'bottom-end',
42
- ]),
43
- };
44
-
45
- export default ToastComponent;
@@ -1,118 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- // COMPONENTS
5
- import { Toast, ProgressBar, ToastContainer } from 'react-bootstrap';
6
- import { Button } from '../Button';
7
- import {Icon, Spinner} from '../Labels';
8
-
9
- const ProgressToast = ({
10
- variant,
11
- status = 'in-progress',
12
- cancelButton = false,
13
- onCancel,
14
- position = 'bottom-start',
15
- currentProgress,
16
- }) => {
17
- const toggleShow = () => setShow(!show);
18
- const [show, setShow] = useState(true);
19
- const [uploadCompleted, setUploadCompleted] = useState(false);
20
-
21
- let content;
22
-
23
- switch (variant) {
24
- case 'upload':
25
- content = (
26
- <div className='uploading'>
27
- <ProgressBar now={status === 'in-progress' ? currentProgress : currentProgress} />
28
- <div className='uploading-wrapper'>
29
- {uploadCompleted ?
30
- <div className='toast-wrapper'>
31
- <div className='toast-type'>
32
- <Icon
33
- style={'solid'}
34
- iconName={'circle-check'}
35
- scale={1}
36
- className={'icon'}
37
- />
38
- </div>
39
- <p>Upload completed</p>
40
- </div>
41
- :
42
- <>
43
- <Spinner />
44
- <p>Uploading…</p>
45
- </>
46
- }
47
- <p className='progress-percentage'>{currentProgress}%</p>
48
- </div>
49
- </div>
50
- );
51
- break;
52
- case 'processing':
53
- content = (
54
- <div className='uploading-wrapper'>
55
- <Spinner />
56
- <p>Processing…</p>
57
- </div>
58
- );
59
- break;
60
- default:
61
- content = null;
62
- }
63
-
64
- if (status === 'error') {
65
- content = (
66
- <div className='uploading-wrapper'>
67
- <div className='toast-wrapper'>
68
- <div className='toast-type'>
69
- <Icon
70
- style={'solid'}
71
- iconName={'circle-xmark'}
72
- scale={1}
73
- className={'icon'}
74
- />
75
- </div>
76
- <p>Upload failed!</p>
77
- </div>
78
- </div>
79
- );
80
- }
81
-
82
- useEffect(() => {
83
- if (currentProgress === 100) {
84
- setUploadCompleted(true);
85
- setTimeout(() => setShow(false), 3000);
86
- }
87
- }, [currentProgress]);
88
-
89
- return (
90
- <ToastContainer position={position}>
91
- <Toast className={`${status === 'error' ? 'error' : ''} ${position} ${uploadCompleted ? 'success' : ''}`} onClose={toggleShow} show={show}>
92
- <Toast.Body>
93
- {content}
94
- {cancelButton && (
95
- <Button variant={'terciary'} size={'xs'} onClick={onCancel}>
96
- Cancel
97
- </Button>
98
- )}
99
- </Toast.Body>
100
- </Toast>
101
- </ToastContainer>
102
- );
103
- };
104
-
105
- ProgressToast.propTypes = {
106
- variant: PropTypes.oneOf(['upload', 'processing']).isRequired,
107
- cancelButton: PropTypes.bool,
108
- position: PropTypes.oneOf([
109
- 'top-start',
110
- 'top-end',
111
- 'bottom-start',
112
- 'bottom-end',
113
- ]),
114
- status: PropTypes.oneOf(['in-progress', 'error']),
115
- currentProgress: PropTypes.number,
116
- };
117
-
118
- export default ProgressToast;
@@ -1,4 +0,0 @@
1
- import ToastComponent from './ToastComponent';
2
- import ToastProgress from './ToastProgress';
3
-
4
- export { ToastComponent, ToastProgress }
@@ -1,50 +0,0 @@
1
- // Buttons
2
- import Button from "./Button/Button";
3
-
4
- // Dropdowns
5
- import { DropdownComponent, DropdownMultiSelect, DropdownDatePicker, DropdownFilter, DropdownSimpleDatePicker } from './Dropdowns';
6
-
7
- // Inputs
8
- import { Checkbox, Input, Radio, Switch, Textarea, InputEmail } from './Inputs';
9
-
10
- // Labels
11
- import { Alert, Icon, LoginSource, PillComponent, Spinner, StatusIcon } from './Labels';
12
-
13
- // Toasts
14
- import {ToastComponent, ToastProgress} from './Toasts';
15
-
16
- // Navigation
17
- import {Navbar, Stepper, Tabnav, Sidebar} from './Navigation';
18
-
19
- export {
20
- // Buttons
21
- Button,
22
- // Dropdowns
23
- DropdownComponent,
24
- DropdownFilter,
25
- DropdownMultiSelect,
26
- DropdownSimpleDatePicker,
27
- DropdownDatePicker,
28
- // Inputs
29
- Checkbox,
30
- Input,
31
- Radio,
32
- Switch,
33
- Textarea,
34
- InputEmail,
35
- // Labels
36
- Alert,
37
- Icon,
38
- LoginSource,
39
- PillComponent,
40
- Spinner,
41
- StatusIcon,
42
- // Toasts
43
- ToastComponent,
44
- ToastProgress,
45
- // Navigation
46
- Navbar,
47
- Stepper,
48
- Tabnav,
49
- Sidebar
50
- }
@@ -1,4 +0,0 @@
1
- import useGetBaseDomain from './useGetBaseDomain';
2
- import useTextFormatter from './useTextFormatter';
3
-
4
- export { useTextFormatter, useGetBaseDomain };
@@ -1,9 +0,0 @@
1
- const useGetBaseDomain = () => {
2
- // get the base domain from window.location.hostname, e.g. groovinads.com or localhost
3
- let hostname = window.location.hostname;
4
- if (hostname.includes('.'))
5
- hostname = hostname.split('.').slice(-2).join('.');
6
- return hostname;
7
- };
8
-
9
- export default useGetBaseDomain;
@@ -1,48 +0,0 @@
1
- import React, { useCallback } from 'react';
2
-
3
- const useTextFormatter = () => {
4
- const toCamelCase = useCallback((str) => {
5
- let s = str?.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
6
- if (+match === 0) return ''; // or if (/\s+/.test(match)) for white spaces
7
- return index === 0 ? match?.toLowerCase() : match?.toUpperCase();
8
- });
9
-
10
- // Ensure the string doesn't start with a number
11
- s = s?.replace(/^\d+/, '');
12
-
13
- // Remove any remaining non-alphanumeric characters (excluding underscores)
14
- s = s?.replace(/[^a-zA-Z0-9_]/g, '');
15
-
16
- return s;
17
- }, []);
18
-
19
- const capitalice = (str) => (str ? `${str.charAt(0).toUpperCase()}${str.slice(1)}` : '');
20
-
21
- const highlightText = (text, query) => {
22
- if (!query) return text;
23
-
24
- const parts = text.split(new RegExp(`(${query})`, 'gi'));
25
-
26
- return (
27
- <span>
28
- {parts.map((part, index) => (
29
- <span
30
- className={[
31
- part.toLowerCase() === query.toLowerCase() &&
32
- 'highligthed-search',
33
- ]}
34
- key={index}
35
- >
36
- {part}
37
- </span>
38
- ))}
39
- </span>
40
- );
41
- };
42
-
43
- // Additional methods can be added here
44
-
45
- return { toCamelCase, highlightText, capitalice };
46
- };
47
-
48
- export default useTextFormatter;
package/src/index.js DELETED
@@ -1,51 +0,0 @@
1
- // Buttons
2
- import Button from "./components/Button/Button";
3
-
4
- // Dropdowns
5
- import {DropdownComponent, DropdownFilter, DropdownMultiSelect, DropdownDatePicker, DropdownSimpleDatePicker} from './components/Dropdowns';
6
-
7
- // Inputs
8
- import {Checkbox, Input, Radio, Switch, Textarea, InputEmail, InputChip} from './components/Inputs';
9
-
10
- // Labels
11
- import {Alert, Icon, LoginSource, PillComponent, Spinner, StatusIcon} from './components/Labels';
12
-
13
- // Toasts
14
- import {ToastComponent, ToastProgress} from './components/Toasts';
15
-
16
- // Navigation
17
- import {Navbar, Stepper, Tabnav, Sidebar} from './components/Navigation';
18
-
19
- export {
20
- // Buttons
21
- Button,
22
- // Dropdowns
23
- DropdownComponent,
24
- DropdownFilter,
25
- DropdownMultiSelect,
26
- DropdownSimpleDatePicker,
27
- DropdownDatePicker,
28
- // Inputs
29
- Checkbox,
30
- Input,
31
- Radio,
32
- Switch,
33
- Textarea,
34
- InputEmail,
35
- InputChip,
36
- // Labels
37
- Alert,
38
- Icon,
39
- LoginSource,
40
- PillComponent,
41
- Spinner,
42
- StatusIcon,
43
- // Toasts
44
- ToastComponent,
45
- ToastProgress,
46
- // Navigation
47
- Navbar,
48
- Stepper,
49
- Tabnav,
50
- Sidebar
51
- }
@@ -1,29 +0,0 @@
1
- import urlPath, { basePath } from './url.path';
2
- import { POST, GET, DELETE } from './helpers';
3
-
4
- // GETS
5
- export const getInfo = async (apiGetInfo) => await GET({ url: `${basePath}${apiGetInfo}`}); // (Sidebar and InputEmail)
6
-
7
- export const authStatus = async () => await GET({ url: urlPath.authStatus });
8
-
9
- export const applications = async () => await GET({ url: urlPath.applications });
10
-
11
- export const getClientsList = async () => await GET({ url: urlPath.clients });
12
-
13
- export const getCustomReportsList = async () => await GET(`${urlPath.customReports}/?sort=id_report.desc&offset=0&limit=100`);
14
-
15
- // POSTS
16
- export const postInfo = async (apiPostInfo, data) => await POST({ url: `${basePath}${apiPostInfo}`, data }); // update emails RETAIL MEDIA (notifications)
17
-
18
- export const authLogout = async () => await POST({ url: urlPath.authLogout });
19
-
20
- export const favApplication = async (appToFav) => await POST({url: `${urlPath.favApps}/${appToFav}`, data: appToFav})
21
-
22
- export const clientsLogin = async (clientId) => await POST({ url: urlPath.clientsLogin, data:{ id_client: clientId }});
23
-
24
- // DELETES
25
- export const unfavApplication = async (appToUnfav) => await DELETE({url: `${urlPath.favApps}/${appToUnfav}`});
26
-
27
- export const deleteEmails = async (apiDeleteEmail, email) => await DELETE({ url: `${basePath}${apiDeleteEmail}/${email}` }); // delete emails RETAIL MEDIA (notifications)
28
-
29
-
@@ -1,32 +0,0 @@
1
- import axios from 'axios';
2
- import urlPath from './url.path';
3
-
4
- axios.defaults.withCredentials = true;
5
-
6
- export const GET = async ({ url }) => {
7
- return await axios
8
- .get(url, urlPath.headers)
9
- .then(({ data }) => data)
10
- .catch((response) => Promise.reject(response || 'error en la url'));
11
- };
12
-
13
- export const POST = async ({ url, data }) => {
14
- return await axios
15
- .post(url, data, urlPath.headers)
16
- .then(({ data }) => data)
17
- .catch((response) => Promise.reject(response || 'error en la url'));
18
- };
19
-
20
- export const PUT = async ({ url, data }) => {
21
- return await axios
22
- .put(url, data, urlPath.headers)
23
- .then(({ data }) => data)
24
- .catch((response) => Promise.reject(response || 'error en la url'));
25
- };
26
-
27
- export const DELETE = async ({ url }) => {
28
- return await axios
29
- .delete(url, urlPath.headers)
30
- .then(({data}) => data)
31
- .catch((response) => Promise.reject(response || 'error en la url'));
32
- };
@@ -1,10 +0,0 @@
1
- // COMPONENTS SERVICES
2
- import * as ComponentsService from './components.services';
3
-
4
- // URL PATH
5
- import urlPath from './url.path';
6
-
7
- export {
8
- ComponentsService,
9
- urlPath,
10
- };
@@ -1,29 +0,0 @@
1
- import Cookies from 'js-cookie';
2
-
3
- const modeEnv = import.meta.env.MODE;
4
-
5
- export const basePath =
6
- modeEnv === 'production'
7
- ? 'https://api.groovinads.com/'
8
- : modeEnv === 'localdev'
9
- ? 'https://api-test.groovinads.com/'
10
- : 'https://api-dev.groovinads.com/';
11
-
12
- export default {
13
- authStatus: basePath + 'v2/auth/status',
14
- authLogout: basePath + 'v2/auth/logout',
15
-
16
- /* APPS FOR DROPDOWN */
17
- applications: basePath + 'v2/applications',
18
- favApps: basePath + 'v2/applications/favorite',
19
- clients: basePath + 'v2/auth/clients',
20
- clientsLogin: basePath + 'v2/auth/clients/login',
21
-
22
- headers: {
23
- headers: {
24
- 'Content-Type': 'application/json',
25
- Authorization: 'Bearer ' + Cookies.get('groovinadsAuthToken'),
26
- 'Accept-Language': 'en',
27
- },
28
- },
29
- };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import Alert from '../components/Labels/Alert';
3
-
4
- export default {
5
- title: 'Labels/Alert',
6
- component: Alert,
7
- };
8
-
9
- const Template = (args) => <Alert {...args}>This is an alert component</Alert>;
10
-
11
- export const Default = Template.bind({});
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import Button from '../components/Button/Button';
3
-
4
- export default {
5
- title: 'Buttons/Button',
6
- component: Button,
7
- };
8
-
9
- const Template = (args) => {
10
- return (
11
- <>
12
- <Button {...args} onClick={() => console.log('Button clicked')}
13
- >
14
- Disabled Button
15
- </Button>
16
- </>
17
- );
18
- };
19
-
20
- export const Default = Template.bind({});
@@ -1,17 +0,0 @@
1
- import React, { useState } from 'react';
2
- import Checkbox from '../components/Inputs/Checkbox';
3
-
4
- export default {
5
- title: 'Inputs/Checkbox',
6
- component: Checkbox,
7
- };
8
-
9
- const Template = (args) => {
10
- const [status, setStatus] = useState(false);
11
-
12
- return (
13
- <Checkbox {...args} status={status} setStatus={setStatus}>Checkbox</Checkbox>
14
- )
15
- };
16
-
17
- export const Default = Template.bind({});
@@ -1,89 +0,0 @@
1
- import React, { useState } from 'react';
2
- import DropdownComponent from '../components/Dropdowns/DropdownComponent';
3
- import { DropdownMenu, DropdownToggle, DropdownItem } from 'react-bootstrap';
4
-
5
- import { Button } from '../components/Button';
6
- import { Icon } from '../components/Labels';
7
-
8
- export default {
9
- title: 'Dropdown/DropdownComponent',
10
- component: DropdownComponent,
11
- };
12
-
13
- const Template = (args) => {
14
- const [show, setShow] = useState(false);
15
- const handleToggle = () => setShow((prevShow) => !prevShow);
16
-
17
- return (
18
- <div style={{ marginLeft: 150 }}>
19
- <button onClick={() => setShow(false)}>Close</button>
20
- <button onClick={() => setShow(true)}>Open</button>
21
- <div className='d-flex'>
22
- <DropdownComponent
23
- {...args}
24
- show={show}
25
- setShow={setShow}
26
- autoClose={'outside'}
27
- >
28
- <DropdownToggle onClick={() => handleToggle()}>Toggle</DropdownToggle>
29
- <DropdownMenu>
30
- <DropdownItem>
31
-
32
- <DropdownComponent
33
- {...args}
34
- autoClose={'outside'}
35
- drop={'end'}
36
- >
37
- <DropdownToggle as={'div'}>Toggle</DropdownToggle>
38
- <DropdownMenu>
39
- <DropdownItem>Item 1</DropdownItem>
40
- <DropdownItem>Item 2</DropdownItem>
41
- <DropdownItem>Item 3</DropdownItem>
42
- </DropdownMenu>
43
- </DropdownComponent>
44
-
45
- </DropdownItem>
46
- <DropdownItem>Item 2</DropdownItem>
47
- <DropdownItem>Item 3</DropdownItem>
48
- </DropdownMenu>
49
- </DropdownComponent>
50
-
51
- <DropdownComponent {...args} autoClose={'outside'}>
52
- <Button
53
- variant='outline'
54
- icon='plus'
55
- className='dropdown-toggle'
56
- // onClick={() => handleToggle()}
57
- >
58
- <span>Add filters</span>
59
- <Icon iconName='chevron-down' className='ms-2' />
60
- </Button>
61
-
62
- <DropdownMenu>
63
- {[{ name: '1' }, { name: '2' }].map((filter) => (
64
- <DropdownItem
65
- key={filter.name}
66
- onClick={() => console.log('click item')}
67
- // disabled={
68
- // // If already selected, show as disabled
69
- // selectedFilters[filter] ? true : false
70
- // }
71
- // onClick={() => {
72
- // setSelectedFilters((prevFilters) => ({
73
- // ...prevFilters,
74
- // [filter]: [],
75
- // }));
76
- // setShowAddFilterDropdown(false);
77
- // }}
78
- >
79
- {filter.name}
80
- </DropdownItem>
81
- ))}
82
- </DropdownMenu>
83
- </DropdownComponent>
84
- </div>
85
- </div>
86
- );
87
- };
88
-
89
- export const Default = Template.bind({});
@@ -1,69 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { DropdownDatePicker } from '../components/Dropdowns';
3
-
4
- export default {
5
- title: 'Dropdown/DropdownDatePicker',
6
- component: DropdownDatePicker,
7
- };
8
-
9
- const Template = (args) => {
10
- const [show, setShow] = useState(false);
11
-
12
- const [dateFrom, setDateFrom] = useState('');
13
- const [dateTo, setDateTo] = useState('');
14
-
15
- const [dateFrom2, setDateFrom2] = useState('');
16
- const [dateTo2, setDateTo2] = useState('');
17
-
18
- const handleToggle = () => setShow((prevShow) => !prevShow);
19
-
20
- useEffect(() => {
21
- console.log('dates From:', dateFrom);
22
- }, [dateFrom]);
23
-
24
- useEffect(() => {
25
- console.log('dates To:', dateTo);
26
- }, [dateTo]);
27
-
28
- return (
29
- <>
30
- <button onClick={() => setShow(!show)}>Toggle</button>
31
- <div>
32
- <DropdownDatePicker
33
- {...args}
34
- // show={show}
35
- // setShow={setShow}
36
- // onToggle={handleToggle}
37
- // variant='filter'
38
- dateFrom={dateFrom}
39
- setDateFrom={setDateFrom}
40
- dateTo={dateTo}
41
- setDateTo={setDateTo}
42
- // dateFrom2={dateFrom2}
43
- // setDateFrom2={setDateFrom2}
44
- // dateTo2={dateTo2}
45
- // setDateTo2={setDateTo2}
46
- />
47
- </div>
48
-
49
- <div>
50
- <p>min max</p>
51
- <DropdownDatePicker
52
- {...args}
53
- // show={show}
54
- // setShow={setShow}
55
- // onToggle={handleToggle}
56
- // variant='filter'
57
- dateFrom={dateFrom}
58
- setDateFrom={setDateFrom}
59
- dateTo={dateTo}
60
- setDateTo={setDateTo}
61
- minDate={new Date('2025-01-01')}
62
- maxDate={new Date('2025-01-31')}
63
- />
64
- </div>
65
- </>
66
- );
67
- };
68
-
69
- export const Default = Template.bind({});