@descope/web-components-ui 1.0.135 → 1.0.148

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/package.json +77 -56
  2. package/src/baseClasses/createBaseClass.js +18 -16
  3. package/src/baseClasses/createBaseInputClass.js +14 -8
  4. package/src/baseClasses/createCssVarImageClass.js +27 -23
  5. package/src/components/boolean-fields/booleanFieldMixin.js +18 -29
  6. package/src/components/boolean-fields/commonStyles.js +1 -1
  7. package/src/components/boolean-fields/descope-boolean-field-internal/BooleanFieldInternal.js +46 -51
  8. package/src/components/boolean-fields/descope-boolean-field-internal/index.js +1 -1
  9. package/src/components/boolean-fields/descope-checkbox/CheckboxClass.js +80 -85
  10. package/src/components/boolean-fields/descope-checkbox/index.js +2 -2
  11. package/src/components/boolean-fields/descope-switch-toggle/SwitchToggleClass.js +88 -95
  12. package/src/components/boolean-fields/descope-switch-toggle/index.js +2 -2
  13. package/src/components/descope-button/ButtonClass.js +57 -47
  14. package/src/components/descope-button/clickableMixin.js +10 -0
  15. package/src/components/descope-combo-box/ComboBoxClass.js +156 -160
  16. package/src/components/descope-container/ContainerClass.js +32 -42
  17. package/src/components/descope-date-picker/index.js +9 -14
  18. package/src/components/descope-divider/DividerClass.js +52 -62
  19. package/src/components/descope-email-field/EmailFieldClass.js +25 -20
  20. package/src/components/descope-image/ImageClass.js +21 -24
  21. package/src/components/descope-link/LinkClass.js +31 -35
  22. package/src/components/descope-loader-linear/LoaderLinearClass.js +31 -36
  23. package/src/components/descope-loader-radial/LoaderRadialClass.js +23 -30
  24. package/src/components/descope-logo/LogoClass.js +5 -1
  25. package/src/components/descope-new-password/NewPasswordClass.js +63 -81
  26. package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +157 -162
  27. package/src/components/descope-new-password/descope-new-password-internal/componentName.js +1 -1
  28. package/src/components/descope-new-password/descope-new-password-internal/index.js +3 -3
  29. package/src/components/descope-new-password/index.js +3 -3
  30. package/src/components/descope-number-field/NumberFieldClass.js +25 -20
  31. package/src/components/descope-passcode/PasscodeClass.js +95 -95
  32. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +151 -157
  33. package/src/components/descope-passcode/descope-passcode-internal/helpers.js +7 -8
  34. package/src/components/descope-passcode/descope-passcode-internal/index.js +2 -2
  35. package/src/components/descope-passcode/index.js +2 -2
  36. package/src/components/descope-password/PasswordClass.js +75 -83
  37. package/src/components/descope-password/passwordDraggableMixin.js +28 -27
  38. package/src/components/descope-phone-field/CountryCodes.js +1210 -1210
  39. package/src/components/descope-phone-field/PhoneFieldClass.js +139 -141
  40. package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +157 -173
  41. package/src/components/descope-phone-field/helpers.js +3 -3
  42. package/src/components/descope-text/TextClass.js +25 -29
  43. package/src/components/descope-text-area/TextAreaClass.js +68 -67
  44. package/src/components/descope-text-field/TextFieldClass.js +42 -37
  45. package/src/components/descope-text-field/textFieldMappings.js +40 -55
  46. package/src/components/descope-totp-image/TotpImageClass.js +5 -1
  47. package/src/components/descope-upload-file/UploadFileClass.js +202 -0
  48. package/src/components/descope-upload-file/helpers.js +11 -0
  49. package/src/components/descope-upload-file/index.js +6 -0
  50. package/src/constants.js +3 -3
  51. package/src/helpers/componentHelpers.js +68 -74
  52. package/src/helpers/index.js +17 -16
  53. package/src/helpers/mixinsHelpers.js +21 -10
  54. package/src/helpers/themeHelpers/colorsHelpers.js +18 -18
  55. package/src/helpers/themeHelpers/componentsThemeManager.js +7 -6
  56. package/src/helpers/themeHelpers/index.js +114 -124
  57. package/src/helpers/themeHelpers/resetHelpers.js +16 -16
  58. package/src/index.cjs.js +3 -3
  59. package/src/index.d.ts +22 -21
  60. package/src/index.js +5 -4
  61. package/src/index.umd.js +14 -13
  62. package/src/mixins/changeMixin.js +18 -17
  63. package/src/mixins/componentNameValidationMixin.js +19 -19
  64. package/src/mixins/createProxy.js +33 -33
  65. package/src/mixins/createStyleMixin/helpers.js +54 -64
  66. package/src/mixins/createStyleMixin/index.js +155 -141
  67. package/src/mixins/draggableMixin.js +61 -61
  68. package/src/mixins/hoverableMixin.js +11 -13
  69. package/src/mixins/index.js +6 -6
  70. package/src/mixins/inputEventsDispatchingMixin.js +61 -60
  71. package/src/mixins/inputValidationMixin.js +153 -148
  72. package/src/mixins/lifecycleEventsMixin.js +17 -15
  73. package/src/mixins/normalizeBooleanAttributesMixin.js +31 -23
  74. package/src/mixins/portalMixin.js +58 -52
  75. package/src/mixins/proxyInputMixin.js +138 -132
  76. package/src/theme/components/button.js +86 -81
  77. package/src/theme/components/checkbox.js +26 -28
  78. package/src/theme/components/comboBox.js +32 -31
  79. package/src/theme/components/container.js +99 -89
  80. package/src/theme/components/divider.js +30 -31
  81. package/src/theme/components/emailField.js +20 -19
  82. package/src/theme/components/image.js +3 -3
  83. package/src/theme/components/index.js +33 -25
  84. package/src/theme/components/inputWrapper.js +28 -25
  85. package/src/theme/components/link.js +29 -36
  86. package/src/theme/components/loader/index.js +3 -3
  87. package/src/theme/components/loader/loaderLinear.js +34 -34
  88. package/src/theme/components/loader/loaderRadial.js +40 -34
  89. package/src/theme/components/logo.js +4 -4
  90. package/src/theme/components/newPassword.js +14 -13
  91. package/src/theme/components/numberField.js +20 -19
  92. package/src/theme/components/passcode.js +20 -22
  93. package/src/theme/components/password.js +22 -21
  94. package/src/theme/components/phoneField.js +23 -23
  95. package/src/theme/components/switchToggle.js +47 -46
  96. package/src/theme/components/text.js +72 -72
  97. package/src/theme/components/textArea.js +27 -25
  98. package/src/theme/components/textField.js +23 -22
  99. package/src/theme/components/totpImage.js +4 -4
  100. package/src/theme/components/uploadFile.js +60 -0
  101. package/src/theme/globals.js +123 -124
  102. package/src/theme/index.js +1 -1
  103. package/dist/cjs/index.cjs.js +0 -5924
  104. package/dist/cjs/index.cjs.js.map +0 -1
  105. package/dist/cjs/package.json +0 -1
  106. package/dist/index.d.ts +0 -51
  107. package/dist/index.esm.js +0 -6606
  108. package/dist/index.esm.js.map +0 -1
  109. package/dist/umd/1018.js +0 -577
  110. package/dist/umd/1018.js.LICENSE.txt +0 -23
  111. package/dist/umd/2481.js +0 -1
  112. package/dist/umd/3208.js +0 -2
  113. package/dist/umd/3208.js.LICENSE.txt +0 -5
  114. package/dist/umd/3585.js +0 -1
  115. package/dist/umd/3878.js +0 -1
  116. package/dist/umd/4201.js +0 -1
  117. package/dist/umd/422.js +0 -2
  118. package/dist/umd/422.js.LICENSE.txt +0 -5
  119. package/dist/umd/4447.js +0 -1
  120. package/dist/umd/4513.js +0 -1
  121. package/dist/umd/4803.js +0 -1
  122. package/dist/umd/541.js +0 -744
  123. package/dist/umd/541.js.LICENSE.txt +0 -21
  124. package/dist/umd/5767.js +0 -2
  125. package/dist/umd/5767.js.LICENSE.txt +0 -15
  126. package/dist/umd/5806.js +0 -109
  127. package/dist/umd/5806.js.LICENSE.txt +0 -5
  128. package/dist/umd/7056.js +0 -48
  129. package/dist/umd/7056.js.LICENSE.txt +0 -5
  130. package/dist/umd/7101.js +0 -148
  131. package/dist/umd/7101.js.LICENSE.txt +0 -11
  132. package/dist/umd/729.js +0 -1
  133. package/dist/umd/7824.js +0 -229
  134. package/dist/umd/7824.js.LICENSE.txt +0 -27
  135. package/dist/umd/7840.js +0 -356
  136. package/dist/umd/7840.js.LICENSE.txt +0 -61
  137. package/dist/umd/8725.js +0 -37
  138. package/dist/umd/8725.js.LICENSE.txt +0 -11
  139. package/dist/umd/9211.js +0 -312
  140. package/dist/umd/9211.js.LICENSE.txt +0 -5
  141. package/dist/umd/9241.js +0 -1
  142. package/dist/umd/9314.js +0 -283
  143. package/dist/umd/9314.js.LICENSE.txt +0 -27
  144. package/dist/umd/9437.js +0 -19
  145. package/dist/umd/9437.js.LICENSE.txt +0 -5
  146. package/dist/umd/9515.js +0 -202
  147. package/dist/umd/9515.js.LICENSE.txt +0 -11
  148. package/dist/umd/9789.js +0 -1
  149. package/dist/umd/boolean-fields-descope-boolean-field-internal-index-js.js +0 -1
  150. package/dist/umd/boolean-fields-descope-checkbox-index-js.js +0 -1
  151. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +0 -1
  152. package/dist/umd/descope-button-index-js.js +0 -1
  153. package/dist/umd/descope-combo-box-index-js.js +0 -1
  154. package/dist/umd/descope-container-index-js.js +0 -1
  155. package/dist/umd/descope-date-picker-index-js.js +0 -1
  156. package/dist/umd/descope-divider-index-js.js +0 -1
  157. package/dist/umd/descope-email-field-index-js.js +0 -1
  158. package/dist/umd/descope-image-index-js.js +0 -1
  159. package/dist/umd/descope-link-index-js.js +0 -1
  160. package/dist/umd/descope-loader-linear-index-js.js +0 -1
  161. package/dist/umd/descope-loader-radial-index-js.js +0 -1
  162. package/dist/umd/descope-logo-index-js.js +0 -1
  163. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +0 -1
  164. package/dist/umd/descope-new-password-index-js.js +0 -1
  165. package/dist/umd/descope-number-field-index-js.js +0 -1
  166. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +0 -1
  167. package/dist/umd/descope-passcode-index-js.js +0 -1
  168. package/dist/umd/descope-password-index-js.js +0 -1
  169. package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +0 -1
  170. package/dist/umd/descope-phone-field-index-js.js +0 -1
  171. package/dist/umd/descope-text-area-index-js.js +0 -1
  172. package/dist/umd/descope-text-field-index-js.js +0 -1
  173. package/dist/umd/descope-text-index-js.js +0 -1
  174. package/dist/umd/descope-totp-image-index-js.js +0 -1
  175. package/dist/umd/index.js +0 -1
