@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.
Files changed (100) hide show
  1. package/dist/cjs/index.cjs.js +35 -18
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +1128 -481
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/101.js +148 -0
  6. package/dist/umd/208.js +2 -0
  7. package/dist/umd/208.js.LICENSE.txt +5 -0
  8. package/dist/umd/211.js +312 -0
  9. package/dist/umd/211.js.LICENSE.txt +5 -0
  10. package/dist/umd/233.js +573 -0
  11. package/dist/umd/{511.js.LICENSE.txt → 233.js.LICENSE.txt} +0 -6
  12. package/dist/umd/422.js +2 -0
  13. package/dist/umd/422.js.LICENSE.txt +5 -0
  14. package/dist/umd/437.js +19 -0
  15. package/dist/umd/437.js.LICENSE.txt +5 -0
  16. package/dist/umd/513.js +1 -0
  17. package/dist/umd/515.js +202 -0
  18. package/dist/umd/515.js.LICENSE.txt +11 -0
  19. package/dist/umd/54.js +4 -4
  20. package/dist/umd/56.js +48 -0
  21. package/dist/umd/56.js.LICENSE.txt +5 -0
  22. package/dist/umd/599.js +1 -1
  23. package/dist/umd/63.js +1 -0
  24. package/dist/umd/725.js +37 -0
  25. package/dist/umd/725.js.LICENSE.txt +11 -0
  26. package/dist/umd/729.js +1 -1
  27. package/dist/umd/767.js +2 -0
  28. package/dist/umd/{9.js.LICENSE.txt → 767.js.LICENSE.txt} +0 -6
  29. package/dist/umd/786.js +2 -0
  30. package/dist/umd/786.js.LICENSE.txt +17 -0
  31. package/dist/umd/789.js +1 -0
  32. package/dist/umd/806.js +109 -0
  33. package/dist/umd/806.js.LICENSE.txt +5 -0
  34. package/dist/umd/938.js +1 -0
  35. package/dist/umd/97.js +1 -1
  36. package/dist/umd/descope-button-index-js.js +1 -1
  37. package/dist/umd/descope-checkbox-index-js.js +1 -0
  38. package/dist/umd/descope-combo-index-js.js +1 -1
  39. package/dist/umd/descope-container-index-js.js +1 -1
  40. package/dist/umd/descope-email-field-index-js.js +1 -0
  41. package/dist/umd/descope-number-field-index-js.js +1 -0
  42. package/dist/umd/descope-password-field-index-js.js +1 -0
  43. package/dist/umd/descope-switch-toggle-index-js.js +1 -0
  44. package/dist/umd/descope-text-area-index-js.js +1 -0
  45. package/dist/umd/descope-text-field-index-js.js +1 -1
  46. package/dist/umd/index.js +1 -1
  47. package/package.json +9 -2
  48. package/src/components/descope-button/Button.js +90 -30
  49. package/src/components/descope-button/index.js +3 -3
  50. package/src/components/descope-checkbox/Checkbox.js +33 -0
  51. package/src/components/descope-checkbox/index.js +6 -0
  52. package/src/components/descope-combo/index.js +12 -12
  53. package/src/components/descope-container/Container.js +57 -51
  54. package/src/components/descope-container/index.js +1 -1
  55. package/src/components/descope-date-picker/index.js +13 -7
  56. package/src/components/descope-email-field/EmailField.js +72 -0
  57. package/src/components/descope-email-field/index.js +6 -0
  58. package/src/components/descope-number-field/NumberField.js +72 -0
  59. package/src/components/descope-number-field/index.js +6 -0
  60. package/src/components/descope-password-field/PasswordField.js +79 -0
  61. package/src/components/descope-password-field/index.js +6 -0
  62. package/src/components/descope-switch-toggle/SwitchToggle.js +81 -0
  63. package/src/components/descope-switch-toggle/index.js +6 -0
  64. package/src/components/descope-text-area/TextArea.js +66 -0
  65. package/src/components/descope-text-area/index.js +6 -0
  66. package/src/components/descope-text-field/TextField.js +98 -28
  67. package/src/components/descope-text-field/index.js +3 -3
  68. package/src/componentsHelpers/componentNameValidationMixin.js +21 -17
  69. package/src/componentsHelpers/createProxy/helpers.js +31 -27
  70. package/src/componentsHelpers/createProxy/index.js +27 -17
  71. package/src/componentsHelpers/createStyleMixin/helpers.js +65 -47
  72. package/src/componentsHelpers/createStyleMixin/index.js +64 -55
  73. package/src/componentsHelpers/draggableMixin.js +25 -26
  74. package/src/componentsHelpers/index.js +12 -9
  75. package/src/componentsHelpers/inputMixin.js +38 -37
  76. package/src/constants.js +1 -1
  77. package/src/dev/index.js +4 -3
  78. package/src/helpers.js +8 -6
  79. package/src/index.cjs.js +1 -1
  80. package/src/index.js +16 -8
  81. package/src/index.umd.js +11 -5
  82. package/src/theme/components/button.js +32 -21
  83. package/src/theme/components/checkbox.js +9 -0
  84. package/src/theme/components/container.js +32 -27
  85. package/src/theme/components/emailField.js +8 -0
  86. package/src/theme/components/index.js +19 -7
  87. package/src/theme/components/input.js +106 -0
  88. package/src/theme/components/numberField.js +8 -0
  89. package/src/theme/components/passwordField.js +11 -0
  90. package/src/theme/components/switchToggle.js +10 -0
  91. package/src/theme/components/textArea.js +44 -0
  92. package/src/theme/components/textField.js +69 -45
  93. package/src/theme/globals.js +27 -26
  94. package/src/theme/index.js +2 -2
  95. package/src/themeHelpers/index.js +45 -30
  96. package/src/themeHelpers/processColors.js +10 -7
  97. package/dist/umd/221.js +0 -37
  98. package/dist/umd/511.js +0 -573
  99. package/dist/umd/9.js +0 -312
  100. /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 => str
