@warp-ds/elements 2.0.0-next.1 → 2.0.0-next.3
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/api.js +3 -6
- package/dist/api.js.map +1 -1
- package/dist/index.js +290 -320
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.d.ts +1 -1
- package/dist/packages/affix/index.js +35 -49
- package/dist/packages/affix/index.js.map +3 -3
- package/dist/packages/alert/index.js +39 -55
- package/dist/packages/alert/index.js.map +3 -3
- package/dist/packages/attention/index.js +140 -126
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/attention/locales/da/messages.d.mts +1 -0
- package/dist/packages/badge/index.js +3 -7
- package/dist/packages/badge/index.js.map +2 -2
- package/dist/packages/box/index.d.ts +1 -1
- package/dist/packages/box/index.js +2 -5
- package/dist/packages/box/index.js.map +2 -2
- package/dist/packages/breadcrumbs/index.js +56 -68
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/locales/da/messages.d.mts +1 -0
- package/dist/packages/broadcast/index.js +2 -6
- package/dist/packages/broadcast/index.js.map +1 -1
- package/dist/packages/button/index.js +56 -69
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/button/locales/da/messages.d.mts +1 -0
- package/dist/packages/card/index.d.ts +2 -2
- package/dist/packages/card/index.js +3 -7
- package/dist/packages/card/index.js.map +2 -2
- package/dist/packages/expandable/index.d.ts +2 -2
- package/dist/packages/expandable/index.js +52 -68
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/i18n.d.ts +4 -4
- package/dist/packages/modal/index.js +45 -69
- package/dist/packages/modal/index.js.map +3 -3
- package/dist/packages/modal/modal-header.d.ts +1 -1
- package/dist/packages/modal/modal-main.d.ts +3 -3
- package/dist/packages/pill/index.js +58 -71
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/pill/locales/da/messages.d.mts +1 -0
- package/dist/packages/select/index.js +76 -104
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/select/locales/da/messages.d.mts +1 -0
- package/dist/packages/textfield/index.js +7 -15
- package/dist/packages/textfield/index.js.map +2 -2
- package/dist/packages/toast/api.d.ts +1 -1
- package/dist/packages/toast/index.js +88 -125
- package/dist/packages/toast/index.js.map +4 -4
- package/dist/packages/toast/locales/da/messages.d.mts +1 -0
- package/dist/packages/toast/toast-container.d.ts +1 -1
- package/dist/packages/toast/toast.d.ts +2 -2
- package/dist/packages/utils/index.d.ts +1 -1
- package/package.json +27 -28
|
@@ -52,10 +52,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
52
52
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
53
|
mod
|
|
54
54
|
));
|
|
55
|
-
var __publicField = (obj, key, value) =>
|
|
56
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
57
|
-
return value;
|
|
58
|
-
};
|
|
55
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
59
56
|
|
|
60
57
|
// node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js
|
|
61
58
|
var require_errors = __commonJS({
|
|
@@ -228,8 +225,7 @@ var require_moo = __commonJS({
|
|
|
228
225
|
return "(" + s + ")";
|
|
229
226
|
}
|
|
230
227
|
function reUnion(regexps) {
|
|
231
|
-
if (!regexps.length)
|
|
232
|
-
return "(?!)";
|
|
228
|
+
if (!regexps.length) return "(?!)";
|
|
233
229
|
var source = regexps.map(function(s) {
|
|
234
230
|
return "(?:" + s + ")";
|
|
235
231
|
}).join("|");
|
|
@@ -239,14 +235,10 @@ var require_moo = __commonJS({
|
|
|
239
235
|
if (typeof obj === "string") {
|
|
240
236
|
return "(?:" + reEscape(obj) + ")";
|
|
241
237
|
} else if (isRegExp(obj)) {
|
|
242
|
-
if (obj.ignoreCase)
|
|
243
|
-
|
|
244
|
-
if (obj.
|
|
245
|
-
|
|
246
|
-
if (obj.sticky)
|
|
247
|
-
throw new Error("RegExp /y flag is implied");
|
|
248
|
-
if (obj.multiline)
|
|
249
|
-
throw new Error("RegExp /m flag is implied");
|
|
238
|
+
if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
|
|
239
|
+
if (obj.global) throw new Error("RegExp /g flag is implied");
|
|
240
|
+
if (obj.sticky) throw new Error("RegExp /y flag is implied");
|
|
241
|
+
if (obj.multiline) throw new Error("RegExp /m flag is implied");
|
|
250
242
|
return obj.source;
|
|
251
243
|
} else {
|
|
252
244
|
throw new Error("Not a pattern: " + obj);
|
|
@@ -295,16 +287,14 @@ var require_moo = __commonJS({
|
|
|
295
287
|
var match = [];
|
|
296
288
|
rules.forEach(function(rule) {
|
|
297
289
|
if (isObject(rule)) {
|
|
298
|
-
if (match.length)
|
|
299
|
-
result.push(ruleOptions(key, match));
|
|
290
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
300
291
|
result.push(ruleOptions(key, rule));
|
|
301
292
|
match = [];
|
|
302
293
|
} else {
|
|
303
294
|
match.push(rule);
|
|
304
295
|
}
|
|
305
296
|
});
|
|
306
|
-
if (match.length)
|
|
307
|
-
result.push(ruleOptions(key, match));
|
|
297
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
308
298
|
}
|
|
309
299
|
return result;
|
|
310
300
|
}
|
|
@@ -439,8 +429,7 @@ var require_moo = __commonJS({
|
|
|
439
429
|
var fallbackRule = errorRule && errorRule.fallback;
|
|
440
430
|
var flags = hasSticky && !fallbackRule ? "ym" : "gm";
|
|
441
431
|
var suffix2 = hasSticky || fallbackRule ? "" : "|";
|
|
442
|
-
if (unicodeFlag === true)
|
|
443
|
-
flags += "u";
|
|
432
|
+
if (unicodeFlag === true) flags += "u";
|
|
444
433
|
var combined = new RegExp(reUnion(parts) + suffix2, flags);
|
|
445
434
|
return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
|
|
446
435
|
}
|
|
@@ -461,8 +450,7 @@ var require_moo = __commonJS({
|
|
|
461
450
|
var all = states.$all ? toRules(states.$all) : [];
|
|
462
451
|
delete states.$all;
|
|
463
452
|
var keys = Object.getOwnPropertyNames(states);
|
|
464
|
-
if (!start)
|
|
465
|
-
start = keys[0];
|
|
453
|
+
if (!start) start = keys[0];
|
|
466
454
|
var ruleMap = /* @__PURE__ */ Object.create(null);
|
|
467
455
|
for (var i = 0; i < keys.length; i++) {
|
|
468
456
|
var key = keys[i];
|
|
@@ -474,8 +462,7 @@ var require_moo = __commonJS({
|
|
|
474
462
|
var included = /* @__PURE__ */ Object.create(null);
|
|
475
463
|
for (var j = 0; j < rules.length; j++) {
|
|
476
464
|
var rule = rules[j];
|
|
477
|
-
if (!rule.include)
|
|
478
|
-
continue;
|
|
465
|
+
if (!rule.include) continue;
|
|
479
466
|
var splice = [j, 1];
|
|
480
467
|
if (rule.include !== key && !included[rule.include]) {
|
|
481
468
|
included[rule.include] = true;
|
|
@@ -485,8 +472,7 @@ var require_moo = __commonJS({
|
|
|
485
472
|
}
|
|
486
473
|
for (var k = 0; k < newRules.length; k++) {
|
|
487
474
|
var newRule = newRules[k];
|
|
488
|
-
if (rules.indexOf(newRule) !== -1)
|
|
489
|
-
continue;
|
|
475
|
+
if (rules.indexOf(newRule) !== -1) continue;
|
|
490
476
|
splice.push(newRule);
|
|
491
477
|
}
|
|
492
478
|
}
|
|
@@ -567,8 +553,7 @@ var require_moo = __commonJS({
|
|
|
567
553
|
};
|
|
568
554
|
};
|
|
569
555
|
Lexer.prototype.setState = function(state) {
|
|
570
|
-
if (!state || this.state === state)
|
|
571
|
-
return;
|
|
556
|
+
if (!state || this.state === state) return;
|
|
572
557
|
this.state = state;
|
|
573
558
|
var info = this.states[state];
|
|
574
559
|
this.groups = info.groups;
|
|
@@ -672,12 +657,9 @@ var require_moo = __commonJS({
|
|
|
672
657
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
673
658
|
throw err;
|
|
674
659
|
}
|
|
675
|
-
if (group.pop)
|
|
676
|
-
|
|
677
|
-
else if (group.
|
|
678
|
-
this.pushState(group.push);
|
|
679
|
-
else if (group.next)
|
|
680
|
-
this.setState(group.next);
|
|
660
|
+
if (group.pop) this.popState();
|
|
661
|
+
else if (group.push) this.pushState(group.push);
|
|
662
|
+
else if (group.next) this.setState(group.next);
|
|
681
663
|
return token;
|
|
682
664
|
};
|
|
683
665
|
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
|
@@ -1030,10 +1012,10 @@ var require_parser = __commonJS({
|
|
|
1030
1012
|
// packages/toast/toast.js
|
|
1031
1013
|
import { css, html as html5 } from "lit";
|
|
1032
1014
|
|
|
1033
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1015
|
+
// node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
|
|
1034
1016
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1035
1017
|
|
|
1036
|
-
// node_modules/.pnpm/@lingui+message-utils@4.
|
|
1018
|
+
// node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1037
1019
|
var import_parser = __toESM(require_parser(), 1);
|
|
1038
1020
|
function processTokens(tokens, mapText) {
|
|
1039
1021
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
@@ -1057,11 +1039,9 @@ function processTokens(tokens, mapText) {
|
|
|
1057
1039
|
}
|
|
1058
1040
|
const offset = token.pluralOffset;
|
|
1059
1041
|
const formatProps = {};
|
|
1060
|
-
token.cases.forEach((
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
mapText
|
|
1064
|
-
);
|
|
1042
|
+
token.cases.forEach(({ key, tokens: tokens2 }) => {
|
|
1043
|
+
const prop = key[0] === "=" ? key.slice(1) : key;
|
|
1044
|
+
formatProps[prop] = processTokens(tokens2, mapText);
|
|
1065
1045
|
});
|
|
1066
1046
|
return [
|
|
1067
1047
|
token.arg,
|
|
@@ -1083,7 +1063,7 @@ Message: ${message}`);
|
|
|
1083
1063
|
}
|
|
1084
1064
|
}
|
|
1085
1065
|
|
|
1086
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1066
|
+
// node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
|
|
1087
1067
|
var isString = (s) => typeof s === "string";
|
|
1088
1068
|
var isFunction = (f) => typeof f === "function";
|
|
1089
1069
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -1169,11 +1149,11 @@ var selectFormatter = (value, rules) => {
|
|
|
1169
1149
|
function interpolate(translation, locale, locales) {
|
|
1170
1150
|
return (values = {}, formats) => {
|
|
1171
1151
|
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1172
|
-
const formatMessage = (tokens) => {
|
|
1152
|
+
const formatMessage = (tokens, replaceOctothorpe = false) => {
|
|
1173
1153
|
if (!Array.isArray(tokens))
|
|
1174
1154
|
return tokens;
|
|
1175
1155
|
return tokens.reduce((message, token) => {
|
|
1176
|
-
if (token === "#") {
|
|
1156
|
+
if (token === "#" && replaceOctothorpe) {
|
|
1177
1157
|
return message + OCTOTHORPE_PH;
|
|
1178
1158
|
}
|
|
1179
1159
|
if (isString(token)) {
|
|
@@ -1184,7 +1164,10 @@ function interpolate(translation, locale, locales) {
|
|
|
1184
1164
|
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1185
1165
|
Object.entries(format).forEach(
|
|
1186
1166
|
([key, value2]) => {
|
|
1187
|
-
interpolatedFormat[key] = formatMessage(
|
|
1167
|
+
interpolatedFormat[key] = formatMessage(
|
|
1168
|
+
value2,
|
|
1169
|
+
type === "plural" || type === "selectordinal"
|
|
1170
|
+
);
|
|
1188
1171
|
}
|
|
1189
1172
|
);
|
|
1190
1173
|
} else {
|
|
@@ -1313,17 +1296,17 @@ var I18n = class extends EventEmitter {
|
|
|
1313
1296
|
}
|
|
1314
1297
|
this.emit("change");
|
|
1315
1298
|
}
|
|
1316
|
-
_load(locale,
|
|
1299
|
+
_load(locale, messages11) {
|
|
1317
1300
|
const maybeMessages = this._messages[locale];
|
|
1318
1301
|
if (!maybeMessages) {
|
|
1319
|
-
this._messages[locale] =
|
|
1302
|
+
this._messages[locale] = messages11;
|
|
1320
1303
|
} else {
|
|
1321
|
-
Object.assign(maybeMessages,
|
|
1304
|
+
Object.assign(maybeMessages, messages11);
|
|
1322
1305
|
}
|
|
1323
1306
|
}
|
|
1324
|
-
load(localeOrMessages,
|
|
1325
|
-
if (typeof localeOrMessages == "string" && typeof
|
|
1326
|
-
this._load(localeOrMessages,
|
|
1307
|
+
load(localeOrMessages, messages11) {
|
|
1308
|
+
if (typeof localeOrMessages == "string" && typeof messages11 === "object") {
|
|
1309
|
+
this._load(localeOrMessages, messages11);
|
|
1327
1310
|
} else {
|
|
1328
1311
|
Object.entries(localeOrMessages).forEach(
|
|
1329
1312
|
([locale, messages25]) => this._load(locale, messages25)
|
|
@@ -1334,10 +1317,10 @@ var I18n = class extends EventEmitter {
|
|
|
1334
1317
|
/**
|
|
1335
1318
|
* @param options {@link LoadAndActivateOptions}
|
|
1336
1319
|
*/
|
|
1337
|
-
loadAndActivate({ locale, locales, messages:
|
|
1320
|
+
loadAndActivate({ locale, locales, messages: messages11 }) {
|
|
1338
1321
|
this._locale = locale;
|
|
1339
1322
|
this._locales = locales || void 0;
|
|
1340
|
-
this._messages[this._locale] =
|
|
1323
|
+
this._messages[this._locale] = messages11;
|
|
1341
1324
|
this.emit("change");
|
|
1342
1325
|
}
|
|
1343
1326
|
activate(locale, locales) {
|
|
@@ -1352,6 +1335,9 @@ var I18n = class extends EventEmitter {
|
|
|
1352
1335
|
}
|
|
1353
1336
|
_(id, values, options) {
|
|
1354
1337
|
let message = options == null ? void 0 : options.message;
|
|
1338
|
+
if (!id) {
|
|
1339
|
+
id = "";
|
|
1340
|
+
}
|
|
1355
1341
|
if (!isString(id)) {
|
|
1356
1342
|
values = id.values || values;
|
|
1357
1343
|
message = id.message;
|
|
@@ -1392,7 +1378,7 @@ function setupI18n(params = {}) {
|
|
|
1392
1378
|
}
|
|
1393
1379
|
var i18n = setupI18n();
|
|
1394
1380
|
|
|
1395
|
-
// node_modules/.pnpm/@warp-ds+css@2.0.0-next.4_@warp-ds+uno@2.0.0_unocss@0.
|
|
1381
|
+
// node_modules/.pnpm/@warp-ds+css@2.0.0-next.4_@warp-ds+uno@2.0.0_unocss@0.61.3_postcss@8.4.39_rollup@4.18.1_vite@_fn7nbuinwdlc4yeboswpxt5lie/node_modules/@warp-ds/css/component-classes/index.js
|
|
1396
1382
|
var box = {
|
|
1397
1383
|
box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
|
|
1398
1384
|
// Relative here enables w-clickable
|
|
@@ -1693,8 +1679,7 @@ var prefersMotion = true;
|
|
|
1693
1679
|
if (windowExists) {
|
|
1694
1680
|
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
1695
1681
|
const callback = ({ matches }) => prefersMotion = !matches;
|
|
1696
|
-
if (query.addEventListener)
|
|
1697
|
-
query.addEventListener("change", callback);
|
|
1682
|
+
if (query.addEventListener) query.addEventListener("change", callback);
|
|
1698
1683
|
callback(query);
|
|
1699
1684
|
}
|
|
1700
1685
|
var removeTransition = (el) => {
|
|
@@ -1711,19 +1696,16 @@ var addTransition = (el) => {
|
|
|
1711
1696
|
var getAfterExpandCallback = (el, done) => () => {
|
|
1712
1697
|
el.style.height = "auto";
|
|
1713
1698
|
el.style.overflow = null;
|
|
1714
|
-
if (done)
|
|
1715
|
-
done();
|
|
1699
|
+
if (done) done();
|
|
1716
1700
|
};
|
|
1717
1701
|
var getAfterCollapseCallback = (done) => () => {
|
|
1718
|
-
if (done)
|
|
1719
|
-
done();
|
|
1702
|
+
if (done) done();
|
|
1720
1703
|
};
|
|
1721
1704
|
var expand = (el, done) => {
|
|
1722
1705
|
const returnPromise = (() => {
|
|
1723
|
-
if (!done)
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
});
|
|
1706
|
+
if (!done) return new Promise((r) => {
|
|
1707
|
+
done = r;
|
|
1708
|
+
});
|
|
1727
1709
|
})();
|
|
1728
1710
|
const afterExpandCallback = getAfterExpandCallback(el, done);
|
|
1729
1711
|
removeTransition(el);
|
|
@@ -1736,15 +1718,13 @@ var expand = (el, done) => {
|
|
|
1736
1718
|
addTransition(el);
|
|
1737
1719
|
requestAnimationFrame(() => el.style.height = dest + "px");
|
|
1738
1720
|
});
|
|
1739
|
-
if (returnPromise)
|
|
1740
|
-
return returnPromise;
|
|
1721
|
+
if (returnPromise) return returnPromise;
|
|
1741
1722
|
};
|
|
1742
1723
|
var collapse = (el, done) => {
|
|
1743
1724
|
const returnPromise = (() => {
|
|
1744
|
-
if (!done)
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
});
|
|
1725
|
+
if (!done) return new Promise((r) => {
|
|
1726
|
+
done = r;
|
|
1727
|
+
});
|
|
1748
1728
|
})();
|
|
1749
1729
|
const afterCollapseCallback = getAfterCollapseCallback(done);
|
|
1750
1730
|
removeTransition(el);
|
|
@@ -1756,15 +1736,14 @@ var collapse = (el, done) => {
|
|
|
1756
1736
|
addTransition(el);
|
|
1757
1737
|
requestAnimationFrame(() => el.style.height = "0px");
|
|
1758
1738
|
});
|
|
1759
|
-
if (returnPromise)
|
|
1760
|
-
return returnPromise;
|
|
1739
|
+
if (returnPromise) return returnPromise;
|
|
1761
1740
|
};
|
|
1762
1741
|
|
|
1763
1742
|
// packages/toast/toast.js
|
|
1764
1743
|
import { classMap } from "lit/directives/class-map.js";
|
|
1765
1744
|
import { when } from "lit/directives/when.js";
|
|
1766
1745
|
|
|
1767
|
-
// node_modules/.pnpm/@warp-ds+icons@2.0.
|
|
1746
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/warning-16.js
|
|
1768
1747
|
import { LitElement } from "lit";
|
|
1769
1748
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1770
1749
|
var messages = JSON.parse('{"icon.title.warning":"Varseltrekant med utropstegn"}');
|
|
@@ -1855,7 +1834,7 @@ if (!customElements.get("w-icon-warning-16")) {
|
|
|
1855
1834
|
customElements.define("w-icon-warning-16", IconWarning16);
|
|
1856
1835
|
}
|
|
1857
1836
|
|
|
1858
|
-
// node_modules/.pnpm/@warp-ds+icons@2.0.
|
|
1837
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/error-16.js
|
|
1859
1838
|
import { LitElement as LitElement2 } from "lit";
|
|
1860
1839
|
import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
|
|
1861
1840
|
var messages4 = JSON.parse('{"icon.title.error":"\xC5ttekant med utropstegn"}');
|
|
@@ -1946,7 +1925,7 @@ if (!customElements.get("w-icon-error-16")) {
|
|
|
1946
1925
|
customElements.define("w-icon-error-16", IconError16);
|
|
1947
1926
|
}
|
|
1948
1927
|
|
|
1949
|
-
// node_modules/.pnpm/@warp-ds+icons@2.0.
|
|
1928
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/success-16.js
|
|
1950
1929
|
import { LitElement as LitElement3 } from "lit";
|
|
1951
1930
|
import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
|
|
1952
1931
|
var messages5 = JSON.parse('{"icon.title.success":"Sirkel med sjekkmerke"}');
|
|
@@ -2037,7 +2016,7 @@ if (!customElements.get("w-icon-success-16")) {
|
|
|
2037
2016
|
customElements.define("w-icon-success-16", IconSuccess16);
|
|
2038
2017
|
}
|
|
2039
2018
|
|
|
2040
|
-
// node_modules/.pnpm/@warp-ds+icons@2.0.
|
|
2019
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/close-16.js
|
|
2041
2020
|
import { LitElement as LitElement4 } from "lit";
|
|
2042
2021
|
import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
|
|
2043
2022
|
var messages6 = JSON.parse('{"icon.title.close":"Kryss"}');
|
|
@@ -2129,7 +2108,7 @@ if (!customElements.get("w-icon-close-16")) {
|
|
|
2129
2108
|
}
|
|
2130
2109
|
|
|
2131
2110
|
// packages/i18n.ts
|
|
2132
|
-
var supportedLocales5 = ["en", "nb", "fi"];
|
|
2111
|
+
var supportedLocales5 = ["en", "nb", "fi", "da"];
|
|
2133
2112
|
var defaultLocale6 = "en";
|
|
2134
2113
|
var getSupportedLocale5 = (usedLocale) => {
|
|
2135
2114
|
return supportedLocales5.find(
|
|
@@ -2149,28 +2128,30 @@ function detectLocale5() {
|
|
|
2149
2128
|
return defaultLocale6;
|
|
2150
2129
|
}
|
|
2151
2130
|
}
|
|
2152
|
-
var getMessages5 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
2153
|
-
if (locale === "nb")
|
|
2154
|
-
|
|
2155
|
-
if (locale === "
|
|
2156
|
-
return fiMsg;
|
|
2131
|
+
var getMessages5 = (locale, enMsg, nbMsg, fiMsg, daMsg) => {
|
|
2132
|
+
if (locale === "nb") return nbMsg;
|
|
2133
|
+
if (locale === "fi") return fiMsg;
|
|
2134
|
+
if (locale === "da") return daMsg;
|
|
2157
2135
|
return enMsg;
|
|
2158
2136
|
};
|
|
2159
|
-
var activateI18n5 = (enMessages, nbMessages, fiMessages) => {
|
|
2137
|
+
var activateI18n5 = (enMessages, nbMessages, fiMessages, daMessages) => {
|
|
2160
2138
|
const locale = detectLocale5();
|
|
2161
|
-
const
|
|
2162
|
-
i18n.load(locale,
|
|
2139
|
+
const messages11 = getMessages5(locale, enMessages, nbMessages, fiMessages, daMessages);
|
|
2140
|
+
i18n.load(locale, messages11);
|
|
2163
2141
|
i18n.activate(locale);
|
|
2164
2142
|
};
|
|
2165
2143
|
|
|
2144
|
+
// packages/toast/locales/da/messages.mjs
|
|
2145
|
+
var messages7 = JSON.parse('{"toast.aria.error":"Fejl","toast.aria.successful":"Fuldf\xF8rt","toast.aria.warning":"Advarsel"}');
|
|
2146
|
+
|
|
2166
2147
|
// packages/toast/locales/en/messages.mjs
|
|
2167
|
-
var
|
|
2148
|
+
var messages8 = JSON.parse('{"toast.aria.error":"Error","toast.aria.successful":"Successful","toast.aria.warning":"Warning"}');
|
|
2168
2149
|
|
|
2169
2150
|
// packages/toast/locales/fi/messages.mjs
|
|
2170
|
-
var
|
|
2151
|
+
var messages9 = JSON.parse('{"toast.aria.error":"Virhe","toast.aria.successful":"Onnistui","toast.aria.warning":"Varoitus"}');
|
|
2171
2152
|
|
|
2172
2153
|
// packages/toast/locales/nb/messages.mjs
|
|
2173
|
-
var
|
|
2154
|
+
var messages10 = JSON.parse('{"toast.aria.error":"Feil","toast.aria.successful":"Vellykket","toast.aria.warning":"Advarsel"}');
|
|
2174
2155
|
|
|
2175
2156
|
// packages/toast/toast.js
|
|
2176
2157
|
var classes = (definition) => {
|
|
@@ -2190,7 +2171,7 @@ var toastType = {
|
|
|
2190
2171
|
var WarpToast = class extends WarpElement {
|
|
2191
2172
|
constructor() {
|
|
2192
2173
|
super();
|
|
2193
|
-
activateI18n5(
|
|
2174
|
+
activateI18n5(messages8, messages10, messages9, messages7);
|
|
2194
2175
|
this.id = Date.now().toString(36) + Math.random().toString(36).slice(2, 5);
|
|
2195
2176
|
this.type = "success";
|
|
2196
2177
|
this.text = "";
|
|
@@ -2203,8 +2184,7 @@ var WarpToast = class extends WarpElement {
|
|
|
2203
2184
|
super.disconnectedCallback();
|
|
2204
2185
|
}
|
|
2205
2186
|
updated() {
|
|
2206
|
-
if (!this._expanded && this._wrapper)
|
|
2207
|
-
expand(this._wrapper, () => this._expanded = true);
|
|
2187
|
+
if (!this._expanded && this._wrapper) expand(this._wrapper, () => this._expanded = true);
|
|
2208
2188
|
}
|
|
2209
2189
|
get _primaryClasses() {
|
|
2210
2190
|
return classes({
|
|
@@ -2258,19 +2238,14 @@ var WarpToast = class extends WarpElement {
|
|
|
2258
2238
|
}
|
|
2259
2239
|
}
|
|
2260
2240
|
get _iconMarkup() {
|
|
2261
|
-
if (this._warning)
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
return html5`<w-icon-error-16></w-icon-error-16>`;
|
|
2265
|
-
else
|
|
2266
|
-
return html5`<w-icon-success-16></w-icon-success-16>`;
|
|
2241
|
+
if (this._warning) return html5`<w-icon-warning-16></w-icon-warning-16>`;
|
|
2242
|
+
if (this._error) return html5`<w-icon-error-16></w-icon-error-16>`;
|
|
2243
|
+
else return html5`<w-icon-success-16></w-icon-success-16>`;
|
|
2267
2244
|
}
|
|
2268
2245
|
async collapse() {
|
|
2269
2246
|
return new Promise((resolve) => {
|
|
2270
|
-
if (this._expanded && this._wrapper)
|
|
2271
|
-
|
|
2272
|
-
else
|
|
2273
|
-
resolve();
|
|
2247
|
+
if (this._expanded && this._wrapper) collapse(this._wrapper, resolve);
|
|
2248
|
+
else resolve();
|
|
2274
2249
|
});
|
|
2275
2250
|
}
|
|
2276
2251
|
close() {
|
|
@@ -2282,8 +2257,7 @@ var WarpToast = class extends WarpElement {
|
|
|
2282
2257
|
this.updateComplete.then(() => this.dispatchEvent(event));
|
|
2283
2258
|
}
|
|
2284
2259
|
render() {
|
|
2285
|
-
if (!this.text)
|
|
2286
|
-
return html5``;
|
|
2260
|
+
if (!this.text) return html5``;
|
|
2287
2261
|
return html5` <section class="${toast.wrapper}" aria-label="${this._typeLabel}">
|
|
2288
2262
|
<div class="${this._primaryClasses}">
|
|
2289
2263
|
<div class="${this._iconClasses}">${this._iconMarkup}</div>
|
|
@@ -2335,10 +2309,8 @@ var WarpToastContainer = class extends WarpElement2 {
|
|
|
2335
2309
|
const keep = [];
|
|
2336
2310
|
const remove = [];
|
|
2337
2311
|
for (const toast3 of this._toasts) {
|
|
2338
|
-
if (Date.now() <= toast3[1].duration)
|
|
2339
|
-
|
|
2340
|
-
else
|
|
2341
|
-
remove.push(toast3);
|
|
2312
|
+
if (Date.now() <= toast3[1].duration) keep.push(toast3);
|
|
2313
|
+
else remove.push(toast3);
|
|
2342
2314
|
}
|
|
2343
2315
|
const collapseTasks = [];
|
|
2344
2316
|
for (const [id] of remove) {
|
|
@@ -2346,15 +2318,13 @@ var WarpToastContainer = class extends WarpElement2 {
|
|
|
2346
2318
|
collapseTasks.push(el.collapse());
|
|
2347
2319
|
}
|
|
2348
2320
|
Promise.all(collapseTasks).then(() => {
|
|
2349
|
-
if (keep.length !== this._toasts.size)
|
|
2350
|
-
this._toasts = new Map(keep);
|
|
2321
|
+
if (keep.length !== this._toasts.size) this._toasts = new Map(keep);
|
|
2351
2322
|
});
|
|
2352
2323
|
}, 500);
|
|
2353
2324
|
}
|
|
2354
2325
|
disconnectedCallback() {
|
|
2355
2326
|
super.disconnectedCallback();
|
|
2356
|
-
if (this._interval)
|
|
2357
|
-
clearTimeout(this._interval);
|
|
2327
|
+
if (this._interval) clearTimeout(this._interval);
|
|
2358
2328
|
}
|
|
2359
2329
|
static init() {
|
|
2360
2330
|
let el = document.querySelector("w-toast-container");
|
|
@@ -2376,8 +2346,7 @@ var WarpToastContainer = class extends WarpElement2 {
|
|
|
2376
2346
|
if (!id) {
|
|
2377
2347
|
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
2378
2348
|
}
|
|
2379
|
-
if (typeof id !== "string" && !Number.isInteger(id))
|
|
2380
|
-
throw new Error('"id" must be number or string when attempting to retrieve toast');
|
|
2349
|
+
if (typeof id !== "string" && !Number.isInteger(id)) throw new Error('"id" must be number or string when attempting to retrieve toast');
|
|
2381
2350
|
return this._toasts.get(id);
|
|
2382
2351
|
}
|
|
2383
2352
|
/**
|
|
@@ -2386,8 +2355,7 @@ var WarpToastContainer = class extends WarpElement2 {
|
|
|
2386
2355
|
* @returns {WarpToastContainer}
|
|
2387
2356
|
*/
|
|
2388
2357
|
set(toast3) {
|
|
2389
|
-
if (!toast3.id)
|
|
2390
|
-
throw new Error('invalid or undefined "id" on toast object');
|
|
2358
|
+
if (!toast3.id) throw new Error('invalid or undefined "id" on toast object');
|
|
2391
2359
|
const result = this._toasts.set(toast3.id, __spreadProps(__spreadValues({}, toast3), {
|
|
2392
2360
|
duration: Date.now() + (toast3.duration || 5e3)
|
|
2393
2361
|
}));
|
|
@@ -2403,11 +2371,9 @@ var WarpToastContainer = class extends WarpElement2 {
|
|
|
2403
2371
|
if (!id) {
|
|
2404
2372
|
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
2405
2373
|
}
|
|
2406
|
-
if (typeof id !== "string" && !Number.isInteger(id))
|
|
2407
|
-
throw new Error('"id" must be number or string when attempting to retrieve toast');
|
|
2374
|
+
if (typeof id !== "string" && !Number.isInteger(id)) throw new Error('"id" must be number or string when attempting to retrieve toast');
|
|
2408
2375
|
const el = this.renderRoot.querySelector(`#${id}`);
|
|
2409
|
-
if (!this._toasts.has(id))
|
|
2410
|
-
return false;
|
|
2376
|
+
if (!this._toasts.has(id)) return false;
|
|
2411
2377
|
await el.collapse();
|
|
2412
2378
|
const result = this._toasts.delete(id);
|
|
2413
2379
|
this._toasts = new Map(Array.from(this._toasts));
|
|
@@ -2454,8 +2420,7 @@ var windowExists2 = typeof window !== "undefined";
|
|
|
2454
2420
|
|
|
2455
2421
|
// packages/toast/api.js
|
|
2456
2422
|
function toast2(message, options) {
|
|
2457
|
-
if (!windowExists2)
|
|
2458
|
-
return;
|
|
2423
|
+
if (!windowExists2) return;
|
|
2459
2424
|
const toast3 = customElements.get("w-toast-container").init();
|
|
2460
2425
|
const data = __spreadValues({
|
|
2461
2426
|
id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),
|
|
@@ -2467,14 +2432,12 @@ function toast2(message, options) {
|
|
|
2467
2432
|
return data;
|
|
2468
2433
|
}
|
|
2469
2434
|
function removeToast(id) {
|
|
2470
|
-
if (!windowExists2)
|
|
2471
|
-
return;
|
|
2435
|
+
if (!windowExists2) return;
|
|
2472
2436
|
const toast3 = customElements.get("w-toast-container").init();
|
|
2473
2437
|
return toast3.del(id);
|
|
2474
2438
|
}
|
|
2475
2439
|
function updateToast(id, options) {
|
|
2476
|
-
if (!windowExists2)
|
|
2477
|
-
return;
|
|
2440
|
+
if (!windowExists2) return;
|
|
2478
2441
|
const toast3 = customElements.get("w-toast-container").init();
|
|
2479
2442
|
toast3.set(__spreadValues(__spreadValues({}, toast3.get(id)), options));
|
|
2480
2443
|
return toast3.get(id);
|