@warp-ds/elements 2.1.1-next.1 → 2.1.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1019,7 +1019,7 @@ var require_parser = __commonJS({
1019
1019
  // packages/modal/modal-footer.js
1020
1020
  import { html } from "lit";
1021
1021
 
1022
- // node_modules/.pnpm/@warp-ds+css@2.0.1_@warp-ds+uno@2.0.2_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_2s4pctzvx7cgxzqlrreqkg4h34/node_modules/@warp-ds/css/component-classes/index.js
1022
+ // node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_sgrraibu65gdmqpe655kfrpl6a/node_modules/@warp-ds/css/component-classes/index.js
1023
1023
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1024
1024
  var buttonColors = {
1025
1025
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -1377,11 +1377,269 @@ var Move = class {
1377
1377
  }
1378
1378
  };
1379
1379
 
1380
- // node_modules/.pnpm/@lingui+core@5.1.2_@lingui+babel-plugin-lingui-macro@5.1.2_babel-plugin-macros@3.1.0_typescri_g2ngrxg2kfutsfck3yn2icllca/node_modules/@lingui/core/dist/index.mjs
1380
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1381
1381
  var import_unraw = __toESM(require_dist(), 1);
1382
1382
 
1383
- // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1383
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1384
1384
  var import_parser = __toESM(require_parser(), 1);
1385
+ var DateFormatError = class extends Error {
1386
+ /** @internal */
1387
+ constructor(msg, token, type) {
1388
+ super(msg);
1389
+ this.token = token;
1390
+ this.type = type || "error";
1391
+ }
1392
+ };
1393
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1394
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1395
+ function yearOptions(token, onError) {
1396
+ switch (token.char) {
1397
+ case "y":
1398
+ return { year: numeric(token.width) };
1399
+ case "r":
1400
+ return { calendar: "gregory", year: "numeric" };
1401
+ case "u":
1402
+ case "U":
1403
+ case "Y":
1404
+ default:
1405
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1406
+ return { year: "numeric" };
1407
+ }
1408
+ }
1409
+ function monthStyle(token, onError) {
1410
+ switch (token.width) {
1411
+ case 1:
1412
+ return "numeric";
1413
+ case 2:
1414
+ return "2-digit";
1415
+ case 3:
1416
+ return "short";
1417
+ case 4:
1418
+ return "long";
1419
+ case 5:
1420
+ return "narrow";
1421
+ default:
1422
+ onError(`${token.desc} is not supported with width ${token.width}`);
1423
+ return void 0;
1424
+ }
1425
+ }
1426
+ function dayStyle(token, onError) {
1427
+ const { char, desc, width } = token;
1428
+ if (char === "d") {
1429
+ return numeric(width);
1430
+ } else {
1431
+ onError(`${desc} is not supported`);
1432
+ return void 0;
1433
+ }
1434
+ }
1435
+ function weekdayStyle(token, onError) {
1436
+ const { char, desc, width } = token;
1437
+ if ((char === "c" || char === "e") && width < 3) {
1438
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1439
+ onError(msg, DateFormatError.WARNING);
1440
+ }
1441
+ return alpha(width);
1442
+ }
1443
+ function hourOptions(token) {
1444
+ const hour = numeric(token.width);
1445
+ let hourCycle;
1446
+ switch (token.char) {
1447
+ case "h":
1448
+ hourCycle = "h12";
1449
+ break;
1450
+ case "H":
1451
+ hourCycle = "h23";
1452
+ break;
1453
+ case "k":
1454
+ hourCycle = "h24";
1455
+ break;
1456
+ case "K":
1457
+ hourCycle = "h11";
1458
+ break;
1459
+ }
1460
+ return hourCycle ? { hour, hourCycle } : { hour };
1461
+ }
1462
+ function timeZoneNameStyle(token, onError) {
1463
+ const { char, desc, width } = token;
1464
+ switch (char) {
1465
+ case "v":
1466
+ case "z":
1467
+ return width === 4 ? "long" : "short";
1468
+ case "V":
1469
+ if (width === 4)
1470
+ return "long";
1471
+ onError(`${desc} is not supported with width ${width}`);
1472
+ return void 0;
1473
+ case "X":
1474
+ onError(`${desc} is not supported`);
1475
+ return void 0;
1476
+ }
1477
+ return "short";
1478
+ }
1479
+ function compileOptions(token, onError) {
1480
+ switch (token.field) {
1481
+ case "era":
1482
+ return { era: alpha(token.width) };
1483
+ case "year":
1484
+ return yearOptions(token, onError);
1485
+ case "month":
1486
+ return { month: monthStyle(token, onError) };
1487
+ case "day":
1488
+ return { day: dayStyle(token, onError) };
1489
+ case "weekday":
1490
+ return { weekday: weekdayStyle(token, onError) };
1491
+ case "period":
1492
+ return void 0;
1493
+ case "hour":
1494
+ return hourOptions(token);
1495
+ case "min":
1496
+ return { minute: numeric(token.width) };
1497
+ case "sec":
1498
+ return { second: numeric(token.width) };
1499
+ case "tz":
1500
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1501
+ case "quarter":
1502
+ case "week":
1503
+ case "sec-frac":
1504
+ case "ms":
1505
+ onError(`${token.desc} is not supported`);
1506
+ }
1507
+ return void 0;
1508
+ }
1509
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1510
+ throw error;
1511
+ }) {
1512
+ const options = {
1513
+ timeZone
1514
+ };
1515
+ const fields2 = [];
1516
+ for (const token of tokens) {
1517
+ const { error, field, str } = token;
1518
+ if (error) {
1519
+ const dte = new DateFormatError(error.message, token);
1520
+ dte.stack = error.stack;
1521
+ onError(dte);
1522
+ }
1523
+ if (str) {
1524
+ const msg = `Ignoring string part: ${str}`;
1525
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1526
+ }
1527
+ if (field) {
1528
+ if (fields2.indexOf(field) === -1)
1529
+ fields2.push(field);
1530
+ else
1531
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1532
+ }
1533
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1534
+ if (opt)
1535
+ Object.assign(options, opt);
1536
+ }
1537
+ return options;
1538
+ }
1539
+ var fields = {
1540
+ G: { field: "era", desc: "Era" },
1541
+ y: { field: "year", desc: "Year" },
1542
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1543
+ u: { field: "year", desc: "Extended year" },
1544
+ U: { field: "year", desc: "Cyclic year name" },
1545
+ r: { field: "year", desc: "Related Gregorian year" },
1546
+ Q: { field: "quarter", desc: "Quarter" },
1547
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1548
+ M: { field: "month", desc: "Month in year" },
1549
+ L: { field: "month", desc: "Stand-alone month in year" },
1550
+ w: { field: "week", desc: "Week of year" },
1551
+ W: { field: "week", desc: "Week of month" },
1552
+ d: { field: "day", desc: "Day in month" },
1553
+ D: { field: "day", desc: "Day of year" },
1554
+ F: { field: "day", desc: "Day of week in month" },
1555
+ g: { field: "day", desc: "Modified julian day" },
1556
+ E: { field: "weekday", desc: "Day of week" },
1557
+ e: { field: "weekday", desc: "Local day of week" },
1558
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1559
+ a: { field: "period", desc: "AM/PM marker" },
1560
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1561
+ B: { field: "period", desc: "Flexible day period" },
1562
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1563
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1564
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1565
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1566
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1567
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1568
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1569
+ m: { field: "min", desc: "Minute in hour" },
1570
+ s: { field: "sec", desc: "Second in minute" },
1571
+ S: { field: "sec-frac", desc: "Fractional second" },
1572
+ A: { field: "ms", desc: "Milliseconds in day" },
1573
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1574
+ Z: { field: "tz", desc: "Time Zone" },
1575
+ O: { field: "tz", desc: "Time Zone: localized" },
1576
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1577
+ V: { field: "tz", desc: "Time Zone: ID" },
1578
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1579
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1580
+ };
1581
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1582
+ function readFieldToken(src, pos) {
1583
+ const char = src[pos];
1584
+ let width = 1;
1585
+ while (src[++pos] === char)
1586
+ ++width;
1587
+ const field = fields[char];
1588
+ if (!field) {
1589
+ const msg = `The letter ${char} is not a valid field identifier`;
1590
+ return { char, error: new Error(msg), width };
1591
+ }
1592
+ return { char, field: field.field, desc: field.desc, width };
1593
+ }
1594
+ function readQuotedToken(src, pos) {
1595
+ let str = src[++pos];
1596
+ let width = 2;
1597
+ if (str === "'")
1598
+ return { char: "'", str, width };
1599
+ while (true) {
1600
+ const next = src[++pos];
1601
+ ++width;
1602
+ if (next === void 0) {
1603
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1604
+ return { char: "'", error: new Error(msg), str, width };
1605
+ } else if (next === "'") {
1606
+ if (src[++pos] !== "'")
1607
+ return { char: "'", str, width };
1608
+ else
1609
+ ++width;
1610
+ }
1611
+ str += next;
1612
+ }
1613
+ }
1614
+ function readToken(src, pos) {
1615
+ const char = src[pos];
1616
+ if (!char)
1617
+ return null;
1618
+ if (isLetter(char))
1619
+ return readFieldToken(src, pos);
1620
+ if (char === "'")
1621
+ return readQuotedToken(src, pos);
1622
+ let str = char;
1623
+ let width = 1;
1624
+ while (true) {
1625
+ const next = src[++pos];
1626
+ if (!next || isLetter(next) || next === "'")
1627
+ return { char, str, width };
1628
+ str += next;
1629
+ width += 1;
1630
+ }
1631
+ }
1632
+ function parseDateTokens(src) {
1633
+ const tokens = [];
1634
+ let pos = 0;
1635
+ while (true) {
1636
+ const token = readToken(src, pos);
1637
+ if (!token)
1638
+ return tokens;
1639
+ tokens.push(token);
1640
+ pos += token.width;
1641
+ }
1642
+ }
1385
1643
  function processTokens(tokens, mapText) {
1386
1644
  if (!tokens.filter((token) => token.type !== "content").length) {
1387
1645
  return tokens.map((token) => mapText(token.value));
@@ -1396,6 +1654,12 @@ function processTokens(tokens, mapText) {
1396
1654
  return [token.arg];
1397
1655
  } else if (token.type === "function") {
1398
1656
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1657
+ if (token.key === "date" && _param) {
1658
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1659
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1660
+ });
1661
+ return [token.arg, token.key, opts];
1662
+ }
1399
1663
  if (_param) {
1400
1664
  return [token.arg, token.key, _param.value.trim()];
1401
1665
  } else {
@@ -1417,6 +1681,13 @@ function processTokens(tokens, mapText) {
1417
1681
  ];
1418
1682
  });
