@warp-ds/elements 2.0.1-next.2 → 2.0.2-next.1
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 +357 -188
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.js +36 -34
- package/dist/packages/affix/index.js.map +3 -3
- package/dist/packages/alert/index.js +64 -60
- package/dist/packages/alert/index.js.map +3 -3
- package/dist/packages/attention/index.js +189 -28
- 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/expandable/index.js +36 -34
- package/dist/packages/expandable/index.js.map +3 -3
- package/dist/packages/modal/index.js +42 -40
- package/dist/packages/modal/index.js.map +3 -3
- package/dist/packages/pill/index.js +29 -28
- package/dist/packages/pill/index.js.map +3 -3
- package/dist/packages/select/index.js +13 -12
- package/dist/packages/select/index.js.map +3 -3
- package/dist/packages/toast/index.js +70 -66
- package/dist/packages/toast/index.js.map +3 -3
- package/package.json +3 -3
|
@@ -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 size3 = text.length;
|
|
649
|
+
this.index += size3;
|
|
650
650
|
this.line += lineBreaks;
|
|
651
651
|
if (lineBreaks !== 0) {
|
|
652
|
-
this.col =
|
|
652
|
+
this.col = size3 - nl + 1;
|
|
653
653
|
} else {
|
|
654
|
-
this.col +=
|
|
654
|
+
this.col += size3;
|
|
655
655
|
}
|
|
656
656
|
if (group.shouldThrow) {
|
|
657
657
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
@@ -2004,6 +2004,151 @@ 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
|
+
};
|
|
2007
2152
|
|
|
2008
2153
|
// node_modules/.pnpm/@floating-ui+utils@0.2.7/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2009
2154
|
function getNodeName(node) {
|
|
@@ -2541,7 +2686,9 @@ var platform = {
|
|
|
2541
2686
|
isRTL
|
|
2542
2687
|
};
|
|
2543
2688
|
var offset2 = offset;
|
|
2689
|
+
var shift2 = shift;
|
|
2544
2690
|
var flip2 = flip;
|
|
2691
|
+
var size2 = size;
|
|
2545
2692
|
var hide2 = hide;
|
|
2546
2693
|
var arrow2 = arrow;
|
|
2547
2694
|
var computePosition2 = (reference, floating, options) => {
|
|
@@ -2557,7 +2704,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
2557
2704
|
}));
|
|
2558
2705
|
};
|
|
2559
2706
|
|
|
2560
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
2707
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.7_@floating-ui+dom@1.6.10/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
|
|
2561
2708
|
var TOP_START = "top-start";
|
|
2562
2709
|
var TOP = "top";
|
|
2563
2710
|
var TOP_END = "top-end";
|
|
@@ -2634,6 +2781,8 @@ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
|
|
|
2634
2781
|
transform: `rotate(${arrowRotation2}deg)`
|
|
2635
2782
|
});
|
|
2636
2783
|
};
|
|
2784
|
+
var ELEMENT_PADDING = 8;
|
|
2785
|
+
var ARROW_OFFSET = 24;
|
|
2637
2786
|
async function useRecompute(state) {
|
|
2638
2787
|
var _a, _b, _c;
|
|
2639
2788
|
if (!(state == null ? void 0 : state.isShowing))
|
|
@@ -2657,8 +2806,18 @@ async function useRecompute(state) {
|
|
|
2657
2806
|
fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
|
|
2658
2807
|
}),
|
|
2659
2808
|
!(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
|
|
2660
|
-
|
|
2809
|
+
(state == null ? void 0 : state.flip) && shift2({ crossAxis: true }),
|
|
2810
|
+
// shifts the attentionEl to make sure that it stays in view
|
|
2811
|
+
hide2(),
|
|
2661
2812
|
// 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
|
+
})
|
|
2662
2821
|
]
|
|
2663
2822
|
}).then(({ x, y, middlewareData, placement }) => {
|
|
2664
2823
|
state.actualDirection = placement;
|
|
@@ -2674,29 +2833,30 @@ async function useRecompute(state) {
|
|
|
2674
2833
|
visibility: referenceHidden ? "hidden" : ""
|
|
2675
2834
|
});
|
|
2676
2835
|
}
|
|
2677
|
-
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
2678
|
-
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
2679
2836
|
if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
|
|
2680
2837
|
const arrowEl = state == null ? void 0 : state.arrowEl;
|
|
2681
2838
|
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
let bottom = "";
|
|
2685
|
-
let left = "";
|
|
2839
|
+
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
2840
|
+
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
2841
|
+
let top = "", right = "", bottom = "", left = "";
|
|
2686
2842
|
if (arrowPlacement === "start") {
|
|
2687
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
2688
|
-
top = typeof arrowY === "number" ? `calc(
|
|
2843
|
+
const value = typeof arrowX === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2844
|
+
top = typeof arrowY === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2689
2845
|
right = isRtl ? value : "";
|
|
2690
2846
|
left = isRtl ? "" : value;
|
|
2691
2847
|
} else if (arrowPlacement === "end") {
|
|
2692
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
2848
|
+
const value = typeof arrowX === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2693
2849
|
right = isRtl ? "" : value;
|
|
2694
2850
|
left = isRtl ? value : "";
|
|
2695
|
-
bottom = typeof arrowY === "number" ? `calc(
|
|
2851
|
+
bottom = typeof arrowY === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
2696
2852
|
} else {
|
|
2697
2853
|
left = typeof arrowX === "number" ? `${arrowX}px` : "";
|
|
2698
2854
|
top = typeof arrowY === "number" ? `${arrowY}px` : "";
|
|
2699
2855
|
}
|
|
2856
|
+
const { x: shiftX } = middlewareData.shift || {};
|
|
2857
|
+
if (typeof shiftX === "number") {
|
|
2858
|
+
left = typeof arrowX === "number" ? `${arrowX - shiftX}px` : left;
|
|
2859
|
+
}
|
|
2700
2860
|
Object.assign(arrowEl.style, {
|
|
2701
2861
|
top,
|
|
2702
2862
|
right,
|
|
@@ -3008,17 +3168,19 @@ var messages3 = JSON.parse('{"attention.aria.callout":"Vihre\xE4 puhekupla, joka
|
|
|
3008
3168
|
// packages/attention/locales/nb/messages.mjs
|
|
3009
3169
|
var messages4 = JSON.parse('{"attention.aria.callout":"Gr\xF8nn taleboble som introduserer noe nytt","attention.aria.close":"Lukk","attention.aria.highlight":"En uthevet taleboble med viktig informasjon","attention.aria.pointingDown":"peker ned","attention.aria.pointingLeft":"peker til venstre","attention.aria.pointingRight":"peker til h\xF8yre","attention.aria.pointingUp":"peker opp","attention.aria.popover":"En hvit taleboble som gir tilleggsinformasjon","attention.aria.tooltip":"En svart taleboble som forklarer konteksten"}');
|
|
3010
3170
|
|
|
3011
|
-
// node_modules/.pnpm/@warp-ds+icons@2.0
|
|
3171
|
+
// node_modules/.pnpm/@warp-ds+icons@2.1.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
|
|
3012
3172
|
import { LitElement } from "lit";
|
|
3013
3173
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
3014
3174
|
var messages5 = JSON.parse('{"icon.title.close":"Kryss"}');
|
|
3015
3175
|
var messages22 = JSON.parse('{"icon.title.close":"Cross"}');
|
|
3016
3176
|
var messages32 = JSON.parse('{"icon.title.close":"Rasti"}');
|
|
3177
|
+
var messages42 = JSON.parse('{"icon.title.close":"Kryds"}');
|
|
3017
3178
|
var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
|
|
3018
3179
|
var defaultLocale3 = "en";
|
|
3019
3180
|
var detectByBrand = () => {
|
|
3181
|
+
var _a;
|
|
3020
3182
|
let value;
|
|
3021
|
-
switch (process.env.NMP_BRAND) {
|
|
3183
|
+
switch ((_a = process == null ? void 0 : process.env) == null ? void 0 : _a.NMP_BRAND) {
|
|
3022
3184
|
case "FINN":
|
|
3023
3185
|
value = "nb";
|
|
3024
3186
|
break;
|
|
@@ -3039,7 +3201,7 @@ var detectByBrand = () => {
|
|
|
3039
3201
|
var detectByHost = () => {
|
|
3040
3202
|
var _a;
|
|
3041
3203
|
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
3042
|
-
if (hostname.includes("finn")) {
|
|
3204
|
+
if (hostname == null ? void 0 : hostname.includes("finn")) {
|
|
3043
3205
|
return "nb";
|
|
3044
3206
|
} else if (hostname.includes("tori")) {
|
|
3045
3207
|
return "fi";
|
|
@@ -3075,20 +3237,19 @@ function detectLocale2() {
|
|
|
3075
3237
|
return defaultLocale3;
|
|
3076
3238
|
}
|
|
3077
3239
|
}
|
|
3078
|
-
var getMessages2 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
3079
|
-
if (locale === "nb")
|
|
3080
|
-
|
|
3081
|
-
if (locale === "
|
|
3082
|
-
return fiMsg;
|
|
3240
|
+
var getMessages2 = (locale, enMsg, nbMsg, fiMsg, daMsg) => {
|
|
3241
|
+
if (locale === "nb") return nbMsg;
|
|
3242
|
+
if (locale === "fi") return fiMsg;
|
|
3243
|
+
if (locale === "da") return daMsg;
|
|
3083
3244
|
return enMsg;
|
|
3084
3245
|
};
|
|
3085
|
-
var activateI18n2 = (enMessages, nbMessages, fiMessages) => {
|
|
3246
|
+
var activateI18n2 = (enMessages, nbMessages, fiMessages, daMessages) => {
|
|
3086
3247
|
const locale = detectLocale2();
|
|
3087
|
-
const
|
|
3088
|
-
i18n.load(locale,
|
|
3248
|
+
const messages52 = getMessages2(locale, enMessages, nbMessages, fiMessages, daMessages);
|
|
3249
|
+
i18n.load(locale, messages52);
|
|
3089
3250
|
i18n.activate(locale);
|
|
3090
3251
|
};
|
|
3091
|
-
activateI18n2(messages22, messages5, messages32);
|
|
3252
|
+
activateI18n2(messages22, messages5, messages32, messages42);
|
|
3092
3253
|
var IconClose16 = class extends LitElement {
|
|
3093
3254
|
render() {
|
|
3094
3255
|
const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
|