@proximus/lavender-fieldset 2.0.0-alpha.19 → 2.0.0-alpha.191
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/dist/Fieldset.d.ts +9 -8
- package/dist/index.es.js +91 -105
- package/package.json +2 -2
package/dist/Fieldset.d.ts
CHANGED
|
@@ -8,15 +8,16 @@ export declare class Fieldset extends PxElement<HTMLFieldSetElement> {
|
|
|
8
8
|
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
9
9
|
setupErrorState(): void;
|
|
10
10
|
get $slotLegend(): HTMLSlotElement;
|
|
11
|
+
get $slotHelper(): HTMLSlotElement;
|
|
11
12
|
get $slotError(): HTMLSlotElement;
|
|
12
13
|
get inverted(): boolean;
|
|
13
14
|
set inverted(value: boolean);
|
|
14
|
-
get role(): string;
|
|
15
|
-
set role(value: string);
|
|
16
|
-
get ariaRequired(): string;
|
|
17
|
-
set ariaRequired(value: string);
|
|
18
|
-
get ariaDisabled(): string;
|
|
19
|
-
set ariaDisabled(value: string);
|
|
20
|
-
get state(): string;
|
|
21
|
-
set state(value: string);
|
|
15
|
+
get role(): string | null;
|
|
16
|
+
set role(value: string | null);
|
|
17
|
+
get ariaRequired(): string | null;
|
|
18
|
+
set ariaRequired(value: string | null);
|
|
19
|
+
get ariaDisabled(): string | null;
|
|
20
|
+
set ariaDisabled(value: string | null);
|
|
21
|
+
get state(): string | null;
|
|
22
|
+
set state(value: string | null);
|
|
22
23
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,106 +1,92 @@
|
|
|
1
|
-
import { PxElement as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</fieldset
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return this.getAttribute("aria-disabled");
|
|
90
|
-
}
|
|
91
|
-
set ariaDisabled(t) {
|
|
92
|
-
t ? this.setAttribute("aria-disabled", t) : this.removeAttribute("aria-disabled");
|
|
93
|
-
}
|
|
94
|
-
get state() {
|
|
95
|
-
return this.getAttribute("state");
|
|
96
|
-
}
|
|
97
|
-
set state(t) {
|
|
98
|
-
t ? this.setAttribute("state", t) : this.removeAttribute("state");
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
i.nativeName = "fieldset";
|
|
102
|
-
let s = i;
|
|
103
|
-
customElements.get("px-fieldset") || customElements.define("px-fieldset", s);
|
|
104
|
-
export {
|
|
105
|
-
s as Fieldset
|
|
1
|
+
import { PxElement as e, log as t, transferAccessibilityAttributes as n } from "@proximus/lavender-common";
|
|
2
|
+
//#region src/fieldset.css?inline
|
|
3
|
+
var r = ":host{display:block}:host *{box-sizing:border-box}fieldset{font-family:var(--px-font-family);border:0;flex-direction:column;margin:0;padding:0;display:flex}fieldset legend{padding:0}fieldset ::slotted([slot=legend]:not([shown--sr])){margin-bottom:var(--px-spacing-2xs-mobile);display:block}fieldset ::slotted([slot=error-text]),fieldset ::slotted([slot=state-text]){display:none}slot[name=helper]{color:#0000008f;font-size:var(--px-text-size-label-s-mobile)}slot[name=error-text]{font-size:var(--px-text-size-body-m-mobile);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-purpose-error-default)}:host([state=error]) ::slotted([slot=error-text]),:host([state=error]) ::slotted([slot=state-text]){display:block}@media screen and (width>=48rem){fieldset ::slotted([slot=legend]:not([shown--sr])){margin-bottom:var(--px-spacing-2xs-tablet)}slot[name=helper]{font-size:var(--px-text-size-label-s-tablet)}slot[name=error-text]{font-size:var(--px-text-size-body-m-tablet)}}@media screen and (width>=64.0625rem){fieldset ::slotted([slot=legend]:not([shown--sr])){margin-bottom:var(--px-spacing-2xs-laptop)}slot[name=helper]{font-size:var(--px-text-size-label-s-laptop)}slot[name=error-text]{font-size:var(--px-text-size-body-m-laptop)}}@media screen and (width>=90.0625rem){fieldset ::slotted([slot=legend]:not([shown--sr])){margin-bottom:var(--px-spacing-2xs-desktop)}slot[name=helper]{font-size:var(--px-text-size-label-s-desktop)}slot[name=error-text]{font-size:var(--px-text-size-body-m-desktop)}}:host([inverted]) fieldset [name=error-text]{color:var(--px-color-text-purpose-error-inverted)}", i = new CSSStyleSheet();
|
|
4
|
+
i.replaceSync(r);
|
|
5
|
+
var a = class extends e {
|
|
6
|
+
static {
|
|
7
|
+
this.nativeName = "fieldset";
|
|
8
|
+
}
|
|
9
|
+
constructor() {
|
|
10
|
+
super(i), this.template = () => "<fieldset>\n <legend><slot name=\"legend\"></slot></legend>\n <px-vstack gap=\"2xs\">\n <slot name=\"helper\"></slot>\n <slot name=\"error-text\"></slot>\n <slot></slot>\n </px-vstack>\n </fieldset>", this.shadowRoot.innerHTML = this.template();
|
|
11
|
+
}
|
|
12
|
+
static get observedAttributes() {
|
|
13
|
+
return [
|
|
14
|
+
...super.observedAttributes,
|
|
15
|
+
"inverted",
|
|
16
|
+
"role",
|
|
17
|
+
"aria-required",
|
|
18
|
+
"aria-disabled",
|
|
19
|
+
"state"
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
this.setupErrorState(), n(this, this.$el, !1);
|
|
24
|
+
}
|
|
25
|
+
attributeChangedCallback(e, t, n) {
|
|
26
|
+
if (t !== n) switch (e) {
|
|
27
|
+
case "disabled":
|
|
28
|
+
this.querySelectorAll("px-radio-group, px-radio, px-checkbox, px-fileupload, px-input, px-textarea, px-select, px-switch").forEach((t) => {
|
|
29
|
+
t.setAttribute(e, "true");
|
|
30
|
+
});
|
|
31
|
+
break;
|
|
32
|
+
case "role":
|
|
33
|
+
case "aria-required":
|
|
34
|
+
case "aria-disabled":
|
|
35
|
+
n !== null && (this.$el.setAttribute(e, n), this.removeAttribute(e));
|
|
36
|
+
break;
|
|
37
|
+
case "state":
|
|
38
|
+
this.setupErrorState();
|
|
39
|
+
break;
|
|
40
|
+
default: super.attributeChangedCallback(e, t, n);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
setupErrorState() {
|
|
44
|
+
let e = this.$slotError?.assignedNodes().length > 0;
|
|
45
|
+
if (this.state === "error" && !e && t("<px-fieldset> with state=\"error\" requires a slot=\"error-text\" containing the error description."), this.state === "error" && e) {
|
|
46
|
+
let e = Math.random().toString(36).substr(2, 9);
|
|
47
|
+
this.$el.setAttribute("id", e), this.$el.setAttribute("aria-describedby", `${e}-error-text`), this.$el.getAttribute("role") && this.$el.setAttribute("aria-invalid", "true"), this.$slotError.setAttribute("id", `${e}-error-text`);
|
|
48
|
+
} else this.$el.removeAttribute("id"), this.$el.removeAttribute("aria-describedby"), this.$el.removeAttribute("aria-invalid"), this.$slotError.removeAttribute("id");
|
|
49
|
+
}
|
|
50
|
+
get $slotLegend() {
|
|
51
|
+
return this.shadowRoot.querySelector("slot[name=\"legend\"]");
|
|
52
|
+
}
|
|
53
|
+
get $slotHelper() {
|
|
54
|
+
return this.shadowRoot.querySelector("slot[name=\"helper\"]");
|
|
55
|
+
}
|
|
56
|
+
get $slotError() {
|
|
57
|
+
return this.shadowRoot.querySelector("slot[name=\"error-text\"]");
|
|
58
|
+
}
|
|
59
|
+
get inverted() {
|
|
60
|
+
return this.hasAttribute("inverted");
|
|
61
|
+
}
|
|
62
|
+
set inverted(e) {
|
|
63
|
+
this._updateBooleanAttribute("inverted", e);
|
|
64
|
+
}
|
|
65
|
+
get role() {
|
|
66
|
+
return this.getAttribute("role");
|
|
67
|
+
}
|
|
68
|
+
set role(e) {
|
|
69
|
+
this._updateAttribute("role", e);
|
|
70
|
+
}
|
|
71
|
+
get ariaRequired() {
|
|
72
|
+
return this.getAttribute("aria-required");
|
|
73
|
+
}
|
|
74
|
+
set ariaRequired(e) {
|
|
75
|
+
this._updateAttribute("aria-required", e);
|
|
76
|
+
}
|
|
77
|
+
get ariaDisabled() {
|
|
78
|
+
return this.getAttribute("aria-disabled");
|
|
79
|
+
}
|
|
80
|
+
set ariaDisabled(e) {
|
|
81
|
+
this._updateAttribute("aria-disabled", e);
|
|
82
|
+
}
|
|
83
|
+
get state() {
|
|
84
|
+
return this.getAttribute("state");
|
|
85
|
+
}
|
|
86
|
+
set state(e) {
|
|
87
|
+
this._updateAttribute("state", e);
|
|
88
|
+
}
|
|
106
89
|
};
|
|
90
|
+
customElements.get("px-fieldset") || customElements.define("px-fieldset", a);
|
|
91
|
+
//#endregion
|
|
92
|
+
export { a as Fieldset };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-fieldset",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.191",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
14
|
"build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
|
|
15
15
|
"test": "vitest run --coverage",
|
|
16
|
-
"wc-manifest": "cem analyze --globs \"src/*\" --config
|
|
16
|
+
"wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|