11
- .replace(/([a-z])([A-Z])/g, "$1-$2")
12
- .replace(/[\s_.]+/g, '-')
13
- .toLowerCase();
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) => `--${kebabCaseJoin(...args.filter(arg => !!arg))}`;
22
+ const getCssVarName = (...args) =>
23
+ `--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
18
24
 
19
- const createCssVarFallback = (first, ...rest) => `var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
25
+ const createCssVarFallback = (first, ...rest) =>
26
+ `var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
20
27
 
21
- const createCssSelector = (baseSelector = '', relativeSelectorOrSelectorFn = '') =>
22
- typeof relativeSelectorOrSelectorFn === 'function' ?
23
- relativeSelectorOrSelectorFn(baseSelector) :
24
- `${baseSelector}${relativeSelectorOrSelectorFn}`;
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
- constructor() {
28
- this.styleMap = new Map();
29
- }
30
-
31
- add(selector, property, value) {
32
- if (!this.styleMap.has(selector)) {
33
- this.styleMap.set(selector, []);
34
- }
35
-
36
- this.styleMap.set(selector, [...this.styleMap.get(selector), { property, value }]);
37
- }
38
-
39
- toString() {
40
- return Array.from(this.styleMap.entries()).reduce((style, [selector, propValArr]) =>
41
- style += `${selector} { \n${propValArr.map(({ property, value }) => `${property}: ${value}`).join(';\n')} \n}\n\n`
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
- const defaultMapping = { selector: '', property: kebabCase(attr) };
64
+ const defaultMapping = { selector: '', property: kebabCase(attr) };
48
65
 
49
- if (!config || !Object.keys(config).length) return [defaultMapping];
66
+ if (!config || !Object.keys(config).length) return [defaultMapping];
50
67
 
51
- if (Array.isArray(config)) return config.map(entry => Object.assign({}, defaultMapping, entry));
68
+ if (Array.isArray(config))
69
+ return config.map((entry) => Object.assign({}, defaultMapping, entry));
52
70
 
53
- return [Object.assign({}, defaultMapping, config)];
71
+ return [Object.assign({}, defaultMapping, config)];
54
72
  };
55
73
 
56
74
  const createStyle = (componentName, baseSelector, mappings) => {
57
- const style = new StyleBuilder();
75
+ const style = new StyleBuilder();
58
76
 
59
- Object.keys(mappings).forEach((attr) => {
60
- const attrConfig = normalizeConfig(attr, mappings[attr]);
77
+ Object.keys(mappings).forEach((attr) => {
78
+ const attrConfig = normalizeConfig(attr, mappings[attr]);
61
79
 
62
- const cssVarName = getCssVarName(componentName, attr);
80
+ const cssVarName = getCssVarName(componentName, attr);
63
81
 
64
- attrConfig.forEach(({ selector: relativeSelectorOrSelectorFn, property }) => {
65
- style.add(
66
- createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
67
- property,
68
- createCssVarFallback(cssVarName)
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
- return style.toString();
93
+ return style.toString();
74
94
  };
75
95
 
76
96
  const createCssVarsList = (componentName, mappings) =>
77
- Object.keys(mappings).reduce(
78
- (acc, attr) => Object.assign(acc, { [attr]: getCssVarName(componentName, attr) }),
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) => [mappingObj, {...mappingObj, selector: () => `:host${mappingObj.selector || ''}`}];
85
-
86
- const createStyleMixin = ({ mappings = {} }) => (superclass) => {
87
- const styleAttributes = Object.keys(mappings).map(key => kebabCaseJoin('st', key));
88
- return class CustomStyleMixinClass extends superclass {
89
- static get observedAttributes() {
90
- const superAttrs = superclass.observedAttributes || [];
91
- return [...superAttrs, ...styleAttributes]
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
- static get cssVarList() {
95
- return createCssVarsList(superclass.componentName, mappings)
96
- }
122
+ static get cssVarList() {
123
+ return createCssVarsList(superclass.componentName, mappings);
124
+ }
97
125
 
98
- #styleEle = null;
126
+ #styleEle = null;
99
127
 
100
- constructor() {
101
- super();
128
+ constructor() {
129
+ super();
102
130
 
103
- this.#createComponentStyle();
104
- this.#createAttrOverrideStyle();
105
- }
131
+ this.#createComponentStyle();
132
+ this.#createAttrOverrideStyle();
133
+ }
106
134
 
107
- #createAttrOverrideStyle() {
108
- this.#styleEle = document.createElement('style');
109
- this.#styleEle.id = 'style-mixin-overrides';
135
+ #createAttrOverrideStyle() {
136
+ this.#styleEle = document.createElement('style');
137
+ this.#styleEle.id = 'style-mixin-overrides';
110
138
 
111
- this.#styleEle.innerText = '* {}';
112
- this.shadowRoot.prepend(this.#styleEle);
113
- }
139
+ this.#styleEle.innerText = '* {}';
140
+ this.shadowRoot.prepend(this.#styleEle);
141
+ }
114
142
 
115
- #updateAttrOverrideStyle(attrName, value) {
116
- const style = this.#styleEle.sheet.cssRules[0].style;
117
- const varName = getCssVarName(superclass.componentName, attrName.replace(/^st-/, ''));
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
- if (value)
120
- style.setProperty(varName, value);
121
- else
122
- style.removeProperty(varName);
123
- }
150
+ if (value) style.setProperty(varName, value);
151
+ else style.removeProperty(varName);
152
+ }
124
153
 
125
- #createComponentStyle() {
126
- const themeStyle = document.createElement('style');
127
- themeStyle.id = 'style-mixin-component';
128
- themeStyle.innerHTML = createStyle(superclass.componentName, this.baseSelector, mappings);
129
- this.shadowRoot.prepend(themeStyle);
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
- attributeChangedCallback(attrName, oldValue, newValue) {
133
- super.attributeChangedCallback?.(attrName, oldValue, newValue);
165
+ attributeChangedCallback(attrName, oldValue, newValue) {
166
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
134
167
 
135
- if (styleAttributes.includes(attrName)) {
136
- this.#updateAttrOverrideStyle(attrName, newValue);
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
- class DraggableMixinClass extends superclass {
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
- const observeAttributes = (ele, callback, excludeAttrs) => {
176
- // sync all attrs on init
177
- callback(...Array.from(ele.attributes).map(attr => attr.name));
179
+ static get observedAttributes() {
180
+ const superAttrs = superclass.observedAttributes || [];
181
+ return [...superAttrs, 'draggable'];
182
+ }
178
183
 
179
- const observer = new MutationObserver((mutationsList) => {
180
- for (const mutation of mutationsList) {
181
- if (mutation.type === "attributes" && !excludeAttrs.includes(mutation.attributeName)) {
182
- callback(mutation.attributeName);
183
- }
184
- }
185
- });
184
+ constructor() {
185
+ super();
186
186
 
187
- observer.observe(ele, { attributes: true });
188
- };
187
+ this.#styleEle = document.createElement('style');
188
+ this.#styleEle.innerText = `${this.baseSelector} { cursor: inherit }`;
189
+ }
189
190
 
190
- const createSyncAttrsCb = (srcEle, targetEle) => (...attrNames) => {
191
- attrNames.forEach(attrName => {
192
- const srcAttrVal = srcEle.getAttribute(attrName);
193
- if (srcAttrVal !== null) {
194
- if (targetEle.getAttribute(attrName) !== srcAttrVal) {
195
- targetEle.setAttribute(attrName, srcAttrVal);
196
- }
197
- } else {
198
- targetEle.removeAttribute(attrName);
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
- observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), excludeAttrs);
205
- observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), excludeAttrs);
241
+ observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), excludeAttrs);
242
+ observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), excludeAttrs);
206
243
  };
207
244
 
208
- const createProxy = ({ componentName, wrappedEleName, slots = [], style, excludeAttrsSync = [] }) => {
209
-
245
+ const createProxy = ({
246
+ componentName,
247
+ wrappedEleName,
248
+ slots = [],
249
+ style,
250
+ excludeAttrsSync = []
251
+ }) => {
210
252
  const template = `