@@ -1,11 +1,11 @@
1
1
  import { getComponentName } from '../../../helpers/componentHelpers';
2
2
  import { compose } from '../../../helpers';
3
3
  import {
4
- createStyleMixin,
5
- proxyInputMixin,
6
- draggableMixin,
7
- componentNameValidationMixin,
8
- createProxy
4
+ createStyleMixin,
5
+ proxyInputMixin,
6
+ draggableMixin,
7
+ componentNameValidationMixin,
8
+ createProxy,
9
9
  } from '../../../mixins';
10
10
  import { booleanFieldMixin } from '../booleanFieldMixin';
11
11
  import commonStyles from '../commonStyles';
@@ -14,98 +14,93 @@ import { useHostExternalPadding } from '../../../helpers/themeHelpers/resetHelpe
14
14
  export const componentName = getComponentName('checkbox');
15
15
 
16
16
  const {
17
- host,
18
- component,
19
- checkboxElement,
20
- checkboxSurface,
21
- checkboxHiddenLabel,
22
- label,
23
- requiredIndicator,
24
- helperText,
25
- errorMessage
17
+ host,
18
+ component,
19
+ checkboxElement,
20
+ checkboxSurface,
21
+ checkboxHiddenLabel,
22
+ label,
23
+ requiredIndicator,
24
+ helperText,
25
+ errorMessage,
26
26
  } = {
27
- host: { selector: () => ':host' },
28
- label: { selector: '::part(label)' },
29
- requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
30
- component: { selector: 'vaadin-checkbox' },
31
- checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
32
- checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
33
- checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
34
- helperText: { selector: '::part(helper-text)' },
35
- errorMessage: { selector: '::part(error-message)' },
27
+ host: { selector: () => ':host' },
28
+ label: { selector: '::part(label)' },
29
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
30
+ component: { selector: 'vaadin-checkbox' },
31
+ checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
32
+ checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
33
+ checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
34
+ helperText: { selector: '::part(helper-text)' },
35
+ errorMessage: { selector: '::part(error-message)' },
36
36
  };
