@getflip/swirl-components 0.152.1 → 0.153.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 +25 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-popover_2.cjs.entry.js +3 -0
- package/dist/cjs/swirl-text-input.cjs.entry.js +6 -0
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-popover-trigger/swirl-popover-trigger.js +3 -0
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +43 -1
- package/dist/collection/components/swirl-text-input/swirl-text-input.spec.js +22 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-popover-trigger2.js +3 -0
- package/dist/components/swirl-text-input2.js +9 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-popover_2.entry.js +3 -0
- package/dist/esm/swirl-text-input.entry.js +6 -0
- package/dist/swirl-components/{p-dc42011e.entry.js → p-944662a7.entry.js} +1 -1
- package/dist/swirl-components/p-b953063e.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-text-input/swirl-text-input.d.ts +2 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-d249be2e.entry.js +0 -1
|
@@ -27,6 +27,9 @@ export class SwirlPopoverTrigger {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const triggerEl = this.getTriggerEl();
|
|
30
|
+
if (!Boolean(triggerEl)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
30
33
|
const popoverId = typeof this.popover === "string" ? this.popover : this.popover?.id;
|
|
31
34
|
if (triggerEl.tagName.startsWith("SWIRL-")) {
|
|
32
35
|
triggerEl.setAttribute("swirl-aria-controls", popoverId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Host
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { getDesktopMediaQuery } from "../../utils";
|
|
4
4
|
export class SwirlTextInput {
|
|
@@ -114,6 +114,12 @@ export class SwirlTextInput {
|
|
|
114
114
|
disconnectedCallback() {
|
|
115
115
|
this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
|
|
116
116
|
}
|
|
117
|
+
async blurInput() {
|
|
118
|
+
this.inputEl.blur();
|
|
119
|
+
}
|
|
120
|
+
async focusInput() {
|
|
121
|
+
this.inputEl.focus();
|
|
122
|
+
}
|
|
117
123
|
watchValue(newValue, oldValue) {
|
|
118
124
|
if (newValue !== oldValue) {
|
|
119
125
|
this.valueChange.emit(newValue);
|
|
@@ -775,6 +781,42 @@ export class SwirlTextInput {
|
|
|
775
781
|
}
|
|
776
782
|
}];
|
|
777
783
|
}
|
|
784
|
+
static get methods() {
|
|
785
|
+
return {
|
|
786
|
+
"blurInput": {
|
|
787
|
+
"complexType": {
|
|
788
|
+
"signature": "() => Promise<void>",
|
|
789
|
+
"parameters": [],
|
|
790
|
+
"references": {
|
|
791
|
+
"Promise": {
|
|
792
|
+
"location": "global"
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
"return": "Promise<void>"
|
|
796
|
+
},
|
|
797
|
+
"docs": {
|
|
798
|
+
"text": "",
|
|
799
|
+
"tags": []
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
"focusInput": {
|
|
803
|
+
"complexType": {
|
|
804
|
+
"signature": "() => Promise<void>",
|
|
805
|
+
"parameters": [],
|
|
806
|
+
"references": {
|
|
807
|
+
"Promise": {
|
|
808
|
+
"location": "global"
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
"return": "Promise<void>"
|
|
812
|
+
},
|
|
813
|
+
"docs": {
|
|
814
|
+
"text": "",
|
|
815
|
+
"tags": []
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
}
|
|
778
820
|
static get watchers() {
|
|
779
821
|
return [{
|
|
780
822
|
"propName": "value",
|
|
@@ -86,4 +86,26 @@ describe("swirl-text-input", () => {
|
|
|
86
86
|
expect(spy).toHaveBeenCalled();
|
|
87
87
|
expect(spy.mock.calls[0][0].detail).toBe("New Value");
|
|
88
88
|
});
|
|
89
|
+
it("can focus", async () => {
|
|
90
|
+
const page = await newSpecPage({
|
|
91
|
+
components: [SwirlTextInput],
|
|
92
|
+
html: `<swirl-text-input value="Value"></swirl-text-input>`,
|
|
93
|
+
});
|
|
94
|
+
const spy = jest.fn();
|
|
95
|
+
const input = page.root.querySelector(".text-input__input");
|
|
96
|
+
input.addEventListener("focus", spy);
|
|
97
|
+
page.rootInstance.focusInput();
|
|
98
|
+
expect(spy).toHaveBeenCalled();
|
|
99
|
+
});
|
|
100
|
+
it("can blur", async () => {
|
|
101
|
+
const page = await newSpecPage({
|
|
102
|
+
components: [SwirlTextInput],
|
|
103
|
+
html: `<swirl-text-input value="Value"></swirl-text-input>`,
|
|
104
|
+
});
|
|
105
|
+
const spy = jest.fn();
|
|
106
|
+
const input = page.root.querySelector(".text-input__input");
|
|
107
|
+
input.addEventListener("blur", spy);
|
|
108
|
+
page.rootInstance.blurInput();
|
|
109
|
+
expect(spy).toHaveBeenCalled();
|
|
110
|
+
});
|
|
89
111
|
});
|