@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
package/package.json CHANGED
@@ -1,58 +1,79 @@
1
1
  {
2
- "name": "@descope/web-components-ui",
3
- "version": "1.0.135",
4
- "description": "",
5
- "main": "dist/cjs/index.cjs.js",
6
- "module": "dist/index.esm.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "require": "./dist/cjs/index.cjs.js",
11
- "import": "./dist/index.esm.js"
12
- },
13
- "./package.json": {
14
- "require": "./package.json"
15
- }
16
- },
17
- "scripts": {
18
- "test": "jest",
19
- "lint": "echo \"Error: no lint specified\" && exit 0",
20
- "build:umd": "webpack -c webpack.prod.js",
21
- "build:lib": "rollup -c",
22
- "build": "npm run build:umd && npm run build:lib && cp src/index.d.ts dist",
23
- "start": "webpack serve -c webpack.dev.js --port=8888",
24
- "format": "prettier . -w --ignore-path .gitignore"
25
- },
26
- "files": [
27
- "dist",
28
- "src"
29
- ],
30
- "license": "UNLICENSED",
31
- "devDependencies": {
32
- "@babel/preset-env": "^7.22.2",
33
- "@rollup/plugin-node-resolve": "^15.0.2",
34
- "html-webpack-plugin": "^5.5.1",
35
- "jest": "^29.5.0",
36
- "jest-environment-jsdom": "^29.5.0",
37
- "prettier": "^2.8.8",
38
- "rollup": "^3.21.4",
39
- "webpack": "^5.79.0",
40
- "webpack-cli": "^5.0.1",
41
- "webpack-dev-server": "^4.13.3"
42
- },
43
- "dependencies": {
44
- "@vaadin/button": "24.0.4",
45
- "@vaadin/checkbox": "24.0.4",
46
- "@vaadin/combo-box": "24.0.4",
47
- "@vaadin/date-picker": "24.0.4",
48
- "@vaadin/email-field": "24.0.4",
49
- "@vaadin/number-field": "24.0.4",
50
- "@vaadin/password-field": "24.0.4",
51
- "@vaadin/text-area": "24.0.4",
52
- "@vaadin/text-field": "24.0.4",
53
- "color": "^4.2.3",
54
- "lodash.merge": "4.6.2",
55
- "lodash.set": "4.3.2",
56
- "rollup-plugin-import-css": "^3.2.1"
57
- }
2
+ "name": "@descope/web-components-ui",
3
+ "version": "1.0.148",
4
+ "description": "",
5
+ "main": "dist/cjs/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/cjs/index.cjs.js",
11
+ "import": "./dist/index.esm.js"
12
+ },
13
+ "./package.json": {
14
+ "require": "./package.json"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "test": "jest",
19
+ "lint": "eslint --fix --max-warnings 0",
20
+ "lint:all": "npm run lint .",
21
+ "build:umd": "webpack -c webpack.prod.js",
22
+ "build:lib": "rollup -c",
23
+ "build": "npm run build:umd && npm run build:lib && cp src/index.d.ts dist",
24
+ "start": "webpack serve -c webpack.dev.js --port=8888",
25
+ "format": "prettier -w --ignore-path .gitignore",
26
+ "format:all": "npm run format .",
27
+ "format-lint": "lint-staged",
28
+ "prepare": "husky install",
29
+ "postinstall": "npm explore @vaadin/vaadin-usage-statistics -- npm run disable"
30
+ },
31
+ "lint-staged": {
32
+ "src/**/*.{js,jsx}": [
33
+ "npm run lint",
34
+ "npm run format"
35
+ ]
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "src"
40
+ ],
41
+ "license": "UNLICENSED",
42
+ "devDependencies": {
43
+ "@babel/preset-env": "^7.22.2",
44
+ "@rollup/plugin-node-resolve": "^15.0.2",
45
+ "eslint": "^8.48.0",
46
+ "eslint-config-airbnb-base": "^15.0.0",
47
+ "eslint-config-prettier": "^9.0.0",
48
+ "eslint-plugin-import": "^2.28.1",
49
+ "eslint-plugin-prettier": "^5.0.0",
50
+ "html-webpack-plugin": "^5.5.1",
51
+ "husky": "^8.0.3",
52
+ "jest": "^29.5.0",
53
+ "jest-environment-jsdom": "^29.5.0",
54
+ "prettier": "^3.0.2",
55
+ "rollup": "^3.21.4",
56
+ "webpack": "^5.79.0",
57
+ "webpack-cli": "^5.0.1",
58
+ "webpack-dev-server": "^4.13.3"
59
+ },
60
+ "dependencies": {
61
+ "@vaadin/button": "24.0.4",
62
+ "@vaadin/checkbox": "24.0.4",
63
+ "@vaadin/combo-box": "24.0.4",
64
+ "@vaadin/date-picker": "24.0.4",
65
+ "@vaadin/email-field": "24.0.4",
66
+ "@vaadin/number-field": "24.0.4",
67
+ "@vaadin/password-field": "24.0.4",
68
+ "@vaadin/text-area": "24.0.4",
69
+ "@vaadin/text-field": "24.0.4",
70
+ "color": "^4.2.3",
71
+ "lint-staged": "^14.0.1",
72
+ "lodash.merge": "4.6.2",
73
+ "lodash.set": "4.3.2",
74
+ "rollup-plugin-import-css": "^3.2.1"
75
+ },
76
+ "vaadin": {
77
+ "disableUsageStatistics": true
78
+ }
58
79
  }
