@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.
@@ -1013,15 +1013,273 @@ var require_parser = __commonJS({
1013
1013
  }
1014
1014
  });
1015
1015
 
1016
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
1016
+ // 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
1017
1017
  import { LitElement } from "lit";
1018
1018
  import { unsafeStatic, html } from "lit/static-html.js";
1019
1019
 
1020
- // 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
1020
+ // 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
1021
1021
  var import_unraw = __toESM(require_dist(), 1);
1022
1022
 
1023
- // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1023
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1024
1024
  var import_parser = __toESM(require_parser(), 1);
1025
+ var DateFormatError = class extends Error {
1026
+ /** @internal */
1027
+ constructor(msg, token, type) {
1028
+ super(msg);
1029
+ this.token = token;
1030
+ this.type = type || "error";
1031
+ }
1032
+ };
1033
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1034
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1035
+ function yearOptions(token, onError) {
1036
+ switch (token.char) {
1037
+ case "y":
1038
+ return { year: numeric(token.width) };
1039
+ case "r":
1040
+ return { calendar: "gregory", year: "numeric" };
1041
+ case "u":
1042
+ case "U":
1043
+ case "Y":
1044
+ default:
1045
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1046
+ return { year: "numeric" };
1047
+ }
1048
+ }
1049
+ function monthStyle(token, onError) {
1050
+ switch (token.width) {
1051
+ case 1:
1052
+ return "numeric";
1053
+ case 2:
1054
+ return "2-digit";
1055
+ case 3:
1056
+ return "short";
1057
+ case 4:
1058
+ return "long";
1059
+ case 5:
1060
+ return "narrow";
1061
+ default:
1062
+ onError(`${token.desc} is not supported with width ${token.width}`);
1063
+ return void 0;
1064
+ }
1065
+ }
1066
+ function dayStyle(token, onError) {
1067
+ const { char, desc, width } = token;
1068
+ if (char === "d") {
1069
+ return numeric(width);
1070
+ } else {
1071
+ onError(`${desc} is not supported`);
1072
+ return void 0;
1073
+ }
1074
+ }
1075
+ function weekdayStyle(token, onError) {
1076
+ const { char, desc, width } = token;
1077
+ if ((char === "c" || char === "e") && width < 3) {
1078
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1079
+ onError(msg, DateFormatError.WARNING);
1080
+ }
1081
+ return alpha(width);
1082
+ }
1083
+ function hourOptions(token) {
1084
+ const hour = numeric(token.width);
1085
+ let hourCycle;
1086
+ switch (token.char) {
1087
+ case "h":
1088
+ hourCycle = "h12";
1089
+ break;
1090
+ case "H":
1091
+ hourCycle = "h23";
1092
+ break;
1093
+ case "k":
1094
+ hourCycle = "h24";
1095
+ break;
1096
+ case "K":
1097
+ hourCycle = "h11";
1098
+ break;
1099
+ }
1100
+ return hourCycle ? { hour, hourCycle } : { hour };
1101
+ }
1102
+ function timeZoneNameStyle(token, onError) {
1103
+ const { char, desc, width } = token;
1104
+ switch (char) {
1105
+ case "v":
1106
+ case "z":
1107
+ return width === 4 ? "long" : "short";
1108
+ case "V":
1109
+ if (width === 4)
1110
+ return "long";
1111
+ onError(`${desc} is not supported with width ${width}`);
1112
+ return void 0;
1113
+ case "X":
1114
+ onError(`${desc} is not supported`);
1115
+ return void 0;
1116
+ }
1117
+ return "short";
1118
+ }
1119
+ function compileOptions(token, onError) {
1120
+ switch (token.field) {
1121
+ case "era":
1122
+ return { era: alpha(token.width) };
1123
+ case "year":
1124
+ return yearOptions(token, onError);
1125
+ case "month":
1126
+ return { month: monthStyle(token, onError) };
1127
+ case "day":
1128
+ return { day: dayStyle(token, onError) };
1129
+ case "weekday":
1130
+ return { weekday: weekdayStyle(token, onError) };
1131
+ case "period":
1132
+ return void 0;
1133
+ case "hour":
1134
+ return hourOptions(token);
1135
+ case "min":
1136
+ return { minute: numeric(token.width) };
1137
+ case "sec":
1138
+ return { second: numeric(token.width) };
1139
+ case "tz":
1140
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1141
+ case "quarter":
1142
+ case "week":
1143
+ case "sec-frac":
1144
+ case "ms":
1145
+ onError(`${token.desc} is not supported`);
1146
+ }
1147
+ return void 0;
1148
+ }
1149
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1150
+ throw error;
1151
+ }) {
1152
+ const options = {
1153
+ timeZone
1154
+ };
1155
+ const fields2 = [];
1156
+ for (const token of tokens) {
1157
+ const { error, field, str } = token;
1158
+ if (error) {
1159
+ const dte = new DateFormatError(error.message, token);
1160
+ dte.stack = error.stack;
1161
+ onError(dte);
1162
+ }
1163
+ if (str) {
1164
+ const msg = `Ignoring string part: ${str}`;
1165
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1166
+ }
1167
+ if (field) {
1168
+ if (fields2.indexOf(field) === -1)
1169
+ fields2.push(field);
1170
+ else
1171
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1172
+ }
1173
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1174
+ if (opt)
1175
+ Object.assign(options, opt);
1176
+ }
1177
+ return options;
1178
+ }
1179
+ var fields = {
1180
+ G: { field: "era", desc: "Era" },
1181
+ y: { field: "year", desc: "Year" },
1182
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1183
+ u: { field: "year", desc: "Extended year" },
1184
+ U: { field: "year", desc: "Cyclic year name" },
1185
+ r: { field: "year", desc: "Related Gregorian year" },
1186
+ Q: { field: "quarter", desc: "Quarter" },
1187
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1188
+ M: { field: "month", desc: "Month in year" },
1189
+ L: { field: "month", desc: "Stand-alone month in year" },
1190
+ w: { field: "week", desc: "Week of year" },
1191
+ W: { field: "week", desc: "Week of month" },
1192
+ d: { field: "day", desc: "Day in month" },
1193
+ D: { field: "day", desc: "Day of year" },
1194
+ F: { field: "day", desc: "Day of week in month" },
1195
+ g: { field: "day", desc: "Modified julian day" },
1196
+ E: { field: "weekday", desc: "Day of week" },
1197
+ e: { field: "weekday", desc: "Local day of week" },
1198
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1199
+ a: { field: "period", desc: "AM/PM marker" },
1200
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1201
+ B: { field: "period", desc: "Flexible day period" },
1202
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1203
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1204
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1205
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1206
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1207
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1208
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1209
+ m: { field: "min", desc: "Minute in hour" },
1210
+ s: { field: "sec", desc: "Second in minute" },
1211
+ S: { field: "sec-frac", desc: "Fractional second" },
1212
+ A: { field: "ms", desc: "Milliseconds in day" },
1213
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1214
+ Z: { field: "tz", desc: "Time Zone" },
1215
+ O: { field: "tz", desc: "Time Zone: localized" },
1216
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1217
+ V: { field: "tz", desc: "Time Zone: ID" },
1218
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1219
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1220
+ };
1221
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1222
+ function readFieldToken(src, pos) {
1223
+ const char = src[pos];
1224
+ let width = 1;
1225
+ while (src[++pos] === char)
1226
+ ++width;
1227
+ const field = fields[char];
1228
+ if (!field) {
1229
+ const msg = `The letter ${char} is not a valid field identifier`;
1230
+ return { char, error: new Error(msg), width };
1231
+ }
1232
+ return { char, field: field.field, desc: field.desc, width };
1233
+ }
1234
+ function readQuotedToken(src, pos) {
1235
+ let str = src[++pos];
1236
+ let width = 2;
1237
+ if (str === "'")
1238
+ return { char: "'", str, width };
1239
+ while (true) {
1240
+ const next = src[++pos];
1241
+ ++width;
1242
+ if (next === void 0) {
1243
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1244
+ return { char: "'", error: new Error(msg), str, width };
1245
+ } else if (next === "'") {
1246
+ if (src[++pos] !== "'")
1247
+ return { char: "'", str, width };
1248
+ else
1249
+ ++width;
1250
+ }
1251
+ str += next;
1252
+ }
1253
+ }
1254
+ function readToken(src, pos) {
1255
+ const char = src[pos];
1256
+ if (!char)
1257
+ return null;
1258
+ if (isLetter(char))
1259
+ return readFieldToken(src, pos);
1260
+ if (char === "'")
1261
+ return readQuotedToken(src, pos);
1262
+ let str = char;
1263
+ let width = 1;
1264
+ while (true) {
1265
+ const next = src[++pos];
1266
+ if (!next || isLetter(next) || next === "'")
1267
+ return { char, str, width };
1268
+ str += next;
1269
+ width += 1;
1270
+ }
1271
+ }
1272
+ function parseDateTokens(src) {
1273
+ const tokens = [];
1274
+ let pos = 0;
1275
+ while (true) {
1276
+ const token = readToken(src, pos);
1277
+ if (!token)
1278
+ return tokens;
1279
+ tokens.push(token);
1280
+ pos += token.width;
1281
+ }
1282
+ }
1025
1283
  function processTokens(tokens, mapText) {
1026
1284
  if (!tokens.filter((token) => token.type !== "content").length) {
1027
1285
  return tokens.map((token) => mapText(token.value));
@@ -1036,6 +1294,12 @@ function processTokens(tokens, mapText) {
1036
1294
  return [token.arg];
1037
1295
  } else if (token.type === "function") {
1038
1296
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1297
+ if (token.key === "date" && _param) {
1298
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1299
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1300
+ });
1301
+ return [token.arg, token.key, opts];
1302
+ }
1039
1303
  if (_param) {
1040
1304
  return [token.arg, token.key, _param.value.trim()];
1041
1305
  } else {
@@ -1057,6 +1321,13 @@ function processTokens(tokens, mapText) {
1057
1321
  ];
1058
1322
  });
