@deepnoid/ui 0.1.78 → 0.1.79

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.js CHANGED
@@ -7714,23 +7714,30 @@ var TableHead = ({
7714
7714
  e.preventDefault();
7715
7715
  onCheckAll(!isCheckedAll);
7716
7716
  };
7717
- const renderTh = (content, key, column) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7717
+ const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7718
7718
  "th",
7719
7719
  {
7720
- className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column),
7720
+ className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className),
7721
7721
  style: {
7722
- width: (column == null ? void 0 : column.width) ? `${column.width}px` : void 0,
7723
- minWidth: (column == null ? void 0 : column.minWidth) ? `${column.minWidth}px` : void 0,
7724
- maxWidth: (column == null ? void 0 : column.maxWidth) ? `${column.maxWidth}px` : void 0,
7725
- height: (column == null ? void 0 : column.height) ? `${column.height}px` : void 0
7722
+ width: isCheckbox ? "40px" : (column == null ? void 0 : column.width) ? `${column.width}px` : "auto",
7723
+ minWidth: isCheckbox ? "40px" : (column == null ? void 0 : column.minWidth) ? `${column.minWidth}px` : void 0,
7724
+ maxWidth: isCheckbox ? "40px" : (column == null ? void 0 : column.maxWidth) ? `${column.maxWidth}px` : void 0,
7725
+ height: (column == null ? void 0 : column.height) ? `${column.height}px` : void 0,
7726
+ ...isCheckbox || (column == null ? void 0 : column.width) ? {
7727
+ flexShrink: 0,
7728
+ flexGrow: 0,
7729
+ boxSizing: "border-box"
7730
+ } : {}
7726
7731
  },
7727
7732
  children: content
7728
7733
  },
7729
7734
  key
7730
7735
  );
7731
7736
  const renderSkeletonRow = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr }), "[&>th]:border-0"), children: [
7732
- columns.map((_, idx) => renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`)),
7733
- rowCheckbox && renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton")
7737
+ columns.map(
7738
+ (column, idx) => renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`, column)
7739
+ ),
7740
+ rowCheckbox && renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton", void 0, true)
7734
7741
  ] }) });
7735
7742
  const renderContentRow = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
7736
7743
  columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
@@ -7743,7 +7750,9 @@ var TableHead = ({
7743
7750
  onChange: (e) => onCheckAll(e.target.checked)
7744
7751
  }
7745
7752
  ) }),
7746
- "checkbox"
7753
+ "checkbox",
7754
+ void 0,
7755
+ true
7747
7756
  )
7748
7757
  ] }) });
7749
7758
  return isLoading ? renderSkeletonRow() : renderContentRow();
@@ -7768,16 +7777,56 @@ var TableBody = ({
7768
7777
  className
7769
7778
  }) => {
7770
7779
  const getCellStyle = (column) => ({
7771
- width: column.width ? `${column.width}px` : void 0,
7780
+ width: column.width ? `${column.width}px` : "auto",
7772
7781
  minWidth: column.minWidth ? `${column.minWidth}px` : void 0,
7773
7782
  maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
7774
7783
  height: column.height ? `${column.height}px` : void 0,
7775
- textAlign: column.align || "center"
7784
+ textAlign: column.align || "center",
7785
+ ...column.width && {
7786
+ flexShrink: 0,
7787
+ flexGrow: 0,
7788
+ boxSizing: "border-box",
7789
+ overflow: "hidden",
7790
+ textOverflow: "ellipsis",
7791
+ whiteSpace: "nowrap"
7792
+ }
7776
7793
  });
7777
- const renderTdSkeleton = (key) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
7778
- const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) }) });
7794
+ const renderTdSkeleton = (key, column) => {
7795
+ const isCheckbox = key.includes("checkbox");
7796
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7797
+ "td",
7798
+ {
7799
+ className: slots.td({ class: classNames == null ? void 0 : classNames.td }),
7800
+ style: isCheckbox ? {
7801
+ width: "40px",
7802
+ minWidth: "40px",
7803
+ maxWidth: "40px",
7804
+ flexShrink: 0,
7805
+ flexGrow: 0,
7806
+ boxSizing: "border-box"
7807
+ } : column ? getCellStyle(column) : void 0,
7808
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" })
7809
+ },
7810
+ key
7811
+ );
7812
+ };
7813
+ const renderCheckboxCell = (rowId) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7814
+ "td",
7815
+ {
7816
+ className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
7817
+ style: {
7818
+ width: "40px",
7819
+ minWidth: "40px",
7820
+ maxWidth: "40px",
7821
+ flexShrink: 0,
7822
+ flexGrow: 0,
7823
+ boxSizing: "border-box"
7824
+ },
7825
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(checkbox_default, { size, checked: checkedRows.has(rowId), onChange: (e) => onCheckRow(rowId, e.target.checked) })
7826
+ }
7827
+ );
7779
7828
  const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
