@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.
@@ -1026,7 +1026,7 @@ var r = function() {
1026
1026
  }, []).join(" ");
1027
1027
  };
1028
1028
 
1029
- // 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
1029
+ // 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
1030
1030
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1031
1031
  var buttonColors = {
1032
1032
  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]",
@@ -1259,15 +1259,273 @@ var attention = {
1259
1259
  import WarpElement from "@warp-ds/elements-core";
1260
1260
  import { ifDefined } from "lit/directives/if-defined.js";
1261
1261
 
1262
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/search-16.js
1262
+ // 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/search-16.js
1263
1263
  import { LitElement } from "lit";
1264
1264
  import { unsafeStatic, html } from "lit/static-html.js";
1265
1265
 
1266
- // 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
1266
+ // 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
1267
1267
  var import_unraw = __toESM(require_dist(), 1);
1268
1268
 
1269
- // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1269
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1270
1270
  var import_parser = __toESM(require_parser(), 1);
1271
+ var DateFormatError = class extends Error {
1272
+ /** @internal */
1273
+ constructor(msg, token, type) {
1274
+ super(msg);
1275
+ this.token = token;
1276
+ this.type = type || "error";
1277
+ }
1278
+ };
1279
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1280
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1281
+ function yearOptions(token, onError) {
1282
+ switch (token.char) {
1283
+ case "y":
1284
+ return { year: numeric(token.width) };
1285
+ case "r":
1286
+ return { calendar: "gregory", year: "numeric" };
1287
+ case "u":
1288
+ case "U":
1289
+ case "Y":
1290
+ default:
1291
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1292
+ return { year: "numeric" };
1293
+ }
1294
+ }
1295
+ function monthStyle(token, onError) {
1296
+ switch (token.width) {
1297
+ case 1:
1298
+ return "numeric";
1299
+ case 2:
1300
+ return "2-digit";
1301
+ case 3:
1302
+ return "short";
1303
+ case 4:
1304
+ return "long";
1305
+ case 5:
1306
+ return "narrow";
1307
+ default:
1308
+ onError(`${token.desc} is not supported with width ${token.width}`);
1309
+ return void 0;
1310
+ }
1311
+ }
1312
+ function dayStyle(token, onError) {
1313
+ const { char, desc, width } = token;
1314
+ if (char === "d") {
1315
+ return numeric(width);
1316
+ } else {
1317
+ onError(`${desc} is not supported`);
1318
+ return void 0;
1319
+ }
1320
+ }
1321
+ function weekdayStyle(token, onError) {
1322
+ const { char, desc, width } = token;
1323
+ if ((char === "c" || char === "e") && width < 3) {
1324
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1325
+ onError(msg, DateFormatError.WARNING);
1326
+ }
1327
+ return alpha(width);
1328
+ }
1329
+ function hourOptions(token) {
1330
+ const hour = numeric(token.width);
1331
+ let hourCycle;
1332
+ switch (token.char) {
1333
+ case "h":
1334
+ hourCycle = "h12";
1335
+ break;
1336
+ case "H":
1337
+ hourCycle = "h23";
1338
+ break;
1339
+ case "k":
1340
+ hourCycle = "h24";
1341
+ break;
1342
+ case "K":
1343
+ hourCycle = "h11";
1344
+ break;
1345
+ }
1346
+ return hourCycle ? { hour, hourCycle } : { hour };
1347
+ }
1348
+ function timeZoneNameStyle(token, onError) {
1349
+ const { char, desc, width } = token;
1350
+ switch (char) {
1351
+ case "v":
1352
+ case "z":
1353
+ return width === 4 ? "long" : "short";
1354
+ case "V":
1355
+ if (width === 4)
1356
+ return "long";
1357
+ onError(`${desc} is not supported with width ${width}`);
1358
+ return void 0;
1359
+ case "X":
1360
+ onError(`${desc} is not supported`);
1361
+ return void 0;
1362
+ }
1363
+ return "short";
1364
+ }
1365
+ function compileOptions(token, onError) {
1366
+ switch (token.field) {
1367
+ case "era":
1368
+ return { era: alpha(token.width) };
1369
+ case "year":
1370
+ return yearOptions(token, onError);
1371
+ case "month":
1372
+ return { month: monthStyle(token, onError) };
1373
+ case "day":
1374
+ return { day: dayStyle(token, onError) };
1375
+ case "weekday":
1376
+ return { weekday: weekdayStyle(token, onError) };
1377
+ case "period":
1378
+ return void 0;
1379
+ case "hour":
1380
+ return hourOptions(token);
1381
+ case "min":
1382
+ return { minute: numeric(token.width) };
1383
+ case "sec":
1384
+ return { second: numeric(token.width) };
1385
+ case "tz":
1386
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1387
+ case "quarter":
1388
+ case "week":
1389
+ case "sec-frac":
1390
+ case "ms":
1391
+ onError(`${token.desc} is not supported`);
1392
+ }
1393
+ return void 0;
1394
+ }
1395
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1396
+ throw error;
1397
+ }) {
1398
+ const options = {
1399
+ timeZone
1400
+ };
1401
+ const fields2 = [];
1402
+ for (const token of tokens) {
1403
+ const { error, field, str } = token;
1404
+ if (error) {
1405
+ const dte = new DateFormatError(error.message, token);
1406
+ dte.stack = error.stack;
1407
+ onError(dte);
1408
+ }
1409
+ if (str) {
1410
+ const msg = `Ignoring string part: ${str}`;
1411
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1412
+ }
1413
+ if (field) {
1414
+ if (fields2.indexOf(field) === -1)
1415
+ fields2.push(field);
1416
+ else
1417
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1418
+ }
1419
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1420
+ if (opt)
1421
+ Object.assign(options, opt);
1422
+ }
1423
+ return options;
1424
+ }
1425
+ var fields = {
1426
+ G: { field: "era", desc: "Era" },
1427
+ y: { field: "year", desc: "Year" },
1428
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1429
+ u: { field: "year", desc: "Extended year" },
1430
+ U: { field: "year", desc: "Cyclic year name" },
1431
+ r: { field: "year", desc: "Related Gregorian year" },
1432
+ Q: { field: "quarter", desc: "Quarter" },
1433
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1434
+ M: { field: "month", desc: "Month in year" },
1435
+ L: { field: "month", desc: "Stand-alone month in year" },
1436
+ w: { field: "week", desc: "Week of year" },
1437
+ W: { field: "week", desc: "Week of month" },
1438
+ d: { field: "day", desc: "Day in month" },
1439
+ D: { field: "day", desc: "Day of year" },
1440
+ F: { field: "day", desc: "Day of week in month" },
1441
+ g: { field: "day", desc: "Modified julian day" },
1442
+ E: { field: "weekday", desc: "Day of week" },
1443
+ e: { field: "weekday", desc: "Local day of week" },
1444
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1445
+ a: { field: "period", desc: "AM/PM marker" },
1446
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1447
+ B: { field: "period", desc: "Flexible day period" },
1448
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1449
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1450
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1451
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1452
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1453
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1454
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1455
+ m: { field: "min", desc: "Minute in hour" },
1456
+ s: { field: "sec", desc: "Second in minute" },
1457
+ S: { field: "sec-frac", desc: "Fractional second" },
1458
+ A: { field: "ms", desc: "Milliseconds in day" },
1459
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1460
+ Z: { field: "tz", desc: "Time Zone" },
1461
+ O: { field: "tz", desc: "Time Zone: localized" },
1462
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1463
+ V: { field: "tz", desc: "Time Zone: ID" },
1464
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1465
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1466
+ };
1467
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1468
+ function readFieldToken(src, pos) {
1469
+ const char = src[pos];
1470
+ let width = 1;
1471
+ while (src[++pos] === char)
1472
+ ++width;
1473
+ const field = fields[char];
1474
+ if (!field) {
1475
+ const msg = `The letter ${char} is not a valid field identifier`;
1476
+ return { char, error: new Error(msg), width };
1477
+ }
1478
+ return { char, field: field.field, desc: field.desc, width };
1479
+ }
1480
+ function readQuotedToken(src, pos) {
1481
+ let str = src[++pos];
1482
+ let width = 2;
1483
+ if (str === "'")
1484
+ return { char: "'", str, width };
1485
+ while (true) {
1486
+ const next = src[++pos];
1487
+ ++width;
1488
+ if (next === void 0) {
1489
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1490
+ return { char: "'", error: new Error(msg), str, width };
1491
+ } else if (next === "'") {
1492
+ if (src[++pos] !== "'")
1493
+ return { char: "'", str, width };
1494
+ else
1495
+ ++width;
1496
+ }
1497
+ str += next;
1498
+ }
1499
+ }
1500
+ function readToken(src, pos) {
1501
+ const char = src[pos];
1502
+ if (!char)
1503
+ return null;
1504
+ if (isLetter(char))
1505
+ return readFieldToken(src, pos);
1506
+ if (char === "'")
1507
+ return readQuotedToken(src, pos);
1508
+ let str = char;
1509
+ let width = 1;
1510
+ while (true) {
1511
+ const next = src[++pos];
1512
+ if (!next || isLetter(next) || next === "'")
1513
+ return { char, str, width };
1514
+ str += next;
1515
+ width += 1;
1516
+ }
1517
+ }
1518
+ function parseDateTokens(src) {
1519
+ const tokens = [];
1520
+ let pos = 0;
1521
+ while (true) {
1522
+ const token = readToken(src, pos);
1523
+ if (!token)
1524
+ return tokens;
1525
+ tokens.push(token);
1526
+ pos += token.width;
1527
+ }
1528
+ }
1271
1529
  function processTokens(tokens, mapText) {
1272
1530
  if (!tokens.filter((token) => token.type !== "content").length) {
1273
1531
  return tokens.map((token) => mapText(token.value));
@@ -1282,6 +1540,12 @@ function processTokens(tokens, mapText) {
1282
1540
  return [token.arg];
1283
1541
  } else if (token.type === "function") {
1284
1542
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1543
+ if (token.key === "date" && _param) {
1544
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1545
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1546
+ });
1547
+ return [token.arg, token.key, opts];
1548
+ }
1285
1549
  if (_param) {
1286
1550
  return [token.arg, token.key, _param.value.trim()];
1287
1551
  } else {
@@ -1303,6 +1567,13 @@ function processTokens(tokens, mapText) {
1303
1567
  ];
1304
1568
  });