211
- ${style ? `<style id="create-proxy">${style}</style>` : ''}
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: "open" }).innerHTML = template;
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('mouseleave', () =>
255
- this.proxyElement.removeAttribute('hover'), { once: true });
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
- class InputMixinClass extends superclass {
329
+ class InputMixinClass extends superclass {
283
330
  static get formAssociated() {
284
331
  return true;
285
332
  }
286
-
287
- #internals
288
333
 
289
- constructor() {
290
- super();
334
+ #internals;
291
335
 
292
- this.#internals = this.attachInternals();
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
- formAssociatedCallback() {
301
- this.setValidity?.();
302
- }
339
+ this.#internals = this.attachInternals();
340
+ }
303
341
 
304
- connectedCallback() {
305
- super.connectedCallback?.();
342
+ formAssociatedCallback() {
343
+ this.setValidity?.();
344
+ }
306
345
 
307
- // vaadin does not expose all those validation attributes so we need to take it from the input
308
- // https://github.com/vaadin/web-components/issues/1177
309
- const input = this.proxyElement.querySelector('input');
310
- if (!input) throw Error('no input was found')
346
+ connectedCallback() {
347
+ super.connectedCallback?.();
311
348
 
312
- this.checkValidity = () => input.checkValidity();
313
- this.reportValidity = () => input.reportValidity();
314
- this.validity = input.validity;
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
- this.setValidity = () => {
317
- this.#internals.setValidity(input.validity, input.validationMessage);
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
- input.oninput = () => {
321
- this.value = input.value;
322
- this.setValidity();
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
- const componentNameValidationMixin = (superclass) =>
329
- class DraggableMixinClass extends superclass {
330
- #checkComponentName() {
331
- const currentComponentName = this.shadowRoot.host.tagName.toLowerCase();
332
-
333
- if (!superclass.componentName) {
334
- throw Error(`component name is not defined on super class, make sure you have a static get for "componentName"`)
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 = (...fns) => (val) => fns.reduceRight((res, fn) => fn(res), val);
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 componentName$4 = getComponentName("button");
429
+ const selectors$2 = {
430
+ label: '::part(label)'
431
+ };
357
432
 
358
433
  const Button = compose(
359
- createStyleMixin({
360
- // todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
361
- mappings: {
362
- 'backgroundColor': {},
363
- 'borderRadius': {},
364
- 'color': { selector: '::part(label)' },
365
- 'borderColor': {},
366
- 'borderStyle': {},
367
- 'borderWidth': {},
368
- 'fontSize': {},
369
- 'height': {},
370
- 'width': matchHostStyle({}),
371
- 'cursor': {},
372
- 'padding': {},
373
- },
374
- }),
375
- draggableMixin,
376
- componentNameValidationMixin
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
- createProxy({
379
- slots: ["prefix", "suffix"],
380
- wrappedEleName: "vaadin-button",
381
- style: `${editorOverrides}`,
382
- excludeAttrsSync: ['tabindex'],
383
- componentName: componentName$4
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
- customElements.define(componentName$4, Button);
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
- const componentName$3 = getComponentName("text-field");
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
- createStyleMixin({
393
- mappings: {
394
- 'placeholderColor': { selector: '> input:placeholder-shown', property: 'color' },
395
- 'color': {},
396
- 'borderColor': { selector: '::part(input-field)' },
397
- 'borderWidth': { selector: '::part(input-field)' },
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
- createProxy({
412
- slots: ["prefix", "suffix"],
413
- wrappedEleName: "vaadin-text-field",
414
- style: ``,
415
- excludeAttrsSync: ['tabindex'],
416
- componentName: componentName$3
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
- customElements.define(componentName$3, TextField);
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$2 = getComponentName("combo");
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
- constructor() {
433
- super();
600
+ constructor() {
601
+ super();
434
602
 
435
- this.attachShadow({ mode: 'open' }).appendChild(
436
- template.content.cloneNode(true)
437
- );
438
- }
603
+ this.attachShadow({ mode: 'open' }).appendChild(
604
+ template.content.cloneNode(true)
605
+ );
606
+ }
439
607
  }
440
608
 
441
- customElements.define(componentName$2, Combo);
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
- const componentName$1 = getComponentName("date-picker");
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$1,
451
- slots: ["prefix", "suffix"],
452
- wrappedEleName: "vaadin-date-picker",
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$1, DatePicker);
876
+ customElements.define(componentName$3, DatePicker);
458
877
 
459
- const componentName = getComponentName("container");
878
+ const componentName$2 = getComponentName('container');
460
879
 
461
880
  class RawContainer extends HTMLElement {
462
- static get componentName() {
463
- return componentName
464
- }
465
- constructor() {
466
- super();
467
- const template = document.createElement('template');
468
- template.innerHTML = `<slot></slot>`;
469
-
470
- this.attachShadow({ mode: 'open' });
471
- this.shadowRoot.appendChild(template.content.cloneNode(true));
472
-
473
- this.baseSelector = ':host > slot';
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
- createStyleMixin({
479
- // todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
480
- mappings: {
481
- 'height': {},
482
- 'width': {},
483
-
484
- 'verticalPadding': [
485
- { property: 'padding-top' },
486
- { property: 'padding-bottom' }
487
- ],
488
- 'horizontalPadding': [
489
- { property: 'padding-left' },
490
- { property: 'padding-right' }
491
- ],
492
-
493
- 'display': {},
494
- 'flexDirection': {},
495
- 'justifyContent': {},
496
- 'alignItems': {},
497
- 'gap': {},
498
-
499
- 'backgroundColor': {},
500
- 'borderRadius': {},
501
-
502
- 'borderColor': {},
503
- 'borderStyle': {},
504
- 'borderWidth': {},
505
-
506
- 'boxShadow': {},
507
- },
508
- }),
509
- draggableMixin,
510
- componentNameValidationMixin,
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) => strArr.map((str) => (str.includes(" ") ? `"${str}"` : str)).join(", ");
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) => set({}, path, `var(${getVarName(prefix ? [prefix, ...path] : 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
- (acc, entry) => (acc += `${entry.join(":")};\n`), ''
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('_')) return acc += `[${kebabCase(section.replace(/^_/, ''))}]`;
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('theme generator', `your theme structure is invalid, attribute "${section}" is followed by "${nextSection}" which is not allowed`);
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.splice(idx + 1, 1).join('')}"]`;
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]) => (acc += `*[data-theme="${themeName}"] ${selector} { \n${Object.entries(vars).map(([key, val]) => `${key}: ${val}`).join(';\n')} \n}\n\n`),
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.mix(Color(isDark ? 'white' : 'black'), percentage).saturate(1).hex();
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: '#e1e1e1'
1072
+ light: '#fff',
1073
+ dark: '#000'
636
1074
  },
637
- primary: "#0082B5",
638
- secondary: "#7D14EB",
639
- success: "green",
640
- error: "red",
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: ["Courier New", "Arial", "sans-serif"],
646
- weight: "700",
647
- size: "48px",
1083
+ font: ['Courier New', 'Arial', 'sans-serif'],
1084
+ weight: '700',
1085
+ size: '48px'
648
1086
  },
649
1087
  h2: {
650
- font: ["Courier New", "sans-serif"],
651
- weight: "500",
652
- size: "38px",
1088
+ font: ['Courier New', 'sans-serif'],
1089
+ weight: '500',
1090
+ size: '38px'
653
1091
  },
654
1092
  h3: {
655
- font: ["Courier New", "sans-serif"],
656
- weight: "300",
657
- size: "28px",
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: "1px",
671
- md: "2px",
672
- lg: "3px",
1108
+ sm: '1px',
1109
+ md: '2px',
1110
+ lg: '3px'
673
1111
  };
674
1112
 
675
1113
  const radius = {
676
- sm: "5px",
677
- md: "25px",
678
- lg: "50px",
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$2 = getThemeRefs(globals);
700
- const vars$2 = Button.cssVarList;
1137
+ const globalRefs$3 = getThemeRefs(globals);
1138
+ const vars$6 = Button.cssVarList;
701
1139
 
702
1140
  const mode = {
703
- primary: {
704
- main: globalRefs$2.colors.primary.main,
705
- dark: 'darkblue',
706
- light: 'lightblue',
707
- contrast: 'white'
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$4);
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$2.height]: '10px',
725
- [vars$2.fontSize]: '10px',
726
- [vars$2.padding]: `0 ${globalRefs$2.spacing.xs}`
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$2.height]: '20px',
730
- [vars$2.fontSize]: '10px',
731
- [vars$2.padding]: `0 ${globalRefs$2.spacing.sm}`
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$2.height]: '30px',
735
- [vars$2.fontSize]: '14px',
736
- [vars$2.padding]: `0 ${globalRefs$2.spacing.md}`
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$2.height]: '40px',
740
- [vars$2.fontSize]: '20px',
741
- [vars$2.padding]: `0 ${globalRefs$2.spacing.lg}`
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$2.height]: '50px',
745
- [vars$2.fontSize]: '25px',
746
- [vars$2.padding]: `0 ${globalRefs$2.spacing.xl}`
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$2.width]: '100%'
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$2.color]: helperRefs$1.contrast,
757
- [vars$2.backgroundColor]: helperRefs$1.main,
1196
+ [vars$6.color]: helperRefs$1.contrast,
1197
+ [vars$6.backgroundColor]: helperRefs$1.main,
758
1198
  _hover: {
759
- [vars$2.backgroundColor]: helperRefs$1.dark,
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$2.color]: helperRefs$1.main,
764
- [vars$2.borderColor]: helperRefs$1.main,
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$2.color]: helperRefs$1.dark,
769
- [vars$2.borderColor]: helperRefs$1.dark,
1209
+ [vars$6.color]: helperRefs$1.dark,
1210
+ [vars$6.borderColor]: helperRefs$1.dark,
770
1211
  _error: {
771
- [vars$2.color]: 'red',
1212
+ [vars$6.color]: helperRefs$1.error
772
1213
  }
773
1214
  }
774
1215
  },
775
1216
  link: {
776
- [vars$2.color]: helperRefs$1.main,
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
- const vars$1 = TextField.cssVarList;
784
-
785
- const textField = {
786
- [vars$1.borderRadius]: globalRefs$1.radius.lg,
787
- [vars$1.color]: globalRefs$1.colors.surface.contrast,
788
- [vars$1.backgroundColor]: globalRefs$1.colors.surface.light,
789
- [vars$1.borderWidth]: globalRefs$1.border.small,
790
- [vars$1.borderStyle]: 'solid',
791
- [vars$1.borderColor]: globalRefs$1.colors.surface.dark,
792
- [vars$1.labelColor]: globalRefs$1.colors.surface.contrast,
793
- [vars$1.placeholderColor]: globalRefs$1.colors.surface.dark,
794
- _invalid: {
795
- [vars$1.backgroundColor]: globalRefs$1.colors.error.light,
796
- [vars$1.borderColor]: globalRefs$1.colors.error.dark,
797
- },
798
-
799
- size: {
800
- sm: {
801
- [vars$1.height]: '20px',
802
- [vars$1.fontSize]: '10px',
803
- [vars$1.padding]: `0 ${globalRefs$1.spacing.xs}`
804
- },
805
- md: {
806
- [vars$1.height]: '30px',
807
- [vars$1.fontSize]: '14px',
808
- [vars$1.padding]: `0 ${globalRefs$1.spacing.sm}`
809
- },
810
- lg: {
811
- [vars$1.height]: '40px',
812
- [vars$1.fontSize]: '20px',
813
- [vars$1.padding]: `0 ${globalRefs$1.spacing.sm}`
814
- },
815
- xl: {
816
- [vars$1.height]: '50px',
817
- [vars$1.fontSize]: '25px',
818
- [vars$1.padding]: `0 ${globalRefs$1.spacing.md}`
819
- },
820
- },
821
-
822
- _fullWidth: {
823
- [vars$1.width]: '100%'
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, helperVars, helperRefs] =
844
- createHelperVars({ verticalAlignment, horizontalAlignment }, 'container');
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: { [helperVars.verticalAlignment]: 'space-between' }
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
- button,
918
- textField,
919
- container
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 };