@proximus/lavender-pillar 2.0.0-alpha.22 → 2.0.0-alpha.220

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/Pillar.d.ts CHANGED
@@ -3,7 +3,7 @@ import { WithExtraAttributes } from '@proximus/lavender-common';
3
3
  export declare const pillarVariantValues: string[];
4
4
  export declare const pillarAlignmentValues: string[];
5
5
  export declare class Pillar extends WithExtraAttributes {
6
- private template;
6
+ protected static readonly template: HTMLTemplateElement;
7
7
  constructor();
8
8
  static get observedAttributes(): string[];
9
9
  connectedCallback(): void;
@@ -16,14 +16,14 @@ export declare class Pillar extends WithExtraAttributes {
16
16
  get $container(): Container;
17
17
  get $title(): HTMLSlotElement;
18
18
  get $children(): NodeListOf<Element>;
19
- get variant(): string;
20
- set variant(value: string);
21
- get backgroundColor(): string;
22
- set backgroundColor(value: string);
23
- get gradient(): string;
24
- set gradient(value: string);
25
- get alignment(): string;
26
- set alignment(value: string);
19
+ get variant(): string | null;
20
+ set variant(value: string | null);
21
+ get backgroundColor(): string | null;
22
+ set backgroundColor(value: string | null);
23
+ get gradient(): string | null;
24
+ set gradient(value: string | null);
25
+ get alignment(): string | null;
26
+ set alignment(value: string | null);
27
27
  get inverted(): boolean;
28
28
  set inverted(value: boolean);
29
29
  }
@@ -0,0 +1,224 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/Pillar.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "pillarVariantValues",
12
+ "type": {
13
+ "text": "array"
14
+ },
15
+ "default": "['', 'naked', 'contained']"
16
+ },
17
+ {
18
+ "kind": "variable",
19
+ "name": "pillarAlignmentValues",
20
+ "type": {
21
+ "text": "array"
22
+ },
23
+ "default": "['', 'left', 'center']"
24
+ },
25
+ {
26
+ "kind": "class",
27
+ "description": "",
28
+ "name": "Pillar",
29
+ "members": [
30
+ {
31
+ "kind": "field",
32
+ "name": "template",
33
+ "privacy": "protected",
34
+ "static": true,
35
+ "readonly": true
36
+ },
37
+ {
38
+ "kind": "method",
39
+ "name": "configureContainer"
40
+ },
41
+ {
42
+ "kind": "method",
43
+ "name": "updateAlignment",
44
+ "parameters": [
45
+ {
46
+ "name": "attrName",
47
+ "type": {
48
+ "text": "string"
49
+ }
50
+ },
51
+ {
52
+ "name": "oldValue",
53
+ "type": {
54
+ "text": "string"
55
+ }
56
+ },
57
+ {
58
+ "name": "newValue",
59
+ "type": {
60
+ "text": "string"
61
+ }
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "kind": "method",
67
+ "name": "updateAlignmentStyle",
68
+ "parameters": [
69
+ {
70
+ "name": "value",
71
+ "type": {
72
+ "text": "string"
73
+ }
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "kind": "method",
79
+ "name": "updateVariant",
80
+ "parameters": [
81
+ {
82
+ "name": "attrName",
83
+ "type": {
84
+ "text": "string"
85
+ }
86
+ },
87
+ {
88
+ "name": "oldValue",
89
+ "type": {
90
+ "text": "string"
91
+ }
92
+ },
93
+ {
94
+ "name": "newValue",
95
+ "type": {
96
+ "text": "string"
97
+ }
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "kind": "field",
103
+ "name": "$el",
104
+ "readonly": true
105
+ },
106
+ {
107
+ "kind": "field",
108
+ "name": "$container",
109
+ "readonly": true
110
+ },
111
+ {
112
+ "kind": "field",
113
+ "name": "$title",
114
+ "readonly": true
115
+ },
116
+ {
117
+ "kind": "field",
118
+ "name": "$children",
119
+ "readonly": true
120
+ },
121
+ {
122
+ "kind": "field",
123
+ "name": "variant"
124
+ },
125
+ {
126
+ "kind": "field",
127
+ "name": "backgroundColor"
128
+ },
129
+ {
130
+ "kind": "field",
131
+ "name": "gradient"
132
+ },
133
+ {
134
+ "kind": "field",
135
+ "name": "alignment"
136
+ },
137
+ {
138
+ "kind": "field",
139
+ "name": "inverted"
140
+ }
141
+ ],
142
+ "attributes": [
143
+ {
144
+ "name": "variant"
145
+ },
146
+ {
147
+ "name": "background-color"
148
+ },
149
+ {
150
+ "name": "background-gradient"
151
+ },
152
+ {
153
+ "name": "alignment"
154
+ },
155
+ {
156
+ "name": "inverted"
157
+ }
158
+ ],
159
+ "superclass": {
160
+ "name": "WithExtraAttributes",
161
+ "package": "@proximus/lavender-common"
162
+ },
163
+ "tagName": "px-pillar",
164
+ "customElement": true
165
+ }
166
+ ],
167
+ "exports": [
168
+ {
169
+ "kind": "js",
170
+ "name": "pillarVariantValues",
171
+ "declaration": {
172
+ "name": "pillarVariantValues",
173
+ "module": "src/Pillar.ts"
174
+ }
175
+ },
176
+ {
177
+ "kind": "js",
178
+ "name": "pillarAlignmentValues",
179
+ "declaration": {
180
+ "name": "pillarAlignmentValues",
181
+ "module": "src/Pillar.ts"
182
+ }
183
+ },
184
+ {
185
+ "kind": "js",
186
+ "name": "Pillar",
187
+ "declaration": {
188
+ "name": "Pillar",
189
+ "module": "src/Pillar.ts"
190
+ }
191
+ },
192
+ {
193
+ "kind": "custom-element-definition",
194
+ "name": "px-pillar",
195
+ "declaration": {
196
+ "name": "Pillar",
197
+ "module": "src/Pillar.ts"
198
+ }
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "kind": "javascript-module",
204
+ "path": "src/index.ts",
205
+ "declarations": [],
206
+ "exports": [
207
+ {
208
+ "kind": "js",
209
+ "name": "*",
210
+ "declaration": {
211
+ "name": "*",
212
+ "module": "src/Pillar"
213
+ }
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "kind": "javascript-module",
219
+ "path": "src/pillar.css",
220
+ "declarations": [],
221
+ "exports": []
222
+ }
223
+ ]
224
+ }
package/dist/index.es.js CHANGED
@@ -1,136 +1,116 @@
1
- import { WithExtraAttributes as s, log as n } from "@proximus/lavender-common";
2
- const l = ':host{display:block}:host *{box-sizing:border-box}.pillar{height:100%;text-align:var(--pillar-text-align, left)}.pillar px-container{height:100%}.pillar__layout{display:flex;flex-direction:column;align-items:var(--pillar-align-items, flex-start);gap:var(--px-spacing-s-mobile);height:100%}.pillar__content{display:flex;flex-direction:column;align-items:var(--pillar-align-items, flex-start);gap:var(--px-spacing-xs-mobile)}::slotted([slot="title"]){font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);font-size:var(--px-text-size-heading-m-mobile);font-weight:var(--px-font-weight-title);color:var(--px-color-text-neutral-default)}::slotted([slot="description"]){font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);font-size:var(--px-text-size-body-m-mobile);font-weight:var(--px-font-weight-body);color:var(--px-color-text-dimmed-default)}@media only screen and (min-width: 768px){.pillar__layout{gap:var(--px-spacing-s-desktop)}.pillar__content{gap:var(--px-spacing-xs-desktop)}::slotted([slot="title"]){font-size:var(--px-text-size-heading-m-desktop)}::slotted([slot="description"]){font-size:var(--px-text-size-body-m-desktop)}}@media only screen and (min-width: 1025px){.pillar__layout{gap:var(--px-spacing-s-desktop)}.pillar__content{gap:var(--px-spacing-xs-desktop)}::slotted([slot="title"]){font-size:var(--px-text-size-heading-m-desktop)}::slotted([slot="description"]){font-size:var(--px-text-size-body-m-desktop)}}:host([inverted]) ::slotted([slot="title"]){color:var(--px-color-text-neutral-inverted)}:host([inverted]) ::slotted([slot="description"]){color:var(--px-color-text-dimmed-inverted)}', a = new CSSStyleSheet();
3
- a.replaceSync(l);
4
- const o = ["", "naked", "contained"], d = ["", "left", "center"];
5
- class c extends s {
6
- constructor() {
7
- super(a), this.template = () => `<div class="pillar">
8
- <px-container>
9
- <div class="pillar__layout">
10
- <slot name="media"></slot>
11
- <div class="pillar__content">
12
- <slot name="title"></slot>
13
- <slot name="description"></slot>
14
- </div>
15
- <slot name="action"></slot>
16
- </div>
17
- </px-container>
18
- </div>`, this.shadowRoot.innerHTML = this.template();
19
- }
20
- static get observedAttributes() {
21
- return [
22
- "variant",
23
- "background-color",
24
- "background-gradient",
25
- "alignment",
26
- "inverted"
27
- ];
28
- }
29
- connectedCallback() {
30
- this.configureContainer();
31
- }
32
- attributeChangedCallback(t, i, e) {
33
- if (i !== e)
34
- switch (t) {
35
- case "variant":
36
- this.updateVariant(t, i, e), this.configureContainer();
37
- break;
38
- case "background-color":
39
- this.$container.backgroundColor = e;
40
- break;
41
- case "background-gradient":
42
- this.$container.gradient = e;
43
- break;
44
- case "alignment":
45
- this.updateAlignment(t, i, e);
46
- break;
47
- case "inverted":
48
- if (e === null || e === "") {
49
- this.$container.setAttribute("inverted", "");
50
- for (let r = 0; r < this.$children.length; r++)
51
- this.$children[r].setAttribute("inverted", "");
52
- } else {
53
- this.$container.removeAttribute("inverted");
54
- for (let r = 0; r < this.$children.length; r++)
55
- this.$children[r].removeAttribute("inverted");
56
- }
57
- break;
58
- default:
59
- super.attributeChangedCallback(t, i, e);
60
- break;
61
- }
62
- }
63
- configureContainer() {
64
- this.variant === "contained" ? (this.$container.padding = "l", !this.backgroundColor && !this.gradient && (this.$container.backgroundColor = this.inverted ? "surface-brand" : "surface-default")) : (this.$container.padding = "none", this.$container.backgroundColor = "none", this.$container.borderRadius = "none");
65
- }
66
- updateAlignment(t, i, e) {
67
- if (!this.checkName(d, e)) {
68
- n(
69
- `${e} is not an allowed ${t} value for ${this.tagName.toLowerCase()}`
70
- );
71
- return;
72
- }
73
- i !== null && i !== "" && i !== "default" && this.updateAlignmentStyle(i), e !== null && e !== "" && e !== "default" && this.updateAlignmentStyle(e);
74
- }
75
- updateAlignmentStyle(t) {
76
- const i = t === "left" ? "flex-start" : t;
77
- this.$el.style.setProperty("--pillar-align-items", i), this.$el.style.setProperty("--pillar-text-align", t);
78
- }
79
- updateVariant(t, i, e) {
80
- if (!this.checkName(o, e)) {
81
- n(
82
- `${e} is not an allowed ${t} value for ${this.tagName.toLowerCase()}`
83
- );
84
- return;
85
- }
86
- i !== null && i !== "" && i !== "default" && this.$el.classList.toggle(i), e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(e);
87
- }
88
- get $el() {
89
- return this.shadowRoot.querySelector(".pillar");
90
- }
91
- get $container() {
92
- return this.shadowRoot.querySelector("px-container");
93
- }
94
- get $title() {
95
- return this.querySelector('[slot="title"]');
96
- }
97
- get $children() {
98
- return this.querySelectorAll("px-pillar > *");
99
- }
100
- get variant() {
101
- return this.getAttribute("variant");
102
- }
103
- set variant(t) {
104
- t ? this.setAttribute("variant", t) : this.removeAttribute("variant");
105
- }
106
- get backgroundColor() {
107
- return this.getAttribute("background-color");
108
- }
109
- set backgroundColor(t) {
110
- this.setAttribute("background-color", t);
111
- }
112
- get gradient() {
113
- return this.getAttribute("background-gradient");
114
- }
115
- set gradient(t) {
116
- this.setAttribute("background-gradient", t);
117
- }
118
- get alignment() {
119
- return this.getAttribute("alignment");
120
- }
121
- set alignment(t) {
122
- t ? this.setAttribute("alignment", t) : this.removeAttribute("alignment");
123
- }
124
- get inverted() {
125
- return this.hasAttribute("inverted");
126
- }
127
- set inverted(t) {
128
- t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
129
- }
130
- }
131
- customElements.get("px-pillar") || customElements.define("px-pillar", c);
132
- export {
133
- c as Pillar,
134
- d as pillarAlignmentValues,
135
- o as pillarVariantValues
1
+ import { WithExtraAttributes as e, booleanPropertyToAttributeSetter as t, createTemplate as n, log as r, propertyToAttributeSetter as i, renderTemplate as a } from "@proximus/lavender-common";
2
+ //#region src/pillar.css?inline
3
+ var o = ":host{display:block}:host *{box-sizing:border-box}.pillar{height:100%}.pillar px-container{height:100%}.pillar__layout{align-items:var(--pillar-align-items,flex-start);gap:var(--px-spacing-s-mobile);flex-direction:column;height:100%;display:flex}.pillar__content{align-items:var(--pillar-align-items,flex-start);gap:var(--px-spacing-xs-mobile);flex-direction:column;display:flex}::slotted([slot=title]){font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);font-size:var(--px-text-size-heading-m-mobile);font-weight:var(--px-font-weight-title);color:var(--px-color-text-neutral-default);text-align:var(--pillar-text-align,left)}::slotted([slot=description]){font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);font-size:var(--px-text-size-body-m-mobile);font-weight:var(--px-font-weight-body);color:var(--px-color-text-dimmed-default);text-align:var(--pillar-text-align,left)}@media screen and (width>=48rem){.pillar__layout{gap:var(--px-spacing-s-desktop)}.pillar__content{gap:var(--px-spacing-xs-desktop)}::slotted([slot=title]){font-size:var(--px-text-size-heading-m-desktop)}::slotted([slot=description]){font-size:var(--px-text-size-body-m-desktop)}}@media screen and (width>=64.0625rem){.pillar__layout{gap:var(--px-spacing-s-desktop)}.pillar__content{gap:var(--px-spacing-xs-desktop)}::slotted([slot=title]){font-size:var(--px-text-size-heading-m-desktop)}::slotted([slot=description]){font-size:var(--px-text-size-body-m-desktop)}}:host([inverted]) ::slotted([slot=title]){color:var(--px-color-text-neutral-inverted)}:host([inverted]) ::slotted([slot=description]){color:var(--px-color-text-dimmed-inverted)}", s = new CSSStyleSheet();
4
+ s.replaceSync(o);
5
+ var c = [
6
+ "",
7
+ "naked",
8
+ "contained"
9
+ ], l = [
10
+ "",
11
+ "left",
12
+ "center"
13
+ ], u = class o extends e {
14
+ static {
15
+ this.template = n("<div class=\"pillar\"><px-container><div class=\"pillar__layout\"><slot name=\"media\"></slot><div class=\"pillar__content\"><slot name=\"title\"></slot><slot name=\"description\"></slot></div><slot name=\"action\"></slot></div></px-container></div>");
16
+ }
17
+ constructor() {
18
+ super(s), a(this.shadowRoot, o.template);
19
+ }
20
+ static get observedAttributes() {
21
+ return [
22
+ "variant",
23
+ "background-color",
24
+ "background-gradient",
25
+ "alignment",
26
+ "inverted"
27
+ ];
28
+ }
29
+ connectedCallback() {
30
+ this.configureContainer();
31
+ }
32
+ attributeChangedCallback(e, t, n) {
33
+ if (t !== n) switch (e) {
34
+ case "variant":
35
+ this.updateVariant(e, t, n), this.configureContainer();
36
+ break;
37
+ case "background-color":
38
+ this.$container.backgroundColor = n;
39
+ break;
40
+ case "background-gradient":
41
+ this.$container.gradient = n;
42
+ break;
43
+ case "alignment":
44
+ this.updateAlignment(e, t, n);
45
+ break;
46
+ case "inverted":
47
+ if (n === null || n === "") {
48
+ this.$container.setAttribute("inverted", "");
49
+ for (let e = 0; e < this.$children.length; e++) this.$children[e].setAttribute("inverted", "");
50
+ } else {
51
+ this.$container.removeAttribute("inverted");
52
+ for (let e = 0; e < this.$children.length; e++) this.$children[e].removeAttribute("inverted");
53
+ }
54
+ break;
55
+ default: super.attributeChangedCallback(e, t, n);
56
+ }
57
+ }
58
+ configureContainer() {
59
+ this.variant === "contained" ? (this.$container.padding = "l", !this.backgroundColor && !this.gradient && (this.$container.backgroundColor = this.inverted ? "surface-brand" : "surface-default")) : (this.$container.padding = "none", this.$container.backgroundColor = "none", this.$container.borderRadius = "none");
60
+ }
61
+ updateAlignment(e, t, n) {
62
+ this.checkName(l, n) ? (t !== null && t !== "" && t !== "default" && this.updateAlignmentStyle(t), n !== null && n !== "" && n !== "default" && this.updateAlignmentStyle(n)) : r(`"${n}" is not a valid ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${l.join("\", \"")}".`);
63
+ }
64
+ updateAlignmentStyle(e) {
65
+ let t = e === "left" ? "flex-start" : e;
66
+ this.$el.style.setProperty("--pillar-align-items", t), this.$el.style.setProperty("--pillar-text-align", e);
67
+ }
68
+ updateVariant(e, t, n) {
69
+ this.checkName(c, n) ? (t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t), n !== null && n !== "" && n !== "default" && this.$el.classList.toggle(n)) : r(`"${n}" is not a valid ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${c.join("\", \"")}".`);
70
+ }
71
+ get $el() {
72
+ return this.shadowRoot.querySelector(".pillar");
73
+ }
74
+ get $container() {
75
+ return this.shadowRoot.querySelector("px-container");
76
+ }
77
+ get $title() {
78
+ return this.querySelector("[slot=\"title\"]");
79
+ }
80
+ get $children() {
81
+ return this.querySelectorAll("px-pillar > *");
82
+ }
83
+ get variant() {
84
+ return this.getAttribute("variant");
85
+ }
86
+ set variant(e) {
87
+ i(this, "variant", e);
88
+ }
89
+ get backgroundColor() {
90
+ return this.getAttribute("background-color");
91
+ }
92
+ set backgroundColor(e) {
93
+ i(this, "background-color", e);
94
+ }
95
+ get gradient() {
96
+ return this.getAttribute("background-gradient");
97
+ }
98
+ set gradient(e) {
99
+ i(this, "background-gradient", e);
100
+ }
101
+ get alignment() {
102
+ return this.getAttribute("alignment");
103
+ }
104
+ set alignment(e) {
105
+ i(this, "alignment", e);
106
+ }
107
+ get inverted() {
108
+ return this.hasAttribute("inverted");
109
+ }
110
+ set inverted(e) {
111
+ t(this, "inverted", e);
112
+ }
136
113
  };
114
+ customElements.get("px-pillar") || customElements.define("px-pillar", u);
115
+ //#endregion
116
+ export { u as Pillar, l as pillarAlignmentValues, c as pillarVariantValues };
@@ -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-pillar",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "variant", "values": [] },
10
+ { "name": "background-color", "values": [] },
11
+ { "name": "background-gradient", "values": [] },
12
+ { "name": "alignment", "values": [] },
13
+ { "name": "inverted", "values": [] }
14
+ ],
15
+ "references": []
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-pillar",
4
+ "version": "2.0.0-alpha.220",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-pillar",
11
+ "description": "\n\n---\n",
12
+ "doc-url": "",
13
+ "attributes": [
14
+ { "name": "variant", "value": { "type": "string" } },
15
+ { "name": "background-color", "value": { "type": "string" } },
16
+ { "name": "background-gradient", "value": { "type": "string" } },
17
+ { "name": "alignment", "value": { "type": "string" } },
18
+ { "name": "inverted", "value": { "type": "string" } }
19
+ ],
20
+ "events": [],
21
+ "js": {
22
+ "properties": [
23
+ { "name": "$el" },
24
+ { "name": "$container" },
25
+ { "name": "$title" },
26
+ { "name": "$children" },
27
+ { "name": "variant" },
28
+ { "name": "backgroundColor" },
29
+ { "name": "gradient" },
30
+ { "name": "alignment" },
31
+ { "name": "inverted" }
32
+ ],
33
+ "events": []
34
+ }
35
+ }
36
+ ]
37
+ },
38
+ "css": {
39
+ "properties": [],
40
+ "pseudo-elements": []
41
+ }
42
+ }
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-pillar",
3
- "version": "2.0.0-alpha.22",
3
+ "version": "2.0.0-alpha.220",
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"