@seeqdev/qomponents 0.0.193 → 0.0.202
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 +106 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +106 -54
- 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 +231 -12
- package/package.json +21 -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);
|
|
@@ -14157,8 +14165,7 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
|
|
|
14157
14165
|
},
|
|
14158
14166
|
placeholder: () => placeholderStyles,
|
|
14159
14167
|
container: ({ selectProps }) => {
|
|
14160
|
-
|
|
14161
|
-
return `${textStyles} ${extraClassNames} ${containerBorderStyles} tw:pointer-events-auto!`;
|
|
14168
|
+
return `${textStyles} ${extraClassNames} tw:pointer-events-auto!`;
|
|
14162
14169
|
},
|
|
14163
14170
|
input: () => textStyles + ' specSelectInput',
|
|
14164
14171
|
menuList: () => menuListStyles,
|
|
@@ -14615,7 +14622,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14615
14622
|
titleIconElement = jsx$1("div", { className: "tw:mt-1.5", children: titleIcon });
|
|
14616
14623
|
}
|
|
14617
14624
|
}
|
|
14618
|
-
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, {})] }));
|
|
14619
14626
|
};
|
|
14620
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!`, {
|
|
14621
14628
|
'tw:max-w-xs': size === 'xs',
|
|
@@ -16648,18 +16655,23 @@ const borderStyles$1 = [
|
|
|
16648
16655
|
'tw:dark:border-gray-500',
|
|
16649
16656
|
].join(' ');
|
|
16650
16657
|
const bgStyles$1 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16651
|
-
const
|
|
16652
|
-
const
|
|
16653
|
-
|
|
16654
|
-
|
|
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) => {
|
|
16655
16667
|
const tooltipData = getQTipData(item);
|
|
16656
16668
|
if (item.isLabel) {
|
|
16657
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));
|
|
16658
16670
|
}
|
|
16659
16671
|
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
16660
|
-
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
|
|
16661
|
-
|
|
16662
|
-
|
|
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) => {
|
|
16663
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
|
|
16664
16676
|
? 'tw:text-sq-disabled-gray'
|
|
16665
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));
|
|
@@ -16667,10 +16679,17 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames =
|
|
|
16667
16679
|
}
|
|
16668
16680
|
return (jsxs("div", { ...tooltipData, children: [jsxs(Item2, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
16669
16681
|
item.onClick(e);
|
|
16670
|
-
}, 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));
|
|
16671
16683
|
})] }) }) })] }));
|
|
16672
16684
|
};
|
|
16673
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
|
+
|
|
16674
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' +
|
|
16675
16694
|
' tw:border-solid tw:border tw:text-sm tw:flex tw:flex-col tw:justify-center tw:items-center';
|
|
16676
16695
|
const darkTheme$1 = 'tw:dark:bg-sq-theme-hover-dark tw:dark:text-sq-text-color-dark';
|
|
@@ -16787,20 +16806,30 @@ const borderColorClasses = [
|
|
|
16787
16806
|
'tw:focus:border-sq-theme-dark',
|
|
16788
16807
|
'tw:active:border-sq-theme-dark',
|
|
16789
16808
|
].join(' ');
|
|
16790
|
-
const
|
|
16791
|
-
const fieldClasses = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3' + 'tw:p-1 tw:border-solid tw:border';
|
|
16809
|
+
const fieldClasses = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3 tw:p-1 tw:border-solid tw:border';
|
|
16792
16810
|
const darkTheme = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-disabled-gray';
|
|
16793
16811
|
const lightTheme = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
|
|
16794
16812
|
/**
|
|
16795
16813
|
* InputGroup.
|
|
16796
16814
|
*/
|
|
16797
16815
|
const InputGroup = React__default.forwardRef((props, ref) => {
|
|
16798
|
-
const { readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, field, maxLength, minLength, ...tooltipProps } = props;
|
|
16816
|
+
const { readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, field, maxLength, minLength, inputGroup, ...tooltipProps } = props;
|
|
16799
16817
|
const tooltipData = getQTipData(tooltipProps);
|
|
16800
16818
|
const appliedClasses = `${baseClasses$1} ${extraClassNames}`;
|
|
16801
|
-
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16802
16819
|
const elementsToAppend = append.filter(Boolean);
|
|
16803
|
-
|
|
16820
|
+
const effectiveInputGroup = inputGroup ?? (elementsToAppend.length > 0 ? 'left' : undefined);
|
|
16821
|
+
const fieldBorderRadius = effectiveInputGroup === 'left'
|
|
16822
|
+
? 'tw:rounded-l-md tw:rounded-r-none'
|
|
16823
|
+
: effectiveInputGroup === 'right'
|
|
16824
|
+
? 'tw:rounded-r-md tw:rounded-l-none'
|
|
16825
|
+
: 'tw:rounded-md';
|
|
16826
|
+
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16827
|
+
// Only pass inputGroup to React components (not DOM elements like div, span, etc.)
|
|
16828
|
+
const isReactComponent = React__default.isValidElement(field) && typeof field.type !== 'string';
|
|
16829
|
+
const fieldWithInputGroup = isReactComponent
|
|
16830
|
+
? React__default.cloneElement(field, { inputGroup: effectiveInputGroup })
|
|
16831
|
+
: field;
|
|
16832
|
+
return (jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsx$1("div", { "data-testid": testId, className: `tw:flex tw:flex-1 tw:cursor-pointer tw:active:z-50 ${fieldAppliedClasses}`, children: fieldWithInputGroup })) : (jsx$1(TextField, { testId: testId, readonly: readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, ref: ref, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, maxLength: maxLength, minLength: minLength, inputGroup: effectiveInputGroup, extraClassNames: `tw:flex tw:flex-1 tw:w-full tw:focus:z-30 ${extraClassNames}`, ...tooltipData })), elementsToAppend.map((item, index) => {
|
|
16804
16833
|
return item?.variant === 'button' ? (jsx$1(Button, { extraClassNames: `$
|
|
16805
16834
|
index ? 'tw:-ml-px' : 'tw:ml-0'
|
|
16806
16835
|
} tw:focus:z-40 tw:focus:border tw:rounded-none tw:last:rounded-r-md`, ...item.buttonProps }, index)) : (jsx$1("div", { className: `${borderColorClasses} ${index ? 'tw:-ml-px' : 'tw:ml-0'} tw:flex tw:items-center tw:justify-center tw:rounded-none tw:last:rounded-r-md tw:active:z-30 tw:active:border tw:border`, children: item?.element }, index));
|
|
@@ -29171,14 +29200,19 @@ var tinycolor$1 = {exports: {}};
|
|
|
29171
29200
|
var tinycolorExports = tinycolor$1.exports;
|
|
29172
29201
|
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
29173
29202
|
|
|
29203
|
+
const PROGRESS_BAR_ANIMATION_CONFIG = {
|
|
29204
|
+
duration: 660,
|
|
29205
|
+
easing: 'ease-in-out',
|
|
29206
|
+
fill: 'forwards',
|
|
29207
|
+
};
|
|
29174
29208
|
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';
|
|
29175
29209
|
const ProgressIndicator = (props) => {
|
|
29176
29210
|
const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
|
|
29177
29211
|
const tooltipData = getQTipData(tooltipProps);
|
|
29178
29212
|
const previousWidth = useRef(0);
|
|
29213
|
+
const animationRef = useRef(null);
|
|
29179
29214
|
const indicatorElementRef = useRef(null);
|
|
29180
29215
|
const [textColorClass, setTextColorClass] = React__default.useState('');
|
|
29181
|
-
const [animatedWidth, setAnimatedWidth] = React__default.useState(previousWidth.current);
|
|
29182
29216
|
// Determine which corners to round based on position and total value
|
|
29183
29217
|
let roundedCorners = '';
|
|
29184
29218
|
if (totalValue >= max) {
|
|
@@ -29199,16 +29233,35 @@ const ProgressIndicator = (props) => {
|
|
|
29199
29233
|
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
29200
29234
|
}
|
|
29201
29235
|
}
|
|
29202
|
-
useEffect(() => {
|
|
29203
|
-
const timeout = setTimeout(() => {
|
|
29204
|
-
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29205
|
-
setAnimatedWidth(newWidth);
|
|
29206
|
-
previousWidth.current = newWidth;
|
|
29207
|
-
}, 100);
|
|
29208
|
-
return () => clearTimeout(timeout);
|
|
29209
|
-
}, [value]);
|
|
29210
29236
|
const bgColor = color || undefined;
|
|
29211
29237
|
const bgClass = color ? '' : 'tw:bg-sq-theme-dark';
|
|
29238
|
+
const indicatorTestId = testId ? `progress-bar-indicator-${testId}` : 'progress-bar-indicator';
|
|
29239
|
+
useEffect(() => {
|
|
29240
|
+
if (!indicatorElementRef.current) {
|
|
29241
|
+
return;
|
|
29242
|
+
}
|
|
29243
|
+
function cleanupAnimation() {
|
|
29244
|
+
if (animationRef.current) {
|
|
29245
|
+
animationRef.current.cancel();
|
|
29246
|
+
animationRef.current = null;
|
|
29247
|
+
}
|
|
29248
|
+
}
|
|
29249
|
+
const newWidth = (Number(value) / Number(max)) * 100;
|
|
29250
|
+
const oldWidth = previousWidth.current;
|
|
29251
|
+
cleanupAnimation();
|
|
29252
|
+
indicatorElementRef.current.style.width = `${newWidth}%`;
|
|
29253
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
29254
|
+
if (!prefersReducedMotion && newWidth !== oldWidth) {
|
|
29255
|
+
animationRef.current = indicatorElementRef.current.animate([{ width: `${oldWidth}%` }, { width: `${newWidth}%` }], PROGRESS_BAR_ANIMATION_CONFIG);
|
|
29256
|
+
}
|
|
29257
|
+
previousWidth.current = newWidth;
|
|
29258
|
+
return () => cleanupAnimation();
|
|
29259
|
+
}, [value, max]);
|
|
29260
|
+
useEffect(() => {
|
|
29261
|
+
if (indicatorElementRef.current) {
|
|
29262
|
+
computeTextClass(indicatorElementRef.current);
|
|
29263
|
+
}
|
|
29264
|
+
}, [color]);
|
|
29212
29265
|
const computeTextClass = (elem) => {
|
|
29213
29266
|
const computedStyle = getComputedStyle(elem);
|
|
29214
29267
|
const backgroundColor = computedStyle.backgroundColor;
|
|
@@ -29217,17 +29270,11 @@ const ProgressIndicator = (props) => {
|
|
|
29217
29270
|
: 'tw:text-sq-text-color tw:dark:text-sq-text-color';
|
|
29218
29271
|
setTextColorClass(textColorClass);
|
|
29219
29272
|
};
|
|
29220
|
-
|
|
29221
|
-
if (indicatorElementRef.current) {
|
|
29222
|
-
computeTextClass(indicatorElementRef.current);
|
|
29223
|
-
}
|
|
29224
|
-
}, [!!indicatorElementRef.current]);
|
|
29225
|
-
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: {
|
|
29273
|
+
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: {
|
|
29226
29274
|
// Background color will default to the theme color if undefined
|
|
29227
29275
|
backgroundColor: bgColor,
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
} }, label ? (jsx$1("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined));
|
|
29276
|
+
width: `${previousWidth.current}%`,
|
|
29277
|
+
}, children: label ? (jsx$1("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined }));
|
|
29231
29278
|
};
|
|
29232
29279
|
const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
|
|
29233
29280
|
const totalValue = values.reduce((acc, { value }) => acc + value, 0);
|
|
@@ -29260,11 +29307,15 @@ const ButtonGroup = (props) => {
|
|
|
29260
29307
|
const { id, extraClassNames = '', testId, onChange, buttons = [], ...tooltipProps } = props;
|
|
29261
29308
|
const tooltipData = getQTipData(tooltipProps);
|
|
29262
29309
|
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
29263
|
-
return (jsx$1("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
29264
|
-
|
|
29265
|
-
|
|
29266
|
-
|
|
29267
|
-
|
|
29310
|
+
return (jsx$1("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons.filter(Boolean).map((item, index) => {
|
|
29311
|
+
if (item?.variant === 'button') {
|
|
29312
|
+
const { isActive, ...buttonPropsWithoutIsActive } = item.buttonProps;
|
|
29313
|
+
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
|
|
29314
|
+
? `${activeClassesByVariantLightTheme[item.buttonProps.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item.buttonProps.variant ?? 'outline']} `
|
|
29315
|
+
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item.buttonProps.value) }, index));
|
|
29316
|
+
}
|
|
29317
|
+
return item?.element;
|
|
29318
|
+
}) }));
|
|
29268
29319
|
};
|
|
29269
29320
|
|
|
29270
29321
|
/**
|
|
@@ -29367,5 +29418,5 @@ const svgIconTypes = [...iconTypes, 'default'];
|
|
|
29367
29418
|
|
|
29368
29419
|
const toolbarButtonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
|
|
29369
29420
|
|
|
29370
|
-
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 };
|
|
29421
|
+
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 };
|
|
29371
29422
|
//# sourceMappingURL=index.esm.js.map
|