@warp-ds/elements 2.0.2-next.5 → 2.0.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.
- package/dist/index.js +26 -185
- package/dist/index.js.map +4 -4
- package/dist/packages/attention/index.js +24 -177
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/breadcrumbs/index.js +1 -1
- package/dist/packages/breadcrumbs/index.js.map +1 -1
- package/dist/packages/select/index.d.ts +0 -3
- package/dist/packages/select/index.js +1 -7
- package/dist/packages/select/index.js.map +2 -2
- package/package.json +3 -5
|
@@ -645,13 +645,13 @@ var require_moo = __commonJS({
|
|
|
645
645
|
line: this.line,
|
|
646
646
|
col: this.col
|
|
647
647
|
};
|
|
648
|
-
var
|
|
649
|
-
this.index +=
|
|
648
|
+
var size2 = text.length;
|
|
649
|
+
this.index += size2;
|
|
650
650
|
this.line += lineBreaks;
|
|
651
651
|
if (lineBreaks !== 0) {
|
|
652
|
-
this.col =
|
|
652
|
+
this.col = size2 - nl + 1;
|
|
653
653
|
} else {
|
|
654
|
-
this.col +=
|
|
654
|
+
this.col += size2;
|
|
655
655
|
}
|
|
656
656
|
if (group.shouldThrow) {
|
|
657
657
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
@@ -2004,151 +2004,6 @@ var offset = function(options) {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
};
|
|
2006
2006
|
};
|
|
2007
|
-
var shift = function(options) {
|
|
2008
|
-
if (options === void 0) {
|
|
2009
|
-
options = {};
|
|
2010
|
-
}
|
|
2011
|
-
return {
|
|
2012
|
-
name: "shift",
|
|
2013
|
-
options,
|
|
2014
|
-
async fn(state) {
|
|
2015
|
-
const {
|
|
2016
|
-
x,
|
|
2017
|
-
y,
|
|
2018
|
-
placement
|
|
2019
|
-
} = state;
|
|
2020
|
-
const _a = evaluate(options, state), {
|
|
2021
|
-
mainAxis: checkMainAxis = true,
|
|
2022
|
-
crossAxis: checkCrossAxis = false,
|
|
2023
|
-
limiter = {
|
|
2024
|
-
fn: (_ref) => {
|
|
2025
|
-
let {
|
|
2026
|
-
x: x2,
|
|
2027
|
-
y: y2
|
|
2028
|
-
} = _ref;
|
|
2029
|
-
return {
|
|
2030
|
-
x: x2,
|
|
2031
|
-
y: y2
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2036
|
-
"mainAxis",
|
|
2037
|
-
"crossAxis",
|
|
2038
|
-
"limiter"
|
|
2039
|
-
]);
|
|
2040
|
-
const coords = {
|
|
2041
|
-
x,
|
|
2042
|
-
y
|
|
2043
|
-
};
|
|
2044
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2045
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
2046
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
2047
|
-
let mainAxisCoord = coords[mainAxis];
|
|
2048
|
-
let crossAxisCoord = coords[crossAxis];
|
|
2049
|
-
if (checkMainAxis) {
|
|
2050
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
|
2051
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
2052
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
|
2053
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
|
2054
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
2055
|
-
}
|
|
2056
|
-
if (checkCrossAxis) {
|
|
2057
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
2058
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
2059
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
|
2060
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
|
2061
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
2062
|
-
}
|
|
2063
|
-
const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
|
|
2064
|
-
[mainAxis]: mainAxisCoord,
|
|
2065
|
-
[crossAxis]: crossAxisCoord
|
|
2066
|
-
}));
|
|
2067
|
-
return __spreadProps(__spreadValues({}, limitedCoords), {
|
|
2068
|
-
data: {
|
|
2069
|
-
x: limitedCoords.x - x,
|
|
2070
|
-
y: limitedCoords.y - y
|
|
2071
|
-
}
|
|
2072
|
-
});
|
|
2073
|
-
}
|
|
2074
|
-
};
|
|
2075
|
-
};
|
|
2076
|
-
var size = function(options) {
|
|
2077
|
-
if (options === void 0) {
|
|
2078
|
-
options = {};
|
|
2079
|
-
}
|
|
2080
|
-
return {
|
|
2081
|
-
name: "size",
|
|
2082
|
-
options,
|
|
2083
|
-
async fn(state) {
|
|
2084
|
-
const {
|
|
2085
|
-
placement,
|
|
2086
|
-
rects,
|
|
2087
|
-
platform: platform2,
|
|
2088
|
-
elements
|
|
2089
|
-
} = state;
|
|
2090
|
-
const _a = evaluate(options, state), {
|
|
2091
|
-
apply = () => {
|
|
2092
|
-
}
|
|
2093
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2094
|
-
"apply"
|
|
2095
|
-
]);
|
|
2096
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2097
|
-
const side2 = getSide(placement);
|
|
2098
|
-
const alignment = getAlignment(placement);
|
|
2099
|
-
const isYAxis = getSideAxis(placement) === "y";
|
|
2100
|
-
const {
|
|
2101
|
-
width,
|
|
2102
|
-
height
|
|
2103
|
-
} = rects.floating;
|
|
2104
|
-
let heightSide;
|
|
2105
|
-
let widthSide;
|
|
2106
|
-
if (side2 === "top" || side2 === "bottom") {
|
|
2107
|
-
heightSide = side2;
|
|
2108
|
-
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
2109
|
-
} else {
|
|
2110
|
-
widthSide = side2;
|
|
2111
|
-
heightSide = alignment === "end" ? "top" : "bottom";
|
|
2112
|
-
}
|
|
2113
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
2114
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
2115
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
2116
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
2117
|
-
const noShift = !state.middlewareData.shift;
|
|
2118
|
-
let availableHeight = overflowAvailableHeight;
|
|
2119
|
-
let availableWidth = overflowAvailableWidth;
|
|
2120
|
-
if (isYAxis) {
|
|
2121
|
-
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
2122
|
-
} else {
|
|
2123
|
-
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
2124
|
-
}
|
|
2125
|
-
if (noShift && !alignment) {
|
|
2126
|
-
const xMin = max(overflow.left, 0);
|
|
2127
|
-
const xMax = max(overflow.right, 0);
|
|
2128
|
-
const yMin = max(overflow.top, 0);
|
|
2129
|
-
const yMax = max(overflow.bottom, 0);
|
|
2130
|
-
if (isYAxis) {
|
|
2131
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
2132
|
-
} else {
|
|
2133
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
await apply(__spreadProps(__spreadValues({}, state), {
|
|
2137
|
-
availableWidth,
|
|
2138
|
-
availableHeight
|
|
2139
|
-
}));
|
|
2140
|
-
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
2141
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
2142
|
-
return {
|
|
2143
|
-
reset: {
|
|
2144
|
-
rects: true
|
|
2145
|
-
}
|
|
2146
|
-
};
|
|
2147
|
-
}
|
|
2148
|
-
return {};
|
|
2149
|
-
}
|
|
2150
|
-
};
|
|
2151
|
-
};
|
|
2152
2007
|
|
|
2153
2008
|
// node_modules/.pnpm/@floating-ui+utils@0.2.7/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2154
2009
|
function getNodeName(node) {
|
|
@@ -2686,9 +2541,7 @@ var platform = {
|
|
|
2686
2541
|
isRTL
|
|
2687
2542
|
};
|
|
2688
2543
|
var offset2 = offset;
|
|
2689
|
-
var shift2 = shift;
|
|
2690
2544
|
var flip2 = flip;
|
|
2691
|
-
var size2 = size;
|
|
2692
2545
|
var hide2 = hide;
|
|
2693
2546
|
var arrow2 = arrow;
|
|
2694
2547
|
var computePosition2 = (reference, floating, options) => {
|
|
@@ -2704,7 +2557,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
2704
2557
|
}));
|
|
2705
2558
|
};
|
|
2706
2559
|
|
|
2707
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
2560
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.5_@floating-ui+dom@1.6.10/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
|
|
2708
2561
|
var TOP_START = "top-start";
|
|
2709
2562
|
var TOP = "top";
|
|
2710
2563
|
var TOP_END = "top-end";
|
|
@@ -2781,8 +2634,6 @@ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
|
|
|
2781
2634
|
transform: `rotate(${arrowRotation2}deg)`
|
|
2782
2635
|
});
|
|
2783
2636
|
};
|
|
2784
|
-
var ELEMENT_PADDING = 8;
|
|
2785
|
-
var ARROW_OFFSET = 24;
|
|
2786
2637
|
async function useRecompute(state) {
|
|
2787
2638
|
var _a, _b, _c;
|
|
2788
2639
|
if (!(state == null ? void 0 : state.isShowing))
|
|
@@ -2805,19 +2656,9 @@ async function useRecompute(state) {
|
|
|
2805
2656
|
// checks overflow to trigger a flip. When disabled, it will ignore overflow
|
|
2806
2657
|
fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
|
|
2807
2658
|
}),
|
|
2808
|
-
(state == null ? void 0 : state.flip) && shift2({ crossAxis: true }),
|
|
2809
|
-
// shifts the attentionEl to make sure that it stays in view
|
|
2810
2659
|
!(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
|
|
2811
|
-
hide2()
|
|
2660
|
+
hide2()
|
|
2812
2661
|
// 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'.
|
|
2813
|
-
size2({
|
|
2814
|
-
apply() {
|
|
2815
|
-
Object.assign(attentionEl.style, {
|
|
2816
|
-
paddingRight: `${ELEMENT_PADDING}px`,
|
|
2817
|
-
paddingLeft: `${ELEMENT_PADDING}px`
|
|
2818
|
-
});
|
|
2819
|
-
}
|
|
2820
|
-
})
|
|
2821
2662
|
]
|
|
2822
2663
|
}).then(({ x, y, middlewareData, placement }) => {
|
|
2823
2664
|
state.actualDirection = placement;
|
|
@@ -2833,22 +2674,25 @@ async function useRecompute(state) {
|
|
|
2833
2674
|
visibility: referenceHidden ? "hidden" : ""
|
|
2834
2675
|
});
|
|
2835
2676
|
}
|
|
2677
|
+
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
2678
|
+
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
2836
2679
|
if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
|
|
2837
2680
|
const arrowEl = state == null ? void 0 : state.arrowEl;
|
|
2838
2681
|
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
let
|
|
2682
|
+
let top = "";
|
|
2683
|
+
let right = "";
|
|
2684
|
+
let bottom = "";
|
|
2685
|
+
let left = "";
|
|
2842
2686
|
if (arrowPlacement === "start") {
|
|
2843
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
2844
|
-
top = typeof arrowY === "number" ? `calc(
|
|
2687
|
+
const value = typeof arrowX === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2688
|
+
top = typeof arrowY === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2845
2689
|
right = isRtl ? value : "";
|
|
2846
2690
|
left = isRtl ? "" : value;
|
|
2847
2691
|
} else if (arrowPlacement === "end") {
|
|
2848
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
2692
|
+
const value = typeof arrowX === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2849
2693
|
right = isRtl ? "" : value;
|
|
2850
2694
|
left = isRtl ? value : "";
|
|
2851
|
-
bottom = typeof arrowY === "number" ? `calc(
|
|
2695
|
+
bottom = typeof arrowY === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2852
2696
|
} else {
|
|
2853
2697
|
left = typeof arrowX === "number" ? `${arrowX}px` : "";
|
|
2854
2698
|
top = typeof arrowY === "number" ? `${arrowY}px` : "";
|
|
@@ -3341,7 +3185,7 @@ ${JSON.stringify(directions)}`
|
|
|
3341
3185
|
]);
|
|
3342
3186
|
}
|
|
3343
3187
|
get _arrowHtml() {
|
|
3344
|
-
return this.noArrow ? "" : html2`<div id="arrow" class="${this._arrowClasses}"></div>`;
|
|
3188
|
+
return this.noArrow ? "" : html2`<div id="arrow" role="img" class="${this._arrowClasses}"></div>`;
|
|
3345
3189
|
}
|
|
3346
3190
|
get _activeVariantClasses() {
|
|
3347
3191
|
const variantProps = {
|
|
@@ -3514,16 +3358,19 @@ ${JSON.stringify(directions)}`
|
|
|
3514
3358
|
${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html2`
|
|
3515
3359
|
<slot name="target"></slot>
|
|
3516
3360
|
|
|
3517
|
-
<div
|
|
3518
|
-
|
|
3361
|
+
<div
|
|
3362
|
+
id="attention"
|
|
3363
|
+
role="${this.tooltip ? "tooltip" : "img"}"
|
|
3364
|
+
aria-label="${this.defaultAriaLabel()}"
|
|
3365
|
+
class="${this._wrapperClasses}">
|
|
3366
|
+
${this._arrowHtml}
|
|
3519
3367
|
<slot name="message"></slot>
|
|
3520
3368
|
${this.canClose ? this._closeBtnHtml : nothing}
|
|
3521
3369
|
</div>
|
|
3522
3370
|
` : html2`
|
|
3523
3371
|
<div id="attention" class="${this._wrapperClasses}">
|
|
3524
3372
|
<slot name="message"></slot>
|
|
3525
|
-
|
|
3526
|
-
${this.canClose ? this._closeBtnHtml : nothing}
|
|
3373
|
+
${this._arrowHtml} ${this.canClose ? this._closeBtnHtml : nothing}
|
|
3527
3374
|
</div>
|
|
3528
3375
|
<slot name="target"></slot>
|
|
3529
3376
|
`}
|