Skip to content

Commit c00b877

Browse files
paodbmlopezFC
authored andcommitted
feat: add tooltip support to toolbar buttons
Sidebar toggle button, next page button and previous page button.
1 parent 85238ef commit c00b877

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@vaadin/list-box": "^24.1.1",
3333
"@vaadin/select": "^24.1.1",
3434
"@vaadin/text-field": "^24.1.1",
35+
"@vaadin/tooltip": "^24.1.1",
3536
"@vaadin/vaadin-lumo-styles": "^24.1.1",
3637
"@vaadin/vaadin-material-styles": "^24.1.1",
3738
"@vaadin/vaadin-themable-mixin": "^24.1.1",

src/vcf-pdf-viewer.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import '@vaadin/select';
77
import '@vaadin/item';
88
import '@vaadin/button';
99
import '@vaadin/icon';
10+
import '@vaadin/tooltip';
1011

1112
import * as pdfjsLib from '../pdfjs/dist/pdf';
1213
import * as pdfjsViewer from '../pdfjs/dist/pdf_viewer';
@@ -261,6 +262,7 @@ class PdfViewerElement extends
261262
<div id="toolbar" part="toolbar">
262263
<vaadin-button id="sidebarToggle" part="toolbar-button toolbar-button-toogle-sidebar" theme="icon" on-click="__toogleSidebar" aria-label="Sidebar toggle">
263264
<vaadin-icon part="toggle-button-icon" slot="prefix"></vaadin-icon>
265+
<vaadin-tooltip slot="tooltip" text="{{sidebarToggleTooltip}}"></vaadin-tooltip>
264266
</vaadin-button>
265267
<span id="title" part="toolbar-text toolbar-title">{{__title}}</span>
266268
<vaadin-select id="zoom" part="toolbar-zoom" value="{{zoom}}" items="[[__zoomItems]]">
@@ -271,9 +273,11 @@ class PdfViewerElement extends
271273
<span id="totalPages" part="toolbar-text toolbar-total-pages">{{__totalPages}}</span>
272274
<vaadin-button id="previousPage" part="toolbar-button toolbar-button-previous-page" theme="icon" on-click="__previousPage" aria-label="Previous page">
273275
<vaadin-icon part="previous-page-button-icon" slot="prefix"></vaadin-icon>
276+
<vaadin-tooltip slot="tooltip" text="{{previousPageTooltip}}"></vaadin-tooltip>
274277
</vaadin-button>
275278
<vaadin-button id="nextPage" part="toolbar-button toolbar-button-next-page" theme="icon" on-click="__nextPage" aria-label="Next page">
276279
<vaadin-icon part="next-page-button-icon" slot="prefix"></vaadin-icon>
280+
<vaadin-tooltip slot="tooltip" text="{{nextPageTooltip}}"></vaadin-tooltip>
277281
</vaadin-button>
278282
</div>
279283
<slot></slot>
@@ -434,7 +438,31 @@ class PdfViewerElement extends
434438
},
435439
__zoomItems: {
436440
computed: '__computeZoomItems(autoZoomOptionLabel, fitZoomOptionLabel)'
437-
}
441+
},
442+
443+
/**
444+
* Property to define a custom tooltip for the sidebar toggle button
445+
*/
446+
sidebarToggleTooltip: {
447+
type: String,
448+
value: ""
449+
},
450+
451+
/**
452+
* Property to define a custom tooltip for the previous page button
453+
*/
454+
previousPageTooltip: {
455+
type: String,
456+
value: ""
457+
},
458+
459+
/**
460+
* Property to define a custom tooltip for the next page button
461+
*/
462+
nextPageTooltip: {
463+
type: String,
464+
value: ""
465+
},
438466
};
439467
}
440468

0 commit comments

Comments
 (0)