@seeqdev/qomponents 0.0.69 → 0.0.71

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/index.js CHANGED
@@ -108,7 +108,7 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
108
108
  const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
109
109
  const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
110
110
  const style = type === 'color' && color ? { color } : {};
111
- const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
111
+ const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
112
112
  ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames} focus:tw-outline-none focus-visible:tw-outline-none tw-outline-none`;
113
113
  const tooltipData = getQTipData(tooltipProps);
114
114
  return (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
@@ -119,7 +119,7 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
119
119
  * - use "variant" to achieve the desired style
120
120
  * - include tooltips and/or icons
121
121
  */
122
- 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, }) => {
122
+ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, iconPrefix = undefined, preventBlur = false, isHtmlTooltip = false, tooltipTestId, }) => {
123
123
  const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
124
124
  const baseClassesByVariant = {
125
125
  'outline': 'disabled:tw-opacity-50 tw-border-solid tw-border',
@@ -183,8 +183,6 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
183
183
  'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
184
184
  };
185
185
  }
186
- const iconClass = (iconPosition === 'left' ? 'tw-mr-1' : 'tw-ml-1');
187
- const iconElement = icon && (React.createElement(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label ? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` }));
188
186
  return (React.createElement("button", { id: id, ...tooltipData, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
189
187
  stopPropagation && e.stopPropagation();
190
188
  onClick && onClick(e);
@@ -193,9 +191,8 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
193
191
  e.preventDefault();
194
192
  }
195
193
  }, className: appliedClasses },
196
- iconPosition === 'left' && iconElement,
197
- label,
198
- iconPosition === 'right' && iconElement));
194
+ icon && (React.createElement(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label ? `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
195
+ label));
199
196
  };
200
197
 
201
198
  function _extends() {
@@ -4426,6 +4423,19 @@ const $cb5cc270b50c6fcd$export$7dacb05d26466c3 = /*#__PURE__*/ React.forwardRef(
4426
4423
  const [$cb5cc270b50c6fcd$var$PortalProvider, $cb5cc270b50c6fcd$var$usePortalContext] = $cb5cc270b50c6fcd$var$createPopoverContext($cb5cc270b50c6fcd$var$PORTAL_NAME, {
4427
4424
  forceMount: undefined
4428
4425
  });
4426
+ const $cb5cc270b50c6fcd$export$dd679ffb4362d2d4 = (props)=>{
4427
+ const { __scopePopover: __scopePopover , forceMount: forceMount , children: children , container: container } = props;
4428
+ const context = $cb5cc270b50c6fcd$var$usePopoverContext($cb5cc270b50c6fcd$var$PORTAL_NAME, __scopePopover);
4429
+ return /*#__PURE__*/ React.createElement($cb5cc270b50c6fcd$var$PortalProvider, {
4430
+ scope: __scopePopover,
4431
+ forceMount: forceMount
4432
+ }, /*#__PURE__*/ React.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
4433
+ present: forceMount || context.open
4434
+ }, /*#__PURE__*/ React.createElement($f1701beae083dbae$export$602eac185826482c, {
4435
+ asChild: true,
4436
+ container: container
4437
+ }, children)));
4438
+ };
4429
4439
  /* -------------------------------------------------------------------------------------------------
4430
4440
  * PopoverContent
4431
4441
  * -----------------------------------------------------------------------------------------------*/ const $cb5cc270b50c6fcd$var$CONTENT_NAME = 'PopoverContent';
@@ -4564,6 +4574,7 @@ const $cb5cc270b50c6fcd$export$3152841115e061b2 = /*#__PURE__*/ React.forwardRef
4564
4574
  }
4565
4575
  const $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9 = $cb5cc270b50c6fcd$export$5b6b19405a83ff9d;
4566
4576
  const $cb5cc270b50c6fcd$export$41fb9f06171c75f4 = $cb5cc270b50c6fcd$export$7dacb05d26466c3;
4577
+ const $cb5cc270b50c6fcd$export$602eac185826482c = $cb5cc270b50c6fcd$export$dd679ffb4362d2d4;
4567
4578
  const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f420b25549ff;
4568
4579
  const $cb5cc270b50c6fcd$export$21b07c8f274aebd5 = $cb5cc270b50c6fcd$export$3152841115e061b2;
4569
4580
 
@@ -4755,13 +4766,13 @@ const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP
4755
4766
  const arrowBaseClasses = 'before:tw-content-[\'\'] before:tw-absolute before:tw-border-8';
4756
4767
  const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';
4757
4768
  const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';
4758
- const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
4769
+ const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
4759
4770
  before:tw-border-l-transparent before:tw-border-r-black`;
4760
- const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
4771
+ const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
4761
4772
  before:tw-border-l-black before:tw-border-r-transparent`;
4762
- const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
4773
+ const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
4763
4774
  before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;
4764
- const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
4775
+ const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
4765
4776
  before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;
4766
4777
  const placements = {
4767
4778
  top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,
@@ -4771,7 +4782,7 @@ const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP
4771
4782
  };
4772
4783
  return (React.createElement("div", { className: "tw-group tw-relative tw-inline-block" },
4773
4784
  children,
4774
- React.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
4785
+ React.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
4775
4786
  tw-absolute tw-opacity-0 group-hover:tw-opacity-100 tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white ${placements[position]}` }, text)));
