@crispy-seed/data-table 0.11.0 → 0.11.2

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 {
@@ -151,7 +151,7 @@ interface DataTableColumn<TRow> {
151
151
  */
152
152
  key: string;
153
153
  /** 헤더 셀에 표시할 내용입니다. */
154
- header: React.ReactNode;
154
+ header: react.ReactNode;
155
155
  /** 이 열을 클릭해 정렬할 수 있는지 여부입니다. */
156
156
  sortable?: boolean;
157
157
  /**
@@ -162,7 +162,7 @@ interface DataTableColumn<TRow> {
162
162
  /** 셀 내용을 직접 그립니다. 지정하면 `type`의 기본 렌더러 대신 이것을 사용합니다.
163
163
  * `editable`이어도 편집/always-live 상태에는 영향이 없습니다 -- 이 필드는 REST
164
164
  * 상태의 표시만 바꿉니다. */
165
- render?: (row: TRow) => React.ReactNode;
165
+ render?: (row: TRow) => react.ReactNode;
166
166
  /** `type: "currency"`의 통화 기호입니다. @default "$" */
167
167
  symbol?: string;
168
168
  /** `type: "rating"`의 별 개수입니다. @default 5 */
@@ -198,8 +198,11 @@ interface DataTableColumn<TRow> {
198
198
  * 절대 스크롤되어 사라지지 않도록 오른쪽 끝에 고정합니다 -- 이 플래그가 있는 열은 테이블
199
199
  * 전체의 `stickyLast`를 켜지 않아도 자동으로 그 고정 + 왼쪽 스크롤 그림자
200
200
  * (`stickyProps`/`stickyLast`가 이미 구현한 것과 동일한 메커니즘, `data-sticky-edge-end`
201
- * / `data-scrolled-end`)를 받습니다. 열 목록의 마지막 열이어야 합니다 -- `stickyLast`
202
- * 자체가 이미 "마지막으로 보이는 열"만 고정하는 규칙이기 때문입니다.
201
+ * / `data-scrolled-end`)를 받습니다. `stickyLast`는 이 플래그가 붙은 열을 직접 찾아
202
+ * 고정합니다 (`column-layout.ts`의 `useEffectiveColumns`) -- 더 이상 "마지막으로 보이는
203
+ * 열"이어야만 한다는 제약이 없습니다. 내부적으로도 `reconcileColumnOrder`(react-headless의
204
+ * `dom.ts`)가 이 열을 항상 맨 끝에 유지하므로, 마운트 이후 추가된 새 열이 이 열보다 뒤로
205
+ * 붙어 고정 셀 뒤에 가려지는 일도 없습니다.
203
206
  */
204
207
  actions?: boolean;
205
208
  /**
@@ -282,6 +285,19 @@ interface DataTableColumn<TRow> {
282
285
  onOpenPreview?: (row: TRow) => void;
283
286
  /** `onOpenPreview` 아이콘의 aria-label입니다. @default "Open preview" */
284
287
  openPreviewLabel?: string;
288
+ /**
289
+ * `type: "entity"` only -- makes the entity NAME itself clickable-to-navigate,
290
+ * matching how Attio actually enters a record (measured live: clicking the name
291
+ * text, an `<a href="/…/company/<id>">` sized to the name, not the row). Takes
292
+ * priority over the value's own `href` (`DataTableEntityValue.href`) when both are
293
+ * given. `event.stopPropagation()`'d, so a name click never also fires the row's
294
+ * `onRowClick` -- independent of the `onOpenPreview` button above, which stays a
295
+ * separate affordance for the same row. Renders a plain, non-underlined-until-
296
+ * hover name (crisp's own measured shape: normal name color/weight, an underline
297
+ * affordance on hover, not a blue link) rather than `onOpenPreview`'s icon button.
298
+ * Omit for a plain, non-clickable name (the existing default).
299
+ */
300
+ onOpenRecord?: (row: TRow) => void;
285
301
  /**
286
302
  * 셀 텍스트 옆에 고정으로 붙는 접미(trailing) 아이콘입니다 (예: 링크 열의 외부 링크
287
303
  * 아이콘, 위치 열의 핀 아이콘) -- 텍스트가 길어져도 이 아이콘은 잘리거나 사라지지
@@ -289,11 +305,11 @@ interface DataTableColumn<TRow> {
289
305
  * 줄임표 처리되고, 아이콘은 `flex-shrink:0`). `type: "text"`(기본)와 `"url"`/
290
306
  * `"email"` 열에서 동작합니다.
291
307
  */
292
- suffixIcon?: (row: TRow) => React.ReactNode;
308
+ suffixIcon?: (row: TRow) => react.ReactNode;
293
309
  }
