@proximus/lavender-fieldset 1.4.20-beta.3 → 1.4.21-alpha.10

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.
@@ -23,6 +23,7 @@ export declare class Fieldset extends PxElement<HTMLFieldSetElement> {
23
23
  static get observedAttributes(): string[];
24
24
  connectedCallback(): void;
25
25
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
26
+ protected _forwardPrefixedAccessibilityAttribute(name: string, value: string | null): void;
26
27
  setupErrorState(): void;
27
28
  get $slotLegend(): HTMLSlotElement;
28
29
  get $slotHelper(): HTMLSlotElement;
@@ -45,6 +45,25 @@
45
45
  "static": true,
46
46
  "default": "{ disabled: ['disabled'], name: ['name'], form: [], } satisfies NativeAttributeMap<HTMLFieldSetElement>"
47
47
  },
48
+ {
49
+ "kind": "method",
50
+ "name": "_forwardPrefixedAccessibilityAttribute",
51
+ "privacy": "protected",
52
+ "parameters": [
53
+ {
54
+ "name": "name",
55
+ "type": {
56
+ "text": "string"
57
+ }
58
+ },
59
+ {
60
+ "name": "value",
61
+ "type": {
62
+ "text": "string | null"
63
+ }
64
+ }
65
+ ]
66
+ },
48
67
  {
49
68
  "kind": "method",
50
69
  "name": "setupErrorState"
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PxElement as e, createTemplate as t, log as n, nativeFieldsetMethods as r, nativeFieldsetProperties as i, renderTemplate as a, transferAccessibilityAttributes as o } from "@proximus/lavender-common";
2
- // src/fieldset.css?inline
2
+ //#region src/fieldset.css?inline
3
3
  var s = ":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)}", c = new CSSStyleSheet();
4
4
  c.replaceSync(s);
5
5
  var l = class s extends e {
@@ -36,7 +36,7 @@ var l = class s extends e {
36
36
  ];
37
37
  }
38
38
  connectedCallback() {
39
- this.setupErrorState(), o(this, this.$el, !1);
39
+ this.setupErrorState(), o(this, this.$el, !1), this._syncPrefixedAccessibilityAttributes();
40
40
  }
41
41
  attributeChangedCallback(e, t, n) {
42
42
  if (t !== n) switch (e) {
@@ -56,12 +56,16 @@ var l = class s extends e {
56
56
  default: super.attributeChangedCallback(e, t, n);
57
57
  }
58
58
  }
59
+ _forwardPrefixedAccessibilityAttribute(e, t) {
60
+ e === "aria-describedby" && this.state === "error" && this.$slotError.id && (t = [this.$slotError.id, t].filter(Boolean).join(" ")), super._forwardPrefixedAccessibilityAttribute(e, t);
61
+ }
59
62
  setupErrorState() {
60
63
  let e = this.$slotError?.assignedNodes().length > 0;
61
64
  if (this.state === "error" && !e && n("<px-fieldset> with state=\"error\" requires a slot=\"error-text\" containing the error description."), this.state === "error" && e) {
62
65
  let e = Math.random().toString(36).substr(2, 9);
63
66
  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`);
64
67
  } else this.$el.removeAttribute("id"), this.$el.removeAttribute("aria-describedby"), this.$el.removeAttribute("aria-invalid"), this.$slotError.removeAttribute("id");
68
+ this._syncPrefixedAccessibilityAttributes();
65
69
  }
66
70
  get $slotLegend() {
67
71
  return this.shadowRoot.querySelector("slot[name=\"legend\"]");
@@ -104,4 +108,5 @@ var l = class s extends e {
104
108
  }
105
109
  };
106
110
  customElements.get("px-fieldset") || customElements.define("px-fieldset", l);
111
+ //#endregion
107
112
  export { l as Fieldset };
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@proximus/lavender-fieldset",
4
- "version": "1.4.20-beta.3",
4
+ "version": "1.4.21-alpha.10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "px-fieldset",
11
- "description": "\n---\n",
11
+ "description": "\n\n---\n",
12
12
  "doc-url": "",
13
13
  "attributes": [
14
14
  { "name": "inverted", "value": { "type": "string" } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-fieldset",
3
- "version": "1.4.20-beta.3",
3
+ "version": "1.4.21-alpha.10",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",