@team-monolith/cds 1.126.0 → 1.127.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.
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ export declare const badgeClasses: {
3
+ readonly root: "Badge";
4
+ readonly icon: "Badge-icon";
5
+ readonly label: "Badge-label";
6
+ };
7
+ export interface BadgeProps {
8
+ className?: string;
9
+ component?: React.ElementType;
10
+ /** 컴포넌트 내 표기될 문자열 */
11
+ label: React.ReactNode;
12
+ /** 컴포넌트 좌측에 표기될 아이콘 */
13
+ icon?: React.ReactNode;
14
+ }
15
+ /**
16
+ * Badge 컴포넌트
17
+ * [피그마](https://www.figma.com/design/UD08wln8CwDoCMGFBIGTiZ/CDS?node-id=6586-3001)
18
+ */
19
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,55 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
+ /** @jsxImportSource @emotion/react */
14
+ import { css, useTheme } from "@emotion/react";
15
+ import styled from "@emotion/styled";
16
+ import React from "react";
17
+ export const badgeClasses = {
18
+ root: "Badge",
19
+ icon: "Badge-icon",
20
+ label: "Badge-label",
21
+ };
22
+ /**
23
+ * Badge 컴포넌트
24
+ * [피그마](https://www.figma.com/design/UD08wln8CwDoCMGFBIGTiZ/CDS?node-id=6586-3001)
25
+ */
26
+ export const Badge = React.forwardRef(function Badge(props, ref) {
27
+ const { className, component: Component = "span", label, icon } = props, other = __rest(props, ["className", "component", "label", "icon"]);
28
+ const theme = useTheme();
29
+ return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: [badgeClasses.root, className].filter(Boolean).join(" "), css: css `
30
+ width: fit-content;
31
+ display: inline-flex;
32
+ align-items: center;
33
+ gap: 2px;
34
+ padding: 2px 8px 2px 6px;
35
+ border-radius: 22px;
36
+ font-family: ${theme.fontFamily.ui};
37
+ `, children: [icon && _jsx(IconWrapper, { className: badgeClasses.icon, children: icon }), _jsx(Label, { className: badgeClasses.label, children: label })] })));
38
+ });
39
+ const IconWrapper = styled.span `
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ width: 14px;
44
+ height: 14px;
45
+
46
+ svg {
47
+ width: 14px;
48
+ height: 14px;
49
+ }
50
+ `;
51
+ const Label = styled.span `
52
+ font-size: 12px;
53
+ font-weight: 600;
54
+ line-height: 18px;
55
+ `;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../@types/emotion.d.ts" preserve="true" />
2
2
  export * from "./components/AlertDialog";
3
+ export * from "./components/Badge";
3
4
  export * from "./components/DecoratedNumber";
4
5
  export * from "./components/Banner";
5
6
  export * from "./components/Book";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../../@types/emotion.d.ts" preserve="true"/>
2
2
  export * from "./components/AlertDialog";
3
+ export * from "./components/Badge";
3
4
  export * from "./components/DecoratedNumber";
4
5
  export * from "./components/Banner";
5
6
  export * from "./components/Book";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.126.0",
3
+ "version": "1.127.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,