@seeqdev/qomponents 0.0.159-patch-package-alternative → 0.0.160

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
@@ -53,6 +53,7 @@ browserId && parseInt(browserId.split(' ', 2)[1], 10);
53
53
  const browserIsFirefox = browserId && browserName === 'Firefox';
54
54
 
55
55
  const DEFAULT_TOOL_TIP_DELAY = 500;
56
+ const tooltipPositions = ['top', 'left', 'right', 'bottom'];
56
57
 
57
58
  const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
58
59
  ? {
@@ -1332,7 +1333,7 @@ const arrow$4 = options => ({
1332
1333
  * clipping boundary. Alternative to `autoPlacement`.
1333
1334
  * @see https://floating-ui.com/docs/flip
1334
1335
  */
1335
- const flip$3 = function (options) {
1336
+ const flip$4 = function (options) {
1336
1337
  if (options === void 0) {
1337
1338
  options = {};
1338
1339
  }
@@ -1618,7 +1619,7 @@ const offset$2 = function (options) {
1618
1619
  * keep it in view when it will overflow the clipping boundary.
1619
1620
  * @see https://floating-ui.com/docs/shift
1620
1621
  */
1621
- const shift$2 = function (options) {
1622
+ const shift$3 = function (options) {
1622
1623
  if (options === void 0) {
1623
1624
  options = {};
1624
1625
  }
@@ -2672,7 +2673,7 @@ const offset$1 = offset$2;
2672
2673
  * keep it in view when it will overflow the clipping boundary.
2673
2674
  * @see https://floating-ui.com/docs/shift
2674
2675
  */
2675
- const shift$1 = shift$2;
2676
+ const shift$2 = shift$3;
2676
2677
 
2677
2678
  /**
2678
2679
  * Optimizes the visibility of the floating element by flipping the `placement`
@@ -2680,7 +2681,7 @@ const shift$1 = shift$2;
2680
2681
  * clipping boundary. Alternative to `autoPlacement`.
2681
2682
  * @see https://floating-ui.com/docs/flip
2682
2683
  */
2683
- const flip$2 = flip$3;
2684
+ const flip$3 = flip$4;
2684
2685
 
2685
2686
  /**
2686
2687
  * Provides data that allows you to change the size of the floating element —
@@ -3019,8 +3020,8 @@ const offset = (options, deps) => ({
3019
3020
  * keep it in view when it will overflow the clipping boundary.
3020
3021
  * @see https://floating-ui.com/docs/shift
3021
3022
  */
3022
- const shift = (options, deps) => ({
3023
- ...shift$1(options),
3023
+ const shift$1 = (options, deps) => ({
3024
+ ...shift$2(options),
3024
3025
  options: [options, deps]
3025
3026
  });
3026
3027
 
@@ -3038,8 +3039,8 @@ const limitShift = (options, deps) => ({
3038
3039
  * clipping boundary. Alternative to `autoPlacement`.
3039
3040
  * @see https://floating-ui.com/docs/flip
3040
3041
  */
3041
- const flip$1 = (options, deps) => ({
3042
- ...flip$2(options),
3042
+ const flip$2 = (options, deps) => ({
3043
+ ...flip$3(options),
3043
3044
  options: [options, deps]
3044
3045
  });
3045
3046
 
@@ -3206,13 +3207,13 @@ var PopperContent = React__namespace.forwardRef(
3206
3207
  },
3207
3208
  middleware: [
3208
3209
  offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
3209
- avoidCollisions && shift({
3210
+ avoidCollisions && shift$1({
3210
3211
  mainAxis: true,
3211
3212
  crossAxis: false,
3212
3213
  limiter: sticky === "partial" ? limitShift() : void 0,
3213
3214
  ...detectOverflowOptions
3214
3215
  }),
3215
- avoidCollisions && flip$1({ ...detectOverflowOptions }),
3216
+ avoidCollisions && flip$2({ ...detectOverflowOptions }),
3216
3217
  size({
3217
3218
  ...detectOverflowOptions,
3218
3219
  apply: ({ elements, rects, availableWidth, availableHeight }) => {
@@ -6900,6 +6901,21 @@ function autoUpdate(reference, floating, update, options) {
6900
6901
  };
6901
6902
  }
6902
6903
 
6904
+ /**
6905
+ * Optimizes the visibility of the floating element by shifting it in order to
6906
+ * keep it in view when it will overflow the clipping boundary.
6907
+ * @see https://floating-ui.com/docs/shift
6908
+ */
6909
+ const shift = shift$3;
6910
+
6911
+ /**
6912
+ * Optimizes the visibility of the floating element by flipping the `placement`
6913
+ * in order to keep it in view when the preferred placement(s) will overflow the
6914
+ * clipping boundary. Alternative to `autoPlacement`.
6915
+ * @see https://floating-ui.com/docs/flip
6916
+ */
6917
+ const flip$1 = flip$4;
6918
+
6903
6919
  /**
6904
6920
  * Provides data to position an inner element of the floating element so that it
6905
6921
  * appears centered to the reference element.
@@ -7421,8 +7437,8 @@ const QTip = () => {
7421
7437
  if (tooltipRef.current && tooltipTarget.current) {
7422
7438
  computePosition(tooltipTarget.current, tooltipRef.current, {
7423
7439
  placement: position,
7424
- middleware: [offset$2(10), arrow({ element: tooltipArrowRef.current })],
7425
- }).then(({ x, y, middlewareData }) => {
7440
+ middleware: [offset$2(10), flip$1(), shift({ padding: 8 }), arrow({ element: tooltipArrowRef.current })],
7441
+ }).then(({ x, y, middlewareData, placement: finalPlacement }) => {
7426
7442
  Object.assign(tooltipRef.current?.style, {
7427
7443
  left: `${x}px`,
7428
7444
  top: `${y}px`,
@@ -7432,7 +7448,7 @@ const QTip = () => {
7432
7448
  const arrowWidth = tooltipArrowRef.current?.offsetHeight / 2;
7433
7449
  const tooltipHeight = tooltipRef.current?.offsetHeight;
7434
7450
  const tooltipWidth = tooltipRef.current?.offsetWidth;
7435
- const style = getArrowStyle(position, x || y, arrowWidth, tooltipHeight, tooltipWidth);
7451
+ const style = getArrowStyle(finalPlacement, x || y, arrowWidth, tooltipHeight, tooltipWidth);
7436
7452
  Object.assign(tooltipArrowRef.current.style, style);
7437
7453
  }
7438
7454
  setShow(true);
@@ -7446,7 +7462,7 @@ const QTip = () => {
7446
7462
  : positionTooltip();
7447
7463
  }
7448
7464
  };
7449
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { onMouseEnter: () => setOverTooltip(true), onMouseLeave: () => setOverTooltip(false), "data-testid": tooltipTestId, ref: tooltipRef, className: 'tw-absolute tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white tw-z-[9999] fade-in ' +
7465
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { onMouseEnter: () => setOverTooltip(true), onMouseLeave: () => setOverTooltip(false), "data-testid": tooltipTestId, ref: tooltipRef, className: 'tw-absolute tw-rounded tw-bg-black tw-max-w-96 tw-p-2 tw-text-xs tw-text-white tw-z-[9999] fade-in ' +
7450
7466
  (show ? 'tw-visible' : 'tw-invisible tw-pointer-events-none'), children: [html ? jsxRuntime.jsx(HTMLTip, { text: tooltipText }) : tooltipText, jsxRuntime.jsx("div", { className: "tw-absolute tw-w-[10px] tw-h-[10px] tw-rotate-45 tw-bg-black", ref: tooltipArrowRef })] }) }));
7451
7467
  };
7452
7468
 
@@ -28786,6 +28802,31 @@ const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '
28786
28802
  return (jsxRuntime.jsxs("div", { "data-testid": testId, className: `tw-flex tw-flex-col tw-items-center tw-justify-center tw-w-full tw-overflow-hidden ${extraClassNames}`, children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-w-full tw-h-max tw-gap-1", children: [showArrows && (jsxRuntime.jsx(Button, { icon: prevIcon, size: "lg", variant: "no-border", testId: "carousel-prev", extraClassNames: `${currentIndex === 0 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onBackClick })), jsxRuntime.jsx(motion.div, { custom: 1, initial: "initial", animate: "animate", exit: "exit", variants: slideVariants, className: "tw-w-full", children: carouselItems[currentIndex] }, currentIndex), showArrows && (jsxRuntime.jsx(Button, { icon: nextIcon, testId: "carousel-next", size: "lg", variant: "no-border", extraClassNames: `${currentIndex === carouselItems.length - 1 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onForwardClick }))] }), showIndicators && (jsxRuntime.jsx("div", { className: "tw-flex tw-gap-1 tw-mt-2", children: carouselItems.map((_, i) => (jsxRuntime.jsx("div", { className: `tw-w-2 tw-h-2 tw-rounded-full tw-cursor-pointer ${i === currentIndex ? 'tw-bg-sq-color-dark' : 'tw-bg-sq-darkish-gray'}`, onClick: () => changeSlide(i) }, i))) }))] }));
28787
28803
  };
28788
28804
 
28805
+ const buttonTypes = ['button', 'reset', 'submit', 'link'];
28806
+ const buttonSizes = ['sm', 'lg'];
28807
+ const buttonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
28808
+ const iconPositions = ['left', 'right'];
28809
+
28810
+ const iconTypes = [
28811
+ 'theme',
28812
+ 'white',
28813
+ 'dark-gray',
28814
+ 'darkish-gray',
28815
+ 'gray',
28816
+ 'color',
28817
+ 'info',
28818
+ 'text',
28819
+ 'warning',
28820
+ 'inherit',
28821
+ 'danger',
28822
+ 'theme-light',
28823
+ 'success',
28824
+ ];
28825
+
28826
+ const svgIconTypes = [...iconTypes, 'default'];
28827
+
28828
+ const toolbarButtonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
28829
+
28789
28830
  exports.Accordion = Accordion;
28790
28831
  exports.Alert = Alert;
28791
28832
  exports.Button = Button;
@@ -28795,6 +28836,7 @@ exports.ButtonWithPopover = ButtonWithPopover;
28795
28836
  exports.Carousel = Carousel;
28796
28837
  exports.Checkbox = Checkbox;
28797
28838
  exports.Collapse = Collapse;
28839
+ exports.DEFAULT_TOOL_TIP_DELAY = DEFAULT_TOOL_TIP_DELAY;
28798
28840
  exports.Icon = Icon;
28799
28841
  exports.InputGroup = InputGroup;
28800
28842
  exports.Modal = Modal;
@@ -28809,4 +28851,12 @@ exports.TextArea = TextArea;
28809
28851
  exports.TextField = TextField;
28810
28852
  exports.ToolbarButton = ToolbarButton;
28811
28853
  exports.Tooltip = Tooltip;
28854
+ exports.buttonSizes = buttonSizes;
28855
+ exports.buttonTypes = buttonTypes;
28856
+ exports.buttonVariants = buttonVariants;
28857
+ exports.iconPositions = iconPositions;
28858
+ exports.iconTypes = iconTypes;
28859
+ exports.svgIconTypes = svgIconTypes;
28860
+ exports.toolbarButtonVariants = toolbarButtonVariants;
28861
+ exports.tooltipPositions = tooltipPositions;
28812
28862
  //# sourceMappingURL=index.js.map