294
310
  interface DataTableProps<TRow extends {
295
311
  id: string;
296
- }> extends DataTableVariantProps, Omit<PrimitiveProps, "asChild">, Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
312
+ }> extends DataTableVariantProps, Omit<PrimitiveProps, "asChild">, Omit<react.HTMLAttributes<HTMLDivElement>, "children"> {
297
313
  columns: DataTableColumn<TRow>[];
298
314
  data: TRow[];
299
315
  /** `type`이 있는 열의 number/currency/date/datetime 표시에 쓰는 로캘입니다. @default "en-US" */
@@ -311,9 +327,9 @@ interface DataTableProps<TRow extends {
311
327
  * 씁니다. 생략하면 karrot 아이콘 셋의 chevron을 씁니다.
312
328
  */
313
329
  sortIcon?: {
314
- idle?: React.ReactNode;
315
- asc?: React.ReactNode;
316
- desc?: React.ReactNode;
330
+ idle?: react.ReactNode;
331
+ asc?: react.ReactNode;
332
+ desc?: react.ReactNode;
317
333
  };
318
334
  /** 왼쪽에 40px짜리 체크박스 선택 열을 추가합니다. */
319
335
  selectable?: boolean;
@@ -329,10 +345,10 @@ interface DataTableProps<TRow extends {
329
345
  getRowSelectionLabel?: (row: TRow) => string;
330
346
  /** 선택 체크박스가 checked일 때 표시할 아이콘입니다. 생략하면 karrot의 체크 아이콘을
331
347
  * 씁니다. */
332
- selectionCheckedIcon?: React.ReactNode;
348
+ selectionCheckedIcon?: react.ReactNode;
333
349
  /** 전체 선택 체크박스가 일부만 선택됐을 때(indeterminate) 표시할 아이콘입니다.
334
350
  * 생략하면 karrot의 minus 아이콘을 씁니다. */
335
- selectionIndeterminateIcon?: React.ReactNode;
351
+ selectionIndeterminateIcon?: react.ReactNode;
336
352
  /**
337
353
  * 행이 하나 이상 선택되면 테이블 하단 중앙에 뜨는 벌크 액션 바(Attio 스타일 floating
338
354
  * pill, gap #4)에 넣을 소비자 액션입니다. 현재 선택된 행 id 목록을 받는 render prop --
@@ -341,7 +357,7 @@ interface DataTableProps<TRow extends {
341
357
  * "크롬 vs 소비자 콘텐츠" 분리). 생략하면 바는 크롬만 보여줍니다. `selectable`이 꺼져
342
358
  * 있으면 무시됩니다(선택 자체가 없으므로).
343
359
  */
344
- bulkActions?: (selectedIds: string[]) => React.ReactNode;
360
+ bulkActions?: (selectedIds: string[]) => react.ReactNode;
345
361
  /** 벌크 액션 바의 지우기(x) 버튼 접근성 이름입니다. @default "Clear selection" */
346
362
  clearSelectionLabel?: string;
347
363
  /** 제어할 검색어입니다. */
@@ -380,7 +396,7 @@ interface DataTableProps<TRow extends {
380
396
  * 행 개수 텍스트를 직접 만듭니다. 생략하면 crisp의 기본 형식을 씁니다: 검색/필터로
381
397
  * 줄지 않았으면 "N rows"(단수는 "row"), 줄었으면 "N of M".
382
398
  */
383
- countLabel?: (shown: number, total: number) => React.ReactNode;
399
+ countLabel?: (shown: number, total: number) => react.ReactNode;
384
400
  /**
385
401
  * 툴바 오른쪽, 행 개수 옆에 렌더링할 커스텀 액션입니다(예: Download/내보내기 버튼).
386
402
  * 이전에는 이 자리에 넣을 공식 prop이 없어서 소비자가 `.seed-data-table__toolbar`
@@ -389,7 +405,7 @@ interface DataTableProps<TRow extends {
389
405
  * 렌더링됩니다). 검색/정렬/필터보다 뒤, 카운트보다 앞(같은 그룹 안에서 카운트
390
406
  * 왼쪽)에 옵니다.
391
407
  */
392
- toolbarActions?: React.ReactNode;
408
+ toolbarActions?: react.ReactNode;
393
409
  /** 헤더의 열별 메뉴(이름 변경 / 숨기기 / 왼쪽·오른쪽으로 이동)를 켭니다, seed `Menu`. */
394
410
  columnMenu?: boolean;
395
411
  /** 헤더를 드래그해 열 순서를 바꿀 수 있게 합니다. @default true */
@@ -470,7 +486,7 @@ interface DataTableProps<TRow extends {
470
486
  * consumer's own "Assign to…") -- rendered inside the SAME `MenuScrollArea` the
471
487
  * built-in items are, so a `<MenuItem>` from this package's own `Menu` export
472
488
  * composes the way `column-menu.tsx`'s own items do. */
473
- cellContextMenuItems?: (ctx: DataTableCellContextMenuContext<TRow>) => React.ReactNode;
489
+ cellContextMenuItems?: (ctx: DataTableCellContextMenuContext<TRow>) => react.ReactNode;
474
490
  /** 행을 클릭할 수 있게 하는 호버 표시입니다 (crisp의 3%/4% 포그라운드 틴트). 커서
475
491
  * 모양은 `onRowClick`이 있는지에 따로 달려 있습니다 -- 이 값과 독립적으로 켤 수
476
492
  * 있습니다(crisp의 두 prop, `interactive`/`onRowClick`도 서로 독립적입니다). */
@@ -481,19 +497,19 @@ interface DataTableProps<TRow extends {
481
497
  /** 주어지면 맨 아래에 crisp가 측정한 "+ New" 추가 행 버튼을 렌더링합니다. */
482
498
  onAddRow?: () => void;
483
499
  /** 추가 행 버튼의 라벨입니다. @default "New record" */
484
- addRowLabel?: React.ReactNode;
500
+ addRowLabel?: react.ReactNode;
485
501
  /** 전체 본문을 이 상태로 대체합니다(로딩 아이콘 + `loadingLabel`) -- 필터/정렬
486
502
  * 재조회나 최초 로드처럼 행 전체가 아직 없을 때를 위한 것입니다. `error`/빈 상태
487
503
  * 보다 우선합니다. 인라인 스크롤 로딩 표시기(`onLoadMore`)와는 별개입니다. */
488
504
  loading?: boolean;
489
505
  /** `loading`일 때 스피너 옆에 보이는 텍스트입니다. @default "Loading..." */
490
- loadingLabel?: React.ReactNode;
506
+ loadingLabel?: react.ReactNode;
491
507
  /** 주어지면 행 대신 이 내용을 본문에 렌더링합니다(crisp의 `.crisp-datatable-empty`
492
508
  * 칸 재사용). `loading`보다는 아래, 빈 상태보다는 위 우선순위입니다. */
493
- error?: React.ReactNode;
509
+ error?: react.ReactNode;
494
510
  /** 검색/필터를 거치고도 행이 하나도 없을 때 본문에 렌더링할 내용입니다.
495
511
  * @default "No results." */
496
- empty?: React.ReactNode;
512
+ empty?: react.ReactNode;
497
513
  /**
498
514
  * Attio 스타일 무한 스크롤: 스크롤 컨테이너 바닥 근처의 sentinel 행이 뷰에 들어오면
499
515
  * 호출됩니다. `Promise`를 반환하면 그동안 자동으로 `loadingMore`가 켜집니다(직접
@@ -517,7 +533,7 @@ interface DataTableProps<TRow extends {
517
533
  * `style={{ height: "100%" }}` 같은 바운드를 주는 것만으로도 "전체 높이" 모드가
518
534
  * 됩니다 -- 새 prop 없이 기존 `style` 전달만으로 두 모드 다 지원됩니다.
519
535
  */
520
- scrollProps?: Omit<React.ComponentPropsWithoutRef<"div">, "ref" | "onScroll">;
536
+ scrollProps?: Omit<react.ComponentPropsWithoutRef<"div">, "ref" | "onScroll">;
521
537
  }
522
538
  /**
523
539
  * @see https://seed-design.io/react/components/data-table
@@ -525,8 +541,8 @@ interface DataTableProps<TRow extends {
525
541
  declare const DataTable: <TRow extends {
526
542
  id: string;
527
543
  }>(props: DataTableProps<TRow> & {
528
- ref?: React.ForwardedRef<HTMLDivElement>;
529
- }) => React.ReactElement;
544
+ ref?: react.ForwardedRef<HTMLDivElement>;
545
+ }) => react.ReactElement;
530
546
 
531
547
  interface DataTableViewsControlProps extends UseDataTableViewsProps {
532
548
  /** The trigger's label when no view is active. @default "Views" */
@@ -536,7 +552,7 @@ interface DataTableViewsControlProps extends UseDataTableViewsProps {
536
552
  * meaningful "no view" state to switch back to. */
537
553
  showClearRow?: boolean;
538
554
  /** The clear row's own label, when `showClearRow` is on. @default "label" */
539
- clearLabel?: React.ReactNode;
555
+ clearLabel?: react.ReactNode;
540
556
  /**
541
557
  * Reads the table's CURRENT column order/visibility/widths/pins + toolbar sort/
542
558
  * filter conditions -- called when the user picks "Save as new view" or "Update
@@ -578,7 +594,7 @@ interface DataTableBulkBarProps {
578
594
  * onClick={() => addToList(ids)}>Add to list</ActionButton>}</DataTableBulkBar>`.
579
595
  * Omit for just the bar's own chrome ("N selected" + clear).
580
596
  */
581
- children?: (selectedIds: string[]) => React.ReactNode;
597
+ children?: (selectedIds: string[]) => react.ReactNode;
582
598
  }
583
599
  /**
584
600
  * The floating bulk-action pill (gap #4) -- renders nothing while no row is selected
@@ -594,7 +610,7 @@ declare function DataTableBulkBar({ clearLabel, children, }: DataTableBulkBarPro
594
610
  type ResizablePanelSide = "left" | "right";
595
611
 
596
612
  type ResizablePanelHandleVariant = "panel" | "column";
597
- type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "children" | "onResize"> & {
613
+ type ResizablePanelProps = Omit<react.ComponentPropsWithoutRef<"div">, "children" | "onResize"> & {
598
614
  /** Which edge of its container the panel is anchored to. @default "left" */
599
615
  side?: ResizablePanelSide;
600
616
  /** Controlled width, in px. */
@@ -683,9 +699,9 @@ type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "children
683
699
  * observe `animationName` changes on the SAME node that carries
684
700
  * `data-state`/the keyframe animation above.
685
701
  */
686
- panelElementRef?: React.Ref<HTMLDivElement>;
702
+ panelElementRef?: react.Ref<HTMLDivElement>;
687
703
  className?: string;
688
- children?: React.ReactNode;
704
+ children?: react.ReactNode;
689
705
  };
690
706
  /**
691
707
  * An adjustable-panel primitive with two layout models (`floating`'s own doc
@@ -701,7 +717,7 @@ type ResizablePanelProps = Omit<React.ComponentPropsWithoutRef<"div">, "children
701
717
  * lives in `useResizablePanel` (`@seed-design/react-resizable-panel`), this
702
718
  * component owns the DOM + recipe classes on top of it.
703
719
  */
704
- declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "onResize"> & {
720
+ declare const ResizablePanel: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "onResize"> & {
705
721
  /** Which edge of its container the panel is anchored to. @default "left" */
706
722
  side?: ResizablePanelSide;
707
723
  /** Controlled width, in px. */
@@ -790,10 +806,10 @@ declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.De
790
806
  * observe `animationName` changes on the SAME node that carries
791
807
  * `data-state`/the keyframe animation above.
792
808
  */
793
- panelElementRef?: React.Ref<HTMLDivElement>;
809
+ panelElementRef?: react.Ref<HTMLDivElement>;
794
810
  className?: string;
795
- children?: React.ReactNode;
796
- } & React.RefAttributes<HTMLDivElement>>;
811
+ children?: react.ReactNode;
812
+ } & react.RefAttributes<HTMLDivElement>>;
797
813
 
798
814
  /** One Highlights card -- label, value and an optional icon, laid out the way
799
815
  * Attio's own peek panel lays its own out (your-moon/crisp#448, measured
@@ -802,8 +818,8 @@ declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.De
802
818
  type RecordPreviewHighlight = {
803
819
  key: string;
804
820
  label: string;
805
- value: React.ReactNode;
806
- icon?: React.ComponentType<{
821
+ value: react.ReactNode;
822
+ icon?: react.ComponentType<{
807
823
  size?: number;
808
824
  }>;
809
825
  };
@@ -816,7 +832,7 @@ type RecordPreviewSection = {
816
832
  key: string;
817
833
  label: string;
818
834
  count: number;
819
- content?: React.ReactNode;
835
+ content?: react.ReactNode;
820
836
  };
821
837
  /** One tab of the panel's own mini detail view (a "tabs" capability with no
822
838
  * your-moon/crisp equivalent -- crisp's own peek only ever shows Highlights
@@ -828,12 +844,12 @@ type RecordPreviewSection = {
828
844
  * tab has been visited) -- see `Tabs.tsx`. */
829
845
  type RecordPreviewTab = {
830
846
  key: string;
831
- label: React.ReactNode;
832
- content: React.ReactNode;
847
+ label: react.ReactNode;
848
+ content: react.ReactNode;
833
849
  /** Rendered right after `label` inside the tab trigger, e.g. an unread
834
850
  * count -- purely presentational, this component attaches no meaning to
835
851
  * it. */
836
- badge?: React.ReactNode;
852
+ badge?: react.ReactNode;
837
853
  };
838
854
  /** The record this panel previews. Only `name` is read directly here --
839
855
  * everything else the panel shows comes from `highlights`/`activity`/
@@ -845,7 +861,7 @@ type RecordPreviewRecord = {
845
861
  name?: string;
846
862
  [key: string]: unknown;
847
863
  };
848
- type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children" | "title" | "onResize"> & {
864
+ type RecordPreviewProps = Omit<react.ComponentPropsWithoutRef<"div">, "children" | "title" | "onResize"> & {
849
865
  /** Whether the panel is mounted/visible. */
850
866
  open: boolean;
851
867
  onClose: () => void;
@@ -866,7 +882,7 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
866
882
  nextRecordLabel?: string;
867
883
  /** "2 of 37 in All Companies" (your-moon/crisp#413) -- a single
868
884
  * pre-formatted string; omit for no counter at all. */
869
- counterLabel?: React.ReactNode;
885
+ counterLabel?: react.ReactNode;
870
886
  /**
871
887
  * Lets a person drag the panel wider or narrower from its own left edge --
872
888
  * this port reuses `ResizablePanel`'s own handle (`side="right"`, whose
@@ -882,7 +898,7 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
882
898
  minWidth?: number;
883
899
  maxWidth?: number;
884
900
  /** The panel's heading, and so its accessible name. Defaults to `record.name`. */
885
- title?: React.ReactNode;
901
+ title?: react.ReactNode;
886
902
  /** Avatar image URL beside the title. Omit for an initials tile built from
887
903
  * `record.name`'s first character. */
888
904
  avatar?: string;
@@ -891,13 +907,13 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
891
907
  record: RecordPreviewRecord | null;
892
908
  /** Heading above the highlight cards (default "Highlights"). Omit the
893
909
  * whole section by omitting `highlights`. */
894
- highlightsLabel?: React.ReactNode;
910
+ highlightsLabel?: react.ReactNode;
895
911
  highlights?: RecordPreviewHighlight[];
896
912
  /** Heading above the activity feed (default "Activity"). */
897
- activityLabel?: React.ReactNode;
898
- viewAllActivityLabel?: React.ReactNode;
913
+ activityLabel?: react.ReactNode;
914
+ viewAllActivityLabel?: react.ReactNode;
899
915
  onViewAllActivity?: () => void;
900
- activity?: React.ReactNode;
916
+ activity?: react.ReactNode;
901
917
  /** Collapsed sections below Activity (your-moon/crisp#413). Omit for no
902
918
  * sections at all. */
903
919
  sections?: RecordPreviewSection[];
@@ -923,9 +939,9 @@ type RecordPreviewProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"
923
939
  onTabChange?: (key: string) => void;
924
940
  /** Label for the synthesized overview tab -- see `tabs`'s own doc
925
941
  * comment. @default "Overview" */
926
- overviewTabLabel?: React.ReactNode;
942
+ overviewTabLabel?: react.ReactNode;
927
943
  /** Rendered below the panel's content, e.g. an Edit button. */
928
- footer?: React.ReactNode;
944
+ footer?: react.ReactNode;
929
945
  /**
930
946
  * An optional dimming backdrop behind the panel -- OFF by default (this
931
947
  * is a peek, not a modal: Attio's own peek never dims the table it