1059
1323
  }
1324
+ function compileDateExpression(format, onError) {
1325
+ if (/^::/.test(format)) {
1326
+ const tokens = parseDateTokens(format.substring(2));
1327
+ return getDateFormatOptions(tokens, void 0, onError);
1328
+ }
1329
+ return format;
1330
+ }
1060
1331
  function compileMessage(message, mapText = (v) => v) {
1061
1332
  try {
1062
1333
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1068,7 +1339,7 @@ Message: ${message}`);
1068
1339
  }
1069
1340
  }
1070
1341
 
1071
- // 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
1342
+ // 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
1072
1343
  var isString = (s) => typeof s === "string";
1073
1344
  var isFunction = (f) => typeof f === "function";
1074
1345
  var cache = /* @__PURE__ */ new Map();
@@ -1079,12 +1350,59 @@ function normalizeLocales(locales) {
1079
1350
  }
1080
1351
  function date(locales, value, format) {
1081
1352
  const _locales = normalizeLocales(locales);
1353
+ if (!format) {
1354
+ format = "default";
1355
+ }
1356
+ let o;
1357
+ if (typeof format === "string") {
1358
+ o = {
1359
+ day: "numeric",
1360
+ month: "short",
1361
+ year: "numeric"
1362
+ };
1363
+ switch (format) {
1364
+ case "full":
1365
+ o.weekday = "long";
1366
+ case "long":
1367
+ o.month = "long";
1368
+ break;
1369
+ case "short":
1370
+ o.month = "numeric";
1371
+ break;
1372
+ }
1373
+ } else {
1374
+ o = format;
1375
+ }
1082
1376
  const formatter = getMemoized(
1083
1377
  () => cacheKey("date", _locales, format),
1084
- () => new Intl.DateTimeFormat(_locales, format)
1378
+ () => new Intl.DateTimeFormat(_locales, o)
1085
1379
  );
1086
1380
  return formatter.format(isString(value) ? new Date(value) : value);
1087
1381
  }
1382
+ function time(locales, value, format) {
1383
+ let o;
1384
+ if (!format) {
1385
+ format = "default";
1386
+ }
1387
+ if (typeof format === "string") {
1388
+ o = {
1389
+ second: "numeric",
1390
+ minute: "numeric",
1391
+ hour: "numeric"
1392
+ };
1393
+ switch (format) {
1394
+ case "full":
1395
+ case "long":
1396
+ o.timeZoneName = "short";
1397
+ break;
1398
+ case "short":
1399
+ delete o.second;
1400
+ }
1401
+ } else {
1402
+ o = format;
1403
+ }
1404
+ return date(locales, value, o);
1405
+ }
1088
1406
  function number(locales, value, format) {
1089
1407
  const _locales = normalizeLocales(locales);
1090
1408
  const formatter = getMemoized(
@@ -1124,7 +1442,9 @@ var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1124
1442
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1125
1443
  const locales = passedLocales || locale;
1126
1444
  const style = (format) => {
1127
- return typeof format === "object" ? format : formats[format] || { style: format };
1445
+ if (typeof format === "object")
1446
+ return format;
1447
+ return formats[format];
1128
1448
  };
1129
1449
  const replaceOctothorpe = (value, message) => {
1130
1450
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1143,8 +1463,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1143
1463
  return replaceOctothorpe(value - offset, message);
1144
1464
  },
1145
1465
  select: selectFormatter,
1146
- number: (value, format) => number(locales, value, style(format)),
1147
- date: (value, format) => date(locales, value, style(format))
1466
+ number: (value, format) => number(
1467
+ locales,
1468
+ value,
1469
+ style(format) || { style: format }
1470
+ ),
1471
+ date: (value, format) => date(locales, value, style(format) || format),
1472
+ time: (value, format) => time(locales, value, style(format) || format)
1148
1473
  };
1149
1474
  };
1150
1475
  var selectFormatter = (value, rules) => {
@@ -1193,10 +1518,10 @@ function interpolate(translation, locale, locales) {
1193
1518
  };
1194
1519
  const result = formatMessage(translation);
1195
1520
  if (isString(result) && UNICODE_REGEX.test(result)) {
1196
- return (0, import_unraw.unraw)(result.trim());
1521
+ return (0, import_unraw.unraw)(result);
1197
1522
  }
1198
1523
  if (isString(result))
1199
- return result.trim();
1524
+ return result;
1200
1525
  return result ? String(result) : "";
1201
1526
  };
1202
1527
  }
@@ -1313,9 +1638,8 @@ var I18n = class extends EventEmitter {
1313
1638
  /**
1314
1639
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1315
1640
  */
1316
- // @ts-ignore deprecated, so ignore the reported error
1317
1641
  loadLocaleData(localeOrAllData, localeData) {
1318
- if (localeData != null) {
1642
+ if (typeof localeOrAllData === "string") {
1319
1643
  this._loadLocaleData(localeOrAllData, localeData);
1320
1644
  } else {
1321
1645
  Object.keys(localeOrAllData).forEach(
@@ -1362,6 +1686,11 @@ var I18n = class extends EventEmitter {
1362
1686
  this.emit("change");
1363
1687
  }
1364
1688
  _(id, values, options) {
1689
+ if (!this.locale) {
1690
+ throw new Error(
1691
+ "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."
1692
+ );
1693
+ }
1365
1694
  let message = options == null ? void 0 : options.message;
1366
1695
  if (!id) {
1367
1696
  id = "";
@@ -1418,7 +1747,7 @@ function setupI18n(params = {}) {
1418
1747
  }
1419
1748
  var i18n = setupI18n();
1420
1749
 
1421
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
1750
+ // 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
1422
1751
  var messages = JSON.parse('{"icon.title.close":["Kryss"]}');
1423
1752
  var messages2 = JSON.parse('{"icon.title.close":["Cross"]}');
1424
1753
  var messages3 = JSON.parse('{"icon.title.close":["Rasti"]}');
@@ -1523,7 +1852,7 @@ var r = function() {
1523
1852
  }, []).join(" ");
1524
1853
  };
1525
1854
 
1526
- // 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
1855
+ // 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
1527
1856
  var pill = {
1528
1857
  wrapper: "flex items-center",
1529
1858
  button: "inline-flex items-center focusable text-xs transition-all",