@descope/web-components-ui 2.1.17 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cjs/index.cjs.js +494 -380
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +14785 -14648
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/1899.js +1 -1
  6. package/dist/umd/1899.js.map +1 -1
  7. package/dist/umd/4623.js +1 -1
  8. package/dist/umd/4623.js.map +1 -1
  9. package/dist/umd/4914.js +1 -1
  10. package/dist/umd/4914.js.map +1 -1
  11. package/dist/umd/5648.js +1 -1
  12. package/dist/umd/5648.js.map +1 -1
  13. package/dist/umd/8961.js +1 -1
  14. package/dist/umd/8961.js.map +1 -1
  15. package/dist/umd/9365.js +1 -1
  16. package/dist/umd/9365.js.map +1 -1
  17. package/dist/umd/9582.js +2 -0
  18. package/dist/umd/9582.js.map +1 -0
  19. package/dist/umd/DescopeDev.js +1 -1
  20. package/dist/umd/DescopeDev.js.map +1 -1
  21. package/dist/umd/boolean-fields-descope-boolean-field-internal-index-js.js +1 -1
  22. package/dist/umd/boolean-fields-descope-boolean-field-internal-index-js.js.map +1 -1
  23. package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -1
  24. package/dist/umd/boolean-fields-descope-checkbox-index-js.js.map +1 -1
  25. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
  26. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js.map +1 -1
  27. package/dist/umd/descope-alert-index-js.js +1 -1
  28. package/dist/umd/descope-alert-index-js.js.map +1 -1
  29. package/dist/umd/descope-apps-list.js +2 -2
  30. package/dist/umd/descope-apps-list.js.map +1 -1
  31. package/dist/umd/descope-email-field-index-js.js +1 -1
  32. package/dist/umd/descope-email-field-index-js.js.map +1 -1
  33. package/dist/umd/descope-enriched-text.js +1 -1
  34. package/dist/umd/descope-enriched-text.js.map +1 -1
  35. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js +1 -1
  36. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js.map +1 -1
  37. package/dist/umd/descope-grid-index-js.js +1 -1
  38. package/dist/umd/descope-grid-index-js.js.map +1 -1
  39. package/dist/umd/descope-passcode-index-js.js +1 -1
  40. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  41. package/dist/umd/descope-scopes-list-index-js.js +1 -1
  42. package/dist/umd/descope-scopes-list-index-js.js.map +1 -1
  43. package/dist/umd/descope-security-questions-verify-index-js.js +1 -1
  44. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  45. package/dist/umd/descope-text-field-index-js.js +1 -1
  46. package/dist/umd/descope-text-field-index-js.js.map +1 -1
  47. package/dist/umd/index.js +1 -1
  48. package/dist/umd/index.js.map +1 -1
  49. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +1 -1
  50. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
  51. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  52. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
  53. package/package.json +28 -28
  54. package/src/components/boolean-fields/commonStyles.js +11 -1
  55. package/src/components/boolean-fields/descope-boolean-field-internal/BooleanFieldInternal.js +32 -4
  56. package/src/components/boolean-fields/descope-checkbox/CheckboxClass.js +15 -2
  57. package/src/components/boolean-fields/descope-checkbox/index.js +1 -0
  58. package/src/components/boolean-fields/descope-switch-toggle/SwitchToggleClass.js +5 -2
  59. package/src/components/boolean-fields/descope-switch-toggle/index.js +1 -0
  60. package/src/mixins/createStyleMixin/helpers.js +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "2.1.17",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -50,10 +50,10 @@
50
50
  "webpack": "^5.79.0",
51
51
  "webpack-cli": "^6.0.0",
52
52
  "webpack-dev-server": "^5.0.0",
53
- "rollup-replace-plugin": "2.1.17",
54
- "test-drivers": "2.1.17",
55
- "webpack-extract-font-loader": "2.1.17",
56
- "webpack-replace-plugin": "2.1.17"
53
+ "rollup-replace-plugin": "2.2.0",
54
+ "test-drivers": "2.2.0",
55
+ "webpack-extract-font-loader": "2.2.0",
56
+ "webpack-replace-plugin": "2.2.0"
57
57
  },
