@duetds/components 8.5.5 → 8.6.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/hydrate/index.js +289 -113
- package/lib/cjs/duet-alert.cjs.entry.js +1 -1
- package/lib/cjs/duet-banner.cjs.entry.js +1 -1
- package/lib/cjs/duet-callout.cjs.entry.js +1 -1
- package/lib/cjs/duet-chip.cjs.entry.js +9 -2
- package/lib/cjs/duet-choice_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-collapsible.cjs.entry.js +1 -1
- package/lib/cjs/duet-combobox.cjs.entry.js +260 -127
- package/lib/cjs/duet-date-picker.cjs.entry.js +1 -1
- package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
- package/lib/cjs/duet-hero.cjs.entry.js +1 -1
- package/lib/cjs/duet-input_2.cjs.entry.js +39 -3
- package/lib/cjs/duet-modal.cjs.entry.js +1 -1
- package/lib/cjs/duet-multiselect.cjs.entry.js +1 -1
- package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
- package/lib/cjs/duet-promo-card.cjs.entry.js +1 -1
- package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-scrollable_3.cjs.entry.js +1 -1
- package/lib/cjs/duet-select.cjs.entry.js +1 -1
- package/lib/cjs/duet-slideout-panel.cjs.entry.js +1 -1
- package/lib/cjs/duet-slideout.cjs.entry.js +1 -1
- package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +1 -1
- package/lib/cjs/loader.cjs.js +1 -1
- package/lib/cjs/{slot-utils-f5073417.js → slot-utils-03a40c78.js} +3 -1
- package/lib/collection/components/duet-chip/duet-chip.css +7 -0
- package/lib/collection/components/duet-chip/duet-chip.js +29 -2
- package/lib/collection/components/duet-combobox/duet-combobox-select-single.js +2 -2
- package/lib/collection/components/duet-combobox/duet-combobox.css +10 -2
- package/lib/collection/components/duet-combobox/duet-combobox.e2e.js +81 -51
- package/lib/collection/components/duet-combobox/duet-combobox.js +321 -142
- package/lib/collection/components/duet-input/duet-input.css +29 -0
- package/lib/collection/components/duet-input/duet-input.js +159 -3
- package/lib/collection/utils/slot-utils.js +3 -1
- package/lib/dist-custom-elements/duet-action-button.js +1 -1
- package/lib/dist-custom-elements/duet-alert.js +1 -1
- package/lib/dist-custom-elements/duet-banner.js +1 -1
- package/lib/dist-custom-elements/duet-breadcrumb.js +1 -1
- package/lib/dist-custom-elements/duet-callout.js +1 -1
- package/lib/dist-custom-elements/duet-card.js +1 -1
- package/lib/dist-custom-elements/duet-chip.js +1 -273
- package/lib/dist-custom-elements/duet-choice-group.js +5 -5
- package/lib/dist-custom-elements/duet-choice.js +2 -2
- package/lib/dist-custom-elements/duet-collapsible.js +2 -2
- package/lib/dist-custom-elements/duet-combobox.js +326 -132
- package/lib/dist-custom-elements/duet-cookie-consent.js +1 -1
- package/lib/dist-custom-elements/duet-date-picker.js +6 -6
- package/lib/dist-custom-elements/duet-editable-table.js +2 -2
- package/lib/dist-custom-elements/duet-fieldset.js +1 -1
- package/lib/dist-custom-elements/duet-footer.js +1 -1
- package/lib/dist-custom-elements/duet-header.js +1 -1
- package/lib/dist-custom-elements/duet-hero.js +1 -1
- package/lib/dist-custom-elements/duet-input.js +1 -1
- package/lib/dist-custom-elements/duet-menu-bar-dropdown-link.js +1 -1
- package/lib/dist-custom-elements/duet-menu-bar-dropdown.js +1 -1
- package/lib/dist-custom-elements/duet-modal.js +2 -2
- package/lib/dist-custom-elements/duet-multiselect.js +5 -5
- package/lib/dist-custom-elements/duet-notification-drawer.js +1 -1
- package/lib/dist-custom-elements/duet-notification.js +1 -1
- package/lib/dist-custom-elements/duet-number-input.js +6 -6
- package/lib/dist-custom-elements/duet-pagination.js +6 -6
- package/lib/dist-custom-elements/duet-popup-menu.js +1 -1
- package/lib/dist-custom-elements/duet-promo-card.js +1 -1
- package/lib/dist-custom-elements/duet-radio-group.js +5 -5
- package/lib/dist-custom-elements/duet-range-slider.js +1 -1
- package/lib/dist-custom-elements/duet-range-stepper.js +2 -2
- package/lib/dist-custom-elements/duet-scrollable.js +1 -1
- package/lib/dist-custom-elements/duet-select.js +1 -1
- package/lib/dist-custom-elements/duet-show-more.js +1 -1
- package/lib/dist-custom-elements/duet-slideout-panel.js +1 -1
- package/lib/dist-custom-elements/duet-slideout.js +2 -2
- package/lib/dist-custom-elements/duet-step.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-dropdown-link.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-dropdown.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-item.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-link.js +1 -1
- package/lib/dist-custom-elements/duet-tab-group.js +6 -6
- package/lib/dist-custom-elements/duet-tab.js +1 -1
- package/lib/dist-custom-elements/duet-textarea.js +4 -4
- package/lib/dist-custom-elements/duet-toggle.js +1 -1
- package/lib/dist-custom-elements/duet-toolbar-dropdown-link.js +1 -1
- package/lib/dist-custom-elements/duet-toolbar-dropdown.js +1 -1
- package/lib/dist-custom-elements/duet-tooltip-button.js +1 -1
- package/lib/dist-custom-elements/duet-tooltip-popup.js +1 -1
- package/lib/dist-custom-elements/duet-tooltip.js +1 -1
- package/lib/dist-custom-elements/duet-tray.js +1 -1
- package/lib/dist-custom-elements/duet-upload-item.js +1 -1
- package/lib/dist-custom-elements/duet-upload.js +5 -5
- package/lib/dist-custom-elements/{p-cff358b0.js → p-014c1177.js} +49 -8
- package/lib/dist-custom-elements/{p-c3d02eb2.js → p-03152b20.js} +1 -1
- package/lib/dist-custom-elements/{p-d87f6dd5.js → p-06e608ae.js} +3 -1
- package/lib/dist-custom-elements/{p-9cdbc360.js → p-0cee8a12.js} +1 -1
- package/lib/dist-custom-elements/{p-12a0876b.js → p-24693e9a.js} +1 -1
- package/lib/dist-custom-elements/{p-9a833e56.js → p-28ec3461.js} +1 -1
- package/lib/dist-custom-elements/{p-d191ba9e.js → p-45fd4d84.js} +1 -1
- package/lib/dist-custom-elements/{p-89d58b60.js → p-6d366100.js} +3 -3
- package/lib/dist-custom-elements/p-755dd68f.js +285 -0
- package/lib/dist-custom-elements/{p-e44c0eff.js → p-785686e3.js} +1 -1
- package/lib/dist-custom-elements/{p-e00d43f3.js → p-92a16064.js} +1 -1
- package/lib/dist-custom-elements/{p-f9f9e33d.js → p-a02e62f3.js} +3 -3
- package/lib/dist-custom-elements/{p-0d5c0a22.js → p-c8415e2f.js} +1 -1
- package/lib/dist-custom-elements/{p-d848b48d.js → p-e702eb52.js} +4 -4
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/{p-88a46585.system.entry.js → p-061f4be0.system.entry.js} +1 -1
- package/lib/duet/p-06e608ae.js +4 -0
- package/lib/duet/{p-8ca813cb.system.entry.js → p-0778ccde.system.entry.js} +1 -1
- package/lib/duet/p-07ac7f3e.system.entry.js +4 -0
- package/lib/duet/p-15e24bf0.entry.js +4 -0
- package/lib/duet/{p-0dac34a4.system.entry.js → p-1ef0e5ca.system.entry.js} +1 -1
- package/lib/duet/{p-c9781f22.entry.js → p-2084a65f.entry.js} +1 -1
- package/lib/duet/{p-fd0bb0bf.entry.js → p-23cecf9f.entry.js} +1 -1
- package/lib/duet/{p-09e4195f.system.entry.js → p-257800b7.system.entry.js} +1 -1
- package/lib/duet/{p-1afd901a.entry.js → p-29491f9f.entry.js} +1 -1
- package/lib/duet/{p-3b5ff822.entry.js → p-3302d75d.entry.js} +1 -1
- package/lib/duet/{p-7629cd0a.entry.js → p-40375e30.entry.js} +1 -1
- package/lib/duet/{p-ba4445cf.system.entry.js → p-45bb3cd0.system.entry.js} +1 -1
- package/lib/duet/p-4781cd58.entry.js +4 -0
- package/lib/duet/p-4cb5943c.entry.js +4 -0
- package/lib/duet/{p-b2f2992f.system.entry.js → p-4de910bd.system.entry.js} +1 -1
- package/lib/duet/p-6151635f.system.js +1 -1
- package/lib/duet/{p-d349dd93.entry.js → p-67382632.entry.js} +1 -1
- package/lib/duet/{p-699a98b4.entry.js → p-76e54ff5.entry.js} +1 -1
- package/lib/duet/{p-4d2ef0e2.entry.js → p-7a161455.entry.js} +1 -1
- package/lib/duet/{p-3d38079c.entry.js → p-7ca15c93.entry.js} +1 -1
- package/lib/duet/{p-bb09fff0.system.entry.js → p-7de614df.system.entry.js} +1 -1
- package/lib/duet/{p-480f37b6.entry.js → p-83238fe7.entry.js} +1 -1
- package/lib/duet/{p-7c1db591.system.entry.js → p-8a4ba903.system.entry.js} +1 -1
- package/lib/duet/{p-4f32a7ee.entry.js → p-8ba91848.entry.js} +1 -1
- package/lib/duet/{p-708359ec.system.entry.js → p-999fff8d.system.entry.js} +1 -1
- package/lib/duet/{p-9d91a1dd.system.entry.js → p-9e75e5d8.system.entry.js} +1 -1
- package/lib/duet/{p-343d037e.entry.js → p-a3afb1af.entry.js} +1 -1
- package/lib/duet/{p-2ca6a8a0.system.entry.js → p-a3e90064.system.entry.js} +1 -1
- package/lib/duet/{p-892a5644.system.entry.js → p-aba91113.system.entry.js} +1 -1
- package/lib/duet/p-ae21ad57.system.js +4 -0
- package/lib/duet/{p-ce05fe6d.system.entry.js → p-b2fc4b72.system.entry.js} +1 -1
- package/lib/duet/{p-84778369.entry.js → p-b5595969.entry.js} +1 -1
- package/lib/duet/{p-bf51f8a5.system.entry.js → p-c68602c9.system.entry.js} +1 -1
- package/lib/duet/{p-f6530332.system.entry.js → p-d5721f0d.system.entry.js} +1 -1
- package/lib/duet/{p-c00fe4ed.entry.js → p-dc133655.entry.js} +1 -1
- package/lib/duet/p-de5054b6.system.entry.js +4 -0
- package/lib/duet/{p-61feb701.entry.js → p-df345202.entry.js} +1 -1
- package/lib/duet/{p-2628a322.entry.js → p-e0907f29.entry.js} +1 -1
- package/lib/duet/p-e333b9fc.system.entry.js +4 -0
- package/lib/duet/p-e411627f.entry.js +4 -0
- package/lib/duet/{p-da51c71f.system.entry.js → p-eafed149.system.entry.js} +1 -1
- package/lib/duet/p-f2279e1e.entry.js +4 -0
- package/lib/duet/{p-b1ab1664.system.entry.js → p-fa311641.system.entry.js} +1 -1
- package/lib/duet/{p-320318de.system.entry.js → p-fa72c79b.system.entry.js} +1 -1
- package/lib/esm/duet-alert.entry.js +1 -1
- package/lib/esm/duet-banner.entry.js +1 -1
- package/lib/esm/duet-callout.entry.js +1 -1
- package/lib/esm/duet-chip.entry.js +9 -2
- package/lib/esm/duet-choice_2.entry.js +1 -1
- package/lib/esm/duet-collapsible.entry.js +1 -1
- package/lib/esm/duet-combobox.entry.js +261 -128
- package/lib/esm/duet-date-picker.entry.js +1 -1
- package/lib/esm/duet-fieldset.entry.js +1 -1
- package/lib/esm/duet-hero.entry.js +1 -1
- package/lib/esm/duet-input_2.entry.js +39 -3
- package/lib/esm/duet-modal.entry.js +1 -1
- package/lib/esm/duet-multiselect.entry.js +1 -1
- package/lib/esm/duet-number-input.entry.js +1 -1
- package/lib/esm/duet-promo-card.entry.js +1 -1
- package/lib/esm/duet-radio_2.entry.js +1 -1
- package/lib/esm/duet-scrollable_3.entry.js +1 -1
- package/lib/esm/duet-select.entry.js +1 -1
- package/lib/esm/duet-slideout-panel.entry.js +1 -1
- package/lib/esm/duet-slideout.entry.js +1 -1
- package/lib/esm/duet-textarea.entry.js +1 -1
- package/lib/esm/duet.js +1 -1
- package/lib/esm/loader.js +1 -1
- package/lib/esm/{slot-utils-1115a819.js → slot-utils-b50aaef5.js} +3 -1
- package/lib/esm-es5/duet-alert.entry.js +1 -1
- package/lib/esm-es5/duet-banner.entry.js +1 -1
- package/lib/esm-es5/duet-callout.entry.js +1 -1
- package/lib/esm-es5/duet-chip.entry.js +1 -1
- package/lib/esm-es5/duet-choice_2.entry.js +1 -1
- package/lib/esm-es5/duet-collapsible.entry.js +1 -1
- package/lib/esm-es5/duet-combobox.entry.js +2 -2
- package/lib/esm-es5/duet-date-picker.entry.js +1 -1
- package/lib/esm-es5/duet-fieldset.entry.js +1 -1
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-input_2.entry.js +2 -2
- package/lib/esm-es5/duet-modal.entry.js +1 -1
- package/lib/esm-es5/duet-multiselect.entry.js +1 -1
- package/lib/esm-es5/duet-number-input.entry.js +2 -2
- package/lib/esm-es5/duet-promo-card.entry.js +2 -2
- package/lib/esm-es5/duet-radio_2.entry.js +1 -1
- package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
- package/lib/esm-es5/duet-select.entry.js +1 -1
- package/lib/esm-es5/duet-slideout-panel.entry.js +1 -1
- package/lib/esm-es5/duet-slideout.entry.js +1 -1
- package/lib/esm-es5/duet-textarea.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/slot-utils-b50aaef5.js +4 -0
- package/lib/types/components/duet-chip/duet-chip.d.ts +4 -0
- package/lib/types/components/duet-combobox/duet-combobox.d.ts +49 -35
- package/lib/types/components/duet-input/duet-input.d.ts +30 -0
- package/lib/types/components.d.ts +44 -21
- package/package.json +2 -2
- package/lib/duet/p-7cf03aa8.system.js +0 -4
- package/lib/duet/p-92e1181c.entry.js +0 -4
- package/lib/duet/p-985c0c67.system.entry.js +0 -4
- package/lib/duet/p-9d27bc65.entry.js +0 -4
- package/lib/duet/p-afe29a3e.entry.js +0 -4
- package/lib/duet/p-cc4a8964.entry.js +0 -4
- package/lib/duet/p-d50ad3ed.entry.js +0 -4
- package/lib/duet/p-d87f6dd5.js +0 -4
- package/lib/duet/p-f1b01db9.system.entry.js +0 -4
- package/lib/duet/p-fa21a3b6.system.entry.js +0 -4
- package/lib/esm-es5/slot-utils-1115a819.js +0 -4
|
@@ -190,6 +190,9 @@ duet-caption:not(:last-of-type) {
|
|
|
190
190
|
.duet-input.is-date {
|
|
191
191
|
padding-right: 64px !important;
|
|
192
192
|
}
|
|
193
|
+
.duet-input.after-chip {
|
|
194
|
+
padding-left: 8px !important;
|
|
195
|
+
}
|
|
193
196
|
.has-error .duet-input {
|
|
194
197
|
border-color: rgb(222, 35, 98) !important;
|
|
195
198
|
}
|
|
@@ -446,4 +449,30 @@ duet-caption:not(:last-of-type) {
|
|
|
446
449
|
}
|
|
447
450
|
.duet-input-variation-revealable.duet-theme-turva.has-error:hover:not(.disabled) .duet-input-relative {
|
|
448
451
|
box-shadow: 0 0 0 1px #e55039;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.duet-input-container.has-chips .duet-input-relative {
|
|
455
|
+
display: flex;
|
|
456
|
+
flex-direction: row;
|
|
457
|
+
flex-wrap: wrap;
|
|
458
|
+
align-content: center;
|
|
459
|
+
align-items: center;
|
|
460
|
+
justify-content: flex-start;
|
|
461
|
+
width: auto;
|
|
462
|
+
border: 1px solid rgb(144, 149, 153);
|
|
463
|
+
border-radius: 4px;
|
|
464
|
+
box-shadow: initial;
|
|
465
|
+
transition: box-shadow 150ms ease, border 150ms ease;
|
|
466
|
+
}
|
|
467
|
+
.duet-theme-turva .duet-input-container.has-chips .duet-input-relative {
|
|
468
|
+
border-color: rgb(116, 116, 117);
|
|
469
|
+
}
|
|
470
|
+
.duet-input-container.has-chips .duet-input-relative .duet-input {
|
|
471
|
+
flex-basis: 4rem;
|
|
472
|
+
flex-grow: 1;
|
|
473
|
+
border-width: 0 !important;
|
|
474
|
+
}
|
|
475
|
+
.duet-input-container.has-chips .duet-input-relative .duet-input:focus, .duet-input-container.has-chips .duet-input-relative .duet-input:hover {
|
|
476
|
+
border-width: 0 !important;
|
|
477
|
+
box-shadow: none !important;
|
|
449
478
|
}
|
|
@@ -173,6 +173,7 @@ export class DuetInput {
|
|
|
173
173
|
this.required = false;
|
|
174
174
|
this.type = "text";
|
|
175
175
|
this.variation = "default";
|
|
176
|
+
this.chips = false;
|
|
176
177
|
this.label = "Label";
|
|
177
178
|
this.labelColor = undefined;
|
|
178
179
|
this.labelWeight = undefined;
|
|
@@ -201,7 +202,7 @@ export class DuetInput {
|
|
|
201
202
|
if (((_a = this === null || this === void 0 ? void 0 : this.nativeInput) === null || _a === void 0 ? void 0 : _a.value) !== this.value) {
|
|
202
203
|
const restoreCursor = resetCursor(this.nativeInput);
|
|
203
204
|
this.nativeInput.value = this.value;
|
|
204
|
-
// restore selection position after having set
|
|
205
|
+
// restore selection position after having set valuea
|
|
205
206
|
// (in webkit based browsers settings value trigger cursor position and will set it to EndOfText)
|
|
206
207
|
restoreCursor();
|
|
207
208
|
}
|
|
@@ -271,6 +272,39 @@ export class DuetInput {
|
|
|
271
272
|
this.value = "";
|
|
272
273
|
}
|
|
273
274
|
}
|
|
275
|
+
getAllChips() {
|
|
276
|
+
return Array.from(this.element.querySelectorAll(".duet-input-relative duet-chip"));
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* @internal
|
|
280
|
+
* Add a chip to the input
|
|
281
|
+
*/
|
|
282
|
+
async addChip(chip) {
|
|
283
|
+
const container = this.element.querySelector(".duet-input-relative");
|
|
284
|
+
const input = container.querySelector("input");
|
|
285
|
+
container.insertBefore(chip, input);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
* Does the input have a chip with the given value and text
|
|
290
|
+
*/
|
|
291
|
+
async hasChip({ value, text }) {
|
|
292
|
+
return this.getAllChips().some(chip => chip.value === value && chip.textContent === text);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* @internal
|
|
296
|
+
* Get all chips from the input
|
|
297
|
+
*/
|
|
298
|
+
async getChips() {
|
|
299
|
+
return this.getAllChips();
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* @internal
|
|
303
|
+
* Remove all chips from the input
|
|
304
|
+
*/
|
|
305
|
+
async clearChips() {
|
|
306
|
+
this.getAllChips().forEach(chip => chip.remove());
|
|
307
|
+
}
|
|
274
308
|
/**
|
|
275
309
|
* render() function
|
|
276
310
|
* Always the last one in the class.
|
|
@@ -317,6 +351,7 @@ export class DuetInput {
|
|
|
317
351
|
(!!this.icon ||
|
|
318
352
|
(this.type !== "text" && this.type !== "tel" && this.type !== "password" && this.type !== "time")),
|
|
319
353
|
"has-error": !!this.error,
|
|
354
|
+
"has-chips": this.chips,
|
|
320
355
|
"has-clear": this.clear,
|
|
321
356
|
"has-focus": this.isFocused,
|
|
322
357
|
disabled: this.disabled,
|
|
@@ -325,6 +360,7 @@ export class DuetInput {
|
|
|
325
360
|
disabled: this.disabled,
|
|
326
361
|
"is-number": this.component === "number",
|
|
327
362
|
"is-date": this.component === "date",
|
|
363
|
+
"after-chip": this.getAllChips().length > 0,
|
|
328
364
|
}, value: this.value, disabled: this.disabled, "aria-invalid": this.error ? "true" : "false", "aria-labelledby": this.accessibleLabelledBy ? `${this.labelId} ${this.accessibleLabelledBy}` : this.labelId, "aria-controls": this.accessibleControls, "aria-autocomplete": this.accessibleAutocomplete, "aria-activedescendant": this.accessibleActiveDescendant, "aria-details": this.accessibleDetails, "aria-description": this.accessibleDescription, "aria-expanded": this.accessibleExpanded, "aria-haspopup": this.accessibleHasPopup, "aria-owns": this.accessibleOwns, "aria-describedby": this.getDescribedBy(), placeholder: this.placeholder, spellcheck: "false", minlength: this.minlength, maxlength: this.maxlength, autocomplete: this.type === "password" ? "off" : this.autoComplete, required: this.required, role: this.role, name: this.name, id: identifier }, inputProps)), !this.value && hasInputIcon && (h("div", { class: "duet-input-icon" }, h("duet-icon", { margin: "none", size: "small", icon: icons[this.type].svg, color: "currentColor" }))), this.clear && this.value && (h("div", { class: {
|
|
329
365
|
"duet-input-clear-icon": true,
|
|
330
366
|
"duet-input-clear-icon-single": !hasInputIcon,
|
|
@@ -781,6 +817,27 @@ export class DuetInput {
|
|
|
781
817
|
"reflect": false,
|
|
782
818
|
"defaultValue": "\"default\""
|
|
783
819
|
},
|
|
820
|
+
"chips": {
|
|
821
|
+
"type": "boolean",
|
|
822
|
+
"mutable": false,
|
|
823
|
+
"complexType": {
|
|
824
|
+
"original": "boolean",
|
|
825
|
+
"resolved": "boolean",
|
|
826
|
+
"references": {}
|
|
827
|
+
},
|
|
828
|
+
"required": false,
|
|
829
|
+
"optional": false,
|
|
830
|
+
"docs": {
|
|
831
|
+
"tags": [{
|
|
832
|
+
"name": "internal",
|
|
833
|
+
"text": "Render a container for chips"
|
|
834
|
+
}],
|
|
835
|
+
"text": ""
|
|
836
|
+
},
|
|
837
|
+
"attribute": "chips",
|
|
838
|
+
"reflect": false,
|
|
839
|
+
"defaultValue": "false"
|
|
840
|
+
},
|
|
784
841
|
"label": {
|
|
785
842
|
"type": "string",
|
|
786
843
|
"mutable": true,
|
|
@@ -995,8 +1052,11 @@ export class DuetInput {
|
|
|
995
1052
|
"required": false,
|
|
996
1053
|
"optional": false,
|
|
997
1054
|
"docs": {
|
|
998
|
-
"tags": [
|
|
999
|
-
|
|
1055
|
+
"tags": [{
|
|
1056
|
+
"name": "internal",
|
|
1057
|
+
"text": "Used internally in Duet to adjust whether this component acts as e.g. number input."
|
|
1058
|
+
}],
|
|
1059
|
+
"text": ""
|
|
1000
1060
|
},
|
|
1001
1061
|
"attribute": "component",
|
|
1002
1062
|
"reflect": false,
|
|
@@ -1314,6 +1374,102 @@ export class DuetInput {
|
|
|
1314
1374
|
"text": "Reset the cursor position on the native element\n`input.resetCursor()`.",
|
|
1315
1375
|
"tags": []
|
|
1316
1376
|
}
|
|
1377
|
+
},
|
|
1378
|
+
"addChip": {
|
|
1379
|
+
"complexType": {
|
|
1380
|
+
"signature": "(chip: HTMLDuetChipElement) => Promise<void>",
|
|
1381
|
+
"parameters": [{
|
|
1382
|
+
"name": "chip",
|
|
1383
|
+
"type": "HTMLDuetChipElement",
|
|
1384
|
+
"docs": ""
|
|
1385
|
+
}],
|
|
1386
|
+
"references": {
|
|
1387
|
+
"Promise": {
|
|
1388
|
+
"location": "global",
|
|
1389
|
+
"id": "global::Promise"
|
|
1390
|
+
},
|
|
1391
|
+
"HTMLDuetChipElement": {
|
|
1392
|
+
"location": "global",
|
|
1393
|
+
"id": "global::HTMLDuetChipElement"
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
"return": "Promise<void>"
|
|
1397
|
+
},
|
|
1398
|
+
"docs": {
|
|
1399
|
+
"text": "",
|
|
1400
|
+
"tags": [{
|
|
1401
|
+
"name": "internal",
|
|
1402
|
+
"text": "Add a chip to the input"
|
|
1403
|
+
}]
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
"hasChip": {
|
|
1407
|
+
"complexType": {
|
|
1408
|
+
"signature": "({ value, text }: { value: string; text: string; }) => Promise<boolean>",
|
|
1409
|
+
"parameters": [{
|
|
1410
|
+
"name": "__0",
|
|
1411
|
+
"type": "{ value: string; text: string; }",
|
|
1412
|
+
"docs": ""
|
|
1413
|
+
}],
|
|
1414
|
+
"references": {
|
|
1415
|
+
"Promise": {
|
|
1416
|
+
"location": "global",
|
|
1417
|
+
"id": "global::Promise"
|
|
1418
|
+
}
|
|
1419
|
+
},
|
|
1420
|
+
"return": "Promise<boolean>"
|
|
1421
|
+
},
|
|
1422
|
+
"docs": {
|
|
1423
|
+
"text": "",
|
|
1424
|
+
"tags": [{
|
|
1425
|
+
"name": "internal",
|
|
1426
|
+
"text": "Does the input have a chip with the given value and text"
|
|
1427
|
+
}]
|
|
1428
|
+
}
|
|
1429
|
+
},
|
|
1430
|
+
"getChips": {
|
|
1431
|
+
"complexType": {
|
|
1432
|
+
"signature": "() => Promise<HTMLDuetChipElement[]>",
|
|
1433
|
+
"parameters": [],
|
|
1434
|
+
"references": {
|
|
1435
|
+
"Promise": {
|
|
1436
|
+
"location": "global",
|
|
1437
|
+
"id": "global::Promise"
|
|
1438
|
+
},
|
|
1439
|
+
"HTMLDuetChipElement": {
|
|
1440
|
+
"location": "global",
|
|
1441
|
+
"id": "global::HTMLDuetChipElement"
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
"return": "Promise<HTMLDuetChipElement[]>"
|
|
1445
|
+
},
|
|
1446
|
+
"docs": {
|
|
1447
|
+
"text": "",
|
|
1448
|
+
"tags": [{
|
|
1449
|
+
"name": "internal",
|
|
1450
|
+
"text": "Get all chips from the input"
|
|
1451
|
+
}]
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
"clearChips": {
|
|
1455
|
+
"complexType": {
|
|
1456
|
+
"signature": "() => Promise<void>",
|
|
1457
|
+
"parameters": [],
|
|
1458
|
+
"references": {
|
|
1459
|
+
"Promise": {
|
|
1460
|
+
"location": "global",
|
|
1461
|
+
"id": "global::Promise"
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
"return": "Promise<void>"
|
|
1465
|
+
},
|
|
1466
|
+
"docs": {
|
|
1467
|
+
"text": "",
|
|
1468
|
+
"tags": [{
|
|
1469
|
+
"name": "internal",
|
|
1470
|
+
"text": "Remove all chips from the input"
|
|
1471
|
+
}]
|
|
1472
|
+
}
|
|
1317
1473
|
}
|
|
1318
1474
|
};
|
|
1319
1475
|
}
|
|
@@ -11,7 +11,9 @@ export const getElementsFromDefaultSlot = (element) => {
|
|
|
11
11
|
return childElements.filter(el => !el.getAttribute("slot"));
|
|
12
12
|
};
|
|
13
13
|
export const hasSlot = (element, slotName) => {
|
|
14
|
-
return
|
|
14
|
+
return slotName
|
|
15
|
+
? getElementsFromNamedSlot(element, slotName).length > 0
|
|
16
|
+
: getElementsFromDefaultSlot(element).length > 0;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* Check if the slotted element matches the given selector.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
import { D as DuetActionButton$1, d as defineCustomElement$1 } from './p-
|
|
4
|
+
import { D as DuetActionButton$1, d as defineCustomElement$1 } from './p-03152b20.js';
|
|
5
5
|
|
|
6
6
|
const DuetActionButton = DuetActionButton$1;
|
|
7
7
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
import { D as DuetAlert$1, d as defineCustomElement$1 } from './p-
|
|
4
|
+
import { D as DuetAlert$1, d as defineCustomElement$1 } from './p-6d366100.js';
|
|
5
5
|
|
|
6
6
|
const DuetAlert = DuetAlert$1;
|
|
7
7
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { p as proxyCustomElement, H, h as h$1, d as Host } from './p-e98f9bb0.js';
|
|
5
5
|
import { i as inheritGlobalTheme } from './p-a58bd561.js';
|
|
6
6
|
import { h } from './p-33937fd7.js';
|
|
7
|
-
import { h as hasSlot, c as checkNamedSlotElement } from './p-
|
|
7
|
+
import { h as hasSlot, c as checkNamedSlotElement } from './p-06e608ae.js';
|
|
8
8
|
import { p as parsePossibleJSON } from './p-0e052642.js';
|
|
9
9
|
import { g as getColorByName } from './p-25c80cdb.js';
|
|
10
10
|
import { d as defineCustomElement$3 } from './p-a167e2a0.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { p as proxyCustomElement, H, h, d as Host } from './p-e98f9bb0.js';
|
|
5
5
|
import { i as inheritGlobalTheme } from './p-a58bd561.js';
|
|
6
|
-
import { s as subscribeTabbingChange, u as unsubscribeTabbingChange } from './p-
|
|
6
|
+
import { s as subscribeTabbingChange, u as unsubscribeTabbingChange } from './p-785686e3.js';
|
|
7
7
|
import { a as getLanguage, c as connectLanguageChangeObserver, d as disconnectLanguageChangeObserver, g as getLocaleString } from './p-2e36d5bf.js';
|
|
8
8
|
import { d as defineCustomElement$3 } from './p-667579b0.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './p-23e23ced.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { p as proxyCustomElement, H, h, d as Host } from './p-e98f9bb0.js';
|
|
5
5
|
import { i as inheritGlobalTheme } from './p-a58bd561.js';
|
|
6
|
-
import { h as hasSlot, c as checkNamedSlotElement } from './p-
|
|
6
|
+
import { h as hasSlot, c as checkNamedSlotElement } from './p-06e608ae.js';
|
|
7
7
|
import { d as defineCustomElement$2 } from './p-667579b0.js';
|
|
8
8
|
|
|
9
9
|
const duetCalloutCss = ":host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;position:relative;display:block;width:100%}blockquote,figure{margin:0}.duet-callout{margin-bottom:28px !important;display:flex;align-items:center;justify-content:center;width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.duet-callout .container{display:flex;flex-direction:column;gap:8px;align-items:center;max-width:688px;text-align:center}.duet-callout .callout-icon{width:50px;padding-bottom:8px}.duet-callout blockquote{font-size:2.7vw;font-weight:600;line-height:1.5;color:rgb(0, 41, 77)}@media (max-width: 37.037037037rem){.duet-callout blockquote{font-size:1rem}}@media (min-width: 46.2962962963rem){.duet-callout blockquote{font-size:1.25rem}}.duet-callout .author{color:rgb(0, 41, 77)}.duet-callout.duet-theme-turva{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.duet-callout.duet-theme-turva .author,.duet-callout.duet-theme-turva blockquote{color:rgb(23, 28, 58)}.duet-callout.duet-m-0{margin:0 !important}";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment, d as Host } from './p-e98f9bb0.js';
|
|
5
5
|
import { i as inheritGlobalTheme } from './p-a58bd561.js';
|
|
6
6
|
import { c as createID } from './p-5e59e970.js';
|
|
7
|
-
import { i as isKeyboardClick, s as subscribeTabbingChange, u as unsubscribeTabbingChange } from './p-
|
|
7
|
+
import { i as isKeyboardClick, s as subscribeTabbingChange, u as unsubscribeTabbingChange } from './p-785686e3.js';
|
|
8
8
|
import { s as sanitizeString } from './p-0e052642.js';
|
|
9
9
|
import { g as getColorByName } from './p-25c80cdb.js';
|
|
10
10
|
import { d as defineCustomElement$3 } from './p-667579b0.js';
|
|
@@ -1,279 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { i as inheritGlobalTheme } from './p-a58bd561.js';
|
|
6
|
-
import { c as createID } from './p-5e59e970.js';
|
|
7
|
-
import { s as subscribeTabbingChange, u as unsubscribeTabbingChange } from './p-e44c0eff.js';
|
|
8
|
-
import { d as defineCustomElement$2 } from './p-667579b0.js';
|
|
9
|
-
|
|
10
|
-
const duetChipCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-right:8px !important;margin-bottom:12px !important;position:relative;display:inline-block;width:auto;max-width:100%;vertical-align:bottom;-webkit-tap-highlight-color:transparent}:host:last-child,:host:last-of-type{margin-right:0 !important}.duet-chip-container{-webkit-user-select:none;user-select:none;position:relative;z-index:100;display:block;width:100%;padding:1px;hyphens:none;line-height:1.1;color:rgb(0, 41, 77) !important;text-align:center;cursor:pointer;background:rgb(255, 255, 255);border-color:rgb(207, 210, 212);border-style:solid;border-width:1px;border-radius:8px;transition:background-color 300ms ease, color 300ms ease, border-color 300ms ease}.duet-chip-container.duet-p-0{padding:0 !important}.duet-chip-container.duet-m-0{margin:0 !important}.duet-chip-container.duet-theme-turva{color:rgb(23, 28, 58) !important;background:rgb(255, 255, 255);border-color:rgb(207, 207, 209)}.duet-chip-container.duet-theme-turva:hover{border-color:rgb(198, 12, 48)}.duet-chip-container:hover{padding:0 !important;border-color:rgb(0, 119, 179);border-width:2px}.duet-chip-container.duet-chip-disabled{color:rgb(101, 119, 135) !important;cursor:default;background:rgb(245, 248, 250) !important;border-color:rgb(245, 248, 250) !important}.duet-chip-container.duet-chip-disabled.duet-theme-turva{color:rgb(116, 116, 117) !important;background:rgb(245, 245, 247);border-color:rgb(245, 245, 247)}.duet-chip-container.duet-chip-disabled:hover{background:rgb(245, 248, 250);border-color:rgb(245, 248, 250)}.duet-chip-container.duet-chip-disabled:hover.duet-theme-turva{background:rgb(245, 245, 247);border-color:rgb(245, 245, 247)}.duet-chip-container.duet-chip-disabled button,.duet-chip-container.duet-chip-disabled label{cursor:default}.duet-chip-container button,.duet-chip-container label{display:flex;align-items:center;width:100%;height:100%;padding:8px 14px;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0.875rem;font-weight:600;line-height:1rem;color:rgb(0, 41, 77) !important;cursor:pointer}.duet-chip-container button:focus,.duet-chip-container label:focus{outline:none}.duet-chip-container .duet-chip-icon-container{display:flex;align-items:center;height:16px;padding:0;transition:padding 300ms ease}.duet-chip-container.duet-chip-has-icon .duet-chip-icon-container{width:24px;height:16px;padding-right:10px}.duet-chip-container.duet-chip-has-icon.duet-chip-filter-checked .duet-chip-icon-container,.duet-chip-container.duet-chip-has-icon.duet-chip-radio-checked .duet-chip-icon-container{padding-right:11px;padding-left:3px}.duet-chip-container.duet-chip-has-icon button,.duet-chip-container.duet-chip-has-icon label{padding-left:10px}.duet-chip-container.duet-chip-has-popup button,.duet-chip-container.duet-chip-has-popup label{padding-right:8px}.duet-chip-container duet-icon:not(.check-mark){width:auto;visibility:visible;transition:width 300ms ease, transform 300ms ease;transform:scaleX(1)}.duet-chip-container duet-icon.check-mark{width:0;overflow:hidden;visibility:hidden;transition:width 300ms ease, transform 300ms ease;transform:scaleX(0)}.duet-chip-container.duet-chip-filter-checked,.duet-chip-container.duet-chip-radio-checked{padding:0 !important;background:rgb(230, 242, 248);border-color:rgb(0, 119, 179);border-width:2px}.duet-chip-container.duet-chip-filter-checked:hover,.duet-chip-container.duet-chip-radio-checked:hover{background:rgb(205, 229, 241)}.duet-chip-container.duet-chip-filter-checked.chip-has-icon button,.duet-chip-container.duet-chip-filter-checked.chip-has-icon label,.duet-chip-container.duet-chip-radio-checked.chip-has-icon button,.duet-chip-container.duet-chip-radio-checked.chip-has-icon label{padding-left:10px}.duet-chip-container.duet-chip-filter-checked .duet-chip-icon-container,.duet-chip-container.duet-chip-radio-checked .duet-chip-icon-container{padding-right:10px}.duet-chip-container.duet-chip-filter-checked .duet-chip-icon-container duet-icon:not(.check-mark),.duet-chip-container.duet-chip-radio-checked .duet-chip-icon-container duet-icon:not(.check-mark){width:0;overflow:hidden;visibility:hidden;transition:width 300ms ease, transform 300ms ease;transform:scaleX(0)}.duet-chip-container.duet-chip-filter-checked .duet-chip-icon-container duet-icon.check-mark,.duet-chip-container.duet-chip-radio-checked .duet-chip-icon-container duet-icon.check-mark{width:auto;visibility:visible;transition:width 300ms ease, transform 300ms ease;transform:scaleX(1)}.duet-chip-container.duet-chip-filter-checked.duet-theme-turva,.duet-chip-container.duet-chip-radio-checked.duet-theme-turva{background:rgb(245, 245, 247);border-color:rgb(198, 12, 48)}.duet-chip-container.duet-chip-filter-checked.duet-theme-turva:hover,.duet-chip-container.duet-chip-radio-checked.duet-theme-turva:hover{background:rgb(228, 228, 230)}.duet-chip-container .duet-chip-popup-disclosure{padding-right:4.5px;padding-left:12.5px}.duet-chip-container .duet-chip-popup-disclosure duet-icon{transition:transform 300ms ease}.duet-chip-container.duet-chip-filter-popup-open{background:rgb(243, 249, 252);border-color:rgb(243, 249, 252)}.duet-chip-container.duet-chip-filter-popup-open.duet-theme-turva{background:rgb(245, 245, 247);border-color:rgb(245, 245, 247)}.duet-chip-container.duet-chip-filter-popup-open .duet-chip-popup-disclosure duet-icon{transform:rotate(180deg)}.duet-chip-container.duet-chip-input{display:flex;align-items:center;padding-right:0 !important}.duet-chip-container.duet-chip-input .duet-chip-input-button{flex-grow:1}.duet-chip-container.duet-chip-input .duet-chip-remove-button{width:26px;padding:8px 16px 8px 0;margin:-8px 0}.duet-chip-container.large button,.duet-chip-container.large label{padding:15px 22px}:host(.user-is-tabbing) .duet-chip-focus{box-shadow:0 0 0 4px rgba(0, 119, 179, 0.3), 0 0 0 1px #0077b3}:host(.user-is-tabbing) .duet-chip-focus.duet-theme-turva{box-shadow:0 0 0 4px rgba(23, 28, 58, 0.2), 0 0 0 1px #171c3a}.duet-chip-container input{position:absolute !important;top:0;left:0;z-index:-1;width:100%;height:100%;cursor:pointer;opacity:0}";
|
|
11
|
-
|
|
12
|
-
const DuetChip$1 = /*@__PURE__*/ proxyCustomElement(class DuetChip extends H {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this.__registerHost();
|
|
16
|
-
this.__attachShadow();
|
|
17
|
-
this.duetChange = createEvent(this, "duetChange", 3);
|
|
18
|
-
this.duetFocus = createEvent(this, "duetFocus", 7);
|
|
19
|
-
this.duetBlur = createEvent(this, "duetBlur", 7);
|
|
20
|
-
/**
|
|
21
|
-
* Own Properties.
|
|
22
|
-
*/
|
|
23
|
-
this.chipId = createID("DuetChip");
|
|
24
|
-
this.enforceNoDisabledSelected = () => {
|
|
25
|
-
if (this.disabled && this.checked) {
|
|
26
|
-
console.error("Duet error: pre-selected chip may not be disabled");
|
|
27
|
-
this.disabled = false;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
this.popupSetUp = () => {
|
|
31
|
-
const popup = document.querySelector(`duet-popup-menu#${this.popup}`);
|
|
32
|
-
if (popup) {
|
|
33
|
-
this.popupElement = popup;
|
|
34
|
-
popup.controller = this.element;
|
|
35
|
-
const originalText = this.element.textContent;
|
|
36
|
-
const originalValue = this.value;
|
|
37
|
-
if (!popup.id) {
|
|
38
|
-
popup.id = "popup-menu";
|
|
39
|
-
}
|
|
40
|
-
popup.addEventListener("duetToggle", (evt) => {
|
|
41
|
-
this.popupOpen = evt.detail.open;
|
|
42
|
-
});
|
|
43
|
-
const clearActive = () => {
|
|
44
|
-
popup.querySelectorAll("duet-popup-menu-item").forEach(item => {
|
|
45
|
-
item.active = false;
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
popup.querySelectorAll("duet-popup-menu-item").forEach(item => {
|
|
49
|
-
item.addEventListener("click", evt => {
|
|
50
|
-
var _a;
|
|
51
|
-
const value = (_a = item.value) !== null && _a !== void 0 ? _a : item.innerText;
|
|
52
|
-
if (!item.active) {
|
|
53
|
-
clearActive();
|
|
54
|
-
item.active = true;
|
|
55
|
-
this.element.textContent = item.innerText;
|
|
56
|
-
this.value = value;
|
|
57
|
-
this.checked = true;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
clearActive();
|
|
61
|
-
this.element.textContent = originalText;
|
|
62
|
-
this.value = originalValue;
|
|
63
|
-
this.checked = false;
|
|
64
|
-
}
|
|
65
|
-
this.emitChange(evt);
|
|
66
|
-
// A workaround to the difference of event handling between the browers.
|
|
67
|
-
// Chrome will emit a separate click event on the chip after the popup is closed, resulting popup.toggle() to
|
|
68
|
-
// open the popup again. Firefox does not have this behavior.
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
if (this.popupElement.isOpen()) {
|
|
71
|
-
this.popupElement.hide();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Component event handling.
|
|
80
|
-
*/
|
|
81
|
-
this.onFocus = (ev) => {
|
|
82
|
-
this.focus = true;
|
|
83
|
-
this.duetFocus.emit({
|
|
84
|
-
originalEvent: ev,
|
|
85
|
-
checked: this.checked,
|
|
86
|
-
value: this.value,
|
|
87
|
-
component: "duet-chip",
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
this.onBlur = (ev) => {
|
|
91
|
-
this.focus = false;
|
|
92
|
-
this.duetBlur.emit({
|
|
93
|
-
originalEvent: ev,
|
|
94
|
-
checked: this.checked,
|
|
95
|
-
value: this.value,
|
|
96
|
-
component: "duet-chip",
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
this.emitChange = originalEvent => {
|
|
100
|
-
this.duetChange.emit({
|
|
101
|
-
originalEvent,
|
|
102
|
-
checked: this.checked,
|
|
103
|
-
value: this.value,
|
|
104
|
-
component: "duet-chip",
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Change checked state and emit duetChange event.
|
|
109
|
-
*/
|
|
110
|
-
this.onFilterChange = (evt) => {
|
|
111
|
-
this.checked = !this.checked;
|
|
112
|
-
this.emitChange(evt);
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Change checked state and emit duetChange event.
|
|
116
|
-
*/
|
|
117
|
-
this.onRadioChange = (evt) => {
|
|
118
|
-
const input = this.focusableElement;
|
|
119
|
-
const inputChecked = input.checked;
|
|
120
|
-
this.checked = inputChecked;
|
|
121
|
-
this.emitChange(evt);
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Stop propagation and prevent default if popup is present, as the popup controls value and checked state.
|
|
125
|
-
*/
|
|
126
|
-
this.onFilterClick = (evt) => {
|
|
127
|
-
if (this.disabled) {
|
|
128
|
-
evt.stopPropagation();
|
|
129
|
-
evt.preventDefault();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (this.popupElement) {
|
|
133
|
-
evt.stopPropagation();
|
|
134
|
-
evt.preventDefault();
|
|
135
|
-
this.popupElement.toggle();
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Remove input chip
|
|
140
|
-
*/
|
|
141
|
-
this.onRemoveClick = (evt) => {
|
|
142
|
-
evt.stopPropagation();
|
|
143
|
-
evt.preventDefault();
|
|
144
|
-
this.element.remove();
|
|
145
|
-
};
|
|
146
|
-
this.focus = false;
|
|
147
|
-
this.popupElement = undefined;
|
|
148
|
-
this.popupOpen = undefined;
|
|
149
|
-
this.accessibleLabel = undefined;
|
|
150
|
-
this.variation = "button";
|
|
151
|
-
this.size = "medium";
|
|
152
|
-
this.popup = undefined;
|
|
153
|
-
this.icon = "";
|
|
154
|
-
this.theme = "";
|
|
155
|
-
this.identifier = undefined;
|
|
156
|
-
this.value = undefined;
|
|
157
|
-
this.name = undefined;
|
|
158
|
-
this.checked = false;
|
|
159
|
-
this.disabled = false;
|
|
160
|
-
this.accessibleExpanded = undefined;
|
|
161
|
-
this.accessiblePopup = "false";
|
|
162
|
-
}
|
|
163
|
-
clearOtherRadioButtons() {
|
|
164
|
-
if (this.variation === "radio" && this.checked) {
|
|
165
|
-
const chips = document.querySelectorAll(`duet-chip[variation="radio"][name="${this.name}"]`);
|
|
166
|
-
chips.forEach(chip => {
|
|
167
|
-
if (chip !== this.element) {
|
|
168
|
-
chip.checked = false;
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Component lifecycle events.
|
|
175
|
-
*/
|
|
176
|
-
componentWillLoad() {
|
|
177
|
-
inheritGlobalTheme(this);
|
|
178
|
-
this.popupSetUp();
|
|
179
|
-
this.enforceNoDisabledSelected();
|
|
180
|
-
}
|
|
181
|
-
connectedCallback() {
|
|
182
|
-
subscribeTabbingChange(this);
|
|
183
|
-
}
|
|
184
|
-
disconnectedCallback() {
|
|
185
|
-
unsubscribeTabbingChange(this);
|
|
186
|
-
}
|
|
187
|
-
getAccessibleExpanded() {
|
|
188
|
-
if (this.accessibleExpanded != null) {
|
|
189
|
-
return (!!this.accessibleExpanded).toString();
|
|
190
|
-
}
|
|
191
|
-
if (this.popupElement) {
|
|
192
|
-
return this.popupOpen ? "true" : "false";
|
|
193
|
-
}
|
|
194
|
-
return undefined;
|
|
195
|
-
}
|
|
196
|
-
getAccessiblePopup() {
|
|
197
|
-
if (this.popupElement) {
|
|
198
|
-
return "true";
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
return this.accessiblePopup != null ? this.accessiblePopup.toString() : undefined;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Sets focus. Use this method instead of the global focus().
|
|
206
|
-
*/
|
|
207
|
-
async setFocus(options) {
|
|
208
|
-
setTimeout(() => this.focusableElement.focus(options), 200);
|
|
209
|
-
}
|
|
210
|
-
render() {
|
|
211
|
-
var _a;
|
|
212
|
-
const identifier = this.identifier || this.chipId;
|
|
213
|
-
const classes = {
|
|
214
|
-
"duet-chip-container": true,
|
|
215
|
-
[`duet-chip-${this.variation}`]: true,
|
|
216
|
-
"duet-chip-focus": this.focus,
|
|
217
|
-
"duet-chip-has-icon": !!this.icon,
|
|
218
|
-
"duet-chip-has-popup": this.variation === "filter" && !!this.popupElement,
|
|
219
|
-
"duet-theme-turva": this.theme === "turva",
|
|
220
|
-
"duet-chip-filter-checked": this.variation === "filter" && this.checked,
|
|
221
|
-
"duet-chip-radio-checked": this.variation === "radio" && this.checked,
|
|
222
|
-
"duet-chip-filter-popup-open": this.popupOpen,
|
|
223
|
-
"duet-chip-disabled": this.disabled,
|
|
224
|
-
[this.size]: true,
|
|
225
|
-
};
|
|
226
|
-
const focusHandlers = {
|
|
227
|
-
onFocus: this.onFocus,
|
|
228
|
-
onBlur: this.onBlur,
|
|
229
|
-
ref: el => (this.focusableElement = el),
|
|
230
|
-
};
|
|
231
|
-
return (h(Host, null, this.variation === "button" && (h("span", { class: classes }, h("button", Object.assign({ id: identifier, "aria-label": this.accessibleLabel, "aria-disabled": this.disabled ? "true" : undefined, name: this.name, value: this.value, onClick: this.disabled ? evt => evt.stopPropagation() : undefined }, focusHandlers), h("span", { class: "duet-chip-icon-container" }, this.icon && (h("duet-icon", { name: this.icon, size: "x-small", margin: "none", color: "currentColor" }))), h("slot", null)))), this.variation === "input" && (h("span", { class: classes }, h("button", Object.assign({ id: identifier, class: "duet-chip-input-button", "aria-label": this.accessibleLabel }, focusHandlers), h("span", { class: "duet-chip-icon-container" }, this.icon && (h("duet-icon", { name: this.icon, size: "x-small", margin: "none", color: "currentColor" }))), h("slot", null)), h("button", { class: "duet-chip-remove-button", onClick: this.onRemoveClick }, h("duet-icon", { name: "activity-close", size: "xx-small", margin: "none", color: "currentColor" })))), this.variation === "filter" && (h("span", { class: classes }, h("input", Object.assign({ "aria-haspopup": this.getAccessiblePopup(), "aria-controls": (_a = this.popupElement) === null || _a === void 0 ? void 0 : _a.id, "aria-expanded": this.getAccessibleExpanded(), "aria-disabled": this.disabled ? "true" : undefined, id: identifier, type: "checkbox", name: this.name, value: this.value, checked: this.checked, onClick: this.onFilterClick, onChange: this.onFilterChange }, focusHandlers)), h("label", { htmlFor: identifier }, this.icon && (h("span", { class: "duet-chip-icon-container" }, h("duet-icon", { name: this.icon, size: "x-small", margin: "none", color: "currentColor" }), h("duet-icon", { name: "messaging-checked-small", size: "xx-small", margin: "none", color: "currentColor", class: "check-mark" }))), h("slot", null), this.popupElement && (h("span", { class: "duet-chip-popup-disclosure" }, h("duet-icon", { name: "action-arrow-down-small", size: "xxx-small", margin: "none", color: "currentColor" })))))), this.variation === "radio" && (h("span", { class: classes }, h("input", Object.assign({ "aria-disabled": this.disabled ? "true" : undefined, id: identifier, type: "radio", name: this.name, value: this.value, checked: this.checked, onChange: this.onRadioChange, onClick: this.disabled ? evt => evt.preventDefault() : undefined }, focusHandlers)), h("label", { htmlFor: identifier }, this.icon && (h("span", { class: "duet-chip-icon-container" }, h("duet-icon", { name: this.icon, size: "x-small", margin: "none", color: "currentColor" }), h("duet-icon", { name: "messaging-checked-small", size: "xx-small", margin: "none", color: "currentColor", class: "check-mark" }))), h("slot", null))))));
|
|
232
|
-
}
|
|
233
|
-
get element() { return this; }
|
|
234
|
-
static get watchers() { return {
|
|
235
|
-
"checked": ["clearOtherRadioButtons"]
|
|
236
|
-
}; }
|
|
237
|
-
static get style() { return duetChipCss; }
|
|
238
|
-
}, [1, "duet-chip", {
|
|
239
|
-
"accessibleLabel": [1, "accessible-label"],
|
|
240
|
-
"variation": [1],
|
|
241
|
-
"size": [1],
|
|
242
|
-
"popup": [1],
|
|
243
|
-
"icon": [1],
|
|
244
|
-
"theme": [1025],
|
|
245
|
-
"identifier": [1],
|
|
246
|
-
"value": [1025],
|
|
247
|
-
"name": [1],
|
|
248
|
-
"checked": [1540],
|
|
249
|
-
"disabled": [4],
|
|
250
|
-
"accessibleExpanded": [1540, "accessible-expanded"],
|
|
251
|
-
"accessiblePopup": [1537, "accessible-popup"],
|
|
252
|
-
"focus": [32],
|
|
253
|
-
"popupElement": [32],
|
|
254
|
-
"popupOpen": [32],
|
|
255
|
-
"setFocus": [64]
|
|
256
|
-
}, undefined, {
|
|
257
|
-
"checked": ["clearOtherRadioButtons"]
|
|
258
|
-
}]);
|
|
259
|
-
function defineCustomElement$1() {
|
|
260
|
-
if (typeof customElements === "undefined") {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const components = ["duet-chip", "duet-icon"];
|
|
264
|
-
components.forEach(tagName => { switch (tagName) {
|
|
265
|
-
case "duet-chip":
|
|
266
|
-
if (!customElements.get(tagName)) {
|
|
267
|
-
customElements.define(tagName, DuetChip$1);
|
|
268
|
-
}
|
|
269
|
-
break;
|
|
270
|
-
case "duet-icon":
|
|
271
|
-
if (!customElements.get(tagName)) {
|
|
272
|
-
defineCustomElement$2();
|
|
273
|
-
}
|
|
274
|
-
break;
|
|
275
|
-
} });
|
|
276
|
-
}
|
|
4
|
+
import { D as DuetChip$1, d as defineCustomElement$1 } from './p-755dd68f.js';
|
|
277
5
|
|
|
278
6
|
const DuetChip = DuetChip$1;
|
|
279
7
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { p as proxyCustomElement, H, h, d as Host } from './p-e98f9bb0.js';
|
|
5
5
|
import { i as inheritGlobalTheme } from './p-a58bd561.js';
|
|
6
|
-
import { c as checkNamedSlotElement } from './p-
|
|
6
|
+
import { c as checkNamedSlotElement } from './p-06e608ae.js';
|
|
7
7
|
import { d as defineCustomElement$8 } from './p-b6322d8d.js';
|
|
8
|
-
import { d as defineCustomElement$7 } from './p-
|
|
8
|
+
import { d as defineCustomElement$7 } from './p-45fd4d84.js';
|
|
9
9
|
import { d as defineCustomElement$6 } from './p-667579b0.js';
|
|
10
|
-
import { d as defineCustomElement$5 } from './p-
|
|
11
|
-
import { d as defineCustomElement$4 } from './p-
|
|
12
|
-
import { d as defineCustomElement$3 } from './p-
|
|
10
|
+
import { d as defineCustomElement$5 } from './p-a02e62f3.js';
|
|
11
|
+
import { d as defineCustomElement$4 } from './p-c8415e2f.js';
|
|
12
|
+
import { d as defineCustomElement$3 } from './p-0cee8a12.js';
|
|
13
13
|
import { d as defineCustomElement$2 } from './p-d1815d2a.js';
|
|
14
14
|
|
|
15
15
|
const duetChoiceGroupCss = "*.sc-duet-choice-group,*.sc-duet-choice-group::after,*.sc-duet-choice-group::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.sc-duet-choice-group-h{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;display:block;width:100%}.horizontal.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group{display:block;margin-bottom:-12px}.horizontal.sc-duet-choice-group-h .duet-choice-group.duet-no-stacking.sc-duet-choice-group{display:flex}@media (min-width: 48em){.horizontal.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group{margin-bottom:0}}@media (max-width: 35.9375em){.horizontal.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group{display:flex}}.horizontal.duet-choice-group-breakpoint-x-small.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:flex}@media (max-width: 22.5em){.horizontal.duet-choice-group-breakpoint-x-small.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:block}}.horizontal.duet-choice-group-breakpoint-small.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:block}@media (min-width: 36em){.horizontal.duet-choice-group-breakpoint-small.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:flex}}.horizontal.duet-choice-group-breakpoint-medium.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:block}@media (min-width: 48em){.horizontal.duet-choice-group-breakpoint-medium.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:flex}}.horizontal.duet-choice-group-breakpoint-large.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:block}@media (min-width: 62em){.horizontal.duet-choice-group-breakpoint-large.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:flex}}.horizontal.duet-choice-group-breakpoint-x-large.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:block}@media (min-width: 64.0625em){.horizontal.duet-choice-group-breakpoint-x-large.sc-duet-choice-group-h .duet-choice-group.sc-duet-choice-group:not(.duet-no-stacking){display:flex}}.duet-choice-group.sc-duet-choice-group{position:relative;width:100%;margin-bottom:-12px}";
|