@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.
- package/dist/clippy-button/index.js +4 -4
- package/dist/clippy-code/index.js +18 -15
- package/dist/clippy-color-combobox/index.d.ts +9 -13
- package/dist/clippy-color-combobox/index.d.ts.map +1 -1
- package/dist/clippy-color-combobox/index.js +6 -5
- package/dist/clippy-color-combobox/lib.d.ts +16 -12
- package/dist/clippy-color-combobox/lib.d.ts.map +1 -1
- package/dist/clippy-color-combobox/messages/en.d.ts +14 -6
- package/dist/clippy-color-combobox/messages/en.d.ts.map +1 -1
- package/dist/clippy-color-combobox/messages/nl.d.ts +14 -6
- package/dist/clippy-color-combobox/messages/nl.d.ts.map +1 -1
- package/dist/clippy-combobox/index.d.ts +22 -8
- package/dist/clippy-combobox/index.d.ts.map +1 -1
- package/dist/clippy-combobox/index.js +703 -8
- package/dist/clippy-font-combobox/index.d.ts +4 -3
- package/dist/clippy-font-combobox/index.d.ts.map +1 -1
- package/dist/clippy-font-combobox/index.js +94 -59
- package/dist/clippy-heading/index.js +180 -174
- package/dist/clippy-html-image/index.js +51 -31
- package/dist/clippy-icon/index.js +22 -16
- package/dist/clippy-lang-combobox/index.d.ts +2 -4
- package/dist/clippy-lang-combobox/index.d.ts.map +1 -1
- package/dist/clippy-lang-combobox/index.js +104 -78
- package/dist/clippy-modal/index.d.ts +3 -3
- package/dist/clippy-modal/index.d.ts.map +1 -1
- package/dist/clippy-modal/index.js +98 -89
- package/dist/clippy-toggletip/index.d.ts +16 -0
- package/dist/clippy-toggletip/index.d.ts.map +1 -0
- package/dist/clippy-toggletip/index.js +180 -0
- package/dist/decorators-Cq82_-g_.js +11 -0
- package/dist/en-D1kE0w6o.js +4 -0
- package/dist/external-BCrp-PaG.js +4 -0
- package/dist/index-7tZ2Ykfm.js +135 -0
- package/dist/index-C9pF3BXT.js +10683 -0
- package/dist/lib/FormElement/index.d.ts +2 -1
- package/dist/lib/FormElement/index.d.ts.map +1 -1
- package/dist/lib/FormElement/index.js +95 -0
- package/dist/lib/LocalizationMixin/index.d.ts.map +1 -1
- package/dist/lib/LocalizationMixin/index.js +64 -0
- package/dist/lib/converters/index.d.ts +4 -0
- package/dist/lib/converters/index.d.ts.map +1 -1
- package/dist/lib/converters/index.js +35 -0
- package/dist/lib/sr-only/index.d.ts +3 -0
- package/dist/lib/sr-only/index.d.ts.map +1 -0
- package/dist/lib/sr-only/index.js +18 -0
- package/dist/nl-99gBQbne.js +19 -0
- package/package.json +19 -16
- package/dist/decorators-BGpMqJ7V.js +0 -7
- package/dist/en-B-D8DBsf.js +0 -4
- package/dist/external-Dtf6f6DP.js +0 -4
- package/dist/index-CT1z3SFL.js +0 -106
- package/dist/index-CaVpiaBC.js +0 -52
- package/dist/index-CmKtM5nD.js +0 -379
- package/dist/index-CtreqNZ6.js +0 -3602
- package/dist/index-D3FiqptQ.js +0 -65
- 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
|
-
|
|
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[]
|
|
22
|
+
queryToValue(query: string): string[];
|
|
22
23
|
getOptionForValue(value: Option['value'] | null): Option | undefined;
|
|
23
|
-
renderEntry(
|
|
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;
|
|
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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAKF,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;;IAEnD,KAAK,EAAE,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAoB;IAI9E,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;IAiC9D,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM;IAOnD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAKrC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAIpE,WAAW,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAalF"}
|
|
@@ -1,77 +1,112 @@
|
|
|
1
|
-
import { s as
|
|
2
|
-
import { html
|
|
3
|
-
import {
|
|
4
|
-
import { ifDefined
|
|
5
|
-
import { ref
|
|
6
|
-
import { styleMap
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
47
|
+
__privateGet(this, _intersectionObserver)?.unobserve(target);
|
|
28
48
|
}
|
|
29
49
|
}
|
|
30
50
|
});
|
|
31
51
|
}
|
|
32
|
-
set value(
|
|
33
|
-
super.value =
|
|
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(
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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(
|
|
46
|
-
|
|
70
|
+
valueToQuery(value) {
|
|
71
|
+
if (value === null) {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
return Array.isArray(value) ? value[0] : value;
|
|
47
75
|
}
|
|
48
|
-
queryToValue(
|
|
49
|
-
return this.options.find((
|
|
76
|
+
queryToValue(query2) {
|
|
77
|
+
return this.options.find((option) => option.value[0] === query2)?.value ?? [query2];
|
|
50
78
|
}
|
|
51
|
-
getOptionForValue(
|
|
52
|
-
return this.options.find((
|
|
79
|
+
getOptionForValue(value) {
|
|
80
|
+
return this.options.find((option) => option.value.every((entry, index) => value?.[index] === entry));
|
|
53
81
|
}
|
|
54
|
-
renderEntry(
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
],
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
],
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
],
|
|
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
|
-
|
|
111
|
+
ClippyFontCombobox
|
|
77
112
|
};
|