+ )}
+ {DEBUG_SHOW_DATA_GRID && (
+
+
+ Data-Grid
+
+
+
+ Update number of words in second column of first row:
+ }
+ onClick={() => setDataGridRowWords((words) => words.slice(0, -1))}
+ >
+ Remove Word
+
+ }
+ onClick={() => setDataGridRowWords((words) => [...words, getRandomWord()])}
+ >
+ Add Word
+
+
+
+ )}
+
+ );
+}
+
+const gridColumns: GridColDef[] = [
+ {
+ field: "firstName",
+ headerName: "First name",
+ resizable: true,
+ width: 250,
+ renderCell: ({ row }) => {
+ return {row.firstName};
+ },
+ },
+ {
+ field: "lastName",
+ headerName: "Last name",
+ flex: 1,
+ renderCell: ({ row }) => {
+ return {row.lastName};
+ },
+ },
+];
+
+storiesOf("@comet/admin/helpers", module)
+ .addDecorator(storyRouterDecorator())
+ .add("Ellipsis Tooltip", () => );
diff --git a/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/DataGrid.stories.tsx b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/DataGrid.stories.tsx
new file mode 100644
index 0000000000..c6245d57ed
--- /dev/null
+++ b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/DataGrid.stories.tsx
@@ -0,0 +1,40 @@
+import { EllipsisTooltip } from "@comet/admin";
+import { DataGrid, GridColDef } from "@mui/x-data-grid";
+import { storiesOf } from "@storybook/react";
+import * as React from "react";
+
+storiesOf("stories/components/EllipsisTooltip", module).add("DataGrid", () => {
+ const words = ["Cursus", "Ridiculus", "Pharetra", "Ligula", "Sem", "Nullam", "Viverra", "Vestibulum", "Vestibulum", "Vestibulum"];
+
+ const getSomeWords = (numberOfWords: number) => {
+ return [...words, ...words, ...words].slice(0, numberOfWords).join(" ");
+ };
+
+ const gridRows = Array.from({ length: 5 }).map((_, index) => ({
+ id: index,
+ firstName: getSomeWords(1 * (index + 2)),
+ lastName: getSomeWords(3 * (index + 2)),
+ }));
+
+ const gridColumns: GridColDef[] = [
+ {
+ field: "firstName",
+ headerName: "First name",
+ resizable: true,
+ width: 250,
+ renderCell: ({ row }) => {
+ return {row.firstName};
+ },
+ },
+ {
+ field: "lastName",
+ headerName: "Last name",
+ flex: 1,
+ renderCell: ({ row }) => {
+ return {row.lastName};
+ },
+ },
+ ];
+
+ return ;
+});
diff --git a/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/EllipsisTooltip.stories.mdx b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/EllipsisTooltip.stories.mdx
new file mode 100644
index 0000000000..eea450874a
--- /dev/null
+++ b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/EllipsisTooltip.stories.mdx
@@ -0,0 +1,44 @@
+import { Meta, Story, Canvas } from "@storybook/addon-docs";
+
+
+
+# EllipsisTooltip
+
+`EllipsisTooltip` is used to automatically add a tooltip to text that is too long to fit in its container.
+This is useful for displaying text in a table or data grid when the text might be too long to fit in the column.
+
+## Simple Example
+
+
+
+## Noteworthy
+
+Some noteworthy things to keep in mind when using `EllipsisTooltip`.
+
+### Usage inside a table
+
+When used inside a table (standard HTML table or MuiTable), the width of the individual cells must be limited.
+This can be done by setting a fixed width on the cell or setting `table-layout: fixed` on the table.
+
+### Usage with text styling
+
+When used in combination with text styling, e.g., `MuiTypography` the `EllipsisTooltip` must be contained by the element that styles the text.
+This will make sure only the normal text is styled, and the text inside the tooltip looks the same as in any other tooltip.
+
+
+
+## Example with `MuiTable`
+
+
+
+## Example with `MuiDataGrid`
+
+
diff --git a/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/Simple.stories.tsx b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/Simple.stories.tsx
new file mode 100644
index 0000000000..5827197b3f
--- /dev/null
+++ b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/Simple.stories.tsx
@@ -0,0 +1,23 @@
+import { EllipsisTooltip } from "@comet/admin";
+import { Paper, Stack, Typography } from "@mui/material";
+import { storiesOf } from "@storybook/react";
+import * as React from "react";
+
+storiesOf("stories/components/EllipsisTooltip", module).add("Simple", () => {
+ return (
+
+
+
+ Short Text
+
+
+
+
+
+ Really long text that requires the tooltip to show the entire text that should be shown in this element.
+
+
+
+
+ );
+});
diff --git a/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/Table.stories.tsx b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/Table.stories.tsx
new file mode 100644
index 0000000000..cc92e18f19
--- /dev/null
+++ b/packages/admin/admin-stories/src/docs/components/EllipsisTooltip/Table.stories.tsx
@@ -0,0 +1,39 @@
+import { EllipsisTooltip } from "@comet/admin";
+import { Table, TableBody, TableCell, TableHead, TableRow } from "@mui/material";
+import { storiesOf } from "@storybook/react";
+import * as React from "react";
+
+storiesOf("stories/components/EllipsisTooltip", module).add("Table", () => {
+ const words = ["Cursus", "Ridiculus", "Pharetra", "Ligula", "Sem", "Nullam", "Viverra", "Vestibulum", "Vestibulum", "Vestibulum"];
+
+ const getWordsForCell = (cellNumber: number, rowIndex: number) => {
+ return words.slice(0, cellNumber * (rowIndex + 1)).join(" ");
+ };
+
+ return (
+