@mondrianai/runyourai-design-system 0.0.6 → 0.0.7

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.mts CHANGED
@@ -5,7 +5,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
7
7
  import * as _radix_ui_react_context from '@radix-ui/react-context';
8
- import { PaginationState, OnChangeFn, RowSelectionState } from '@tanstack/react-table';
8
+ import { RowSelectionState, OnChangeFn, SortingState } from '@tanstack/react-table';
9
9
  export { OnChangeFn, PaginationState, RowSelectionState, SortingState } from '@tanstack/react-table';
10
10
 
11
11
  declare const Accordion: React$1.ForwardRefExoticComponent<(Accordion$1.AccordionSingleProps | Accordion$1.AccordionMultipleProps) & React$1.RefAttributes<HTMLDivElement>>;
@@ -642,6 +642,7 @@ type SidebarSubMenuItem = {
642
642
  isActive?: boolean;
643
643
  titleBadge?: string | number;
644
644
  onClick?: () => void;
645
+ isExternal?: boolean;
645
646
  };
646
647
  type SidebarMainMenuItem = {
647
648
  id: string;
@@ -762,13 +763,12 @@ interface TableColumn<T> {
762
763
  ellipsisTooltip?: (row: T) => React$1.ReactNode;
763
764
  cell: (row: T) => React$1.ReactNode;
764
765
  }
765
- /**
766
- * TanStack Table의 pagination 옵션을 그대로 노출.
767
- * 상세 동작은 TanStack Table 공식 문서 참고:
768
- * https://tanstack.com/table/latest/docs/api/features/pagination
769
- */
770
- interface TablePaginationConfig extends Partial<Pick<PaginationState, 'pageSize' | 'pageIndex'>> {
771
- onPaginationChange?: OnChangeFn<PaginationState>;
766
+ interface TablePaginationConfig {
767
+ pageSize?: number;
768
+ /** 현재 페이지 번호 (1-based). 외부에서 제어할 전달. */
769
+ currentPage?: number;
770
+ /** 페이지 변경 콜백 (1-based page). */
771
+ onPageChange?: (page: number) => void;
772
772
  /** 서버사이드 페이지네이션 시 true로 설정 */
773
773
  manualPagination?: boolean;
774
774
  /** manualPagination=true 일 때 전체 페이지 수 */
@@ -792,7 +792,7 @@ interface TableProps<T> {
792
792
  rowKey: keyof T | ((row: T) => string);
793
793
  /**
794
794
  * 페이지네이션 설정. 미전달 시 페이지네이션 비활성화.
795
- * TanStack Table pagination 옵션을 그대로 수용.
795
+ * 외부 API는 1-based page를 사용하고, TanStack 0-based pageIndex는 내부에서 변환한다.
796
796
  */
797
797
  pagination?: TablePaginationConfig;
798
798
  /**
@@ -816,6 +816,11 @@ interface TableProps<T> {
816
816
  rowActions?: (row: T) => React$1.ReactNode;
817
817
  /** 행 클릭 핸들러. enableRowSelection=true(편집 모드)일 때는 동작하지 않음. */
818
818
  onRowClick?: (row: T) => void;
819
+ /**
820
+ * 정렬 상태 변경 콜백. 서버사이드 정렬 연동에 사용.
821
+ * 빈 배열(정렬 해제)은 전달되지 않으므로 항상 최소 1개 항목 보장.
822
+ */
823
+ onSortingChange?: (sorting: SortingState) => void;
819
824
  className?: string;
820
825
  }
821
826
  declare function SortIcon({ direction }: {
@@ -828,7 +833,7 @@ interface PaginationProps {
828
833
  className?: string;
829
834
  }
830
835
  declare function Pagination({ currentPage, totalPages, onPageChange, className, }: PaginationProps): react_jsx_runtime.JSX.Element;
831
- declare function Table<T>({ columns, data, rowKey, pagination, defaultSorting, loading, enableRowSelection, rowSelection: rowSelectionProp, onRowSelectionChange, rowActions, onRowClick, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
836
+ declare function Table<T>({ columns, data, rowKey, pagination, defaultSorting, loading, enableRowSelection, rowSelection: rowSelectionProp, onRowSelectionChange, rowActions, onRowClick, onSortingChange, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
832
837
 
833
838
  declare const TooltipProvider: React$1.FC<Tooltip$1.TooltipProviderProps>;
834
839
  interface TooltipProps extends Pick<React$1.ComponentPropsWithoutRef<typeof Tooltip$1.Root>, 'open' | 'defaultOpen' | 'onOpenChange' | 'delayDuration'>, Omit<React$1.ComponentPropsWithoutRef<typeof Tooltip$1.Content>, 'children' | 'content'> {
@@ -1357,9 +1362,9 @@ interface TrashIconProps {
1357
1362
  className?: string;
1358
1363
  }
1359
1364
  /**
1360
- * Trash icon — SVG downloaded directly from Figma design system.
1365
+ * Trash-2 icon — SVG downloaded directly from Figma design system.
1361
1366
  * Uses stroke="currentColor" for CSS color control.
1362
- * Source: figma.com/design/bNKDIZZAm8ByouCPBnlEye node 128:2740 (lucide/trash)
1367
+ * Source: figma.com/design/bNKDIZZAm8ByouCPBnlEye node 128:2738 (lucide/trash-2)
1363
1368
  */
1364
1369
  declare function TrashIcon({ className }: TrashIconProps): react_jsx_runtime.JSX.Element;
1365
1370
 
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
7
7
  import * as _radix_ui_react_context from '@radix-ui/react-context';
8
- import { PaginationState, OnChangeFn, RowSelectionState } from '@tanstack/react-table';
8
+ import { RowSelectionState, OnChangeFn, SortingState } from '@tanstack/react-table';
9
9
  export { OnChangeFn, PaginationState, RowSelectionState, SortingState } from '@tanstack/react-table';
10
10
 
11
11
  declare const Accordion: React$1.ForwardRefExoticComponent<(Accordion$1.AccordionSingleProps | Accordion$1.AccordionMultipleProps) & React$1.RefAttributes<HTMLDivElement>>;
@@ -642,6 +642,7 @@ type SidebarSubMenuItem = {
642
642
  isActive?: boolean;
643
643
  titleBadge?: string | number;
644
644
  onClick?: () => void;
645
+ isExternal?: boolean;
645
646
  };
646
647
  type SidebarMainMenuItem = {
647
648
  id: string;
@@ -762,13 +763,12 @@ interface TableColumn<T> {
762
763
  ellipsisTooltip?: (row: T) => React$1.ReactNode;
763
764
  cell: (row: T) => React$1.ReactNode;
764
765
  }
765
- /**
766
- * TanStack Table의 pagination 옵션을 그대로 노출.
767
- * 상세 동작은 TanStack Table 공식 문서 참고:
768
- * https://tanstack.com/table/latest/docs/api/features/pagination
769
- */
770
- interface TablePaginationConfig extends Partial<Pick<PaginationState, 'pageSize' | 'pageIndex'>> {
771
- onPaginationChange?: OnChangeFn<PaginationState>;
766
+ interface TablePaginationConfig {
767
+ pageSize?: number;
768
+ /** 현재 페이지 번호 (1-based). 외부에서 제어할 전달. */
769
+ currentPage?: number;
770
+ /** 페이지 변경 콜백 (1-based page). */
771
+ onPageChange?: (page: number) => void;
772
772
  /** 서버사이드 페이지네이션 시 true로 설정 */
773
773
  manualPagination?: boolean;
774
774
  /** manualPagination=true 일 때 전체 페이지 수 */
@@ -792,7 +792,7 @@ interface TableProps<T> {
792
792
  rowKey: keyof T | ((row: T) => string);
793
793
  /**
794
794
  * 페이지네이션 설정. 미전달 시 페이지네이션 비활성화.
795
- * TanStack Table pagination 옵션을 그대로 수용.
795
+ * 외부 API는 1-based page를 사용하고, TanStack 0-based pageIndex는 내부에서 변환한다.
796
796
  */
797
797
  pagination?: TablePaginationConfig;
798
798
  /**
@@ -816,6 +816,11 @@ interface TableProps<T> {
816
816
  rowActions?: (row: T) => React$1.ReactNode;
817
817
  /** 행 클릭 핸들러. enableRowSelection=true(편집 모드)일 때는 동작하지 않음. */
818
818
  onRowClick?: (row: T) => void;
819
+ /**
820
+ * 정렬 상태 변경 콜백. 서버사이드 정렬 연동에 사용.
821
+ * 빈 배열(정렬 해제)은 전달되지 않으므로 항상 최소 1개 항목 보장.
822
+ */
823
+ onSortingChange?: (sorting: SortingState) => void;
819
824
  className?: string;
820
825
  }
821
826
  declare function SortIcon({ direction }: {
@@ -828,7 +833,7 @@ interface PaginationProps {
828
833
  className?: string;
829
834
  }
830
835
  declare function Pagination({ currentPage, totalPages, onPageChange, className, }: PaginationProps): react_jsx_runtime.JSX.Element;
831
- declare function Table<T>({ columns, data, rowKey, pagination, defaultSorting, loading, enableRowSelection, rowSelection: rowSelectionProp, onRowSelectionChange, rowActions, onRowClick, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
836
+ declare function Table<T>({ columns, data, rowKey, pagination, defaultSorting, loading, enableRowSelection, rowSelection: rowSelectionProp, onRowSelectionChange, rowActions, onRowClick, onSortingChange, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
832
837
 
833
838
  declare const TooltipProvider: React$1.FC<Tooltip$1.TooltipProviderProps>;
834
839
  interface TooltipProps extends Pick<React$1.ComponentPropsWithoutRef<typeof Tooltip$1.Root>, 'open' | 'defaultOpen' | 'onOpenChange' | 'delayDuration'>, Omit<React$1.ComponentPropsWithoutRef<typeof Tooltip$1.Content>, 'children' | 'content'> {
@@ -1357,9 +1362,9 @@ interface TrashIconProps {
1357
1362
  className?: string;
1358
1363
  }
1359
1364
  /**
1360
- * Trash icon — SVG downloaded directly from Figma design system.
1365
+ * Trash-2 icon — SVG downloaded directly from Figma design system.
1361
1366
  * Uses stroke="currentColor" for CSS color control.
1362
- * Source: figma.com/design/bNKDIZZAm8ByouCPBnlEye node 128:2740 (lucide/trash)
1367
+ * Source: figma.com/design/bNKDIZZAm8ByouCPBnlEye node 128:2738 (lucide/trash-2)
1363
1368
  */
1364
1369
  declare function TrashIcon({ className }: TrashIconProps): react_jsx_runtime.JSX.Element;
1365
1370
 
package/dist/index.js CHANGED
@@ -658,7 +658,7 @@ var import_class_variance_authority = require("class-variance-authority");
658
658
  var import_jsx_runtime3 = require("react/jsx-runtime");
659
659
  var buttonVariants = (0, import_class_variance_authority.cva)(
660
660
  // Base — 모든 버튼 공통 스타일
661
- "inline-flex shrink-0 items-center justify-center gap-1.5 rounded-lg text-sm font-medium leading-5 tracking-tight whitespace-nowrap cursor-pointer select-none transition-[transform,opacity,background-color,border-color,color,box-shadow] duration-150 active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:pointer-events-auto disabled:opacity-50 disabled:active:scale-100 [&>svg]:size-4 [&>svg]:shrink-0",
661
+ "inline-flex shrink-0 items-center justify-center gap-1.5 rounded-lg text-sm font-medium leading-5 tracking-tight whitespace-nowrap cursor-pointer select-none transition-[transform,opacity,background-color,border-color,color,box-shadow] duration-150 active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:pointer-events-auto disabled:bg-muted disabled:text-muted-foreground disabled:border-transparent disabled:shadow-none disabled:active:scale-100 [&>svg]:size-4 [&>svg]:shrink-0",
662
662
  {
663
663
  variants: {
664
664
  /**
@@ -4108,6 +4108,7 @@ function Sheet({ open, onClose, title, description, children, footer }) {
4108
4108
 
4109
4109
  // src/components/ui/sidebar.tsx
4110
4110
  var React21 = __toESM(require("react"));
4111
+ var import_lucide_react2 = require("lucide-react");
4111
4112
 
4112
4113
  // src/components/icons/custom/panel-left.tsx
4113
4114
  var import_jsx_runtime34 = require("react/jsx-runtime");
@@ -4342,7 +4343,8 @@ function Sidebar({
4342
4343
  className: "flex gap-2 h-8 items-center p-2 rounded-md hover:bg-sidebar-accent transition-colors",
4343
4344
  children: [
4344
4345
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "flex items-center justify-center size-4 shrink-0 [&_svg]:size-full", children: item.icon }),
4345
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "flex-1 min-w-0 text-sm font-normal leading-5 tracking-tight overflow-hidden text-ellipsis whitespace-nowrap text-foreground", children: item.title })
4346
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "flex-1 min-w-0 text-sm font-normal leading-5 tracking-tight overflow-hidden text-ellipsis whitespace-nowrap text-foreground", children: item.title }),
4347
+ item.isExternal && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "flex items-center justify-center shrink-0 text-[#8C8C8C]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react2.ArrowUpRight, { size: 12, strokeWidth: 1.5 }) })
4346
4348
  ]
4347
4349
  }
4348
4350
  )
@@ -4885,7 +4887,7 @@ function Pagination({
4885
4887
  onClick: () => onPageChange(currentPage - 1),
4886
4888
  disabled: isPrevDisabled,
4887
4889
  "aria-label": "\uC774\uC804 \uD398\uC774\uC9C0",
4888
- className: "cursor-pointer",
4890
+ className: "cursor-pointer disabled:bg-transparent",
4889
4891
  children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon, { name: "chevron-left", className: "size-4" })
4890
4892
  }
4891
4893
  )
@@ -4929,7 +4931,7 @@ function Pagination({
4929
4931
  onClick: () => onPageChange(currentPage + 1),
4930
4932
  disabled: isNextDisabled,
4931
4933
  "aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0",
4932
- className: "cursor-pointer",
4934
+ className: "cursor-pointer disabled:bg-transparent",
4933
4935
  children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon, { name: "chevron-right", className: "size-4" })
4934
4936
  }
4935
4937
  )
@@ -4951,6 +4953,7 @@ function Table({
4951
4953
  onRowSelectionChange,
4952
4954
  rowActions,
4953
4955
  onRowClick,
4956
+ onSortingChange,
4954
4957
  className
4955
4958
  }) {
4956
4959
  var _a, _b, _c;
@@ -4978,15 +4981,32 @@ function Table({
4978
4981
  }))) != null ? _a2 : [];
4979
4982
  }
4980
4983
  );
4984
+ const handleSortingChange = React25.useCallback(
4985
+ (updater) => {
4986
+ setSorting((prev) => {
4987
+ const next = typeof updater === "function" ? updater(prev) : updater;
4988
+ if (next.length > 0) onSortingChange == null ? void 0 : onSortingChange(next);
4989
+ return next;
4990
+ });
4991
+ },
4992
+ [onSortingChange]
4993
+ );
4981
4994
  const [internalPagination, setInternalPagination] = React25.useState({
4982
- pageIndex: (_a = pagination == null ? void 0 : pagination.pageIndex) != null ? _a : 0,
4995
+ pageIndex: ((_a = pagination == null ? void 0 : pagination.currentPage) != null ? _a : 1) - 1,
4983
4996
  pageSize: (_b = pagination == null ? void 0 : pagination.pageSize) != null ? _b : 10
4984
4997
  });
4998
+ React25.useEffect(() => {
4999
+ if ((pagination == null ? void 0 : pagination.currentPage) !== void 0) {
5000
+ setInternalPagination((prev) => __spreadProps(__spreadValues({}, prev), {
5001
+ pageIndex: pagination.currentPage - 1
5002
+ }));
5003
+ }
5004
+ }, [pagination == null ? void 0 : pagination.currentPage]);
4985
5005
  const handlePaginationChange = (updater) => {
4986
5006
  var _a2;
4987
5007
  const next = typeof updater === "function" ? updater(internalPagination) : updater;
4988
5008
  setInternalPagination(next);
4989
- (_a2 = pagination == null ? void 0 : pagination.onPaginationChange) == null ? void 0 : _a2.call(pagination, updater);
5009
+ (_a2 = pagination == null ? void 0 : pagination.onPageChange) == null ? void 0 : _a2.call(pagination, next.pageIndex + 1);
4990
5010
  };
4991
5011
  const isSelectionActive = enableRowSelection === true;
4992
5012
  const selectionColumn = React25.useMemo(
@@ -5041,7 +5061,7 @@ function Table({
5041
5061
  sorting
5042
5062
  }, hasPagination && { pagination: internalPagination }), isSelectionActive && { rowSelection: effectiveRowSelection }),
5043
5063
  getRowId: (row) => getRowKey(row),
5044
- onSortingChange: setSorting
5064
+ onSortingChange: handleSortingChange
5045
5065
  }, hasPagination && { onPaginationChange: handlePaginationChange }), isSelectionActive && {
5046
5066
  enableRowSelection: true,
5047
5067
  onRowSelectionChange: handleRowSelectionChange
@@ -7406,7 +7426,7 @@ function TrashIcon({ className }) {
7406
7426
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
7407
7427
  "svg",
7408
7428
  {
7409
- viewBox: "-2.25 -1.25 24 24",
7429
+ viewBox: "0 0 24 24",
7410
7430
  fill: "none",
7411
7431
  stroke: "currentColor",
7412
7432
  strokeLinecap: "round",
@@ -7414,7 +7434,7 @@ function TrashIcon({ className }) {
7414
7434
  strokeWidth: 1.5,
7415
7435
  "aria-hidden": true,
7416
7436
  className: cn("shrink-0", className),
7417
- children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("path", { d: "M0.75 4.75H18.75M16.75 4.75V18.75C16.75 19.75 15.75 20.75 14.75 20.75H4.75C3.75 20.75 2.75 19.75 2.75 18.75V4.75M5.75 4.75V2.75C5.75 1.75 6.75 0.75 7.75 0.75H11.75C12.75 0.75 13.75 1.75 13.75 2.75V4.75" })
7437
+ children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("path", { d: "M3 6H21M19 6V20C19 21 18 22 17 22H7C6 22 5 21 5 20V6M8 6V4C8 3 9 2 10 2H14C15 2 16 3 16 4V6M10 11V17M14 11V17" })
7418
7438
  }
7419
7439
  );
7420
7440
  }