@seeqdev/qomponents 0.0.124 → 0.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert/Alert.js +1 -1
- package/dist/Alert/Alert.js.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +3 -3
- package/dist/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.stories.js +94 -34
- package/dist/ButtonGroup/ButtonGroup.stories.js.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.test.js +3 -3
- package/dist/ButtonGroup/ButtonGroup.test.js.map +1 -1
- package/dist/Carousel/Carousel.js +62 -0
- package/dist/Carousel/Carousel.js.map +1 -0
- package/dist/Carousel/Carousel.stories.js +115 -0
- package/dist/Carousel/Carousel.stories.js.map +1 -0
- package/dist/Carousel/Carousel.test.js +48 -0
- package/dist/Carousel/Carousel.test.js.map +1 -0
- package/dist/Carousel/Carousel.types.js +2 -0
- package/dist/Carousel/Carousel.types.js.map +1 -0
- package/dist/Carousel/index.js +2 -0
- package/dist/Carousel/index.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -5
- package/package.json +1 -1
|
@@ -0,0 +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('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
19
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
20
|
+
renderChild('Second content for carousel', '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('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
26
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
27
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
28
|
+
], autoSlide: true, continous: 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('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
33
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
34
|
+
renderChild('Second content for carousel', '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, "Continous"),
|
|
38
|
+
React.createElement(Carousel, { carouselItems: [
|
|
39
|
+
renderChild('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
40
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
41
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
42
|
+
], activeIndex: value, onSlide: (index) => setValue(index), continous: true })),
|
|
43
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
44
|
+
React.createElement("p", null, "Non continous"),
|
|
45
|
+
React.createElement(Carousel, { carouselItems: [
|
|
46
|
+
renderChild('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
47
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
48
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
49
|
+
], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continous: false })),
|
|
50
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
51
|
+
React.createElement("p", null, "Without indicators"),
|
|
52
|
+
React.createElement(Carousel, { carouselItems: [
|
|
53
|
+
renderChild('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
54
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
55
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
56
|
+
], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continous: 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('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
62
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
63
|
+
renderChild('Second content for carousel', '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('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
69
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
70
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
71
|
+
], autoSlide: true, continous: 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('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
76
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
77
|
+
renderChild('Second content for carousel', '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, "Continous"),
|
|
81
|
+
React.createElement(Carousel, { carouselItems: [
|
|
82
|
+
renderChild('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
83
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
84
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
85
|
+
], activeIndex: value, onSlide: (index) => setValue(index), continous: true })),
|
|
86
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
87
|
+
React.createElement("p", null, "Non continous"),
|
|
88
|
+
React.createElement(Carousel, { carouselItems: [
|
|
89
|
+
renderChild('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
90
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
91
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
92
|
+
], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continous: false })),
|
|
93
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
94
|
+
React.createElement("p", null, "Without indicators"),
|
|
95
|
+
React.createElement(Carousel, { carouselItems: [
|
|
96
|
+
renderChild('This is a content to be shown when the collapse is visible.', 'tw-bg-yellow-500'),
|
|
97
|
+
renderChild('Second content for carousel', 'tw-bg-green-500'),
|
|
98
|
+
renderChild('Second content for carousel', 'tw-bg-gray-500'),
|
|
99
|
+
], activeIndex: value, onSlide: (index) => setValue(index), showArrows: true, continous: 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
|
+
//# sourceMappingURL=Carousel.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Carousel.stories.js","sourceRoot":"","sources":["../../src/Carousel/Carousel.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,eAAe;IACb,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,C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SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { act, render, fireEvent, screen } from '@testing-library/react';
|
|
4
|
+
import Carousel from './Carousel';
|
|
5
|
+
describe('Carousel Component', () => {
|
|
6
|
+
const mockOnSlide = jest.fn();
|
|
7
|
+
const carouselItems = [React.createElement("div", { key: "1" }, "Slide 1"), React.createElement("div", { key: "2" }, "Slide 2"), React.createElement("div", { key: "3" }, "Slide 3")];
|
|
8
|
+
it('renders correctly', () => {
|
|
9
|
+
render(React.createElement(Carousel, { testId: "carousel", carouselItems: carouselItems }));
|
|
10
|
+
expect(screen.getByTestId('carousel')).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it('shows the correct initial slide', () => {
|
|
13
|
+
render(React.createElement(Carousel, { testId: "carousel", carouselItems: carouselItems, activeIndex: 1 }));
|
|
14
|
+
expect(screen.getByText('Slide 2')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
it('calls onSlide when next button is clicked', () => {
|
|
17
|
+
render(React.createElement(Carousel, { testId: "carousel", carouselItems: carouselItems, onSlide: mockOnSlide }));
|
|
18
|
+
const nextButton = screen.getByTestId('carousel-next');
|
|
19
|
+
fireEvent.click(nextButton);
|
|
20
|
+
expect(mockOnSlide).toHaveBeenCalledWith(1, 'right');
|
|
21
|
+
});
|
|
22
|
+
it('calls onSlide when previous button is clicked', () => {
|
|
23
|
+
render(React.createElement(Carousel, { testId: "carousel", carouselItems: carouselItems, onSlide: mockOnSlide, activeIndex: 1 }));
|
|
24
|
+
const prevButton = screen.getByTestId('carousel-prev');
|
|
25
|
+
fireEvent.click(prevButton);
|
|
26
|
+
expect(mockOnSlide).toHaveBeenCalledWith(0, 'left');
|
|
27
|
+
});
|
|
28
|
+
it('does not move past the last slide', () => {
|
|
29
|
+
render(React.createElement(Carousel, { testId: "carousel", carouselItems: carouselItems, activeIndex: 2 }));
|
|
30
|
+
const nextButton = screen.queryByTestId('carousel-next');
|
|
31
|
+
expect(nextButton).toHaveClass('tw-invisible');
|
|
32
|
+
});
|
|
33
|
+
it('autoSlides correctly', async () => {
|
|
34
|
+
jest.useFakeTimers();
|
|
35
|
+
render(React.createElement(Carousel, { testId: "carousel", carouselItems: carouselItems, autoSlide: true, interval: 1000 }));
|
|
36
|
+
expect(screen.getByText('Slide 1')).toBeInTheDocument();
|
|
37
|
+
act(() => {
|
|
38
|
+
jest.advanceTimersByTime(1000);
|
|
39
|
+
});
|
|
40
|
+
expect(screen.getByText('Slide 2')).toBeInTheDocument();
|
|
41
|
+
act(() => {
|
|
42
|
+
jest.advanceTimersByTime(1000);
|
|
43
|
+
});
|
|
44
|
+
expect(screen.getByText('Slide 3')).toBeInTheDocument();
|
|
45
|
+
jest.useRealTimers();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=Carousel.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Carousel.test.js","sourceRoot":"","sources":["../../src/Carousel/Carousel.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC9B,MAAM,aAAa,GA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B,EAAE,CAAC;QAExD,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Carousel.types.js","sourceRoot":"","sources":["../../src/Carousel/Carousel.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Carousel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -15850,7 +15850,7 @@ const Alert = ({ children, dismissible = true, onClose, show = true, variant, te
|
|
|
15850
15850
|
}
|
|
15851
15851
|
return (React__default.createElement("div", { "data-testid": testId, id: id, className: appliedClasses },
|
|
15852
15852
|
children,
|
|
15853
|
-
dismissible && (React__default.createElement(Icon, { icon: "fc-delete", type: variant.match(/danger|warning/) ? 'color' : 'theme', color: variant.match(/danger|warning/) ? 'inherit' : undefined, extraClassNames: `tw-self-end tw-text-[11px] tw-cursor-pointer tw-absolute tw-right-[10px] tw-top-[10px] ${variant.match(/danger|warning|gray/) ? 'tw-text-sq-text-color dark:tw-text-sq-text
|
|
15853
|
+
dismissible && (React__default.createElement(Icon, { icon: "fc-delete", type: variant.match(/danger|warning/) ? 'color' : 'theme', color: variant.match(/danger|warning/) ? 'inherit' : undefined, extraClassNames: `tw-self-end tw-text-[11px] tw-cursor-pointer tw-absolute tw-right-[10px] tw-top-[10px] ${variant.match(/danger|warning|gray/) ? 'tw-text-sq-text-color dark:tw-text-sq-dark-text' : ''}`, testId: `${testId}-close-btn`, onClick: onClose, ...tooltipProps }))));
|
|
15854
15854
|
};
|
|
15855
15855
|
|
|
15856
15856
|
const SeeqActionDropdownItem = (item) => {
|