@teipublisher/pb-components 2.26.0-next-3.8 → 2.26.0-next-3.10
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/dist/{iron-form-b76df6d4.js → iron-form-277f9d42.js} +1 -1
- package/dist/{paper-listbox-9b2edde9.js → paper-listbox-c2468542.js} +46 -46
- package/dist/pb-components-bundle.js +38 -35
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +15 -38
- package/dist/pb-odd-editor.js +60 -56
- package/dist/{vaadin-element-mixin-497e09e1.js → vaadin-element-mixin-6633322b.js} +111 -70
- package/package.json +1 -2
- package/pb-elements.json +15 -38
- package/src/pb-authority-lookup.js +96 -94
- package/src/pb-collapse.js +106 -51
- package/src/pb-odd-editor.js +24 -26
- package/src/pb-odd-elementspec-editor.js +3 -3
- package/src/pb-odd-model-editor.js +31 -25
package/pb-elements.json
CHANGED
|
@@ -792,7 +792,7 @@
|
|
|
792
792
|
},
|
|
793
793
|
{
|
|
794
794
|
"name": "pb-authority-new-entity",
|
|
795
|
-
"description": "
|
|
795
|
+
"description": "Fiaured when user clicks the add new entity button"
|
|
796
796
|
},
|
|
797
797
|
{
|
|
798
798
|
"name": "pb-authority-lookup",
|
|
@@ -2587,15 +2587,9 @@
|
|
|
2587
2587
|
"path": "./src/pb-collapse.js",
|
|
2588
2588
|
"description": "A collapsible block: in collapsed state it only shows a header and expands if clicked.\nThe header should go into slot `collapse-trigger`, the content into `collapse-content`.\nExample:\n\n```html\n<pb-collapse>\n <div slot=\"collapse-trigger\">\n Metadata\n </div>\n <pb-view slot=\"collapse-content\" src=\"document1\" subscribe=\"transcription\" xpath=\"//teiHeader\"></pb-view>\n</pb-collapse>\n```\n\nBy adding a CSS 'icon-right' to a `pb-collapse` the icon can be placed on the right side\n```\n<pb-collapse class='icon-right'>\n```",
|
|
2589
2589
|
"attributes": [
|
|
2590
|
-
{
|
|
2591
|
-
"name": "horizontal",
|
|
2592
|
-
"type": "boolean",
|
|
2593
|
-
"default": "false",
|
|
2594
|
-
"deprecatedMessage": "Corresponds to the iron-collapse's horizontal property."
|
|
2595
|
-
},
|
|
2596
2590
|
{
|
|
2597
2591
|
"name": "no-animation",
|
|
2598
|
-
"description": "
|
|
2592
|
+
"description": "Whether to disable animations.",
|
|
2599
2593
|
"type": "boolean",
|
|
2600
2594
|
"default": "false"
|
|
2601
2595
|
},
|
|
@@ -2605,24 +2599,6 @@
|
|
|
2605
2599
|
"type": "boolean",
|
|
2606
2600
|
"default": "false"
|
|
2607
2601
|
},
|
|
2608
|
-
{
|
|
2609
|
-
"name": "expand-icon",
|
|
2610
|
-
"description": "The iron-icon when collapsed. Value must be one of the icons defined by iron-icons",
|
|
2611
|
-
"type": "string",
|
|
2612
|
-
"default": "\"icons:expand-more\""
|
|
2613
|
-
},
|
|
2614
|
-
{
|
|
2615
|
-
"name": "collapse-icon",
|
|
2616
|
-
"description": "The icon when expanded.",
|
|
2617
|
-
"type": "string",
|
|
2618
|
-
"default": "\"icons:expand-less\""
|
|
2619
|
-
},
|
|
2620
|
-
{
|
|
2621
|
-
"name": "no-icons",
|
|
2622
|
-
"description": "Whether to hide the expand/collapse icon.",
|
|
2623
|
-
"type": "boolean",
|
|
2624
|
-
"default": "false"
|
|
2625
|
-
},
|
|
2626
2602
|
{
|
|
2627
2603
|
"name": "toggles",
|
|
2628
2604
|
"description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\nSet to true to keep multiple pb-collapse open at the same time.",
|
|
@@ -2664,15 +2640,13 @@
|
|
|
2664
2640
|
"properties": [
|
|
2665
2641
|
{
|
|
2666
2642
|
"name": "horizontal",
|
|
2667
|
-
"attribute": "horizontal",
|
|
2668
2643
|
"type": "boolean",
|
|
2669
|
-
"default": "false"
|
|
2670
|
-
"deprecatedMessage": "Corresponds to the iron-collapse's horizontal property."
|
|
2644
|
+
"default": "false"
|
|
2671
2645
|
},
|
|
2672
2646
|
{
|
|
2673
2647
|
"name": "noAnimation",
|
|
2674
2648
|
"attribute": "no-animation",
|
|
2675
|
-
"description": "
|
|
2649
|
+
"description": "Whether to disable animations.",
|
|
2676
2650
|
"type": "boolean",
|
|
2677
2651
|
"default": "false"
|
|
2678
2652
|
},
|
|
@@ -2685,22 +2659,16 @@
|
|
|
2685
2659
|
},
|
|
2686
2660
|
{
|
|
2687
2661
|
"name": "expandIcon",
|
|
2688
|
-
"attribute": "expand-icon",
|
|
2689
|
-
"description": "The iron-icon when collapsed. Value must be one of the icons defined by iron-icons",
|
|
2690
2662
|
"type": "string",
|
|
2691
2663
|
"default": "\"icons:expand-more\""
|
|
2692
2664
|
},
|
|
2693
2665
|
{
|
|
2694
2666
|
"name": "collapseIcon",
|
|
2695
|
-
"attribute": "collapse-icon",
|
|
2696
|
-
"description": "The icon when expanded.",
|
|
2697
2667
|
"type": "string",
|
|
2698
2668
|
"default": "\"icons:expand-less\""
|
|
2699
2669
|
},
|
|
2700
2670
|
{
|
|
2701
2671
|
"name": "noIcons",
|
|
2702
|
-
"attribute": "no-icons",
|
|
2703
|
-
"description": "Whether to hide the expand/collapse icon.",
|
|
2704
2672
|
"type": "boolean",
|
|
2705
2673
|
"default": "false"
|
|
2706
2674
|
},
|
|
@@ -2768,8 +2736,17 @@
|
|
|
2768
2736
|
"cssProperties": [
|
|
2769
2737
|
{
|
|
2770
2738
|
"name": "--pb-collapse-icon-padding",
|
|
2771
|
-
"description": "padding
|
|
2772
|
-
"default": "\"
|
|
2739
|
+
"description": "padding left or right of the \"caret\" icon left to the collapsible item",
|
|
2740
|
+
"default": "\".5rem\""
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
"name": "--pb-collapse-icon-size",
|
|
2744
|
+
"description": "size of the \"caret\" icon left to the collapsible item",
|
|
2745
|
+
"default": "\".75rem\""
|
|
2746
|
+
},
|
|
2747
|
+
{
|
|
2748
|
+
"name": "--pb-collapse-icon-image",
|
|
2749
|
+
"description": "image of the \"caret\" icon left to the collapsible item"
|
|
2773
2750
|
}
|
|
2774
2751
|
]
|
|
2775
2752
|
},
|
|
@@ -11,7 +11,7 @@ import "./pb-restricted.js";
|
|
|
11
11
|
*
|
|
12
12
|
* @fires pb-authority-select - Fired when user selects an entry from the list
|
|
13
13
|
* @fires pb-authority-edit-entity - Fired when user clicks the edit button next to an entry
|
|
14
|
-
* @fires pb-authority-new-entity -
|
|
14
|
+
* @fires pb-authority-new-entity - Fiaured when user clicks the add new entity button
|
|
15
15
|
* @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
|
|
16
16
|
* authority type
|
|
17
17
|
*/
|
|
@@ -167,36 +167,110 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
|
|
|
167
167
|
_formatItem(item) {
|
|
168
168
|
return html`
|
|
169
169
|
<li>
|
|
170
|
-
<
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
<div>
|
|
171
|
+
<button @click="${() => this._select(item)}" title="link to">
|
|
172
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><path d="M208 352h-64a96 96 0 010-192h64M304 160h64a96 96 0 010 192h-64M163.29 256h187.42" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="36"/></svg>
|
|
173
|
+
</button>
|
|
174
174
|
${item.link
|
|
175
175
|
? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
|
|
176
176
|
: html`${unsafeHTML(item.label)}`
|
|
177
177
|
}
|
|
178
|
+
<div class="badges">
|
|
179
|
+
${item.occurrences > 0 ? html`<span class="occurrences badge" part="occurrences">${item.occurrences}</span>` : null}
|
|
180
|
+
${item.provider ? html`<span class="source badge" part="source">${item.provider}</span>` :null}
|
|
181
|
+
<span class="register badge" part="register">${item.register}</span>
|
|
182
|
+
${
|
|
183
|
+
this._authorities[this.type] && this._authorities[this.type].editable ?
|
|
184
|
+
html`
|
|
185
|
+
<pb-restricted group="${this.group}">
|
|
186
|
+
<button
|
|
187
|
+
@click="${() => this._editEntity(item)}"
|
|
188
|
+
title="${translate('annotations.edit-entity')}">
|
|
189
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><path d="M384 224v184a40 40 0 01-40 40H104a40 40 0 01-40-40V168a40 40 0 0140-40h167.48" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path d="M459.94 53.25a16.06 16.06 0 00-23.22-.56L424.35 65a8 8 0 000 11.31l11.34 11.32a8 8 0 0011.34 0l12.06-12c6.1-6.09 6.67-16.01.85-22.38zM399.34 90L218.82 270.2a9 9 0 00-2.31 3.93L208.16 299a3.91 3.91 0 004.86 4.86l24.85-8.35a9 9 0 003.93-2.31L422 112.66a9 9 0 000-12.66l-9.95-10a9 9 0 00-12.71 0z"/></svg>
|
|
190
|
+
</button>
|
|
191
|
+
</pb-restricted>` : null
|
|
192
|
+
}
|
|
193
|
+
</div>
|
|
178
194
|
</div>
|
|
179
|
-
${item.
|
|
180
|
-
${item.provider ? html`<div><span class="source badge" part="source">${item.provider}</span></div>` :null}
|
|
181
|
-
<div><span class="register badge" part="register">${item.register}</span></div>
|
|
182
|
-
|
|
183
|
-
${
|
|
184
|
-
this._authorities[this.type] && this._authorities[this.type].editable ?
|
|
185
|
-
html`
|
|
186
|
-
<pb-restricted group="${this.group}">
|
|
187
|
-
<button
|
|
188
|
-
@click="${() => this._editEntity(item)}"
|
|
189
|
-
title="${translate('annotations.edit-entity')}">
|
|
190
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><path d="M384 224v184a40 40 0 01-40 40H104a40 40 0 01-40-40V168a40 40 0 0140-40h167.48" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path d="M459.94 53.25a16.06 16.06 0 00-23.22-.56L424.35 65a8 8 0 000 11.31l11.34 11.32a8 8 0 0011.34 0l12.06-12c6.1-6.09 6.67-16.01.85-22.38zM399.34 90L218.82 270.2a9 9 0 00-2.31 3.93L208.16 299a3.91 3.91 0 004.86 4.86l24.85-8.35a9 9 0 003.93-2.31L422 112.66a9 9 0 000-12.66l-9.95-10a9 9 0 00-12.71 0z"/></svg>
|
|
191
|
-
</button>
|
|
192
|
-
</pb-restricted>` : null
|
|
193
|
-
}
|
|
194
|
-
${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
|
|
195
|
-
|
|
195
|
+
${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
|
|
196
196
|
</li>
|
|
197
197
|
`;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
static get styles() {
|
|
201
|
+
return css`
|
|
202
|
+
:host {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
header {
|
|
208
|
+
display: flex;
|
|
209
|
+
justify-content: space-between;
|
|
210
|
+
align-items: center;
|
|
211
|
+
margin-bottom: 1rem;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
header > input {
|
|
215
|
+
flex-grow: 1;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.link {
|
|
219
|
+
flex-grow: 2;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
#output {
|
|
223
|
+
overflow: auto;
|
|
224
|
+
/*FireFox*/
|
|
225
|
+
scrollbar-width: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
#output > ul {
|
|
229
|
+
width: 100%;
|
|
230
|
+
padding: 0;
|
|
231
|
+
list-style: none;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
#output > ul > li {
|
|
235
|
+
border-bottom: 1px solid var(--pb-color-border);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
#output > ul > li > div {
|
|
239
|
+
display: flex;
|
|
240
|
+
justify-content: space-between;
|
|
241
|
+
align-items: center;
|
|
242
|
+
flex-wrap: wrap;
|
|
243
|
+
gap: .125rem;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
#output > ul > li > div > a {
|
|
247
|
+
flex-grow: 2;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.badges {
|
|
251
|
+
display: inline-flex;
|
|
252
|
+
gap: .125rem;
|
|
253
|
+
align-items: center;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.badge {
|
|
257
|
+
font-size: .75rem;
|
|
258
|
+
border-radius: 4px;
|
|
259
|
+
padding: 4px;
|
|
260
|
+
color: var(--pb-color-inverse);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.source {
|
|
264
|
+
background-color: #637b8c;
|
|
265
|
+
}
|
|
266
|
+
.register {
|
|
267
|
+
background-color: var(--pb-color-lighter, #35424b);
|
|
268
|
+
}
|
|
269
|
+
.occurrences {
|
|
270
|
+
background-color: var(--pb-color-focus, #f6a623);
|
|
271
|
+
}
|
|
272
|
+
`;
|
|
273
|
+
}
|
|
200
274
|
|
|
201
275
|
_select(item) {
|
|
202
276
|
const connector = this._authorities[item.register];
|
|
@@ -294,77 +368,5 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
|
|
|
294
368
|
});
|
|
295
369
|
});
|
|
296
370
|
}
|
|
297
|
-
|
|
298
|
-
static get styles() {
|
|
299
|
-
return css`
|
|
300
|
-
:host {
|
|
301
|
-
display: flex;
|
|
302
|
-
flex-direction: column;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
header {
|
|
306
|
-
display: flex;
|
|
307
|
-
justify-content: space-between;
|
|
308
|
-
align-items: center;
|
|
309
|
-
margin-bottom: 1rem;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
header > input {
|
|
313
|
-
flex-grow: 1;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.link {
|
|
317
|
-
flex-grow: 2;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
#output {
|
|
321
|
-
overflow: auto;
|
|
322
|
-
/*FireFox*/
|
|
323
|
-
scrollbar-width: none;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
#output ul {
|
|
327
|
-
width: 100%;
|
|
328
|
-
padding: 0;
|
|
329
|
-
list-style: none;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
#output li {
|
|
333
|
-
display: flex;
|
|
334
|
-
justify-content: space-between;
|
|
335
|
-
flex-wrap: wrap;
|
|
336
|
-
align-items: center;
|
|
337
|
-
gap: .125rem;
|
|
338
|
-
border-bottom: 1px solid #efefef;
|
|
339
|
-
}
|
|
340
|
-
#output li:hover{
|
|
341
|
-
background:#efefef;
|
|
342
|
-
}
|
|
343
|
-
#output li button {
|
|
344
|
-
display: block;
|
|
345
|
-
}
|
|
346
|
-
#output td:nth-child(3), #output td:nth-child(4), #output td:nth-child(5) {
|
|
347
|
-
text-align: right;
|
|
348
|
-
vertical-align: middle;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.badge {
|
|
352
|
-
font-size: .85rem;
|
|
353
|
-
border-radius: 4px;
|
|
354
|
-
padding: 4px;
|
|
355
|
-
color: var(--pb-color-inverse);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.source {
|
|
359
|
-
background-color: #637b8c;
|
|
360
|
-
}
|
|
361
|
-
.register {
|
|
362
|
-
background-color: var(--pb-color-lighter, #35424b);
|
|
363
|
-
}
|
|
364
|
-
.occurrences {
|
|
365
|
-
background-color: var(--pb-color-focus, #f6a623);
|
|
366
|
-
}
|
|
367
|
-
`;
|
|
368
|
-
}
|
|
369
371
|
}
|
|
370
372
|
customElements.define('pb-authority-lookup', PbAuthorityLookup);
|
package/src/pb-collapse.js
CHANGED
|
@@ -3,7 +3,6 @@ import {pbMixin} from './pb-mixin.js';
|
|
|
3
3
|
import {themableMixin} from "./theming.js";
|
|
4
4
|
import '@polymer/iron-icon';
|
|
5
5
|
import '@polymer/iron-icons';
|
|
6
|
-
import '@polymer/iron-collapse';
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -27,7 +26,9 @@ import '@polymer/iron-collapse';
|
|
|
27
26
|
*
|
|
28
27
|
* @slot collapse-trigger - trigger toggling collapsed content on/off
|
|
29
28
|
* @slot collapse-content - content to be collapsed
|
|
30
|
-
* @cssprop [--pb-collapse-icon-padding
|
|
29
|
+
* @cssprop [--pb-collapse-icon-padding=.5rem] - padding left or right of the "caret" icon left to the collapsible item
|
|
30
|
+
* @cssprop [--pb-collapse-icon-size=.75rem] - size of the "caret" icon left to the collapsible item
|
|
31
|
+
* @cssprop [--pb-collapse-icon-image] - image of the "caret" icon left to the collapsible item
|
|
31
32
|
* @fires pb-collapse-open - Fires opening the collapsed section
|
|
32
33
|
*/
|
|
33
34
|
export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
@@ -35,14 +36,7 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
35
36
|
return {
|
|
36
37
|
...super.properties,
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
* Corresponds to the iron-collapse's horizontal property.
|
|
40
|
-
*/
|
|
41
|
-
horizontal: {
|
|
42
|
-
type: Boolean
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* Corresponds to the iron-collapse's noAnimation property.
|
|
39
|
+
* Whether to disable animations.
|
|
46
40
|
*
|
|
47
41
|
*/
|
|
48
42
|
noAnimation: {
|
|
@@ -62,27 +56,6 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
62
56
|
*/
|
|
63
57
|
toggles: {
|
|
64
58
|
type: Boolean
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* The iron-icon when collapsed. Value must be one of the icons defined by iron-icons
|
|
68
|
-
*/
|
|
69
|
-
expandIcon: {
|
|
70
|
-
type: String,
|
|
71
|
-
attribute: 'expand-icon'
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* The icon when expanded.
|
|
75
|
-
*/
|
|
76
|
-
collapseIcon: {
|
|
77
|
-
type: String,
|
|
78
|
-
attribute: 'collapse-icon'
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* Whether to hide the expand/collapse icon.
|
|
82
|
-
*/
|
|
83
|
-
noIcons: {
|
|
84
|
-
type: Boolean,
|
|
85
|
-
attribute: 'no-icons'
|
|
86
59
|
}
|
|
87
60
|
};
|
|
88
61
|
}
|
|
@@ -118,6 +91,16 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
118
91
|
}
|
|
119
92
|
}
|
|
120
93
|
|
|
94
|
+
updated(changedProperties) {
|
|
95
|
+
super.updated(changedProperties);
|
|
96
|
+
if (changedProperties.has('opened')) {
|
|
97
|
+
const details = this.shadowRoot.querySelector('details');
|
|
98
|
+
if (details) {
|
|
99
|
+
details.open = this.opened;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
121
104
|
/**
|
|
122
105
|
* opens the collapsible section
|
|
123
106
|
*/
|
|
@@ -149,19 +132,21 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
149
132
|
}
|
|
150
133
|
}
|
|
151
134
|
|
|
135
|
+
_handleToggle(e) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
this.toggle();
|
|
138
|
+
}
|
|
139
|
+
|
|
152
140
|
render() {
|
|
153
141
|
return html`
|
|
154
|
-
<
|
|
155
|
-
${
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</
|
|
162
|
-
<iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
|
|
163
|
-
<slot name="collapse-content"></slot>
|
|
164
|
-
</iron-collapse>
|
|
142
|
+
<details ?open="${this.opened}" class="${this.horizontal ? 'horizontal' : ''}">
|
|
143
|
+
<summary @click="${this._handleToggle}" class="collapse-trigger">
|
|
144
|
+
<slot id="collapseTrigger" name="collapse-trigger"></slot>
|
|
145
|
+
</summary>
|
|
146
|
+
<div class="collapse-content ${this.noAnimation ? 'no-animation' : ''}">
|
|
147
|
+
<slot name="collapse-content"></slot>
|
|
148
|
+
</div>
|
|
149
|
+
</details>
|
|
165
150
|
`;
|
|
166
151
|
}
|
|
167
152
|
|
|
@@ -172,21 +157,91 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
172
157
|
position: relative;
|
|
173
158
|
}
|
|
174
159
|
|
|
175
|
-
|
|
176
|
-
display:
|
|
177
|
-
align-items:center;
|
|
178
|
-
grid-template-columns:min-content auto;
|
|
160
|
+
details {
|
|
161
|
+
display: block;
|
|
179
162
|
}
|
|
180
163
|
|
|
181
|
-
|
|
182
|
-
|
|
164
|
+
summary {
|
|
165
|
+
display: inline-flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
list-style: none;
|
|
169
|
+
outline: none;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
user-select: none;
|
|
172
|
+
gap: var(--pb-collapse-icon-padding, .5rem);
|
|
183
173
|
}
|
|
184
174
|
|
|
185
|
-
:host(.icon-right)
|
|
186
|
-
|
|
187
|
-
|
|
175
|
+
:host(:not(.icon-right)) summary::before {
|
|
176
|
+
display: block;
|
|
177
|
+
content: "";
|
|
178
|
+
background-image: var(--pb-collapse-icon-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E"));
|
|
179
|
+
transform: none;
|
|
180
|
+
height: var(--pb-collapse-icon-size, .75rem);
|
|
181
|
+
width: var(--pb-collapse-icon-size, .75rem);
|
|
182
|
+
background-size: var(--pb-collapse-icon-size, .75rem) auto;
|
|
183
|
+
background-position: left center;
|
|
184
|
+
background-repeat: no-repeat;
|
|
188
185
|
}
|
|
189
186
|
|
|
187
|
+
:host(.icon-right) summary::after {
|
|
188
|
+
display: block;
|
|
189
|
+
content: "";
|
|
190
|
+
background-image: var(--pb-collapse-icon-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E"));
|
|
191
|
+
transform: none;
|
|
192
|
+
height: var(--pb-collapse-icon-size, .75rem);
|
|
193
|
+
width: var(--pb-collapse-icon-size, .75rem);
|
|
194
|
+
background-size: var(--pb-collapse-icon-size, .75rem) auto;
|
|
195
|
+
background-position: right center;
|
|
196
|
+
background-repeat: no-repeat;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.dropdown-button[open]>summary::after {
|
|
200
|
+
transform: rotate(180deg);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.collapse-content {
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.collapse-content.no-animation {
|
|
209
|
+
transition: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
details[open] .collapse-content {
|
|
213
|
+
animation: slideDown 0.3s ease-in-out;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
details:not([open]) .collapse-content {
|
|
217
|
+
animation: slideUp 0.3s ease-in-out;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.horizontal .collapse-content {
|
|
221
|
+
transition: max-width 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@keyframes slideDown {
|
|
225
|
+
from {
|
|
226
|
+
opacity: 0;
|
|
227
|
+
max-height: 0;
|
|
228
|
+
}
|
|
229
|
+
to {
|
|
230
|
+
opacity: 1;
|
|
231
|
+
max-height: 1000px;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes slideUp {
|
|
236
|
+
from {
|
|
237
|
+
opacity: 1;
|
|
238
|
+
max-height: 1000px;
|
|
239
|
+
}
|
|
240
|
+
to {
|
|
241
|
+
opacity: 0;
|
|
242
|
+
max-height: 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
190
245
|
`;
|
|
191
246
|
}
|
|
192
247
|
}
|