@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
@@ -2,6 +2,7 @@ import { ClippyCombobox } from '../clippy-combobox';
2
2
  type Option = {
3
3
  label: string;
4
4
  value: string[];
5
+ description?: string;
5
6
  cssUrl?: string;
6
7
  };
7
8
  declare const tag = "clippy-font-combobox";
@@ -12,15 +13,15 @@ declare global {
12
13
  }
13
14
  export declare class ClippyFontCombobox extends ClippyCombobox<Option> {
14
15
  #private;
15
- readonly allowOther = true;
16
+ allow: (typeof ClippyCombobox.allowances)[number];
16
17
  readonly listboxElement?: Element;
17
18
  set value(value: Option['value'] | null);
18
19
  get value(): Option['value'] | null;
19
20
  fetchAdditionalOptions(query: string): Promise<Option[]>;
20
21
  valueToQuery(value: Option['value'] | null): string;
21
- queryToValue(query: string): string[] | null;
22
+ queryToValue(query: string): string[];
22
23
  getOptionForValue(value: Option['value'] | null): Option | undefined;
23
- renderEntry(option: Option, _index: number): import('lit').TemplateResult<1>;
24
+ renderEntry({ cssUrl, description, label, value }: Option, index: number): import('lit').TemplateResult<1>;
24
25
  }
