@tide-design/components 0.15.0 → 0.17.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/dist/Badge/Badge.d.ts +5 -2
- package/dist/Badge/Badge.js +20 -6
- package/package.json +3 -3
package/dist/Badge/Badge.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Color, FillVariant, Size } from "../types.js";
|
|
|
2
2
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
3
3
|
type BadgeVariant = Extract<FillVariant, "subtle" | "solid"> | "faint";
|
|
4
4
|
type BadgeSize = Extract<Size, "sm" | "md">;
|
|
5
|
+
type BadgeShape = "rounded" | "pill";
|
|
5
6
|
export interface BadgeOwnProps {
|
|
6
7
|
/** 상태를 말하는 텍스트. 색만으로 상태를 전하지 않도록 필수다(WCAG 1.4.1). */
|
|
7
8
|
children: ReactNode;
|
|
@@ -9,13 +10,15 @@ export interface BadgeOwnProps {
|
|
|
9
10
|
variant?: BadgeVariant;
|
|
10
11
|
/** `sm` 높이 20px, `md` 24px. 기본값 `md`. */
|
|
11
12
|
size?: BadgeSize;
|
|
13
|
+
/** `rounded`(모서리 4px, 기본값), `pill`(양끝이 둥근 알약 모양). 한 화면에서는 하나로 맞춘다. */
|
|
14
|
+
shape?: BadgeShape;
|
|
12
15
|
/** 색 이름. 상태는 Role, 뜻 없는 분류는 색 계열 이름(앱 등록 포함). 기본값 `neutral`. */
|
|
13
16
|
color?: Color;
|
|
14
17
|
}
|
|
15
18
|
export interface BadgeProps extends BadgeOwnProps, Omit<ComponentProps<"span">, keyof BadgeOwnProps> {}
|
|
16
19
|
/**
|
|
17
20
|
* 상태나 분류를 짧은 텍스트로 보여 주는 라벨. 뜻은 반드시 텍스트로 적는다. 서버 컴포넌트로 쓸 수 있다.
|
|
18
|
-
* Tide props: `children`, `variant`, `size`, `color` ({@link BadgeOwnProps}). 나머지는 `<span>` 속성.
|
|
21
|
+
* Tide props: `children`, `variant`, `size`, `shape`, `color` ({@link BadgeOwnProps}). 나머지는 `<span>` 속성.
|
|
19
22
|
*/
|
|
20
|
-
export declare function Badge({ variant, size, color, className, ...props }: BadgeProps): ReactElement;
|
|
23
|
+
export declare function Badge({ variant, size, shape, color, className, ...props }: BadgeProps): ReactElement;
|
|
21
24
|
export {};
|
package/dist/Badge/Badge.js
CHANGED
|
@@ -8,19 +8,33 @@ const variantClass = {
|
|
|
8
8
|
solid: "bg-accent-solid text-accent-on-solid"
|
|
9
9
|
};
|
|
10
10
|
const sizeClass = {
|
|
11
|
-
sm: "h-5 gap-1
|
|
12
|
-
md: "h-6 gap-1
|
|
11
|
+
sm: "h-5 gap-1 text-label-sm",
|
|
12
|
+
md: "h-6 gap-1 text-label-md"
|
|
13
13
|
};
|
|
14
|
-
const
|
|
14
|
+
const shapeClass = {
|
|
15
|
+
rounded: "rounded-sm",
|
|
16
|
+
pill: "rounded-full"
|
|
17
|
+
};
|
|
18
|
+
const paddingClass = {
|
|
19
|
+
rounded: {
|
|
20
|
+
sm: "px-1.5",
|
|
21
|
+
md: "px-2"
|
|
22
|
+
},
|
|
23
|
+
pill: {
|
|
24
|
+
sm: "px-2",
|
|
25
|
+
md: "px-2.5"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const baseClass = "inline-flex max-w-full shrink-0 items-center border border-transparent align-middle whitespace-nowrap [&_svg]:size-3 [&_svg]:shrink-0";
|
|
15
29
|
/**
|
|
16
30
|
* 상태나 분류를 짧은 텍스트로 보여 주는 라벨. 뜻은 반드시 텍스트로 적는다. 서버 컴포넌트로 쓸 수 있다.
|
|
17
|
-
* Tide props: `children`, `variant`, `size`, `color` ({@link BadgeOwnProps}). 나머지는 `<span>` 속성.
|
|
31
|
+
* Tide props: `children`, `variant`, `size`, `shape`, `color` ({@link BadgeOwnProps}). 나머지는 `<span>` 속성.
|
|
18
32
|
*/
|
|
19
|
-
function Badge({ variant = "subtle", size = "md", color = "neutral", className, ...props }) {
|
|
33
|
+
function Badge({ variant = "subtle", size = "md", shape = "rounded", color = "neutral", className, ...props }) {
|
|
20
34
|
return /* @__PURE__ */ jsx("span", {
|
|
21
35
|
...props,
|
|
22
36
|
"data-color": color,
|
|
23
|
-
className: cn(baseClass, variantClass[variant], sizeClass[size], className)
|
|
37
|
+
className: cn(baseClass, variantClass[variant], sizeClass[size], shapeClass[shape], paddingClass[shape][size], className)
|
|
24
38
|
});
|
|
25
39
|
}
|
|
26
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tide-design/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Tide 디자인 시스템의 React Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"./styles.css": "./dist/styles.css"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tide-design/foundation": "0.
|
|
38
|
-
"@tide-design/icons": "0.
|
|
37
|
+
"@tide-design/foundation": "0.17.0",
|
|
38
|
+
"@tide-design/icons": "0.17.0",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react-aria": "^3.53.1",
|
|
41
41
|
"react-stately": "^3.51.0",
|