@idbrnd/design-system 1.7.4 → 1.9.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,68 @@
1
+ import type { CSSProperties, ReactNode } from "react";
2
+ import type { Row, Table } from "@tanstack/react-table";
3
+ export type TableVariant = "normal" | "content";
4
+ interface BaseTableProps<TData> {
5
+ /** useReactTable()로 생성한 TanStack Table 인스턴스 */
6
+ table: Table<TData>;
7
+ /** 테이블 스타일 변형
8
+ * @defaultValue `'normal'`
9
+ */
10
+ variant?: TableVariant;
11
+ /** 첫 번째 컬럼에 행 선택 체크박스 표시 여부.
12
+ * useReactTable에 `enableRowSelection`, `state.rowSelection`, `onRowSelectionChange` 설정 필요
13
+ * @defaultValue `false`
14
+ */
15
+ selectable?: boolean;
16
+ /** 행 hover/focus/pressed/selected 인터랙션 활성화 여부
17
+ * @defaultValue `false`
18
+ */
19
+ interactive?: boolean;
20
+ /** 행 클릭 콜백. 제공 시 체크박스 없이도 행에 인터랙션 효과 적용 */
21
+ onRowClick?: (row: Row<TData>) => void;
22
+ /** 로딩 상태 */
23
+ loading?: boolean;
24
+ /** 로딩 스켈레톤 행 수
25
+ * @defaultValue `5`
26
+ */
27
+ skeletonRowCount?: number;
28
+ /** 데이터가 없을 때 표시할 내용 (전체 오버라이드) */
29
+ emptyContent?: ReactNode;
30
+ /** 빈 상태 제목 */
31
+ emptyTitle?: string;
32
+ /** 빈 상태 설명 */
33
+ emptyDescription?: string;
34
+ /** 루트 엘리먼트 인라인 스타일 */
35
+ customStyle?: CSSProperties;
36
+ /** 추가 클래스명 */
37
+ className?: string;
38
+ /** 표시할 최대 행 수. 초과 시 세로 스크롤 발생. 헤더는 항상 고정 */
39
+ maxRows?: number;
40
+ }
41
+ type AccordionProps<TData> = {
42
+ accordion?: false;
43
+ canExpand?: never;
44
+ renderAccordionContent?: never;
45
+ } | {
46
+ /** 행마다 아코디언 토글(쉐브론) 컬럼을 활성화할지 여부.
47
+ * `renderAccordionContent`를 함께 제공해야 동작합니다.
48
+ */
49
+ accordion: true;
50
+ /** 행마다 쉐브론(토글)을 표시할지 결정하는 함수.
51
+ * 미제공 시 모든 행에 토글 표시.
52
+ * renderAccordionContent 호출을 펼쳐진 행으로만 제한하므로
53
+ * 콘텐츠 생성 비용이 클 때 반드시 제공하세요.
54
+ */
55
+ canExpand?: (row: Row<TData>) => boolean;
56
+ /** 확장된 행에 렌더링할 콘텐츠.
57
+ * 행이 펼쳐질 때 해당 row를 인수로 받아 ReactNode를 반환.
58
+ *
59
+ * **주의 — row.id 안정성**: TanStack Table은 기본적으로 배열 인덱스를
60
+ * row.id로 사용합니다. 정렬·필터 변경 시 같은 id가 다른 데이터를 가리켜
61
+ * 엉뚱한 행이 열린 상태가 됩니다.
62
+ * accordion 사용 시 useReactTable에 반드시
63
+ * `getRowId: (originalRow) => originalRow.id` 를 설정하세요.
64
+ */
65
+ renderAccordionContent: (row: Row<TData>) => ReactNode;
66
+ };
67
+ export type TableProps<TData> = BaseTableProps<TData> & AccordionProps<TData>;
68
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { CSSProperties, ReactNode } from "react";
2
+ import type { TableVariant } from "./Table.types";
3
+ export interface TableContainerProps {
4
+ /** 테이블 스타일 변형 — Table 컴포넌트의 variant와 동일하게 맞춰야 합니다.
5
+ * - `normal`: 단순 외곽선
6
+ * - `content`: 외곽선 + border-radius (Pagination도 border 안에 포함)
7
+ * @defaultValue `'normal'`
8
+ */
9
+ variant?: TableVariant;
10
+ children: ReactNode;
11
+ customStyle?: CSSProperties;
12
+ className?: string;
13
+ }
14
+ declare function TableContainer({ variant, children, customStyle, className, }: TableContainerProps): import("react/jsx-runtime").JSX.Element;
15
+ export default TableContainer;
package/dist/index.d.ts CHANGED
@@ -54,3 +54,9 @@ export type { FilterChipProps } from "./components/Chip/FilterChip/FilterChip";
54
54
  export type { FilterBarProps, FilterBarSize, } from "./components/Chip/FilterBar/FilterBar";
55
55
  export { default as Tooltip } from "./components/Tooltip/Tooltip";
56
56
  export type { TooltipProps, TooltipPosition, TooltipVariant, TooltipTrigger, TooltipContent, } from "./components/Tooltip/Tooltip.types";
57
+ export { default as Table } from "./components/Table/Table";
58
+ export type { TableProps, TableVariant, } from "./components/Table/Table.types";
59
+ export { default as TableContainer } from "./components/Table/TableContainer";
60
+ export type { TableContainerProps } from "./components/Table/TableContainer";
61
+ export { default as Pagination } from "./components/Table/Pagination/Pagination";
62
+ export type { PaginationProps, PaginationVariant, } from "./components/Table/Pagination/Pagination.types";