58
58
  "dependencies": {
59
59
  "@vaadin/checkbox": "24.3.4",
@@ -77,29 +77,29 @@
77
77
  "libphonenumber-js": "^1.11.12",
78
78
  "lodash.debounce": "4.0.8",
79
79
  "lodash.merge": "4.6.2",
80
- "@descope-ui/common": "2.1.17",
81
- "@descope-ui/descope-address-field": "2.1.17",
82
- "@descope-ui/descope-apps-list": "2.1.17",
83
- "@descope-ui/descope-autocomplete-field": "2.1.17",
84
- "@descope-ui/descope-avatar": "2.1.17",
85
- "@descope-ui/descope-badge": "2.1.17",
86
- "@descope-ui/descope-button": "2.1.17",
87
- "@descope-ui/descope-collapsible-container": "2.1.17",
88
- "@descope-ui/descope-combo-box": "2.1.17",
89
- "@descope-ui/descope-enriched-text": "2.1.17",
90
- "@descope-ui/descope-icon": "2.1.17",
91
- "@descope-ui/descope-image": "2.1.17",
92
- "@descope-ui/descope-link": "2.1.17",
93
- "@descope-ui/descope-list": "2.1.17",
94
- "@descope-ui/descope-list-item": "2.1.17",
95
- "@descope-ui/descope-outbound-app-button": "2.1.17",
96
- "@descope-ui/descope-outbound-apps": "2.1.17",
97
- "@descope-ui/descope-password-strength": "2.1.17",
98
- "@descope-ui/descope-recovery-codes": "2.1.17",
99
- "@descope-ui/descope-text": "2.1.17",
100
- "@descope-ui/descope-timer": "2.1.17",
101
- "@descope-ui/descope-timer-button": "2.1.17",
102
- "@descope-ui/descope-trusted-devices": "2.1.17"
80
+ "@descope-ui/common": "2.2.0",
81
+ "@descope-ui/descope-address-field": "2.2.0",
82
+ "@descope-ui/descope-apps-list": "2.2.0",
83
+ "@descope-ui/descope-autocomplete-field": "2.2.0",
84
+ "@descope-ui/descope-avatar": "2.2.0",
85
+ "@descope-ui/descope-badge": "2.2.0",
86
+ "@descope-ui/descope-button": "2.2.0",
87
+ "@descope-ui/descope-collapsible-container": "2.2.0",
88
+ "@descope-ui/descope-combo-box": "2.2.0",
89
+ "@descope-ui/descope-enriched-text": "2.2.0",
90
+ "@descope-ui/descope-icon": "2.2.0",
91
+ "@descope-ui/descope-image": "2.2.0",
92
+ "@descope-ui/descope-link": "2.2.0",
93
+ "@descope-ui/descope-list": "2.2.0",
94
+ "@descope-ui/descope-list-item": "2.2.0",
95
+ "@descope-ui/descope-outbound-app-button": "2.2.0",
96
+ "@descope-ui/descope-outbound-apps": "2.2.0",
97
+ "@descope-ui/descope-password-strength": "2.2.0",
98
+ "@descope-ui/descope-recovery-codes": "2.2.0",
99
+ "@descope-ui/descope-text": "2.2.0",
100
+ "@descope-ui/descope-timer": "2.2.0",
101
+ "@descope-ui/descope-timer-button": "2.2.0",
102
+ "@descope-ui/descope-trusted-devices": "2.2.0"
103
103
  },