@@ -1,7 +1,7 @@
1
- import { compose } from "../helpers";
2
- import { componentNameValidationMixin } from "../mixins/componentNameValidationMixin";
3
- import { hoverableMixin } from "../mixins/hoverableMixin";
4
- import { normalizeBooleanAttributesMixin } from "../mixins/normalizeBooleanAttributesMixin";
1
+ import { compose } from '../helpers';
2
+ import { componentNameValidationMixin } from '../mixins/componentNameValidationMixin';
3
+ import { hoverableMixin } from '../mixins/hoverableMixin';
4
+ import { normalizeBooleanAttributesMixin } from '../mixins/normalizeBooleanAttributesMixin';
5
5
 
6
6
  export const createBaseClass = ({ componentName, baseSelector = '' }) => {
7
7
  class DescopeBaseClass extends HTMLElement {
@@ -15,26 +15,28 @@ export const createBaseClass = ({ componentName, baseSelector = '' }) => {
15
15
 
16
16
  // base selector is the selector for the component wrapper,
17
17
  // it's the highest element that is relevant for the layout
18
+ // eslint-disable-next-line class-methods-use-this
18
19
  get baseSelector() {
19
- return baseSelector
20
+ return baseSelector;
20
21
  }
21
22
 
22
23
  // this is the base element, which returned by querying the base selector
23
24
  get baseElement() {
24
- this.#baseElement ??= this.baseSelector ?
25
- this.rootElement.querySelector(this.baseSelector) :
26
- this;
25
+ this.#baseElement ??= this.baseSelector
26
+ ? this.rootElement.querySelector(this.baseSelector)
27
+ : this;
27
28
 
28
- if(!this.#baseElement) {
29
- console.warn('missing base element for component', this.localName)
29
+ if (!this.#baseElement) {
30
+ // eslint-disable-next-line no-console
31
+ console.warn('missing base element for component', this.localName);
30
32
  }
31
- return this.#baseElement
33
+ return this.#baseElement;
32
34
  }
33
35
 
34
- // this is the component root level element,
36
+ // this is the component root level element,
35
37
  // it can be either a shadow root or the component's node from the light DOM
36
38
  get rootElement() {
37
- return this.shadowRoot || this
39
+ return this.shadowRoot || this;
38
40
  }
39
41
 
40
42
  connectedCallback() {
@@ -43,7 +45,7 @@ export const createBaseClass = ({ componentName, baseSelector = '' }) => {
43
45
  if (this.rootElement.isConnected) {
44
46
  // the init function is running once, on the first time the component is connected
45
47
  if (this.#isInit) {
46
- this.#isInit = false
48
+ this.#isInit = false;
47
49
  this.init?.();
48
50
  }
49
51
  }
@@ -54,5 +56,5 @@ export const createBaseClass = ({ componentName, baseSelector = '' }) => {
54
56
  componentNameValidationMixin,
55
57
  hoverableMixin,
56
58
  normalizeBooleanAttributesMixin
57
- )(DescopeBaseClass)
58
- }
59
+ )(DescopeBaseClass);
60
+ };
@@ -1,10 +1,16 @@
1
- import { compose } from "../helpers";
2
- import { changeMixin, inputEventsDispatchingMixin, inputValidationMixin, normalizeBooleanAttributesMixin } from "../mixins";
3
- import { createBaseClass } from "./createBaseClass";
4
-
5
- export const createBaseInputClass = (...args) => compose(
6
- inputValidationMixin,
1
+ import { compose } from '../helpers';
2
+ import {
7
3
  changeMixin,
4
+ inputEventsDispatchingMixin,
5
+ inputValidationMixin,
8
6
  normalizeBooleanAttributesMixin,
9
- inputEventsDispatchingMixin
10
- )(createBaseClass(...args))
7
+ } from '../mixins';
8
+ import { createBaseClass } from './createBaseClass';
9
+
10
+ export const createBaseInputClass = (...args) =>
11
+ compose(
12
+ inputValidationMixin,
13
+ changeMixin,
14
+ normalizeBooleanAttributesMixin,
15
+ inputEventsDispatchingMixin
16
+ )(createBaseClass(...args));
@@ -2,13 +2,17 @@ import { compose } from '../helpers';
2
2
  import { componentNameValidationMixin, createStyleMixin, draggableMixin } from '../mixins';
3
3
  import { createBaseClass } from './createBaseClass';
4
4
 
5
- let style;
6
- const getContent = () => style;
7
5
  export const createCssVarImageClass = ({ componentName, varName, fallbackVarName }) => {
8
- class RawCssVarImageClass extends createBaseClass({ componentName, baseSelector: ':host > div' }) {
9
- constructor() {
10
- super();
11
- this.attachShadow({ mode: 'open' }).innerHTML = `
6
+ let style;
7
+ const getContent = () => style;
8
+
9
+ class RawCssVarImageClass extends createBaseClass({
10
+ componentName,
11
+ baseSelector: ':host > div',
12
+ }) {
13
+ constructor() {
14
+ super();
15
+ this.attachShadow({ mode: 'open' }).innerHTML = `
12
16
  <style>
13
17
  :host {
14
18
  display: inline-flex;
@@ -27,23 +31,23 @@ export const createCssVarImageClass = ({ componentName, varName, fallbackVarName
27
31
  </style>
28
32
  <div></div>
29
33
  `;
30
- }
31
- }
34
+ }
35
+ }
32
36
 
33
- const CssVarImageClass = compose(
34
- createStyleMixin({
35
- mappings: {
36
- height: { selector: () => ':host' },
37
- width: { selector: () => ':host' },
38
- [varName]: { property: 'content' },
39
- [fallbackVarName]: { property: 'content' },
40
- }
41
- }),
42
- draggableMixin,
43
- componentNameValidationMixin
44
- )(RawCssVarImageClass);
37
+ const CssVarImageClass = compose(
38
+ createStyleMixin({
39
+ mappings: {
40
+ height: { selector: () => ':host' },
41
+ width: { selector: () => ':host' },
42
+ [varName]: { property: 'content' },
43
+ [fallbackVarName]: { property: 'content' },
44
+ },
45
+ }),
46
+ draggableMixin,
47
+ componentNameValidationMixin
48
+ )(RawCssVarImageClass);
45
49
 
46
- style = `content: var(${CssVarImageClass.cssVarList[varName]}, var(${CssVarImageClass.cssVarList[fallbackVarName]}));`
50
+ style = `content: var(${CssVarImageClass.cssVarList[varName]}, var(${CssVarImageClass.cssVarList[fallbackVarName]}));`;
47
51
 
48
- return CssVarImageClass;
49
- }
52
+ return CssVarImageClass;
53
+ };
@@ -1,39 +1,28 @@
1
- import { forwardAttrs, forwardProps, syncAttrs } from "../../helpers/componentHelpers";
2
- import { componentName as descopeInternalComponentName } from './descope-boolean-field-internal/BooleanFieldInternal'
1
+ import { forwardAttrs, forwardProps, syncAttrs } from '../../helpers/componentHelpers';
2
+ import { componentName as descopeInternalComponentName } from './descope-boolean-field-internal/BooleanFieldInternal';
3
3
 
4
4
  export const booleanFieldMixin = (superclass) =>
5
- class BooleanFieldMixinClass extends superclass {
6
- constructor() {
7
- super();
8
- }
5
+ class BooleanFieldMixinClass extends superclass {
6
+ init() {
7
+ super.init?.();
9
8
 
10
- init() {
11
- super.init?.();
12
-
13
- const template = document.createElement('template');
14
- template.innerHTML = `
15
- <${descopeInternalComponentName}
9
+ const template = document.createElement('template');
10
+ template.innerHTML = `
11
+ <${descopeInternalComponentName}
16
12
  tabindex="-1"
17
13
  slot="input"
18
14
  ></${descopeInternalComponentName}>
19
15
  `;
20
16
 
21
- this.baseElement.appendChild(template.content.cloneNode(true));
22
- this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
23
- this.checkbox = this.inputElement.querySelector('vaadin-checkbox');
17
+ this.baseElement.appendChild(template.content.cloneNode(true));
18
+ this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
19
+ this.checkbox = this.inputElement.querySelector('vaadin-checkbox');
24
20
 
25
- forwardAttrs(this, this.inputElement, {
26
- includeAttrs: [
27
- 'required',
28
- 'full-width',
29
- 'size',
30
- 'label',
31
- 'invalid',
32
- 'disabled'
33
- ]
34
- });
21
+ forwardAttrs(this, this.inputElement, {
22
+ includeAttrs: ['required', 'full-width', 'size', 'label', 'invalid', 'disabled'],
23
+ });
35
24
 
36
- forwardProps(this.inputElement, this, ['checked']);
37
- syncAttrs(this, this.inputElement, { includeAttrs: ['checked'] });
38
- }
39
- };
25
+ forwardProps(this.inputElement, this, ['checked']);
26
+ syncAttrs(this, this.inputElement, { includeAttrs: ['checked'] });
27
+ }
28
+ };
@@ -1,4 +1,4 @@
1
- import { resetInputFieldDefaultWidth } from "../../helpers/themeHelpers/resetHelpers";
1
+ import { resetInputFieldDefaultWidth } from '../../helpers/themeHelpers/resetHelpers';
2
2
 
3
3
  export default `
4
4
  :host {
@@ -3,64 +3,59 @@ import { forwardAttrs, getComponentName, syncAttrs } from '../../../helpers/comp
3
3
 
4
4
  export const componentName = getComponentName('boolean-field-internal');
5
5
 
6
- const forwardAttributes = [
7
- 'disabled',
8
- 'label',
9
- 'invalid',
10
- 'readonly'
11
- ];
6
+ const forwardAttributes = ['disabled', 'label', 'invalid', 'readonly'];
12
7
 
13
- const BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' })
8
+ const BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' });
14
9
 
15
10
  class BooleanInputInternal extends BaseInputClass {
16
- constructor() {
17
- super();
18
- this.innerHTML = `
11
+ constructor() {
12
+ super();
13
+ this.innerHTML = `
19
14
  <div class="wrapper">
20
15
  <vaadin-checkbox></vaadin-checkbox>
21
16
  </div>
22
17
  `;
23
- this.wrapperEle = this.querySelector('div');
24
- this.checkbox = this.querySelector('vaadin-checkbox')
25
- }
26
-
27
- get value() {
28
- return this.checkbox?.checked;
29
- }
30
-
31
- set value(val) {
32
- this.checkbox.checked = val;
33
- }
34
-
35
- get checked() {
36
- return this.value;
37
- }
38
-
39
- set checked(val) {
40
- this.value = val;
41
- }
42
-
43
- init() {
44
- this.addEventListener('focus', (e) => {
45
- if (e.isTrusted) {
46
- this.checkbox.focus()
47
- }
48
- });
49
- super.init?.();
50
-
51
- forwardAttrs(this, this.checkbox, { includeAttrs: forwardAttributes });
52
- syncAttrs(this, this.checkbox, { includeAttrs: ['checked'] });
53
-
54
- // we need it in order to set the focus ring and trigger validation on descope-checkbox
55
- this.handleFocusEventsDispatching([this.checkbox])
56
- }
57
-
58
- getValidity() {
59
- if (this.isRequired && !this.value) {
60
- return { valueMissing: true };
61
- }
62
- return {}
63
- };
18
+ this.wrapperEle = this.querySelector('div');
19
+ this.checkbox = this.querySelector('vaadin-checkbox');
20
+ }
21
+
22
+ get value() {
23
+ return this.checkbox?.checked;
24
+ }
25
+
26
+ set value(val) {
27
+ this.checkbox.checked = val;
28
+ }
29
+
30
+ get checked() {
31
+ return this.value;
32
+ }
33
+
34
+ set checked(val) {
35
+ this.value = val;
36
+ }
37
+
38
+ init() {
39
+ this.addEventListener('focus', (e) => {
40
+ if (e.isTrusted) {
41
+ this.checkbox.focus();
42
+ }
43
+ });
44
+ super.init?.();
45
+
46
+ forwardAttrs(this, this.checkbox, { includeAttrs: forwardAttributes });
47
+ syncAttrs(this, this.checkbox, { includeAttrs: ['checked'] });
48
+
49
+ // we need it in order to set the focus ring and trigger validation on descope-checkbox
50
+ this.handleFocusEventsDispatching([this.checkbox]);
51
+ }
52
+
53
+ getValidity() {
54
+ if (this.isRequired && !this.value) {
55
+ return { valueMissing: true };
56
+ }
57
+ return {};
58
+ }
64
59
  }
65
60
 
66
61
  export default BooleanInputInternal;
@@ -1,3 +1,3 @@
1
- import BooleanFieldInternal, { componentName } from "./BooleanFieldInternal"
1
+ import BooleanFieldInternal, { componentName } from './BooleanFieldInternal';
2
2
 
3
3
  customElements.define(componentName, BooleanFieldInternal);