@seeqdev/qomponents 0.0.59 → 0.0.61

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.
@@ -32,8 +32,8 @@ export interface ButtonWithDropdownProps {
32
32
  id?: string;
33
33
  /** extra class names to be placed on the dropdown container */
34
34
  extraClassNames?: string;
35
- /** id that will be used in the data-testid attribute on the trigger element */
36
- testId?: string;
35
+ /** id that will be used in the data-testid attribute on the container element */
36
+ containerTestId?: string;
37
37
  /** the text to be displayed on the triggers's tooltip */
38
38
  tooltipText?: string;
39
39
  /** optional testId applied to the tooltip - useful for testing */
@@ -62,5 +62,9 @@ export interface ButtonWithDropdownProps {
62
62
  isOpen?: boolean;
63
63
  /** function called to open and close popover */
64
64
  onOpenChange?: (isOpen: boolean) => void;
65
+ /** should popover close when the content is clicked? */
66
+ isCloseOnContentClick?: boolean;
67
+ /** focus should be kept within dropdown */
68
+ keepFocusInsideDropdown?: boolean;
65
69
  }
66
70
  export {};
@@ -8,8 +8,8 @@ export interface ButtonWithPopoverProps {
8
8
  id?: string;
9
9
  /** extra class names to be placed on the Popover container component */
10
10
  extraClassNames?: string;
11
- /** id that will be used in the data-testid attribute on the button element */
12
- testId?: string;
11
+ /** id that will be used in the data-testid attribute on the container element */
12
+ containerTestId?: string;
13
13
  /** the text to be displayed on the icon's tooltip */
14
14
  tooltipText?: string;
15
15
  /** optional testId applied to the tooltip - useful for testing */
Binary file
Binary file
package/dist/index.esm.js CHANGED
@@ -14996,11 +14996,11 @@ const borderStyles$1 = [
14996
14996
  'tw-border-solid',
14997
14997
  'tw-border',
14998
14998
  'tw-rounded-sm',
14999
- 'tw-border-sq-light-gray',
14999
+ 'tw-border-sq-disabled-gray',
15000
15000
  'dark:tw-border-gray-700',
15001
15001
  ].join(' ');
15002
15002
  const disabledClasses$1 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
15003
- const ButtonWithPopover = ({ children, trigger, tooltipText, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, testId, tooltipTestId, tooltipDelay, tooltipPlacement, disabled = false, align = 'end', alignOffset = -5, placement = 'bottom', placementOffset = 2, onOpenChange, isOpen, isHtmlTooltip = false, isCloseOnContentClick = false, }) => {
15003
+ const ButtonWithPopover = ({ children, trigger, tooltipText, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, tooltipTestId, tooltipDelay, tooltipPlacement, disabled = false, align = 'end', alignOffset = -5, placement = 'bottom', placementOffset = 2, onOpenChange, isOpen, isHtmlTooltip = false, isCloseOnContentClick = false, }) => {
15004
15004
  let tooltipData = undefined;
15005
15005
  if (tooltipText) {
15006
15006
  tooltipData = {
@@ -15012,14 +15012,14 @@ const ButtonWithPopover = ({ children, trigger, tooltipText, id, hasArrow, extra
15012
15012
  };
15013
15013
  }
15014
15014
  return (React.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { open: isOpen, defaultOpen: false, onOpenChange: onOpenChange },
15015
- React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none`, disabled: disabled, "data-testid": testId },
15015
+ React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none`, disabled: disabled },
15016
15016
  React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center tw-justify-center ${disabled ? disabledClasses$1 : ''} ${extraTriggerClassNames || ''}` }, trigger)),
15017
15017
  React.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, align: align, side: placement, alignOffset: alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:tw-outline-none tw-outline-none" },
15018
- React.createElement("div", { className: `${bgStyles$1} ${borderStyles$1} tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
15018
+ React.createElement("div", { "data-testid": containerTestId, className: `${bgStyles$1} ${borderStyles$1} tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
15019
15019
  data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade
15020
15020
  ${extraPopoverClassNames || ''}` },
15021
15021
  hasArrow && (React.createElement($cb5cc270b50c6fcd$export$21b07c8f274aebd5, { asChild: true },
15022
- React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[6px] tw-h-[6px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-light-gray dark:tw-border-gray-700 tw-mt-[-2px]" }))),
15022
+ React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[6px] tw-h-[6px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-700 tw-mt-[-2px]" }))),
15023
15023
  children))));
15024
15024
  };
15025
15025
 
@@ -15714,12 +15714,12 @@ const borderStyles = [
15714
15714
  'tw-border-solid',
15715
15715
  'tw-border',
15716
15716
  'tw-rounded-sm',
15717
- 'tw-border-sq-light-gray',
15717
+ 'tw-border-sq-disabled-gray',
15718
15718
  'dark:tw-border-gray-700',
15719
15719
  ].join(' ');
15720
15720
  const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
15721
15721
  const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
15722
- const ButtonWithDropdown = ({ dropdownItems, triggerIcon, tooltipText, id, extraClassNames, testId, tooltipTestId, tooltipDelay, tooltipPlacement, disabled = false, align = 'end', placement = 'bottom', placementOffset = 2, alignOffset = -5, hasArrow = false, onOpenChange, isHtmlTooltip = false, isOpen, }) => {
15722
+ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, tooltipText, id, extraClassNames, containerTestId, tooltipTestId, tooltipDelay, tooltipPlacement, disabled = false, align = 'end', placement = 'bottom', placementOffset = 2, alignOffset = -5, hasArrow = false, onOpenChange, isHtmlTooltip = false, isOpen, keepFocusInsideDropdown = true, }) => {
15723
15723
  let tooltipData = undefined;
15724
15724
  if (tooltipText) {
15725
15725
  tooltipData = {
@@ -15730,23 +15730,23 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, tooltipText, id, extra
15730
15730
  'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
15731
15731
  };
15732
15732
  }
15733
- return (React.createElement($d08ef79370b62062$export$be92b6f5f03c0fe9, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange },
15734
- React.createElement($d08ef79370b62062$export$41fb9f06171c75f4, { id: id, className: `tw-border-none focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none`, disabled: disabled, "data-testid": testId },
15733
+ return (React.createElement($d08ef79370b62062$export$be92b6f5f03c0fe9, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown },
15734
+ React.createElement($d08ef79370b62062$export$41fb9f06171c75f4, { id: id, className: `tw-border-none focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none`, disabled: disabled },
15735
15735
  React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none ${disabled ? disabledClasses : ''} ${extraClassNames || ''}` }, triggerIcon)),
15736
15736
  React.createElement($d08ef79370b62062$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, className: "focus-visible:tw-outline-none tw-outline-none" },
15737
- React.createElement("div", { className: bgStyles +
15737
+ React.createElement("div", { "data-testid": containerTestId, className: bgStyles +
15738
15738
  ' 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' +
15739
15739
  ' forceFont data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade ' +
15740
15740
  borderStyles },
15741
15741
  hasArrow && (React.createElement($d08ef79370b62062$export$21b07c8f274aebd5, { asChild: true },
15742
- React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[6px] tw-h-[6px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-light-gray dark:tw-border-gray-700 tw-mt-[-2px]" }))),
15742
+ React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[6px] tw-h-[6px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-700 tw-mt-[-2px]" }))),
15743
15743
  dropdownItems.map((item, index) => (React.createElement("div", { key: item.label + index },
15744
15744
  React.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, { key: item.label + index, onSelect: (e) => {
15745
15745
  item.onClick(e);
15746
15746
  }, className: `tw-cursor-pointer tw-flex dark:tw-text-sq-white hover:tw-bg-sq-colored-hover hover:dark:tw-bg-sq-colored-hover-dark tw-leading-none tw-items-center tw-h-[27px] tw-px-[19px] tw-relative tw-select-none tw-outline-none data-[disabled]:tw-text-sq-disabled-gray data-[disabled]:tw-pointer-events-none ${item.containerExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled },
15747
15747
  item.icon && (React.createElement(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })),
15748
15748
  React.createElement("div", { "data-testid": item.labelTestId, className: "tw-text-[13px] tw-ml-1" }, item.label)),
15749
- item.hasDivider && (React.createElement($d08ef79370b62062$export$1ff3c3f08ae963c0, { "data-testid": `dropdown-divider-${index}`, className: "tw-h-[1px] tw-bg-sq-light-gray dark:tw-bg-gray-700 tw-my-[8px]" })))))))));
15749
+ item.hasDivider && (React.createElement($d08ef79370b62062$export$1ff3c3f08ae963c0, { "data-testid": `dropdown-divider-${index}`, className: "tw-h-[1px] tw-bg-sq-disabled-gray dark:tw-bg-gray-700 tw-my-[8px]" })))))))));
15750
15750
  };
15751
15751
 
15752
15752
  export { Accordion, Button, ButtonWithDropdown, ButtonWithPopover, Checkbox, Icon, Modal, QTip, Select, Tabs, TextArea, TextField, ToolbarButton, Tooltip };