@deepnoid/ui 0.1.202 → 0.1.203

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.
@@ -639,37 +639,13 @@ function TableHeaderCell({
639
639
  }) {
640
640
  const thRef = (0, import_react2.useRef)(null);
641
641
  const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
642
- const checkOverflow = (el) => {
643
- if (el.scrollWidth > el.clientWidth) {
644
- return true;
645
- }
646
- const children = Array.from(el.children);
647
- for (const child of children) {
648
- if (child.scrollWidth > child.clientWidth) {
649
- return true;
650
- }
651
- }
652
- return false;
653
- };
654
- const extractTextFromContent = (node) => {
655
- if (typeof node === "string" || typeof node === "number") {
656
- return String(node);
657
- }
658
- if ((0, import_react2.isValidElement)(node)) {
659
- return String(node.props.children || "");
660
- }
661
- return "";
662
- };
663
- (0, import_react2.useEffect)(() => {
664
- if (thRef.current && !isCheckbox) {
665
- setTimeout(() => {
666
- if (thRef.current) {
667
- setShowTitle(checkOverflow(thRef.current));
668
- }
669
- }, 0);
642
+ (0, import_react2.useLayoutEffect)(() => {
643
+ if (!isCheckbox && thRef.current) {
644
+ const el = thRef.current;
645
+ setShowTitle(el.scrollWidth > el.clientWidth);
670
646
  }
671
647
  }, [content, isCheckbox]);
672
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
648
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
673
649
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
674
650
  "th",
675
651
  {
@@ -682,7 +658,10 @@ function TableHeaderCell({
682
658
  flexShrink: 0,
683
659
  flexGrow: 0,
684
660
  boxSizing: "border-box"
685
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
661
+ } : column ? {
662
+ ...getCellStyle(column),
663
+ textAlign: "center"
664
+ } : void 0,
686
665
  title: titleText,
687
666
  children: content
688
667
  }
@@ -691,7 +670,6 @@ function TableHeaderCell({
691
670
  var TableHead = ({
692
671
  slots,
693
672
  columns,
694
- color,
695
673
  size,
696
674
  rowCheckbox = false,
697
675
  hasCheckedRows,
@@ -743,53 +721,31 @@ function TableCell({
743
721
  }) {
744
722
  var _a, _b;
745
723
  const value = row[column.field];
746
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
724
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
747
725
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
726
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
748
727
  const tdRef = (0, import_react3.useRef)(null);
749
728
  const [showTitle, setShowTitle] = (0, import_react3.useState)(false);
750
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
751
- const checkOverflow = (el) => {
752
- if (el.scrollWidth > el.clientWidth) {
753
- return true;
754
- }
755
- const children = Array.from(el.children);
756
- for (const child of children) {
757
- if (child.scrollWidth > child.clientWidth) {
758
- return true;
759
- }
760
- }
761
- return false;
762
- };
763
- (0, import_react3.useEffect)(() => {
729
+ (0, import_react3.useLayoutEffect)(() => {
764
730
  if (tdRef.current && isTextContent) {
765
- setTimeout(() => {
766
- if (tdRef.current) {
767
- setShowTitle(checkOverflow(tdRef.current));
768
- }
769
- }, 0);
731
+ const el = tdRef.current;
732
+ setShowTitle(el.scrollWidth > el.clientWidth);
770
733
  }
771
734
  }, [content, isTextContent]);
772
735
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
773
736
  "td",
774
737
  {
775
738
  ref: tdRef,
776
- className: clsx(
777
- slots.td(),
778
- classNames == null ? void 0 : classNames.td,
779
- column.className,
780
- isTextContent && "truncate",
781
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
782
- ),
739
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
783
740
  style: {
784
741
  ...getCellStyle(column),
785
742
  maxWidth: column.width || "150px",
786
743
  textAlign: column.align || "center",
787
- ...!isTextContent && {
788
- overflow: "visible",
789
- whiteSpace: "normal"
790
- }
744
+ whiteSpace: isTextContent ? "nowrap" : "normal",
745
+ overflow: isTextContent ? "hidden" : "visible",
746
+ textOverflow: isTextContent ? "ellipsis" : void 0
791
747
  },
792
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
748
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
793
749
  children: content
794
750
  },
795
751
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  getCellStyle,
4
4
  table_default
5
- } from "../../chunk-KYWCJIXI.mjs";
5
+ } from "../../chunk-W3V4SZV5.mjs";
6
6
  import "../../chunk-7B7LRG5J.mjs";
7
7
  import "../../chunk-VVCSY7DG.mjs";
8
8
  import "../../chunk-F3HENRVM.mjs";
9
+ import "../../chunk-QZ3LVYJW.mjs";
9
10
  import "../../chunk-2GCSFWHD.mjs";
10
11
  import "../../chunk-3RTVVQA3.mjs";
11
- import "../../chunk-QZ3LVYJW.mjs";
12
12
  import "../../chunk-DQRAFUDA.mjs";
13
13
  import "../../chunk-EWS3FESG.mjs";
14
14
  import "../../chunk-OEIEALIP.mjs";
@@ -3,11 +3,11 @@ import "../../chunk-LUWGOKLG.mjs";
3
3
  import {
4
4
  ToastProvider,
5
5
  useToast
6
- } from "../../chunk-SSGCTWWW.mjs";
7
- import "../../chunk-ZOTHPHXA.mjs";
6
+ } from "../../chunk-L3A3IEKZ.mjs";
8
7
  import {
9
8
  toast_default
10
9
  } from "../../chunk-4F7SIDZB.mjs";
10
+ import "../../chunk-ZOTHPHXA.mjs";
11
11
  import "../../chunk-ZYIIXWVY.mjs";
12
12
  import "../../chunk-YEYUS6DW.mjs";
13
13
  import "../../chunk-E3G5QXSH.mjs";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  ToastProvider,
4
4
  useToast
5
- } from "../../chunk-SSGCTWWW.mjs";
6
- import "../../chunk-ZOTHPHXA.mjs";
5
+ } from "../../chunk-L3A3IEKZ.mjs";
7
6
  import "../../chunk-4F7SIDZB.mjs";
7
+ import "../../chunk-ZOTHPHXA.mjs";
8
8
  import "../../chunk-ZYIIXWVY.mjs";
9
9
  import "../../chunk-YEYUS6DW.mjs";
10
10
  import "../../chunk-E3G5QXSH.mjs";
package/dist/index.js CHANGED
@@ -8197,37 +8197,13 @@ function TableHeaderCell({
8197
8197
  }) {
8198
8198
  const thRef = (0, import_react15.useRef)(null);
8199
8199
  const [showTitle, setShowTitle] = (0, import_react15.useState)(false);
8200
- const checkOverflow = (el) => {
8201
- if (el.scrollWidth > el.clientWidth) {
8202
- return true;
8203
- }
8204
- const children = Array.from(el.children);
8205
- for (const child of children) {
8206
- if (child.scrollWidth > child.clientWidth) {
8207
- return true;
8208
- }
8209
- }
8210
- return false;
8211
- };
8212
- const extractTextFromContent = (node) => {
8213
- if (typeof node === "string" || typeof node === "number") {
8214
- return String(node);
8215
- }
8216
- if ((0, import_react15.isValidElement)(node)) {
8217
- return String(node.props.children || "");
8218
- }
8219
- return "";
8220
- };
8221
- (0, import_react15.useEffect)(() => {
8222
- if (thRef.current && !isCheckbox) {
8223
- setTimeout(() => {
8224
- if (thRef.current) {
8225
- setShowTitle(checkOverflow(thRef.current));
8226
- }
8227
- }, 0);
8200
+ (0, import_react15.useLayoutEffect)(() => {
8201
+ if (!isCheckbox && thRef.current) {
8202
+ const el = thRef.current;
8203
+ setShowTitle(el.scrollWidth > el.clientWidth);
8228
8204
  }
8229
8205
  }, [content, isCheckbox]);
8230
- const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
8206
+ const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
8231
8207
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
8232
8208
  "th",
8233
8209
  {
@@ -8240,7 +8216,10 @@ function TableHeaderCell({
8240
8216
  flexShrink: 0,
8241
8217
  flexGrow: 0,
8242
8218
  boxSizing: "border-box"
8243
- } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
8219
+ } : column ? {
8220
+ ...getCellStyle(column),
8221
+ textAlign: "center"
8222
+ } : void 0,
8244
8223
  title: titleText,
8245
8224
  children: content
8246
8225
  }
@@ -8249,7 +8228,6 @@ function TableHeaderCell({
8249
8228
  var TableHead = ({
8250
8229
  slots,
8251
8230
  columns,
8252
- color,
8253
8231
  size,
8254
8232
  rowCheckbox = false,
8255
8233
  hasCheckedRows,
@@ -8301,53 +8279,31 @@ function TableCell({
8301
8279
  }) {
8302
8280
  var _a, _b;
8303
8281
  const value = row[column.field];
8304
- const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
8282
+ const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
8305
8283
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
8284
+ const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
8306
8285
  const tdRef = (0, import_react16.useRef)(null);
8307
8286
  const [showTitle, setShowTitle] = (0, import_react16.useState)(false);
8308
- const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
8309
- const checkOverflow = (el) => {
8310
- if (el.scrollWidth > el.clientWidth) {
8311
- return true;
8312
- }
8313
- const children = Array.from(el.children);
8314
- for (const child of children) {
8315
- if (child.scrollWidth > child.clientWidth) {
8316
- return true;
8317
- }
8318
- }
8319
- return false;
8320
- };
8321
- (0, import_react16.useEffect)(() => {
8287
+ (0, import_react16.useLayoutEffect)(() => {
8322
8288
  if (tdRef.current && isTextContent) {
8323
- setTimeout(() => {
8324
- if (tdRef.current) {
8325
- setShowTitle(checkOverflow(tdRef.current));
8326
- }
8327
- }, 0);
8289
+ const el = tdRef.current;
8290
+ setShowTitle(el.scrollWidth > el.clientWidth);
8328
8291
  }
8329
8292
  }, [content, isTextContent]);
8330
8293
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8331
8294
  "td",
8332
8295
  {
8333
8296
  ref: tdRef,
8334
- className: clsx(
8335
- slots.td(),
8336
- classNames == null ? void 0 : classNames.td,
8337
- column.className,
8338
- isTextContent && "truncate",
8339
- isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
8340
- ),
8297
+ className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
8341
8298
  style: {
8342
8299
  ...getCellStyle(column),
8343
8300
  maxWidth: column.width || "150px",
8344
8301
  textAlign: column.align || "center",
8345
- ...!isTextContent && {
8346
- overflow: "visible",
8347
- whiteSpace: "normal"
8348
- }
8302
+ whiteSpace: isTextContent ? "nowrap" : "normal",
8303
+ overflow: isTextContent ? "hidden" : "visible",
8304
+ textOverflow: isTextContent ? "ellipsis" : void 0
8349
8305
  },
8350
- title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
8306
+ title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
8351
8307
  children: content
8352
8308
  },
8353
8309
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
package/dist/index.mjs CHANGED
@@ -9,34 +9,34 @@ import "./chunk-MBLZYQCN.mjs";
9
9
  import {
10
10
  tree_default
11
11
  } from "./chunk-F6BQCZ54.mjs";
12
- import "./chunk-DX3KXNP6.mjs";
12
+ import "./chunk-3MY6LO7N.mjs";
13
13
  import {
14
- table_default
15
- } from "./chunk-KYWCJIXI.mjs";
14
+ tabs_default
15
+ } from "./chunk-DW3BX4M2.mjs";
16
+ import "./chunk-RRAZM5D3.mjs";
17
+ import {
18
+ textarea_default
19
+ } from "./chunk-Q22PRT24.mjs";
16
20
  import "./chunk-LUWGOKLG.mjs";
17
21
  import {
18
22
  ToastProvider,
19
23
  useToast
20
- } from "./chunk-SSGCTWWW.mjs";
21
- import "./chunk-ZOTHPHXA.mjs";
24
+ } from "./chunk-L3A3IEKZ.mjs";
22
25
  import {
23
26
  toast_default
24
27
  } from "./chunk-4F7SIDZB.mjs";
28
+ import "./chunk-ZOTHPHXA.mjs";
25
29
  import "./chunk-LVFI2NOH.mjs";
26
30
  import {
27
31
  switch_default
28
32
  } from "./chunk-AGE57VDD.mjs";
29
- import "./chunk-3MY6LO7N.mjs";
30
- import {
31
- tabs_default
32
- } from "./chunk-DW3BX4M2.mjs";
33
- import "./chunk-RRAZM5D3.mjs";
34
- import {
35
- textarea_default
36
- } from "./chunk-Q22PRT24.mjs";
33
+ import "./chunk-DX3KXNP6.mjs";
37
34
  import {
38
35
  definition_table_default
39
36
  } from "./chunk-DS5CGU2X.mjs";
37
+ import {
38
+ table_default
39
+ } from "./chunk-W3V4SZV5.mjs";
40
40
  import "./chunk-MZ76AA76.mjs";
41
41
  import {
42
42
  skeleton_default
@@ -45,14 +45,16 @@ import "./chunk-OLQOLLKG.mjs";
45
45
  import {
46
46
  starRating_default
47
47
  } from "./chunk-OX4T7OBC.mjs";
48
- import "./chunk-4VWG4726.mjs";
48
+ import "./chunk-TPFN22HR.mjs";
49
49
  import {
50
- timePicker_default
51
- } from "./chunk-COGGK5Q6.mjs";
52
- import "./chunk-QCEKPS7U.mjs";
50
+ radio_default
51
+ } from "./chunk-PRNE3U26.mjs";
52
+ import "./chunk-7B7LRG5J.mjs";
53
53
  import {
54
- select_default
55
- } from "./chunk-K2RW5KLO.mjs";
54
+ pagination_default
55
+ } from "./chunk-VVCSY7DG.mjs";
56
+ import "./chunk-F3HENRVM.mjs";
57
+ import "./chunk-4VWG4726.mjs";
56
58
  import {
57
59
  datePicker_default
58
60
  } from "./chunk-2EUKWA4W.mjs";
@@ -60,38 +62,24 @@ import "./chunk-FWFEKWWD.mjs";
60
62
  import {
61
63
  day_default
62
64
  } from "./chunk-XZYQFBCT.mjs";
63
- import "./chunk-7B7LRG5J.mjs";
64
- import {
65
- pagination_default
66
- } from "./chunk-VVCSY7DG.mjs";
67
- import "./chunk-F3HENRVM.mjs";
68
- import "./chunk-TPFN22HR.mjs";
69
65
  import {
70
- radio_default
71
- } from "./chunk-PRNE3U26.mjs";
72
- import "./chunk-RLXOHILK.mjs";
66
+ timePicker_default
67
+ } from "./chunk-COGGK5Q6.mjs";
68
+ import "./chunk-QCEKPS7U.mjs";
73
69
  import {
74
- fileUpload_default
75
- } from "./chunk-5JRZQLXQ.mjs";
76
- import "./chunk-7VOQKIIK.mjs";
70
+ select_default
71
+ } from "./chunk-K2RW5KLO.mjs";
72
+ import "./chunk-7MVEAQ7Z.mjs";
77
73
  import {
78
- progress_default
79
- } from "./chunk-KH63CD55.mjs";
80
- import "./chunk-2GCSFWHD.mjs";
74
+ list_default
75
+ } from "./chunk-NGRGAY42.mjs";
81
76
  import {
82
- input_default
83
- } from "./chunk-3RTVVQA3.mjs";
77
+ listItem_default
78
+ } from "./chunk-K3M3QEEV.mjs";
84
79
  import "./chunk-DJOG6Z35.mjs";
85
80
  import {
86
81
  modal_default
87
82
  } from "./chunk-D72ILS4A.mjs";
88
- import "./chunk-7MVEAQ7Z.mjs";
89
- import {
90
- listItem_default
91
- } from "./chunk-K3M3QEEV.mjs";
92
- import {
93
- list_default
94
- } from "./chunk-NGRGAY42.mjs";
95
83
  import "./chunk-QZ3LVYJW.mjs";
96
84
  import "./chunk-MGEWSREV.mjs";
97
85
  import {
@@ -101,6 +89,18 @@ import "./chunk-32GA3YW4.mjs";
101
89
  import {
102
90
  drawer_default
103
91
  } from "./chunk-45Y7ANPK.mjs";
92
+ import "./chunk-RLXOHILK.mjs";
93
+ import {
94
+ fileUpload_default
95
+ } from "./chunk-5JRZQLXQ.mjs";
96
+ import "./chunk-7VOQKIIK.mjs";
97
+ import {
98
+ progress_default
99
+ } from "./chunk-KH63CD55.mjs";
100
+ import "./chunk-2GCSFWHD.mjs";
101
+ import {
102
+ input_default
103
+ } from "./chunk-3RTVVQA3.mjs";
104
104
  import "./chunk-3OCNT22V.mjs";
105
105
  import {
106
106
  areaChart_default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.202",
3
+ "version": "0.1.203",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import {
3
- getToastPosition
4
- } from "./chunk-ZOTHPHXA.mjs";
5
2
  import {
6
3
  toast_default
7
4
  } from "./chunk-4F7SIDZB.mjs";
5
+ import {
6
+ getToastPosition
7
+ } from "./chunk-ZOTHPHXA.mjs";
8
8
 
9
9
  // src/components/toast/use-toast.tsx
10
10
  import { createContext, useContext, useState, useCallback, useEffect, useRef } from "react";