@nl-design-system-community/clippy-components 1.2.0 → 2.0.0

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 (56) hide show
  1. package/dist/clippy-button/index.js +4 -4
  2. package/dist/clippy-code/index.js +18 -15
  3. package/dist/clippy-color-combobox/index.d.ts +9 -13
  4. package/dist/clippy-color-combobox/index.d.ts.map +1 -1
  5. package/dist/clippy-color-combobox/index.js +6 -5
  6. package/dist/clippy-color-combobox/lib.d.ts +16 -12
  7. package/dist/clippy-color-combobox/lib.d.ts.map +1 -1
  8. package/dist/clippy-color-combobox/messages/en.d.ts +14 -6
  9. package/dist/clippy-color-combobox/messages/en.d.ts.map +1 -1
  10. package/dist/clippy-color-combobox/messages/nl.d.ts +14 -6
  11. package/dist/clippy-color-combobox/messages/nl.d.ts.map +1 -1
  12. package/dist/clippy-combobox/index.d.ts +22 -8
  13. package/dist/clippy-combobox/index.d.ts.map +1 -1
  14. package/dist/clippy-combobox/index.js +703 -8
  15. package/dist/clippy-font-combobox/index.d.ts +4 -3
  16. package/dist/clippy-font-combobox/index.d.ts.map +1 -1
  17. package/dist/clippy-font-combobox/index.js +94 -59
  18. package/dist/clippy-heading/index.js +180 -174
  19. package/dist/clippy-html-image/index.js +51 -31
  20. package/dist/clippy-icon/index.js +22 -16
  21. package/dist/clippy-lang-combobox/index.d.ts +2 -4
  22. package/dist/clippy-lang-combobox/index.d.ts.map +1 -1
  23. package/dist/clippy-lang-combobox/index.js +104 -78
  24. package/dist/clippy-modal/index.d.ts +3 -3
  25. package/dist/clippy-modal/index.d.ts.map +1 -1
  26. package/dist/clippy-modal/index.js +98 -89
  27. package/dist/clippy-toggletip/index.d.ts +16 -0
  28. package/dist/clippy-toggletip/index.d.ts.map +1 -0
  29. package/dist/clippy-toggletip/index.js +180 -0
  30. package/dist/decorators-Cq82_-g_.js +11 -0
  31. package/dist/en-D1kE0w6o.js +4 -0
  32. package/dist/external-BCrp-PaG.js +4 -0
  33. package/dist/index-7tZ2Ykfm.js +135 -0
  34. package/dist/index-C9pF3BXT.js +10683 -0
  35. package/dist/lib/FormElement/index.d.ts +2 -1
  36. package/dist/lib/FormElement/index.d.ts.map +1 -1
  37. package/dist/lib/FormElement/index.js +95 -0
  38. package/dist/lib/LocalizationMixin/index.d.ts.map +1 -1
  39. package/dist/lib/LocalizationMixin/index.js +64 -0
  40. package/dist/lib/converters/index.d.ts +4 -0
  41. package/dist/lib/converters/index.d.ts.map +1 -1
  42. package/dist/lib/converters/index.js +35 -0
  43. package/dist/lib/sr-only/index.d.ts +3 -0
  44. package/dist/lib/sr-only/index.d.ts.map +1 -0
  45. package/dist/lib/sr-only/index.js +18 -0
  46. package/dist/nl-99gBQbne.js +19 -0
  47. package/package.json +19 -16
  48. package/dist/decorators-BGpMqJ7V.js +0 -7
  49. package/dist/en-B-D8DBsf.js +0 -4
  50. package/dist/external-Dtf6f6DP.js +0 -4
  51. package/dist/index-CT1z3SFL.js +0 -106
  52. package/dist/index-CaVpiaBC.js +0 -52
  53. package/dist/index-CmKtM5nD.js +0 -379
  54. package/dist/index-CtreqNZ6.js +0 -3602
  55. package/dist/index-D3FiqptQ.js +0 -65
  56. package/dist/nl-CJG2-yS5.js +0 -11