7780
- columns.map((_, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`)),
7829
+ columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
7781
7830
  rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
7782
7831
  ] }, `skeleton-${rowIndex}`);
7783
7832
  const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
@@ -8185,43 +8234,53 @@ var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
8185
8234
  const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
8186
8235
  const slots = (0, import_react15.useMemo)(() => tableStyle(variantProps), [variantProps]);
8187
8236
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
8188
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
8189
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8190
- table_head_default,
8191
- {
8192
- columns,
8193
- size,
8194
- color,
8195
- rowCheckbox,
8196
- isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
8197
- onCheckAll: handleAllRowCheck,
8198
- isLoading,
8199
- classNames,
8200
- slots
8201
- }
8202
- ),
8203
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8204
- table_body_default,
8205
- {
8206
- slots,
8207
- rows,
8208
- columns,
8209
- size,
8210
- color,
8211
- rowCheckbox,
8212
- checkedRows,
8213
- onCheckRow: handleRowCheck,
8214
- emptyContent,
8215
- isLoading,
8216
- skeletonRow,
8217
- className: clsx(
8218
- "transition-all duration-150 ease-out",
8219
- isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
8220
- classNames
8237
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
8238
+ "table",
8239
+ {
8240
+ className: slots.table({ class: classNames == null ? void 0 : classNames.table }),
8241
+ style: {
8242
+ tableLayout: "fixed",
8243
+ width: "100%"
8244
+ },
8245
+ children: [
8246
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8247
+ table_head_default,
8248
+ {
8249
+ columns,
8250
+ size,
8251
+ color,
8252
+ rowCheckbox,
8253
+ isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
8254
+ onCheckAll: handleAllRowCheck,
8255
+ isLoading,
8256
+ classNames,
8257
+ slots
8258
+ }
8259
+ ),
8260
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8261
+ table_body_default,
8262
+ {
8263
+ slots,
8264
+ rows,
8265
+ columns,
8266
+ size,
8267
+ color,
8268
+ rowCheckbox,
8269
+ checkedRows,
8270
+ onCheckRow: handleRowCheck,
8271
+ emptyContent,
8272
+ isLoading,
8273
+ skeletonRow,
8274
+ className: clsx(
8275
+ "transition-all duration-150 ease-out",
8276
+ isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
8277
+ classNames
8278
+ )
8279
+ }
8221
8280
  )
8222
- }
8223
- )
8224
- ] }) }),
8281
+ ]
8282
+ }
8283
+ ) }),
8225
8284
  showPagination && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8226
8285
  pagination_default,
8227
8286
  {
package/dist/index.mjs CHANGED
@@ -28,9 +28,9 @@ import {
28
28
  } from "./chunk-KCAGZUYM.mjs";
29
29
  import {
30
30
  table_default
31
- } from "./chunk-4PU6UC7K.mjs";
32
- import "./chunk-5GBAUDP4.mjs";
33
- import "./chunk-TKB2JL2E.mjs";
31
+ } from "./chunk-AX3D6VFT.mjs";
32
+ import "./chunk-SIVCIIB6.mjs";
33
+ import "./chunk-D5N7OBSO.mjs";
34
34
  import "./chunk-3MY6LO7N.mjs";
35
35
  import {
36
36
  tabs_default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.78",
3
+ "version": "0.1.79",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {