@warp-ds/elements 2.0.2-next.6 → 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 +27 -189
- package/dist/index.js.map +4 -4
- package/dist/packages/attention/index.js +25 -181
- 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
package/dist/index.js
CHANGED
|
@@ -651,13 +651,13 @@ var require_moo = __commonJS({
|
|
|
651
651
|
line: this.line,
|
|
652
652
|
col: this.col
|
|
653
653
|
};
|
|
654
|
-
var
|
|
655
|
-
this.index +=
|
|
654
|
+
var size2 = text.length;
|
|
655
|
+
this.index += size2;
|
|
656
656
|
this.line += lineBreaks;
|
|
657
657
|
if (lineBreaks !== 0) {
|
|
658
|
-
this.col =
|
|
658
|
+
this.col = size2 - nl + 1;
|
|
659
659
|
} else {
|
|
660
|
-
this.col +=
|
|
660
|
+
this.col += size2;
|
|
661
661
|
}
|
|
662
662
|
if (group.shouldThrow) {
|
|
663
663
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
@@ -3125,151 +3125,6 @@ var offset = function(options) {
|
|
|
3125
3125
|
}
|
|
3126
3126
|
};
|
|
3127
3127
|
};
|
|
3128
|
-
var shift = function(options) {
|
|
3129
|
-
if (options === void 0) {
|
|
3130
|
-
options = {};
|
|
3131
|
-
}
|
|
3132
|
-
return {
|
|
3133
|
-
name: "shift",
|
|
3134
|
-
options,
|
|
3135
|
-
async fn(state) {
|
|
3136
|
-
const {
|
|
3137
|
-
x,
|
|
3138
|
-
y: y2,
|
|
3139
|
-
placement
|
|
3140
|
-
} = state;
|
|
3141
|
-
const _a = evaluate(options, state), {
|
|
3142
|
-
mainAxis: checkMainAxis = true,
|
|
3143
|
-
crossAxis: checkCrossAxis = false,
|
|
3144
|
-
limiter = {
|
|
3145
|
-
fn: (_ref) => {
|
|
3146
|
-
let {
|
|
3147
|
-
x: x2,
|
|
3148
|
-
y: y3
|
|
3149
|
-
} = _ref;
|
|
3150
|
-
return {
|
|
3151
|
-
x: x2,
|
|
3152
|
-
y: y3
|
|
3153
|
-
};
|
|
3154
|
-
}
|
|
3155
|
-
}
|
|
3156
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
3157
|
-
"mainAxis",
|
|
3158
|
-
"crossAxis",
|
|
3159
|
-
"limiter"
|
|
3160
|
-
]);
|
|
3161
|
-
const coords = {
|
|
3162
|
-
x,
|
|
3163
|
-
y: y2
|
|
3164
|
-
};
|
|
3165
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3166
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
3167
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
3168
|
-
let mainAxisCoord = coords[mainAxis];
|
|
3169
|
-
let crossAxisCoord = coords[crossAxis];
|
|
3170
|
-
if (checkMainAxis) {
|
|
3171
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
|
3172
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
3173
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
|
3174
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
|
3175
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
3176
|
-
}
|
|
3177
|
-
if (checkCrossAxis) {
|
|
3178
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
3179
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
3180
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
|
3181
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
|
3182
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
3183
|
-
}
|
|
3184
|
-
const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
|
|
3185
|
-
[mainAxis]: mainAxisCoord,
|
|
3186
|
-
[crossAxis]: crossAxisCoord
|
|
3187
|
-
}));
|
|
3188
|
-
return __spreadProps(__spreadValues({}, limitedCoords), {
|
|
3189
|
-
data: {
|
|
3190
|
-
x: limitedCoords.x - x,
|
|
3191
|
-
y: limitedCoords.y - y2
|
|
3192
|
-
}
|
|
3193
|
-
});
|
|
3194
|
-
}
|
|
3195
|
-
};
|
|
3196
|
-
};
|
|
3197
|
-
var size = function(options) {
|
|
3198
|
-
if (options === void 0) {
|
|
3199
|
-
options = {};
|
|
3200
|
-
}
|
|
3201
|
-
return {
|
|
3202
|
-
name: "size",
|
|
3203
|
-
options,
|
|
3204
|
-
async fn(state) {
|
|
3205
|
-
const {
|
|
3206
|
-
placement,
|
|
3207
|
-
rects,
|
|
3208
|
-
platform: platform2,
|
|
3209
|
-
elements
|
|
3210
|
-
} = state;
|
|
3211
|
-
const _a = evaluate(options, state), {
|
|
3212
|
-
apply = () => {
|
|
3213
|
-
}
|
|
3214
|
-
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
3215
|
-
"apply"
|
|
3216
|
-
]);
|
|
3217
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3218
|
-
const side2 = getSide(placement);
|
|
3219
|
-
const alignment = getAlignment(placement);
|
|
3220
|
-
const isYAxis = getSideAxis(placement) === "y";
|
|
3221
|
-
const {
|
|
3222
|
-
width,
|
|
3223
|
-
height
|
|
3224
|
-
} = rects.floating;
|
|
3225
|
-
let heightSide;
|
|
3226
|
-
let widthSide;
|
|
3227
|
-
if (side2 === "top" || side2 === "bottom") {
|
|
3228
|
-
heightSide = side2;
|
|
3229
|
-
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
3230
|
-
} else {
|
|
3231
|
-
widthSide = side2;
|
|
3232
|
-
heightSide = alignment === "end" ? "top" : "bottom";
|
|
3233
|
-
}
|
|
3234
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
3235
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
3236
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
3237
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
3238
|
-
const noShift = !state.middlewareData.shift;
|
|
3239
|
-
let availableHeight = overflowAvailableHeight;
|
|
3240
|
-
let availableWidth = overflowAvailableWidth;
|
|
3241
|
-
if (isYAxis) {
|
|
3242
|
-
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
3243
|
-
} else {
|
|
3244
|
-
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
3245
|
-
}
|
|
3246
|
-
if (noShift && !alignment) {
|
|
3247
|
-
const xMin = max(overflow.left, 0);
|
|
3248
|
-
const xMax = max(overflow.right, 0);
|
|
3249
|
-
const yMin = max(overflow.top, 0);
|
|
3250
|
-
const yMax = max(overflow.bottom, 0);
|
|
3251
|
-
if (isYAxis) {
|
|
3252
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
3253
|
-
} else {
|
|
3254
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3257
|
-
await apply(__spreadProps(__spreadValues({}, state), {
|
|
3258
|
-
availableWidth,
|
|
3259
|
-
availableHeight
|
|
3260
|
-
}));
|
|
3261
|
-
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
3262
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
3263
|
-
return {
|
|
3264
|
-
reset: {
|
|
3265
|
-
rects: true
|
|
3266
|
-
}
|
|
3267
|
-
};
|
|
3268
|
-
}
|
|
3269
|
-
return {};
|
|
3270
|
-
}
|
|
3271
|
-
};
|
|
3272
|
-
};
|
|
3273
3128
|
|
|
3274
3129
|
// node_modules/.pnpm/@floating-ui+utils@0.2.7/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
3275
3130
|
function getNodeName(node) {
|
|
@@ -3807,9 +3662,7 @@ var platform = {
|
|
|
3807
3662
|
isRTL
|
|
3808
3663
|
};
|
|
3809
3664
|
var offset2 = offset;
|
|
3810
|
-
var shift2 = shift;
|
|
3811
3665
|
var flip2 = flip;
|
|
3812
|
-
var size2 = size;
|
|
3813
3666
|
var hide2 = hide;
|
|
3814
3667
|
var arrow2 = arrow;
|
|
3815
3668
|
var computePosition2 = (reference, floating, options) => {
|
|
@@ -3825,7 +3678,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
3825
3678
|
}));
|
|
3826
3679
|
};
|
|
3827
3680
|
|
|
3828
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
3681
|
+
// 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
|
|
3829
3682
|
var TOP_START = "top-start";
|
|
3830
3683
|
var TOP = "top";
|
|
3831
3684
|
var TOP_END = "top-end";
|
|
@@ -3902,8 +3755,6 @@ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
|
|
|
3902
3755
|
transform: `rotate(${arrowRotation2}deg)`
|
|
3903
3756
|
});
|
|
3904
3757
|
};
|
|
3905
|
-
var ELEMENT_PADDING = 8;
|
|
3906
|
-
var ARROW_OFFSET = 24;
|
|
3907
3758
|
async function useRecompute(state) {
|
|
3908
3759
|
var _a, _b, _c;
|
|
3909
3760
|
if (!(state == null ? void 0 : state.isShowing))
|
|
@@ -3926,19 +3777,9 @@ async function useRecompute(state) {
|
|
|
3926
3777
|
// checks overflow to trigger a flip. When disabled, it will ignore overflow
|
|
3927
3778
|
fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
|
|
3928
3779
|
}),
|
|
3929
|
-
(state == null ? void 0 : state.flip) && shift2({ crossAxis: true }),
|
|
3930
|
-
// shifts the attentionEl to make sure that it stays in view
|
|
3931
3780
|
!(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
|
|
3932
|
-
hide2()
|
|
3781
|
+
hide2()
|
|
3933
3782
|
// 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'.
|
|
3934
|
-
size2({
|
|
3935
|
-
apply() {
|
|
3936
|
-
Object.assign(attentionEl.style, {
|
|
3937
|
-
paddingRight: `${ELEMENT_PADDING}px`,
|
|
3938
|
-
paddingLeft: `${ELEMENT_PADDING}px`
|
|
3939
|
-
});
|
|
3940
|
-
}
|
|
3941
|
-
})
|
|
3942
3783
|
]
|
|
3943
3784
|
}).then(({ x, y: y2, middlewareData, placement }) => {
|
|
3944
3785
|
state.actualDirection = placement;
|
|
@@ -3954,22 +3795,25 @@ async function useRecompute(state) {
|
|
|
3954
3795
|
visibility: referenceHidden ? "hidden" : ""
|
|
3955
3796
|
});
|
|
3956
3797
|
}
|
|
3798
|
+
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
3799
|
+
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
3957
3800
|
if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
|
|
3958
3801
|
const arrowEl = state == null ? void 0 : state.arrowEl;
|
|
3959
3802
|
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
let
|
|
3803
|
+
let top = "";
|
|
3804
|
+
let right = "";
|
|
3805
|
+
let bottom = "";
|
|
3806
|
+
let left = "";
|
|
3963
3807
|
if (arrowPlacement === "start") {
|
|
3964
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
3965
|
-
top = typeof arrowY === "number" ? `calc(
|
|
3808
|
+
const value = typeof arrowX === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3809
|
+
top = typeof arrowY === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3966
3810
|
right = isRtl ? value : "";
|
|
3967
3811
|
left = isRtl ? "" : value;
|
|
3968
3812
|
} else if (arrowPlacement === "end") {
|
|
3969
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
3813
|
+
const value = typeof arrowX === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3970
3814
|
right = isRtl ? "" : value;
|
|
3971
3815
|
left = isRtl ? value : "";
|
|
3972
|
-
bottom = typeof arrowY === "number" ? `calc(
|
|
3816
|
+
bottom = typeof arrowY === "number" ? `calc(24px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3973
3817
|
} else {
|
|
3974
3818
|
left = typeof arrowX === "number" ? `${arrowX}px` : "";
|
|
3975
3819
|
top = typeof arrowY === "number" ? `${arrowY}px` : "";
|
|
@@ -4069,10 +3913,7 @@ ${JSON.stringify(Object.keys(opposites))}`);
|
|
|
4069
3913
|
${JSON.stringify(directions)}`
|
|
4070
3914
|
);
|
|
4071
3915
|
}
|
|
4072
|
-
setTimeout(() =>
|
|
4073
|
-
this.requestUpdate();
|
|
4074
|
-
this.handleDone();
|
|
4075
|
-
}, 0);
|
|
3916
|
+
setTimeout(() => this.requestUpdate(), 0);
|
|
4076
3917
|
if (!this.callout) {
|
|
4077
3918
|
window.addEventListener("click", this.handleDone);
|
|
4078
3919
|
window.addEventListener("scroll", this.handleDone);
|
|
@@ -4124,7 +3965,7 @@ ${JSON.stringify(directions)}`
|
|
|
4124
3965
|
]);
|
|
4125
3966
|
}
|
|
4126
3967
|
get _arrowHtml() {
|
|
4127
|
-
return this.noArrow ? "" : html9`<div id="arrow" class="${this._arrowClasses}"></div>`;
|
|
3968
|
+
return this.noArrow ? "" : html9`<div id="arrow" role="img" class="${this._arrowClasses}"></div>`;
|
|
4128
3969
|
}
|
|
4129
3970
|
get _activeVariantClasses() {
|
|
4130
3971
|
const variantProps = {
|
|
@@ -4297,16 +4138,19 @@ ${JSON.stringify(directions)}`
|
|
|
4297
4138
|
${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html9`
|
|
4298
4139
|
<slot name="target"></slot>
|
|
4299
4140
|
|
|
4300
|
-
<div
|
|
4301
|
-
|
|
4141
|
+
<div
|
|
4142
|
+
id="attention"
|
|
4143
|
+
role="${this.tooltip ? "tooltip" : "img"}"
|
|
4144
|
+
aria-label="${this.defaultAriaLabel()}"
|
|
4145
|
+
class="${this._wrapperClasses}">
|
|
4146
|
+
${this._arrowHtml}
|
|
4302
4147
|
<slot name="message"></slot>
|
|
4303
4148
|
${this.canClose ? this._closeBtnHtml : nothing}
|
|
4304
4149
|
</div>
|
|
4305
4150
|
` : html9`
|
|
4306
4151
|
<div id="attention" class="${this._wrapperClasses}">
|
|
4307
4152
|
<slot name="message"></slot>
|
|
4308
|
-
|
|
4309
|
-
${this.canClose ? this._closeBtnHtml : nothing}
|
|
4153
|
+
${this._arrowHtml} ${this.canClose ? this._closeBtnHtml : nothing}
|
|
4310
4154
|
</div>
|
|
4311
4155
|
<slot name="target"></slot>
|
|
4312
4156
|
`}
|
|
@@ -4456,7 +4300,7 @@ if (!customElements.get("w-box")) {
|
|
|
4456
4300
|
// packages/breadcrumbs/index.js
|
|
4457
4301
|
import { html as html12 } from "lit";
|
|
4458
4302
|
|
|
4459
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
4303
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.5_@floating-ui+dom@1.6.10/node_modules/@warp-ds/core/dist/breadcrumbs/index.js
|
|
4460
4304
|
function interleave(array, separator2) {
|
|
4461
4305
|
return array.flatMap((el) => [el, separator2]).slice(0, -1);
|
|
4462
4306
|
}
|
|
@@ -5753,11 +5597,6 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement15) {
|
|
|
5753
5597
|
event.preventDefault();
|
|
5754
5598
|
}
|
|
5755
5599
|
}
|
|
5756
|
-
// Fire a custom 'change' event, used when the dropdown changes state.
|
|
5757
|
-
onChange({ target }) {
|
|
5758
|
-
const event = new CustomEvent("change", { detail: target.value });
|
|
5759
|
-
this.dispatchEvent(event);
|
|
5760
|
-
}
|
|
5761
5600
|
render() {
|
|
5762
5601
|
return html24`<div class="${select.wrapper}">
|
|
5763
5602
|
${when(
|
|
@@ -5784,8 +5623,7 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement15) {
|
|
|
5784
5623
|
aria-describedby="${ifDefined5(__privateGet(this, _WarpSelect_instances, helpId_get))}"
|
|
5785
5624
|
aria-invalid="${ifDefined5(this.invalid)}"
|
|
5786
5625
|
aria-errormessage="${ifDefined5(this.invalid && __privateGet(this, _WarpSelect_instances, helpId_get))}"
|
|
5787
|
-
@keydown=${this.handleKeyDown}
|
|
5788
|
-
@change=${this.onChange}>
|
|
5626
|
+
@keydown=${this.handleKeyDown}>
|
|
5789
5627
|
${unsafeHTML(this._options)}
|
|
5790
5628
|
</select>
|
|
5791
5629
|
<div class="${__privateGet(this, _WarpSelect_instances, chevronClasses_get2)}">
|