@grantcodes/ui 2.11.0 → 2.11.1
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.11.1](https://github.com/grantcodes/ui/compare/ui-v2.11.0...ui-v2.11.1) (2026-05-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **form-field:** reflect label for SSR hydration and replace JS inline detection with CSS :has() ([9bc091b](https://github.com/grantcodes/ui/commit/9bc091bfaf838549479cc32f2ec9408e13eb14e3))
|
|
9
|
+
|
|
3
10
|
## [2.11.0](https://github.com/grantcodes/ui/compare/ui-v2.10.2...ui-v2.11.0) (2026-05-03)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { html } from "lit/static-html.js";
|
|
3
3
|
import formFieldStyles from "./form-field.css" with { type: "css" };
|
|
4
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
5
4
|
import { generateId } from "../../lib/generate-id.js";
|
|
6
5
|
|
|
7
6
|
export class GrantCodesFormField extends LitElement {
|
|
@@ -9,7 +8,7 @@ export class GrantCodesFormField extends LitElement {
|
|
|
9
8
|
static styles = [formFieldStyles];
|
|
10
9
|
|
|
11
10
|
static properties = {
|
|
12
|
-
label: { type: String },
|
|
11
|
+
label: { type: String, reflect: true },
|
|
13
12
|
error: { type: String },
|
|
14
13
|
help: { type: String },
|
|
15
14
|
};
|
|
@@ -21,7 +20,6 @@ export class GrantCodesFormField extends LitElement {
|
|
|
21
20
|
this.error = undefined;
|
|
22
21
|
this.help = undefined;
|
|
23
22
|
|
|
24
|
-
this.inlineInput = false;
|
|
25
23
|
this.groupInput = false;
|
|
26
24
|
|
|
27
25
|
/** @type {NodeListOf<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>} */
|
|
@@ -77,10 +75,6 @@ export class GrantCodesFormField extends LitElement {
|
|
|
77
75
|
input.id = this.id;
|
|
78
76
|
input.setAttribute("aria-describedby", this.ariaDescribedBy);
|
|
79
77
|
|
|
80
|
-
if (input.type === "checkbox" || input.type === "radio") {
|
|
81
|
-
this.inlineInput = true;
|
|
82
|
-
this.requestUpdate();
|
|
83
|
-
}
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
handleLabelClick() {
|
|
@@ -130,14 +124,9 @@ export class GrantCodesFormField extends LitElement {
|
|
|
130
124
|
}
|
|
131
125
|
|
|
132
126
|
render() {
|
|
133
|
-
const classes = classMap({
|
|
134
|
-
"form-field": true,
|
|
135
|
-
"form-field--inline": this.inlineInput,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
127
|
if (this.groupInput) {
|
|
139
128
|
return html`
|
|
140
|
-
<fieldset class
|
|
129
|
+
<fieldset class="form-field">
|
|
141
130
|
<legend class="form-field__label">${this.label}</legend>
|
|
142
131
|
<slot></slot>
|
|
143
132
|
${this.errorTemplate()}
|
|
@@ -146,7 +135,7 @@ export class GrantCodesFormField extends LitElement {
|
|
|
146
135
|
}
|
|
147
136
|
|
|
148
137
|
return html`
|
|
149
|
-
<div class
|
|
138
|
+
<div class="form-field">
|
|
150
139
|
<label>
|
|
151
140
|
<span class="form-field__label" @click=${this.handleLabelClick}
|
|
152
141
|
>${this.label}</span
|
|
@@ -30,6 +30,18 @@ describe("Form Field Component", () => {
|
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
it("should reflect label text for SSR client upgrade", async () => {
|
|
34
|
+
element = await fixture("grantcodes-form-field", {
|
|
35
|
+
label: "Username",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
assert.strictEqual(
|
|
39
|
+
element.getAttribute("label"),
|
|
40
|
+
"Username",
|
|
41
|
+
"Label should be serialized to an attribute for client upgrade",
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
33
45
|
it("should display error message when error is set", async () => {
|
|
34
46
|
element = await fixture("grantcodes-form-field", {
|
|
35
47
|
label: "Email",
|