@teipublisher/pb-components 2.1.1 → 2.3.0

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.
@@ -2500,7 +2500,7 @@
2500
2500
  {
2501
2501
  "name": "pb-collapse",
2502
2502
  "path": "./src/pb-collapse.js",
2503
- "description": "A collapsible block: in collapsed state it only shows a header and expands if clicked.\r\nThe header should go into slot `collapse-trigger`, the content into `collapse-content`.\r\nExample:\r\n\r\n```html\r\n<pb-collapse>\r\n <div slot=\"collapse-trigger\">\r\n Metadata\r\n </div>\r\n <pb-view slot=\"collapse-content\" src=\"document1\" subscribe=\"transcription\" xpath=\"//teiHeader\"></pb-view>\r\n</pb-collapse>\r\n```",
2503
+ "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```",
2504
2504
  "attributes": [
2505
2505
  {
2506
2506
  "name": "horizontal",
@@ -2540,7 +2540,7 @@
2540
2540
  },
2541
2541
  {
2542
2542
  "name": "toggles",
2543
- "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\r\nSet to true to keep multiple pb-collapse open at the same time.",
2543
+ "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.",
2544
2544
  "type": "boolean",
2545
2545
  "default": "false"
2546
2546
  },
@@ -2622,7 +2622,7 @@
2622
2622
  {
2623
2623
  "name": "toggles",
2624
2624
  "attribute": "toggles",
2625
- "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\r\nSet to true to keep multiple pb-collapse open at the same time.",
2625
+ "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.",
2626
2626
  "type": "boolean",
2627
2627
  "default": "false"
2628
2628
  },
@@ -8538,6 +8538,10 @@
8538
8538
  "name": "pb-load",
8539
8539
  "description": "Fires when user selects new page to show"
8540
8540
  },
8541
+ {
8542
+ "name": "pb-paginate",
8543
+ "description": "Fires when user selects new page to show"
8544
+ },
8541
8545
  {
8542
8546
  "name": "pb-results-received",
8543
8547
  "description": "When received, recalculates page ranges to display according to the parameters received"
@@ -9379,6 +9383,11 @@
9379
9383
  "name": "subforms",
9380
9384
  "type": "string"
9381
9385
  },
9386
+ {
9387
+ "name": "source",
9388
+ "description": "Optional URL to query for suggestions. If relative, it is interpreted\nrelative to the endpoint defined on a surrounding `pb-page`.\n\nUpon autocomplete, the current input by the user will be sent with a query parameter\n`query`. The name/values of form controls nested within `pb-search` or subforms will also be\nappended to the request as parameters. This allows the server side code to distinguish\ndifferent states.",
9389
+ "type": "string"
9390
+ },
9382
9391
  {
9383
9392
  "name": "name",
9384
9393
  "type": "string",
@@ -9462,6 +9471,12 @@
9462
9471
  "attribute": "subforms",
9463
9472
  "type": "string"
9464
9473
  },
9474
+ {
9475
+ "name": "source",
9476
+ "attribute": "source",
9477
+ "description": "Optional URL to query for suggestions. If relative, it is interpreted\nrelative to the endpoint defined on a surrounding `pb-page`.\n\nUpon autocomplete, the current input by the user will be sent with a query parameter\n`query`. The name/values of form controls nested within `pb-search` or subforms will also be\nappended to the request as parameters. This allows the server side code to distinguish\ndifferent states.",
9478
+ "type": "string"
9479
+ },
9465
9480
  {
9466
9481
  "name": "name",
9467
9482
  "attribute": "name",
@@ -9547,6 +9562,10 @@
9547
9562
  "name": "pb-load",
9548
9563
  "description": "Fired to perform the actual search with parameters passed to the request"
9549
9564
  },
9565
+ {
9566
+ "name": "pb-paginate",
9567
+ "description": "When received, triggers the search again with the new value of the start property"
9568
+ },
9550
9569
  {
9551
9570
  "name": "pb-search-resubmit",
9552
9571
  "description": "When received, triggers the search again"
@@ -1,4 +1,4 @@
1
- import{h as e,m as t,F as o,D as i,z as s,A as r,j as a,f as n}from"./paper-checkbox-102e3b43.js";import{E as d,T as l,D as p,p as c}from"./vaadin-element-mixin-672938e3.js";import{f as h,N as m,j as u,k as b,l as g,A as v,L as f,c as w,h as y,b as _,w as x,p as $}from"./pb-mixin-8a593923.js";import{t as E,g as S}from"./pb-i18n-8a90c591.js";import"./jinn-codemirror-9718e0e0.js";
1
+ import{h as e,m as t,F as o,D as i,z as s,A as r,j as a,f as n}from"./paper-checkbox-102e3b43.js";import{E as d,T as l,D as p,p as c}from"./vaadin-element-mixin-cef6f588.js";import{f as h,N as m,j as u,k as b,l as g,A as v,L as f,c as w,h as y,b as _,w as x,p as $}from"./pb-mixin-8a593923.js";import{t as E,g as S}from"./pb-i18n-8a90c591.js";import"./jinn-codemirror-9718e0e0.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -538,21 +538,24 @@ t({_template:e`
538
538
  `}static get styles(){return b`
539
539
  :host {
540
540
  display: block;
541
+ position: relative;
541
542
  }
542
543
 
543
544
  #trigger {
544
- display: table-row;
545
+ display: flex;
546
+ align-items:center
545
547
  }
546
548
 
547
- #trigger iron-icon {
548
- display: table-cell;
549
+ iron-icon {
549
550
  padding: var(--pb-collapse-icon-padding, 0 4px 0 0);
550
551
  }
551
552
 
552
- slot[name="collapse-trigger"] {
553
- display: table-cell;
553
+ :host(.icon-right) iron-icon {
554
+ position: absolute;
555
+ right: 0;
554
556
  }
555
- `}}customElements.define("pb-collapse",O);
557
+
558
+ `}}customElements.get("pb-collapse")||customElements.define("pb-collapse",O)
556
559
  /**
557
560
  @license
558
561
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
@@ -562,8 +565,7 @@ http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
562
565
  found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
563
566
  part of the polymer project is also subject to an additional IP rights grant
564
567
  found at http://polymer.github.io/PATENTS.txt
565
- */
566
- const T=document.createElement("template");T.setAttribute("style","display: none;"),T.innerHTML="<dom-module id=\"paper-item-shared-styles\">\n <template>\n <style>\n :host, .paper-item {\n display: block;\n position: relative;\n min-height: var(--paper-item-min-height, 48px);\n padding: 0px 16px;\n }\n\n .paper-item {\n @apply --paper-font-subhead;\n border:none;\n outline: none;\n background: white;\n width: 100%;\n text-align: left;\n }\n\n :host([hidden]), .paper-item[hidden] {\n display: none !important;\n }\n\n :host(.iron-selected), .paper-item.iron-selected {\n font-weight: var(--paper-item-selected-weight, bold);\n\n @apply --paper-item-selected;\n }\n\n :host([disabled]), .paper-item[disabled] {\n color: var(--paper-item-disabled-color, var(--disabled-text-color));\n\n @apply --paper-item-disabled;\n }\n\n :host(:focus), .paper-item:focus {\n position: relative;\n outline: 0;\n\n @apply --paper-item-focused;\n }\n\n :host(:focus):before, .paper-item:focus:before {\n @apply --layout-fit;\n\n background: currentColor;\n content: '';\n opacity: var(--dark-divider-opacity);\n pointer-events: none;\n\n @apply --paper-item-focused-before;\n }\n </style>\n </template>\n</dom-module>",document.head.appendChild(T.content);
568
+ */;const T=document.createElement("template");T.setAttribute("style","display: none;"),T.innerHTML="<dom-module id=\"paper-item-shared-styles\">\n <template>\n <style>\n :host, .paper-item {\n display: block;\n position: relative;\n min-height: var(--paper-item-min-height, 48px);\n padding: 0px 16px;\n }\n\n .paper-item {\n @apply --paper-font-subhead;\n border:none;\n outline: none;\n background: white;\n width: 100%;\n text-align: left;\n }\n\n :host([hidden]), .paper-item[hidden] {\n display: none !important;\n }\n\n :host(.iron-selected), .paper-item.iron-selected {\n font-weight: var(--paper-item-selected-weight, bold);\n\n @apply --paper-item-selected;\n }\n\n :host([disabled]), .paper-item[disabled] {\n color: var(--paper-item-disabled-color, var(--disabled-text-color));\n\n @apply --paper-item-disabled;\n }\n\n :host(:focus), .paper-item:focus {\n position: relative;\n outline: 0;\n\n @apply --paper-item-focused;\n }\n\n :host(:focus):before, .paper-item:focus:before {\n @apply --layout-fit;\n\n background: currentColor;\n content: '';\n opacity: var(--dark-divider-opacity);\n pointer-events: none;\n\n @apply --paper-item-focused-before;\n }\n </style>\n </template>\n</dom-module>",document.head.appendChild(T.content);
567
569
  /**
568
570
  @license
569
571
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/pb-elements.json CHANGED
@@ -2500,7 +2500,7 @@
2500
2500
  {
2501
2501
  "name": "pb-collapse",
2502
2502
  "path": "./src/pb-collapse.js",
2503
- "description": "A collapsible block: in collapsed state it only shows a header and expands if clicked.\r\nThe header should go into slot `collapse-trigger`, the content into `collapse-content`.\r\nExample:\r\n\r\n```html\r\n<pb-collapse>\r\n <div slot=\"collapse-trigger\">\r\n Metadata\r\n </div>\r\n <pb-view slot=\"collapse-content\" src=\"document1\" subscribe=\"transcription\" xpath=\"//teiHeader\"></pb-view>\r\n</pb-collapse>\r\n```",
2503
+ "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```",
2504
2504
  "attributes": [
2505
2505
  {
2506
2506
  "name": "horizontal",
@@ -2540,7 +2540,7 @@
2540
2540
  },
2541
2541
  {
2542
2542
  "name": "toggles",
2543
- "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\r\nSet to true to keep multiple pb-collapse open at the same time.",
2543
+ "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.",
2544
2544
  "type": "boolean",
2545
2545
  "default": "false"
2546
2546
  },
@@ -2622,7 +2622,7 @@
2622
2622
  {
2623
2623
  "name": "toggles",
2624
2624
  "attribute": "toggles",
2625
- "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\r\nSet to true to keep multiple pb-collapse open at the same time.",
2625
+ "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.",
2626
2626
  "type": "boolean",
2627
2627
  "default": "false"
2628
2628
  },
@@ -8538,6 +8538,10 @@
8538
8538
  "name": "pb-load",
8539
8539
  "description": "Fires when user selects new page to show"
8540
8540
  },
8541
+ {
8542
+ "name": "pb-paginate",
8543
+ "description": "Fires when user selects new page to show"
8544
+ },
8541
8545
  {
8542
8546
  "name": "pb-results-received",
8543
8547
  "description": "When received, recalculates page ranges to display according to the parameters received"
@@ -9379,6 +9383,11 @@
9379
9383
  "name": "subforms",
9380
9384
  "type": "string"
9381
9385
  },
9386
+ {
9387
+ "name": "source",
9388
+ "description": "Optional URL to query for suggestions. If relative, it is interpreted\nrelative to the endpoint defined on a surrounding `pb-page`.\n\nUpon autocomplete, the current input by the user will be sent with a query parameter\n`query`. The name/values of form controls nested within `pb-search` or subforms will also be\nappended to the request as parameters. This allows the server side code to distinguish\ndifferent states.",
9389
+ "type": "string"
9390
+ },
9382
9391
  {
9383
9392
  "name": "name",
9384
9393
  "type": "string",
@@ -9462,6 +9471,12 @@
9462
9471
  "attribute": "subforms",
9463
9472
  "type": "string"
9464
9473
  },
9474
+ {
9475
+ "name": "source",
9476
+ "attribute": "source",
9477
+ "description": "Optional URL to query for suggestions. If relative, it is interpreted\nrelative to the endpoint defined on a surrounding `pb-page`.\n\nUpon autocomplete, the current input by the user will be sent with a query parameter\n`query`. The name/values of form controls nested within `pb-search` or subforms will also be\nappended to the request as parameters. This allows the server side code to distinguish\ndifferent states.",
9478
+ "type": "string"
9479
+ },
9465
9480
  {
9466
9481
  "name": "name",
9467
9482
  "attribute": "name",
@@ -9547,6 +9562,10 @@
9547
9562
  "name": "pb-load",
9548
9563
  "description": "Fired to perform the actual search with parameters passed to the request"
9549
9564
  },
9565
+ {
9566
+ "name": "pb-paginate",
9567
+ "description": "When received, triggers the search again with the new value of the start property"
9568
+ },
9550
9569
  {
9551
9570
  "name": "pb-search-resubmit",
9552
9571
  "description": "When received, triggers the search again"
@@ -1,184 +1,194 @@
1
- import { LitElement, html, css } from 'lit-element';
2
- import { pbMixin } from './pb-mixin.js';
3
- import { themableMixin } from "./theming.js";
4
- import '@polymer/iron-icon';
5
- import '@polymer/iron-icons';
6
- import '@polymer/iron-collapse';
7
-
8
-
9
- /**
10
- * A collapsible block: in collapsed state it only shows a header and expands if clicked.
11
- * The header should go into slot `collapse-trigger`, the content into `collapse-content`.
12
- * Example:
13
- *
14
- * ```html
15
- * <pb-collapse>
16
- * <div slot="collapse-trigger">
17
- * Metadata
18
- * </div>
19
- * <pb-view slot="collapse-content" src="document1" subscribe="transcription" xpath="//teiHeader"></pb-view>
20
- * </pb-collapse>
21
- * ```
22
- *
23
- * @slot collapse-trigger - trigger toggling collapsed content on/off
24
- * @slot collapse-content - content to be collapsed
25
- * @cssprop [--pb-collapse-icon-padding=0 4px 0 0] - padding in px for the "caret-down" icon left to the collapsible item
26
- * @fires pb-collapse-open - Fires opening the collapsed section
27
- */
28
- export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
29
- static get properties() {
30
- return {
31
- ...super.properties,
32
- /**
33
- * @deprecated
34
- * Corresponds to the iron-collapse's horizontal property.
35
- */
36
- horizontal: {
37
- type: Boolean
38
- },
39
- /**
40
- * Corresponds to the iron-collapse's noAnimation property.
41
- *
42
- */
43
- noAnimation: {
44
- type: Boolean,
45
- attribute: 'no-animation'
46
- },
47
- /**
48
- * Whether currently expanded.
49
- *
50
- */
51
- opened: {
52
- type: Boolean
53
- },
54
- /**
55
- * By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.
56
- * Set to true to keep multiple pb-collapse open at the same time.
57
- */
58
- toggles: {
59
- type: Boolean
60
- },
61
- /**
62
- * The iron-icon when collapsed. Value must be one of the icons defined by iron-icons
63
- */
64
- expandIcon: {
65
- type: String,
66
- attribute: 'expand-icon'
67
- },
68
- /**
69
- * The icon when expanded.
70
- */
71
- collapseIcon: {
72
- type: String,
73
- attribute: 'collapse-icon'
74
- },
75
- /**
76
- * Whether to hide the expand/collapse icon.
77
- */
78
- noIcons: {
79
- type: Boolean,
80
- attribute: 'no-icons'
81
- }
82
- };
83
- }
84
-
85
- constructor() {
86
- super();
87
- this.horizontal = false;
88
- this.noAnimation = false;
89
- this.opened = false;
90
- this.expandIcon = 'icons:expand-more';
91
- this.collapseIcon = 'icons:expand-less';
92
- this.noIcons = false;
93
- this.toggles = false;
94
- }
95
-
96
- connectedCallback() {
97
- super.connectedCallback();
98
- this.addEventListener('pb-collapse-open', () => {
99
- this.open();
100
- });
101
- if (this.toggles) {
102
- this.subscribeTo('pb-collapse-open', (ev) => {
103
- if (!ev.detail || ev.detail._source === this) {
104
- return;
105
- }
106
- for (const collapse of this.querySelectorAll('pb-collapse')) {
107
- if (collapse === ev.detail._source) {
108
- return;
109
- }
110
- }
111
- this.close();
112
- });
113
- }
114
- }
115
-
116
- /**
117
- * opens the collapsible section
118
- */
119
- open() {
120
- if (this.opened) {
121
- return;
122
- }
123
- this.opened = true;
124
-
125
- this.emitTo('pb-collapse-open', this);
126
- }
127
-
128
- /**
129
- * closes the collapsible section
130
- */
131
- close() {
132
- if (this.opened) {
133
- this.opened = false;
134
- }
135
- }
136
-
137
- /**
138
- * toggles the collapsible state
139
- */
140
- toggle() {
141
- this.opened = !this.opened;
142
- if (this.opened) {
143
- this.emitTo('pb-collapse-open', this.data);
144
- }
145
- }
146
-
147
- render() {
148
- return html`
149
- <div id="trigger" @click="${this.toggle}" class="collapse-trigger">
150
- ${
151
- !this.noIcons ?
152
- html`<iron-icon icon="${this.opened ? this.collapseIcon : this.expandIcon}"></iron-icon>` :
153
- null
154
- }
155
- <slot id="collapseTrigger" name="collapse-trigger"></slot>
156
- </div>
157
- <iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
158
- <slot name="collapse-content"></slot>
159
- </iron-collapse>
160
- `;
161
- }
162
-
163
- static get styles() {
164
- return css`
165
- :host {
166
- display: block;
167
- }
168
-
169
- #trigger {
170
- display: table-row;
171
- }
172
-
173
- #trigger iron-icon {
174
- display: table-cell;
175
- padding: var(--pb-collapse-icon-padding, 0 4px 0 0);
176
- }
177
-
178
- slot[name="collapse-trigger"] {
179
- display: table-cell;
180
- }
181
- `;
182
- }
183
- }
184
- customElements.define('pb-collapse', PbCollapse);
1
+ import {LitElement, html, css} from 'lit-element';
2
+ import {pbMixin} from './pb-mixin.js';
3
+ import {themableMixin} from "./theming.js";
4
+ import '@polymer/iron-icon';
5
+ import '@polymer/iron-icons';
6
+ import '@polymer/iron-collapse';
7
+
8
+
9
+ /**
10
+ * A collapsible block: in collapsed state it only shows a header and expands if clicked.
11
+ * The header should go into slot `collapse-trigger`, the content into `collapse-content`.
12
+ * Example:
13
+ *
14
+ * ```html
15
+ * <pb-collapse>
16
+ * <div slot="collapse-trigger">
17
+ * Metadata
18
+ * </div>
19
+ * <pb-view slot="collapse-content" src="document1" subscribe="transcription" xpath="//teiHeader"></pb-view>
20
+ * </pb-collapse>
21
+ * ```
22
+ *
23
+ * By adding a CSS 'icon-right' to a `pb-collapse` the icon can be placed on the right side
24
+ * ```
25
+ * <pb-collapse class='icon-right'>
26
+ * ```
27
+ *
28
+ * @slot collapse-trigger - trigger toggling collapsed content on/off
29
+ * @slot collapse-content - content to be collapsed
30
+ * @cssprop [--pb-collapse-icon-padding=0 4px 0 0] - padding in px for the "caret-down" icon left to the collapsible item
31
+ * @fires pb-collapse-open - Fires opening the collapsed section
32
+ */
33
+ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
34
+ static get properties() {
35
+ return {
36
+ ...super.properties,
37
+ /**
38
+ * @deprecated
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.
46
+ *
47
+ */
48
+ noAnimation: {
49
+ type: Boolean,
50
+ attribute: 'no-animation'
51
+ },
52
+ /**
53
+ * Whether currently expanded.
54
+ *
55
+ */
56
+ opened: {
57
+ type: Boolean
58
+ },
59
+ /**
60
+ * By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.
61
+ * Set to true to keep multiple pb-collapse open at the same time.
62
+ */
63
+ toggles: {
64
+ 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
+ }
87
+ };
88
+ }
89
+
90
+ constructor() {
91
+ super();
92
+ this.horizontal = false;
93
+ this.noAnimation = false;
94
+ this.opened = false;
95
+ this.expandIcon = 'icons:expand-more';
96
+ this.collapseIcon = 'icons:expand-less';
97
+ this.noIcons = false;
98
+ this.toggles = false;
99
+ }
100
+
101
+ connectedCallback() {
102
+ super.connectedCallback();
103
+ this.addEventListener('pb-collapse-open', () => {
104
+ this.open();
105
+ });
106
+ if (this.toggles) {
107
+ this.subscribeTo('pb-collapse-open', (ev) => {
108
+ if (!ev.detail || ev.detail._source === this) {
109
+ return;
110
+ }
111
+ for (const collapse of this.querySelectorAll('pb-collapse')) {
112
+ if (collapse === ev.detail._source) {
113
+ return;
114
+ }
115
+ }
116
+ this.close();
117
+ });
118
+ }
119
+ }
120
+
121
+ /**
122
+ * opens the collapsible section
123
+ */
124
+ open() {
125
+ if (this.opened) {
126
+ return;
127
+ }
128
+ this.opened = true;
129
+
130
+ this.emitTo('pb-collapse-open', this);
131
+ }
132
+
133
+ /**
134
+ * closes the collapsible section
135
+ */
136
+ close() {
137
+ if (this.opened) {
138
+ this.opened = false;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * toggles the collapsible state
144
+ */
145
+ toggle() {
146
+ this.opened = !this.opened;
147
+ if (this.opened) {
148
+ this.emitTo('pb-collapse-open', this.data);
149
+ }
150
+ }
151
+
152
+ render() {
153
+ return html`
154
+ <div id="trigger" @click="${this.toggle}" class="collapse-trigger">
155
+ ${
156
+ !this.noIcons ?
157
+ html`<iron-icon icon="${this.opened ? this.collapseIcon : this.expandIcon}"></iron-icon>` :
158
+ null
159
+ }
160
+ <slot id="collapseTrigger" name="collapse-trigger"></slot>
161
+ </div>
162
+ <iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
163
+ <slot name="collapse-content"></slot>
164
+ </iron-collapse>
165
+ `;
166
+ }
167
+
168
+ static get styles() {
169
+ return css`
170
+ :host {
171
+ display: block;
172
+ position: relative;
173
+ }
174
+
175
+ #trigger {
176
+ display: flex;
177
+ align-items:center
178
+ }
179
+
180
+ iron-icon {
181
+ padding: var(--pb-collapse-icon-padding, 0 4px 0 0);
182
+ }
183
+
184
+ :host(.icon-right) iron-icon {
185
+ position: absolute;
186
+ right: 0;
187
+ }
188
+
189
+ `;
190
+ }
191
+ }
192
+ if (!customElements.get('pb-collapse')) {
193
+ customElements.define('pb-collapse', PbCollapse);
194
+ }
package/src/pb-login.js CHANGED
@@ -129,16 +129,22 @@ export class PbLogin extends pbMixin(LitElement) {
129
129
  };
130
130
  this._checkLogin.generateRequest();
131
131
  });
