@getflip/swirl-components 0.331.0 → 0.333.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/components.json +7 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/media-query.service-aad2b3b1.js +24 -0
- package/dist/cjs/swirl-action-list_2.cjs.entry.js +8 -12
- package/dist/cjs/swirl-app-layout_5.cjs.entry.js +19 -23
- package/dist/cjs/swirl-autocomplete.cjs.entry.js +1 -1
- package/dist/cjs/swirl-banner.cjs.entry.js +8 -9
- package/dist/cjs/swirl-button.cjs.entry.js +9 -11
- package/dist/cjs/swirl-carousel.cjs.entry.js +1 -1
- package/dist/cjs/swirl-chip.cjs.entry.js +8 -9
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-console-layout.cjs.entry.js +1 -1
- package/dist/cjs/swirl-date-input.cjs.entry.js +8 -9
- package/dist/cjs/swirl-date-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/swirl-file-chip.cjs.entry.js +6 -3
- package/dist/cjs/swirl-file-viewer_8.cjs.entry.js +1 -1
- package/dist/cjs/swirl-form-control.cjs.entry.js +26 -13
- package/dist/cjs/swirl-icon-check-small_2.cjs.entry.js +10 -12
- package/dist/cjs/swirl-icon-error_3.cjs.entry.js +8 -9
- package/dist/cjs/swirl-image-grid-item.cjs.entry.js +1 -1
- package/dist/cjs/swirl-inline-status.cjs.entry.js +8 -9
- package/dist/cjs/swirl-lightbox.cjs.entry.js +1 -1
- package/dist/cjs/swirl-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/swirl-menu.cjs.entry.js +1 -1
- package/dist/cjs/swirl-option-list_2.cjs.entry.js +1 -1
- package/dist/cjs/swirl-pagination.cjs.entry.js +1 -1
- package/dist/cjs/swirl-pdf-reader.cjs.entry.js +1 -1
- package/dist/cjs/swirl-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +8 -9
- package/dist/cjs/swirl-search.cjs.entry.js +8 -9
- package/dist/cjs/swirl-select.cjs.entry.js +1 -1
- package/dist/cjs/swirl-shell-layout.cjs.entry.js +1 -1
- package/dist/cjs/swirl-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/swirl-table-column.cjs.entry.js +1 -1
- package/dist/cjs/swirl-table-row.cjs.entry.js +1 -1
- package/dist/cjs/swirl-table.cjs.entry.js +1 -1
- package/dist/cjs/swirl-tabs.cjs.entry.js +1 -1
- package/dist/cjs/swirl-text-input.cjs.entry.js +8 -9
- package/dist/cjs/swirl-time-input.cjs.entry.js +8 -9
- package/dist/cjs/swirl-toast.cjs.entry.js +8 -9
- package/dist/cjs/swirl-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/{utils-b7a6f714.js → utils-4f225daf.js} +6 -0
- package/dist/collection/components/swirl-action-list-item/swirl-action-list-item.js +7 -12
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +11 -12
- package/dist/collection/components/swirl-banner/swirl-banner.js +7 -9
- package/dist/collection/components/swirl-button/swirl-button.js +8 -11
- package/dist/collection/components/swirl-chip/swirl-chip.js +7 -9
- package/dist/collection/components/swirl-date-input/swirl-date-input.js +8 -9
- package/dist/collection/components/swirl-file-chip/swirl-file-chip.css +3 -3
- package/dist/collection/components/swirl-file-chip/swirl-file-chip.js +5 -2
- package/dist/collection/components/swirl-file-chip/swirl-file-chip.spec.js +8 -0
- package/dist/collection/components/swirl-form-control/swirl-form-control.js +27 -12
- package/dist/collection/components/swirl-inline-error/swirl-inline-error.js +7 -9
- package/dist/collection/components/swirl-inline-status/swirl-inline-status.js +7 -9
- package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.js +9 -12
- package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js +7 -9
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.css +1 -0
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +8 -11
- package/dist/collection/components/swirl-search/swirl-search.js +7 -9
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +7 -9
- package/dist/collection/components/swirl-time-input/swirl-time-input.js +7 -9
- package/dist/collection/components/swirl-toast/swirl-toast.js +7 -9
- package/dist/collection/services/media-query.service.js +19 -0
- package/dist/collection/utils.js +5 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/media-query.service.js +22 -0
- package/dist/components/swirl-action-list-item2.js +7 -12
- package/dist/components/swirl-app-layout2.js +11 -12
- package/dist/components/swirl-banner.js +7 -9
- package/dist/components/swirl-button2.js +8 -11
- package/dist/components/swirl-chip.js +7 -9
- package/dist/components/swirl-date-input.js +8 -9
- package/dist/components/swirl-file-chip.js +20 -11
- package/dist/components/swirl-form-control.js +27 -13
- package/dist/components/swirl-inline-error2.js +7 -9
- package/dist/components/swirl-inline-status.js +7 -9
- package/dist/components/swirl-option-list-item2.js +9 -12
- package/dist/components/swirl-resource-list-file-item.js +7 -9
- package/dist/components/swirl-resource-list-item2.js +9 -12
- package/dist/components/swirl-search.js +7 -9
- package/dist/components/swirl-text-input2.js +7 -9
- package/dist/components/swirl-time-input.js +7 -9
- package/dist/components/swirl-toast2.js +7 -9
- package/dist/components/utils.js +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/media-query.service-9a0ff1cb.js +22 -0
- package/dist/esm/swirl-action-list_2.entry.js +8 -12
- package/dist/esm/swirl-app-layout_5.entry.js +19 -23
- package/dist/esm/swirl-autocomplete.entry.js +1 -1
- package/dist/esm/swirl-banner.entry.js +8 -9
- package/dist/esm/swirl-button.entry.js +9 -11
- package/dist/esm/swirl-carousel.entry.js +1 -1
- package/dist/esm/swirl-chip.entry.js +8 -9
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-console-layout.entry.js +1 -1
- package/dist/esm/swirl-date-input.entry.js +8 -9
- package/dist/esm/swirl-date-picker_2.entry.js +1 -1
- package/dist/esm/swirl-file-chip.entry.js +6 -3
- package/dist/esm/swirl-file-viewer_8.entry.js +1 -1
- package/dist/esm/swirl-form-control.entry.js +26 -13
- package/dist/esm/swirl-icon-check-small_2.entry.js +10 -12
- package/dist/esm/swirl-icon-error_3.entry.js +8 -9
- package/dist/esm/swirl-image-grid-item.entry.js +1 -1
- package/dist/esm/swirl-inline-status.entry.js +8 -9
- package/dist/esm/swirl-lightbox.entry.js +1 -1
- package/dist/esm/swirl-menu-item.entry.js +1 -1
- package/dist/esm/swirl-menu.entry.js +1 -1
- package/dist/esm/swirl-option-list_2.entry.js +1 -1
- package/dist/esm/swirl-pagination.entry.js +1 -1
- package/dist/esm/swirl-pdf-reader.entry.js +1 -1
- package/dist/esm/swirl-popover_2.entry.js +1 -1
- package/dist/esm/swirl-resource-list-file-item.entry.js +8 -9
- package/dist/esm/swirl-search.entry.js +8 -9
- package/dist/esm/swirl-select.entry.js +1 -1
- package/dist/esm/swirl-shell-layout.entry.js +1 -1
- package/dist/esm/swirl-tab-bar.entry.js +1 -1
- package/dist/esm/swirl-table-column.entry.js +1 -1
- package/dist/esm/swirl-table-row.entry.js +1 -1
- package/dist/esm/swirl-table.entry.js +1 -1
- package/dist/esm/swirl-tabs.entry.js +1 -1
- package/dist/esm/swirl-text-input.entry.js +8 -9
- package/dist/esm/swirl-time-input.entry.js +8 -9
- package/dist/esm/swirl-toast.entry.js +8 -9
- package/dist/esm/swirl-toolbar.entry.js +1 -1
- package/dist/esm/{utils-0cdf2a1e.js → utils-28df99ee.js} +6 -1
- package/dist/swirl-components/p-01f6d9f7.entry.js +1 -0
- package/dist/swirl-components/{p-9efd3512.entry.js → p-0657e672.entry.js} +1 -1
- package/dist/swirl-components/{p-6151ce60.entry.js → p-116b0b79.entry.js} +1 -1
- package/dist/swirl-components/{p-a8c32e22.entry.js → p-18a5d961.entry.js} +1 -1
- package/dist/swirl-components/{p-8ff403f9.entry.js → p-342453b8.entry.js} +1 -1
- package/dist/swirl-components/{p-e266f49e.entry.js → p-3fbc754b.entry.js} +1 -1
- package/dist/swirl-components/{p-6ee7104a.entry.js → p-4326c599.entry.js} +1 -1
- package/dist/swirl-components/p-4bdd342f.entry.js +1 -0
- package/dist/swirl-components/{p-6883e785.entry.js → p-4c7278e7.entry.js} +1 -1
- package/dist/swirl-components/{p-3ce549f7.entry.js → p-54d8b273.entry.js} +1 -1
- package/dist/swirl-components/{p-fd170d86.entry.js → p-58459af7.entry.js} +1 -1
- package/dist/swirl-components/p-66a6ef4e.js +1 -0
- package/dist/swirl-components/{p-e6d28a3b.entry.js → p-6d4ad312.entry.js} +1 -1
- package/dist/swirl-components/{p-bd65c4ff.entry.js → p-6dac4d2d.entry.js} +1 -1
- package/dist/swirl-components/{p-f327707e.entry.js → p-6dc03904.entry.js} +1 -1
- package/dist/swirl-components/{p-a61dd959.entry.js → p-6f5c8919.entry.js} +1 -1
- package/dist/swirl-components/p-71f229c5.entry.js +1 -0
- package/dist/swirl-components/p-7d2f064b.entry.js +1 -0
- package/dist/swirl-components/{p-0212df50.entry.js → p-7ffa902d.entry.js} +1 -1
- package/dist/swirl-components/p-9d4f99b2.entry.js +1 -0
- package/dist/swirl-components/{p-d17891c6.entry.js → p-9de51fe6.entry.js} +1 -1
- package/dist/swirl-components/{p-75f4a7b1.entry.js → p-9dee1041.entry.js} +1 -1
- package/dist/swirl-components/p-a256f2e4.entry.js +1 -0
- package/dist/swirl-components/p-a692f31d.entry.js +1 -0
- package/dist/swirl-components/p-a7f421b2.entry.js +1 -0
- package/dist/swirl-components/{p-81d9d1e2.entry.js → p-b0882434.entry.js} +1 -1
- package/dist/swirl-components/{p-17ea3af1.entry.js → p-b4a18fa0.entry.js} +1 -1
- package/dist/swirl-components/p-bf70f6fa.entry.js +1 -0
- package/dist/swirl-components/p-c344994e.entry.js +1 -0
- package/dist/swirl-components/p-c817bbf2.entry.js +1 -0
- package/dist/swirl-components/p-d0196e17.entry.js +1 -0
- package/dist/swirl-components/p-db3132a6.entry.js +1 -0
- package/dist/swirl-components/{p-72c83e56.entry.js → p-dc5295de.entry.js} +1 -1
- package/dist/swirl-components/{p-b2020b3c.entry.js → p-dd5dfce9.entry.js} +1 -1
- package/dist/swirl-components/p-dd74a7bd.entry.js +1 -0
- package/dist/swirl-components/{p-3d741780.entry.js → p-defe37bc.entry.js} +1 -1
- package/dist/swirl-components/p-e4cda03f.entry.js +1 -0
- package/dist/swirl-components/p-e8332857.entry.js +1 -0
- package/dist/swirl-components/{p-9f6bfdbf.js → p-f078017d.js} +1 -1
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-action-list-item/swirl-action-list-item.d.ts +1 -3
- package/dist/types/components/swirl-app-layout/swirl-app-layout.d.ts +1 -2
- package/dist/types/components/swirl-banner/swirl-banner.d.ts +1 -2
- package/dist/types/components/swirl-button/swirl-button.d.ts +1 -2
- package/dist/types/components/swirl-chip/swirl-chip.d.ts +1 -2
- package/dist/types/components/swirl-date-input/swirl-date-input.d.ts +1 -2
- package/dist/types/components/swirl-form-control/swirl-form-control.d.ts +3 -1
- package/dist/types/components/swirl-inline-error/swirl-inline-error.d.ts +1 -2
- package/dist/types/components/swirl-inline-status/swirl-inline-status.d.ts +1 -2
- package/dist/types/components/swirl-option-list-item/swirl-option-list-item.d.ts +1 -2
- package/dist/types/components/swirl-resource-list-file-item/swirl-resource-list-file-item.d.ts +1 -2
- package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +1 -2
- package/dist/types/components/swirl-search/swirl-search.d.ts +1 -2
- package/dist/types/components/swirl-text-input/swirl-text-input.d.ts +1 -2
- package/dist/types/components/swirl-time-input/swirl-time-input.d.ts +1 -2
- package/dist/types/components/swirl-toast/swirl-toast.d.ts +1 -2
- package/dist/types/services/media-query.service.d.ts +10 -0
- package/dist/types/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-003420ed.entry.js +0 -1
- package/dist/swirl-components/p-1848ed27.entry.js +0 -1
- package/dist/swirl-components/p-3440a0a7.entry.js +0 -1
- package/dist/swirl-components/p-4336b76f.entry.js +0 -1
- package/dist/swirl-components/p-4f100063.entry.js +0 -1
- package/dist/swirl-components/p-66fd3146.entry.js +0 -1
- package/dist/swirl-components/p-6a8e2781.entry.js +0 -1
- package/dist/swirl-components/p-7ad8cfda.entry.js +0 -1
- package/dist/swirl-components/p-89785229.entry.js +0 -1
- package/dist/swirl-components/p-ad19624f.entry.js +0 -1
- package/dist/swirl-components/p-de22e8e2.entry.js +0 -1
- package/dist/swirl-components/p-e3999150.entry.js +0 -1
- package/dist/swirl-components/p-e5b06e45.entry.js +0 -1
- package/dist/swirl-components/p-e6048064.entry.js +0 -1
- package/dist/swirl-components/p-ef6a438b.entry.js +0 -1
- package/dist/swirl-components/p-f1f234c5.entry.js +0 -1
|
@@ -2,14 +2,12 @@ import { h, Host, } from "@stencil/core";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { format, isValid, parse } from "date-fns";
|
|
4
4
|
import { create as createMask } from "maska/dist/es6/maska";
|
|
5
|
-
import {
|
|
5
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
6
|
+
import { isMobileViewport } from "../../utils";
|
|
6
7
|
const internalDateFormat = "yyyy-MM-dd";
|
|
7
8
|
export class SwirlDateInput {
|
|
8
9
|
constructor() {
|
|
9
|
-
this.
|
|
10
|
-
this.desktopMediaQueryHandler = (event) => {
|
|
11
|
-
this.updateIconSize(event.matches);
|
|
12
|
-
};
|
|
10
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
13
11
|
this.onChange = (event) => {
|
|
14
12
|
const value = event.target.value;
|
|
15
13
|
if (value === "") {
|
|
@@ -88,8 +86,9 @@ export class SwirlDateInput {
|
|
|
88
86
|
}
|
|
89
87
|
componentDidLoad() {
|
|
90
88
|
this.setupMask();
|
|
91
|
-
this.
|
|
92
|
-
|
|
89
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
90
|
+
this.updateIconSize(isDesktop);
|
|
91
|
+
});
|
|
93
92
|
// see https://stackoverflow.com/a/27314017
|
|
94
93
|
if (this.autoFocus) {
|
|
95
94
|
this.focus();
|
|
@@ -97,7 +96,7 @@ export class SwirlDateInput {
|
|
|
97
96
|
}
|
|
98
97
|
disconnectedCallback() {
|
|
99
98
|
this.mask?.destroy();
|
|
100
|
-
this.
|
|
99
|
+
this.mediaQueryUnsubscribe();
|
|
101
100
|
}
|
|
102
101
|
watchFormat() {
|
|
103
102
|
this.setupMask();
|
|
@@ -148,7 +147,7 @@ export class SwirlDateInput {
|
|
|
148
147
|
const className = classnames("date-input", {
|
|
149
148
|
"date-input--inline": this.inline,
|
|
150
149
|
});
|
|
151
|
-
return (h(Host, { key: '
|
|
150
|
+
return (h(Host, { key: 'b08bf17f0edd807a419199a88ba2ca14b0a2e4b6' }, h("div", { key: '5543669cbc75241146e2808293631e007914e258', class: className }, h("input", { key: '85836403ef82b583fad6a4118dc4532aa482e01b', "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, readonly: this.readonly, id: this.id, inputmode: "numeric", onClick: this.onClick, onMouseDown: this.onMouseDown, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { key: '2054f02531393bbb345c78ed79dc620ce491e90a', swirlPopover: `popover-${this.id}` }, h("button", { key: '6aa6a53cd62693a74be31f1e2c1ed6f42d8dccec', "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { key: '87745196a9f9a67938410acf56ca36b6d7396711', size: this.iconSize })))), !this.disabled && (h("swirl-popover", { key: '29e15ada59823318ef9c05aae7813eeda1e8ecbb', animation: "scale-in-y", class: "date-input__date-picker-popover", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { key: '65b8374a92785362f5b9060d4ddd83c5d518c5bd', disableDate: this.datePickerDisableDate, firstDayOfWeek: this.firstDayOfWeek, labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue, startDate: dateValue })))));
|
|
152
151
|
}
|
|
153
152
|
static get is() { return "swirl-date-input"; }
|
|
154
153
|
static get encapsulation() { return "scoped"; }
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
.file-chip:hover.file-chip--one-action .file-chip__info > * {
|
|
22
|
+
.file-chip:hover.file-chip--one-action .file-chip__info > *, .file-chip:focus-within.file-chip--one-action .file-chip__info > * {
|
|
23
23
|
width: calc(100% - 44px - var(--s-space-12));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
.file-chip:hover.file-chip--two-actions .file-chip__info > * {
|
|
27
|
+
.file-chip:hover.file-chip--two-actions .file-chip__info > *, .file-chip:focus-within.file-chip--two-actions .file-chip__info > * {
|
|
28
28
|
width: calc(100% - 88px - var(--s-space-12));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
.file-chip:hover .file-chip__actions {
|
|
32
|
+
.file-chip:hover .file-chip__actions, .file-chip:focus-within .file-chip__actions {
|
|
33
33
|
opacity: 1;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import { saveAs } from "file-saver";
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
-
import { isAudioMimeType, isCompressedArchiveMimeType, isImageMimeType, isPdfMimeType, isVideoMimeType, } from "../../utils";
|
|
4
|
+
import { isAudioMimeType, isCompressedArchiveMimeType, isDocumentMimeType, isImageMimeType, isPdfMimeType, isVideoMimeType, } from "../../utils";
|
|
5
5
|
export class SwirlFileChip {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.handleDownloadClick = () => {
|
|
@@ -51,6 +51,9 @@ export class SwirlFileChip {
|
|
|
51
51
|
else if (isCompressedArchiveMimeType(this.type)) {
|
|
52
52
|
return h("swirl-icon-folder", null);
|
|
53
53
|
}
|
|
54
|
+
else if (isDocumentMimeType(this.type)) {
|
|
55
|
+
return h("swirl-icon-file", null);
|
|
56
|
+
}
|
|
54
57
|
else {
|
|
55
58
|
return h("swirl-icon-attachment", null);
|
|
56
59
|
}
|
|
@@ -62,7 +65,7 @@ export class SwirlFileChip {
|
|
|
62
65
|
"file-chip--one-action": actionCount === 1,
|
|
63
66
|
"file-chip--two-actions": actionCount === 2,
|
|
64
67
|
});
|
|
65
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: '8ba0390953507f3c39fdb662c2714a721c1f048b' }, h("span", { key: '97a4e2627f6490a237cde23f54347e320e8065b5', role: "group", class: className }, h("span", { key: 'f6dee9b3416db43baeeb3854995d94ef1142607f', class: "file-chip__icon" }, this.getFileIcon()), h("span", { key: '29d1a7aa234ceb846039004e8439db4441a32ba1', class: "file-chip__info" }, h("span", { key: '8594d492fd758e59797dff9b0923b2e2ec5bdc86', class: "file-chip__name", title: this.name }, this.name), this.description && (h("span", { key: '887570df6590394016b9b0a4a49e06e6719acb53', class: "file-chip__description" }, this.description))), h("swirl-button-group", { key: '9fee7eaf170777b86fd33b98c069e641fa7eab02', class: "file-chip__actions" }, this.showPreviewButton && (h("swirl-button", { key: '647360858f679d9eb4a65947f2839dec369d1a08', variant: "flat", icon: "<swirl-icon-preview></swirl-icon-preview>", onClick: this.handlePreviewClick, label: this.previewButtonLabel, hideLabel: true, part: "file-chip__preview" })), this.showDownloadButton && (h("swirl-button", { key: '6e718daf409c8f37caa228f545806f2fe7579f6d', variant: "flat", icon: "<swirl-icon-download></swirl-icon-download>", onClick: this.handleDownloadClick, label: this.downloadButtonLabel, hideLabel: true, part: "file-chip__download" }))))));
|
|
66
69
|
}
|
|
67
70
|
static get is() { return "swirl-file-chip"; }
|
|
68
71
|
static get encapsulation() { return "shadow"; }
|
|
@@ -83,6 +83,14 @@ describe("swirl-file-chip", () => {
|
|
|
83
83
|
const iconElement = page.root.shadowRoot.querySelector(".file-chip__icon swirl-icon-audio-file");
|
|
84
84
|
expect(iconElement).toBeTruthy();
|
|
85
85
|
});
|
|
86
|
+
it("renders document file type", async () => {
|
|
87
|
+
const page = await newSpecPage({
|
|
88
|
+
components: [SwirlFileChip],
|
|
89
|
+
html: `<swirl-file-chip url="https://example.com/document.doc" name="document.doc" type="application/msword"></swirl-file-chip>`,
|
|
90
|
+
});
|
|
91
|
+
const iconElement = page.root.shadowRoot.querySelector(".file-chip__icon swirl-icon-file");
|
|
92
|
+
expect(iconElement).toBeTruthy();
|
|
93
|
+
});
|
|
86
94
|
it("renders text file type", async () => {
|
|
87
95
|
const page = await newSpecPage({
|
|
88
96
|
components: [SwirlFileChip],
|
|
@@ -64,16 +64,11 @@ export class SwirlFormControl {
|
|
|
64
64
|
componentDidRender() {
|
|
65
65
|
this.checkInputValue();
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.inputEl.setAttribute("aria-describedby", this.descriptionId);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.inputEl.setAttribute("swirl-aria-describedby", this.descriptionId);
|
|
76
|
-
}
|
|
67
|
+
watchDescription() {
|
|
68
|
+
this.associateDescriptionWithInputElement();
|
|
69
|
+
}
|
|
70
|
+
watchErrorMessage() {
|
|
71
|
+
this.associateDescriptionWithInputElement();
|
|
77
72
|
}
|
|
78
73
|
setInputElementDisabledState() {
|
|
79
74
|
if (!Boolean(this.inputEl)) {
|
|
@@ -136,6 +131,23 @@ export class SwirlFormControl {
|
|
|
136
131
|
this.inputEl.setAttribute("aria-labelledby", this.labelId);
|
|
137
132
|
this.inputEl.setAttribute("aria-describedby", this.descriptionId);
|
|
138
133
|
}
|
|
134
|
+
associateDescriptionWithInputElement() {
|
|
135
|
+
if (!Boolean(this.inputEl)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (Boolean(this.description) || Boolean(this.errorMessage)) {
|
|
139
|
+
if (Boolean(this.inputEl.getAttribute("contenteditable"))) {
|
|
140
|
+
this.inputEl.setAttribute("aria-describedby", this.descriptionId);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.inputEl.setAttribute("swirl-aria-describedby", this.descriptionId);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.inputEl.removeAttribute("aria-describedby");
|
|
148
|
+
this.inputEl.removeAttribute("swirl-aria-describedby");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
139
151
|
render() {
|
|
140
152
|
const showErrorMessage = Boolean(this.errorMessage);
|
|
141
153
|
const showDescription = Boolean(this.description) && !showErrorMessage;
|
|
@@ -163,7 +175,7 @@ export class SwirlFormControl {
|
|
|
163
175
|
"form-control--is-select": isSelect,
|
|
164
176
|
});
|
|
165
177
|
const LabelTag = hasContenteditableControl ? "div" : "label";
|
|
166
|
-
return (h(Host, { key: '
|
|
178
|
+
return (h(Host, { key: 'f78a0f9a49ce41a080064a155f715ef89fd91587', onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { key: 'd2fd7eb95177001c0706a6d18e48e83185f6caf9', class: className, role: "group" }, h("span", { key: 'e8fe85fc929992d48a22005c63c228c8ee14d208', class: "form-control__controls" }, h("span", { key: 'bd67548611eec6031148bf04e5b45c9d6caec594', class: "form-control__prefix" }, h("slot", { key: '5093dd090be2f2432bece77ec1d0d390fdb482bd', name: "prefix" })), h(LabelTag, { key: '30c60c1a1b7d36faa862acca026d218e38406da3', class: "form-control__label", onClick: this.onLabelClick }, hasIcon && (h("span", { key: '7f3b05a85aeac928540c1fcd7a34bebceccf786f', class: "form-control__icon" }, h("swirl-icon", { key: '12cd37a3f685e93fa7fc6b08d3fb4239e0202b36', glyph: this.icon, size: 20 }))), h("span", { key: '045cc7c094980fc107c1b47ebd0bbe37e5a4080e', class: "form-control__label-text", id: this.labelId }, this.label, this.secondaryLabel && this.labelPosition === "outside" && (h("span", { key: 'c6fdda2752f2a88ed46839213d6906c6768b7f16', class: "form-control__secondary-label" }, this.secondaryLabel)), this.tooltip && (h("span", { key: 'cf3f742e1cedd723e655f3f6d237aeb04cf26bad', class: "form-control__tooltip" }, h("swirl-tooltip", { key: 'a450c876d07b2c4f2ff90f9468554c1c897a111d', content: this.tooltip, positioning: "fixed", position: "top" }, h("swirl-icon-help", { key: '41b1b6ab4f6c240d7e7028020b15edf178129293', size: 16, tabindex: "0" }))))), h("span", { key: '968e151ce5df21d39ffd348bb696e8b6c53828c9', class: "form-control__input" }, h("slot", { key: '8b9507aae4143b57d8a29ef4ae4fa1de23d0f897' })))), showDescription && (h("span", { key: '1d2a0bada179effc4c912adc43e1ea9e8aa49ea4', class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { key: '4b1e4794cdf197fba650d97d56e752f0ed09df89', "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { key: '505704e097a229340d566b0240be6f43af4d19f0', message: this.errorMessage, size: "s" }))))));
|
|
167
179
|
}
|
|
168
180
|
static get is() { return "swirl-form-control"; }
|
|
169
181
|
static get encapsulation() { return "scoped"; }
|
|
@@ -409,7 +421,10 @@ export class SwirlFormControl {
|
|
|
409
421
|
static get watchers() {
|
|
410
422
|
return [{
|
|
411
423
|
"propName": "description",
|
|
412
|
-
"methodName": "
|
|
424
|
+
"methodName": "watchDescription"
|
|
425
|
+
}, {
|
|
426
|
+
"propName": "errorMessage",
|
|
427
|
+
"methodName": "watchErrorMessage"
|
|
413
428
|
}, {
|
|
414
429
|
"propName": "disabled",
|
|
415
430
|
"methodName": "setInputElementDisabledState"
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
4
4
|
export class SwirlInlineError {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.
|
|
7
|
-
this.desktopMediaQueryHandler = (event) => {
|
|
8
|
-
this.forceIconProps(event.matches);
|
|
9
|
-
};
|
|
6
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
10
7
|
this.message = undefined;
|
|
11
8
|
this.size = "m";
|
|
12
9
|
}
|
|
13
10
|
componentDidLoad() {
|
|
14
|
-
this.
|
|
15
|
-
|
|
11
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
12
|
+
this.forceIconProps(isDesktop);
|
|
13
|
+
});
|
|
16
14
|
}
|
|
17
15
|
disconnectedCallback() {
|
|
18
|
-
this.
|
|
16
|
+
this.mediaQueryUnsubscribe();
|
|
19
17
|
}
|
|
20
18
|
forceIconProps(smallIcon) {
|
|
21
19
|
if (!Boolean(this.iconEl)) {
|
|
@@ -33,7 +31,7 @@ export class SwirlInlineError {
|
|
|
33
31
|
}
|
|
34
32
|
render() {
|
|
35
33
|
const className = classnames("inline-error", `inline-error--size-${this.size}`);
|
|
36
|
-
return (h(Host, { key: '
|
|
34
|
+
return (h(Host, { key: '78eb4e0317497e4eb8b474bf2fc5dfe73a184a8d' }, h("span", { key: 'a60bd28648dac3243d1af914dbaa4c77fcac9829', class: className, part: "inline-error" }, h("span", { key: '67c27900c45afff291461ba8446e3d812f02c955', class: "inline-error__icon", ref: (el) => (this.iconEl = el) }, h("swirl-icon-error", { key: 'a6dbd685b5dcc2ccd50fdbf1802898cb99eb4a2d' })), h("span", { key: '7454ee5da004959bcf52ce2ca168b7aa1e81370e', class: "inline-error__message" }, this.message))));
|
|
37
35
|
}
|
|
38
36
|
static get is() { return "swirl-inline-error"; }
|
|
39
37
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
4
4
|
export class SwirlInlineStatus {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.
|
|
7
|
-
this.desktopMediaQueryHandler = (event) => {
|
|
8
|
-
this.forceIconProps(event.matches);
|
|
9
|
-
};
|
|
6
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
10
7
|
this.icon = undefined;
|
|
11
8
|
this.intent = undefined;
|
|
12
9
|
this.message = undefined;
|
|
@@ -14,11 +11,12 @@ export class SwirlInlineStatus {
|
|
|
14
11
|
this.iconSize = 20;
|
|
15
12
|
}
|
|
16
13
|
componentDidLoad() {
|
|
17
|
-
this.
|
|
18
|
-
|
|
14
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
15
|
+
this.forceIconProps(isDesktop);
|
|
16
|
+
});
|
|
19
17
|
}
|
|
20
18
|
disconnectedCallback() {
|
|
21
|
-
this.
|
|
19
|
+
this.mediaQueryUnsubscribe();
|
|
22
20
|
}
|
|
23
21
|
forceIconProps(smallIcon) {
|
|
24
22
|
if (!Boolean(this.iconEl)) {
|
|
@@ -39,7 +37,7 @@ export class SwirlInlineStatus {
|
|
|
39
37
|
}
|
|
40
38
|
render() {
|
|
41
39
|
const className = classnames("inline-status", `inline-status--intent-${this.intent}`, `inline-status--size-${this.size}`);
|
|
42
|
-
return (h(Host, { key: '
|
|
40
|
+
return (h(Host, { key: '4061d83f2fe39058d8d6e6d90b9dadc73d575aa7' }, h("span", { key: 'ae51319d804419fda99def8af8fd81b25f5c9cfc', class: className, part: "inline-status" }, this.icon && (h("span", { key: 'c677da1834aef7c19041022ad7580115c1fd8ec3', class: "inline-status__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), h("span", { key: 'dbec6cd97a2cab40ccbd9670eac038d64d14137c', class: "inline-status__message" }, this.message))));
|
|
43
41
|
}
|
|
44
42
|
static get is() { return "swirl-inline-status"; }
|
|
45
43
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { v4 as uuid } from "uuid";
|
|
4
|
-
import {
|
|
4
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
5
5
|
/**
|
|
6
6
|
* @slot avatar - Optional avatar displayed to the left of the label
|
|
7
7
|
*/
|
|
8
8
|
export class SwirlOptionListItem {
|
|
9
9
|
constructor() {
|
|
10
|
-
this.desktopMediaQuery = getDesktopMediaQuery();
|
|
11
10
|
this.elementId = uuid();
|
|
12
|
-
this.
|
|
13
|
-
this.forceIconProps(event.matches);
|
|
14
|
-
this.updateIconSize(event.matches);
|
|
15
|
-
};
|
|
11
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
16
12
|
this.onDragHandleKeyDown = (event) => {
|
|
17
13
|
if (event.code === "Space" || event.code === "Enter") {
|
|
18
14
|
event.preventDefault();
|
|
@@ -42,12 +38,13 @@ export class SwirlOptionListItem {
|
|
|
42
38
|
this.focused = undefined;
|
|
43
39
|
}
|
|
44
40
|
componentDidLoad() {
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
42
|
+
this.forceIconProps(isDesktop);
|
|
43
|
+
this.updateIconSize(isDesktop);
|
|
44
|
+
});
|
|
48
45
|
}
|
|
49
46
|
disconnectedCallback() {
|
|
50
|
-
this.
|
|
47
|
+
this.mediaQueryUnsubscribe();
|
|
51
48
|
}
|
|
52
49
|
forceIconProps(smallIcon) {
|
|
53
50
|
const icon = this.iconEl?.children[0];
|
|
@@ -71,9 +68,9 @@ export class SwirlOptionListItem {
|
|
|
71
68
|
"option-list-item--selected": this.selected,
|
|
72
69
|
"option-list-item--show-avatar": showAvatar,
|
|
73
70
|
});
|
|
74
|
-
return (h(Host, { key: '
|
|
71
|
+
return (h(Host, { key: 'f10b9d5998e571b30de2b9755b20aa9ff6553b7c' }, h("div", { key: '7351b14adf1f9b8e7f6c8fe95bff82703e3cb0c8', "aria-checked": this.swirlAriaRole === "menuitemradio" ? ariaSelected : undefined, "aria-describedby": Boolean(this.description)
|
|
75
72
|
? `option-list-item-${this.elementId}-description`
|
|
76
|
-
: undefined, "aria-disabled": ariaDisabled, "aria-labelledby": `option-list-item-${this.elementId}-label`, "aria-selected": this.swirlAriaRole === "option" ? ariaSelected : undefined, class: className, id: `option-list-item-${this.elementId}`, onBlur: this.onBlur, onFocus: this.onFocus, part: "option-list-item", role: this.swirlAriaRole }, showIcon && (h("span", { key: '
|
|
73
|
+
: undefined, "aria-disabled": ariaDisabled, "aria-labelledby": `option-list-item-${this.elementId}-label`, "aria-selected": this.swirlAriaRole === "option" ? ariaSelected : undefined, class: className, id: `option-list-item-${this.elementId}`, onBlur: this.onBlur, onFocus: this.onFocus, part: "option-list-item", role: this.swirlAriaRole }, showIcon && (h("span", { key: '28b5bf751e4b6f040e217976431cc10ccc18b2ab', class: "option-list-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) }, showIconBadge && (h("span", { key: '17d8ee99d49bc39e9c29acbdefa6a33ac1fe011f', class: "option-list-item__icon-badge", innerHTML: this.iconBadge })))), showCheckbox && (h("span", { key: 'c96a9aa51eb3d24d8d2981e72f57258ec104a4f0', class: "option-list-item__checkbox" }, h("span", { key: 'e5e16760dac9d5f8fd32dfc1a87b276bac40e218', class: "option-list-item__checkbox-box" }, this.selected && (h("swirl-icon-check-strong", { key: '19678c01717c67032d419f1c081c79dd3d2d86d2', class: "option-list-item__checkbox-icon", size: 16 }))))), h("span", { key: '206a3376c0fc0cc5fc251417d3807cb9d021dcc8', class: "option-list-item__avatar" }, h("slot", { key: 'd017728bbc40c000fd35fb1baa92ea4c01f730a2', name: "avatar" })), h("span", { key: '0fd4cec5ad5274106c2db52c304bc1877bbb03fd', class: "option-list-item__label-container" }, h("span", { key: 'b3e61b55ed5e5a0f40a59ee5ff6705ba0f170915', class: "option-list-item__label", id: `option-list-item-${this.elementId}-label`, part: "option-list-item__label" }, this.label), this.description && (h("span", { key: 'a789b71d53ce36c63aacba3136d29e778da6c506', class: "option-list-item__description", id: `option-list-item-${this.elementId}-description` }, this.description))), showSelectionIcon && (h("span", { key: 'cc615418e02db15288d1038518c032216db71025', class: "option-list-item__selection-icon" }, h("swirl-icon-check-small", { key: '6f06dee5b1cd618ad9fabb61b6bf9f4abf07fa0a', size: this.iconSize })))), this.allowDrag && (h("button", { key: '1bad552ed0a4324962a5e4735bc4330bb44cd3ea', "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "option-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, tabIndex: this.focused ? 0 : -1, type: "button" }, h("swirl-icon-drag-handle", { key: '124518bd0178c8e3e8021b5519ae751213f2e99a', size: this.iconSize })))));
|
|
77
74
|
}
|
|
78
75
|
static get is() { return "swirl-option-list-item"; }
|
|
79
76
|
static get encapsulation() { return "scoped"; }
|
package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
4
4
|
export class SwirlResourceListFileItem {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.
|
|
7
|
-
this.desktopMediaQueryHandler = (event) => {
|
|
8
|
-
this.forceIconProps(event.matches);
|
|
9
|
-
};
|
|
6
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
10
7
|
this.description = undefined;
|
|
11
8
|
this.errorMessage = undefined;
|
|
12
9
|
this.icon = "<swirl-icon-file></swirl-icon-file>";
|
|
@@ -16,11 +13,12 @@ export class SwirlResourceListFileItem {
|
|
|
16
13
|
this.removeButtonLabel = "Remove file";
|
|
17
14
|
}
|
|
18
15
|
componentDidLoad() {
|
|
19
|
-
this.
|
|
20
|
-
|
|
16
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
17
|
+
this.forceIconProps(isDesktop);
|
|
18
|
+
});
|
|
21
19
|
}
|
|
22
20
|
disconnectedCallback() {
|
|
23
|
-
this.
|
|
21
|
+
this.mediaQueryUnsubscribe();
|
|
24
22
|
}
|
|
25
23
|
forceIconProps(smallIcon) {
|
|
26
24
|
if (!Boolean(this.iconEl)) {
|
|
@@ -37,7 +35,7 @@ export class SwirlResourceListFileItem {
|
|
|
37
35
|
const className = classnames("resource-list-file-item", {
|
|
38
36
|
"resource-list-file-item--has-control": showSpinner || showRemoveButton,
|
|
39
37
|
});
|
|
40
|
-
return (h(Host, { key: '
|
|
38
|
+
return (h(Host, { key: '00406d571fa761d38dbba9b0f662bf8fd8ccf894', role: "row" }, h("div", { key: 'ae94f2002c524e297f147eef7fb1f468259ef351', class: className, part: "resource-list-file-item", role: "gridcell" }, h("span", { key: 'b09d36edbd320f67f9a6fabf0c55b9aaba1dfcef', class: "resource-list-file-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) }), h("span", { key: 'e2c7ebed082e6d7e5807865df3a86a7162ca6bb9', class: "resource-list-file-item__label-container" }, h("span", { key: '3899742fff0596baec287802dbae87171934f7fd', class: "resource-list-file-item__label", id: "label" }, this.label), showDescription && (h("span", { key: '47d88eb73d4652c7575d0460db2a218002b2b765', class: "resource-list-file-item__description" }, this.description)), showError && (h("span", { key: '453f887dc5d5c4d6ce05f8fb089b05f3e6036bab', "aria-live": "polite", class: "resource-list-file-item__error-message" }, h("swirl-inline-error", { key: '6afa1e5d6a7c93bef6fbfaacae4ceb1d9d0cf5a7', message: this.errorMessage, size: "s" })))), showSpinner && (h("span", { key: '24f2fe680d14334561cdcbc395084b338fd0bb11', class: "resource-list-file-item__spinner" }, h("swirl-spinner", { key: '83a6ba6bec794a03673af8cc9fc3f1e851af17a2', size: "s" }))), showRemoveButton && (h("span", { key: 'c50ffc6f5db1880b01ba4df0dc68e20c7b1e85b7', class: "resource-list-file-item__remove-button" }, h("swirl-button", { key: '4d8f1cc62abed8353d12d57e4b87387fbc6b0895', hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.removeButtonLabel, onClick: this.remove.emit }))))));
|
|
41
39
|
}
|
|
42
40
|
static get is() { return "swirl-resource-list-file-item"; }
|
|
43
41
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classnames from "classnames";
|
|
2
2
|
import { v4 as uuid } from "uuid";
|
|
3
3
|
import { h, Host, } from "@stencil/core";
|
|
4
|
-
import {
|
|
4
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
5
5
|
/**
|
|
6
6
|
* @slot control - Used to add a menu button to the item
|
|
7
7
|
* @slot badges - Badges displayed inside the item
|
|
@@ -9,12 +9,8 @@ import { getDesktopMediaQuery } from "../../utils";
|
|
|
9
9
|
*/
|
|
10
10
|
export class SwirlResourceListItem {
|
|
11
11
|
constructor() {
|
|
12
|
-
this.desktopMediaQuery = getDesktopMediaQuery();
|
|
13
12
|
this.elementId = uuid();
|
|
14
|
-
this.
|
|
15
|
-
this.forceIconProps(event.matches);
|
|
16
|
-
this.updateIconSize(event.matches);
|
|
17
|
-
};
|
|
13
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
18
14
|
this.onClick = () => {
|
|
19
15
|
if (!this.selectable) {
|
|
20
16
|
return;
|
|
@@ -73,16 +69,17 @@ export class SwirlResourceListItem {
|
|
|
73
69
|
this.updateMediaState();
|
|
74
70
|
}
|
|
75
71
|
componentDidLoad() {
|
|
76
|
-
this.
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
73
|
+
this.forceIconProps(isDesktop);
|
|
74
|
+
this.updateIconSize(isDesktop);
|
|
75
|
+
});
|
|
79
76
|
this.makeControlUnfocusable();
|
|
80
77
|
if (Boolean(this.menuTriggerId)) {
|
|
81
78
|
console.warn('[Swirl] The "menu-trigger-id" prop of swirl-resource-list-item is deprecated and will be removed with the next major release. Please use the "control" slot to add a menu button instead. https://swirl-storybook.flip-app.dev/?path=/docs/components-swirlresourcelistitem--docs');
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
81
|
disconnectedCallback() {
|
|
85
|
-
this.
|
|
82
|
+
this.mediaQueryUnsubscribe();
|
|
86
83
|
}
|
|
87
84
|
forceIconProps(smallIcon) {
|
|
88
85
|
const icon = this.iconEl?.children[0];
|
|
@@ -156,7 +153,7 @@ export class SwirlResourceListItem {
|
|
|
156
153
|
"resource-list-item--wrap-description": this.descriptionWrap,
|
|
157
154
|
"resource-list-item--wrap-label": this.labelWrap,
|
|
158
155
|
});
|
|
159
|
-
return (h(Host, { key: '
|
|
156
|
+
return (h(Host, { key: '63387d5ff4c56c678c6c0e30d8236d5b966d0bff', role: "row" }, h("div", { key: '6fd8f35b61a84ea91ff9ff80f6f754ee50a5933f', class: className, role: "gridcell" }, h(Tag, { key: '17e7329e6692317ad3dea70d660720c6fb8b33a5', "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-label": ariaLabel, "aria-labelledby": Boolean(this.swirlAriaLabel) ? undefined : this.elementId, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, onBlur: this.onBlur, onFocus: this.onFocus, part: "resource-list-item__content", role: role, tabIndex: 0, type: Tag === "button" ? "button" : undefined }, this.hasMedia && (h("span", { key: '4d12c2a220c03d1ee1bb77e214e028f013a23e21', class: "resource-list-item__media" }, h("slot", { key: '5d104523e7da44ceac278d5f6eebea6c2d2e516f', name: "media" }))), h("span", { key: 'cdc7fdf4a5a3e2df7080fece60638aa1d67c6388', class: "resource-list-item__label-container", style: labelContainerStyles }, h("span", { key: '187fd3a9974f65902e0fa89cb6c90b4178df7063', class: "resource-list-item__label", id: this.elementId, innerHTML: this.allowHtml ? this.label : undefined }, !this.allowHtml && this.label), this.description && (h("span", { key: '5047356c9b024dcdcf1299cc8479aedb2eb7b961', class: "resource-list-item__description", innerHTML: this.allowHtml ? this.description : undefined }, !this.allowHtml && this.description))), showMeta && (h("span", { key: '1a5039459c067b4de2a540f79124ac9310f9c594', class: "resource-list-item__meta" }, h("span", { key: 'a74caa7e64e88b8cbd9be7be020d63d833f03781', class: "resource-list-item__meta-text" }, this.meta), h("span", { key: 'ae4f5a2e927b934fba247e989cfc219b09805c99', class: "resource-list-item__badges" }, h("slot", { key: '59df5cb937ffc581ad1f6470b6080561045997fd', name: "badges" }))))), this.selectable && (h("span", { key: 'a494bc2e24fd043cc3c1024e89ae0a16d7c14f86', "aria-hidden": "true", class: "resource-list-item__checkbox" }, h("span", { key: 'b0070f0ad50a683528c216d8e0d1221b53652433', class: "resource-list-item__checkbox-icon" }, this.checked && (h("swirl-icon-check-strong", { key: 'dc3cdd5fa6e9adda926966fc77d8acf44762fda5' }))))), h("span", { key: 'd5b2f9079f6cae27bca88d7b00d9eb954641e3f1', class: "resource-list-item__control", onClick: this.onControlClick, ref: (el) => (this.controlContainer = el) }, h("slot", { key: '263ee1c8cd59301ebd510a29ce29afd112fa6c32', name: "control" })), showMenu && (h("swirl-popover-trigger", { key: '16ecfb13e3bf0e3d36851671f708ce949ff3dfee', swirlPopover: this.menuTriggerId }, h("swirl-button", { key: 'a1d94f00a09a875a689c015b332a794cda4612ca', "aria-disabled": disabled ? "true" : undefined, class: "resource-list-item__menu-trigger", disabled: disabled, hideLabel: true, icon: "<swirl-icon-more-horizontal></swirl-icon-more-horizontal>", intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))), this.allowDrag && (h("button", { key: '6a580ae58f2e50fe42828d9db668260b91bb9d43', "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, h("swirl-icon-drag-handle", { key: 'e999dfe63293b3367c6d8507532761887b3835d6', size: this.iconSize })))));
|
|
160
157
|
}
|
|
161
158
|
static get is() { return "swirl-resource-list-item"; }
|
|
162
159
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
4
4
|
export class SwirlSearch {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.
|
|
7
|
-
this.desktopMediaQueryHandler = (event) => {
|
|
8
|
-
this.forceIconProps(event.matches);
|
|
9
|
-
};
|
|
6
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
10
7
|
this.clear = () => {
|
|
11
8
|
this.input.value = "";
|
|
12
9
|
this.input.focus();
|
|
@@ -35,8 +32,9 @@ export class SwirlSearch {
|
|
|
35
32
|
this.variant = "filled";
|
|
36
33
|
}
|
|
37
34
|
componentDidLoad() {
|
|
38
|
-
this.
|
|
39
|
-
|
|
35
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
36
|
+
this.forceIconProps(isDesktop);
|
|
37
|
+
});
|
|
40
38
|
// see https://stackoverflow.com/a/27314017
|
|
41
39
|
if (this.autoFocus) {
|
|
42
40
|
setTimeout(() => {
|
|
@@ -45,7 +43,7 @@ export class SwirlSearch {
|
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
disconnectedCallback() {
|
|
48
|
-
this.
|
|
46
|
+
this.mediaQueryUnsubscribe();
|
|
49
47
|
}
|
|
50
48
|
forceIconProps(smallIcon) {
|
|
51
49
|
if (!Boolean(this.iconEl)) {
|
|
@@ -64,7 +62,7 @@ export class SwirlSearch {
|
|
|
64
62
|
const className = classnames("search", `search--variant-${this.variant}`, {
|
|
65
63
|
"search--disabled": this.disabled,
|
|
66
64
|
});
|
|
67
|
-
return (h(Host, { key: '
|
|
65
|
+
return (h(Host, { key: 'c54510f133d5583f1cb2942a21e889a271ec083c' }, h("span", { key: 'f09bf81a55b0e0e23e78dd1929055e92fd966e90', class: className, ref: (el) => (this.iconEl = el) }, h("swirl-icon-search", { key: '9d5107940cfaff59864c6a94c5eb2a3657a9168d', "aria-hidden": "true", class: "search__icon" }), h("input", { key: 'd42dcf2414af5d7f569a6990c5e85f67bdc8b9b5', "aria-disabled": this.disabled ? "true" : undefined, "aria-label": this.label, autoComplete: "off", autoFocus: this.autoFocus, class: "search__input", disabled: this.disabled, id: this.inputId, inputMode: "search", name: this.inputName, onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.input = el), type: "search", value: this.value }), !this.disabled && (h("button", { key: 'b6ec549ceb75a93fda65cc8fb008e00c26b133ac', "aria-label": this.clearButtonLabel, class: "search__clear-button", onClick: this.clear, type: "button" }, h("swirl-icon-cancel", { key: '7bff26d8ebc73200035936d4add57e2ef6bdd1e5' }))))));
|
|
68
66
|
}
|
|
69
67
|
static get is() { return "swirl-search"; }
|
|
70
68
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { DesktopMediaQuery } from "../../services/media-query.service";
|
|
4
4
|
export class SwirlTextInput {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.
|
|
7
|
-
this.desktopMediaQueryHandler = (event) => {
|
|
8
|
-
this.updateIconSize(event.matches);
|
|
9
|
-
};
|
|
6
|
+
this.mediaQueryUnsubscribe = () => { };
|
|
10
7
|
this.clear = () => {
|
|
11
8
|
this.inputEl.value = "";
|
|
12
9
|
this.value = "";
|
|
@@ -102,8 +99,9 @@ export class SwirlTextInput {
|
|
|
102
99
|
this.showPassword = false;
|
|
103
100
|
}
|
|
104
101
|
componentDidLoad() {
|
|
105
|
-
this.
|
|
106
|
-
|
|
102
|
+
this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
|
|
103
|
+
this.updateIconSize(isDesktop);
|
|
104
|
+
});
|
|
107
105
|
// see https://stackoverflow.com/a/27314017
|
|
108
106
|
if (this.autoFocus) {
|
|
109
107
|
setTimeout(() => {
|
|
@@ -115,7 +113,7 @@ export class SwirlTextInput {
|
|
|
115
113
|
this.adjustInputSize();
|
|
116
114
|
}
|
|
117
115
|
disconnectedCallback() {
|
|
118
|
-
this.
|
|
116
|
+
this.mediaQueryUnsubscribe();
|
|
119
117
|
}
|
|
120
118
|
async blurInput() {
|
|
121
119
|
this.inputEl.blur();
|
|
@@ -179,7 +177,7 @@ export class SwirlTextInput {
|
|
|
179
177
|
"text-input--inline": this.inline,
|
|
180
178
|
"text-input--show-password": this.type === "password" && this.showPassword,
|
|
181
179
|
});
|
|
182
|
-
return (h(Host, { key: '
|
|
180
|
+
return (h(Host, { key: '118c43993df15e8a56132135bd6e5bd7b20c7fa5' }, h("div", { key: 'b32019d666499025e823f65c84107090b3e0bdde', class: className }, this.prefixLabel && (h("span", { key: 'e92f359d218821987e795d91ba09de0a5ac83787', class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { key: '311c606dc2c9b78965d35543c79c828bbf04939d', "aria-autocomplete": this.swirlAriaAutocomplete, "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-invalid": ariaInvalid, autoComplete: this.autoComplete, autoFocus: this.autoFocus, class: "text-input__input", disabled: this.disabled, inputMode: this.mode, maxLength: this.maxLength, max: this.type === "number" ? this.max : undefined, min: this.type === "number" ? this.min : undefined, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, onKeyPress: this.onKeyPress, placeholder: !Boolean(this.suffixLabel) ? this.placeholder : undefined, ref: (el) => (this.inputEl = el), required: this.required, role: this.swirlRole, name: this.inputName, rows: this.rows > 1 ? this.rows : this.autoGrow ? 1 : undefined, spellcheck: this.spellCheck, step: this.type === "number" ? this.step : undefined, type: type, value: this.value }, this.rows > 1 && this.value), this.suffixLabel && (h("span", { key: '2e2987f816f1a26b074ca67fc67d2b88031af88e', class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { key: '82218c372d0374651f5cb3a07a679c5f045dabfc', "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { key: '9c42c315b34e9a614a145d2e8a00da2b28fcc21e', size: this.iconSize }))), showPasswordToggle && (h("button", { key: 'd78dcd286ba441a8d5df0a9d9e8b02c466dab617', "aria-label": this.passwordToggleLabel, class: "text-input__password-toggle", onClick: this.togglePassword, type: "button" }, this.showPassword ? (h("swirl-icon-visibility-off", { size: this.iconSize })) : (h("swirl-icon-visibility", { size: this.iconSize })))), showStepper && (h("span", { key: 'e29c6cb14c6bb8ff7ebf67800b2b267ca0208df9', class: "text-input__stepper" }, h("button", { key: '6218def82164fd3b57015d3fb8c40391cefcf84d', "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { key: '9b338df89a94563b9f9fde0ba16cb1fae537c203', size: this.iconSize })), h("button", { key: '6d31cb2c37f9a2887c57f2350afe184a76dd09f8', "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { key: 'f2b7974999012a8ad29d84dd5df8a908605f57b4', size: this.iconSize })))), this.showCharacterCounter && (h("span", { key: '4dae89e8b35db216b513bbca04dff56c48b64696', class: "text-input__character-counter", "aria-live": "polite" }, h("swirl-visually-hidden", { key: 'c48b6c6017b6b2a8524a2f3f5e9d2d8869026b3f' }, this.characterCounterLabel), this.value?.length || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
|
|
183
181
|
}
|
|
184
182
|
static get is() { return "swirl-text-input"; }
|
|
185
183
|
static get encapsulation() { return "scoped"; }
|