@mondrianai/runyourai-design-system 0.0.20 → 0.0.21

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.mjs CHANGED
@@ -4064,7 +4064,7 @@ function Modal({
4064
4064
  variant = "confirm",
4065
4065
  title,
4066
4066
  description,
4067
- showCloseButton = false,
4067
+ showCloseButton = true,
4068
4068
  children,
4069
4069
  cancelLabel = "\uCDE8\uC18C",
4070
4070
  confirmLabel = "\uD655\uC778",
@@ -6018,6 +6018,9 @@ function SortIcon({ direction }) {
6018
6018
  }
6019
6019
  );
6020
6020
  }
6021
+ function isEmptyConfig(value) {
6022
+ return typeof value === "object" && value !== null && !React27.isValidElement(value) && "description" in value;
6023
+ }
6021
6024
  function Table({
6022
6025
  columns,
6023
6026
  data,
@@ -6025,11 +6028,13 @@ function Table({
6025
6028
  pagination,
6026
6029
  defaultSorting,
6027
6030
  loading = false,
6031
+ empty,
6028
6032
  enableRowSelection,
6029
6033
  rowSelection: rowSelectionProp,
6030
6034
  onRowSelectionChange,
6031
6035
  rowActions,
6032
6036
  onRowClick,
6037
+ isRowDisabled,
6033
6038
  onSortingChange,
6034
6039
  className,
6035
6040
  maxHeight
@@ -6096,6 +6101,7 @@ function Table({
6096
6101
  Checkbox,
6097
6102
  {
6098
6103
  checked: row.getIsSelected(),
6104
+ disabled: !row.getCanSelect(),
6099
6105
  onCheckedChange: (checked) => row.toggleSelected(!!checked),
6100
6106
  "aria-label": "\uD589 \uC120\uD0DD",
6101
6107
  onClick: (e) => e.stopPropagation()
@@ -6141,7 +6147,7 @@ function Table({
6141
6147
  getRowId: (row) => getRowKey(row),
6142
6148
  onSortingChange: handleSortingChange
6143
6149
  }, hasPagination && { onPaginationChange: handlePaginationChange }), isSelectionActive && {
6144
- enableRowSelection: true,
6150
+ enableRowSelection: isRowDisabled ? (row) => !isRowDisabled(row.original) : true,
6145
6151
  onRowSelectionChange: handleRowSelectionChange
6146
6152
  }), {
6147
6153
  getCoreRowModel: getCoreRowModel(),
@@ -6250,81 +6256,87 @@ function Table({
6250
6256
  name: "loader-2",
6251
6257
  className: "mx-auto size-6 animate-spin text-muted-foreground"
6252
6258
  }
6253
- ) }) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx52(
6254
- "tr",
6255
- {
6256
- onClick: !isSelectionActive && onRowClick ? () => onRowClick(row.original) : void 0,
6257
- className: cn(
6258
- "group border-b border-border transition-colors hover:bg-accent/50 last:border-b-0",
6259
- !isSelectionActive && onRowClick && "cursor-pointer",
6260
- isSelectionActive && row.getIsSelected() && "bg-accent/30"
6261
- ),
6262
- children: row.getVisibleCells().map((cell) => {
6263
- var _a2;
6264
- if (cell.column.id === "__select__") {
6265
- return /* @__PURE__ */ jsx52("td", { className: "w-10 p-0 relative", children: isSelectionActive && /* @__PURE__ */ jsx52("div", { className: "absolute inset-0 flex items-center justify-center", children: flexRender(
6259
+ ) }) }) : table.getRowModel().rows.length === 0 ? /* @__PURE__ */ jsx52("tr", { children: /* @__PURE__ */ jsx52("td", { colSpan: colCount, children: empty === void 0 ? /* @__PURE__ */ jsx52(Empty, { description: "No Data" }) : isEmptyConfig(empty) ? /* @__PURE__ */ jsx52(Empty, { description: empty.description }) : empty }) }) : table.getRowModel().rows.map((row) => {
6260
+ var _a2;
6261
+ const rowDisabled = (_a2 = isRowDisabled == null ? void 0 : isRowDisabled(row.original)) != null ? _a2 : false;
6262
+ return /* @__PURE__ */ jsx52(
6263
+ "tr",
6264
+ {
6265
+ "aria-disabled": rowDisabled || void 0,
6266
+ onClick: !isSelectionActive && onRowClick && !rowDisabled ? () => onRowClick(row.original) : void 0,
6267
+ className: cn(
6268
+ "group border-b border-border transition-colors hover:bg-accent/50 last:border-b-0",
6269
+ !isSelectionActive && onRowClick && !rowDisabled && "cursor-pointer",
6270
+ isSelectionActive && row.getIsSelected() && "bg-accent/30",
6271
+ rowDisabled && "cursor-not-allowed [&_td]:text-muted-foreground"
6272
+ ),
6273
+ children: row.getVisibleCells().map((cell) => {
6274
+ var _a3;
6275
+ if (cell.column.id === "__select__") {
6276
+ return /* @__PURE__ */ jsx52("td", { className: "w-10 p-0 relative", children: isSelectionActive && /* @__PURE__ */ jsx52("div", { className: "absolute inset-0 flex items-center justify-center", children: flexRender(
6277
+ cell.column.columnDef.cell,
6278
+ cell.getContext()
6279
+ ) }) }, cell.id);
6280
+ }
6281
+ if (cell.column.id === "__row_actions__") {
6282
+ return /* @__PURE__ */ jsx52(
6283
+ "td",
6284
+ {
6285
+ className: "w-12 px-2 py-4 align-middle text-right",
6286
+ children: flexRender(
6287
+ cell.column.columnDef.cell,
6288
+ cell.getContext()
6289
+ )
6290
+ },
6291
+ cell.id
6292
+ );
6293
+ }
6294
+ const {
6295
+ align,
6296
+ cellCls,
6297
+ ellipsis,
6298
+ ellipsisTooltip,
6299
+ cellFn
6300
+ } = (_a3 = colMap[cell.column.id]) != null ? _a3 : {
6301
+ align: "left",
6302
+ cellCls: "",
6303
+ ellipsis: false,
6304
+ ellipsisTooltip: void 0,
6305
+ cellFn: () => null
6306
+ };
6307
+ const rendered = flexRender(
6266
6308
  cell.column.columnDef.cell,
6267
6309
  cell.getContext()
6268
- ) }) }, cell.id);
6269
- }
6270
- if (cell.column.id === "__row_actions__") {
6310
+ );
6311
+ const rawContent = ellipsis ? cellFn(row.original) : null;
6312
+ const cellContent = ellipsis ? /* @__PURE__ */ jsx52(
6313
+ EllipsisCell,
6314
+ {
6315
+ rendered: rawContent,
6316
+ tooltip: ellipsisTooltip ? ellipsisTooltip(row.original) : rawContent
6317
+ }
6318
+ ) : rendered;
6271
6319
  return /* @__PURE__ */ jsx52(
6272
6320
  "td",
6273
6321
  {
6274
- className: "w-12 px-2 py-4 align-middle text-right",
6275
- children: flexRender(
6276
- cell.column.columnDef.cell,
6277
- cell.getContext()
6278
- )
6322
+ className: cn(
6323
+ "px-2 py-4 text-sm leading-none text-foreground align-middle",
6324
+ align === "center" && "text-center",
6325
+ align === "right" && "text-right",
6326
+ // ellipsis 컬럼은 max-w-0으로 table 레이아웃상 너비를 고정하고
6327
+ // overflow-hidden으로 td 밖으로 나가는 콘텐츠를 클리핑
6328
+ ellipsis && "max-w-0 overflow-hidden",
6329
+ cellCls
6330
+ ),
6331
+ children: cellContent
6279
6332
  },
6280
6333
  cell.id
6281
6334
  );
6282
- }
6283
- const {
6284
- align,
6285
- cellCls,
6286
- ellipsis,
6287
- ellipsisTooltip,
6288
- cellFn
6289
- } = (_a2 = colMap[cell.column.id]) != null ? _a2 : {
6290
- align: "left",
6291
- cellCls: "",
6292
- ellipsis: false,
6293
- ellipsisTooltip: void 0,
6294
- cellFn: () => null
6295
- };
6296
- const rendered = flexRender(
6297
- cell.column.columnDef.cell,
6298
- cell.getContext()
6299
- );
6300
- const rawContent = ellipsis ? cellFn(row.original) : null;
6301
- const cellContent = ellipsis ? /* @__PURE__ */ jsx52(
6302
- EllipsisCell,
6303
- {
6304
- rendered: rawContent,
6305
- tooltip: ellipsisTooltip ? ellipsisTooltip(row.original) : rawContent
6306
- }
6307
- ) : rendered;
6308
- return /* @__PURE__ */ jsx52(
6309
- "td",
6310
- {
6311
- className: cn(
6312
- "px-2 py-4 text-sm leading-none text-foreground align-middle",
6313
- align === "center" && "text-center",
6314
- align === "right" && "text-right",
6315
- // ellipsis 컬럼은 max-w-0으로 table 레이아웃상 너비를 고정하고
6316
- // overflow-hidden으로 td 밖으로 나가는 콘텐츠를 클리핑
6317
- ellipsis && "max-w-0 overflow-hidden",
6318
- cellCls
6319
- ),
6320
- children: cellContent
6321
- },
6322
- cell.id
6323
- );
6324
- })
6325
- },
6326
- getRowKey(row.original)
6327
- )) })
6335
+ })
6336
+ },
6337
+ getRowKey(row.original)
6338
+ );
6339
+ }) })
6328
6340
  ] })
6329
6341
  }
6330
6342
  ),