@descope/web-components-ui 1.0.39 → 1.0.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +35 -18
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1128 -481
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/101.js +148 -0
- package/dist/umd/208.js +2 -0
- package/dist/umd/208.js.LICENSE.txt +5 -0
- package/dist/umd/211.js +312 -0
- package/dist/umd/211.js.LICENSE.txt +5 -0
- package/dist/umd/233.js +573 -0
- package/dist/umd/{511.js.LICENSE.txt → 233.js.LICENSE.txt} +0 -6
- package/dist/umd/422.js +2 -0
- package/dist/umd/422.js.LICENSE.txt +5 -0
- package/dist/umd/437.js +19 -0
- package/dist/umd/437.js.LICENSE.txt +5 -0
- package/dist/umd/513.js +1 -0
- package/dist/umd/515.js +202 -0
- package/dist/umd/515.js.LICENSE.txt +11 -0
- package/dist/umd/54.js +4 -4
- package/dist/umd/56.js +48 -0
- package/dist/umd/56.js.LICENSE.txt +5 -0
- package/dist/umd/599.js +1 -1
- package/dist/umd/63.js +1 -0
- package/dist/umd/725.js +37 -0
- package/dist/umd/725.js.LICENSE.txt +11 -0
- package/dist/umd/729.js +1 -1
- package/dist/umd/767.js +2 -0
- package/dist/umd/{9.js.LICENSE.txt → 767.js.LICENSE.txt} +0 -6
- package/dist/umd/786.js +2 -0
- package/dist/umd/786.js.LICENSE.txt +17 -0
- package/dist/umd/789.js +1 -0
- package/dist/umd/806.js +109 -0
- package/dist/umd/806.js.LICENSE.txt +5 -0
- package/dist/umd/938.js +1 -0
- package/dist/umd/97.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-checkbox-index-js.js +1 -0
- package/dist/umd/descope-combo-index-js.js +1 -1
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -0
- package/dist/umd/descope-number-field-index-js.js +1 -0
- package/dist/umd/descope-password-field-index-js.js +1 -0
- package/dist/umd/descope-switch-toggle-index-js.js +1 -0
- package/dist/umd/descope-text-area-index-js.js +1 -0
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +9 -2
- package/src/components/descope-button/Button.js +90 -30
- package/src/components/descope-button/index.js +3 -3
- package/src/components/descope-checkbox/Checkbox.js +33 -0
- package/src/components/descope-checkbox/index.js +6 -0
- package/src/components/descope-combo/index.js +12 -12
- package/src/components/descope-container/Container.js +57 -51
- package/src/components/descope-container/index.js +1 -1
- package/src/components/descope-date-picker/index.js +13 -7
- package/src/components/descope-email-field/EmailField.js +72 -0
- package/src/components/descope-email-field/index.js +6 -0
- package/src/components/descope-number-field/NumberField.js +72 -0
- package/src/components/descope-number-field/index.js +6 -0
- package/src/components/descope-password-field/PasswordField.js +79 -0
- package/src/components/descope-password-field/index.js +6 -0
- package/src/components/descope-switch-toggle/SwitchToggle.js +81 -0
- package/src/components/descope-switch-toggle/index.js +6 -0
- package/src/components/descope-text-area/TextArea.js +66 -0
- package/src/components/descope-text-area/index.js +6 -0
- package/src/components/descope-text-field/TextField.js +98 -28
- package/src/components/descope-text-field/index.js +3 -3
- package/src/componentsHelpers/componentNameValidationMixin.js +21 -17
- package/src/componentsHelpers/createProxy/helpers.js +31 -27
- package/src/componentsHelpers/createProxy/index.js +27 -17
- package/src/componentsHelpers/createStyleMixin/helpers.js +65 -47
- package/src/componentsHelpers/createStyleMixin/index.js +64 -55
- package/src/componentsHelpers/draggableMixin.js +25 -26
- package/src/componentsHelpers/index.js +12 -9
- package/src/componentsHelpers/inputMixin.js +38 -37
- package/src/constants.js +1 -1
- package/src/dev/index.js +4 -3
- package/src/helpers.js +8 -6
- package/src/index.cjs.js +1 -1
- package/src/index.js +16 -8
- package/src/index.umd.js +11 -5
- package/src/theme/components/button.js +32 -21
- package/src/theme/components/checkbox.js +9 -0
- package/src/theme/components/container.js +32 -27
- package/src/theme/components/emailField.js +8 -0
- package/src/theme/components/index.js +19 -7
- package/src/theme/components/input.js +106 -0
- package/src/theme/components/numberField.js +8 -0
- package/src/theme/components/passwordField.js +11 -0
- package/src/theme/components/switchToggle.js +10 -0
- package/src/theme/components/textArea.js +44 -0
- package/src/theme/components/textField.js +69 -45
- package/src/theme/globals.js +27 -26
- package/src/theme/index.js +2 -2
- package/src/themeHelpers/index.js +45 -30
- package/src/themeHelpers/processColors.js +10 -7
- package/dist/umd/221.js +0 -37
- package/dist/umd/511.js +0 -573
- package/dist/umd/9.js +0 -312
- /package/dist/umd/{221.js.LICENSE.txt → 101.js.LICENSE.txt} +0 -0
package/dist/index.esm.js
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
import '@vaadin/button';
|
2
2
|
import '@vaadin/text-field';
|
3
|
+
import '@vaadin/number-field';
|
4
|
+
import '@vaadin/email-field';
|
5
|
+
import '@vaadin/password-field';
|
6
|
+
import '@vaadin/text-area';
|
3
7
|
import '@vaadin/date-picker';
|
4
8
|
import merge from 'lodash.merge';
|
5
9
|
import set from 'lodash.set';
|
@@ -7,211 +11,249 @@ import Color from 'color';
|
|
7
11
|
|
8
12
|
const DESCOPE_PREFIX = 'descope';
|
9
13
|
|
10
|
-
const kebabCase = str =>
|
11
|
-
|
12
|
-
.replace(/[
|
13
|
-
.
|
14
|
+
const kebabCase = (str) =>
|
15
|
+
str
|
16
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
17
|
+
.replace(/[\s_.]+/g, '-')
|
18
|
+
.toLowerCase();
|
14
19
|
|
15
20
|
const kebabCaseJoin = (...args) => kebabCase(args.join('-'));
|
16
21
|
|
17
|
-
const getCssVarName = (...args) =>
|
22
|
+
const getCssVarName = (...args) =>
|
23
|
+
`--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
|
18
24
|
|
19
|
-
const createCssVarFallback = (first, ...rest) =>
|
25
|
+
const createCssVarFallback = (first, ...rest) =>
|
26
|
+
`var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
|
20
27
|
|
21
|
-
const createCssSelector = (
|
22
|
-
|
23
|
-
|
24
|
-
|
28
|
+
const createCssSelector = (
|
29
|
+
baseSelector = '',
|
30
|
+
relativeSelectorOrSelectorFn = ''
|
31
|
+
) =>
|
32
|
+
typeof relativeSelectorOrSelectorFn === 'function'
|
33
|
+
? relativeSelectorOrSelectorFn(baseSelector)
|
34
|
+
: `${baseSelector}${relativeSelectorOrSelectorFn}`;
|
25
35
|
|
26
36
|
class StyleBuilder {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
constructor() {
|
38
|
+
this.styleMap = new Map();
|
39
|
+
}
|
40
|
+
|
41
|
+
add(selector, property, value) {
|
42
|
+
if (!this.styleMap.has(selector)) {
|
43
|
+
this.styleMap.set(selector, []);
|
44
|
+
}
|
45
|
+
|
46
|
+
this.styleMap.set(selector, [
|
47
|
+
...this.styleMap.get(selector),
|
48
|
+
{ property, value }
|
49
|
+
]);
|
50
|
+
}
|
51
|
+
|
52
|
+
toString() {
|
53
|
+
return Array.from(this.styleMap.entries()).reduce(
|
54
|
+
(style, [selector, propValArr]) =>
|
55
|
+
(style += `${selector} { \n${propValArr
|
56
|
+
.map(({ property, value }) => `${property}: ${value}`)
|
57
|
+
.join(';\n')} \n}\n\n`),
|
58
|
+
''
|
59
|
+
);
|
60
|
+
}
|
44
61
|
}
|
45
62
|
|
46
63
|
const normalizeConfig = (attr, config) => {
|
47
|
-
|
64
|
+
const defaultMapping = { selector: '', property: kebabCase(attr) };
|
48
65
|
|
49
|
-
|
66
|
+
if (!config || !Object.keys(config).length) return [defaultMapping];
|
50
67
|
|
51
|
-
|
68
|
+
if (Array.isArray(config))
|
69
|
+
return config.map((entry) => Object.assign({}, defaultMapping, entry));
|
52
70
|
|
53
|
-
|
71
|
+
return [Object.assign({}, defaultMapping, config)];
|
54
72
|
};
|
55
73
|
|
56
74
|
const createStyle = (componentName, baseSelector, mappings) => {
|
57
|
-
|
75
|
+
const style = new StyleBuilder();
|
58
76
|
|
59
|
-
|
60
|
-
|
77
|
+
Object.keys(mappings).forEach((attr) => {
|
78
|
+
const attrConfig = normalizeConfig(attr, mappings[attr]);
|
61
79
|
|
62
|
-
|
80
|
+
const cssVarName = getCssVarName(componentName, attr);
|
63
81
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
82
|
+
attrConfig.forEach(
|
83
|
+
({ selector: relativeSelectorOrSelectorFn, property }) => {
|
84
|
+
style.add(
|
85
|
+
createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
|
86
|
+
property,
|
87
|
+
createCssVarFallback(cssVarName)
|
88
|
+
);
|
89
|
+
}
|
90
|
+
);
|
91
|
+
});
|
72
92
|
|
73
|
-
|
93
|
+
return style.toString();
|
74
94
|
};
|
75
95
|
|
76
96
|
const createCssVarsList = (componentName, mappings) =>
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
97
|
+
Object.keys(mappings).reduce(
|
98
|
+
(acc, attr) =>
|
99
|
+
Object.assign(acc, { [attr]: getCssVarName(componentName, attr) }),
|
100
|
+
{}
|
101
|
+
);
|
81
102
|
|
82
103
|
// match the host selector with the inner element selector
|
83
104
|
// e.g. when we want to set the same size for the host & the inner element this can be useful
|
84
|
-
const matchHostStyle = (mappingObj) => [
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
105
|
+
const matchHostStyle = (mappingObj) => [
|
106
|
+
mappingObj,
|
107
|
+
{ ...mappingObj, selector: () => `:host${mappingObj.selector || ''}` }
|
108
|
+
];
|
109
|
+
|
110
|
+
const createStyleMixin =
|
111
|
+
({ mappings = {} }) =>
|
112
|
+
(superclass) => {
|
113
|
+
const styleAttributes = Object.keys(mappings).map((key) =>
|
114
|
+
kebabCaseJoin('st', key)
|
115
|
+
);
|
116
|
+
return class CustomStyleMixinClass extends superclass {
|
117
|
+
static get observedAttributes() {
|
118
|
+
const superAttrs = superclass.observedAttributes || [];
|
119
|
+
return [...superAttrs, ...styleAttributes];
|
120
|
+
}
|
93
121
|
|
94
|
-
|
95
|
-
|
96
|
-
|
122
|
+
static get cssVarList() {
|
123
|
+
return createCssVarsList(superclass.componentName, mappings);
|
124
|
+
}
|
97
125
|
|
98
|
-
|
126
|
+
#styleEle = null;
|
99
127
|
|
100
|
-
|
101
|
-
|
128
|
+
constructor() {
|
129
|
+
super();
|
102
130
|
|
103
|
-
|
104
|
-
|
105
|
-
|
131
|
+
this.#createComponentStyle();
|
132
|
+
this.#createAttrOverrideStyle();
|
133
|
+
}
|
106
134
|
|
107
|
-
|
108
|
-
|
109
|
-
|
135
|
+
#createAttrOverrideStyle() {
|
136
|
+
this.#styleEle = document.createElement('style');
|
137
|
+
this.#styleEle.id = 'style-mixin-overrides';
|
110
138
|
|
111
|
-
|
112
|
-
|
113
|
-
|
139
|
+
this.#styleEle.innerText = '* {}';
|
140
|
+
this.shadowRoot.prepend(this.#styleEle);
|
141
|
+
}
|
114
142
|
|
115
|
-
|
116
|
-
|
117
|
-
|
143
|
+
#updateAttrOverrideStyle(attrName, value) {
|
144
|
+
const style = this.#styleEle.sheet.cssRules[0].style;
|
145
|
+
const varName = getCssVarName(
|
146
|
+
superclass.componentName,
|
147
|
+
attrName.replace(/^st-/, '')
|
148
|
+
);
|
118
149
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
style.removeProperty(varName);
|
123
|
-
}
|
150
|
+
if (value) style.setProperty(varName, value);
|
151
|
+
else style.removeProperty(varName);
|
152
|
+
}
|
124
153
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
154
|
+
#createComponentStyle() {
|
155
|
+
const themeStyle = document.createElement('style');
|
156
|
+
themeStyle.id = 'style-mixin-component';
|
157
|
+
themeStyle.innerHTML = createStyle(
|
158
|
+
superclass.componentName,
|
159
|
+
this.baseSelector,
|
160
|
+
mappings
|
161
|
+
);
|
162
|
+
this.shadowRoot.prepend(themeStyle);
|
163
|
+
}
|
131
164
|
|
132
|
-
|
133
|
-
|
165
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
166
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
134
167
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
};
|
168
|
+
if (styleAttributes.includes(attrName)) {
|
169
|
+
this.#updateAttrOverrideStyle(attrName, newValue);
|
170
|
+
}
|
171
|
+
}
|
172
|
+
};
|
173
|
+
};
|
141
174
|
|
142
175
|
const draggableMixin = (superclass) =>
|
143
|
-
|
144
|
-
|
145
|
-
#styleEle = null;
|
146
|
-
|
147
|
-
static get observedAttributes() {
|
148
|
-
const superAttrs = superclass.observedAttributes || [];
|
149
|
-
return [...superAttrs, 'draggable']
|
150
|
-
}
|
151
|
-
|
152
|
-
constructor() {
|
153
|
-
super();
|
154
|
-
|
155
|
-
this.#styleEle = document.createElement('style');
|
156
|
-
this.#styleEle.innerText = `${this.baseSelector} { cursor: inherit }`;
|
157
|
-
}
|
158
|
-
|
159
|
-
#handleDraggableStyle(isDraggable) {
|
160
|
-
if (isDraggable) {
|
161
|
-
this.shadowRoot.appendChild(this.#styleEle);
|
162
|
-
} else {
|
163
|
-
this.#styleEle.remove();
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
attributeChangedCallback(attrName, oldValue, newValue) {
|
168
|
-
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
169
|
-
if (attrName === 'draggable') {
|
170
|
-
this.#handleDraggableStyle(newValue === 'true');
|
171
|
-
}
|
172
|
-
}
|
173
|
-
};
|
176
|
+
class DraggableMixinClass extends superclass {
|
177
|
+
#styleEle = null;
|
174
178
|
|
175
|
-
|
176
|
-
|
177
|
-
|
179
|
+
static get observedAttributes() {
|
180
|
+
const superAttrs = superclass.observedAttributes || [];
|
181
|
+
return [...superAttrs, 'draggable'];
|
182
|
+
}
|
178
183
|
|
179
|
-
|
180
|
-
|
181
|
-
if (mutation.type === "attributes" && !excludeAttrs.includes(mutation.attributeName)) {
|
182
|
-
callback(mutation.attributeName);
|
183
|
-
}
|
184
|
-
}
|
185
|
-
});
|
184
|
+
constructor() {
|
185
|
+
super();
|
186
186
|
|
187
|
-
|
188
|
-
}
|
187
|
+
this.#styleEle = document.createElement('style');
|
188
|
+
this.#styleEle.innerText = `${this.baseSelector} { cursor: inherit }`;
|
189
|
+
}
|
189
190
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
191
|
+
#handleDraggableStyle(isDraggable) {
|
192
|
+
if (isDraggable) {
|
193
|
+
this.shadowRoot.appendChild(this.#styleEle);
|
194
|
+
} else {
|
195
|
+
this.#styleEle.remove();
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
200
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
201
|
+
if (attrName === 'draggable') {
|
202
|
+
this.#handleDraggableStyle(newValue === 'true');
|
203
|
+
}
|
204
|
+
}
|
205
|
+
};
|
206
|
+
|
207
|
+
const observeAttributes = (ele, callback, excludeAttrs) => {
|
208
|
+
// sync all attrs on init
|
209
|
+
callback(...Array.from(ele.attributes).map((attr) => attr.name));
|
210
|
+
|
211
|
+
const observer = new MutationObserver((mutationsList) => {
|
212
|
+
for (const mutation of mutationsList) {
|
213
|
+
if (
|
214
|
+
mutation.type === 'attributes' &&
|
215
|
+
!excludeAttrs.includes(mutation.attributeName)
|
216
|
+
) {
|
217
|
+
callback(mutation.attributeName);
|
218
|
+
}
|
219
|
+
}
|
220
|
+
});
|
221
|
+
|
222
|
+
observer.observe(ele, { attributes: true });
|
201
223
|
};
|
202
224
|
|
225
|
+
const createSyncAttrsCb =
|
226
|
+
(srcEle, targetEle) =>
|
227
|
+
(...attrNames) => {
|
228
|
+
attrNames.forEach((attrName) => {
|
229
|
+
const srcAttrVal = srcEle.getAttribute(attrName);
|
230
|
+
if (srcAttrVal !== null) {
|
231
|
+
if (targetEle.getAttribute(attrName) !== srcAttrVal) {
|
232
|
+
targetEle.setAttribute(attrName, srcAttrVal);
|
233
|
+
}
|
234
|
+
} else {
|
235
|
+
targetEle.removeAttribute(attrName);
|
236
|
+
}
|
237
|
+
});
|
238
|
+
};
|
239
|
+
|
203
240
|
const syncAttrs = (ele1, ele2, excludeAttrs) => {
|
204
|
-
|
205
|
-
|
241
|
+
observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), excludeAttrs);
|
242
|
+
observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), excludeAttrs);
|
206
243
|
};
|
207
244
|
|
208
|
-
const createProxy = ({
|
209
|
-
|
245
|
+
const createProxy = ({
|
246
|
+
componentName,
|
247
|
+
wrappedEleName,
|
248
|
+
slots = [],
|
249
|
+
style,
|
250
|
+
excludeAttrsSync = []
|
251
|
+
}) => {
|
210
252
|
const template = `
|
211
|
-
|
253
|
+
<style id="create-proxy"></style>
|
212
254
|
<${wrappedEleName}>
|
213
255
|
<slot></slot>
|
214
|
-
${slots.map((slot) => `<slot name="${slot}" slot="${slot}"></slot>`).join(
|
256
|
+
${slots.map((slot) => `<slot name="${slot}" slot="${slot}"></slot>`).join('')}
|
215
257
|
</${wrappedEleName}>
|
216
258
|
`;
|
217
259
|
|
@@ -221,17 +263,19 @@ const createProxy = ({ componentName, wrappedEleName, slots = [], style, exclude
|
|
221
263
|
}
|
222
264
|
|
223
265
|
constructor() {
|
224
|
-
super().attachShadow({ mode:
|
266
|
+
super().attachShadow({ mode: 'open' }).innerHTML = template;
|
225
267
|
this.hostElement = this.shadowRoot.host;
|
226
268
|
this.componentName = this.hostElement.tagName.toLowerCase();
|
227
269
|
this.baseSelector = wrappedEleName;
|
270
|
+
this.shadowRoot.getElementById('create-proxy').innerHTML =
|
271
|
+
typeof style === 'function' ? style() : style;
|
228
272
|
}
|
229
273
|
|
230
274
|
connectedCallback() {
|
231
275
|
if (this.shadowRoot.isConnected) {
|
232
276
|
this.proxyElement = this.shadowRoot.querySelector(wrappedEleName);
|
233
277
|
this.setAttribute('tabindex', '0');
|
234
|
-
|
278
|
+
|
235
279
|
// we want to focus on the proxy element when focusing our WC
|
236
280
|
this.onfocus = (e) => {
|
237
281
|
this.proxyElement.focus();
|
@@ -251,8 +295,11 @@ const createProxy = ({ componentName, wrappedEleName, slots = [], style, exclude
|
|
251
295
|
|
252
296
|
this.mouseoverCbRef = () => {
|
253
297
|
this.proxyElement.setAttribute('hover', '');
|
254
|
-
this.proxyElement.addEventListener(
|
255
|
-
|
298
|
+
this.proxyElement.addEventListener(
|
299
|
+
'mouseleave',
|
300
|
+
() => this.proxyElement.removeAttribute('hover'),
|
301
|
+
{ once: true }
|
302
|
+
);
|
256
303
|
};
|
257
304
|
|
258
305
|
this.proxyElement.addEventListener('mouseover', this.mouseoverCbRef);
|
@@ -279,149 +326,270 @@ const createProxy = ({ componentName, wrappedEleName, slots = [], style, exclude
|
|
279
326
|
};
|
280
327
|
|
281
328
|
const inputMixin = (superclass) =>
|
282
|
-
|
329
|
+
class InputMixinClass extends superclass {
|
283
330
|
static get formAssociated() {
|
284
331
|
return true;
|
285
332
|
}
|
286
|
-
|
287
|
-
#internals
|
288
333
|
|
289
|
-
|
290
|
-
super();
|
334
|
+
#internals;
|
291
335
|
|
292
|
-
|
293
|
-
|
294
|
-
// this is needed in order to make sure the form input validation is working
|
295
|
-
if (!this.hasAttribute('tabindex')) {
|
296
|
-
this.setAttribute('tabindex', 0);
|
297
|
-
}
|
298
|
-
}
|
336
|
+
constructor() {
|
337
|
+
super();
|
299
338
|
|
300
|
-
|
301
|
-
|
302
|
-
}
|
339
|
+
this.#internals = this.attachInternals();
|
340
|
+
}
|
303
341
|
|
304
|
-
|
305
|
-
|
342
|
+
formAssociatedCallback() {
|
343
|
+
this.setValidity?.();
|
344
|
+
}
|
306
345
|
|
307
|
-
|
308
|
-
|
309
|
-
const input = this.proxyElement.querySelector('input');
|
310
|
-
if (!input) throw Error('no input was found')
|
346
|
+
connectedCallback() {
|
347
|
+
super.connectedCallback?.();
|
311
348
|
|
312
|
-
|
313
|
-
|
314
|
-
|
349
|
+
// this is needed in order to make sure the form input validation is working
|
350
|
+
if (!this.hasAttribute('tabindex')) {
|
351
|
+
this.setAttribute('tabindex', 0);
|
352
|
+
}
|
315
353
|
|
316
|
-
|
317
|
-
|
318
|
-
|
354
|
+
// vaadin does not expose all those validation attributes so we need to take it from the input
|
355
|
+
// https://github.com/vaadin/web-components/issues/1177
|
356
|
+
const input =
|
357
|
+
this.proxyElement.querySelector('input') ||
|
358
|
+
this.proxyElement.querySelector('textarea');
|
359
|
+
if (!input) throw Error('no input was found');
|
360
|
+
|
361
|
+
this.checkValidity = () => input.checkValidity();
|
362
|
+
this.reportValidity = () => input.reportValidity();
|
363
|
+
this.validity = input.validity;
|
364
|
+
|
365
|
+
this.setValidity = () => {
|
366
|
+
this.#internals.setValidity(input.validity, input.validationMessage);
|
367
|
+
};
|
368
|
+
|
369
|
+
input.oninput = () => {
|
370
|
+
this.value = input.value;
|
371
|
+
this.setValidity();
|
372
|
+
};
|
373
|
+
}
|
374
|
+
};
|
319
375
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
376
|
+
const componentNameValidationMixin = (superclass) =>
|
377
|
+
class DraggableMixinClass extends superclass {
|
378
|
+
#checkComponentName() {
|
379
|
+
const currentComponentName = this.shadowRoot.host.tagName.toLowerCase();
|
380
|
+
|
381
|
+
if (!superclass.componentName) {
|
382
|
+
throw Error(
|
383
|
+
`component name is not defined on super class, make sure you have a static get for "componentName"`
|
384
|
+
);
|
385
|
+
}
|
324
386
|
|
325
|
-
|
326
|
-
|
387
|
+
if (currentComponentName !== superclass.componentName) {
|
388
|
+
throw Error(
|
389
|
+
`component name mismatch, expected "${superclass.componentName}", current "${currentComponentName}"`
|
390
|
+
);
|
391
|
+
}
|
392
|
+
}
|
327
393
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
}
|
336
|
-
|
337
|
-
if (currentComponentName !== superclass.componentName) {
|
338
|
-
throw Error(`component name mismatch, expected "${superclass.componentName}", current "${currentComponentName}"`)
|
339
|
-
}
|
340
|
-
}
|
341
|
-
|
342
|
-
connectedCallback() {
|
343
|
-
super.connectedCallback?.();
|
344
|
-
if (this.shadowRoot.isConnected) {
|
345
|
-
this.#checkComponentName();
|
346
|
-
}
|
347
|
-
}
|
348
|
-
};
|
394
|
+
connectedCallback() {
|
395
|
+
super.connectedCallback?.();
|
396
|
+
if (this.shadowRoot.isConnected) {
|
397
|
+
this.#checkComponentName();
|
398
|
+
}
|
399
|
+
}
|
400
|
+
};
|
349
401
|
|
350
402
|
const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
|
351
403
|
|
352
|
-
const compose =
|
404
|
+
const compose =
|
405
|
+
(...fns) =>
|
406
|
+
(val) =>
|
407
|
+
fns.reduceRight((res, fn) => fn(res), val);
|
408
|
+
|
409
|
+
const componentName$a = getComponentName('button');
|
353
410
|
|
354
411
|
const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
|
412
|
+
const resetStyles = `
|
413
|
+
vaadin-button { margin: 0; }
|
414
|
+
vaadin-button::part(prefix) {
|
415
|
+
margin-left: 0;
|
416
|
+
margin-right: 0;
|
417
|
+
}
|
418
|
+
`;
|
419
|
+
const iconStyles = `
|
420
|
+
vaadin-button::part(prefix),
|
421
|
+
vaadin-button::part(label) {
|
422
|
+
display: flex;
|
423
|
+
justify-content: center;
|
424
|
+
align-items: center;
|
425
|
+
gap: 5px;
|
426
|
+
}
|
427
|
+
`;
|
355
428
|
|
356
|
-
const
|
429
|
+
const selectors$2 = {
|
430
|
+
label: '::part(label)'
|
431
|
+
};
|
357
432
|
|
358
433
|
const Button = compose(
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
434
|
+
createStyleMixin({
|
435
|
+
// todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
|
436
|
+
mappings: {
|
437
|
+
backgroundColor: {},
|
438
|
+
borderRadius: {},
|
439
|
+
color: { selector: selectors$2.label },
|
440
|
+
borderColor: {},
|
441
|
+
borderStyle: {},
|
442
|
+
borderWidth: {},
|
443
|
+
fontSize: {},
|
444
|
+
height: {},
|
445
|
+
width: [matchHostStyle()],
|
446
|
+
cursor: {},
|
447
|
+
padding: [matchHostStyle(), { selector: selectors$2.label }],
|
448
|
+
textDecoration: { selector: selectors$2.label }
|
449
|
+
}
|
450
|
+
}),
|
451
|
+
draggableMixin,
|
452
|
+
componentNameValidationMixin
|
377
453
|
)(
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
454
|
+
createProxy({
|
455
|
+
slots: ['prefix', 'label', 'suffix'],
|
456
|
+
wrappedEleName: 'vaadin-button',
|
457
|
+
style: () =>
|
458
|
+
`${resetStyles} ${editorOverrides} ${iconStyles} ${loadingIndicatorStyles}`,
|
459
|
+
excludeAttrsSync: ['tabindex'],
|
460
|
+
componentName: componentName$a
|
461
|
+
})
|
385
462
|
);
|
386
463
|
|
387
|
-
|
464
|
+
const loadingIndicatorStyles = `
|
465
|
+
@keyframes spin {
|
466
|
+
0% { -webkit-transform: rotate(0deg); }
|
467
|
+
100% { -webkit-transform: rotate(360deg); }
|
468
|
+
}
|
469
|
+
:host([loading]) ::before {
|
470
|
+
--marginRatio: 1.35;
|
471
|
+
color: var(${Button.cssVarList.color});
|
472
|
+
animation: spin 2s linear infinite;
|
473
|
+
position: absolute;
|
474
|
+
top: calc(50% - calc((var(${Button.cssVarList.height}) / var(--marginRatio)) / 2));
|
475
|
+
left: calc(50% - calc((var(${Button.cssVarList.height}) / var(--marginRatio)) / 2));
|
476
|
+
content: '';
|
477
|
+
z-index: 1;
|
478
|
+
box-sizing: border-box;
|
479
|
+
border-radius: 50%;
|
480
|
+
border-bottom-color: transparent;
|
481
|
+
border-left-color: transparent;
|
482
|
+
border-width: calc(var(${Button.cssVarList.height}) / 12);
|
483
|
+
border-style: solid;
|
484
|
+
width: calc(var(${Button.cssVarList.height}) / var(--marginRatio));
|
485
|
+
height: calc(var(${Button.cssVarList.height}) / var(--marginRatio));
|
486
|
+
}
|
487
|
+
:host([loading])::part(prefix),
|
488
|
+
:host([loading])::part(label) {
|
489
|
+
visibility: hidden;
|
490
|
+
}
|
491
|
+
`;
|
388
492
|
|
389
|
-
|
493
|
+
customElements.define(componentName$a, Button);
|
494
|
+
|
495
|
+
const componentName$9 = getComponentName('text-field');
|
496
|
+
|
497
|
+
const selectors$1 = {
|
498
|
+
label: '::part(label)',
|
499
|
+
input: '::part(input-field)',
|
500
|
+
readOnlyInput: '[readonly]::part(input-field)::after',
|
501
|
+
placeholder: '> input:placeholder-shown'
|
502
|
+
};
|
503
|
+
|
504
|
+
let overrides$5 = ``;
|
505
|
+
|
506
|
+
const textFieldMappings = {
|
507
|
+
color: { selector: selectors$1.input },
|
508
|
+
backgroundColor: { selector: selectors$1.input },
|
509
|
+
width: [matchHostStyle()],
|
510
|
+
color: { selector: selectors$1.input },
|
511
|
+
borderColor: [
|
512
|
+
{ selector: selectors$1.input },
|
513
|
+
{ selector: selectors$1.readOnlyInput }
|
514
|
+
],
|
515
|
+
borderWidth: [
|
516
|
+
{ selector: selectors$1.input },
|
517
|
+
{ selector: selectors$1.readOnlyInput }
|
518
|
+
],
|
519
|
+
borderStyle: [
|
520
|
+
{ selector: selectors$1.input },
|
521
|
+
{ selector: selectors$1.readOnlyInput }
|
522
|
+
],
|
523
|
+
borderRadius: { selector: selectors$1.input },
|
524
|
+
boxShadow: { selector: selectors$1.input },
|
525
|
+
fontSize: {},
|
526
|
+
height: { selector: selectors$1.input },
|
527
|
+
padding: { selector: selectors$1.input },
|
528
|
+
outline: { selector: selectors$1.input },
|
529
|
+
outlineOffset: { selector: selectors$1.input },
|
530
|
+
|
531
|
+
placeholderColor: { selector: selectors$1.placeholder, property: 'color' }
|
532
|
+
};
|
390
533
|
|
391
534
|
const TextField = compose(
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
'borderStyle': { selector: '::part(input-field)' },
|
399
|
-
'borderRadius': { selector: '::part(input-field)' },
|
400
|
-
'boxShadow': { selector: '::part(input-field)' },
|
401
|
-
'height': { selector: '::part(input-field)' },
|
402
|
-
'padding': { selector: '::part(input-field)' },
|
403
|
-
'backgroundColor': { selector: '::part(input-field)' },
|
404
|
-
'labelColor': { selector: '::part(label)', property: 'color' },
|
405
|
-
},
|
406
|
-
}),
|
407
|
-
draggableMixin,
|
408
|
-
inputMixin,
|
409
|
-
componentNameValidationMixin
|
535
|
+
createStyleMixin({
|
536
|
+
mappings: textFieldMappings
|
537
|
+
}),
|
538
|
+
draggableMixin,
|
539
|
+
inputMixin,
|
540
|
+
componentNameValidationMixin
|
410
541
|
)(
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
542
|
+
createProxy({
|
543
|
+
slots: ['prefix', 'suffix'],
|
544
|
+
wrappedEleName: 'vaadin-text-field',
|
545
|
+
style: () => overrides$5,
|
546
|
+
excludeAttrsSync: ['tabindex'],
|
547
|
+
componentName: componentName$9
|
548
|
+
})
|
418
549
|
);
|
419
550
|
|
420
|
-
|
551
|
+
overrides$5 = `
|
552
|
+
vaadin-text-field {
|
553
|
+
margin: 0;
|
554
|
+
padding: 0;
|
555
|
+
}
|
556
|
+
vaadin-text-field::part(input-field) {
|
557
|
+
overflow: hidden;
|
558
|
+
}
|
559
|
+
vaadin-text-field[readonly] > input:placeholder-shown {
|
560
|
+
opacity: 1;
|
561
|
+
}
|
562
|
+
vaadin-text-field input:-webkit-autofill,
|
563
|
+
vaadin-text-field input:-webkit-autofill::first-line,
|
564
|
+
vaadin-text-field input:-webkit-autofill:hover,
|
565
|
+
vaadin-text-field input:-webkit-autofill:active,
|
566
|
+
vaadin-text-field input:-webkit-autofill:focus {
|
567
|
+
-webkit-text-fill-color: var(${TextField.cssVarList.color});
|
568
|
+
box-shadow: 0 0 0 var(${TextField.cssVarList.height}) var(${TextField.cssVarList.backgroundColor}) inset;
|
569
|
+
}
|
570
|
+
vaadin-text-field > label,
|
571
|
+
vaadin-text-field::part(input-field) {
|
572
|
+
cursor: pointer;
|
573
|
+
color: var(${TextField.cssVarList.color});
|
574
|
+
}
|
575
|
+
vaadin-text-field::part(input-field):focus {
|
576
|
+
cursor: text;
|
577
|
+
}
|
578
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
579
|
+
font-size: "12px";
|
580
|
+
content: "*";
|
581
|
+
color: var(${TextField.cssVarList.color});
|
582
|
+
}
|
583
|
+
vaadin-text-field[readonly]::part(input-field)::after {
|
584
|
+
border: 0 solid;
|
585
|
+
}
|
586
|
+
`;
|
587
|
+
|
588
|
+
customElements.define(componentName$9, TextField);
|
421
589
|
|
422
590
|
const template = document.createElement('template');
|
423
591
|
|
424
|
-
const componentName$
|
592
|
+
const componentName$8 = getComponentName('combo');
|
425
593
|
|
426
594
|
template.innerHTML = `
|
427
595
|
<descope-button></descope-button>
|
@@ -429,88 +597,339 @@ template.innerHTML = `
|
|
429
597
|
`;
|
430
598
|
|
431
599
|
class Combo extends HTMLElement {
|
432
|
-
|
433
|
-
|
600
|
+
constructor() {
|
601
|
+
super();
|
434
602
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
603
|
+
this.attachShadow({ mode: 'open' }).appendChild(
|
604
|
+
template.content.cloneNode(true)
|
605
|
+
);
|
606
|
+
}
|
439
607
|
}
|
440
608
|
|
441
|
-
customElements.define(componentName$
|
609
|
+
customElements.define(componentName$8, Combo);
|
610
|
+
|
611
|
+
const componentName$7 = getComponentName('number-field');
|
612
|
+
|
613
|
+
let overrides$4 = ``;
|
614
|
+
|
615
|
+
const NumberField = compose(
|
616
|
+
createStyleMixin({
|
617
|
+
mappings: {
|
618
|
+
...textFieldMappings
|
619
|
+
}
|
620
|
+
}),
|
621
|
+
draggableMixin,
|
622
|
+
inputMixin,
|
623
|
+
componentNameValidationMixin
|
624
|
+
)(
|
625
|
+
createProxy({
|
626
|
+
slots: ['prefix', 'suffix'],
|
627
|
+
wrappedEleName: 'vaadin-number-field',
|
628
|
+
style: () => overrides$4,
|
629
|
+
excludeAttrsSync: ['tabindex'],
|
630
|
+
componentName: componentName$7
|
631
|
+
})
|
632
|
+
);
|
633
|
+
|
634
|
+
overrides$4 = `
|
635
|
+
vaadin-number-field {
|
636
|
+
margin: 0;
|
637
|
+
padding: 0;
|
638
|
+
}
|
639
|
+
vaadin-number-field::part(input-field) {
|
640
|
+
overflow: hidden;
|
641
|
+
}
|
642
|
+
vaadin-number-field[readonly] > input:placeholder-shown {
|
643
|
+
opacity: 1;
|
644
|
+
}
|
645
|
+
vaadin-number-field input:-webkit-autofill,
|
646
|
+
vaadin-number-field input:-webkit-autofill::first-line,
|
647
|
+
vaadin-number-field input:-webkit-autofill:hover,
|
648
|
+
vaadin-number-field input:-webkit-autofill:active,
|
649
|
+
vaadin-number-field input:-webkit-autofill:focus {
|
650
|
+
-webkit-text-fill-color: var(${NumberField.cssVarList.color});
|
651
|
+
box-shadow: 0 0 0 var(${NumberField.cssVarList.height}) var(${NumberField.cssVarList.backgroundColor}) inset;
|
652
|
+
}
|
653
|
+
vaadin-number-field > label,
|
654
|
+
vaadin-number-field::part(input-field) {
|
655
|
+
cursor: pointer;
|
656
|
+
color: var(${NumberField.cssVarList.color});
|
657
|
+
}
|
658
|
+
vaadin-number-field::part(input-field):focus {
|
659
|
+
cursor: text;
|
660
|
+
}
|
661
|
+
vaadin-number-field[required]::part(required-indicator)::after {
|
662
|
+
font-size: "12px";
|
663
|
+
content: "*";
|
664
|
+
color: var(${NumberField.cssVarList.color});
|
665
|
+
}
|
666
|
+
vaadin-number-field[readonly]::part(input-field)::after {
|
667
|
+
border: 0 solid;
|
668
|
+
}
|
669
|
+
`;
|
670
|
+
|
671
|
+
customElements.define(componentName$7, NumberField);
|
672
|
+
|
673
|
+
const componentName$6 = getComponentName('email-field');
|
442
674
|
|
443
|
-
|
675
|
+
let overrides$3 = ``;
|
676
|
+
|
677
|
+
const EmailField = compose(
|
678
|
+
createStyleMixin({
|
679
|
+
mappings: {
|
680
|
+
...textFieldMappings
|
681
|
+
}
|
682
|
+
}),
|
683
|
+
draggableMixin,
|
684
|
+
inputMixin,
|
685
|
+
componentNameValidationMixin
|
686
|
+
)(
|
687
|
+
createProxy({
|
688
|
+
slots: ['suffix'],
|
689
|
+
wrappedEleName: 'vaadin-email-field',
|
690
|
+
style: () => overrides$3,
|
691
|
+
excludeAttrsSync: ['tabindex'],
|
692
|
+
componentName: componentName$6
|
693
|
+
})
|
694
|
+
);
|
695
|
+
|
696
|
+
overrides$3 = `
|
697
|
+
vaadin-email-field {
|
698
|
+
margin: 0;
|
699
|
+
padding: 0;
|
700
|
+
}
|
701
|
+
vaadin-email-field::part(input-field) {
|
702
|
+
overflow: hidden;
|
703
|
+
}
|
704
|
+
vaadin-email-field[readonly] > input:placeholder-shown {
|
705
|
+
opacity: 1;
|
706
|
+
}
|
707
|
+
vaadin-email-field input:-webkit-autofill,
|
708
|
+
vaadin-email-field input:-webkit-autofill::first-line,
|
709
|
+
vaadin-email-field input:-webkit-autofill:hover,
|
710
|
+
vaadin-email-field input:-webkit-autofill:active,
|
711
|
+
vaadin-email-field input:-webkit-autofill:focus {
|
712
|
+
-webkit-text-fill-color: var(${EmailField.cssVarList.color});
|
713
|
+
box-shadow: 0 0 0 var(${EmailField.cssVarList.height}) var(${EmailField.cssVarList.backgroundColor}) inset;
|
714
|
+
}
|
715
|
+
vaadin-email-field > label,
|
716
|
+
vaadin-email-field::part(input-field) {
|
717
|
+
cursor: pointer;
|
718
|
+
color: var(${EmailField.cssVarList.color});
|
719
|
+
}
|
720
|
+
vaadin-email-field::part(input-field):focus {
|
721
|
+
cursor: text;
|
722
|
+
}
|
723
|
+
vaadin-email-field[required]::part(required-indicator)::after {
|
724
|
+
font-size: "12px";
|
725
|
+
content: "*";
|
726
|
+
color: var(${EmailField.cssVarList.color});
|
727
|
+
}
|
728
|
+
vaadin-email-field[readonly]::part(input-field)::after {
|
729
|
+
border: 0 solid;
|
730
|
+
}
|
731
|
+
`;
|
732
|
+
|
733
|
+
customElements.define(componentName$6, EmailField);
|
734
|
+
|
735
|
+
const componentName$5 = getComponentName('password-field');
|
736
|
+
|
737
|
+
let overrides$2 = ``;
|
738
|
+
|
739
|
+
const PasswordField = compose(
|
740
|
+
createStyleMixin({
|
741
|
+
mappings: {
|
742
|
+
...textFieldMappings,
|
743
|
+
// todo: override cursor from lumo
|
744
|
+
revealCursor: [
|
745
|
+
{
|
746
|
+
selector: '::part(reveal-button)::before',
|
747
|
+
property: 'cursor'
|
748
|
+
}
|
749
|
+
]
|
750
|
+
}
|
751
|
+
}),
|
752
|
+
draggableMixin,
|
753
|
+
inputMixin,
|
754
|
+
componentNameValidationMixin
|
755
|
+
)(
|
756
|
+
createProxy({
|
757
|
+
slots: ['suffix'],
|
758
|
+
wrappedEleName: 'vaadin-password-field',
|
759
|
+
style: () => overrides$2,
|
760
|
+
excludeAttrsSync: ['tabindex'],
|
761
|
+
componentName: componentName$5
|
762
|
+
})
|
763
|
+
);
|
764
|
+
|
765
|
+
overrides$2 = `
|
766
|
+
vaadin-password-field {
|
767
|
+
margin: 0;
|
768
|
+
padding: 0;
|
769
|
+
}
|
770
|
+
vaadin-password-field::part(input-field) {
|
771
|
+
overflow: hidden;
|
772
|
+
}
|
773
|
+
vaadin-password-field[readonly] > input:placeholder-shown {
|
774
|
+
opacity: 1;
|
775
|
+
}
|
776
|
+
vaadin-password-field input:-webkit-autofill,
|
777
|
+
vaadin-password-field input:-webkit-autofill::first-line,
|
778
|
+
vaadin-password-field input:-webkit-autofill:hover,
|
779
|
+
vaadin-password-field input:-webkit-autofill:active,
|
780
|
+
vaadin-password-field input:-webkit-autofill:focus {
|
781
|
+
-webkit-text-fill-color: var(${PasswordField.cssVarList.color});
|
782
|
+
box-shadow: 0 0 0 var(${PasswordField.cssVarList.height}) var(${PasswordField.cssVarList.backgroundColor}) inset;
|
783
|
+
}
|
784
|
+
vaadin-password-field > label,
|
785
|
+
vaadin-password-field::part(input-field) {
|
786
|
+
cursor: pointer;
|
787
|
+
color: var(${PasswordField.cssVarList.color});
|
788
|
+
}
|
789
|
+
vaadin-password-field::part(input-field):focus {
|
790
|
+
cursor: text;
|
791
|
+
}
|
792
|
+
vaadin-password-field[required]::part(required-indicator)::after {
|
793
|
+
font-size: "12px";
|
794
|
+
content: "*";
|
795
|
+
color: var(${PasswordField.cssVarList.color});
|
796
|
+
}
|
797
|
+
vaadin-password-field[readonly]::part(input-field)::after {
|
798
|
+
border: 0 solid;
|
799
|
+
}
|
800
|
+
`;
|
801
|
+
|
802
|
+
customElements.define(componentName$5, PasswordField);
|
803
|
+
|
804
|
+
const componentName$4 = getComponentName('text-area');
|
805
|
+
|
806
|
+
const selectors = {
|
807
|
+
label: '::part(label)',
|
808
|
+
input: ':not([disabled])::part(input-field)',
|
809
|
+
required: '::part(required-indicator)::after'
|
810
|
+
};
|
811
|
+
|
812
|
+
let overrides$1 = ``;
|
813
|
+
|
814
|
+
const TextArea = compose(
|
815
|
+
createStyleMixin({
|
816
|
+
mappings: {
|
817
|
+
resize: { selector: '> textarea' },
|
818
|
+
color: { selector: selectors.label },
|
819
|
+
cursor: {},
|
820
|
+
width: {},
|
821
|
+
backgroundColor: { selector: selectors.input },
|
822
|
+
borderWidth: { selector: selectors.input },
|
823
|
+
borderStyle: { selector: selectors.input },
|
824
|
+
borderColor: { selector: selectors.input },
|
825
|
+
borderRadius: { selector: selectors.input },
|
826
|
+
outline: { selector: selectors.input },
|
827
|
+
outlineOffset: { selector: selectors.input }
|
828
|
+
}
|
829
|
+
}),
|
830
|
+
draggableMixin,
|
831
|
+
inputMixin,
|
832
|
+
componentNameValidationMixin
|
833
|
+
)(
|
834
|
+
createProxy({
|
835
|
+
slots: [],
|
836
|
+
wrappedEleName: 'vaadin-text-area',
|
837
|
+
style: () => overrides$1,
|
838
|
+
excludeAttrsSync: ['tabindex'],
|
839
|
+
componentName: componentName$4
|
840
|
+
})
|
841
|
+
);
|
842
|
+
|
843
|
+
overrides$1 = `
|
844
|
+
vaadin-text-area {
|
845
|
+
margin: 0;
|
846
|
+
}
|
847
|
+
vaadin-text-area > label,
|
848
|
+
vaadin-text-area::part(input-field) {
|
849
|
+
cursor: pointer;
|
850
|
+
}
|
851
|
+
vaadin-text-area[focused] input:focus {
|
852
|
+
cursor: text;
|
853
|
+
}
|
854
|
+
vaadin-text-area::part(required-indicator)::after {
|
855
|
+
font-size: "12px";
|
856
|
+
content: "*";
|
857
|
+
}
|
858
|
+
`;
|
859
|
+
|
860
|
+
customElements.define(componentName$4, TextArea);
|
861
|
+
|
862
|
+
const componentName$3 = getComponentName('date-picker');
|
444
863
|
|
445
864
|
const DatePicker = compose(
|
446
865
|
draggableMixin,
|
447
866
|
componentNameValidationMixin
|
448
867
|
)(
|
449
868
|
createProxy({
|
450
|
-
componentName: componentName$
|
451
|
-
slots: [
|
452
|
-
wrappedEleName:
|
453
|
-
style:
|
869
|
+
componentName: componentName$3,
|
870
|
+
slots: ['prefix', 'suffix'],
|
871
|
+
wrappedEleName: 'vaadin-date-picker',
|
872
|
+
style: ``
|
454
873
|
})
|
455
874
|
);
|
456
875
|
|
457
|
-
customElements.define(componentName$
|
876
|
+
customElements.define(componentName$3, DatePicker);
|
458
877
|
|
459
|
-
const componentName = getComponentName(
|
878
|
+
const componentName$2 = getComponentName('container');
|
460
879
|
|
461
880
|
class RawContainer extends HTMLElement {
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
881
|
+
static get componentName() {
|
882
|
+
return componentName$2;
|
883
|
+
}
|
884
|
+
constructor() {
|
885
|
+
super();
|
886
|
+
const template = document.createElement('template');
|
887
|
+
template.innerHTML = `<slot></slot>`;
|
888
|
+
|
889
|
+
this.attachShadow({ mode: 'open' });
|
890
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
891
|
+
|
892
|
+
this.baseSelector = ':host > slot';
|
893
|
+
}
|
475
894
|
}
|
476
895
|
|
477
896
|
const Container = compose(
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
897
|
+
createStyleMixin({
|
898
|
+
// todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
|
899
|
+
mappings: {
|
900
|
+
height: {},
|
901
|
+
width: {},
|
902
|
+
|
903
|
+
verticalPadding: [
|
904
|
+
{ property: 'padding-top' },
|
905
|
+
{ property: 'padding-bottom' }
|
906
|
+
],
|
907
|
+
horizontalPadding: [
|
908
|
+
{ property: 'padding-left' },
|
909
|
+
{ property: 'padding-right' }
|
910
|
+
],
|
911
|
+
|
912
|
+
display: {},
|
913
|
+
flexDirection: {},
|
914
|
+
justifyContent: {},
|
915
|
+
alignItems: {},
|
916
|
+
gap: {},
|
917
|
+
|
918
|
+
backgroundColor: {},
|
919
|
+
borderRadius: {},
|
920
|
+
|
921
|
+
borderColor: {},
|
922
|
+
borderStyle: {},
|
923
|
+
borderWidth: {},
|
924
|
+
|
925
|
+
boxShadow: {}
|
926
|
+
}
|
927
|
+
}),
|
928
|
+
draggableMixin,
|
929
|
+
componentNameValidationMixin
|
511
930
|
)(RawContainer);
|
512
931
|
|
513
|
-
customElements.define(componentName, Container);
|
932
|
+
customElements.define(componentName$2, Container);
|
514
933
|
|
515
934
|
const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
|
516
935
|
|
@@ -524,21 +943,25 @@ const transformTheme = (theme, path, getTransformation) => {
|
|
524
943
|
}, {});
|
525
944
|
};
|
526
945
|
|
527
|
-
const stringifyArray = (strArr) =>
|
946
|
+
const stringifyArray = (strArr) =>
|
947
|
+
strArr.map((str) => (str.includes(' ') ? `"${str}"` : str)).join(', ');
|
528
948
|
|
529
949
|
const themeToCSSVarsObj = (theme) =>
|
530
950
|
transformTheme(theme, [], (path, val) => ({
|
531
|
-
[getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
|
951
|
+
[getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
|
532
952
|
}));
|
533
953
|
|
534
954
|
const getThemeRefs = (theme, prefix) =>
|
535
|
-
transformTheme(theme, [], (path) =>
|
955
|
+
transformTheme(theme, [], (path) =>
|
956
|
+
set({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)
|
957
|
+
);
|
536
958
|
|
537
959
|
const globalsThemeToStyle = (theme, themeName = '') => `
|
538
960
|
*[data-theme="${themeName}"] {
|
539
961
|
${Object.entries(themeToCSSVarsObj(theme)).reduce(
|
540
|
-
|
541
|
-
|
962
|
+
(acc, entry) => (acc += `${entry.join(':')};\n`),
|
963
|
+
''
|
964
|
+
)}
|
542
965
|
}
|
543
966
|
`;
|
544
967
|
|
@@ -551,16 +974,22 @@ const componentsThemeToStyleObj = (componentsTheme) =>
|
|
551
974
|
// starts with underscore -> attribute selector
|
552
975
|
|
553
976
|
const attrsSelector = restPath.reduce((acc, section, idx) => {
|
554
|
-
if (section.startsWith('_'))
|
977
|
+
if (section.startsWith('_'))
|
978
|
+
return (acc += `[${kebabCase(section.replace(/^_/, ''))}="true"]`);
|
555
979
|
|
556
980
|
const nextSection = restPath[idx + 1];
|
557
981
|
|
558
982
|
if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
|
559
|
-
console.error(
|
983
|
+
console.error(
|
984
|
+
'theme generator',
|
985
|
+
`your theme structure is invalid, attribute "${section}" is followed by "${nextSection}" which is not allowed`
|
986
|
+
);
|
560
987
|
return acc;
|
561
988
|
}
|
562
989
|
|
563
|
-
return acc += `[${kebabCase(section)}="${restPath
|
990
|
+
return (acc += `[${kebabCase(section)}="${restPath
|
991
|
+
.splice(idx + 1, 1)
|
992
|
+
.join('')}"]`);
|
564
993
|
}, '');
|
565
994
|
|
566
995
|
let selector = `${getComponentName(component)}${attrsSelector}`;
|
@@ -569,12 +998,17 @@ const componentsThemeToStyleObj = (componentsTheme) =>
|
|
569
998
|
[selector]: {
|
570
999
|
[property]: val
|
571
1000
|
}
|
572
|
-
}
|
1001
|
+
};
|
573
1002
|
});
|
574
1003
|
|
575
1004
|
const componentsThemeToStyle = (componentsTheme, themeName = '') =>
|
576
1005
|
Object.entries(componentsThemeToStyleObj(componentsTheme)).reduce(
|
577
|
-
(acc, [selector, vars]) =>
|
1006
|
+
(acc, [selector, vars]) =>
|
1007
|
+
(acc += `*[data-theme="${themeName}"] ${selector} { \n${Object.entries(
|
1008
|
+
vars
|
1009
|
+
)
|
1010
|
+
.map(([key, val]) => `${key}: ${val}`)
|
1011
|
+
.join(';\n')} \n}\n\n`),
|
578
1012
|
''
|
579
1013
|
);
|
580
1014
|
|
@@ -583,7 +1017,7 @@ ${globalsThemeToStyle(globals, themeName)}
|
|
583
1017
|
${componentsThemeToStyle(components, themeName)}
|
584
1018
|
`;
|
585
1019
|
|
586
|
-
const useVar = varName => `var(${varName})`;
|
1020
|
+
const useVar = (varName) => `var(${varName})`;
|
587
1021
|
|
588
1022
|
const createHelperVars = (theme, prefix) => {
|
589
1023
|
const res = transformTheme(theme, [], (path, value) => {
|
@@ -595,17 +1029,20 @@ const createHelperVars = (theme, prefix) => {
|
|
595
1029
|
const theme = set({}, [...modifiedPath, varName], value);
|
596
1030
|
const useVars = { [property]: useVar(varName) };
|
597
1031
|
|
598
|
-
return { theme, useVars, vars }
|
1032
|
+
return { theme, useVars, vars };
|
599
1033
|
});
|
600
1034
|
|
601
|
-
return [res.theme, res.useVars, res.vars]
|
1035
|
+
return [res.theme, res.useVars, res.vars];
|
602
1036
|
};
|
603
1037
|
|
604
1038
|
const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
|
605
1039
|
const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
|
606
1040
|
const genContrast = (c, percentage = 0.9) => {
|
607
1041
|
const isDark = c.isDark();
|
608
|
-
return c
|
1042
|
+
return c
|
1043
|
+
.mix(Color(isDark ? 'white' : 'black'), percentage)
|
1044
|
+
.saturate(1)
|
1045
|
+
.hex();
|
609
1046
|
};
|
610
1047
|
|
611
1048
|
const genColor = (color) => {
|
@@ -615,8 +1052,8 @@ const genColor = (color) => {
|
|
615
1052
|
main: mainColor.hex(),
|
616
1053
|
dark: color.dark || genDark(mainColor),
|
617
1054
|
light: color.light || genLight(mainColor),
|
618
|
-
contrast: color.contrast || genContrast(mainColor)
|
619
|
-
}
|
1055
|
+
contrast: color.contrast || genContrast(mainColor)
|
1056
|
+
};
|
620
1057
|
};
|
621
1058
|
|
622
1059
|
const genColors = (colors) => {
|
@@ -624,38 +1061,39 @@ const genColors = (colors) => {
|
|
624
1061
|
const currentColor = colors[colorName];
|
625
1062
|
|
626
1063
|
return Object.assign(acc, {
|
627
|
-
[colorName]: genColor(currentColor)
|
628
|
-
})
|
1064
|
+
[colorName]: genColor(currentColor)
|
1065
|
+
});
|
629
1066
|
}, {});
|
630
1067
|
};
|
631
1068
|
|
632
1069
|
const colors = genColors({
|
633
1070
|
surface: {
|
634
1071
|
main: 'lightgray',
|
635
|
-
light: '#
|
1072
|
+
light: '#fff',
|
1073
|
+
dark: '#000'
|
636
1074
|
},
|
637
|
-
primary:
|
638
|
-
secondary:
|
639
|
-
success:
|
640
|
-
error:
|
1075
|
+
primary: '#0082B5',
|
1076
|
+
secondary: '#7D14EB',
|
1077
|
+
success: 'green',
|
1078
|
+
error: 'red'
|
641
1079
|
});
|
642
1080
|
|
643
1081
|
const typography = {
|
644
1082
|
h1: {
|
645
|
-
font: [
|
646
|
-
weight:
|
647
|
-
size:
|
1083
|
+
font: ['Courier New', 'Arial', 'sans-serif'],
|
1084
|
+
weight: '700',
|
1085
|
+
size: '48px'
|
648
1086
|
},
|
649
1087
|
h2: {
|
650
|
-
font: [
|
651
|
-
weight:
|
652
|
-
size:
|
1088
|
+
font: ['Courier New', 'sans-serif'],
|
1089
|
+
weight: '500',
|
1090
|
+
size: '38px'
|
653
1091
|
},
|
654
1092
|
h3: {
|
655
|
-
font: [
|
656
|
-
weight:
|
657
|
-
size:
|
658
|
-
}
|
1093
|
+
font: ['Courier New', 'sans-serif'],
|
1094
|
+
weight: '300',
|
1095
|
+
size: '28px'
|
1096
|
+
}
|
659
1097
|
};
|
660
1098
|
|
661
1099
|
const spacing = {
|
@@ -663,19 +1101,19 @@ const spacing = {
|
|
663
1101
|
sm: '4px',
|
664
1102
|
md: '8px',
|
665
1103
|
lg: '16px',
|
666
|
-
xl: '32px'
|
1104
|
+
xl: '32px'
|
667
1105
|
};
|
668
1106
|
|
669
1107
|
const border = {
|
670
|
-
sm:
|
671
|
-
md:
|
672
|
-
lg:
|
1108
|
+
sm: '1px',
|
1109
|
+
md: '2px',
|
1110
|
+
lg: '3px'
|
673
1111
|
};
|
674
1112
|
|
675
1113
|
const radius = {
|
676
|
-
sm:
|
677
|
-
md:
|
678
|
-
lg:
|
1114
|
+
sm: '5px',
|
1115
|
+
md: '25px',
|
1116
|
+
lg: '50px'
|
679
1117
|
};
|
680
1118
|
|
681
1119
|
const shadow = {
|
@@ -683,8 +1121,8 @@ const shadow = {
|
|
683
1121
|
size: {
|
684
1122
|
sm: `0 0 10px`,
|
685
1123
|
md: `0 0 20px`,
|
686
|
-
lg: `0 0 30px
|
687
|
-
}
|
1124
|
+
lg: `0 0 30px`
|
1125
|
+
}
|
688
1126
|
};
|
689
1127
|
|
690
1128
|
var globals = {
|
@@ -693,135 +1131,333 @@ var globals = {
|
|
693
1131
|
spacing,
|
694
1132
|
border,
|
695
1133
|
radius,
|
696
|
-
shadow
|
1134
|
+
shadow
|
697
1135
|
};
|
698
1136
|
|
699
|
-
const globalRefs$
|
700
|
-
const vars$
|
1137
|
+
const globalRefs$3 = getThemeRefs(globals);
|
1138
|
+
const vars$6 = Button.cssVarList;
|
701
1139
|
|
702
1140
|
const mode = {
|
703
|
-
primary:
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
},
|
709
|
-
secondary: globalRefs$2.colors.secondary,
|
710
|
-
success: globalRefs$2.colors.success,
|
711
|
-
error: globalRefs$2.colors.error,
|
712
|
-
surface: globalRefs$2.colors.surface,
|
1141
|
+
primary: globalRefs$3.colors.primary,
|
1142
|
+
secondary: globalRefs$3.colors.secondary,
|
1143
|
+
success: globalRefs$3.colors.success,
|
1144
|
+
error: globalRefs$3.colors.error,
|
1145
|
+
surface: globalRefs$3.colors.surface
|
713
1146
|
};
|
714
1147
|
|
715
|
-
const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$
|
1148
|
+
const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$a);
|
716
1149
|
|
717
1150
|
const button = {
|
718
1151
|
...helperTheme$1,
|
719
|
-
[vars$2.borderRadius]: globalRefs$2.radius.lg,
|
720
|
-
[vars$2.cursor]: 'pointer',
|
721
1152
|
|
722
1153
|
size: {
|
723
1154
|
xs: {
|
724
|
-
[vars$
|
725
|
-
[vars$
|
726
|
-
[vars$
|
1155
|
+
[vars$6.height]: '10px',
|
1156
|
+
[vars$6.fontSize]: '10px',
|
1157
|
+
[vars$6.padding]: `0 ${globalRefs$3.spacing.xs}`
|
727
1158
|
},
|
728
1159
|
sm: {
|
729
|
-
[vars$
|
730
|
-
[vars$
|
731
|
-
[vars$
|
1160
|
+
[vars$6.height]: '20px',
|
1161
|
+
[vars$6.fontSize]: '10px',
|
1162
|
+
[vars$6.padding]: `0 ${globalRefs$3.spacing.sm}`
|
732
1163
|
},
|
733
1164
|
md: {
|
734
|
-
[vars$
|
735
|
-
[vars$
|
736
|
-
[vars$
|
1165
|
+
[vars$6.height]: '30px',
|
1166
|
+
[vars$6.fontSize]: '14px',
|
1167
|
+
[vars$6.padding]: `0 ${globalRefs$3.spacing.md}`
|
737
1168
|
},
|
738
1169
|
lg: {
|
739
|
-
[vars$
|
740
|
-
[vars$
|
741
|
-
[vars$
|
1170
|
+
[vars$6.height]: '40px',
|
1171
|
+
[vars$6.fontSize]: '20px',
|
1172
|
+
[vars$6.padding]: `0 ${globalRefs$3.spacing.lg}`
|
742
1173
|
},
|
743
1174
|
xl: {
|
744
|
-
[vars$
|
745
|
-
[vars$
|
746
|
-
[vars$
|
747
|
-
}
|
1175
|
+
[vars$6.height]: '50px',
|
1176
|
+
[vars$6.fontSize]: '25px',
|
1177
|
+
[vars$6.padding]: `0 ${globalRefs$3.spacing.xl}`
|
1178
|
+
}
|
748
1179
|
},
|
749
1180
|
|
1181
|
+
[vars$6.borderRadius]: globalRefs$3.radius.lg,
|
1182
|
+
[vars$6.cursor]: 'pointer',
|
1183
|
+
[vars$6.borderWidth]: '2px',
|
1184
|
+
[vars$6.borderStyle]: 'solid',
|
1185
|
+
[vars$6.borderColor]: 'transparent',
|
1186
|
+
|
750
1187
|
_fullWidth: {
|
751
|
-
[vars$
|
1188
|
+
[vars$6.width]: '100%'
|
1189
|
+
},
|
1190
|
+
_loading: {
|
1191
|
+
[vars$6.cursor]: 'wait'
|
752
1192
|
},
|
753
1193
|
|
754
1194
|
variant: {
|
755
1195
|
contained: {
|
756
|
-
[vars$
|
757
|
-
[vars$
|
1196
|
+
[vars$6.color]: helperRefs$1.contrast,
|
1197
|
+
[vars$6.backgroundColor]: helperRefs$1.main,
|
758
1198
|
_hover: {
|
759
|
-
[vars$
|
1199
|
+
[vars$6.backgroundColor]: helperRefs$1.dark
|
760
1200
|
},
|
1201
|
+
_loading: {
|
1202
|
+
[vars$6.backgroundColor]: helperRefs$1.main
|
1203
|
+
}
|
761
1204
|
},
|
762
1205
|
outline: {
|
763
|
-
[vars$
|
764
|
-
[vars$
|
765
|
-
[vars$2.borderWidth]: '2px',
|
766
|
-
[vars$2.borderStyle]: 'solid',
|
1206
|
+
[vars$6.color]: helperRefs$1.main,
|
1207
|
+
[vars$6.borderColor]: helperRefs$1.main,
|
767
1208
|
_hover: {
|
768
|
-
[vars$
|
769
|
-
[vars$
|
1209
|
+
[vars$6.color]: helperRefs$1.dark,
|
1210
|
+
[vars$6.borderColor]: helperRefs$1.dark,
|
770
1211
|
_error: {
|
771
|
-
[vars$
|
1212
|
+
[vars$6.color]: helperRefs$1.error
|
772
1213
|
}
|
773
1214
|
}
|
774
1215
|
},
|
775
1216
|
link: {
|
776
|
-
[vars$
|
1217
|
+
[vars$6.color]: helperRefs$1.main,
|
1218
|
+
[vars$6.padding]: 0,
|
1219
|
+
[vars$6.margin]: 0,
|
1220
|
+
[vars$6.lineHeight]: helperRefs$1.height,
|
1221
|
+
[vars$6.borderRadius]: 0,
|
1222
|
+
_hover: {
|
1223
|
+
[vars$6.color]: helperRefs$1.main,
|
1224
|
+
[vars$6.textDecoration]: 'underline'
|
1225
|
+
}
|
1226
|
+
}
|
1227
|
+
}
|
1228
|
+
};
|
1229
|
+
|
1230
|
+
const globalRefs$2 = getThemeRefs(globals);
|
1231
|
+
|
1232
|
+
const vars$5 = TextField.cssVarList;
|
1233
|
+
|
1234
|
+
const textField = (vars) => ({
|
1235
|
+
size: {
|
1236
|
+
xs: {
|
1237
|
+
[vars.height]: '14px',
|
1238
|
+
[vars.fontSize]: '8px',
|
1239
|
+
[vars.padding]: `0 ${globalRefs$2.spacing.xs}`
|
777
1240
|
},
|
1241
|
+
sm: {
|
1242
|
+
[vars.height]: '20px',
|
1243
|
+
[vars.fontSize]: '10px',
|
1244
|
+
[vars.padding]: `0 ${globalRefs$2.spacing.sm}`
|
1245
|
+
},
|
1246
|
+
md: {
|
1247
|
+
[vars.height]: '30px',
|
1248
|
+
[vars.fontSize]: '14px',
|
1249
|
+
[vars.padding]: `0 ${globalRefs$2.spacing.md}`
|
1250
|
+
},
|
1251
|
+
lg: {
|
1252
|
+
[vars.height]: '40px',
|
1253
|
+
[vars.fontSize]: '16px',
|
1254
|
+
[vars.padding]: `0 ${globalRefs$2.spacing.lg}`
|
1255
|
+
},
|
1256
|
+
xl: {
|
1257
|
+
[vars.height]: '50px',
|
1258
|
+
[vars.fontSize]: '25px',
|
1259
|
+
[vars.padding]: `0 ${globalRefs$2.spacing.xl}`
|
1260
|
+
}
|
1261
|
+
},
|
1262
|
+
|
1263
|
+
[vars.color]: globalRefs$2.colors.surface.contrast,
|
1264
|
+
[vars.placeholderColor]: globalRefs$2.colors.surface.contrast,
|
1265
|
+
|
1266
|
+
[vars.backgroundColor]: globalRefs$2.colors.surface.light,
|
1267
|
+
|
1268
|
+
[vars.borderWidth]: '1px',
|
1269
|
+
[vars.borderStyle]: 'solid',
|
1270
|
+
[vars.borderColor]: 'transparent',
|
1271
|
+
[vars.borderWidthReadOnly]: '0',
|
1272
|
+
[vars.borderRadius]: globalRefs$2.radius.sm,
|
1273
|
+
|
1274
|
+
_borderoffset: {
|
1275
|
+
[vars.outlineOffset]: '2px'
|
1276
|
+
},
|
1277
|
+
|
1278
|
+
_invalid: {
|
1279
|
+
[vars.borderColor]: globalRefs$2.colors.error.main,
|
1280
|
+
[vars.color]: globalRefs$2.colors.error.main
|
1281
|
+
},
|
1282
|
+
|
1283
|
+
_disabled: {
|
1284
|
+
[vars.color]: globalRefs$2.colors.surface.dark,
|
1285
|
+
[vars.placeholderColor]: globalRefs$2.colors.surface.light,
|
1286
|
+
[vars.backgroundColor]: globalRefs$2.colors.surface.main
|
1287
|
+
},
|
1288
|
+
|
1289
|
+
_fullWidth: {
|
1290
|
+
[vars.width]: '100%'
|
1291
|
+
},
|
1292
|
+
|
1293
|
+
_focused: {
|
1294
|
+
[vars.outline]: `2px solid ${globalRefs$2.colors.surface.main}`
|
1295
|
+
},
|
1296
|
+
|
1297
|
+
_bordered: {
|
1298
|
+
[vars.borderColor]: globalRefs$2.colors.surface.main
|
778
1299
|
}
|
1300
|
+
});
|
1301
|
+
|
1302
|
+
var textField$1 = textField(vars$5);
|
1303
|
+
|
1304
|
+
const vars$4 = PasswordField.cssVarList;
|
1305
|
+
|
1306
|
+
const passwordField = {
|
1307
|
+
...textField(vars$4),
|
1308
|
+
[vars$4.revealCursor]: 'pointer'
|
1309
|
+
};
|
1310
|
+
|
1311
|
+
const numberField = {
|
1312
|
+
...textField(NumberField.cssVarList)
|
1313
|
+
};
|
1314
|
+
|
1315
|
+
const emailField = {
|
1316
|
+
...textField(EmailField.cssVarList)
|
779
1317
|
};
|
780
1318
|
|
781
1319
|
const globalRefs$1 = getThemeRefs(globals);
|
1320
|
+
const vars$3 = TextArea.cssVarList;
|
1321
|
+
|
1322
|
+
const textArea = {
|
1323
|
+
[vars$3.color]: globalRefs$1.colors.primary.main,
|
1324
|
+
[vars$3.backgroundColor]: globalRefs$1.colors.surface.light,
|
1325
|
+
[vars$3.resize]: 'vertical',
|
1326
|
+
|
1327
|
+
[vars$3.borderRadius]: globalRefs$1.radius.sm,
|
1328
|
+
[vars$3.borderWidth]: '1px',
|
1329
|
+
[vars$3.borderStyle]: 'solid',
|
1330
|
+
[vars$3.borderColor]: 'transparent',
|
1331
|
+
|
1332
|
+
_borderOffset: {
|
1333
|
+
[vars$3.outlineOffset]: '2px'
|
1334
|
+
},
|
1335
|
+
|
1336
|
+
_bordered: {
|
1337
|
+
[vars$3.borderColor]: globalRefs$1.colors.surface.main
|
1338
|
+
},
|
782
1339
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
1340
|
+
_focused: {
|
1341
|
+
[vars$3.focusInputCursor]: 'text',
|
1342
|
+
[vars$3.outline]: `2px solid ${globalRefs$1.colors.surface.main}`
|
1343
|
+
},
|
1344
|
+
|
1345
|
+
_fullWidth: {
|
1346
|
+
[vars$3.width]: '100%'
|
1347
|
+
},
|
1348
|
+
|
1349
|
+
_disabled: {
|
1350
|
+
[vars$3.cursor]: 'not-allowed'
|
1351
|
+
},
|
1352
|
+
|
1353
|
+
_invalid: {
|
1354
|
+
[vars$3.outline]: `2px solid ${globalRefs$1.colors.error.main}`
|
1355
|
+
}
|
1356
|
+
};
|
1357
|
+
|
1358
|
+
const componentName$1 = getComponentName('checkbox');
|
1359
|
+
|
1360
|
+
const Checkbox = compose(
|
1361
|
+
createStyleMixin({
|
1362
|
+
mappings: {
|
1363
|
+
width: {},
|
1364
|
+
cursor: [{}, { selector: '> label' }]
|
1365
|
+
}
|
1366
|
+
}),
|
1367
|
+
draggableMixin,
|
1368
|
+
inputMixin,
|
1369
|
+
componentNameValidationMixin
|
1370
|
+
)(
|
1371
|
+
createProxy({
|
1372
|
+
slots: [],
|
1373
|
+
wrappedEleName: 'vaadin-checkbox',
|
1374
|
+
style: ``,
|
1375
|
+
excludeAttrsSync: ['tabindex'],
|
1376
|
+
componentName: componentName$1
|
1377
|
+
})
|
1378
|
+
);
|
1379
|
+
|
1380
|
+
const vars$2 = Checkbox.cssVarList;
|
1381
|
+
|
1382
|
+
const checkbox = {
|
1383
|
+
[vars$2.cursor]: 'pointer'
|
1384
|
+
};
|
1385
|
+
|
1386
|
+
const componentName = getComponentName('switch-toggle');
|
1387
|
+
|
1388
|
+
let overrides = ``;
|
1389
|
+
|
1390
|
+
const SwitchToggle = compose(
|
1391
|
+
createStyleMixin({
|
1392
|
+
mappings: {
|
1393
|
+
width: {},
|
1394
|
+
cursor: [{}, { selector: '> label' }]
|
1395
|
+
}
|
1396
|
+
}),
|
1397
|
+
draggableMixin,
|
1398
|
+
inputMixin,
|
1399
|
+
componentNameValidationMixin
|
1400
|
+
)(
|
1401
|
+
createProxy({
|
1402
|
+
slots: [],
|
1403
|
+
wrappedEleName: 'vaadin-checkbox',
|
1404
|
+
style: () => overrides,
|
1405
|
+
excludeAttrsSync: ['tabindex'],
|
1406
|
+
componentName
|
1407
|
+
})
|
1408
|
+
);
|
1409
|
+
|
1410
|
+
overrides = `
|
1411
|
+
:host {
|
1412
|
+
--margin: 7px;
|
1413
|
+
--width: var(${SwitchToggle.cssVarList.width});
|
1414
|
+
--height: calc(var(--width) / 2);
|
1415
|
+
--radius: var(--height);
|
1416
|
+
--knobSize: calc(var(--height) - 5px);
|
1417
|
+
--bgColor: #fff;
|
1418
|
+
--knobBgColor: #000;
|
1419
|
+
}
|
1420
|
+
vaadin-checkbox>label {
|
1421
|
+
cursor: pointer;
|
1422
|
+
border: 1px solid;
|
1423
|
+
text-indent: -99999px;
|
1424
|
+
display: block;
|
1425
|
+
position: relative;
|
1426
|
+
width: var(--width);
|
1427
|
+
height: var(--height);
|
1428
|
+
background: var(--bgColor);
|
1429
|
+
border-radius: var(--radius);
|
1430
|
+
}
|
1431
|
+
vaadin-checkbox>label::after {
|
1432
|
+
content: '';
|
1433
|
+
position: absolute;
|
1434
|
+
transition: 0.3s;
|
1435
|
+
top: var(--margin);
|
1436
|
+
left: var(--margin);
|
1437
|
+
width: var(--knobSize);
|
1438
|
+
height: var(--knobSize);
|
1439
|
+
background: var(--knobBgColor);
|
1440
|
+
border-radius: var(--knobSize);
|
1441
|
+
}
|
1442
|
+
vaadin-checkbox::part(checkbox) {
|
1443
|
+
height: 0;
|
1444
|
+
width: 0;
|
1445
|
+
visibility: hidden;
|
1446
|
+
}
|
1447
|
+
vaadin-checkbox[checked]>label::after {
|
1448
|
+
transform: translateX(-100%);
|
1449
|
+
left: calc(100% - var(--margin));
|
1450
|
+
}
|
1451
|
+
vaadin-checkbox[active]>label::after {
|
1452
|
+
width: calc(var(--knobSize) + 15px);
|
1453
|
+
}
|
1454
|
+
`;
|
1455
|
+
|
1456
|
+
const vars$1 = SwitchToggle.cssVarList;
|
1457
|
+
|
1458
|
+
const swtichToggle = {
|
1459
|
+
[vars$1.width]: '70px',
|
1460
|
+
[vars$1.cursor]: [{}, { selector: '> label' }]
|
825
1461
|
};
|
826
1462
|
|
827
1463
|
const globalRefs = getThemeRefs(globals);
|
@@ -831,30 +1467,33 @@ const vars = Container.cssVarList;
|
|
831
1467
|
const verticalAlignment = {
|
832
1468
|
start: { verticalAlignment: 'start' },
|
833
1469
|
center: { verticalAlignment: 'center' },
|
834
|
-
end: { verticalAlignment: 'end' }
|
1470
|
+
end: { verticalAlignment: 'end' }
|
835
1471
|
};
|
836
1472
|
|
837
1473
|
const horizontalAlignment = {
|
838
1474
|
start: { horizontalAlignment: 'start' },
|
839
1475
|
center: { horizontalAlignment: 'center' },
|
840
|
-
end: { horizontalAlignment: 'end' }
|
1476
|
+
end: { horizontalAlignment: 'end' }
|
841
1477
|
};
|
842
1478
|
|
843
|
-
const [helperTheme,
|
844
|
-
|
1479
|
+
const [helperTheme, helperRefs, helperVars] = createHelperVars(
|
1480
|
+
{ verticalAlignment, horizontalAlignment },
|
1481
|
+
'container'
|
1482
|
+
);
|
845
1483
|
|
846
1484
|
const container = {
|
847
1485
|
...helperTheme,
|
848
1486
|
[vars.display]: 'flex',
|
1487
|
+
[vars.backgroundColor]: globalRefs.colors.surface.main,
|
849
1488
|
verticalPadding: {
|
850
1489
|
sm: { [vars.verticalPadding]: '5px' },
|
851
1490
|
md: { [vars.verticalPadding]: '10px' },
|
852
|
-
lg: { [vars.verticalPadding]: '20px' }
|
1491
|
+
lg: { [vars.verticalPadding]: '20px' }
|
853
1492
|
},
|
854
1493
|
horizontalPadding: {
|
855
1494
|
sm: { [vars.horizontalPadding]: '5px' },
|
856
1495
|
md: { [vars.horizontalPadding]: '10px' },
|
857
|
-
lg: { [vars.horizontalPadding]: '20px' }
|
1496
|
+
lg: { [vars.horizontalPadding]: '20px' }
|
858
1497
|
},
|
859
1498
|
direction: {
|
860
1499
|
row: {
|
@@ -862,7 +1501,7 @@ const container = {
|
|
862
1501
|
[vars.alignItems]: helperRefs.verticalAlignment,
|
863
1502
|
[vars.justifyContent]: helperRefs.horizontalAlignment,
|
864
1503
|
horizontalAlignment: {
|
865
|
-
spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' }
|
1504
|
+
spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' }
|
866
1505
|
}
|
867
1506
|
},
|
868
1507
|
|
@@ -871,9 +1510,11 @@ const container = {
|
|
871
1510
|
[vars.alignItems]: helperRefs.horizontalAlignment,
|
872
1511
|
[vars.justifyContent]: helperRefs.verticalAlignment,
|
873
1512
|
verticalAlignment: {
|
874
|
-
spaceBetween: {
|
1513
|
+
spaceBetween: {
|
1514
|
+
[helperVars.verticalAlignment]: 'space-between'
|
1515
|
+
}
|
875
1516
|
}
|
876
|
-
}
|
1517
|
+
}
|
877
1518
|
},
|
878
1519
|
|
879
1520
|
spaceBetween: {
|
@@ -889,34 +1530,40 @@ const container = {
|
|
889
1530
|
},
|
890
1531
|
|
891
1532
|
shadow: {
|
892
|
-
sm: {
|
893
|
-
[vars.boxShadow]: `${globalRefs.shadow.size.sm} ${globalRefs.shadow.color}`
|
894
|
-
},
|
895
|
-
md: {
|
896
|
-
[vars.boxShadow]: `${globalRefs.shadow.size.md} ${globalRefs.shadow.color}`
|
897
|
-
},
|
898
|
-
lg: {
|
899
|
-
[vars.boxShadow]: `${globalRefs.shadow.size.lg} ${globalRefs.shadow.color}`
|
1533
|
+
sm: {
|
1534
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.sm} ${globalRefs.shadow.color}`
|
900
1535
|
},
|
1536
|
+
md: {
|
1537
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.md} ${globalRefs.shadow.color}`
|
1538
|
+
},
|
1539
|
+
lg: {
|
1540
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.lg} ${globalRefs.shadow.color}`
|
1541
|
+
}
|
901
1542
|
},
|
902
1543
|
|
903
1544
|
borderRadius: {
|
904
|
-
sm: {
|
1545
|
+
sm: {
|
905
1546
|
[vars.borderRadius]: globalRefs.radius.sm
|
906
1547
|
},
|
907
|
-
md: {
|
1548
|
+
md: {
|
908
1549
|
[vars.borderRadius]: globalRefs.radius.md
|
909
1550
|
},
|
910
|
-
lg: {
|
1551
|
+
lg: {
|
911
1552
|
[vars.borderRadius]: globalRefs.radius.lg
|
912
|
-
}
|
1553
|
+
}
|
913
1554
|
}
|
914
1555
|
};
|
915
1556
|
|
916
1557
|
var components = {
|
917
|
-
|
918
|
-
|
919
|
-
|
1558
|
+
button,
|
1559
|
+
textField: textField$1,
|
1560
|
+
passwordField,
|
1561
|
+
numberField,
|
1562
|
+
emailField,
|
1563
|
+
textArea,
|
1564
|
+
checkbox,
|
1565
|
+
switchToggle: swtichToggle,
|
1566
|
+
container
|
920
1567
|
};
|
921
1568
|
|
922
1569
|
var index = { globals, components };
|