25
26
  export {};
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clippy-font-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,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,QAAA,MAAM,GAAG,yBAAyB,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;KAC3B;CACF;AAED,qBACa,kBAAmB,SAAQ,cAAc,CAAC,MAAM,CAAC;;IAC5D,SAAkB,UAAU,QAAQ;IAIpC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC,IACa,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAG/C;IAED,IAAa,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAE3C;IAEc,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgC9D,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM;IAOnD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAK5C,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAIpE,W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E,KAAK,EAAE,MAAM;CAalF"}
@@ -1,77 +1,112 @@
1
- import { s as _ } from "../decorators-BGpMqJ7V.js";
2
- import { html as b } from "lit";
3
- import { query as C, property as w } from "lit/decorators.js";
4
- import { ifDefined as E } from "lit/directives/if-defined.js";
5
- import { ref as x } from "lit/directives/ref.js";
6
- import { styleMap as O } from "lit/directives/style-map.js";
7
- import { b as g, C as A } from "../index-CmKtM5nD.js";
8
- var F = Object.defineProperty, M = Object.getOwnPropertyDescriptor, m = (t) => {
9
- throw TypeError(t);
10
- }, h = (t, e, r, s) => {
11
- for (var o = s > 1 ? void 0 : s ? M(e, r) : e, i = t.length - 1, n; i >= 0; i--)
12
- (n = t[i]) && (o = (s ? n(e, r, o) : n(o)) || o);
13
- return s && o && F(e, r, o), o;
14
- }, y = (t, e, r) => e.has(t) || m("Cannot " + r), a = (t, e, r) => (y(t, e, "read from private field"), r ? r.call(t) : e.get(t)), c = (t, e, r) => e.has(t) ? m("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), d = (t, e, r, s) => (y(t, e, "write to private field"), e.set(t, r), r), p, l, f;
15
- const S = "clippy-font-combobox";
16
- let u = class extends A {
1
+ import { s as safeCustomElement } from "../decorators-Cq82_-g_.js";
2
+ import { nothing, html } from "lit";
3
+ import { property, query } from "lit/decorators.js";
4
+ import { ifDefined } from "lit/directives/if-defined.js";
5
+ import { ref } from "lit/directives/ref.js";
6
+ import { styleMap } from "lit/directives/style-map.js";
7
+ import { ClippyCombobox } from "../clippy-combobox/index.js";
8
+ import { allowedValuesConverter, arrayFromCommaList } from "../lib/converters/index.js";
9
+ var __defProp = Object.defineProperty;
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __typeError = (msg) => {
12
+ throw TypeError(msg);
13
+ };
14
+ var __decorateClass = (decorators, target, key, kind) => {
15
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
16
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
17
+ if (decorator = decorators[i])
18
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
19
+ if (kind && result) __defProp(target, key, result);
20
+ return result;
21
+ };
22
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
23
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24
+ 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);
25
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
26
+ var _additional, _intersectionObserver, _loadFontsInView;
27
+ const defaultAllowance = "other";
28
+ const tag = "clippy-font-combobox";
29
+ let ClippyFontCombobox = class extends ClippyCombobox {
17
30
  constructor() {
18
- super(...arguments), this.allowOther = !0, c(this, p), c(this, l), c(this, f, (t) => {
19
- for (const e of t) {
20
- const { intersectionRatio: r, target: s } = e;
21
- if (r > 0 && s instanceof HTMLElement) {
22
- const o = s.dataset.cssUrl || "", i = document.querySelector(`[href="${o}"]`);
23
- if (o && !i) {
24
- const n = document.createElement("link");
25
- n.setAttribute("rel", "stylesheet"), n.setAttribute("href", o), document.head.appendChild(n);
31
+ super(...arguments);
32
+ this.allow = defaultAllowance;
33
+ __privateAdd(this, _additional);
34
+ __privateAdd(this, _intersectionObserver);
35
+ __privateAdd(this, _loadFontsInView, (entries) => {
36
+ for (const entry of entries) {
37
+ const { intersectionRatio, target } = entry;
38
+ if (intersectionRatio > 0 && target instanceof HTMLElement) {
39
+ const cssUrl = target.dataset["cssUrl"] || "";
40
+ const stylesheets = document.querySelector(`[href="${cssUrl}"]`);
41
+ if (cssUrl && !stylesheets) {
42
+ const link = document.createElement("link");
43
+ link.setAttribute("rel", "stylesheet");
44
+ link.setAttribute("href", cssUrl);
45
+ document.head.appendChild(link);
26
46
  }
27
- a(this, l)?.unobserve(s);
47
+ __privateGet(this, _intersectionObserver)?.unobserve(target);
28
48
  }
29
49
  }
30
50
  });
31
51
  }
32
- set value(t) {
33
- super.value = t, this.query = this.valueToQuery(t);
52
+ set value(value) {
53
+ super.value = value;
54
+ this.query = this.valueToQuery(value);
34
55
  }
35
56
  get value() {
36
57
  return super.value;
37
58
  }
38
- async fetchAdditionalOptions(t) {
39
- d(this, p, a(this, p) ?? await import("../external-Dtf6f6DP.js").then(({ default: r }) => r));
40
- const e = a(this, p).filter((r) => r.label.includes(t));
41
- return e.length && d(this, l, a(this, l) ?? new IntersectionObserver(a(this, f), {
42
- root: this.listboxElement
43
- })), e;
59
+ async fetchAdditionalOptions(query2) {
60
+ __privateSet(this, _additional, __privateGet(this, _additional) ?? await import("../external-BCrp-PaG.js").then(({ default: items }) => items));
61
+ const filter = this.filter(query2);
62
+ const options = __privateGet(this, _additional).filter(filter);
63
+ if (options.length) {
64
+ __privateSet(this, _intersectionObserver, __privateGet(this, _intersectionObserver) ?? new IntersectionObserver(__privateGet(this, _loadFontsInView), {
65
+ root: this.listboxElement
66
+ }));
67
+ }
68
+ return options;
44
69
  }
45
- valueToQuery(t) {
46
- return t === null ? "" : Array.isArray(t) ? t[0] : t;
70
+ valueToQuery(value) {
71
+ if (value === null) {
72
+ return "";
73
+ }
74
+ return Array.isArray(value) ? value[0] : value;
47
75
  }
48
- queryToValue(t) {
49
- return this.options.find((e) => e.value[0] === t)?.value ?? null;
76
+ queryToValue(query2) {
77
+ return this.options.find((option) => option.value[0] === query2)?.value ?? [query2];
50
78
  }
51
- getOptionForValue(t) {
52
- return this.options.find((e) => e.value.every((r, s) => t?.[s] === r));
79
+ getOptionForValue(value) {
80
+ return this.options.find((option) => option.value.every((entry, index) => value?.[index] === entry));
53
81
  }
54
- renderEntry(t, e) {
55
- const { cssUrl: r, label: s, value: o } = t, i = { fontFamily: o.toString(), fontSizeAdjust: 0.5 };
56
- return b`<span ${x((v) => {
57
- v && a(this, l) && a(this, l).observe(v);
58
- })} style=${O(i)} data-css-url=${E(r)}>
59
- ${s}
60
- </span>`;
82
+ renderEntry({ cssUrl, description, label, value }, index) {
83
+ const styles = { fontFamily: value.toString(), fontSizeAdjust: 0.5 };
84
+ const observeElement = (element) => {
85
+ if (element && __privateGet(this, _intersectionObserver)) {
86
+ __privateGet(this, _intersectionObserver).observe(element);
87
+ }
88
+ };
89
+ return html`
90
+ <div ${ref(observeElement)} style=${styleMap(styles)} data-css-url=${ifDefined(cssUrl)}>${label}</div>
91
+ ${description && index !== void 0 ? html`<div>${description}</div>` : nothing}
92
+ `;
61
93
  }
62
94
  };
63
- p = /* @__PURE__ */ new WeakMap();
64
- l = /* @__PURE__ */ new WeakMap();
65
- f = /* @__PURE__ */ new WeakMap();
66
- h([
67
- C("[role=listbox]")
68
- ], u.prototype, "listboxElement", 2);
69
- h([
70
- w({ converter: g })
71
- ], u.prototype, "value", 1);
72
- u = h([
73
- _(S)
74
- ], u);
95
+ _additional = /* @__PURE__ */ new WeakMap();
96
+ _intersectionObserver = /* @__PURE__ */ new WeakMap();
97
+ _loadFontsInView = /* @__PURE__ */ new WeakMap();
98
+ __decorateClass([
99
+ property({ converter: allowedValuesConverter(ClippyCombobox.allowances, defaultAllowance) })
100
+ ], ClippyFontCombobox.prototype, "allow", 2);
101
+ __decorateClass([
102
+ query("[role=listbox]")
103
+ ], ClippyFontCombobox.prototype, "listboxElement", 2);
104
+ __decorateClass([
105
+ property({ converter: arrayFromCommaList })
106
+ ], ClippyFontCombobox.prototype, "value", 1);
107
+ ClippyFontCombobox = __decorateClass([
108
+ safeCustomElement(tag)
109
+ ], ClippyFontCombobox);
75
110
  export {
76
- u as ClippyFontCombobox
111
+ ClippyFontCombobox
77
112
  };