@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.
@@ -1035,11 +1035,269 @@ var r = function() {
1035
1035
  }, []).join(" ");
1036
1036
  };
1037
1037
 
1038
- // 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
1038
+ // 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
1039
1039
  var import_unraw = __toESM(require_dist(), 1);
1040
1040
 
1041
- // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1041
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1042
1042
  var import_parser = __toESM(require_parser(), 1);
1043
+ var DateFormatError = class extends Error {
1044
+ /** @internal */
1045
+ constructor(msg, token, type) {
1046
+ super(msg);
1047
+ this.token = token;
1048
+ this.type = type || "error";
1049
+ }
1050
+ };
1051
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1052
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1053
+ function yearOptions(token, onError) {
1054
+ switch (token.char) {
1055
+ case "y":
1056
+ return { year: numeric(token.width) };
1057
+ case "r":
1058
+ return { calendar: "gregory", year: "numeric" };
1059
+ case "u":
1060
+ case "U":
1061
+ case "Y":
1062
+ default:
1063
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1064
+ return { year: "numeric" };
1065
+ }
1066
+ }
1067
+ function monthStyle(token, onError) {
1068
+ switch (token.width) {
1069
+ case 1:
1070
+ return "numeric";
1071
+ case 2:
1072
+ return "2-digit";
1073
+ case 3:
1074
+ return "short";
1075
+ case 4:
1076
+ return "long";
1077
+ case 5:
1078
+ return "narrow";
1079
+ default:
1080
+ onError(`${token.desc} is not supported with width ${token.width}`);
1081
+ return void 0;
1082
+ }
1083
+ }
1084
+ function dayStyle(token, onError) {
1085
+ const { char, desc, width } = token;
1086
+ if (char === "d") {
1087
+ return numeric(width);
1088
+ } else {
1089
+ onError(`${desc} is not supported`);
1090
+ return void 0;
1091
+ }
1092
+ }
1093
+ function weekdayStyle(token, onError) {
1094
+ const { char, desc, width } = token;
1095
+ if ((char === "c" || char === "e") && width < 3) {
1096
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1097
+ onError(msg, DateFormatError.WARNING);
1098
+ }
1099
+ return alpha(width);
1100
+ }
1101
+ function hourOptions(token) {
1102
+ const hour = numeric(token.width);
1103
+ let hourCycle;
1104
+ switch (token.char) {
1105
+ case "h":
1106
+ hourCycle = "h12";
1107
+ break;
1108
+ case "H":
1109
+ hourCycle = "h23";
1110
+ break;
1111
+ case "k":
1112
+ hourCycle = "h24";
1113
+ break;
1114
+ case "K":
1115
+ hourCycle = "h11";
1116
+ break;
1117
+ }
1118
+ return hourCycle ? { hour, hourCycle } : { hour };
1119
+ }
1120
+ function timeZoneNameStyle(token, onError) {
1121
+ const { char, desc, width } = token;
1122
+ switch (char) {
1123
+ case "v":
1124
+ case "z":
1125
+ return width === 4 ? "long" : "short";
1126
+ case "V":
1127
+ if (width === 4)
1128
+ return "long";
1129
+ onError(`${desc} is not supported with width ${width}`);
1130
+ return void 0;
1131
+ case "X":
1132
+ onError(`${desc} is not supported`);
1133
+ return void 0;
1134
+ }
1135
+ return "short";
1136
+ }
1137
+ function compileOptions(token, onError) {
1138
+ switch (token.field) {
1139
+ case "era":
1140
+ return { era: alpha(token.width) };
1141
+ case "year":
1142
+ return yearOptions(token, onError);
1143
+ case "month":
1144
+ return { month: monthStyle(token, onError) };
1145
+ case "day":
1146
+ return { day: dayStyle(token, onError) };
1147
+ case "weekday":
1148
+ return { weekday: weekdayStyle(token, onError) };
1149
+ case "period":
1150
+ return void 0;
1151
+ case "hour":
1152
+ return hourOptions(token);
1153
+ case "min":
1154
+ return { minute: numeric(token.width) };
1155
+ case "sec":
1156
+ return { second: numeric(token.width) };
1157
+ case "tz":
1158
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1159
+ case "quarter":
1160
+ case "week":
1161
+ case "sec-frac":
1162
+ case "ms":
1163
+ onError(`${token.desc} is not supported`);
1164
+ }
1165
+ return void 0;
1166
+ }
1167
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1168
+ throw error;
1169
+ }) {
1170
+ const options = {
1171
+ timeZone
1172
+ };
1173
+ const fields2 = [];
1174
+ for (const token of tokens) {
1175
+ const { error, field, str } = token;
1176
+ if (error) {
1177
+ const dte = new DateFormatError(error.message, token);
1178
+ dte.stack = error.stack;
1179
+ onError(dte);
1180
+ }
1181
+ if (str) {
1182
+ const msg = `Ignoring string part: ${str}`;
1183
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1184
+ }
1185
+ if (field) {
1186
+ if (fields2.indexOf(field) === -1)
1187
+ fields2.push(field);
1188
+ else
1189
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1190
+ }
1191
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1192
+ if (opt)
1193
+ Object.assign(options, opt);
1194
+ }
1195
+ return options;
1196
+ }
1197
+ var fields = {
1198
+ G: { field: "era", desc: "Era" },
1199
+ y: { field: "year", desc: "Year" },
1200
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1201
+ u: { field: "year", desc: "Extended year" },
1202
+ U: { field: "year", desc: "Cyclic year name" },
1203
+ r: { field: "year", desc: "Related Gregorian year" },
1204
+ Q: { field: "quarter", desc: "Quarter" },
1205
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1206
+ M: { field: "month", desc: "Month in year" },
1207
+ L: { field: "month", desc: "Stand-alone month in year" },
1208
+ w: { field: "week", desc: "Week of year" },
1209
+ W: { field: "week", desc: "Week of month" },
1210
+ d: { field: "day", desc: "Day in month" },
1211
+ D: { field: "day", desc: "Day of year" },
1212
+ F: { field: "day", desc: "Day of week in month" },
1213
+ g: { field: "day", desc: "Modified julian day" },
1214
+ E: { field: "weekday", desc: "Day of week" },
1215
+ e: { field: "weekday", desc: "Local day of week" },
1216
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1217
+ a: { field: "period", desc: "AM/PM marker" },
1218
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1219
+ B: { field: "period", desc: "Flexible day period" },
1220
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1221
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1222
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1223
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1224
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1225
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1226
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1227
+ m: { field: "min", desc: "Minute in hour" },
1228
+ s: { field: "sec", desc: "Second in minute" },
1229
+ S: { field: "sec-frac", desc: "Fractional second" },
1230
+ A: { field: "ms", desc: "Milliseconds in day" },
1231
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1232
+ Z: { field: "tz", desc: "Time Zone" },
1233
+ O: { field: "tz", desc: "Time Zone: localized" },
1234
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1235
+ V: { field: "tz", desc: "Time Zone: ID" },
1236
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1237
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1238
+ };
1239
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1240
+ function readFieldToken(src, pos) {
1241
+ const char = src[pos];
1242
+ let width = 1;
1243
+ while (src[++pos] === char)
1244
+ ++width;
1245
+ const field = fields[char];
1246
+ if (!field) {
1247
+ const msg = `The letter ${char} is not a valid field identifier`;
1248
+ return { char, error: new Error(msg), width };
1249
+ }
1250
+ return { char, field: field.field, desc: field.desc, width };
1251
+ }
1252
+ function readQuotedToken(src, pos) {
1253
+ let str = src[++pos];
1254
+ let width = 2;
1255
+ if (str === "'")
1256
+ return { char: "'", str, width };
1257
+ while (true) {
1258
+ const next = src[++pos];
1259
+ ++width;
1260
+ if (next === void 0) {
1261
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1262
+ return { char: "'", error: new Error(msg), str, width };
1263
+ } else if (next === "'") {
1264
+ if (src[++pos] !== "'")
1265
+ return { char: "'", str, width };
1266
+ else
1267
+ ++width;
1268
+ }
1269
+ str += next;
1270
+ }
1271
+ }
1272
+ function readToken(src, pos) {
1273
+ const char = src[pos];
1274
+ if (!char)
1275
+ return null;
1276
+ if (isLetter(char))
1277
+ return readFieldToken(src, pos);
1278
+ if (char === "'")
1279
+ return readQuotedToken(src, pos);
1280
+ let str = char;
1281
+ let width = 1;
1282
+ while (true) {
1283
+ const next = src[++pos];
1284
+ if (!next || isLetter(next) || next === "'")
1285
+ return { char, str, width };
1286
+ str += next;
1287
+ width += 1;
1288
+ }
1289
+ }
1290
+ function parseDateTokens(src) {
1291
+ const tokens = [];
1292
+ let pos = 0;
1293
+ while (true) {
1294
+ const token = readToken(src, pos);
1295
+ if (!token)
1296
+ return tokens;
1297
+ tokens.push(token);
1298
+ pos += token.width;
1299
+ }
1300
+ }
1043
1301
  function processTokens(tokens, mapText) {
1044
1302
  if (!tokens.filter((token) => token.type !== "content").length) {
1045
1303
  return tokens.map((token) => mapText(token.value));
@@ -1054,6 +1312,12 @@ function processTokens(tokens, mapText) {
1054
1312
  return [token.arg];
1055
1313
  } else if (token.type === "function") {
1056
1314
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1315
+ if (token.key === "date" && _param) {
1316
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1317
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1318
+ });
1319
+ return [token.arg, token.key, opts];
1320
+ }
1057
1321
  if (_param) {
1058
1322
  return [token.arg, token.key, _param.value.trim()];
1059
1323
  } else {
@@ -1075,6 +1339,13 @@ function processTokens(tokens, mapText) {
1075
1339
  ];
1076
1340
  });
