@seeqdev/qomponents 0.0.132 → 0.0.134

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 (156) hide show
  1. package/README.md +135 -135
  2. package/dist/Accordion/Accordion.js +8 -8
  3. package/dist/Accordion/Accordion.stories.js +114 -114
  4. package/dist/Accordion/Accordion.test.js +54 -54
  5. package/dist/Accordion/Accordion.types.js +1 -1
  6. package/dist/Accordion/index.js +1 -1
  7. package/dist/Alert/Alert.js +33 -33
  8. package/dist/Alert/Alert.stories.js +51 -51
  9. package/dist/Alert/Alert.test.js +50 -50
  10. package/dist/Alert/Alert.types.d.ts +1 -0
  11. package/dist/Alert/Alert.types.js +1 -1
  12. package/dist/Alert/index.js +1 -1
  13. package/dist/Button/Button.js +91 -91
  14. package/dist/Button/Button.stories.js +99 -99
  15. package/dist/Button/Button.test.js +48 -48
  16. package/dist/Button/Button.types.js +4 -4
  17. package/dist/Button/index.js +1 -1
  18. package/dist/ButtonGroup/ButtonGroup.js +32 -32
  19. package/dist/ButtonGroup/ButtonGroup.stories.js +384 -384
  20. package/dist/ButtonGroup/ButtonGroup.test.js +66 -66
  21. package/dist/ButtonGroup/ButtonGroup.types.d.ts +1 -0
  22. package/dist/ButtonGroup/ButtonGroup.types.js +1 -1
  23. package/dist/ButtonGroup/index.js +1 -1
  24. package/dist/ButtonWithDropdown/ButtonWithDropdown.js +59 -59
  25. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +142 -142
  26. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +92 -92
  27. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +1 -0
  28. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +1 -1
  29. package/dist/ButtonWithDropdown/index.js +1 -1
  30. package/dist/ButtonWithPopover/ButtonWithPopover.js +61 -61
  31. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +74 -74
  32. package/dist/ButtonWithPopover/ButtonWithPopover.test.js +81 -81
  33. package/dist/ButtonWithPopover/ButtonWithPopover.types.js +1 -1
  34. package/dist/ButtonWithPopover/index.js +1 -1
  35. package/dist/Carousel/Carousel.js +69 -66
  36. package/dist/Carousel/Carousel.js.map +1 -1
  37. package/dist/Carousel/Carousel.stories.js +114 -114
  38. package/dist/Carousel/Carousel.test.js +47 -47
  39. package/dist/Carousel/Carousel.types.d.ts +1 -0
  40. package/dist/Carousel/Carousel.types.js +1 -1
  41. package/dist/Carousel/index.js +1 -1
  42. package/dist/Checkbox/Checkbox.js +25 -25
  43. package/dist/Checkbox/Checkbox.stories.js +33 -33
  44. package/dist/Checkbox/Checkbox.test.js +93 -93
  45. package/dist/Checkbox/Checkbox.types.d.ts +1 -0
  46. package/dist/Checkbox/Checkbox.types.js +1 -1
  47. package/dist/Checkbox/index.js +1 -1
  48. package/dist/Collapse/Collapse.js +14 -17
  49. package/dist/Collapse/Collapse.js.map +1 -1
  50. package/dist/Collapse/Collapse.stories.js +36 -36
  51. package/dist/Collapse/Collapse.test.js +18 -18
  52. package/dist/Collapse/Collapse.types.d.ts +1 -0
  53. package/dist/Collapse/Collapse.types.js +1 -1
  54. package/dist/Collapse/index.js +1 -1
  55. package/dist/Icon/Icon.js +54 -54
  56. package/dist/Icon/Icon.stories.js +46 -46
  57. package/dist/Icon/Icon.test.js +54 -54
  58. package/dist/Icon/Icon.types.d.ts +1 -0
  59. package/dist/Icon/Icon.types.js +15 -15
  60. package/dist/Icon/index.js +1 -1
  61. package/dist/InputGroup/InputGroup.js +31 -31
  62. package/dist/InputGroup/InputGroup.stories.js +167 -167
  63. package/dist/InputGroup/InputGroup.test.js +42 -42
  64. package/dist/InputGroup/InputGroup.types.d.ts +1 -0
  65. package/dist/InputGroup/InputGroup.types.js +1 -1
  66. package/dist/InputGroup/index.js +1 -1
  67. package/dist/Modal/Modal.js +99 -99
  68. package/dist/Modal/Modal.js.map +1 -1
  69. package/dist/Modal/Modal.stories.js +126 -126
  70. package/dist/Modal/Modal.test.js +107 -107
  71. package/dist/Modal/Modal.types.js +1 -1
  72. package/dist/Modal/index.js +1 -1
  73. package/dist/ProgressBar/ProgressBar.js +49 -29
  74. package/dist/ProgressBar/ProgressBar.js.map +1 -1
  75. package/dist/ProgressBar/ProgressBar.stories.js +80 -72
  76. package/dist/ProgressBar/ProgressBar.stories.js.map +1 -1
  77. package/dist/ProgressBar/ProgressBar.test.js +43 -37
  78. package/dist/ProgressBar/ProgressBar.test.js.map +1 -1
  79. package/dist/ProgressBar/ProgressBar.types.d.ts +2 -0
  80. package/dist/ProgressBar/ProgressBar.types.js +1 -1
  81. package/dist/ProgressBar/index.js +1 -1
  82. package/dist/SeeqActionDropdown/SeeqActionDropdown.js +47 -47
  83. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +79 -79
  84. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +72 -72
  85. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.d.ts +1 -0
  86. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +1 -1
  87. package/dist/SeeqActionDropdown/index.js +1 -1
  88. package/dist/SeeqActionDropdown/variants.js +22 -22
  89. package/dist/Select/Select.js +173 -173
  90. package/dist/Select/Select.stories.js +79 -79
  91. package/dist/Select/Select.test.js +181 -181
  92. package/dist/Select/Select.types.js +1 -1
  93. package/dist/Select/index.js +2 -2
  94. package/dist/Slider/Slider.js +12 -12
  95. package/dist/Slider/Slider.stories.js +57 -57
  96. package/dist/Slider/Slider.test.js +32 -32
  97. package/dist/Slider/Slider.types.d.ts +1 -0
  98. package/dist/Slider/Slider.types.js +1 -1
  99. package/dist/Slider/index.js +1 -1
  100. package/dist/Tabs/Tabs.js +21 -21
  101. package/dist/Tabs/Tabs.stories.js +90 -90
  102. package/dist/Tabs/Tabs.test.js +90 -90
  103. package/dist/Tabs/Tabs.types.d.ts +1 -0
  104. package/dist/Tabs/Tabs.types.js +1 -1
  105. package/dist/Tabs/index.js +1 -1
  106. package/dist/TextArea/TextArea.js +24 -24
  107. package/dist/TextArea/TextArea.stories.js +45 -45
  108. package/dist/TextArea/TextArea.test.js +67 -67
  109. package/dist/TextArea/TextArea.types.d.ts +1 -0
  110. package/dist/TextArea/TextArea.types.js +1 -1
  111. package/dist/TextArea/index.js +1 -1
  112. package/dist/TextField/TextField.js +78 -78
  113. package/dist/TextField/TextField.stories.js +69 -69
  114. package/dist/TextField/TextField.test.js +38 -38
  115. package/dist/TextField/TextField.types.d.ts +1 -0
  116. package/dist/TextField/TextField.types.js +1 -1
  117. package/dist/TextField/index.js +1 -1
  118. package/dist/ToolbarButton/ToolbarButton.js +74 -74
  119. package/dist/ToolbarButton/ToolbarButton.stories.js +93 -93
  120. package/dist/ToolbarButton/ToolbarButton.test.js +92 -92
  121. package/dist/ToolbarButton/ToolbarButton.types.js +1 -1
  122. package/dist/ToolbarButton/index.js +1 -1
  123. package/dist/Tooltip/QTip.stories.js +44 -44
  124. package/dist/Tooltip/QTip.types.js +1 -1
  125. package/dist/Tooltip/QTipPerformance.stories.js +29 -29
  126. package/dist/Tooltip/Qtip.js +167 -167
  127. package/dist/Tooltip/Tooltip.js +35 -35
  128. package/dist/Tooltip/Tooltip.stories.js +31 -31
  129. package/dist/Tooltip/Tooltip.types.d.ts +1 -0
  130. package/dist/Tooltip/Tooltip.types.js +2 -2
  131. package/dist/Tooltip/TooltipPerformance.stories.js +29 -29
  132. package/dist/Tooltip/index.js +2 -2
  133. package/dist/Tooltip/qTip.utilities.js +10 -10
  134. package/dist/example/.eslintrc.cjs +14 -14
  135. package/dist/example/README.md +33 -33
  136. package/dist/example/index.html +13 -13
  137. package/dist/example/package.json +30 -30
  138. package/dist/example/src/ComplexSelectExample.tsx +81 -81
  139. package/dist/example/src/Example.tsx +408 -408
  140. package/dist/example/src/index.css +102 -102
  141. package/dist/example/src/main.tsx +10 -10
  142. package/dist/example/src/vite-env.d.ts +1 -1
  143. package/dist/example/tsconfig.json +33 -33
  144. package/dist/example/tsconfig.node.json +12 -12
  145. package/dist/example/vite.config.ts +12 -12
  146. package/dist/index.esm.js +15266 -7869
  147. package/dist/index.esm.js.map +1 -1
  148. package/dist/index.js +15230 -7833
  149. package/dist/index.js.map +1 -1
  150. package/dist/styles.css +3714 -3709
  151. package/dist/types.js +1 -1
  152. package/dist/utils/browserId.js +28 -28
  153. package/dist/utils/svg.js +19 -19
  154. package/dist/utils/validateStyleDimension.js +13 -13
  155. package/dist/utils/validateStyleDimension.test.js +19 -19
  156. package/package.json +89 -86