104
104
  "overrides": {
105
105
  "@vaadin/avatar": "24.3.4",
@@ -1,6 +1,7 @@
1
+ import { EnrichedTextClass } from '@descope-ui/descope-enriched-text/class';
1
2
  import { resetInputFieldDefaultWidth } from '../../helpers/themeHelpers/resetHelpers';
2
3
 
3
- export default `
4
+ export default (cssVarList) => `
4
5
  :host {
5
6
  display: inline-flex;
6
7
  }
@@ -47,4 +48,13 @@ descope-boolean-field-internal {
47
48
  -webkit-mask-image: none;
48
49
  min-height: initial;
49
50
  }
51
+
52
+ descope-enriched-text[empty] {
53
+ ${EnrichedTextClass.cssVarList.hostDisplay}: none;
54
+ }
55
+
56
+ descope-enriched-text {
57
+ ${EnrichedTextClass.cssVarList.hostDirection}: var(${cssVarList.hostDirection});
58
+ }
59
+
50
60
  `;
@@ -1,26 +1,34 @@
1
1
  import { createBaseInputClass } from '../../../baseClasses/createBaseInputClass';
2
- import { forwardAttrs, getComponentName, syncAttrs } from '../../../helpers/componentHelpers';
2
+ import {
3
+ forwardAttrs,
4
+ observeAttributes,
5
+ getComponentName,
6
+ syncAttrs,
7
+ } from '../../../helpers/componentHelpers';
3
8
 
4
9
  export const componentName = getComponentName('boolean-field-internal');
5
10
 
6
- const forwardAttributes = ['disabled', 'label', 'invalid', 'readonly'];
11
+ const forwardAttributes = ['disabled', 'invalid', 'readonly'];
7
12
 
8
13
  const BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' });
9
14
 
10
15
  class BooleanInputInternal extends BaseInputClass {
11
16
  static get observedAttributes() {
12
- return ['readonly'];
17
+ return ['readonly', 'label'];
13
18
  }
14
19
 
15
20
  constructor() {
16
21
  super();
17
22
  this.innerHTML = `
18
23
  <div class="wrapper">
19
- <vaadin-checkbox></vaadin-checkbox>
24
+ <vaadin-checkbox>
25
+ <descope-enriched-text class="label-content" slot="label"></descope-enriched-text>
26
+ </vaadin-checkbox>
20
27
  </div>
21
28
  `;
22
29
  this.wrapperEle = this.querySelector('div');
23
30
  this.checkbox = this.querySelector('vaadin-checkbox');
31
+ this.labelContent = this.querySelector('.label-content');
24
32
  }
25
33
 
26
34
  get value() {
@@ -50,6 +58,13 @@ class BooleanInputInternal extends BaseInputClass {
50
58
  forwardAttrs(this, this.checkbox, { includeAttrs: forwardAttributes });
51
59
  syncAttrs(this, this.checkbox, { includeAttrs: ['checked'] });
52
60
 
61
+ // Handle label click to toggle checkbox
62
+ this.labelContent.addEventListener('click', (e) => {
63
+ if (!this.hasAttribute('disabled') && !this.hasAttribute('readonly')) {
64
+ this.checkbox.click();
65
+ }
66
+ });
67
+
53
68
  // we need it in order to set the focus ring and trigger validation on descope-checkbox
54
69
  this.handleFocusEventsDispatching([this.checkbox]);
55
70
  }
@@ -60,6 +75,19 @@ class BooleanInputInternal extends BaseInputClass {
60
75
  if (attrName === 'readonly') {
61
76
  this.onReadOnlyChange(newValue !== null);
62
77
  }
78
+
79
+ if (attrName === 'label') {
80
+ this.onLabelChange();
81
+ }
82
+ }
83
+
84
+ onLabelChange() {
85
+ const labelValue = this.getAttribute('label');
86
+ if (labelValue) {
87
+ this.labelContent.textContent = labelValue;
88
+ } else {
89
+ this.labelContent.textContent = '';
90
+ }
63
91
  }
64
92
 
65
93
  onReadOnlyChange(val) {
@@ -1,3 +1,4 @@
1
+ import { EnrichedTextClass } from '@descope-ui/descope-enriched-text/class';
1
2
  import { getComponentName } from '../../../helpers/componentHelpers';
2
3
  import { compose } from '../../../helpers';
3
4
  import {
@@ -24,7 +25,9 @@ const {
24
25
  errorMessage,
25
26
  } = {
26
27
  host: { selector: () => ':host' },
27
- requiredIndicator: { selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::after' },
28
+ requiredIndicator: {
29
+ selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::part(content)::after',
30
+ },
28
31
  component: { selector: 'vaadin-checkbox' },
29
32
  checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
30
33
  checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
@@ -70,6 +73,16 @@ export const CheckboxClass = compose(
70
73
  inputOutlineColor: { ...checkboxElement, property: 'outline-color' },
71
74
  inputOutlineStyle: { ...checkboxElement, property: 'outline-style' },
72
75
 
76
+ inputContainerPadding: { ...component, property: 'padding' },
77
+ inputContainerBorderRadius: { ...component, property: 'border-radius' },
78
+ inputContainerBorderWidth: { ...component, property: 'border-width' },
79
+ inputContainerBorderColor: { ...component, property: 'border-color' },
80
+ inputContainerBorderStyle: { ...component, property: 'border-style' },
81
+ inputContainerOutlineWidth: { ...component, property: 'outline-width' },
82
+ inputContainerOutlineOffset: { ...component, property: 'outline-offset' },
83
+ inputContainerOutlineColor: { ...component, property: 'outline-color' },
84
+ inputContainerOutlineStyle: { ...component, property: 'outline-style' },
85
+
73
86
  inputSize: [
74
87
  { ...checkboxElement, property: 'width' },
75
88
  { ...checkboxElement, property: 'height' },
@@ -87,7 +100,7 @@ export const CheckboxClass = compose(
87
100
  slots: [],
88
101
  wrappedEleName: 'vaadin-text-field',
89
102
  style: () => `
90
- ${commonStyles}
103
+ ${commonStyles(CheckboxClass.cssVarList)}
91
104
  ${useHostExternalPadding(CheckboxClass.cssVarList)}
92
105
 
93
106
  :host {
@@ -1,6 +1,7 @@
1
1
  import { componentName, CheckboxClass } from './CheckboxClass';
2
2
  import '@vaadin/checkbox';
3
3
  import '@vaadin/text-field';
4
+ import '@descope-ui/descope-enriched-text';
4
5
  import '../descope-boolean-field-internal';
5
6
 
6
7
  customElements.define(componentName, CheckboxClass);
@@ -1,3 +1,4 @@
1
+ import { EnrichedTextClass } from '@descope-ui/descope-enriched-text/class';
1
2
  import { getComponentName } from '../../../helpers/componentHelpers';
2
3
  import { compose } from '../../../helpers';
3
4
  import {
@@ -24,7 +25,9 @@ const {
24
25
  errorMessage,
25
26
  } = {
26
27
  host: { selector: () => ':host' },
27
- requiredIndicator: { selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::after' },
28
+ requiredIndicator: {
29
+ selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::part(content)::after',
30
+ },
28
31
  component: { selector: 'vaadin-checkbox' },
29
32
  checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
30
33
  checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
@@ -97,7 +100,7 @@ export const SwitchToggleClass = compose(
97
100
  slots: [],
98
101
  wrappedEleName: 'vaadin-text-field',
99
102
  style: () => `
100
- ${commonStyles}
103
+ ${commonStyles(SwitchToggleClass.cssVarList)}
101
104
  ${useHostExternalPadding(SwitchToggleClass.cssVarList)}
102
105
 
103
106
  :host {
@@ -1,6 +1,7 @@
1
1
  import { componentName, SwitchToggleClass } from './SwitchToggleClass';
2
2
  import '@vaadin/checkbox';
3
3
  import '@vaadin/text-field';
4
+ import '@descope-ui/descope-enriched-text';
4
5
  import '../descope-boolean-field-internal';
5
6
 
6
7
  customElements.define(componentName, SwitchToggleClass);
@@ -1,7 +1,17 @@
1
1
  import { camelCaseJoin, isFunction, kebabCase, kebabCaseJoin } from '../../helpers';
2
2
  import { getCssVarName } from '../../helpers/componentHelpers';
3
3
 
4
- const createCssVar = (varName, fallback) => `var(${varName}${fallback ? `, ${fallback}` : ''})`;
4
+ const getOverrideCssVarName = (origVarName) => `${origVarName}__override`;
5
+
6
+ const createCssVar = (varName, fallback, createOverride = false) => {
7
+ const ret = `var(${varName}${fallback ? `, ${fallback}` : ''})`;
8
+
9
+ if (!createOverride) return ret;
10
+
11
+ // we are generating an override css var to allow override with fallback to the default var
12
+ const overrideVarName = getOverrideCssVarName(varName);
13
+ return `var(${overrideVarName}, ${ret})`;
14
+ };
5
15
 
6
16
  const createCssSelector = (baseSelector = '', relativeSelectorOrSelectorFn = '') =>
7
17
  isFunction(relativeSelectorOrSelectorFn)
@@ -50,6 +60,7 @@ const getFallbackVarName = (origVarName, suffix = 'fallback') => kebabCaseJoin(o
50
60
 
51
61
  export const createStyle = (componentName, baseSelector, mappings) => {
52
62
  const style = new StyleBuilder();
63
+ // we generate all the fallback vars recursively
53
64
  const createFallbackVar = (fallback, origVarName) => {
54
65
  if (!fallback) return '';
55
66
  if (typeof fallback === 'string') return fallback;
@@ -69,7 +80,7 @@ export const createStyle = (componentName, baseSelector, mappings) => {
69
80
  style.add(
70
81
  createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
71
82
  isFunction(property) ? property() : property,
72
- createCssVar(cssVarName, fallbackValue) + (important ? '!important' : '')
83
+ createCssVar(cssVarName, fallbackValue, true) + (important ? '!important' : '')
73
84
  );
74
85
  }
75
86
  );
@@ -96,6 +107,8 @@ export const createCssVarsList = (componentName, mappings) =>
96
107
  return Object.assign(
97
108
  acc,
98
109
  { [attr]: varName },
110
+ // we are exposing the override css var names, the convention is to add 'Override' suffix to the attribute name
111
+ { [attr + 'Override']: getOverrideCssVarName(varName) },
99
112
  getFallbackVarsNames(attr, varName, mappings[attr])
100
113
  );
101
114
  }, {});