lecom-ui 5.4.17 → 5.4.18

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.
@@ -96,7 +96,7 @@ function DataTable({
96
96
  const lastColumnFixed = rowsElem.length - 1 === rowElemIndex;
97
97
  const lastRow = listRows.length - 1 === listRowIndex;
98
98
  const currentElemIsTh = currentElem.tagName === "TH";
99
- const hasTruncate = currentElem.style.overflow === "hidden" && currentElem.style.textOverflow === "ellipsis";
99
+ const hasTruncate = currentElem.querySelector(".truncate") !== null;
100
100
  const boxShadowWidth = currentElemIsTh ? "-1.5px" : "-0.5px";
101
101
  const boxShadow = `#c9c9c9 0px ${lastRow ? "0px" : boxShadowWidth} 0px inset`;
102
102
  currentElem.style.position = "sticky";
@@ -114,35 +114,11 @@ function DataTable({
114
114
  const allCells = document.querySelectorAll("table#data-table td");
115
115
  allCells.forEach((cell) => {
116
116
  const cellElem = cell;
117
- const hasTruncate = cellElem.style.overflow === "hidden" && cellElem.style.textOverflow === "ellipsis";
117
+ const hasTruncate = cellElem.querySelector(".truncate") !== null;
118
118
  if (hasTruncate && !cellElem.hasAttribute("data-fixed")) {
119
119
  cellElem.style.backgroundColor = "#ffffff";
120
120
  }
121
121
  });
122
- const allRows = document.querySelectorAll("table#data-table tbody tr");
123
- allRows.forEach((row) => {
124
- const rowElem = row;
125
- rowElem.addEventListener("mouseenter", () => {
126
- const cells = rowElem.querySelectorAll("td");
127
- cells.forEach((cell) => {
128
- const cellElem = cell;
129
- const hasTruncate = cellElem.style.overflow === "hidden" && cellElem.style.textOverflow === "ellipsis";
130
- if (hasTruncate || cellElem.hasAttribute("data-fixed")) {
131
- cellElem.style.backgroundColor = "#f3f4f6";
132
- }
133
- });
134
- });
135
- rowElem.addEventListener("mouseleave", () => {
136
- const cells = rowElem.querySelectorAll("td");
137
- cells.forEach((cell) => {
138
- const cellElem = cell;
139
- const hasTruncate = cellElem.style.overflow === "hidden" && cellElem.style.textOverflow === "ellipsis";
140
- if (hasTruncate || cellElem.hasAttribute("data-fixed")) {
141
- cellElem.style.backgroundColor = "#ffffff";
142
- }
143
- });
144
- });
145
- });
146
122
  }
147
123
  }, [isLoading, sorting]);
148
124
  const throttle = React.useCallback(
@@ -152,6 +152,7 @@ function buildColumns({
152
152
  {
153
153
  variant: size === "small" ? "body-medium-400" : "body-large-400",
154
154
  textColor: "text-grey-800",
155
+ className: "truncate",
155
156
  title: row.getValue(externalColumn.key)
156
157
  },
157
158
  row.getValue(externalColumn.key)
@@ -13,18 +13,7 @@ function Table({
13
13
  onIsSelected,
14
14
  expandedContent
15
15
  }) {
16
- const styleColumn = React.useCallback((meta, elem) => {
17
- if (elem === "td" && meta.truncate) {
18
- return {
19
- width: meta.width,
20
- maxWidth: meta.maxWidth ?? "0",
21
- minWidth: meta.minWidth ?? "0",
22
- overflow: "hidden",
23
- textOverflow: "ellipsis",
24
- whiteSpace: "nowrap",
25
- textAlign: meta.align || "left"
26
- };
27
- }
16
+ const styleColumn = React.useCallback((meta) => {
28
17
  return {
29
18
  width: meta.width,
30
19
  maxWidth: meta.maxWidth ?? void 0,
@@ -59,7 +48,7 @@ function Table({
59
48
  "data-header": header.id,
60
49
  "data-fixed": getFixed(header.column.columnDef.meta),
61
50
  style: {
62
- ...styleColumn(header.column.columnDef.meta, "th"),
51
+ ...styleColumn(header.column.columnDef.meta),
63
52
  ...header.column.columnDef.meta?.headerStyle
64
53
  }
65
54
  },
@@ -83,12 +72,9 @@ function Table({
83
72
  ),
84
73
  "data-column": cell.column.id,
85
74
  "data-fixed": getFixed(cell.column.columnDef.meta),
86
- style: styleColumn(
87
- cell.column.columnDef.meta,
88
- "td"
89
- )
75
+ style: styleColumn(cell.column.columnDef.meta)
90
76
  },
91
- flexRender(cell.column.columnDef.cell, cell.getContext())
77
+ cell.column.columnDef.meta?.truncate ? /* @__PURE__ */ React.createElement("div", { className: "truncate" }, flexRender(cell.column.columnDef.cell, cell.getContext())) : flexRender(cell.column.columnDef.cell, cell.getContext())
92
78
  ))
93
79
  ), row.getIsExpanded() && expandedContent && /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { colSpan: columns.length, className: "p-0" }, expandedContent(row))))) : /* @__PURE__ */ React.createElement("tr", { className: "border-b-[0.5px] [&_td]:hover:bg-grey-100 [&_td]:data-[state=selected]:bg-grey-100" }, /* @__PURE__ */ React.createElement(
94
80
  "td",
package/dist/index.d.ts CHANGED
@@ -786,8 +786,8 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
786
786
 
787
787
  declare const inputVariants: (props?: ({
788
788
  variant?: "default" | "filled" | "borderless" | null | undefined;
789
- size?: "small" | "default" | "large" | null | undefined;
790
- radius?: "small" | "default" | "large" | "full" | null | undefined;
789
+ size?: "default" | "small" | "large" | null | undefined;
790
+ radius?: "default" | "small" | "large" | "full" | null | undefined;
791
791
  } & class_variance_authority_types.ClassProp) | undefined) => string;
792
792
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
793
793
  sufix?: React$1.ReactNode;
@@ -992,7 +992,7 @@ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimi
992
992
  declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
993
993
 
994
994
  declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
995
- declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLDivElement | HTMLButtonElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement>, "id" | "onResize"> & {
995
+ declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement>, "id" | "onResize"> & {
996
996
  className?: string;
997
997
  collapsedSize?: number | undefined;
998
998
  collapsible?: boolean | undefined;
@@ -1159,9 +1159,9 @@ declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
1159
1159
 
1160
1160
  declare const textareaVariants: (props?: ({
1161
1161
  variant?: "default" | "filled" | "borderless" | null | undefined;
1162
- size?: "small" | "default" | "large" | null | undefined;
1163
- radius?: "small" | "default" | "large" | "full" | null | undefined;
1164
- resize?: "both" | "horizontal" | "vertical" | "default" | "vertical-limited" | null | undefined;
1162
+ size?: "default" | "small" | "large" | null | undefined;
1163
+ radius?: "default" | "small" | "large" | "full" | null | undefined;
1164
+ resize?: "default" | "both" | "horizontal" | "vertical" | "vertical-limited" | null | undefined;
1165
1165
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1166
1166
  interface TextareaProps extends React$1.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {
1167
1167
  }
@@ -1300,7 +1300,7 @@ declare const SheetClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dial
1300
1300
  declare const SheetPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
1301
1301
  declare const SheetOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
1302
1302
  declare const sheetVariants: (props?: ({
1303
- side?: "top" | "bottom" | "left" | "right" | null | undefined;
1303
+ side?: "left" | "right" | "top" | "bottom" | null | undefined;
1304
1304
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1305
1305
  interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
1306
1306
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.4.17",
3
+ "version": "5.4.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",