@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
|
@@ -49,10 +49,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
49
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
50
50
|
mod
|
|
51
51
|
));
|
|
52
|
-
var __publicField = (obj, key, value) =>
|
|
53
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
54
|
-
return value;
|
|
55
|
-
};
|
|
52
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
56
53
|
|
|
57
54
|
// node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js
|
|
58
55
|
var require_errors = __commonJS({
|
|
@@ -225,8 +222,7 @@ var require_moo = __commonJS({
|
|
|
225
222
|
return "(" + s + ")";
|
|
226
223
|
}
|
|
227
224
|
function reUnion(regexps) {
|
|
228
|
-
if (!regexps.length)
|
|
229
|
-
return "(?!)";
|
|
225
|
+
if (!regexps.length) return "(?!)";
|
|
230
226
|
var source = regexps.map(function(s) {
|
|
231
227
|
return "(?:" + s + ")";
|
|
232
228
|
}).join("|");
|
|
@@ -236,14 +232,10 @@ var require_moo = __commonJS({
|
|
|
236
232
|
if (typeof obj === "string") {
|
|
237
233
|
return "(?:" + reEscape(obj) + ")";
|
|
238
234
|
} else if (isRegExp(obj)) {
|
|
239
|
-
if (obj.ignoreCase)
|
|
240
|
-
|
|
241
|
-
if (obj.
|
|
242
|
-
|
|
243
|
-
if (obj.sticky)
|
|
244
|
-
throw new Error("RegExp /y flag is implied");
|
|
245
|
-
if (obj.multiline)
|
|
246
|
-
throw new Error("RegExp /m flag is implied");
|
|
235
|
+
if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
|
|
236
|
+
if (obj.global) throw new Error("RegExp /g flag is implied");
|
|
237
|
+
if (obj.sticky) throw new Error("RegExp /y flag is implied");
|
|
238
|
+
if (obj.multiline) throw new Error("RegExp /m flag is implied");
|
|
247
239
|
return obj.source;
|
|
248
240
|
} else {
|
|
249
241
|
throw new Error("Not a pattern: " + obj);
|
|
@@ -292,16 +284,14 @@ var require_moo = __commonJS({
|
|
|
292
284
|
var match = [];
|
|
293
285
|
rules.forEach(function(rule) {
|
|
294
286
|
if (isObject(rule)) {
|
|
295
|
-
if (match.length)
|
|
296
|
-
result.push(ruleOptions(key, match));
|
|
287
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
297
288
|
result.push(ruleOptions(key, rule));
|
|
298
289
|
match = [];
|
|
299
290
|
} else {
|
|
300
291
|
match.push(rule);
|
|
301
292
|
}
|
|
302
293
|
});
|
|
303
|
-
if (match.length)
|
|
304
|
-
result.push(ruleOptions(key, match));
|
|
294
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
305
295
|
}
|
|
306
296
|
return result;
|
|
307
297
|
}
|
|
@@ -436,8 +426,7 @@ var require_moo = __commonJS({
|
|
|
436
426
|
var fallbackRule = errorRule && errorRule.fallback;
|
|
437
427
|
var flags = hasSticky && !fallbackRule ? "ym" : "gm";
|
|
438
428
|
var suffix2 = hasSticky || fallbackRule ? "" : "|";
|
|
439
|
-
if (unicodeFlag === true)
|
|
440
|
-
flags += "u";
|
|
429
|
+
if (unicodeFlag === true) flags += "u";
|
|
441
430
|
var combined = new RegExp(reUnion(parts) + suffix2, flags);
|
|
442
431
|
return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
|
|
443
432
|
}
|
|
@@ -458,8 +447,7 @@ var require_moo = __commonJS({
|
|
|
458
447
|
var all = states.$all ? toRules(states.$all) : [];
|
|
459
448
|
delete states.$all;
|
|
460
449
|
var keys = Object.getOwnPropertyNames(states);
|
|
461
|
-
if (!start)
|
|
462
|
-
start = keys[0];
|
|
450
|
+
if (!start) start = keys[0];
|
|
463
451
|
var ruleMap = /* @__PURE__ */ Object.create(null);
|
|
464
452
|
for (var i = 0; i < keys.length; i++) {
|
|
465
453
|
var key = keys[i];
|
|
@@ -471,8 +459,7 @@ var require_moo = __commonJS({
|
|
|
471
459
|
var included = /* @__PURE__ */ Object.create(null);
|
|
472
460
|
for (var j = 0; j < rules.length; j++) {
|
|
473
461
|
var rule = rules[j];
|
|
474
|
-
if (!rule.include)
|
|
475
|
-
continue;
|
|
462
|
+
if (!rule.include) continue;
|
|
476
463
|
var splice = [j, 1];
|
|
477
464
|
if (rule.include !== key && !included[rule.include]) {
|
|
478
465
|
included[rule.include] = true;
|
|
@@ -482,8 +469,7 @@ var require_moo = __commonJS({
|
|
|
482
469
|
}
|
|
483
470
|
for (var k = 0; k < newRules.length; k++) {
|
|
484
471
|
var newRule = newRules[k];
|
|
485
|
-
if (rules.indexOf(newRule) !== -1)
|
|
486
|
-
continue;
|
|
472
|
+
if (rules.indexOf(newRule) !== -1) continue;
|
|
487
473
|
splice.push(newRule);
|
|
488
474
|
}
|
|
489
475
|
}
|
|
@@ -564,8 +550,7 @@ var require_moo = __commonJS({
|
|
|
564
550
|
};
|
|
565
551
|
};
|
|
566
552
|
Lexer.prototype.setState = function(state) {
|
|
567
|
-
if (!state || this.state === state)
|
|
568
|
-
return;
|
|
553
|
+
if (!state || this.state === state) return;
|
|
569
554
|
this.state = state;
|
|
570
555
|
var info = this.states[state];
|
|
571
556
|
this.groups = info.groups;
|
|
@@ -669,12 +654,9 @@ var require_moo = __commonJS({
|
|
|
669
654
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
670
655
|
throw err;
|
|
671
656
|
}
|
|
672
|
-
if (group.pop)
|
|
673
|
-
|
|
674
|
-
else if (group.
|
|
675
|
-
this.pushState(group.push);
|
|
676
|
-
else if (group.next)
|
|
677
|
-
this.setState(group.next);
|
|
657
|
+
if (group.pop) this.popState();
|
|
658
|
+
else if (group.push) this.pushState(group.push);
|
|
659
|
+
else if (group.next) this.setState(group.next);
|
|
678
660
|
return token;
|
|
679
661
|
};
|
|
680
662
|
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
|
@@ -1027,10 +1009,10 @@ var require_parser = __commonJS({
|
|
|
1027
1009
|
// packages/breadcrumbs/index.js
|
|
1028
1010
|
import { html } from "lit";
|
|
1029
1011
|
|
|
1030
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1012
|
+
// node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
|
|
1031
1013
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1032
1014
|
|
|
1033
|
-
// node_modules/.pnpm/@lingui+message-utils@4.
|
|
1015
|
+
// node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1034
1016
|
var import_parser = __toESM(require_parser(), 1);
|
|
1035
1017
|
function processTokens(tokens, mapText) {
|
|
1036
1018
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
@@ -1054,11 +1036,9 @@ function processTokens(tokens, mapText) {
|
|
|
1054
1036
|
}
|
|
1055
1037
|
const offset = token.pluralOffset;
|
|
1056
1038
|
const formatProps = {};
|
|
1057
|
-
token.cases.forEach((
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
mapText
|
|
1061
|
-
);
|
|
1039
|
+
token.cases.forEach(({ key, tokens: tokens2 }) => {
|
|
1040
|
+
const prop = key[0] === "=" ? key.slice(1) : key;
|
|
1041
|
+
formatProps[prop] = processTokens(tokens2, mapText);
|
|
1062
1042
|
});
|
|
1063
1043
|
return [
|
|
1064
1044
|
token.arg,
|
|
@@ -1080,7 +1060,7 @@ Message: ${message}`);
|
|
|
1080
1060
|
}
|
|
1081
1061
|
}
|
|
1082
1062
|
|
|
1083
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1063
|
+
// node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
|
|
1084
1064
|
var isString = (s) => typeof s === "string";
|
|
1085
1065
|
var isFunction = (f) => typeof f === "function";
|
|
1086
1066
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -1166,11 +1146,11 @@ var selectFormatter = (value, rules) => {
|
|
|
1166
1146
|
function interpolate(translation, locale, locales) {
|
|
1167
1147
|
return (values = {}, formats) => {
|
|
1168
1148
|
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1169
|
-
const formatMessage = (tokens) => {
|
|
1149
|
+
const formatMessage = (tokens, replaceOctothorpe = false) => {
|
|
1170
1150
|
if (!Array.isArray(tokens))
|
|
1171
1151
|
return tokens;
|
|
1172
1152
|
return tokens.reduce((message, token) => {
|
|
1173
|
-
if (token === "#") {
|
|
1153
|
+
if (token === "#" && replaceOctothorpe) {
|
|
1174
1154
|
return message + OCTOTHORPE_PH;
|
|
1175
1155
|
}
|
|
1176
1156
|
if (isString(token)) {
|
|
@@ -1181,7 +1161,10 @@ function interpolate(translation, locale, locales) {
|
|
|
1181
1161
|
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1182
1162
|
Object.entries(format).forEach(
|
|
1183
1163
|
([key, value2]) => {
|
|
1184
|
-
interpolatedFormat[key] = formatMessage(
|
|
1164
|
+
interpolatedFormat[key] = formatMessage(
|
|
1165
|
+
value2,
|
|
1166
|
+
type === "plural" || type === "selectordinal"
|
|
1167
|
+
);
|
|
1185
1168
|
}
|
|
1186
1169
|
);
|
|
1187
1170
|
} else {
|
|
@@ -1310,17 +1293,17 @@ var I18n = class extends EventEmitter {
|
|
|
1310
1293
|
}
|
|
1311
1294
|
this.emit("change");
|
|
1312
1295
|
}
|
|
1313
|
-
_load(locale,
|
|
1296
|
+
_load(locale, messages5) {
|
|
1314
1297
|
const maybeMessages = this._messages[locale];
|
|
1315
1298
|
if (!maybeMessages) {
|
|
1316
|
-
this._messages[locale] =
|
|
1299
|
+
this._messages[locale] = messages5;
|
|
1317
1300
|
} else {
|
|
1318
|
-
Object.assign(maybeMessages,
|
|
1301
|
+
Object.assign(maybeMessages, messages5);
|
|
1319
1302
|
}
|
|
1320
1303
|
}
|
|
1321
|
-
load(localeOrMessages,
|
|
1322
|
-
if (typeof localeOrMessages == "string" && typeof
|
|
1323
|
-
this._load(localeOrMessages,
|
|
1304
|
+
load(localeOrMessages, messages5) {
|
|
1305
|
+
if (typeof localeOrMessages == "string" && typeof messages5 === "object") {
|
|
1306
|
+
this._load(localeOrMessages, messages5);
|
|
1324
1307
|
} else {
|
|
1325
1308
|
Object.entries(localeOrMessages).forEach(
|
|
1326
1309
|
([locale, messages22]) => this._load(locale, messages22)
|
|
@@ -1331,10 +1314,10 @@ var I18n = class extends EventEmitter {
|
|
|
1331
1314
|
/**
|
|
1332
1315
|
* @param options {@link LoadAndActivateOptions}
|
|
1333
1316
|
*/
|
|
1334
|
-
loadAndActivate({ locale, locales, messages:
|
|
1317
|
+
loadAndActivate({ locale, locales, messages: messages5 }) {
|
|
1335
1318
|
this._locale = locale;
|
|
1336
1319
|
this._locales = locales || void 0;
|
|
1337
|
-
this._messages[this._locale] =
|
|
1320
|
+
this._messages[this._locale] = messages5;
|
|
1338
1321
|
this.emit("change");
|
|
1339
1322
|
}
|
|
1340
1323
|
activate(locale, locales) {
|
|
@@ -1349,6 +1332,9 @@ var I18n = class extends EventEmitter {
|
|
|
1349
1332
|
}
|
|
1350
1333
|
_(id, values, options) {
|
|
1351
1334
|
let message = options == null ? void 0 : options.message;
|
|
1335
|
+
if (!id) {
|
|
1336
|
+
id = "";
|
|
1337
|
+
}
|
|
1352
1338
|
if (!isString(id)) {
|
|
1353
1339
|
values = id.values || values;
|
|
1354
1340
|
message = id.message;
|
|
@@ -1389,12 +1375,12 @@ function setupI18n(params = {}) {
|
|
|
1389
1375
|
}
|
|
1390
1376
|
var i18n = setupI18n();
|
|
1391
1377
|
|
|
1392
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
1378
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.5_@floating-ui+dom@1.6.7/node_modules/@warp-ds/core/dist/breadcrumbs/index.js
|
|
1393
1379
|
function interleave(array, separator2) {
|
|
1394
1380
|
return array.flatMap((el) => [el, separator2]).slice(0, -1);
|
|
1395
1381
|
}
|
|
1396
1382
|
|
|
1397
|
-
// node_modules/.pnpm/@warp-ds+css@2.0.0-next.4_@warp-ds+uno@2.0.0_unocss@0.
|
|
1383
|
+
// 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
|
|
1398
1384
|
var box = {
|
|
1399
1385
|
box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
|
|
1400
1386
|
// Relative here enables w-clickable
|
|
@@ -1678,7 +1664,7 @@ var attention = {
|
|
|
1678
1664
|
import WarpElement from "@warp-ds/elements-core";
|
|
1679
1665
|
|
|
1680
1666
|
// packages/i18n.ts
|
|
1681
|
-
var supportedLocales = ["en", "nb", "fi"];
|
|
1667
|
+
var supportedLocales = ["en", "nb", "fi", "da"];
|
|
1682
1668
|
var defaultLocale2 = "en";
|
|
1683
1669
|
var getSupportedLocale = (usedLocale) => {
|
|
1684
1670
|
return supportedLocales.find(
|
|
@@ -1698,17 +1684,16 @@ function detectLocale() {
|
|
|
1698
1684
|
return defaultLocale2;
|
|
1699
1685
|
}
|
|
1700
1686
|
}
|
|
1701
|
-
var getMessages = (locale, enMsg, nbMsg, fiMsg) => {
|
|
1702
|
-
if (locale === "nb")
|
|
1703
|
-
|
|
1704
|
-
if (locale === "
|
|
1705
|
-
return fiMsg;
|
|
1687
|
+
var getMessages = (locale, enMsg, nbMsg, fiMsg, daMsg) => {
|
|
1688
|
+
if (locale === "nb") return nbMsg;
|
|
1689
|
+
if (locale === "fi") return fiMsg;
|
|
1690
|
+
if (locale === "da") return daMsg;
|
|
1706
1691
|
return enMsg;
|
|
1707
1692
|
};
|
|
1708
|
-
var activateI18n = (enMessages, nbMessages, fiMessages) => {
|
|
1693
|
+
var activateI18n = (enMessages, nbMessages, fiMessages, daMessages) => {
|
|
1709
1694
|
const locale = detectLocale();
|
|
1710
|
-
const
|
|
1711
|
-
i18n.load(locale,
|
|
1695
|
+
const messages5 = getMessages(locale, enMessages, nbMessages, fiMessages, daMessages);
|
|
1696
|
+
i18n.load(locale, messages5);
|
|
1712
1697
|
i18n.activate(locale);
|
|
1713
1698
|
};
|
|
1714
1699
|
|
|
@@ -1729,21 +1714,24 @@ function kebabCaseAttributes(constructor) {
|
|
|
1729
1714
|
};
|
|
1730
1715
|
}
|
|
1731
1716
|
|
|
1717
|
+
// packages/breadcrumbs/locales/da/messages.mjs
|
|
1718
|
+
var messages = JSON.parse('{"breadcrumbs.ariaLabel":"Du er her"}');
|
|
1719
|
+
|
|
1732
1720
|
// packages/breadcrumbs/locales/en/messages.mjs
|
|
1733
|
-
var
|
|
1721
|
+
var messages2 = JSON.parse('{"breadcrumbs.ariaLabel":"You are here"}');
|
|
1734
1722
|
|
|
1735
1723
|
// packages/breadcrumbs/locales/fi/messages.mjs
|
|
1736
|
-
var
|
|
1724
|
+
var messages3 = JSON.parse('{"breadcrumbs.ariaLabel":"Olet t\xE4ss\xE4"}');
|
|
1737
1725
|
|
|
1738
1726
|
// packages/breadcrumbs/locales/nb/messages.mjs
|
|
1739
|
-
var
|
|
1727
|
+
var messages4 = JSON.parse('{"breadcrumbs.ariaLabel":"Her er du"}');
|
|
1740
1728
|
|
|
1741
1729
|
// packages/breadcrumbs/index.js
|
|
1742
1730
|
var separator = html`<span class=${breadcrumbs.separator}>/</span>`;
|
|
1743
1731
|
var WarpBreadcrumbs = class extends kebabCaseAttributes(WarpElement) {
|
|
1744
1732
|
constructor() {
|
|
1745
1733
|
super();
|
|
1746
|
-
activateI18n(
|
|
1734
|
+
activateI18n(messages2, messages4, messages3, messages);
|
|
1747
1735
|
this.ariaLabel = i18n._({
|
|
1748
1736
|
id: "breadcrumbs.ariaLabel",
|
|
1749
1737
|
message: "You are here",
|