@channel.io/bezier-react 3.0.2 → 3.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,kGA+BjB,CAAA"}
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,kGAgCjB,CAAA"}
@@ -8,6 +8,12 @@ interface BadgeOwnProps {
8
8
  * Icon to be shown on the left side of the badge.
9
9
  */
10
10
  icon?: BezierIcon;
11
+ /**
12
+ * Whether the text is truncated.
13
+ * If it is a positive integer, it means the maximum number of lines.
14
+ * @default false
15
+ */
16
+ truncated?: boolean | number;
11
17
  }
12
18
  export interface BadgeProps extends BezierComponentProps<'div'>, ChildrenProps, SizeProps<BadgeSize>, VariantProps<BadgeVariant>, BadgeOwnProps {
13
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,0BAAyB;AAE1B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,wBAAqC;AAEtC,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAE9C,UAAU,aAAa;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB;AAED,MAAM,WAAW,UACf,SAAQ,oBAAoB,CAAC,KAAK,CAAC,EACjC,aAAa,EACb,SAAS,CAAC,SAAS,CAAC,EACpB,YAAY,CAAC,YAAY,CAAC,EAC1B,aAAa;CAAG"}
1
+ {"version":3,"file":"Badge.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,0BAAyB;AAE1B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,wBAAqC;AAEtC,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAE9C,UAAU,aAAa;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,UACf,SAAQ,oBAAoB,CAAC,KAAK,CAAC,EACjC,aAAa,EACb,SAAS,CAAC,SAAS,CAAC,EACpB,YAAY,CAAC,YAAY,CAAC,EAC1B,aAAa;CAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@channel.io/bezier-react",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "React components library that implements Bezier design system.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,7 +64,7 @@
64
64
  "@babel/preset-env": "^7.26.0",
65
65
  "@babel/preset-react": "^7.26.3",
66
66
  "@babel/preset-typescript": "^7.26.0",
67
- "@channel.io/bezier-icons": "0.39.0",
67
+ "@channel.io/bezier-icons": "0.40.0",
68
68
  "@chromatic-com/storybook": "^3.2.2",
69
69
  "@figma/code-connect": "^1.2.4",
70
70
  "@rollup/plugin-alias": "^5.1.1",
@@ -1,6 +1,8 @@
1
1
  import { AppleIcon } from '@channel.io/bezier-icons'
2
2
  import { type Meta, type StoryFn, type StoryObj } from '@storybook/react'
3
3
 
4
+ import { Box } from '~/src/components/Box'
5
+
4
6
  import { Badge } from './Badge'
5
7
  import { type BadgeProps } from './Badge.types'
6
8
 
@@ -14,6 +16,12 @@ const Template: StoryFn<BadgeProps> = ({ children, ...badgeProps }) => (
14
16
  <Badge {...badgeProps}>{children}</Badge>
15
17
  )
16
18
 
19
+ const Truncated: StoryFn<BadgeProps> = ({ children, ...badgeProps }) => (
20
+ <Box width={200}>
21
+ <Badge {...badgeProps}>{children}</Badge>
22
+ </Box>
23
+ )
24
+
17
25
  export const Primary: StoryObj<BadgeProps> = {
18
26
  render: Template,
19
27
 
@@ -23,4 +31,24 @@ export const Primary: StoryObj<BadgeProps> = {
23
31
  icon: AppleIcon,
24
32
  variant: 'default',
25
33
  },
34
+ argTypes: {
35
+ truncated: {
36
+ table: {
37
+ disable: true,
38
+ },
39
+ },
40
+ },
41
+ }
42
+
43
+ export const Secondary: StoryObj<BadgeProps> = {
44
+ render: Truncated,
45
+
46
+ args: {
47
+ children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
48
+ size: 'm',
49
+ icon: AppleIcon,
50
+ variant: 'default',
51
+ truncated: true,
52
+ },
53
+ name: 'Truncated',
26
54
  }
@@ -26,7 +26,7 @@ export const BADGE_TEST_ID = 'bezier-badge'
26
26
  */
27
27
  export const Badge = memo(
28
28
  forwardRef<HTMLDivElement, BadgeProps>(function Badge(
29
- { size = 'm', variant = 'default', icon, children, ...rest },
29
+ { size = 'm', variant = 'default', truncated ,icon, children, ...rest },
30
30
  forwardedRef
31
31
  ) {
32
32
  return (
@@ -48,6 +48,7 @@ export const Badge = memo(
48
48
  <BaseTagBadgeText
49
49
  size={size}
50
50
  marginHorizontal={3}
51
+ truncated={truncated}
51
52
  >
52
53
  {children}
53
54
  </BaseTagBadgeText>
@@ -21,6 +21,12 @@ interface BadgeOwnProps {
21
21
  * Icon to be shown on the left side of the badge.
22
22
  */
23
23
  icon?: BezierIcon
24
+ /**
25
+ * Whether the text is truncated.
26
+ * If it is a positive integer, it means the maximum number of lines.
27
+ * @default false
28
+ */
29
+ truncated?: boolean | number
24
30
  }
25
31
 
26
32
  export interface BadgeProps
@@ -7,6 +7,8 @@
7
7
  min-width: 200px;
8
8
  padding: 12px;
9
9
 
10
+ text-align: left;
11
+
10
12
  border-radius: var(--radius-12);
11
13
 
12
14
  &:where(.variant-default) {