@seeqdev/qomponents 0.0.194 → 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.
Files changed (69) hide show
  1. package/dist/example/{.eslintrc.cjs → .eslintrc.js} +1 -1
  2. package/dist/index.esm.js +90 -48
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +90 -47
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/Button/Button.d.ts +2 -1
  7. package/dist/src/Button/Button.types.d.ts +4 -4
  8. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.d.ts +1 -0
  9. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +14 -21
  10. package/dist/src/Icon/Icon.types.d.ts +1 -1
  11. package/dist/src/SvgIcon/SvgIcon.types.d.ts +1 -1
  12. package/dist/src/ToolbarButton/ToolbarButton.types.d.ts +1 -1
  13. package/dist/src/Tooltip/Tooltip.types.d.ts +2 -2
  14. package/dist/src/TriggerWithDropdown/TriggerWithDropdown.d.ts +4 -0
  15. package/dist/src/TriggerWithDropdown/TriggerWithDropdown.types.d.ts +102 -0
  16. package/dist/src/TriggerWithDropdown/index.d.ts +1 -0
  17. package/dist/src/index.d.ts +2 -0
  18. package/dist/src/test-utils/is-browser-mode.d.ts +10 -0
  19. package/dist/src/types.d.ts +1 -0
  20. package/dist/styles.css +227 -12
  21. package/package.json +20 -12
  22. package/dist/src/Accordion/Accordion.stories.d.ts +0 -5
  23. package/dist/src/Accordion/Accordion.test.d.ts +0 -1
  24. package/dist/src/Alert/Alert.stories.d.ts +0 -14
  25. package/dist/src/Alert/Alert.test.d.ts +0 -1
  26. package/dist/src/Button/Button.stories.d.ts +0 -9
  27. package/dist/src/Button/Button.test.d.ts +0 -1
  28. package/dist/src/ButtonGroup/ButtonGroup.stories.d.ts +0 -5
  29. package/dist/src/ButtonGroup/ButtonGroup.test.d.ts +0 -1
  30. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +0 -5
  31. package/dist/src/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +0 -1
  32. package/dist/src/ButtonWithPopover/ButtonWithPopover.stories.d.ts +0 -5
  33. package/dist/src/ButtonWithPopover/ButtonWithPopover.test.d.ts +0 -1
  34. package/dist/src/Carousel/Carousel.stories.d.ts +0 -5
  35. package/dist/src/Carousel/Carousel.test.d.ts +0 -1
  36. package/dist/src/Checkbox/Checkbox.stories.d.ts +0 -5
  37. package/dist/src/Checkbox/Checkbox.test.d.ts +0 -1
  38. package/dist/src/Collapse/Collapse.stories.d.ts +0 -5
  39. package/dist/src/Collapse/Collapse.test.d.ts +0 -1
  40. package/dist/src/Icon/Icon.stories.d.ts +0 -5
  41. package/dist/src/Icon/Icon.test.d.ts +0 -1
  42. package/dist/src/InputGroup/InputGroup.stories.d.ts +0 -5
  43. package/dist/src/InputGroup/InputGroup.test.d.ts +0 -1
  44. package/dist/src/Modal/Modal.stories.d.ts +0 -10
  45. package/dist/src/Modal/Modal.test.d.ts +0 -1
  46. package/dist/src/ProgressBar/ProgressBar.stories.d.ts +0 -5
  47. package/dist/src/ProgressBar/ProgressBar.test.d.ts +0 -1
  48. package/dist/src/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +0 -5
  49. package/dist/src/SeeqActionDropdown/SeeqActionDropdown.test.d.ts +0 -1
  50. package/dist/src/Select/Select.stories.d.ts +0 -5
  51. package/dist/src/Select/Select.test.d.ts +0 -1
  52. package/dist/src/Slider/Slider.stories.d.ts +0 -5
  53. package/dist/src/Slider/Slider.test.d.ts +0 -1
  54. package/dist/src/SvgIcon/SvgIcon.stories.d.ts +0 -5
  55. package/dist/src/SvgIcon/SvgIcon.test.d.ts +0 -1
  56. package/dist/src/Tabs/Tabs.stories.d.ts +0 -5
  57. package/dist/src/Tabs/Tabs.test.d.ts +0 -1
  58. package/dist/src/TextArea/TextArea.stories.d.ts +0 -5
  59. package/dist/src/TextArea/TextArea.test.d.ts +0 -1
  60. package/dist/src/TextField/TextField.stories.d.ts +0 -5
  61. package/dist/src/TextField/TextField.test.d.ts +0 -1
  62. package/dist/src/ToolbarButton/ToolbarButton.stories.d.ts +0 -5
  63. package/dist/src/ToolbarButton/ToolbarButton.test.d.ts +0 -1
  64. package/dist/src/Tooltip/QTip.stories.d.ts +0 -6
  65. package/dist/src/Tooltip/QTipPerformance.stories.d.ts +0 -5
  66. package/dist/src/Tooltip/Tooltip.stories.d.ts +0 -5
  67. package/dist/src/Tooltip/TooltipPerformance.stories.d.ts +0 -5
  68. package/dist/src/setupTests.d.ts +0 -1
  69. package/dist/src/utils/validateStyleDimension.test.d.ts +0 -1
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  env: { browser: true, es2020: true },
3
3
  extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'],
