@seeqdev/qomponents 0.0.62 → 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.
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +39 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +66 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +72 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +16 -12
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +2 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +1 -0
- package/dist/ButtonWithDropdown/index.js +2 -0
- package/dist/ButtonWithDropdown/index.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.js +27 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +50 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +61 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.d.ts +2 -12
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +2 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +1 -0
- package/dist/ButtonWithPopover/index.js +2 -0
- package/dist/ButtonWithPopover/index.js.map +1 -0
- package/dist/Checkbox/Checkbox.js +4 -2
- package/dist/Checkbox/Checkbox.js.map +1 -1
- package/dist/Checkbox/Checkbox.stories.js +7 -5
- package/dist/Checkbox/Checkbox.stories.js.map +1 -1
- package/dist/Checkbox/Checkbox.types.d.ts +2 -1
- package/dist/Icon/Icon.js +3 -11
- package/dist/Icon/Icon.js.map +1 -1
- package/dist/Icon/Icon.types.d.ts +3 -12
- package/dist/Select/Select.js.map +1 -1
- package/dist/ToolbarButton/ToolbarButton.js +8 -6
- package/dist/ToolbarButton/ToolbarButton.js.map +1 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js +10 -0
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +1 -1
- package/dist/Tooltip/Qtip.js +9 -3
- package/dist/Tooltip/Qtip.js.map +1 -1
- package/dist/Tooltip/Tooltip.types.d.ts +13 -1
- package/dist/Tooltip/qTip.utilities.d.ts +3 -0
- package/dist/Tooltip/qTip.utilities.js +11 -0
- package/dist/Tooltip/qTip.utilities.js.map +1 -0
- package/dist/index.esm.js +45 -41
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,6 +53,16 @@ const browserIsFirefox = browserId && browserName === 'Firefox';
|
|
|
53
53
|
|
|
54
54
|
const DEFAULT_TOOL_TIP_DELAY = 500;
|
|
55
55
|
|
|
56
|
+
const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
|
|
57
|
+
? {
|
|
58
|
+
'data-qtip-text': tooltip,
|
|
59
|
+
'data-qtip-placement': tooltipPlacement,
|
|
60
|
+
'data-qtip-is-html': isHtmlTooltip,
|
|
61
|
+
'data-qtip-testid': tooltipTestId,
|
|
62
|
+
'data-qtip-delay': tooltipDelay,
|
|
63
|
+
}
|
|
64
|
+
: undefined;
|
|
65
|
+
|
|
56
66
|
const colorClassesThemeLight = {
|
|
57
67
|
'theme': 'tw-text-sq-color-dark',
|
|
58
68
|
'white': 'tw-text-white',
|
|
@@ -88,7 +98,7 @@ const colorClassesThemeDark = {
|
|
|
88
98
|
* - access to Seeq custom icons by providing the desired icon
|
|
89
99
|
* - leverage "type" to style your icon
|
|
90
100
|
*/
|
|
91
|
-
const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId,
|
|
101
|
+
const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId, number, ...tooltipProps }) => {
|
|
92
102
|
if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
|
|
93
103
|
const errorMessage = color === undefined || color === ''
|
|
94
104
|
? 'Icon with type="color" must have prop color specified.'
|
|
@@ -100,15 +110,7 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
100
110
|
const style = type === 'color' && color ? { color } : {};
|
|
101
111
|
const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
102
112
|
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
|
|
103
|
-
const tooltipData =
|
|
104
|
-
? {
|
|
105
|
-
'data-qtip-text': tooltip,
|
|
106
|
-
'data-qtip-placement': tooltipPlacement,
|
|
107
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
108
|
-
'data-qtip-testid': tooltipTestId,
|
|
109
|
-
'data-qtip-delay': tooltipDelay,
|
|
110
|
-
}
|
|
111
|
-
: undefined;
|
|
113
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
112
114
|
return (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
|
|
113
115
|
};
|
|
114
116
|
|
|
@@ -4709,10 +4711,11 @@ const radioClasses = `tw-form-radio ${baseClasses$2}`;
|
|
|
4709
4711
|
* Checkbox and Radio Box Component.
|
|
4710
4712
|
*/
|
|
4711
4713
|
const Checkbox = (props) => {
|
|
4712
|
-
const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, } = props;
|
|
4714
|
+
const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, ...tooltipProps } = props;
|
|
4713
4715
|
const assignedId = id ?? 'checkbox_' + Math.random();
|
|
4716
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
4714
4717
|
return (React.createElement("span", { className: `${alignment} ${extraClassNames}` },
|
|
4715
|
-
React.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 }),
|
|
4718
|
+
React.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 }),
|
|
4716
4719
|
React.createElement("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
|
|
4717
4720
|
? 'tw-cursor-not-allowed dark:tw-text-sq-fairly-dark-gray tw-text-sq-fairly-dark-gray'
|
|
4718
4721
|
: 'tw-cursor-pointer tw-text-sq-text-color dark:tw-text-sq-dark-text'}` }, label)));
|
|
@@ -15020,17 +15023,8 @@ const borderStyles$1 = [
|
|
|
15020
15023
|
'dark:tw-border-gray-700',
|
|
15021
15024
|
].join(' ');
|
|
15022
15025
|
const disabledClasses$1 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
15023
|
-
const ButtonWithPopover = ({ children, trigger,
|
|
15024
|
-
|
|
15025
|
-
if (tooltipText) {
|
|
15026
|
-
tooltipData = {
|
|
15027
|
-
'data-qtip-text': tooltipText,
|
|
15028
|
-
'data-qtip-placement': tooltipPlacement,
|
|
15029
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
15030
|
-
'data-qtip-testid': tooltipTestId,
|
|
15031
|
-
'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
15032
|
-
};
|
|
15033
|
-
}
|
|
15026
|
+
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 }) => {
|
|
15027
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
15034
15028
|
return (React__namespace.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { open: isOpen, defaultOpen: false, onOpenChange: onOpenChange },
|
|
15035
15029
|
React__namespace.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none`, disabled: disabled },
|
|
15036
15030
|
React__namespace.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center tw-justify-center ${disabled ? disabledClasses$1 : ''} ${extraTriggerClassNames || ''}` }, trigger)),
|
|
@@ -15362,6 +15356,12 @@ const $6cc32821e9371a1c$var$MenuRootContentNonModal = /*#__PURE__*/ React.forwar
|
|
|
15362
15356
|
}))
|
|
15363
15357
|
})))))));
|
|
15364
15358
|
});
|
|
15359
|
+
const $6cc32821e9371a1c$export$dd37bec0e8a99143 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
15360
|
+
const { __scopeMenu: __scopeMenu , ...labelProps } = props;
|
|
15361
|
+
return /*#__PURE__*/ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, labelProps, {
|
|
15362
|
+
ref: forwardedRef
|
|
15363
|
+
}));
|
|
15364
|
+
});
|
|
15365
15365
|
/* -------------------------------------------------------------------------------------------------
|
|
15366
15366
|
* MenuItem
|
|
15367
15367
|
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$ITEM_NAME = 'MenuItem';
|
|
@@ -15581,6 +15581,7 @@ function $6cc32821e9371a1c$var$whenMouse(handler) {
|
|
|
15581
15581
|
const $6cc32821e9371a1c$export$be92b6f5f03c0fe9 = $6cc32821e9371a1c$export$d9b273488cd8ce6f;
|
|
15582
15582
|
const $6cc32821e9371a1c$export$b688253958b8dfe7 = $6cc32821e9371a1c$export$9fa5ebd18bee4d43;
|
|
15583
15583
|
const $6cc32821e9371a1c$export$7c6e2c02157bb7d2 = $6cc32821e9371a1c$export$479f0f2f71193efe;
|
|
15584
|
+
const $6cc32821e9371a1c$export$b04be29aa201d4f5 = $6cc32821e9371a1c$export$dd37bec0e8a99143;
|
|
15584
15585
|
const $6cc32821e9371a1c$export$6d08773d2e66f8f2 = $6cc32821e9371a1c$export$2ce376c2cc3355c8;
|
|
15585
15586
|
const $6cc32821e9371a1c$export$1ff3c3f08ae963c0 = $6cc32821e9371a1c$export$1cec7dcdd713e220;
|
|
15586
15587
|
const $6cc32821e9371a1c$export$21b07c8f274aebd5 = $6cc32821e9371a1c$export$bcdda4773debf5fa;
|
|
@@ -15702,6 +15703,13 @@ const $d08ef79370b62062$export$6e76d93a37c01248 = /*#__PURE__*/ React.forwardRef
|
|
|
15702
15703
|
}
|
|
15703
15704
|
}));
|
|
15704
15705
|
});
|
|
15706
|
+
const $d08ef79370b62062$export$76e48c5b57f24495 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
15707
|
+
const { __scopeDropdownMenu: __scopeDropdownMenu , ...labelProps } = props;
|
|
15708
|
+
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15709
|
+
return /*#__PURE__*/ React.createElement($6cc32821e9371a1c$export$b04be29aa201d4f5, _extends({}, menuScope, labelProps, {
|
|
15710
|
+
ref: forwardedRef
|
|
15711
|
+
}));
|
|
15712
|
+
});
|
|
15705
15713
|
const $d08ef79370b62062$export$ed97964d1871885d = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
15706
15714
|
const { __scopeDropdownMenu: __scopeDropdownMenu , ...itemProps } = props;
|
|
15707
15715
|
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
@@ -15726,6 +15734,7 @@ const $d08ef79370b62062$export$34b8980744021ec5 = /*#__PURE__*/ React.forwardRef
|
|
|
15726
15734
|
/* -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$export$be92b6f5f03c0fe9 = $d08ef79370b62062$export$e44a253a59704894;
|
|
15727
15735
|
const $d08ef79370b62062$export$41fb9f06171c75f4 = $d08ef79370b62062$export$d2469213b3befba9;
|
|
15728
15736
|
const $d08ef79370b62062$export$7c6e2c02157bb7d2 = $d08ef79370b62062$export$6e76d93a37c01248;
|
|
15737
|
+
const $d08ef79370b62062$export$b04be29aa201d4f5 = $d08ef79370b62062$export$76e48c5b57f24495;
|
|
15729
15738
|
const $d08ef79370b62062$export$6d08773d2e66f8f2 = $d08ef79370b62062$export$ed97964d1871885d;
|
|
15730
15739
|
const $d08ef79370b62062$export$1ff3c3f08ae963c0 = $d08ef79370b62062$export$da160178fd3bc7e9;
|
|
15731
15740
|
const $d08ef79370b62062$export$21b07c8f274aebd5 = $d08ef79370b62062$export$34b8980744021ec5;
|
|
@@ -15739,17 +15748,8 @@ const borderStyles = [
|
|
|
15739
15748
|
].join(' ');
|
|
15740
15749
|
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
15741
15750
|
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
15742
|
-
const ButtonWithDropdown = ({ dropdownItems, triggerIcon,
|
|
15743
|
-
|
|
15744
|
-
if (tooltipText) {
|
|
15745
|
-
tooltipData = {
|
|
15746
|
-
'data-qtip-text': tooltipText,
|
|
15747
|
-
'data-qtip-placement': tooltipPlacement,
|
|
15748
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
15749
|
-
'data-qtip-testid': tooltipTestId,
|
|
15750
|
-
'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
15751
|
-
};
|
|
15752
|
-
}
|
|
15751
|
+
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 }) => {
|
|
15752
|
+
const tooltipData = getQTipData(tooltipProps);
|
|
15753
15753
|
return (React__namespace.createElement($d08ef79370b62062$export$be92b6f5f03c0fe9, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown },
|
|
15754
15754
|
React__namespace.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 },
|
|
15755
15755
|
React__namespace.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)),
|
|
@@ -15760,13 +15760,17 @@ const ButtonWithDropdown = ({ dropdownItems, triggerIcon, tooltipText, id, extra
|
|
|
15760
15760
|
borderStyles },
|
|
15761
15761
|
hasArrow && (React__namespace.createElement($d08ef79370b62062$export$21b07c8f274aebd5, { asChild: true },
|
|
15762
15762
|
React__namespace.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]" }))),
|
|
15763
|
-
dropdownItems.map((item, index) =>
|
|
15764
|
-
React__namespace.createElement($d08ef79370b62062$export$
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
15768
|
-
|
|
15769
|
-
|
|
15763
|
+
dropdownItems.map((item, index) => {
|
|
15764
|
+
return item.isLabel ? (React__namespace.createElement($d08ef79370b62062$export$b04be29aa201d4f5, { key: (item.label || '') + index, className: item.containerExtraClassNames },
|
|
15765
|
+
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]" })),
|
|
15766
|
+
React__namespace.createElement("div", { "data-testid": item.labelTestId, className: "tw-text-[13px] tw-ml-1" }, item.label))) : (React__namespace.createElement("div", { key: item.label + index },
|
|
15767
|
+
React__namespace.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, { key: item.label + index, "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
15768
|
+
item.onClick(e);
|
|
15769
|
+
}, 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 },
|
|
15770
|
+
item.icon && (React__namespace.createElement(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px] ${item.iconExtraClassNames || ''}` })),
|
|
15771
|
+
React__namespace.createElement("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw-text-[13px] tw-ml-1 ${item.labelClasses}` }, item.label)),
|
|
15772
|
+
item.hasDivider && (React__namespace.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]" }))));
|
|
15773
|
+
})))));
|
|
15770
15774
|
};
|
|
15771
15775
|
|
|
15772
15776
|
exports.Accordion = Accordion;
|