@seeqdev/qomponents 0.0.140 → 0.0.142

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.
@@ -30,6 +30,7 @@ export interface ToolbarButtonProps {
30
30
  tooltipTestId?: string;
31
31
  /** options for the tooltip */
32
32
  tooltipOptions?: Omit<TooltipProps, 'text'>;
33
+ /** sets button to disabled */
33
34
  disabled?: boolean;
34
35
  /** function called when the toolbar is clicked on, i.e. for tracking (does not open the popover) */
35
36
  onClick?: (e: MouseEvent) => void;
package/dist/index.esm.js CHANGED
@@ -4539,35 +4539,29 @@ function getSvgIconPath(icon) {
4539
4539
  return isSvgIcon(icon) ? icon.substring(SVG_PATH.length) : '';
4540
4540
  }
4541
4541
 
4542
- const borderStyles$4 = [
4542
+ const popoverBorderStyles = [
4543
4543
  'tw-border-solid',
4544
4544
  'tw-border',
4545
4545
  'tw-rounded-[10px]',
4546
4546
  'tw-border-sq-disabled-gray',
4547
4547
  'dark:tw-border-gray-500',
4548
4548
  ].join(' ');
4549
- const triggerBorderStyles = [
4550
- 'tw-border-solid',
4551
- 'tw-border',
4552
- 'tw-rounded-[10px]',
4553
- 'tw-border-transparent',
4554
- 'hover:tw-border-solid',
4555
- 'hover:tw-border',
4556
- 'hover:tw-rounded-[10px]',
4557
- 'hover:tw-border-sq-darkish-gray',
4558
- 'active:tw-border-sq-color-dark',
4559
- 'dark:hover:tw-border-sq-color-dark-dark',
4560
- 'dark:focus:tw-border-sq-color-dark-dark',
4561
- 'dark:active:tw-border-sq-color-dark-dark',
4549
+ const triggerBackgroundStyles = [
4550
+ 'tw-bg-transparent',
4551
+ 'hover:tw-bg-sq-light-gray',
4552
+ 'active:tw-bg-sq-light-gray',
4553
+ 'dark:tw-bg-transparent',
4554
+ 'dark:hover:tw-bg-sq-field-disabled-gray',
4555
+ 'dark:active:tw-bg-sq-field-disabled-gray',
4562
4556
  ].join(' ');
4563
- const activeBorderStyles = [
4557
+ const activeBackgroundStyles = [
4564
4558
  'active',
4565
- 'tw-border-solid',
4566
- 'tw-border',
4567
- 'tw-rounded-[10px]',
4568
- 'tw-border-sq-color-dark',
4569
- 'active:tw-border-sq-color-dark',
4570
- 'dark:hover:tw-border-sq-color-dark-dark',
4559
+ 'tw-bg-sq-dark-gray',
4560
+ 'hover:tw-bg-sq-dark-gray',
4561
+ 'active:tw-bg-sq-dark-gray',
4562
+ 'dark:tw-bg-sq-field-disabled-gray',
4563
+ 'dark:hover:tw-border-sq-field-disabled-gray',
4564
+ 'dark:active:tw-bg-sq-field-disabled-gray',
4571
4565
  ].join(' ');
4572
4566
  const bgStyles$3 = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
4573
4567
  const disabledClasses$4 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
@@ -4589,10 +4583,10 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
4589
4583
  }
4590
4584
  };
4591
4585
  return (React.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { defaultOpen: false, onOpenChange: onOpenChange },
4592
- React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
4586
+ React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none tw-mx-[1.5px] first:tw-ml-0 last:tw-mr-0 ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
4593
4587
  onClick && onClick(e);
4594
4588
  } },
4595
- React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[5px]'} ${disabled ? disabledClasses$4 : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
4589
+ React.createElement("div", { ...tooltipData, className: `tw-flex tw-flex-col tw-items-center tw-rounded-[10px] ${isSmall ? 'tw-py-[1px] tw-px-1' : 'tw-px-2 tw-py-[5px]'} ${disabled ? disabledClasses$4 : isActive ? activeBackgroundStyles : triggerBackgroundStyles} ${extraClassNames || ''}` },
4596
4590
  React.createElement("span", { className: "tw-nowrap" },
4597
4591
  isPrimaryAnSvg ? (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw-text-sq-text-color dark:tw-text-sq-dark-text ${primaryIconExtraClassNames || ''}`, viewBox: primaryIconViewbox, height: `${iconHeight}px`, width: `${iconWidth}px`, fill: "currentColor", "data-testid": testId },
4598
4592
  React.createElement("path", { d: getSvgIconPath(icon) }))) : (React.createElement(Icon, { icon: icon, testId: "firstIcon", type: "text", large: !isSmall && !label && !secondIcon && !forceSmallIcon, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-dark-text` })),
@@ -4603,7 +4597,7 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
4603
4597
  React.createElement("div", { className: bgStyles$3 +
4604
4598
  ' tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:animate-in data-[state=closed]:animate-out' +
4605
4599
  ' data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2' +
4606
- borderStyles$4 },
4600
+ popoverBorderStyles },
4607
4601
  hasArrow && (React.createElement($cb5cc270b50c6fcd$export$21b07c8f274aebd5, { asChild: true },
4608
4602
  React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[15px] tw-h-[15px] tw-mt-[-7px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-500" }))),
4609
4603
  popoverContent))) : undefined));
