@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
@@ -52,10 +52,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
52
52
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
53
53
  mod
54
54
  ));
55
- var __publicField = (obj, key, value) => {
56
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
57
- return value;
58
- };
55
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
59
56
 
60
57
  // node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js
61
58
  var require_errors = __commonJS({
@@ -228,8 +225,7 @@ var require_moo = __commonJS({
228
225
  return "(" + s + ")";
229
226
  }
230
227
  function reUnion(regexps) {
231
- if (!regexps.length)
232
- return "(?!)";
228
+ if (!regexps.length) return "(?!)";
233
229
  var source = regexps.map(function(s) {
234
230
  return "(?:" + s + ")";
235
231
  }).join("|");
@@ -239,14 +235,10 @@ var require_moo = __commonJS({
239
235
  if (typeof obj === "string") {
240
236
  return "(?:" + reEscape(obj) + ")";
241
237
  } else if (isRegExp(obj)) {
242
- if (obj.ignoreCase)
243
- throw new Error("RegExp /i flag not allowed");
244
- if (obj.global)
245
- throw new Error("RegExp /g flag is implied");
246
- if (obj.sticky)
247
- throw new Error("RegExp /y flag is implied");
248
- if (obj.multiline)
249
- throw new Error("RegExp /m flag is implied");
238
+ if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
239
+ if (obj.global) throw new Error("RegExp /g flag is implied");
240
+ if (obj.sticky) throw new Error("RegExp /y flag is implied");
241
+ if (obj.multiline) throw new Error("RegExp /m flag is implied");
250
242
  return obj.source;
251
243
  } else {
252
244
  throw new Error("Not a pattern: " + obj);
@@ -295,16 +287,14 @@ var require_moo = __commonJS({
295
287
  var match = [];
296
288
  rules.forEach(function(rule) {
297
289
  if (isObject(rule)) {
298
- if (match.length)
299
- result.push(ruleOptions(key, match));
290
+ if (match.length) result.push(ruleOptions(key, match));
300
291
  result.push(ruleOptions(key, rule));
301
292
  match = [];
302
293
  } else {
303
294
  match.push(rule);
304
295
  }
305
296
  });
306
- if (match.length)
307
- result.push(ruleOptions(key, match));
297
+ if (match.length) result.push(ruleOptions(key, match));
308
298
  }
309
299
  return result;
310
300
  }
@@ -439,8 +429,7 @@ var require_moo = __commonJS({
439
429
  var fallbackRule = errorRule && errorRule.fallback;
440
430
  var flags = hasSticky && !fallbackRule ? "ym" : "gm";
441
431
  var suffix2 = hasSticky || fallbackRule ? "" : "|";
442
- if (unicodeFlag === true)
443
- flags += "u";
432
+ if (unicodeFlag === true) flags += "u";
444
433
  var combined = new RegExp(reUnion(parts) + suffix2, flags);
445
434
  return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
446
435
  }
@@ -461,8 +450,7 @@ var require_moo = __commonJS({
461
450
  var all = states.$all ? toRules(states.$all) : [];
462
451
  delete states.$all;
463
452
  var keys = Object.getOwnPropertyNames(states);
464
- if (!start)
465
- start = keys[0];
453
+ if (!start) start = keys[0];
466
454
  var ruleMap = /* @__PURE__ */ Object.create(null);
467
455
  for (var i2 = 0; i2 < keys.length; i2++) {
468
456
  var key = keys[i2];
@@ -474,8 +462,7 @@ var require_moo = __commonJS({
474
462
  var included = /* @__PURE__ */ Object.create(null);
475
463
  for (var j = 0; j < rules.length; j++) {
476
464
  var rule = rules[j];
477
- if (!rule.include)
478
- continue;
465
+ if (!rule.include) continue;
479
466
  var splice = [j, 1];
480
467
  if (rule.include !== key && !included[rule.include]) {
481
468
  included[rule.include] = true;
@@ -485,8 +472,7 @@ var require_moo = __commonJS({
485
472
  }
486
473
  for (var k = 0; k < newRules.length; k++) {
487
474
  var newRule = newRules[k];
488
- if (rules.indexOf(newRule) !== -1)
489
- continue;
475
+ if (rules.indexOf(newRule) !== -1) continue;
490
476
  splice.push(newRule);
491
477
  }
492
478
  }
@@ -567,8 +553,7 @@ var require_moo = __commonJS({
567
553
  };
568
554
  };
569
555
  Lexer.prototype.setState = function(state) {
570
- if (!state || this.state === state)
571
- return;
556
+ if (!state || this.state === state) return;
572
557
  this.state = state;
573
558
  var info = this.states[state];
574
559
  this.groups = info.groups;
@@ -672,12 +657,9 @@ var require_moo = __commonJS({
672
657
  var err = new Error(this.formatError(token, "invalid syntax"));
673
658
  throw err;
674
659
  }
675
- if (group.pop)
676
- this.popState();
677
- else if (group.push)
678
- this.pushState(group.push);
679
- else if (group.next)
680
- this.setState(group.next);
660
+ if (group.pop) this.popState();
661
+ else if (group.push) this.pushState(group.push);
662
+ else if (group.next) this.setState(group.next);
681
663
  return token;
682
664
  };
683
665
  if (typeof Symbol !== "undefined" && Symbol.iterator) {
@@ -1030,7 +1012,7 @@ var require_parser = __commonJS({
1030
1012
  // packages/modal/modal-footer.js
1031
1013
  import { html } from "lit";
1032
1014
 
1033
- // 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
1015
+ // 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
1034
1016
  var box = {
1035
1017
  box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
1036
1018
  // Relative here enables w-clickable
@@ -1381,8 +1363,7 @@ var windowExists = typeof window !== "undefined";
1381
1363
  if (windowExists) {
1382
1364
  const query = window.matchMedia("(prefers-reduced-motion: reduce)");
1383
1365
  const callback = ({ matches }) => reduceMotion = matches;
1384
- if (query.addEventListener)
1385
- query.addEventListener("change", callback);
1366
+ if (query.addEventListener) query.addEventListener("change", callback);
1386
1367
  callback(query);
1387
1368
  }
1388
1369
 
@@ -1413,8 +1394,7 @@ var Move = class {
1413
1394
  }
1414
1395
  async play() {
1415
1396
  this.last = this.el.getBoundingClientRect();
1416
- if (!this.el.animate)
1417
- return;
1397
+ if (!this.el.animate) return;
1418
1398
  const animation = this.el.animate(this.keyframes, this.animationOptions);
1419
1399
  await animation.finished;
1420
1400
  }
@@ -1428,22 +1408,20 @@ var Move = class {
1428
1408
  return __spreadValues(__spreadValues({}, this.defaults), this.userAnimationOptions);
1429
1409
  }
1430
1410
  get animationOptions() {
1431
- if (!this.shouldReduceMotion)
1432
- return this.mergedOptions;
1433
- if (!reduceMotion)
1434
- return this.mergedOptions;
1411
+ if (!this.shouldReduceMotion) return this.mergedOptions;
1412
+ if (!reduceMotion) return this.mergedOptions;
1435
1413
  return __spreadProps(__spreadValues({}, this.mergedOptions), { duration: 0 });
1436
1414
  }
1437
1415
  };
1438
1416
 
1439
- // node_modules/.pnpm/@warp-ds+icons@2.0.1/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
1417
+ // node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
1440
1418
  import { LitElement } from "lit";
1441
1419
  import { unsafeStatic, html as html2 } from "lit/static-html.js";
1442
1420
 
1443
- // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1421
+ // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1444
1422
  var import_unraw = __toESM(require_dist(), 1);
1445
1423
 
1446
- // node_modules/.pnpm/@lingui+message-utils@4.7.1/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1424
+ // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1447
1425
  var import_parser = __toESM(require_parser(), 1);
1448
1426
  function processTokens(tokens, mapText) {
1449
1427
  if (!tokens.filter((token) => token.type !== "content").length) {
@@ -1467,11 +1445,9 @@ function processTokens(tokens, mapText) {
1467
1445
  }
1468
1446
  const offset = token.pluralOffset;
1469
1447
  const formatProps = {};
1470
- token.cases.forEach((item) => {
1471
- formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
1472
- item.tokens,
1473
- mapText
1474
- );
1448
+ token.cases.forEach(({ key, tokens: tokens2 }) => {
1449
+ const prop = key[0] === "=" ? key.slice(1) : key;
1450
+ formatProps[prop] = processTokens(tokens2, mapText);
1475
1451
  });
1476
1452
  return [
1477
1453
  token.arg,
@@ -1493,7 +1469,7 @@ Message: ${message}`);
1493
1469
  }
1494
1470
  }
1495
1471
 
1496
- // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1472
+ // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1497
1473
  var isString = (s) => typeof s === "string";
1498
1474
  var isFunction = (f2) => typeof f2 === "function";
1499
1475
  var cache = /* @__PURE__ */ new Map();
@@ -1579,11 +1555,11 @@ var selectFormatter = (value, rules) => {
1579
1555
  function interpolate(translation, locale, locales) {
1580
1556
  return (values = {}, formats) => {
1581
1557
  const formatters = getDefaultFormats(locale, locales, formats);
1582
- const formatMessage = (tokens) => {
1558
+ const formatMessage = (tokens, replaceOctothorpe = false) => {
1583
1559
  if (!Array.isArray(tokens))
1584
1560
  return tokens;
1585
1561
  return tokens.reduce((message, token) => {
1586
- if (token === "#") {
1562
+ if (token === "#" && replaceOctothorpe) {
1587
1563
  return message + OCTOTHORPE_PH;
1588
1564
  }
1589
1565
  if (isString(token)) {
@@ -1594,7 +1570,10 @@ function interpolate(translation, locale, locales) {
1594
1570
  if (type === "plural" || type === "selectordinal" || type === "select") {
1595
1571
  Object.entries(format).forEach(
1596
1572
  ([key, value2]) => {
1597
- interpolatedFormat[key] = formatMessage(value2);
1573
+ interpolatedFormat[key] = formatMessage(
1574
+ value2,
1575
+ type === "plural" || type === "selectordinal"
1576
+ );
1598
1577
  }
1599
1578
  );
1600
1579
  } else {
@@ -1762,6 +1741,9 @@ var I18n = class extends EventEmitter {
1762
1741
  }
1763
1742
  _(id, values, options) {
1764
1743
  let message = options == null ? void 0 : options.message;
1744
+ if (!id) {
1745
+ id = "";
1746
+ }
1765
1747
  if (!isString(id)) {
1766
1748
  values = id.values || values;
1767
1749
  message = id.message;
@@ -1802,7 +1784,7 @@ function setupI18n(params = {}) {
1802
1784
  }
1803
1785
  var i18n = setupI18n();
1804
1786
 
1805
- // node_modules/.pnpm/@warp-ds+icons@2.0.1/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
1787
+ // node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
1806
1788
  var messages = JSON.parse('{"icon.title.arrow-left":"Pil som peker mot venstre"}');
1807
1789
  var messages2 = JSON.parse('{"icon.title.arrow-left":"Leftward-pointing arrow"}');
1808
1790
  var messages3 = JSON.parse('{"icon.title.arrow-left":"Vasemmalle osoittava nuoli"}');
@@ -1891,7 +1873,7 @@ if (!customElements.get("w-icon-arrow-left-16")) {
1891
1873
  customElements.define("w-icon-arrow-left-16", IconArrowLeft16);
1892
1874
  }
1893
1875
 
1894
- // node_modules/.pnpm/@warp-ds+icons@2.0.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
1876
+ // node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/close-16.js
1895
1877
  import { LitElement as LitElement2 } from "lit";
1896
1878
  import { unsafeStatic as unsafeStatic2, html as html3 } from "lit/static-html.js";
1897
1879
  var messages4 = JSON.parse('{"icon.title.close":"Kryss"}');
@@ -2025,8 +2007,7 @@ var ModalHeader = class extends CanCloseMixin(WarpElement2) {
2025
2007
  </button>` : nothing;
2026
2008
  }
2027
2009
  get closeButton() {
2028
- if (this[NO_CLOSE_BUTTON])
2029
- return nothing;
2010
+ if (this[NO_CLOSE_BUTTON]) return nothing;
2030
2011
  return html4` <button
2031
2012
  type="button"
2032
2013
  class="${modalElement.headerButton} ${this._hasTopContent ? modalElement.headerCloseButtonOnImage : modalElement.headerCloseButton}"
@@ -2163,13 +2144,11 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2163
2144
  `;
2164
2145
  }
2165
2146
  willUpdate(changedProperties) {
2166
- if (changedProperties.has("show"))
2167
- this[this.show ? "open" : "close"]();
2147
+ if (changedProperties.has("show")) this[this.show ? "open" : "close"]();
2168
2148
  }
2169
2149
  handleListeners(verb = "addEventListener") {
2170
2150
  document[verb]("keydown", this.interceptEscape);
2171
- if (!this[NO_BACKDROP_CLICKS])
2172
- this.dialogEl.value[verb]("mousedown", this.closeOnBackdropClick);
2151
+ if (!this[NO_BACKDROP_CLICKS]) this.dialogEl.value[verb]("mousedown", this.closeOnBackdropClick);
2173
2152
  this.dialogEl.value[verb]("close", this.eventPreventer);
2174
2153
  this.dialogEl.value[verb]("cancel", this.eventPreventer);
2175
2154
  this.dialogInnerEl.value[verb]("transitionend", this.modifyBorderRadius);
@@ -2180,8 +2159,7 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2180
2159
  }
2181
2160
  /** @param {MouseEvent} evt */
2182
2161
  closeOnBackdropClick(evt) {
2183
- if (this.dialogEl.value === evt.target)
2184
- this.close();
2162
+ if (this.dialogEl.value === evt.target) this.close();
2185
2163
  }
2186
2164
  /** @param {KeyboardEvent} evt */
2187
2165
  interceptEscape(evt) {
@@ -2191,10 +2169,8 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2191
2169
  }
2192
2170
  }
2193
2171
  modifyBorderRadius() {
2194
- if (this.dialogInnerEl.value.scrollHeight * 1.02 > innerHeight)
2195
- this.dialogInnerEl.value.style.borderRadius = "0px";
2196
- else
2197
- this.dialogInnerEl.value.style.borderRadius = null;
2172
+ if (this.dialogInnerEl.value.scrollHeight * 1.02 > innerHeight) this.dialogInnerEl.value.style.borderRadius = "0px";
2173
+ else this.dialogInnerEl.value.style.borderRadius = null;
2198
2174
  }
2199
2175
  };
2200
2176
  __publicField(ModalMain, "properties", {