@warp-ds/elements 2.0.0-next.2 → 2.0.0-next.3

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.
Files changed (45) hide show
  1. package/dist/api.js +3 -6
  2. package/dist/api.js.map +1 -1
  3. package/dist/index.js +205 -255
  4. package/dist/index.js.map +4 -4
  5. package/dist/packages/affix/index.d.ts +1 -1
  6. package/dist/packages/affix/index.js +35 -49
  7. package/dist/packages/affix/index.js.map +3 -3
  8. package/dist/packages/alert/index.js +39 -55
  9. package/dist/packages/alert/index.js.map +3 -3
  10. package/dist/packages/attention/index.js +118 -109
  11. package/dist/packages/attention/index.js.map +4 -4
  12. package/dist/packages/badge/index.js +3 -7
  13. package/dist/packages/badge/index.js.map +2 -2
  14. package/dist/packages/box/index.d.ts +1 -1
  15. package/dist/packages/box/index.js +2 -5
  16. package/dist/packages/box/index.js.map +2 -2
  17. package/dist/packages/breadcrumbs/index.js +36 -53
  18. package/dist/packages/breadcrumbs/index.js.map +3 -3
  19. package/dist/packages/broadcast/index.js +2 -6
  20. package/dist/packages/broadcast/index.js.map +1 -1
  21. package/dist/packages/button/index.js +36 -54
  22. package/dist/packages/button/index.js.map +3 -3
  23. package/dist/packages/card/index.d.ts +2 -2
  24. package/dist/packages/card/index.js +3 -7
  25. package/dist/packages/card/index.js.map +2 -2
  26. package/dist/packages/expandable/index.d.ts +2 -2
  27. package/dist/packages/expandable/index.js +52 -68
  28. package/dist/packages/expandable/index.js.map +4 -4
  29. package/dist/packages/modal/index.js +45 -69
  30. package/dist/packages/modal/index.js.map +3 -3
  31. package/dist/packages/modal/modal-header.d.ts +1 -1
  32. package/dist/packages/modal/modal-main.d.ts +3 -3
  33. package/dist/packages/pill/index.js +38 -56
  34. package/dist/packages/pill/index.js.map +3 -3
  35. package/dist/packages/select/index.js +54 -87
  36. package/dist/packages/select/index.js.map +3 -3
  37. package/dist/packages/textfield/index.js +7 -15
  38. package/dist/packages/textfield/index.js.map +2 -2
  39. package/dist/packages/toast/api.d.ts +1 -1
  40. package/dist/packages/toast/index.js +68 -110
  41. package/dist/packages/toast/index.js.map +3 -3
  42. package/dist/packages/toast/toast-container.d.ts +1 -1
  43. package/dist/packages/toast/toast.d.ts +2 -2
  44. package/dist/packages/utils/index.d.ts +1 -1
  45. package/package.json +27 -28
@@ -6,6 +6,9 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __typeError = (msg) => {
10
+ throw TypeError(msg);
11
+ };
9
12
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
13
  var __spreadValues = (a, b) => {
11
14
  for (var prop in b || (b = {}))
@@ -49,23 +52,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
49
52
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
50
53
  mod
51
54
  ));
52
- var __publicField = (obj, key, value) => {
53
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
54
- return value;
55
- };
56
- var __accessCheck = (obj, member, msg) => {
57
- if (!member.has(obj))
58
- throw TypeError("Cannot " + msg);
59
- };
60
- var __privateGet = (obj, member, getter) => {
61
- __accessCheck(obj, member, "read from private field");
62
- return getter ? getter.call(obj) : member.get(obj);
63
- };
64
- var __privateAdd = (obj, member, value) => {
65
- if (member.has(obj))
66
- throw TypeError("Cannot add the same private member more than once");
67
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
68
- };
55
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
56
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
57
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
58
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
69
59
 
70
60
  // node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js