4
4
  parser: '@typescript-eslint/parser',
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
- 'danger': 'tw:hover:bg-sq-bg-danger tw:hover:border-sq-bg-danger',
154
- 'theme-light': 'tw:hover:bg-sq-link tw:hover:border-sq-link',
155
- 'no-border': '',
156
- 'warning': '',
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
- 'danger': 'tw:dark:hover:bg-sq-bg-danger tw:dark:hover:border-sq-bg-danger',
163
- 'theme-light': 'tw:dark:hover:bg-sq-link-dark tw:dark:hover:border-sq-link-dark',
164
- 'no-border': '',
165
- 'warning': '',
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 disabledClasses$1 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
16651
- const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames = '', contentExtraClassNames = '', containerTestId, disabled = false, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, onContainerClick, ...tooltipProps }) => {
16652
- const tooltipData = getQTipData(tooltipProps);
16653
- return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, 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 }) }), 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) => {
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
- ? 'tw:text-sq-disabled-gray!'
16661
- : '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(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:w-4.5 tw:ml-4 tw:text-2 tw:justify-center tw:flex` })] }), 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) => {
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';
@@ -29180,14 +29200,19 @@ var tinycolor$1 = {exports: {}};
29180
29200
  var tinycolorExports = tinycolor$1.exports;
29181
29201
  var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
29182
29202
 
29203
+ const PROGRESS_BAR_ANIMATION_CONFIG = {
29204
+ duration: 660,
29205
+ easing: 'ease-in-out',
29206
+ fill: 'forwards',
29207
+ };
29183
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';
29184
29209
  const ProgressIndicator = (props) => {
29185
29210
  const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
29186
29211
  const tooltipData = getQTipData(tooltipProps);
29187
29212
  const previousWidth = useRef(0);
29213
+ const animationRef = useRef(null);
29188
29214
  const indicatorElementRef = useRef(null);
29189
29215
  const [textColorClass, setTextColorClass] = React__default.useState('');
29190
- const [animatedWidth, setAnimatedWidth] = React__default.useState(previousWidth.current);
29191
29216
  // Determine which corners to round based on position and total value
29192
29217
  let roundedCorners = '';
29193
29218
  if (totalValue >= max) {
@@ -29208,16 +29233,35 @@ const ProgressIndicator = (props) => {
29208
29233
  roundedCorners = 'tw:rounded-l-[0.9375rem]';
29209
29234
  }
29210
29235
  }
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
29236
  const bgColor = color || undefined;
29220
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]);
29221
29265
  const computeTextClass = (elem) => {
29222
29266
  const computedStyle = getComputedStyle(elem);
29223
29267
  const backgroundColor = computedStyle.backgroundColor;
@@ -29226,17 +29270,11 @@ const ProgressIndicator = (props) => {
29226
29270
  : 'tw:text-sq-text-color tw:dark:text-sq-text-color';
29227
29271
  setTextColorClass(textColorClass);
29228
29272
  };
29229
- useEffect(() => {
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: {
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: {
29235
29274
  // Background color will default to the theme color if undefined
29236
29275
  backgroundColor: bgColor,
29237
- animation: 'width 660ms forwards',
29238
- width: `${animatedWidth}%`,
29239
- } }, 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 }));
29240
29278
  };
29241
29279
  const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
29242
29280
  const totalValue = values.reduce((acc, { value }) => acc + value, 0);
@@ -29269,11 +29307,15 @@ const ButtonGroup = (props) => {
29269
29307
  const { id, extraClassNames = '', testId, onChange, buttons = [], ...tooltipProps } = props;
29270
29308
  const tooltipData = getQTipData(tooltipProps);
29271
29309
  const appliedClasses = `${baseClasses} ${extraClassNames}`;
29272
- return (jsx$1("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
29273
- .filter(Boolean)
29274
- .map((item, index) => item?.variant === 'button' ? (jsx$1(Button, { ...item.buttonProps, 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 ${item.buttonProps?.isActive
29275
- ? `${activeClassesByVariantLightTheme[item?.buttonProps?.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item?.buttonProps?.variant ?? 'outline']} `
29276
- : ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) }, index)) : (item?.element)) }));
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
+ }) }));
29277
29319
  };
29278
29320
 
29279
29321
  /**
@@ -29376,5 +29418,5 @@ const svgIconTypes = [...iconTypes, 'default'];
29376
29418
 
29377
29419
  const toolbarButtonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
29378
29420
 
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 };
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 };
29380
29422
  //# sourceMappingURL=index.esm.js.map