@getflip/swirl-components 0.81.3 → 0.82.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 +29 -3
- package/dist/cjs/file-manager.cjs.entry.js +2 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-action-list_3.cjs.entry.js +8 -12
- package/dist/cjs/swirl-app-bar.cjs.entry.js +1 -2
- package/dist/cjs/swirl-app-layout_7.cjs.entry.js +10 -15
- package/dist/cjs/swirl-autocomplete.cjs.entry.js +4 -6
- package/dist/cjs/swirl-avatar-group.cjs.entry.js +1 -1
- package/dist/cjs/swirl-banner.cjs.entry.js +5 -7
- package/dist/cjs/swirl-button.cjs.entry.js +2 -3
- package/dist/cjs/swirl-carousel.cjs.entry.js +3 -4
- package/dist/cjs/swirl-chip.cjs.entry.js +2 -3
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-console-layout.cjs.entry.js +2 -4
- package/dist/cjs/swirl-date-input.cjs.entry.js +14 -7
- package/dist/cjs/swirl-dialog.cjs.entry.js +4 -5
- package/dist/cjs/swirl-file-viewer_7.cjs.entry.js +13 -20
- package/dist/cjs/swirl-form-control.cjs.entry.js +1 -2
- package/dist/cjs/swirl-icon-check-small_3.cjs.entry.js +3 -5
- package/dist/cjs/swirl-icon-error_3.cjs.entry.js +2 -3
- package/dist/cjs/swirl-inline-status.cjs.entry.js +1 -2
- package/dist/cjs/swirl-lightbox.cjs.entry.js +8 -16
- package/dist/cjs/swirl-menu-item.cjs.entry.js +4 -7
- package/dist/cjs/swirl-menu.cjs.entry.js +6 -8
- package/dist/cjs/swirl-modal.cjs.entry.js +15 -6
- package/dist/cjs/swirl-option-list.cjs.entry.js +5 -8
- package/dist/cjs/swirl-pdf-reader.cjs.entry.js +3 -5
- package/dist/cjs/swirl-popover_2.cjs.entry.js +9 -14
- package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +2 -3
- package/dist/cjs/swirl-search.cjs.entry.js +8 -3
- package/dist/cjs/swirl-select.cjs.entry.js +9 -7
- package/dist/cjs/swirl-shell-layout.cjs.entry.js +2 -3
- 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 -2
- package/dist/cjs/swirl-tabs.cjs.entry.js +2 -4
- package/dist/cjs/swirl-tag.cjs.entry.js +1 -2
- package/dist/cjs/swirl-text-input.cjs.entry.js +8 -4
- package/dist/cjs/swirl-theme-provider.cjs.entry.js +15 -5
- package/dist/cjs/swirl-time-input.cjs.entry.js +10 -6
- package/dist/cjs/swirl-toast-provider.cjs.entry.js +8 -3
- package/dist/cjs/swirl-toast.cjs.entry.js +4 -6
- package/dist/cjs/swirl-tooltip.cjs.entry.js +6 -8
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/collection/components/swirl-action-list/swirl-action-list.js +3 -5
- package/dist/collection/components/swirl-action-list-item/swirl-action-list-item.js +5 -7
- package/dist/collection/components/swirl-app-bar/swirl-app-bar.js +1 -2
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +1 -2
- package/dist/collection/components/swirl-autocomplete/swirl-autocomplete.js +4 -6
- package/dist/collection/components/swirl-avatar-group/swirl-avatar-group.js +1 -1
- package/dist/collection/components/swirl-banner/swirl-banner.js +5 -7
- package/dist/collection/components/swirl-button/swirl-button.js +2 -3
- package/dist/collection/components/swirl-carousel/swirl-carousel.js +3 -4
- package/dist/collection/components/swirl-chip/swirl-chip.js +2 -3
- package/dist/collection/components/swirl-console-layout/swirl-console-layout.js +2 -4
- package/dist/collection/components/swirl-date-input/swirl-date-input.js +14 -7
- package/dist/collection/components/swirl-dialog/swirl-dialog.js +4 -5
- package/dist/collection/components/swirl-file-viewer/viewers/swirl-file-viewer-csv/swirl-file-viewer-csv.js +2 -4
- package/dist/collection/components/swirl-file-viewer/viewers/swirl-file-viewer-pdf/swirl-file-viewer-pdf.js +11 -16
- package/dist/collection/components/swirl-form-control/swirl-form-control.js +1 -2
- package/dist/collection/components/swirl-form-control/swirl-form-control.stories.js +28 -7
- package/dist/collection/components/swirl-inline-error/swirl-inline-error.js +2 -3
- package/dist/collection/components/swirl-inline-status/swirl-inline-status.js +1 -2
- package/dist/collection/components/swirl-lightbox/swirl-lightbox.js +8 -16
- package/dist/collection/components/swirl-menu/swirl-menu.js +6 -8
- package/dist/collection/components/swirl-menu-item/swirl-menu-item.js +4 -7
- package/dist/collection/components/swirl-modal/swirl-modal.js +53 -9
- package/dist/collection/components/swirl-modal/swirl-modal.stories.js +1 -1
- package/dist/collection/components/swirl-option-list/swirl-option-list.js +5 -8
- package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.js +3 -5
- package/dist/collection/components/swirl-pdf-reader/swirl-pdf-reader.js +3 -5
- package/dist/collection/components/swirl-popover/swirl-popover.js +8 -12
- package/dist/collection/components/swirl-popover/swirl-popover.stories.js +1 -1
- package/dist/collection/components/swirl-popover-trigger/swirl-popover-trigger.js +1 -2
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.js +6 -8
- package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js +2 -3
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +3 -5
- package/dist/collection/components/swirl-search/swirl-search.js +8 -3
- package/dist/collection/components/swirl-select/swirl-select.js +9 -7
- package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.js +2 -3
- package/dist/collection/components/swirl-table/swirl-table.js +1 -2
- package/dist/collection/components/swirl-table-column/swirl-table-column.js +1 -1
- package/dist/collection/components/swirl-table-row/swirl-table-row.js +1 -1
- package/dist/collection/components/swirl-tabs/swirl-tabs.js +2 -4
- package/dist/collection/components/swirl-tag/swirl-tag.js +1 -2
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +8 -4
- package/dist/collection/components/swirl-text-input/swirl-text-input.spec.js +1 -4
- package/dist/collection/components/swirl-theme-provider/swirl-theme-provider.js +15 -5
- package/dist/collection/components/swirl-time-input/swirl-time-input.js +10 -6
- package/dist/collection/components/swirl-toast/swirl-toast.js +4 -6
- package/dist/collection/components/swirl-toast-provider/swirl-toast-provider.js +8 -3
- package/dist/collection/components/swirl-tooltip/swirl-tooltip.js +6 -8
- package/dist/collection/prototypes/file-manager/file-manager.js +2 -4
- package/dist/components/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/components/file-manager.js +2 -4
- package/dist/components/swirl-action-list-item2.js +5 -7
- package/dist/components/swirl-action-list2.js +3 -5
- package/dist/components/swirl-app-bar.js +1 -2
- package/dist/components/swirl-app-layout2.js +1 -2
- package/dist/components/swirl-autocomplete.js +4 -6
- package/dist/components/swirl-avatar-group.js +1 -1
- package/dist/components/swirl-banner.js +5 -7
- package/dist/components/swirl-button2.js +2 -3
- package/dist/components/swirl-carousel.js +3 -4
- package/dist/components/swirl-chip.js +2 -3
- package/dist/components/swirl-console-layout.js +2 -4
- package/dist/components/swirl-date-input.js +14 -7
- package/dist/components/swirl-dialog.js +4 -5
- package/dist/components/swirl-file-viewer-csv2.js +2 -4
- package/dist/components/swirl-file-viewer-pdf2.js +11 -16
- package/dist/components/swirl-form-control.js +1 -2
- package/dist/components/swirl-inline-error2.js +2 -3
- package/dist/components/swirl-inline-status.js +1 -2
- package/dist/components/swirl-lightbox.js +8 -16
- package/dist/components/swirl-menu-item.js +4 -7
- package/dist/components/swirl-menu.js +6 -8
- package/dist/components/swirl-modal.js +16 -6
- package/dist/components/swirl-option-list-item2.js +3 -5
- package/dist/components/swirl-option-list2.js +5 -8
- package/dist/components/swirl-pdf-reader.js +3 -5
- package/dist/components/swirl-popover-trigger2.js +1 -2
- package/dist/components/swirl-popover2.js +8 -12
- package/dist/components/swirl-resource-list-file-item.js +2 -3
- package/dist/components/swirl-resource-list-item2.js +3 -5
- package/dist/components/swirl-resource-list2.js +6 -8
- package/dist/components/swirl-search.js +8 -3
- package/dist/components/swirl-select.js +9 -7
- package/dist/components/swirl-shell-layout.js +2 -3
- package/dist/components/swirl-table-column.js +1 -1
- package/dist/components/swirl-table-row.js +1 -1
- package/dist/components/swirl-table.js +1 -2
- package/dist/components/swirl-tabs.js +2 -4
- package/dist/components/swirl-tag2.js +1 -2
- package/dist/components/swirl-text-input2.js +8 -4
- package/dist/components/swirl-theme-provider.js +15 -5
- package/dist/components/swirl-time-input.js +10 -6
- package/dist/components/swirl-toast-provider.js +8 -3
- package/dist/components/swirl-toast2.js +4 -6
- package/dist/components/swirl-tooltip.js +6 -8
- package/dist/esm/file-manager.entry.js +2 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-action-list_3.entry.js +8 -12
- package/dist/esm/swirl-app-bar.entry.js +1 -2
- package/dist/esm/swirl-app-layout_7.entry.js +10 -15
- package/dist/esm/swirl-autocomplete.entry.js +4 -6
- package/dist/esm/swirl-avatar-group.entry.js +1 -1
- package/dist/esm/swirl-banner.entry.js +5 -7
- package/dist/esm/swirl-button.entry.js +2 -3
- package/dist/esm/swirl-carousel.entry.js +3 -4
- package/dist/esm/swirl-chip.entry.js +2 -3
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-console-layout.entry.js +2 -4
- package/dist/esm/swirl-date-input.entry.js +14 -7
- package/dist/esm/swirl-dialog.entry.js +4 -5
- package/dist/esm/swirl-file-viewer_7.entry.js +13 -20
- package/dist/esm/swirl-form-control.entry.js +1 -2
- package/dist/esm/swirl-icon-check-small_3.entry.js +3 -5
- package/dist/esm/swirl-icon-error_3.entry.js +2 -3
- package/dist/esm/swirl-inline-status.entry.js +1 -2
- package/dist/esm/swirl-lightbox.entry.js +8 -16
- package/dist/esm/swirl-menu-item.entry.js +4 -7
- package/dist/esm/swirl-menu.entry.js +6 -8
- package/dist/esm/swirl-modal.entry.js +15 -6
- package/dist/esm/swirl-option-list.entry.js +5 -8
- package/dist/esm/swirl-pdf-reader.entry.js +3 -5
- package/dist/esm/swirl-popover_2.entry.js +9 -14
- package/dist/esm/swirl-resource-list-file-item.entry.js +2 -3
- package/dist/esm/swirl-search.entry.js +8 -3
- package/dist/esm/swirl-select.entry.js +9 -7
- package/dist/esm/swirl-shell-layout.entry.js +2 -3
- 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 -2
- package/dist/esm/swirl-tabs.entry.js +2 -4
- package/dist/esm/swirl-tag.entry.js +1 -2
- package/dist/esm/swirl-text-input.entry.js +8 -4
- package/dist/esm/swirl-theme-provider.entry.js +15 -5
- package/dist/esm/swirl-time-input.entry.js +10 -6
- package/dist/esm/swirl-toast-provider.entry.js +8 -3
- package/dist/esm/swirl-toast.entry.js +4 -6
- package/dist/esm/swirl-tooltip.entry.js +6 -8
- package/dist/swirl-components/p-07957b9a.entry.js +1 -0
- package/dist/swirl-components/p-1a05f16b.entry.js +1 -0
- package/dist/swirl-components/{p-1d92561c.entry.js → p-1a4c6557.entry.js} +1 -1
- package/dist/swirl-components/p-1f3c35bd.entry.js +1 -0
- package/dist/swirl-components/p-3da6d23a.entry.js +1 -0
- package/dist/swirl-components/{p-ab7f6735.entry.js → p-44196449.entry.js} +1 -1
- package/dist/swirl-components/p-4dafdcee.entry.js +1 -0
- package/dist/swirl-components/p-56fa872b.entry.js +1 -0
- package/dist/swirl-components/p-5fcf5a79.entry.js +1 -0
- package/dist/swirl-components/p-62f1aaae.entry.js +1 -0
- package/dist/swirl-components/p-684170ee.entry.js +1 -0
- package/dist/swirl-components/p-6f178b75.entry.js +1 -0
- package/dist/swirl-components/p-723f12cd.entry.js +1 -0
- package/dist/swirl-components/{p-bd0ba465.entry.js → p-7c9311c4.entry.js} +2 -2
- package/dist/swirl-components/p-7e90107b.entry.js +1 -0
- package/dist/swirl-components/p-81067ba3.entry.js +1 -0
- package/dist/swirl-components/p-8e5e6c16.entry.js +1 -0
- package/dist/swirl-components/p-902fc533.entry.js +1 -0
- package/dist/swirl-components/p-9c5e2b99.entry.js +1 -0
- package/dist/swirl-components/p-9c70b38e.entry.js +1 -0
- package/dist/swirl-components/p-a3e6a921.entry.js +1 -0
- package/dist/swirl-components/p-a8dc02be.entry.js +1 -0
- package/dist/swirl-components/p-baf3c630.entry.js +1 -0
- package/dist/swirl-components/p-bf317ae5.entry.js +1 -0
- package/dist/swirl-components/p-c3d23855.entry.js +1 -0
- package/dist/swirl-components/p-c4c4d5c4.entry.js +1 -0
- package/dist/swirl-components/p-ce1cd2e1.entry.js +1 -0
- package/dist/swirl-components/p-d14846f2.entry.js +1 -0
- package/dist/swirl-components/p-d1edd738.entry.js +10 -0
- package/dist/swirl-components/p-d3c3cb10.entry.js +1 -0
- package/dist/swirl-components/p-d3e39e06.entry.js +1 -0
- package/dist/swirl-components/p-d403f973.entry.js +1 -0
- package/dist/swirl-components/p-e4819964.entry.js +1 -0
- package/dist/swirl-components/p-e86c79d8.entry.js +1 -0
- package/dist/swirl-components/{p-b6e75c2e.entry.js → p-e9cefe04.entry.js} +1 -1
- package/dist/swirl-components/p-efb5e6ee.entry.js +1 -0
- package/dist/swirl-components/p-f299ab14.entry.js +1 -0
- package/dist/swirl-components/p-f703a664.entry.js +1 -0
- package/dist/swirl-components/p-fd7140dc.entry.js +1 -0
- package/dist/swirl-components/p-fdfeb16a.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-date-input/swirl-date-input.d.ts +1 -0
- package/dist/types/components/swirl-modal/swirl-modal.d.ts +5 -2
- package/dist/types/components/swirl-time-input/swirl-time-input.d.ts +1 -0
- package/dist/types/components.d.ts +5 -2
- package/package.json +2 -2
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-017fc399.entry.js +0 -1
- package/dist/swirl-components/p-028dbe1a.entry.js +0 -1
- package/dist/swirl-components/p-059f706f.entry.js +0 -1
- package/dist/swirl-components/p-062a4329.entry.js +0 -1
- package/dist/swirl-components/p-209e85c5.entry.js +0 -1
- package/dist/swirl-components/p-2278aeae.entry.js +0 -1
- package/dist/swirl-components/p-251884ec.entry.js +0 -1
- package/dist/swirl-components/p-27bdb25e.entry.js +0 -1
- package/dist/swirl-components/p-29147daa.entry.js +0 -1
- package/dist/swirl-components/p-29d32e39.entry.js +0 -1
- package/dist/swirl-components/p-2d5438ae.entry.js +0 -1
- package/dist/swirl-components/p-2fb83beb.entry.js +0 -1
- package/dist/swirl-components/p-30ae7d5c.entry.js +0 -1
- package/dist/swirl-components/p-34edf304.entry.js +0 -1
- package/dist/swirl-components/p-3d7a911b.entry.js +0 -1
- package/dist/swirl-components/p-5875e90e.entry.js +0 -1
- package/dist/swirl-components/p-67770da3.entry.js +0 -1
- package/dist/swirl-components/p-6832ee6c.entry.js +0 -1
- package/dist/swirl-components/p-687f534e.entry.js +0 -1
- package/dist/swirl-components/p-70db5c75.entry.js +0 -1
- package/dist/swirl-components/p-71c6c311.entry.js +0 -1
- package/dist/swirl-components/p-75a0a157.entry.js +0 -1
- package/dist/swirl-components/p-75d85160.entry.js +0 -1
- package/dist/swirl-components/p-794d25e2.entry.js +0 -1
- package/dist/swirl-components/p-873a1d91.entry.js +0 -1
- package/dist/swirl-components/p-8c62e1d4.entry.js +0 -1
- package/dist/swirl-components/p-8d92436f.entry.js +0 -1
- package/dist/swirl-components/p-97ac3d63.entry.js +0 -1
- package/dist/swirl-components/p-9d9427ab.entry.js +0 -1
- package/dist/swirl-components/p-a7568135.entry.js +0 -10
- package/dist/swirl-components/p-af46650d.entry.js +0 -1
- package/dist/swirl-components/p-d2845730.entry.js +0 -1
- package/dist/swirl-components/p-d56358aa.entry.js +0 -1
- package/dist/swirl-components/p-d5c14ee5.entry.js +0 -1
- package/dist/swirl-components/p-dd83db88.entry.js +0 -1
- package/dist/swirl-components/p-f6a11841.entry.js +0 -1
|
@@ -83,22 +83,19 @@ export class SwirlMenuItem {
|
|
|
83
83
|
: undefined;
|
|
84
84
|
}
|
|
85
85
|
renderActionListItem() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
? (_c = Array.from(((_b = this.subMenu) === null || _b === void 0 ? void 0 : _b.querySelectorAll("swirl-menu-item")) || []).find((item) => { var _a; return item.value === ((_a = this.subMenu) === null || _a === void 0 ? void 0 : _a.value); })) === null || _c === void 0 ? void 0 : _c.label
|
|
86
|
+
const badge = Boolean(this.subMenu?.value)
|
|
87
|
+
? Array.from(this.subMenu?.querySelectorAll("swirl-menu-item") || []).find((item) => item.value === this.subMenu?.value)?.label
|
|
89
88
|
: undefined;
|
|
90
89
|
return (h("swirl-action-list-item", { badge: badge, description: this.description, disabled: this.disabled, icon: this.icon, intent: this.intent, label: this.label, onClick: this.onActionListItemClick, ref: (el) => (this.actionListItem = el) }));
|
|
91
90
|
}
|
|
92
91
|
renderOptionListItem() {
|
|
93
|
-
|
|
94
|
-
return (h("swirl-option-list-item", { disabled: this.disabled, icon: this.icon, label: this.label, onClick: this.onOptionListItemClick, onKeyDown: this.onOptionListItemKeyDown, onKeyUp: this.onOptionListItemKeyUp, ref: (el) => (this.optionListItem = el), selected: ((_a = this.parentMenu) === null || _a === void 0 ? void 0 : _a.value) === this.value, swirlAriaRole: "menuitemradio", value: this.value }));
|
|
92
|
+
return (h("swirl-option-list-item", { disabled: this.disabled, icon: this.icon, label: this.label, onClick: this.onOptionListItemClick, onKeyDown: this.onOptionListItemKeyDown, onKeyUp: this.onOptionListItemKeyUp, ref: (el) => (this.optionListItem = el), selected: this.parentMenu?.value === this.value, swirlAriaRole: "menuitemradio", value: this.value }));
|
|
95
93
|
}
|
|
96
94
|
render() {
|
|
97
|
-
var _a;
|
|
98
95
|
const className = classnames("menu-item", {
|
|
99
96
|
"menu-item--expanded": this.expanded,
|
|
100
97
|
});
|
|
101
|
-
return (h(Host, null, h("div", { class: className },
|
|
98
|
+
return (h(Host, null, h("div", { class: className }, this.parentMenu?.variant === "selection"
|
|
102
99
|
? this.renderOptionListItem()
|
|
103
100
|
: this.renderActionListItem(), h("slot", { onSlotchange: this.onSlotChange }))));
|
|
104
101
|
}
|
|
@@ -28,10 +28,9 @@ export class SwirlModal {
|
|
|
28
28
|
this.secondaryAction.emit(event);
|
|
29
29
|
};
|
|
30
30
|
this.determineScrollStatus = () => {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const scrollable = ((_e = this.scrollContainer) === null || _e === void 0 ? void 0 : _e.scrollHeight) > ((_f = this.scrollContainer) === null || _f === void 0 ? void 0 : _f.offsetHeight);
|
|
31
|
+
const scrolled = this.scrollContainer?.scrollTop > 0;
|
|
32
|
+
const scrolledDown = Math.ceil(this.scrollContainer?.scrollTop + this.scrollContainer?.offsetHeight) >= this.scrollContainer?.scrollHeight;
|
|
33
|
+
const scrollable = this.scrollContainer?.scrollHeight > this.scrollContainer?.offsetHeight;
|
|
35
34
|
if (scrolled !== this.scrolled) {
|
|
36
35
|
this.scrolled = scrolled;
|
|
37
36
|
}
|
|
@@ -42,6 +41,7 @@ export class SwirlModal {
|
|
|
42
41
|
this.scrollable = scrollable;
|
|
43
42
|
}
|
|
44
43
|
};
|
|
44
|
+
this.closable = true;
|
|
45
45
|
this.closeButtonLabel = "Close modal";
|
|
46
46
|
this.hideCloseButton = undefined;
|
|
47
47
|
this.hideLabel = undefined;
|
|
@@ -89,6 +89,7 @@ export class SwirlModal {
|
|
|
89
89
|
// wait for animation
|
|
90
90
|
setTimeout(() => {
|
|
91
91
|
this.focusTrap.activate();
|
|
92
|
+
this.handleAutoFocus();
|
|
92
93
|
}, 200);
|
|
93
94
|
}
|
|
94
95
|
else {
|
|
@@ -105,12 +106,16 @@ export class SwirlModal {
|
|
|
105
106
|
this.determineScrollStatus();
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
108
|
-
* Close the modal.
|
|
109
|
+
* Close the modal. Pass `true` to force close even if the modal is not closable.
|
|
109
110
|
*/
|
|
110
|
-
async close() {
|
|
111
|
+
async close(force) {
|
|
111
112
|
if (this.closing) {
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
115
|
+
this.requestModalClose.emit();
|
|
116
|
+
if (!this.closable && !force) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
114
119
|
this.closing = true;
|
|
115
120
|
this.unlockBodyScroll();
|
|
116
121
|
setTimeout(() => {
|
|
@@ -128,6 +133,9 @@ export class SwirlModal {
|
|
|
128
133
|
updateHeaderToolsStatus() {
|
|
129
134
|
this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
|
|
130
135
|
}
|
|
136
|
+
handleAutoFocus() {
|
|
137
|
+
this.modalEl.querySelector("input[autofocus]")?.focus();
|
|
138
|
+
}
|
|
131
139
|
lockBodyScroll() {
|
|
132
140
|
disableBodyScroll(this.scrollContainer);
|
|
133
141
|
}
|
|
@@ -164,6 +172,24 @@ export class SwirlModal {
|
|
|
164
172
|
}
|
|
165
173
|
static get properties() {
|
|
166
174
|
return {
|
|
175
|
+
"closable": {
|
|
176
|
+
"type": "boolean",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "boolean",
|
|
180
|
+
"resolved": "boolean",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": true,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": ""
|
|
188
|
+
},
|
|
189
|
+
"attribute": "closable",
|
|
190
|
+
"reflect": false,
|
|
191
|
+
"defaultValue": "true"
|
|
192
|
+
},
|
|
167
193
|
"closeButtonLabel": {
|
|
168
194
|
"type": "string",
|
|
169
195
|
"mutable": false,
|
|
@@ -406,6 +432,21 @@ export class SwirlModal {
|
|
|
406
432
|
}
|
|
407
433
|
}
|
|
408
434
|
}
|
|
435
|
+
}, {
|
|
436
|
+
"method": "requestModalClose",
|
|
437
|
+
"name": "requestModalClose",
|
|
438
|
+
"bubbles": true,
|
|
439
|
+
"cancelable": true,
|
|
440
|
+
"composed": true,
|
|
441
|
+
"docs": {
|
|
442
|
+
"tags": [],
|
|
443
|
+
"text": ""
|
|
444
|
+
},
|
|
445
|
+
"complexType": {
|
|
446
|
+
"original": "void",
|
|
447
|
+
"resolved": "void",
|
|
448
|
+
"references": {}
|
|
449
|
+
}
|
|
409
450
|
}, {
|
|
410
451
|
"method": "secondaryAction",
|
|
411
452
|
"name": "secondaryAction",
|
|
@@ -447,8 +488,11 @@ export class SwirlModal {
|
|
|
447
488
|
},
|
|
448
489
|
"close": {
|
|
449
490
|
"complexType": {
|
|
450
|
-
"signature": "() => Promise<void>",
|
|
451
|
-
"parameters": [
|
|
491
|
+
"signature": "(force?: boolean) => Promise<void>",
|
|
492
|
+
"parameters": [{
|
|
493
|
+
"tags": [],
|
|
494
|
+
"text": ""
|
|
495
|
+
}],
|
|
452
496
|
"references": {
|
|
453
497
|
"Promise": {
|
|
454
498
|
"location": "global"
|
|
@@ -457,7 +501,7 @@ export class SwirlModal {
|
|
|
457
501
|
"return": "Promise<void>"
|
|
458
502
|
},
|
|
459
503
|
"docs": {
|
|
460
|
-
"text": "Close the modal.",
|
|
504
|
+
"text": "Close the modal. Pass `true` to force close even if the modal is not closable.",
|
|
461
505
|
"tags": []
|
|
462
506
|
}
|
|
463
507
|
}
|
|
@@ -50,7 +50,7 @@ const Template = (args) => {
|
|
|
50
50
|
</swirl-text>
|
|
51
51
|
|
|
52
52
|
<swirl-box padding-block-start="0" padding-block-end="16" slot="header-tools">
|
|
53
|
-
<swirl-search label="Search"></swirl-search>
|
|
53
|
+
<swirl-search auto-focus label="Search"></swirl-search>
|
|
54
54
|
</div>
|
|
55
55
|
`;
|
|
56
56
|
container.append(trigger, element);
|
|
@@ -19,7 +19,7 @@ export class SwirlOptionList {
|
|
|
19
19
|
this.onClick = (event) => {
|
|
20
20
|
event.preventDefault();
|
|
21
21
|
const target = event.target;
|
|
22
|
-
const item = target
|
|
22
|
+
const item = target?.closest("swirl-option-list-item");
|
|
23
23
|
const composedTarget = event.composedPath()[0];
|
|
24
24
|
const clickedOption = Boolean(closestPassShadow(composedTarget, '[role="option"]'));
|
|
25
25
|
if (!Boolean(item) || !clickedOption) {
|
|
@@ -128,9 +128,8 @@ export class SwirlOptionList {
|
|
|
128
128
|
this.setupDragDrop();
|
|
129
129
|
}
|
|
130
130
|
disconnectedCallback() {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(_b = this.sortable) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
131
|
+
this.observer?.disconnect();
|
|
132
|
+
this.sortable?.destroy();
|
|
134
133
|
}
|
|
135
134
|
watchAllowDrag() {
|
|
136
135
|
this.setItemAllowDragState();
|
|
@@ -258,16 +257,14 @@ export class SwirlOptionList {
|
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
259
|
syncItemsWithValue() {
|
|
261
|
-
|
|
262
|
-
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach((item) => (item.selected = this.value.includes(item.value)));
|
|
260
|
+
this.items?.forEach((item) => (item.selected = this.value.includes(item.value)));
|
|
263
261
|
}
|
|
264
262
|
focusItem(index) {
|
|
265
|
-
var _a;
|
|
266
263
|
if (this.disabled) {
|
|
267
264
|
return;
|
|
268
265
|
}
|
|
269
266
|
this.items.forEach((item) => item.querySelector('[role="option"]').removeAttribute("tabIndex"));
|
|
270
|
-
const item =
|
|
267
|
+
const item = this.items[index]?.querySelector('[role="option"]');
|
|
271
268
|
if (!Boolean(item)) {
|
|
272
269
|
return;
|
|
273
270
|
}
|
|
@@ -33,13 +33,11 @@ export class SwirlOptionListItem {
|
|
|
33
33
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
34
34
|
}
|
|
35
35
|
disconnectedCallback() {
|
|
36
|
-
|
|
37
|
-
(_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
|
|
36
|
+
this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
|
|
38
37
|
}
|
|
39
38
|
forceIconProps(smallIcon) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", smallIcon ? "20" : "24");
|
|
39
|
+
const icon = this.iconEl?.children[0];
|
|
40
|
+
icon?.setAttribute("size", smallIcon ? "20" : "24");
|
|
43
41
|
}
|
|
44
42
|
updateIconSize(smallIcon) {
|
|
45
43
|
this.iconSize = smallIcon ? 20 : 24;
|
|
@@ -66,9 +66,8 @@ export class SwirlPdfReader {
|
|
|
66
66
|
this.zoom = value === "auto" ? value : +value;
|
|
67
67
|
};
|
|
68
68
|
this.onThumbnailClick = (index) => () => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
page === null || page === void 0 ? void 0 : page.scrollIntoView();
|
|
69
|
+
const page = querySelectorAllDeep(this.el, `[data-page-number="${index + 1}"]`)?.[0];
|
|
70
|
+
page?.scrollIntoView();
|
|
72
71
|
};
|
|
73
72
|
this.autoZoomLabel = "Full width";
|
|
74
73
|
this.closeButtonLabel = "Close PDF viewer";
|
|
@@ -104,9 +103,8 @@ export class SwirlPdfReader {
|
|
|
104
103
|
this.modal = new A11yDialog(this.modalEl);
|
|
105
104
|
}
|
|
106
105
|
disconnectedCallback() {
|
|
107
|
-
var _a;
|
|
108
106
|
this.unlockBodyScroll();
|
|
109
|
-
|
|
107
|
+
this.modal?.destroy();
|
|
110
108
|
}
|
|
111
109
|
onWindowResize() {
|
|
112
110
|
if (!Boolean(this.pdfViewer)) {
|
|
@@ -74,7 +74,6 @@ export class SwirlPopover {
|
|
|
74
74
|
this.unlockBodyScroll();
|
|
75
75
|
}
|
|
76
76
|
onWindowFocusIn(event) {
|
|
77
|
-
var _a;
|
|
78
77
|
if (!this.active) {
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
@@ -85,7 +84,7 @@ export class SwirlPopover {
|
|
|
85
84
|
const popoverLostFocus = !this.el.contains(target) &&
|
|
86
85
|
!this.el.contains(activeElement) &&
|
|
87
86
|
target !== this.triggerEl &&
|
|
88
|
-
!
|
|
87
|
+
!this.triggerEl?.contains(target) &&
|
|
89
88
|
(!isSafari ||
|
|
90
89
|
(isSafari &&
|
|
91
90
|
!this.el.contains(relatedTarget || target) &&
|
|
@@ -115,7 +114,6 @@ export class SwirlPopover {
|
|
|
115
114
|
* @returns
|
|
116
115
|
*/
|
|
117
116
|
async close() {
|
|
118
|
-
var _a;
|
|
119
117
|
if (this.closing || !this.active) {
|
|
120
118
|
return;
|
|
121
119
|
}
|
|
@@ -130,7 +128,7 @@ export class SwirlPopover {
|
|
|
130
128
|
this.updateTriggerAttributes();
|
|
131
129
|
}, 150);
|
|
132
130
|
this.unlockBodyScroll();
|
|
133
|
-
|
|
131
|
+
this.getNativeTriggerElement()?.focus();
|
|
134
132
|
}
|
|
135
133
|
/**
|
|
136
134
|
* Open the popover.
|
|
@@ -179,10 +177,9 @@ export class SwirlPopover {
|
|
|
179
177
|
});
|
|
180
178
|
}
|
|
181
179
|
getNativeTriggerElement() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
((_d = (_c = this.triggerEl) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.children[0]) ||
|
|
180
|
+
return this.triggerEl?.tagName.startsWith("SWIRL-")
|
|
181
|
+
? (this.triggerEl?.children[0] ||
|
|
182
|
+
this.triggerEl?.shadowRoot?.children[0] ||
|
|
186
183
|
this.triggerEl)
|
|
187
184
|
: this.triggerEl;
|
|
188
185
|
}
|
|
@@ -235,17 +232,16 @@ export class SwirlPopover {
|
|
|
235
232
|
enableBodyScroll(this.scrollContainer);
|
|
236
233
|
}
|
|
237
234
|
render() {
|
|
238
|
-
var _a, _b, _c;
|
|
239
235
|
const mobile = !window.matchMedia("(min-width: 768px)").matches;
|
|
240
|
-
const className = classnames("popover", `popover--animation-${this.animation}`, `popover--placement-${
|
|
236
|
+
const className = classnames("popover", `popover--animation-${this.animation}`, `popover--placement-${this.position?.placement}`, {
|
|
241
237
|
"popover--closing": this.closing,
|
|
242
238
|
"popover--active": this.active,
|
|
243
239
|
"popover--fullscreen-bottom-sheet": this.fullscreenBottomSheet,
|
|
244
240
|
"popover--inactive": !this.active,
|
|
245
241
|
});
|
|
246
242
|
return (h(Host, null, h("div", { class: className, onKeyDown: this.onKeydown }, h("div", { "aria-hidden": !this.active ? "true" : "false", "aria-label": this.label, class: "popover__content", id: this.popoverId, part: "popover__content", role: "dialog", ref: (el) => (this.contentContainer = el), style: {
|
|
247
|
-
top: Boolean(this.position) ? `${
|
|
248
|
-
left: Boolean(this.position) ? `${
|
|
243
|
+
top: Boolean(this.position) ? `${this.position?.y}px` : "",
|
|
244
|
+
left: Boolean(this.position) ? `${this.position?.x}px` : "",
|
|
249
245
|
}, tabindex: "-1" }, h("span", { class: "popover__handle" }), h("div", { class: "popover__scroll-container", ref: (el) => (this.scrollContainer = el), style: {
|
|
250
246
|
maxHeight: !mobile && Boolean(this.maxHeight)
|
|
251
247
|
? this.maxHeight
|
|
@@ -60,7 +60,7 @@ const Template = (args) => {
|
|
|
60
60
|
container.append("\n ", trigger, "\n ", element);
|
|
61
61
|
element.addEventListener("click", (event) => {
|
|
62
62
|
const target = event.target;
|
|
63
|
-
if (
|
|
63
|
+
if (target?.tagName === "SWIRL-ACTION-LIST-ITEM") {
|
|
64
64
|
element.close();
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -27,12 +27,11 @@ export class SwirlPopoverTrigger {
|
|
|
27
27
|
}, { once: true });
|
|
28
28
|
};
|
|
29
29
|
this.updateTriggerElAriaAttributes = (open) => {
|
|
30
|
-
var _a;
|
|
31
30
|
if (!this.setAriaAttributes) {
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
const triggerEl = this.getTriggerEl();
|
|
35
|
-
const popoverId = typeof this.popover === "string" ? this.popover :
|
|
34
|
+
const popoverId = typeof this.popover === "string" ? this.popover : this.popover?.id;
|
|
36
35
|
if (triggerEl.tagName.startsWith("SWIRL-")) {
|
|
37
36
|
triggerEl.setAttribute("swirl-aria-controls", popoverId);
|
|
38
37
|
triggerEl.setAttribute("swirl-aria-expanded", String(open || "false"));
|
|
@@ -53,7 +53,7 @@ export class SwirlResourceList {
|
|
|
53
53
|
else if (event.key === "Space" || event.key === "Enter") {
|
|
54
54
|
const target = event.composedPath()[0];
|
|
55
55
|
if (Boolean(this.dragging) &&
|
|
56
|
-
!
|
|
56
|
+
!target?.classList.contains("resource-list-item__drag-handle")) {
|
|
57
57
|
event.preventDefault();
|
|
58
58
|
this.stopDrag(this.dragging);
|
|
59
59
|
}
|
|
@@ -81,9 +81,8 @@ export class SwirlResourceList {
|
|
|
81
81
|
this.setupDragDrop();
|
|
82
82
|
}
|
|
83
83
|
disconnectedCallback() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
84
|
+
this.sortable?.destroy();
|
|
85
|
+
this.observer?.disconnect();
|
|
87
86
|
}
|
|
88
87
|
observeSlotChanges() {
|
|
89
88
|
this.observer = new MutationObserver(() => {
|
|
@@ -106,10 +105,9 @@ export class SwirlResourceList {
|
|
|
106
105
|
return this.items.map((i) => i).findIndex((i) => i === item);
|
|
107
106
|
}
|
|
108
107
|
removeItemsFromTabOrder() {
|
|
109
|
-
this.items.forEach((item) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
108
|
+
this.items.forEach((item) => item
|
|
109
|
+
?.querySelector(".resource-list-item__content, .resource-list-file-item")
|
|
110
|
+
?.setAttribute("tabIndex", "-1"));
|
|
113
111
|
}
|
|
114
112
|
setItemAllowDragState() {
|
|
115
113
|
if (this.allowDrag) {
|
package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js
CHANGED
|
@@ -20,15 +20,14 @@ export class SwirlResourceListFileItem {
|
|
|
20
20
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
21
21
|
}
|
|
22
22
|
disconnectedCallback() {
|
|
23
|
-
|
|
24
|
-
(_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
|
|
23
|
+
this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
|
|
25
24
|
}
|
|
26
25
|
forceIconProps(smallIcon) {
|
|
27
26
|
if (!Boolean(this.iconEl)) {
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
29
|
const icon = this.iconEl.children[0];
|
|
31
|
-
icon
|
|
30
|
+
icon?.setAttribute("size", smallIcon ? "20" : "24");
|
|
32
31
|
}
|
|
33
32
|
render() {
|
|
34
33
|
const showError = Boolean(this.errorMessage);
|
|
@@ -62,13 +62,11 @@ export class SwirlResourceListItem {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
disconnectedCallback() {
|
|
65
|
-
|
|
66
|
-
(_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
|
|
65
|
+
this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
|
|
67
66
|
}
|
|
68
67
|
forceIconProps(smallIcon) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", smallIcon ? "20" : "24");
|
|
68
|
+
const icon = this.iconEl?.children[0];
|
|
69
|
+
icon?.setAttribute("size", smallIcon ? "20" : "24");
|
|
72
70
|
}
|
|
73
71
|
updateIconSize(smallIcon) {
|
|
74
72
|
this.iconSize = smallIcon ? 20 : 24;
|
|
@@ -37,17 +37,22 @@ export class SwirlSearch {
|
|
|
37
37
|
componentDidLoad() {
|
|
38
38
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
39
39
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
40
|
+
// see https://stackoverflow.com/a/27314017
|
|
41
|
+
if (this.autoFocus) {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
this.input.focus();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
disconnectedCallback() {
|
|
42
|
-
|
|
43
|
-
(_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
|
|
48
|
+
this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
|
|
44
49
|
}
|
|
45
50
|
forceIconProps(smallIcon) {
|
|
46
51
|
if (!Boolean(this.iconEl)) {
|
|
47
52
|
return;
|
|
48
53
|
}
|
|
49
54
|
const icon = this.iconEl.children[0];
|
|
50
|
-
icon
|
|
55
|
+
icon?.setAttribute("size", smallIcon ? "20" : "24");
|
|
51
56
|
}
|
|
52
57
|
onKeyDown(event) {
|
|
53
58
|
if ((event.code === "KeyK" || event.code === "Slash") &&
|
|
@@ -21,8 +21,7 @@ export class SwirlSelect {
|
|
|
21
21
|
this.updateOptions();
|
|
22
22
|
};
|
|
23
23
|
this.onOpen = (event) => {
|
|
24
|
-
|
|
25
|
-
this.placement = (_a = event.detail.position) === null || _a === void 0 ? void 0 : _a.placement;
|
|
24
|
+
this.placement = event.detail.position?.placement;
|
|
26
25
|
this.open = true;
|
|
27
26
|
};
|
|
28
27
|
this.onClose = () => {
|
|
@@ -62,15 +61,16 @@ export class SwirlSelect {
|
|
|
62
61
|
this.options = querySelectorAllDeep(this.el, "swirl-option-list-item");
|
|
63
62
|
}
|
|
64
63
|
render() {
|
|
65
|
-
var _a, _b, _c;
|
|
66
64
|
const label = Boolean(this.value)
|
|
67
|
-
?
|
|
65
|
+
? this.value
|
|
66
|
+
?.map((value) => this.options.find((option) => option.value === value)?.label)
|
|
67
|
+
.join(", ")
|
|
68
68
|
: "";
|
|
69
69
|
const ariaInvalid = this.invalid === true || this.invalid === false
|
|
70
70
|
? String(this.invalid)
|
|
71
71
|
: undefined;
|
|
72
72
|
const formControl = this.el.closest("swirl-form-control");
|
|
73
|
-
const offset =
|
|
73
|
+
const offset = formControl?.inline || formControl?.labelPosition === "outside"
|
|
74
74
|
? -12
|
|
75
75
|
: -16;
|
|
76
76
|
const className = classnames("select", `select--placement-${this.placement}`, {
|
|
@@ -78,9 +78,11 @@ export class SwirlSelect {
|
|
|
78
78
|
"select--inline": this.inline,
|
|
79
79
|
"select--multi": this.multiSelect,
|
|
80
80
|
});
|
|
81
|
-
return (h(Host, { onKeyDown: this.onKeyDown }, h("div", { class: className }, h("swirl-popover-trigger", { popover: this.popover, setAriaAttributes: false }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, class: "select__input", disabled: this.disabled, readOnly: true, type: "text", value: label })), h("span", { class: "select__multi-select-values" },
|
|
81
|
+
return (h(Host, { onKeyDown: this.onKeyDown }, h("div", { class: className }, h("swirl-popover-trigger", { popover: this.popover, setAriaAttributes: false }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, class: "select__input", disabled: this.disabled, readOnly: true, type: "text", value: label })), h("span", { class: "select__multi-select-values" }, this.value
|
|
82
|
+
?.map((value) => this.options.find((option) => option.value === value))
|
|
83
|
+
?.map((option) => (h("swirl-tag", { "aria-hidden": "true", label: option?.label,
|
|
82
84
|
// eslint-disable-next-line react/jsx-no-bind
|
|
83
|
-
onRemove: () => this.unselectOption(option
|
|
85
|
+
onRemove: () => this.unselectOption(option?.value), removable: !this.disabled && this.allowDeselect })))), h("span", { class: "select__indicator" }, this.open ? (h("swirl-icon-expand-less", null)) : (h("swirl-icon-expand-more", null))), h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, value: this.value }, h("slot", { onSlotchange: this.onSlotChange }))))));
|
|
84
86
|
}
|
|
85
87
|
static get is() { return "swirl-select"; }
|
|
86
88
|
static get encapsulation() { return "scoped"; }
|
|
@@ -51,10 +51,9 @@ export class SwirlShellLayout {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
this.onSidebarClick = () => {
|
|
54
|
-
var _a, _b;
|
|
55
54
|
if (this.collapsedSidebar) {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
document.activeElement?.blur();
|
|
56
|
+
getActiveElement()?.blur();
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
59
|
this.onSidebarMouseEnter = () => {
|
|
@@ -136,9 +136,8 @@ export class SwirlTable {
|
|
|
136
136
|
emptyRow.style.width = scrollWidth;
|
|
137
137
|
}
|
|
138
138
|
layoutRowGroups() {
|
|
139
|
-
var _a;
|
|
140
139
|
const tableRowGroups = Array.from(this.el.querySelectorAll("swirl-table-row-group"));
|
|
141
|
-
const scrollWidth = `${
|
|
140
|
+
const scrollWidth = `${this.el.shadowRoot.querySelector(".table__container")?.scrollWidth}px`;
|
|
142
141
|
tableRowGroups.forEach((tableRowGroup) => {
|
|
143
142
|
const headerRow = tableRowGroup.shadowRoot.querySelector(".table-row-group__header-row");
|
|
144
143
|
if (!Boolean(headerRow)) {
|
|
@@ -11,7 +11,7 @@ export class SwirlTableRow {
|
|
|
11
11
|
}
|
|
12
12
|
componentDidLoad() {
|
|
13
13
|
const table = closestPassShadow(this.el, "swirl-table");
|
|
14
|
-
table
|
|
14
|
+
table?.rerender();
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
const className = classnames("table-row", {
|
|
@@ -43,8 +43,7 @@ export class SwirlTabs {
|
|
|
43
43
|
const nextIndex = Math.min(this.tabs.length - 1, currentIndex + 1);
|
|
44
44
|
this.activateTab(this.tabs[nextIndex].tabId);
|
|
45
45
|
requestAnimationFrame(() => {
|
|
46
|
-
|
|
47
|
-
(_a = this.el.querySelector(".tabs__tab--active")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
46
|
+
this.el.querySelector(".tabs__tab--active")?.focus();
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
activatePreviousTab() {
|
|
@@ -52,8 +51,7 @@ export class SwirlTabs {
|
|
|
52
51
|
const previousIndex = Math.max(0, currentIndex - 1);
|
|
53
52
|
this.activateTab(this.tabs[previousIndex].tabId);
|
|
54
53
|
requestAnimationFrame(() => {
|
|
55
|
-
|
|
56
|
-
(_a = this.el.querySelector(".tabs__tab--active")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
54
|
+
this.el.querySelector(".tabs__tab--active")?.focus();
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
collectTabs() {
|
|
@@ -3,8 +3,7 @@ import classnames from "classnames";
|
|
|
3
3
|
export class SwirlTag {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.onRemove = (event) => {
|
|
6
|
-
|
|
7
|
-
(_a = this.remove) === null || _a === void 0 ? void 0 : _a.emit(event);
|
|
6
|
+
this.remove?.emit(event);
|
|
8
7
|
};
|
|
9
8
|
this.intent = "default";
|
|
10
9
|
this.label = undefined;
|
|
@@ -102,13 +102,18 @@ export class SwirlTextInput {
|
|
|
102
102
|
componentDidLoad() {
|
|
103
103
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
104
104
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
105
|
+
// see https://stackoverflow.com/a/27314017
|
|
106
|
+
if (this.autoFocus) {
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
this.inputEl.focus();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
componentDidRender() {
|
|
107
113
|
this.adjustInputSize();
|
|
108
114
|
}
|
|
109
115
|
disconnectedCallback() {
|
|
110
|
-
|
|
111
|
-
(_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
|
|
116
|
+
this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
|
|
112
117
|
}
|
|
113
118
|
updateIconSize(smallIcon) {
|
|
114
119
|
this.iconSize = smallIcon ? 20 : 24;
|
|
@@ -138,7 +143,6 @@ export class SwirlTextInput {
|
|
|
138
143
|
event.target.select();
|
|
139
144
|
}
|
|
140
145
|
render() {
|
|
141
|
-
var _a;
|
|
142
146
|
const Tag = this.rows === 1 && !this.autoGrow ? "input" : "textarea";
|
|
143
147
|
const ariaInvalid = this.invalid === true || this.invalid === false
|
|
144
148
|
? String(this.invalid)
|
|
@@ -161,7 +165,7 @@ export class SwirlTextInput {
|
|
|
161
165
|
"text-input--inline": this.inline,
|
|
162
166
|
"text-input--show-password": this.type === "password" && this.showPassword,
|
|
163
167
|
});
|
|
164
|
-
return (h(Host, null, h("div", { class: className }, this.prefixLabel && (h("span", { class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { "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, 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", { class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { size: this.iconSize }))), showPasswordToggle && (h("button", { "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", { class: "text-input__stepper" }, h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { size: this.iconSize })), h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { size: this.iconSize })))), this.showCharacterCounter && (h("span", { class: "text-input__character-counter" },
|
|
168
|
+
return (h(Host, null, h("div", { class: className }, this.prefixLabel && (h("span", { class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { "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, 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", { class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { size: this.iconSize }))), showPasswordToggle && (h("button", { "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", { class: "text-input__stepper" }, h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { size: this.iconSize })), h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { size: this.iconSize })))), this.showCharacterCounter && (h("span", { class: "text-input__character-counter" }, this.value?.length || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
|
|
165
169
|
}
|
|
166
170
|
static get is() { return "swirl-text-input"; }
|
|
167
171
|
static get encapsulation() { return "scoped"; }
|
|
@@ -5,7 +5,6 @@ describe("swirl-text-input", () => {
|
|
|
5
5
|
const page = await newSpecPage({
|
|
6
6
|
components: [SwirlTextInput],
|
|
7
7
|
html: `<swirl-text-input
|
|
8
|
-
auto-focus="true"
|
|
9
8
|
disabled="true"
|
|
10
9
|
swirl-aria-describedby="id"
|
|
11
10
|
invalid="true"
|
|
@@ -17,8 +16,7 @@ describe("swirl-text-input", () => {
|
|
|
17
16
|
</swirl-text-input>`,
|
|
18
17
|
});
|
|
19
18
|
expect(page.root).toEqualHtml(`
|
|
20
|
-
<swirl-text-input
|
|
21
|
-
disabled="true"
|
|
19
|
+
<swirl-text-input disabled="true"
|
|
22
20
|
swirl-aria-describedby="id"
|
|
23
21
|
invalid="true"
|
|
24
22
|
mode="decimal"
|
|
@@ -31,7 +29,6 @@ describe("swirl-text-input", () => {
|
|
|
31
29
|
aria-disabled="true"
|
|
32
30
|
aria-invalid="true"
|
|
33
31
|
autocomplete="on"
|
|
34
|
-
autofocus=""
|
|
35
32
|
class="text-input__input"
|
|
36
33
|
disabled=""
|
|
37
34
|
inputmode="decimal"
|