@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.
Files changed (2) hide show
  1. package/dist/index.es.js +27 -30
  2. 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 n = ':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(n);
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
- var t;
24
- ((t = this.$slotLegend) == null ? void 0 : t.assignedNodes().length) > 0 || console.error(
25
- '<px-fieldset> requires a slot="legend" containing the description of the fieldset.'
26
- ), this.setupErrorState(), d(this, this.$el, !1);
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(e, "true");
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
- r !== null && (this.$el.setAttribute(e, this.getAttribute(e)), this.removeAttribute(e));
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(e, t, r);
45
+ super.attributeChangedCallback(t, r, e);
49
46
  break;
50
47
  }
51
48
  }
52
49
  setupErrorState() {
53
- var t;
54
- const e = ((t = this.$slotError) == null ? void 0 : t.assignedNodes().length) > 0;
55
- if (this.state === "error" && !e && console.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" && e) {
58
- const r = Math.random().toString(36).substr(2, 9);
59
- this.$el.setAttribute("id", r), this.$el.setAttribute("aria-describedby", `${r}-error-text`), this.$el.setAttribute("aria-invalid", "true"), this.$slotError.setAttribute("id", `${r}-error-text`);
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(e) {
77
- e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
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(e) {
83
- e ? this.setAttribute("role", e) : this.removeAttribute("role");
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(e) {
89
- e ? this.setAttribute("aria-required", e) : this.removeAttribute("aria-required");
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(e) {
95
- e ? this.setAttribute("aria-disabled", e) : this.removeAttribute("aria-disabled");
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(e) {
101
- e ? this.setAttribute("state", e) : this.removeAttribute("state");
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",
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 ../custom-elements-manifest.config.js --outdir dist"
16
+ "wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"