@warp-ds/elements 1.4.1-next.1 → 1.4.1-next.2

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.
@@ -2520,7 +2520,7 @@ var computePosition2 = (reference, floating, options) => {
2520
2520
  }));
2521
2521
  };
2522
2522
 
2523
- // node_modules/.pnpm/@warp-ds+core@1.1.1_@floating-ui+dom@1.6.3/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
2523
+ // node_modules/.pnpm/@warp-ds+core@1.1.2_@floating-ui+dom@1.6.3/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
2524
2524
  var TOP_START = "top-start";
2525
2525
  var TOP = "top";
2526
2526
  var TOP_END = "top-end";
@@ -2575,8 +2575,6 @@ var rotation = {
2575
2575
  [BOTTOM]: -135,
2576
2576
  [BOTTOM_END]: -135
2577
2577
  };
2578
- var middlePosition = "calc(50% - 7px)";
2579
- var isDirectionVertical = (name) => [TOP_START, TOP, TOP_END, BOTTOM_START, BOTTOM, BOTTOM_END].includes(name);
2580
2578
  var arrowDirectionClassname = (dir) => {
2581
2579
  let direction;
2582
2580
  if (/-/.test(dir)) {
@@ -2599,17 +2597,6 @@ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
2599
2597
  transform: `rotate(${arrowRotation2}deg)`
2600
2598
  });
2601
2599
  };
