@getflip/swirl-components 0.179.0 → 0.180.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 +33 -3
- package/dist/cjs/index-1de6abbd.js +12 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-form-control.cjs.entry.js +3 -2
- package/dist/cjs/{swirl-icon-info_2.cjs.entry.js → swirl-icon-info.cjs.entry.js} +0 -120
- package/dist/cjs/swirl-modal.cjs.entry.js +1 -1
- package/dist/cjs/swirl-tooltip.cjs.entry.js +127 -0
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-form-control/swirl-form-control.css +24 -0
- package/dist/collection/components/swirl-form-control/swirl-form-control.js +19 -1
- package/dist/collection/components/swirl-form-control/swirl-form-control.spec.js +14 -2
- package/dist/collection/components/swirl-modal/swirl-modal.css +1 -1
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +1 -1
- package/dist/collection/components/swirl-tooltip/swirl-tooltip.css +4 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-form-control.js +20 -6
- package/dist/components/swirl-icon-help.js +1 -40
- package/dist/components/swirl-icon-help2.js +42 -0
- package/dist/components/swirl-modal.js +1 -1
- package/dist/components/swirl-tooltip2.js +1 -1
- package/dist/esm/index-59244838.js +12 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-form-control.entry.js +3 -2
- package/dist/esm/{swirl-icon-info_2.entry.js → swirl-icon-info.entry.js} +2 -121
- package/dist/esm/swirl-modal.entry.js +1 -1
- package/dist/esm/swirl-tooltip.entry.js +123 -0
- package/dist/swirl-components/p-88364fd1.entry.js +1 -0
- package/dist/swirl-components/p-957009c4.entry.js +1 -0
- package/dist/swirl-components/{p-60a8ff07.entry.js → p-9e705cb8.entry.js} +1 -1
- package/dist/swirl-components/p-f408c0bd.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-form-control/swirl-form-control.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +1 -1
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-7cccf85c.entry.js +0 -1
- package/dist/swirl-components/p-f05b06f8.entry.js +0 -1
|
@@ -135,6 +135,30 @@
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
139
|
+
|
|
140
|
+
.form-control--label-position-outside .form-control__label-text {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.form-control--label-position-outside .form-control__label-text .form-control__tooltip {
|
|
147
|
+
display: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
151
|
+
|
|
152
|
+
.form-control--label-position-outside .form-control__label-text .form-control__tooltip {
|
|
153
|
+
display: flex;
|
|
154
|
+
margin-left: var(--s-space-4)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.form-control--label-position-outside .form-control__label-text .form-control__tooltip:hover {
|
|
158
|
+
cursor: default;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
138
162
|
.form-control--invalid.form-control--has-focus:not(.form-control--disabled) .form-control__label {
|
|
139
163
|
border-color: var(--s-border-critical);
|
|
140
164
|
box-shadow: 0 0 0 var(--s-border-width-default) var(--s-border-critical);
|
|
@@ -43,6 +43,7 @@ export class SwirlFormControl {
|
|
|
43
43
|
this.invalid = undefined;
|
|
44
44
|
this.label = undefined;
|
|
45
45
|
this.labelPosition = "inside";
|
|
46
|
+
this.tooltip = undefined;
|
|
46
47
|
this.hasFocus = undefined;
|
|
47
48
|
this.inputValue = undefined;
|
|
48
49
|
}
|
|
@@ -152,7 +153,7 @@ export class SwirlFormControl {
|
|
|
152
153
|
"form-control--is-select": isSelect,
|
|
153
154
|
});
|
|
154
155
|
const LabelTag = hasContenteditableControl ? "div" : "label";
|
|
155
|
-
return (h(Host, { onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { class: className, role: "group" }, h("span", { class: "form-control__controls" }, h("span", { class: "form-control__prefix" }, h("slot", { name: "prefix" })), h(LabelTag, { class: "form-control__label", onClick: this.onLabelClick }, h("span", { class: "form-control__label-text", id: this.labelId }, this.label), h("span", { class: "form-control__input" }, h("slot", null)))), showDescription && (h("span", { class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { message: this.errorMessage, size: "s" }))))));
|
|
156
|
+
return (h(Host, { onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { class: className, role: "group" }, h("span", { class: "form-control__controls" }, h("span", { class: "form-control__prefix" }, h("slot", { name: "prefix" })), h(LabelTag, { class: "form-control__label", onClick: this.onLabelClick }, h("span", { class: "form-control__label-text", id: this.labelId }, this.label, this.tooltip && this.labelPosition === "outside" && (h("span", { class: "form-control__tooltip" }, h("swirl-tooltip", { content: this.tooltip, positioning: "fixed", position: "top" }, h("swirl-icon-help", { size: 16, tabindex: "0" }))))), h("span", { class: "form-control__input" }, h("slot", null)))), showDescription && (h("span", { class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { message: this.errorMessage, size: "s" }))))));
|
|
156
157
|
}
|
|
157
158
|
static get is() { return "swirl-form-control"; }
|
|
158
159
|
static get encapsulation() { return "scoped"; }
|
|
@@ -309,6 +310,23 @@ export class SwirlFormControl {
|
|
|
309
310
|
"attribute": "label-position",
|
|
310
311
|
"reflect": false,
|
|
311
312
|
"defaultValue": "\"inside\""
|
|
313
|
+
},
|
|
314
|
+
"tooltip": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"mutable": false,
|
|
317
|
+
"complexType": {
|
|
318
|
+
"original": "string",
|
|
319
|
+
"resolved": "string",
|
|
320
|
+
"references": {}
|
|
321
|
+
},
|
|
322
|
+
"required": false,
|
|
323
|
+
"optional": true,
|
|
324
|
+
"docs": {
|
|
325
|
+
"tags": [],
|
|
326
|
+
"text": ""
|
|
327
|
+
},
|
|
328
|
+
"attribute": "tooltip",
|
|
329
|
+
"reflect": false
|
|
312
330
|
}
|
|
313
331
|
};
|
|
314
332
|
}
|
|
@@ -94,7 +94,7 @@ describe("swirl-form-control", () => {
|
|
|
94
94
|
page.root.dispatchEvent(new KeyboardEvent("keydown", { key: "Tab" }));
|
|
95
95
|
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
96
96
|
await page.waitForChanges();
|
|
97
|
-
expect(formControl.classList.contains(
|
|
97
|
+
expect(formControl.classList.contains("form-control--has-focus")).toBeTruthy();
|
|
98
98
|
});
|
|
99
99
|
it("doesn't keep focus when Tab is pressed and the active element is not descendent of the input", async () => {
|
|
100
100
|
const page = await newSpecPage({
|
|
@@ -113,6 +113,18 @@ describe("swirl-form-control", () => {
|
|
|
113
113
|
page.root.dispatchEvent(new KeyboardEvent("keydown", { key: "Tab" }));
|
|
114
114
|
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
115
115
|
await page.waitForChanges();
|
|
116
|
-
expect(formControl.classList.contains(
|
|
116
|
+
expect(formControl.classList.contains("form-control--has-focus")).toBeFalsy();
|
|
117
|
+
});
|
|
118
|
+
it("renders a tooltip icon when tooltip is set an label position is outside", async () => {
|
|
119
|
+
const page = await newSpecPage({
|
|
120
|
+
components: [SwirlFormControl],
|
|
121
|
+
html: `
|
|
122
|
+
<swirl-form-control label="Label" label-position="outside" tooltip="This is a tooltip">
|
|
123
|
+
<swirl-text-input></swirl-text-input>
|
|
124
|
+
</swirl-form-control>
|
|
125
|
+
`,
|
|
126
|
+
});
|
|
127
|
+
const tooltip = page.root.querySelector("swirl-tooltip");
|
|
128
|
+
expect(tooltip).not.toBeNull();
|
|
117
129
|
});
|
|
118
130
|
});
|