@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.
- package/package.json +77 -56
- package/src/baseClasses/createBaseClass.js +18 -16
- package/src/baseClasses/createBaseInputClass.js +14 -8
- package/src/baseClasses/createCssVarImageClass.js +27 -23
- package/src/components/boolean-fields/booleanFieldMixin.js +18 -29
- package/src/components/boolean-fields/commonStyles.js +1 -1
- package/src/components/boolean-fields/descope-boolean-field-internal/BooleanFieldInternal.js +46 -51
- package/src/components/boolean-fields/descope-boolean-field-internal/index.js +1 -1
- package/src/components/boolean-fields/descope-checkbox/CheckboxClass.js +80 -85
- package/src/components/boolean-fields/descope-checkbox/index.js +2 -2
- package/src/components/boolean-fields/descope-switch-toggle/SwitchToggleClass.js +88 -95
- package/src/components/boolean-fields/descope-switch-toggle/index.js +2 -2
- package/src/components/descope-button/ButtonClass.js +57 -47
- package/src/components/descope-button/clickableMixin.js +10 -0
- package/src/components/descope-combo-box/ComboBoxClass.js +156 -160
- package/src/components/descope-container/ContainerClass.js +32 -42
- package/src/components/descope-date-picker/index.js +9 -14
- package/src/components/descope-divider/DividerClass.js +52 -62
- package/src/components/descope-email-field/EmailFieldClass.js +25 -20
- package/src/components/descope-image/ImageClass.js +21 -24
- package/src/components/descope-link/LinkClass.js +31 -35
- package/src/components/descope-loader-linear/LoaderLinearClass.js +31 -36
- package/src/components/descope-loader-radial/LoaderRadialClass.js +23 -30
- package/src/components/descope-logo/LogoClass.js +5 -1
- package/src/components/descope-new-password/NewPasswordClass.js +63 -81
- package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +157 -162
- package/src/components/descope-new-password/descope-new-password-internal/componentName.js +1 -1
- package/src/components/descope-new-password/descope-new-password-internal/index.js +3 -3
- package/src/components/descope-new-password/index.js +3 -3
- package/src/components/descope-number-field/NumberFieldClass.js +25 -20
- package/src/components/descope-passcode/PasscodeClass.js +95 -95
- package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +151 -157
- package/src/components/descope-passcode/descope-passcode-internal/helpers.js +7 -8
- package/src/components/descope-passcode/descope-passcode-internal/index.js +2 -2
- package/src/components/descope-passcode/index.js +2 -2
- package/src/components/descope-password/PasswordClass.js +75 -83
- package/src/components/descope-password/passwordDraggableMixin.js +28 -27
- package/src/components/descope-phone-field/CountryCodes.js +1210 -1210
- package/src/components/descope-phone-field/PhoneFieldClass.js +139 -141
- package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +157 -173
- package/src/components/descope-phone-field/helpers.js +3 -3
- package/src/components/descope-text/TextClass.js +25 -29
- package/src/components/descope-text-area/TextAreaClass.js +68 -67
- package/src/components/descope-text-field/TextFieldClass.js +42 -37
- package/src/components/descope-text-field/textFieldMappings.js +40 -55
- package/src/components/descope-totp-image/TotpImageClass.js +5 -1
- package/src/components/descope-upload-file/UploadFileClass.js +202 -0
- package/src/components/descope-upload-file/helpers.js +11 -0
- package/src/components/descope-upload-file/index.js +6 -0
- package/src/constants.js +3 -3
- package/src/helpers/componentHelpers.js +68 -74
- package/src/helpers/index.js +17 -16
- package/src/helpers/mixinsHelpers.js +21 -10
- package/src/helpers/themeHelpers/colorsHelpers.js +18 -18
- package/src/helpers/themeHelpers/componentsThemeManager.js +7 -6
- package/src/helpers/themeHelpers/index.js +114 -124
- package/src/helpers/themeHelpers/resetHelpers.js +16 -16
- package/src/index.cjs.js +3 -3
- package/src/index.d.ts +22 -21
- package/src/index.js +5 -4
- package/src/index.umd.js +14 -13
- package/src/mixins/changeMixin.js +18 -17
- package/src/mixins/componentNameValidationMixin.js +19 -19
- package/src/mixins/createProxy.js +33 -33
- package/src/mixins/createStyleMixin/helpers.js +54 -64
- package/src/mixins/createStyleMixin/index.js +155 -141
- package/src/mixins/draggableMixin.js +61 -61
- package/src/mixins/hoverableMixin.js +11 -13
- package/src/mixins/index.js +6 -6
- package/src/mixins/inputEventsDispatchingMixin.js +61 -60
- package/src/mixins/inputValidationMixin.js +153 -148
- package/src/mixins/lifecycleEventsMixin.js +17 -15
- package/src/mixins/normalizeBooleanAttributesMixin.js +31 -23
- package/src/mixins/portalMixin.js +58 -52
- package/src/mixins/proxyInputMixin.js +138 -132
- package/src/theme/components/button.js +86 -81
- package/src/theme/components/checkbox.js +26 -28
- package/src/theme/components/comboBox.js +32 -31
- package/src/theme/components/container.js +99 -89
- package/src/theme/components/divider.js +30 -31
- package/src/theme/components/emailField.js +20 -19
- package/src/theme/components/image.js +3 -3
- package/src/theme/components/index.js +33 -25
- package/src/theme/components/inputWrapper.js +28 -25
- package/src/theme/components/link.js +29 -36
- package/src/theme/components/loader/index.js +3 -3
- package/src/theme/components/loader/loaderLinear.js +34 -34
- package/src/theme/components/loader/loaderRadial.js +40 -34
- package/src/theme/components/logo.js +4 -4
- package/src/theme/components/newPassword.js +14 -13
- package/src/theme/components/numberField.js +20 -19
- package/src/theme/components/passcode.js +20 -22
- package/src/theme/components/password.js +22 -21
- package/src/theme/components/phoneField.js +23 -23
- package/src/theme/components/switchToggle.js +47 -46
- package/src/theme/components/text.js +72 -72
- package/src/theme/components/textArea.js +27 -25
- package/src/theme/components/textField.js +23 -22
- package/src/theme/components/totpImage.js +4 -4
- package/src/theme/components/uploadFile.js +60 -0
- package/src/theme/globals.js +123 -124
- package/src/theme/index.js +1 -1
- package/dist/cjs/index.cjs.js +0 -5924
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/index.d.ts +0 -51
- package/dist/index.esm.js +0 -6606
- package/dist/index.esm.js.map +0 -1
- package/dist/umd/1018.js +0 -577
- package/dist/umd/1018.js.LICENSE.txt +0 -23
- package/dist/umd/2481.js +0 -1
- package/dist/umd/3208.js +0 -2
- package/dist/umd/3208.js.LICENSE.txt +0 -5
- package/dist/umd/3585.js +0 -1
- package/dist/umd/3878.js +0 -1
- package/dist/umd/4201.js +0 -1
- package/dist/umd/422.js +0 -2
- package/dist/umd/422.js.LICENSE.txt +0 -5
- package/dist/umd/4447.js +0 -1
- package/dist/umd/4513.js +0 -1
- package/dist/umd/4803.js +0 -1
- package/dist/umd/541.js +0 -744
- package/dist/umd/541.js.LICENSE.txt +0 -21
- package/dist/umd/5767.js +0 -2
- package/dist/umd/5767.js.LICENSE.txt +0 -15
- package/dist/umd/5806.js +0 -109
- package/dist/umd/5806.js.LICENSE.txt +0 -5
- package/dist/umd/7056.js +0 -48
- package/dist/umd/7056.js.LICENSE.txt +0 -5
- package/dist/umd/7101.js +0 -148
- package/dist/umd/7101.js.LICENSE.txt +0 -11
- package/dist/umd/729.js +0 -1
- package/dist/umd/7824.js +0 -229
- package/dist/umd/7824.js.LICENSE.txt +0 -27
- package/dist/umd/7840.js +0 -356
- package/dist/umd/7840.js.LICENSE.txt +0 -61
- package/dist/umd/8725.js +0 -37
- package/dist/umd/8725.js.LICENSE.txt +0 -11
- package/dist/umd/9211.js +0 -312
- package/dist/umd/9211.js.LICENSE.txt +0 -5
- package/dist/umd/9241.js +0 -1
- package/dist/umd/9314.js +0 -283
- package/dist/umd/9314.js.LICENSE.txt +0 -27
- package/dist/umd/9437.js +0 -19
- package/dist/umd/9437.js.LICENSE.txt +0 -5
- package/dist/umd/9515.js +0 -202
- package/dist/umd/9515.js.LICENSE.txt +0 -11
- package/dist/umd/9789.js +0 -1
- package/dist/umd/boolean-fields-descope-boolean-field-internal-index-js.js +0 -1
- package/dist/umd/boolean-fields-descope-checkbox-index-js.js +0 -1
- package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +0 -1
- package/dist/umd/descope-button-index-js.js +0 -1
- package/dist/umd/descope-combo-box-index-js.js +0 -1
- package/dist/umd/descope-container-index-js.js +0 -1
- package/dist/umd/descope-date-picker-index-js.js +0 -1
- package/dist/umd/descope-divider-index-js.js +0 -1
- package/dist/umd/descope-email-field-index-js.js +0 -1
- package/dist/umd/descope-image-index-js.js +0 -1
- package/dist/umd/descope-link-index-js.js +0 -1
- package/dist/umd/descope-loader-linear-index-js.js +0 -1
- package/dist/umd/descope-loader-radial-index-js.js +0 -1
- package/dist/umd/descope-logo-index-js.js +0 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +0 -1
- package/dist/umd/descope-new-password-index-js.js +0 -1
- package/dist/umd/descope-number-field-index-js.js +0 -1
- package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +0 -1
- package/dist/umd/descope-passcode-index-js.js +0 -1
- package/dist/umd/descope-password-index-js.js +0 -1
- package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +0 -1
- package/dist/umd/descope-phone-field-index-js.js +0 -1
- package/dist/umd/descope-text-area-index-js.js +0 -1
- package/dist/umd/descope-text-field-index-js.js +0 -1
- package/dist/umd/descope-text-index-js.js +0 -1
- package/dist/umd/descope-totp-image-index-js.js +0 -1
- package/dist/umd/index.js +0 -1
package/package.json
CHANGED
@@ -1,58 +1,79 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
2
|
-
import { componentNameValidationMixin } from
|
3
|
-
import {
|
4
|
-
import { normalizeBooleanAttributesMixin } from
|
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
|
-
|
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
|
2
|
-
import {
|
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
|
-
|
10
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
50
|
+
style = `content: var(${CssVarImageClass.cssVarList[varName]}, var(${CssVarImageClass.cssVarList[fallbackVarName]}));`;
|
47
51
|
|
48
|
-
|
49
|
-
}
|
52
|
+
return CssVarImageClass;
|
53
|
+
};
|
@@ -1,39 +1,28 @@
|
|
1
|
-
import { forwardAttrs, forwardProps, syncAttrs } from
|
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
5
|
+
class BooleanFieldMixinClass extends superclass {
|
6
|
+
init() {
|
7
|
+
super.init?.();
|
9
8
|
|
10
|
-
|
11
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
25
|
+
forwardProps(this.inputElement, this, ['checked']);
|
26
|
+
syncAttrs(this, this.inputElement, { includeAttrs: ['checked'] });
|
27
|
+
}
|
28
|
+
};
|
package/src/components/boolean-fields/descope-boolean-field-internal/BooleanFieldInternal.js
CHANGED
@@ -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
|
-
|
17
|
-
|
18
|
-
|
11
|
+
constructor() {
|
12
|
+
super();
|
13
|
+
this.innerHTML = `
|
19
14
|
<div class="wrapper">
|
20
15
|
<vaadin-checkbox></vaadin-checkbox>
|
21
16
|
</div>
|
22
17
|
`;
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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;
|