@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,11 +1026,269 @@ var r = function() {
1026
1026
  }, []).join(" ");
1027
1027
  };
1028
1028
 
1029
- // 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
1029
+ // 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
1030
1030
  var import_unraw = __toESM(require_dist(), 1);
1031
1031
 
1032
- // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1032
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1033
1033
  var import_parser = __toESM(require_parser(), 1);
1034
+ var DateFormatError = class extends Error {
1035
+ /** @internal */
1036
+ constructor(msg, token, type) {
1037
+ super(msg);
1038
+ this.token = token;
1039
+ this.type = type || "error";
1040
+ }
1041
+ };
1042
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1043
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1044
+ function yearOptions(token, onError) {
1045
+ switch (token.char) {
1046
+ case "y":
1047
+ return { year: numeric(token.width) };
1048
+ case "r":
1049
+ return { calendar: "gregory", year: "numeric" };
1050
+ case "u":
1051
+ case "U":
1052
+ case "Y":
1053
+ default:
1054
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1055
+ return { year: "numeric" };
1056
+ }
1057
+ }
1058
+ function monthStyle(token, onError) {
1059
+ switch (token.width) {
1060
+ case 1:
1061
+ return "numeric";
1062
+ case 2:
1063
+ return "2-digit";
1064
+ case 3:
1065
+ return "short";
1066
+ case 4:
1067
+ return "long";
1068
+ case 5:
1069
+ return "narrow";
1070
+ default:
1071
+ onError(`${token.desc} is not supported with width ${token.width}`);
1072
+ return void 0;
1073
+ }
1074
+ }
1075
+ function dayStyle(token, onError) {
1076
+ const { char, desc, width } = token;
1077
+ if (char === "d") {
1078
+ return numeric(width);
1079
+ } else {
1080
+ onError(`${desc} is not supported`);
1081
+ return void 0;
1082
+ }
1083
+ }
1084
+ function weekdayStyle(token, onError) {
1085
+ const { char, desc, width } = token;
1086
+ if ((char === "c" || char === "e") && width < 3) {
1087
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1088
+ onError(msg, DateFormatError.WARNING);
1089
+ }
1090
+ return alpha(width);
1091
+ }
1092
+ function hourOptions(token) {
1093
+ const hour = numeric(token.width);
1094
+ let hourCycle;
1095
+ switch (token.char) {
1096
+ case "h":
1097
+ hourCycle = "h12";
1098
+ break;
1099
+ case "H":
1100
+ hourCycle = "h23";
1101
+ break;
1102
+ case "k":
1103
+ hourCycle = "h24";
1104
+ break;
1105
+ case "K":
1106
+ hourCycle = "h11";
1107
+ break;
1108
+ }
1109
+ return hourCycle ? { hour, hourCycle } : { hour };
1110
+ }
1111
+ function timeZoneNameStyle(token, onError) {
1112
+ const { char, desc, width } = token;
1113
+ switch (char) {
1114
+ case "v":
1115
+ case "z":
1116
+ return width === 4 ? "long" : "short";
1117
+ case "V":
1118
+ if (width === 4)
1119
+ return "long";
1120
+ onError(`${desc} is not supported with width ${width}`);
1121
+ return void 0;
1122
+ case "X":
1123
+ onError(`${desc} is not supported`);
1124
+ return void 0;
1125
+ }
1126
+ return "short";
1127
+ }
1128
+ function compileOptions(token, onError) {
1129
+ switch (token.field) {
1130
+ case "era":
1131
+ return { era: alpha(token.width) };
1132
+ case "year":
1133
+ return yearOptions(token, onError);
1134
+ case "month":
1135
+ return { month: monthStyle(token, onError) };
1136
+ case "day":
1137
+ return { day: dayStyle(token, onError) };
1138
+ case "weekday":
1139
+ return { weekday: weekdayStyle(token, onError) };
1140
+ case "period":
1141
+ return void 0;
1142
+ case "hour":
1143
+ return hourOptions(token);
1144
+ case "min":
1145
+ return { minute: numeric(token.width) };
1146
+ case "sec":
1147
+ return { second: numeric(token.width) };
1148
+ case "tz":
1149
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1150
+ case "quarter":
1151
+ case "week":
1152
+ case "sec-frac":
1153
+ case "ms":
1154
+ onError(`${token.desc} is not supported`);
1155
+ }
1156
+ return void 0;
1157
+ }
1158
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1159
+ throw error;
1160
+ }) {
1161
+ const options = {
1162
+ timeZone
1163
+ };
1164
+ const fields2 = [];
1165
+ for (const token of tokens) {
1166
+ const { error, field, str } = token;
1167
+ if (error) {
1168
+ const dte = new DateFormatError(error.message, token);
1169
+ dte.stack = error.stack;
1170
+ onError(dte);
1171
+ }
1172
+ if (str) {
1173
+ const msg = `Ignoring string part: ${str}`;
1174
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1175
+ }
1176
+ if (field) {
1177
+ if (fields2.indexOf(field) === -1)
1178
+ fields2.push(field);
1179
+ else
1180
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1181
+ }
1182
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1183
+ if (opt)
1184
+ Object.assign(options, opt);
1185
+ }
1186
+ return options;
1187
+ }
1188
+ var fields = {
1189
+ G: { field: "era", desc: "Era" },
1190
+ y: { field: "year", desc: "Year" },
1191
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1192
+ u: { field: "year", desc: "Extended year" },
1193
+ U: { field: "year", desc: "Cyclic year name" },
1194
+ r: { field: "year", desc: "Related Gregorian year" },
1195
+ Q: { field: "quarter", desc: "Quarter" },
1196
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1197
+ M: { field: "month", desc: "Month in year" },
1198
+ L: { field: "month", desc: "Stand-alone month in year" },
1199
+ w: { field: "week", desc: "Week of year" },
1200
+ W: { field: "week", desc: "Week of month" },
1201
+ d: { field: "day", desc: "Day in month" },
1202
+ D: { field: "day", desc: "Day of year" },
1203
+ F: { field: "day", desc: "Day of week in month" },
1204
+ g: { field: "day", desc: "Modified julian day" },
1205
+ E: { field: "weekday", desc: "Day of week" },
1206
+ e: { field: "weekday", desc: "Local day of week" },
1207
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1208
+ a: { field: "period", desc: "AM/PM marker" },
1209
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1210
+ B: { field: "period", desc: "Flexible day period" },
1211
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1212
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1213
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1214
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1215
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1216
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1217
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1218
+ m: { field: "min", desc: "Minute in hour" },
1219
+ s: { field: "sec", desc: "Second in minute" },
1220
+ S: { field: "sec-frac", desc: "Fractional second" },
1221
+ A: { field: "ms", desc: "Milliseconds in day" },
1222
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1223
+ Z: { field: "tz", desc: "Time Zone" },
1224
+ O: { field: "tz", desc: "Time Zone: localized" },
1225
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1226
+ V: { field: "tz", desc: "Time Zone: ID" },
1227
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1228
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1229
+ };
1230
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1231
+ function readFieldToken(src, pos) {
1232
+ const char = src[pos];
1233
+ let width = 1;
1234
+ while (src[++pos] === char)
1235
+ ++width;
1236
+ const field = fields[char];
1237
+ if (!field) {
1238
+ const msg = `The letter ${char} is not a valid field identifier`;
1239
+ return { char, error: new Error(msg), width };
1240
+ }
1241
+ return { char, field: field.field, desc: field.desc, width };
1242
+ }
1243
+ function readQuotedToken(src, pos) {
1244
+ let str = src[++pos];
1245
+ let width = 2;
1246
+ if (str === "'")
1247
+ return { char: "'", str, width };
1248
+ while (true) {
1249
+ const next = src[++pos];
1250
+ ++width;
1251
+ if (next === void 0) {
1252
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1253
+ return { char: "'", error: new Error(msg), str, width };
1254
+ } else if (next === "'") {
1255
+ if (src[++pos] !== "'")
1256
+ return { char: "'", str, width };
1257
+ else
1258
+ ++width;
1259
+ }
1260
+ str += next;
1261
+ }
1262
+ }
1263
+ function readToken(src, pos) {
1264
+ const char = src[pos];
1265
+ if (!char)
1266
+ return null;
1267
+ if (isLetter(char))
1268
+ return readFieldToken(src, pos);
1269
+ if (char === "'")
1270
+ return readQuotedToken(src, pos);
1271
+ let str = char;
1272
+ let width = 1;
1273
+ while (true) {
1274
+ const next = src[++pos];
1275
+ if (!next || isLetter(next) || next === "'")
1276
+ return { char, str, width };
1277
+ str += next;
1278
+ width += 1;
1279
+ }
1280
+ }
1281
+ function parseDateTokens(src) {
1282
+ const tokens = [];
1283
+ let pos = 0;
1284
+ while (true) {
1285
+ const token = readToken(src, pos);
1286
+ if (!token)
1287
+ return tokens;
1288
+ tokens.push(token);
1289
+ pos += token.width;
1290
+ }
1291
+ }
1034
1292
  function processTokens(tokens, mapText) {
1035
1293
  if (!tokens.filter((token) => token.type !== "content").length) {
1036
1294
  return tokens.map((token) => mapText(token.value));
@@ -1045,6 +1303,12 @@ function processTokens(tokens, mapText) {
1045
1303
  return [token.arg];
1046
1304
  } else if (token.type === "function") {
1047
1305
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1306
+ if (token.key === "date" && _param) {
1307
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1308
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1309
+ });
1310
+ return [token.arg, token.key, opts];
1311
+ }
1048
1312
  if (_param) {
1049
1313
  return [token.arg, token.key, _param.value.trim()];
1050
1314
  } else {
@@ -1066,6 +1330,13 @@ function processTokens(tokens, mapText) {
1066
1330
  ];
1067
1331
  });
