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