1305
1569
  }
1570
+ function compileDateExpression(format, onError) {
1571
+ if (/^::/.test(format)) {
1572
+ const tokens = parseDateTokens(format.substring(2));
1573
+ return getDateFormatOptions(tokens, void 0, onError);
1574
+ }
1575
+ return format;
1576
+ }
1306
1577
  function compileMessage(message, mapText = (v) => v) {
1307
1578
  try {
1308
1579
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1314,7 +1585,7 @@ Message: ${message}`);
1314
1585
  }
1315
1586
  }
1316
1587
 
1317
- // 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
1588
+ // 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
1318
1589
  var isString = (s) => typeof s === "string";
1319
1590
  var isFunction = (f) => typeof f === "function";
1320
1591
  var cache = /* @__PURE__ */ new Map();
@@ -1325,12 +1596,59 @@ function normalizeLocales(locales) {
1325
1596
  }
1326
1597
  function date(locales, value, format) {
1327
1598
  const _locales = normalizeLocales(locales);
1599
+ if (!format) {
1600
+ format = "default";
1601
+ }
1602
+ let o;
1603
+ if (typeof format === "string") {
1604
+ o = {
1605
+ day: "numeric",
1606
+ month: "short",
1607
+ year: "numeric"
1608
+ };
1609
+ switch (format) {
1610
+ case "full":
1611
+ o.weekday = "long";
1612
+ case "long":
1613
+ o.month = "long";
1614
+ break;
1615
+ case "short":
1616
+ o.month = "numeric";
1617
+ break;
1618
+ }
1619
+ } else {
1620
+ o = format;
1621
+ }
1328
1622
  const formatter = getMemoized(
1329
1623
  () => cacheKey("date", _locales, format),
1330
- () => new Intl.DateTimeFormat(_locales, format)
1624
+ () => new Intl.DateTimeFormat(_locales, o)
1331
1625
  );
1332
1626
  return formatter.format(isString(value) ? new Date(value) : value);
1333
1627
  }
1628
+ function time(locales, value, format) {
1629
+ let o;
1630
+ if (!format) {
1631
+ format = "default";
1632
+ }
1633
+ if (typeof format === "string") {
1634
+ o = {
1635
+ second: "numeric",
1636
+ minute: "numeric",
1637
+ hour: "numeric"
1638
+ };
1639
+ switch (format) {
1640
+ case "full":
1641
+ case "long":
1642
+ o.timeZoneName = "short";
1643
+ break;
1644
+ case "short":
1645
+ delete o.second;
1646
+ }
1647
+ } else {
1648
+ o = format;
1649
+ }
1650
+ return date(locales, value, o);
1651
+ }
1334
1652
  function number(locales, value, format) {
1335
1653
  const _locales = normalizeLocales(locales);
1336
1654
  const formatter = getMemoized(
@@ -1370,7 +1688,9 @@ var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1370
1688
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1371
1689
  const locales = passedLocales || locale;
1372
1690
  const style = (format) => {
1373
- return typeof format === "object" ? format : formats[format] || { style: format };
1691
+ if (typeof format === "object")
1692
+ return format;
1693
+ return formats[format];
1374
1694
  };
1375
1695
  const replaceOctothorpe = (value, message) => {
1376
1696
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1389,8 +1709,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1389
1709
  return replaceOctothorpe(value - offset, message);
1390
1710
  },
1391
1711
  select: selectFormatter,
1392
- number: (value, format) => number(locales, value, style(format)),
1393
- date: (value, format) => date(locales, value, style(format))
1712
+ number: (value, format) => number(
1713
+ locales,
1714
+ value,
1715
+ style(format) || { style: format }
1716
+ ),
1717
+ date: (value, format) => date(locales, value, style(format) || format),
1718
+ time: (value, format) => time(locales, value, style(format) || format)
1394
1719
  };
1395
1720
  };
1396
1721
  var selectFormatter = (value, rules) => {
@@ -1439,10 +1764,10 @@ function interpolate(translation, locale, locales) {
1439
1764
  };
1440
1765
  const result = formatMessage(translation);
1441
1766
  if (isString(result) && UNICODE_REGEX.test(result)) {
1442
- return (0, import_unraw.unraw)(result.trim());
1767
+ return (0, import_unraw.unraw)(result);
1443
1768
  }
1444
1769
  if (isString(result))
1445
- return result.trim();
1770
+ return result;
1446
1771
  return result ? String(result) : "";
1447
1772
  };
1448
1773
  }
@@ -1559,9 +1884,8 @@ var I18n = class extends EventEmitter {
1559
1884
  /**
1560
1885
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1561
1886
  */
1562
- // @ts-ignore deprecated, so ignore the reported error
1563
1887
  loadLocaleData(localeOrAllData, localeData) {
1564
- if (localeData != null) {
1888
+ if (typeof localeOrAllData === "string") {
1565
1889
  this._loadLocaleData(localeOrAllData, localeData);
1566
1890
  } else {
1567
1891
  Object.keys(localeOrAllData).forEach(
@@ -1608,6 +1932,11 @@ var I18n = class extends EventEmitter {
1608
1932
  this.emit("change");
1609
1933
  }
1610
1934
  _(id, values, options) {
1935
+ if (!this.locale) {
1936
+ throw new Error(
1937
+ "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."
1938
+ );
1939
+ }
1611
1940
  let message = options == null ? void 0 : options.message;
1612
1941
  if (!id) {
1613
1942
  id = "";
@@ -1664,7 +1993,7 @@ function setupI18n(params = {}) {
1664
1993
  }
1665
1994
  var i18n = setupI18n();
1666
1995
 
1667
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/search-16.js
1996
+ // 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/search-16.js
1668
1997
  var messages = JSON.parse('{"icon.title.search":["Forst\xF8rrelsesglass"]}');
1669
1998
  var messages2 = JSON.parse('{"icon.title.search":["Magnifying glass"]}');
1670
1999
  var messages3 = JSON.parse('{"icon.title.search":["Suurennuslasi"]}');
@@ -1756,7 +2085,7 @@ if (!customElements.get("w-icon-search-16")) {
1756
2085
  customElements.define("w-icon-search-16", IconSearch16);
1757
2086
  }
1758
2087
 
1759
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
2088
+ // 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
1760
2089
  import { LitElement as LitElement2 } from "lit";
1761
2090
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1762
2091
  var messages6 = JSON.parse('{"icon.title.close":["Kryss"]}');