1068
1332
  }
1333
+ function compileDateExpression(format, onError) {
1334
+ if (/^::/.test(format)) {
1335
+ const tokens = parseDateTokens(format.substring(2));
1336
+ return getDateFormatOptions(tokens, void 0, onError);
1337
+ }
1338
+ return format;
1339
+ }
1069
1340
  function compileMessage(message, mapText = (v) => v) {
1070
1341
  try {
1071
1342
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1077,7 +1348,7 @@ Message: ${message}`);
1077
1348
  }
1078
1349
  }
1079
1350
 
1080
- // 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
1351
+ // 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
1081
1352
  var isString = (s) => typeof s === "string";
1082
1353
  var isFunction = (f) => typeof f === "function";
1083
1354
  var cache = /* @__PURE__ */ new Map();
@@ -1088,12 +1359,59 @@ function normalizeLocales(locales) {
1088
1359
  }
1089
1360
  function date(locales, value, format) {
1090
1361
  const _locales = normalizeLocales(locales);
1362
+ if (!format) {
1363
+ format = "default";
1364
+ }
1365
+ let o;
1366
+ if (typeof format === "string") {
1367
+ o = {
1368
+ day: "numeric",
1369
+ month: "short",
1370
+ year: "numeric"
1371
+ };
1372
+ switch (format) {
1373
+ case "full":
1374
+ o.weekday = "long";
1375
+ case "long":
1376
+ o.month = "long";
1377
+ break;
1378
+ case "short":
1379
+ o.month = "numeric";
1380
+ break;
1381
+ }
1382
+ } else {
1383
+ o = format;
1384
+ }
1091
1385
  const formatter = getMemoized(
1092
1386
  () => cacheKey("date", _locales, format),
1093
- () => new Intl.DateTimeFormat(_locales, format)
1387
+ () => new Intl.DateTimeFormat(_locales, o)
1094
1388
  );
1095
1389
  return formatter.format(isString(value) ? new Date(value) : value);
1096
1390
  }
1391
+ function time(locales, value, format) {
1392
+ let o;
1393
+ if (!format) {
1394
+ format = "default";
1395
+ }
1396
+ if (typeof format === "string") {
1397
+ o = {
1398
+ second: "numeric",
1399
+ minute: "numeric",
1400
+ hour: "numeric"
1401
+ };
1402
+ switch (format) {
1403
+ case "full":
1404
+ case "long":
1405
+ o.timeZoneName = "short";
1406
+ break;
1407
+ case "short":
1408
+ delete o.second;
1409
+ }
1410
+ } else {
1411
+ o = format;
1412
+ }
1413
+ return date(locales, value, o);
1414
+ }
1097
1415
  function number(locales, value, format) {
1098
1416
  const _locales = normalizeLocales(locales);
1099
1417
  const formatter = getMemoized(
@@ -1133,7 +1451,9 @@ var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1133
1451
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1134
1452
  const locales = passedLocales || locale;
1135
1453
  const style = (format) => {
1136
- return typeof format === "object" ? format : formats[format] || { style: format };
1454
+ if (typeof format === "object")
1455
+ return format;
1456
+ return formats[format];
1137
1457
  };
1138
1458
  const replaceOctothorpe = (value, message) => {
1139
1459
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1152,8 +1472,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1152
1472
  return replaceOctothorpe(value - offset, message);
1153
1473
  },
1154
1474
  select: selectFormatter,
1155
- number: (value, format) => number(locales, value, style(format)),
1156
- date: (value, format) => date(locales, value, style(format))
1475
+ number: (value, format) => number(
1476
+ locales,
1477
+ value,
1478
+ style(format) || { style: format }
1479
+ ),
1480
+ date: (value, format) => date(locales, value, style(format) || format),
1481
+ time: (value, format) => time(locales, value, style(format) || format)
1157
1482
  };
1158
1483
  };
1159
1484
  var selectFormatter = (value, rules) => {
@@ -1202,10 +1527,10 @@ function interpolate(translation, locale, locales) {
1202
1527
  };
1203
1528
  const result = formatMessage(translation);
1204
1529
  if (isString(result) && UNICODE_REGEX.test(result)) {
1205
- return (0, import_unraw.unraw)(result.trim());
1530
+ return (0, import_unraw.unraw)(result);
1206
1531
  }
1207
1532
  if (isString(result))
1208
- return result.trim();
1533
+ return result;
1209
1534
  return result ? String(result) : "";
1210
1535
  };
1211
1536
  }
@@ -1322,9 +1647,8 @@ var I18n = class extends EventEmitter {
1322
1647
  /**
1323
1648
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1324
1649
  */
1325
- // @ts-ignore deprecated, so ignore the reported error
1326
1650
  loadLocaleData(localeOrAllData, localeData) {
1327
- if (localeData != null) {
1651
+ if (typeof localeOrAllData === "string") {
1328
1652
  this._loadLocaleData(localeOrAllData, localeData);
1329
1653
  } else {
1330
1654
  Object.keys(localeOrAllData).forEach(
@@ -1371,6 +1695,11 @@ var I18n = class extends EventEmitter {
1371
1695
  this.emit("change");
1372
1696
  }
1373
1697
  _(id, values, options) {
1698
+ if (!this.locale) {
1699
+ throw new Error(
1700
+ "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."
1701
+ );
1702
+ }
1374
1703
  let message = options == null ? void 0 : options.message;
1375
1704
  if (!id) {
1376
1705
  id = "";
@@ -1427,7 +1756,7 @@ function setupI18n(params = {}) {
1427
1756
  }
1428
1757
  var i18n = setupI18n();
1429
1758
 
1430
- // 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
1759
+ // 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
1431
1760
  var card = {
1432
1761
  base: "cursor-pointer overflow-hidden relative transition-all",
1433
1762
  shadow: "group rounded-8 s-surface-elevated-200 hover:s-surface-elevated-200-hover active:s-surface-elevated-200-active",