@descope/flow-components 2.0.457 → 2.0.459

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 (2) hide show
  1. package/dist/index.cjs.js +66 -31
  2. package/package.json +3 -3
package/dist/index.cjs.js CHANGED
@@ -93856,7 +93856,7 @@ descope-boolean-field-internal {
93856
93856
  vars: vars$3
93857
93857
  });
93858
93858
 
93859
- var clockIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNNiAwQzIuNyAwIDAgMi43IDAgNkMwIDkuMyAyLjcgMTIgNiAxMkM5LjMgMTIgMTIgOS4zIDEyIDZDMTIgMi43IDkuMyAwIDYgMFpNNiAxMC41QzMuNTI1IDEwLjUgMS41IDguNDc1IDEuNSA2QzEuNSAzLjUyNSAzLjUyNSAxLjUgNiAxLjVDOC40NzUgMS41IDEwLjUgMy41MjUgMTAuNSA2QzEwLjUgOC40NzUgOC40NzUgMTAuNSA2IDEwLjVaIiBmaWxsPSIjMTgxQTFDIi8+CiAgPHBhdGggZD0iTTYgMi4yNUg1LjI1VjYuNzVIOVY2SDZWMi4yNVoiIGZpbGw9IiMxODFBMUMiLz4KPC9zdmc+Cg==";
93859
+ var clockIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwMSAxMDEiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+CjxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+Cjwvc3ZnPgo=";
93860
93860
 
93861
93861
  const fmt = (val, pad = 2) => String(val).padStart(pad, '0');
93862
93862
 