37
37
 
38
38
  export const CheckboxClass = compose(
39
- createStyleMixin({
40
- mappings: {
41
- hostWidth: { ...host, property: 'width' },
39
+ createStyleMixin({
40
+ mappings: {
41
+ hostWidth: { ...host, property: 'width' },
42
42
 
43
- fontSize: [
44
- host,
45
- checkboxElement,
46
- label,
47
- checkboxHiddenLabel,
48
- ],
49
- fontFamily: [
50
- label,
51
- checkboxHiddenLabel,
52
- helperText,
53
- errorMessage,
54
- ],
43
+ fontSize: [host, checkboxElement, label, checkboxHiddenLabel],
44
+ fontFamily: [label, checkboxHiddenLabel, helperText, errorMessage],
55
45
 
56
- labelTextColor: [
57
- { ...label, property: 'color' },
58
- { ...requiredIndicator, property: 'color' },
59
- { ...label, property: '-webkit-text-fill-color' }
60
- ],
61
- labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
46
+ labelTextColor: [
47
+ { ...label, property: 'color' },
48
+ { ...requiredIndicator, property: 'color' },
49
+ { ...label, property: '-webkit-text-fill-color' },
50
+ ],
51
+ labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
52
+ errorMessageTextColor: { ...errorMessage, property: 'color' },
62
53
 
63
- labelFontWeight: [
64
- { ...label, property: 'font-weight' },
65
- { ...checkboxHiddenLabel, property: 'font-weight' }
66
- ],
67
- labelSpacing: [
68
- { ...label, property: 'left' },
69
- { ...checkboxHiddenLabel, property: 'padding-left' }
70
- ],
71
- inputValueTextColor: { ...checkboxSurface, property: 'color' },
72
- inputBackgroundColor: { ...checkboxElement, property: 'background-color' },
54
+ labelFontWeight: [
55
+ { ...label, property: 'font-weight' },
56
+ { ...checkboxHiddenLabel, property: 'font-weight' },
57
+ ],
58
+ labelSpacing: [
59
+ { ...label, property: 'left' },
60
+ { ...checkboxHiddenLabel, property: 'padding-left' },
61
+ ],
62
+ inputValueTextColor: { ...checkboxSurface, property: 'color' },
63
+ inputBackgroundColor: { ...checkboxElement, property: 'background-color' },
73
64
 
74
- inputBorderRadius: { ...checkboxElement, property: 'border-radius' },
75
- inputBorderWidth: { ...checkboxElement, property: 'border-width' },
76
- inputBorderOffset: { ...checkboxElement, property: 'border-offset' },
77
- inputBorderColor: { ...checkboxElement, property: 'border-color' },
78
- inputBorderStyle: { ...checkboxElement, property: 'border-style' },
65
+ inputBorderRadius: { ...checkboxElement, property: 'border-radius' },
66
+ inputBorderWidth: { ...checkboxElement, property: 'border-width' },
67
+ inputBorderOffset: { ...checkboxElement, property: 'border-offset' },
68
+ inputBorderColor: { ...checkboxElement, property: 'border-color' },
69
+ inputBorderStyle: { ...checkboxElement, property: 'border-style' },
79
70
 
80
- inputOutlineWidth: { ...checkboxElement, property: 'outline-width' },
81
- inputOutlineOffset: { ...checkboxElement, property: 'outline-offset' },
82
- inputOutlineColor: { ...checkboxElement, property: 'outline-color' },
83
- inputOutlineStyle: { ...checkboxElement, property: 'outline-style' },
71
+ inputOutlineWidth: { ...checkboxElement, property: 'outline-width' },
72
+ inputOutlineOffset: { ...checkboxElement, property: 'outline-offset' },
73
+ inputOutlineColor: { ...checkboxElement, property: 'outline-color' },
74
+ inputOutlineStyle: { ...checkboxElement, property: 'outline-style' },
84
75
 
85
- inputSize: [
86
- { ...checkboxElement, property: 'width' },
87
- { ...checkboxElement, property: 'height' },
88
- { ...checkboxSurface, property: 'font-size' },
89
- { ...component, property: 'font-size' },
90
- { ...checkboxHiddenLabel, property: 'line-height' },
91
- { ...label, property: 'margin-left' },
92
- { ...label, property: 'line-height' },
93
- ],
94
- },
95
- }),
96
- draggableMixin,
97
- proxyInputMixin,
98
- componentNameValidationMixin,
99
- booleanFieldMixin
76
+ inputSize: [
77
+ { ...checkboxElement, property: 'width' },
78
+ { ...checkboxElement, property: 'height' },
79
+ { ...checkboxSurface, property: 'font-size' },
80
+ { ...component, property: 'font-size' },
81
+ { ...checkboxHiddenLabel, property: 'line-height' },
82
+ { ...label, property: 'margin-left' },
83
+ { ...label, property: 'line-height' },
84
+ ],
85
+ },
86
+ }),
87
+ draggableMixin,
88
+ proxyInputMixin,
89
+ componentNameValidationMixin,
90
+ booleanFieldMixin
100
91
  )(
101
- createProxy({
102
- slots: [],
103
- wrappedEleName: 'vaadin-text-field',
104
- style: () => `
92
+ createProxy({
93
+ slots: [],
94
+ wrappedEleName: 'vaadin-text-field',
95
+ style: () => `
105
96
  ${commonStyles}
97
+ vaadin-checkbox::part(checkbox)::after {
98
+ top: 0;
99
+ left: 0;
100
+ }
106
101
  ${useHostExternalPadding(CheckboxClass.cssVarList)}
107
102
  `,
108
- excludeAttrsSync: ['tabindex'],
109
- componentName
110
- })
103
+ excludeAttrsSync: ['tabindex'],
104
+ componentName,
105
+ })
111
106
  );
@@ -1,6 +1,6 @@
1
1
  import { componentName, CheckboxClass } from './CheckboxClass';
2
- import '@vaadin/checkbox'
3
- import '@vaadin/text-field'
2
+ import '@vaadin/checkbox';
3
+ import '@vaadin/text-field';
4
4
  import '../descope-boolean-field-internal';
5
5
 
6
6
  customElements.define(componentName, CheckboxClass);
@@ -1,11 +1,11 @@
1
- import { getComponentName } from '../../../helpers/componentHelpers'
1
+ import { getComponentName } from '../../../helpers/componentHelpers';
2
2
  import { compose } from '../../../helpers';
3
3
  import {
4
- createStyleMixin,
5
- proxyInputMixin,
6
- draggableMixin,
7
- componentNameValidationMixin,
8
- createProxy
4
+ createStyleMixin,
5
+ proxyInputMixin,
6
+ draggableMixin,
7
+ componentNameValidationMixin,
8
+ createProxy,
9
9
  } from '../../../mixins';
10
10
  import { booleanFieldMixin } from '../booleanFieldMixin';
11
11
  import commonStyles from '../commonStyles';
@@ -14,102 +14,95 @@ import { useHostExternalPadding } from '../../../helpers/themeHelpers/resetHelpe
14
14
  export const componentName = getComponentName('switch-toggle');
15
15
 
16
16
  const {
17
- host,
18
- component,
19
- checkboxElement: track,
20
- checkboxSurface: knob,
21
- checkboxHiddenLabel,
22
- label,
23
- requiredIndicator,
24
- helperText,
25
- errorMessage
17
+ host,
18
+ component,
19
+ checkboxElement: track,
20
+ checkboxSurface: knob,
21
+ checkboxHiddenLabel,
22
+ label,
23
+ requiredIndicator,
24
+ helperText,
25
+ errorMessage,
26
26
  } = {
27
- host: { selector: () => ':host' },
28
- label: { selector: '::part(label)' },
29
- requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
30
- component: { selector: 'vaadin-checkbox' },
31
- checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
32
- checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
33
- checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
34
- helperText: { selector: '::part(helper-text)' },
35
- errorMessage: { selector: '::part(error-message)' },
27
+ host: { selector: () => ':host' },
28
+ label: { selector: '::part(label)' },
29
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
30
+ component: { selector: 'vaadin-checkbox' },
31
+ checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
32
+ checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
33
+ checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
34
+ helperText: { selector: '::part(helper-text)' },
35
+ errorMessage: { selector: '::part(error-message)' },
36
36
  };
37
37
 
38
38
  export const SwitchToggleClass = compose(
39
- createStyleMixin({
40
- mappings: {
41
- hostWidth: { ...host, property: 'width' },
42
- fontSize: [
43
- component,
44
- label,
45
- checkboxHiddenLabel,
46
- ],
47
- fontFamily: [
48
- label,
49
- helperText,
50
- errorMessage,
51
- ],
52
- trackBorderWidth: { ...track, property: 'border-width' },
53
- trackBorderStyle: { ...track, property: 'border-style' },
54
- trackBorderColor: { ...track, property: 'border-color' },
55
- trackBackgroundColor: { ...track, property: 'background-color' },
56
- trackBorderRadius: { ...track, property: 'border-radius' },
57
- trackWidth: [
58
- { ...track, property: 'width' },
59
- ],
60
- trackHeight: [
61
- { ...knob, property: 'font-size' },
62
- { ...track, property: 'height' }
63
- ],
39
+ createStyleMixin({
40
+ mappings: {
41
+ hostWidth: { ...host, property: 'width' },
42
+ fontSize: [component, label, checkboxHiddenLabel],
43
+ fontFamily: [label, helperText, errorMessage],
44
+ trackBorderWidth: { ...track, property: 'border-width' },
45
+ trackBorderStyle: { ...track, property: 'border-style' },
46
+ trackBorderColor: { ...track, property: 'border-color' },
47
+ trackBackgroundColor: { ...track, property: 'background-color' },
48
+ trackBorderRadius: { ...track, property: 'border-radius' },
49
+ trackWidth: [{ ...track, property: 'width' }],
50
+ trackHeight: [
51
+ { ...knob, property: 'font-size' },
52
+ { ...track, property: 'height' },
53
+ ],
64
54
 
65
- knobSize: [
66
- { ...knob, property: 'width' },
67
- { ...knob, property: 'height' },
68
- ],
69
- knobTextColor: { ...knob, property: 'color' },
70
- knobRadius: { ...knob, property: 'border-radius' },
71
- knobTransitionDuration: { ...knob, property: 'transition' },
72
- knobColor: { ...knob, property: 'background-color' },
73
- knobTopOffset: { ...knob, property: 'top' },
74
- knobLeftOffset: { ...knob, property: 'left' },
55
+ knobSize: [
56
+ { ...knob, property: 'width' },
57
+ { ...knob, property: 'height' },
58
+ ],
59
+ knobTextColor: { ...knob, property: 'color' },
60
+ knobRadius: { ...knob, property: 'border-radius' },
61
+ knobTransitionDuration: { ...knob, property: 'transition' },
62
+ knobColor: { ...knob, property: 'background-color' },
63
+ knobTopOffset: { ...knob, property: 'top' },
64
+ knobLeftOffset: { ...knob, property: 'left' },
75
65
 
76
- labelSpacing: [
77
- { ...label, property: 'padding-left' },
78
- { ...checkboxHiddenLabel, property: 'padding-left' }
79
- ],
80
- labelLineHeight: [
81
- { ...label, property: 'line-height' },
82
- { ...checkboxHiddenLabel, property: 'line-height' }
83
- ],
84
- labelFontWeight: [
85
- { ...label, property: 'font-weight' },
86
- { ...checkboxHiddenLabel, property: 'font-weight' }
87
- ],
88
- labelTextColor: [
89
- { ...label, property: 'color' },
90
- { ...requiredIndicator, property: 'color' },
91
- { ...label, property: '-webkit-text-fill-color' }
92
- ],
93
- labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
94
- inputOutlineWidth: { ...track, property: 'outline-width' },
95
- inputOutlineOffset: { ...track, property: 'outline-offset' },
96
- inputOutlineColor: { ...track, property: 'outline-color' },
97
- inputOutlineStyle: { ...track, property: 'outline-style' },
98
- },
99
- }),
100
- draggableMixin,
101
- proxyInputMixin,
102
- componentNameValidationMixin,
103
- booleanFieldMixin
66
+ labelSpacing: [
67
+ { ...label, property: 'padding-left' },
68
+ { ...checkboxHiddenLabel, property: 'padding-left' },
69
+ ],
70
+ labelLineHeight: [
71
+ { ...label, property: 'line-height' },
72
+ { ...checkboxHiddenLabel, property: 'line-height' },
73
+ ],
74
+ labelFontWeight: [
75
+ { ...label, property: 'font-weight' },
76
+ { ...checkboxHiddenLabel, property: 'font-weight' },
77
+ ],
78
+ labelTextColor: [
79
+ { ...label, property: 'color' },
80
+ { ...requiredIndicator, property: 'color' },
81
+ { ...label, property: '-webkit-text-fill-color' },
82
+ ],
83
+ labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
84
+ errorMessageTextColor: { ...errorMessage, property: 'color' },
85
+ inputOutlineWidth: { ...track, property: 'outline-width' },
86
+ inputOutlineOffset: { ...track, property: 'outline-offset' },
87
+ inputOutlineColor: { ...track, property: 'outline-color' },
88
+ inputOutlineStyle: { ...track, property: 'outline-style' },
89
+ },
90
+ }),
91
+ draggableMixin,
92
+ proxyInputMixin,
93
+ componentNameValidationMixin,
94
+ booleanFieldMixin
104
95
  )(
105
- createProxy({
106
- slots: [],
107
- wrappedEleName: 'vaadin-text-field',
108
- style: () => `
96
+ createProxy({
97
+ slots: [],
98
+ wrappedEleName: 'vaadin-text-field',
99
+ style: () => `
109
100
  ${commonStyles}
110
101
  ${useHostExternalPadding(SwitchToggleClass.cssVarList)}
111
102
  vaadin-text-field::part(label) {
112
- left: calc(var(${SwitchToggleClass.cssVarList.trackWidth}) + var(${SwitchToggleClass.cssVarList.trackBorderWidth}) * 2);
103
+ left: calc(var(${SwitchToggleClass.cssVarList.trackWidth}) + var(${
104
+ SwitchToggleClass.cssVarList.trackBorderWidth
105
+ }) * 2);
113
106
  }
114
107
  vaadin-checkbox[active]::part(checkbox) {
115
108
  transform: none;
@@ -120,7 +113,7 @@ export const SwitchToggleClass = compose(
120
113
  content: '';
121
114
  }
122
115
  `,
123
- excludeAttrsSync: ['tabindex'],
124
- componentName
125
- })
116
+ excludeAttrsSync: ['tabindex'],
117
+ componentName,
118
+ })
126
119
  );