@@ -13396,6 +13390,7 @@ const multiValueStyles = [
13396
13390
  *
13397
13391
  */
13398
13392
  const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no matching options', isSearchable = true, creatable = false, isMulti = false, isClearable = false, closeMenuOnSelect = true, id, inputId, menuPortalTarget, getOptionLabel, getSelectedValueLabel, getOptionValue, onChange, menuIsOpen, menuPlacement = 'auto', extraClassNames, inputGroup, filterConfig, filterOption, small = false, isDisabled = false, showError = false, isLoading = false, formatGroupLabel, onRemove, defaultValue, onMenuOpen, onMenuClose, components, onMenuInputFocus, onInputChange, inputValue, }) => {
13393
+ const [isSelectOptionsOpen, setIsSelectOptionsOpen] = React__default.useState(false);
13399
13394
  const getOptionOrSelectedLabel = (option, { context }) => {
13400
13395
  const getSelectedOptionLabel = getSelectedValueLabel ? getSelectedValueLabel : getOptionLabel;
13401
13396
  if (getOptionLabel || getSelectedValueLabel) {
@@ -13451,6 +13446,7 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
13451
13446
  classNames: {
13452
13447
  control: ({ menuIsOpen }) => {
13453
13448
  let border = menuIsOpen ? 'tw-rounded-t-md' : 'tw-rounded-md';
13449
+ setIsSelectOptionsOpen(menuIsOpen);
13454
13450
  // if it's on the left side of the input group make sure the right side is straight and not curved
13455
13451
  if (inputGroup === 'left') {
13456
13452
  border = menuIsOpen ? 'tw-rounded-tl-md' : 'tw-rounded-l-md';
@@ -13462,7 +13458,10 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
13462
13458
  return `${appliedClasses} ${baseClasses$3} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw-pl-2 tw-pr-1' : 'tw-pl-2.5 tw-pr-1.5'}`;
13463
13459
  },
13464
13460
  placeholder: () => placeholderStyles,
13465
- container: () => `${textStyles} ${containerStyles} ${extraClassNames}`,
13461
+ container: () => {
13462
+ const containerBorderStyles = isSelectOptionsOpen ? 'tw-rounded-t-md' : 'tw-rounded-md';
13463
+ return `${textStyles} ${containerStyles} ${extraClassNames} ${containerBorderStyles}`;
13464
+ },
13466
13465
  input: () => textStyles + ' specSelectInput',
13467
13466
  menuList: () => menuListStyles,
13468
13467
  menu: () => menuStyles,
@@ -15985,11 +15984,11 @@ const InputGroup = React__default.forwardRef((props, ref) => {
15985
15984
  const tooltipData = getQTipData(tooltipProps);
15986
15985
  const appliedClasses = `${baseClasses$1} ${extraClassNames}`;
15987
15986
  const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
15987
+ const elementsToAppend = append.filter(Boolean);
15988
15988
  return (React__default.createElement("div", { id: `input-group-${id}`, className: appliedClasses },
15989
- field ? (React__default.createElement("div", { "data-testid": testId, className: `tw-flex tw-flex-1 tw-cursor-pointer active:tw-z-50 ${fieldAppliedClasses}` }, field)) : (React__default.createElement(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, extraClassNames: `tw-flex tw-flex-1 tw-w-full tw-rounded-r-none focus:tw-z-30 ${extraClassNames}`, ...tooltipData })),
15990
- append.filter(Boolean).map((item, index, array) => {
15991
- const isLast = index === array.length - 1;
15992
- return item?.variant === 'button' ? (React__default.createElement(Button, { key: index, extraClassNames: `tw-ml-[-1px] focus:tw-z-40 focus:tw-border tw-rounded-l-none tw-rounded-r-none ${isLast ? 'tw-rounded-r-md' : ''}`, ...item.buttonProps })) : (React__default.createElement("div", { key: index, className: `${borderColorClasses} tw-flex tw-items-center tw-justify-center tw-rounded-none tw-ml-[-1px] active:tw-z-30 active:tw-border tw-border ${isLast ? 'tw-rounded-r-md' : ''}` }, item?.element));
15989
+ field ? (React__default.createElement("div", { "data-testid": testId, className: `tw-flex tw-flex-1 tw-cursor-pointer active:tw-z-50 ${fieldAppliedClasses}` }, field)) : (React__default.createElement(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, extraClassNames: `tw-flex tw-flex-1 tw-w-full focus:tw-z-30 tw-rounded-r-none last:tw-rounded-r-md ${extraClassNames}`, ...tooltipData })),
15990
+ elementsToAppend.map((item, index) => {
15991
+ return item?.variant === 'button' ? (React__default.createElement(Button, { key: index, extraClassNames: `tw-ml-[-1px] focus:tw-z-40 focus:tw-border tw-rounded-none last:tw-rounded-r-md`, ...item.buttonProps })) : (React__default.createElement("div", { key: index, className: `${borderColorClasses} tw-flex tw-items-center tw-justify-center tw-rounded-none last:tw-rounded-r-md tw-ml-[-1px] active:tw-z-30 active:tw-border tw-border` }, item?.element));
15993
15992
  })));
15994
15993
  });
15995
15994
 
@@ -22191,12 +22190,12 @@ const ProgressIndicator = (props) => {
22191
22190
  computeTextClass(indicatorElementRef.current);
22192
22191
  }
22193
22192
  }, [!!indicatorElementRef.current]);
22194
- return (React__default.createElement(Indicator, { className: `tw-ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw-w-full tw-h-[18px] tw-duration-[660ms] tw-flex tw-justify-center tw-items-center 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: {
22193
+ return (React__default.createElement(Indicator, { className: `tw-ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw-w-full tw-h-[18px] 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: {
22195
22194
  // Background color will default to the theme color if undefined
22196
22195
  backgroundColor: bgColor,
22197
22196
  animation: 'width 660ms forwards',
22198
22197
  width: `${animatedWidth}%`,
22199
- } }, label ? React__default.createElement("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass}` }, label) : undefined));
22198
+ } }, label ? (React__default.createElement("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw-absolute tw-z-50' : ''}` }, label)) : undefined));
22200
22199
  };
22201
22200
  const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
22202
22201
  const totalValue = values.reduce((acc, { value }) => acc + value, 0);
@@ -22229,9 +22228,11 @@ const ButtonGroup = (props) => {
22229
22228
  const { id, extraClassNames, testId, onChange, buttons = [], ...tooltipProps } = props;
22230
22229
  const tooltipData = getQTipData(tooltipProps);
22231
22230
  const appliedClasses = `${baseClasses} ${extraClassNames}`;
22232
- return (React__default.createElement("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData }, buttons.filter(Boolean).map((item, index) => item?.variant === 'button' ? (React__default.createElement(Button, { key: index, ...item.buttonProps, extraClassNames: `tw-ml-[-1px] focus:tw-z-40 tw-outline-none focus:tw-border tw-rounded-none first:tw-rounded-l-md last:tw-rounded-r-md ${item.buttonProps?.isActive
22231
+ return (React__default.createElement("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData }, buttons
22232
+ .filter(Boolean)
22233
+ .map((item, index) => item?.variant === 'button' ? (React__default.createElement(Button, { key: index, ...item.buttonProps, extraClassNames: `tw-ml-[-1px] focus:tw-z-40 tw-outline-none focus:tw-border tw-rounded-none first:tw-rounded-l-md last:tw-rounded-r-md ${item.buttonProps?.isActive
22233
22234
  ? `${activeClassesByVariantLightTheme[item?.buttonProps?.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item?.buttonProps?.variant ?? 'outline']} `
22234
- : ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) })) : (React__default.createElement("div", { key: index, className: ` tw-flex tw-items-center tw-justify-center tw-rounded-none tw-ml-[-1px] active:tw-z-30 ${item?.extraClassNames || ''}` }, item?.element)))));
22235
+ : ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) })) : (item?.element))));
22235
22236
  };
22236
22237
 
22237
22238
  /**