@seeqdev/qomponents 0.0.63 → 0.0.64

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 (31) hide show
  1. package/dist/ButtonWithDropdown/ButtonWithDropdown.js +14 -19
  2. package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -1
  3. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +6 -6
  4. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +1 -1
  5. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +1 -1
  6. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +1 -1
  7. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +2 -12
  8. package/dist/ButtonWithPopover/ButtonWithPopover.js +3 -12
  9. package/dist/ButtonWithPopover/ButtonWithPopover.js.map +1 -1
  10. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +7 -7
  11. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +1 -1
  12. package/dist/ButtonWithPopover/ButtonWithPopover.test.js +1 -1
  13. package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +1 -1
  14. package/dist/ButtonWithPopover/ButtonWithPopover.types.d.ts +2 -12
  15. package/dist/Checkbox/Checkbox.js +4 -2
  16. package/dist/Checkbox/Checkbox.js.map +1 -1
  17. package/dist/Checkbox/Checkbox.stories.js +7 -5
  18. package/dist/Checkbox/Checkbox.stories.js.map +1 -1
  19. package/dist/Checkbox/Checkbox.types.d.ts +2 -1
  20. package/dist/Icon/Icon.js +3 -11
  21. package/dist/Icon/Icon.js.map +1 -1
  22. package/dist/Icon/Icon.types.d.ts +3 -12
  23. package/dist/Tooltip/Tooltip.types.d.ts +13 -1
  24. package/dist/Tooltip/qTip.utilities.d.ts +3 -0
  25. package/dist/Tooltip/qTip.utilities.js +11 -0
  26. package/dist/Tooltip/qTip.utilities.js.map +1 -0
  27. package/dist/index.esm.js +19 -34
  28. package/dist/index.esm.js.map +1 -1
  29. package/dist/index.js +19 -34
  30. package/dist/index.js.map +1 -1
  31. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import { QTipDataAttributes } from './QTip.types';
2
+ import { TooltipComponentProps } from './Tooltip.types';
3
+ export declare const getQTipData: ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay, }: TooltipComponentProps) => QTipDataAttributes | undefined;
@@ -0,0 +1,11 @@
1
+ import { DEFAULT_TOOL_TIP_DELAY } from './Tooltip.types';
2
+ export const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
3
+ ? {
4
+ 'data-qtip-text': tooltip,
5
+ 'data-qtip-placement': tooltipPlacement,
6
+ 'data-qtip-is-html': isHtmlTooltip,
7
+ 'data-qtip-testid': tooltipTestId,
8
+ 'data-qtip-delay': tooltipDelay,
9
+ }
10
+ : undefined;
11
+ //# sourceMappingURL=qTip.utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qTip.utilities.js","sourceRoot":"","sources":["../../src/Tooltip/qTip.utilities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAyB,MAAM,iBAAiB,CAAC;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,YAAY,GAAG,sBAAsB,GACf,EAAkC,EAAE,CAC1D,OAAO;IACL,CAAC,CAAC;QACE,gBAAgB,EAAE,OAAO;QACzB,qBAAqB,EAAE,gBAAgB;QACvC,mBAAmB,EAAE,aAAa;QAClC,kBAAkB,EAAE,aAAa;QACjC,iBAAiB,EAAE,YAAY;KAChC;IACH,CAAC,CAAC,SAAS,CAAC"}
package/dist/index.esm.js CHANGED
@@ -33,6 +33,16 @@ const browserIsFirefox = browserId && browserName === 'Firefox';
33
33
 
34
34
  const DEFAULT_TOOL_TIP_DELAY = 500;
35
35
 