@@ -1,6 +1,6 @@
1
1
  import { componentName, SwitchToggleClass } from './SwitchToggleClass';
2
- import '@vaadin/checkbox'
3
- import '@vaadin/text-field'
2
+ import '@vaadin/checkbox';
3
+ import '@vaadin/text-field';
4
4
  import '../descope-boolean-field-internal';
5
5
 
6
6
  customElements.define(componentName, SwitchToggleClass);
@@ -1,12 +1,12 @@
1
1
  import { compose } from '../../helpers';
2
2
  import { getComponentName } from '../../helpers/componentHelpers';
3
- import { useHostExternalPadding } from '../../helpers/themeHelpers/resetHelpers';
4
3
  import {
5
- createStyleMixin,
6
- draggableMixin,
7
- createProxy,
8
- componentNameValidationMixin
4
+ createStyleMixin,
5
+ draggableMixin,
6
+ createProxy,
7
+ componentNameValidationMixin,
9
8
  } from '../../mixins';
9
+ import { clickableMixin } from './clickableMixin';
10
10
 
11
11
  export const componentName = getComponentName('button');
12
12
 
@@ -15,6 +15,10 @@ const resetStyles = `
15
15
  display: inline-block;
16
16
  box-sizing: border-box;
17
17
  }
18
+ vaadin-button::before,
19
+ vaadin-button::after {
20
+ opacity: 0;
21
+ }
18
22
  vaadin-button {
19
23
  margin: 0;
20
24
  min-width: 0;
@@ -43,65 +47,67 @@ const iconStyles = `
43
47
  const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
