@crispy-seed/data-table 0.9.0 → 0.10.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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  declare interface DataTableVariant {
@@ -114,7 +114,7 @@ interface UseDataTableViewsProps {
114
114
  storageKey?: string;
115
115
  }
116
116
 
117
- type DataTableCellType = "text" | "entity" | "url" | "email" | "tags" | "status" | "number" | "currency" | "date" | "datetime" | "rating" | "checkbox";
117
+ type DataTableCellType = "text" | "entity" | "url" | "email" | "tags" | "status" | "number" | "currency" | "date" | "datetime" | "rating" | "checkbox" | "chip" | "chip-list";
118
118
 
119
119
  /** A `select`/`reference`/`actor` editor's own choice list -- `value`/`label` are
120
120
  * required (the committed string and what the row reads), `avatar` is read only by
@@ -138,7 +138,7 @@ interface DataTableColumn<TRow> {
138
138
  */
139
139
  key: string;
140
140
  /** 헤더 셀에 표시할 내용입니다. */
141
- header: React.ReactNode;
141
+ header: react.ReactNode;
142
142
  /** 이 열을 클릭해 정렬할 수 있는지 여부입니다. */
143
143
  sortable?: boolean;
144
144
  /**
@@ -149,7 +149,7 @@ interface DataTableColumn<TRow> {
149
149
  /** 셀 내용을 직접 그립니다. 지정하면 `type`의 기본 렌더러 대신 이것을 사용합니다.
150
150
  * `editable`이어도 편집/always-live 상태에는 영향이 없습니다 -- 이 필드는 REST
151
151
  * 상태의 표시만 바꿉니다. */
152
- render?: (row: TRow) => React.ReactNode;
152
+ render?: (row: TRow) => react.ReactNode;
153
153
  /** `type: "currency"`의 통화 기호입니다. @default "$" */
154
154
  symbol?: string;
155
155
  /** `type: "rating"`의 별 개수입니다. @default 5 */
@@ -269,10 +269,18 @@ interface DataTableColumn<TRow> {
269
269
  onOpenPreview?: (row: TRow) => void;
270
270
  /** `onOpenPreview` 아이콘의 aria-label입니다. @default "Open preview" */
271
271
  openPreviewLabel?: string;
272
+ /**
273
+ * 셀 텍스트 옆에 고정으로 붙는 접미(trailing) 아이콘입니다 (예: 링크 열의 외부 링크
274
+ * 아이콘, 위치 열의 핀 아이콘) -- 텍스트가 길어져도 이 아이콘은 잘리거나 사라지지
275
+ * 않습니다 (cells.tsx의 `CellWithSuffix`: 텍스트 쪽만 `flex:1;min-width:0`로
276
+ * 줄임표 처리되고, 아이콘은 `flex-shrink:0`). `type: "text"`(기본)와 `"url"`/
277
+ * `"email"` 열에서 동작합니다.
278
+ */
279
+ suffixIcon?: (row: TRow) => react.ReactNode;
272
280
  }
273
281
  interface DataTableProps<TRow extends {
274
282
  id: string;
275
- }> extends DataTableVariantProps, Omit<PrimitiveProps, "asChild">, Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
283
+ }> extends DataTableVariantProps, Omit<PrimitiveProps, "asChild">, Omit<react.HTMLAttributes<HTMLDivElement>, "children"> {
276
284
  columns: DataTableColumn<TRow>[];
277
285
  data: TRow[];
278
286
  /** `type`이 있는 열의 number/currency/date/datetime 표시에 쓰는 로캘입니다. @default "en-US" */
@@ -290,9 +298,9 @@ interface DataTableProps<TRow extends {
290
298
  * 씁니다. 생략하면 karrot 아이콘 셋의 chevron을 씁니다.
291
299
  */
292
300
  sortIcon?: {
293
- idle?: React.ReactNode;
294
- asc?: React.ReactNode;
295
- desc?: React.ReactNode;
301
+ idle?: react.ReactNode;
302
+ asc?: react.ReactNode;
303
+ desc?: react.ReactNode;
296
304
  };
297
305
  /** 왼쪽에 40px짜리 체크박스 선택 열을 추가합니다. */
298
306
  selectable?: boolean;
@@ -308,10 +316,10 @@ interface DataTableProps<TRow extends {
308
316
  getRowSelectionLabel?: (row: TRow) => string;
309
317
  /** 선택 체크박스가 checked일 때 표시할 아이콘입니다. 생략하면 karrot의 체크 아이콘을
310
318
  * 씁니다. */
311
- selectionCheckedIcon?: React.ReactNode;
319
+ selectionCheckedIcon?: react.ReactNode;
312
320
  /** 전체 선택 체크박스가 일부만 선택됐을 때(indeterminate) 표시할 아이콘입니다.
313
321
  * 생략하면 karrot의 minus 아이콘을 씁니다. */
314
- selectionIndeterminateIcon?: React.ReactNode;
322
+ selectionIndeterminateIcon?: react.ReactNode;
315
323
  /** 제어할 검색어입니다. */
316
324
  query?: string;
317
325
  /** 비제어 방식으로 사용할 때의 초기 검색어입니다. */
@@ -348,7 +356,7 @@ interface DataTableProps<TRow extends {
348
356
  * 행 개수 텍스트를 직접 만듭니다. 생략하면 crisp의 기본 형식을 씁니다: 검색/필터로
349
357
  * 줄지 않았으면 "N rows"(단수는 "row"), 줄었으면 "N of M".
350
358
  */
351
- countLabel?: (shown: number, total: number) => React.ReactNode;
359
+ countLabel?: (shown: number, total: number) => react.ReactNode;
352
360
  /**
353
361
  * 툴바 오른쪽, 행 개수 옆에 렌더링할 커스텀 액션입니다(예: Download/내보내기 버튼).
354
362
  * 이전에는 이 자리에 넣을 공식 prop이 없어서 소비자가 `.seed-data-table__toolbar`
@@ -357,7 +365,7 @@ interface DataTableProps<TRow extends {
357
365
  * 렌더링됩니다). 검색/정렬/필터보다 뒤, 카운트보다 앞(같은 그룹 안에서 카운트
358
366
  * 왼쪽)에 옵니다.
359
367
  */
360
- toolbarActions?: React.ReactNode;
368
+ toolbarActions?: react.ReactNode;
361
369
  /** 헤더의 열별 메뉴(이름 변경 / 숨기기 / 왼쪽·오른쪽으로 이동)를 켭니다, seed `Menu`. */
362
370
  columnMenu?: boolean;
363
371
  /** 헤더를 드래그해 열 순서를 바꿀 수 있게 합니다. @default true */
@@ -431,19 +439,19 @@ interface DataTableProps<TRow extends {
431
439
  /** 주어지면 맨 아래에 crisp가 측정한 "+ New" 추가 행 버튼을 렌더링합니다. */
432
440
  onAddRow?: () => void;
433
441
  /** 추가 행 버튼의 라벨입니다. @default "New record" */
434
- addRowLabel?: React.ReactNode;
442
+ addRowLabel?: react.ReactNode;
435
443
  /** 전체 본문을 이 상태로 대체합니다(로딩 아이콘 + `loadingLabel`) -- 필터/정렬
436
444
  * 재조회나 최초 로드처럼 행 전체가 아직 없을 때를 위한 것입니다. `error`/빈 상태
437
445
  * 보다 우선합니다. 인라인 스크롤 로딩 표시기(`onLoadMore`)와는 별개입니다. */
438
446
  loading?: boolean;
439
447
  /** `loading`일 때 스피너 옆에 보이는 텍스트입니다. @default "Loading..." */
440
- loadingLabel?: React.ReactNode;
448
+ loadingLabel?: react.ReactNode;
441
449
  /** 주어지면 행 대신 이 내용을 본문에 렌더링합니다(crisp의 `.crisp-datatable-empty`
442
450
  * 칸 재사용). `loading`보다는 아래, 빈 상태보다는 위 우선순위입니다. */
443
- error?: React.ReactNode;
451
+ error?: react.ReactNode;
444
452
  /** 검색/필터를 거치고도 행이 하나도 없을 때 본문에 렌더링할 내용입니다.
445
453
  * @default "No results." */
446
- empty?: React.ReactNode;
454
+ empty?: react.ReactNode;
447
455
  /**
448
456
  * Attio 스타일 무한 스크롤: 스크롤 컨테이너 바닥 근처의 sentinel 행이 뷰에 들어오면
449
457
  * 호출됩니다. `Promise`를 반환하면 그동안 자동으로 `loadingMore`가 켜집니다(직접
@@ -467,7 +475,7 @@ interface DataTableProps<TRow extends {
467
475
  * `style={{ height: "100%" }}` 같은 바운드를 주는 것만으로도 "전체 높이" 모드가
468
476
  * 됩니다 -- 새 prop 없이 기존 `style` 전달만으로 두 모드 다 지원됩니다.
469
477
  */
470
- scrollProps?: Omit<React.ComponentPropsWithoutRef<"div">, "ref" | "onScroll">;
478
+ scrollProps?: Omit<react.ComponentPropsWithoutRef<"div">, "ref" | "onScroll">;
471
479
  }
472
480
  /**
473
481
  * @see https://seed-design.io/react/components/data-table
@@ -475,8 +483,8 @@ interface DataTableProps<TRow extends {
475
483
  declare const DataTable: <TRow extends {
476
484
  id: string;
477
485
  }>(props: DataTableProps<TRow> & {
478
- ref?: React.ForwardedRef<HTMLDivElement>;
479
- }) => React.ReactElement;
486
+ ref?: react.ForwardedRef<HTMLDivElement>;
487
+ }) => react.ReactElement;
480
488
 
481
489
  interface DataTableViewsControlProps extends UseDataTableViewsProps {
482
490
  /** The trigger's label when no view is active. @default "Views" */
@@ -486,7 +494,7 @@ interface DataTableViewsControlProps extends UseDataTableViewsProps {
486
494
  * meaningful "no view" state to switch back to. */
487
495
  showClearRow?: boolean;
488
496
  /** The clear row's own label, when `showClearRow` is on. @default "label" */
489
- clearLabel?: React.ReactNode;
497
+ clearLabel?: react.ReactNode;
490
498
  /**
491
499
  * Reads the table's CURRENT column order/visibility/widths/pins + toolbar sort/
492
500
  * filter conditions -- called when the user picks "Save as new view" or "Update
@@ -522,7 +530,7 @@ declare namespace DataTableViewsControl {
522
530
  type ResizablePanelSide = "left" | "right";
523
531
 
524
532
  type ResizablePanelHandleVariant = "panel" | "column";
525
- type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "children" | "onResize"> & {
533
+ type ResizablePanelProps = Omit<react.ComponentPropsWithoutRef<"div">, "children" | "onResize"> & {
526
534
  /** Which edge of its container the panel is anchored to. @default "left" */
527
535
  side?: ResizablePanelSide;
528
536
  /** Controlled width, in px. */
@@ -611,9 +619,9 @@ type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "children
611
619
  * observe `animationName` changes on the SAME node that carries
612
620
  * `data-state`/the keyframe animation above.
613
621
  */
614
- panelElementRef?: React.Ref<HTMLDivElement>;
622
+ panelElementRef?: react.Ref<HTMLDivElement>;
615
623
  className?: string;
616
- children?: React.ReactNode;
624
+ children?: react.ReactNode;
617
625
  };
618
626
  /**
619
627
  * An adjustable-panel primitive with two layout models (`floating`'s own doc
@@ -629,7 +637,7 @@ type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "children
629
637
  * lives in `useResizablePanel` (`@seed-design/react-resizable-panel`), this
630
638
  * component owns the DOM + recipe classes on top of it.
631
639
  */
632
- declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "onResize"> & {
640
+ declare const ResizablePanel: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "onResize"> & {
633
641
  /** Which edge of its container the panel is anchored to. @default "left" */
634
642
  side?: ResizablePanelSide;
635
643
  /** Controlled width, in px. */
@@ -718,10 +726,10 @@ declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.De
718
726
  * observe `animationName` changes on the SAME node that carries
719
727
  * `data-state`/the keyframe animation above.
720
728
  */
721
- panelElementRef?: React.Ref<HTMLDivElement>;
729
+ panelElementRef?: react.Ref<HTMLDivElement>;
722
730
  className?: string;
723
- children?: React.ReactNode;
724
- } & React.RefAttributes<HTMLDivElement>>;
731
+ children?: react.ReactNode;
732
+ } & react.RefAttributes<HTMLDivElement>>;
725
733
 
726
734
  /** One Highlights card -- label, value and an optional icon, laid out the way
727
735
  * Attio's own peek panel lays its own out (your-moon/crisp#448, measured
@@ -730,8 +738,8 @@ declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.De
730
738
  type RecordPreviewHighlight = {
731
739
  key: string;
732
740
  label: string;
733
- value: React.ReactNode;
734
- icon?: React.ComponentType<{
741
+ value: react.ReactNode;
742
+ icon?: react.ComponentType<{
735
743
  size?: number;
736
744
  }>;
737
745
  };
@@ -744,7 +752,7 @@ type RecordPreviewSection = {
744
752
  key: string;
745
753
  label: string;
746
754
  count: number;
747
- content?: React.ReactNode;
755
+ content?: react.ReactNode;
748
756
  };
749
757
  /** One tab of the panel's own mini detail view (a "tabs" capability with no
750
758
  * your-moon/crisp equivalent -- crisp's own peek only ever shows Highlights
@@ -756,12 +764,12 @@ type RecordPreviewSection = {
756
764
  * tab has been visited) -- see `Tabs.tsx`. */
757
765
  type RecordPreviewTab = {
758
766
  key: string;
759
- label: React.ReactNode;
760
- content: React.ReactNode;
767
+ label: react.ReactNode;
768
+ content: react.ReactNode;
761
769
  /** Rendered right after `label` inside the tab trigger, e.g. an unread
762
770
  * count -- purely presentational, this component attaches no meaning to
763
771
  * it. */
764
- badge?: React.ReactNode;
772
+ badge?: react.ReactNode;
765
773
  };
766
774
  /** The record this panel previews. Only `name` is read directly here --
767
775
  * everything else the panel shows comes from `highlights`/`activity`/
@@ -773,7 +781,7 @@ type RecordPreviewRecord = {
773
781
  name?: string;
774
782
  [key: string]: unknown;
775
783
  };
776
- type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children" | "title" | "onResize"> & {
784
+ type RecordPreviewProps = Omit<react.ComponentPropsWithoutRef<"div">, "children" | "title" | "onResize"> & {
777
785
  /** Whether the panel is mounted/visible. */
778
786
  open: boolean;
779
787
  onClose: () => void;
@@ -794,7 +802,7 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
794
802
  nextRecordLabel?: string;
795
803
  /** "2 of 37 in All Companies" (your-moon/crisp#413) -- a single
796
804
  * pre-formatted string; omit for no counter at all. */
797
- counterLabel?: React.ReactNode;
805
+ counterLabel?: react.ReactNode;
798
806
  /**
799
807
  * Lets a person drag the panel wider or narrower from its own left edge --
800
808
  * this port reuses `ResizablePanel`'s own handle (`side="right"`, whose
@@ -810,7 +818,7 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
810
818
  minWidth?: number;
811
819
  maxWidth?: number;
812
820
  /** The panel's heading, and so its accessible name. Defaults to `record.name`. */
813
- title?: React.ReactNode;
821
+ title?: react.ReactNode;
814
822
  /** Avatar image URL beside the title. Omit for an initials tile built from
815
823
  * `record.name`'s first character. */
816
824
  avatar?: string;
@@ -819,13 +827,13 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
819
827
  record: RecordPreviewRecord | null;
820
828
  /** Heading above the highlight cards (default "Highlights"). Omit the
821
829
  * whole section by omitting `highlights`. */
822
- highlightsLabel?: React.ReactNode;
830
+ highlightsLabel?: react.ReactNode;
823
831
  highlights?: RecordPreviewHighlight[];
824
832
  /** Heading above the activity feed (default "Activity"). */
825
- activityLabel?: React.ReactNode;
826
- viewAllActivityLabel?: React.ReactNode;
833
+ activityLabel?: react.ReactNode;
834
+ viewAllActivityLabel?: react.ReactNode;
827
835
  onViewAllActivity?: () => void;
828
- activity?: React.ReactNode;
836
+ activity?: react.ReactNode;
829
837
  /** Collapsed sections below Activity (your-moon/crisp#413). Omit for no
830
838
  * sections at all. */
831
839
  sections?: RecordPreviewSection[];
@@ -851,9 +859,9 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
851
859
  onTabChange?: (key: string) => void;
852
860
  /** Label for the synthesized overview tab -- see `tabs`'s own doc
853
861
  * comment. @default "Overview" */
854
- overviewTabLabel?: React.ReactNode;
862
+ overviewTabLabel?: react.ReactNode;
855
863
  /** Rendered below the panel's content, e.g. an Edit button. */
856
- footer?: React.ReactNode;
864
+ footer?: react.ReactNode;
857
865
  /**
858
866
  * An optional dimming backdrop behind the panel -- OFF by default (this
859
867
  * is a peek, not a modal: Attio's own peek never dims the table it