2602
- function computeCalloutArrow({ actualDirection, directionName = BOTTOM, arrowEl }) {
2603
- if (!arrowEl)
2604
- return;
2605
- actualDirection = directionName;
2606
- const directionIsVertical = isDirectionVertical(directionName);
2607
- Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
2608
- left: directionIsVertical ? middlePosition : "",
2609
- top: !directionIsVertical ? middlePosition : ""
2610
- });
2611
- applyArrowStyles(arrowEl, arrowRotation(actualDirection), actualDirection);
2612
- }
2613
2600
  async function useRecompute(state) {
2614
2601
  var _a, _b, _c;
2615
2602
  if (!(state == null ? void 0 : state.isShowing))
@@ -2617,33 +2604,34 @@ async function useRecompute(state) {
2617
2604
  if (state == null ? void 0 : state.waitForDOM) {
2618
2605
  await (state == null ? void 0 : state.waitForDOM());
2619
2606
  }
2620
- if (state == null ? void 0 : state.isCallout)
2621
- return computeCalloutArrow(state);
2622
2607
  if (!(state == null ? void 0 : state.targetEl) || !(state == null ? void 0 : state.attentionEl))
2623
2608
  return;
2624
- const targetEl = state == null ? void 0 : state.targetEl;
2625
- const attentionEl = state == null ? void 0 : state.attentionEl;
2609
+ let targetEl = state == null ? void 0 : state.targetEl;
2610
+ const attentionEl = state.attentionEl;
2626
2611
  computePosition2(targetEl, attentionEl, {
2627
2612
  placement: (_a = state == null ? void 0 : state.directionName) != null ? _a : BOTTOM,
2628
2613
  middleware: [
2629
2614
  offset({ mainAxis: (_b = state == null ? void 0 : state.distance) != null ? _b : 8, crossAxis: (_c = state == null ? void 0 : state.skidding) != null ? _c : 0 }),
2630
2615
  (state == null ? void 0 : state.flip) && flip2({
2616
+ // when flip is set to true it will move the attentionEl's placement to its opposite side or to the preferred placements if fallbackPlacements has a value
2631
2617
  crossAxis: state == null ? void 0 : state.crossAxis,
2632
2618
  fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
2633
2619
  }),
2634
2620
  !(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
2635
2621
  hide2()
2636
- //will hide the attentionEl when it appears detached from the targetEl. Can be called multiple times in the middleware-array if you want to use several strategies. Default strategy is 'referenceHidden'.
2622
+ // will hide the attentionEl when it appears detached from the targetEl. Can be called multiple times in the middleware-array if you want to use several strategies. Default strategy is 'referenceHidden'.
2637
2623
  ]
2638
2624
  }).then(({ x, y, middlewareData, placement }) => {
2639
2625
  state.actualDirection = placement;
2640
- Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
2641
- left: `${x}px`,
2642
- top: `${y}px`
2643
- });
2626
+ if (!(state == null ? void 0 : state.isCallout)) {
2627
+ Object.assign(attentionEl.style, {
2628
+ left: `${x}px`,
2629
+ top: `${y}px`
2630
+ });
2631
+ }
2644
2632
  if ((middlewareData == null ? void 0 : middlewareData.hide) && !(state == null ? void 0 : state.isCallout)) {
2645
- const { referenceHidden } = middlewareData == null ? void 0 : middlewareData.hide;
2646
- Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
2633
+ const { referenceHidden } = middlewareData.hide;
2634
+ Object.assign(attentionEl.style, {
2647
2635
  visibility: referenceHidden ? "hidden" : ""
2648
2636
  });
2649
2637
  }
@@ -2651,26 +2639,26 @@ async function useRecompute(state) {
2651
2639
  const arrowPlacement = arrowDirection(placement).split("-")[1];
2652
2640
  if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
2653
2641
  const arrowEl = state == null ? void 0 : state.arrowEl;
2654
- const { x: x2, y: y2 } = middlewareData == null ? void 0 : middlewareData.arrow;
2642
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
2655
2643
  let top = "";
2656
2644
  let right = "";
2657
2645
  let bottom = "";
2658
2646
  let left = "";
2659
2647
  if (arrowPlacement === "start") {
2660
- const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2661
- top = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2648
+ const value = typeof arrowX === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
2649
+ top = typeof arrowY === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
2662
2650
  right = isRtl ? value : "";
2663
2651
  left = isRtl ? "" : value;
2664
2652
  } else if (arrowPlacement === "end") {
2665
- const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2653
+ const value = typeof arrowX === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
2666
2654
  right = isRtl ? "" : value;
2667
2655
  left = isRtl ? value : "";
2668
- bottom = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2656
+ bottom = typeof arrowY === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
2669
2657
  } else {
2670
- left = typeof x2 === "number" ? `${x2}px` : "";
2671
- top = typeof y2 === "number" ? `${y2}px` : "";
2658
+ left = typeof arrowX === "number" ? `${arrowX}px` : "";
2659
+ top = typeof arrowY === "number" ? `${arrowY}px` : "";
2672
2660
  }
2673
- Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
2661
+ Object.assign(arrowEl.style, {
2674
2662
  top,
2675
2663
  right,
2676
2664
  bottom,
@@ -2682,7 +2670,7 @@ async function useRecompute(state) {
2682
2670
  return state;
2683
2671
  }
2684
2672
 
2685
- // node_modules/.pnpm/@warp-ds+css@1.9.6/node_modules/@warp-ds/css/component-classes/index.js
2673
+ // node_modules/.pnpm/@warp-ds+css@1.9.7/node_modules/@warp-ds/css/component-classes/index.js
2686
2674
  var box = {
2687
2675
  box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
2688
2676
  // Relative here enables w-clickable
@@ -3041,7 +3029,7 @@ var messages2 = JSON.parse('{"attention.aria.callout":"callout speech bubble","a
3041
3029
  // packages/attention/locales/nb/messages.mjs
3042
3030
  var messages3 = JSON.parse('{"attention.aria.callout":"callout speech bubble","attention.aria.close":"Lukk","attention.aria.highlight":"highlighted speech bubble","attention.aria.pointingDown":"pointing down","attention.aria.pointingLeft":"pointing left","attention.aria.pointingRight":"pointing right","attention.aria.pointingUp":"pointing up","attention.aria.popover":"popover speech bubble","attention.aria.tooltip":"tooltip"}');
3043
3031
 
3044
- // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
3032
+ // node_modules/.pnpm/@warp-ds+icons@2.0.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
3045
3033
  import { LitElement } from "lit";
3046
3034
  import { unsafeStatic, html } from "lit/static-html.js";
3047
3035
  var messages4 = JSON.parse('{"icon.title.close":"Kryss"}');