@proximus/lavender-fieldset 2.0.0-alpha.3 → 2.0.0-alpha.30
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/index.es.js +27 -30
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PxElement as a, transferAccessibilityAttributes as d } from "@proximus/lavender-common";
|
|
2
|
-
const
|
|
3
|
-
o.replaceSync(
|
|
1
|
+
import { PxElement as a, transferAccessibilityAttributes as d, log as n } from "@proximus/lavender-common";
|
|
2
|
+
const b = ':host{display:block}:host *{box-sizing:border-box}fieldset{display:flex;flex-direction:column;margin:0;padding:0;border:0;font-family:var(--px-font-family)}fieldset legend{padding:0}fieldset ::slotted([slot="legend"]:not([shown--sr])){display:block;margin-bottom:var(--px-spacing-xs-mobile)}fieldset ::slotted([slot="error-text"]){display:none;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);margin-bottom:var(--px-spacing-xs-mobile)}:host([state="error"]) ::slotted([slot="error-text"]){display:block}@media only screen and (min-width: 48em){fieldset ::slotted([slot="legend"]:not([shown--sr])){margin-bottom:var(--px-spacing-xs-tablet)}fieldset ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-tablet)}}@media only screen and (min-width: 64.0625em){fieldset ::slotted([slot="legend"]:not([shown--sr])){margin-bottom:var(--px-spacing-xs-laptop)}fieldset ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-laptop)}}@media only screen and (min-width: 90.0625em){fieldset ::slotted([slot="legend"]:not([shown--sr])){margin-bottom:var(--px-spacing-xs-desktop)}fieldset ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-desktop)}}:host([inverted]) fieldset ::slotted([slot="error-text"]){color:var(--px-color-text-purpose-error-inverted)}', o = new CSSStyleSheet();
|
|
3
|
+
o.replaceSync(b);
|
|
4
4
|
const i = class i extends a {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(o), this.template = () => `<fieldset >
|
|
@@ -20,43 +20,40 @@ const i = class i extends a {
|
|
|
20
20
|
];
|
|
21
21
|
}
|
|
22
22
|
connectedCallback() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
attributeChangedCallback(e, t, r) {
|
|
29
|
-
if (t !== r)
|
|
30
|
-
switch (e) {
|
|
23
|
+
this.setupErrorState(), d(this, this.$el, !1);
|
|
24
|
+
}
|
|
25
|
+
attributeChangedCallback(t, r, e) {
|
|
26
|
+
if (r !== e)
|
|
27
|
+
switch (t) {
|
|
31
28
|
case "disabled": {
|
|
32
29
|
this.querySelectorAll(
|
|
33
30
|
"px-radio-group, px-radio, px-checkbox, px-fileupload, px-input, px-textarea, px-select, px-switch"
|
|
34
31
|
).forEach((l) => {
|
|
35
|
-
l.setAttribute(
|
|
32
|
+
l.setAttribute(t, "true");
|
|
36
33
|
});
|
|
37
34
|
break;
|
|
38
35
|
}
|
|
39
36
|
case "role":
|
|
40
37
|
case "aria-required":
|
|
41
38
|
case "aria-disabled":
|
|
42
|
-
|
|
39
|
+
e !== null && (this.$el.setAttribute(t, this.getAttribute(t)), this.removeAttribute(t));
|
|
43
40
|
break;
|
|
44
41
|
case "state":
|
|
45
42
|
this.setupErrorState();
|
|
46
43
|
break;
|
|
47
44
|
default:
|
|
48
|
-
super.attributeChangedCallback(
|
|
45
|
+
super.attributeChangedCallback(t, r, e);
|
|
49
46
|
break;
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
setupErrorState() {
|
|
53
|
-
var
|
|
54
|
-
const
|
|
55
|
-
if (this.state === "error" && !
|
|
50
|
+
var r;
|
|
51
|
+
const t = ((r = this.$slotError) == null ? void 0 : r.assignedNodes().length) > 0;
|
|
52
|
+
if (this.state === "error" && !t && n(
|
|
56
53
|
'<px-fieldset> with state="error" requires a slot="error-text" containing the error description.'
|
|
57
|
-
), this.state === "error" &&
|
|
58
|
-
const
|
|
59
|
-
this.$el.setAttribute("id",
|
|
54
|
+
), this.state === "error" && t) {
|
|
55
|
+
const e = Math.random().toString(36).substr(2, 9);
|
|
56
|
+
this.$el.setAttribute("id", e), this.$el.setAttribute("aria-describedby", `${e}-error-text`), this.$el.setAttribute("aria-invalid", "true"), this.$slotError.setAttribute("id", `${e}-error-text`);
|
|
60
57
|
} else
|
|
61
58
|
this.$el.removeAttribute("id"), this.$el.removeAttribute("aria-describedby"), this.$el.removeAttribute("aria-invalid"), this.$slotError.removeAttribute("id");
|
|
62
59
|
}
|
|
@@ -73,32 +70,32 @@ const i = class i extends a {
|
|
|
73
70
|
get inverted() {
|
|
74
71
|
return this.hasAttribute("inverted");
|
|
75
72
|
}
|
|
76
|
-
set inverted(
|
|
77
|
-
|
|
73
|
+
set inverted(t) {
|
|
74
|
+
t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
|
|
78
75
|
}
|
|
79
76
|
get role() {
|
|
80
77
|
return this.getAttribute("role");
|
|
81
78
|
}
|
|
82
|
-
set role(
|
|
83
|
-
|
|
79
|
+
set role(t) {
|
|
80
|
+
t ? this.setAttribute("role", t) : this.removeAttribute("role");
|
|
84
81
|
}
|
|
85
82
|
get ariaRequired() {
|
|
86
83
|
return this.getAttribute("aria-required");
|
|
87
84
|
}
|
|
88
|
-
set ariaRequired(
|
|
89
|
-
|
|
85
|
+
set ariaRequired(t) {
|
|
86
|
+
t ? this.setAttribute("aria-required", t) : this.removeAttribute("aria-required");
|
|
90
87
|
}
|
|
91
88
|
get ariaDisabled() {
|
|
92
89
|
return this.getAttribute("aria-disabled");
|
|
93
90
|
}
|
|
94
|
-
set ariaDisabled(
|
|
95
|
-
|
|
91
|
+
set ariaDisabled(t) {
|
|
92
|
+
t ? this.setAttribute("aria-disabled", t) : this.removeAttribute("aria-disabled");
|
|
96
93
|
}
|
|
97
94
|
get state() {
|
|
98
95
|
return this.getAttribute("state");
|
|
99
96
|
}
|
|
100
|
-
set state(
|
|
101
|
-
|
|
97
|
+
set state(t) {
|
|
98
|
+
t ? this.setAttribute("state", t) : this.removeAttribute("state");
|
|
102
99
|
}
|
|
103
100
|
};
|
|
104
101
|
i.nativeName = "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.30",
|
|
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"
|