36
+ const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
37
+ ? {
38
+ 'data-qtip-text': tooltip,
39
+ 'data-qtip-placement': tooltipPlacement,
40
+ 'data-qtip-is-html': isHtmlTooltip,
41
+ 'data-qtip-testid': tooltipTestId,
42
+ 'data-qtip-delay': tooltipDelay,
43
+ }
44
+ : undefined;
45
+
36
46
  const colorClassesThemeLight = {
37
47
  'theme': 'tw-text-sq-color-dark',
38
48
  'white': 'tw-text-white',
@@ -68,7 +78,7 @@ const colorClassesThemeDark = {
68
78
  * - access to Seeq custom icons by providing the desired icon
69
79
  * - leverage "type" to style your icon
70
80
  */
71
- const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId, tooltip, tooltipPlacement, number, isHtmlTooltip = false, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => {
81
+ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId, number, ...tooltipProps }) => {
72
82
  if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
73
83
  const errorMessage = color === undefined || color === ''
74
84
  ? 'Icon with type="color" must have prop color specified.'
@@ -80,15 +90,7 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
80
90
  const style = type === 'color' && color ? { color } : {};
81
91
  const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
82
92
  ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
83
- const tooltipData = tooltip
84
- ? {
85
- 'data-qtip-text': tooltip,
86
- 'data-qtip-placement': tooltipPlacement,
87
- 'data-qtip-is-html': isHtmlTooltip,
88
- 'data-qtip-testid': tooltipTestId,
89
- 'data-qtip-delay': tooltipDelay,
90
- }
91
- : undefined;
93
+ const tooltipData = getQTipData(tooltipProps);
92
94
  return (React__default.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
93
95
  };
94
96
 
@@ -4689,10 +4691,11 @@ const radioClasses = `tw-form-radio ${baseClasses$2}`;
4689
4691
  * Checkbox and Radio Box Component.
4690
4692
  */
4691
4693
  const Checkbox = (props) => {
4692
- const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, } = props;
4694
+ const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, ...tooltipProps } = props;
4693
4695
  const assignedId = id ?? 'checkbox_' + Math.random();
4696
+ const tooltipData = getQTipData(tooltipProps);
4694
4697
  return (React__default.createElement("span", { className: `${alignment} ${extraClassNames}` },
4695
- React__default.createElement("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, checked: checked, defaultChecked: defaultChecked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'}`, disabled: disabled, onClick: onClick, onChange: onChange, onKeyDown: onKeyDown }),
4698
+ React__default.createElement("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, checked: checked, defaultChecked: defaultChecked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'}`, disabled: disabled, onClick: onClick, onChange: onChange, onKeyDown: onKeyDown, ...tooltipData }),
4696
4699
  React__default.createElement("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
4697
4700
  ? 'tw-cursor-not-allowed dark:tw-text-sq-fairly-dark-gray tw-text-sq-fairly-dark-gray'
4698
4701
  : 'tw-cursor-pointer tw-text-sq-text-color dark:tw-text-sq-dark-text'}` }, label)));
@@ -15000,17 +15003,8 @@ const borderStyles$1 = [
15000
15003
  'dark:tw-border-gray-700',
15001
15004
  ].join(' ');
15002
15005
  const disabledClasses$1 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
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, setFocusOnTriggerOnClose = true, }) => {
15004
- let tooltipData = undefined;
15005
- if (tooltipText) {
15006
- tooltipData = {
15007
- 'data-qtip-text': tooltipText,
15008
- 'data-qtip-placement': tooltipPlacement,
15009
- 'data-qtip-is-html': isHtmlTooltip,
15010
- 'data-qtip-testid': tooltipTestId,
15011
- 'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
15012
- };
15013
- }
15006
+ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, disabled = false, align = 'end', alignOffset = -5, placement = 'bottom', placementOffset = 2, onOpenChange, isOpen, isCloseOnContentClick = false, setFocusOnTriggerOnClose = true, ...tooltipProps }) => {
15007
+ const tooltipData = getQTipData(tooltipProps);
15014
15008
  return (React.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { open: isOpen, defaultOpen: false, onOpenChange: onOpenChange },
15015
15009
  React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none`, disabled: disabled },
15016
15010
  React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center tw-justify-center ${disabled ? disabledClasses$1 : ''} ${extraTriggerClassNames || ''}` }, trigger)),
@@ -15734,17 +15728,8 @@ const borderStyles = [
15734
15728
  ].join(' ');
15735
15729
  const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
15736
15730
  const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
15737
- 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, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, }) => {
15738
- let tooltipData = undefined;
15739
- if (tooltipText) {
15740
- tooltipData = {
15741
- 'data-qtip-text': tooltipText,
15742
- 'data-qtip-placement': tooltipPlacement,
15743
- 'data-qtip-is-html': isHtmlTooltip,
15744
- 'data-qtip-testid': tooltipTestId,
15745
- 'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
15746
- };
15747
- }
15731
+ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames, containerTestId, disabled = false, align = 'end', placement = 'bottom', placementOffset = 2, alignOffset = -5, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, ...tooltipProps }) => {
15732
+ const tooltipData = getQTipData(tooltipProps);
15748
15733
  return (React.createElement($d08ef79370b62062$export$be92b6f5f03c0fe9, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown },
15749
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 },
15750
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)),