@idbrnd/design-system 2.1.2 → 2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @idbrnd/design-system
2
2
 
3
- ![Version](https://img.shields.io/badge/version-2.1.2-4B5FE1?style=flat-square)
3
+ ![Version](https://img.shields.io/badge/version-2.2.0-4B5FE1?style=flat-square)
4
4
  ![React](https://img.shields.io/badge/React-18.3.1-61DAFB?style=flat-square&logo=react&logoColor=white)
5
5
  ![Vite](https://img.shields.io/badge/Vite-7.3.0-646CFF?style=flat-square&logo=vite&logoColor=white)
6
6
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.9.3-3178C6?style=flat-square&logo=typescript&logoColor=white)
@@ -557,7 +557,7 @@ import { PushBadge } from "@idbrnd/design-system";
557
557
 
558
558
  ### Tooltip
559
559
 
560
- 트리거 엘리먼트에 마우스를 올리거나 클릭하면 말풍선 형태의 안내 텍스트를 표시하는 컴포넌트입니다.
560
+ 트리거 엘리먼트에 마우스를 올리거나 클릭하면 말풍선 형태의 안내 텍스트를 표시하는 컴포넌트입니다. `trigger="always"`로 항상 표시되는 고정 안내 형태로도 사용할 수 있습니다.
561
561
 
562
562
  ```tsx
563
563
  import { Tooltip } from "@idbrnd/design-system";
@@ -584,6 +584,14 @@ import { Tooltip } from "@idbrnd/design-system";
584
584
  </Tooltip>
585
585
  ```
586
586
 
587
+ **항상 표시 (고정 안내)**
588
+
589
+ ```tsx
590
+ <Tooltip content="필수 입력 항목입니다" trigger="always" position="right">
591
+ <InfoIcon />
592
+ </Tooltip>
593
+ ```
594
+
587
595
  **말줄임 시에만 표시**
588
596
 
589
597
  ```tsx
@@ -603,7 +611,7 @@ import { Tooltip } from "@idbrnd/design-system";
603
611
  | Prop | 타입 | 기본값 | 설명 |
604
612
  | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ----------------------------------------------------------------------------- |
605
613
  | `content` | `ReactNode \| ((close: () => void) => ReactNode)` | — | **(필수)** 툴팁에 표시할 내용. render function 전달 시 `close` 콜백 사용 가능 |
606
- | `trigger` | `"hover"` \| `"click"` | `"hover"` | 트리거 방식 |
614
+ | `trigger` | `"hover"` \| `"click"` \| `"always"` | `"hover"` | 트리거 방식. `"always"`는 항상 표시되는 고정 안내 |
607
615
  | `variant` | `"default"` \| `"compact"` | `"default"` | 크기 변형. default: 8px 12px, compact: 4px 12px |
608
616
  | `position` | `"top"` \| `"top-left"` \| `"top-right"` \| `"bottom"` \| `"bottom-left"` \| `"bottom-right"` \| `"left"` \| `"left-top"` \| `"left-bottom"` \| `"right"` \| `"right-top"` \| `"right-bottom"` | `"top"` | 툴팁 표시 위치 (12방향) |
609
617
  | `arrow` | `boolean` | `true` | 화살표(꼬리표) 표시 여부 |
@@ -617,6 +625,7 @@ import { Tooltip } from "@idbrnd/design-system";
617
625
  유의사항:
618
626
 
619
627
  - `trigger="click"` 시 외부 클릭, 스크롤, 리사이즈 시 자동으로 닫힙니다.
628
+ - `trigger="always"` 시 마운트 시점부터 항상 표시되며, 스크롤·리사이즈 시 트리거를 따라 위치를 재계산합니다. `visibleOnEllipsis`와 함께 쓰면 말줄임이 있을 때만 표시됩니다.
620
629
  - `position`의 첫 번째 단어는 툴팁이 놓이는 방향, 두 번째 단어는 화살표가 치우치는 방향입니다.
621
630
  - `content`에 render function을 전달하면 닫기 버튼 등 인터랙션을 구현할 수 있습니다.
622
631
  - 툴팁은 `document.body`에 포탈로 렌더링됩니다.
@@ -1224,17 +1233,42 @@ function Example() {
1224
1233
  />
1225
1234
  ```
1226
1235
 
1227
- | Prop | 타입 | 기본값 | 설명 |
1228
- | ------------- | ------------------------------------ | ---------- | ------------------------------------------------- |
1229
- | `items` | `SegmentedControlItem[]` | — | **(필수)** 세그먼트 목록 |
1230
- | `value` | `string` | — | **(필수)** 현재 선택된 세그먼트 값 |
1231
- | `onChange` | `(value: string) => void` | — | 세그먼트 변경 콜백 |
1232
- | `variant` | `"basic"` \| `"icon"` | `"basic"` | `"icon"`: 아이콘 전용 정사각형 세그먼트 |
1233
- | `type` | `"fill"` \| `"outlined"` | `"fill"` | 컴포넌트 외형 |
1234
- | `size` | `"small"` \| `"medium"` \| `"large"` | `"medium"` | 크기. small: 32px, medium: 40px, large: 48px |
1235
- | `icon` | `boolean` | `false` | `variant="basic"`에서 아이콘을 텍스트와 함께 표시 |
1236
- | `label` | `string` | — | 스크린 리더용 그룹 레이블 (`aria-label`) |
1237
- | `customStyle` | `CSSProperties` | — | 추가 인라인 스타일 |
1236
+ **레이아웃 (`layout="hug" | "fill"`)**
1237
+
1238
+ ```tsx
1239
+ {
1240
+ /* hug: 내부 세그먼트 크기에 맞춰 컨테이너가 축소됩니다 */
1241
+ }
1242
+ <SegmentedControl
1243
+ items={items}
1244
+ value={period}
1245
+ onChange={setPeriod}
1246
+ layout="hug"
1247
+ />;
1248
+
1249
+ {
1250
+ /* fill: 부모 너비를 최대한 채우고 세그먼트가 균등하게 늘어납니다 (basic 기본값) */
1251
+ }
1252
+ <SegmentedControl
1253
+ items={items}
1254
+ value={period}
1255
+ onChange={setPeriod}
1256
+ layout="fill"
1257
+ />;
1258
+ ```
1259
+
1260
+ | Prop | 타입 | 기본값 | 설명 |
1261
+ | ------------- | ------------------------------------ | ------------------------------------------------------ | -------------------------------------------------------------------------- |
1262
+ | `items` | `SegmentedControlItem[]` | — | **(필수)** 세그먼트 목록 |
1263
+ | `value` | `string` | — | **(필수)** 현재 선택된 세그먼트 값 |
1264
+ | `onChange` | `(value: string) => void` | — | 세그먼트 변경 콜백 |
1265
+ | `variant` | `"basic"` \| `"icon"` | `"basic"` | `"icon"`: 아이콘 전용 정사각형 세그먼트 |
1266
+ | `type` | `"fill"` \| `"outlined"` | `"fill"` | 컴포넌트 외형 |
1267
+ | `size` | `"small"` \| `"medium"` \| `"large"` | `"medium"` | 크기. small: 32px, medium: 40px, large: 48px |
1268
+ | `layout` | `"hug"` \| `"fill"` | `variant="basic"`: `"fill"`, `variant="icon"`: `"hug"` | `"hug"`: 내부 세그먼트 크기에 맞춰 축소, `"fill"`: 부모 너비를 최대한 채움 |
1269
+ | `icon` | `boolean` | `false` | `variant="basic"`에서 아이콘을 텍스트와 함께 표시 |
1270
+ | `label` | `string` | — | 스크린 리더용 그룹 레이블 (`aria-label`) |
1271
+ | `customStyle` | `CSSProperties` | — | 추가 인라인 스타일 |
1238
1272
 
1239
1273
  **`SegmentedControlItem`**
1240
1274
 
@@ -1248,6 +1282,7 @@ function Example() {
1248
1282
 
1249
1283
  유의사항:
1250
1284
 
1285
+ - `layout`을 지정하지 않으면 `variant`별 기본값(`basic`="fill", `icon`="hug")이 적용됩니다.
1251
1286
  - `variant="icon"` 사용 시 각 item에 `ariaLabel`을 반드시 지정해야 합니다. 미지정 시 개발 모드에서 경고가 출력됩니다.
1252
1287
  - `variant="basic"`에서 `icon=true`이면 세그먼트 왼쪽에 아이콘, 나머지 공간에 텍스트가 배치됩니다.
1253
1288
  - `value`에 해당하는 item이 없으면 슬라이딩 인디케이터가 숨겨지고, 첫 번째 활성 항목에 키보드 포커스가 유지됩니다.
@@ -1893,6 +1928,7 @@ import type {
1893
1928
  SegmentedControlVariant,
1894
1929
  SegmentedControlType,
1895
1930
  SegmentedControlSize,
1931
+ SegmentedControlLayout,
1896
1932
  SegmentedControlItem,
1897
1933
 
1898
1934
  // Tab
@@ -2,6 +2,7 @@ import { type CSSProperties, type ReactNode } from "react";
2
2
  export type SegmentedControlVariant = "basic" | "icon";
3
3
  export type SegmentedControlType = "fill" | "outlined";
4
4
  export type SegmentedControlSize = "small" | "medium" | "large";
5
+ export type SegmentedControlLayout = "hug" | "fill";
5
6
  export interface SegmentedControlItem {
6
7
  value: string;
7
8
  label?: ReactNode;
@@ -14,6 +15,14 @@ export interface SegmentedControlProps {
14
15
  variant?: SegmentedControlVariant;
15
16
  type?: SegmentedControlType;
16
17
  size?: SegmentedControlSize;
18
+ /**
19
+ * 컨테이너 크기 결정 방식.
20
+ * - "hug": 내부 요소(세그먼트) 크기에 맞춰 컨테이너가 축소됩니다.
21
+ * - "fill": 부모 요소의 너비를 최대한 채우고, 세그먼트가 균등하게 늘어납니다.
22
+ *
23
+ * 기본값은 variant별로 다릅니다: basic="fill", icon="hug"
24
+ */
25
+ layout?: SegmentedControlLayout;
17
26
  /** basic variant에서 icon을 함께 표시할지 여부 */
18
27
  icon?: boolean;
19
28
  /** 스크린 리더용 그룹 레이블 */
@@ -23,5 +32,5 @@ export interface SegmentedControlProps {
23
32
  onChange?: (value: string) => void;
24
33
  customStyle?: CSSProperties;
25
34
  }
26
- declare function SegmentedControl({ variant, type, size, icon, label, items, value, onChange, customStyle, }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
35
+ declare function SegmentedControl({ variant, type, size, layout, icon, label, items, value, onChange, customStyle, }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
27
36
  export default SegmentedControl;
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, ReactNode } from 'react';
1
+ import type { CSSProperties, ReactNode } from "react";
2
2
  /**
3
3
  * 툴팁이 표시될 위치 (12방향).
4
4
  *
@@ -10,19 +10,21 @@ import type { CSSProperties, ReactNode } from 'react';
10
10
  * 'top-left' → 트리거 위, 왼쪽 정렬
11
11
  * 'right-bottom' → 트리거 오른쪽, 아래 정렬
12
12
  */
13
- export type TooltipPosition = 'top-left' | 'top' | 'top-right' | 'right-top' | 'right' | 'right-bottom' | 'bottom-left' | 'bottom' | 'bottom-right' | 'left-top' | 'left' | 'left-bottom';
13
+ export type TooltipPosition = "top-left" | "top" | "top-right" | "right-top" | "right" | "right-bottom" | "bottom-left" | "bottom" | "bottom-right" | "left-top" | "left" | "left-bottom";
14
14
  /**
15
15
  * 툴팁 크기 변형.
16
16
  * - `'default'` : 넉넉한 패딩 (8px 12px)
17
17
  * - `'compact'` : 작은 패딩 (4px 12px)
18
18
  */
19
- export type TooltipVariant = 'default' | 'compact';
19
+ export type TooltipVariant = "default" | "compact";
20
20
  /**
21
21
  * 툴팁 트리거 방식.
22
- * - `'hover'` : 마우스를 올리면 표시, 벗어나면 숨김
23
- * - `'click'` : 클릭하면 토글, 외부 클릭 시 숨김
22
+ * - `'hover'` : 마우스를 올리면 표시, 벗어나면 숨김
23
+ * - `'click'` : 클릭하면 토글, 외부 클릭 시 숨김
24
+ * - `'always'` : 마운트 시점부터 항상 표시 (특정 화면·요소에 고정된 안내 정보를 노출할 때).
25
+ * 스크롤·리사이즈 시 트리거를 따라 위치를 재계산.
24
26
  */
25
- export type TooltipTrigger = 'hover' | 'click';
27
+ export type TooltipTrigger = "hover" | "click" | "always";
26
28
  /**
27
29
  * 툴팁 콘텐츠 타입.
28
30
  *
@@ -0,0 +1 @@
1
+ export default function SegmentedControlPage(): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -57,7 +57,7 @@ export type { TooltipProps, TooltipPosition, TooltipVariant, TooltipTrigger, Too
57
57
  export { default as Tab } from "./components/Tab/Tab";
58
58
  export type { TabProps, TabItem, TabSize, TabResize, } from "./components/Tab/Tab";
59
59
  export { default as SegmentedControl } from "./components/SegmentedControl/SegmentedControl";
60
- export type { SegmentedControlProps, SegmentedControlVariant, SegmentedControlType, SegmentedControlSize, SegmentedControlItem, } from "./components/SegmentedControl/SegmentedControl";
60
+ export type { SegmentedControlProps, SegmentedControlVariant, SegmentedControlType, SegmentedControlSize, SegmentedControlLayout, SegmentedControlItem, } from "./components/SegmentedControl/SegmentedControl";
61
61
  export { default as Table } from "./components/Table/Table";
62
62
  export type { TableProps, TableVariant, } from "./components/Table/Table.types";
63
63
  export { default as TableContainer } from "./components/Table/TableContainer";