1077
1341
  }
1342
+ function compileDateExpression(format, onError) {
1343
+ if (/^::/.test(format)) {
1344
+ const tokens = parseDateTokens(format.substring(2));
1345
+ return getDateFormatOptions(tokens, void 0, onError);
1346
+ }
1347
+ return format;
1348
+ }
1078
1349
  function compileMessage(message, mapText = (v) => v) {
1079
1350
  try {
1080
1351
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1086,7 +1357,7 @@ Message: ${message}`);
1086
1357
  }
1087
1358
  }
1088
1359
 
1089
- // 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
1360
+ // 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
1090
1361
  var isString = (s) => typeof s === "string";
1091
1362
  var isFunction = (f) => typeof f === "function";
1092
1363
  var cache = /* @__PURE__ */ new Map();
@@ -1097,12 +1368,59 @@ function normalizeLocales(locales) {
1097
1368
  }
1098
1369
  function date(locales, value, format) {
1099
1370
  const _locales = normalizeLocales(locales);
1371
+ if (!format) {
1372
+ format = "default";
1373
+ }
1374
+ let o;
1375
+ if (typeof format === "string") {
1376
+ o = {
1377
+ day: "numeric",
1378
+ month: "short",
1379
+ year: "numeric"
1380
+ };
1381
+ switch (format) {
1382
+ case "full":
1383
+ o.weekday = "long";
1384
+ case "long":
1385
+ o.month = "long";
1386
+ break;
1387
+ case "short":
1388
+ o.month = "numeric";
1389
+ break;
1390
+ }
1391
+ } else {
1392
+ o = format;
1393
+ }
1100
1394
  const formatter = getMemoized(
1101
1395
  () => cacheKey("date", _locales, format),
1102
- () => new Intl.DateTimeFormat(_locales, format)
1396
+ () => new Intl.DateTimeFormat(_locales, o)
1103
1397
  );
1104
1398
  return formatter.format(isString(value) ? new Date(value) : value);
1105
1399
  }
1400
+ function time(locales, value, format) {
1401
+ let o;
1402
+ if (!format) {
1403
+ format = "default";
1404
+ }
1405
+ if (typeof format === "string") {
1406
+ o = {
1407
+ second: "numeric",
1408
+ minute: "numeric",
1409
+ hour: "numeric"
1410
+ };
1411
+ switch (format) {
1412
+ case "full":
1413
+ case "long":
1414
+ o.timeZoneName = "short";
1415
+ break;
1416
+ case "short":
1417
+ delete o.second;
1418
+ }
1419
+ } else {
1420
+ o = format;
1421
+ }
1422
+ return date(locales, value, o);
1423
+ }
1106
1424
  function number(locales, value, format) {
1107
1425
  const _locales = normalizeLocales(locales);
1108
1426
  const formatter = getMemoized(
@@ -1142,7 +1460,9 @@ var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1142
1460
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1143
1461
  const locales = passedLocales || locale;
1144
1462
  const style = (format) => {
1145
- return typeof format === "object" ? format : formats[format] || { style: format };
1463
+ if (typeof format === "object")
1464
+ return format;
1465
+ return formats[format];
1146
1466
  };
1147
1467
  const replaceOctothorpe = (value, message) => {
1148
1468
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1161,8 +1481,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1161
1481
  return replaceOctothorpe(value - offset, message);
1162
1482
  },
1163
1483
  select: selectFormatter,
1164
- number: (value, format) => number(locales, value, style(format)),
1165
- date: (value, format) => date(locales, value, style(format))
1484
+ number: (value, format) => number(
1485
+ locales,
1486
+ value,
1487
+ style(format) || { style: format }
1488
+ ),
1489
+ date: (value, format) => date(locales, value, style(format) || format),
1490
+ time: (value, format) => time(locales, value, style(format) || format)
1166
1491
  };
1167
1492
  };
1168
1493
  var selectFormatter = (value, rules) => {
@@ -1211,10 +1536,10 @@ function interpolate(translation, locale, locales) {
1211
1536
  };
1212
1537
  const result = formatMessage(translation);
1213
1538
  if (isString(result) && UNICODE_REGEX.test(result)) {
1214
- return (0, import_unraw.unraw)(result.trim());
1539
+ return (0, import_unraw.unraw)(result);
1215
1540
  }
1216
1541
  if (isString(result))
1217
- return result.trim();
1542
+ return result;
1218
1543
  return result ? String(result) : "";
1219
1544
  };
1220
1545
  }
@@ -1331,9 +1656,8 @@ var I18n = class extends EventEmitter {
1331
1656
  /**
1332
1657
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1333
1658
  */
1334
- // @ts-ignore deprecated, so ignore the reported error
1335
1659
  loadLocaleData(localeOrAllData, localeData) {
1336
- if (localeData != null) {
1660
+ if (typeof localeOrAllData === "string") {
1337
1661
  this._loadLocaleData(localeOrAllData, localeData);
1338
1662
  } else {
1339
1663
  Object.keys(localeOrAllData).forEach(
@@ -1380,6 +1704,11 @@ var I18n = class extends EventEmitter {
1380
1704
  this.emit("change");
1381
1705
  }
1382
1706
  _(id, values, options) {
1707
+ if (!this.locale) {
1708
+ throw new Error(
1709
+ "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."
1710
+ );
1711
+ }
1383
1712
  let message = options == null ? void 0 : options.message;
1384
1713
  if (!id) {
1385
1714
  id = "";
@@ -1436,7 +1765,7 @@ function setupI18n(params = {}) {
1436
1765
  }
1437
1766
  var i18n = setupI18n();
1438
1767
 
1439
- // 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
1768
+ // 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
1440
1769
  var toaster = {
1441
1770
  wrapper: "fixed transform translate-z-0 bottom-16 left-0 right-0 mx-8 sm:mx-16 z-50 pointer-events-none",
1442
1771
  base: "grid auto-rows-auto justify-items-center justify-center mx-auto pointer-events-none",
@@ -1756,7 +2085,7 @@ var collapse = (el, done) => {
1756
2085
  // packages/toast/toast.js
1757
2086
  import { when } from "lit/directives/when.js";
1758
2087
 
1759
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/warning-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/warning-16.js
1760
2089
  import { LitElement } from "lit";
1761
2090
  import { unsafeStatic, html } from "lit/static-html.js";
1762
2091
  var messages = JSON.parse('{"icon.title.warning":["Varseltrekant med utropstegn"]}');
@@ -1850,7 +2179,7 @@ if (!customElements.get("w-icon-warning-16")) {
1850
2179
  customElements.define("w-icon-warning-16", IconWarning16);
1851
2180
  }
1852
2181
 
1853
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/error-16.js
2182
+ // 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/error-16.js
1854
2183
  import { LitElement as LitElement2 } from "lit";
1855
2184
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1856
2185
  var messages6 = JSON.parse('{"icon.title.error":["\xC5ttekant med utropstegn"]}');
@@ -1944,7 +2273,7 @@ if (!customElements.get("w-icon-error-16")) {
1944
2273
  customElements.define("w-icon-error-16", IconError16);
1945
2274
  }
1946
2275
 
1947
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/success-16.js
2276
+ // 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/success-16.js
1948
2277
  import { LitElement as LitElement3 } from "lit";
1949
2278
  import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
1950
2279
  var messages7 = JSON.parse('{"icon.title.success":["Sirkel med sjekkmerke"]}');
@@ -2038,7 +2367,7 @@ if (!customElements.get("w-icon-success-16")) {
2038
2367
  customElements.define("w-icon-success-16", IconSuccess16);
2039
2368
  }
2040
2369
 
2041
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
2370
+ // 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
2042
2371
  import { LitElement as LitElement4 } from "lit";
2043
2372
  import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
2044
2373
  var messages8 = JSON.parse('{"icon.title.close":["Kryss"]}');