@seeqdev/qomponents 0.0.185 → 0.0.186
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/package.json +2 -2
- package/dist/src/Accordion/Accordion.js +0 -8
- package/dist/src/Accordion/Accordion.stories.js +0 -96
- package/dist/src/Accordion/Accordion.test.js +0 -54
- package/dist/src/Accordion/Accordion.types.js +0 -1
- package/dist/src/Accordion/index.js +0 -1
- package/dist/src/Alert/Alert.js +0 -33
- package/dist/src/Alert/Alert.stories.js +0 -72
- package/dist/src/Alert/Alert.test.js +0 -49
- package/dist/src/Alert/Alert.types.js +0 -1
- package/dist/src/Alert/index.js +0 -1
- package/dist/src/Button/Button.js +0 -107
- package/dist/src/Button/Button.stories.js +0 -74
- package/dist/src/Button/Button.test.js +0 -65
- package/dist/src/Button/Button.types.js +0 -4
- package/dist/src/Button/index.js +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.js +0 -34
- package/dist/src/ButtonGroup/ButtonGroup.stories.js +0 -328
- package/dist/src/ButtonGroup/ButtonGroup.test.js +0 -65
- package/dist/src/ButtonGroup/ButtonGroup.types.js +0 -1
- package/dist/src/ButtonGroup/index.js +0 -1
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.js +0 -46
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.stories.js +0 -119
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.test.js +0 -92
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.types.js +0 -1
- package/dist/src/ButtonWithDropdown/index.js +0 -1
- package/dist/src/ButtonWithPopover/ButtonWithPopover.js +0 -54
- package/dist/src/ButtonWithPopover/ButtonWithPopover.stories.js +0 -51
- package/dist/src/ButtonWithPopover/ButtonWithPopover.test.js +0 -80
- package/dist/src/ButtonWithPopover/ButtonWithPopover.types.js +0 -1
- package/dist/src/ButtonWithPopover/index.js +0 -1
- package/dist/src/Carousel/Carousel.js +0 -80
- package/dist/src/Carousel/Carousel.stories.js +0 -100
- package/dist/src/Carousel/Carousel.test.js +0 -47
- package/dist/src/Carousel/Carousel.types.js +0 -1
- package/dist/src/Carousel/index.js +0 -1
- package/dist/src/Checkbox/Checkbox.js +0 -24
- package/dist/src/Checkbox/Checkbox.stories.js +0 -21
- package/dist/src/Checkbox/Checkbox.test.js +0 -93
- package/dist/src/Checkbox/Checkbox.types.js +0 -1
- package/dist/src/Checkbox/index.js +0 -1
- package/dist/src/Collapse/Collapse.js +0 -16
- package/dist/src/Collapse/Collapse.stories.js +0 -28
- package/dist/src/Collapse/Collapse.test.js +0 -16
- package/dist/src/Collapse/Collapse.types.js +0 -1
- package/dist/src/Collapse/index.js +0 -1
- package/dist/src/Icon/Icon.js +0 -55
- package/dist/src/Icon/Icon.stories.js +0 -31
- package/dist/src/Icon/Icon.test.js +0 -54
- package/dist/src/Icon/Icon.types.js +0 -15
- package/dist/src/Icon/index.js +0 -1
- package/dist/src/InputGroup/InputGroup.js +0 -33
- package/dist/src/InputGroup/InputGroup.stories.js +0 -144
- package/dist/src/InputGroup/InputGroup.test.js +0 -41
- package/dist/src/InputGroup/InputGroup.types.js +0 -1
- package/dist/src/InputGroup/index.js +0 -1
- package/dist/src/Modal/Modal.js +0 -86
- package/dist/src/Modal/Modal.stories.js +0 -79
- package/dist/src/Modal/Modal.test.js +0 -107
- package/dist/src/Modal/Modal.types.js +0 -1
- package/dist/src/Modal/index.js +0 -1
- package/dist/src/ProgressBar/ProgressBar.js +0 -71
- package/dist/src/ProgressBar/ProgressBar.stories.js +0 -46
- package/dist/src/ProgressBar/ProgressBar.test.js +0 -42
- package/dist/src/ProgressBar/ProgressBar.types.js +0 -1
- package/dist/src/ProgressBar/index.js +0 -1
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.js +0 -41
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.stories.js +0 -73
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.test.js +0 -72
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.types.js +0 -1
- package/dist/src/SeeqActionDropdown/index.js +0 -1
- package/dist/src/SeeqActionDropdown/variants.js +0 -34
- package/dist/src/Select/Select.js +0 -171
- package/dist/src/Select/Select.stories.js +0 -50
- package/dist/src/Select/Select.test.js +0 -176
- package/dist/src/Select/Select.types.js +0 -1
- package/dist/src/Select/index.js +0 -2
- package/dist/src/Slider/Slider.js +0 -11
- package/dist/src/Slider/Slider.stories.js +0 -37
- package/dist/src/Slider/Slider.test.js +0 -31
- package/dist/src/Slider/Slider.types.js +0 -1
- package/dist/src/Slider/index.js +0 -1
- package/dist/src/SvgIcon/SvgIcon.js +0 -27
- package/dist/src/SvgIcon/SvgIcon.stories.js +0 -26
- package/dist/src/SvgIcon/SvgIcon.test.js +0 -40
- package/dist/src/SvgIcon/SvgIcon.types.js +0 -2
- package/dist/src/SvgIcon/index.js +0 -1
- package/dist/src/Tabs/Tabs.js +0 -18
- package/dist/src/Tabs/Tabs.stories.js +0 -83
- package/dist/src/Tabs/Tabs.test.js +0 -91
- package/dist/src/Tabs/Tabs.types.js +0 -1
- package/dist/src/Tabs/index.js +0 -1
- package/dist/src/TextArea/TextArea.js +0 -54
- package/dist/src/TextArea/TextArea.stories.js +0 -21
- package/dist/src/TextArea/TextArea.test.js +0 -129
- package/dist/src/TextArea/TextArea.types.js +0 -1
- package/dist/src/TextArea/index.js +0 -1
- package/dist/src/TextField/TextField.js +0 -85
- package/dist/src/TextField/TextField.stories.js +0 -30
- package/dist/src/TextField/TextField.test.js +0 -40
- package/dist/src/TextField/TextField.types.js +0 -1
- package/dist/src/TextField/index.js +0 -1
- package/dist/src/ToolbarButton/ToolbarButton.js +0 -58
- package/dist/src/ToolbarButton/ToolbarButton.stories.js +0 -63
- package/dist/src/ToolbarButton/ToolbarButton.test.js +0 -89
- package/dist/src/ToolbarButton/ToolbarButton.types.js +0 -1
- package/dist/src/ToolbarButton/index.js +0 -1
- package/dist/src/Tooltip/QTip.stories.js +0 -22
- package/dist/src/Tooltip/QTip.types.js +0 -1
- package/dist/src/Tooltip/QTipPerformance.stories.js +0 -27
- package/dist/src/Tooltip/Qtip.js +0 -168
- package/dist/src/Tooltip/Tooltip.js +0 -34
- package/dist/src/Tooltip/Tooltip.stories.js +0 -20
- package/dist/src/Tooltip/Tooltip.types.js +0 -2
- package/dist/src/Tooltip/TooltipPerformance.stories.js +0 -25
- package/dist/src/Tooltip/index.js +0 -2
- package/dist/src/Tooltip/qTip.utilities.js +0 -10
- package/dist/src/index.js +0 -47
- package/dist/src/setupTests.js +0 -5
- package/dist/src/types.js +0 -25
- package/dist/src/utils/browserId.js +0 -28
- package/dist/src/utils/svg.js +0 -19
- package/dist/src/utils/validateStyleDimension.js +0 -13
- package/dist/src/utils/validateStyleDimension.test.js +0 -19
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import '../styles.css';
|
|
3
|
-
import { getQTipData } from '../Tooltip/qTip.utilities';
|
|
4
|
-
import Button from '../Button';
|
|
5
|
-
const baseClasses = 'tw-flex tw-outline-none tw-w-full tw-relative tw-flex-wrap';
|
|
6
|
-
const activeClassesByVariantLightTheme = {
|
|
7
|
-
'outline': '!tw-bg-sq-disabled-gray tw-border-sq-color-dark',
|
|
8
|
-
'theme': 'tw-bg-sq-color-highlight',
|
|
9
|
-
'danger': '',
|
|
10
|
-
'theme-light': '',
|
|
11
|
-
'no-border': '!tw-bg-sq-disabled-gray',
|
|
12
|
-
'warning': '',
|
|
13
|
-
};
|
|
14
|
-
const activeClassesByVariantDarkTheme = {
|
|
15
|
-
'outline': 'dark:!tw-bg-sq-multi-gray-dark dark:tw-border-sq-color-dark',
|
|
16
|
-
'theme': 'dark:tw-bg-sq-color-highlight',
|
|
17
|
-
'danger': '',
|
|
18
|
-
'theme-light': '',
|
|
19
|
-
'no-border': 'dark:!tw-bg-sq-multi-gray-dark',
|
|
20
|
-
'warning': '',
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* ButtonGroup.
|
|
24
|
-
*/
|
|
25
|
-
export const ButtonGroup = (props) => {
|
|
26
|
-
const { id, extraClassNames = '', testId, onChange, buttons = [], ...tooltipProps } = props;
|
|
27
|
-
const tooltipData = getQTipData(tooltipProps);
|
|
28
|
-
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
29
|
-
return (_jsx("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
30
|
-
.filter(Boolean)
|
|
31
|
-
.map((item, index) => item?.variant === 'button' ? (_jsx(Button, { ...item.buttonProps, extraClassNames: `tw-ml-[-1px] focus:tw-z-40 tw-outline-none focus:tw-border tw-rounded-none first:tw-rounded-l-md last:tw-rounded-r-md ${item.buttonProps?.isActive
|
|
32
|
-
? `${activeClassesByVariantLightTheme[item?.buttonProps?.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item?.buttonProps?.variant ?? 'outline']} `
|
|
33
|
-
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) }, index)) : (item?.element)) }));
|
|
34
|
-
};
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { QTip } from '../Tooltip/Qtip';
|
|
4
|
-
import { ButtonGroup } from './ButtonGroup';
|
|
5
|
-
import ToolbarButton from '../ToolbarButton';
|
|
6
|
-
export default {
|
|
7
|
-
title: 'ButtonGroup',
|
|
8
|
-
};
|
|
9
|
-
export const AllButtonGroups = () => {
|
|
10
|
-
const [value, setValue] = React.useState('provided-1');
|
|
11
|
-
const renderAllVariations = () => (_jsxs(_Fragment, { children: [
|
|
12
|
-
_jsxs("div", { className: "light", children: [
|
|
13
|
-
_jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: () => { }, buttons: [
|
|
14
|
-
{
|
|
15
|
-
variant: 'button',
|
|
16
|
-
buttonProps: {
|
|
17
|
-
variant: 'outline',
|
|
18
|
-
icon: 'fc-annotate',
|
|
19
|
-
iconStyle: 'theme',
|
|
20
|
-
value: 'provided-1',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
variant: 'button',
|
|
25
|
-
buttonProps: {
|
|
26
|
-
variant: 'outline',
|
|
27
|
-
icon: 'fc-trash',
|
|
28
|
-
iconStyle: 'theme',
|
|
29
|
-
value: 'provided-2',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
variant: 'button',
|
|
34
|
-
buttonProps: {
|
|
35
|
-
variant: 'outline',
|
|
36
|
-
icon: 'fc-formula-ai',
|
|
37
|
-
iconStyle: 'theme',
|
|
38
|
-
value: 'provided-3',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
42
|
-
{
|
|
43
|
-
variant: 'button',
|
|
44
|
-
buttonProps: {
|
|
45
|
-
variant: 'outline',
|
|
46
|
-
icon: 'fc-annotate',
|
|
47
|
-
extraClassNames: 'tw-border-none',
|
|
48
|
-
iconStyle: 'theme',
|
|
49
|
-
value: 'provided-1',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
variant: 'button',
|
|
54
|
-
buttonProps: {
|
|
55
|
-
variant: 'outline',
|
|
56
|
-
icon: 'fc-trash',
|
|
57
|
-
extraClassNames: 'tw-border-none',
|
|
58
|
-
iconStyle: 'theme',
|
|
59
|
-
value: 'provided-2',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
variant: 'button',
|
|
64
|
-
buttonProps: {
|
|
65
|
-
variant: 'outline',
|
|
66
|
-
extraClassNames: 'tw-border-none',
|
|
67
|
-
icon: 'fc-formula-ai',
|
|
68
|
-
iconStyle: 'theme',
|
|
69
|
-
value: 'provided-3',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
73
|
-
{
|
|
74
|
-
variant: 'button',
|
|
75
|
-
buttonProps: {
|
|
76
|
-
variant: 'theme',
|
|
77
|
-
icon: 'fc-annotate',
|
|
78
|
-
iconStyle: 'white',
|
|
79
|
-
value: 'provided-1',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
variant: 'button',
|
|
84
|
-
buttonProps: {
|
|
85
|
-
variant: 'theme',
|
|
86
|
-
icon: 'fc-trash',
|
|
87
|
-
iconStyle: 'white',
|
|
88
|
-
value: 'provided-2',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
variant: 'button',
|
|
93
|
-
buttonProps: {
|
|
94
|
-
variant: 'theme',
|
|
95
|
-
icon: 'fc-formula-ai',
|
|
96
|
-
iconStyle: 'white',
|
|
97
|
-
value: 'provided-3',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
101
|
-
{
|
|
102
|
-
variant: 'button',
|
|
103
|
-
buttonProps: {
|
|
104
|
-
variant: 'theme',
|
|
105
|
-
label: 'annotate',
|
|
106
|
-
value: 'provided-1',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
variant: 'button',
|
|
111
|
-
buttonProps: {
|
|
112
|
-
variant: 'theme',
|
|
113
|
-
label: 'trash',
|
|
114
|
-
value: 'provided-2',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
variant: 'button',
|
|
119
|
-
buttonProps: {
|
|
120
|
-
variant: 'theme',
|
|
121
|
-
label: 'formula-ai',
|
|
122
|
-
value: 'provided-3',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: () => { }, buttons: [
|
|
126
|
-
{
|
|
127
|
-
variant: 'element',
|
|
128
|
-
element: (_jsx(ToolbarButton, { icon: "fc-y-axis", label: "Popover", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: _jsx("div", { className: "tw-text-sm dark:tw-text-white", children: _jsx("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2", children: "Flavors" }) }) })),
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
variant: 'element',
|
|
132
|
-
element: (_jsx(ToolbarButton, { icon: "fc-trash", label: "Trash", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: _jsx("div", { className: "tw-text-sm dark:tw-text-white", children: _jsx("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2", children: "Flavors" }) }) })),
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
variant: 'element',
|
|
136
|
-
element: (_jsx(ToolbarButton, { icon: "fc-formula-ai", label: "Formula", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: _jsx("div", { className: "tw-text-sm dark:tw-text-white", children: _jsx("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2", children: "Flavors" }) }) })),
|
|
137
|
-
},
|
|
138
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { buttons: [
|
|
139
|
-
{
|
|
140
|
-
variant: 'button',
|
|
141
|
-
buttonProps: {
|
|
142
|
-
size: 'sm',
|
|
143
|
-
icon: 'fc-annotate',
|
|
144
|
-
value: 'left',
|
|
145
|
-
isActive: true,
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
variant: 'button',
|
|
150
|
-
buttonProps: {
|
|
151
|
-
size: 'sm',
|
|
152
|
-
icon: 'fc-trash',
|
|
153
|
-
value: 'center',
|
|
154
|
-
isActive: false,
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
variant: 'button',
|
|
159
|
-
buttonProps: {
|
|
160
|
-
size: 'sm',
|
|
161
|
-
icon: 'fc-formula-ai',
|
|
162
|
-
value: 'right',
|
|
163
|
-
isActive: false,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
] }) })
|
|
167
|
-
] }), _jsxs("div", { className: "tw-dark tw-bg-sq-dark-background", children: [
|
|
168
|
-
_jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
169
|
-
{
|
|
170
|
-
variant: 'button',
|
|
171
|
-
buttonProps: {
|
|
172
|
-
variant: 'outline',
|
|
173
|
-
icon: 'fc-annotate',
|
|
174
|
-
iconStyle: 'theme',
|
|
175
|
-
value: 'provided-1',
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
variant: 'button',
|
|
180
|
-
buttonProps: {
|
|
181
|
-
variant: 'outline',
|
|
182
|
-
icon: 'fc-trash',
|
|
183
|
-
iconStyle: 'theme',
|
|
184
|
-
value: 'provided-2',
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
variant: 'button',
|
|
189
|
-
buttonProps: {
|
|
190
|
-
variant: 'outline',
|
|
191
|
-
icon: 'fc-formula-ai',
|
|
192
|
-
iconStyle: 'theme',
|
|
193
|
-
value: 'provided-3',
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
197
|
-
{
|
|
198
|
-
variant: 'button',
|
|
199
|
-
buttonProps: {
|
|
200
|
-
variant: 'no-border',
|
|
201
|
-
icon: 'fc-annotate',
|
|
202
|
-
iconStyle: 'theme',
|
|
203
|
-
value: 'provided-1',
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
variant: 'button',
|
|
208
|
-
buttonProps: {
|
|
209
|
-
variant: 'no-border',
|
|
210
|
-
icon: 'fc-trash',
|
|
211
|
-
iconStyle: 'theme',
|
|
212
|
-
value: 'provided-2',
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
variant: 'button',
|
|
217
|
-
buttonProps: {
|
|
218
|
-
variant: 'no-border',
|
|
219
|
-
icon: 'fc-formula-ai',
|
|
220
|
-
iconStyle: 'theme',
|
|
221
|
-
value: 'provided-3',
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
225
|
-
{
|
|
226
|
-
variant: 'button',
|
|
227
|
-
buttonProps: {
|
|
228
|
-
variant: 'theme',
|
|
229
|
-
icon: 'fc-annotate',
|
|
230
|
-
iconStyle: 'white',
|
|
231
|
-
value: 'provided-1',
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
variant: 'button',
|
|
236
|
-
buttonProps: {
|
|
237
|
-
variant: 'theme',
|
|
238
|
-
icon: 'fc-trash',
|
|
239
|
-
iconStyle: 'white',
|
|
240
|
-
value: 'provided-2',
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
variant: 'button',
|
|
245
|
-
buttonProps: {
|
|
246
|
-
variant: 'theme',
|
|
247
|
-
icon: 'fc-formula-ai',
|
|
248
|
-
iconStyle: 'white',
|
|
249
|
-
value: 'provided-3',
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: (newValue) => setValue(newValue), buttons: [
|
|
253
|
-
{
|
|
254
|
-
variant: 'button',
|
|
255
|
-
buttonProps: {
|
|
256
|
-
variant: 'theme',
|
|
257
|
-
label: 'annotate',
|
|
258
|
-
value: 'provided-1',
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
variant: 'button',
|
|
263
|
-
buttonProps: {
|
|
264
|
-
variant: 'theme',
|
|
265
|
-
label: 'trash',
|
|
266
|
-
value: 'provided-2',
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
variant: 'button',
|
|
271
|
-
buttonProps: {
|
|
272
|
-
variant: 'theme',
|
|
273
|
-
label: 'formula-ai',
|
|
274
|
-
value: 'provided-3',
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { onChange: () => { }, buttons: [
|
|
278
|
-
{
|
|
279
|
-
variant: 'element',
|
|
280
|
-
element: (_jsx(ToolbarButton, { icon: "fc-y-axis", label: "Popover", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: _jsx("div", { className: "tw-text-sm dark:tw-text-white", children: _jsx("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2", children: "Flavors" }) }) })),
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
variant: 'element',
|
|
284
|
-
element: (_jsx(ToolbarButton, { icon: "fc-trash", label: "Trash", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: _jsx("div", { className: "tw-text-sm dark:tw-text-white", children: _jsx("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2", children: "Flavors" }) }) })),
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
variant: 'element',
|
|
288
|
-
element: (_jsx(ToolbarButton, { icon: "fc-formula-ai", label: "Formula", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: _jsx("div", { className: "tw-text-sm dark:tw-text-white", children: _jsx("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2", children: "Flavors" }) }) })),
|
|
289
|
-
},
|
|
290
|
-
] }) }), _jsx("div", { className: "tw-p-4", children: _jsx(ButtonGroup, { buttons: [
|
|
291
|
-
{
|
|
292
|
-
variant: 'button',
|
|
293
|
-
buttonProps: {
|
|
294
|
-
size: 'sm',
|
|
295
|
-
icon: 'fc-annotate',
|
|
296
|
-
value: 'left',
|
|
297
|
-
isActive: true,
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
variant: 'button',
|
|
302
|
-
buttonProps: {
|
|
303
|
-
size: 'sm',
|
|
304
|
-
icon: 'fc-trash',
|
|
305
|
-
value: 'center',
|
|
306
|
-
isActive: false,
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
variant: 'button',
|
|
311
|
-
buttonProps: {
|
|
312
|
-
size: 'sm',
|
|
313
|
-
icon: 'fc-formula-ai',
|
|
314
|
-
value: 'right',
|
|
315
|
-
isActive: false,
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
] }) })
|
|
319
|
-
] })
|
|
320
|
-
] }));
|
|
321
|
-
return (_jsxs("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4", children: [
|
|
322
|
-
_jsx(QTip, {}), _jsxs("div", { className: "color_topic", children: [
|
|
323
|
-
_jsx("b", { children: "Topic Colors" }), renderAllVariations()] }), _jsxs("div", { className: "color_analysis", children: [
|
|
324
|
-
_jsx("b", { children: "Analysis Colors" }), renderAllVariations()] }), _jsxs("div", { className: "color_datalab", children: [
|
|
325
|
-
_jsx("b", { children: "Datalab Colors" }), renderAllVariations()] }), _jsxs("div", { className: "color_vantage", children: [
|
|
326
|
-
_jsx("b", { children: "Vantage Colors" }), renderAllVariations()] })
|
|
327
|
-
] }));
|
|
328
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
-
import { ButtonGroup } from './ButtonGroup';
|
|
4
|
-
describe('ButtonGroup', () => {
|
|
5
|
-
const mockOnChange = jest.fn();
|
|
6
|
-
const defaultProps = {
|
|
7
|
-
id: 'test-id',
|
|
8
|
-
extraClassNames: 'extra-class',
|
|
9
|
-
testId: 'button-group',
|
|
10
|
-
onChange: mockOnChange,
|
|
11
|
-
buttons: [
|
|
12
|
-
{
|
|
13
|
-
variant: 'button',
|
|
14
|
-
buttonProps: {
|
|
15
|
-
testId: 'button1',
|
|
16
|
-
value: 'button1',
|
|
17
|
-
variant: 'outline',
|
|
18
|
-
extraClassNames: 'button-class',
|
|
19
|
-
isActive: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
variant: 'button',
|
|
24
|
-
buttonProps: {
|
|
25
|
-
testId: 'button2',
|
|
26
|
-
value: 'button2',
|
|
27
|
-
variant: 'theme',
|
|
28
|
-
extraClassNames: 'button-class',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
variant: 'element',
|
|
33
|
-
element: _jsx("span", { children: "Custom Element" }, "custom-element"),
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
};
|
|
37
|
-
it('renders ButtonGroup with buttons and custom elements', () => {
|
|
38
|
-
const { getByTestId } = render(_jsx(ButtonGroup, { ...defaultProps }));
|
|
39
|
-
const buttonGroup = getByTestId('button-group');
|
|
40
|
-
expect(buttonGroup).toBeInTheDocument();
|
|
41
|
-
expect(buttonGroup).toHaveClass('tw-flex tw-outline-none tw-w-full tw-relative tw-flex-wrap extra-class');
|
|
42
|
-
const button1 = getByTestId('button1');
|
|
43
|
-
expect(button1).toBeInTheDocument();
|
|
44
|
-
expect(button1).toHaveClass('button-class');
|
|
45
|
-
const button2 = getByTestId('button2');
|
|
46
|
-
expect(button2).toBeInTheDocument();
|
|
47
|
-
expect(button2).toHaveClass('button-class');
|
|
48
|
-
});
|
|
49
|
-
it('calls onChange when a button is clicked', () => {
|
|
50
|
-
const { getByTestId } = render(_jsx(ButtonGroup, { ...defaultProps }));
|
|
51
|
-
const button1 = getByTestId('button1');
|
|
52
|
-
fireEvent.click(button1);
|
|
53
|
-
expect(mockOnChange).toHaveBeenCalledWith('button1');
|
|
54
|
-
const button2 = getByTestId('button2');
|
|
55
|
-
fireEvent.click(button2);
|
|
56
|
-
expect(mockOnChange).toHaveBeenCalledWith('button2');
|
|
57
|
-
});
|
|
58
|
-
it('applies active classes based on value and variant', () => {
|
|
59
|
-
const { getByTestId } = render(_jsx(ButtonGroup, { ...defaultProps }));
|
|
60
|
-
const button1 = getByTestId('button1');
|
|
61
|
-
expect(button1).toHaveClass('!tw-bg-sq-disabled-gray tw-border-sq-color-dark');
|
|
62
|
-
const button2 = getByTestId('button2');
|
|
63
|
-
expect(button2).not.toHaveClass('tw-bg-sq-color-highlight');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ButtonGroup as default } from './ButtonGroup';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import { getQTipData } from '../Tooltip/qTip.utilities';
|
|
5
|
-
const borderStyles = [
|
|
6
|
-
'tw-border-solid',
|
|
7
|
-
'tw-border',
|
|
8
|
-
'tw-rounded-popover',
|
|
9
|
-
'tw-border-sq-disabled-gray',
|
|
10
|
-
'dark:tw-border-gray-500',
|
|
11
|
-
].join(' ');
|
|
12
|
-
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
13
|
-
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
14
|
-
const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames = '', contentExtraClassNames = '', containerTestId, disabled = false, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, onContainerClick, ...tooltipProps }) => {
|
|
15
|
-
const tooltipData = getQTipData(tooltipProps);
|
|
16
|
-
return (_jsxs(DropdownMenu.Root, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [
|
|
17
|
-
_jsx(DropdownMenu.Trigger, { id: id, className: `tw-border-none focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none`, disabled: disabled, children: _jsx("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none ${disabled ? disabledClasses : ''} ${extraClassNames}`, children: triggerIcon }) }), _jsx(DropdownMenu.Portal, { children: _jsx(DropdownMenu.Content, { onClick: onContainerClick, sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, onCloseAutoFocus: (e) => !setFocusOnTriggerOnClose && e.preventDefault(), className: "focus-visible:tw-outline-none tw-outline-none", children: _jsxs("div", { "data-testid": containerTestId, className: `${bgStyles} tw-relative tw-z-[1200] tw-min-w-6 tw-py-2 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out forceFont data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade ${borderStyles} ${contentExtraClassNames}`, children: [hasArrow && (_jsx(DropdownMenu.Arrow, { asChild: true, children: _jsx("div", { className: " tw-fill-transparent tw-bg-white tw-w-[15px] tw-h-[15px] 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 tw-mt-[-7px]" }) })), dropdownItems.map((item, index) => {
|
|
18
|
-
const tooltipData = getQTipData(item);
|
|
19
|
-
if (item.isLabel) {
|
|
20
|
-
return (_jsxs(DropdownMenu.Label, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (_jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })), _jsx("div", { "data-testid": item.labelTestId, className: `tw-text-[0.8125rem] tw-ml-1 ${item.disabled ? 'tw-text-sq-disabled-gray' : 'tw-text-sq-text-color dark:tw-text-sq-white'} tw-not-italic tw-font-normal ${item.labelClasses}`, children: item.label })
|
|
21
|
-
] }, (item.id || '') + index));
|
|
22
|
-
}
|
|
23
|
-
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
24
|
-
return (_jsxs(DropdownMenu.Sub, { children: [
|
|
25
|
-
_jsxs(DropdownMenu.SubTrigger, { id: id, className: `tw-cursor-pointer tw-flex tw-justify-between dark:tw-text-sq-white hover:tw-bg-sq-gray-highlight dark:hover:tw-bg-sq-gray-highlight-dark tw-leading-none tw-items-center tw-h-[27px] tw-pl-[19px] tw-relative tw-select-none tw-outline-none data-[disabled]:tw-pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, ...tooltipData, children: [
|
|
26
|
-
_jsxs("div", { className: "tw-flex", children: [item.icon && (_jsx(Icon, { icon: item.icon, extraClassNames: `tw-w-[18px] ${item.disabled
|
|
27
|
-
? '!tw-text-sq-disabled-gray'
|
|
28
|
-
: 'tw-text-sq-text-color dark:tw-text-sq-white'} ${item.iconExtraClassNames || ''}` })), _jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw-text-[0.8125rem] tw-ml-1 ${item.disabled && '!tw-opacity-30'} tw-not-italic tw-font-semibold ${item.labelClasses}`, children: item.label })
|
|
29
|
-
] }), _jsx(Icon, { small: true, icon: "fc-arrow-dropdown -tw-rotate-90", extraClassNames: `${item.disabled ? 'tw-text-sq-disabled-gray' : 'tw-text-sq-text-color dark:tw-text-sq-white'} tw-w-[18px] tw-ml-4 tw-text-[0.5rem] tw-justify-center tw-flex` })
|
|
30
|
-
] }), _jsx(DropdownMenu.Portal, { children: _jsx(DropdownMenu.SubContent, { className: "focus-visible:tw-outline-none tw-outline-none", children: _jsx("div", { "data-testid": containerTestId, className: `${bgStyles} tw-relative tw-z-[1000] tw-min-w-6 tw-py-2 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out forceFont data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade ${borderStyles}`, children: item.subMenuItems.map((subItem, subIndex) => {
|
|
31
|
-
return (_jsxs(DropdownMenu.Item, { onSelect: subItem.onClick, "data-qtip-text": subItem.tooltip, className: "tw-cursor-pointer tw-flex dark:tw-text-sq-white hover:tw-bg-sq-gray-highlight dark:hover:tw-bg-sq-gray-highlight-dark tw-leading-none tw-items-center tw-h-[27px] tw-px-[19px] tw-relative tw-select-none tw-outline-none data-[disabled]:tw-pointer-events-none", disabled: subItem.disabled, children: [subItem.iconClass && (_jsx(Icon, { icon: subItem.iconClass, type: "text", extraClassNames: `tw-w-[18px] ${item.disabled && '!tw-opacity-30'}` })), _jsx("div", { className: `tw-text-[0.8125rem] tw-ml-1 ${subItem.disabled
|
|
32
|
-
? 'tw-text-sq-disabled-gray'
|
|
33
|
-
: 'tw-text-sq-text-color dark:tw-text-sq-white'} tw-not-italic tw-font-normal ${item.labelClasses}`, children: subItem.label })
|
|
34
|
-
] }, subItem.label + subIndex));
|
|
35
|
-
}) }) }) })
|
|
36
|
-
] }, (item.id || item.icon || '') + index));
|
|
37
|
-
}
|
|
38
|
-
return (_jsxs("div", { ...tooltipData, children: [
|
|
39
|
-
_jsxs(DropdownMenu.Item, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
40
|
-
item.onClick(e);
|
|
41
|
-
}, className: `tw-cursor-pointer tw-flex dark:tw-text-sq-white hover:tw-bg-sq-gray-highlight dark:hover:tw-bg-sq-gray-highlight-dark tw-leading-none tw-items-center tw-min-h-[27px] tw-px-[19px] tw-relative tw-select-none tw-outline-none data-[disabled]:tw-pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, children: [item.icon && (_jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw-w-[18px] ${item.disabled && '!tw-opacity-30'} ${item.iconExtraClassNames || ''}` })), _jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw-text-[0.8125rem] tw-ml-1 ${item.disabled ? 'tw-text-sq-disabled-gray' : 'tw-text-sq-text-color dark:tw-text-sq-white'} tw-not-italic tw-font-normal ${item.labelClasses || ''}`, children: item.label })
|
|
42
|
-
] }, (item.id || item.icon || '') + index), item.hasDivider && (_jsx(DropdownMenu.Separator, { "data-testid": `dropdown-divider-${index}`, className: "tw-h-[1px] tw-bg-sq-disabled-gray dark:tw-bg-gray-500 tw-my-[8px]" }))] }, (item.id || '') + index));
|
|
43
|
-
})] }) }) })
|
|
44
|
-
] }));
|
|
45
|
-
};
|
|
46
|
-
export default ButtonWithDropdown;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import ButtonWithDropdown from './ButtonWithDropdown';
|
|
4
|
-
import Icon from '../Icon';
|
|
5
|
-
import { QTip } from '../Tooltip/Qtip';
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Button with Dropdown',
|
|
8
|
-
};
|
|
9
|
-
export const AllButtonWithDropdownVariants = () => {
|
|
10
|
-
const [openDropdown, setOpenDropdown] = React.useState('');
|
|
11
|
-
const allButtonWithDropdowns = (color, isDark) => (_jsxs("div", { className: isDark ? 'tw-dark tw-bg-sq-dark-background' : '', children: [
|
|
12
|
-
_jsx("div", { className: "tw-p-5 ", children: _jsx(ButtonWithDropdown, { onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-1-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-1-${color}-${isDark ? 'dark' : 'light'}`, triggerIcon: _jsx(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
|
-
] }) }), _jsx("div", { className: "tw-p-5 ", children: _jsx(ButtonWithDropdown, { triggerIcon: _jsx(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: [
|
|
24
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
25
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
26
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
27
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
28
|
-
], containerTestId: "basic-dropdown1", tooltip: "This is a normal dropdown.", tooltipDelay: 0, tooltipPlacement: "top" }) }), _jsxs("div", { className: "tw-p-5 ", children: [
|
|
29
|
-
_jsx("div", { className: "dark:tw-text-white tw-text-xs", children: "Dropdown with arrow" }), _jsx(ButtonWithDropdown, { triggerIcon: _jsx(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: [
|
|
30
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
31
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
32
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
33
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
34
|
-
], containerTestId: "basic-dropdown1", hasArrow: true, tooltip: "This is a normal dropdown aligned to the end", tooltipDelay: 0, tooltipPlacement: "top" })
|
|
35
|
-
] }), _jsxs("div", { className: "tw-p-5 ", children: [
|
|
36
|
-
_jsx("div", { className: "dark:tw-text-white tw-text-xs", children: "Dropdown aligned at center" }), _jsx(ButtonWithDropdown, { triggerIcon: _jsx(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: [
|
|
37
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
38
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
39
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
40
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
41
|
-
], containerTestId: "basic-dropdown1", hasArrow: true, tooltip: "This is a normal dropdown aligned to the center", align: "center", tooltipDelay: 0, tooltipPlacement: "top" })
|
|
42
|
-
] }), _jsxs("div", { className: "tw-p-5 ", children: [
|
|
43
|
-
_jsx("div", { className: "dark:tw-text-white tw-text-xs", children: "Dropdown aligned at start" }), _jsx(ButtonWithDropdown, { triggerIcon: _jsx(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: [
|
|
44
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
45
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
46
|
-
{ label: 'Guava', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), hasDivider: true },
|
|
47
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
48
|
-
], containerTestId: "basic-dropdown1", hasArrow: true, tooltip: "This is a normal dropdown aligned to the center", align: "start", tooltipDelay: 0, tooltipPlacement: "top" })
|
|
49
|
-
] }), _jsx("div", { className: "tw-p-5 ", children: _jsx(ButtonWithDropdown, { triggerIcon: _jsx(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 }) }), _jsx("div", { className: "tw-p-5 ", children: _jsx(ButtonWithDropdown, { onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-7-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-7-${color}-${isDark ? 'dark' : 'light'}`, triggerIcon: _jsx(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: [
|
|
50
|
-
{ label: 'Orange', icon: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
51
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
52
|
-
{
|
|
53
|
-
label: 'Guava',
|
|
54
|
-
icon: 'fc-user-community',
|
|
55
|
-
onClick: () => setOpenDropdown(''),
|
|
56
|
-
tooltipDelay: 0,
|
|
57
|
-
tooltip: 'This is a guava',
|
|
58
|
-
subMenuItems: [
|
|
59
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
60
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
61
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
65
|
-
{
|
|
66
|
-
label: 'Cashew',
|
|
67
|
-
icon: 'fc-user-community',
|
|
68
|
-
disabled: true,
|
|
69
|
-
onClick: () => setOpenDropdown(''),
|
|
70
|
-
subMenuItems: [
|
|
71
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
72
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
73
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
] }) }), _jsx("div", { className: "tw-p-5 ", children: _jsx(ButtonWithDropdown, { onOpenChange: (isOpen) => setOpenDropdown(isOpen ? `dropdown-8-${color}-${isDark ? 'dark' : 'light'}` : ''), isOpen: openDropdown === `dropdown-8-${color}-${isDark ? 'dark' : 'light'}`, triggerIcon: _jsx(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: [
|
|
77
|
-
{
|
|
78
|
-
label: (_jsxs("div", { children: [
|
|
79
|
-
_jsx("h5", { children: "Label heading" }), _jsx("p", { children: "Label description" }), _jsx("p", { children: "Dropdown is my work" }), _jsx("p", { children: "I do it happily" }), _jsx("p", { children: "Final remards" }), _jsx("p", { children: "Thank you" })
|
|
80
|
-
] })),
|
|
81
|
-
icon: 'fc-data-file',
|
|
82
|
-
onClick: () => setOpenDropdown(''),
|
|
83
|
-
},
|
|
84
|
-
{ label: 'Mango', icon: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
85
|
-
{
|
|
86
|
-
label: 'Guava',
|
|
87
|
-
icon: 'fc-user-community',
|
|
88
|
-
onClick: () => setOpenDropdown(''),
|
|
89
|
-
tooltipDelay: 0,
|
|
90
|
-
tooltip: 'This is a guava',
|
|
91
|
-
subMenuItems: [
|
|
92
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
93
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
94
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
{ label: 'Banana', icon: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
98
|
-
{
|
|
99
|
-
label: 'Cashew',
|
|
100
|
-
icon: 'fc-user-community',
|
|
101
|
-
disabled: true,
|
|
102
|
-
onClick: () => setOpenDropdown(''),
|
|
103
|
-
subMenuItems: [
|
|
104
|
-
{ label: 'Orange', iconClass: 'fc-data-file', onClick: () => setOpenDropdown('') },
|
|
105
|
-
{ label: 'Mango', iconClass: 'fc-user-community', onClick: () => setOpenDropdown('') },
|
|
106
|
-
{ label: 'Apple', iconClass: 'fc-user-community', onClick: () => setOpenDropdown(''), disabled: true },
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
] }) })
|
|
110
|
-
] }));
|
|
111
|
-
const renderAllVariations = (color) => (_jsxs("div", { className: "tw-grid tw-grid-cols-2 tw-gap-4 tw-p-4", children: [allButtonWithDropdowns(color), allButtonWithDropdowns(color, true)] }));
|
|
112
|
-
return (_jsxs("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4", children: [
|
|
113
|
-
_jsx(QTip, {}), _jsxs("div", { className: "color_topic", children: [
|
|
114
|
-
_jsx("b", { children: "Topic Colors" }), renderAllVariations('topic')] }), _jsxs("div", { className: "color_analysis", children: [
|
|
115
|
-
_jsx("b", { children: "Analysis Colors" }), renderAllVariations('analysis')] }), _jsxs("div", { className: "color_datalab", children: [
|
|
116
|
-
_jsx("b", { children: "Datalab Colors" }), renderAllVariations('datalab')] }), _jsxs("div", { className: "color_vantage", children: [
|
|
117
|
-
_jsx("b", { children: "Vantage Colors" }), renderAllVariations('vantage')] })
|
|
118
|
-
] }));
|
|
119
|
-
};
|