71
61
  var require_errors = __commonJS({
@@ -238,8 +228,7 @@ var require_moo = __commonJS({
238
228
  return "(" + s + ")";
239
229
  }
240
230
  function reUnion(regexps) {
241
- if (!regexps.length)
242
- return "(?!)";
231
+ if (!regexps.length) return "(?!)";
243
232
  var source = regexps.map(function(s) {
244
233
  return "(?:" + s + ")";
245
234
  }).join("|");
@@ -249,14 +238,10 @@ var require_moo = __commonJS({
249
238
  if (typeof obj === "string") {
250
239
  return "(?:" + reEscape(obj) + ")";
251
240
  } else if (isRegExp(obj)) {
252
- if (obj.ignoreCase)
253
- throw new Error("RegExp /i flag not allowed");
254
- if (obj.global)
255
- throw new Error("RegExp /g flag is implied");
256
- if (obj.sticky)
257
- throw new Error("RegExp /y flag is implied");
258
- if (obj.multiline)
259
- throw new Error("RegExp /m flag is implied");
241
+ if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
242
+ if (obj.global) throw new Error("RegExp /g flag is implied");
243
+ if (obj.sticky) throw new Error("RegExp /y flag is implied");
244
+ if (obj.multiline) throw new Error("RegExp /m flag is implied");
260
245
  return obj.source;
261
246
  } else {
262
247
  throw new Error("Not a pattern: " + obj);
@@ -305,16 +290,14 @@ var require_moo = __commonJS({
305
290
  var match = [];
306
291
  rules.forEach(function(rule) {
307
292
  if (isObject(rule)) {
308
- if (match.length)
309
- result.push(ruleOptions(key, match));
293
+ if (match.length) result.push(ruleOptions(key, match));
310
294
  result.push(ruleOptions(key, rule));
311
295
  match = [];
312
296
  } else {
313
297
  match.push(rule);
314
298
  }
315
299
  });
316
- if (match.length)
317
- result.push(ruleOptions(key, match));
300
+ if (match.length) result.push(ruleOptions(key, match));
318
301
  }
319
302
  return result;
320
303
  }
@@ -449,8 +432,7 @@ var require_moo = __commonJS({
449
432
  var fallbackRule = errorRule && errorRule.fallback;
450
433
  var flags = hasSticky && !fallbackRule ? "ym" : "gm";
451
434
  var suffix2 = hasSticky || fallbackRule ? "" : "|";
452
- if (unicodeFlag === true)
453
- flags += "u";
435
+ if (unicodeFlag === true) flags += "u";
454
436
  var combined = new RegExp(reUnion(parts) + suffix2, flags);
455
437
  return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
456
438
  }
@@ -471,8 +453,7 @@ var require_moo = __commonJS({
471
453
  var all = states.$all ? toRules(states.$all) : [];
472
454
  delete states.$all;
473
455
  var keys = Object.getOwnPropertyNames(states);
474
- if (!start)
475
- start = keys[0];
456
+ if (!start) start = keys[0];
476
457
  var ruleMap = /* @__PURE__ */ Object.create(null);
477
458
  for (var i = 0; i < keys.length; i++) {
478
459
  var key = keys[i];
@@ -484,8 +465,7 @@ var require_moo = __commonJS({
484
465
  var included = /* @__PURE__ */ Object.create(null);
485
466
  for (var j = 0; j < rules.length; j++) {
486
467
  var rule = rules[j];
487
- if (!rule.include)
488
- continue;
468
+ if (!rule.include) continue;
489
469
  var splice = [j, 1];
490
470
  if (rule.include !== key && !included[rule.include]) {
491
471
  included[rule.include] = true;
@@ -495,8 +475,7 @@ var require_moo = __commonJS({
495
475
  }
496
476
  for (var k = 0; k < newRules.length; k++) {
497
477
  var newRule = newRules[k];
498
- if (rules.indexOf(newRule) !== -1)
499
- continue;
478
+ if (rules.indexOf(newRule) !== -1) continue;
500
479
  splice.push(newRule);
501
480
  }
502
481
  }
@@ -577,8 +556,7 @@ var require_moo = __commonJS({
577
556
  };
578
557
  };
579
558
  Lexer.prototype.setState = function(state) {
580
- if (!state || this.state === state)
581
- return;
559
+ if (!state || this.state === state) return;
582
560
  this.state = state;
583
561
  var info = this.states[state];
584
562
  this.groups = info.groups;
@@ -682,12 +660,9 @@ var require_moo = __commonJS({
682
660
  var err = new Error(this.formatError(token, "invalid syntax"));
683
661
  throw err;
684
662
  }
685
- if (group.pop)
686
- this.popState();
687
- else if (group.push)
688
- this.pushState(group.push);
689
- else if (group.next)
690
- this.setState(group.next);
663
+ if (group.pop) this.popState();
664
+ else if (group.push) this.pushState(group.push);
665
+ else if (group.next) this.setState(group.next);
691
666
  return token;
692
667
  };
693
668
  if (typeof Symbol !== "undefined" && Symbol.iterator) {
@@ -1042,8 +1017,7 @@ import { html as html2 } from "lit";
1042
1017
 
1043
1018
  // node_modules/.pnpm/@chbphone55+classnames@2.0.0/node_modules/@chbphone55/classnames/dist/index.m.js
1044
1019
  var r = function() {
1045
- for (var t = [], n = arguments.length; n--; )
1046
- t[n] = arguments[n];
1020
+ for (var t = [], n = arguments.length; n--; ) t[n] = arguments[n];
1047
1021
  return t.reduce(function(t2, n2) {
1048
1022
  return t2.concat("string" == typeof n2 ? n2 : Array.isArray(n2) ? r.apply(void 0, n2) : "object" == typeof n2 && n2 ? Object.keys(n2).map(function(r2) {
1049
1023
  return n2[r2] ? r2 : "";
@@ -1051,10 +1025,10 @@ var r = function() {
1051
1025
  }, []).join(" ");
1052
1026
  };
1053
1027
 
1054
- // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1028
+ // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1055
1029
  var import_unraw = __toESM(require_dist(), 1);
1056
1030
 
1057
- // node_modules/.pnpm/@lingui+message-utils@4.7.1/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1031
+ // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1058
1032
  var import_parser = __toESM(require_parser(), 1);
1059
1033
  function processTokens(tokens, mapText) {
1060
1034
  if (!tokens.filter((token) => token.type !== "content").length) {
@@ -1078,11 +1052,9 @@ function processTokens(tokens, mapText) {
1078
1052
  }
1079
1053
  const offset = token.pluralOffset;
1080
1054
  const formatProps = {};
1081
- token.cases.forEach((item) => {
1082
- formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
1083
- item.tokens,
1084
- mapText
1085
- );
1055
+ token.cases.forEach(({ key, tokens: tokens2 }) => {
1056
+ const prop = key[0] === "=" ? key.slice(1) : key;
1057
+ formatProps[prop] = processTokens(tokens2, mapText);
1086
1058
  });
1087
1059
  return [
1088
1060
  token.arg,
@@ -1104,7 +1076,7 @@ Message: ${message}`);
1104
1076
  }
1105
1077
  }
1106
1078
 
1107
- // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1079
+ // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1108
1080
  var isString = (s) => typeof s === "string";
1109
1081
  var isFunction = (f) => typeof f === "function";
1110
1082
  var cache = /* @__PURE__ */ new Map();
@@ -1190,11 +1162,11 @@ var selectFormatter = (value, rules) => {
1190
1162
  function interpolate(translation, locale, locales) {
1191
1163
  return (values = {}, formats) => {
1192
1164
  const formatters = getDefaultFormats(locale, locales, formats);
1193
- const formatMessage = (tokens) => {
1165
+ const formatMessage = (tokens, replaceOctothorpe = false) => {
1194
1166
  if (!Array.isArray(tokens))
1195
1167
  return tokens;
1196
1168
  return tokens.reduce((message, token) => {
1197
- if (token === "#") {
1169
+ if (token === "#" && replaceOctothorpe) {
1198
1170
  return message + OCTOTHORPE_PH;
1199
1171
  }
1200
1172
  if (isString(token)) {
@@ -1205,7 +1177,10 @@ function interpolate(translation, locale, locales) {
1205
1177
  if (type === "plural" || type === "selectordinal" || type === "select") {
1206
1178
  Object.entries(format).forEach(
1207
1179
  ([key, value2]) => {
1208
- interpolatedFormat[key] = formatMessage(value2);
1180
+ interpolatedFormat[key] = formatMessage(
1181
+ value2,
1182
+ type === "plural" || type === "selectordinal"
1183
+ );
1209
1184
  }
1210
1185
  );
1211
1186
  } else {
@@ -1373,6 +1348,9 @@ var I18n = class extends EventEmitter {
1373
1348
  }
1374
1349
  _(id, values, options) {
1375
1350
  let message = options == null ? void 0 : options.message;
1351
+ if (!id) {
1352
+ id = "";
1353
+ }
1376
1354
  if (!isString(id)) {
1377
1355
  values = id.values || values;
1378
1356
  message = id.message;
@@ -1413,7 +1391,7 @@ function setupI18n(params = {}) {
1413
1391
  }
1414
1392
  var i18n = setupI18n();
1415
1393
 
1416
- // node_modules/.pnpm/@warp-ds+css@2.0.0-next.4_@warp-ds+uno@2.0.0_unocss@0.58.5_postcss@8.4.38_rollup@4.18.0_vite@_d2fzbudswaxjysaqn4v4imsdwy/node_modules/@warp-ds/css/component-classes/index.js
1394
+ // node_modules/.pnpm/@warp-ds+css@2.0.0-next.4_@warp-ds+uno@2.0.0_unocss@0.61.3_postcss@8.4.39_rollup@4.18.1_vite@_fn7nbuinwdlc4yeboswpxt5lie/node_modules/@warp-ds/css/component-classes/index.js
1417
1395
  var box = {
1418
1396
  box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
1419
1397
  // Relative here enables w-clickable
@@ -1729,12 +1707,9 @@ function detectLocale() {
1729
1707
  }
1730
1708
  }
1731
1709
  var getMessages = (locale, enMsg, nbMsg, fiMsg, daMsg) => {
1732
- if (locale === "nb")
1733
- return nbMsg;
1734
- if (locale === "fi")
1735
- return fiMsg;
1736
- if (locale === "da")
1737
- return daMsg;
1710
+ if (locale === "nb") return nbMsg;
1711
+ if (locale === "fi") return fiMsg;
1712
+ if (locale === "da") return daMsg;
1738
1713
  return enMsg;
1739
1714
  };
1740
1715
  var activateI18n = (enMessages, nbMessages, fiMessages, daMessages) => {
@@ -1773,7 +1748,7 @@ var messages3 = JSON.parse('{"select.label.optional":"(vapaaehtoinen)"}');
1773
1748
  // packages/select/locales/nb/messages.mjs
1774
1749
  var messages4 = JSON.parse('{"select.label.optional":"(valgfritt)"}');
1775
1750
 
1776
- // node_modules/.pnpm/@warp-ds+icons@2.0.1/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1751
+ // node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1777
1752
  import { LitElement } from "lit";
1778
1753
  import { unsafeStatic, html } from "lit/static-html.js";
1779
1754
  var messages5 = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
@@ -1865,15 +1840,11 @@ if (!customElements.get("w-icon-chevron-down-16")) {
1865
1840
  }
1866
1841
 
1867
1842
  // packages/select/index.js
1868
- var _classes, classes_get, _helpTextClasses, helpTextClasses_get, _chevronClasses, chevronClasses_get, _id, id_get, _helpId, helpId_get;
1843
+ var _WarpSelect_instances, classes_get, helpTextClasses_get, chevronClasses_get, id_get, helpId_get;
1869
1844
  var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
1870
1845
  constructor() {
1871
1846
  super();
1872
- __privateAdd(this, _classes);
1873
- __privateAdd(this, _helpTextClasses);
1874
- __privateAdd(this, _chevronClasses);
1875
- __privateAdd(this, _id);
1876
- __privateAdd(this, _helpId);
1847
+ __privateAdd(this, _WarpSelect_instances);
1877
1848
  activateI18n(messages2, messages4, messages3, messages);
1878
1849
  this._options = this.innerHTML;
1879
1850
  }
@@ -1881,7 +1852,7 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
1881
1852
  return html2`<div class="${select.wrapper}">
1882
1853
  ${when(
1883
1854
  this.label,
1884
- () => html2`<label class="${label.label}" for="${__privateGet(this, _id, id_get)}">
1855
+ () => html2`<label class="${label.label}" for="${__privateGet(this, _WarpSelect_instances, id_get)}">
1885
1856
  ${this.label}
1886
1857
  ${when(
1887
1858
  this.optional,
@@ -1897,30 +1868,29 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
1897
1868
  )}
1898
1869
  <div class="${select.selectWrapper}">
1899
1870
  <select
1900
- class="${__privateGet(this, _classes, classes_get)}"
1901
- id="${__privateGet(this, _id, id_get)}"
1871
+ class="${__privateGet(this, _WarpSelect_instances, classes_get)}"
1872
+ id="${__privateGet(this, _WarpSelect_instances, id_get)}"
1902
1873
  ?autofocus=${this.autoFocus}
1903
- aria-describedby="${ifDefined(__privateGet(this, _helpId, helpId_get))}"
1874
+ aria-describedby="${ifDefined(__privateGet(this, _WarpSelect_instances, helpId_get))}"
1904
1875
  aria-invalid="${ifDefined(this.invalid)}"
1905
- aria-errormessage="${ifDefined(this.invalid && __privateGet(this, _helpId, helpId_get))}">
1876
+ aria-errormessage="${ifDefined(this.invalid && __privateGet(this, _WarpSelect_instances, helpId_get))}">
1906
1877
  ${unsafeHTML(this._options)}
1907
1878
  </select>
1908
- <div class="${__privateGet(this, _chevronClasses, chevronClasses_get)}">
1879
+ <div class="${__privateGet(this, _WarpSelect_instances, chevronClasses_get)}">
1909
1880
  <w-icon-chevron-down-16></w-icon-chevron-down-16>
1910
1881
  </div>
1911
1882
  </div>
1912
- ${when(this.always || this.invalid, () => html2`<div id="${__privateGet(this, _helpId, helpId_get)}" class="${__privateGet(this, _helpTextClasses, helpTextClasses_get)}">${this.hint}</div>`)}
1883
+ ${when(this.always || this.invalid, () => html2`<div id="${__privateGet(this, _WarpSelect_instances, helpId_get)}" class="${__privateGet(this, _WarpSelect_instances, helpTextClasses_get)}">${this.hint}</div>`)}
1913
1884
  </div>`;
1914
1885
  }
1915
1886
  };
1916
- _classes = new WeakSet();
1887
+ _WarpSelect_instances = new WeakSet();
1917
1888
  classes_get = function() {
1918
1889
  return r({
1919
1890
  [select.default]: true,
1920
1891
  [select.invalid]: this.invalid
1921
1892
  });
1922
1893
  };
1923
- _helpTextClasses = new WeakSet();
1924
1894
  helpTextClasses_get = function() {
1925
1895
  return r({
1926
1896
  [helpText.helpText]: true,
@@ -1928,20 +1898,17 @@ helpTextClasses_get = function() {
1928
1898
  [helpText.helpTextColorInvalid]: this.invalid
1929
1899
  });
1930
1900
  };
1931
- _chevronClasses = new WeakSet();
1932
1901
  chevronClasses_get = function() {
1933
1902
  return r({
1934
1903
  [select.chevron]: true,
1935
1904
  [select.chevronDisabled]: this.disabled
1936
1905
  });
1937
1906
  };
1938
- _id = new WeakSet();
1939
1907
  id_get = function() {
1940
1908
  return "select_id";
1941
1909
  };
1942
- _helpId = new WeakSet();
1943
1910
  helpId_get = function() {
1944
- return this.hint ? `${__privateGet(this, _id, id_get)}__hint` : void 0;
1911
+ return this.hint ? `${__privateGet(this, _WarpSelect_instances, id_get)}__hint` : void 0;
1945
1912
  };
1946
1913
  __publicField(WarpSelect, "properties", {
1947
1914
  // Whether the element should receive focus on render