132
+ this.addEventListener('keyup', event => {
133
+ if (event.keyCode === 13) {
134
+ event.preventDefault();
135
+ this._confirmLogin();
136
+ }
137
+ });
132
138
  }
133
139
 
134
140
  render() {
135
141
  return html`
136
- <a href="#" @click="${this._show}" title="${this.user}">
142
+ <a href="#" @click="${this._show}" role="button" title="${this.user ? this.user : this.loginLabel}">
137
143
  ${
138
144
  this.loggedIn ?
139
145
  html`<iron-icon icon="${this.logoutIcon}"></iron-icon> <span class="label">${translate(this.logoutLabel, { user: this.user })}</span>` :
140
146
  html`<iron-icon icon="${this.loginIcon}"></iron-icon> <span class="label">${translate(this.loginLabel)}</span>`
141
- }
147
+ }
142
148
  </a>
143
149
 
144
150
  <paper-dialog id="loginDialog">
@@ -191,12 +197,8 @@ export class PbLogin extends pbMixin(LitElement) {
191
197
  a {
192
198
  color: var(--pb-login-link-color, --pb-link-color);
193
199
  text-decoration: none;
194
- }
195
-
196
- @media (max-width: 1024px) {
197
- .label {
198
- display: none;
199
- }
200
+ display: flex;
201
+ gap:0.5rem;
200
202
  }
201
203
 
202
204
  #message {
@@ -280,4 +282,4 @@ export class PbLogin extends pbMixin(LitElement) {
280
282
  * @param {Array<String>} groups groups the user is a member of
281
283
  */
282
284
  }
283
- customElements.define('pb-login', PbLogin);
285
+ customElements.define('pb-login', PbLogin);