@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.esm.js
CHANGED
|
@@ -32,7 +32,7 @@ const browserName = browserId && browserId.split(' ', 2)[0];
|
|
|
32
32
|
browserId && parseInt(browserId.split(' ', 2)[1], 10);
|
|
33
33
|
const browserIsFirefox = browserId && browserName === 'Firefox';
|
|
34
34
|
|
|
35
|
-
const DEFAULT_TOOL_TIP_DELAY = 500;
|
|
35
|
+
const DEFAULT_TOOL_TIP_DELAY = process.env.NODE_ENV === 'test' ? 10 : 500;
|
|
36
36
|
const tooltipPositions = ['top', 'left', 'right', 'bottom'];
|
|
37
37
|
|
|
38
38
|
const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
|
|
@@ -102,8 +102,8 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
102
102
|
* - use "variant" to achieve the desired style
|
|
103
103
|
* - include tooltips and/or icons
|
|
104
104
|
*/
|
|
105
|
-
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, }) => {
|
|
106
|
-
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';
|
|
105
|
+
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 }) => {
|
|
106
|
+
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';
|
|
107
107
|
const baseClassesByVariant = {
|
|
108
108
|
'outline': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
109
109
|
'theme': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
@@ -134,7 +134,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
134
134
|
'outline': 'tw:bg-white tw:border-sq-disabled-gray',
|
|
135
135
|
'theme': 'tw:bg-sq-theme-dark tw:border-sq-theme-dark',
|
|
136
136
|
'danger': '',
|
|
137
|
-
'theme-light': 'tw:bg-sq-theme-icon',
|
|
137
|
+
'theme-light': 'tw:bg-sq-theme-icon tw:border-sq-theme-icon',
|
|
138
138
|
'no-border': '',
|
|
139
139
|
'warning': '',
|
|
140
140
|
};
|
|
@@ -149,20 +149,28 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
149
149
|
const activeClassesByVariantLightTheme = {
|
|
150
150
|
'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' +
|
|
151
151
|
' tw:active:border-sq-theme-dark',
|
|
152
|
-
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight'
|
|
153
|
-
|
|
154
|
-
'
|
|
155
|
-
|
|
156
|
-
'
|
|
152
|
+
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight tw:focus:bg-sq-theme-darker ' +
|
|
153
|
+
'tw:focus:border-sq-theme-darker tw:active:bg-sq-theme-darker tw:active:border-sq-theme-darker',
|
|
154
|
+
'danger': 'tw:hover:bg-sq-danger-hover tw:hover:border-sq-danger-hover tw:focus:bg-sq-danger-hover ' +
|
|
155
|
+
'tw:focus:border-sq-danger-hover tw:active:bg-sq-danger tw:active:border-sq-danger',
|
|
156
|
+
'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 ' +
|
|
157
|
+
'tw:active:bg-sq-theme-darker tw:active:border-sq-theme-darker',
|
|
158
|
+
'no-border': 'tw:hover:bg-sq-light-gray tw:focus:bg-sq-light-gray tw:active:bg-sq-light-gray',
|
|
159
|
+
'warning': 'tw:hover:bg-sq-warning-hover tw:hover:border-sq-warning-hover tw:focus:bg-sq-warning-hover ' +
|
|
160
|
+
'tw:focus:border-sq-warning-hover tw:active:bg-sq-warning tw:active:border-sq-warning',
|
|
157
161
|
};
|
|
158
162
|
const activeClassesByVariantDarkTheme = {
|
|
159
163
|
'outline': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-multi-gray-dark' +
|
|
160
164
|
' tw:dark:active:bg-sq-multi-gray-dark tw:dark:focus:border-sq-theme-dark tw:dark:active:border-sq-theme-dark',
|
|
161
|
-
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight'
|
|
162
|
-
|
|
163
|
-
'
|
|
164
|
-
|
|
165
|
-
'
|
|
165
|
+
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight tw:dark:focus:bg-sq-theme-darker ' +
|
|
166
|
+
'tw:dark:focus:border-sq-theme-darker tw:dark:active:bg-sq-theme-darker tw:dark:active:border-sq-theme-darker',
|
|
167
|
+
'danger': 'tw:dark:hover:bg-sq-danger-hover tw:dark:hover:border-sq-danger-hover tw:dark:focus:bg-sq-danger-hover ' +
|
|
168
|
+
'tw:dark:focus:border-sq-danger-hover tw:dark:active:bg-sq-danger tw:dark:active:border-sq-danger',
|
|
169
|
+
'theme-light': 'tw:dark:hover:bg-sq-theme-link tw:dark:hover:border-sq-theme-link tw:dark:focus:bg-sq-theme-darker ' +
|
|
170
|
+
'tw:dark:focus:border-sq-theme-darker tw:dark:active:bg-sq-theme-darker tw:dark:active:border-sq-theme-darker',
|
|
171
|
+
'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',
|
|
172
|
+
'warning': 'tw:dark:hover:bg-sq-warning-hover tw:dark:hover:border-sq-warning-hover tw:dark:focus:bg-sq-warning-hover ' +
|
|
173
|
+
'tw:dark:focus:border-sq-warning-hover tw:dark:active:bg-sq-warning tw:dark:active:border-sq-warning',
|
|
166
174
|
};
|
|
167
175
|
const sizeClasses = {
|
|
168
176
|
xs: 'tw:text-xs tw:py-0.5',
|
|
@@ -187,7 +195,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
187
195
|
const iconElement = icon && (jsx$1(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label
|
|
188
196
|
? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}`
|
|
189
197
|
: '', testId: `${id}_spinner` }));
|
|
190
|
-
return (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) => {
|
|
198
|
+
return (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) => {
|
|
191
199
|
stopPropagation && e.stopPropagation();
|
|
192
200
|
if (!disabled) {
|
|
193
201
|
onClick?.(e);
|
|
@@ -14614,7 +14622,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14614
14622
|
titleIconElement = jsx$1("div", { className: "tw:mt-1.5", children: titleIcon });
|
|
14615
14623
|
}
|
|
14616
14624
|
}
|
|
14617
|
-
return (jsxs(Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsx$1("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsx$1(Fragment, {}), jsx$1(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsx$1(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsx$1("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : (customHeader ?? (jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxs("div", { className: "tw:flex tw:items-center", children: [jsx$1("h3", { children: title }), titleSuffixLabel && jsx$1("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsx$1("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] }))) }), titleIcon && titleIconPosition === 'right' ? jsx$1("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsx$1(Fragment, {})] }));
|
|
14625
|
+
return (jsxs(Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsx$1("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsx$1(Fragment, {}), jsx$1(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsx$1(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsx$1("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : ((customHeader ?? (jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxs("div", { className: "tw:flex tw:items-center", children: [jsx$1("h3", { children: title }), titleSuffixLabel && jsx$1("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsx$1("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] })))) }), titleIcon && titleIconPosition === 'right' ? jsx$1("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsx$1(Fragment, {})] }));
|
|
14618
14626
|
};
|
|
14619
14627
|
return open ? (jsx$1(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: 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!`, {
|
|
14620
14628
|
'tw:max-w-xs': size === 'xs',
|
|
@@ -16647,18 +16655,23 @@ const borderStyles$1 = [
|
|
|
16647
16655
|
'tw:dark:border-gray-500',
|
|
16648
16656
|
].join(' ');
|
|
16649
16657
|
const bgStyles$1 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16650
|
-
const
|
|
16651
|
-
const
|
|
16652
|
-
|
|
16653
|
-
|
|
16658
|
+
const ButtonWithDropdown = (props) => {
|
|
16659
|
+
const { label, variant = 'outline', size = 'sm', icon, iconStyle = 'text', iconColor, iconPosition = 'left', iconPrefix, extraClassNames = '', testId, id, disabled = false, ...tooltipProps } = props;
|
|
16660
|
+
return (jsx$1(Dropdown, { ...props, children: jsx$1(Trigger, { asChild: true, id: id, disabled: disabled, children: jsx$1(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: {
|
|
16661
|
+
delay: tooltipProps.tooltipDelay,
|
|
16662
|
+
position: tooltipProps.tooltipPlacement,
|
|
16663
|
+
} }) }) }));
|
|
16664
|
+
};
|
|
16665
|
+
const Dropdown = ({ dropdownItems, id, children, contentExtraClassNames = '', containerTestId, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, onContainerClick, }) => {
|
|
16666
|
+
return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [children, jsx$1(Portal2, { children: jsx$1(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: 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 && (jsx$1(Arrow2, { asChild: true, children: jsx$1("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) => {
|
|
16654
16667
|
const tooltipData = getQTipData(item);
|
|
16655
16668
|
if (item.isLabel) {
|
|
16656
16669
|
return (jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsx$1(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" })), jsx$1("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));
|
|
16657
16670
|
}
|
|
16658
16671
|
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
16659
|
-
return (jsxs(Sub2, { children: [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: [jsxs("div", { className: "tw:flex", children: [item.icon && (jsx$1(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16660
|
-
|
|
16661
|
-
|
|
16672
|
+
return (jsxs(Sub2, { children: [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: [jsxs("div", { className: "tw:flex", children: [item.icon && (jsx$1("div", { className: "tw:min-w-5", children: jsx$1(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16673
|
+
? 'tw:text-sq-disabled-gray!'
|
|
16674
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} ${item.iconExtraClassNames || ''}` }) })), jsx$1("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 })] }), jsx$1("div", { className: "tw:flex tw:justify-center tw:items-center", children: jsx$1(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` }) })] }), jsx$1(Portal2, { children: jsx$1(SubContent2, { className: "tw:focus-visible:outline-none tw:outline-none", children: jsx$1("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) => {
|
|
16662
16675
|
return (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 && (jsx$1(Icon, { icon: subItem.iconClass, type: "text", extraClassNames: `tw:w-4.5 ${item.disabled && 'tw:opacity-30!'}` })), jsx$1("div", { className: `tw:text-sq-13 tw:ml-1 ${subItem.disabled
|
|
16663
16676
|
? 'tw:text-sq-disabled-gray'
|
|
16664
16677
|
: 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: subItem.label })] }, subItem.label + subIndex));
|
|
@@ -16666,10 +16679,17 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames =
|
|
|
16666
16679
|
}
|
|
16667
16680
|
return (jsxs("div", { ...tooltipData, children: [jsxs(Item2, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
16668
16681
|
item.onClick(e);
|
|
16669
|
-
}, 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 && (jsx$1(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 || ''}` })), jsx$1("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 && (jsx$1(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));
|
|
16682
|
+
}, 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 && (jsx$1("div", { className: "tw:min-w-5", children: jsx$1(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 || ''}` }) })), jsx$1("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 && (jsx$1(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));
|
|
16670
16683
|
})] }) }) })] }));
|
|
16671
16684
|
};
|
|
16672
16685
|
|
|
16686
|
+
const disabledClasses$1 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16687
|
+
const TriggerWithDropdown = (props) => {
|
|
16688
|
+
const { triggerIcon, id, extraClassNames = '', disabled = false, ...tooltipProps } = props;
|
|
16689
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
16690
|
+
return (jsx$1(Dropdown, { ...props, children: jsx$1(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: jsx$1("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 }) }) }));
|
|
16691
|
+
};
|
|
16692
|
+
|
|
16673
16693
|
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' +
|
|
16674
16694
|
' tw:border-solid tw:border tw:text-sm tw:flex tw:flex-col tw:justify-center tw:items-center';
|
|
16675
16695
|
const darkTheme$1 = 'tw:dark:bg-sq-theme-hover-dark tw:dark:text-sq-text-color-dark';
|
|
@@ -16727,9 +16747,10 @@ const SvgIcon = ({ onClick, icon, color, type = 'default', extraClassNames, view
|
|
|
16727
16747
|
const SeeqActionDropdownItem = (item) => {
|
|
16728
16748
|
let renderIcon = jsx$1(Fragment, {});
|
|
16729
16749
|
if (item.icon) {
|
|
16730
|
-
renderIcon = isSvgIcon(item.icon) ? (jsx$1(SvgIcon, { icon: item.icon, extraClassNames: item.iconExtraClassNames + 'tw:p-1 tw:h-
|
|
16750
|
+
renderIcon = isSvgIcon(item.icon) ? (jsx$1(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 })) : (jsx$1(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 }));
|
|
16731
16751
|
}
|
|
16732
|
-
return (jsxs("div", { className: "tw:flex-
|
|
16752
|
+
return (jsxs("div", { className: "tw:flex-row tw:flex tw:p-2.5 tw:pl-5 tw:w-150 tw:gap-4", children: [jsx$1("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' +
|
|
16753
|
+
' tw:mt-1.5', item.iconContainerExtraClassNames), children: renderIcon }), jsxs("div", { className: "tw:flex tw:flex-col tw:justify-center", children: [jsx$1("div", { className: "tw:text-[20px] tw:font-semibold", children: item.display }), jsx$1("div", { className: "tw:text-sq-13 tw:leading-4", children: item.text })] })] }));
|
|
16733
16754
|
};
|
|
16734
16755
|
const ViewWorkbench = (item) => {
|
|
16735
16756
|
let renderIcon = jsx$1(Fragment, {});
|
|
@@ -16766,9 +16787,11 @@ const renderItem = (variant, item) => {
|
|
|
16766
16787
|
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 }) => {
|
|
16767
16788
|
const tooltipData = getQTipData(tooltipProps);
|
|
16768
16789
|
return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsx$1(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: jsx$1("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 }) }), jsx$1(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: jsxs("div", { "data-testid": containerTestId, className: bgStyles +
|
|
16769
|
-
' tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:
|
|
16770
|
-
' tw:
|
|
16771
|
-
'
|
|
16790
|
+
' tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:shadow-[0_4px_8px_rgba(0,0,0,0.2)]' +
|
|
16791
|
+
' tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in' +
|
|
16792
|
+
' tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade' +
|
|
16793
|
+
' tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade' +
|
|
16794
|
+
' tw:data-[side=left]:animate-slideRightAndFade ' +
|
|
16772
16795
|
borderStyles, children: [hasArrow && (jsx$1(Arrow2, { asChild: true, children: jsx$1("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) => {
|
|
16773
16796
|
return (jsxs("div", { children: [jsx$1(Item2, { onSelect: (e) => {
|
|
16774
16797
|
item.action(e);
|
|
@@ -29180,14 +29203,19 @@ var tinycolor$1 = {exports: {}};
|
|
|
29180
29203
|
var tinycolorExports = tinycolor$1.exports;
|
|
29181
29204
|
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
29182
29205
|
|
|
29206
|
+
const PROGRESS_BAR_ANIMATION_CONFIG = {
|
|
29207
|
+
duration: 660,
|
|
29208
|
+
easing: 'ease-in-out',
|
|
29209
|
+
fill: 'forwards',
|
|
29210
|
+
};
|
|
29183
29211
|
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';
|
|
29184
29212
|
const ProgressIndicator = (props) => {
|
|
29185
29213
|
const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
|
|
29186
29214
|
const tooltipData = getQTipData(tooltipProps);
|
|
29187
29215
|
const previousWidth = useRef(0);
|
|
29216
|
+
const animationRef = useRef(null);
|
|
29188
29217
|
const indicatorElementRef = useRef(null);
|
|
29189
29218
|
const [textColorClass, setTextColorClass] = React__default.useState('');
|
|
29190
|
-
const [animatedWidth, setAnimatedWidth] = React__default.useState(previousWidth.current);
|
|
29191
29219
|
// Determine which corners to round based on position and total value
|
|
29192
29220
|
let roundedCorners = '';
|
|
29193
29221
|
if (totalValue >= max) {
|
|
@@ -29208,16 +29236,35 @@ const ProgressIndicator = (props) => {
|
|
|
29208
29236
|
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
29209
29237
|
}
|
|
29210
29238
|
}
|
|
29211
|
-
useEffect(() => {
|
|
29212
|
-
const timeout = setTimeout(() => {
|
|
29213
|
-
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29214
|
-
setAnimatedWidth(newWidth);
|
|
29215
|
-
previousWidth.current = newWidth;
|
|
29216
|
-
}, 100);
|
|
29217
|
-
return () => clearTimeout(timeout);
|
|
29218
|
-
}, [value]);
|
|
29219
29239
|
const bgColor = color || undefined;
|
|
29220
29240
|
const bgClass = color ? '' : 'tw:bg-sq-theme-dark';
|
|
29241
|
+
const indicatorTestId = testId ? `progress-bar-indicator-${testId}` : 'progress-bar-indicator';
|
|
29242
|
+
useEffect(() => {
|
|
29243
|
+
if (!indicatorElementRef.current) {
|
|
29244
|
+
return;
|
|
29245
|
+
}
|
|
29246
|
+
function cleanupAnimation() {
|
|
29247
|
+
if (animationRef.current) {
|
|
29248
|
+
animationRef.current.cancel();
|
|
29249
|
+
animationRef.current = null;
|
|
29250
|
+
}
|
|
29251
|
+
}
|
|
29252
|
+
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29253
|
+
const oldWidth = previousWidth.current;
|
|
29254
|
+
cleanupAnimation();
|
|
29255
|
+
indicatorElementRef.current.style.width = `${newWidth}%`;
|
|
29256
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
29257
|
+
if (!prefersReducedMotion && newWidth !== oldWidth) {
|
|
29258
|
+
animationRef.current = indicatorElementRef.current.animate([{ width: `${oldWidth}%` }, { width: `${newWidth}%` }], PROGRESS_BAR_ANIMATION_CONFIG);
|
|
29259
|
+
}
|
|
29260
|
+
previousWidth.current = newWidth;
|
|
29261
|
+
return () => cleanupAnimation();
|
|
29262
|
+
}, [value, max]);
|
|
29263
|
+
useEffect(() => {
|
|
29264
|
+
if (indicatorElementRef.current) {
|
|
29265
|
+
computeTextClass(indicatorElementRef.current);
|
|
29266
|
+
}
|
|
29267
|
+
}, [color]);
|
|
29221
29268
|
const computeTextClass = (elem) => {
|
|
29222
29269
|
const computedStyle = getComputedStyle(elem);
|
|
29223
29270
|
const backgroundColor = computedStyle.backgroundColor;
|
|
@@ -29226,17 +29273,11 @@ const ProgressIndicator = (props) => {
|
|
|
29226
29273
|
: 'tw:text-sq-text-color tw:dark:text-sq-text-color';
|
|
29227
29274
|
setTextColorClass(textColorClass);
|
|
29228
29275
|
};
|
|
29229
|
-
|
|
29230
|
-
if (indicatorElementRef.current) {
|
|
29231
|
-
computeTextClass(indicatorElementRef.current);
|
|
29232
|
-
}
|
|
29233
|
-
}, [!!indicatorElementRef.current]);
|
|
29234
|
-
return (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: {
|
|
29276
|
+
return (jsx$1(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: {
|
|
29235
29277
|
// Background color will default to the theme color if undefined
|
|
29236
29278
|
backgroundColor: bgColor,
|
|
29237
|
-
|
|
29238
|
-
|
|
29239
|
-
} }, label ? (jsx$1("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined));
|
|
29279
|
+
width: `${previousWidth.current}%`,
|
|
29280
|
+
}, children: label ? (jsx$1("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined }));
|
|
29240
29281
|
};
|
|
29241
29282
|
const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
|
|
29242
29283
|
const totalValue = values.reduce((acc, { value }) => acc + value, 0);
|
|
@@ -29269,11 +29310,15 @@ const ButtonGroup = (props) => {
|
|
|
29269
29310
|
const { id, extraClassNames = '', testId, onChange, buttons = [], ...tooltipProps } = props;
|
|
29270
29311
|
const tooltipData = getQTipData(tooltipProps);
|
|
29271
29312
|
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
29272
|
-
return (jsx$1("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
29273
|
-
|
|
29274
|
-
|
|
29275
|
-
|
|
29276
|
-
|
|
29313
|
+
return (jsx$1("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons.filter(Boolean).map((item, index) => {
|
|
29314
|
+
if (item?.variant === 'button') {
|
|
29315
|
+
const { isActive, ...buttonPropsWithoutIsActive } = item.buttonProps;
|
|
29316
|
+
return (jsx$1(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
|
|
29317
|
+
? `${activeClassesByVariantLightTheme[item.buttonProps.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item.buttonProps.variant ?? 'outline']} `
|
|
29318
|
+
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item.buttonProps.value) }, index));
|
|
29319
|
+
}
|
|
29320
|
+
return item?.element;
|
|
29321
|
+
}) }));
|
|
29277
29322
|
};
|
|
29278
29323
|
|
|
29279
29324
|
/**
|
|
@@ -29376,5 +29421,5 @@ const svgIconTypes = [...iconTypes, 'default'];
|
|
|
29376
29421
|
|
|
29377
29422
|
const toolbarButtonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
|
|
29378
29423
|
|
|
29379
|
-
export { Accordion, Alert, Button, ButtonGroup, ButtonWithDropdown, ButtonWithPopover, Carousel, Checkbox, Collapse, DEFAULT_TOOL_TIP_DELAY, Icon, InputGroup, Modal, ProgressBar, QTip, SeeqActionDropdown, Select, components as SelectComponents, Slider, Tabs, TextArea, TextField, ToolbarButton, Tooltip, buttonSizes, buttonTypes, buttonVariants, iconPositions, iconTypes, svgIconTypes, toolbarButtonVariants, tooltipPositions };
|
|
29424
|
+
export { Accordion, Alert, Button, ButtonGroup, ButtonWithDropdown, ButtonWithPopover, Carousel, Checkbox, Collapse, DEFAULT_TOOL_TIP_DELAY, Icon, InputGroup, Modal, ProgressBar, QTip, SeeqActionDropdown, Select, components as SelectComponents, Slider, Tabs, TextArea, TextField, ToolbarButton, Tooltip, TriggerWithDropdown, buttonSizes, buttonTypes, buttonVariants, iconPositions, iconTypes, svgIconTypes, toolbarButtonVariants, tooltipPositions };
|
|
29380
29425
|
//# sourceMappingURL=index.esm.js.map
|