@descope-ui/descope-collapsible-container 0.0.6 → 0.0.8
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/CHANGELOG.md +14 -0
- package/package.json +5 -5
- package/src/component/CollapsibleContainerClass.js +48 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.8](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-collapsible-container-0.0.7...@descope-ui/descope-collapsible-container-0.0.8) (2025-06-03)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@descope-ui/descope-icon` updated to version `0.0.8`
|
|
10
|
+
## [0.0.7](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-collapsible-container-0.0.6...@descope-ui/descope-collapsible-container-0.0.7) (2025-05-28)
|
|
11
|
+
|
|
12
|
+
### Dependency Updates
|
|
13
|
+
|
|
14
|
+
* `e2e-utils` updated to version `0.0.1`
|
|
15
|
+
* `@descope-ui/common` updated to version `0.0.12`
|
|
16
|
+
* `@descope-ui/theme-globals` updated to version `0.0.12`
|
|
17
|
+
* `@descope-ui/descope-text` updated to version `0.0.12`
|
|
18
|
+
* `@descope-ui/descope-icon` updated to version `0.0.7`
|
|
5
19
|
## [0.0.6](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-collapsible-container-0.0.5...@descope-ui/descope-collapsible-container-0.0.6) (2025-04-29)
|
|
6
20
|
|
|
7
21
|
### Dependency Updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope-ui/descope-collapsible-container",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./src/component/index.js"
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"test-drivers": "0.0.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@descope-ui/common": "0.0.
|
|
22
|
-
"@descope-ui/theme-globals": "0.0.
|
|
23
|
-
"@descope-ui/descope-text": "0.0.
|
|
24
|
-
"@descope-ui/descope-icon": "0.0.
|
|
21
|
+
"@descope-ui/common": "0.0.12",
|
|
22
|
+
"@descope-ui/theme-globals": "0.0.12",
|
|
23
|
+
"@descope-ui/descope-text": "0.0.12",
|
|
24
|
+
"@descope-ui/descope-icon": "0.0.8"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"link-workspace-packages": false
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createStyleMixin,
|
|
3
|
+
draggableMixin,
|
|
4
|
+
componentNameValidationMixin,
|
|
5
|
+
} from '@descope-ui/common/components-mixins';
|
|
2
6
|
import { createBaseClass } from '@descope-ui/common/base-classes';
|
|
3
7
|
import { compose } from '@descope-ui/common/utils';
|
|
4
8
|
import {
|
|
5
9
|
forwardAttrs,
|
|
6
10
|
getComponentName,
|
|
7
|
-
injectStyle
|
|
11
|
+
injectStyle,
|
|
8
12
|
} from '@descope-ui/common/components-helpers';
|
|
9
13
|
import chevronIcon from './chevron.svg';
|
|
10
14
|
import { TextClass } from '@descope-ui/descope-text/class';
|
|
11
15
|
|
|
12
16
|
export const componentName = getComponentName('collapsible-container');
|
|
13
17
|
|
|
14
|
-
class RawCollapsibleContainer extends createBaseClass({
|
|
18
|
+
class RawCollapsibleContainer extends createBaseClass({
|
|
19
|
+
componentName,
|
|
20
|
+
baseSelector: 'slot',
|
|
21
|
+
}) {
|
|
15
22
|
static get observedAttributes() {
|
|
16
23
|
return ['collapsed', 'collapsible', 'text'];
|
|
17
24
|
}
|
|
@@ -23,7 +30,9 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
23
30
|
<div class="wrapper">
|
|
24
31
|
<descope-text st-host-direction="ltr">
|
|
25
32
|
<div class="header">
|
|
26
|
-
<
|
|
33
|
+
<div class="icon">
|
|
34
|
+
<descope-icon st-fill="currentcolor" src=${chevronIcon}></descope-icon>
|
|
35
|
+
</div>
|
|
27
36
|
<span></span>
|
|
28
37
|
</div>
|
|
29
38
|
</descope-text>
|
|
@@ -38,7 +47,6 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
38
47
|
div.content {
|
|
39
48
|
transition-property: max-height;
|
|
40
49
|
overflow: auto;
|
|
41
|
-
transition-property: max-height;
|
|
42
50
|
height: auto;
|
|
43
51
|
}
|
|
44
52
|
slot {
|
|
@@ -57,11 +65,15 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
57
65
|
display: flex;
|
|
58
66
|
align-items: baseline;
|
|
59
67
|
}
|
|
60
|
-
|
|
61
|
-
transition-property: transform;
|
|
68
|
+
.icon {
|
|
62
69
|
flex-shrink: 0;
|
|
63
70
|
height: var(${TextClass.cssVarList.textLineHeight});
|
|
64
71
|
min-height: 24px;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
}
|
|
75
|
+
descope-icon {
|
|
76
|
+
transition-property: transform;
|
|
65
77
|
}
|
|
66
78
|
.rotate {
|
|
67
79
|
transform: rotate(-180deg);
|
|
@@ -84,18 +96,18 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
84
96
|
flex-direction: column;
|
|
85
97
|
}
|
|
86
98
|
`,
|
|
87
|
-
this
|
|
99
|
+
this,
|
|
88
100
|
);
|
|
89
101
|
|
|
90
102
|
this.header = this.shadowRoot.querySelector('.header');
|
|
91
103
|
this.content = this.shadowRoot.querySelector('div.content');
|
|
92
|
-
this.icon = this.header.querySelector('descope-icon')
|
|
104
|
+
this.icon = this.header.querySelector('descope-icon');
|
|
93
105
|
this.headerText = this.header.querySelector('span');
|
|
94
106
|
this.textComponent = this.shadowRoot.querySelector('descope-text');
|
|
95
107
|
}
|
|
96
108
|
|
|
97
109
|
get isCollapsible() {
|
|
98
|
-
return this.getAttribute('collapsible') === 'true'
|
|
110
|
+
return this.getAttribute('collapsible') === 'true';
|
|
99
111
|
}
|
|
100
112
|
|
|
101
113
|
calcContentHeight() {
|
|
@@ -112,8 +124,8 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
112
124
|
|
|
113
125
|
collapse(animated = false) {
|
|
114
126
|
const final = () => {
|
|
115
|
-
this.content.style.maxHeight = '0px'
|
|
116
|
-
}
|
|
127
|
+
this.content.style.maxHeight = '0px';
|
|
128
|
+
};
|
|
117
129
|
this.icon.classList.add('rotate');
|
|
118
130
|
if (!animated) return final();
|
|
119
131
|
|
|
@@ -124,7 +136,7 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
124
136
|
expand(animated = false) {
|
|
125
137
|
const final = () => {
|
|
126
138
|
this.content.style.maxHeight = '';
|
|
127
|
-
}
|
|
139
|
+
};
|
|
128
140
|
this.icon.classList.remove('rotate');
|
|
129
141
|
if (!animated) return final();
|
|
130
142
|
|
|
@@ -142,11 +154,11 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
142
154
|
|
|
143
155
|
this.header.addEventListener('click', () => {
|
|
144
156
|
if (!this.isCollapsible) return;
|
|
145
|
-
this.toggle()
|
|
157
|
+
this.toggle();
|
|
146
158
|
});
|
|
147
159
|
forwardAttrs(this, this.textComponent, {
|
|
148
160
|
includeAttrs: ['text-align', 'text-variant', 'text-mode'],
|
|
149
|
-
mapAttrs: { 'text-mode': 'mode', 'text-variant': 'variant' }
|
|
161
|
+
mapAttrs: { 'text-mode': 'mode', 'text-variant': 'variant' },
|
|
150
162
|
});
|
|
151
163
|
}
|
|
152
164
|
|
|
@@ -158,7 +170,7 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
158
170
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
159
171
|
if (name === 'text') {
|
|
160
172
|
this.updateHeaderText();
|
|
161
|
-
return
|
|
173
|
+
return;
|
|
162
174
|
}
|
|
163
175
|
const collapsed = this.isCollapsed && this.isCollapsible;
|
|
164
176
|
if (collapsed) {
|
|
@@ -172,19 +184,26 @@ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelec
|
|
|
172
184
|
const selectors = {
|
|
173
185
|
host: () => ':host',
|
|
174
186
|
icon: () => 'descope-icon',
|
|
187
|
+
iconWrapper: () => '.icon',
|
|
175
188
|
header: () => '.header',
|
|
176
189
|
text: () => 'span',
|
|
177
190
|
wrapper: () => '.wrapper',
|
|
178
191
|
content: () => 'div.content',
|
|
179
|
-
}
|
|
192
|
+
};
|
|
180
193
|
|
|
181
194
|
export const CollapsibleContainerClass = compose(
|
|
182
195
|
createStyleMixin({
|
|
183
196
|
mappings: {
|
|
184
197
|
hostWidth: { selector: selectors.host, property: 'width' },
|
|
185
198
|
hostDirection: { selector: selectors.host, property: 'direction' },
|
|
186
|
-
verticalPadding: [
|
|
187
|
-
|
|
199
|
+
verticalPadding: [
|
|
200
|
+
{ selector: selectors.wrapper, property: 'padding-top' },
|
|
201
|
+
{ selector: selectors.wrapper, property: 'padding-bottom' },
|
|
202
|
+
],
|
|
203
|
+
horizontalPadding: [
|
|
204
|
+
{ selector: selectors.wrapper, property: 'padding-left' },
|
|
205
|
+
{ selector: selectors.wrapper, property: 'padding-right' },
|
|
206
|
+
],
|
|
188
207
|
|
|
189
208
|
flexDirection: {},
|
|
190
209
|
justifyContent: {},
|
|
@@ -205,15 +224,21 @@ export const CollapsibleContainerClass = compose(
|
|
|
205
224
|
|
|
206
225
|
boxShadow: { selector: selectors.wrapper },
|
|
207
226
|
|
|
208
|
-
headerIconOrder: { selector: selectors.
|
|
227
|
+
headerIconOrder: { selector: selectors.iconWrapper, property: 'order' },
|
|
209
228
|
headerCursor: { selector: selectors.header, property: 'cursor' },
|
|
210
229
|
headerGap: { selector: selectors.header, property: 'gap' },
|
|
211
230
|
textGrow: { selector: selectors.text, property: 'flex-grow' },
|
|
212
231
|
textDirection: { selector: selectors.text, property: 'direction' },
|
|
213
|
-
iconAnimationDuration: {
|
|
214
|
-
|
|
232
|
+
iconAnimationDuration: {
|
|
233
|
+
selector: selectors.icon,
|
|
234
|
+
property: 'transition-duration',
|
|
235
|
+
},
|
|
236
|
+
contentAnimationDuration: {
|
|
237
|
+
selector: selectors.content,
|
|
238
|
+
property: 'transition-duration',
|
|
239
|
+
},
|
|
215
240
|
},
|
|
216
241
|
}),
|
|
217
242
|
draggableMixin,
|
|
218
|
-
componentNameValidationMixin
|
|
243
|
+
componentNameValidationMixin,
|
|
219
244
|
)(RawCollapsibleContainer);
|