@proximus/lavender-fieldset 2.0.0-alpha.22 → 2.0.0-alpha.221

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.
@@ -1,22 +1,23 @@
1
1
  import { PxElement } from '@proximus/lavender-common';
2
2
  export declare class Fieldset extends PxElement<HTMLFieldSetElement> {
3
+ protected static readonly template: HTMLTemplateElement;
3
4
  static nativeName: string;
4
- private template;
5
5
  constructor();
6
6
  static get observedAttributes(): string[];
7
7
  connectedCallback(): void;
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
  }
@@ -0,0 +1,136 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/Fieldset.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "class",
11
+ "description": "",
12
+ "name": "Fieldset",
13
+ "members": [
14
+ {
15
+ "kind": "field",
16
+ "name": "template",
17
+ "privacy": "protected",
18
+ "static": true,
19
+ "readonly": true
20
+ },
21
+ {
22
+ "kind": "field",
23
+ "name": "nativeName",
24
+ "type": {
25
+ "text": "string"
26
+ },
27
+ "static": true,
28
+ "default": "'fieldset'"
29
+ },
30
+ {
31
+ "kind": "method",
32
+ "name": "setupErrorState"
33
+ },
34
+ {
35
+ "kind": "field",
36
+ "name": "$slotLegend",
37
+ "readonly": true
38
+ },
39
+ {
40
+ "kind": "field",
41
+ "name": "$slotHelper",
42
+ "readonly": true
43
+ },
44
+ {
45
+ "kind": "field",
46
+ "name": "$slotError",
47
+ "readonly": true
48
+ },
49
+ {
50
+ "kind": "field",
51
+ "name": "inverted"
52
+ },
53
+ {
54
+ "kind": "field",
55
+ "name": "role"
56
+ },
57
+ {
58
+ "kind": "field",
59
+ "name": "ariaRequired"
60
+ },
61
+ {
62
+ "kind": "field",
63
+ "name": "ariaDisabled"
64
+ },
65
+ {
66
+ "kind": "field",
67
+ "name": "state"
68
+ }
69
+ ],
70
+ "attributes": [
71
+ {
72
+ "name": "inverted"
73
+ },
74
+ {
75
+ "name": "role"
76
+ },
77
+ {
78
+ "name": "aria-required"
79
+ },
80
+ {
81
+ "name": "aria-disabled"
82
+ },
83
+ {
84
+ "name": "state"
85
+ }
86
+ ],
87
+ "superclass": {
88
+ "name": "PxElement",
89
+ "package": "@proximus/lavender-common"
90
+ },
91
+ "tagName": "px-fieldset",
92
+ "customElement": true
93
+ }
94
+ ],
95
+ "exports": [
96
+ {
97
+ "kind": "js",
98
+ "name": "Fieldset",
99
+ "declaration": {
100
+ "name": "Fieldset",
101
+ "module": "src/Fieldset.ts"
102
+ }
103
+ },
104
+ {
105
+ "kind": "custom-element-definition",
106
+ "name": "px-fieldset",
107
+ "declaration": {
108
+ "name": "Fieldset",
109
+ "module": "src/Fieldset.ts"
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "kind": "javascript-module",
116
+ "path": "src/fieldset.css",
117
+ "declarations": [],
118
+ "exports": []
119
+ },
120
+ {
121
+ "kind": "javascript-module",
122
+ "path": "src/index.ts",
123
+ "declarations": [],
124
+ "exports": [
125
+ {
126
+ "kind": "js",
127
+ "name": "*",
128
+ "declaration": {
129
+ "name": "*",
130
+ "module": "src/Fieldset"
131
+ }
132
+ }
133
+ ]
134
+ }
135
+ ]
136
+ }
package/dist/index.es.js CHANGED
@@ -1,106 +1,95 @@
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
- const i = class i extends a {
5
- constructor() {
6
- super(o), this.template = () => `<fieldset >
7
- <legend><slot name="legend"></slot></legend>
8
- <slot name="error-text"></slot>
9
- <slot></slot>
10
- </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(), d(this, this.$el, !1);
24
- }
25
- attributeChangedCallback(t, r, e) {
26
- if (r !== e)
27
- switch (t) {
28
- case "disabled": {
29
- this.querySelectorAll(
30
- "px-radio-group, px-radio, px-checkbox, px-fileupload, px-input, px-textarea, px-select, px-switch"
31
- ).forEach((l) => {
32
- l.setAttribute(t, "true");
33
- });
34
- break;
35
- }
36
- case "role":
37
- case "aria-required":
38
- case "aria-disabled":
39
- e !== null && (this.$el.setAttribute(t, this.getAttribute(t)), this.removeAttribute(t));
40
- break;
41
- case "state":
42
- this.setupErrorState();
43
- break;
44
- default:
45
- super.attributeChangedCallback(t, r, e);
46
- break;
47
- }
48
- }
49
- setupErrorState() {
50
- var r;
51
- const t = ((r = this.$slotError) == null ? void 0 : r.assignedNodes().length) > 0;
52
- if (this.state === "error" && !t && n(
53
- '<px-fieldset> with state="error" requires a slot="error-text" containing the error description.'
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`);
57
- } else
58
- this.$el.removeAttribute("id"), this.$el.removeAttribute("aria-describedby"), this.$el.removeAttribute("aria-invalid"), this.$slotError.removeAttribute("id");
59
- }
60
- get $slotLegend() {
61
- return this.shadowRoot.querySelector(
62
- 'slot[name="legend"]'
63
- );
64
- }
65
- get $slotError() {
66
- return this.shadowRoot.querySelector(
67
- 'slot[name="error-text"]'
68
- );
69
- }
70
- get inverted() {
71
- return this.hasAttribute("inverted");
72
- }
73
- set inverted(t) {
74
- t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
75
- }
76
- get role() {
77
- return this.getAttribute("role");
78
- }
79
- set role(t) {
80
- t ? this.setAttribute("role", t) : this.removeAttribute("role");
81
- }
82
- get ariaRequired() {
83
- return this.getAttribute("aria-required");
84
- }
85
- set ariaRequired(t) {
86
- t ? this.setAttribute("aria-required", t) : this.removeAttribute("aria-required");
87
- }
88
- get ariaDisabled() {
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
- }
1
+ import { PxElement as e, createTemplate as t, log as n, renderTemplate as r, transferAccessibilityAttributes as i } from "@proximus/lavender-common";
2
+ //#region src/fieldset.css?inline
3
+ var a = ":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)}", o = new CSSStyleSheet();
4
+ o.replaceSync(a);
5
+ var s = class a extends e {
6
+ static {
7
+ this.template = t("<fieldset><legend><slot name=\"legend\"></slot></legend><px-vstack gap=\"2xs\"><slot name=\"helper\"></slot><slot name=\"error-text\"></slot><slot></slot></px-vstack></fieldset>");
8
+ }
9
+ static {
10
+ this.nativeName = "fieldset";
11
+ }
12
+ constructor() {
13
+ super(o), r(this.shadowRoot, a.template);
14
+ }
15
+ static get observedAttributes() {
16
+ return [
17
+ ...super.observedAttributes,
18
+ "inverted",
19
+ "role",
20
+ "aria-required",
21
+ "aria-disabled",
22
+ "state"
23
+ ];
24
+ }
25
+ connectedCallback() {
26
+ this.setupErrorState(), i(this, this.$el, !1);
27
+ }
28
+ attributeChangedCallback(e, t, n) {
29
+ if (t !== n) switch (e) {
30
+ case "disabled":
31
+ this.querySelectorAll("px-radio-group, px-radio, px-checkbox, px-fileupload, px-input, px-textarea, px-select, px-switch").forEach((t) => {
32
+ t.setAttribute(e, "true");
33
+ });
34
+ break;
35
+ case "role":
36
+ case "aria-required":
37
+ case "aria-disabled":
38
+ n !== null && (this.$el.setAttribute(e, n), this.removeAttribute(e));
39
+ break;
40
+ case "state":
41
+ this.setupErrorState();
42
+ break;
43
+ default: super.attributeChangedCallback(e, t, n);
44
+ }
45
+ }
46
+ setupErrorState() {
47
+ let e = this.$slotError?.assignedNodes().length > 0;
48
+ if (this.state === "error" && !e && n("<px-fieldset> with state=\"error\" requires a slot=\"error-text\" containing the error description."), this.state === "error" && e) {
49
+ let e = Math.random().toString(36).substr(2, 9);
50
+ 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`);
51
+ } else this.$el.removeAttribute("id"), this.$el.removeAttribute("aria-describedby"), this.$el.removeAttribute("aria-invalid"), this.$slotError.removeAttribute("id");
52
+ }
53
+ get $slotLegend() {
54
+ return this.shadowRoot.querySelector("slot[name=\"legend\"]");
55
+ }
56
+ get $slotHelper() {
57
+ return this.shadowRoot.querySelector("slot[name=\"helper\"]");
58
+ }
59
+ get $slotError() {
60
+ return this.shadowRoot.querySelector("slot[name=\"error-text\"]");
61
+ }
62
+ get inverted() {
63
+ return this.hasAttribute("inverted");
64
+ }
65
+ set inverted(e) {
66
+ this._updateBooleanAttribute("inverted", e);
67
+ }
68
+ get role() {
69
+ return this.getAttribute("role");
70
+ }
71
+ set role(e) {
72
+ this._updateAttribute("role", e);
73
+ }
74
+ get ariaRequired() {
75
+ return this.getAttribute("aria-required");
76
+ }
77
+ set ariaRequired(e) {
78
+ this._updateAttribute("aria-required", e);
79
+ }
80
+ get ariaDisabled() {
81
+ return this.getAttribute("aria-disabled");
82
+ }
83
+ set ariaDisabled(e) {
84
+ this._updateAttribute("aria-disabled", e);
85
+ }
86
+ get state() {
87
+ return this.getAttribute("state");
88
+ }
89
+ set state(e) {
90
+ this._updateAttribute("state", e);
91
+ }
100
92
  };
101
- i.nativeName = "fieldset";
102
- let s = i;
103
93
  customElements.get("px-fieldset") || customElements.define("px-fieldset", s);
104
- export {
105
- s as Fieldset
106
- };
94
+ //#endregion
95
+ export { s as Fieldset };
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [],
5
+ "pseudoElements": []
6
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "px-fieldset",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "inverted", "values": [] },
10
+ { "name": "role", "values": [] },
11
+ { "name": "aria-required", "values": [] },
12
+ { "name": "aria-disabled", "values": [] },
13
+ { "name": "state", "values": [] }
14
+ ],
15
+ "references": []
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-fieldset",
4
+ "version": "2.0.0-alpha.221",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-fieldset",
11
+ "description": "\n\n---\n",
12
+ "doc-url": "",
13
+ "attributes": [
14
+ { "name": "inverted", "value": { "type": "string" } },
15
+ { "name": "role", "value": { "type": "string" } },
16
+ { "name": "aria-required", "value": { "type": "string" } },
17
+ { "name": "aria-disabled", "value": { "type": "string" } },
18
+ { "name": "state", "value": { "type": "string" } }
19
+ ],
20
+ "events": [],
21
+ "js": {
22
+ "properties": [
23
+ { "name": "$slotLegend" },
24
+ { "name": "$slotHelper" },
25
+ { "name": "$slotError" },
26
+ { "name": "inverted" },
27
+ { "name": "role" },
28
+ { "name": "ariaRequired" },
29
+ { "name": "ariaDisabled" },
30
+ { "name": "state" }
31
+ ],
32
+ "events": []
33
+ }
34
+ }
35
+ ]
36
+ },
37
+ "css": {
38
+ "properties": [],
39
+ "pseudo-elements": []
40
+ }
41
+ }
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-fieldset",
3
- "version": "2.0.0-alpha.22",
3
+ "version": "2.0.0-alpha.221",
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"