@descope-ui/descope-badge 3.7.0 → 3.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope-ui/descope-badge",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "files": [
5
5
  "src",
6
6
  "stories"
@@ -18,13 +18,13 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@playwright/test": "1.58.2",
21
- "e2e-utils": "3.7.0",
22
- "test-assets": "3.7.0",
23
- "test-drivers": "3.7.0"
21
+ "e2e-utils": "3.7.1",
22
+ "test-assets": "3.7.1",
23
+ "test-drivers": "3.7.1"
24
24
  },
25
25
  "dependencies": {
26
- "@descope-ui/common": "3.7.0",
27
- "@descope-ui/theme-globals": "3.7.0"
26
+ "@descope-ui/theme-globals": "3.7.1",
27
+ "@descope-ui/common": "3.7.1"
28
28
  },
29
29
  "publishConfig": {
30
30
  "link-workspace-packages": false
@@ -16,6 +16,10 @@ class RawBadge extends createBaseClass({
16
16
  componentName,
17
17
  baseSelector: ':host > div',
18
18
  }) {
19
+ static get observedAttributes() {
20
+ return ['data-attachment-size', 'shrink-to-indicator-threshold'];
21
+ }
22
+
19
23
  constructor() {
20
24
  super();
21
25
 
@@ -41,6 +45,24 @@ class RawBadge extends createBaseClass({
41
45
  this,
42
46
  );
43
47
  }
48
+
49
+ get shrinkToIndicatorThreshold() {
50
+ return this.getAttribute('shrink-to-indicator-threshold') || 65;
51
+ }
52
+
53
+ #handleShrinkToIndicator(value) {
54
+ this.toggleAttribute(
55
+ 'shrink-to-indicator',
56
+ parseFloat(value) < this.shrinkToIndicatorThreshold,
57
+ );
58
+ }
59
+
60
+ attributeChangedCallback(name, oldVal, newVal) {
61
+ super.attributeChangedCallback?.(name, oldVal, newVal);
62
+ if (name === 'data-attachment-size' && oldVal !== newVal) {
63
+ this.#handleShrinkToIndicator(newVal);
64
+ }
65
+ }
44
66
  }
45
67
 
46
68
  export const BadgeClass = compose(
package/src/theme.js CHANGED
@@ -54,18 +54,26 @@ const badge = {
54
54
  },
55
55
  },
56
56
 
57
- $breakpoints: {
58
- indicator: '(max-width: 65px)',
59
- },
57
+ // Container Query example:
58
+ // $breakpoints: {
59
+ // indicator: '(max-width: 65px)',
60
+ // },
61
+ // _shrinkToIndicator: {
62
+ // '$breakpoints.indicator': {
63
+ // [vars.hostWidth]: '13px',
64
+ // [vars.hostHeight]: '13px',
65
+ // [vars.borderRadius]: '50%',
66
+ // [vars.fontSize]: '0',
67
+ // [vars.textIndent]: '-9999px',
68
+ // },
69
+ // },
60
70
 
61
71
  _shrinkToIndicator: {
62
- '$breakpoints.indicator': {
63
- [vars.hostWidth]: '13px',
64
- [vars.hostHeight]: '13px',
65
- [vars.borderRadius]: '50%',
66
- [vars.fontSize]: '0',
67
- [vars.textIndent]: '-9999px',
68
- },
72
+ [vars.hostWidth]: '13px',
73
+ [vars.hostHeight]: '13px',
74
+ [vars.borderRadius]: '50%',
75
+ [vars.fontSize]: '0',
76
+ [vars.textIndent]: '-9999px',
69
77
  },
70
78
 
71
79
  mode: {