wcs-core 2.8.0 → 2.11.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 +72 -6
- package/README.md +2 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/wcs-accordion-content.cjs.entry.js +19 -0
- package/dist/cjs/wcs-accordion-header.cjs.entry.js +16 -0
- package/dist/cjs/wcs-accordion-panel.cjs.entry.js +31 -0
- package/dist/cjs/wcs-accordion.cjs.entry.js +36 -0
- package/dist/cjs/wcs-button.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js +3 -1
- package/dist/cjs/wcs-error_2.cjs.entry.js +6 -9
- package/dist/cjs/wcs-grid-column.cjs.entry.js +1 -1
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +13 -10
- package/dist/cjs/wcs-mat-icon.cjs.entry.js +1 -1
- package/dist/cjs/wcs-modal.cjs.entry.js +11 -2
- package/dist/cjs/wcs-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/wcs-radio.cjs.entry.js +1 -1
- package/dist/cjs/wcs-tooltip.cjs.entry.js +10 -3
- package/dist/cjs/wcs.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/accordion/accordion.js +38 -0
- package/dist/collection/components/accordion-content/accordion-content.css +4 -0
- package/dist/collection/components/accordion-content/accordion-content.js +15 -0
- package/dist/collection/components/accordion-header/accordion-header.js +9 -0
- package/dist/collection/components/accordion-panel/accordion-panel.css +35 -0
- package/dist/collection/components/accordion-panel/accordion-panel.js +89 -0
- package/dist/collection/components/button/button.css +12 -4
- package/dist/collection/components/dropdown/dropdown.js +3 -1
- package/dist/collection/components/form-field/form-field.js +6 -9
- package/dist/collection/components/grid-column/grid-column.js +2 -2
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +14 -11
- package/dist/collection/components/mat-icon/mat-icon.css +3 -1
- package/dist/collection/components/modal/modal-interface.js +1 -0
- package/dist/collection/components/modal/modal.css +33 -30
- package/dist/collection/components/modal/modal.js +55 -6
- package/dist/collection/components/radio/radio.css +1 -1
- package/dist/collection/components/radio-group/radio-group.css +1 -1
- package/dist/collection/components/tooltip/tooltip.js +28 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/wcs-accordion-content.entry.js +15 -0
- package/dist/esm/wcs-accordion-header.entry.js +12 -0
- package/dist/esm/wcs-accordion-panel.entry.js +27 -0
- package/dist/esm/wcs-accordion.entry.js +32 -0
- package/dist/esm/wcs-button.entry.js +1 -1
- package/dist/esm/wcs-dropdown.entry.js +3 -1
- package/dist/esm/wcs-error_2.entry.js +6 -9
- package/dist/esm/wcs-grid-column.entry.js +1 -1
- package/dist/esm/wcs-horizontal-stepper.entry.js +13 -10
- package/dist/esm/wcs-mat-icon.entry.js +1 -1
- package/dist/esm/wcs-modal.entry.js +11 -2
- package/dist/esm/wcs-radio-group.entry.js +1 -1
- package/dist/esm/wcs-radio.entry.js +1 -1
- package/dist/esm/wcs-tooltip.entry.js +10 -3
- package/dist/esm/wcs.js +2 -2
- package/dist/types/components/accordion/accordion.d.ts +12 -0
- package/dist/types/components/accordion-content/accordion-content.d.ts +3 -0
- package/dist/types/components/accordion-header/accordion-header.d.ts +3 -0
- package/dist/types/components/accordion-panel/accordion-panel.d.ts +8 -0
- package/dist/types/components/grid-column/grid-column.d.ts +1 -1
- package/dist/types/components/modal/modal-interface.d.ts +1 -0
- package/dist/types/components/modal/modal.d.ts +10 -0
- package/dist/types/components/tooltip/tooltip.d.ts +12 -0
- package/dist/types/components.d.ts +81 -0
- package/dist/types/interfaces.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/wcs/p-0c397250.entry.js +1 -0
- package/dist/wcs/p-2507b398.entry.js +1 -0
- package/dist/wcs/{p-ecbe5165.entry.js → p-3d1924c8.entry.js} +1 -1
- package/dist/wcs/{p-22813c8e.entry.js → p-66e74651.entry.js} +1 -1
- package/dist/wcs/p-706d195a.entry.js +1 -0
- package/dist/wcs/{p-0a103e06.entry.js → p-9619f77a.entry.js} +1 -1
- package/dist/wcs/p-bcf381a2.entry.js +1 -0
- package/dist/wcs/p-c295cfca.entry.js +1 -0
- package/dist/wcs/p-cf77e1d9.entry.js +1 -0
- package/dist/wcs/p-d45c7c63.entry.js +1 -0
- package/dist/wcs/p-df5baf36.entry.js +1 -0
- package/dist/wcs/{p-ff6d0dfd.entry.js → p-f00ef24c.entry.js} +1 -1
- package/dist/wcs/{p-57247184.entry.js → p-f430a227.entry.js} +1 -1
- package/dist/wcs/{p-1e16709a.entry.js → p-f96bb0bf.entry.js} +1 -1
- package/dist/wcs/wcs.esm.js +1 -1
- package/package.json +2 -3
- package/dist/wcs/p-08a7e84d.entry.js +0 -1
- package/dist/wcs/p-6b8d2bc7.entry.js +0 -1
- package/dist/wcs/p-94a31f64.entry.js +0 -1
- package/dist/wcs/p-b5ffbea8.entry.js +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Component, Element, h, Host, Listen } from '@stencil/core';
|
|
2
|
+
export class Accordion {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.accordionPanels = [];
|
|
5
|
+
}
|
|
6
|
+
componentWillLoad() {
|
|
7
|
+
this.accordionPanels = this.getAllAccordionPanelsFromHostElement();
|
|
8
|
+
}
|
|
9
|
+
wcsOpenChangeHandler(event) {
|
|
10
|
+
if (event.detail) {
|
|
11
|
+
this.closeAllAccordionsExcept(event.target);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return (h(Host, null,
|
|
16
|
+
h("slot", null)));
|
|
17
|
+
}
|
|
18
|
+
getAllAccordionPanelsFromHostElement() {
|
|
19
|
+
return Array.from(this.el.children)
|
|
20
|
+
.filter(el => el.tagName === 'WCS-ACCORDION-PANEL');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Close all accordion panels except the one that match the eventTarget reference
|
|
24
|
+
*/
|
|
25
|
+
closeAllAccordionsExcept(eventTarget) {
|
|
26
|
+
this.accordionPanels.filter(a => a !== eventTarget).forEach(a => a.close());
|
|
27
|
+
}
|
|
28
|
+
static get is() { return "wcs-accordion"; }
|
|
29
|
+
static get encapsulation() { return "shadow"; }
|
|
30
|
+
static get elementRef() { return "el"; }
|
|
31
|
+
static get listeners() { return [{
|
|
32
|
+
"name": "wcsOpenChange",
|
|
33
|
+
"method": "wcsOpenChangeHandler",
|
|
34
|
+
"target": undefined,
|
|
35
|
+
"capture": false,
|
|
36
|
+
"passive": false
|
|
37
|
+
}]; }
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, h, Host } from '@stencil/core';
|
|
2
|
+
export class AccordionContent {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, { slot: "content" },
|
|
5
|
+
h("slot", null)));
|
|
6
|
+
}
|
|
7
|
+
static get is() { return "wcs-accordion-content"; }
|
|
8
|
+
static get encapsulation() { return "shadow"; }
|
|
9
|
+
static get originalStyleUrls() { return {
|
|
10
|
+
"$": ["accordion-content.scss"]
|
|
11
|
+
}; }
|
|
12
|
+
static get styleUrls() { return {
|
|
13
|
+
"$": ["accordion-content.css"]
|
|
14
|
+
}; }
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component, h, Host } from '@stencil/core';
|
|
2
|
+
export class AccordionHeader {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, { slot: "header" },
|
|
5
|
+
h("slot", null)));
|
|
6
|
+
}
|
|
7
|
+
static get is() { return "wcs-accordion-header"; }
|
|
8
|
+
static get encapsulation() { return "shadow"; }
|
|
9
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
margin-bottom: 16px;
|
|
6
|
+
}
|
|
7
|
+
:host .header {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
padding: 14px 24px;
|
|
12
|
+
border-radius: 7px;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
color: var(--wcs-primary);
|
|
16
|
+
background-color: var(--wcs-light);
|
|
17
|
+
}
|
|
18
|
+
:host .header-action {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
user-select: none;
|
|
22
|
+
}
|
|
23
|
+
:host .header-action .arrow {
|
|
24
|
+
fill: var(--wcs-primary);
|
|
25
|
+
}
|
|
26
|
+
:host .content {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([open]) {
|
|
31
|
+
margin-bottom: 0;
|
|
32
|
+
}
|
|
33
|
+
:host([open]) .content {
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Component, h, Host, Prop, Event, Watch, Method } from '@stencil/core';
|
|
2
|
+
import { SelectArrow } from '../select/select-arrow';
|
|
3
|
+
export class AccordionPanel {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.open = false;
|
|
6
|
+
}
|
|
7
|
+
openChange(newValue) {
|
|
8
|
+
this.wcsOpenChange.emit(newValue);
|
|
9
|
+
}
|
|
10
|
+
async close() {
|
|
11
|
+
this.open = false;
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return (h(Host, null,
|
|
15
|
+
h("div", { class: "header", onClick: () => this.open = !this.open },
|
|
16
|
+
h("slot", { name: "header" }),
|
|
17
|
+
h("div", { class: "header-action" },
|
|
18
|
+
h("span", null, this.open ? 'Fermez' : 'Ouvrez'),
|
|
19
|
+
h(SelectArrow, { up: this.open }))),
|
|
20
|
+
h("div", { class: "content" },
|
|
21
|
+
h("slot", { name: "content" }))));
|
|
22
|
+
}
|
|
23
|
+
static get is() { return "wcs-accordion-panel"; }
|
|
24
|
+
static get encapsulation() { return "shadow"; }
|
|
25
|
+
static get originalStyleUrls() { return {
|
|
26
|
+
"$": ["accordion-panel.scss"]
|
|
27
|
+
}; }
|
|
28
|
+
static get styleUrls() { return {
|
|
29
|
+
"$": ["accordion-panel.css"]
|
|
30
|
+
}; }
|
|
31
|
+
static get properties() { return {
|
|
32
|
+
"open": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"mutable": true,
|
|
35
|
+
"complexType": {
|
|
36
|
+
"original": "boolean",
|
|
37
|
+
"resolved": "boolean",
|
|
38
|
+
"references": {}
|
|
39
|
+
},
|
|
40
|
+
"required": false,
|
|
41
|
+
"optional": false,
|
|
42
|
+
"docs": {
|
|
43
|
+
"tags": [],
|
|
44
|
+
"text": ""
|
|
45
|
+
},
|
|
46
|
+
"attribute": "open",
|
|
47
|
+
"reflect": true,
|
|
48
|
+
"defaultValue": "false"
|
|
49
|
+
}
|
|
50
|
+
}; }
|
|
51
|
+
static get events() { return [{
|
|
52
|
+
"method": "wcsOpenChange",
|
|
53
|
+
"name": "wcsOpenChange",
|
|
54
|
+
"bubbles": true,
|
|
55
|
+
"cancelable": true,
|
|
56
|
+
"composed": true,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"complexType": {
|
|
62
|
+
"original": "boolean",
|
|
63
|
+
"resolved": "boolean",
|
|
64
|
+
"references": {}
|
|
65
|
+
}
|
|
66
|
+
}]; }
|
|
67
|
+
static get methods() { return {
|
|
68
|
+
"close": {
|
|
69
|
+
"complexType": {
|
|
70
|
+
"signature": "() => Promise<void>",
|
|
71
|
+
"parameters": [],
|
|
72
|
+
"references": {
|
|
73
|
+
"Promise": {
|
|
74
|
+
"location": "global"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"return": "Promise<void>"
|
|
78
|
+
},
|
|
79
|
+
"docs": {
|
|
80
|
+
"text": "",
|
|
81
|
+
"tags": []
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}; }
|
|
85
|
+
static get watchers() { return [{
|
|
86
|
+
"propName": "open",
|
|
87
|
+
"methodName": "openChange"
|
|
88
|
+
}]; }
|
|
89
|
+
}
|
|
@@ -201,6 +201,10 @@
|
|
|
201
201
|
:host([shape=small]) {
|
|
202
202
|
--wcs-button-padding: 2px 16px;
|
|
203
203
|
}
|
|
204
|
+
:host([shape=small]) .wcs-inner-button {
|
|
205
|
+
min-width: var(--wcs-button-min-width, unset);
|
|
206
|
+
min-height: var(--wcs-button-min-height, unset);
|
|
207
|
+
}
|
|
204
208
|
|
|
205
209
|
:host([shape=round]) {
|
|
206
210
|
--wcs-button-padding: 0;
|
|
@@ -210,8 +214,8 @@
|
|
|
210
214
|
display: inline-flex;
|
|
211
215
|
align-items: center;
|
|
212
216
|
justify-content: center;
|
|
213
|
-
min-width: 42px;
|
|
214
|
-
min-height: 42px;
|
|
217
|
+
min-width: var(--wcs-button-min-width, 42px);
|
|
218
|
+
min-height: var(--wcs-button-min-height, 42px);
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
:host([shape=square]) {
|
|
@@ -221,13 +225,17 @@
|
|
|
221
225
|
display: inline-flex;
|
|
222
226
|
align-items: center;
|
|
223
227
|
justify-content: center;
|
|
224
|
-
min-width: 42px;
|
|
225
|
-
min-height: 42px;
|
|
228
|
+
min-width: var(--wcs-button-min-width, 42px);
|
|
229
|
+
min-height: var(--wcs-button-min-height, 42px);
|
|
226
230
|
}
|
|
227
231
|
|
|
228
232
|
:host([shape=normal]) {
|
|
229
233
|
--wcs-button-padding: calc(var(--wcs-padding) / 2 + 1px) calc(var(--wcs-padding));
|
|
230
234
|
}
|
|
235
|
+
:host([shape=normal]) .wcs-inner-button {
|
|
236
|
+
min-width: var(--wcs-button-min-width, unset);
|
|
237
|
+
min-height: var(--wcs-button-min-height, unset);
|
|
238
|
+
}
|
|
231
239
|
|
|
232
240
|
:host([mode=stroked]) .wcs-inner-button {
|
|
233
241
|
box-shadow: inset 0 0 0 1px var(--wcs-button-border-color);
|
|
@@ -35,7 +35,9 @@ export class Dropdown {
|
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
});
|
|
38
|
-
this.
|
|
38
|
+
if (!this.noArrow) {
|
|
39
|
+
this.el.shadowRoot.querySelector('.arrow').style.fill = this.buttonTextColor;
|
|
40
|
+
}
|
|
39
41
|
this.fixForFirefoxBelow63();
|
|
40
42
|
}
|
|
41
43
|
fixForFirefoxBelow63() {
|
|
@@ -65,22 +65,19 @@ export class FormField {
|
|
|
65
65
|
this.updateLabelRequiredFlag(isRequired, label);
|
|
66
66
|
}
|
|
67
67
|
initSpiedElement() {
|
|
68
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
69
69
|
const SUPPORTED_COMPONENTS = ['wcs-input', 'wcs-select', 'wcs-textarea', 'wcs-radio-group', 'wcs-switch', 'wcs-checkbox'];
|
|
70
|
-
this.spiedElement = (_a = this.el.shadowRoot.querySelector('slot:not([name])')) === null || _a === void 0 ? void 0 : _a.assignedElements()[0];
|
|
70
|
+
this.spiedElement = (_a = this.el.shadowRoot.querySelector('slot:not([name])')) === null || _a === void 0 ? void 0 : _a.assignedElements().filter(n => [...SUPPORTED_COMPONENTS, 'SLOT'].map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0];
|
|
71
71
|
// If the component is used in another web component
|
|
72
|
-
if (this.spiedElement.tagName === 'SLOT') {
|
|
72
|
+
if (((_b = this.spiedElement) === null || _b === void 0 ? void 0 : _b.tagName) === 'SLOT') {
|
|
73
73
|
this.spiedElement = (this.spiedElement
|
|
74
74
|
.assignedElements()
|
|
75
75
|
.filter(n => SUPPORTED_COMPONENTS.map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0]);
|
|
76
76
|
}
|
|
77
|
-
if (!this.spiedElement)
|
|
78
|
-
throw new Error('You must provide a slotted element in form field');
|
|
79
|
-
if (SUPPORTED_COMPONENTS
|
|
80
|
-
.map(x => x.toUpperCase())
|
|
81
|
-
.indexOf(this.spiedElement.tagName) === -1) {
|
|
77
|
+
if (!this.spiedElement) {
|
|
82
78
|
// tslint:disable-next-line:no-console
|
|
83
|
-
console.warn('
|
|
79
|
+
console.warn('Form-field component support only ' + SUPPORTED_COMPONENTS.toString() + '. Some features may not work with the provided component.');
|
|
80
|
+
return;
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
updateLabelRequiredFlag(isRequired, label) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Event, h, Host, Prop,
|
|
1
|
+
import { Component, Element, Event, h, Host, Prop, Watch } from '@stencil/core';
|
|
2
2
|
import { GridSortArrow } from './grid-sort-arrow';
|
|
3
3
|
export class GridColumn {
|
|
4
4
|
constructor() {
|
|
@@ -30,8 +30,8 @@ export class GridColumn {
|
|
|
30
30
|
this.sort ? h(GridSortArrow, { state: this.sortOrder }) : ''))));
|
|
31
31
|
}
|
|
32
32
|
onSortClick() {
|
|
33
|
+
// @Watch on sortOrder property will trigger wcsSortChange event
|
|
33
34
|
this.sortOrder = this.sortOrder === 'none' || this.sortOrder === 'desc' ? 'asc' : 'desc';
|
|
34
|
-
this.emitSortConfig();
|
|
35
35
|
}
|
|
36
36
|
static get is() { return "wcs-grid-column"; }
|
|
37
37
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, Element, Event, h, Host, Method, Prop, State, Watch } from '@stencil/core';
|
|
2
2
|
import { HorizontalStep } from './horizontal-step';
|
|
3
3
|
export class HorizontalStepper {
|
|
4
4
|
constructor() {
|
|
@@ -20,16 +20,19 @@ export class HorizontalStepper {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
onCurrentStepChange(newValue, oldValue) {
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
//Check if the function is called before the component has finished its initialization in which case we do nothing
|
|
24
|
+
if (this.internalCurrentStep !== undefined) {
|
|
25
|
+
const stepInterval = Math.abs(oldValue - newValue);
|
|
26
|
+
this.el.style.setProperty('--wcs-progress-bar-animation-duration', 375 / stepInterval + 'ms');
|
|
27
|
+
if (newValue !== oldValue) {
|
|
28
|
+
for (let i = 0; i < stepInterval; i++) {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
this.internalCurrentStep -= (oldValue - newValue) > 0 ? 1 : -1;
|
|
31
|
+
if (i === stepInterval - 1) {
|
|
32
|
+
this.el.style.removeProperty('--wcs-progress-bar-animation-duration');
|
|
33
|
+
}
|
|
34
|
+
}, (i * (375 / stepInterval)));
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
wcs-modal {
|
|
2
|
-
--saas-fix-modal: rgba(var(--wcs-black), 0.5);
|
|
3
2
|
z-index: 999;
|
|
4
3
|
position: fixed;
|
|
5
4
|
top: 0;
|
|
@@ -7,59 +6,61 @@ wcs-modal {
|
|
|
7
6
|
left: 0;
|
|
8
7
|
right: 0;
|
|
9
8
|
display: none;
|
|
9
|
+
background: rgba(0, 0, 0, 0.4);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
wcs-modal[show] {
|
|
13
|
-
display:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
display: flex;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
width: 100vw;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
Backdrop
|
|
22
22
|
*/
|
|
23
|
-
wcs-modal[without-backdrop]
|
|
24
|
-
|
|
23
|
+
wcs-modal[without-backdrop] {
|
|
24
|
+
background-color: unset;
|
|
25
25
|
}
|
|
26
26
|
wcs-modal[without-backdrop] .wcs-modal-container {
|
|
27
27
|
border: solid 1px var(--wcs-text-light);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.wcs-modal-backdrop {
|
|
31
|
-
display: block;
|
|
32
|
-
position: fixed;
|
|
33
|
-
top: 0;
|
|
34
|
-
left: 0;
|
|
35
|
-
bottom: 0;
|
|
36
|
-
right: 0;
|
|
37
|
-
opacity: 0.4;
|
|
38
|
-
background-color: var(--wcs-black);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
30
|
/**
|
|
42
31
|
Modal window
|
|
43
32
|
*/
|
|
44
33
|
.wcs-modal-container {
|
|
45
|
-
|
|
46
|
-
top: 50%;
|
|
47
|
-
left: 50%;
|
|
48
|
-
min-width: 400px;
|
|
49
|
-
max-width: 480px;
|
|
50
|
-
/* bring your own prefixes */
|
|
51
|
-
transform: translate(-50%, -50%);
|
|
52
|
-
pointer-events: auto;
|
|
34
|
+
max-height: var(--wcs-modal-max-height, 80%);
|
|
53
35
|
background-color: #fff;
|
|
36
|
+
display: grid;
|
|
37
|
+
grid-template-columns: 100%;
|
|
38
|
+
grid-template-rows: auto 1fr auto;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
pointer-events: auto;
|
|
54
41
|
background-clip: padding-box;
|
|
55
42
|
border: 0 solid rgba(0, 0, 0, 0.2);
|
|
56
43
|
border-radius: 0.4375rem;
|
|
57
|
-
outline: 0;
|
|
58
44
|
z-index: 20000;
|
|
59
|
-
display: block;
|
|
60
45
|
padding: 1.375rem 1.875rem 1.875rem 1.875rem;
|
|
61
46
|
}
|
|
62
47
|
|
|
48
|
+
.wcs-modal-container[data-size=s] {
|
|
49
|
+
width: 288px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.wcs-modal-container[data-size=m] {
|
|
53
|
+
width: 480px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.wcs-modal-container[data-size=l] {
|
|
57
|
+
width: 864px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.wcs-modal-container[data-size=xl] {
|
|
61
|
+
width: 1200px;
|
|
62
|
+
}
|
|
63
|
+
|
|
63
64
|
.wcs-modal-header {
|
|
64
65
|
margin-bottom: 8px;
|
|
65
66
|
display: flex;
|
|
@@ -75,9 +76,11 @@ Modal window
|
|
|
75
76
|
.wcs-modal-content {
|
|
76
77
|
font-weight: 400;
|
|
77
78
|
font-size: 16px;
|
|
79
|
+
overflow-y: auto;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
.wcs-modal-actions {
|
|
81
83
|
margin-top: 20px;
|
|
82
|
-
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: flex-end;
|
|
83
86
|
}
|
|
@@ -14,20 +14,28 @@ export class Modal {
|
|
|
14
14
|
* if false, it won't close the modal when the escape key is pressed.
|
|
15
15
|
*/
|
|
16
16
|
this.showCloseButton = false;
|
|
17
|
+
/**
|
|
18
|
+
* There are multiple sizes for modals. The default size is medium (m), however other sizes are available. Select the
|
|
19
|
+
* size best suited for the content and screen size displaying the modal. Remember to test responsiveness.
|
|
20
|
+
*/
|
|
21
|
+
this.size = 'm';
|
|
22
|
+
/**
|
|
23
|
+
* Specifies whether the component should hide the actions slot or not
|
|
24
|
+
*/
|
|
25
|
+
this.hideActions = false;
|
|
17
26
|
}
|
|
18
27
|
render() {
|
|
19
28
|
return (h(Host, null,
|
|
20
|
-
h("div", { class: "wcs-modal-
|
|
21
|
-
h("div", { class: "wcs-modal-container" },
|
|
29
|
+
h("div", { class: "wcs-modal-container", "data-size": this.size },
|
|
22
30
|
h("div", { class: "wcs-modal-header" },
|
|
23
31
|
h("h5", null,
|
|
24
32
|
h("slot", { name: "header" })),
|
|
25
|
-
this.showCloseButton && (h("wcs-button", { shape: "round", mode: "
|
|
26
|
-
h("
|
|
33
|
+
this.showCloseButton && (h("wcs-button", { shape: "round", mode: "clear", class: "wcs-dark", onClick: ($event) => this.onCloseButtonClick($event) },
|
|
34
|
+
h("wcs-mat-icon", { icon: "close" })))),
|
|
27
35
|
h("div", { class: "wcs-modal-content" },
|
|
28
36
|
h("slot", null)),
|
|
29
|
-
h("div", { class: "wcs-modal-actions" },
|
|
30
|
-
h("slot", { name: "actions" })))));
|
|
37
|
+
!this.hideActions && (h("div", { class: "wcs-modal-actions" },
|
|
38
|
+
h("slot", { name: "actions" }))))));
|
|
31
39
|
}
|
|
32
40
|
onKeyDown(event) {
|
|
33
41
|
if (this.showCloseButton && event.key === 'Escape') {
|
|
@@ -102,6 +110,47 @@ export class Modal {
|
|
|
102
110
|
"attribute": "show-close-button",
|
|
103
111
|
"reflect": true,
|
|
104
112
|
"defaultValue": "false"
|
|
113
|
+
},
|
|
114
|
+
"size": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"mutable": false,
|
|
117
|
+
"complexType": {
|
|
118
|
+
"original": "ModalSize",
|
|
119
|
+
"resolved": "\"l\" | \"m\" | \"s\" | \"xl\"",
|
|
120
|
+
"references": {
|
|
121
|
+
"ModalSize": {
|
|
122
|
+
"location": "import",
|
|
123
|
+
"path": "./modal-interface"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": false,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": "There are multiple sizes for modals. The default size is medium (m), however other sizes are available. Select the\nsize best suited for the content and screen size displaying the modal. Remember to test responsiveness."
|
|
132
|
+
},
|
|
133
|
+
"attribute": "size",
|
|
134
|
+
"reflect": false,
|
|
135
|
+
"defaultValue": "'m'"
|
|
136
|
+
},
|
|
137
|
+
"hideActions": {
|
|
138
|
+
"type": "boolean",
|
|
139
|
+
"mutable": false,
|
|
140
|
+
"complexType": {
|
|
141
|
+
"original": "boolean",
|
|
142
|
+
"resolved": "boolean",
|
|
143
|
+
"references": {}
|
|
144
|
+
},
|
|
145
|
+
"required": false,
|
|
146
|
+
"optional": false,
|
|
147
|
+
"docs": {
|
|
148
|
+
"tags": [],
|
|
149
|
+
"text": "Specifies whether the component should hide the actions slot or not"
|
|
150
|
+
},
|
|
151
|
+
"attribute": "hide-actions",
|
|
152
|
+
"reflect": true,
|
|
153
|
+
"defaultValue": "false"
|
|
105
154
|
}
|
|
106
155
|
}; }
|
|
107
156
|
static get events() { return [{
|
|
@@ -64,7 +64,7 @@ export class Tooltip {
|
|
|
64
64
|
this.tippyInstance = tippy(document.getElementById(this.for), {
|
|
65
65
|
theme: this.theme,
|
|
66
66
|
allowHTML: true,
|
|
67
|
-
content: this.
|
|
67
|
+
content: this.getTooltipContentFromPropAndSlot(),
|
|
68
68
|
maxWidth: this.maxWidth,
|
|
69
69
|
placement: this.position,
|
|
70
70
|
delay: this.delay,
|
|
@@ -73,6 +73,12 @@ export class Tooltip {
|
|
|
73
73
|
trigger: this.trigger
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
getTooltipContentFromPropAndSlot() {
|
|
77
|
+
if (this.content) {
|
|
78
|
+
return this.content + this.el.innerHTML;
|
|
79
|
+
}
|
|
80
|
+
return this.el.innerHTML;
|
|
81
|
+
}
|
|
76
82
|
updateProps() {
|
|
77
83
|
this.tippyInstance.setProps({
|
|
78
84
|
interactive: this.interactive,
|
|
@@ -86,7 +92,7 @@ export class Tooltip {
|
|
|
86
92
|
}
|
|
87
93
|
updateTippyContent() {
|
|
88
94
|
this.tippyInstance.setProps({
|
|
89
|
-
content: this.
|
|
95
|
+
content: this.getTooltipContentFromPropAndSlot()
|
|
90
96
|
});
|
|
91
97
|
}
|
|
92
98
|
/**
|
|
@@ -279,6 +285,23 @@ export class Tooltip {
|
|
|
279
285
|
"attribute": "theme",
|
|
280
286
|
"reflect": false,
|
|
281
287
|
"defaultValue": "'wcs'"
|
|
288
|
+
},
|
|
289
|
+
"content": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "string",
|
|
294
|
+
"resolved": "string",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": false,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": "You can use this property instead of the slot API to affect content in the tooltip.\n\nThis makes it easier to manage the update if the tooltip contains elements that are not mutated when their\ncontent changes. Indeed, if the slot is used, the tooltip is updated only if the structure of the slotted DOM\nchanges (the DOM must be mutated).\n\nThe two APIs are not mutually exclusive, if both are filled in (the prop + the slot) the rendering will first\ndisplay the content of this property and then the slotted elements."
|
|
302
|
+
},
|
|
303
|
+
"attribute": "content",
|
|
304
|
+
"reflect": false
|
|
282
305
|
}
|
|
283
306
|
}; }
|
|
284
307
|
static get methods() { return {
|
|
@@ -369,5 +392,8 @@ export class Tooltip {
|
|
|
369
392
|
}, {
|
|
370
393
|
"propName": "trigger",
|
|
371
394
|
"methodName": "updateProps"
|
|
395
|
+
}, {
|
|
396
|
+
"propName": "content",
|
|
397
|
+
"methodName": "updateTippyContent"
|
|
372
398
|
}]; }
|
|
373
399
|
}
|