@proximus/lavender-accordion 2.0.0-alpha.21 → 2.0.0-alpha.211

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.
@@ -3,9 +3,9 @@ import { PxElement } from '@proximus/lavender-common';
3
3
  export declare const accordionVariantValues: readonly ["", "none", "single", "contained"];
4
4
  export declare const accordionBackgroundColorValues: string[];
5
5
  export declare class Accordion extends PxElement<HTMLDivElement> {
6
+ protected static readonly template: HTMLTemplateElement;
6
7
  static nativeName: string;
7
8
  private isSafari;
8
- private template;
9
9
  constructor();
10
10
  static get observedAttributes(): string[];
11
11
  connectedCallback(): void;
@@ -15,10 +15,10 @@ export declare class Accordion extends PxElement<HTMLDivElement> {
15
15
  updateAriaExpanded(): void;
16
16
  get $summary(): HTMLElement;
17
17
  get $details(): HTMLDetailsElement;
18
- get variant(): string;
19
- set variant(value: string);
20
- get backgroundColor(): string;
21
- set backgroundColor(value: string);
18
+ get variant(): string | null;
19
+ set variant(value: string | null);
20
+ get backgroundColor(): string | null;
21
+ set backgroundColor(value: string | null);
22
22
  get inverted(): boolean;
23
23
  set inverted(value: boolean);
24
24
  get noContentPadding(): boolean;
@@ -0,0 +1,215 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/Accordion.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "accordionVariantValues",
12
+ "type": {
13
+ "text": "[\n '',\n 'none',\n 'single',\n 'contained',\n]"
14
+ },
15
+ "default": "[ '', 'none', 'single', 'contained', ]"
16
+ },
17
+ {
18
+ "kind": "variable",
19
+ "name": "accordionBackgroundColorValues",
20
+ "type": {
21
+ "text": "array"
22
+ },
23
+ "default": "[ '', 'container-default', 'container-light', ]"
24
+ },
25
+ {
26
+ "kind": "class",
27
+ "description": "",
28
+ "name": "Accordion",
29
+ "members": [
30
+ {
31
+ "kind": "field",
32
+ "name": "template",
33
+ "privacy": "protected",
34
+ "static": true,
35
+ "readonly": true
36
+ },
37
+ {
38
+ "kind": "field",
39
+ "name": "nativeName",
40
+ "type": {
41
+ "text": "string"
42
+ },
43
+ "static": true,
44
+ "default": "'details'"
45
+ },
46
+ {
47
+ "kind": "field",
48
+ "name": "isSafari",
49
+ "privacy": "private"
50
+ },
51
+ {
52
+ "kind": "method",
53
+ "name": "updateAttribute",
54
+ "parameters": [
55
+ {
56
+ "name": "attrName",
57
+ "type": {
58
+ "text": "string"
59
+ }
60
+ },
61
+ {
62
+ "name": "oldValue",
63
+ "type": {
64
+ "text": "string"
65
+ }
66
+ },
67
+ {
68
+ "name": "newValue",
69
+ "type": {
70
+ "text": "string"
71
+ }
72
+ },
73
+ {
74
+ "name": "attrValues",
75
+ "type": {
76
+ "text": "readonly string[]"
77
+ }
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "kind": "method",
83
+ "name": "updateBackgroundColor",
84
+ "parameters": [
85
+ {
86
+ "name": "attrName",
87
+ "type": {
88
+ "text": "string"
89
+ }
90
+ },
91
+ {
92
+ "name": "newValue",
93
+ "type": {
94
+ "text": "string"
95
+ }
96
+ },
97
+ {
98
+ "name": "attrValue",
99
+ "type": {
100
+ "text": "string[]"
101
+ }
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "kind": "method",
107
+ "name": "updateAriaExpanded"
108
+ },
109
+ {
110
+ "kind": "field",
111
+ "name": "$summary",
112
+ "readonly": true
113
+ },
114
+ {
115
+ "kind": "field",
116
+ "name": "$details",
117
+ "readonly": true
118
+ },
119
+ {
120
+ "kind": "field",
121
+ "name": "variant"
122
+ },
123
+ {
124
+ "kind": "field",
125
+ "name": "backgroundColor"
126
+ },
127
+ {
128
+ "kind": "field",
129
+ "name": "inverted"
130
+ },
131
+ {
132
+ "kind": "field",
133
+ "name": "noContentPadding"
134
+ }
135
+ ],
136
+ "attributes": [
137
+ {
138
+ "name": "variant"
139
+ },
140
+ {
141
+ "name": "background-color"
142
+ },
143
+ {
144
+ "name": "inverted"
145
+ },
146
+ {
147
+ "name": "no-content-padding"
148
+ }
149
+ ],
150
+ "superclass": {
151
+ "name": "PxElement",
152
+ "package": "@proximus/lavender-common"
153
+ },
154
+ "tagName": "px-accordion",
155
+ "customElement": true
156
+ }
157
+ ],
158
+ "exports": [
159
+ {
160
+ "kind": "js",
161
+ "name": "accordionVariantValues",
162
+ "declaration": {
163
+ "name": "accordionVariantValues",
164
+ "module": "src/Accordion.ts"
165
+ }
166
+ },
167
+ {
168
+ "kind": "js",
169
+ "name": "accordionBackgroundColorValues",
170
+ "declaration": {
171
+ "name": "accordionBackgroundColorValues",
172
+ "module": "src/Accordion.ts"
173
+ }
174
+ },
175
+ {
176
+ "kind": "js",
177
+ "name": "Accordion",
178
+ "declaration": {
179
+ "name": "Accordion",
180
+ "module": "src/Accordion.ts"
181
+ }
182
+ },
183
+ {
184
+ "kind": "custom-element-definition",
185
+ "name": "px-accordion",
186
+ "declaration": {
187
+ "name": "Accordion",
188
+ "module": "src/Accordion.ts"
189
+ }
190
+ }
191
+ ]
192
+ },
193
+ {
194
+ "kind": "javascript-module",
195
+ "path": "src/accordion.css",
196
+ "declarations": [],
197
+ "exports": []
198
+ },
199
+ {
200
+ "kind": "javascript-module",
201
+ "path": "src/index.ts",
202
+ "declarations": [],
203
+ "exports": [
204
+ {
205
+ "kind": "js",
206
+ "name": "*",
207
+ "declaration": {
208
+ "name": "*",
209
+ "module": "src/Accordion"
210
+ }
211
+ }
212
+ ]
213
+ }
214
+ ]
215
+ }
package/dist/index.es.js CHANGED
@@ -1,118 +1,92 @@
1
1
  import "@proximus/lavender-layout";
2
- import { PxElement as d, log as i } from "@proximus/lavender-common";
3
- const l = `details{font-family:var(--px-font-family);display:flex;flex-direction:column}details summary{font-size:var(--px-text-size-label-m-mobile);align-items:center;align-self:flex-start;transition:all .2s ease-out 0s,backdrop-filter 0s,-webkit-backdrop-filter 0s}details summary .arrow-icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:var(--px-size-icon-m);height:var(--px-size-icon-m);background-color:var(--px-color-background-container-secondary-default);border-radius:var(--px-radius-pill);transition:all .2s ease-out 0s,backdrop-filter 0s,-webkit-backdrop-filter 0s}details summary .arrow-icon:after{content:"";width:var(--px-size-icon-xs);height:var(--px-size-icon-xs);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-position:50% 50%;mask-position:50% 50%;-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cg id='CHEVRON DOWN'%3E%3Cpath id='Vector' fill-rule='evenodd' clip-rule='evenodd' d='M12.4714 6.19524C12.2111 5.93489 11.7889 5.93489 11.5286 6.19524L8 9.72384L4.4714 6.19524C4.21105 5.93489 3.78894 5.93489 3.52859 6.19524C3.26824 6.45559 3.26824 6.8777 3.52859 7.13805L7.52859 11.1381C7.78894 11.3984 8.21105 11.3984 8.4714 11.1381L12.4714 7.13805C12.7318 6.8777 12.7318 6.45559 12.4714 6.19524Z' fill='%235C2D91'/%3E%3C/g%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cg id='CHEVRON DOWN'%3E%3Cpath id='Vector' fill-rule='evenodd' clip-rule='evenodd' d='M12.4714 6.19524C12.2111 5.93489 11.7889 5.93489 11.5286 6.19524L8 9.72384L4.4714 6.19524C4.21105 5.93489 3.78894 5.93489 3.52859 6.19524C3.26824 6.45559 3.26824 6.8777 3.52859 7.13805L7.52859 11.1381C7.78894 11.3984 8.21105 11.3984 8.4714 11.1381L12.4714 7.13805C12.7318 6.8777 12.7318 6.45559 12.4714 6.19524Z' fill='%235C2D91'/%3E%3C/g%3E%3C/svg%3E");background-color:currentColor;color:var(--px-color-icon-brand-default);transition:all .2s ease-out 0s,backdrop-filter 0s,-webkit-backdrop-filter 0s}details summary:hover{cursor:pointer}details summary:hover .arrow-icon{background-color:var( --px-color-background-state-hover-bordered-default );border-color:var(--px-color-border-state-hover-default);-webkit-backdrop-filter:blur(15px);backdrop-filter:blur(15px)}details:not(.single):not(.contained){border-bottom:var(--px-size-border-m) solid var(--px-color-border-main-default)}details:not(.single) ::slotted([slot="title"]){flex-grow:1}details:not(.single) slot[name=content]{display:block;padding:var(--px-padding-s-mobile)}details:not(.single) summary{display:flex;padding:var(--px-padding-s-mobile);gap:var(--px-spacing-s-mobile);align-self:stretch}details:not(.single) summary .arrow-icon{border:var(--px-size-border-m) solid transparent}details:not(.single) summary:hover{background-color:var(--px-color-background-state-hover-default)}details:not(.single) summary:hover .arrow-icon{border-color:var(--px-color-border-state-hover-default)}details:not(.single).contained{border-radius:var(--px-radius-main);border:var(--px-size-border-m) solid var(--px-color-border-none-default);background-color:var( --accordion-contained-background-color-default, var(--px-color-background-container-default-default) )}details:not(.single).contained summary{padding:var(--px-padding-m-mobile);font-size:var(--px-text-size-label-l-mobile);font-weight:var(--px-font-weight-title);color:var(--px-color-text-brand-default)}details:not(.single).contained summary:hover{background-color:var(--px-color-background-none)}details:not(.single).contained:has(summary:hover){background-color:var( --px-color-background-state-hover-bordered-default );border-color:var(--px-color-border-state-hover-default)}details:not(.single).contained[no-content-padding] slot[name=content]{padding:0}details.single summary{display:inline-flex;padding-block:var(--px-padding-2xs-mobile);gap:var(--px-spacing-xs-mobile);justify-content:center;color:var(--px-color-text-brand-default);font-weight:var(--px-font-weight-title);border:var(--px-size-border-m) solid transparent;border-radius:var(--px-radius-pill)}details.single summary:hover{gap:var(--px-spacing-2xs-mobile);padding:var(--px-padding-2xs-mobile) var(--px-padding-s-mobile);border-color:var(--px-color-border-state-hover-default)}details.single summary:hover .arrow-icon{border-color:transparent;background-color:transparent;margin-right:calc(var(--px-padding-xs-mobile) * -1)}details.single slot[name=content]{display:block;padding-top:var(--px-spacing-s-mobile)}details[open] summary slot[name=title]{color:var(--px-color-text-brand-default);font-weight:var(--px-font-weight-title)}details[open] summary .arrow-icon:after{transform:rotate(180deg)}summary::-webkit-details-marker{display:none}:host([inverted]) details{color:var(--px-color-text-neutral-inverted)}:host([inverted]) details summary .arrow-icon{background-color:var( --px-color-background-container-secondary-inverted )}:host([inverted]) details summary .arrow-icon:after{color:var(--px-color-icon-brand-inverted)}:host([inverted]) details summary:hover .arrow-icon{background-color:var(--px-color-background-state-hover-default);border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) details:not(.single){border-bottom-color:var(--px-color-border-main-inverted)}:host([inverted]) details:not(.single) summary:hover{background-color:var(--px-color-background-state-hover-inverted)}:host([inverted]) details:not(.single).contained{background-color:var( --accordion-contained-background-color-inverted, var(--px-color-background-container-default-inverted) );border-color:var(--px-color-border-none-inverted)}:host([inverted]) details:not(.single).contained summary{color:var(--px-color-text-neutral-inverted)}:host([inverted]) details:not(.single).contained summary:hover{background-color:var(--px-color-background-none)}:host([inverted]) details:not(.single).contained:has(summary:hover){background-color:var( --px-color-background-state-hover-bordered-inverted );border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) details.single summary{color:var(--px-color-text-brand-inverted)}:host([inverted]) details.single summary:hover{border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) details.single summary:hover .arrow-icon{border-color:transparent;background-color:transparent}:host([inverted]) details[open] summary slot[name=title]{color:var(--px-color-text-brand-inverted)}@media only screen and (min-width: 48em){details summary{font-size:var(--px-text-size-label-m-tablet)}details:not(.single) slot[name=content]{padding:var(--px-padding-s-tablet)}details:not(.single) summary{padding:var(--px-padding-s-tablet);gap:var(--px-spacing-s-tablet)}details:not(.single).contained summary{padding:var(--px-padding-m-tablet);font-size:var(--px-text-size-label-l-tablet)}details.single summary{padding-block:var(--px-padding-2xs-tablet);gap:var(--px-spacing-xs-tablet)}details.single summary:hover{gap:var(--px-spacing-2xs-tablet);padding:var(--px-padding-2xs-tablet) var(--px-padding-s-tablet)}details.single summary:hover .arrow-icon{margin-right:calc(var(--px-padding-xs-tablet) * -1)}details.single slot[name=content]{padding-top:var(--px-spacing-s-tablet)}}@media only screen and (min-width: 64.0625em){details summary{font-size:var(--px-text-size-label-m-laptop)}details:not(.single) slot[name=content]{padding:var(--px-padding-s-laptop)}details:not(.single) summary{padding:var(--px-padding-s-laptop);gap:var(--px-spacing-s-laptop)}details:not(.single).contained summary{font-size:var(--px-text-size-label-l-laptop);padding:var(--px-padding-m-laptop)}details.single summary{padding-block:var(--px-padding-2xs-laptop);gap:var(--px-spacing-xs-laptop)}details.single summary:hover{gap:var(--px-spacing-2xs-laptop);padding:var(--px-padding-2xs-laptop) var(--px-padding-s-laptop)}details.single summary:hover .arrow-icon{margin-right:calc(var(--px-padding-xs-laptop) * -1)}details.single slot[name=content]{padding-top:var(--px-spacing-s-laptop)}}`, n = new CSSStyleSheet();
4
- n.replaceSync(l);
5
- const c = [
6
- "",
7
- "none",
8
- "single",
9
- "contained"
10
- ], p = [
11
- "",
12
- "container-default",
13
- "container-light"
14
- ], o = class o extends d {
15
- constructor() {
16
- super(n), this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), this.template = () => `<details>
17
- <summary><slot name="icon"></slot><slot name="title"></slot><slot name="info"></slot><span class="arrow-icon"></span></summary>
18
- <slot name="content"></slot>
19
- </details>`, this.shadowRoot.innerHTML = this.template();
20
- }
21
- static get observedAttributes() {
22
- return [
23
- ...super.observedAttributes,
24
- "variant",
25
- "background-color",
26
- "inverted",
27
- "no-content-padding"
28
- ];
29
- }
30
- connectedCallback() {
31
- this.isSafari && this.$summary.setAttribute("role", "button"), this.$details && this.$summary && (this.updateAriaExpanded(), this.$details.addEventListener("toggle", () => {
32
- this.updateAriaExpanded();
33
- }));
34
- }
35
- attributeChangedCallback(e, t, r) {
36
- if (t !== r)
37
- switch (e) {
38
- case "variant":
39
- this.updateAttribute(
40
- e,
41
- t,
42
- r,
43
- c
44
- );
45
- break;
46
- case "background-color":
47
- this.updateBackgroundColor(
48
- e,
49
- r,
50
- p
51
- );
52
- break;
53
- default:
54
- super.attributeChangedCallback(e, t, r);
55
- break;
56
- }
57
- }
58
- updateAttribute(e, t, r, s) {
59
- t !== null && t !== "" && this.$el.classList.toggle(`${t}`), r !== null && r !== "" && this.$el.classList.toggle(`${r}`), this.checkName(s, r) || i(
60
- `${r} is not an allowed ${e} value for ${this.tagName.toLowerCase()}`
61
- );
62
- }
63
- updateBackgroundColor(e, t, r) {
64
- this.checkName(r, t) ? (this.$el.style.setProperty(
65
- `--accordion-contained-${e}-default`,
66
- `var(--px-color-background-${t}-default)`
67
- ), this.$el.style.setProperty(
68
- `--accordion-contained-${e}-inverted`,
69
- `var(--px-color-background-${t}-inverted)`
70
- )) : i(
71
- `${t} is not an allowed ${e} value for ${this.tagName.toLowerCase()}`
72
- );
73
- }
74
- updateAriaExpanded() {
75
- this.$summary.setAttribute(
76
- "aria-expanded",
77
- this.$details.hasAttribute("open") ? "true" : "false"
78
- );
79
- }
80
- get $summary() {
81
- return this.shadowRoot.querySelector("summary");
82
- }
83
- get $details() {
84
- return this.shadowRoot.querySelector("details");
85
- }
86
- get variant() {
87
- return this.getAttribute("variant");
88
- }
89
- set variant(e) {
90
- this.setAttribute("variant", e);
91
- }
92
- get backgroundColor() {
93
- return this.getAttribute("background-color");
94
- }
95
- set backgroundColor(e) {
96
- this.setAttribute("background-color", e);
97
- }
98
- get inverted() {
99
- return this.hasAttribute("inverted");
100
- }
101
- set inverted(e) {
102
- e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
103
- }
104
- get noContentPadding() {
105
- return this.hasAttribute("no-content-padding");
106
- }
107
- set noContentPadding(e) {
108
- e ? this.setAttribute("no-content-padding", "") : this.removeAttribute("no-content-padding");
109
- }
110
- };
111
- o.nativeName = "details";
112
- let a = o;
113
- customElements.get("px-accordion") || customElements.define("px-accordion", a);
114
- export {
115
- a as Accordion,
116
- p as accordionBackgroundColorValues,
117
- c as accordionVariantValues
2
+ import { PxElement as e, createTemplate as t, log as n, renderTemplate as r } from "@proximus/lavender-common";
3
+ //#region src/accordion.css?inline
4
+ var i = "details{font-family:var(--px-font-family);flex-direction:column;display:flex}details summary{font-size:var(--px-text-size-label-m-mobile);align-self:flex-start;align-items:center;transition:all .2s ease-out,-webkit-backdrop-filter,backdrop-filter}details summary .arrow-icon{width:var(--px-size-icon-m);height:var(--px-size-icon-m);background-color:var(--px-color-background-container-secondary-default);border-radius:var(--px-radius-pill);flex-shrink:0;justify-content:center;align-items:center;transition:all .2s ease-out,-webkit-backdrop-filter,backdrop-filter;display:flex}details summary .arrow-icon:after{content:\"\";width:var(--px-size-icon-xs);height:var(--px-size-icon-xs);color:var(--px-color-icon-brand-default);background-color:currentColor;transition:all .2s ease-out,-webkit-backdrop-filter,backdrop-filter;-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cg id='CHEVRON DOWN'%3E%3Cpath id='Vector' fill-rule='evenodd' clip-rule='evenodd' d='M12.4714 6.19524C12.2111 5.93489 11.7889 5.93489 11.5286 6.19524L8 9.72384L4.4714 6.19524C4.21105 5.93489 3.78894 5.93489 3.52859 6.19524C3.26824 6.45559 3.26824 6.8777 3.52859 7.13805L7.52859 11.1381C7.78894 11.3984 8.21105 11.3984 8.4714 11.1381L12.4714 7.13805C12.7318 6.8777 12.7318 6.45559 12.4714 6.19524Z' fill='%235C2D91'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cg id='CHEVRON DOWN'%3E%3Cpath id='Vector' fill-rule='evenodd' clip-rule='evenodd' d='M12.4714 6.19524C12.2111 5.93489 11.7889 5.93489 11.5286 6.19524L8 9.72384L4.4714 6.19524C4.21105 5.93489 3.78894 5.93489 3.52859 6.19524C3.26824 6.45559 3.26824 6.8777 3.52859 7.13805L7.52859 11.1381C7.78894 11.3984 8.21105 11.3984 8.4714 11.1381L12.4714 7.13805C12.7318 6.8777 12.7318 6.45559 12.4714 6.19524Z' fill='%235C2D91'/%3E%3C/g%3E%3C/svg%3E\");-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}details summary:hover{cursor:pointer}details summary:hover .arrow-icon{background-color:var(--px-color-background-state-hover-bordered-default);border-color:var(--px-color-border-state-hover-default);-webkit-backdrop-filter:blur(15px);backdrop-filter:blur(15px)}details:not(.single):not(.contained){border-bottom:var(--px-size-border-m) solid var(--px-color-border-main-default)}details:not(.single) ::slotted([slot=title]){flex-grow:1}details:not(.single) slot[name=content]{padding:var(--px-padding-m-mobile);display:block}details:not(.single) summary{padding:var(--px-padding-m-mobile);gap:var(--px-spacing-s-mobile);align-self:stretch;display:flex}details:not(.single) summary .arrow-icon{border:var(--px-size-border-m) solid transparent}details:not(.single) summary:hover{background-color:var(--px-color-background-state-hover-default)}details:not(.single) summary:hover .arrow-icon{border-color:var(--px-color-border-state-hover-default)}details:not(.single).contained{border-radius:var(--px-radius-main);border:var(--px-size-border-m) solid var(--px-color-border-none-default);background-color:var(--accordion-contained-background-color-default,var(--px-color-background-container-default-default))}details:not(.single).contained summary{padding:var(--px-padding-m-mobile);font-size:var(--px-text-size-label-l-mobile);font-weight:var(--px-font-weight-title);color:var(--px-color-text-brand-default)}details:not(.single).contained summary:hover{background-color:var(--px-color-background-none)}details:not(.single).contained:has(summary:hover){background-color:var(--px-color-background-state-hover-bordered-default);border-color:var(--px-color-border-state-hover-default)}details:not(.single).contained[no-content-padding] slot[name=content]{padding:0}details.single summary{padding-block:var(--px-padding-2xs-mobile);gap:var(--px-spacing-xs-mobile);color:var(--px-color-text-brand-default);font-weight:var(--px-font-weight-title);border:var(--px-size-border-m) solid transparent;border-radius:var(--px-radius-pill);justify-content:center;display:inline-flex}details.single summary:hover{gap:var(--px-spacing-2xs-mobile);padding:var(--px-padding-2xs-mobile) var(--px-padding-s-mobile);border-color:var(--px-color-border-state-hover-default)}details.single summary:hover .arrow-icon{margin-right:calc(var(--px-padding-xs-mobile) * -1);background-color:#0000;border-color:#0000}details.single slot[name=content]{padding-top:var(--px-spacing-s-mobile);display:block}details[open] summary slot[name=title]{color:var(--px-color-text-brand-default);font-weight:var(--px-font-weight-title)}details[open] summary .arrow-icon:after{transform:rotate(180deg)}summary::-webkit-details-marker{display:none}:host([inverted]) details{color:var(--px-color-text-neutral-inverted)}:host([inverted]) details summary .arrow-icon{background-color:var(--px-color-background-container-secondary-inverted)}:host([inverted]) details summary .arrow-icon:after{color:var(--px-color-icon-brand-inverted)}:host([inverted]) details summary:hover .arrow-icon{background-color:var(--px-color-background-state-hover-default);border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) details:not(.single){border-bottom-color:var(--px-color-border-main-inverted)}:host([inverted]) details:not(.single) summary:hover{background-color:var(--px-color-background-state-hover-inverted)}:host([inverted]) details:not(.single).contained{background-color:var(--accordion-contained-background-color-inverted,var(--px-color-background-container-default-inverted));border-color:var(--px-color-border-none-inverted)}:host([inverted]) details:not(.single).contained summary{color:var(--px-color-text-neutral-inverted)}:host([inverted]) details:not(.single).contained summary:hover{background-color:var(--px-color-background-none)}:host([inverted]) details:not(.single).contained:has(summary:hover){background-color:var(--px-color-background-state-hover-bordered-inverted);border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) details.single summary{color:var(--px-color-text-brand-inverted)}:host([inverted]) details.single summary:hover{border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) details.single summary:hover .arrow-icon{background-color:#0000;border-color:#0000}:host([inverted]) details[open] summary slot[name=title]{color:var(--px-color-text-brand-inverted)}@media screen and (width>=48rem){details summary{font-size:var(--px-text-size-label-m-tablet)}details:not(.single) slot[name=content]{padding:var(--px-padding-m-tablet)}details:not(.single) summary{padding:var(--px-padding-m-tablet);gap:var(--px-spacing-s-tablet)}details:not(.single).contained summary{padding:var(--px-padding-m-tablet);font-size:var(--px-text-size-label-l-tablet)}details.single summary{padding-block:var(--px-padding-2xs-tablet);gap:var(--px-spacing-xs-tablet)}details.single summary:hover{gap:var(--px-spacing-2xs-tablet);padding:var(--px-padding-2xs-tablet) var(--px-padding-s-tablet)}details.single summary:hover .arrow-icon{margin-right:calc(var(--px-padding-xs-tablet) * -1)}details.single slot[name=content]{padding-top:var(--px-spacing-s-tablet)}}@media screen and (width>=64.0625rem){details summary{font-size:var(--px-text-size-label-m-laptop)}details:not(.single) slot[name=content]{padding:var(--px-padding-m-laptop)}details:not(.single) summary{padding:var(--px-padding-m-laptop);gap:var(--px-spacing-s-laptop)}details:not(.single).contained summary{font-size:var(--px-text-size-label-l-laptop);padding:var(--px-padding-m-laptop)}details.single summary{padding-block:var(--px-padding-2xs-laptop);gap:var(--px-spacing-xs-laptop)}details.single summary:hover{gap:var(--px-spacing-2xs-laptop);padding:var(--px-padding-2xs-laptop) var(--px-padding-s-laptop)}details.single summary:hover .arrow-icon{margin-right:calc(var(--px-padding-xs-laptop) * -1)}details.single slot[name=content]{padding-top:var(--px-spacing-s-laptop)}}", a = new CSSStyleSheet();
5
+ a.replaceSync(i);
6
+ var o = [
7
+ "",
8
+ "none",
9
+ "single",
10
+ "contained"
11
+ ], s = [
12
+ "",
13
+ "container-default",
14
+ "container-light"
15
+ ], c = class i extends e {
16
+ static {
17
+ this.template = t("<details><summary><slot name=\"icon\"></slot><slot name=\"title\"></slot><slot name=\"info\"></slot><span class=\"arrow-icon\"></span></summary><slot name=\"content\"></slot></details>");
18
+ }
19
+ static {
20
+ this.nativeName = "details";
21
+ }
22
+ constructor() {
23
+ super(a), this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), r(this.shadowRoot, i.template);
24
+ }
25
+ static get observedAttributes() {
26
+ return [
27
+ ...super.observedAttributes,
28
+ "variant",
29
+ "background-color",
30
+ "inverted",
31
+ "no-content-padding"
32
+ ];
33
+ }
34
+ connectedCallback() {
35
+ this.isSafari && this.$summary.setAttribute("role", "button"), this.$details && this.$summary && (this.updateAriaExpanded(), this.$details.addEventListener("toggle", () => {
36
+ this.updateAriaExpanded();
37
+ }));
38
+ }
39
+ attributeChangedCallback(e, t, n) {
40
+ if (t !== n) switch (e) {
41
+ case "variant":
42
+ this.updateAttribute(e, t, n, o);
43
+ break;
44
+ case "background-color":
45
+ this.updateBackgroundColor(e, n, s);
46
+ break;
47
+ default: super.attributeChangedCallback(e, t, n);
48
+ }
49
+ }
50
+ updateAttribute(e, t, r, i) {
51
+ t !== null && t !== "" && this.$el.classList.toggle(`${t}`), r !== null && r !== "" && this.$el.classList.toggle(`${r}`), this.checkName(i, r) || n(`"${r}" is not an allowed ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${i.join("\", \"")}".`);
52
+ }
53
+ updateBackgroundColor(e, t, r) {
54
+ this.checkName(r, t) ? (this.$el.style.setProperty(`--accordion-contained-${e}-default`, `var(--px-color-background-${t}-default)`), this.$el.style.setProperty(`--accordion-contained-${e}-inverted`, `var(--px-color-background-${t}-inverted)`)) : n(`"${t}" is not an allowed ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${r.join("\", \"")}".`);
55
+ }
56
+ updateAriaExpanded() {
57
+ this.$summary.setAttribute("aria-expanded", this.$details.hasAttribute("open") ? "true" : "false");
58
+ }
59
+ get $summary() {
60
+ return this.shadowRoot.querySelector("summary");
61
+ }
62
+ get $details() {
63
+ return this.shadowRoot.querySelector("details");
64
+ }
65
+ get variant() {
66
+ return this.getAttribute("variant");
67
+ }
68
+ set variant(e) {
69
+ this._updateAttribute("variant", e);
70
+ }
71
+ get backgroundColor() {
72
+ return this.getAttribute("background-color");
73
+ }
74
+ set backgroundColor(e) {
75
+ this._updateAttribute("background-color", e);
76
+ }
77
+ get inverted() {
78
+ return this.hasAttribute("inverted");
79
+ }
80
+ set inverted(e) {
81
+ this._updateBooleanAttribute("inverted", e);
82
+ }
83
+ get noContentPadding() {
84
+ return this.hasAttribute("no-content-padding");
85
+ }
86
+ set noContentPadding(e) {
87
+ this._updateBooleanAttribute("no-content-padding", e);
88
+ }
118
89
  };