@@ -1,6 +1,6 @@
1
- import { s as c } from "../decorators-BGpMqJ7V.js";
2
- import { css as a, LitElement as p, html as v } from "lit";
3
- const y = a`
1
+ import { s as safeCustomElement } from "../decorators-Cq82_-g_.js";
2
+ import { css, LitElement, html } from "lit";
3
+ const iconStyles = css`
4
4
  :host {
5
5
  block-size: var(--clippy-icon-size);
6
6
  color: var(--clippy-icon-color);
@@ -17,24 +17,30 @@ const y = a`
17
17
  pointer-events: none;
18
18
  }
19
19
  `;
20
- var b = Object.getOwnPropertyDescriptor, d = (s, n, r, o) => {
21
- for (var e = o > 1 ? void 0 : o ? b(n, r) : n, t = s.length - 1, l; t >= 0; t--)
22
- (l = s[t]) && (e = l(e) || e);
23
- return e;
20
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
21
+ var __decorateClass = (decorators, target, key, kind) => {
22
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
23
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
24
+ if (decorator = decorators[i])
25
+ result = decorator(result) || result;
26
+ return result;
24
27
  };
25
- const h = "clippy-icon";
26
- let i = class extends p {
28
+ const tag = "clippy-icon";
29
+ let ClippyIcon = class extends LitElement {
27
30
  render() {
28
- return v`<slot></slot>`;
31
+ return html`<slot></slot>`;
29
32
  }
30
33
  connectedCallback() {
31
- super.connectedCallback(), this.hasAttribute("aria-hidden") || this.setAttribute("aria-hidden", "true");
34
+ super.connectedCallback();
35
+ if (!this.hasAttribute("aria-hidden")) {
36
+ this.setAttribute("aria-hidden", "true");
37
+ }
32
38
  }
33
39
  };
34
- i.styles = [y];
35
- i = d([
36
- c(h)
37
- ], i);
40
+ ClippyIcon.styles = [iconStyles];
41
+ ClippyIcon = __decorateClass([
42
+ safeCustomElement(tag)
43
+ ], ClippyIcon);
38
44
  export {
39
- i as ClippyIcon
45
+ ClippyIcon
40
46
  };
@@ -5,7 +5,7 @@ type Option = {
5
5
  autonym: string;
6
6
  exonym: string;
7
7
  };
8
- declare const FORMAT_OPTIONS: readonly ["both", "autonym", "exonym"];
8
+ declare const FORMAT_OPTIONS: readonly ["autonym", "exonym", "autonym-exonym", "exonym-autonym"];
9
9
  type Format = (typeof FORMAT_OPTIONS)[number];
10
10
  declare const tag = "clippy-lang-combobox";
11
11
  declare global {
@@ -23,7 +23,6 @@ declare const ClippyLangCombobox_base: (new (...args: any[]) => {
23
23
  export declare class ClippyLangCombobox extends ClippyLangCombobox_base {
24
24
  #private;
25
25
  exonyms: Intl.DisplayNames;
26
- separator: string;
27
26
  format: Format;
28
27
  static readonly autonyms: {
29
28
  of: (code: string) => string;
@@ -31,13 +30,12 @@ export declare class ClippyLangCombobox extends ClippyLangCombobox_base {
31
30
  readonly autonyms: {
32
31
  of: (code: string) => string;
33
32
  };
34
- static readonly styles: import('lit').CSSResult[];
35
33
  set lang(value: string);
36
34
  get lang(): string;
37
35
  readonly filter: (query: string) => ({ autonym, exonym, label }: Option) => boolean;
38
36
  set options(options: string[]);
39
37
  get options(): Option[];
40
- renderEntry(option: Option): import('lit').TemplateResult<1>;
38
+ renderEntry(option: Option, index?: number): import('lit').TemplateResult<1>;
41
39
  }
42
40
  export {};
43
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clippy-lang-combobox/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,cAAc,wCAAyC,CAAC;AAE9D,KAAK,MAAM,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAI9C,QAAA,MAAM,GAAG,yBAAyB,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;KAC3B;CACF;AAGD,cAAM,CAAE,SAAQ,cAAc,CAAC,MAAM,CAAC;CAAG;;;;;;AAEzC,qBACa,kBAAmB,SAAQ,uBAAoB;;IAC1D,OAAO,oBAAkE;IAC7D,SAAS,SAAqB;IAO1C,MAAM,EAAE,MAAM,CAAyB;IAIvC,MAAM,CAAC,QAAQ,CAAC,QAAQ;mBAAgB,MAAM;MAAmC;IACjF,QAAQ,CAAC,QAAQ;mBADuB,MAAM;MACa;IAE3D,gBAAyB,MAAM,4BAAsC;IAMrE,IACa,IAAI,CAAC,KAAK,EAAE,MAAM,EAK9B;IAED,IAAa,IAAI,IAPQ,MAAM,CAS9B;IAED,SAAkB,MAAM,GAAI,OAAO,MAAM,MAE/B,4BAA4B,MAAM,aAa1C;IAEF,IACa,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAgBrC;IAED,IAAa,OAAO,IAAI,MAAM,EAAE,CAE/B;IAEQ,WAAW,CAAC,MAAM,EAAE,MAAM;CAsBpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clippy-lang-combobox/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,cAAc,oEAAqE,CAAC;AAE1F,KAAK,MAAM,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,QAAA,MAAM,GAAG,yBAAyB,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;KAC3B;CACF;AAGD,cAAM,CAAE,SAAQ,cAAc,CAAC,MAAM,CAAC;CAAG;;;;;;AAEzC,qBACa,kBAAmB,SAAQ,uBAAoB;;IAC1D,OAAO,oBAAkE;IAOzE,MAAM,EAAE,MAAM,CAAyB;IAIvC,MAAM,CAAC,QAAQ,CAAC,QAAQ;mBAAgB,MAAM;MAAmC;IACjF,QAAQ,CAAC,QAAQ;mBADuB,MAAM;MACa;IAM3D,IACa,IAAI,CAAC,KAAK,EAAE,MAAM,EAK9B;IAED,IAAa,IAAI,IAPQ,MAAM,CAS9B;IAED,SAAkB,MAAM,GAAI,OAAO,MAAM,MAE/B,4BAA4B,MAAM,aAa1C;IAEF,IACa,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAerC;IAED,IAAa,OAAO,IAAI,MAAM,EAAE,CAE/B;IAEQ,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAoBpD"}
@@ -1,10 +1,11 @@
1
- import { C as k, a as A } from "../index-CmKtM5nD.js";
2
- import { s as C } from "../decorators-BGpMqJ7V.js";
3
- import { L as S } from "../index-CaVpiaBC.js";
4
- import { css as T, html as p, nothing as l } from "lit";
5
- import { property as y } from "lit/decorators.js";
6
- import { ifDefined as z } from "lit/directives/if-defined.js";
7
- const O = {
1
+ import { arrayFromTokenList } from "../lib/converters/index.js";
2
+ import { s as safeCustomElement } from "../decorators-Cq82_-g_.js";
3
+ import LocalizationMixin from "../lib/LocalizationMixin/index.js";
4
+ import { html } from "lit";
5
+ import { property } from "lit/decorators.js";
6
+ import { ifDefined } from "lit/directives/if-defined.js";
7
+ import { ClippyCombobox } from "../clippy-combobox/index.js";
8
+ const languages = {
8
9
  aa: "Afaraf",
9
10
  ab: "аҧсуа бызшәа",
10
11
  ae: "Avesta",
@@ -189,102 +190,127 @@ const O = {
189
190
  za: "Saɯ cueŋƅ",
190
191
  zh: "中文",
191
192
  zu: "isiZulu"
192
- }, N = /* @__PURE__ */ new Set(["ar", "dv", "fa", "he", "ps", "sd", "ug", "ur", "yi"]), b = (a) => N.has(a) ? "rtl" : "ltr", D = T`
193
- /**
194
- * Whenever the writing direction of an element inside the option is different, we want to align it differently.
195
- * For both scenarios that would come down to "justify:content: flex-end"
196
- */
197
- .clippy-combobox__option:dir(ltr):has(*:dir(rtl)),
198
- .clippy-combobox__option:dir(rtl):has(*:dir(ltr)),
199
- .clippy-combobox__current-option:dir(ltr):has(*:dir(rtl)),
200
- .clippy-combobox__current-option:dir(rtl):has(*:dir(ltr)) {
201
- justify-content: flex-end;
202
- }
203
- `;
204
- var E = Object.defineProperty, I = Object.getOwnPropertyDescriptor, v = (a) => {
205
- throw TypeError(a);
206
- }, c = (a, t, o, e) => {
207
- for (var s = e > 1 ? void 0 : e ? I(t, o) : t, n = a.length - 1, r; n >= 0; n--)
208
- (r = a[n]) && (s = (e ? r(t, o, s) : r(s)) || s);
209
- return e && s && E(t, o, s), s;
210
- }, _ = (a, t, o) => t.has(a) || v("Cannot " + o), m = (a, t, o) => (_(a, t, "read from private field"), o ? o.call(a) : t.get(a)), g = (a, t, o) => t.has(a) ? v("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, o), f = (a, t, o, e) => (_(a, t, "write to private field"), t.set(a, o), o), h, u, d, w;
211
- const x = ["both", "autonym", "exonym"], L = x[0], $ = "-", F = "clippy-lang-combobox";
212
- class M extends k {
193
+ };
194
+ const rtlLanguages = /* @__PURE__ */ new Set(["ar", "dv", "fa", "he", "ps", "sd", "ug", "ur", "yi"]);
195
+ const direction = (lang) => {
196
+ return rtlLanguages.has(lang) ? "rtl" : "ltr";
197
+ };
198
+ var __defProp = Object.defineProperty;
199
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
200
+ var __typeError = (msg) => {
201
+ throw TypeError(msg);
202
+ };
203
+ var __decorateClass = (decorators, target, key, kind) => {
204
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
205
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
206
+ if (decorator = decorators[i])
207
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
208
+ if (kind && result) __defProp(target, key, result);
209
+ return result;
210
+ };
211
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
212
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
213
+ 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);
214
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
215
+ var _options, _lang, _ClippyLangCombobox_instances, dir_get;
216
+ const FORMAT_OPTIONS = ["autonym", "exonym", "autonym-exonym", "exonym-autonym"];
217
+ const DEFAULT_FORMAT_OPTION = FORMAT_OPTIONS[0];
218
+ const tag = "clippy-lang-combobox";
219
+ class C extends ClippyCombobox {
213
220
  }
214
- let i = class extends S(M) {
221
+ let ClippyLangCombobox = class extends LocalizationMixin(C) {
215
222
  constructor() {
216
- super(...arguments), g(this, d), this.exonyms = new Intl.DisplayNames(this.DEFAULT_LANG, { type: "language" }), this.separator = $, this.format = L, g(this, h, []), g(this, u), this.autonyms = { of: i.autonyms.of }, this.filter = (a) => {
217
- const t = a.toLowerCase();
218
- return ({ autonym: o, exonym: e, label: s }) => {
219
- const n = s.toLowerCase().includes(t);
223
+ super(...arguments);
224
+ __privateAdd(this, _ClippyLangCombobox_instances);
225
+ this.exonyms = new Intl.DisplayNames(this.DEFAULT_LANG, { type: "language" });
226
+ this.format = DEFAULT_FORMAT_OPTION;
227
+ __privateAdd(this, _options, []);
228
+ __privateAdd(this, _lang);
229
+ this.autonyms = { of: ClippyLangCombobox.autonyms.of };
230
+ this.filter = (query) => {
231
+ const normalizedQuery = query.toLowerCase();
232
+ return ({ autonym, exonym, label }) => {
233
+ const hasLabelMatch = label.toLowerCase().includes(normalizedQuery);
220
234
  switch (this.format) {
221
235
  case "autonym":
222
- return n || e.toLowerCase().includes(t);
236
+ return hasLabelMatch || exonym.toLowerCase().includes(normalizedQuery);
223
237
  case "exonym":
224
- return n || o.toLowerCase().includes(t);
238
+ return hasLabelMatch || autonym.toLowerCase().includes(normalizedQuery);
225
239
  default:
226
- return n;
240
+ return hasLabelMatch;
227
241
  }
228
242
  };
229
243
  };
230
244
  }
231
- set lang(a) {
232
- a !== m(this, u) && (f(this, u, a), this.exonyms = new Intl.DisplayNames(a, { type: "language" }));
245
+ set lang(value) {
246
+ if (value !== __privateGet(this, _lang)) {
247
+ __privateSet(this, _lang, value);
248
+ this.exonyms = new Intl.DisplayNames(value, { type: "language" });
249
+ }
233
250
  }
234
251
  get lang() {
235
- return m(this, u) || this.DEFAULT_LANG;
252
+ return __privateGet(this, _lang) || this.DEFAULT_LANG;
236
253
  }
237
- set options(a) {
238
- f(this, h, a.map((t) => {
239
- const o = this.autonyms.of(t), e = this.exonyms.of(t) || o, s = {
240
- autonym: o,
241
- exonym: e,
242
- value: t
243
- }, n = e === o ? "" : ` ${this.separator} ${o}`, r = this.format === "both" ? `${s.exonym}${n}` : s?.[this.format];
254
+ set options(options) {
255
+ __privateSet(this, _options, options.map((value) => {
256
+ const autonym = this.autonyms.of(value);
257
+ const exonym = this.exonyms.of(value) || autonym;
258
+ const option = {
259
+ autonym,
260
+ exonym,
261
+ value
262
+ };
263
+ const label = this.format.startsWith("autonym") ? autonym : exonym;
244
264
  return {
245
- ...s,
246
- label: r
265
+ ...option,
266
+ label
247
267
  };
248
268
  }));
249
269
  }
250
270
  get options() {
251
- return m(this, h);
271
+ return __privateGet(this, _options);
252
272
  }
253
- renderEntry(a) {
254
- const t = b(a.value), o = t === m(this, d, w) ? void 0 : t, e = a.value === this.lang, s = e || ["both", "exonym"].includes(this.format) ? p`<span class="clippy-lang-combobox__exonym">${a.exonym}</span>` : l, n = !e && ["both", "autonym"].includes(this.format) ? p`<span class="clippy-lang-combobox__autonym" lang=${a.value} dir=${z(o)}>
255
- ${a.autonym}
256
- </span>` : l, r = s === l || n === l ? l : p`<span role="presentation">${this.separator}</span>`;
257
- return p` <span class="clippy-lang-combobox__option"> ${s} ${r} ${n} </span>`;
273
+ renderEntry(option, index) {
274
+ const formatArray = this.format.split("-");
275
+ const classes = ["clippy-lang-combobox__option-label", "clippy-lang-combobox__option-description"];
276
+ const parts = index === void 0 ? [formatArray[0]] : formatArray;
277
+ return html`${parts.map((part, i) => {
278
+ const content = option[part];
279
+ const optionDir = direction(option.value);
280
+ let lang;
281
+ let dir;
282
+ if (part === "autonym") {
283
+ lang = option.value;
284
+ dir = optionDir === __privateGet(this, _ClippyLangCombobox_instances, dir_get) ? void 0 : optionDir;
285
+ }
286
+ return html`<div class="${classes[i]}" lang=${ifDefined(lang)} dir=${ifDefined(dir)}>${content}</div>`;
287
+ })}`;
258
288
  }
259
289
  };
260
- h = /* @__PURE__ */ new WeakMap();
261
- u = /* @__PURE__ */ new WeakMap();
262
- d = /* @__PURE__ */ new WeakSet();
263
- w = function() {
264
- return b(this.lang);
290
+ _options = /* @__PURE__ */ new WeakMap();
291
+ _lang = /* @__PURE__ */ new WeakMap();
292
+ _ClippyLangCombobox_instances = /* @__PURE__ */ new WeakSet();
293
+ dir_get = function() {
294
+ return direction(this.lang);
265
295
  };
266
- i.autonyms = { of: (a) => O[a] };
267
- i.styles = [...k.styles, D];
268
- c([
269
- y()
270
- ], i.prototype, "separator", 2);
271
- c([
272
- y({
296
+ ClippyLangCombobox.autonyms = { of: (code) => languages[code] };
297
+ __decorateClass([
298
+ property({
273
299
  converter: {
274
- fromAttribute: (a) => x.find((t) => t === a) || L
300
+ fromAttribute: (value) => FORMAT_OPTIONS.find((v) => v === value) || DEFAULT_FORMAT_OPTION
275
301
  },
276
302
  type: String
277
303
  })
278
- ], i.prototype, "format", 2);
279
- c([
280
- y()
281
- ], i.prototype, "lang", 1);
282
- c([
283
- y({ converter: A, type: Array })
284
- ], i.prototype, "options", 1);
285
- i = c([
286
- C(F)
287
- ], i);
304
+ ], ClippyLangCombobox.prototype, "format", 2);
305
+ __decorateClass([
306
+ property()
307
+ ], ClippyLangCombobox.prototype, "lang", 1);
308
+ __decorateClass([
309
+ property({ converter: arrayFromTokenList, type: Array })
310
+ ], ClippyLangCombobox.prototype, "options", 1);
311
+ ClippyLangCombobox = __decorateClass([
312
+ safeCustomElement(tag)
313
+ ], ClippyLangCombobox);
288
314
  export {
289
- i as ClippyLangCombobox
315
+ ClippyLangCombobox
290
316
  };
@@ -12,7 +12,7 @@ export declare class ClippyModal extends LitElement {
12
12
  /**
13
13
  * When loading the page, the dialog is not open by default.
14
14
  */
15
- standardOpen: boolean;
15
+ 'standard-open': boolean;
16
16
  title: string;
17
17
  closedBy: string;
18
18
  /**
@@ -27,8 +27,8 @@ export declare class ClippyModal extends LitElement {
27
27
  * Button labels for confirm/cancel actions. Consumers can override these,
28
28
  * e.g. with localized strings.
29
29
  */
30
- confirmLabel: string;
31
- cancelLabel: string;
30
+ 'confirm-label': string;
31
+ 'cancel-label': string;
32
32
  readonly dialogElement: HTMLDialogElement;
33
33
  private readonly titleId;
34
34
  private previouslyFocusedElement;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clippy-modal/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,UAAU,EAA6B,MAAM,KAAK,CAAC;AAS5D,eAAO,MAAM,oBAAoB;;;CAGhC,CAAC;AAEF,qBACa,WAAY,SAAQ,UAAU;IACzC;;;OAGG;IAEH,eAAe,SAAM;IACrB;;OAEG;IAEH,YAAY,UAAS;IACgB,KAAK,SAAM;IACpB,QAAQ,SAAS;IAC7C;;;;;;OAMG;IAEH,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAY;IAC3D;;;OAGG;IACyB,YAAY,SAAQ;IACpB,WAAW,SAAY;IAGnD,QAAQ,CAAC,aAAa,EAAG,iBAAiB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmD;IAE3E,OAAO,CAAC,wBAAwB,CAA4B;IAE5D,gBAAyB,MAAM,0DAI7B;IAEF,QAAQ,CAAC,IAAI,aAOX;IAEF,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM;IAMpB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAiB5B;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAK7B;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;IAEF,IAAI,WAAW,IAAI,MAAM,CAExB;IAEQ,MAAM;CA8ChB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clippy-modal/index.ts"],"names":[],"mappings":"AAGA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAA4B,MAAM,KAAK,CAAC;AAS3D,eAAO,MAAM,oBAAoB;;;CAGhC,CAAC;AAEF,qBACa,WAAY,SAAQ,UAAU;IACzC;;;OAGG;IAEH,eAAe,SAAM;IACrB;;OAEG;IAEH,eAAe,UAAS;IACa,KAAK,SAAM;IACpB,QAAQ,SAAS;IAC7C;;;;;;OAMG;IAEH,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAY;IAC3D;;;OAGG;IACyB,eAAe,SAAQ;IACvB,cAAc,SAAY;IAGtD,QAAQ,CAAC,aAAa,EAAG,iBAAiB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmD;IAE3E,OAAO,CAAC,wBAAwB,CAA4B;IAE5D,gBAAyB,MAAM,0DAAuE;IAEtG,QAAQ,CAAC,IAAI,aAOX;IAEF,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM;IAMpB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAiB5B;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAK7B;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;IAEF,IAAI,WAAW,IAAI,MAAM,CAExB;IAEQ,MAAM;CA8ChB"}
@@ -1,26 +1,14 @@
1
- import { s as b } from "../decorators-BGpMqJ7V.js";
2
- import { b as h } from "../index-CT1z3SFL.js";
1
+ import { s as safeCustomElement } from "../decorators-Cq82_-g_.js";
2
+ import { b as buttonStyles } from "../index-7tZ2Ykfm.js";
3
+ import "../clippy-heading/index.js";
3
4
  import "../clippy-icon/index.js";
4
- import { css as u, unsafeCSS as c, LitElement as v, nothing as p, html as m } from "lit";
5
- import { property as d, query as y } from "lit/decorators.js";
6
- import { unsafeSVG as f } from "lit/directives/unsafe-svg.js";
7
- const k = ".ams-dialog:not(dialog:not([open])){background-color:var(--ams-dialog-background-color);border-color:var(--ams-dialog-border-color);border-style:var(--ams-dialog-border-style);border-width:var(--ams-dialog-border-width);box-sizing:border-box;display:flex;flex-direction:column;gap:var(--ams-dialog-gap);inline-size:var(--ams-dialog-inline-size);max-block-size:var(--ams-dialog-max-block-size);max-inline-size:var(--ams-dialog-max-inline-size);inset-block:0;padding-block:0;padding-inline:0}@media screen and (min-width:37.5rem){.ams-dialog:not(dialog:not([open])){inline-size:var(--ams-dialog-medium-inline-size);max-block-size:var(--ams-dialog-medium-max-block-size)}}.ams-dialog:not(dialog:not([open]))::backdrop{background:var(--ams-dialog-backdrop-background-color, rgba(24, 24, 24, .625))}.ams-dialog__header{align-items:flex-start;display:flex;gap:var(--ams-dialog-header-gap);justify-content:space-between;padding-block:var(--ams-dialog-header-padding-block);padding-inline:var(--ams-dialog-header-padding-inline)}@media screen and (min-width:37.5rem){.ams-dialog__header{padding-block:var(--ams-dialog-header-medium-padding-block);padding-inline:var(--ams-dialog-header-medium-padding-inline)}}.ams-dialog__body{overflow-y:auto;overscroll-behavior-y:contain;padding-block:var(--ams-dialog-body-padding-block);padding-inline:var(--ams-dialog-body-padding-inline)}@media screen and (min-width:37.5rem){.ams-dialog__body{padding-inline:var(--ams-dialog-body-medium-padding-inline)}}.ams-dialog__footer{padding-block:var(--ams-dialog-footer-padding-block);padding-inline:var(--ams-dialog-footer-padding-inline)}@media screen and (min-width:37.5rem){.ams-dialog__footer{padding-block:var(--ams-dialog-footer-medium-padding-block);padding-inline:var(--ams-dialog-footer-medium-padding-inline)}}", _ = `<svg
8
- xmlns="http://www.w3.org/2000/svg"
9
- width="24"
10
- height="24"
11
- viewBox="0 0 24 24"
12
- fill="none"
13
- stroke="currentColor"
14
- stroke-width="2"
15
- stroke-linecap="round"
16
- stroke-linejoin="round"
17
- class="icon icon-tabler icons-tabler-outline icon-tabler-x"
18
- >
19
- <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
20
- <path d="M18 6l-12 12" />
21
- <path d="M6 6l12 12" />
22
- </svg>`, w = [
23
- u`
5
+ import { css, unsafeCSS, LitElement, nothing, html } from "lit";
6
+ import { property, query } from "lit/decorators.js";
7
+ import { unsafeSVG } from "lit/directives/unsafe-svg.js";
8
+ const amsDialogStyles = ".ams-dialog:not(dialog:not([open])){background-color:var(--ams-dialog-background-color);border-color:var(--ams-dialog-border-color);border-style:var(--ams-dialog-border-style);border-width:var(--ams-dialog-border-width);box-sizing:border-box;display:flex;flex-direction:column;gap:var(--ams-dialog-gap);inline-size:var(--ams-dialog-inline-size);max-block-size:var(--ams-dialog-max-block-size);max-inline-size:var(--ams-dialog-max-inline-size);inset-block:0;padding-block:0;padding-inline:0}@media screen and (min-width: 37.5rem){.ams-dialog:not(dialog:not([open])){inline-size:var(--ams-dialog-medium-inline-size);max-block-size:var(--ams-dialog-medium-max-block-size)}}.ams-dialog:not(dialog:not([open]))::backdrop{background:var(--ams-dialog-backdrop-background-color, rgba(24, 24, 24, 0.625))}.ams-dialog__header{align-items:flex-start;display:flex;gap:var(--ams-dialog-header-gap);justify-content:space-between;padding-block:var(--ams-dialog-header-padding-block);padding-inline:var(--ams-dialog-header-padding-inline)}@media screen and (min-width: 37.5rem){.ams-dialog__header{padding-block:var(--ams-dialog-header-medium-padding-block);padding-inline:var(--ams-dialog-header-medium-padding-inline)}}.ams-dialog__body{overflow-y:auto;overscroll-behavior-y:contain;padding-block:var(--ams-dialog-body-padding-block);padding-inline:var(--ams-dialog-body-padding-inline)}@media screen and (min-width: 37.5rem){.ams-dialog__body{padding-inline:var(--ams-dialog-body-medium-padding-inline)}}.ams-dialog__footer{padding-block:var(--ams-dialog-footer-padding-block);padding-inline:var(--ams-dialog-footer-padding-inline)}@media screen and (min-width: 37.5rem){.ams-dialog__footer{padding-block:var(--ams-dialog-footer-medium-padding-block);padding-inline:var(--ams-dialog-footer-medium-padding-inline)}}/*# sourceMappingURL=dialog.css.map */\n";
9
+ const CloseIcon = '<svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n stroke="currentColor"\n stroke-width="2"\n stroke-linecap="round"\n stroke-linejoin="round"\n class="icon icon-tabler icons-tabler-outline icon-tabler-x"\n>\n <path stroke="none" d="M0 0h24v24H0z" fill="none"/>\n <path d="M18 6l-12 12" />\n <path d="M6 6l12 12" />\n</svg>';
10
+ const dialogStyles = [
11
+ css`
24
12
  :host {
25
13
  --ams-dialog-background-color: var(--todo-modal-dialog-background-color);
26
14
  --ams-dialog-border-color: var(--todo-modal-dialog-border-color);
@@ -59,48 +47,73 @@ const k = ".ams-dialog:not(dialog:not([open])){background-color:var(--ams-dialog
59
47
  }
60
48
  `
61
49
  ];
62
- var x = Object.defineProperty, z = Object.getOwnPropertyDescriptor, a = (i, l, t, n) => {
63
- for (var e = n > 1 ? void 0 : n ? z(l, t) : l, s = i.length - 1, r; s >= 0; s--)
64
- (r = i[s]) && (e = (n ? r(l, t, e) : r(e)) || e);
65
- return n && e && x(l, t, e), e;
50
+ var __defProp = Object.defineProperty;
51
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
52
+ var __decorateClass = (decorators, target, key, kind) => {
53
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
54
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
55
+ if (decorator = decorators[i])
56
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
57
+ if (kind && result) __defProp(target, key, result);
58
+ return result;
66
59
  };
67
- let E = 0;
68
- const $ = "clippy-modal", g = {
60
+ let dialogInstanceCounter = 0;
61
+ const tag = "clippy-modal";
62
+ const DIALOG_BUTTON_VALUES = {
69
63
  cancel: "cancel",
70
64
  confirm: "confirm"
71
65
  };
72
- let o = class extends v {
66
+ let ClippyModal = class extends LitElement {
73
67
  constructor() {
74
- super(...arguments), this.ariaDescribedby = "", this.standardOpen = !1, this.title = "", this.closedBy = "any", this.actions = "cancel", this.confirmLabel = "OK", this.cancelLabel = "Cancel", this.titleId = `clippy-modal-title-${++E}`, this.previouslyFocusedElement = null, this.open = () => {
68
+ super(...arguments);
69
+ this.ariaDescribedby = "";
70
+ this["standard-open"] = false;
71
+ this.title = "";
72
+ this.closedBy = "any";
73
+ this.actions = "cancel";
74
+ this["confirm-label"] = "OK";
75
+ this["cancel-label"] = "Cancel";
76
+ this.titleId = `clippy-modal-title-${++dialogInstanceCounter}`;
77
+ this.previouslyFocusedElement = null;
78
+ this.open = () => {
75
79
  if (!this.dialogElement) return;
76
- const i = this.getRootNode();
77
- this.previouslyFocusedElement = i.activeElement, this.dialogElement.showModal();
78
- }, this.onDialogClose = () => {
79
- if (this.dispatchEvent(
80
+ const root = this.getRootNode();
81
+ this.previouslyFocusedElement = root.activeElement;
82
+ this.dialogElement.showModal();
83
+ };
84
+ this.onDialogClose = () => {
85
+ this.dispatchEvent(
80
86
  new Event("close", {
81
- bubbles: !0,
82
- composed: !0
87
+ bubbles: true,
88
+ composed: true
83
89
  })
84
- ), this.previouslyFocusedElement && typeof this.previouslyFocusedElement.focus == "function")
90
+ );
91
+ if (this.previouslyFocusedElement && typeof this.previouslyFocusedElement.focus === "function") {
85
92
  try {
86
93
  this.previouslyFocusedElement.focus();
87
94
  } catch {
88
95
  }
96
+ }
89
97
  this.previouslyFocusedElement = null;
90
- }, this.onDialogCancel = (i) => {
91
- i.preventDefault(), this.close();
92
- }, this.onCloseClick = () => {
93
- this.close(g.cancel);
98
+ };
99
+ this.onDialogCancel = (event) => {
100
+ event.preventDefault();
101
+ this.close();
102
+ };
103
+ this.onCloseClick = () => {
104
+ this.close(DIALOG_BUTTON_VALUES.cancel);
94
105
  };
95
106
  }
96
- close(i) {
97
- this.dialogElement?.open && this.dialogElement.close(i);
107
+ close(value) {
108
+ if (this.dialogElement?.open) {
109
+ this.dialogElement.close(value);
110
+ }
98
111
  }
99
112
  get returnValue() {
100
113
  return this.dialogElement?.returnValue ?? "No return value.";
101
114
  }
102
115
  render() {
103
- return m`
116
+ return html`
104
117
  <dialog
105
118
  class="ams-dialog"
106
119
  closedby=${this.closedBy}
@@ -109,15 +122,15 @@ let o = class extends v {
109
122
  aria-describedby=${this.ariaDescribedby || void 0}
110
123
  @close=${this.onDialogClose}
111
124
  @cancel=${this.onDialogCancel}
112
- ?open=${this.standardOpen}
125
+ ?open=${this["standard-open"]}
113
126
  >
114
127
  <form method="dialog" novalidate>
115
128
  <header class="ams-dialog__header">
116
- <clippy-heading level={1} id=${this.titleId}>
129
+ <clippy-heading level="1" id=${this.titleId}>
117
130
  <slot name="title">${this.title}</slot>
118
131
  </clippy-heading>
119
132
  <clippy-button icon-only @click=${this.onCloseClick} purpose="subtle">
120
- <clippy-icon slot="iconStart">${f(_)}</clippy-icon>
133
+ <clippy-icon slot="iconStart">${unsafeSVG(CloseIcon)}</clippy-icon>
121
134
  Sluiten
122
135
  </clippy-button>
123
136
  </header>
@@ -126,55 +139,51 @@ let o = class extends v {
126
139
  </div>
127
140
  <footer class="ams-dialog__footer">
128
141
  <!-- using utrecht-button here disrupts the dialog form flow since it's in the shadow DOM. -->
129
- ${this.actions === "confirm" || this.actions === "both" ? m`
130
- <button class="nl-button nl-button--primary" value=${g.confirm}>
131
- ${this.confirmLabel}
142
+ ${this.actions === "confirm" || this.actions === "both" ? html`
143
+ <button class="nl-button nl-button--primary" value=${DIALOG_BUTTON_VALUES.confirm}>
144
+ ${this["confirm-label"]}
132
145
  </button>
133
- ` : p}
134
- ${this.actions === "cancel" || this.actions === "both" ? m`
135
- <button class="nl-button nl-button--secondary" value=${g.cancel}>
136
- ${this.cancelLabel}
146
+ ` : nothing}
147
+ ${this.actions === "cancel" || this.actions === "both" ? html`
148
+ <button class="nl-button nl-button--secondary" value=${DIALOG_BUTTON_VALUES.cancel}>
149
+ ${this["cancel-label"]}
137
150
  </button>
138
- ` : p}
151
+ ` : nothing}
139
152
  </footer>
140
153
  </form>
141
154
  </dialog>
142
155
  `;
143
156
  }
144
157
  };
145
- o.styles = [
146
- w,
147
- c(k),
148
- c(h)
149
- ];
150
- a([
151
- d({ attribute: "aria-describedby", type: String })
152
- ], o.prototype, "ariaDescribedby", 2);
153
- a([
154
- d({ type: Boolean })
155
- ], o.prototype, "standardOpen", 2);
156
- a([
157
- d({ type: String })
158
- ], o.prototype, "title", 2);
159
- a([
160
- d({ type: String })
161
- ], o.prototype, "closedBy", 2);
162
- a([
163
- d({ type: String })
164
- ], o.prototype, "actions", 2);
165
- a([
166
- d({ type: String })
167
- ], o.prototype, "confirmLabel", 2);
168
- a([
169
- d({ type: String })
170
- ], o.prototype, "cancelLabel", 2);
171
- a([
172
- y("dialog")
173
- ], o.prototype, "dialogElement", 2);
174
- o = a([
175
- b($)
176
- ], o);
158
+ ClippyModal.styles = [dialogStyles, unsafeCSS(amsDialogStyles), unsafeCSS(buttonStyles)];
159
+ __decorateClass([
160
+ property({ attribute: "aria-describedby", type: String })
161
+ ], ClippyModal.prototype, "ariaDescribedby", 2);
162
+ __decorateClass([
163
+ property({ type: Boolean })
164
+ ], ClippyModal.prototype, "standard-open", 2);
165
+ __decorateClass([
166
+ property({ type: String })
167
+ ], ClippyModal.prototype, "title", 2);
168
+ __decorateClass([
169
+ property({ type: String })
170
+ ], ClippyModal.prototype, "closedBy", 2);
171
+ __decorateClass([
172
+ property({ type: String })
173
+ ], ClippyModal.prototype, "actions", 2);
174
+ __decorateClass([
175
+ property({ type: String })
176
+ ], ClippyModal.prototype, "confirm-label", 2);
177
+ __decorateClass([
178
+ property({ type: String })
179
+ ], ClippyModal.prototype, "cancel-label", 2);
180
+ __decorateClass([
181
+ query("dialog")
182
+ ], ClippyModal.prototype, "dialogElement", 2);
183
+ ClippyModal = __decorateClass([
184
+ safeCustomElement(tag)
185
+ ], ClippyModal);
177
186
  export {
178
- o as ClippyModal,
179
- g as DIALOG_BUTTON_VALUES
187
+ ClippyModal,
188
+ DIALOG_BUTTON_VALUES
180
189
  };
@@ -0,0 +1,16 @@
1
+ import { LitElement } from 'lit';
2
+ declare const tag = "clippy-toggletip";
3
+ type Position = 'block-start' | 'inline-end' | 'block-end' | 'inline-start';
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ [tag]: ClippyToggletip;
7
+ }
8
+ }
9
+ export declare class ClippyToggletip extends LitElement {
10
+ text: string;
11
+ position: Position;
12
+ static readonly styles: import('lit').CSSResult[];
13
+ render(): import('lit').TemplateResult<1>;
14
+ }
15
+ export {};
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clippy-toggletip/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAGhD,OAAO,oBAAoB,CAAC;AAG5B,QAAA,MAAM,GAAG,qBAAqB,CAAC;AAE/B,KAAK,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AAiB5E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC;KACxB;CACF;AAED,qBACa,eAAgB,SAAQ,UAAU;IACjB,IAAI,SAAM;IAMtC,QAAQ,EAAE,QAAQ,CAAiB;IAEnC,gBAAyB,MAAM,4BAAY;IAElC,MAAM;CAUhB"}