@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as
|
|
2
|
-
import { css
|
|
3
|
-
const
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
26
|
-
let
|
|
28
|
+
const tag = "clippy-icon";
|
|
29
|
+
let ClippyIcon = class extends LitElement {
|
|
27
30
|
render() {
|
|
28
|
-
return
|
|
31
|
+
return html`<slot></slot>`;
|
|
29
32
|
}
|
|
30
33
|
connectedCallback() {
|
|
31
|
-
super.connectedCallback()
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
if (!this.hasAttribute("aria-hidden")) {
|
|
36
|
+
this.setAttribute("aria-hidden", "true");
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
],
|
|
40
|
+
ClippyIcon.styles = [iconStyles];
|
|
41
|
+
ClippyIcon = __decorateClass([
|
|
42
|
+
safeCustomElement(tag)
|
|
43
|
+
], ClippyIcon);
|
|
38
44
|
export {
|
|
39
|
-
|
|
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 ["
|
|
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;
|
|
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 {
|
|
2
|
-
import { s as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { property
|
|
6
|
-
import { ifDefined
|
|
7
|
-
|
|
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
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
|
221
|
+
let ClippyLangCombobox = class extends LocalizationMixin(C) {
|
|
215
222
|
constructor() {
|
|
216
|
-
super(...arguments)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
|
236
|
+
return hasLabelMatch || exonym.toLowerCase().includes(normalizedQuery);
|
|
223
237
|
case "exonym":
|
|
224
|
-
return
|
|
238
|
+
return hasLabelMatch || autonym.toLowerCase().includes(normalizedQuery);
|
|
225
239
|
default:
|
|
226
|
-
return
|
|
240
|
+
return hasLabelMatch;
|
|
227
241
|
}
|
|
228
242
|
};
|
|
229
243
|
};
|
|
230
244
|
}
|
|
231
|
-
set lang(
|
|
232
|
-
|
|
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
|
|
252
|
+
return __privateGet(this, _lang) || this.DEFAULT_LANG;
|
|
236
253
|
}
|
|
237
|
-
set options(
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
...
|
|
246
|
-
label
|
|
265
|
+
...option,
|
|
266
|
+
label
|
|
247
267
|
};
|
|
248
268
|
}));
|
|
249
269
|
}
|
|
250
270
|
get options() {
|
|
251
|
-
return
|
|
271
|
+
return __privateGet(this, _options);
|
|
252
272
|
}
|
|
253
|
-
renderEntry(
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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: (
|
|
300
|
+
fromAttribute: (value) => FORMAT_OPTIONS.find((v) => v === value) || DEFAULT_FORMAT_OPTION
|
|
275
301
|
},
|
|
276
302
|
type: String
|
|
277
303
|
})
|
|
278
|
-
],
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
],
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
],
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
],
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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,
|
|
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
|
|
2
|
-
import { b as
|
|
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
|
|
5
|
-
import { property
|
|
6
|
-
import { unsafeSVG
|
|
7
|
-
const
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
68
|
-
const
|
|
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
|
|
66
|
+
let ClippyModal = class extends LitElement {
|
|
73
67
|
constructor() {
|
|
74
|
-
super(...arguments)
|
|
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
|
|
77
|
-
this.previouslyFocusedElement =
|
|
78
|
-
|
|
79
|
-
|
|
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:
|
|
82
|
-
composed:
|
|
87
|
+
bubbles: true,
|
|
88
|
+
composed: true
|
|
83
89
|
})
|
|
84
|
-
)
|
|
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
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.close(
|
|
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(
|
|
97
|
-
this.dialogElement?.open
|
|
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
|
|
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
|
|
125
|
+
?open=${this["standard-open"]}
|
|
113
126
|
>
|
|
114
127
|
<form method="dialog" novalidate>
|
|
115
128
|
<header class="ams-dialog__header">
|
|
116
|
-
<clippy-heading level=
|
|
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">${
|
|
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" ?
|
|
130
|
-
<button class="nl-button nl-button--primary" value=${
|
|
131
|
-
${this
|
|
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
|
-
` :
|
|
134
|
-
${this.actions === "cancel" || this.actions === "both" ?
|
|
135
|
-
<button class="nl-button nl-button--secondary" value=${
|
|
136
|
-
${this
|
|
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
|
-
` :
|
|
151
|
+
` : nothing}
|
|
139
152
|
</footer>
|
|
140
153
|
</form>
|
|
141
154
|
</dialog>
|
|
142
155
|
`;
|
|
143
156
|
}
|
|
144
157
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
-
|
|
179
|
-
|
|
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"}
|