90
+ customElements.get("px-accordion") || customElements.define("px-accordion", c);
91
+ //#endregion
92
+ export { c as Accordion, s as accordionBackgroundColorValues, o as accordionVariantValues };
@@ -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,17 @@
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-accordion",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "variant", "values": [] },
10
+ { "name": "background-color", "values": [] },
11
+ { "name": "inverted", "values": [] },
12
+ { "name": "no-content-padding", "values": [] }
13
+ ],
14
+ "references": []
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-accordion",
4
+ "version": "2.0.0-alpha.211",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-accordion",
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": "inverted", "value": { "type": "string" } },
17
+ { "name": "no-content-padding", "value": { "type": "string" } }
18
+ ],
19
+ "events": [],
20
+ "js": {
21
+ "properties": [
22
+ { "name": "$summary" },
23
+ { "name": "$details" },
24
+ { "name": "variant" },
25
+ { "name": "backgroundColor" },
26
+ { "name": "inverted" },
27
+ { "name": "noContentPadding" }
28
+ ],
29
+ "events": []
30
+ }
31
+ }
32
+ ]
33
+ },
34
+ "css": {
35
+ "properties": [],
36
+ "pseudo-elements": []
37
+ }
38
+ }
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-accordion",
3
- "version": "2.0.0-alpha.21",
3
+ "version": "2.0.0-alpha.211",
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 && 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"