@@ -1,82 +1,82 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen, waitFor } from '@testing-library/react';
4
- import userEvent from '@testing-library/user-event';
5
- import ButtonWithPopover from './ButtonWithPopover';
6
- import Icon from '../Icon';
7
- describe('ButtonWithPopover', () => {
8
- const mockOnClick = jest.fn();
9
- const testId = 'trigger-icon';
10
- class Context {
11
- props = {
12
- trigger: (React.createElement(Icon, { icon: "fc-more", type: "text", testId: testId, extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })),
13
- onOpenChange: mockOnClick,
14
- containerTestId: 'basic-Popover1',
15
- tooltip: 'This is a small Popover.',
16
- tooltipDelay: 0,
17
- tooltipPlacement: 'top',
18
- isHtmlTooltip: false,
19
- hoverOpenDelay: 0,
20
- children: React.createElement("div", null, "Popover content"),
21
- };
22
- }
23
- let tc;
24
- beforeEach(() => {
25
- tc = new Context();
26
- jest.clearAllMocks();
27
- });
28
- afterEach(() => {
29
- global.ResizeObserver = undefined;
30
- });
31
- const renderButtonWithPopover = (props) => render(React.createElement("div", { "data-testid": "container", className: "tw-w-10 tw-h-10" },
32
- React.createElement(ButtonWithPopover, { ...props })));
33
- const openPopover = async () => {
34
- const popover = screen.getByTestId(testId);
35
- await userEvent.click(popover);
36
- };
37
- const closePopover = async () => {
38
- const container = screen.getByTestId('container');
39
- await userEvent.click(container);
40
- };
41
- test('renders trigger and opens Popover content on trigger click', async () => {
42
- renderButtonWithPopover(tc.props);
43
- expect(screen.getByTestId('trigger-icon')).toBeInTheDocument();
44
- await openPopover();
45
- expect(screen.getByText('Popover content')).toBeInTheDocument();
46
- await closePopover();
47
- expect(screen.queryByText('Popover content')).not.toBeInTheDocument();
48
- });
49
- test('renders trigger and opens Popover content on trigger hover', async () => {
50
- tc.props.isHoverEnabled = true;
51
- renderButtonWithPopover(tc.props);
52
- expect(screen.getByTestId('trigger-icon')).toBeInTheDocument();
53
- const popover = screen.getByTestId(testId);
54
- await userEvent.hover(popover);
55
- await waitFor(() => {
56
- expect(screen.getByText('Popover content')).toBeInTheDocument();
57
- });
58
- });
59
- test('closes popover when content is clicked and is set in props', async () => {
60
- tc.props.isCloseOnContentClick = true;
61
- renderButtonWithPopover(tc.props);
62
- await openPopover();
63
- const item1 = screen.getByText('Popover content');
64
- await userEvent.click(item1);
65
- expect(mockOnClick).toHaveBeenCalledTimes(2);
66
- });
67
- test('leaves popover open when content is clicked and is set in props', async () => {
68
- tc.props.isCloseOnContentClick = false;
69
- renderButtonWithPopover(tc.props);
70
- await openPopover();
71
- const item1 = screen.getByText('Popover content');
72
- await userEvent.click(item1);
73
- expect(mockOnClick).toHaveBeenCalledTimes(1);
74
- });
75
- test('does not open when disabled', async () => {
76
- tc.props.disabled = true;
77
- renderButtonWithPopover(tc.props);
78
- await openPopover();
79
- expect(screen.queryByText('Popover content')).not.toBeInTheDocument();
80
- });
81
- });
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen, waitFor } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
5
+ import ButtonWithPopover from './ButtonWithPopover';
6
+ import Icon from '../Icon';
7
+ describe('ButtonWithPopover', () => {
8
+ const mockOnClick = jest.fn();
9
+ const testId = 'trigger-icon';
10
+ class Context {
11
+ props = {
12
+ trigger: (React.createElement(Icon, { icon: "fc-more", type: "text", testId: testId, extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })),
13
+ onOpenChange: mockOnClick,
14
+ containerTestId: 'basic-Popover1',
15
+ tooltip: 'This is a small Popover.',
16
+ tooltipDelay: 0,
17
+ tooltipPlacement: 'top',
18
+ isHtmlTooltip: false,
19
+ hoverOpenDelay: 0,
20
+ children: React.createElement("div", null, "Popover content"),
21
+ };
22
+ }
23
+ let tc;
24
+ beforeEach(() => {
25
+ tc = new Context();
26
+ jest.clearAllMocks();
27
+ });
28
+ afterEach(() => {
29
+ global.ResizeObserver = undefined;
30
+ });
31
+ const renderButtonWithPopover = (props) => render(React.createElement("div", { "data-testid": "container", className: "tw-w-10 tw-h-10" },
32
+ React.createElement(ButtonWithPopover, { ...props })));
33
+ const openPopover = async () => {
34
+ const popover = screen.getByTestId(testId);
35
+ await userEvent.click(popover);
36
+ };
37
+ const closePopover = async () => {
38
+ const container = screen.getByTestId('container');
39
+ await userEvent.click(container);
40
+ };
41
+ test('renders trigger and opens Popover content on trigger click', async () => {
42
+ renderButtonWithPopover(tc.props);
43
+ expect(screen.getByTestId('trigger-icon')).toBeInTheDocument();
44
+ await openPopover();
45
+ expect(screen.getByText('Popover content')).toBeInTheDocument();
46
+ await closePopover();
47
+ expect(screen.queryByText('Popover content')).not.toBeInTheDocument();
48
+ });
49
+ test('renders trigger and opens Popover content on trigger hover', async () => {
50
+ tc.props.isHoverEnabled = true;
51
+ renderButtonWithPopover(tc.props);
52
+ expect(screen.getByTestId('trigger-icon')).toBeInTheDocument();
53
+ const popover = screen.getByTestId(testId);
54
+ await userEvent.hover(popover);
55
+ await waitFor(() => {
56
+ expect(screen.getByText('Popover content')).toBeInTheDocument();
57
+ });
58
+ });
59
+ test('closes popover when content is clicked and is set in props', async () => {
60
+ tc.props.isCloseOnContentClick = true;
61
+ renderButtonWithPopover(tc.props);
62
+ await openPopover();
63
+ const item1 = screen.getByText('Popover content');
64
+ await userEvent.click(item1);
65
+ expect(mockOnClick).toHaveBeenCalledTimes(2);
66
+ });
67
+ test('leaves popover open when content is clicked and is set in props', async () => {
68
+ tc.props.isCloseOnContentClick = false;
69
+ renderButtonWithPopover(tc.props);
70
+ await openPopover();
71
+ const item1 = screen.getByText('Popover content');
72
+ await userEvent.click(item1);
73
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
74
+ });
75
+ test('does not open when disabled', async () => {
76
+ tc.props.disabled = true;
77
+ renderButtonWithPopover(tc.props);
78
+ await openPopover();
79
+ expect(screen.queryByText('Popover content')).not.toBeInTheDocument();
80
+ });
81
+ });
82
82
  //# sourceMappingURL=ButtonWithPopover.test.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=ButtonWithPopover.types.js.map