44
48
 
45
49
  const { host, label } = {
46
- host: { selector: () => ':host' },
47
- label: { selector: '::part(label)' },
50
+ host: { selector: () => ':host' },
51
+ label: { selector: '::part(label)' },
48
52
  };
49
53
 
50
- export const ButtonClass = compose(
51
- createStyleMixin({
52
- mappings: {
53
- hostWidth: { ...host, property: 'width' },
54
- fontSize: {},
55
- fontFamily: {},
54
+ let loadingIndicatorStyles;
56
55
 
57
- cursor: {},
58
- backgroundColor: {},
56
+ export const ButtonClass = compose(
57
+ createStyleMixin({
58
+ mappings: {
59
+ hostWidth: { ...host, property: 'width' },
60
+ hostHeight: { property: 'height' },
61
+ fontSize: {},
62
+ fontFamily: {},
59
63
 
60
- outlineOffset: {},
61
- outlineColor: {},
62
- outlineStyle: {},
63
- outlineWidth: {},
64
+ cursor: {},
65
+ backgroundColor: {},
64
66
 
65
- borderRadius: {},
66
- borderColor: {},
67
- borderStyle: {},
68
- borderWidth: {},
67
+ outlineOffset: {},
68
+ outlineColor: {},
69
+ outlineStyle: {},
70
+ outlineWidth: {},
69
71
 
70
- verticalPadding: [
71
- { property: 'padding-top' },
72
- { property: 'padding-bottom' },
73
- ],
74
- horizontalPadding: [
75
- { property: 'padding-left' },
76
- { property: 'padding-right' },
77
- ],
72
+ borderRadius: {},
73
+ borderColor: {},
74
+ borderStyle: {},
75
+ borderWidth: {},
78
76
 
79
- labelTextColor: { property: 'color' },
80
- labelTextDecoration: { ...label, property: 'text-decoration' },
81
- labelSpacing: { ...label, property: 'gap' },
77
+ verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],
78
+ horizontalPadding: [{ property: 'padding-left' }, { property: 'padding-right' }],
82
79
 
83
- }
84
- }),
85
- draggableMixin,
86
- componentNameValidationMixin
80
+ labelTextColor: { property: 'color' },
81
+ labelTextDecoration: { ...label, property: 'text-decoration' },
82
+ labelSpacing: { ...label, property: 'gap' },
83
+ },
84
+ }),
85
+ clickableMixin,
86
+ draggableMixin,
87
+ componentNameValidationMixin
87
88
  )(
88
- createProxy({
89
- slots: ['prefix', 'label', 'suffix'],
90
- wrappedEleName: 'vaadin-button',
91
- style: () => `
89
+ createProxy({
90
+ slots: ['prefix', 'label', 'suffix'],
91
+ wrappedEleName: 'vaadin-button',
92
+ style: () => `
92
93
  ${resetStyles}
93
94
  ${iconStyles}
94
95
  ${loadingIndicatorStyles}
95
96
  ${editorOverrides}
96
- ${useHostExternalPadding(ButtonClass.cssVarList)}
97
+ :host {
98
+ padding: calc(var(${ButtonClass.cssVarList.outlineWidth}) + var(${ButtonClass.cssVarList.outlineOffset}));
99
+ }
100
+ vaadin-button {
101
+ height: calc(var(${ButtonClass.cssVarList.hostHeight}) - var(${ButtonClass.cssVarList.outlineWidth}) - var(${ButtonClass.cssVarList.outlineOffset}));
102
+ }
97
103
  `,
98
- excludeAttrsSync: ['tabindex'],
99
- componentName
100
- })
104
+ excludeAttrsSync: ['tabindex'],
105
+ componentName,
106
+ })
101
107
  );
102
108
 
103
109
  const { color, fontSize } = ButtonClass.cssVarList;
104
- const loadingIndicatorStyles = `
110
+ loadingIndicatorStyles = `
105
111
  @keyframes spin {
106
112
  0% { -webkit-transform: rotate(0deg); }
107
113
  100% { -webkit-transform: rotate(360deg); }
@@ -123,6 +129,10 @@ const loadingIndicatorStyles = `
123
129
  width: var(${fontSize});
124
130
  height: var(${fontSize});
125
131
  }
132
+ :host([disabled="true"]),
133
+ :host([loading="true"]) {
134
+ pointer-events: none;
135
+ }
126
136
  :host([loading="true"])::part(prefix),
127
137
  :host([loading="true"])::part(label) {
128
138
  visibility: hidden;
@@ -0,0 +1,10 @@
1
+ export const clickableMixin = (superclass) =>
2
+ class ClickableMixinClass extends superclass {
3
+ get isLoading() {
4
+ return this.getAttribute('loading') === 'true';
5
+ }
6
+
7
+ click() {
8
+ this.isLoading || super.click();
9
+ }
10
+ };