@seeqdev/qomponents 0.0.194 → 0.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/example/{.eslintrc.cjs → .eslintrc.js} +1 -1
- package/dist/index.esm.js +98 -53
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +98 -52
- package/dist/index.js.map +1 -1
- package/dist/src/Button/Button.d.ts +2 -1
- package/dist/src/Button/Button.types.d.ts +4 -4
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.d.ts +1 -0
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +14 -21
- package/dist/src/Icon/Icon.types.d.ts +1 -1
- package/dist/src/SvgIcon/SvgIcon.types.d.ts +1 -1
- package/dist/src/ToolbarButton/ToolbarButton.types.d.ts +1 -1
- package/dist/src/Tooltip/Tooltip.types.d.ts +2 -2
- package/dist/src/TriggerWithDropdown/TriggerWithDropdown.d.ts +4 -0
- package/dist/src/TriggerWithDropdown/TriggerWithDropdown.types.d.ts +102 -0
- package/dist/src/TriggerWithDropdown/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/test-utils/is-browser-mode.d.ts +10 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/styles.css +246 -25
- package/package.json +20 -12
- package/dist/src/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/src/Accordion/Accordion.test.d.ts +0 -1
- package/dist/src/Alert/Alert.stories.d.ts +0 -14
- package/dist/src/Alert/Alert.test.d.ts +0 -1
- package/dist/src/Button/Button.stories.d.ts +0 -9
- package/dist/src/Button/Button.test.d.ts +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.stories.d.ts +0 -5
- package/dist/src/ButtonGroup/ButtonGroup.test.d.ts +0 -1
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +0 -5
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +0 -1
- package/dist/src/ButtonWithPopover/ButtonWithPopover.stories.d.ts +0 -5
- package/dist/src/ButtonWithPopover/ButtonWithPopover.test.d.ts +0 -1
- package/dist/src/Carousel/Carousel.stories.d.ts +0 -5
- package/dist/src/Carousel/Carousel.test.d.ts +0 -1
- package/dist/src/Checkbox/Checkbox.stories.d.ts +0 -5
- package/dist/src/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/src/Collapse/Collapse.stories.d.ts +0 -5
- package/dist/src/Collapse/Collapse.test.d.ts +0 -1
- package/dist/src/Icon/Icon.stories.d.ts +0 -5
- package/dist/src/Icon/Icon.test.d.ts +0 -1
- package/dist/src/InputGroup/InputGroup.stories.d.ts +0 -5
- package/dist/src/InputGroup/InputGroup.test.d.ts +0 -1
- package/dist/src/Modal/Modal.stories.d.ts +0 -10
- package/dist/src/Modal/Modal.test.d.ts +0 -1
- package/dist/src/ProgressBar/ProgressBar.stories.d.ts +0 -5
- package/dist/src/ProgressBar/ProgressBar.test.d.ts +0 -1
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +0 -5
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.test.d.ts +0 -1
- package/dist/src/Select/Select.stories.d.ts +0 -5
- package/dist/src/Select/Select.test.d.ts +0 -1
- package/dist/src/Slider/Slider.stories.d.ts +0 -5
- package/dist/src/Slider/Slider.test.d.ts +0 -1
- package/dist/src/SvgIcon/SvgIcon.stories.d.ts +0 -5
- package/dist/src/SvgIcon/SvgIcon.test.d.ts +0 -1
- package/dist/src/Tabs/Tabs.stories.d.ts +0 -5
- package/dist/src/Tabs/Tabs.test.d.ts +0 -1
- package/dist/src/TextArea/TextArea.stories.d.ts +0 -5
- package/dist/src/TextArea/TextArea.test.d.ts +0 -1
- package/dist/src/TextField/TextField.stories.d.ts +0 -5
- package/dist/src/TextField/TextField.test.d.ts +0 -1
- package/dist/src/ToolbarButton/ToolbarButton.stories.d.ts +0 -5
- package/dist/src/ToolbarButton/ToolbarButton.test.d.ts +0 -1
- package/dist/src/Tooltip/QTip.stories.d.ts +0 -6
- package/dist/src/Tooltip/QTipPerformance.stories.d.ts +0 -5
- package/dist/src/Tooltip/Tooltip.stories.d.ts +0 -5
- package/dist/src/Tooltip/TooltipPerformance.stories.d.ts +0 -5
- package/dist/src/setupTests.d.ts +0 -1
- package/dist/src/utils/validateStyleDimension.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ const browserName = browserId && browserId.split(' ', 2)[0];
|
|
|
52
52
|
browserId && parseInt(browserId.split(' ', 2)[1], 10);
|
|
53
53
|
const browserIsFirefox = browserId && browserName === 'Firefox';
|
|
54
54
|
|
|
55
|
-
const DEFAULT_TOOL_TIP_DELAY = 500;
|
|
55
|
+
const DEFAULT_TOOL_TIP_DELAY = process.env.NODE_ENV === 'test' ? 10 : 500;
|
|
56
56
|
const tooltipPositions = ['top', 'left', 'right', 'bottom'];
|
|
57
57
|
|
|
58
58
|
const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
|
|
@@ -122,8 +122,8 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
122
122
|
* - use "variant" to achieve the desired style
|
|
123
123
|
* - include tooltips and/or icons
|
|
124
124
|
*/
|
|
125
|
-
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, iconPosition = 'left', iconPrefix = undefined, preventBlur = false, isHtmlTooltip = false, tooltipTestId, }) => {
|
|
126
|
-
const baseClasses = 'tw:px-2.5 tw:rounded-md tw:focus:ring-0 tw:focus-visible:outline-none tw:aria-disabled:cursor-not-allowed tw:disabled:pointer-events-none';
|
|
125
|
+
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, iconPosition = 'left', iconPrefix = undefined, preventBlur = false, isHtmlTooltip = false, tooltipTestId, ref, ...rest }) => {
|
|
126
|
+
const baseClasses = 'tw:px-2.5 tw:rounded-md tw:focus:ring-0 tw:focus-visible:outline-none tw:hover:cursor-pointer tw:aria-disabled:cursor-not-allowed tw:disabled:pointer-events-none';
|
|
127
127
|
const baseClassesByVariant = {
|
|
128
128
|
'outline': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
129
129
|
'theme': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
@@ -154,7 +154,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
154
154
|
'outline': 'tw:bg-white tw:border-sq-disabled-gray',
|
|
155
155
|
'theme': 'tw:bg-sq-theme-dark tw:border-sq-theme-dark',
|
|
156
156
|
'danger': '',
|
|
157
|
-
'theme-light': 'tw:bg-sq-theme-icon',
|
|
157
|
+
'theme-light': 'tw:bg-sq-theme-icon tw:border-sq-theme-icon',
|
|
158
158
|
'no-border': '',
|
|
159
159
|
'warning': '',
|
|
160
160
|
};
|
|
@@ -169,20 +169,28 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
169
169
|
const activeClassesByVariantLightTheme = {
|
|
170
170
|
'outline': 'tw:hover:bg-sq-light-gray tw:focus:bg-sq-dark-gray tw:active:bg-sq-dark-gray tw:focus:border-sq-theme-dark' +
|
|
171
171
|
' tw:active:border-sq-theme-dark',
|
|
172
|
-
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight'
|
|
173
|
-
|
|
174
|
-
'
|
|
175
|
-
|
|
176
|
-
'
|
|
172
|
+
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight tw:focus:bg-sq-theme-darker ' +
|
|
173
|
+
'tw:focus:border-sq-theme-darker tw:active:bg-sq-theme-darker tw:active:border-sq-theme-darker',
|
|
174
|
+
'danger': 'tw:hover:bg-sq-danger-hover tw:hover:border-sq-danger-hover tw:focus:bg-sq-danger-hover ' +
|
|
175
|
+
'tw:focus:border-sq-danger-hover tw:active:bg-sq-danger tw:active:border-sq-danger',
|
|
176
|
+
'theme-light': 'tw:hover:bg-sq-theme-link tw:hover:border-sq-theme-link tw:focus:bg-sq-theme-darker tw:focus:border-sq-theme-darker ' +
|
|
177
|
+
'tw:active:bg-sq-theme-darker tw:active:border-sq-theme-darker',
|
|
178
|
+
'no-border': 'tw:hover:bg-sq-light-gray tw:focus:bg-sq-light-gray tw:active:bg-sq-light-gray',
|
|
179
|
+
'warning': 'tw:hover:bg-sq-warning-hover tw:hover:border-sq-warning-hover tw:focus:bg-sq-warning-hover ' +
|
|
180
|
+
'tw:focus:border-sq-warning-hover tw:active:bg-sq-warning tw:active:border-sq-warning',
|
|
177
181
|
};
|
|
178
182
|
const activeClassesByVariantDarkTheme = {
|
|
179
183
|
'outline': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-multi-gray-dark' +
|
|
180
184
|
' tw:dark:active:bg-sq-multi-gray-dark tw:dark:focus:border-sq-theme-dark tw:dark:active:border-sq-theme-dark',
|
|
181
|
-
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight'
|
|
182
|
-
|
|
183
|
-
'
|
|
184
|
-
|
|
185
|
-
'
|
|
185
|
+
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight tw:dark:focus:bg-sq-theme-darker ' +
|
|
186
|
+
'tw:dark:focus:border-sq-theme-darker tw:dark:active:bg-sq-theme-darker tw:dark:active:border-sq-theme-darker',
|
|
187
|
+
'danger': 'tw:dark:hover:bg-sq-danger-hover tw:dark:hover:border-sq-danger-hover tw:dark:focus:bg-sq-danger-hover ' +
|
|
188
|
+
'tw:dark:focus:border-sq-danger-hover tw:dark:active:bg-sq-danger tw:dark:active:border-sq-danger',
|
|
189
|
+
'theme-light': 'tw:dark:hover:bg-sq-theme-link tw:dark:hover:border-sq-theme-link tw:dark:focus:bg-sq-theme-darker ' +
|
|
190
|
+
'tw:dark:focus:border-sq-theme-darker tw:dark:active:bg-sq-theme-darker tw:dark:active:border-sq-theme-darker',
|
|
191
|
+
'no-border': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-highlight-color-dark tw:dark:active:bg-sq-highlight-color-dark',
|
|
192
|
+
'warning': 'tw:dark:hover:bg-sq-warning-hover tw:dark:hover:border-sq-warning-hover tw:dark:focus:bg-sq-warning-hover ' +
|
|
193
|
+
'tw:dark:focus:border-sq-warning-hover tw:dark:active:bg-sq-warning tw:dark:active:border-sq-warning',
|
|
186
194
|
};
|
|
187
195
|
const sizeClasses = {
|
|
188
196
|
xs: 'tw:text-xs tw:py-0.5',
|
|
@@ -207,7 +215,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
207
215
|
const iconElement = icon && (jsxRuntime.jsx(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label
|
|
208
216
|
? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}`
|
|
209
217
|
: '', testId: `${id}_spinner` }));
|
|
210
|
-
return (jsxRuntime.jsxs("button", { id: id, ...tooltipData, disabled: disabled && !tooltip, "aria-disabled": disabled, "data-testid": testId, tabIndex: disabled ? -1 : undefined, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
218
|
+
return (jsxRuntime.jsxs("button", { ...rest, ref: ref, id: id, ...tooltipData, disabled: disabled && !tooltip, "aria-disabled": disabled, "data-testid": testId, tabIndex: disabled ? -1 : undefined, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
211
219
|
stopPropagation && e.stopPropagation();
|
|
212
220
|
if (!disabled) {
|
|
213
221
|
onClick?.(e);
|
|
@@ -14634,7 +14642,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14634
14642
|
titleIconElement = jsxRuntime.jsx("div", { className: "tw:mt-1.5", children: titleIcon });
|
|
14635
14643
|
}
|
|
14636
14644
|
}
|
|
14637
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsxRuntime.jsx("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}), jsxRuntime.jsx(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsxRuntime.jsx(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsxRuntime.jsx("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : (customHeader ?? (jsxRuntime.jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxRuntime.jsxs("div", { className: "tw:flex tw:items-center", children: [jsxRuntime.jsx("h3", { children: title }), titleSuffixLabel && jsxRuntime.jsx("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsxRuntime.jsx("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] }))) }), titleIcon && titleIconPosition === 'right' ? jsxRuntime.jsx("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
14645
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsxRuntime.jsx("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}), jsxRuntime.jsx(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsxRuntime.jsx(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsxRuntime.jsx("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : ((customHeader ?? (jsxRuntime.jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxRuntime.jsxs("div", { className: "tw:flex tw:items-center", children: [jsxRuntime.jsx("h3", { children: title }), titleSuffixLabel && jsxRuntime.jsx("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsxRuntime.jsx("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] })))) }), titleIcon && titleIconPosition === 'right' ? jsxRuntime.jsx("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
14638
14646
|
};
|
|
14639
14647
|
return open ? (jsxRuntime.jsx(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: jsxRuntime.jsxs(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), onInteractOutside: (e) => (onInteractOutside ? onInteractOutside(e) : e.preventDefault()), "data-testid": testId, "aria-describedby": ariaDescribedBy, className: classNames(`modalContent tw:w-full tw:border-none tw:shadow-none tw:dark:text-sq-dark-text tw:gap-0!`, {
|
|
14640
14648
|
'tw:max-w-xs': size === 'xs',
|
|
@@ -16667,18 +16675,23 @@ const borderStyles$1 = [
|
|
|
16667
16675
|
'tw:dark:border-gray-500',
|
|
16668
16676
|
].join(' ');
|
|
16669
16677
|
const bgStyles$1 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16670
|
-
const
|
|
16671
|
-
const
|
|
16672
|
-
|
|
16673
|
-
|
|
16678
|
+
const ButtonWithDropdown = (props) => {
|
|
16679
|
+
const { label, variant = 'outline', size = 'sm', icon, iconStyle = 'text', iconColor, iconPosition = 'left', iconPrefix, extraClassNames = '', testId, id, disabled = false, ...tooltipProps } = props;
|
|
16680
|
+
return (jsxRuntime.jsx(Dropdown, { ...props, children: jsxRuntime.jsx(Trigger, { asChild: true, id: id, disabled: disabled, children: jsxRuntime.jsx(Button, { label: label, variant: variant, size: size, icon: icon, iconStyle: iconStyle, iconColor: iconColor, iconPosition: iconPosition, iconPrefix: iconPrefix, extraClassNames: extraClassNames, testId: testId, disabled: disabled, tooltip: tooltipProps.tooltip, tooltipOptions: {
|
|
16681
|
+
delay: tooltipProps.tooltipDelay,
|
|
16682
|
+
position: tooltipProps.tooltipPlacement,
|
|
16683
|
+
} }) }) }));
|
|
16684
|
+
};
|
|
16685
|
+
const Dropdown = ({ dropdownItems, id, children, contentExtraClassNames = '', containerTestId, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, onContainerClick, }) => {
|
|
16686
|
+
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [children, jsxRuntime.jsx(Portal2, { children: jsxRuntime.jsx(Content2, { onClick: onContainerClick, sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, onCloseAutoFocus: (e) => !setFocusOnTriggerOnClose && e.preventDefault(), className: "tw:focus-visible:outline-none tw:outline-none", children: jsxRuntime.jsxs("div", { "data-testid": containerTestId, className: `${bgStyles$1} tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ${borderStyles$1} ${contentExtraClassNames}`, children: [hasArrow && (jsxRuntime.jsx(Arrow2, { asChild: true, children: jsxRuntime.jsx("div", { className: "tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500 tw:-mt-sq-7" }) })), dropdownItems.map((item, index) => {
|
|
16674
16687
|
const tooltipData = getQTipData(item);
|
|
16675
16688
|
if (item.isLabel) {
|
|
16676
16689
|
return (jsxRuntime.jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw:text-sq-text-color tw:dark:text-sq-white tw:w-4.5" })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: item.label })] }, (item.id || '') + index));
|
|
16677
16690
|
}
|
|
16678
16691
|
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
16679
|
-
return (jsxRuntime.jsxs(Sub2, { children: [jsxRuntime.jsxs(SubTrigger2, { id: id, className: `tw:cursor-pointer tw:flex tw:justify-between tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:pl-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, ...tooltipData, children: [jsxRuntime.jsxs("div", { className: "tw:flex", children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16680
|
-
|
|
16681
|
-
|
|
16692
|
+
return (jsxRuntime.jsxs(Sub2, { children: [jsxRuntime.jsxs(SubTrigger2, { id: id, className: `tw:cursor-pointer tw:flex tw:justify-between tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:pl-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, ...tooltipData, children: [jsxRuntime.jsxs("div", { className: "tw:flex", children: [item.icon && (jsxRuntime.jsx("div", { className: "tw:min-w-5", children: jsxRuntime.jsx(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16693
|
+
? 'tw:text-sq-disabled-gray!'
|
|
16694
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} ${item.iconExtraClassNames || ''}` }) })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled && 'tw:opacity-30!'} tw:not-italic tw:font-semibold ${item.labelClasses}`, children: item.label })] }), jsxRuntime.jsx("div", { className: "tw:flex tw:justify-center tw:items-center", children: jsxRuntime.jsx(Icon, { size: "sm", icon: "fc-arrow-dropdown tw:rotate-270", extraClassNames: `${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:ml-4 tw:mr-2 tw:text-2` }) })] }), jsxRuntime.jsx(Portal2, { children: jsxRuntime.jsx(SubContent2, { className: "tw:focus-visible:outline-none tw:outline-none", children: jsxRuntime.jsx("div", { "data-testid": containerTestId, className: `${bgStyles$1} tw:relative tw:z-[1000] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ${borderStyles$1}`, children: item.subMenuItems.map((subItem, subIndex) => {
|
|
16682
16695
|
return (jsxRuntime.jsxs(Item2, { onSelect: subItem.onClick, "data-qtip-text": subItem.tooltip, className: "tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none", disabled: subItem.disabled, children: [subItem.iconClass && (jsxRuntime.jsx(Icon, { icon: subItem.iconClass, type: "text", extraClassNames: `tw:w-4.5 ${item.disabled && 'tw:opacity-30!'}` })), jsxRuntime.jsx("div", { className: `tw:text-sq-13 tw:ml-1 ${subItem.disabled
|
|
16683
16696
|
? 'tw:text-sq-disabled-gray'
|
|
16684
16697
|
: 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: subItem.label })] }, subItem.label + subIndex));
|
|
@@ -16686,10 +16699,17 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames =
|
|
|
16686
16699
|
}
|
|
16687
16700
|
return (jsxRuntime.jsxs("div", { ...tooltipData, children: [jsxRuntime.jsxs(Item2, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
16688
16701
|
item.onClick(e);
|
|
16689
|
-
}, className: `tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:min-h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw:w-sq-4.5 ${item.disabled && 'tw:opacity-30!'} ${item.iconExtraClassNames || ''}` })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses || ''}`, children: item.label })] }, (item.id || item.icon || '') + index), item.hasDivider && (jsxRuntime.jsx(Separator2, { "data-testid": `dropdown-divider-${index}`, className: "tw:h-px tw:bg-sq-disabled-gray tw:dark:bg-gray-500 tw:my-2" }))] }, (item.id || '') + index));
|
|
16702
|
+
}, className: `tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:min-h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, children: [item.icon && (jsxRuntime.jsx("div", { className: "tw:min-w-5", children: jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw:w-sq-4.5 ${item.disabled && 'tw:opacity-30!'} ${item.iconExtraClassNames || ''}` }) })), jsxRuntime.jsx("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses || ''}`, children: item.label })] }, (item.id || item.icon || '') + index), item.hasDivider && (jsxRuntime.jsx(Separator2, { "data-testid": `dropdown-divider-${index}`, className: "tw:h-px tw:bg-sq-disabled-gray tw:dark:bg-gray-500 tw:my-2" }))] }, (item.id || '') + index));
|
|
16690
16703
|
})] }) }) })] }));
|
|
16691
16704
|
};
|
|
16692
16705
|
|
|
16706
|
+
const disabledClasses$1 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16707
|
+
const TriggerWithDropdown = (props) => {
|
|
16708
|
+
const { triggerIcon, id, extraClassNames = '', disabled = false, ...tooltipProps } = props;
|
|
16709
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
16710
|
+
return (jsxRuntime.jsx(Dropdown, { ...props, children: jsxRuntime.jsx(Trigger, { id: id, className: `tw:bg-transparent tw:border-none tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none`, disabled: disabled, children: jsxRuntime.jsx("div", { ...tooltipData, className: `tw:bg-transparent tw:flex tw:flex-col tw:items-center tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none ${disabled ? disabledClasses$1 : ''} ${extraClassNames}`, children: triggerIcon }) }) }));
|
|
16711
|
+
};
|
|
16712
|
+
|
|
16693
16713
|
const baseClasses$2 = 'tw:mx-auto tw:leading-normal tw:outline-none tw:py-2 tw:px-3 tw:rounded-[10px] tw:w-full tw:relative' +
|
|
16694
16714
|
' tw:border-solid tw:border tw:text-sm tw:flex tw:flex-col tw:justify-center tw:items-center';
|
|
16695
16715
|
const darkTheme$1 = 'tw:dark:bg-sq-theme-hover-dark tw:dark:text-sq-text-color-dark';
|
|
@@ -16747,9 +16767,10 @@ const SvgIcon = ({ onClick, icon, color, type = 'default', extraClassNames, view
|
|
|
16747
16767
|
const SeeqActionDropdownItem = (item) => {
|
|
16748
16768
|
let renderIcon = jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
16749
16769
|
if (item.icon) {
|
|
16750
|
-
renderIcon = isSvgIcon(item.icon) ? (jsxRuntime.jsx(SvgIcon, { icon: item.icon, extraClassNames: item.iconExtraClassNames + 'tw:p-1 tw:h-
|
|
16770
|
+
renderIcon = isSvgIcon(item.icon) ? (jsxRuntime.jsx(SvgIcon, { icon: item.icon, extraClassNames: item.iconExtraClassNames + 'tw:p-1 tw:h-9 tw:w-9 tw:dark:text-sq-white tw:text-5.5! tw:text-sq-white', ...item })) : (jsxRuntime.jsx(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw:dark:text-sq-white tw:text-5.5! tw:text-sq-white tw:min-w-9 ' + item.iconExtraClassNames }));
|
|
16751
16771
|
}
|
|
16752
|
-
return (jsxRuntime.jsxs("div", { className: "tw:flex-
|
|
16772
|
+
return (jsxRuntime.jsxs("div", { className: "tw:flex-row tw:flex tw:p-2.5 tw:pl-5 tw:w-150 tw:gap-4", children: [jsxRuntime.jsx("div", { className: classNames('tw:rounded-[0.1875rem] tw:h-9 tw:w-9 tw:bg-sq-theme-dark tw:flex tw:justify-center tw:items-center' +
|
|
16773
|
+
' tw:mt-1.5', item.iconContainerExtraClassNames), children: renderIcon }), jsxRuntime.jsxs("div", { className: "tw:flex tw:flex-col tw:justify-center", children: [jsxRuntime.jsx("div", { className: "tw:text-[20px] tw:font-semibold", children: item.display }), jsxRuntime.jsx("div", { className: "tw:text-sq-13 tw:leading-4", children: item.text })] })] }));
|
|
16753
16774
|
};
|
|
16754
16775
|
const ViewWorkbench = (item) => {
|
|
16755
16776
|
let renderIcon = jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
@@ -16786,9 +16807,11 @@ const renderItem = (variant, item) => {
|
|
|
16786
16807
|
const SeeqActionDropdown = ({ seeqActionDropdownItems, trigger, id, extraClassNames, containerTestId, disabled = false, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, variant, ...tooltipProps }) => {
|
|
16787
16808
|
const tooltipData = getQTipData(tooltipProps);
|
|
16788
16809
|
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsxRuntime.jsx(Trigger, { id: id, "data-testid": id, className: `tw:border-none tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none`, asChild: true, disabled: disabled, children: jsxRuntime.jsx("div", { ...tooltipData, className: `tw:bg-transparent tw:flex tw:flex-col tw:items-center tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none ${disabled ? disabledClasses : ''} ${extraClassNames || ''}`, children: trigger }) }), jsxRuntime.jsx(Content2, { sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, onCloseAutoFocus: (e) => !setFocusOnTriggerOnClose && e.preventDefault(), className: "tw:focus-visible:outline-none tw:outline-none", children: jsxRuntime.jsxs("div", { "data-testid": containerTestId, className: bgStyles +
|
|
16789
|
-
' tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:
|
|
16790
|
-
' tw:
|
|
16791
|
-
'
|
|
16810
|
+
' tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:shadow-[0_4px_8px_rgba(0,0,0,0.2)]' +
|
|
16811
|
+
' tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in' +
|
|
16812
|
+
' tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade' +
|
|
16813
|
+
' tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade' +
|
|
16814
|
+
' tw:data-[side=left]:animate-slideRightAndFade ' +
|
|
16792
16815
|
borderStyles, children: [hasArrow && (jsxRuntime.jsx(Arrow2, { asChild: true, children: jsxRuntime.jsx("div", { className: " tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500 tw:-mt-sq-7" }) })), seeqActionDropdownItems.map((item, index) => {
|
|
16793
16816
|
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Item2, { onSelect: (e) => {
|
|
16794
16817
|
item.action(e);
|
|
@@ -29200,14 +29223,19 @@ var tinycolor$1 = {exports: {}};
|
|
|
29200
29223
|
var tinycolorExports = tinycolor$1.exports;
|
|
29201
29224
|
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
29202
29225
|
|
|
29226
|
+
const PROGRESS_BAR_ANIMATION_CONFIG = {
|
|
29227
|
+
duration: 660,
|
|
29228
|
+
easing: 'ease-in-out',
|
|
29229
|
+
fill: 'forwards',
|
|
29230
|
+
};
|
|
29203
29231
|
const baseLabelClasses = 'tw:left-1 tw:text-xs tw:text-sq-text-color tw:dark:text-sq-dark-text tw:items-center tw:h-4.5';
|
|
29204
29232
|
const ProgressIndicator = (props) => {
|
|
29205
29233
|
const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
|
|
29206
29234
|
const tooltipData = getQTipData(tooltipProps);
|
|
29207
29235
|
const previousWidth = React.useRef(0);
|
|
29236
|
+
const animationRef = React.useRef(null);
|
|
29208
29237
|
const indicatorElementRef = React.useRef(null);
|
|
29209
29238
|
const [textColorClass, setTextColorClass] = React.useState('');
|
|
29210
|
-
const [animatedWidth, setAnimatedWidth] = React.useState(previousWidth.current);
|
|
29211
29239
|
// Determine which corners to round based on position and total value
|
|
29212
29240
|
let roundedCorners = '';
|
|
29213
29241
|
if (totalValue >= max) {
|
|
@@ -29228,16 +29256,35 @@ const ProgressIndicator = (props) => {
|
|
|
29228
29256
|
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
29229
29257
|
}
|
|
29230
29258
|
}
|
|
29231
|
-
React.useEffect(() => {
|
|
29232
|
-
const timeout = setTimeout(() => {
|
|
29233
|
-
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29234
|
-
setAnimatedWidth(newWidth);
|
|
29235
|
-
previousWidth.current = newWidth;
|
|
29236
|
-
}, 100);
|
|
29237
|
-
return () => clearTimeout(timeout);
|
|
29238
|
-
}, [value]);
|
|
29239
29259
|
const bgColor = color || undefined;
|
|
29240
29260
|
const bgClass = color ? '' : 'tw:bg-sq-theme-dark';
|
|
29261
|
+
const indicatorTestId = testId ? `progress-bar-indicator-${testId}` : 'progress-bar-indicator';
|
|
29262
|
+
React.useEffect(() => {
|
|
29263
|
+
if (!indicatorElementRef.current) {
|
|
29264
|
+
return;
|
|
29265
|
+
}
|
|
29266
|
+
function cleanupAnimation() {
|
|
29267
|
+
if (animationRef.current) {
|
|
29268
|
+
animationRef.current.cancel();
|
|
29269
|
+
animationRef.current = null;
|
|
29270
|
+
}
|
|
29271
|
+
}
|
|
29272
|
+
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29273
|
+
const oldWidth = previousWidth.current;
|
|
29274
|
+
cleanupAnimation();
|
|
29275
|
+
indicatorElementRef.current.style.width = `${newWidth}%`;
|
|
29276
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
29277
|
+
if (!prefersReducedMotion && newWidth !== oldWidth) {
|
|
29278
|
+
animationRef.current = indicatorElementRef.current.animate([{ width: `${oldWidth}%` }, { width: `${newWidth}%` }], PROGRESS_BAR_ANIMATION_CONFIG);
|
|
29279
|
+
}
|
|
29280
|
+
previousWidth.current = newWidth;
|
|
29281
|
+
return () => cleanupAnimation();
|
|
29282
|
+
}, [value, max]);
|
|
29283
|
+
React.useEffect(() => {
|
|
29284
|
+
if (indicatorElementRef.current) {
|
|
29285
|
+
computeTextClass(indicatorElementRef.current);
|
|
29286
|
+
}
|
|
29287
|
+
}, [color]);
|
|
29241
29288
|
const computeTextClass = (elem) => {
|
|
29242
29289
|
const computedStyle = getComputedStyle(elem);
|
|
29243
29290
|
const backgroundColor = computedStyle.backgroundColor;
|
|
@@ -29246,17 +29293,11 @@ const ProgressIndicator = (props) => {
|
|
|
29246
29293
|
: 'tw:text-sq-text-color tw:dark:text-sq-text-color';
|
|
29247
29294
|
setTextColorClass(textColorClass);
|
|
29248
29295
|
};
|
|
29249
|
-
|
|
29250
|
-
if (indicatorElementRef.current) {
|
|
29251
|
-
computeTextClass(indicatorElementRef.current);
|
|
29252
|
-
}
|
|
29253
|
-
}, [!!indicatorElementRef.current]);
|
|
29254
|
-
return (React.createElement(Indicator, { className: `tw:ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw:w-full tw:h-4.5 tw:duration-[660ms] tw:flex tw:justify-center tw:items-center ${valuesLength === 1 ? '' : 'tw:overflow-hidden'} ${roundedCorners} ${bgClass} ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-testid": `progress-bar-indicator-${testId ? testId : value}`, key: `${index}-${value}`, ref: indicatorElementRef, style: {
|
|
29296
|
+
return (jsxRuntime.jsx(Indicator, { className: `tw:w-full tw:h-4.5 tw:flex tw:justify-center tw:items-center ${valuesLength === 1 ? '' : 'tw:overflow-hidden'} ${roundedCorners} ${bgClass} ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-segment-value": value, "data-testid": indicatorTestId, ref: indicatorElementRef, style: {
|
|
29255
29297
|
// Background color will default to the theme color if undefined
|
|
29256
29298
|
backgroundColor: bgColor,
|
|
29257
|
-
|
|
29258
|
-
|
|
29259
|
-
} }, label ? (jsxRuntime.jsx("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined));
|
|
29299
|
+
width: `${previousWidth.current}%`,
|
|
29300
|
+
}, children: label ? (jsxRuntime.jsx("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined }));
|
|
29260
29301
|
};
|
|
29261
29302
|
const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
|
|
29262
29303
|
const totalValue = values.reduce((acc, { value }) => acc + value, 0);
|
|
@@ -29289,11 +29330,15 @@ const ButtonGroup = (props) => {
|
|
|
29289
29330
|
const { id, extraClassNames = '', testId, onChange, buttons = [], ...tooltipProps } = props;
|
|
29290
29331
|
const tooltipData = getQTipData(tooltipProps);
|
|
29291
29332
|
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
29292
|
-
return (jsxRuntime.jsx("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
29293
|
-
|
|
29294
|
-
|
|
29295
|
-
|
|
29296
|
-
|
|
29333
|
+
return (jsxRuntime.jsx("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons.filter(Boolean).map((item, index) => {
|
|
29334
|
+
if (item?.variant === 'button') {
|
|
29335
|
+
const { isActive, ...buttonPropsWithoutIsActive } = item.buttonProps;
|
|
29336
|
+
return (jsxRuntime.jsx(Button, { ...buttonPropsWithoutIsActive, extraClassNames: `tw:-ml-sq-1 tw:focus:z-40 tw:outline-none tw:focus:border tw:rounded-none tw:first:rounded-l-md tw:last:rounded-r-md ${isActive
|
|
29337
|
+
? `${activeClassesByVariantLightTheme[item.buttonProps.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item.buttonProps.variant ?? 'outline']} `
|
|
29338
|
+
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item.buttonProps.value) }, index));
|
|
29339
|
+
}
|
|
29340
|
+
return item?.element;
|
|
29341
|
+
}) }));
|
|
29297
29342
|
};
|
|
29298
29343
|
|
|
29299
29344
|
/**
|
|
@@ -29420,6 +29465,7 @@ exports.TextArea = TextArea;
|
|
|
29420
29465
|
exports.TextField = TextField;
|
|
29421
29466
|
exports.ToolbarButton = ToolbarButton;
|
|
29422
29467
|
exports.Tooltip = Tooltip;
|
|
29468
|
+
exports.TriggerWithDropdown = TriggerWithDropdown;
|
|
29423
29469
|
exports.buttonSizes = buttonSizes;
|
|
29424
29470
|
exports.buttonTypes = buttonTypes;
|
|
29425
29471
|
exports.buttonVariants = buttonVariants;
|