@descope-ui/descope-recovery-codes 0.0.1 → 0.0.3

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.3](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-recovery-codes-0.0.2...@descope-ui/descope-recovery-codes-0.0.3) (2025-06-30)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@descope-ui/theme-globals` updated to version `0.0.17`
10
+ * `@descope-ui/descope-text` updated to version `0.0.17`
11
+ ## [0.0.2](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-recovery-codes-0.0.1...@descope-ui/descope-recovery-codes-0.0.2) (2025-06-30)
12
+
13
+ ### Dependency Updates
14
+
15
+ * `@descope-ui/common` updated to version `0.0.16`
16
+ * `@descope-ui/theme-globals` updated to version `0.0.16`
17
+ * `@descope-ui/descope-text` updated to version `0.0.16`
5
18
  ## 0.0.1 (2025-06-29)
6
19
 
7
20
  ### Dependency Updates
@@ -7,6 +7,7 @@ const componentAttributes = {
7
7
  mode: ['primary', 'secondary', 'success', 'error'],
8
8
  'text-align': ['left', 'center', 'right'],
9
9
  'full-width': ['false', 'true'],
10
+ 'readonly': ['false', 'true'],
10
11
  itemsSource: ['attr', 'prop'],
11
12
  };
12
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope-ui/descope-recovery-codes",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./src/component/index.js"
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@vaadin/icon": "24.3.4",
22
22
  "@vaadin/icons": "24.3.4",
23
- "@descope-ui/common": "0.0.15",
24
- "@descope-ui/theme-globals": "0.0.15",
25
- "@descope-ui/descope-text": "0.0.15"
23
+ "@descope-ui/common": "0.0.16",
24
+ "@descope-ui/descope-text": "0.0.17",
25
+ "@descope-ui/theme-globals": "0.0.17"
26
26
  },
27
27
  "publishConfig": {
28
28
  "link-workspace-packages": false
@@ -11,7 +11,6 @@ import {
11
11
  injectStyle,
12
12
  } from '@descope-ui/common/components-helpers';
13
13
  import { createBaseClass } from '@descope-ui/common/base-classes';
14
- import { sortData } from './helpers';
15
14
  import { TextClass } from '@descope-ui/descope-text/class';
16
15
 
17
16
  export const componentName = getComponentName('recovery-codes');
@@ -28,6 +27,10 @@ class RawRecoveryCodes extends createBaseClass({
28
27
  componentName,
29
28
  baseSelector: ':host > div',
30
29
  }) {
30
+ static get observedAttributes() {
31
+ return ['readonly'];
32
+ }
33
+
31
34
  constructor() {
32
35
  super();
33
36
 
@@ -40,6 +43,10 @@ class RawRecoveryCodes extends createBaseClass({
40
43
  </div>
41
44
  `;
42
45
 
46
+ this.list = this.shadowRoot.querySelector('.list');
47
+ this.icon = this.shadowRoot.querySelector('.icon')
48
+ this.iconWrapper = this.shadowRoot.querySelector('.icon-wrapper')
49
+
43
50
  injectStyle(
44
51
  `
45
52
  :host {
@@ -64,14 +71,17 @@ class RawRecoveryCodes extends createBaseClass({
64
71
  content: '\\02022';
65
72
  transform: translateY(-0.06em);
66
73
  }
67
- vaadin-icon {
74
+ .icon-wrapper {
75
+ align-self: flex-start;
76
+ }
77
+ .icon {
68
78
  cursor: pointer;
69
79
  }
70
- .copied {
80
+ .icon.copied {
71
81
  cursor: initial;
72
82
  }
73
- .icon-wrapper {
74
- align-self: flex-start;
83
+ .icon.readonly {
84
+ pointer-events: none;
75
85
  }
76
86
  `,
77
87
  this,
@@ -89,9 +99,6 @@ class RawRecoveryCodes extends createBaseClass({
89
99
  init() {
90
100
  super.init();
91
101
 
92
- this.list = this.shadowRoot.querySelector('.list');
93
- this.icon = this.shadowRoot.querySelector('.icon')
94
- this.iconWrapper = this.shadowRoot.querySelector('.icon-wrapper')
95
102
 
96
103
  this.icon.addEventListener('click', this.onCopy.bind(this));
97
104
 
@@ -113,6 +120,20 @@ class RawRecoveryCodes extends createBaseClass({
113
120
  this.icon.classList.remove('copied');
114
121
  }, 5000);
115
122
  }
123
+
124
+ onReadOnly(isReadOnly) {
125
+ this.icon.classList.toggle('readonly', isReadOnly);
126
+ }
127
+
128
+ attributeChangedCallback(attrName, oldValue, newValue) {
129
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
130
+
131
+ if (newValue !== oldValue) {
132
+ if (attrName === 'readonly') {
133
+ this.onReadOnly(newValue === 'true');
134
+ }
135
+ }
136
+ }
116
137
  }
117
138
 
118
139
  export const RecoveryCodesClass = compose(
@@ -137,8 +158,7 @@ export const RecoveryCodesClass = compose(
137
158
  createDynamicDataMixin({
138
159
  itemRenderer,
139
160
  rerenderAttrsList: ['variant', 'mode'],
140
- targetSelector: '.list',
141
- sortFn: sortData
161
+ targetSelector: '.list'
142
162
  }),
143
163
  draggableMixin,
144
164
  componentNameValidationMixin,
@@ -5,6 +5,7 @@ import {
5
5
  fullWidthControl,
6
6
  typographyVariantControl,
7
7
  directionControl,
8
+ readOnlyControl,
8
9
  } from '@descope-ui/common/sb-controls';
9
10
 
10
11
  const serializedData = [
@@ -26,6 +27,7 @@ const Template = ({
26
27
  'text-align': textAlign,
27
28
  'full-width': fullWidth,
28
29
  direction,
30
+ readonly,
29
31
  }) => `
30
32
  <descope-recovery-codes
31
33
  data='${(itemsSource === 'attr' && serializedData) || ''}'
@@ -33,6 +35,7 @@ const Template = ({
33
35
  variant="${variant || ''}"
34
36
  full-width="${fullWidth || false}"
35
37
  text-align="${textAlign}"
38
+ readonly="${readonly || false}"
36
39
  st-host-direction="${direction ?? ''}"
37
40
  ></descope-recovery-codes>
38
41
  `;
@@ -68,6 +71,7 @@ export default {
68
71
  ...fullWidthControl,
69
72
  ...typographyVariantControl,
70
73
  ...directionControl,
74
+ ...readOnlyControl,
71
75
  itemsSource: {
72
76
  name: 'Where to take the items from',
73
77
  control: {
@@ -1 +0,0 @@
1
- export const sortData = (a, b) => a.value.localeCompare(b.value)