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