@@ -1,2 +1,2 @@
1
- export { default } from './ButtonWithPopover';
1
+ export { default } from './ButtonWithPopover';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,67 +1,70 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { animated, useTransition } from '@react-spring/web';
3
- import Button from '../Button/Button';
4
- /**
5
- * Carousel:
6
- * - Easily create a carousel with custom slides.
7
- * - Supports automatic sliding, navigation arrows, and slide indicators.
8
- */
9
- const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '', onSlide = () => { }, autoSlide, showIndicators = true, continuous = true, interval = 4000, prevIcon = 'fc-arrow-dropdown tw-rotate-90', nextIcon = 'fc-arrow-dropdown -tw-rotate-90', showArrows = true, iconExtraClassNames = '', carouselItems = [], }) => {
10
- const [currentIndex, setCurrentIndex] = useState(activeIndex);
11
- const changeSlide = (nextIndex) => {
12
- const newIndex = nextIndex % carouselItems.length;
13
- setCurrentIndex(newIndex);
14
- onSlide(newIndex, newIndex > currentIndex ? 'right' : 'left');
15
- };
16
- useEffect(() => {
17
- if (autoSlide) {
18
- const currentInterval = setInterval(() => {
19
- if (continuous) {
20
- setCurrentIndex((prevCurrentIndex) => {
21
- onSlide((prevCurrentIndex + 1) % carouselItems.length, (prevCurrentIndex + 1) % carouselItems.length > prevCurrentIndex ? 'right' : 'left');
22
- return (prevCurrentIndex + 1) % carouselItems.length;
23
- });
24
- }
25
- else if (currentIndex === carouselItems.length - 1) {
26
- clearInterval(currentInterval);
27
- }
28
- else {
29
- changeSlide(currentIndex + 1);
30
- }
31
- }, interval);
32
- return () => clearInterval(currentInterval);
33
- }
34
- }, [autoSlide]);
35
- useEffect(() => {
36
- if (activeIndex && activeIndex !== currentIndex) {
37
- setCurrentIndex(activeIndex);
38
- }
39
- }, [activeIndex]);
40
- const transitions = useTransition([currentIndex], {
41
- keys: null,
42
- exitBeforeEnter: true,
43
- from: { transform: 'translate3d(100%,0,0)' },
44
- enter: { transform: 'translate3d(0%,0,0)' },
45
- leave: { transform: 'translate3d(0%,0,0)' },
46
- });
47
- const onBackClick = () => {
48
- if (currentIndex === 0 && !continuous) {
49
- return;
50
- }
51
- changeSlide((currentIndex - 1) % carouselItems.length);
52
- };
53
- const onForwardClick = () => {
54
- if (currentIndex === carouselItems.length - 1 && !continuous) {
55
- return;
56
- }
57
- changeSlide((currentIndex + 1) % carouselItems.length);
58
- };
59
- return (React.createElement("div", { "data-testid": testId, className: `tw-flex tw-flex-col tw-items-center tw-justify-center tw-w-full tw-overflow-hidden ${extraClassNames}` },
60
- React.createElement("div", { className: "tw-flex tw-items-center tw-w-full tw-h-max tw-gap-1" },
61
- showArrows && (React.createElement(Button, { icon: prevIcon, size: "lg", variant: "no-border", testId: "carousel-prev", extraClassNames: `${currentIndex === 0 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onBackClick })),
62
- transitions((style, i) => (React.createElement(animated.div, { "data-testid": `${testId}-${currentIndex}`, style: style, className: "tw-w-full" }, carouselItems[currentIndex]))),
63
- showArrows && (React.createElement(Button, { icon: nextIcon, testId: "carousel-next", size: "lg", variant: "no-border", extraClassNames: `${currentIndex === carouselItems.length - 1 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onForwardClick }))),
64
- showIndicators && (React.createElement("div", { className: "tw-flex tw-gap-1 tw-mt-2" }, carouselItems.map((_, i) => (React.createElement("div", { key: i, className: `tw-w-2 tw-h-2 tw-rounded-full tw-cursor-pointer ${i === currentIndex ? 'tw-bg-sq-color-dark' : 'tw-bg-sq-darkish-gray'}`, onClick: () => changeSlide(i) })))))));
65
- };
66
- export default Carousel;
1
+ import React, { useEffect, useState } from 'react';
2
+ import { motion } from 'framer-motion';
3
+ import Button from '../Button/Button';
4
+ /**
5
+ * Carousel:
6
+ * - Easily create a carousel with custom slides.
7
+ * - Supports automatic sliding, navigation arrows, and slide indicators.
8
+ */
9
+ const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '', onSlide = () => { }, autoSlide, showIndicators = true, continuous = true, interval = 4000, prevIcon = 'fc-arrow-dropdown tw-rotate-90', nextIcon = 'fc-arrow-dropdown -tw-rotate-90', showArrows = true, iconExtraClassNames = '', carouselItems = [], }) => {
10
+ const [currentIndex, setCurrentIndex] = useState(activeIndex);
11
+ const changeSlide = (nextIndex) => {
12
+ const newIndex = (nextIndex + carouselItems.length) % carouselItems.length;
13
+ setCurrentIndex(newIndex);
14
+ onSlide(newIndex, newIndex > currentIndex ? 'right' : 'left');
15
+ };
16
+ useEffect(() => {
17
+ if (autoSlide) {
18
+ const slideInterval = setInterval(() => {
19
+ if (continuous || currentIndex < carouselItems.length - 1) {
20
+ changeSlide(currentIndex + 1);
21
+ }
22
+ else {
23
+ clearInterval(slideInterval);
24
+ }
25
+ }, interval);
26
+ return () => clearInterval(slideInterval);
27
+ }
28
+ }, [autoSlide, currentIndex, continuous, interval, carouselItems.length]);
29
+ useEffect(() => {
30
+ if (activeIndex !== currentIndex) {
31
+ setCurrentIndex(activeIndex);
32
+ }
33
+ }, [activeIndex]);
34
+ const onBackClick = () => {
35
+ if (currentIndex === 0 && !continuous) {
36
+ return;
37
+ }
38
+ changeSlide(currentIndex - 1);
39
+ };
40
+ const onForwardClick = () => {
41
+ if (currentIndex === carouselItems.length - 1 && !continuous) {
42
+ return;
43
+ }
44
+ changeSlide(currentIndex + 1);
45
+ };
46
+ const slideVariants = {
47
+ initial: (direction) => ({
48
+ x: direction > 0 ? '100%' : '-100%',
49
+ opacity: 0,
50
+ }),
51
+ animate: {
52
+ x: 0,
53
+ opacity: 1,
54
+ transition: { type: 'spring', damping: 20, stiffness: 100 },
55
+ },
56
+ exit: (direction) => ({
57
+ x: direction > 0 ? '-100%' : '100%',
58
+ opacity: 0,
59
+ transition: { type: 'spring', damping: 20, stiffness: 100 },
60
+ }),
61
+ };
62
+ return (React.createElement("div", { "data-testid": testId, className: `tw-flex tw-flex-col tw-items-center tw-justify-center tw-w-full tw-overflow-hidden ${extraClassNames}` },
63
+ React.createElement("div", { className: "tw-flex tw-items-center tw-w-full tw-h-max tw-gap-1" },
64
+ showArrows && (React.createElement(Button, { icon: prevIcon, size: "lg", variant: "no-border", testId: "carousel-prev", extraClassNames: `${currentIndex === 0 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onBackClick })),
65
+ React.createElement(motion.div, { key: currentIndex, custom: 1, initial: "initial", animate: "animate", exit: "exit", variants: slideVariants, className: "tw-w-full" }, carouselItems[currentIndex]),
66
+ showArrows && (React.createElement(Button, { icon: nextIcon, testId: "carousel-next", size: "lg", variant: "no-border", extraClassNames: `${currentIndex === carouselItems.length - 1 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onForwardClick }))),
67
+ showIndicators && (React.createElement("div", { className: "tw-flex tw-gap-1 tw-mt-2" }, carouselItems.map((_, i) => (React.createElement("div", { key: i, className: `tw-w-2 tw-h-2 tw-rounded-full tw-cursor-pointer ${i === currentIndex ? 'tw-bg-sq-color-dark' : 'tw-bg-sq-darkish-gray'}`, onClick: () => changeSlide(i) })))))));
68
+ };
69
+ export default Carousel;
67
70
  //# sourceMappingURL=Carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.js","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAA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B,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,WAAW,EACnB,eAAe,EAAE,GACf,YAAY,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAC9E,IAAI,mBAAmB,oBAAoB,EAC3C,OAAO,EAAE,cAAc,GACvB,CACH,CACG;QACL,cAAc,IAAI,CACjB,6BAAK,SAAS,EAAC,0BAA0B,IACtC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAC3B,6BACE,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,mDACT,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,uBAC/C,EAAE,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,GAC7B,CACH,CAAC,CACE,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,115 +1,115 @@
1
- import React from 'react';
2
- import { QTip } from '../Tooltip/Qtip';
3
- import Carousel from './Carousel';
4
- import Button from '../Button';
5
- export default {
6
- title: 'Carousel',
7
- };
8
- export const AllCarousels = () => {
9
- const [value, setValue] = React.useState(0);
10
- const renderChild = (text, extraClass) => (React.createElement("div", { className: 'tw-p-4 tw-text-sq-color-gray dark:tw-text-sq-white tw-h-[200px] ' + extraClass },
11
- React.createElement("p", { className: "tw-mb-5 tw-text-[15px] tw-leading-normal" }, text),
12
- React.createElement(Button, { variant: "outline", label: "Save data" })));
13
- const renderAllVariations = () => (React.createElement(React.Fragment, null,
14
- React.createElement("div", { className: "light" },
15
- React.createElement("div", { className: "tw-p-4" },
16
- React.createElement("p", null, "Controlled"),
17
- React.createElement(Carousel, { carouselItems: [
18
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
19
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
20
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
21
- ], activeIndex: value, onSlide: (index) => setValue(index) })),
22
- React.createElement("div", { className: "tw-p-4" },
23
- React.createElement("p", null, "Uncontrolled"),
24
- React.createElement(Carousel, { carouselItems: [
25
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
26
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
27
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
28
- ], autoSlide: true, continuous: true, showArrows: false })),
29
- React.createElement("div", { className: "tw-p-4" },
30
- React.createElement("p", null, "Custom side buttons"),
31
- React.createElement(Carousel, { carouselItems: [
32
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
33
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
34
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
35
- ], activeIndex: value, onSlide: (index) => setValue(index), nextIcon: "fc-more", prevIcon: "fc-y-axis" })),
36
- React.createElement("div", { className: "tw-p-4" },
37
- React.createElement("p", null, "Continuous"),
38
- React.createElement(Carousel, { carouselItems: [
39
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
40
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
41
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
42
- ], activeIndex: value, onSlide: (index) => setValue(index), continuous: true })),
43
- React.createElement("div", { className: "tw-p-4" },
44
- React.createElement("p", null, "Non continuous"),
45
- React.createElement(Carousel, { carouselItems: [
46
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
47
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
48
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
49
- ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: false })),
50
- React.createElement("div", { className: "tw-p-4" },
51
- React.createElement("p", null, "Without indicators"),
52
- React.createElement(Carousel, { carouselItems: [
53
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
54
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
55
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
56
- ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: true, showIndicators: false }))),
57
- React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
58
- React.createElement("div", { className: "tw-p-4" },
59
- React.createElement("p", null, "Controlled"),
60
- React.createElement(Carousel, { carouselItems: [
61
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
62
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
63
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
64
- ], activeIndex: value, onSlide: (index) => setValue(index) })),
65
- React.createElement("div", { className: "tw-p-4" },
66
- React.createElement("p", null, "Uncontrolled"),
67
- React.createElement(Carousel, { carouselItems: [
68
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
69
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
70
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
71
- ], autoSlide: true, continuous: true, showArrows: false })),
72
- React.createElement("div", { className: "tw-p-4" },
73
- React.createElement("p", null, "Custom side buttons"),
74
- React.createElement(Carousel, { carouselItems: [
75
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
76
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
77
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
78
- ], activeIndex: value, onSlide: (index) => setValue(index), nextIcon: "fc-more", prevIcon: "fc-y-axis" })),
79
- React.createElement("div", { className: "tw-p-4" },
80
- React.createElement("p", null, "Continuous"),
81
- React.createElement(Carousel, { carouselItems: [
82
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
83
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
84
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
85
- ], activeIndex: value, onSlide: (index) => setValue(index), continuous: true })),
86
- React.createElement("div", { className: "tw-p-4" },
87
- React.createElement("p", null, "Non continuous"),
88
- React.createElement(Carousel, { carouselItems: [
89
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
90
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
91
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
92
- ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: false })),
93
- React.createElement("div", { className: "tw-p-4" },
94
- React.createElement("p", null, "Without indicators"),
95
- React.createElement(Carousel, { carouselItems: [
96
- renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
97
- renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
98
- renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
99
- ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: true, showIndicators: false })))));
100
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
101
- React.createElement(QTip, null),
102
- React.createElement("div", { className: "color_topic" },
103
- React.createElement("b", null, "Topic Colors"),
104
- renderAllVariations()),
105
- React.createElement("div", { className: "color_analysis" },
106
- React.createElement("b", null, "Analysis Colors"),
107
- renderAllVariations()),
108
- React.createElement("div", { className: "color_datalab" },
109
- React.createElement("b", null, "Datalab Colors"),
110
- renderAllVariations()),
111
- React.createElement("div", { className: "color_vantage" },
112
- React.createElement("b", null, "Vantage Colors"),
113
- renderAllVariations())));
114
- };
1
+ import React from 'react';
2
+ import { QTip } from '../Tooltip/Qtip';
3
+ import Carousel from './Carousel';
4
+ import Button from '../Button';
5
+ export default {
6
+ title: 'Carousel',
7
+ };
8
+ export const AllCarousels = () => {
9
+ const [value, setValue] = React.useState(0);
10
+ const renderChild = (text, extraClass) => (React.createElement("div", { className: 'tw-p-4 tw-text-sq-color-gray dark:tw-text-sq-white tw-h-[200px] ' + extraClass },
11
+ React.createElement("p", { className: "tw-mb-5 tw-text-[15px] tw-leading-normal" }, text),
12
+ React.createElement(Button, { variant: "outline", label: "Save data" })));
13
+ const renderAllVariations = () => (React.createElement(React.Fragment, null,
14
+ React.createElement("div", { className: "light" },
15
+ React.createElement("div", { className: "tw-p-4" },
16
+ React.createElement("p", null, "Controlled"),
17
+ React.createElement(Carousel, { carouselItems: [
18
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
19
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
20
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
21
+ ], activeIndex: value, onSlide: (index) => setValue(index) })),
22
+ React.createElement("div", { className: "tw-p-4" },
23
+ React.createElement("p", null, "Uncontrolled"),
24
+ React.createElement(Carousel, { carouselItems: [
25
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
26
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
27
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
28
+ ], autoSlide: true, continuous: true, showArrows: false })),
29
+ React.createElement("div", { className: "tw-p-4" },
30
+ React.createElement("p", null, "Custom side buttons"),
31
+ React.createElement(Carousel, { carouselItems: [
32
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
33
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
34
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
35
+ ], activeIndex: value, onSlide: (index) => setValue(index), nextIcon: "fc-more", prevIcon: "fc-y-axis" })),
36
+ React.createElement("div", { className: "tw-p-4" },
37
+ React.createElement("p", null, "Continuous"),
38
+ React.createElement(Carousel, { carouselItems: [
39
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
40
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
41
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
42
+ ], activeIndex: value, onSlide: (index) => setValue(index), continuous: true })),
43
+ React.createElement("div", { className: "tw-p-4" },
44
+ React.createElement("p", null, "Non continuous"),
45
+ React.createElement(Carousel, { carouselItems: [
46
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
47
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
48
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
49
+ ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: false })),
50
+ React.createElement("div", { className: "tw-p-4" },
51
+ React.createElement("p", null, "Without indicators"),
52
+ React.createElement(Carousel, { carouselItems: [
53
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
54
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
55
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
56
+ ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: true, showIndicators: false }))),
57
+ React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
58
+ React.createElement("div", { className: "tw-p-4" },
59
+ React.createElement("p", null, "Controlled"),
60
+ React.createElement(Carousel, { carouselItems: [
61
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
62
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
63
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
64
+ ], activeIndex: value, onSlide: (index) => setValue(index) })),
65
+ React.createElement("div", { className: "tw-p-4" },
66
+ React.createElement("p", null, "Uncontrolled"),
67
+ React.createElement(Carousel, { carouselItems: [
68
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
69
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
70
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
71
+ ], autoSlide: true, continuous: true, showArrows: false })),
72
+ React.createElement("div", { className: "tw-p-4" },
73
+ React.createElement("p", null, "Custom side buttons"),
74
+ React.createElement(Carousel, { carouselItems: [
75
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
76
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
77
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
78
+ ], activeIndex: value, onSlide: (index) => setValue(index), nextIcon: "fc-more", prevIcon: "fc-y-axis" })),
79
+ React.createElement("div", { className: "tw-p-4" },
80
+ React.createElement("p", null, "Continuous"),
81
+ React.createElement(Carousel, { carouselItems: [
82
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
83
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
84
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
85
+ ], activeIndex: value, onSlide: (index) => setValue(index), continuous: true })),
86
+ React.createElement("div", { className: "tw-p-4" },
87
+ React.createElement("p", null, "Non continuous"),
88
+ React.createElement(Carousel, { carouselItems: [
89
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
90
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
91
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
92
+ ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: false })),
93
+ React.createElement("div", { className: "tw-p-4" },
94
+ React.createElement("p", null, "Without indicators"),
95
+ React.createElement(Carousel, { carouselItems: [
96
+ renderChild('First of her name, the Queen to be, long may she reign', 'tw-bg-yellow-500'),
97
+ renderChild('Second of her home, but her love conquers all', 'tw-bg-green-500'),
98
+ renderChild('Third is a wonder, the embodiment of hope and faith', 'tw-bg-gray-500'),
99
+ ], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continuous: true, showIndicators: false })))));
100
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
101
+ React.createElement(QTip, null),
102
+ React.createElement("div", { className: "color_topic" },
103
+ React.createElement("b", null, "Topic Colors"),
104
+ renderAllVariations()),
105
+ React.createElement("div", { className: "color_analysis" },
106
+ React.createElement("b", null, "Analysis Colors"),
107
+ renderAllVariations()),
108
+ React.createElement("div", { className: "color_datalab" },
109
+ React.createElement("b", null, "Datalab Colors"),
110
+ renderAllVariations()),
111
+ React.createElement("div", { className: "color_vantage" },
112
+ React.createElement("b", null, "Vantage Colors"),
113
+ renderAllVariations())));
114
+ };
115
115
  //# sourceMappingURL=Carousel.stories.js.map