1419
1683
  }
1684
+ function compileDateExpression(format, onError) {
1685
+ if (/^::/.test(format)) {
1686
+ const tokens = parseDateTokens(format.substring(2));
1687
+ return getDateFormatOptions(tokens, void 0, onError);
1688
+ }
1689
+ return format;
1690
+ }
1420
1691
  function compileMessage(message, mapText = (v) => v) {
1421
1692
  try {
1422
1693
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1428,7 +1699,7 @@ Message: ${message}`);
1428
1699
  }
1429
1700
  }
1430
1701
 
1431
- // node_modules/.pnpm/@lingui+core@5.1.2_@lingui+babel-plugin-lingui-macro@5.1.2_babel-plugin-macros@3.1.0_typescri_g2ngrxg2kfutsfck3yn2icllca/node_modules/@lingui/core/dist/index.mjs
1702
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1432
1703
  var isString = (s) => typeof s === "string";
1433
1704
  var isFunction = (f2) => typeof f2 === "function";
1434
1705
  var cache = /* @__PURE__ */ new Map();
@@ -1439,12 +1710,59 @@ function normalizeLocales(locales) {
1439
1710
  }
1440
1711
  function date(locales, value, format) {
1441
1712
  const _locales = normalizeLocales(locales);
1713
+ if (!format) {
1714
+ format = "default";
1715
+ }
1716
+ let o;
1717
+ if (typeof format === "string") {
1718
+ o = {
1719
+ day: "numeric",
1720
+ month: "short",
1721
+ year: "numeric"
1722
+ };
1723
+ switch (format) {
1724
+ case "full":
1725
+ o.weekday = "long";
1726
+ case "long":
1727
+ o.month = "long";
1728
+ break;
1729
+ case "short":
1730
+ o.month = "numeric";
1731
+ break;
1732
+ }
1733
+ } else {
1734
+ o = format;
1735
+ }
1442
1736
  const formatter = getMemoized(
1443
1737
  () => cacheKey("date", _locales, format),
1444
- () => new Intl.DateTimeFormat(_locales, format)
1738
+ () => new Intl.DateTimeFormat(_locales, o)
1445
1739
  );
1446
1740
  return formatter.format(isString(value) ? new Date(value) : value);
1447
1741
  }
1742
+ function time(locales, value, format) {
1743
+ let o;
1744
+ if (!format) {
1745
+ format = "default";
1746
+ }
1747
+ if (typeof format === "string") {
1748
+ o = {
1749
+ second: "numeric",
1750
+ minute: "numeric",
1751
+ hour: "numeric"
1752
+ };
1753
+ switch (format) {
1754
+ case "full":
1755
+ case "long":
1756
+ o.timeZoneName = "short";
1757
+ break;
1758
+ case "short":
1759
+ delete o.second;
1760
+ }
1761
+ } else {
1762
+ o = format;
1763
+ }
1764
+ return date(locales, value, o);
1765
+ }
1448
1766
  function number(locales, value, format) {
1449
1767
  const _locales = normalizeLocales(locales);
1450
1768
  const formatter = getMemoized(
@@ -1484,7 +1802,9 @@ var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1484
1802
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1485
1803
  const locales = passedLocales || locale;
1486
1804
  const style = (format) => {
1487
- return typeof format === "object" ? format : formats[format] || { style: format };
1805
+ if (typeof format === "object")
1806
+ return format;
1807
+ return formats[format];
1488
1808
  };
1489
1809
  const replaceOctothorpe = (value, message) => {
1490
1810
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1503,8 +1823,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1503
1823
  return replaceOctothorpe(value - offset, message);
1504
1824
  },
1505
1825
  select: selectFormatter,
1506
- number: (value, format) => number(locales, value, style(format)),
1507
- date: (value, format) => date(locales, value, style(format))
1826
+ number: (value, format) => number(
1827
+ locales,
1828
+ value,
1829
+ style(format) || { style: format }
1830
+ ),
1831
+ date: (value, format) => date(locales, value, style(format) || format),
1832
+ time: (value, format) => time(locales, value, style(format) || format)
1508
1833
  };
1509
1834
  };
1510
1835
  var selectFormatter = (value, rules) => {
@@ -1553,10 +1878,10 @@ function interpolate(translation, locale, locales) {
1553
1878
  };
1554
1879
  const result = formatMessage(translation);
1555
1880
  if (isString(result) && UNICODE_REGEX.test(result)) {
1556
- return (0, import_unraw.unraw)(result.trim());
1881
+ return (0, import_unraw.unraw)(result);
1557
1882
  }
1558
1883
  if (isString(result))
1559
- return result.trim();
1884
+ return result;
1560
1885
  return result ? String(result) : "";
1561
1886
  };
1562
1887
  }
@@ -1673,9 +1998,8 @@ var I18n = class extends EventEmitter {
1673
1998
  /**
1674
1999
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1675
2000
  */
1676
- // @ts-ignore deprecated, so ignore the reported error
1677
2001
  loadLocaleData(localeOrAllData, localeData) {
1678
- if (localeData != null) {
2002
+ if (typeof localeOrAllData === "string") {
1679
2003
  this._loadLocaleData(localeOrAllData, localeData);
1680
2004
  } else {
1681
2005
  Object.keys(localeOrAllData).forEach(
@@ -1722,6 +2046,11 @@ var I18n = class extends EventEmitter {
1722
2046
  this.emit("change");
1723
2047
  }
1724
2048
  _(id, values, options) {
2049
+ if (!this.locale) {
2050
+ throw new Error(
2051
+ "Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic."
2052
+ );
2053
+ }
1725
2054
  let message = options == null ? void 0 : options.message;
1726
2055
  if (!id) {
1727
2056
  id = "";
@@ -1778,7 +2107,7 @@ function setupI18n(params = {}) {
1778
2107
  }
1779
2108
  var i18n = setupI18n();
1780
2109
 
1781
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
2110
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
1782
2111
  import { LitElement } from "lit";
1783
2112
  import { unsafeStatic, html as html2 } from "lit/static-html.js";
1784
2113
  var messages = JSON.parse('{"icon.title.arrow-left":["Pil som peker mot venstre"]}');
@@ -1872,7 +2201,7 @@ if (!customElements.get("w-icon-arrow-left-16")) {
1872
2201
  customElements.define("w-icon-arrow-left-16", IconArrowLeft16);
1873
2202
  }
1874
2203
 
1875
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
2204
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/close-16.js
1876
2205
  import { LitElement as LitElement2 } from "lit";
1877
2206
  import { unsafeStatic as unsafeStatic2, html as html3 } from "lit/static-html.js";
1878
2207
  var messages6 = JSON.parse('{"icon.title.close":["Kryss"]}');