@seeqdev/qomponents 0.0.83 → 0.0.85
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/ToolbarButton/ToolbarButton.js +5 -3
- package/dist/ToolbarButton/ToolbarButton.js.map +1 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js +3 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +1 -1
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +10 -0
- package/dist/Tooltip/QTip.stories.js +5 -0
- package/dist/Tooltip/QTip.stories.js.map +1 -1
- package/dist/Tooltip/Qtip.js +1 -4
- package/dist/Tooltip/Qtip.js.map +1 -1
- package/dist/index.esm.js +25 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -3
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +20 -0
- package/dist/utils/svg.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4581,6 +4581,26 @@ const $cb5cc270b50c6fcd$export$602eac185826482c = $cb5cc270b50c6fcd$export$dd679
|
|
|
4581
4581
|
const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f420b25549ff;
|
|
4582
4582
|
const $cb5cc270b50c6fcd$export$21b07c8f274aebd5 = $cb5cc270b50c6fcd$export$3152841115e061b2;
|
|
4583
4583
|
|
|
4584
|
+
const SVG_PATH = 'svgpath:';
|
|
4585
|
+
/**
|
|
4586
|
+
* Determines if an icon is SVG
|
|
4587
|
+
*
|
|
4588
|
+
* @param icon - an icon string that will either be an icon class or an SVG path definition (e.g. "fa fa-wrench" or
|
|
4589
|
+
* "svgpath:M 17.0181 0 ...")
|
|
4590
|
+
*/
|
|
4591
|
+
function isSvgIcon(icon) {
|
|
4592
|
+
return icon.startsWith(SVG_PATH);
|
|
4593
|
+
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Retrieves the SVG path from an SVG icon
|
|
4596
|
+
*
|
|
4597
|
+
* @param icon - an SVG icon string including path definition (e.g. "svgpath:M 17.0181 0 ...")
|
|
4598
|
+
* @returns the SVG icon path or an empty string if the supplied icon is not SVG
|
|
4599
|
+
*/
|
|
4600
|
+
function getSvgIconPath(icon) {
|
|
4601
|
+
return isSvgIcon(icon) ? icon.substring(SVG_PATH.length) : '';
|
|
4602
|
+
}
|
|
4603
|
+
|
|
4584
4604
|
const borderStyles$4 = [
|
|
4585
4605
|
'tw-border-solid',
|
|
4586
4606
|
'tw-border',
|
|
@@ -4614,7 +4634,7 @@ const activeBorderStyles = [
|
|
|
4614
4634
|
const bgStyles$3 = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
4615
4635
|
const disabledClasses$4 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
4616
4636
|
const PopoverContent = React__namespace.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React__namespace.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
4617
|
-
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, onClick, onHide, }) => {
|
|
4637
|
+
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, isPrimaryAnSvg = false, primaryIconExtraClassNames = false, iconHeight = 24, iconWidth = 24, primaryIconViewbox = '0 0 24 24', onClick, onHide, }) => {
|
|
4618
4638
|
let tooltipData = undefined;
|
|
4619
4639
|
if (tooltipText) {
|
|
4620
4640
|
tooltipData = {
|
|
@@ -4634,9 +4654,10 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
|
|
|
4634
4654
|
React__namespace.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
4635
4655
|
onClick && onClick(e);
|
|
4636
4656
|
} },
|
|
4637
|
-
React__namespace.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-[
|
|
4657
|
+
React__namespace.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 || ''}` },
|
|
4638
4658
|
React__namespace.createElement("span", { className: "tw-nowrap" },
|
|
4639
|
-
React__namespace.createElement(
|
|
4659
|
+
isPrimaryAnSvg ? (React__namespace.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 },
|
|
4660
|
+
React__namespace.createElement("path", { d: getSvgIconPath(icon) }))) : (React__namespace.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` })),
|
|
4640
4661
|
secondIcon && React__namespace.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
|
|
4641
4662
|
popoverContent ? (React__namespace.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-ml-[3px] tw-text-[8px]", type: "text" })) : undefined),
|
|
4642
4663
|
!isSmall && (React__namespace.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
|
|
@@ -6556,9 +6577,6 @@ const QTip = () => {
|
|
|
6556
6577
|
const ttTimeout = React.useRef();
|
|
6557
6578
|
const onMouseMove = (e) => {
|
|
6558
6579
|
clearTimeout(ttTimeout.current);
|
|
6559
|
-
if (!(e.target instanceof HTMLElement)) {
|
|
6560
|
-
return;
|
|
6561
|
-
}
|
|
6562
6580
|
tooltipTarget.current = e.target;
|
|
6563
6581
|
let dataset = e.target?.dataset;
|
|
6564
6582
|
let text = dataset?.qtipText;
|
|
@@ -6569,7 +6587,7 @@ const QTip = () => {
|
|
|
6569
6587
|
dataset = currentTooltipTarget?.dataset;
|
|
6570
6588
|
text = dataset?.qtipText;
|
|
6571
6589
|
if (!text || text === '') {
|
|
6572
|
-
currentTooltipTarget = e.target?.parentElement?.parentElement;
|
|
6590
|
+
currentTooltipTarget = e.target?.parentElement?.parentElement || null;
|
|
6573
6591
|
dataset = currentTooltipTarget?.dataset;
|
|
6574
6592
|
text = dataset?.qtipText;
|
|
6575
6593
|
}
|