4776
4787
  };
4777
4788
 
@@ -13692,7 +13703,7 @@ const multiValueStyles = [
13692
13703
  * For ease of testing most of the elements of this select can be identified by classNames prefixed with "spec".
13693
13704
  *
13694
13705
  */
13695
- 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, }) => {
13706
+ 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 }) => {
13696
13707
  const getOptionOrSelectedLabel = (option, { context }) => {
13697
13708
  const getSelectedOptionLabel = getSelectedValueLabel ? getSelectedValueLabel : getOptionLabel;
13698
13709
  if (getOptionLabel || getSelectedValueLabel) {
@@ -13737,6 +13748,9 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
13737
13748
  getOptionValue,
13738
13749
  options,
13739
13750
  isDisabled,
13751
+ onMenuOpen,
13752
+ onMenuClose,
13753
+ components,
13740
13754
  hideSelectedOptions: isMulti,
13741
13755
  filterOption: filterOption ? filterOption : filterConfig ? createFilter(filterConfig) : undefined,
13742
13756
  classNames: {
@@ -14052,9 +14066,9 @@ const Dialog = $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9;
14052
14066
  const DialogPortal = $5d3850c4d0b4e6c7$export$602eac185826482c;
14053
14067
  const DialogClose = $5d3850c4d0b4e6c7$export$f39c2d165cd861fe;
14054
14068
  const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (React.createElement(DialogPortal, null,
14055
- React.createElement("div", { className: "tw-select-none tw-fixed tw-w-full tw-h-full tw-opacity-50 tw-inset-0 tw-z-[1000] tw-bg-sq-dark-background\n data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 " }),
14056
- React.createElement($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ref: ref, className: `tw-fixed tw-left-[50%] tw-top-0 tw-my-6 tw-translate-x-[-50%] tw-z-[1001] tw-grid
14057
- tw-gap-4 tw-border tw-bg-sq-white dark:tw-bg-sq-dark-background tw-p-6 tw-shadow-lg tw-duration-200
14069
+ React.createElement("div", { className: "tw-select-none tw-fixed tw-w-full tw-h-full tw-opacity-50 tw-inset-0 tw-z-[1000] tw-bg-sq-dark-background\r\n data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0\r\n data-[state=open]:fade-in-0 " }),
14070
+ React.createElement($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ref: ref, className: `tw-fixed tw-left-[50%] tw-top-0 tw-my-6 tw-translate-x-[-50%] tw-z-[1001] tw-grid
14071
+ tw-gap-4 tw-border tw-bg-sq-white dark:tw-bg-sq-dark-background tw-p-6 tw-shadow-lg tw-duration-200
14058
14072
  tw-rounded-lg ${className}`, ...props }, children))));
14059
14073
  DialogContent.displayName = $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2.displayName;
14060
14074
  const DialogHeader = ({ className, ...props }) => (React.createElement("div", { className: "tw-w-full tw-justify-between" },
@@ -14121,7 +14135,7 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
14121
14135
  'tw-max-w-5xl': size === '5xl',
14122
14136
  'tw-max-w-6xl': size === '6xl',
14123
14137
  }, dialogClassName) },
14124
- React.createElement(DialogHeader, { className: "modal-header tw-flex tw-w-full tw-justify-between tw-border-sq-disabled-gray\n dark:tw-border-sq-dark-disabled-gray tw-border-0 tw-border-b tw-px-6 tw-py-4" },
14138
+ React.createElement(DialogHeader, { className: "modal-header tw-flex tw-w-full tw-justify-between tw-border-sq-disabled-gray\r\n dark:tw-border-sq-dark-disabled-gray tw-border-0 tw-border-b tw-px-6 tw-py-4" },
14125
14139
  React.createElement("div", { className: "tw-flex tw-w-full" }, renderTitle()),
14126
14140
  !hideCloseIcon && React.createElement(DialogClose, { autoFocus: false, className: "[&:has(:focus-visible)]:none tw-opacity-70 tw-bg-transparent hover:tw-opacity-100 close tw-cursor-pointer tw-ml-4", "data-testid": "closeButton" },
14127
14141
  React.createElement("span", { className: "tw-cursor-pointer" }, "\u00D7"))),
@@ -15023,7 +15037,7 @@ const borderStyles$1 = [
15023
15037
  'dark:tw-border-gray-500',
15024
15038
  ].join(' ');
15025
15039
  const disabledClasses$1 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
15026
- const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, onInteractOutside, onPointerDownOutside, disabled = false, align = 'end', alignOffset = -35, placement = 'bottom', placementOffset = 2, isHoverEnabled = false, hoverOpenDelay = 300, onOpenChange, isOpen, isCloseOnContentClick = false, setFocusOnTriggerOnClose = true, ...tooltipProps }) => {
15040
+ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, onInteractOutside, onPointerDownOutside, isTriggerAsChild = false, shouldTriggerFullWidth = false, disabled = false, align = 'end', alignOffset = -35, placement = 'bottom', placementOffset = 2, isHoverEnabled = false, hoverOpenDelay = 300, onOpenChange, isOpen, isCloseOnContentClick = false, setFocusOnTriggerOnClose = true, isPortal = false, ...tooltipProps }) => {
15027
15041
  const tooltipData = getQTipData(tooltipProps);
15028
15042
  let timeout;
15029
15043
  const [isHoveredOpen, setIsHoveredOpen] = React__namespace.useState(false);
@@ -15044,17 +15058,20 @@ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassN
15044
15058
  }
15045
15059
  };
15046
15060
  React__namespace.useEffect(() => () => timeout && clearTimeout(timeout), []);
15061
+ const renderContent = () => {
15062
+ return (React__namespace.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, align: align, side: placement, onInteractOutside: onInteractOutside, onPointerDownOutside: onPointerDownOutside, alignOffset: isHoverEnabled ? -10 : alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:tw-outline-none tw-outline-none tw-w-full tw-h-full" },
15063
+ React__namespace.createElement("div", { "data-testid": containerTestId, className: `${bgStyles$1} ${borderStyles$1} tw-relative tw-z-[1000] tw-min-w-6 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
15064
+ data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade tw-text-sq-text-color
15065
+ ${extraPopoverClassNames || ''}` },
15066
+ hasArrow && (React__namespace.createElement($cb5cc270b50c6fcd$export$21b07c8f274aebd5, { asChild: true },
15067
+ React__namespace.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" }))),
15068
+ children)));
15069
+ };
15047
15070
  const renderPopover = (popoverOpenState) => {
15048
15071
  return (React__namespace.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { open: popoverOpenState, defaultOpen: false, onOpenChange: onOpenChange },
15049
- React__namespace.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none`, disabled: disabled },
15050
- React__namespace.createElement("div", { ...tooltipData, onMouseOver: onHoverStart, onMouseOut: onHoverEnd, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center tw-justify-center focus-visible:tw-outline-none tw-outline-none ${disabled ? disabledClasses$1 : ''} ${extraTriggerClassNames || ''}` }, trigger)),
15051
- React__namespace.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, align: align, side: placement, onInteractOutside: onInteractOutside, onPointerDownOutside: onPointerDownOutside, alignOffset: isHoverEnabled ? -10 : alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:tw-outline-none tw-outline-none" },
15052
- React__namespace.createElement("div", { "data-testid": containerTestId, className: `${bgStyles$1} ${borderStyles$1} tw-relative tw-z-[1000] tw-min-w-6 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
15053
- data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade tw-text-sq-text-color
15054
- ${extraPopoverClassNames || ''}` },
15055
- hasArrow && (React__namespace.createElement($cb5cc270b50c6fcd$export$21b07c8f274aebd5, { asChild: true },
15056
- React__namespace.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" }))),
15057
- children))));
15072
+ React__namespace.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, asChild: isTriggerAsChild, className: `focus-visible:tw-outline-none tw-outline-none ${shouldTriggerFullWidth ? 'tw-w-full tw-h-full' : ''}`, disabled: disabled },
15073
+ React__namespace.createElement("div", { ...tooltipData, onMouseOver: onHoverStart, onMouseOut: onHoverEnd, className: `tw-bg-transparent focus-visible:tw-outline-none tw-outline-none ${disabled ? disabledClasses$1 : ''} ${shouldTriggerFullWidth ? 'tw-flex tw-flex-col tw-items-center tw-justify-center' : 'inline'} ${extraTriggerClassNames || ''}` }, trigger)),
15074
+ isPortal ? React__namespace.createElement($cb5cc270b50c6fcd$export$602eac185826482c, null, renderContent()) : renderContent()));
15058
15075
  };
15059
15076
  return isHoverEnabled ? renderPopover(isHoveredOpen) : renderPopover(isOpen);
15060
15077
  };
@@ -16059,7 +16076,7 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames, c
16059
16076
  if (item.isLabel) {
16060
16077
  return (React__namespace.createElement($d08ef79370b62062$export$b04be29aa201d4f5, { key: (item.label || '') + index, className: item.containerExtraClassNames },
16061
16078
  item.icon && (React__namespace.createElement(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })),
16062
- React__namespace.createElement("div", { "data-testid": item.labelTestId, className: "tw-text-[13px] tw-ml-1" }, item.label)));
16079
+ React__namespace.createElement("div", { "data-testid": item.labelTestId, className: "tw-text-[13px] tw-text-sq-text-color dark:tw-text-sq-white tw-ml-1" }, item.label)));
16063
16080
  }
16064
16081
  if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
16065
16082
  return (React__namespace.createElement($d08ef79370b62062$export$d7a01e11500dfb6f, { key: item.label + index },