@descope-ui/descope-badge 3.1.13 → 3.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.2.0](https://github.com/descope/web-components-ui/compare/web-components-ui-3.1.13...web-components-ui-3.2.0) (2026-04-16)
6
+
7
+
8
+ ### Features
9
+
10
+ * add descope-last-auth-badge component ([#982](https://github.com/descope/web-components-ui/issues/982)) ([055b461](https://github.com/descope/web-components-ui/commit/055b4618abbdf518494a2984e56d66e58fdb4809))
11
+
5
12
  ## [3.1.13](https://github.com/descope/web-components-ui/compare/web-components-ui-3.1.12...web-components-ui-3.1.13) (2026-04-15)
6
13
 
7
14
  ## [3.1.12](https://github.com/descope/web-components-ui/compare/web-components-ui-3.1.11...web-components-ui-3.1.12) (2026-04-15)
@@ -7,7 +7,9 @@ const componentAttributes = {
7
7
  bordered: ['true', 'false'],
8
8
  mode: ['default', 'primary', 'secondary', 'success', 'error'],
9
9
  size: ['xs', 'sm', 'md', 'lg'],
10
+ variant: ['contained'],
10
11
  'full-width': ['true', 'false'],
12
+ 'shrink-to-indicator': ['true'],
11
13
  };
12
14
 
13
15
  const storyName = 'descope-badge';
@@ -24,6 +26,16 @@ test.describe('theme', () => {
24
26
  });
25
27
  });
26
28
 
29
+ ['sm', 'md', 'lg', 'xl'].forEach((shadow) => {
30
+ test(`shadow: ${shadow}`, async ({ page }) => {
31
+ await page.goto(getStoryUrl(storyName, { shadow }), {
32
+ waitUntil: 'networkidle',
33
+ });
34
+ const component = createBadgeTestDriver(page.locator(componentName));
35
+ expect(await component.screenshot({ padding: 20 })).toMatchSnapshot();
36
+ });
37
+ });
38
+
27
39
  test(`direction: rtl`, async ({ page }) => {
28
40
  await page.goto(
29
41
  getStoryUrl(storyName, { direction: 'rtl', text: `-Label` }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope-ui/descope-badge",
3
- "version": "3.1.13",
3
+ "version": "3.2.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./src/component/index.js"
@@ -14,13 +14,13 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@playwright/test": "1.58.2",
17
- "e2e-utils": "3.1.13",
18
- "test-assets": "3.1.13",
19
- "test-drivers": "3.1.13"
17
+ "e2e-utils": "3.2.0",
18
+ "test-assets": "3.2.0",
19
+ "test-drivers": "3.2.0"
20
20
  },
21
21
  "dependencies": {
22
- "@descope-ui/common": "3.1.13",
23
- "@descope-ui/theme-globals": "3.1.13"
22
+ "@descope-ui/common": "3.2.0",
23
+ "@descope-ui/theme-globals": "3.2.0"
24
24
  },
25
25
  "publishConfig": {
26
26
  "link-workspace-packages": false
@@ -4,9 +4,11 @@ import {
4
4
  draggableMixin,
5
5
  } from '@descope-ui/common/components-mixins';
6
6
  import { createBaseClass } from '@descope-ui/common/base-classes';
7
- import { getComponentName } from '@descope-ui/common/components-helpers';
7
+ import {
8
+ getComponentName,
9
+ injectStyle,
10
+ } from '@descope-ui/common/components-helpers';
8
11
  import { compose } from '@descope-ui/common/utils';
9
- import { injectStyle } from '@descope-ui/common/components-helpers';
10
12
 
11
13
  export const componentName = getComponentName('badge');
12
14
 
@@ -29,6 +31,7 @@ class RawBadge extends createBaseClass({
29
31
  display: inline-flex;
30
32
  }
31
33
  :host > div {
34
+ position: relative;
32
35
  width: 100%;
33
36
  text-overflow: ellipsis;
34
37
  overflow: hidden;
@@ -44,6 +47,7 @@ export const BadgeClass = compose(
44
47
  createStyleMixin({
45
48
  mappings: {
46
49
  hostWidth: [{ selector: () => ':host', property: 'width' }],
50
+ hostHeight: [{ selector: () => ':host', property: 'height' }],
47
51
  hostDirection: { property: 'direction' },
48
52
 
49
53
  fontFamily: {},
@@ -68,6 +72,8 @@ export const BadgeClass = compose(
68
72
 
69
73
  textColor: { property: 'color' },
70
74
  textAlign: {},
75
+ boxShadow: {},
76
+ textIndent: {},
71
77
  },
72
78
  }),
73
79
  draggableMixin,
package/src/theme.js CHANGED
@@ -1,12 +1,26 @@
1
1
  import globals from '@descope-ui/theme-globals';
2
- import { getThemeRefs } from '@descope-ui/common/theme-helpers';
3
- import { BadgeClass } from './component/BadgeClass';
2
+ import {
3
+ getThemeRefs,
4
+ createHelperVars,
5
+ } from '@descope-ui/common/theme-helpers';
6
+ import { BadgeClass, componentName } from './component/BadgeClass';
4
7
 
5
8
  const globalRefs = getThemeRefs(globals);
6
9
 
10
+ const [helperTheme, helperRefs] = createHelperVars(
11
+ {
12
+ shadowColor: '#00000020', // if we want to support transparency vars, we should use different color format
13
+ },
14
+ componentName,
15
+ );
16
+
17
+ const { shadowColor } = helperRefs;
18
+
7
19
  const vars = BadgeClass.cssVarList;
8
20
 
9
21
  const badge = {
22
+ ...helperTheme,
23
+
10
24
  [vars.hostWidth]: 'fit-content',
11
25
  [vars.hostDirection]: globalRefs.direction,
12
26
 
@@ -34,6 +48,26 @@ const badge = {
34
48
  lg: { [vars.fontSize]: '18px' },
35
49
  },
36
50
 
51
+ variant: {
52
+ contained: {
53
+ [vars.backgroundColor]: globalRefs.colors.surface.main,
54
+ },
55
+ },
56
+
57
+ $breakpoints: {
58
+ indicator: '(max-width: 65px)',
59
+ },
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
+ },
70
+
37
71
  mode: {
38
72
  default: {
39
73
  [vars.textColor]: globalRefs.colors.surface.dark,
@@ -66,6 +100,21 @@ const badge = {
66
100
  },
67
101
  },
68
102
  },
103
+
104
+ shadow: {
105
+ sm: {
106
+ [vars.boxShadow]: `${globalRefs.shadow.wide.sm} ${shadowColor}, ${globalRefs.shadow.narrow.sm} ${shadowColor}`,
107
+ },
108
+ md: {
109
+ [vars.boxShadow]: `${globalRefs.shadow.wide.md} ${shadowColor}, ${globalRefs.shadow.narrow.md} ${shadowColor}`,
110
+ },
111
+ lg: {
112
+ [vars.boxShadow]: `${globalRefs.shadow.wide.lg} ${shadowColor}, ${globalRefs.shadow.narrow.lg} ${shadowColor}`,
113
+ },
114
+ xl: {
115
+ [vars.boxShadow]: `${globalRefs.shadow.wide.xl} ${shadowColor}, ${globalRefs.shadow.narrow.xl} ${shadowColor}`,
116
+ },
117
+ },
69
118
  };
70
119
 
71
120
  export default badge;
@@ -7,6 +7,7 @@ import {
7
7
  sizeControl,
8
8
  borderedControl,
9
9
  directionControl,
10
+ boxShadowControl,
10
11
  } from '@descope-ui/common/sb-controls';
11
12
 
12
13
  const Template = ({
@@ -16,13 +17,19 @@ const Template = ({
16
17
  bordered,
17
18
  text,
18
19
  direction,
20
+ shadow,
21
+ variant,
22
+ 'shrink-to-indicator': shrinkToIndicator,
19
23
  }) => `
20
24
  <descope-badge
21
25
  mode="${mode}"
22
26
  size="${size}"
23
27
  bordered="${bordered}"
28
+ shadow="${shadow ?? ''}"
24
29
  full-width="${fullWidth || false}"
25
30
  st-host-direction="${direction ?? ''}"
31
+ variant="${variant ?? ''}"
32
+ shrink-to-indicator="${shrinkToIndicator || false}"
26
33
  >
27
34
  ${text}
28
35
  </descope-badge>
@@ -35,6 +42,22 @@ export default {
35
42
  panelPosition: 'right',
36
43
  controls: { expanded: true },
37
44
  },
45
+ decorators: [
46
+ (story, { args }) => {
47
+ if (!args['shrink-to-indicator']) return story(args);
48
+ return `
49
+ <style nonce="${window.DESCOPE_NONCE}">
50
+ .wrapper {
51
+ width: 20px; overflow: hidden;
52
+ container-type: inline-size;
53
+ }
54
+ </style>
55
+ <div class="wrapper">
56
+ ${story(args)}
57
+ </div>
58
+ `;
59
+ },
60
+ ],
38
61
  argTypes: {
39
62
  ...textContentControl,
40
63
  ...modeControl,
@@ -42,10 +65,18 @@ export default {
42
65
  ...sizeControl,
43
66
  ...directionControl,
44
67
  ...borderedControl,
68
+ ...boxShadowControl,
45
69
  mode: {
46
70
  ...modeControl.mode,
47
71
  options: ['none', 'default', 'primary', 'secondary', 'success', 'error'],
48
72
  },
73
+ variant: {
74
+ control: { type: 'select' },
75
+ options: ['none', 'contained'],
76
+ },
77
+ 'shrink-to-indicator': {
78
+ control: 'boolean',
79
+ },
49
80
  },
50
81
  };
51
82
 
@@ -57,4 +88,5 @@ Default.args = {
57
88
  size: 'md',
58
89
  bordered: 'true',
59
90
  'full-width': 'false',
91
+ 'shrink-to-indicator': false,
60
92
  };