wcs-core 2.5.2 → 2.7.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 +58 -0
- package/README.md +17 -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-6a290c40.js +1731 -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 +45 -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 +129 -0
- package/dist/cjs/wcs.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/button/button.css +79 -75
- package/dist/collection/components/button/button.js +23 -11
- 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/footer/footer.css +1 -1
- package/dist/collection/components/form-field/form-field.css +1 -1
- 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 +69 -3
- 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/input/input.css +48 -0
- package/dist/collection/components/input/input.js +40 -4
- package/dist/collection/components/radio/radio.component.js +1 -1
- package/dist/collection/components/radio/radio.css +18 -4
- package/dist/collection/components/radio-group/radio-group.js +7 -2
- 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/switch/switch.css +53 -16
- package/dist/collection/components/switch/switch.js +55 -6
- package/dist/collection/components/tab/tab.js +4 -4
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/textarea/textarea.css +4 -0
- package/dist/collection/components/textarea/textarea.js +2 -2
- package/dist/collection/components/tooltip/tooltip.js +2 -2
- 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-e5fdfb6a.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 +41 -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 +125 -0
- package/dist/esm/wcs.js +3 -3
- package/dist/types/components/button/button.d.ts +7 -3
- 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/grid/grid.d.ts +18 -0
- package/dist/types/components/grid-column/grid-column.d.ts +5 -0
- package/dist/types/components/grid-custom-cell/grid-custom-cell.d.ts +12 -0
- package/dist/types/components/input/input.d.ts +8 -0
- 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/switch/switch-interface.d.ts +1 -0
- package/dist/types/components/switch/switch.d.ts +10 -2
- package/dist/types/components.d.ts +148 -4
- package/dist/types/stencil-public-runtime.d.ts +183 -182
- package/dist/types/utils/helpers.d.ts +1 -0
- package/dist/wcs/p-03b2e238.entry.js +1 -0
- package/dist/wcs/p-15008e35.entry.js +1 -0
- package/dist/wcs/p-16dfbae8.js +127 -0
- package/dist/wcs/p-17c6db7f.entry.js +1 -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-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-55fdc284.entry.js +1 -0
- package/dist/wcs/p-57247184.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-64523291.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-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-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-b5138986.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-d7dec082.entry.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-e65d1c27.entry.js +1 -0
- package/dist/wcs/p-e9ce507c.entry.js +1 -0
- package/dist/wcs/p-ea3e93e9.entry.js +1 -0
- package/dist/wcs/p-ed6e8541.entry.js +1 -0
- package/dist/wcs/p-f46e6c3c.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-fbaf299d.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.esm.js +1 -1
- package/loader/index.d.ts +0 -1
- package/package.json +22 -21
- 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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3cb9d725.js');
|
|
6
|
+
|
|
7
|
+
const spinnerCss = "@keyframes wcs-spinner-border{to{transform:rotate(360deg)}}@keyframes wcs-spinner-grow{0%{transform:scale(0)}50%{opacity:1}}:host{display:inline-block;width:2rem;height:2rem;vertical-align:text-bottom;border-radius:50%}:host([mode=border]){border:0.25em solid var(--wcs-base);border-right-color:transparent;animation:wcs-spinner-border 0.75s linear infinite}:host([mode=growing]){background-color:var(--wcs-base);opacity:0;animation:wcs-spinner-grow 0.75s linear infinite}";
|
|
8
|
+
|
|
9
|
+
let Spinner = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
/**
|
|
13
|
+
* Indicates the spinner display mode.
|
|
14
|
+
* Accepted values: `border` or `growing`
|
|
15
|
+
*/
|
|
16
|
+
this.mode = 'border';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
Spinner.style = spinnerCss;
|
|
20
|
+
|
|
21
|
+
exports.wcs_spinner = Spinner;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3cb9d725.js');
|
|
6
|
+
|
|
7
|
+
const switchCss = ":host{--wcs-switch-background-color-initial:var(--wcs-text-light);--wcs-switch-background-color-final:var(--wcs-primary);--wcs-switch-bullet-color-initial:var(--wcs-switch-background-color-final);--wcs-switch-bullet-color-final:var(--wcs-switch-background-color-initial);--wcs-switch-text-color:var(--wcs-text-medium);display:flex}:host([disabled]){--wcs-switch-text-color:var(--wcs-text-disabled)}.wcs-container{position:relative;display:flex;margin-bottom:0}:host([label-alignment=top]) .wcs-container{align-items:start}:host([label-alignment=center]) .wcs-container{align-items:center}:host([label-alignment=bottom]) .wcs-container{align-items:flex-end}.wcs-container input{position:absolute;opacity:0;height:0;width:0}.text{color:var(--wcs-switch-text-color);margin-left:6px;font-weight:500;line-height:1.375}.wcs-container:not([aria-disabled]) input:checked~.text{--wcs-switch-text-color:var(--wcs-primary)}.wcs-checkmark::before{position:absolute;transition:all 0.15s ease-out}.wcs-checkmark::before{bottom:0.3125rem;left:0.3125rem;width:0.875rem;height:0.875rem;content:\"\";border-radius:50%;background-color:var(--wcs-switch-bullet-color-initial)}:host([disabled]:not([checked])) .wcs-checkmark::before{background-color:var(--wcs-text-disabled)}:host([disabled]:not([checked])) .wcs-checkmark{background-color:var(--wcs-light)}:host([disabled][checked]) .wcs-checkmark::before{background-color:var(--wcs-white)}:host([disabled][checked]) .wcs-checkmark{background-color:var(--wcs-text-disabled)}.wcs-checkmark{top:0;right:0;bottom:0;left:0;width:3rem;height:1.5rem;border-radius:0.75rem;background-color:var(--wcs-switch-background-color-initial)}.wcs-container:not([aria-disabled]){cursor:pointer}.wcs-container:hover:not([aria-disabled]){--wcs-switch-text-color:var(--wcs-primary)}input:not([disabled]):checked+.wcs-checkmark::before,.wcs-container:hover input:not([disabled])+.wcs-checkmark::before,.wcs-container:focus input:not([disabled])+.wcs-checkmark::before{background-color:var(--wcs-switch-bullet-color-final)}input:checked+.wcs-checkmark::before{transform:translateX(24px)}input:not([disabled]):checked+.wcs-checkmark,.wcs-container:hover input:not([disabled])+.wcs-checkmark,.wcs-container:focus input:not([disabled])+.wcs-checkmark{background-color:var(--wcs-switch-background-color-final)}";
|
|
8
|
+
|
|
9
|
+
let Switch = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.wcsChange = index.createEvent(this, "wcsChange", 7);
|
|
13
|
+
this.switchId = `wcs-switch-${switchIds++}`;
|
|
14
|
+
this.name = this.switchId;
|
|
15
|
+
/**
|
|
16
|
+
* If `true`, the switch is selected.
|
|
17
|
+
*/
|
|
18
|
+
this.checked = false;
|
|
19
|
+
/**
|
|
20
|
+
* Specifie the alignment of the switch with the label content
|
|
21
|
+
*/
|
|
22
|
+
this.labelAlignment = 'center';
|
|
23
|
+
/**
|
|
24
|
+
* Specify wether the switch is disabled or not.
|
|
25
|
+
*/
|
|
26
|
+
this.disabled = false;
|
|
27
|
+
}
|
|
28
|
+
toggleChange(_event) {
|
|
29
|
+
this.checked = !this.checked;
|
|
30
|
+
this.wcsChange.emit({
|
|
31
|
+
checked: this.checked
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return (index.h(index.Host, null, index.h("label", { htmlFor: this.name, class: "wcs-container", "aria-disabled": this.disabled }, index.h("input", { onChange: (evt) => this.toggleChange(evt), checked: this.checked, class: "wcs-switch", type: "checkbox", name: this.name, disabled: this.disabled, id: this.name }), index.h("span", { class: "wcs-checkmark" }), index.h("span", { class: "text" }, index.h("slot", null)))));
|
|
36
|
+
}
|
|
37
|
+
get el() { return index.getElement(this); }
|
|
38
|
+
};
|
|
39
|
+
let switchIds = 0;
|
|
40
|
+
Switch.style = switchCss;
|
|
41
|
+
|
|
42
|
+
exports.wcs_switch = Switch;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3cb9d725.js');
|
|
6
|
+
|
|
7
|
+
let Tab = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.tabLoaded = index.createEvent(this, "tabLoaded", 7);
|
|
11
|
+
}
|
|
12
|
+
componentDidLoad() {
|
|
13
|
+
this.tabLoaded.emit();
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return (index.h(index.Host, { slot: "wcs-tab" }, index.h("slot", null)));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.wcs_tab = Tab;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3cb9d725.js');
|
|
6
|
+
|
|
7
|
+
const tabsCss = ":host{--wcs-tabs-padding-bottom:16px}:host([align=start]) .wcs-tabs-headers{justify-content:start}:host([align=end]) .wcs-tabs-headers{justify-content:end}:host([align=center]) .wcs-tabs-headers{justify-content:center}.wcs-tabs-headers{padding-top:4px;overflow-x:auto;display:flex;position:relative}:host([gutter]) .wcs-tabs-headers{border-bottom:var(--wcs-tabs-headers-border-bottom)}.wcs-tab-header{padding:8px 24px 16px 0;display:flex;flex-shrink:0;align-items:center;justify-content:center;cursor:pointer;outline:none}.wcs-tab-header span{text-align:center;color:var(--wcs-text-disabled);font-size:1rem;font-weight:400}.wcs-tab-header:focus span,.wcs-tab-header:hover span{color:var(--wcs-primary)}.active span{font-weight:500;color:var(--wcs-primary);position:relative}.active span::after{position:absolute;bottom:calc(var(--wcs-tabs-padding-bottom) * -1);left:0;width:100%;height:0.3125rem;content:\"\";background-color:#0088ce;border-radius:3px}";
|
|
8
|
+
|
|
9
|
+
let Tabs = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.tabChange = index.createEvent(this, "tabChange", 7);
|
|
13
|
+
/**
|
|
14
|
+
* Tab headers alignment.
|
|
15
|
+
*/
|
|
16
|
+
this.align = 'start';
|
|
17
|
+
/**
|
|
18
|
+
* Current selected tab index.
|
|
19
|
+
* Starts at 0.
|
|
20
|
+
*/
|
|
21
|
+
this.selectedIndex = 0;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to skip rendering the tabpanel with the content of the selected tab. Use this prop if you plan to
|
|
24
|
+
* separately render the tab content.
|
|
25
|
+
*/
|
|
26
|
+
this.headersOnly = false;
|
|
27
|
+
this.headers = [];
|
|
28
|
+
this.currentActiveTabIndex = 0;
|
|
29
|
+
}
|
|
30
|
+
selectedIndexChanged(newValue) {
|
|
31
|
+
this.currentActiveTabIndex = newValue;
|
|
32
|
+
}
|
|
33
|
+
selectedTabkeyChanged(newValue) {
|
|
34
|
+
this.updateCurrentActiveIndexByTabKey(newValue);
|
|
35
|
+
}
|
|
36
|
+
emitActiveTabChange() {
|
|
37
|
+
this.tabChange.emit({
|
|
38
|
+
tabName: this.headers[this.currentActiveTabIndex],
|
|
39
|
+
tabIndex: this.currentActiveTabIndex,
|
|
40
|
+
selectedKey: this.tabs[this.currentActiveTabIndex].itemKey
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
updateCurrentActiveIndexByTabKey(newValue) {
|
|
44
|
+
for (let i = 0; i < this.tabs.length; i++) {
|
|
45
|
+
const tab = this.tabs[i];
|
|
46
|
+
if (tab.itemKey === newValue) {
|
|
47
|
+
this.currentActiveTabIndex = i;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
onTabLoaded() {
|
|
52
|
+
this.refreshHeaders();
|
|
53
|
+
}
|
|
54
|
+
componentDidLoad() {
|
|
55
|
+
this.putTabsInCorrectDivIfTheyAreNot();
|
|
56
|
+
this.refreshHeaders();
|
|
57
|
+
if (this.selectedIndex) {
|
|
58
|
+
this.currentActiveTabIndex = this.selectedIndex;
|
|
59
|
+
}
|
|
60
|
+
if (this.selectedKey) {
|
|
61
|
+
this.updateCurrentActiveIndexByTabKey(this.selectedKey);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// XXX: Firefox < 63
|
|
65
|
+
putTabsInCorrectDivIfTheyAreNot() {
|
|
66
|
+
const tabDiv = this.el.shadowRoot.querySelector('.wcs-tabs');
|
|
67
|
+
if (tabDiv.querySelector('slot') === null) {
|
|
68
|
+
Array.from(this.el.querySelectorAll('wcs-tab'))
|
|
69
|
+
.filter(node => node.parentNode !== tabDiv)
|
|
70
|
+
.forEach(tab => {
|
|
71
|
+
if (tab.parentElement.isEqualNode(this.el)) {
|
|
72
|
+
this.el.removeChild(tab);
|
|
73
|
+
tabDiv.appendChild(tab);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
handleKeyDown(ev, tabIndex) {
|
|
79
|
+
const target = ev.target;
|
|
80
|
+
switch (ev.key) {
|
|
81
|
+
case ' ':
|
|
82
|
+
case 'Enter': {
|
|
83
|
+
this.currentActiveTabIndex = tabIndex;
|
|
84
|
+
this.emitActiveTabChange();
|
|
85
|
+
ev.preventDefault();
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 'ArrowLeft': {
|
|
89
|
+
if (target.previousElementSibling
|
|
90
|
+
&& target.previousElementSibling.classList.contains('wcs-tab-header')) {
|
|
91
|
+
target.previousElementSibling.focus();
|
|
92
|
+
ev.preventDefault();
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case 'ArrowRight': {
|
|
97
|
+
if (target.nextElementSibling
|
|
98
|
+
&& target.nextElementSibling.classList.contains('wcs-tab-header')) {
|
|
99
|
+
target.nextElementSibling.focus();
|
|
100
|
+
ev.preventDefault();
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
refreshHeaders() {
|
|
107
|
+
this.headers = [];
|
|
108
|
+
this.tabs
|
|
109
|
+
.forEach(x => {
|
|
110
|
+
this.headers.push(x.getAttribute('header'));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
get tabs() {
|
|
114
|
+
const tabsEl = this.el.shadowRoot.querySelector('.wcs-tabs');
|
|
115
|
+
// FIXME: problem with this selector being too greedy in ff < 63
|
|
116
|
+
const tabs = this.el.shadowRoot.querySelectorAll('.wcs-tabs > wcs-tab');
|
|
117
|
+
return tabs.length !== 0
|
|
118
|
+
? tabs
|
|
119
|
+
: tabsEl.querySelector('slot')
|
|
120
|
+
? tabsEl.querySelector('slot').assignedElements()
|
|
121
|
+
: [];
|
|
122
|
+
}
|
|
123
|
+
selectTabAndEmitChangeEvent(index) {
|
|
124
|
+
this.currentActiveTabIndex = index;
|
|
125
|
+
this.emitActiveTabChange();
|
|
126
|
+
}
|
|
127
|
+
componentWillUpdate() {
|
|
128
|
+
if (!this.headersOnly) {
|
|
129
|
+
this.updateTabVisibility();
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
this.hideAllTabsContent();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
updateTabVisibility() {
|
|
136
|
+
this.tabs.forEach((el, idx) => {
|
|
137
|
+
if (idx !== this.currentActiveTabIndex) {
|
|
138
|
+
el.setAttribute('style', 'display: none;');
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
el.setAttribute('style', 'display: block;');
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
hideAllTabsContent() {
|
|
146
|
+
this.tabs.forEach((el) => el.setAttribute('style', 'display: none;'));
|
|
147
|
+
}
|
|
148
|
+
render() {
|
|
149
|
+
return (index.h(index.Host, null, index.h("div", { class: "wcs-tabs-headers" }, this.headers.map((header, idx) => index.h("div", { class: 'wcs-tab-header ' + (this.currentActiveTabIndex === idx ? 'active' : ''), onClick: () => this.selectTabAndEmitChangeEvent(idx), onKeyDown: evt => this.handleKeyDown(evt, idx), tabIndex: idx }, index.h("span", null, header)))), index.h("div", { class: "wcs-tabs" }, index.h("slot", { name: "wcs-tab" }))));
|
|
150
|
+
}
|
|
151
|
+
get el() { return index.getElement(this); }
|
|
152
|
+
static get watchers() { return {
|
|
153
|
+
"selectedIndex": ["selectedIndexChanged"],
|
|
154
|
+
"selectedKey": ["selectedTabkeyChanged"]
|
|
155
|
+
}; }
|
|
156
|
+
};
|
|
157
|
+
Tabs.style = tabsCss;
|
|
158
|
+
|
|
159
|
+
exports.wcs_tabs = Tabs;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3cb9d725.js');
|
|
6
|
+
const helpers = require('./helpers-6abce594.js');
|
|
7
|
+
|
|
8
|
+
const textareaCss = ":host{--wcs-textarea-icon-color:var(--wcs-text-medium);--wcs-internal-textarea-border-radius-left:var(--wcs-textarea-border-radius-left, var(--wcs-border-radius));--wcs-internal-textarea-border-radius-right:var(--wcs-textarea-border-radius-right, var(--wcs-border-radius));display:flex;flex-direction:row;width:100%;border-radius:var(--wcs-internal-textarea-border-radius-left) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-left);background-color:var(--wcs-light);border:1px solid var(--wcs-light);background-clip:padding-box}:host ::placeholder{font-weight:400;font-style:italic}:host textarea{overflow:auto;flex:1;width:100%;box-sizing:border-box;min-height:24px;background-color:transparent;font-family:var(--wcs-font-sans-serif);color:var(--wcs-primary);font-weight:var(--wcs-font-weight-form-value) !important;border:none;padding:calc(var(--wcs-padding) / 2) var(--wcs-padding);font-size:1rem;line-height:1.5}:host textarea:focus{box-shadow:none;outline:0}:host wcs-mat-icon{position:relative;margin-top:7px;margin-left:8px;margin-right:-8px}:host([disabled]) textarea{color:var(--wcs-text-disabled)}:host([state=error]){border-color:var(--wcs-red) !important}:host(:focus-within){border:solid 1px var(--wcs-primary)}:host(:focus-within) wcs-mat-icon{color:var(--wcs-primary)}";
|
|
9
|
+
|
|
10
|
+
let Textarea = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.wcsChange = index.createEvent(this, "wcsChange", 7);
|
|
14
|
+
this.wcsInput = index.createEvent(this, "wcsInput", 7);
|
|
15
|
+
this.wcsBlur = index.createEvent(this, "wcsBlur", 7);
|
|
16
|
+
this.wcsFocus = index.createEvent(this, "wcsFocus", 7);
|
|
17
|
+
this.inputId = `wcs-textarea-${textareaIds++}`;
|
|
18
|
+
this.didBlurAfterEdit = false;
|
|
19
|
+
this.inheritedAttributes = {};
|
|
20
|
+
/**
|
|
21
|
+
* This is required for a WebKit bug which requires us to
|
|
22
|
+
* blur and focus an input to properly focus the input in
|
|
23
|
+
* an item with delegatesFocus. It will no longer be needed
|
|
24
|
+
* with iOS 14.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
this.fireFocusEvents = true;
|
|
29
|
+
this.hasFocus = false;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
|
|
32
|
+
*/
|
|
33
|
+
this.autocapitalize = 'none';
|
|
34
|
+
/**
|
|
35
|
+
* This Boolean attribute lets you specify that a form control should have input focus when the page loads.
|
|
36
|
+
*/
|
|
37
|
+
this.autofocus = false;
|
|
38
|
+
/**
|
|
39
|
+
* If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `"password"`, `false` for all other types.
|
|
40
|
+
*/
|
|
41
|
+
this.clearOnEdit = false;
|
|
42
|
+
/**
|
|
43
|
+
* Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.
|
|
44
|
+
*/
|
|
45
|
+
this.debounce = 0;
|
|
46
|
+
/**
|
|
47
|
+
* If `true`, the user cannot interact with the textarea.
|
|
48
|
+
*/
|
|
49
|
+
this.disabled = false;
|
|
50
|
+
/**
|
|
51
|
+
* The name of the control, which is submitted with the form data.
|
|
52
|
+
*/
|
|
53
|
+
this.name = this.inputId;
|
|
54
|
+
/**
|
|
55
|
+
* If `true`, the user cannot modify the value.
|
|
56
|
+
*/
|
|
57
|
+
this.readonly = false;
|
|
58
|
+
/**
|
|
59
|
+
* If `true`, the user must fill in a value before submitting a form.
|
|
60
|
+
*/
|
|
61
|
+
this.required = false;
|
|
62
|
+
/**
|
|
63
|
+
* If `true`, the element will have its spelling and grammar checked.
|
|
64
|
+
*/
|
|
65
|
+
this.spellcheck = false;
|
|
66
|
+
/**
|
|
67
|
+
* Specifies the state of the input. By default the input is in an initial state but you can set it to 'error' state if the data given by the user is not valid.
|
|
68
|
+
*/
|
|
69
|
+
this.state = 'initial';
|
|
70
|
+
/**
|
|
71
|
+
* If `true`, the element height will increase based on the value.
|
|
72
|
+
*/
|
|
73
|
+
this.autoGrow = false;
|
|
74
|
+
/**
|
|
75
|
+
* The value of the textarea.
|
|
76
|
+
*/
|
|
77
|
+
this.value = '';
|
|
78
|
+
this.onInput = (ev) => {
|
|
79
|
+
if (this.nativeInput) {
|
|
80
|
+
this.value = this.nativeInput.value;
|
|
81
|
+
}
|
|
82
|
+
this.wcsInput.emit(ev);
|
|
83
|
+
};
|
|
84
|
+
this.onFocus = (ev) => {
|
|
85
|
+
this.hasFocus = true;
|
|
86
|
+
this.focusChange();
|
|
87
|
+
if (this.fireFocusEvents) {
|
|
88
|
+
this.wcsFocus.emit(ev);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.onBlur = (ev) => {
|
|
92
|
+
this.hasFocus = false;
|
|
93
|
+
this.focusChange();
|
|
94
|
+
if (this.fireFocusEvents) {
|
|
95
|
+
this.wcsBlur.emit(ev);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.onKeyDown = () => {
|
|
99
|
+
this.checkClearOnEdit();
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
debounceChanged() {
|
|
103
|
+
this.wcsChange = helpers.debounceEvent(this.wcsChange, this.debounce);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Update the native input element when the value changes
|
|
107
|
+
*/
|
|
108
|
+
valueChanged() {
|
|
109
|
+
const nativeInput = this.nativeInput;
|
|
110
|
+
const value = this.getValue();
|
|
111
|
+
if (nativeInput && nativeInput.value !== value) {
|
|
112
|
+
nativeInput.value = value;
|
|
113
|
+
}
|
|
114
|
+
this.runAutoGrow();
|
|
115
|
+
this.wcsChange.emit({ value });
|
|
116
|
+
}
|
|
117
|
+
connectedCallback() {
|
|
118
|
+
this.debounceChanged();
|
|
119
|
+
{
|
|
120
|
+
document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {
|
|
121
|
+
detail: this.el
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
{
|
|
127
|
+
document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {
|
|
128
|
+
detail: this.el
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
componentWillLoad() {
|
|
133
|
+
this.inheritedAttributes = helpers.inheritAttributes(this.el, ['title']);
|
|
134
|
+
}
|
|
135
|
+
componentDidLoad() {
|
|
136
|
+
helpers.raf(() => this.runAutoGrow());
|
|
137
|
+
}
|
|
138
|
+
runAutoGrow() {
|
|
139
|
+
const nativeInput = this.nativeInput;
|
|
140
|
+
if (nativeInput && this.autoGrow) {
|
|
141
|
+
index.readTask(() => {
|
|
142
|
+
nativeInput.style.height = 'auto';
|
|
143
|
+
nativeInput.style.height = nativeInput.scrollHeight + 'px';
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* This method make the textarea automatically adopt the size of the content without a scroll bar
|
|
149
|
+
*/
|
|
150
|
+
async fitContent() {
|
|
151
|
+
helpers.raf(() => this.runAutoGrow());
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Sets focus on the native `textarea` in `wcs-textarea`. Use this method instead of the global
|
|
155
|
+
* `textarea.focus()`.
|
|
156
|
+
*/
|
|
157
|
+
async setFocus() {
|
|
158
|
+
if (this.nativeInput) {
|
|
159
|
+
this.nativeInput.focus();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Sets blur on the native `textarea` in `wcs-textarea`. Use this method instead of the global
|
|
164
|
+
* `textarea.blur()`.
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
async setBlur() {
|
|
168
|
+
if (this.nativeInput) {
|
|
169
|
+
this.nativeInput.blur();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Returns the native `<textarea>` element used under the hood.
|
|
174
|
+
*/
|
|
175
|
+
getInputElement() {
|
|
176
|
+
// tslint:disable-next-line:no-non-null-assertion
|
|
177
|
+
return Promise.resolve(this.nativeInput);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if we need to clear the text input if clearOnEdit is enabled
|
|
181
|
+
*/
|
|
182
|
+
checkClearOnEdit() {
|
|
183
|
+
if (!this.clearOnEdit) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// Did the input value change after it was blurred and edited?
|
|
187
|
+
if (this.didBlurAfterEdit && this.hasValue()) {
|
|
188
|
+
// Clear the input
|
|
189
|
+
this.value = '';
|
|
190
|
+
}
|
|
191
|
+
// Reset the flag
|
|
192
|
+
this.didBlurAfterEdit = false;
|
|
193
|
+
}
|
|
194
|
+
focusChange() {
|
|
195
|
+
// If clearOnEdit is enabled and the input blurred but has a value, set a flag
|
|
196
|
+
if (this.clearOnEdit && !this.hasFocus && this.hasValue()) {
|
|
197
|
+
this.didBlurAfterEdit = true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
hasValue() {
|
|
201
|
+
return this.getValue() !== '';
|
|
202
|
+
}
|
|
203
|
+
getValue() {
|
|
204
|
+
return this.value || '';
|
|
205
|
+
}
|
|
206
|
+
render() {
|
|
207
|
+
const value = this.getValue();
|
|
208
|
+
const labelId = this.inputId + '-lbl';
|
|
209
|
+
const label = helpers.findItemLabel(this.el);
|
|
210
|
+
if (label) {
|
|
211
|
+
label.id = labelId;
|
|
212
|
+
}
|
|
213
|
+
return (index.h(index.Host, { "aria-disabled": this.disabled ? 'true' : null }, this.icon ? (index.h("wcs-mat-icon", { icon: this.icon, size: "m" })) : null, index.h("textarea", Object.assign({ class: "native-textarea", "aria-labelledby": label ? labelId : null, ref: el => this.nativeInput = el, autoCapitalize: this.autocapitalize, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, disabled: this.disabled, maxLength: this.maxlength, minLength: this.minlength, name: this.name, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, cols: this.cols, rows: this.rows, wrap: this.wrap, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown }, this.inheritedAttributes), value)));
|
|
214
|
+
}
|
|
215
|
+
get el() { return index.getElement(this); }
|
|
216
|
+
static get watchers() { return {
|
|
217
|
+
"debounce": ["debounceChanged"],
|
|
218
|
+
"value": ["valueChanged"]
|
|
219
|
+
}; }
|
|
220
|
+
};
|
|
221
|
+
let textareaIds = 0;
|
|
222
|
+
Textarea.style = textareaCss;
|
|
223
|
+
|
|
224
|
+
exports.wcs_textarea = Textarea;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3cb9d725.js');
|
|
6
|
+
|
|
7
|
+
let overlayElement;
|
|
8
|
+
function getOverlay() {
|
|
9
|
+
if (!overlayElement) {
|
|
10
|
+
createOverlay();
|
|
11
|
+
}
|
|
12
|
+
return overlayElement;
|
|
13
|
+
}
|
|
14
|
+
function createOverlay() {
|
|
15
|
+
const existent = document.querySelector('.wcs-overlay');
|
|
16
|
+
overlayElement = existent
|
|
17
|
+
? existent
|
|
18
|
+
: document.createElement('div');
|
|
19
|
+
overlayElement.classList.add('wcs-overlay');
|
|
20
|
+
document.body.appendChild(overlayElement);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let Tooltip = class {
|
|
24
|
+
constructor(hostRef) {
|
|
25
|
+
index.registerInstance(this, hostRef);
|
|
26
|
+
/**
|
|
27
|
+
* Where the tooltip is going to show relative to the element it's describing.
|
|
28
|
+
*/
|
|
29
|
+
this.position = 'bottom';
|
|
30
|
+
}
|
|
31
|
+
componentWillLoad() {
|
|
32
|
+
const target = document.getElementById(this.for);
|
|
33
|
+
if (target === null) {
|
|
34
|
+
throw new Error(`Cannot find element with corresponding id: ${this.for}`);
|
|
35
|
+
}
|
|
36
|
+
this.target = target;
|
|
37
|
+
this.listen('mouseenter', 'show');
|
|
38
|
+
this.listen('focus', 'show');
|
|
39
|
+
this.listen('mouseleave', 'hide');
|
|
40
|
+
this.listen('blur', 'hide');
|
|
41
|
+
this.listen('tap', 'hide');
|
|
42
|
+
}
|
|
43
|
+
listen(eventName, className) {
|
|
44
|
+
this.target.addEventListener(eventName, () => {
|
|
45
|
+
if (className === 'hide') {
|
|
46
|
+
this.content.classList.replace('show', 'hide');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.content.classList.replace('hide', 'show');
|
|
50
|
+
}
|
|
51
|
+
this.updatePosition();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
componentDidRender() {
|
|
55
|
+
const overlay = getOverlay();
|
|
56
|
+
this.content = this.el.shadowRoot.querySelector('.wcs-tooltip-content');
|
|
57
|
+
const nodes = this.el.shadowRoot.querySelector('slot')
|
|
58
|
+
? this.el.shadowRoot.querySelector('slot').assignedNodes()
|
|
59
|
+
: this.content.querySelectorAll('*');
|
|
60
|
+
nodes.forEach(n => this.content.appendChild(n.cloneNode(true)));
|
|
61
|
+
this.content.remove();
|
|
62
|
+
overlay.appendChild(this.content);
|
|
63
|
+
this.updatePosition();
|
|
64
|
+
}
|
|
65
|
+
updatePosition() {
|
|
66
|
+
// Function taken and adapted from https://github.com/PolymerElements/paper-tooltip/blob/master/paper-tooltip.js
|
|
67
|
+
// Thanks ! :-)
|
|
68
|
+
if (!this.target || !this.content.offsetParent) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const parentRect = this.content.offsetParent.getBoundingClientRect();
|
|
72
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
73
|
+
const thisRect = this.content.getBoundingClientRect();
|
|
74
|
+
const borderWidth = 6;
|
|
75
|
+
const horizontalCenterOffset = (targetRect.width - thisRect.width) / 2;
|
|
76
|
+
const verticalCenterOffset = (targetRect.height - thisRect.height) / 2;
|
|
77
|
+
const targetLeft = targetRect.left - parentRect.left;
|
|
78
|
+
const targetTop = targetRect.top - parentRect.top;
|
|
79
|
+
let tooltipLeft;
|
|
80
|
+
let tooltipTop;
|
|
81
|
+
switch (this.position) {
|
|
82
|
+
case 'top':
|
|
83
|
+
tooltipLeft = targetLeft + horizontalCenterOffset;
|
|
84
|
+
tooltipTop = targetTop - thisRect.height - borderWidth;
|
|
85
|
+
break;
|
|
86
|
+
case 'bottom':
|
|
87
|
+
tooltipLeft = targetLeft + horizontalCenterOffset;
|
|
88
|
+
tooltipTop = targetTop + targetRect.height + borderWidth;
|
|
89
|
+
break;
|
|
90
|
+
case 'left':
|
|
91
|
+
tooltipLeft = targetLeft - thisRect.width - borderWidth;
|
|
92
|
+
tooltipTop = targetTop + verticalCenterOffset;
|
|
93
|
+
break;
|
|
94
|
+
case 'right':
|
|
95
|
+
tooltipLeft = targetLeft + targetRect.width + borderWidth;
|
|
96
|
+
tooltipTop = targetTop + verticalCenterOffset;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
// Clip to the left/right side.
|
|
100
|
+
if (parentRect.left + tooltipLeft + thisRect.width > window.innerWidth) {
|
|
101
|
+
this.content.style.right = '0px';
|
|
102
|
+
this.content.style.left = 'auto';
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.content.style.left = Math.max(0, tooltipLeft) + 'px';
|
|
106
|
+
this.content.style.right = 'auto';
|
|
107
|
+
}
|
|
108
|
+
// Clip the top/bottom side.
|
|
109
|
+
if (parentRect.top + tooltipTop + thisRect.height > window.innerHeight) {
|
|
110
|
+
this.content.style.bottom = (parentRect.height - targetTop) + 'px';
|
|
111
|
+
this.content.style.top = 'auto';
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.content.style.top = Math.max(-parentRect.top, tooltipTop) + 'px';
|
|
115
|
+
this.content.style.bottom = 'auto';
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
disconnectedCallback() {
|
|
119
|
+
// TODO: this gets called only at the component creation in ff < 63
|
|
120
|
+
// const overlay = getOverlay();
|
|
121
|
+
// overlay.removeChild(this.content);
|
|
122
|
+
}
|
|
123
|
+
render() {
|
|
124
|
+
return (index.h(index.Host, null, index.h("div", { class: "wcs-tooltip-content hide" }, index.h("slot", null))));
|
|
125
|
+
}
|
|
126
|
+
get el() { return index.getElement(this); }
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports.wcs_tooltip = Tooltip;
|
package/dist/cjs/wcs.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-3cb9d725.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v2.
|
|
6
|
+
Stencil Client Patch Browser v2.10.0 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
const patchBrowser = () => {
|
|
9
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('wcs.cjs.js', document.baseURI).href));
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["wcs-
|
|
18
|
+
return index.bootstrapLazy([["wcs-editable-field.cjs",[[1,"wcs-editable-field",{"type":[1],"label":[1],"readonly":[4],"value":[1032],"validateFn":[16],"formatFn":[16],"errorMsg":[1,"error-msg"],"currentState":[32],"isError":[32]},[[8,"click","onWindowClickEvent"]]]]],["wcs-grid.cjs",[[1,"wcs-grid",{"serverMode":[4,"server-mode"],"data":[16],"loading":[4],"selectionConfig":[1,"selection-config"],"selectedItems":[8,"selected-items"],"wcsGridPaginationId":[1,"wcs-grid-pagination-id"],"rowIdPath":[1,"row-id-path"],"columns":[32],"paginationEl":[32],"rows":[32]},[[0,"wcsHiddenChange","onHiddenColumnChange"],[0,"wcsSortChange","sortChangeEventHandler"],[0,"wcsGridPaginationChange","paginationChangeEventHandler"],[8,"wcsGridPaginationChange","paginationChangeEventHandlerOutside"]]]]],["wcs-grid-pagination.cjs",[[1,"wcs-grid-pagination",{"availablePageSizes":[16],"currentPage":[2,"current-page"],"pageSize":[2,"page-size"],"itemsCount":[2,"items-count"],"pageCount":[2,"page-count"]}]]],["wcs-horizontal-stepper.cjs",[[1,"wcs-horizontal-stepper",{"currentStep":[1026,"current-step"],"steps":[16],"mode":[1],"checkOnComplete":[4,"check-on-complete"],"buttonMode":[32],"internalCurrentStep":[32],"previous":[64],"next":[64]}]]],["wcs-dropdown.cjs",[[1,"wcs-dropdown",{"noArrow":[4,"no-arrow"],"mode":[1],"shape":[1],"disabled":[4],"placement":[1],"expanded":[32]},[[8,"click","onWindowClickEvent"],[0,"wcsDropdownItemClick","dropdownItemClick"]]]]],["wcs-galactic-menu.cjs",[[1,"wcs-galactic-menu",{"text":[1],"showPopoverMenu":[32]},[[8,"click","onWindowClickEvent"]]]]],["wcs-input.cjs",[[1,"wcs-input",{"fireFocusEvents":[4,"fire-focus-events"],"accept":[1],"autocapitalize":[1],"autocomplete":[1],"autocorrect":[1],"autofocus":[4],"clearInput":[4,"clear-input"],"clearOnEdit":[4,"clear-on-edit"],"debounce":[2],"prefixLabel":[1,"prefix-label"],"suffixLabel":[1,"suffix-label"],"disabled":[4],"enterkeyhint":[1],"icon":[1],"inputmode":[1],"max":[1],"maxlength":[2],"min":[1],"minlength":[2],"multiple":[4],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[4],"required":[4],"spellcheck":[4],"state":[513],"step":[1],"size":[2],"type":[1],"value":[1032],"hasFocus":[32],"setFocus":[64],"setBlur":[64],"getInputElement":[64]}]]],["wcs-modal.cjs",[[4,"wcs-modal",{"backdrop":[516],"show":[1540],"showCloseButton":[516,"show-close-button"]},[[4,"keydown","onKeyDown"]]]]],["wcs-textarea.cjs",[[1,"wcs-textarea",{"fireFocusEvents":[4,"fire-focus-events"],"autocapitalize":[1],"autofocus":[4],"clearOnEdit":[1028,"clear-on-edit"],"debounce":[2],"disabled":[4],"icon":[1],"inputmode":[1],"enterkeyhint":[1],"maxlength":[2],"minlength":[2],"name":[1],"placeholder":[1],"readonly":[4],"required":[4],"spellcheck":[4],"state":[513],"cols":[2],"rows":[2],"wrap":[1],"autoGrow":[4,"auto-grow"],"value":[1025],"hasFocus":[32],"fitContent":[64],"setFocus":[64],"setBlur":[64],"getInputElement":[64]}]]],["wcs-action-bar.cjs",[[1,"wcs-action-bar",{"gutter":[4],"hasTabs":[32]}]]],["wcs-app.cjs",[[1,"wcs-app"]]],["wcs-badge.cjs",[[1,"wcs-badge",{"shape":[1],"color":[1]}]]],["wcs-card.cjs",[[1,"wcs-card",{"mode":[1537]}]]],["wcs-card-body.cjs",[[1,"wcs-card-body"]]],["wcs-com-nav.cjs",[[1,"wcs-com-nav",{"appName":[1,"app-name"]}]]],["wcs-com-nav-category.cjs",[[1,"wcs-com-nav-category",{"label":[1],"categoryOpen":[32],"close":[64],"open":[64]},[[8,"click","onWindowClickEvent"],[8,"wcsCategoryOpened","onSubmenuOpened"]]]]],["wcs-com-nav-submenu.cjs",[[1,"wcs-com-nav-submenu",{"label":[1],"panelTitle":[1,"panel-title"],"panelDescription":[1,"panel-description"],"menuOpen":[32],"close":[64],"open":[64]},[[8,"click","onWindowClickEvent"],[8,"wcsSubmenuOpened","onSubmenuOpened"],[0,"wcsCategoryItemClicked","wcsCategoryItemClickedHandler"]]]]],["wcs-divider.cjs",[[1,"wcs-divider"]]],["wcs-dropdown-divider.cjs",[[1,"wcs-dropdown-divider"]]],["wcs-dropdown-header.cjs",[[1,"wcs-dropdown-header"]]],["wcs-dropdown-item.cjs",[[4,"wcs-dropdown-item",null,[[1,"mousedown","onMouseDown"]]]]],["wcs-field.cjs",[[1,"wcs-field"]]],["wcs-field-content.cjs",[[1,"wcs-field-content"]]],["wcs-field-label.cjs",[[1,"wcs-field-label"]]],["wcs-footer.cjs",[[1,"wcs-footer"]]],["wcs-galactic.cjs",[[1,"wcs-galactic",{"text":[1],"show":[32]}]]],["wcs-grid-column.cjs",[[1,"wcs-grid-column",{"path":[1],"name":[1],"sort":[4],"sortFn":[16],"formatter":[16],"sortOrder":[1025,"sort-order"],"width":[1],"customCells":[4,"custom-cells"],"hidden":[4]}]]],["wcs-grid-custom-cell.cjs",[[1,"wcs-grid-custom-cell",{"columnId":[1,"column-id"],"rowId":[8,"row-id"]}]]],["wcs-header.cjs",[[1,"wcs-header"]]],["wcs-hint.cjs",[[1,"wcs-hint",{"small":[1540]}]]],["wcs-icon.cjs",[[0,"wcs-icon",{"icon":[1],"size":[1]}]]],["wcs-label.cjs",[[1,"wcs-label",{"required":[516]}]]],["wcs-list-item.cjs",[[1,"wcs-list-item",{"activated":[1028]}]]],["wcs-list-item-properties.cjs",[[1,"wcs-list-item-properties"]]],["wcs-list-item-property.cjs",[[1,"wcs-list-item-property"]]],["wcs-nav.cjs",[[1,"wcs-nav"]]],["wcs-nav-item.cjs",[[4,"wcs-nav-item",{"text":[513],"href":[1537]}]]],["wcs-progress-radial.cjs",[[1,"wcs-progress-radial",{"size":[2],"showLabel":[4,"show-label"],"value":[2]}]]],["wcs-radio-group.cjs",[[1,"wcs-radio-group",{"value":[8],"name":[520],"mode":[513]},[[0,"wcsRadioClick","selectedOptionChanged"]]]]],["wcs-switch.cjs",[[1,"wcs-switch",{"name":[1],"checked":[516],"labelAlignment":[513,"label-alignment"],"disabled":[4]}]]],["wcs-tab.cjs",[[1,"wcs-tab",{"header":[1537],"itemKey":[8,"item-key"]}]]],["wcs-tabs.cjs",[[1,"wcs-tabs",{"align":[1537],"selectedIndex":[2,"selected-index"],"selectedKey":[8,"selected-key"],"headersOnly":[4,"headers-only"],"gutter":[4],"headers":[32],"currentActiveTabIndex":[32]},[[0,"tabLoaded","onTabLoaded"]]]]],["wcs-tooltip.cjs",[[1,"wcs-tooltip",{"for":[513],"position":[513]}]]],["wcs-progress-bar.cjs",[[1,"wcs-progress-bar",{"small":[1028],"showLabel":[1028,"show-label"],"value":[1026]}]]],["wcs-radio.cjs",[[1,"wcs-radio",{"mode":[513],"value":[1544],"label":[1537],"checked":[1540],"disabled":[1028]}]]],["wcs-select_2.cjs",[[4,"wcs-select-option",{"disabled":[1540],"selected":[1540],"value":[8],"chipColor":[1,"chip-color"],"chipBackgroundColor":[1,"chip-background-color"],"multiple":[1540]},[[1,"mousedown","onMouseDown"]]],[1,"wcs-select",{"value":[1032],"placeholder":[1537],"disabled":[1028],"multiple":[516],"chips":[516],"name":[1],"compareWith":[16],"expanded":[32],"hasLoaded":[32],"displayText":[32],"focused":[32],"overlayDirection":[32],"open":[64],"close":[64]},[[1,"mousedown","onMouseDown"],[8,"click","onWindowClickEvent"],[0,"wcsSelectOptionClick","selectedOptionChanged"]]]]],["wcs-error_2.cjs",[[1,"wcs-error"],[1,"wcs-form-field",{"isError":[1540,"is-error"],"icon":[8],"hasPrefix":[32],"hasSuffix":[32],"spiedElement":[32]}]]],["wcs-spinner.cjs",[[1,"wcs-spinner",{"mode":[1537]}]]],["wcs-button.cjs",[[1,"wcs-button",{"type":[1025],"href":[1],"disabled":[516],"ripple":[4],"shape":[513],"mode":[513]},[[0,"click","onClick"]]]]],["wcs-checkbox.cjs",[[1,"wcs-checkbox",{"name":[1],"indeterminate":[1540],"checked":[1540],"labelAlignment":[1537,"label-alignment"],"disabled":[4]}]]],["wcs-mat-icon.cjs",[[1,"wcs-mat-icon",{"icon":[1],"size":[1],"family":[1],"familyFile":[32],"familyClass":[32]}]]]], options);
|
|
19
19
|
});
|