wcs-core 2.6.0 → 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 +30 -0
- package/README.md +16 -0
- package/dist/cjs/{helpers-d9aaa8c4.js → helpers-6abce594.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/popper-6a290c40.js +1731 -0
- package/dist/cjs/wcs-button.cjs.entry.js +1 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js +6 -2
- 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.cjs.entry.js +43 -10
- package/dist/cjs/wcs-error_2.cjs.entry.js +1 -1
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js +3 -1730
- package/dist/cjs/wcs-grid-column.cjs.entry.js +5 -1
- package/dist/cjs/wcs-grid.cjs.entry.js +28 -5
- package/dist/cjs/wcs-input.cjs.entry.js +3 -3
- package/dist/cjs/wcs-radio.cjs.entry.js +2 -2
- package/dist/cjs/wcs-select_2.cjs.entry.js +1 -1
- package/dist/cjs/wcs-switch.cjs.entry.js +10 -2
- package/dist/cjs/wcs-textarea.cjs.entry.js +2 -2
- package/dist/cjs/wcs.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/checkbox/checkbox.css +18 -7
- package/dist/collection/components/checkbox/checkbox.js +24 -2
- 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/form-field/form-field.css +1 -1
- package/dist/collection/components/grid/grid.js +28 -5
- package/dist/collection/components/grid-column/grid-column.js +7 -1
- package/dist/collection/components/input/input.css +48 -0
- package/dist/collection/components/input/input.js +38 -2
- 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/switch/switch.css +53 -16
- package/dist/collection/components/switch/switch.js +55 -6
- package/dist/collection/components/textarea/textarea.css +4 -0
- package/dist/collection/utils/helpers.js +4 -0
- package/dist/esm/{helpers-50436c51.js → helpers-e2993152.js} +5 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/popper-e5fdfb6a.js +1729 -0
- package/dist/esm/wcs-button.entry.js +1 -1
- package/dist/esm/wcs-checkbox.entry.js +6 -2
- 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.entry.js +43 -10
- package/dist/esm/wcs-error_2.entry.js +1 -1
- package/dist/esm/wcs-galactic-menu.entry.js +2 -1729
- package/dist/esm/wcs-grid-column.entry.js +5 -1
- package/dist/esm/wcs-grid.entry.js +28 -5
- package/dist/esm/wcs-input.entry.js +3 -3
- package/dist/esm/wcs-radio.entry.js +2 -2
- package/dist/esm/wcs-select_2.entry.js +1 -1
- package/dist/esm/wcs-switch.entry.js +10 -2
- package/dist/esm/wcs-textarea.entry.js +2 -2
- package/dist/esm/wcs.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +4 -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 +11 -0
- package/dist/types/components/grid-column/grid-column.d.ts +1 -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/switch/switch-interface.d.ts +1 -0
- package/dist/types/components/switch/switch.d.ts +10 -2
- package/dist/types/components.d.ts +105 -4
- package/dist/types/utils/helpers.d.ts +1 -0
- package/dist/wcs/{p-356a8e3b.entry.js → p-384068f7.entry.js} +1 -1
- package/dist/wcs/p-41037455.entry.js +1 -0
- package/dist/wcs/p-57247184.entry.js +1 -0
- package/dist/wcs/p-7206e492.entry.js +1 -0
- package/dist/wcs/p-8c8740e3.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-b5138986.js +1 -0
- package/dist/wcs/p-bbf1ef42.entry.js +1 -0
- package/dist/wcs/{p-3d10b02a.entry.js → p-c7d6d3e1.entry.js} +1 -1
- package/dist/wcs/p-cf4d7a83.js +1 -0
- package/dist/wcs/{p-a5a1b27c.entry.js → p-d7dec082.entry.js} +1 -1
- package/dist/wcs/p-e65d1c27.entry.js +1 -0
- package/dist/wcs/p-ea3e93e9.entry.js +1 -0
- package/dist/wcs/p-fbaf299d.entry.js +1 -0
- package/dist/wcs/{p-4338f140.entry.js → p-ff6d0dfd.entry.js} +1 -1
- package/dist/wcs/wcs.esm.js +1 -1
- package/package.json +1 -2
- package/dist/wcs/p-0fbe574e.entry.js +0 -1
- package/dist/wcs/p-62f7ab6d.entry.js +0 -1
- package/dist/wcs/p-83f1ad32.js +0 -1
- package/dist/wcs/p-8f0f9868.entry.js +0 -1
- package/dist/wcs/p-af1a5e52.entry.js +0 -1
- package/dist/wcs/p-bef44630.entry.js +0 -1
- package/dist/wcs/p-d59b4495.entry.js +0 -1
- package/dist/wcs/p-dd300dea.entry.js +0 -1
- package/dist/wcs/p-e486647c.entry.js +0 -1
|
@@ -1,31 +1,41 @@
|
|
|
1
|
-
import { Component, Element, h, Host, Listen, Prop, State } from '@stencil/core';
|
|
1
|
+
import { Component, Element, h, Host, Listen, Prop, State, Watch } from '@stencil/core';
|
|
2
2
|
import { SelectArrow } from '../select/select-arrow';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* @example ```hmtl
|
|
7
|
-
* <wcs-dropdown>
|
|
8
|
-
* <div slot="placeholder"></div>
|
|
9
|
-
* <div slot="items">
|
|
10
|
-
* <wcs-dropdown-header></wcs-dropdown-header>
|
|
11
|
-
* <wcs-divider></wcs-divider>
|
|
12
|
-
* <wcs-dropdown-item></wcs-dropdown-item>
|
|
13
|
-
* </div>
|
|
14
|
-
* </wcs-dropdown>
|
|
15
|
-
* ```
|
|
16
|
-
* @todo Complete keyboard navigation.
|
|
17
|
-
*/
|
|
3
|
+
import { createPopper } from '@popperjs/core';
|
|
4
|
+
import { clickTargetIsElementOrChildren } from '../../utils/helpers';
|
|
18
5
|
export class Dropdown {
|
|
19
6
|
constructor() {
|
|
7
|
+
/** Hides the arrow in the button */
|
|
8
|
+
this.noArrow = false;
|
|
9
|
+
/** Dropdown's button mode */
|
|
20
10
|
this.mode = 'stroked';
|
|
11
|
+
/** Dropdown's button shape */
|
|
21
12
|
this.shape = 'normal';
|
|
13
|
+
/** Specifies whether the dropdown button is clickable or not */
|
|
22
14
|
this.disabled = false;
|
|
15
|
+
/** placement of the dropdown's popover */
|
|
16
|
+
this.placement = 'bottom-end';
|
|
23
17
|
this.expanded = false;
|
|
24
18
|
}
|
|
19
|
+
placementChange() {
|
|
20
|
+
this.popper.setOptions(Object.assign(Object.assign({}, this.popper.state.options), { placement: this.placement })).then(_ => this.popper.update());
|
|
21
|
+
}
|
|
25
22
|
componentDidLoad() {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
this.
|
|
23
|
+
const wcsButtonElement = this.el.shadowRoot.querySelector('wcs-button');
|
|
24
|
+
const buttonWrapper = wcsButtonElement.shadowRoot.querySelector('button');
|
|
25
|
+
this.buttonTextColor = window.getComputedStyle(buttonWrapper).color;
|
|
26
|
+
const popoverDiv = this.el.shadowRoot.querySelector('.popover');
|
|
27
|
+
this.popper = createPopper(wcsButtonElement, popoverDiv, {
|
|
28
|
+
placement: this.placement,
|
|
29
|
+
modifiers: [
|
|
30
|
+
{
|
|
31
|
+
name: 'offset',
|
|
32
|
+
options: {
|
|
33
|
+
offset: [0, 8]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
this.el.shadowRoot.querySelector('.arrow').style.fill = this.buttonTextColor;
|
|
29
39
|
this.fixForFirefoxBelow63();
|
|
30
40
|
}
|
|
31
41
|
fixForFirefoxBelow63() {
|
|
@@ -39,14 +49,11 @@ export class Dropdown {
|
|
|
39
49
|
});
|
|
40
50
|
}
|
|
41
51
|
}
|
|
42
|
-
onButtonClick(
|
|
43
|
-
e.stopPropagation();
|
|
52
|
+
onButtonClick(_) {
|
|
44
53
|
this.expanded = !this.expanded;
|
|
45
54
|
}
|
|
46
55
|
onWindowClickEvent(event) {
|
|
47
|
-
|
|
48
|
-
const clickedOnDropdownOrChildren = event.target instanceof Node
|
|
49
|
-
&& this.el.contains(event.target);
|
|
56
|
+
const clickedOnDropdownOrChildren = clickTargetIsElementOrChildren(event, this.el);
|
|
50
57
|
if (this.expanded && !clickedOnDropdownOrChildren) {
|
|
51
58
|
this.expanded = false;
|
|
52
59
|
}
|
|
@@ -54,13 +61,22 @@ export class Dropdown {
|
|
|
54
61
|
dropdownItemClick(_) {
|
|
55
62
|
this.expanded = false;
|
|
56
63
|
}
|
|
64
|
+
componentDidRender() {
|
|
65
|
+
if (this.popper) {
|
|
66
|
+
this.popper.update();
|
|
67
|
+
}
|
|
68
|
+
if (!this.noArrow) {
|
|
69
|
+
this.el.shadowRoot.querySelector('.arrow').style.fill = this.buttonTextColor;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
57
72
|
render() {
|
|
58
73
|
return (h(Host, null,
|
|
59
|
-
h("wcs-button", { mode: this.mode, shape: this.shape, onClick: ($event) => this.onButtonClick($event) },
|
|
74
|
+
h("wcs-button", { mode: this.mode, shape: this.shape, disabled: this.disabled, onClick: ($event) => this.onButtonClick($event) },
|
|
60
75
|
h("div", { class: "wcs-button-content-wrapper" },
|
|
61
76
|
h("slot", { name: "placeholder" }),
|
|
62
|
-
h(SelectArrow, { up: this.expanded }))),
|
|
77
|
+
this.noArrow ? null : (h(SelectArrow, { up: this.expanded })))),
|
|
63
78
|
h("div", { class: (this.expanded ? 'show ' : '') + 'popover' },
|
|
79
|
+
h("div", { id: "arrow", "data-popper-arrow": true }),
|
|
64
80
|
h("div", { class: "container" },
|
|
65
81
|
h("slot", { name: "item" })))));
|
|
66
82
|
}
|
|
@@ -73,6 +89,24 @@ export class Dropdown {
|
|
|
73
89
|
"$": ["dropdown.css"]
|
|
74
90
|
}; }
|
|
75
91
|
static get properties() { return {
|
|
92
|
+
"noArrow": {
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"mutable": false,
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "boolean",
|
|
97
|
+
"resolved": "boolean",
|
|
98
|
+
"references": {}
|
|
99
|
+
},
|
|
100
|
+
"required": false,
|
|
101
|
+
"optional": false,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": "Hides the arrow in the button"
|
|
105
|
+
},
|
|
106
|
+
"attribute": "no-arrow",
|
|
107
|
+
"reflect": false,
|
|
108
|
+
"defaultValue": "false"
|
|
109
|
+
},
|
|
76
110
|
"mode": {
|
|
77
111
|
"type": "string",
|
|
78
112
|
"mutable": false,
|
|
@@ -90,7 +124,7 @@ export class Dropdown {
|
|
|
90
124
|
"optional": false,
|
|
91
125
|
"docs": {
|
|
92
126
|
"tags": [],
|
|
93
|
-
"text": ""
|
|
127
|
+
"text": "Dropdown's button mode"
|
|
94
128
|
},
|
|
95
129
|
"attribute": "mode",
|
|
96
130
|
"reflect": false,
|
|
@@ -113,7 +147,7 @@ export class Dropdown {
|
|
|
113
147
|
"optional": false,
|
|
114
148
|
"docs": {
|
|
115
149
|
"tags": [],
|
|
116
|
-
"text": ""
|
|
150
|
+
"text": "Dropdown's button shape"
|
|
117
151
|
},
|
|
118
152
|
"attribute": "shape",
|
|
119
153
|
"reflect": false,
|
|
@@ -131,17 +165,44 @@ export class Dropdown {
|
|
|
131
165
|
"optional": false,
|
|
132
166
|
"docs": {
|
|
133
167
|
"tags": [],
|
|
134
|
-
"text": ""
|
|
168
|
+
"text": "Specifies whether the dropdown button is clickable or not"
|
|
135
169
|
},
|
|
136
170
|
"attribute": "disabled",
|
|
137
171
|
"reflect": false,
|
|
138
172
|
"defaultValue": "false"
|
|
173
|
+
},
|
|
174
|
+
"placement": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"mutable": false,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "WcsDropdownPlacement",
|
|
179
|
+
"resolved": "\"auto\" | \"auto-end\" | \"auto-start\" | \"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
180
|
+
"references": {
|
|
181
|
+
"WcsDropdownPlacement": {
|
|
182
|
+
"location": "import",
|
|
183
|
+
"path": "./dropdown-interface"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": "placement of the dropdown's popover"
|
|
192
|
+
},
|
|
193
|
+
"attribute": "placement",
|
|
194
|
+
"reflect": false,
|
|
195
|
+
"defaultValue": "'bottom-end'"
|
|
139
196
|
}
|
|
140
197
|
}; }
|
|
141
198
|
static get states() { return {
|
|
142
199
|
"expanded": {}
|
|
143
200
|
}; }
|
|
144
201
|
static get elementRef() { return "el"; }
|
|
202
|
+
static get watchers() { return [{
|
|
203
|
+
"propName": "placement",
|
|
204
|
+
"methodName": "placementChange"
|
|
205
|
+
}]; }
|
|
145
206
|
static get listeners() { return [{
|
|
146
207
|
"name": "click",
|
|
147
208
|
"method": "onWindowClickEvent",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, h, Host } from '@stencil/core';
|
|
2
|
+
export class DropdownDivider {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, { slot: "item" }));
|
|
5
|
+
}
|
|
6
|
+
static get is() { return "wcs-dropdown-divider"; }
|
|
7
|
+
static get encapsulation() { return "shadow"; }
|
|
8
|
+
static get originalStyleUrls() { return {
|
|
9
|
+
"$": ["dropdown-divider.scss"]
|
|
10
|
+
}; }
|
|
11
|
+
static get styleUrls() { return {
|
|
12
|
+
"$": ["dropdown-divider.css"]
|
|
13
|
+
}; }
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, h, Host } from '@stencil/core';
|
|
2
|
+
export class DropdownHeader {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, { slot: "item" },
|
|
5
|
+
h("slot", null)));
|
|
6
|
+
}
|
|
7
|
+
static get is() { return "wcs-dropdown-header"; }
|
|
8
|
+
static get encapsulation() { return "shadow"; }
|
|
9
|
+
static get originalStyleUrls() { return {
|
|
10
|
+
"$": ["dropdown-header.scss"]
|
|
11
|
+
}; }
|
|
12
|
+
static get styleUrls() { return {
|
|
13
|
+
"$": ["dropdown-header.css"]
|
|
14
|
+
}; }
|
|
15
|
+
}
|
|
@@ -83,6 +83,19 @@ export class Grid {
|
|
|
83
83
|
if (this.selectedItems) {
|
|
84
84
|
this.updateSelectionWithValues(this.selectedItems);
|
|
85
85
|
}
|
|
86
|
+
this.applyInitialSortConfig();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Handle existing column's filters (defined before the grid is instantiated)
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
applyInitialSortConfig() {
|
|
93
|
+
const [first, ...other] = this.columns.filter(c => c.sortOrder !== 'none');
|
|
94
|
+
// We keep only one active sorted column
|
|
95
|
+
other === null || other === void 0 ? void 0 : other.forEach(o => o.sortOrder = 'none');
|
|
96
|
+
if (first && !this.serverMode) {
|
|
97
|
+
this.sortBy(first);
|
|
98
|
+
}
|
|
86
99
|
}
|
|
87
100
|
getGridColumnsFromTemplate() {
|
|
88
101
|
const slotted = this.el.shadowRoot.querySelector('slot[name="grid-column"]');
|
|
@@ -93,22 +106,32 @@ export class Grid {
|
|
|
93
106
|
return slotted.assignedElements();
|
|
94
107
|
}
|
|
95
108
|
sortChangeEventHandler(event) {
|
|
109
|
+
if (event.detail.order === 'none')
|
|
110
|
+
return;
|
|
96
111
|
// We keep only one active sort column
|
|
97
112
|
this.columns.filter(c => c !== event.detail.column).forEach(c => c.sortOrder = 'none');
|
|
98
113
|
if (this.serverMode)
|
|
99
114
|
return;
|
|
100
|
-
|
|
115
|
+
this.sortBy(event.detail.column);
|
|
116
|
+
this.updatePageIndex();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Sorts the grid rows according to the given column's configuration
|
|
120
|
+
* @param colmun Column from which to extract the sorting configuration
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
sortBy(colmun) {
|
|
124
|
+
if (colmun.sortFn) {
|
|
101
125
|
this.rows = _.cloneDeep(this.rows)
|
|
102
|
-
.sort((a, b) =>
|
|
126
|
+
.sort((a, b) => colmun.sortFn(a.data, b.data, colmun) * getSortOrderInteger(colmun.sortOrder));
|
|
103
127
|
}
|
|
104
128
|
else {
|
|
105
129
|
this.rows = _.cloneDeep(this.rows)
|
|
106
130
|
.sort((a, b) => {
|
|
107
|
-
const path =
|
|
108
|
-
return ((_.get(a.data, path) < _.get(b.data, path)) ? -1 : (_.get(a.data, path) > _.get(b.data, path)) ? 1 : 0) * getSortOrderInteger(
|
|
131
|
+
const path = colmun.path;
|
|
132
|
+
return ((_.get(a.data, path) < _.get(b.data, path)) ? -1 : (_.get(a.data, path) > _.get(b.data, path)) ? 1 : 0) * getSortOrderInteger(colmun.sortOrder);
|
|
109
133
|
});
|
|
110
134
|
}
|
|
111
|
-
this.updatePageIndex();
|
|
112
135
|
}
|
|
113
136
|
/**
|
|
114
137
|
* Update the page's number of all rows
|
|
@@ -10,6 +10,9 @@ export class GridColumn {
|
|
|
10
10
|
parseMyObjectProp(newValue) {
|
|
11
11
|
this.wcsHiddenChange.emit(newValue);
|
|
12
12
|
}
|
|
13
|
+
sortOrderChange(_) {
|
|
14
|
+
this.emitSortConfig();
|
|
15
|
+
}
|
|
13
16
|
emitSortConfig() {
|
|
14
17
|
if (!this.sort)
|
|
15
18
|
return;
|
|
@@ -151,7 +154,7 @@ export class GridColumn {
|
|
|
151
154
|
"text": ""
|
|
152
155
|
},
|
|
153
156
|
"attribute": "sort-order",
|
|
154
|
-
"reflect":
|
|
157
|
+
"reflect": false,
|
|
155
158
|
"defaultValue": "'none'"
|
|
156
159
|
},
|
|
157
160
|
"width": {
|
|
@@ -248,5 +251,8 @@ export class GridColumn {
|
|
|
248
251
|
static get watchers() { return [{
|
|
249
252
|
"propName": "hidden",
|
|
250
253
|
"methodName": "parseMyObjectProp"
|
|
254
|
+
}, {
|
|
255
|
+
"propName": "sortOrder",
|
|
256
|
+
"methodName": "sortOrderChange"
|
|
251
257
|
}]; }
|
|
252
258
|
}
|
|
@@ -37,14 +37,62 @@
|
|
|
37
37
|
margin-left: 8px;
|
|
38
38
|
margin-right: -8px;
|
|
39
39
|
}
|
|
40
|
+
:host .prefix, :host .suffix {
|
|
41
|
+
color: var(--wcs-white);
|
|
42
|
+
display: flex;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
align-items: center;
|
|
45
|
+
padding: 0 calc(var(--wcs-padding) / 2);
|
|
46
|
+
font-weight: var(--wcs-font-weight-form-value) !important;
|
|
47
|
+
background-color: var(--wcs-text-disabled);
|
|
48
|
+
}
|
|
49
|
+
:host .prefix {
|
|
50
|
+
border-radius: var(--wcs-internal-input-border-radius-left) 0 0 var(--wcs-internal-input-border-radius-left);
|
|
51
|
+
margin: -1px 0 -1px -1px;
|
|
52
|
+
border-left: solid 1px transparent;
|
|
53
|
+
border-top: solid 1px transparent;
|
|
54
|
+
border-bottom: solid 1px transparent;
|
|
55
|
+
}
|
|
56
|
+
:host .suffix {
|
|
57
|
+
border-radius: 0 var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) 0;
|
|
58
|
+
margin: -1px -1px -1px 0px;
|
|
59
|
+
border-right: solid 1px transparent;
|
|
60
|
+
border-top: solid 1px transparent;
|
|
61
|
+
border-bottom: solid 1px transparent;
|
|
62
|
+
}
|
|
40
63
|
|
|
41
64
|
:host([state=error]) {
|
|
42
65
|
border-color: var(--wcs-red) !important;
|
|
43
66
|
}
|
|
44
67
|
|
|
68
|
+
:host([data-has-prefix]) input {
|
|
69
|
+
padding-left: calc(var(--wcs-padding) / 2);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([data-has-suffix]) input {
|
|
73
|
+
padding-left: calc(var(--wcs-padding) / 2);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([disabled]) input {
|
|
77
|
+
color: var(--wcs-text-disabled);
|
|
78
|
+
}
|
|
79
|
+
:host([disabled]) .prefix, :host([disabled]) .suffix {
|
|
80
|
+
color: var(--wcs-light);
|
|
81
|
+
}
|
|
82
|
+
|
|
45
83
|
:host(:focus-within) {
|
|
46
84
|
border: solid 1px var(--wcs-primary);
|
|
47
85
|
}
|
|
86
|
+
:host(:focus-within) .prefix {
|
|
87
|
+
border-left: solid 1px var(--wcs-primary);
|
|
88
|
+
border-top: solid 1px var(--wcs-primary);
|
|
89
|
+
border-bottom: solid 1px var(--wcs-primary);
|
|
90
|
+
}
|
|
91
|
+
:host(:focus-within) .suffix {
|
|
92
|
+
border-right: solid 1px var(--wcs-primary);
|
|
93
|
+
border-top: solid 1px var(--wcs-primary);
|
|
94
|
+
border-bottom: solid 1px var(--wcs-primary);
|
|
95
|
+
}
|
|
48
96
|
:host(:focus-within) wcs-mat-icon {
|
|
49
97
|
color: var(--wcs-primary);
|
|
50
98
|
}
|
|
@@ -205,9 +205,11 @@ export class Input {
|
|
|
205
205
|
if (label) {
|
|
206
206
|
label.id = labelId;
|
|
207
207
|
}
|
|
208
|
-
return (h(Host, { "aria-disabled": this.disabled ? 'true' : null },
|
|
208
|
+
return (h(Host, { "aria-disabled": this.disabled ? 'true' : null, "data-has-prefix": !!this.prefixLabel, "data-has-suffix": !!this.suffixLabel },
|
|
209
|
+
this.prefixLabel ? (h("span", { class: "prefix" }, this.prefixLabel)) : null,
|
|
209
210
|
this.icon ? (h("wcs-mat-icon", { icon: this.icon, size: "m" })) : null,
|
|
210
|
-
h("input", Object.assign({ class: "native-input", ref: input => this.nativeInput = input, "aria-labelledby": label ? labelId : null, disabled: this.disabled, accept: this.accept, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown }, this.inheritedAttributes))
|
|
211
|
+
h("input", Object.assign({ class: "native-input", ref: input => this.nativeInput = input, "aria-labelledby": label ? labelId : null, disabled: this.disabled, accept: this.accept, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown }, this.inheritedAttributes)),
|
|
212
|
+
this.suffixLabel ? (h("span", { class: "suffix" }, this.suffixLabel)) : null));
|
|
211
213
|
}
|
|
212
214
|
static get is() { return "wcs-input"; }
|
|
213
215
|
static get encapsulation() { return "shadow"; }
|
|
@@ -386,6 +388,40 @@ export class Input {
|
|
|
386
388
|
"reflect": false,
|
|
387
389
|
"defaultValue": "0"
|
|
388
390
|
},
|
|
391
|
+
"prefixLabel": {
|
|
392
|
+
"type": "string",
|
|
393
|
+
"mutable": false,
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "string",
|
|
396
|
+
"resolved": "string",
|
|
397
|
+
"references": {}
|
|
398
|
+
},
|
|
399
|
+
"required": false,
|
|
400
|
+
"optional": false,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": "Prefix displayed before the text field contents. This is not included in the value."
|
|
404
|
+
},
|
|
405
|
+
"attribute": "prefix-label",
|
|
406
|
+
"reflect": false
|
|
407
|
+
},
|
|
408
|
+
"suffixLabel": {
|
|
409
|
+
"type": "string",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "string",
|
|
413
|
+
"resolved": "string",
|
|
414
|
+
"references": {}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": false,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": "Suffix displayed after the text field contents. This is not included in the value."
|
|
421
|
+
},
|
|
422
|
+
"attribute": "suffix-label",
|
|
423
|
+
"reflect": false
|
|
424
|
+
},
|
|
389
425
|
"disabled": {
|
|
390
426
|
"type": "boolean",
|
|
391
427
|
"mutable": false,
|
|
@@ -31,7 +31,7 @@ export class Radio {
|
|
|
31
31
|
}
|
|
32
32
|
render() {
|
|
33
33
|
return (h(Host, { slot: "option" },
|
|
34
|
-
h("input", { id: this.inputId, type: "radio", value: this.value, checked: this.checked, "aria-disabled": this.disabled ? 'true' : null, "aria-checked": `${this.checked}` }),
|
|
34
|
+
h("input", { id: this.inputId, type: "radio", value: this.value, checked: this.checked, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-checked": `${this.checked}` }),
|
|
35
35
|
h("label", { htmlFor: `${this.inputId}` }, this.label)));
|
|
36
36
|
}
|
|
37
37
|
static get is() { return "wcs-radio"; }
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
padding: 0.125rem 0 0;
|
|
6
6
|
margin-bottom: 0;
|
|
7
7
|
color: var(--wcs-text-medium);
|
|
8
|
-
cursor: pointer;
|
|
9
8
|
background-color: transparent;
|
|
10
9
|
border: none;
|
|
11
10
|
font-weight: 500 !important;
|
|
@@ -35,6 +34,14 @@
|
|
|
35
34
|
background: no-repeat 50%/50% 50%;
|
|
36
35
|
}
|
|
37
36
|
|
|
37
|
+
:host([mode=radio][disabled]) label {
|
|
38
|
+
color: var(--wcs-text-disabled);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([mode=radio]:not([disabled])) label {
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
|
|
38
45
|
:host([mode=radio][checked]) label {
|
|
39
46
|
color: var(--wcs-primary);
|
|
40
47
|
}
|
|
@@ -43,10 +50,10 @@
|
|
|
43
50
|
background-color: var(--wcs-primary);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
:host([mode=radio]:hover) label {
|
|
53
|
+
:host([mode=radio]:hover):not([disabled]) label {
|
|
47
54
|
color: var(--wcs-primary);
|
|
48
55
|
}
|
|
49
|
-
:host([mode=radio]:hover) label:before {
|
|
56
|
+
:host([mode=radio]:hover):not([disabled]) label:before {
|
|
50
57
|
border-color: var(--wcs-primary);
|
|
51
58
|
}
|
|
52
59
|
|
|
@@ -66,7 +73,6 @@
|
|
|
66
73
|
margin-bottom: 0;
|
|
67
74
|
color: var(--wcs-white);
|
|
68
75
|
white-space: nowrap;
|
|
69
|
-
cursor: pointer;
|
|
70
76
|
border-radius: 0.4375rem;
|
|
71
77
|
}
|
|
72
78
|
|
|
@@ -74,4 +80,12 @@
|
|
|
74
80
|
font-weight: 500 !important;
|
|
75
81
|
color: var(--wcs-primary);
|
|
76
82
|
background-color: var(--wcs-white);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host([mode=option][disabled]) label {
|
|
86
|
+
color: var(--wcs-text-disabled);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:host([mode=option]:not([disabled])) label {
|
|
90
|
+
cursor: pointer;
|
|
77
91
|
}
|
|
@@ -94,9 +94,14 @@ export class RadioGroup {
|
|
|
94
94
|
"type": "string",
|
|
95
95
|
"mutable": false,
|
|
96
96
|
"complexType": {
|
|
97
|
-
"original": "
|
|
97
|
+
"original": "RadioGroupMode",
|
|
98
98
|
"resolved": "\"option\" | \"radio\"",
|
|
99
|
-
"references": {
|
|
99
|
+
"references": {
|
|
100
|
+
"RadioGroupMode": {
|
|
101
|
+
"location": "import",
|
|
102
|
+
"path": "./radio-group-interface"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
100
105
|
},
|
|
101
106
|
"required": false,
|
|
102
107
|
"optional": false,
|
|
@@ -3,40 +3,54 @@
|
|
|
3
3
|
--wcs-switch-background-color-final: var(--wcs-primary);
|
|
4
4
|
--wcs-switch-bullet-color-initial: var(--wcs-switch-background-color-final);
|
|
5
5
|
--wcs-switch-bullet-color-final: var(--wcs-switch-background-color-initial);
|
|
6
|
+
--wcs-switch-text-color: var(--wcs-text-medium);
|
|
6
7
|
display: flex;
|
|
7
8
|
}
|
|
8
9
|
|
|
10
|
+
:host([disabled]) {
|
|
11
|
+
--wcs-switch-text-color: var(--wcs-text-disabled);
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
/* Customize the label (the wcs-container) */
|
|
10
15
|
.wcs-container {
|
|
11
16
|
position: relative;
|
|
12
|
-
display:
|
|
13
|
-
width: 3rem;
|
|
14
|
-
height: 1.5rem;
|
|
17
|
+
display: flex;
|
|
15
18
|
margin-bottom: 0;
|
|
16
19
|
}
|
|
17
20
|
|
|
21
|
+
/* Let the user choose the alignment of the checkbox with the label text */
|
|
22
|
+
:host([label-alignment=top]) .wcs-container {
|
|
23
|
+
align-items: start;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([label-alignment=center]) .wcs-container {
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([label-alignment=bottom]) .wcs-container {
|
|
31
|
+
align-items: flex-end;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
/* Hide the browser's default switch */
|
|
19
35
|
.wcs-container input {
|
|
20
36
|
position: absolute;
|
|
21
37
|
opacity: 0;
|
|
22
|
-
cursor: pointer;
|
|
23
38
|
height: 0;
|
|
24
39
|
width: 0;
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
height:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
border: 0;
|
|
42
|
+
.text {
|
|
43
|
+
color: var(--wcs-switch-text-color);
|
|
44
|
+
margin-left: 6px;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
line-height: 1.375;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.wcs-container:not([aria-disabled]) input:checked ~ .text {
|
|
50
|
+
--wcs-switch-text-color: var(--wcs-primary);
|
|
37
51
|
}
|
|
38
52
|
|
|
39
|
-
.wcs-checkmark::before
|
|
53
|
+
.wcs-checkmark::before {
|
|
40
54
|
position: absolute;
|
|
41
55
|
transition: all 0.15s ease-out;
|
|
42
56
|
}
|
|
@@ -51,16 +65,39 @@
|
|
|
51
65
|
background-color: var(--wcs-switch-bullet-color-initial);
|
|
52
66
|
}
|
|
53
67
|
|
|
68
|
+
:host([disabled]:not([checked])) .wcs-checkmark::before {
|
|
69
|
+
background-color: var(--wcs-text-disabled);
|
|
70
|
+
}
|
|
71
|
+
:host([disabled]:not([checked])) .wcs-checkmark {
|
|
72
|
+
background-color: var(--wcs-light);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([disabled][checked]) .wcs-checkmark::before {
|
|
76
|
+
background-color: var(--wcs-white);
|
|
77
|
+
}
|
|
78
|
+
:host([disabled][checked]) .wcs-checkmark {
|
|
79
|
+
background-color: var(--wcs-text-disabled);
|
|
80
|
+
}
|
|
81
|
+
|
|
54
82
|
.wcs-checkmark {
|
|
55
83
|
top: 0;
|
|
56
84
|
right: 0;
|
|
57
85
|
bottom: 0;
|
|
58
86
|
left: 0;
|
|
59
|
-
|
|
87
|
+
width: 3rem;
|
|
88
|
+
height: 1.5rem;
|
|
60
89
|
border-radius: 0.75rem;
|
|
61
90
|
background-color: var(--wcs-switch-background-color-initial);
|
|
62
91
|
}
|
|
63
92
|
|
|
93
|
+
.wcs-container:not([aria-disabled]) {
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.wcs-container:hover:not([aria-disabled]) {
|
|
98
|
+
--wcs-switch-text-color: var(--wcs-primary);
|
|
99
|
+
}
|
|
100
|
+
|
|
64
101
|
/* When the switch is checked, change the bullet to grey */
|
|
65
102
|
input:not([disabled]):checked + .wcs-checkmark::before,
|
|
66
103
|
.wcs-container:hover input:not([disabled]) + .wcs-checkmark::before,
|