@getflip/swirl-components 0.120.1 → 0.120.2
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 +1 -1
- package/dist/cjs/swirl-app-layout_6.cjs.entry.js +25 -1
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +26 -2
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-resource-list-item2.js +25 -1
- package/dist/esm/swirl-app-layout_6.entry.js +25 -1
- package/dist/swirl-components/{p-488d2a7d.entry.js → p-b2a9f663.entry.js} +1 -1
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +5 -0
- package/package.json +1 -1
package/components.json
CHANGED
|
@@ -479,6 +479,12 @@ const SwirlResourceListItem = class {
|
|
|
479
479
|
this.checked = !this.checked;
|
|
480
480
|
this.valueChange.emit(this.checked);
|
|
481
481
|
};
|
|
482
|
+
this.onBlur = () => {
|
|
483
|
+
this.makeControlUnfocusable();
|
|
484
|
+
};
|
|
485
|
+
this.onFocus = () => {
|
|
486
|
+
this.makeControlFocusable();
|
|
487
|
+
};
|
|
482
488
|
this.onMenuTriggerClick = (event) => {
|
|
483
489
|
if (this.disabled && !Boolean(this.href)) {
|
|
484
490
|
event.stopPropagation();
|
|
@@ -518,6 +524,7 @@ const SwirlResourceListItem = class {
|
|
|
518
524
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
519
525
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
520
526
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
527
|
+
this.makeControlUnfocusable();
|
|
521
528
|
if (Boolean(this.menuTriggerId)) {
|
|
522
529
|
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');
|
|
523
530
|
}
|
|
@@ -539,6 +546,23 @@ const SwirlResourceListItem = class {
|
|
|
539
546
|
this.hasMedia = hasMedia;
|
|
540
547
|
}
|
|
541
548
|
}
|
|
549
|
+
getControl() {
|
|
550
|
+
return this.el.querySelector('[slot="control"] button');
|
|
551
|
+
}
|
|
552
|
+
makeControlFocusable() {
|
|
553
|
+
const control = this.getControl();
|
|
554
|
+
if (!Boolean(control)) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
control.tabIndex = 0;
|
|
558
|
+
}
|
|
559
|
+
makeControlUnfocusable() {
|
|
560
|
+
const control = this.getControl();
|
|
561
|
+
if (!Boolean(control)) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
control.tabIndex = -1;
|
|
565
|
+
}
|
|
542
566
|
render() {
|
|
543
567
|
const Tag = !this.interactive && !this.selectable
|
|
544
568
|
? "div"
|
|
@@ -567,7 +591,7 @@ const SwirlResourceListItem = class {
|
|
|
567
591
|
"resource-list-item--show-control-on-focus": showControlOnFocus,
|
|
568
592
|
"resource-list-item--show-meta": showMeta,
|
|
569
593
|
});
|
|
570
|
-
return (index.h(index.Host, { role: "row" }, index.h("div", { class: className, role: "gridcell" }, index.h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": this.id, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, part: "resource-list-item__content", role: role, tabIndex: 0, type: Tag === "button" ? "button" : undefined }, this.hasMedia && (index.h("span", { class: "resource-list-item__media" }, index.h("slot", { name: "media" }))), index.h("span", { class: "resource-list-item__label-container" }, index.h("span", { class: "resource-list-item__label", id: this.id, innerHTML: this.label }), this.description && (index.h("span", { class: "resource-list-item__description" }, this.description))), showMeta && (index.h("span", { class: "resource-list-item__meta" }, index.h("span", { class: "resource-list-item__meta-text" }, this.meta), index.h("span", { class: "resource-list-item__badges" }, index.h("slot", { name: "badges" }))))), this.selectable && (index.h("span", { "aria-hidden": "true", class: "resource-list-item__checkbox" }, index.h("span", { class: "resource-list-item__checkbox-icon" }, this.checked && (index.h("swirl-icon-check-strong", null))))), index.h("span", { class: "resource-list-item__control" }, index.h("slot", { name: "control" })), showMenu && (index.h("swirl-popover-trigger", { popover: this.menuTriggerId }, index.h("swirl-button", { "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 && (index.h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, index.h("swirl-icon-drag-handle", { size: this.iconSize })))));
|
|
594
|
+
return (index.h(index.Host, { role: "row" }, index.h("div", { class: className, role: "gridcell" }, index.h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": this.id, 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 && (index.h("span", { class: "resource-list-item__media" }, index.h("slot", { name: "media" }))), index.h("span", { class: "resource-list-item__label-container" }, index.h("span", { class: "resource-list-item__label", id: this.id, innerHTML: this.label }), this.description && (index.h("span", { class: "resource-list-item__description" }, this.description))), showMeta && (index.h("span", { class: "resource-list-item__meta" }, index.h("span", { class: "resource-list-item__meta-text" }, this.meta), index.h("span", { class: "resource-list-item__badges" }, index.h("slot", { name: "badges" }))))), this.selectable && (index.h("span", { "aria-hidden": "true", class: "resource-list-item__checkbox" }, index.h("span", { class: "resource-list-item__checkbox-icon" }, this.checked && (index.h("swirl-icon-check-strong", null))))), index.h("span", { class: "resource-list-item__control" }, index.h("slot", { name: "control" })), showMenu && (index.h("swirl-popover-trigger", { popover: this.menuTriggerId }, index.h("swirl-button", { "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 && (index.h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, index.h("swirl-icon-drag-handle", { size: this.iconSize })))));
|
|
571
595
|
}
|
|
572
596
|
get el() { return index.getElement(this); }
|
|
573
597
|
};
|