@warp-ds/elements 1.2.3-next.2 → 1.3.0-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.d.ts +2 -1
- package/dist/index.js +412 -296
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.js +72 -58
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/alert/index.js +80 -66
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/attention/index.js +71 -57
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/index.js +3 -3
- package/dist/packages/badge/index.js.map +2 -2
- package/dist/packages/box/index.js +3 -3
- package/dist/packages/box/index.js.map +2 -2
- package/dist/packages/breadcrumbs/index.js +67 -53
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/button/index.js +66 -52
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/card/index.js +3 -3
- package/dist/packages/card/index.js.map +2 -2
- package/dist/packages/expandable/index.js +72 -58
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/pill/index.d.ts +34 -0
- package/dist/packages/pill/index.js +1810 -0
- package/dist/packages/pill/index.js.map +7 -0
- package/dist/packages/pill/locales/en/messages.d.mts +1 -0
- package/dist/packages/pill/locales/fi/messages.d.mts +1 -0
- package/dist/packages/pill/locales/nb/messages.d.mts +1 -0
- package/dist/packages/select/index.js +70 -56
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/textfield/index.js +3 -3
- package/dist/packages/textfield/index.js.map +2 -2
- package/dist/packages/toast/index.js +83 -69
- package/dist/packages/toast/index.js.map +4 -4
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1045,7 +1045,7 @@ import { html as html3 } from "lit";
|
|
|
1045
1045
|
import WarpElement from "@warp-ds/elements-core";
|
|
1046
1046
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
1047
1047
|
|
|
1048
|
-
// node_modules/.pnpm/@warp-ds+css@1.
|
|
1048
|
+
// node_modules/.pnpm/@warp-ds+css@1.7.0/node_modules/@warp-ds/css/component-classes/index.js
|
|
1049
1049
|
var badge = {
|
|
1050
1050
|
base: "py-4 px-8 border-0 rounded-4 text-xs inline-flex",
|
|
1051
1051
|
neutral: "i-bg-$color-badge-neutral-background i-text-$color-badge-neutral-text",
|
|
@@ -1074,6 +1074,17 @@ var box = {
|
|
|
1074
1074
|
neutralClickable: "hover:i-bg-$color-box-neutral-background-hover active:i-bg-$color-box-neutral-background-hover",
|
|
1075
1075
|
borderedClickable: "hover:i-bg-$color-box-bordered-background-hover active:i-bg-$color-box-bordered-background-hover hover:i-border-$color-box-bordered-border-hover active:i-border-$color-box-bordered-border-hover"
|
|
1076
1076
|
};
|
|
1077
|
+
var pill = {
|
|
1078
|
+
pill: "flex items-center",
|
|
1079
|
+
button: "inline-flex items-center focusable text-xs transition-all",
|
|
1080
|
+
suggestion: "i-bg-$color-pill-suggestion-background hover:i-bg-$color-pill-suggestion-background-hover active:i-bg-$color-pill-suggestion-background-active i-text-$color-pill-suggestion-text font-bold",
|
|
1081
|
+
filter: "i-bg-$color-pill-filter-background hover:i-bg-$color-pill-filter-background-hover active:i-bg-$color-pill-filter-background-active i-text-$color-pill-filter-text",
|
|
1082
|
+
label: "pl-12 py-8 rounded-l-full",
|
|
1083
|
+
labelWithoutClose: "pr-12 rounded-r-full",
|
|
1084
|
+
labelWithClose: "pr-2",
|
|
1085
|
+
close: "pr-12 pl-4 py-8 rounded-r-full",
|
|
1086
|
+
a11y: "sr-only"
|
|
1087
|
+
};
|
|
1077
1088
|
var card = {
|
|
1078
1089
|
card: "cursor-pointer overflow-hidden relative transition-all",
|
|
1079
1090
|
cardShadow: "rounded-8 i-shadow-$shadow-card hover:i-shadow-$shadow-card-hover hover:i-bg-$color-card-background-hover tap-highlight-transparent",
|
|
@@ -1253,9 +1264,9 @@ var modal = {
|
|
|
1253
1264
|
content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
|
|
1254
1265
|
footer: "flex justify-end shrink-0 px-16 sm:px-32",
|
|
1255
1266
|
transitionTitle: "transition-all duration-300",
|
|
1256
|
-
transitionTitleCenter: "justify-self-center",
|
|
1267
|
+
transitionTitleCenter: "justify-self-center self-center",
|
|
1257
1268
|
transitionTitleColSpan: "col-span-2",
|
|
1258
|
-
title: "-mt-4 sm:-mt-8 h-40 sm:h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-
|
|
1269
|
+
title: "py-8 sm:py-0 -mt-4 sm:-mt-8 min-h-40 sm:min-h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-start px-16 sm:px-32 border-b sm:border-b-0 shrink-0",
|
|
1259
1270
|
titleText: "mb-0 h4 sm:h3",
|
|
1260
1271
|
titleButton: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} sm:min-h-[44px] sm:min-w-[44px] min-h-[32px] min-w-[32px]`,
|
|
1261
1272
|
titleButtonLeft: "-ml-8 sm:-ml-12 justify-self-start",
|
|
@@ -1355,14 +1366,14 @@ var attention = {
|
|
|
1355
1366
|
closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
|
|
1356
1367
|
};
|
|
1357
1368
|
|
|
1358
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
1369
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/search-16.js
|
|
1359
1370
|
import { LitElement } from "lit";
|
|
1360
1371
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1361
1372
|
|
|
1362
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1373
|
+
// node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
|
|
1363
1374
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1364
1375
|
|
|
1365
|
-
// node_modules/.pnpm/@lingui+message-utils@4.
|
|
1376
|
+
// node_modules/.pnpm/@lingui+message-utils@4.7.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1366
1377
|
var import_parser = __toESM(require_parser(), 1);
|
|
1367
1378
|
function processTokens(tokens, mapText) {
|
|
1368
1379
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
@@ -1412,13 +1423,14 @@ Message: ${message}`);
|
|
|
1412
1423
|
}
|
|
1413
1424
|
}
|
|
1414
1425
|
|
|
1415
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1426
|
+
// node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
|
|
1416
1427
|
var isString = (s3) => typeof s3 === "string";
|
|
1417
1428
|
var isFunction = (f3) => typeof f3 === "function";
|
|
1418
1429
|
var cache = /* @__PURE__ */ new Map();
|
|
1430
|
+
var defaultLocale = "en";
|
|
1419
1431
|
function normalizeLocales(locales) {
|
|
1420
1432
|
const out = Array.isArray(locales) ? locales : [locales];
|
|
1421
|
-
return [...out,
|
|
1433
|
+
return [...out, defaultLocale];
|
|
1422
1434
|
}
|
|
1423
1435
|
function date(locales, value, format) {
|
|
1424
1436
|
const _locales = normalizeLocales(locales);
|
|
@@ -1463,11 +1475,13 @@ function cacheKey(type, locales, options) {
|
|
|
1463
1475
|
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1464
1476
|
}
|
|
1465
1477
|
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
|
|
1466
|
-
var getDefaultFormats = (locale,
|
|
1467
|
-
locales =
|
|
1468
|
-
const style = (format) =>
|
|
1478
|
+
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1479
|
+
const locales = passedLocales || locale;
|
|
1480
|
+
const style = (format) => {
|
|
1481
|
+
return typeof format === "object" ? format : formats[format] || { style: format };
|
|
1482
|
+
};
|
|
1469
1483
|
const replaceOctothorpe = (value, message) => {
|
|
1470
|
-
const numberFormat = Object.keys(formats).length ? style("number") :
|
|
1484
|
+
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1471
1485
|
const valueStr = number(locales, value, numberFormat);
|
|
1472
1486
|
return message.replace("#", valueStr);
|
|
1473
1487
|
};
|
|
@@ -1482,17 +1496,19 @@ var getDefaultFormats = (locale, locales, formats = {}) => {
|
|
|
1482
1496
|
const message = plural(locales, true, value, cases);
|
|
1483
1497
|
return replaceOctothorpe(value - offset, message);
|
|
1484
1498
|
},
|
|
1485
|
-
select:
|
|
1486
|
-
var _a;
|
|
1487
|
-
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1488
|
-
},
|
|
1499
|
+
select: selectFormatter,
|
|
1489
1500
|
number: (value, format) => number(locales, value, style(format)),
|
|
1490
1501
|
date: (value, format) => date(locales, value, style(format)),
|
|
1491
|
-
undefined:
|
|
1502
|
+
undefined: undefinedFormatter
|
|
1492
1503
|
};
|
|
1493
1504
|
};
|
|
1505
|
+
var selectFormatter = (value, rules) => {
|
|
1506
|
+
var _a;
|
|
1507
|
+
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1508
|
+
};
|
|
1509
|
+
var undefinedFormatter = (value) => value;
|
|
1494
1510
|
function interpolate(translation, locale, locales) {
|
|
1495
|
-
return (values
|
|
1511
|
+
return (values = {}, formats) => {
|
|
1496
1512
|
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1497
1513
|
const formatMessage = (message) => {
|
|
1498
1514
|
if (!Array.isArray(message))
|
|
@@ -1502,14 +1518,15 @@ function interpolate(translation, locale, locales) {
|
|
|
1502
1518
|
return message2 + token;
|
|
1503
1519
|
const [name, type, format] = token;
|
|
1504
1520
|
let interpolatedFormat = {};
|
|
1505
|
-
if (format != null &&
|
|
1506
|
-
Object.
|
|
1507
|
-
interpolatedFormat[key] = formatMessage(
|
|
1521
|
+
if (format != null && typeof format === "object") {
|
|
1522
|
+
Object.entries(format).forEach(([key, value2]) => {
|
|
1523
|
+
interpolatedFormat[key] = formatMessage(value2);
|
|
1508
1524
|
});
|
|
1509
1525
|
} else {
|
|
1510
1526
|
interpolatedFormat = format;
|
|
1511
1527
|
}
|
|
1512
|
-
const
|
|
1528
|
+
const formatter = formatters[type];
|
|
1529
|
+
const value = formatter(values[name], interpolatedFormat);
|
|
1513
1530
|
if (value == null)
|
|
1514
1531
|
return message2;
|
|
1515
1532
|
return message2 + value;
|
|
@@ -1521,7 +1538,7 @@ function interpolate(translation, locale, locales) {
|
|
|
1521
1538
|
}
|
|
1522
1539
|
if (isString(result))
|
|
1523
1540
|
return result.trim();
|
|
1524
|
-
return result;
|
|
1541
|
+
return result ? String(result) : "";
|
|
1525
1542
|
};
|
|
1526
1543
|
}
|
|
1527
1544
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1535,25 +1552,29 @@ var EventEmitter = class {
|
|
|
1535
1552
|
__publicField$1(this, "_events", {});
|
|
1536
1553
|
}
|
|
1537
1554
|
on(event, listener) {
|
|
1538
|
-
|
|
1539
|
-
|
|
1555
|
+
var _a2;
|
|
1556
|
+
var _a;
|
|
1557
|
+
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1540
1558
|
this._events[event].push(listener);
|
|
1541
1559
|
return () => this.removeListener(event, listener);
|
|
1542
1560
|
}
|
|
1543
1561
|
removeListener(event, listener) {
|
|
1544
|
-
|
|
1562
|
+
const maybeListeners = this._getListeners(event);
|
|
1563
|
+
if (!maybeListeners)
|
|
1545
1564
|
return;
|
|
1546
|
-
const index =
|
|
1565
|
+
const index = maybeListeners.indexOf(listener);
|
|
1547
1566
|
if (~index)
|
|
1548
|
-
|
|
1567
|
+
maybeListeners.splice(index, 1);
|
|
1549
1568
|
}
|
|
1550
1569
|
emit(event, ...args) {
|
|
1551
|
-
|
|
1570
|
+
const maybeListeners = this._getListeners(event);
|
|
1571
|
+
if (!maybeListeners)
|
|
1552
1572
|
return;
|
|
1553
|
-
|
|
1573
|
+
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1554
1574
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1575
|
+
_getListeners(event) {
|
|
1576
|
+
const maybeListeners = this._events[event];
|
|
1577
|
+
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1557
1578
|
}
|
|
1558
1579
|
};
|
|
1559
1580
|
var __defProp2 = Object.defineProperty;
|
|
@@ -1564,23 +1585,22 @@ var __publicField2 = (obj, key, value) => {
|
|
|
1564
1585
|
};
|
|
1565
1586
|
var I18n = class extends EventEmitter {
|
|
1566
1587
|
constructor(params) {
|
|
1588
|
+
var _a;
|
|
1567
1589
|
super();
|
|
1568
|
-
__publicField2(this, "_locale");
|
|
1590
|
+
__publicField2(this, "_locale", "");
|
|
1569
1591
|
__publicField2(this, "_locales");
|
|
1570
|
-
__publicField2(this, "_localeData");
|
|
1571
|
-
__publicField2(this, "_messages");
|
|
1592
|
+
__publicField2(this, "_localeData", {});
|
|
1593
|
+
__publicField2(this, "_messages", {});
|
|
1572
1594
|
__publicField2(this, "_missing");
|
|
1573
1595
|
__publicField2(this, "t", this._.bind(this));
|
|
1574
|
-
this._messages = {};
|
|
1575
|
-
this._localeData = {};
|
|
1576
1596
|
if (params.missing != null)
|
|
1577
1597
|
this._missing = params.missing;
|
|
1578
1598
|
if (params.messages != null)
|
|
1579
1599
|
this.load(params.messages);
|
|
1580
1600
|
if (params.localeData != null)
|
|
1581
1601
|
this.loadLocaleData(params.localeData);
|
|
1582
|
-
if (params.locale
|
|
1583
|
-
this.activate(params.locale, params.locales);
|
|
1602
|
+
if (typeof params.locale === "string" || params.locales) {
|
|
1603
|
+
this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
|
|
1584
1604
|
}
|
|
1585
1605
|
}
|
|
1586
1606
|
get locale() {
|
|
@@ -1601,15 +1621,17 @@ var I18n = class extends EventEmitter {
|
|
|
1601
1621
|
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1602
1622
|
}
|
|
1603
1623
|
_loadLocaleData(locale, localeData) {
|
|
1604
|
-
|
|
1624
|
+
const maybeLocaleData = this._localeData[locale];
|
|
1625
|
+
if (!maybeLocaleData) {
|
|
1605
1626
|
this._localeData[locale] = localeData;
|
|
1606
1627
|
} else {
|
|
1607
|
-
Object.assign(
|
|
1628
|
+
Object.assign(maybeLocaleData, localeData);
|
|
1608
1629
|
}
|
|
1609
1630
|
}
|
|
1610
1631
|
/**
|
|
1611
1632
|
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1612
1633
|
*/
|
|
1634
|
+
// @ts-ignore deprecated, so ignore the reported error
|
|
1613
1635
|
loadLocaleData(localeOrAllData, localeData) {
|
|
1614
1636
|
if (localeData != null) {
|
|
1615
1637
|
this._loadLocaleData(localeOrAllData, localeData);
|
|
@@ -1620,19 +1642,20 @@ var I18n = class extends EventEmitter {
|
|
|
1620
1642
|
}
|
|
1621
1643
|
this.emit("change");
|
|
1622
1644
|
}
|
|
1623
|
-
_load(locale,
|
|
1624
|
-
|
|
1625
|
-
|
|
1645
|
+
_load(locale, messages43) {
|
|
1646
|
+
const maybeMessages = this._messages[locale];
|
|
1647
|
+
if (!maybeMessages) {
|
|
1648
|
+
this._messages[locale] = messages43;
|
|
1626
1649
|
} else {
|
|
1627
|
-
Object.assign(
|
|
1650
|
+
Object.assign(maybeMessages, messages43);
|
|
1628
1651
|
}
|
|
1629
1652
|
}
|
|
1630
|
-
load(localeOrMessages,
|
|
1631
|
-
if (
|
|
1632
|
-
this._load(localeOrMessages,
|
|
1653
|
+
load(localeOrMessages, messages43) {
|
|
1654
|
+
if (typeof localeOrMessages == "string" && typeof messages43 === "object") {
|
|
1655
|
+
this._load(localeOrMessages, messages43);
|
|
1633
1656
|
} else {
|
|
1634
|
-
Object.
|
|
1635
|
-
(locale) => this._load(locale,
|
|
1657
|
+
Object.entries(localeOrMessages).forEach(
|
|
1658
|
+
([locale, messages210]) => this._load(locale, messages210)
|
|
1636
1659
|
);
|
|
1637
1660
|
}
|
|
1638
1661
|
this.emit("change");
|
|
@@ -1640,10 +1663,10 @@ var I18n = class extends EventEmitter {
|
|
|
1640
1663
|
/**
|
|
1641
1664
|
* @param options {@link LoadAndActivateOptions}
|
|
1642
1665
|
*/
|
|
1643
|
-
loadAndActivate({ locale, locales, messages:
|
|
1666
|
+
loadAndActivate({ locale, locales, messages: messages43 }) {
|
|
1644
1667
|
this._locale = locale;
|
|
1645
1668
|
this._locales = locales || void 0;
|
|
1646
|
-
this._messages[this._locale] =
|
|
1669
|
+
this._messages[this._locale] = messages43;
|
|
1647
1670
|
this.emit("change");
|
|
1648
1671
|
}
|
|
1649
1672
|
activate(locale, locales) {
|
|
@@ -1656,13 +1679,15 @@ var I18n = class extends EventEmitter {
|
|
|
1656
1679
|
this._locales = locales;
|
|
1657
1680
|
this.emit("change");
|
|
1658
1681
|
}
|
|
1659
|
-
_(id, values
|
|
1682
|
+
_(id, values, options) {
|
|
1683
|
+
let message = options == null ? void 0 : options.message;
|
|
1660
1684
|
if (!isString(id)) {
|
|
1661
1685
|
values = id.values || values;
|
|
1662
1686
|
message = id.message;
|
|
1663
1687
|
id = id.id;
|
|
1664
1688
|
}
|
|
1665
|
-
const
|
|
1689
|
+
const messageForId = this.messages[id];
|
|
1690
|
+
const messageMissing = messageForId === void 0;
|
|
1666
1691
|
const missing = this._missing;
|
|
1667
1692
|
if (missing && messageMissing) {
|
|
1668
1693
|
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
@@ -1670,7 +1695,7 @@ var I18n = class extends EventEmitter {
|
|
|
1670
1695
|
if (messageMissing) {
|
|
1671
1696
|
this.emit("missing", { id, locale: this._locale });
|
|
1672
1697
|
}
|
|
1673
|
-
let translation =
|
|
1698
|
+
let translation = messageForId || message || id;
|
|
1674
1699
|
if (true) {
|
|
1675
1700
|
translation = isString(translation) ? compileMessage(translation) : translation;
|
|
1676
1701
|
}
|
|
@@ -1682,7 +1707,7 @@ var I18n = class extends EventEmitter {
|
|
|
1682
1707
|
translation,
|
|
1683
1708
|
this._locale,
|
|
1684
1709
|
this._locales
|
|
1685
|
-
)(values, formats);
|
|
1710
|
+
)(values, options == null ? void 0 : options.formats);
|
|
1686
1711
|
}
|
|
1687
1712
|
date(value, format) {
|
|
1688
1713
|
return date(this._locales || this._locale, value, format);
|
|
@@ -1696,16 +1721,16 @@ function setupI18n(params = {}) {
|
|
|
1696
1721
|
}
|
|
1697
1722
|
var i18n = setupI18n();
|
|
1698
1723
|
|
|
1699
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
1724
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/search-16.js
|
|
1700
1725
|
var messages = JSON.parse('{"icon.title.search":"Forst\xF8rrelsesglass"}');
|
|
1701
1726
|
var messages2 = JSON.parse('{"icon.title.search":"Magnifying glass"}');
|
|
1702
1727
|
var messages3 = JSON.parse('{"icon.title.search":"Suurennuslasi"}');
|
|
1703
1728
|
var supportedLocales = ["en", "nb", "fi"];
|
|
1704
|
-
var
|
|
1729
|
+
var defaultLocale2 = "en";
|
|
1705
1730
|
var getSupportedLocale = (usedLocale) => {
|
|
1706
1731
|
return supportedLocales.find(
|
|
1707
1732
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1708
|
-
) ||
|
|
1733
|
+
) || defaultLocale2;
|
|
1709
1734
|
};
|
|
1710
1735
|
function detectLocale() {
|
|
1711
1736
|
if (typeof window === "undefined") {
|
|
@@ -1717,7 +1742,7 @@ function detectLocale() {
|
|
|
1717
1742
|
return getSupportedLocale(htmlLocale);
|
|
1718
1743
|
} catch (e2) {
|
|
1719
1744
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
1720
|
-
return
|
|
1745
|
+
return defaultLocale2;
|
|
1721
1746
|
}
|
|
1722
1747
|
}
|
|
1723
1748
|
var getMessages = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1729,8 +1754,8 @@ var getMessages = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
1729
1754
|
};
|
|
1730
1755
|
var activateI18n = (enMessages, nbMessages, fiMessages) => {
|
|
1731
1756
|
const locale = detectLocale();
|
|
1732
|
-
const
|
|
1733
|
-
i18n.load(locale,
|
|
1757
|
+
const messages43 = getMessages(locale, enMessages, nbMessages, fiMessages);
|
|
1758
|
+
i18n.load(locale, messages43);
|
|
1734
1759
|
i18n.activate(locale);
|
|
1735
1760
|
};
|
|
1736
1761
|
activateI18n(messages2, messages, messages3);
|
|
@@ -1744,18 +1769,18 @@ if (!customElements.get("w-icon-search-16")) {
|
|
|
1744
1769
|
customElements.define("w-icon-search-16", IconSearch16);
|
|
1745
1770
|
}
|
|
1746
1771
|
|
|
1747
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
1772
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
|
|
1748
1773
|
import { LitElement as LitElement2 } from "lit";
|
|
1749
1774
|
import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
|
|
1750
1775
|
var messages4 = JSON.parse('{"icon.title.close":"Kryss"}');
|
|
1751
1776
|
var messages22 = JSON.parse('{"icon.title.close":"Cross"}');
|
|
1752
1777
|
var messages32 = JSON.parse('{"icon.title.close":"Rasti"}');
|
|
1753
1778
|
var supportedLocales2 = ["en", "nb", "fi"];
|
|
1754
|
-
var
|
|
1779
|
+
var defaultLocale3 = "en";
|
|
1755
1780
|
var getSupportedLocale2 = (usedLocale) => {
|
|
1756
1781
|
return supportedLocales2.find(
|
|
1757
1782
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1758
|
-
) ||
|
|
1783
|
+
) || defaultLocale3;
|
|
1759
1784
|
};
|
|
1760
1785
|
function detectLocale2() {
|
|
1761
1786
|
if (typeof window === "undefined") {
|
|
@@ -1767,7 +1792,7 @@ function detectLocale2() {
|
|
|
1767
1792
|
return getSupportedLocale2(htmlLocale);
|
|
1768
1793
|
} catch (e2) {
|
|
1769
1794
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
1770
|
-
return
|
|
1795
|
+
return defaultLocale3;
|
|
1771
1796
|
}
|
|
1772
1797
|
}
|
|
1773
1798
|
var getMessages2 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1779,8 +1804,8 @@ var getMessages2 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
1779
1804
|
};
|
|
1780
1805
|
var activateI18n2 = (enMessages, nbMessages, fiMessages) => {
|
|
1781
1806
|
const locale = detectLocale2();
|
|
1782
|
-
const
|
|
1783
|
-
i18n.load(locale,
|
|
1807
|
+
const messages43 = getMessages2(locale, enMessages, nbMessages, fiMessages);
|
|
1808
|
+
i18n.load(locale, messages43);
|
|
1784
1809
|
i18n.activate(locale);
|
|
1785
1810
|
};
|
|
1786
1811
|
activateI18n2(messages22, messages4, messages32);
|
|
@@ -1903,18 +1928,18 @@ var r = function() {
|
|
|
1903
1928
|
}, []).join(" ");
|
|
1904
1929
|
};
|
|
1905
1930
|
|
|
1906
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
1931
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/alert-info-16.js
|
|
1907
1932
|
import { LitElement as LitElement3 } from "lit";
|
|
1908
1933
|
import { unsafeStatic as unsafeStatic3, html as html4 } from "lit/static-html.js";
|
|
1909
1934
|
var messages5 = JSON.parse('{"icon.title.alert-info":"Bl\xE5 sirkel med bokstaven \\"I\\""}');
|
|
1910
1935
|
var messages23 = JSON.parse('{"icon.title.alert-info":"Blue circle with the letter I"}');
|
|
1911
1936
|
var messages33 = JSON.parse('{"icon.title.alert-info":"Ympyr\xE4, jonka sis\xE4ll\xE4 on i-kirjain"}');
|
|
1912
1937
|
var supportedLocales3 = ["en", "nb", "fi"];
|
|
1913
|
-
var
|
|
1938
|
+
var defaultLocale4 = "en";
|
|
1914
1939
|
var getSupportedLocale3 = (usedLocale) => {
|
|
1915
1940
|
return supportedLocales3.find(
|
|
1916
1941
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1917
|
-
) ||
|
|
1942
|
+
) || defaultLocale4;
|
|
1918
1943
|
};
|
|
1919
1944
|
function detectLocale3() {
|
|
1920
1945
|
if (typeof window === "undefined") {
|
|
@@ -1926,7 +1951,7 @@ function detectLocale3() {
|
|
|
1926
1951
|
return getSupportedLocale3(htmlLocale);
|
|
1927
1952
|
} catch (e2) {
|
|
1928
1953
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
1929
|
-
return
|
|
1954
|
+
return defaultLocale4;
|
|
1930
1955
|
}
|
|
1931
1956
|
}
|
|
1932
1957
|
var getMessages3 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1938,8 +1963,8 @@ var getMessages3 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
1938
1963
|
};
|
|
1939
1964
|
var activateI18n3 = (enMessages, nbMessages, fiMessages) => {
|
|
1940
1965
|
const locale = detectLocale3();
|
|
1941
|
-
const
|
|
1942
|
-
i18n.load(locale,
|
|
1966
|
+
const messages43 = getMessages3(locale, enMessages, nbMessages, fiMessages);
|
|
1967
|
+
i18n.load(locale, messages43);
|
|
1943
1968
|
i18n.activate(locale);
|
|
1944
1969
|
};
|
|
1945
1970
|
activateI18n3(messages23, messages5, messages33);
|
|
@@ -1953,18 +1978,18 @@ if (!customElements.get("w-icon-alert-info-16")) {
|
|
|
1953
1978
|
customElements.define("w-icon-alert-info-16", IconAlertInfo16);
|
|
1954
1979
|
}
|
|
1955
1980
|
|
|
1956
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
1981
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/alert-warning-16.js
|
|
1957
1982
|
import { LitElement as LitElement4 } from "lit";
|
|
1958
1983
|
import { unsafeStatic as unsafeStatic4, html as html5 } from "lit/static-html.js";
|
|
1959
1984
|
var messages6 = JSON.parse('{"icon.title.alert-warning":"Gul varseltrekant med utropstegn"}');
|
|
1960
1985
|
var messages24 = JSON.parse('{"icon.title.alert-warning":"Yellow warning triangle with exclamation point"}');
|
|
1961
1986
|
var messages34 = JSON.parse('{"icon.title.alert-warning":"Keltainen varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
|
|
1962
1987
|
var supportedLocales4 = ["en", "nb", "fi"];
|
|
1963
|
-
var
|
|
1988
|
+
var defaultLocale5 = "en";
|
|
1964
1989
|
var getSupportedLocale4 = (usedLocale) => {
|
|
1965
1990
|
return supportedLocales4.find(
|
|
1966
1991
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1967
|
-
) ||
|
|
1992
|
+
) || defaultLocale5;
|
|
1968
1993
|
};
|
|
1969
1994
|
function detectLocale4() {
|
|
1970
1995
|
if (typeof window === "undefined") {
|
|
@@ -1976,7 +2001,7 @@ function detectLocale4() {
|
|
|
1976
2001
|
return getSupportedLocale4(htmlLocale);
|
|
1977
2002
|
} catch (e2) {
|
|
1978
2003
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
1979
|
-
return
|
|
2004
|
+
return defaultLocale5;
|
|
1980
2005
|
}
|
|
1981
2006
|
}
|
|
1982
2007
|
var getMessages4 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1988,8 +2013,8 @@ var getMessages4 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
1988
2013
|
};
|
|
1989
2014
|
var activateI18n4 = (enMessages, nbMessages, fiMessages) => {
|
|
1990
2015
|
const locale = detectLocale4();
|
|
1991
|
-
const
|
|
1992
|
-
i18n.load(locale,
|
|
2016
|
+
const messages43 = getMessages4(locale, enMessages, nbMessages, fiMessages);
|
|
2017
|
+
i18n.load(locale, messages43);
|
|
1993
2018
|
i18n.activate(locale);
|
|
1994
2019
|
};
|
|
1995
2020
|
activateI18n4(messages24, messages6, messages34);
|
|
@@ -2003,18 +2028,18 @@ if (!customElements.get("w-icon-alert-warning-16")) {
|
|
|
2003
2028
|
customElements.define("w-icon-alert-warning-16", IconAlertWarning16);
|
|
2004
2029
|
}
|
|
2005
2030
|
|
|
2006
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
2031
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/alert-error-16.js
|
|
2007
2032
|
import { LitElement as LitElement5 } from "lit";
|
|
2008
2033
|
import { unsafeStatic as unsafeStatic5, html as html6 } from "lit/static-html.js";
|
|
2009
2034
|
var messages7 = JSON.parse('{"icon.title.alert-error":"R\xF8d \xE5ttekant med hvitt utropstegn"}');
|
|
2010
2035
|
var messages25 = JSON.parse('{"icon.title.alert-error":"Red octagon with white exclamation point"}');
|
|
2011
2036
|
var messages35 = JSON.parse('{"icon.title.alert-error":"Punainen kahdeksankulmio, jonka sis\xE4ll\xE4 on valkoinen huutomerkki"}');
|
|
2012
2037
|
var supportedLocales5 = ["en", "nb", "fi"];
|
|
2013
|
-
var
|
|
2038
|
+
var defaultLocale6 = "en";
|
|
2014
2039
|
var getSupportedLocale5 = (usedLocale) => {
|
|
2015
2040
|
return supportedLocales5.find(
|
|
2016
2041
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
2017
|
-
) ||
|
|
2042
|
+
) || defaultLocale6;
|
|
2018
2043
|
};
|
|
2019
2044
|
function detectLocale5() {
|
|
2020
2045
|
if (typeof window === "undefined") {
|
|
@@ -2026,7 +2051,7 @@ function detectLocale5() {
|
|
|
2026
2051
|
return getSupportedLocale5(htmlLocale);
|
|
2027
2052
|
} catch (e2) {
|
|
2028
2053
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
2029
|
-
return
|
|
2054
|
+
return defaultLocale6;
|
|
2030
2055
|
}
|
|
2031
2056
|
}
|
|
2032
2057
|
var getMessages5 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -2038,8 +2063,8 @@ var getMessages5 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
2038
2063
|
};
|
|
2039
2064
|
var activateI18n5 = (enMessages, nbMessages, fiMessages) => {
|
|
2040
2065
|
const locale = detectLocale5();
|
|
2041
|
-
const
|
|
2042
|
-
i18n.load(locale,
|
|
2066
|
+
const messages43 = getMessages5(locale, enMessages, nbMessages, fiMessages);
|
|
2067
|
+
i18n.load(locale, messages43);
|
|
2043
2068
|
i18n.activate(locale);
|
|
2044
2069
|
};
|
|
2045
2070
|
activateI18n5(messages25, messages7, messages35);
|
|
@@ -2053,18 +2078,18 @@ if (!customElements.get("w-icon-alert-error-16")) {
|
|
|
2053
2078
|
customElements.define("w-icon-alert-error-16", IconAlertError16);
|
|
2054
2079
|
}
|
|
2055
2080
|
|
|
2056
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
2081
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/alert-success-16.js
|
|
2057
2082
|
import { LitElement as LitElement6 } from "lit";
|
|
2058
2083
|
import { unsafeStatic as unsafeStatic6, html as html7 } from "lit/static-html.js";
|
|
2059
2084
|
var messages8 = JSON.parse('{"icon.title.alert-success":"Gr\xF8nn sirkel med sjekkmerke"}');
|
|
2060
2085
|
var messages26 = JSON.parse('{"icon.title.alert-success":"Green circle with checkmark"}');
|
|
2061
2086
|
var messages36 = JSON.parse('{"icon.title.alert-success":"Vihre\xE4 ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"}');
|
|
2062
2087
|
var supportedLocales6 = ["en", "nb", "fi"];
|
|
2063
|
-
var
|
|
2088
|
+
var defaultLocale7 = "en";
|
|
2064
2089
|
var getSupportedLocale6 = (usedLocale) => {
|
|
2065
2090
|
return supportedLocales6.find(
|
|
2066
2091
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
2067
|
-
) ||
|
|
2092
|
+
) || defaultLocale7;
|
|
2068
2093
|
};
|
|
2069
2094
|
function detectLocale6() {
|
|
2070
2095
|
if (typeof window === "undefined") {
|
|
@@ -2076,7 +2101,7 @@ function detectLocale6() {
|
|
|
2076
2101
|
return getSupportedLocale6(htmlLocale);
|
|
2077
2102
|
} catch (e2) {
|
|
2078
2103
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
2079
|
-
return
|
|
2104
|
+
return defaultLocale7;
|
|
2080
2105
|
}
|
|
2081
2106
|
}
|
|
2082
2107
|
var getMessages6 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -2088,8 +2113,8 @@ var getMessages6 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
2088
2113
|
};
|
|
2089
2114
|
var activateI18n6 = (enMessages, nbMessages, fiMessages) => {
|
|
2090
2115
|
const locale = detectLocale6();
|
|
2091
|
-
const
|
|
2092
|
-
i18n.load(locale,
|
|
2116
|
+
const messages43 = getMessages6(locale, enMessages, nbMessages, fiMessages);
|
|
2117
|
+
i18n.load(locale, messages43);
|
|
2093
2118
|
i18n.activate(locale);
|
|
2094
2119
|
};
|
|
2095
2120
|
activateI18n6(messages26, messages8, messages36);
|
|
@@ -2542,7 +2567,7 @@ var D2 = { getClippingRect: function(t2) {
|
|
|
2542
2567
|
}, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === i2(t2).direction };
|
|
2543
2568
|
var z = (t2, n3, o3) => o(t2, n3, __spreadValues({ platform: D2 }, o3));
|
|
2544
2569
|
|
|
2545
|
-
// node_modules/.pnpm/@warp-ds+core@1.0.
|
|
2570
|
+
// node_modules/.pnpm/@warp-ds+core@1.0.2/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
|
|
2546
2571
|
var TOP = "top";
|
|
2547
2572
|
var BOTTOM = "bottom";
|
|
2548
2573
|
var LEFT = "left";
|
|
@@ -2618,11 +2643,11 @@ var messages11 = JSON.parse('{"attention.aria.callout":"callout speech bubble","
|
|
|
2618
2643
|
|
|
2619
2644
|
// packages/i18n.ts
|
|
2620
2645
|
var supportedLocales7 = ["en", "nb", "fi"];
|
|
2621
|
-
var
|
|
2646
|
+
var defaultLocale8 = "en";
|
|
2622
2647
|
var getSupportedLocale7 = (usedLocale) => {
|
|
2623
2648
|
return supportedLocales7.find(
|
|
2624
2649
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
2625
|
-
) ||
|
|
2650
|
+
) || defaultLocale8;
|
|
2626
2651
|
};
|
|
2627
2652
|
function detectLocale7() {
|
|
2628
2653
|
if (typeof window === "undefined") {
|
|
@@ -2634,7 +2659,7 @@ function detectLocale7() {
|
|
|
2634
2659
|
return getSupportedLocale7(htmlLocale);
|
|
2635
2660
|
} catch (e2) {
|
|
2636
2661
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
2637
|
-
return
|
|
2662
|
+
return defaultLocale8;
|
|
2638
2663
|
}
|
|
2639
2664
|
}
|
|
2640
2665
|
var getMessages7 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -2646,8 +2671,8 @@ var getMessages7 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
2646
2671
|
};
|
|
2647
2672
|
var activateI18n7 = (enMessages, nbMessages, fiMessages) => {
|
|
2648
2673
|
const locale = detectLocale7();
|
|
2649
|
-
const
|
|
2650
|
-
i18n.load(locale,
|
|
2674
|
+
const messages43 = getMessages7(locale, enMessages, nbMessages, fiMessages);
|
|
2675
|
+
i18n.load(locale, messages43);
|
|
2651
2676
|
i18n.activate(locale);
|
|
2652
2677
|
};
|
|
2653
2678
|
|
|
@@ -3030,7 +3055,7 @@ if (!customElements.get("w-box")) {
|
|
|
3030
3055
|
import { html as html12 } from "lit";
|
|
3031
3056
|
import WarpElement6 from "@warp-ds/elements-core";
|
|
3032
3057
|
|
|
3033
|
-
// node_modules/.pnpm/@warp-ds+core@1.0.
|
|
3058
|
+
// node_modules/.pnpm/@warp-ds+core@1.0.2/node_modules/@warp-ds/core/dist/breadcrumbs/index.js
|
|
3034
3059
|
function interleave(array, separator2) {
|
|
3035
3060
|
return array.flatMap((el) => [el, separator2]).slice(0, -1);
|
|
3036
3061
|
}
|
|
@@ -3139,11 +3164,11 @@ var WarpBroadcast = class extends WarpElement7 {
|
|
|
3139
3164
|
this._hiddenMessageIds = [.../* @__PURE__ */ new Set([...this._hiddenMessageIds, id])];
|
|
3140
3165
|
}
|
|
3141
3166
|
render() {
|
|
3142
|
-
const
|
|
3167
|
+
const messages43 = this._messages.filter((item) => !this._hiddenMessageIds.includes(item.id));
|
|
3143
3168
|
return html13`
|
|
3144
|
-
<aside class=${`${
|
|
3169
|
+
<aside class=${`${messages43.length === 0 ? "hidden" : "mb-16"}`}>
|
|
3145
3170
|
${repeat(
|
|
3146
|
-
|
|
3171
|
+
messages43,
|
|
3147
3172
|
({ id }) => `broadcast-${id}`,
|
|
3148
3173
|
({ id, message }) => html13`<w-toast
|
|
3149
3174
|
id="broadcast-${id}"
|
|
@@ -3238,7 +3263,7 @@ ${buttonTypes2.join(
|
|
|
3238
3263
|
const secondary = this.variant === "secondary";
|
|
3239
3264
|
const negative = this.variant === "negative";
|
|
3240
3265
|
const utility = this.variant === "utility";
|
|
3241
|
-
const
|
|
3266
|
+
const pill2 = this.variant === "pill";
|
|
3242
3267
|
const link = this.variant === "link";
|
|
3243
3268
|
return r(
|
|
3244
3269
|
{
|
|
@@ -3274,10 +3299,10 @@ ${buttonTypes2.join(
|
|
|
3274
3299
|
[button.negativeQuiet]: negative && !this.small && this.quiet && !this.loading,
|
|
3275
3300
|
[button.negativeQuietLoading]: negative && !this.small && this.quiet && this.loading,
|
|
3276
3301
|
[button.negativeLoading]: negative && !this.small && !this.quiet && this.loading,
|
|
3277
|
-
[button.pill]:
|
|
3278
|
-
[button.pillSmall]:
|
|
3279
|
-
[button.pillLoading]:
|
|
3280
|
-
[button.pillSmallLoading]:
|
|
3302
|
+
[button.pill]: pill2 && !this.small && !this.loading,
|
|
3303
|
+
[button.pillSmall]: pill2 && this.small && !this.loading,
|
|
3304
|
+
[button.pillLoading]: pill2 && !this.small && this.loading,
|
|
3305
|
+
[button.pillSmallLoading]: pill2 && this.small && this.loading,
|
|
3281
3306
|
[button.link]: link && !this.small,
|
|
3282
3307
|
[button.linkSmall]: link && this.small,
|
|
3283
3308
|
[button.linkAsButton]: !!this.href,
|
|
@@ -3428,18 +3453,18 @@ if (!customElements.get("w-card")) {
|
|
|
3428
3453
|
import { css as css5, html as html18 } from "lit";
|
|
3429
3454
|
import WarpElement10 from "@warp-ds/elements-core";
|
|
3430
3455
|
|
|
3431
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
3456
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
|
|
3432
3457
|
import { LitElement as LitElement7 } from "lit";
|
|
3433
3458
|
import { unsafeStatic as unsafeStatic7, html as html16 } from "lit/static-html.js";
|
|
3434
3459
|
var messages18 = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
|
|
3435
3460
|
var messages27 = JSON.parse('{"icon.title.chevron-down":"Downward arrow"}');
|
|
3436
3461
|
var messages37 = JSON.parse('{"icon.title.chevron-down":"Nuoli alasp\xE4in"}');
|
|
3437
3462
|
var supportedLocales8 = ["en", "nb", "fi"];
|
|
3438
|
-
var
|
|
3463
|
+
var defaultLocale9 = "en";
|
|
3439
3464
|
var getSupportedLocale8 = (usedLocale) => {
|
|
3440
3465
|
return supportedLocales8.find(
|
|
3441
3466
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
3442
|
-
) ||
|
|
3467
|
+
) || defaultLocale9;
|
|
3443
3468
|
};
|
|
3444
3469
|
function detectLocale8() {
|
|
3445
3470
|
if (typeof window === "undefined") {
|
|
@@ -3451,7 +3476,7 @@ function detectLocale8() {
|
|
|
3451
3476
|
return getSupportedLocale8(htmlLocale);
|
|
3452
3477
|
} catch (e2) {
|
|
3453
3478
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
3454
|
-
return
|
|
3479
|
+
return defaultLocale9;
|
|
3455
3480
|
}
|
|
3456
3481
|
}
|
|
3457
3482
|
var getMessages8 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -3463,8 +3488,8 @@ var getMessages8 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
3463
3488
|
};
|
|
3464
3489
|
var activateI18n8 = (enMessages, nbMessages, fiMessages) => {
|
|
3465
3490
|
const locale = detectLocale8();
|
|
3466
|
-
const
|
|
3467
|
-
i18n.load(locale,
|
|
3491
|
+
const messages43 = getMessages8(locale, enMessages, nbMessages, fiMessages);
|
|
3492
|
+
i18n.load(locale, messages43);
|
|
3468
3493
|
i18n.activate(locale);
|
|
3469
3494
|
};
|
|
3470
3495
|
activateI18n8(messages27, messages18, messages37);
|
|
@@ -3478,18 +3503,18 @@ if (!customElements.get("w-icon-chevron-down-16")) {
|
|
|
3478
3503
|
customElements.define("w-icon-chevron-down-16", IconChevronDown16);
|
|
3479
3504
|
}
|
|
3480
3505
|
|
|
3481
|
-
// node_modules/.pnpm/@warp-ds+icons@1.
|
|
3506
|
+
// node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-up-16.js
|
|
3482
3507
|
import { LitElement as LitElement8 } from "lit";
|
|
3483
3508
|
import { unsafeStatic as unsafeStatic8, html as html17 } from "lit/static-html.js";
|
|
3484
3509
|
var messages19 = JSON.parse('{"icon.title.chevron-up":"Oppoverpil"}');
|
|
3485
3510
|
var messages28 = JSON.parse('{"icon.title.chevron-up":"Upward arrow"}');
|
|
3486
3511
|
var messages38 = JSON.parse('{"icon.title.chevron-up":"Nuoli yl\xF6sp\xE4in"}');
|
|
3487
3512
|
var supportedLocales9 = ["en", "nb", "fi"];
|
|
3488
|
-
var
|
|
3513
|
+
var defaultLocale10 = "en";
|
|
3489
3514
|
var getSupportedLocale9 = (usedLocale) => {
|
|
3490
3515
|
return supportedLocales9.find(
|
|
3491
3516
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
3492
|
-
) ||
|
|
3517
|
+
) || defaultLocale10;
|
|
3493
3518
|
};
|
|
3494
3519
|
function detectLocale9() {
|
|
3495
3520
|
if (typeof window === "undefined") {
|
|
@@ -3501,7 +3526,7 @@ function detectLocale9() {
|
|
|
3501
3526
|
return getSupportedLocale9(htmlLocale);
|
|
3502
3527
|
} catch (e2) {
|
|
3503
3528
|
console.warn("could not detect locale, falling back to source locale", e2);
|
|
3504
|
-
return
|
|
3529
|
+
return defaultLocale10;
|
|
3505
3530
|
}
|
|
3506
3531
|
}
|
|
3507
3532
|
var getMessages9 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -3513,8 +3538,8 @@ var getMessages9 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
|
3513
3538
|
};
|
|
3514
3539
|
var activateI18n9 = (enMessages, nbMessages, fiMessages) => {
|
|
3515
3540
|
const locale = detectLocale9();
|
|
3516
|
-
const
|
|
3517
|
-
i18n.load(locale,
|
|
3541
|
+
const messages43 = getMessages9(locale, enMessages, nbMessages, fiMessages);
|
|
3542
|
+
i18n.load(locale, messages43);
|
|
3518
3543
|
i18n.activate(locale);
|
|
3519
3544
|
};
|
|
3520
3545
|
activateI18n9(messages28, messages19, messages38);
|
|
@@ -3661,25 +3686,115 @@ if (!customElements.get("w-expandable")) {
|
|
|
3661
3686
|
customElements.define("w-expandable", WarpExpandable);
|
|
3662
3687
|
}
|
|
3663
3688
|
|
|
3664
|
-
// packages/
|
|
3665
|
-
import { html as html19
|
|
3689
|
+
// packages/pill/index.js
|
|
3690
|
+
import { html as html19 } from "lit";
|
|
3691
|
+
|
|
3692
|
+
// packages/pill/locales/en/messages.mjs
|
|
3693
|
+
var messages20 = JSON.parse('{"pill.aria.openFilter":"Open filter","pill.aria.removeFilter":["Remove filter ",["label"]]}');
|
|
3694
|
+
|
|
3695
|
+
// packages/pill/locales/fi/messages.mjs
|
|
3696
|
+
var messages21 = JSON.parse('{"pill.aria.openFilter":"Avaa suodatin","pill.aria.removeFilter":["Tyhjenn\xE4 suodatin ",["label"]]}');
|
|
3697
|
+
|
|
3698
|
+
// packages/pill/locales/nb/messages.mjs
|
|
3699
|
+
var messages29 = JSON.parse('{"pill.aria.openFilter":"\xC5pne filter","pill.aria.removeFilter":["Fjern filter ",["label"]]}');
|
|
3700
|
+
|
|
3701
|
+
// packages/pill/index.js
|
|
3666
3702
|
import WarpElement11 from "@warp-ds/elements-core";
|
|
3703
|
+
var WarpPill = class extends kebabCaseAttributes(WarpElement11) {
|
|
3704
|
+
constructor() {
|
|
3705
|
+
super();
|
|
3706
|
+
activateI18n7(messages20, messages29, messages21);
|
|
3707
|
+
this.canClose = false;
|
|
3708
|
+
this.suggestion = false;
|
|
3709
|
+
this.openFilterSrText = i18n._({
|
|
3710
|
+
id: "pill.aria.openFilter",
|
|
3711
|
+
message: "Open filter",
|
|
3712
|
+
comment: "Fallback screenreader message for open filter"
|
|
3713
|
+
});
|
|
3714
|
+
this.removeFilterSrText = i18n._({
|
|
3715
|
+
id: "pill.aria.removeFilter",
|
|
3716
|
+
message: "Remove filter {label}",
|
|
3717
|
+
comment: "Fallback screenreader message for removal of the filter"
|
|
3718
|
+
});
|
|
3719
|
+
}
|
|
3720
|
+
get _labelClasses() {
|
|
3721
|
+
return r({
|
|
3722
|
+
[pill.button]: true,
|
|
3723
|
+
[this.suggestion ? pill.suggestion : pill.filter]: true,
|
|
3724
|
+
[pill.label]: true,
|
|
3725
|
+
[this.canClose ? pill.labelWithClose : pill.labelWithoutClose]: true
|
|
3726
|
+
});
|
|
3727
|
+
}
|
|
3728
|
+
get _closeClasses() {
|
|
3729
|
+
return r({
|
|
3730
|
+
[pill.button]: true,
|
|
3731
|
+
[this.suggestion ? pill.suggestion : pill.filter]: true,
|
|
3732
|
+
[pill.close]: true
|
|
3733
|
+
});
|
|
3734
|
+
}
|
|
3735
|
+
_onClick() {
|
|
3736
|
+
this.dispatchEvent(new CustomEvent("w-pill-click", { bubbles: true, composed: true }));
|
|
3737
|
+
}
|
|
3738
|
+
_onClose() {
|
|
3739
|
+
this.dispatchEvent(new CustomEvent("w-pill-close", { bubbles: true, composed: true }));
|
|
3740
|
+
}
|
|
3741
|
+
render() {
|
|
3742
|
+
return html19`
|
|
3743
|
+
<div class="${pill.pill}">
|
|
3744
|
+
<button
|
|
3745
|
+
type="button"
|
|
3746
|
+
class="${this._labelClasses}"
|
|
3747
|
+
@click="${this._onClick}"
|
|
3748
|
+
>
|
|
3749
|
+
<span class="${pill.a11y}"
|
|
3750
|
+
>${this.openSrLabel ? this.openSrLabel : this.openFilterSrText}</span
|
|
3751
|
+
>
|
|
3752
|
+
<slot></slot>
|
|
3753
|
+
</button>
|
|
3754
|
+
${this.canClose ? html19`<button
|
|
3755
|
+
type="button"
|
|
3756
|
+
class="${this._closeClasses}"
|
|
3757
|
+
@click="${this._onClose}"
|
|
3758
|
+
>
|
|
3759
|
+
<span class="${pill.a11y}"
|
|
3760
|
+
>${this.closeSrLabel ? this.closeSrLabel : this.removeFilterSrText}</span
|
|
3761
|
+
>
|
|
3762
|
+
<w-icon-close-16></w-icon-close-16>
|
|
3763
|
+
</button>` : null}
|
|
3764
|
+
</div>
|
|
3765
|
+
`;
|
|
3766
|
+
}
|
|
3767
|
+
};
|
|
3768
|
+
__publicField(WarpPill, "styles", [WarpElement11.styles]);
|
|
3769
|
+
__publicField(WarpPill, "properties", {
|
|
3770
|
+
canClose: { type: Boolean },
|
|
3771
|
+
suggestion: { type: Boolean },
|
|
3772
|
+
openSrLabel: { type: String },
|
|
3773
|
+
closeSrLabel: { type: String }
|
|
3774
|
+
});
|
|
3775
|
+
if (!customElements.get("w-pill")) {
|
|
3776
|
+
customElements.define("w-pill", WarpPill);
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
// packages/select/index.js
|
|
3780
|
+
import { html as html20, css as css6 } from "lit";
|
|
3781
|
+
import WarpElement12 from "@warp-ds/elements-core";
|
|
3667
3782
|
import { ifDefined as ifDefined5 } from "lit/directives/if-defined.js";
|
|
3668
3783
|
import { when } from "lit/directives/when.js";
|
|
3669
3784
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
3670
3785
|
|
|
3671
3786
|
// packages/select/locales/en/messages.mjs
|
|
3672
|
-
var
|
|
3787
|
+
var messages30 = JSON.parse('{"select.label.optional":"(optional)"}');
|
|
3673
3788
|
|
|
3674
3789
|
// packages/select/locales/nb/messages.mjs
|
|
3675
|
-
var
|
|
3790
|
+
var messages31 = JSON.parse('{"select.label.optional":"(valgfritt)"}');
|
|
3676
3791
|
|
|
3677
3792
|
// packages/select/locales/fi/messages.mjs
|
|
3678
|
-
var
|
|
3793
|
+
var messages39 = JSON.parse('{"select.label.optional":"(vapaaehtoinen)"}');
|
|
3679
3794
|
|
|
3680
3795
|
// packages/select/index.js
|
|
3681
3796
|
var _classes, classes_get, _labelClasses, labelClasses_get, _helpTextClasses, helpTextClasses_get, _chevronClasses, chevronClasses_get, _id, id_get, _helpId, helpId_get;
|
|
3682
|
-
var WarpSelect = class extends kebabCaseAttributes(
|
|
3797
|
+
var WarpSelect = class extends kebabCaseAttributes(WarpElement12) {
|
|
3683
3798
|
constructor() {
|
|
3684
3799
|
super();
|
|
3685
3800
|
__privateAdd(this, _classes);
|
|
@@ -3688,18 +3803,18 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement11) {
|
|
|
3688
3803
|
__privateAdd(this, _chevronClasses);
|
|
3689
3804
|
__privateAdd(this, _id);
|
|
3690
3805
|
__privateAdd(this, _helpId);
|
|
3691
|
-
activateI18n7(
|
|
3806
|
+
activateI18n7(messages30, messages31, messages39);
|
|
3692
3807
|
this._options = this.innerHTML;
|
|
3693
3808
|
}
|
|
3694
3809
|
render() {
|
|
3695
|
-
return
|
|
3810
|
+
return html20`<div class="${select.wrapper}">
|
|
3696
3811
|
${when(
|
|
3697
3812
|
this.label,
|
|
3698
|
-
() =>
|
|
3813
|
+
() => html20`<label class="${__privateGet(this, _labelClasses, labelClasses_get)}" for="${__privateGet(this, _id, id_get)}">
|
|
3699
3814
|
${this.label}
|
|
3700
3815
|
${when(
|
|
3701
3816
|
this.optional,
|
|
3702
|
-
() =>
|
|
3817
|
+
() => html20`<span class="${label.optional}"
|
|
3703
3818
|
>${i18n._({
|
|
3704
3819
|
id: "select.label.optional",
|
|
3705
3820
|
message: "(optional)",
|
|
@@ -3726,7 +3841,7 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement11) {
|
|
|
3726
3841
|
</div>
|
|
3727
3842
|
${when(
|
|
3728
3843
|
this.always || this.invalid,
|
|
3729
|
-
() =>
|
|
3844
|
+
() => html20`<div id="${__privateGet(this, _helpId, helpId_get)}" class="${__privateGet(this, _helpTextClasses, helpTextClasses_get)}">
|
|
3730
3845
|
${this.hint}
|
|
3731
3846
|
</div>`
|
|
3732
3847
|
)}
|
|
@@ -3784,16 +3899,16 @@ __publicField(WarpSelect, "properties", {
|
|
|
3784
3899
|
optional: { type: Boolean, reflect: true },
|
|
3785
3900
|
_options: { state: true }
|
|
3786
3901
|
});
|
|
3787
|
-
__publicField(WarpSelect, "styles", [
|
|
3902
|
+
__publicField(WarpSelect, "styles", [WarpElement12.styles]);
|
|
3788
3903
|
if (!customElements.get("w-select")) {
|
|
3789
3904
|
customElements.define("w-select", WarpSelect);
|
|
3790
3905
|
}
|
|
3791
3906
|
|
|
3792
3907
|
// packages/textfield/index.js
|
|
3793
|
-
import { css as css7, html as
|
|
3794
|
-
import
|
|
3908
|
+
import { css as css7, html as html21 } from "lit";
|
|
3909
|
+
import WarpElement13 from "@warp-ds/elements-core";
|
|
3795
3910
|
import { ifDefined as ifDefined6 } from "lit/directives/if-defined.js";
|
|
3796
|
-
var WarpTextField = class extends
|
|
3911
|
+
var WarpTextField = class extends WarpElement13 {
|
|
3797
3912
|
constructor() {
|
|
3798
3913
|
super();
|
|
3799
3914
|
this.type = "text";
|
|
@@ -3824,7 +3939,7 @@ var WarpTextField = class extends WarpElement12 {
|
|
|
3824
3939
|
}
|
|
3825
3940
|
get _label() {
|
|
3826
3941
|
if (this.label) {
|
|
3827
|
-
return
|
|
3942
|
+
return html21`<label for="${this._id}" class=${this._labelStyles}>${this.label}</label>`;
|
|
3828
3943
|
}
|
|
3829
3944
|
}
|
|
3830
3945
|
get _helpId() {
|
|
@@ -3862,7 +3977,7 @@ var WarpTextField = class extends WarpElement12 {
|
|
|
3862
3977
|
this._hasSuffix = true;
|
|
3863
3978
|
}
|
|
3864
3979
|
render() {
|
|
3865
|
-
return
|
|
3980
|
+
return html21`
|
|
3866
3981
|
${this._label}
|
|
3867
3982
|
<div class="${input.wrapper}">
|
|
3868
3983
|
<slot @slotchange="${this.prefixSlotChange}" name="prefix"></slot>
|
|
@@ -3891,7 +4006,7 @@ var WarpTextField = class extends WarpElement12 {
|
|
|
3891
4006
|
/>
|
|
3892
4007
|
<slot @slotchange="${this.suffixSlotChange}" name="suffix"></slot>
|
|
3893
4008
|
</div>
|
|
3894
|
-
${this.helpText &&
|
|
4009
|
+
${this.helpText && html21`<div class="${this._helpTextStyles}" id="${this._helpId}">${this.helpText}</div>`}
|
|
3895
4010
|
`;
|
|
3896
4011
|
}
|
|
3897
4012
|
};
|
|
@@ -3921,7 +4036,7 @@ __publicField(WarpTextField, "properties", {
|
|
|
3921
4036
|
// so never gets higher Specificity. Thus in order to overwrite style linked within shadowDOM, we need to use !important.
|
|
3922
4037
|
// https://stackoverflow.com/a/61631668
|
|
3923
4038
|
__publicField(WarpTextField, "styles", [
|
|
3924
|
-
|
|
4039
|
+
WarpElement13.styles,
|
|
3925
4040
|
css7`
|
|
3926
4041
|
:host {
|
|
3927
4042
|
display: block;
|
|
@@ -3966,9 +4081,141 @@ function updateToast(id, options) {
|
|
|
3966
4081
|
return toast3.get(id);
|
|
3967
4082
|
}
|
|
3968
4083
|
|
|
4084
|
+
// packages/toast/toast-container.js
|
|
4085
|
+
import { css as css8, html as html22 } from "lit";
|
|
4086
|
+
import WarpElement14 from "@warp-ds/elements-core";
|
|
4087
|
+
import { repeat as repeat2 } from "lit/directives/repeat.js";
|
|
4088
|
+
var WarpToastContainer = class extends WarpElement14 {
|
|
4089
|
+
constructor() {
|
|
4090
|
+
super();
|
|
4091
|
+
this._toasts = /* @__PURE__ */ new Map();
|
|
4092
|
+
}
|
|
4093
|
+
connectedCallback() {
|
|
4094
|
+
super.connectedCallback();
|
|
4095
|
+
this._interval = setInterval(() => {
|
|
4096
|
+
const keep = [];
|
|
4097
|
+
const remove = [];
|
|
4098
|
+
for (const toast3 of this._toasts) {
|
|
4099
|
+
if (Date.now() <= toast3[1].duration)
|
|
4100
|
+
keep.push(toast3);
|
|
4101
|
+
else
|
|
4102
|
+
remove.push(toast3);
|
|
4103
|
+
}
|
|
4104
|
+
const collapseTasks = [];
|
|
4105
|
+
for (const [id] of remove) {
|
|
4106
|
+
const el = this.renderRoot.querySelector(`#${id}`);
|
|
4107
|
+
collapseTasks.push(el.collapse());
|
|
4108
|
+
}
|
|
4109
|
+
Promise.all(collapseTasks).then(() => {
|
|
4110
|
+
if (keep.length != this._toasts.size)
|
|
4111
|
+
this._toasts = new Map(keep);
|
|
4112
|
+
});
|
|
4113
|
+
}, 500);
|
|
4114
|
+
}
|
|
4115
|
+
disconnectedCallback() {
|
|
4116
|
+
super.disconnectedCallback();
|
|
4117
|
+
if (this._interval)
|
|
4118
|
+
clearTimeout(this._interval);
|
|
4119
|
+
}
|
|
4120
|
+
static init() {
|
|
4121
|
+
let el = document.querySelector("w-toast-container");
|
|
4122
|
+
if (!el) {
|
|
4123
|
+
el = document.createElement("w-toast-container");
|
|
4124
|
+
document.body.appendChild(el);
|
|
4125
|
+
}
|
|
4126
|
+
return el;
|
|
4127
|
+
}
|
|
4128
|
+
get _toastsArray() {
|
|
4129
|
+
return Array.from(this._toasts).map(([, toast3]) => toast3);
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
*
|
|
4133
|
+
* @param {String|Number} id
|
|
4134
|
+
* @returns {ToastOptions}
|
|
4135
|
+
*/
|
|
4136
|
+
get(id) {
|
|
4137
|
+
if (!id)
|
|
4138
|
+
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
4139
|
+
if (typeof id !== "string" && !Number.isInteger(id))
|
|
4140
|
+
throw new Error(
|
|
4141
|
+
'"id" must be number or string when attempting to retrieve toast'
|
|
4142
|
+
);
|
|
4143
|
+
return this._toasts.get(id);
|
|
4144
|
+
}
|
|
4145
|
+
/**
|
|
4146
|
+
*
|
|
4147
|
+
* @param {Object} toast
|
|
4148
|
+
* @returns {WarpToastContainer}
|
|
4149
|
+
*/
|
|
4150
|
+
set(toast3) {
|
|
4151
|
+
if (!toast3.id)
|
|
4152
|
+
throw new Error('invalid or undefined "id" on toast object');
|
|
4153
|
+
const result = this._toasts.set(toast3.id, __spreadProps(__spreadValues({}, toast3), {
|
|
4154
|
+
duration: Date.now() + (toast3.duration || 5e3)
|
|
4155
|
+
}));
|
|
4156
|
+
this._toasts = new Map(Array.from(this._toasts));
|
|
4157
|
+
return result;
|
|
4158
|
+
}
|
|
4159
|
+
/**
|
|
4160
|
+
*
|
|
4161
|
+
* @param {String|Number} id
|
|
4162
|
+
* @returns {ToastOptions | false}
|
|
4163
|
+
*/
|
|
4164
|
+
async del(id) {
|
|
4165
|
+
if (!id)
|
|
4166
|
+
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
4167
|
+
if (typeof id !== "string" && !Number.isInteger(id))
|
|
4168
|
+
throw new Error(
|
|
4169
|
+
'"id" must be number or string when attempting to retrieve toast'
|
|
4170
|
+
);
|
|
4171
|
+
const el = this.renderRoot.querySelector(`#${id}`);
|
|
4172
|
+
if (!this._toasts.has(id))
|
|
4173
|
+
return false;
|
|
4174
|
+
await el.collapse();
|
|
4175
|
+
const result = this._toasts.delete(id);
|
|
4176
|
+
this._toasts = new Map(Array.from(this._toasts));
|
|
4177
|
+
return result;
|
|
4178
|
+
}
|
|
4179
|
+
render() {
|
|
4180
|
+
return html22`
|
|
4181
|
+
<aside class="${toaster.container}">
|
|
4182
|
+
<div class="${toaster.toaster}" id="w-toast-container-list">
|
|
4183
|
+
${repeat2(
|
|
4184
|
+
this._toastsArray,
|
|
4185
|
+
(toast3) => toast3.id,
|
|
4186
|
+
(toast3) => html22` <w-toast
|
|
4187
|
+
class="${toaster.content}"
|
|
4188
|
+
id="${toast3.id}"
|
|
4189
|
+
type="${toast3.type}"
|
|
4190
|
+
text="${toast3.text}"
|
|
4191
|
+
?canclose=${toast3.canclose}
|
|
4192
|
+
@close=${() => this.del(toast3.id)}
|
|
4193
|
+
>
|
|
4194
|
+
</w-toast>`
|
|
4195
|
+
)}
|
|
4196
|
+
</div>
|
|
4197
|
+
</aside>
|
|
4198
|
+
`;
|
|
4199
|
+
}
|
|
4200
|
+
};
|
|
4201
|
+
__publicField(WarpToastContainer, "styles", [
|
|
4202
|
+
WarpElement14.styles,
|
|
4203
|
+
css8`
|
|
4204
|
+
:host {
|
|
4205
|
+
display: block;
|
|
4206
|
+
}
|
|
4207
|
+
`
|
|
4208
|
+
]);
|
|
4209
|
+
__publicField(WarpToastContainer, "properties", {
|
|
4210
|
+
_toasts: { state: true }
|
|
4211
|
+
});
|
|
4212
|
+
if (!customElements.get("w-toast-container")) {
|
|
4213
|
+
customElements.define("w-toast-container", WarpToastContainer);
|
|
4214
|
+
}
|
|
4215
|
+
|
|
3969
4216
|
// packages/toast/toast.js
|
|
3970
|
-
import { css as
|
|
3971
|
-
import
|
|
4217
|
+
import { css as css9, html as html23 } from "lit";
|
|
4218
|
+
import WarpElement15 from "@warp-ds/elements-core";
|
|
3972
4219
|
import { classMap as classMap2 } from "lit/directives/class-map.js";
|
|
3973
4220
|
import { when as when2 } from "lit/directives/when.js";
|
|
3974
4221
|
|
|
@@ -4046,13 +4293,13 @@ var collapse = (el, done) => {
|
|
|
4046
4293
|
};
|
|
4047
4294
|
|
|
4048
4295
|
// packages/toast/locales/en/messages.mjs
|
|
4049
|
-
var
|
|
4296
|
+
var messages40 = JSON.parse('{"toast.aria.error":"Error","toast.aria.successful":"Successful","toast.aria.warning":"Warning"}');
|
|
4050
4297
|
|
|
4051
4298
|
// packages/toast/locales/nb/messages.mjs
|
|
4052
|
-
var
|
|
4299
|
+
var messages41 = JSON.parse('{"toast.aria.error":"Varsel","toast.aria.successful":"Vellykket","toast.aria.warning":"Feil"}');
|
|
4053
4300
|
|
|
4054
4301
|
// packages/toast/locales/fi/messages.mjs
|
|
4055
|
-
var
|
|
4302
|
+
var messages42 = JSON.parse('{"toast.aria.error":"Error","toast.aria.successful":"Successful","toast.aria.warning":"Warning"}');
|
|
4056
4303
|
|
|
4057
4304
|
// packages/toast/toast.js
|
|
4058
4305
|
var classes2 = (definition) => {
|
|
@@ -4069,10 +4316,10 @@ var toastType = {
|
|
|
4069
4316
|
error: "error",
|
|
4070
4317
|
warning: "warning"
|
|
4071
4318
|
};
|
|
4072
|
-
var WarpToast = class extends
|
|
4319
|
+
var WarpToast = class extends WarpElement15 {
|
|
4073
4320
|
constructor() {
|
|
4074
4321
|
super();
|
|
4075
|
-
activateI18n7(
|
|
4322
|
+
activateI18n7(messages40, messages41, messages42);
|
|
4076
4323
|
this.id = Date.now().toString(36) + Math.random().toString(36).slice(2, 5);
|
|
4077
4324
|
this.type = "success";
|
|
4078
4325
|
this.text = "";
|
|
@@ -4138,11 +4385,11 @@ var WarpToast = class extends WarpElement13 {
|
|
|
4138
4385
|
}
|
|
4139
4386
|
get _iconMarkup() {
|
|
4140
4387
|
if (this._warning)
|
|
4141
|
-
return
|
|
4388
|
+
return html23`<w-icon-alert-warning-16></w-icon-alert-warning-16>`;
|
|
4142
4389
|
if (this._error)
|
|
4143
|
-
return
|
|
4390
|
+
return html23`<w-icon-alert-error-16></w-icon-alert-error-16>`;
|
|
4144
4391
|
else
|
|
4145
|
-
return
|
|
4392
|
+
return html23`<w-icon-alert-success-16></w-icon-alert-success-16>`;
|
|
4146
4393
|
}
|
|
4147
4394
|
async collapse() {
|
|
4148
4395
|
return new Promise((resolve) => {
|
|
@@ -4162,8 +4409,8 @@ var WarpToast = class extends WarpElement13 {
|
|
|
4162
4409
|
}
|
|
4163
4410
|
render() {
|
|
4164
4411
|
if (!this.text)
|
|
4165
|
-
return
|
|
4166
|
-
return
|
|
4412
|
+
return html23``;
|
|
4413
|
+
return html23` <section class="${toast.wrapper}" aria-label="${this._typeLabel}">
|
|
4167
4414
|
<div class="${this._primaryClasses}">
|
|
4168
4415
|
<div class="${this._iconClasses}">${this._iconMarkup}</div>
|
|
4169
4416
|
<div role="${this._role}" class="${toast.content}">
|
|
@@ -4171,7 +4418,7 @@ var WarpToast = class extends WarpElement13 {
|
|
|
4171
4418
|
</div>
|
|
4172
4419
|
${when2(
|
|
4173
4420
|
this.canclose === true,
|
|
4174
|
-
() =>
|
|
4421
|
+
() => html23`
|
|
4175
4422
|
<button class="${toast.close}" @click="${this.close}">
|
|
4176
4423
|
<w-icon-close-16></w-icon-close-16>
|
|
4177
4424
|
</button>
|
|
@@ -4182,8 +4429,8 @@ var WarpToast = class extends WarpElement13 {
|
|
|
4182
4429
|
}
|
|
4183
4430
|
};
|
|
4184
4431
|
__publicField(WarpToast, "styles", [
|
|
4185
|
-
|
|
4186
|
-
|
|
4432
|
+
WarpElement15.styles,
|
|
4433
|
+
css9`
|
|
4187
4434
|
:host {
|
|
4188
4435
|
display: block;
|
|
4189
4436
|
}
|
|
@@ -4199,143 +4446,11 @@ if (!customElements.get("w-toast")) {
|
|
|
4199
4446
|
customElements.define("w-toast", WarpToast);
|
|
4200
4447
|
}
|
|
4201
4448
|
|
|
4202
|
-
// packages/toast/toast-container.js
|
|
4203
|
-
import { css as css9, html as html22 } from "lit";
|
|
4204
|
-
import WarpElement14 from "@warp-ds/elements-core";
|
|
4205
|
-
import { repeat as repeat2 } from "lit/directives/repeat.js";
|
|
4206
|
-
var WarpToastContainer = class extends WarpElement14 {
|
|
4207
|
-
constructor() {
|
|
4208
|
-
super();
|
|
4209
|
-
this._toasts = /* @__PURE__ */ new Map();
|
|
4210
|
-
}
|
|
4211
|
-
connectedCallback() {
|
|
4212
|
-
super.connectedCallback();
|
|
4213
|
-
this._interval = setInterval(() => {
|
|
4214
|
-
const keep = [];
|
|
4215
|
-
const remove = [];
|
|
4216
|
-
for (const toast3 of this._toasts) {
|
|
4217
|
-
if (Date.now() <= toast3[1].duration)
|
|
4218
|
-
keep.push(toast3);
|
|
4219
|
-
else
|
|
4220
|
-
remove.push(toast3);
|
|
4221
|
-
}
|
|
4222
|
-
const collapseTasks = [];
|
|
4223
|
-
for (const [id] of remove) {
|
|
4224
|
-
const el = this.renderRoot.querySelector(`#${id}`);
|
|
4225
|
-
collapseTasks.push(el.collapse());
|
|
4226
|
-
}
|
|
4227
|
-
Promise.all(collapseTasks).then(() => {
|
|
4228
|
-
if (keep.length != this._toasts.size)
|
|
4229
|
-
this._toasts = new Map(keep);
|
|
4230
|
-
});
|
|
4231
|
-
}, 500);
|
|
4232
|
-
}
|
|
4233
|
-
disconnectedCallback() {
|
|
4234
|
-
super.disconnectedCallback();
|
|
4235
|
-
if (this._interval)
|
|
4236
|
-
clearTimeout(this._interval);
|
|
4237
|
-
}
|
|
4238
|
-
static init() {
|
|
4239
|
-
let el = document.querySelector("w-toast-container");
|
|
4240
|
-
if (!el) {
|
|
4241
|
-
el = document.createElement("w-toast-container");
|
|
4242
|
-
document.body.appendChild(el);
|
|
4243
|
-
}
|
|
4244
|
-
return el;
|
|
4245
|
-
}
|
|
4246
|
-
get _toastsArray() {
|
|
4247
|
-
return Array.from(this._toasts).map(([, toast3]) => toast3);
|
|
4248
|
-
}
|
|
4249
|
-
/**
|
|
4250
|
-
*
|
|
4251
|
-
* @param {String|Number} id
|
|
4252
|
-
* @returns {ToastOptions}
|
|
4253
|
-
*/
|
|
4254
|
-
get(id) {
|
|
4255
|
-
if (!id)
|
|
4256
|
-
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
4257
|
-
if (typeof id !== "string" && !Number.isInteger(id))
|
|
4258
|
-
throw new Error(
|
|
4259
|
-
'"id" must be number or string when attempting to retrieve toast'
|
|
4260
|
-
);
|
|
4261
|
-
return this._toasts.get(id);
|
|
4262
|
-
}
|
|
4263
|
-
/**
|
|
4264
|
-
*
|
|
4265
|
-
* @param {Object} toast
|
|
4266
|
-
* @returns {WarpToastContainer}
|
|
4267
|
-
*/
|
|
4268
|
-
set(toast3) {
|
|
4269
|
-
if (!toast3.id)
|
|
4270
|
-
throw new Error('invalid or undefined "id" on toast object');
|
|
4271
|
-
const result = this._toasts.set(toast3.id, __spreadProps(__spreadValues({}, toast3), {
|
|
4272
|
-
duration: Date.now() + (toast3.duration || 5e3)
|
|
4273
|
-
}));
|
|
4274
|
-
this._toasts = new Map(Array.from(this._toasts));
|
|
4275
|
-
return result;
|
|
4276
|
-
}
|
|
4277
|
-
/**
|
|
4278
|
-
*
|
|
4279
|
-
* @param {String|Number} id
|
|
4280
|
-
* @returns {ToastOptions | false}
|
|
4281
|
-
*/
|
|
4282
|
-
async del(id) {
|
|
4283
|
-
if (!id)
|
|
4284
|
-
throw new Error('undefined "id" given when attempting to retrieve toast');
|
|
4285
|
-
if (typeof id !== "string" && !Number.isInteger(id))
|
|
4286
|
-
throw new Error(
|
|
4287
|
-
'"id" must be number or string when attempting to retrieve toast'
|
|
4288
|
-
);
|
|
4289
|
-
const el = this.renderRoot.querySelector(`#${id}`);
|
|
4290
|
-
if (!this._toasts.has(id))
|
|
4291
|
-
return false;
|
|
4292
|
-
await el.collapse();
|
|
4293
|
-
const result = this._toasts.delete(id);
|
|
4294
|
-
this._toasts = new Map(Array.from(this._toasts));
|
|
4295
|
-
return result;
|
|
4296
|
-
}
|
|
4297
|
-
render() {
|
|
4298
|
-
return html22`
|
|
4299
|
-
<aside class="${toaster.container}">
|
|
4300
|
-
<div class="${toaster.toaster}" id="w-toast-container-list">
|
|
4301
|
-
${repeat2(
|
|
4302
|
-
this._toastsArray,
|
|
4303
|
-
(toast3) => toast3.id,
|
|
4304
|
-
(toast3) => html22` <w-toast
|
|
4305
|
-
class="${toaster.content}"
|
|
4306
|
-
id="${toast3.id}"
|
|
4307
|
-
type="${toast3.type}"
|
|
4308
|
-
text="${toast3.text}"
|
|
4309
|
-
?canclose=${toast3.canclose}
|
|
4310
|
-
@close=${() => this.del(toast3.id)}
|
|
4311
|
-
>
|
|
4312
|
-
</w-toast>`
|
|
4313
|
-
)}
|
|
4314
|
-
</div>
|
|
4315
|
-
</aside>
|
|
4316
|
-
`;
|
|
4317
|
-
}
|
|
4318
|
-
};
|
|
4319
|
-
__publicField(WarpToastContainer, "styles", [
|
|
4320
|
-
WarpElement14.styles,
|
|
4321
|
-
css9`
|
|
4322
|
-
:host {
|
|
4323
|
-
display: block;
|
|
4324
|
-
}
|
|
4325
|
-
`
|
|
4326
|
-
]);
|
|
4327
|
-
__publicField(WarpToastContainer, "properties", {
|
|
4328
|
-
_toasts: { state: true }
|
|
4329
|
-
});
|
|
4330
|
-
if (!customElements.get("w-toast-container")) {
|
|
4331
|
-
customElements.define("w-toast-container", WarpToastContainer);
|
|
4332
|
-
}
|
|
4333
|
-
|
|
4334
4449
|
// packages/utils/expand-transition.js
|
|
4335
|
-
import { css as css10, html as
|
|
4336
|
-
import
|
|
4450
|
+
import { css as css10, html as html24 } from "lit";
|
|
4451
|
+
import WarpElement16 from "@warp-ds/elements-core";
|
|
4337
4452
|
import { ifDefined as ifDefined7 } from "lit/directives/if-defined.js";
|
|
4338
|
-
var ExpandTransition = class extends
|
|
4453
|
+
var ExpandTransition = class extends WarpElement16 {
|
|
4339
4454
|
constructor() {
|
|
4340
4455
|
super();
|
|
4341
4456
|
this.show = false;
|
|
@@ -4368,8 +4483,8 @@ var ExpandTransition = class extends WarpElement15 {
|
|
|
4368
4483
|
return this != null ? this : null;
|
|
4369
4484
|
}
|
|
4370
4485
|
render() {
|
|
4371
|
-
return
|
|
4372
|
-
${this._removeElement ?
|
|
4486
|
+
return html24`<div aria-hidden=${ifDefined7(!this.show ? "true" : void 0)}>
|
|
4487
|
+
${this._removeElement ? html24`` : html24`<slot></slot>`}
|
|
4373
4488
|
</div>`;
|
|
4374
4489
|
}
|
|
4375
4490
|
};
|
|
@@ -4381,7 +4496,7 @@ __publicField(ExpandTransition, "properties", {
|
|
|
4381
4496
|
_removeElement: { type: Boolean, state: true }
|
|
4382
4497
|
});
|
|
4383
4498
|
__publicField(ExpandTransition, "styles", [
|
|
4384
|
-
|
|
4499
|
+
WarpElement16.styles,
|
|
4385
4500
|
css10`
|
|
4386
4501
|
:host {
|
|
4387
4502
|
display: block;
|
|
@@ -4393,10 +4508,10 @@ if (!customElements.get("w-expand-transition")) {
|
|
|
4393
4508
|
}
|
|
4394
4509
|
|
|
4395
4510
|
// packages/utils/unstyled-heading.js
|
|
4396
|
-
import { html as
|
|
4397
|
-
import
|
|
4511
|
+
import { html as html25 } from "lit";
|
|
4512
|
+
import WarpElement17 from "@warp-ds/elements-core";
|
|
4398
4513
|
import { unsafeHTML as unsafeHTML2 } from "lit/directives/unsafe-html.js";
|
|
4399
|
-
var UnstyledHeading = class extends
|
|
4514
|
+
var UnstyledHeading = class extends WarpElement17 {
|
|
4400
4515
|
get _markup() {
|
|
4401
4516
|
return `<h${this.level}
|
|
4402
4517
|
style="margin: 0; font-weight: unset; font-size: unset; line-height: unset;"
|
|
@@ -4406,13 +4521,13 @@ var UnstyledHeading = class extends WarpElement16 {
|
|
|
4406
4521
|
`;
|
|
4407
4522
|
}
|
|
4408
4523
|
render() {
|
|
4409
|
-
return !this.level ?
|
|
4524
|
+
return !this.level ? html25`<slot></slot>` : unsafeHTML2(this._markup);
|
|
4410
4525
|
}
|
|
4411
4526
|
};
|
|
4412
4527
|
__publicField(UnstyledHeading, "properties", {
|
|
4413
4528
|
level: { type: Number }
|
|
4414
4529
|
});
|
|
4415
|
-
__publicField(UnstyledHeading, "styles", [
|
|
4530
|
+
__publicField(UnstyledHeading, "styles", [WarpElement17.styles]);
|
|
4416
4531
|
if (!customElements.get("w-unstyled-heading")) {
|
|
4417
4532
|
customElements.define("w-unstyled-heading", UnstyledHeading);
|
|
4418
4533
|
}
|
|
@@ -4429,6 +4544,7 @@ export {
|
|
|
4429
4544
|
WarpButton,
|
|
4430
4545
|
WarpCard,
|
|
4431
4546
|
WarpExpandable,
|
|
4547
|
+
WarpPill,
|
|
4432
4548
|
WarpSelect,
|
|
4433
4549
|
WarpTextField,
|
|
4434
4550
|
WarpToast,
|