wcs-core 2.5.4 → 2.9.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.
- package/CHANGELOG.md +132 -5
- package/README.md +19 -1
- package/dist/cjs/component-fc28ed16.js +1074 -0
- package/dist/cjs/helpers-6abce594.js +86 -0
- package/dist/cjs/{index-e05c3e1f.js → index-3cb9d725.js} +165 -87
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/{esm/wcs-action-bar_47.entry.js → cjs/lodash-776d6f03.js} +12499 -22628
- package/dist/cjs/popper-5777994b.js +1732 -0
- package/dist/cjs/select-arrow-76ccf86d.js +36 -0
- package/dist/cjs/wcs-action-bar.cjs.entry.js +24 -0
- package/dist/cjs/wcs-app.cjs.entry.js +2 -2
- package/dist/cjs/wcs-badge.cjs.entry.js +27 -0
- package/dist/cjs/wcs-button.cjs.entry.js +86 -0
- package/dist/cjs/wcs-card-body.cjs.entry.js +19 -0
- package/dist/cjs/wcs-card.cjs.entry.js +20 -0
- package/dist/cjs/wcs-checkbox.cjs.entry.js +47 -0
- package/dist/cjs/wcs-com-nav-category.cjs.entry.js +63 -0
- package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +69 -0
- package/dist/cjs/wcs-com-nav.cjs.entry.js +19 -0
- package/dist/cjs/wcs-divider.cjs.entry.js +19 -0
- package/dist/cjs/wcs-dropdown-divider.cjs.entry.js +19 -0
- package/dist/cjs/wcs-dropdown-header.cjs.entry.js +19 -0
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js +23 -0
- package/dist/cjs/wcs-dropdown.cjs.entry.js +90 -0
- package/dist/cjs/wcs-editable-field.cjs.entry.js +225 -0
- package/dist/cjs/wcs-error_2.cjs.entry.js +137 -0
- package/dist/cjs/wcs-field-content.cjs.entry.js +16 -0
- package/dist/cjs/wcs-field-label.cjs.entry.js +16 -0
- package/dist/cjs/wcs-field.cjs.entry.js +19 -0
- package/dist/cjs/wcs-footer.cjs.entry.js +19 -0
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js +58 -0
- package/dist/cjs/wcs-galactic.cjs.entry.js +41 -0
- package/dist/cjs/wcs-grid-column.cjs.entry.js +77 -0
- package/dist/cjs/wcs-grid-custom-cell.cjs.entry.js +16 -0
- package/dist/cjs/wcs-grid-pagination.cjs.entry.js +4 -4
- package/dist/cjs/wcs-grid.cjs.entry.js +332 -0
- package/dist/cjs/wcs-header.cjs.entry.js +25 -0
- package/dist/cjs/wcs-hint.cjs.entry.js +20 -0
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +114 -0
- package/dist/cjs/wcs-icon.cjs.entry.js +2 -2
- package/dist/cjs/wcs-input.cjs.entry.js +228 -0
- package/dist/cjs/wcs-label.cjs.entry.js +20 -0
- package/dist/cjs/wcs-list-item-properties.cjs.entry.js +19 -0
- package/dist/cjs/wcs-list-item-property.cjs.entry.js +19 -0
- package/dist/cjs/wcs-list-item.cjs.entry.js +23 -0
- package/dist/cjs/wcs-mat-icon.cjs.entry.js +73 -0
- package/dist/cjs/wcs-modal.cjs.entry.js +50 -0
- package/dist/cjs/wcs-nav-item.cjs.entry.js +23 -0
- package/dist/cjs/wcs-nav.cjs.entry.js +19 -0
- package/dist/cjs/wcs-progress-bar.cjs.entry.js +47 -0
- package/dist/cjs/wcs-progress-radial.cjs.entry.js +30 -0
- package/dist/cjs/wcs-radio-group.cjs.entry.js +65 -0
- package/dist/cjs/wcs-radio.cjs.entry.js +49 -0
- package/dist/cjs/wcs-select_2.cjs.entry.js +4916 -0
- package/dist/cjs/wcs-spinner.cjs.entry.js +21 -0
- package/dist/cjs/wcs-switch.cjs.entry.js +42 -0
- package/dist/cjs/wcs-tab.cjs.entry.js +20 -0
- package/dist/cjs/wcs-tabs.cjs.entry.js +159 -0
- package/dist/cjs/wcs-textarea.cjs.entry.js +224 -0
- package/dist/cjs/wcs-tooltip.cjs.entry.js +1635 -0
- package/dist/cjs/wcs.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/badge/badge-interface.js +1 -0
- package/dist/collection/components/badge/badge.js +14 -4
- package/dist/collection/components/button/button.css +79 -75
- package/dist/collection/components/button/button.js +23 -11
- package/dist/collection/components/card/card-interface.js +1 -0
- package/dist/collection/components/card/card.js +7 -2
- package/dist/collection/components/checkbox/checkbox.css +18 -7
- package/dist/collection/components/checkbox/checkbox.js +24 -2
- package/dist/collection/components/com-nav/com-nav.css +1 -2
- package/dist/collection/components/com-nav-category/com-nav-category.css +5 -6
- package/dist/collection/components/com-nav-category/com-nav-category.js +31 -1
- package/dist/collection/components/com-nav-submenu/com-nav-submenu.css +1 -2
- package/dist/collection/components/com-nav-submenu/com-nav-submenu.js +21 -1
- package/dist/collection/components/dropdown/dropdown-interface.js +1 -0
- package/dist/collection/components/dropdown/dropdown.css +46 -38
- package/dist/collection/components/dropdown/dropdown.js +90 -29
- package/dist/collection/components/dropdown-divider/dropdown-divider.css +7 -0
- package/dist/collection/components/dropdown-divider/dropdown-divider.js +14 -0
- package/dist/collection/components/dropdown-header/dropdown-header.css +8 -0
- package/dist/collection/components/dropdown-header/dropdown-header.js +15 -0
- package/dist/collection/components/editable-field/editable-field.js +7 -2
- package/dist/collection/components/footer/footer.css +1 -1
- package/dist/collection/components/form-field/form-field.css +1 -2
- package/dist/collection/components/form-field/form-field.js +0 -17
- package/dist/collection/components/grid/grid.js +75 -13
- package/dist/collection/components/grid-column/grid-column.css +5 -0
- package/dist/collection/components/grid-column/grid-column.js +70 -4
- package/dist/collection/components/grid-custom-cell/grid-custom-cell.js +45 -0
- package/dist/collection/components/grid-pagination/grid-pagination.js +4 -4
- package/dist/collection/components/header/header.css +1 -1
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +7 -2
- package/dist/collection/components/input/input.css +48 -0
- package/dist/collection/components/input/input.js +40 -4
- package/dist/collection/components/mat-icon/mat-icon.css +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js +7 -2
- package/dist/collection/components/modal/modal-interface.js +1 -0
- package/dist/collection/components/modal/modal.css +26 -7
- package/dist/collection/components/modal/modal.js +35 -7
- package/dist/collection/components/nav-item/nav-item.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +4 -4
- package/dist/collection/components/radio/radio.component.js +9 -4
- package/dist/collection/components/radio/radio.css +44 -19
- package/dist/collection/components/radio-group/radio-group.css +5 -1
- package/dist/collection/components/radio-group/radio-group.js +10 -5
- package/dist/collection/components/select/select.css +81 -77
- package/dist/collection/components/select/select.js +2 -2
- package/dist/collection/components/select-option/select-option.css +79 -75
- package/dist/collection/components/select-option/select-option.js +6 -7
- package/dist/collection/components/spinner/spinner-interface.js +1 -0
- package/dist/collection/components/spinner/spinner.js +8 -3
- package/dist/collection/components/switch/switch.css +53 -16
- package/dist/collection/components/switch/switch.js +55 -6
- package/dist/collection/components/tab/tab.js +5 -5
- package/dist/collection/components/tabs/tabs.js +2 -2
- package/dist/collection/components/textarea/textarea.css +4 -0
- package/dist/collection/components/textarea/textarea.js +2 -2
- package/dist/collection/components/tooltip/tooltip.css +3 -0
- package/dist/collection/components/tooltip/tooltip.js +310 -92
- package/dist/collection/utils/helpers.js +4 -0
- package/dist/esm/component-6b4d470f.js +1072 -0
- package/dist/esm/helpers-e2993152.js +77 -0
- package/dist/esm/{index-c619b1fa.js → index-b982604a.js} +165 -88
- package/dist/esm/loader.js +3 -3
- package/dist/{cjs/wcs-action-bar_47.cjs.entry.js → esm/lodash-d6d9d079.js} +12610 -22791
- package/dist/esm/popper-5f42e560.js +1729 -0
- package/dist/esm/select-arrow-73ac4016.js +34 -0
- package/dist/esm/wcs-action-bar.entry.js +20 -0
- package/dist/esm/wcs-app.entry.js +2 -2
- package/dist/esm/wcs-badge.entry.js +23 -0
- package/dist/esm/wcs-button.entry.js +82 -0
- package/dist/esm/wcs-card-body.entry.js +15 -0
- package/dist/esm/wcs-card.entry.js +16 -0
- package/dist/esm/wcs-checkbox.entry.js +43 -0
- package/dist/esm/wcs-com-nav-category.entry.js +59 -0
- package/dist/esm/wcs-com-nav-submenu.entry.js +65 -0
- package/dist/esm/wcs-com-nav.entry.js +15 -0
- package/dist/esm/wcs-divider.entry.js +15 -0
- package/dist/esm/wcs-dropdown-divider.entry.js +15 -0
- package/dist/esm/wcs-dropdown-header.entry.js +15 -0
- package/dist/esm/wcs-dropdown-item.entry.js +19 -0
- package/dist/esm/wcs-dropdown.entry.js +86 -0
- package/dist/esm/wcs-editable-field.entry.js +221 -0
- package/dist/esm/wcs-error_2.entry.js +132 -0
- package/dist/esm/wcs-field-content.entry.js +12 -0
- package/dist/esm/wcs-field-label.entry.js +12 -0
- package/dist/esm/wcs-field.entry.js +15 -0
- package/dist/esm/wcs-footer.entry.js +15 -0
- package/dist/esm/wcs-galactic-menu.entry.js +54 -0
- package/dist/esm/wcs-galactic.entry.js +37 -0
- package/dist/esm/wcs-grid-column.entry.js +73 -0
- package/dist/esm/wcs-grid-custom-cell.entry.js +12 -0
- package/dist/esm/wcs-grid-pagination.entry.js +4 -4
- package/dist/esm/wcs-grid.entry.js +328 -0
- package/dist/esm/wcs-header.entry.js +21 -0
- package/dist/esm/wcs-hint.entry.js +16 -0
- package/dist/esm/wcs-horizontal-stepper.entry.js +110 -0
- package/dist/esm/wcs-icon.entry.js +2 -2
- package/dist/esm/wcs-input.entry.js +224 -0
- package/dist/esm/wcs-label.entry.js +16 -0
- package/dist/esm/wcs-list-item-properties.entry.js +15 -0
- package/dist/esm/wcs-list-item-property.entry.js +15 -0
- package/dist/esm/wcs-list-item.entry.js +19 -0
- package/dist/esm/wcs-mat-icon.entry.js +69 -0
- package/dist/esm/wcs-modal.entry.js +46 -0
- package/dist/esm/wcs-nav-item.entry.js +19 -0
- package/dist/esm/wcs-nav.entry.js +15 -0
- package/dist/esm/wcs-progress-bar.entry.js +43 -0
- package/dist/esm/wcs-progress-radial.entry.js +26 -0
- package/dist/esm/wcs-radio-group.entry.js +61 -0
- package/dist/esm/wcs-radio.entry.js +45 -0
- package/dist/esm/wcs-select_2.entry.js +4911 -0
- package/dist/esm/wcs-spinner.entry.js +17 -0
- package/dist/esm/wcs-switch.entry.js +38 -0
- package/dist/esm/wcs-tab.entry.js +16 -0
- package/dist/esm/wcs-tabs.entry.js +155 -0
- package/dist/esm/wcs-textarea.entry.js +220 -0
- package/dist/esm/wcs-tooltip.entry.js +1631 -0
- package/dist/esm/wcs.js +3 -3
- package/dist/types/components/badge/badge-interface.d.ts +2 -0
- package/dist/types/components/badge/badge.d.ts +3 -2
- package/dist/types/components/button/button.d.ts +7 -3
- package/dist/types/components/card/card-interface.d.ts +1 -0
- package/dist/types/components/card/card.d.ts +2 -1
- package/dist/types/components/checkbox/checkbox.d.ts +4 -0
- package/dist/types/components/com-nav-category/com-nav-category.d.ts +7 -0
- package/dist/types/components/com-nav-submenu/com-nav-submenu.d.ts +7 -0
- package/dist/types/components/dropdown/dropdown-interface.d.ts +1 -0
- package/dist/types/components/dropdown/dropdown.d.ts +13 -16
- package/dist/types/components/dropdown-divider/dropdown-divider.d.ts +3 -0
- package/dist/types/components/dropdown-header/dropdown-header.d.ts +3 -0
- package/dist/types/components/editable-field/editable-field-interface.d.ts +1 -0
- package/dist/types/components/editable-field/editable-field.d.ts +2 -2
- package/dist/types/components/form-field/form-field.d.ts +0 -4
- package/dist/types/components/grid/grid.d.ts +18 -0
- package/dist/types/components/grid-column/grid-column.d.ts +6 -1
- package/dist/types/components/grid-custom-cell/grid-custom-cell.d.ts +12 -0
- package/dist/types/components/horizontal-stepper/horizontal-stepper-interface.d.ts +1 -0
- package/dist/types/components/horizontal-stepper/horizontal-stepper.d.ts +2 -2
- package/dist/types/components/input/input.d.ts +8 -0
- package/dist/types/components/mat-icon/mat-icon-interface.d.ts +1 -0
- package/dist/types/components/mat-icon/mat-icon.d.ts +2 -2
- package/dist/types/components/modal/modal-interface.d.ts +1 -0
- package/dist/types/components/modal/modal.d.ts +7 -1
- package/dist/types/components/radio/radio.component.d.ts +2 -1
- package/dist/types/components/radio-group/radio-group-interface.d.ts +1 -0
- package/dist/types/components/radio-group/radio-group.d.ts +2 -2
- package/dist/types/components/select-option/select-option.d.ts +2 -0
- package/dist/types/components/spinner/spinner-interface.d.ts +1 -0
- package/dist/types/components/spinner/spinner.d.ts +2 -1
- package/dist/types/components/switch/switch-interface.d.ts +1 -0
- package/dist/types/components/switch/switch.d.ts +10 -2
- package/dist/types/components/tooltip/tooltip.d.ts +70 -6
- package/dist/types/components.d.ts +253 -41
- package/dist/types/interfaces.d.ts +22 -0
- package/dist/types/stencil-public-runtime.d.ts +189 -186
- package/dist/types/utils/helpers.d.ts +1 -0
- package/dist/wcs/p-03b2e238.entry.js +1 -0
- package/dist/wcs/p-08a7e84d.entry.js +1 -0
- package/dist/wcs/p-16dfbae8.js +127 -0
- package/dist/wcs/p-1dce7e63.entry.js +1 -0
- package/dist/wcs/p-1f5aed36.entry.js +1 -0
- package/dist/wcs/p-214236db.entry.js +1 -0
- package/dist/wcs/p-22813c8e.entry.js +1 -0
- package/dist/wcs/p-26b5c0a3.entry.js +1 -0
- package/dist/wcs/p-2e6265dc.entry.js +1 -0
- package/dist/wcs/p-384068f7.entry.js +1 -0
- package/dist/wcs/p-41037455.entry.js +1 -0
- package/dist/wcs/p-474d6601.entry.js +1 -0
- package/dist/wcs/p-4e9e226d.entry.js +1 -0
- package/dist/wcs/p-55fdc284.entry.js +1 -0
- package/dist/wcs/p-5b35b232.entry.js +1 -0
- package/dist/wcs/p-600a9cc0.entry.js +1 -0
- package/dist/wcs/p-60b51967.entry.js +1 -0
- package/dist/wcs/p-65c5ccc5.entry.js +1 -0
- package/dist/wcs/p-688fea65.entry.js +1 -0
- package/dist/wcs/p-716d5921.entry.js +1 -0
- package/dist/wcs/p-7206e492.entry.js +1 -0
- package/dist/wcs/p-7219c04b.js +1 -0
- package/dist/wcs/p-7c26f650.entry.js +1 -0
- package/dist/wcs/p-8137f075.entry.js +1 -0
- package/dist/wcs/p-8864a491.entry.js +1 -0
- package/dist/wcs/p-8c8740e3.entry.js +1 -0
- package/dist/wcs/p-91a2de07.entry.js +1 -0
- package/dist/wcs/p-94a31f64.entry.js +1 -0
- package/dist/wcs/p-9619f77a.entry.js +1 -0
- package/dist/wcs/p-979dfd78.entry.js +1 -0
- package/dist/wcs/p-9ba52bc4.entry.js +1 -0
- package/dist/wcs/p-a1ee1551.entry.js +1 -0
- package/dist/wcs/p-a92d369e.entry.js +1 -0
- package/dist/wcs/p-a978c1e3.entry.js +1 -0
- package/dist/wcs/p-adef7aaf.js +1 -0
- package/dist/wcs/p-b5ffbea8.entry.js +1 -0
- package/dist/wcs/p-b7184d59.entry.js +1 -0
- package/dist/wcs/p-bbf1ef42.entry.js +1 -0
- package/dist/wcs/p-c7d6d3e1.entry.js +15 -0
- package/dist/wcs/p-cf4d7a83.js +1 -0
- package/dist/wcs/p-d3c9a644.js +1 -0
- package/dist/wcs/p-db68379f.entry.js +1 -0
- package/dist/wcs/p-dbbc3f58.entry.js +1 -0
- package/dist/wcs/p-dc817204.entry.js +1 -0
- package/dist/wcs/p-e0163de8.entry.js +1 -0
- package/dist/wcs/p-e4236d32.entry.js +1 -0
- package/dist/wcs/p-e43358e4.entry.js +1 -0
- package/dist/wcs/p-e9ce507c.entry.js +1 -0
- package/dist/wcs/p-ecbe5165.entry.js +6 -0
- package/dist/wcs/p-f430a227.entry.js +1 -0
- package/dist/wcs/p-f46e6c3c.js +1 -0
- package/dist/wcs/p-f96bb0bf.entry.js +1 -0
- package/dist/wcs/p-f9944bde.entry.js +1 -0
- package/dist/wcs/p-fa173947.entry.js +1 -0
- package/dist/wcs/p-fb1577b5.entry.js +1 -0
- package/dist/wcs/p-febe9ccc.entry.js +1 -0
- package/dist/wcs/p-ff6d0dfd.entry.js +1 -0
- package/dist/wcs/wcs.css +1 -1
- package/dist/wcs/wcs.esm.js +1 -1
- package/loader/index.d.ts +0 -1
- package/package.json +25 -22
- package/dist/types/interface.d.ts +0 -3
- package/dist/wcs/p-16dca526.entry.js +0 -1
- package/dist/wcs/p-4f228fcb.entry.js +0 -134
- package/dist/wcs/p-66520e5a.entry.js +0 -1
- package/dist/wcs/p-d31287c6.entry.js +0 -1
- package/dist/wcs/p-f73f235b.js +0 -1
- package/schematics/.gitignore +0 -18
- package/schematics/.npmignore +0 -4
- package/schematics/collection.json +0 -9
- package/schematics/src/ng-add/files/fonts/avenir-black.woff +0 -0
- package/schematics/src/ng-add/files/fonts/avenir-book.woff +0 -0
- package/schematics/src/ng-add/files/fonts/avenir-lighter.woff +0 -0
- package/schematics/src/ng-add/files/fonts/avenir-medium.woff +0 -0
- package/schematics/src/ng-add/files/sncf-logo.png +0 -0
- package/schematics/src/ng-add/index.d.ts +0 -3
- package/schematics/src/ng-add/index.js +0 -119
- package/schematics/src/ng-add/index.js.map +0 -1
- package/schematics/src/ng-add/schema.json +0 -5
|
@@ -1,111 +1,133 @@
|
|
|
1
|
-
import { Component, h, Host, Prop, Element } from '@stencil/core';
|
|
2
|
-
|
|
1
|
+
import { Component, h, Host, Prop, Element, Watch, Method } from '@stencil/core';
|
|
2
|
+
// We use the Tippy.js library for the tooltip. At first by using directly the styles of tippy because
|
|
3
|
+
// the design system does not specify any spec for the tooltips.
|
|
4
|
+
//
|
|
5
|
+
// In a second time, if a need of customization is felt, it will be possible to use the lib in a
|
|
6
|
+
// "Headless" mode where the rendering of the tooltip will be entirely in our charge, without
|
|
7
|
+
// modifications in the API : https://atomiks.github.io/tippyjs/v6/headless-tippy/
|
|
8
|
+
import tippy from 'tippy.js';
|
|
9
|
+
/**
|
|
10
|
+
* Tooltips are used to provide additional information for features available on the website. These can improve the user
|
|
11
|
+
* experience or simply show additional information. Tooltips appear when the user rolls over or clicks on them
|
|
12
|
+
* (for longer content).
|
|
13
|
+
*
|
|
14
|
+
* Note that this component is based on the Tippy.js library : https://atomiks.github.io/tippyjs/
|
|
15
|
+
*/
|
|
3
16
|
export class Tooltip {
|
|
4
17
|
constructor() {
|
|
5
18
|
/**
|
|
6
19
|
* Where the tooltip is going to show relative to the element it's describing.
|
|
7
20
|
*/
|
|
8
21
|
this.position = 'bottom';
|
|
22
|
+
/**
|
|
23
|
+
* Determines if the tooltip has interactive content inside of it, so that it can be hovered over and clicked inside
|
|
24
|
+
* without hiding.
|
|
25
|
+
*/
|
|
26
|
+
this.interactive = false;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies the maximum width of the tooltip. Useful to prevent it from being too horizontally wide to read.
|
|
29
|
+
*
|
|
30
|
+
* If the viewport's width is smaller than maxWidth, core CSS ensures the tippy remains smaller than the screen.
|
|
31
|
+
*/
|
|
32
|
+
this.maxWidth = 350;
|
|
33
|
+
/**
|
|
34
|
+
* Delay in ms once a trigger event is fired before the tooltip shows or hides.
|
|
35
|
+
*
|
|
36
|
+
* You can provide an array with two values to define a different duration for show and hide.
|
|
37
|
+
*
|
|
38
|
+
* `[showDelay, hideDelay]`
|
|
39
|
+
*
|
|
40
|
+
* Use null to use default value.
|
|
41
|
+
*/
|
|
42
|
+
this.delay = 0;
|
|
43
|
+
/**
|
|
44
|
+
* Duration in ms of the transition animation.
|
|
45
|
+
*/
|
|
46
|
+
this.duration = [300, 250];
|
|
47
|
+
/**
|
|
48
|
+
* Determines the events that cause the tooltip to show. Multiple event names are separated by spaces.
|
|
49
|
+
*
|
|
50
|
+
* See: https://atomiks.github.io/tippyjs/v6/all-props/#trigger
|
|
51
|
+
*/
|
|
52
|
+
this.trigger = 'mouseenter focus';
|
|
53
|
+
/**
|
|
54
|
+
* Allows you to change the theme used by tippy.
|
|
55
|
+
*
|
|
56
|
+
* The WCS theme is used by default and uses the WCS CSS variables.
|
|
57
|
+
*
|
|
58
|
+
* You can create a theme by following this documentation and choosing a custom name :
|
|
59
|
+
* https://atomiks.github.io/tippyjs/v6/themes/
|
|
60
|
+
*/
|
|
61
|
+
this.theme = 'wcs';
|
|
9
62
|
}
|
|
10
63
|
componentWillLoad() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
64
|
+
this.tippyInstance = tippy(document.getElementById(this.for), {
|
|
65
|
+
theme: this.theme,
|
|
66
|
+
allowHTML: true,
|
|
67
|
+
content: this.el.innerHTML,
|
|
68
|
+
maxWidth: this.maxWidth,
|
|
69
|
+
placement: this.position,
|
|
70
|
+
delay: this.delay,
|
|
71
|
+
duration: this.duration,
|
|
72
|
+
interactive: this.interactive,
|
|
73
|
+
trigger: this.trigger
|
|
74
|
+
});
|
|
21
75
|
}
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
76
|
+
updateProps() {
|
|
77
|
+
this.tippyInstance.setProps({
|
|
78
|
+
interactive: this.interactive,
|
|
79
|
+
placement: this.position,
|
|
80
|
+
maxWidth: this.maxWidth,
|
|
81
|
+
theme: this.theme,
|
|
82
|
+
delay: this.delay,
|
|
83
|
+
duration: this.duration,
|
|
84
|
+
trigger: this.trigger
|
|
31
85
|
});
|
|
32
86
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
? this.el.shadowRoot.querySelector('slot').assignedNodes()
|
|
38
|
-
: this.content.querySelectorAll('*');
|
|
39
|
-
nodes.forEach(n => this.content.appendChild(n.cloneNode(true)));
|
|
40
|
-
this.content.remove();
|
|
41
|
-
overlay.appendChild(this.content);
|
|
42
|
-
this.updatePosition();
|
|
87
|
+
updateTippyContent() {
|
|
88
|
+
this.tippyInstance.setProps({
|
|
89
|
+
content: this.el.innerHTML
|
|
90
|
+
});
|
|
43
91
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
tooltipTop = targetTop + targetRect.height + borderWidth;
|
|
68
|
-
break;
|
|
69
|
-
case 'left':
|
|
70
|
-
tooltipLeft = targetLeft - thisRect.width - borderWidth;
|
|
71
|
-
tooltipTop = targetTop + verticalCenterOffset;
|
|
72
|
-
break;
|
|
73
|
-
case 'right':
|
|
74
|
-
tooltipLeft = targetLeft + targetRect.width + borderWidth;
|
|
75
|
-
tooltipTop = targetTop + verticalCenterOffset;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
// Clip to the left/right side.
|
|
79
|
-
if (parentRect.left + tooltipLeft + thisRect.width > window.innerWidth) {
|
|
80
|
-
this.content.style.right = '0px';
|
|
81
|
-
this.content.style.left = 'auto';
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.content.style.left = Math.max(0, tooltipLeft) + 'px';
|
|
85
|
-
this.content.style.right = 'auto';
|
|
86
|
-
}
|
|
87
|
-
// Clip the top/bottom side.
|
|
88
|
-
if (parentRect.top + tooltipTop + thisRect.height > window.innerHeight) {
|
|
89
|
-
this.content.style.bottom = (parentRect.height - targetTop) + 'px';
|
|
90
|
-
this.content.style.top = 'auto';
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
this.content.style.top = Math.max(-parentRect.top, tooltipTop) + 'px';
|
|
94
|
-
this.content.style.bottom = 'auto';
|
|
95
|
-
}
|
|
92
|
+
/**
|
|
93
|
+
* Programmatically hide the tooltip
|
|
94
|
+
*/
|
|
95
|
+
async hide() {
|
|
96
|
+
this.tippyInstance.hide();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Programmatically show the tooltip
|
|
100
|
+
*/
|
|
101
|
+
async show() {
|
|
102
|
+
this.tippyInstance.show();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Temporarily prevent the tooltip from showing or hiding
|
|
106
|
+
*/
|
|
107
|
+
async disable() {
|
|
108
|
+
this.tippyInstance.disable();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Re-enable a disabled tooltip
|
|
112
|
+
*/
|
|
113
|
+
async enable() {
|
|
114
|
+
this.tippyInstance.enable();
|
|
96
115
|
}
|
|
97
116
|
disconnectedCallback() {
|
|
98
|
-
|
|
99
|
-
// const overlay = getOverlay();
|
|
100
|
-
// overlay.removeChild(this.content);
|
|
117
|
+
this.tippyInstance.destroy();
|
|
101
118
|
}
|
|
102
119
|
render() {
|
|
103
120
|
return (h(Host, null,
|
|
104
|
-
h("
|
|
105
|
-
h("slot", null))));
|
|
121
|
+
h("slot", { onSlotchange: _ => this.updateTippyContent() })));
|
|
106
122
|
}
|
|
107
123
|
static get is() { return "wcs-tooltip"; }
|
|
108
124
|
static get encapsulation() { return "shadow"; }
|
|
125
|
+
static get originalStyleUrls() { return {
|
|
126
|
+
"$": ["tooltip.scss"]
|
|
127
|
+
}; }
|
|
128
|
+
static get styleUrls() { return {
|
|
129
|
+
"$": ["tooltip.css"]
|
|
130
|
+
}; }
|
|
109
131
|
static get properties() { return {
|
|
110
132
|
"for": {
|
|
111
133
|
"type": "string",
|
|
@@ -119,13 +141,13 @@ export class Tooltip {
|
|
|
119
141
|
"optional": false,
|
|
120
142
|
"docs": {
|
|
121
143
|
"tags": [{
|
|
122
|
-
"
|
|
123
|
-
"
|
|
144
|
+
"name": "example",
|
|
145
|
+
"text": "```html\n<span id=\"tooltiped\">Some content</span>\n<wcs-tooltip for=\"tooltiped\">A tooltip!</wcs-tooltip>\n```"
|
|
124
146
|
}],
|
|
125
|
-
"text": "The **id** of the element the tooltip's going to describe."
|
|
147
|
+
"text": "The **id** of the element the tooltip's going to describe.\n\nThis property cannot be modified after initialization."
|
|
126
148
|
},
|
|
127
149
|
"attribute": "for",
|
|
128
|
-
"reflect":
|
|
150
|
+
"reflect": false
|
|
129
151
|
},
|
|
130
152
|
"position": {
|
|
131
153
|
"type": "string",
|
|
@@ -149,7 +171,203 @@ export class Tooltip {
|
|
|
149
171
|
"attribute": "position",
|
|
150
172
|
"reflect": true,
|
|
151
173
|
"defaultValue": "'bottom'"
|
|
174
|
+
},
|
|
175
|
+
"interactive": {
|
|
176
|
+
"type": "boolean",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "boolean",
|
|
180
|
+
"resolved": "boolean",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": false,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": "Determines if the tooltip has interactive content inside of it, so that it can be hovered over and clicked inside\nwithout hiding."
|
|
188
|
+
},
|
|
189
|
+
"attribute": "interactive",
|
|
190
|
+
"reflect": false,
|
|
191
|
+
"defaultValue": "false"
|
|
192
|
+
},
|
|
193
|
+
"maxWidth": {
|
|
194
|
+
"type": "any",
|
|
195
|
+
"mutable": false,
|
|
196
|
+
"complexType": {
|
|
197
|
+
"original": "string | number",
|
|
198
|
+
"resolved": "number | string",
|
|
199
|
+
"references": {}
|
|
200
|
+
},
|
|
201
|
+
"required": false,
|
|
202
|
+
"optional": false,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": "Specifies the maximum width of the tooltip. Useful to prevent it from being too horizontally wide to read.\n\nIf the viewport's width is smaller than maxWidth, core CSS ensures the tippy remains smaller than the screen."
|
|
206
|
+
},
|
|
207
|
+
"attribute": "max-width",
|
|
208
|
+
"reflect": false,
|
|
209
|
+
"defaultValue": "350"
|
|
210
|
+
},
|
|
211
|
+
"delay": {
|
|
212
|
+
"type": "number",
|
|
213
|
+
"mutable": false,
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "number | [number, number]",
|
|
216
|
+
"resolved": "[number, number] | number",
|
|
217
|
+
"references": {}
|
|
218
|
+
},
|
|
219
|
+
"required": false,
|
|
220
|
+
"optional": false,
|
|
221
|
+
"docs": {
|
|
222
|
+
"tags": [],
|
|
223
|
+
"text": "Delay in ms once a trigger event is fired before the tooltip shows or hides.\n\nYou can provide an array with two values to define a different duration for show and hide.\n\n`[showDelay, hideDelay]`\n\nUse null to use default value."
|
|
224
|
+
},
|
|
225
|
+
"attribute": "delay",
|
|
226
|
+
"reflect": false,
|
|
227
|
+
"defaultValue": "0"
|
|
228
|
+
},
|
|
229
|
+
"duration": {
|
|
230
|
+
"type": "number",
|
|
231
|
+
"mutable": false,
|
|
232
|
+
"complexType": {
|
|
233
|
+
"original": "number | [number, number]",
|
|
234
|
+
"resolved": "[number, number] | number",
|
|
235
|
+
"references": {}
|
|
236
|
+
},
|
|
237
|
+
"required": false,
|
|
238
|
+
"optional": false,
|
|
239
|
+
"docs": {
|
|
240
|
+
"tags": [],
|
|
241
|
+
"text": "Duration in ms of the transition animation."
|
|
242
|
+
},
|
|
243
|
+
"attribute": "duration",
|
|
244
|
+
"reflect": false,
|
|
245
|
+
"defaultValue": "[300, 250]"
|
|
246
|
+
},
|
|
247
|
+
"trigger": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"mutable": false,
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "string",
|
|
252
|
+
"resolved": "string",
|
|
253
|
+
"references": {}
|
|
254
|
+
},
|
|
255
|
+
"required": false,
|
|
256
|
+
"optional": false,
|
|
257
|
+
"docs": {
|
|
258
|
+
"tags": [],
|
|
259
|
+
"text": "Determines the events that cause the tooltip to show. Multiple event names are separated by spaces.\n\nSee: https://atomiks.github.io/tippyjs/v6/all-props/#trigger"
|
|
260
|
+
},
|
|
261
|
+
"attribute": "trigger",
|
|
262
|
+
"reflect": false,
|
|
263
|
+
"defaultValue": "'mouseenter focus'"
|
|
264
|
+
},
|
|
265
|
+
"theme": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"mutable": false,
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "string",
|
|
270
|
+
"resolved": "string",
|
|
271
|
+
"references": {}
|
|
272
|
+
},
|
|
273
|
+
"required": false,
|
|
274
|
+
"optional": false,
|
|
275
|
+
"docs": {
|
|
276
|
+
"tags": [],
|
|
277
|
+
"text": "Allows you to change the theme used by tippy.\n\nThe WCS theme is used by default and uses the WCS CSS variables.\n\nYou can create a theme by following this documentation and choosing a custom name :\nhttps://atomiks.github.io/tippyjs/v6/themes/"
|
|
278
|
+
},
|
|
279
|
+
"attribute": "theme",
|
|
280
|
+
"reflect": false,
|
|
281
|
+
"defaultValue": "'wcs'"
|
|
282
|
+
}
|
|
283
|
+
}; }
|
|
284
|
+
static get methods() { return {
|
|
285
|
+
"hide": {
|
|
286
|
+
"complexType": {
|
|
287
|
+
"signature": "() => Promise<void>",
|
|
288
|
+
"parameters": [],
|
|
289
|
+
"references": {
|
|
290
|
+
"Promise": {
|
|
291
|
+
"location": "global"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"return": "Promise<void>"
|
|
295
|
+
},
|
|
296
|
+
"docs": {
|
|
297
|
+
"text": "Programmatically hide the tooltip",
|
|
298
|
+
"tags": []
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"show": {
|
|
302
|
+
"complexType": {
|
|
303
|
+
"signature": "() => Promise<void>",
|
|
304
|
+
"parameters": [],
|
|
305
|
+
"references": {
|
|
306
|
+
"Promise": {
|
|
307
|
+
"location": "global"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"return": "Promise<void>"
|
|
311
|
+
},
|
|
312
|
+
"docs": {
|
|
313
|
+
"text": "Programmatically show the tooltip",
|
|
314
|
+
"tags": []
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"disable": {
|
|
318
|
+
"complexType": {
|
|
319
|
+
"signature": "() => Promise<void>",
|
|
320
|
+
"parameters": [],
|
|
321
|
+
"references": {
|
|
322
|
+
"Promise": {
|
|
323
|
+
"location": "global"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"return": "Promise<void>"
|
|
327
|
+
},
|
|
328
|
+
"docs": {
|
|
329
|
+
"text": "Temporarily prevent the tooltip from showing or hiding",
|
|
330
|
+
"tags": []
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"enable": {
|
|
334
|
+
"complexType": {
|
|
335
|
+
"signature": "() => Promise<void>",
|
|
336
|
+
"parameters": [],
|
|
337
|
+
"references": {
|
|
338
|
+
"Promise": {
|
|
339
|
+
"location": "global"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"return": "Promise<void>"
|
|
343
|
+
},
|
|
344
|
+
"docs": {
|
|
345
|
+
"text": "Re-enable a disabled tooltip",
|
|
346
|
+
"tags": []
|
|
347
|
+
}
|
|
152
348
|
}
|
|
153
349
|
}; }
|
|
154
350
|
static get elementRef() { return "el"; }
|
|
351
|
+
static get watchers() { return [{
|
|
352
|
+
"propName": "interactive",
|
|
353
|
+
"methodName": "updateProps"
|
|
354
|
+
}, {
|
|
355
|
+
"propName": "position",
|
|
356
|
+
"methodName": "updateProps"
|
|
357
|
+
}, {
|
|
358
|
+
"propName": "maxWidth",
|
|
359
|
+
"methodName": "updateProps"
|
|
360
|
+
}, {
|
|
361
|
+
"propName": "theme",
|
|
362
|
+
"methodName": "updateProps"
|
|
363
|
+
}, {
|
|
364
|
+
"propName": "delay",
|
|
365
|
+
"methodName": "updateProps"
|
|
366
|
+
}, {
|
|
367
|
+
"propName": "duration",
|
|
368
|
+
"methodName": "updateProps"
|
|
369
|
+
}, {
|
|
370
|
+
"propName": "trigger",
|
|
371
|
+
"methodName": "updateProps"
|
|
372
|
+
}]; }
|
|
155
373
|
}
|
|
@@ -69,3 +69,7 @@ export const clickInsideElement = (event, element) => {
|
|
|
69
69
|
return event.x >= element.getBoundingClientRect().x && event.x <= element.getBoundingClientRect().x + element.getBoundingClientRect().width
|
|
70
70
|
&& event.y >= element.getBoundingClientRect().y && event.y <= element.getBoundingClientRect().y + element.getBoundingClientRect().height;
|
|
71
71
|
};
|
|
72
|
+
export const clickTargetIsElementOrChildren = (mouseEvent, element) => {
|
|
73
|
+
return mouseEvent.target instanceof Node
|
|
74
|
+
&& element.contains(mouseEvent.target);
|
|
75
|
+
};
|