@@ -93877,7 +93877,7 @@ descope-boolean-field-internal {
93877
93877
 
93878
93878
  const componentName$3 = getComponentName('timer');
93879
93879
 
93880
- const observedAttributes$1 = ['seconds', 'hide-icon'];
93880
+ const observedAttributes$1 = ['seconds', 'hide-icon', 'paused'];
93881
93881
 
93882
93882
  const BaseClass$2 = createBaseClass$1({
93883
93883
  componentName: componentName$3,
@@ -93935,57 +93935,63 @@ descope-boolean-field-internal {
93935
93935
  return Math.max(0, secs);
93936
93936
  }
93937
93937
 
93938
+ // we use `pause` attribute for allowing preview mode by executing `pause`
93939
+ get isPaused() {
93940
+ return this.getAttribute('paused') === 'true';
93941
+ }
93942
+
93938
93943
  init() {
93939
93944
  super.init?.();
93940
93945
 
93941
93946
  this.#timeRemains = this.seconds;
93942
93947
  }
93943
93948
 
93944
- start() {
93945
- this.dispatchEvent(new CustomEvent('timer-started', { bubbles: true }));
93946
-
93947
- this.startInterval();
93948
- }
93949
-
93950
- startInterval() {
93949
+ startInterval() {
93951
93950
  const intervalCycle = () => {
93951
+ this.#decreaseInterval();
93952
+ if (!this.#timeRemains) this.stop();
93952
93953
  this.#updateDisplay(this.#timeRemains);
93953
-
93954
- if (!this.#timeRemains) {
93955
- this.stop();
93956
- } else {
93957
- this.#decreaseInterval();
93958
- }
93959
93954
  };
93960
93955
 
93961
- intervalCycle();
93962
-
93963
93956
  if (this.#timeRemains) {
93964
93957
  this.#intervalId = setInterval(intervalCycle, DEFAULT_INTERVAL);
93958
+ } else {
93959
+ this.stop();
93965
93960
  }
93966
93961
  }
93967
93962
 
93963
+ stopInterval() {
93964
+ clearInterval(this.#intervalId);
93965
+ }
93966
+
93968
93967
  #decreaseInterval() {
93969
- this.#timeRemains = Math.max(this.#timeRemains - DEFAULT_INTERVAL, 0);
93968
+ this.#timeRemains = this.#timeRemains - DEFAULT_INTERVAL;
93970
93969
  }
93971
93970
 
93972
93971
  reset() {
93973
93972
  this.#timeRemains = this.seconds;
93974
- this.start();
93973
+ this.#updateDisplay(this.#timeRemains);
93974
+
93975
+ if (this.isPaused) return;
93976
+
93977
+ this.dispatchEvent(new CustomEvent('timer-started', { bubbles: true }));
93978
+ this.startInterval();
93975
93979
  }
93976
93980
 
93977
93981
  stop() {
93978
- this.pause();
93982
+ this.stopInterval();
93979
93983
  this.#timeRemains = 0;
93980
93984
  this.#updateDisplay(this.#timeRemains);
93981
93985
  this.dispatchEvent(new CustomEvent('timer-ended', { bubbles: true }));
93982
93986
  }
93983
93987
 
93984
93988
  pause() {
93985
- clearInterval(this.#intervalId);
93989
+ this.setAttribute('paused', 'true');
93990
+ this.stopInterval();
93986
93991
  }
93987
93992
 
93988
93993
  resume() {
93994
+ this.removeAttribute('paused');
93989
93995
  this.startInterval();
93990
93996
  }
93991
93997
 
@@ -93997,6 +94003,19 @@ descope-boolean-field-internal {
93997
94003
  this.icon.classList.toggle('hidden', val === 'true');
93998
94004
  }
93999
94005
 
94006
+ #handlePause(paused) {
94007
+ setTimeout(() => {
94008
+ if (paused) {
94009
+ this.pause();
94010
+ } else {
94011
+ // we want to prevent a another interval from starting in case previous interval was not yet cleared
94012
+ if (!this.#intervalId) {
94013
+ this.resume();
94014
+ }
94015
+ }
94016
+ });
94017
+ }
94018
+
94000
94019
  attributeChangedCallback(attrName, oldValue, newValue) {
94001
94020
  super.attributeChangedCallback?.(attrName, oldValue, newValue);
94002
94021
 
@@ -94007,28 +94026,31 @@ descope-boolean-field-internal {
94007
94026
  if (attrName === 'hide-icon') {
94008
94027
  this.#toggleIcon(newValue);
94009
94028
  }
94029
+ if (attrName === 'paused') {
94030
+ this.#handlePause(newValue === 'true');
94031
+ }
94010
94032
  }
94011
94033
  }
94012
94034
  }
94013
94035
 
94014
94036
  const { host: host$1, icon, timer: timer$2 } = {
94015
94037
  host: { selector: () => ':host' },
94016
- icon: { selector: '.icon' },
94017
- timer: { selector: '.timer' },
94038
+ icon: { selector: () => '.icon' },
94039
+ timer: { selector: () => '.timer' },
94018
94040
  };
94019
94041
 
94020
94042
  const TimerClass = compose(
94021
94043
  createStyleMixin$1({
94022
94044
  mappings: {
94023
- backgroundColor: {},
94024
- fontSize: [{}, { ...icon }],
94045
+ fontSize: {},
94025
94046
  iconSize: [
94026
94047
  { ...icon, property: 'width' },
94027
94048
  { ...icon, property: 'height' },
94028
94049
  ],
94029
94050
  fontFamily: {},
94051
+ minHeight: {},
94030
94052
  fontWeight: { ...timer$2 },
94031
- lineHeight: { property: 'min-height' },
94053
+ lineHeight: { ...timer$2 },
94032
94054
  textColor: { ...timer$2, property: 'color' },
94033
94055
  gap: {},
94034
94056
  textAlign: { property: 'justify-content' },
@@ -94048,7 +94070,8 @@ descope-boolean-field-internal {
94048
94070
  [vars$2.hostDirection]: globalRefs$1.direction,
94049
94071
  [vars$2.gap]: '0.25em',
94050
94072
  [vars$2.fontFamily]: globalRefs$1.fonts.font1.family,
94051
- [vars$2.lineHeight]: '2em',
94073
+ [vars$2.minHeight]: '1.5em',
94074
+ [vars$2.lineHeight]: '1em',
94052
94075
  [vars$2.fontWeight]: globalRefs$1.fonts.font1.fontWeight,
94053
94076
  [vars$2.textColor]: globalRefs$1.colors.surface.contrast,
94054
94077
  [vars$2.iconColor]: globalRefs$1.colors.surface.contrast,
@@ -94096,6 +94119,7 @@ descope-boolean-field-internal {
94096
94119
  const timerAttrs = [
94097
94120
  'timer-seconds',
94098
94121
  'timer-hide-icon',
94122
+ 'timer-paused',
94099
94123
  'size',
94100
94124
  'text-align',
94101
94125
  'full-width',
@@ -94104,6 +94128,7 @@ descope-boolean-field-internal {
94104
94128
  const mapTimerAttrs = {
94105
94129
  'timer-seconds': 'seconds',
94106
94130
  'timer-hide-icon': 'hide-icon',
94131
+ 'timer-paused': 'paused',
94107
94132
  };
94108
94133
 
94109
94134
  const BaseClass$1 = createBaseClass$1({
@@ -94118,7 +94143,7 @@ descope-boolean-field-internal {
94118
94143
  this.attachShadow({ mode: 'open' }).innerHTML = `
94119
94144
  <div class="wrapper">
94120
94145
  <descope-timer class="timer"></descope-timer>
94121
- <descope-button class="button">
94146
+ <descope-button class="button" disabled="true">
94122
94147
  <slot></slot>
94123
94148
  </descope-button>
94124
94149
  </div>
@@ -94164,6 +94189,14 @@ descope-boolean-field-internal {
94164
94189
  includeAttrs: timerAttrs,
94165
94190
  mapAttrs: mapTimerAttrs,
94166
94191
  });
94192
+
94193
+ // When we sync attributes, the `disabled` attribute is being compared to the attribute
94194
+ // on Vaadin component; since the Vaadin component has no `disabled` attribute, we sync
94195
+ // that back to our component.
94196
+ // This is pending a more generic fix in the way we sync attibutes.
94197
+ this.button.shadowRoot
94198
+ .querySelector('vaadin-button')
94199
+ .setAttribute('disabled', 'true');
94167
94200
  }
94168
94201
 
94169
94202
  onTimerStarted() {
@@ -94179,9 +94212,11 @@ descope-boolean-field-internal {
94179
94212
  }
94180
94213
 
94181
94214
  toggleButtonDisable(isDisabled) {
94182
- isDisabled
94183
- ? this.button.setAttribute('disabled', 'true')
94184
- : this.button.removeAttribute('disabled');
94215
+ setTimeout(() => {
94216
+ isDisabled
94217
+ ? this.button.setAttribute('disabled', 'true')
94218
+ : this.button.removeAttribute('disabled');
94219
+ });
94185
94220
  }
94186
94221
  }
94187
94222
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "2.0.457",
3
+ "version": "2.0.459",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -68,7 +68,7 @@
68
68
  "eslint-config-airbnb-typescript": "18.0.0",
69
69
  "eslint-config-prettier": "10.0.1",
70
70
  "eslint-config-standard": "17.1.0",
71
- "eslint-import-resolver-typescript": "3.8.2",
71
+ "eslint-import-resolver-typescript": "3.8.3",
72
72
  "eslint-plugin-import": "2.31.0",
73
73
  "eslint-plugin-jest": "28.11.0",
74
74
  "eslint-plugin-jest-dom": "5.5.0",
@@ -104,7 +104,7 @@
104
104
  "typescript": "^5.7.2"
105
105
  },
106
106
  "dependencies": {
107
- "@descope/web-components-ui": "1.43.0"
107
+ "@descope/web-components-ui": "1.44.0"
108
108
  },
109
109
  "peerDependencies": {
110
110
  "react": ">= 18"