@seeqdev/qomponents 0.0.155-react-19-v10 → 0.0.156
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/README.md +135 -135
- package/dist/Accordion/Accordion.stories.d.ts +1 -2
- package/dist/Alert/Alert.stories.d.ts +1 -2
- package/dist/Alert/Alert.types.d.ts +0 -1
- package/dist/Button/Button.stories.d.ts +4 -5
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/ButtonGroup/ButtonGroup.stories.d.ts +1 -2
- package/dist/ButtonGroup/ButtonGroup.types.d.ts +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +1 -2
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.d.ts +1 -2
- package/dist/Carousel/Carousel.stories.d.ts +1 -2
- package/dist/Carousel/Carousel.types.d.ts +0 -1
- package/dist/Checkbox/Checkbox.stories.d.ts +1 -2
- package/dist/Checkbox/Checkbox.types.d.ts +0 -1
- package/dist/Collapse/Collapse.stories.d.ts +1 -2
- package/dist/Collapse/Collapse.types.d.ts +0 -1
- package/dist/Icon/Icon.stories.d.ts +1 -2
- package/dist/Icon/Icon.types.d.ts +0 -1
- package/dist/InputGroup/InputGroup.stories.d.ts +1 -2
- package/dist/InputGroup/InputGroup.types.d.ts +0 -1
- package/dist/ProgressBar/ProgressBar.stories.d.ts +3 -2
- package/dist/ProgressBar/ProgressBar.types.d.ts +10 -0
- package/dist/ProgressBar/index.d.ts +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +1 -2
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.d.ts +0 -1
- package/dist/Select/Select.stories.d.ts +1 -2
- package/dist/Slider/Slider.stories.d.ts +1 -2
- package/dist/Slider/Slider.types.d.ts +0 -1
- package/dist/SvgIcon/SvgIcon.stories.d.ts +1 -2
- package/dist/SvgIcon/SvgIcon.types.d.ts +0 -1
- package/dist/Tabs/Tabs.stories.d.ts +1 -2
- package/dist/Tabs/Tabs.types.d.ts +1 -2
- package/dist/TextArea/TextArea.stories.d.ts +1 -2
- package/dist/TextArea/TextArea.types.d.ts +0 -1
- package/dist/TextField/TextField.stories.d.ts +1 -2
- package/dist/TextField/TextField.types.d.ts +0 -1
- package/dist/ToolbarButton/ToolbarButton.stories.d.ts +1 -2
- package/dist/Tooltip/QTip.stories.d.ts +1 -2
- package/dist/Tooltip/QTipPerformance.stories.d.ts +1 -2
- package/dist/Tooltip/Tooltip.stories.d.ts +1 -2
- package/dist/Tooltip/Tooltip.types.d.ts +2 -3
- package/dist/Tooltip/TooltipPerformance.stories.d.ts +1 -2
- package/dist/example/.eslintrc.cjs +14 -14
- package/dist/example/README.md +33 -33
- package/dist/example/index.html +13 -13
- package/dist/example/package.json +30 -30
- package/dist/example/src/ComplexSelectExample.tsx +81 -81
- package/dist/example/src/Example.tsx +408 -408
- package/dist/example/src/index.css +102 -102
- package/dist/example/src/main.tsx +10 -10
- package/dist/example/src/vite-env.d.ts +1 -1
- package/dist/example/tsconfig.json +33 -33
- package/dist/example/tsconfig.node.json +12 -12
- package/dist/example/vite.config.ts +12 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +7896 -14347
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7889 -14340
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4006 -3819
- package/package.json +88 -91
- package/dist/Accordion/Accordion.js +0 -9
- package/dist/Accordion/Accordion.js.map +0 -1
- package/dist/Accordion/Accordion.stories.js +0 -115
- package/dist/Accordion/Accordion.stories.js.map +0 -1
- package/dist/Accordion/Accordion.test.js +0 -55
- package/dist/Accordion/Accordion.test.js.map +0 -1
- package/dist/Accordion/Accordion.types.js +0 -2
- package/dist/Accordion/Accordion.types.js.map +0 -1
- package/dist/Accordion/index.js +0 -2
- package/dist/Accordion/index.js.map +0 -1
- package/dist/Alert/Alert.js +0 -34
- package/dist/Alert/Alert.js.map +0 -1
- package/dist/Alert/Alert.stories.js +0 -52
- package/dist/Alert/Alert.stories.js.map +0 -1
- package/dist/Alert/Alert.test.js +0 -51
- package/dist/Alert/Alert.test.js.map +0 -1
- package/dist/Alert/Alert.types.js +0 -2
- package/dist/Alert/Alert.types.js.map +0 -1
- package/dist/Alert/index.js +0 -2
- package/dist/Alert/index.js.map +0 -1
- package/dist/Button/Button.js +0 -92
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.js +0 -100
- package/dist/Button/Button.stories.js.map +0 -1
- package/dist/Button/Button.test.js +0 -49
- package/dist/Button/Button.test.js.map +0 -1
- package/dist/Button/Button.types.js +0 -5
- package/dist/Button/Button.types.js.map +0 -1
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.js +0 -35
- package/dist/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.stories.js +0 -385
- package/dist/ButtonGroup/ButtonGroup.stories.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.test.js +0 -67
- package/dist/ButtonGroup/ButtonGroup.test.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.types.js +0 -2
- package/dist/ButtonGroup/ButtonGroup.types.js.map +0 -1
- package/dist/ButtonGroup/index.js +0 -2
- package/dist/ButtonGroup/index.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +0 -60
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +0 -143
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +0 -93
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +0 -2
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +0 -1
- package/dist/ButtonWithDropdown/index.js +0 -2
- package/dist/ButtonWithDropdown/index.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.js +0 -62
- package/dist/ButtonWithPopover/ButtonWithPopover.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +0 -75
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +0 -82
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +0 -2
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +0 -1
- package/dist/ButtonWithPopover/index.js +0 -2
- package/dist/ButtonWithPopover/index.js.map +0 -1
- package/dist/Carousel/Carousel.js +0 -70
- package/dist/Carousel/Carousel.js.map +0 -1
- package/dist/Carousel/Carousel.stories.js +0 -115
- package/dist/Carousel/Carousel.stories.js.map +0 -1
- package/dist/Carousel/Carousel.test.js +0 -48
- package/dist/Carousel/Carousel.test.js.map +0 -1
- package/dist/Carousel/Carousel.types.js +0 -2
- package/dist/Carousel/Carousel.types.js.map +0 -1
- package/dist/Carousel/index.js +0 -2
- package/dist/Carousel/index.js.map +0 -1
- package/dist/Checkbox/Checkbox.js +0 -26
- package/dist/Checkbox/Checkbox.js.map +0 -1
- package/dist/Checkbox/Checkbox.stories.js +0 -34
- package/dist/Checkbox/Checkbox.stories.js.map +0 -1
- package/dist/Checkbox/Checkbox.test.js +0 -94
- package/dist/Checkbox/Checkbox.test.js.map +0 -1
- package/dist/Checkbox/Checkbox.types.js +0 -2
- package/dist/Checkbox/Checkbox.types.js.map +0 -1
- package/dist/Checkbox/index.js +0 -2
- package/dist/Checkbox/index.js.map +0 -1
- package/dist/Collapse/Collapse.js +0 -15
- package/dist/Collapse/Collapse.js.map +0 -1
- package/dist/Collapse/Collapse.stories.js +0 -37
- package/dist/Collapse/Collapse.stories.js.map +0 -1
- package/dist/Collapse/Collapse.test.js +0 -19
- package/dist/Collapse/Collapse.test.js.map +0 -1
- package/dist/Collapse/Collapse.types.js +0 -2
- package/dist/Collapse/Collapse.types.js.map +0 -1
- package/dist/Collapse/index.js +0 -2
- package/dist/Collapse/index.js.map +0 -1
- package/dist/Icon/Icon.js +0 -55
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.js +0 -49
- package/dist/Icon/Icon.stories.js.map +0 -1
- package/dist/Icon/Icon.test.js +0 -55
- package/dist/Icon/Icon.test.js.map +0 -1
- package/dist/Icon/Icon.types.js +0 -16
- package/dist/Icon/Icon.types.js.map +0 -1
- package/dist/Icon/index.js +0 -2
- package/dist/Icon/index.js.map +0 -1
- package/dist/InputGroup/InputGroup.js +0 -35
- package/dist/InputGroup/InputGroup.js.map +0 -1
- package/dist/InputGroup/InputGroup.stories.js +0 -176
- package/dist/InputGroup/InputGroup.stories.js.map +0 -1
- package/dist/InputGroup/InputGroup.test.js +0 -43
- package/dist/InputGroup/InputGroup.test.js.map +0 -1
- package/dist/InputGroup/InputGroup.types.js +0 -2
- package/dist/InputGroup/InputGroup.types.js.map +0 -1
- package/dist/InputGroup/index.js +0 -2
- package/dist/InputGroup/index.js.map +0 -1
- package/dist/Modal/Modal.js +0 -102
- package/dist/Modal/Modal.js.map +0 -1
- package/dist/Modal/Modal.stories.js +0 -127
- package/dist/Modal/Modal.stories.js.map +0 -1
- package/dist/Modal/Modal.test.js +0 -108
- package/dist/Modal/Modal.test.js.map +0 -1
- package/dist/Modal/Modal.types.js +0 -2
- package/dist/Modal/Modal.types.js.map +0 -1
- package/dist/Modal/index.js +0 -2
- package/dist/Modal/index.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.js +0 -70
- package/dist/ProgressBar/ProgressBar.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.stories.js +0 -83
- package/dist/ProgressBar/ProgressBar.stories.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.test.js +0 -44
- package/dist/ProgressBar/ProgressBar.test.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.types.js +0 -2
- package/dist/ProgressBar/ProgressBar.types.js.map +0 -1
- package/dist/ProgressBar/index.js +0 -2
- package/dist/ProgressBar/index.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js +0 -48
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +0 -87
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +0 -73
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +0 -2
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js.map +0 -1
- package/dist/SeeqActionDropdown/index.js +0 -2
- package/dist/SeeqActionDropdown/index.js.map +0 -1
- package/dist/SeeqActionDropdown/variants.js +0 -38
- package/dist/SeeqActionDropdown/variants.js.map +0 -1
- package/dist/Select/Select.js +0 -177
- package/dist/Select/Select.js.map +0 -1
- package/dist/Select/Select.stories.js +0 -82
- package/dist/Select/Select.stories.js.map +0 -1
- package/dist/Select/Select.test.js +0 -182
- package/dist/Select/Select.test.js.map +0 -1
- package/dist/Select/Select.types.js +0 -2
- package/dist/Select/Select.types.js.map +0 -1
- package/dist/Select/index.js +0 -3
- package/dist/Select/index.js.map +0 -1
- package/dist/Slider/Slider.js +0 -13
- package/dist/Slider/Slider.js.map +0 -1
- package/dist/Slider/Slider.stories.js +0 -58
- package/dist/Slider/Slider.stories.js.map +0 -1
- package/dist/Slider/Slider.test.js +0 -33
- package/dist/Slider/Slider.test.js.map +0 -1
- package/dist/Slider/Slider.types.js +0 -2
- package/dist/Slider/Slider.types.js.map +0 -1
- package/dist/Slider/index.js +0 -2
- package/dist/Slider/index.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.js +0 -30
- package/dist/SvgIcon/SvgIcon.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.stories.js +0 -42
- package/dist/SvgIcon/SvgIcon.stories.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.test.js +0 -41
- package/dist/SvgIcon/SvgIcon.test.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.types.js +0 -6
- package/dist/SvgIcon/SvgIcon.types.js.map +0 -1
- package/dist/SvgIcon/index.js +0 -2
- package/dist/SvgIcon/index.js.map +0 -1
- package/dist/Tabs/Tabs.js +0 -22
- package/dist/Tabs/Tabs.js.map +0 -1
- package/dist/Tabs/Tabs.stories.js +0 -91
- package/dist/Tabs/Tabs.stories.js.map +0 -1
- package/dist/Tabs/Tabs.test.js +0 -91
- package/dist/Tabs/Tabs.test.js.map +0 -1
- package/dist/Tabs/Tabs.types.js +0 -2
- package/dist/Tabs/Tabs.types.js.map +0 -1
- package/dist/Tabs/index.js +0 -2
- package/dist/Tabs/index.js.map +0 -1
- package/dist/TextArea/TextArea.js +0 -25
- package/dist/TextArea/TextArea.js.map +0 -1
- package/dist/TextArea/TextArea.stories.js +0 -46
- package/dist/TextArea/TextArea.stories.js.map +0 -1
- package/dist/TextArea/TextArea.test.js +0 -68
- package/dist/TextArea/TextArea.test.js.map +0 -1
- package/dist/TextArea/TextArea.types.js +0 -2
- package/dist/TextArea/TextArea.types.js.map +0 -1
- package/dist/TextArea/index.js +0 -2
- package/dist/TextArea/index.js.map +0 -1
- package/dist/TextField/TextField.js +0 -86
- package/dist/TextField/TextField.js.map +0 -1
- package/dist/TextField/TextField.stories.js +0 -70
- package/dist/TextField/TextField.stories.js.map +0 -1
- package/dist/TextField/TextField.test.js +0 -41
- package/dist/TextField/TextField.test.js.map +0 -1
- package/dist/TextField/TextField.types.js +0 -2
- package/dist/TextField/TextField.types.js.map +0 -1
- package/dist/TextField/index.js +0 -2
- package/dist/TextField/index.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.js +0 -69
- package/dist/ToolbarButton/ToolbarButton.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js +0 -97
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.test.js +0 -93
- package/dist/ToolbarButton/ToolbarButton.test.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.types.js +0 -2
- package/dist/ToolbarButton/ToolbarButton.types.js.map +0 -1
- package/dist/ToolbarButton/index.js +0 -2
- package/dist/ToolbarButton/index.js.map +0 -1
- package/dist/Tooltip/QTip.stories.js +0 -45
- package/dist/Tooltip/QTip.stories.js.map +0 -1
- package/dist/Tooltip/QTip.types.js +0 -2
- package/dist/Tooltip/QTip.types.js.map +0 -1
- package/dist/Tooltip/QTipPerformance.stories.js +0 -30
- package/dist/Tooltip/QTipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/Qtip.js +0 -170
- package/dist/Tooltip/Qtip.js.map +0 -1
- package/dist/Tooltip/Tooltip.js +0 -36
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/Tooltip.stories.js +0 -32
- package/dist/Tooltip/Tooltip.stories.js.map +0 -1
- package/dist/Tooltip/Tooltip.types.js +0 -3
- package/dist/Tooltip/Tooltip.types.js.map +0 -1
- package/dist/Tooltip/TooltipPerformance.stories.js +0 -30
- package/dist/Tooltip/TooltipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/index.js +0 -3
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/Tooltip/qTip.utilities.js +0 -11
- package/dist/Tooltip/qTip.utilities.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/browserId.js +0 -29
- package/dist/utils/browserId.js.map +0 -1
- package/dist/utils/svg.js +0 -20
- package/dist/utils/svg.js.map +0 -1
- package/dist/utils/validateStyleDimension.js +0 -14
- package/dist/utils/validateStyleDimension.js.map +0 -1
- package/dist/utils/validateStyleDimension.test.js +0 -20
- package/dist/utils/validateStyleDimension.test.js.map +0 -1
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ButtonWithDropdown from './ButtonWithDropdown';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import { QTip } from '../Tooltip/Qtip';
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Button with Dropdown',
|
|
7
|
-
};
|
|
8
|
-
export const AllButtonWithDropdownVariants = () => {
|
|
9
|
-
const [openDropdown, setOpenDropdown] = React.useState('');
|
|
10
|
-
const allButtonWithDropdowns = (color, isDark) => (React.createElement("div", { className: isDark ? 'tw-dark tw-bg-sq-dark-background' : '' },
|
|
11
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
12
|
-
React.createElement(ButtonWithDropdown, { onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-1-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-1-${color}-${isDark ? 'dark' : 'light'}`, triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), containerTestId: "basic-dropdown1", tooltip: "This is a small dropdown.", tooltipDelay: 0, tooltipPlacement: "top", dropdownItems: [
|
|
13
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
14
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
15
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
16
|
-
{
|
|
17
|
-
label: 'Banana',
|
|
18
|
-
icon: 'fc-user-community',
|
|
19
|
-
onClick: () => setOpenDropdown(''),
|
|
20
|
-
tooltipDelay: 0,
|
|
21
|
-
tooltip: 'This is a banana',
|
|
22
|
-
},
|
|
23
|
-
] })),
|
|
24
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
25
|
-
React.createElement(ButtonWithDropdown, { triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-2-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-2-${color}-${isDark ? 'dark' : 'light'}`, dropdownItems: [
|
|
26
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
27
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
28
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
29
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
30
|
-
], containerTestId: "basic-dropdown1", tooltip: "This is a normal dropdown.", tooltipDelay: 0, tooltipPlacement: "top" })),
|
|
31
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
32
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Dropdown with arrow"),
|
|
33
|
-
React.createElement(ButtonWithDropdown, { triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-3-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-3-${color}-${isDark ? 'dark' : 'light'}`, dropdownItems: [
|
|
34
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
35
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
36
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
37
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
38
|
-
], containerTestId: "basic-dropdown1", hasArrow: true, tooltip: "This is a normal dropdown aligned to the end", tooltipDelay: 0, tooltipPlacement: "top" })),
|
|
39
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
40
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Dropdown aligned at center"),
|
|
41
|
-
React.createElement(ButtonWithDropdown, { triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-4-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-4-${color}-${isDark ? 'dark' : 'light'}`, dropdownItems: [
|
|
42
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
43
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
44
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
45
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
46
|
-
], containerTestId: "basic-dropdown1", hasArrow: true, tooltip: "This is a normal dropdown aligned to the center", align: "center", tooltipDelay: 0, tooltipPlacement: "top" })),
|
|
47
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
48
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Dropdown aligned at start"),
|
|
49
|
-
React.createElement(ButtonWithDropdown, { triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-5-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-5-${color}-${isDark ? 'dark' : 'light'}`, dropdownItems: [
|
|
50
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
51
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
52
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
53
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
54
|
-
], containerTestId: "basic-dropdown1", hasArrow: true, tooltip: "This is a normal dropdown aligned to the center", align: "start", tooltipDelay: 0, tooltipPlacement: "top" })),
|
|
55
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
56
|
-
React.createElement(ButtonWithDropdown, { triggerIcon: React.createElement(Icon, { icon: "fc-gears-2", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), dropdownItems: [], onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-6-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-6-${color}-${isDark ? 'dark' : 'light'}`, containerTestId: "basic-dropdown2", tooltip: "This is a disabled dropdown.", tooltipDelay: 0, tooltipPlacement: "top", disabled: true })),
|
|
57
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
58
|
-
React.createElement(ButtonWithDropdown, { onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-7-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-7-${color}-${isDark ? 'dark' : 'light'}`, triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), containerTestId: "basic-dropdown7", tooltip: "This is a dropdown with submenu", tooltipDelay: 0, tooltipPlacement: "top", dropdownItems: [
|
|
59
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
60
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
61
|
-
{
|
|
62
|
-
label: 'Guava',
|
|
63
|
-
icon: 'fc-user-community',
|
|
64
|
-
onClick: () => setOpenDropdown(''),
|
|
65
|
-
tooltipDelay: 0,
|
|
66
|
-
tooltip: 'This is a guava',
|
|
67
|
-
subMenuItems: [
|
|
68
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
69
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
70
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
74
|
-
{
|
|
75
|
-
label: 'Cashew',
|
|
76
|
-
icon: 'fc-user-community',
|
|
77
|
-
disabled: true,
|
|
78
|
-
onClick: () => setOpenDropdown(''),
|
|
79
|
-
subMenuItems: [
|
|
80
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
81
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
82
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
] })),
|
|
86
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
87
|
-
React.createElement(ButtonWithDropdown, { onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-8-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-8-${color}-${isDark ? 'dark' : 'light'}`, triggerIcon: React.createElement(Icon, { icon: "fc-more", type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" }), containerTestId: "basic-dropdown8", tooltip: "This is a dropdown with submenu", tooltipDelay: 0, tooltipPlacement: "top", dropdownItems: [
|
|
88
|
-
{
|
|
89
|
-
label: (React.createElement("div", null,
|
|
90
|
-
React.createElement("h5", null, "Label heading"),
|
|
91
|
-
React.createElement("p", null, "Label description"),
|
|
92
|
-
React.createElement("p", null, "Dropdown is my work"),
|
|
93
|
-
React.createElement("p", null, "I do it happily"),
|
|
94
|
-
React.createElement("p", null, "Final remards"),
|
|
95
|
-
React.createElement("p", null, "Thank you"))),
|
|
96
|
-
icon: 'fc-data-file',
|
|
97
|
-
onClick: () => setOpenDropdown(''),
|
|
98
|
-
},
|
|
99
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
100
|
-
{
|
|
101
|
-
label: 'Guava',
|
|
102
|
-
icon: 'fc-user-community',
|
|
103
|
-
onClick: () => setOpenDropdown(''),
|
|
104
|
-
tooltipDelay: 0,
|
|
105
|
-
tooltip: 'This is a guava',
|
|
106
|
-
subMenuItems: [
|
|
107
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
108
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
109
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
113
|
-
{
|
|
114
|
-
label: 'Cashew',
|
|
115
|
-
icon: 'fc-user-community',
|
|
116
|
-
disabled: true,
|
|
117
|
-
onClick: () => setOpenDropdown(''),
|
|
118
|
-
subMenuItems: [
|
|
119
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
120
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
121
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
] }))));
|
|
125
|
-
const renderAllVariations = (color) => (React.createElement("div", { className: "tw-grid tw-grid-cols-2 tw-gap-4 tw-p-4" },
|
|
126
|
-
allButtonWithDropdowns(color),
|
|
127
|
-
allButtonWithDropdowns(color, true)));
|
|
128
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
129
|
-
React.createElement(QTip, null),
|
|
130
|
-
React.createElement("div", { className: "color_topic" },
|
|
131
|
-
React.createElement("b", null, "Topic Colors"),
|
|
132
|
-
renderAllVariations('topic')),
|
|
133
|
-
React.createElement("div", { className: "color_analysis" },
|
|
134
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
135
|
-
renderAllVariations('analysis')),
|
|
136
|
-
React.createElement("div", { className: "color_datalab" },
|
|
137
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
138
|
-
renderAllVariations('datalab')),
|
|
139
|
-
React.createElement("div", { className: "color_vantage" },
|
|
140
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
141
|
-
renderAllVariations('vantage'))));
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=ButtonWithDropdown.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.stories.js","sourceRoot":"","sources":["../../src/ButtonWithDropdown/ButtonWithDropdown.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,eAAe;IACb,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC3D,MAAM,sBAAsB,GAAG,CAAC,KAAa,EAAE,MAAgB,EAAE,EAAE,CAAC,CAClE,6BAAK,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE;QAC9D,6BAAK,SAAS,EAAC,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B,CAAC,KAAK,CAAC;QAC7B,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,CAChC,CACP,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,IAAI,OAAG;QACR,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,CAAC,OAAO,CAAC,CACzB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,CAAC,UAAU,CAAC,CAC5B;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,CAAC,SAAS,CAAC,CAC3B;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,CAAC,SAAS,CAAC,CAC3B,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import userEvent from '@testing-library/user-event';
|
|
5
|
-
import ButtonWithDropdown from './ButtonWithDropdown';
|
|
6
|
-
import Icon from '../Icon';
|
|
7
|
-
describe('ButtonWithDropdown', () => {
|
|
8
|
-
const mockOnClick = jest.fn();
|
|
9
|
-
const testId = 'trigger-icon';
|
|
10
|
-
const tooltip = 'This is a small dropdown.';
|
|
11
|
-
const itemTooltip = 'This is an item from the dropdown.';
|
|
12
|
-
class Context {
|
|
13
|
-
props = {
|
|
14
|
-
triggerIcon: (React.createElement(Icon, { icon: "fc-more", type: "text", testId: testId, extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })),
|
|
15
|
-
containerTestId: 'basic-dropdown1',
|
|
16
|
-
tooltip,
|
|
17
|
-
tooltipDelay: 0,
|
|
18
|
-
tooltipPlacement: 'top',
|
|
19
|
-
isHtmlTooltip: false,
|
|
20
|
-
dropdownItems: [
|
|
21
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: mockOnClick },
|
|
22
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: mockOnClick },
|
|
23
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: mockOnClick },
|
|
24
|
-
{
|
|
25
|
-
label: 'Banana',
|
|
26
|
-
icon: 'fc-user-community',
|
|
27
|
-
onClick: mockOnClick,
|
|
28
|
-
tooltip: itemTooltip,
|
|
29
|
-
tooltipPlacement: 'top',
|
|
30
|
-
tooltipDelay: 0,
|
|
31
|
-
isHtmlTooltip: false,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
let tc;
|
|
37
|
-
beforeEach(() => {
|
|
38
|
-
tc = new Context();
|
|
39
|
-
jest.clearAllMocks();
|
|
40
|
-
});
|
|
41
|
-
const renderButtonWithDropdown = (props) => render(React.createElement(ButtonWithDropdown, { ...props }));
|
|
42
|
-
const openDropdown = async () => {
|
|
43
|
-
const popover = screen.getByTestId(testId);
|
|
44
|
-
await userEvent.click(popover);
|
|
45
|
-
};
|
|
46
|
-
test('renders trigger and opens dropdown content on trigger click', async () => {
|
|
47
|
-
renderButtonWithDropdown(tc.props);
|
|
48
|
-
expect(screen.getByTestId('trigger-icon')).toBeInTheDocument();
|
|
49
|
-
await openDropdown();
|
|
50
|
-
expect(screen.getByText('Orange')).toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
test('renders dividers correctly', async () => {
|
|
53
|
-
tc.props.dropdownItems[1].hasDivider = true;
|
|
54
|
-
renderButtonWithDropdown(tc.props);
|
|
55
|
-
expect(screen.getByTestId('trigger-icon')).toBeInTheDocument();
|
|
56
|
-
await openDropdown();
|
|
57
|
-
expect(screen.getByText('Orange')).toBeInTheDocument();
|
|
58
|
-
expect(screen.getByTestId('dropdown-divider-1')).toBeInTheDocument();
|
|
59
|
-
});
|
|
60
|
-
test('calls onClick handler when dropdown item is selected', async () => {
|
|
61
|
-
renderButtonWithDropdown(tc.props);
|
|
62
|
-
await openDropdown();
|
|
63
|
-
const item1 = screen.getByText('Orange');
|
|
64
|
-
await userEvent.click(item1);
|
|
65
|
-
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
66
|
-
});
|
|
67
|
-
test('closes dropdown when item is clicked', async () => {
|
|
68
|
-
renderButtonWithDropdown(tc.props);
|
|
69
|
-
await openDropdown();
|
|
70
|
-
const item1 = screen.getByText('Orange');
|
|
71
|
-
await userEvent.click(item1);
|
|
72
|
-
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
73
|
-
expect(screen.queryByText('Orange')).not.toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
test('does not open when disabled', async () => {
|
|
76
|
-
tc.props.disabled = true;
|
|
77
|
-
renderButtonWithDropdown(tc.props);
|
|
78
|
-
await openDropdown();
|
|
79
|
-
expect(screen.queryByText('Orange')).not.toBeInTheDocument();
|
|
80
|
-
});
|
|
81
|
-
test('renders button tooltip correctly', async () => {
|
|
82
|
-
renderButtonWithDropdown(tc.props);
|
|
83
|
-
const tooltipText = document.querySelector(`[data-qtip-text="${tooltip}"]`);
|
|
84
|
-
expect(tooltipText).toBeInTheDocument();
|
|
85
|
-
});
|
|
86
|
-
test('renders dropdown item tooltip correctly', async () => {
|
|
87
|
-
renderButtonWithDropdown(tc.props);
|
|
88
|
-
await openDropdown();
|
|
89
|
-
const tooltipText = document.querySelector(`[data-qtip-text="${itemTooltip}"]`);
|
|
90
|
-
expect(tooltipText).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
//# sourceMappingURL=ButtonWithDropdown.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.test.js","sourceRoot":"","sources":["../../src/ButtonWithDropdown/ButtonWithDropdown.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,M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CAAC,aAAa,CAAC,oBAAoB,OAAO,IAAI,CAAC,CAAC;QAC5E,MAAM,CAAC,WAAW,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACzD,wBAAwB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,YAAY,EAAE,CAAC;QACrB,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,oBAAoB,WAAW,IAAI,CAAC,CAAC;QAChF,MAAM,CAAC,WAAW,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.types.js","sourceRoot":"","sources":["../../src/ButtonWithDropdown/ButtonWithDropdown.types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ButtonWithDropdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
4
|
-
import { getQTipData } from '../Tooltip/qTip.utilities';
|
|
5
|
-
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
6
|
-
const borderStyles = [
|
|
7
|
-
'tw-border-solid',
|
|
8
|
-
'tw-border',
|
|
9
|
-
'tw-rounded-popover',
|
|
10
|
-
'tw-border-sq-disabled-gray',
|
|
11
|
-
'dark:tw-border-gray-500',
|
|
12
|
-
].join(' ');
|
|
13
|
-
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
14
|
-
const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, onInteractOutside, onPointerDownOutside, isTriggerAsChild = false, shouldTriggerFullWidth = false, disabled = false, align = 'end', alignOffset = -35, placement = 'bottom', placementOffset = 2, isHoverEnabled = false, hoverOpenDelay = 300, onOpenChange, isOpen, isCloseOnContentClick = false, isPortal = false, ...tooltipProps }) => {
|
|
15
|
-
const tooltipData = getQTipData(tooltipProps);
|
|
16
|
-
const timeout = useRef(null);
|
|
17
|
-
const [isHoveredOpen, setIsHoveredOpen] = React.useState(false);
|
|
18
|
-
const clearHoverTimeout = () => {
|
|
19
|
-
if (timeout.current) {
|
|
20
|
-
clearTimeout(timeout.current);
|
|
21
|
-
timeout.current = null;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const onHoverStart = () => {
|
|
25
|
-
if (isHoverEnabled) {
|
|
26
|
-
clearHoverTimeout();
|
|
27
|
-
timeout.current = setTimeout(() => {
|
|
28
|
-
setIsHoveredOpen(true);
|
|
29
|
-
onOpenChange && onOpenChange(true);
|
|
30
|
-
}, hoverOpenDelay);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const onHoverEnd = () => {
|
|
34
|
-
if (isHoverEnabled) {
|
|
35
|
-
clearHoverTimeout();
|
|
36
|
-
timeout.current = setTimeout(() => {
|
|
37
|
-
setIsHoveredOpen(false);
|
|
38
|
-
onOpenChange && onOpenChange(false);
|
|
39
|
-
}, 200);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
React.useEffect(() => clearHoverTimeout, []);
|
|
43
|
-
const renderContent = () => {
|
|
44
|
-
return (React.createElement(PopoverPrimitive.Content, { sideOffset: placementOffset, align: align, side: placement, onInteractOutside: onInteractOutside, onPointerDownOutside: onPointerDownOutside, alignOffset: isHoverEnabled ? -10 : alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:tw-outline-none tw-outline-none tw-w-full tw-h-full" },
|
|
45
|
-
React.createElement("div", { "data-testid": containerTestId, className: `${bgStyles} ${borderStyles} tw-relative tw-z-[1200] tw-min-w-6 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
|
|
46
|
-
data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade tw-text-sq-text-color
|
|
47
|
-
${extraPopoverClassNames || ''}` },
|
|
48
|
-
hasArrow && (React.createElement(PopoverPrimitive.Arrow, { asChild: true },
|
|
49
|
-
React.createElement("div", { className: "tw-fill-transparent tw-bg-white tw-w-[15px] tw-h-[15px] tw-mt-[-7px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-500" }))),
|
|
50
|
-
children)));
|
|
51
|
-
};
|
|
52
|
-
const renderPopover = (popoverOpenState) => {
|
|
53
|
-
return (React.createElement(PopoverPrimitive.Root, { open: popoverOpenState, defaultOpen: false, onOpenChange: onOpenChange },
|
|
54
|
-
trigger ? (React.createElement(PopoverPrimitive.Trigger, { id: id, asChild: isTriggerAsChild, className: `focus-visible:tw-outline-none tw-outline-none ${shouldTriggerFullWidth ? 'tw-w-full tw-h-full' : ''}`, disabled: disabled },
|
|
55
|
-
React.createElement("div", { ...tooltipData, onMouseOver: onHoverStart, onMouseOut: onHoverEnd, className: `tw-bg-transparent focus-visible:tw-outline-none tw-outline-none ${disabled ? disabledClasses : ''} ${shouldTriggerFullWidth ? 'tw-flex tw-flex-col tw-items-center tw-justify-center' : 'tw-inline'} ${extraTriggerClassNames || ''}` }, trigger))) : (React.createElement(PopoverPrimitive.Trigger, { asChild: true },
|
|
56
|
-
React.createElement("div", null))),
|
|
57
|
-
isPortal ? React.createElement(PopoverPrimitive.Portal, null, renderContent()) : renderContent()));
|
|
58
|
-
};
|
|
59
|
-
return isHoverEnabled ? renderPopover(isHoveredOpen) : renderPopover(isOpen);
|
|
60
|
-
};
|
|
61
|
-
export default ButtonWithPopover;
|
|
62
|
-
//# sourceMappingURL=ButtonWithPopover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithPopover.js","sourceRoot":"","sources":["../../src/ButtonWithPopover/ButtonWithPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,QAAQ,GAAG,CAAC,gBAAgB,EAAE,+BAA+B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/E,MAAM,YAAY,GAAG;IACnB,iBAAiB;IACjB,WAAW;IACX,oBAAoB;IACpB,4BAA4B;IAC5B,yBAAyB;CAC1B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,eAAe,GAAG,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7E,MAAM,iBAAiB,GAAoD,CAAC,EAC1E,QAAQ,EACR,OAAO,EACP,EAAE,EACF,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,GAAG,KAAK,EACxB,sBAAsB,GAAG,KAAK,EAC9B,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,KAAK,EACb,WAAW,GAAG,CAAC,EAAE,EACjB,SAAS,GAAG,QAAQ,EACpB,eAAe,GAAG,CAAC,EACnB,cAAc,GAAG,KAAK,EACtB,cAAc,GAAG,GAAG,EACpB,YAAY,EACZ,MAAM,EACN,qBAAqB,GAAG,KAAK,EAC7B,QAAQ,GAAG,KAAK,EAChB,GAAG,YA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AC,gBAAgB,CAAC,OAAO,IAAC,OAAO;gBAC/B,gCAAO,CACkB,CAC5B;YACA,QAAQ,CAAC,CAAC,CAAC,oBAAC,gBAAgB,CAAC,MAAM,QAAE,aAAa,EAAE,CAA2B,CAAC,CAAC,CAAC,aAAa,EAAE,CAC5E,CACzB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ButtonWithPopover from './ButtonWithPopover';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import { QTip } from '../Tooltip/Qtip';
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Button with Popover',
|
|
7
|
-
};
|
|
8
|
-
export const AllButtonWithPopoverVariants = () => {
|
|
9
|
-
const options = ['Chocolate', 'Strawberry', 'Vanilla', 'Rocky Road', 'Crazy Cow', 'Almond Joy'];
|
|
10
|
-
const renderFlavours = () => (React.createElement("div", { className: "tw-text-sm dark:tw-text-white tw-w-72 tw-p-4" },
|
|
11
|
-
React.createElement("p", { className: "tw-font-bold" }, "Flavors"),
|
|
12
|
-
React.createElement("div", { className: "tw-w-full tw-flex tw-flex-wrap tw-gap-1" }, options.map((option) => (React.createElement("div", { key: option, className: "tw-flex tw-items-center tw-px-2 tw-py-1 tw-mt-2 tw tw-rounded-full tw-border-sq-color-dark-dark tw-border" },
|
|
13
|
-
React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
14
|
-
React.createElement("span", null, option)))))));
|
|
15
|
-
const renderInputFields = () => {
|
|
16
|
-
const [name, setName] = React.useState('');
|
|
17
|
-
const [email, setEmail] = React.useState('');
|
|
18
|
-
return (React.createElement("div", { className: "tw-w-72 tw-p-4" },
|
|
19
|
-
React.createElement("div", { className: "tw-flex tw-flex-col tw-gap-2" },
|
|
20
|
-
React.createElement("input", { type: "text", value: name, onChange: (e) => setName(e.target.value), placeholder: "Enter your name", className: "tw-p-2 tw-rounded tw-border tw-border-sq-color-dark-dark dark:tw-border-sq-dark-background tw-bg-transparent" }),
|
|
21
|
-
React.createElement("input", { type: "text", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter your email", className: "tw-p-2 tw-rounded tw-border tw-border-sq-color-dark-dark dark:tw-border-sq-dark-background tw-bg-transparent" }),
|
|
22
|
-
React.createElement("button", { className: "tw-p-2 tw-rounded tw-border tw-border-sq-color-dark-dark dark:tw-border-sq-dark-background tw-bg-transparent tw-text-sq-color" }, "Submit"))));
|
|
23
|
-
};
|
|
24
|
-
const [openPopver, setOpenPopover] = React.useState('');
|
|
25
|
-
const iconRef = React.useRef(null);
|
|
26
|
-
const allButtonWithPopovers = (isDark = false, topic) => (React.createElement("div", { className: isDark ? 'tw-dark tw-bg-sq-dark-background ' : '' },
|
|
27
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
28
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-1`, tooltip: "This is a small popover.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false }, renderFlavours())),
|
|
29
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
30
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-2`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-2`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-2` : ''), tooltip: "This is a normal popover.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false }, renderFlavours())),
|
|
31
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
32
|
-
React.createElement("p", { className: "dark:tw-text-sq-white tw-text-sm tw-mb-4" }, "Close popover on content click"),
|
|
33
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-3`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-3`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-3` : ''), tooltip: "This is a normal popover.", tooltipDelay: 0, tooltipPlacement: "top", isCloseOnContentClick: true, isHtmlTooltip: false }, renderFlavours())),
|
|
34
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
35
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-4`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-4`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-4` : ''), tooltip: "This is a disabled popover.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, disabled: true }, renderFlavours())),
|
|
36
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
37
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Popover with arrow"),
|
|
38
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-5`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-5`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-5` : ''), tooltip: "This is a normal popover with arrow.", tooltipDelay: 0, tooltipPlacement: "top", hasArrow: true, isHtmlTooltip: false }, renderFlavours())),
|
|
39
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
40
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Popover aligned at center"),
|
|
41
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-6`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-6`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-6` : ''), tooltip: "This is a normal popover with arrow.", tooltipDelay: 0, tooltipPlacement: "top", align: "center", hasArrow: true, isHtmlTooltip: false }, renderFlavours())),
|
|
42
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
43
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Popover aligned at start"),
|
|
44
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-7`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-7`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-7` : ''), tooltip: "This is a normal popover with arrow.", tooltipDelay: 0, align: "start", tooltipPlacement: "top", hasArrow: true, isHtmlTooltip: false }, renderFlavours())),
|
|
45
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
46
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Popover triggered by hover"),
|
|
47
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-8`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-8`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-8` : ''), isHoverEnabled: true, align: "start", tooltipPlacement: "top", hasArrow: true, isHtmlTooltip: false }, renderFlavours())),
|
|
48
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
49
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Popover triggered by another element"), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-9`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-9`, onInteractOutside: () => setOpenPopover(''), align: "start", tooltipPlacement: "top", hasArrow: true, isHtmlTooltip: false }, renderFlavours()),
|
|
50
|
-
openPopver != `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-9` && (React.createElement("div", { ref: iconRef, onClick: () => {
|
|
51
|
-
setOpenPopover(`basic-popover-${isDark ? 'dark' : 'light'}-${topic}-9`);
|
|
52
|
-
} },
|
|
53
|
-
React.createElement(Icon, { type: "text", icon: "fc-all-items" })))),
|
|
54
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
55
|
-
React.createElement("div", { className: "dark:tw-text-white tw-text-xs" }, "Popover with input fields"),
|
|
56
|
-
React.createElement(ButtonWithPopover, { trigger: React.createElement(Icon, { type: "color", color: "rgb(var(--sq-color-dark-dark))", icon: "fc-more" }), containerTestId: `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-10`, isOpen: openPopver === `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-10`, onOpenChange: (isOpen) => setOpenPopover(isOpen ? `basic-popover-${isDark ? 'dark' : 'light'}-${topic}-10` : ''), tooltip: "This is a normal popover with arrow.", tooltipDelay: 0, tooltipPlacement: "top", align: "center", hasArrow: true, isHtmlTooltip: false }, renderInputFields()))));
|
|
57
|
-
const renderAllVariations = (color) => (React.createElement("div", { className: "tw-grid tw-grid-cols-2 tw-gap-4 tw-p-4" },
|
|
58
|
-
allButtonWithPopovers(false, color),
|
|
59
|
-
allButtonWithPopovers(true, color)));
|
|
60
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
61
|
-
React.createElement(QTip, null),
|
|
62
|
-
React.createElement("div", { className: "color_topic" },
|
|
63
|
-
React.createElement("b", null, "Topic Colors"),
|
|
64
|
-
renderAllVariations('topic')),
|
|
65
|
-
React.createElement("div", { className: "color_analysis" },
|
|
66
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
67
|
-
renderAllVariations('analysis')),
|
|
68
|
-
React.createElement("div", { className: "color_datalab" },
|
|
69
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
70
|
-
renderAllVariations('datalab')),
|
|
71
|
-
React.createElement("div", { className: "color_vantage" },
|
|
72
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
73
|
-
renderAllVariations('vantage'))));
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=ButtonWithPopover.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithPopover.stories.js","sourceRoot":"","sources":["../../src/ButtonWithPopover/ButtonWithPopover.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,eAAe;IACb,KAAK,EAAE,qBAAqB;CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,OAAO,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,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CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAExF,OAAO,EAAC,sCAAsC,EAC9C,YAAY,EAAE,CAAC,EACf,gBAAgB,EAAC,KAAK,EACtB,KAAK,EAAC,QAAQ,EACd,QAAQ,QACR,aAAa,EAAE,KAAK,IACnB,iBAAiB,EAAE,CACF,CAChB,CACF,CACP,CAAC;IACF,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAC7C,6BAAK,SAAS,EAAC,wCAAwC;QACpD,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC;QACnC,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,CAC/B,CACP,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,IAAI,OAAG;QACR,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,CAAC,OAAO,CAAC,CACzB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,CAAC,UAAU,CAAC,CAC5B;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,CAAC,SAAS,CAAC,CAC3B;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,CAAC,SAAS,CAAC,CAC3B,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
//# sourceMappingURL=ButtonWithPopover.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithPopover.test.js","sourceRoot":"","sources":["../../src/ButtonWithPopover/ButtonWithPopover.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,E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../../src/ButtonWithPopover/ButtonWithPopover.types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ButtonWithPopover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|