@omer-x/tailwind-ui-kit 1.0.0-alpha.25 → 1.0.0-alpha.26
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/README.md +13 -4
- package/dist/components/layout/Container.d.ts +3 -6
- package/dist/components/layout/Container.js +2 -2
- package/dist/components/table/TableCell.d.ts +13 -0
- package/dist/components/table/TableCell.js +17 -0
- package/dist/components/table/Tdx.d.ts +5 -6
- package/dist/components/table/Tdx.js +7 -10
- package/dist/components/table/index.d.ts +2 -1
- package/dist/components/table/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -408,7 +408,7 @@ A `DialogHandle<Payload>` has `open(triggerId?)`, `openWithPayload(payload)`, `c
|
|
|
408
408
|
|
|
409
409
|
#### `Container`
|
|
410
410
|
|
|
411
|
-
Tailwind's `container`, centered with horizontal padding (`container mx-auto px-3`). Accepts
|
|
411
|
+
Tailwind's `container`, centered with horizontal padding (`container mx-auto px-3`). Accepts all `<div>` props.
|
|
412
412
|
|
|
413
413
|
### `@omer-x/tailwind-ui-kit/page`
|
|
414
414
|
|
|
@@ -464,16 +464,25 @@ const items = usePagination({ totalItems, itemsPerPage, currentPage, siblings: 1
|
|
|
464
464
|
|
|
465
465
|
### `@omer-x/tailwind-ui-kit/table`
|
|
466
466
|
|
|
467
|
-
#### `
|
|
467
|
+
#### `TableCell`
|
|
468
468
|
|
|
469
|
-
A `<td>`
|
|
469
|
+
A `<td>` that accepts all `<td>` props (`colSpan`, `rowSpan`, `title`, event handlers, …).
|
|
470
|
+
|
|
471
|
+
| Prop | Type | Description |
|
|
472
|
+
|------|------|-------------|
|
|
473
|
+
| `overflow` | `"wrap" \| "truncate"` | `"wrap"` (default) is a normal `<td>`. `"truncate"` keeps the content on one line and cuts it with an ellipsis instead of widening the column. Exposed as `data-overflow`. |
|
|
470
474
|
|
|
471
475
|
```tsx
|
|
472
476
|
<tr>
|
|
473
|
-
<
|
|
477
|
+
<TableCell overflow="truncate" className="max-w-48">{product.description}</TableCell>
|
|
478
|
+
<TableCell overflow={expanded ? "wrap" : "truncate"}>{product.notes}</TableCell>
|
|
474
479
|
</tr>
|
|
475
480
|
```
|
|
476
481
|
|
|
482
|
+
#### `Tdx` (deprecated)
|
|
483
|
+
|
|
484
|
+
Use `<TableCell overflow="truncate">` instead. `Tdx` is kept as an alias for it and accepts the same `<td>` props.
|
|
485
|
+
|
|
477
486
|
### `@omer-x/tailwind-ui-kit/elements`
|
|
478
487
|
|
|
479
488
|
Bare HTML elements whose only addition is a `render` prop (`RenderProp<Tag>`): `JustAnchor` (`<a>`), `JustButton` (`<button>`), `JustDiv` (`<div>`), `JustInput` (`<input>`) and `JustSpan` (`<span>`). They take all props of their element and add no styles.
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { ComponentProps
|
|
2
|
-
type ContainerProps = ComponentProps<"div"
|
|
3
|
-
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
};
|
|
6
|
-
declare const Container: ({ className, children }: ContainerProps) => import("react").JSX.Element;
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
type ContainerProps = ComponentProps<"div">;
|
|
3
|
+
declare const Container: ({ className, ...props }: ContainerProps) => import("react").JSX.Element;
|
|
7
4
|
export { Container as default };
|
|
@@ -3,8 +3,8 @@ import { cn } from "cn";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/components/layout/Container.tsx
|
|
6
|
-
const Container = ({ className,
|
|
6
|
+
const Container = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
7
7
|
className: cn("container mx-auto px-3", className),
|
|
8
|
-
|
|
8
|
+
...props
|
|
9
9
|
});
|
|
10
10
|
export { Container as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export type TableCellOverflow = "wrap" | "truncate";
|
|
3
|
+
type TableCellProps = ComponentProps<"td"> & {
|
|
4
|
+
/**
|
|
5
|
+
* How content wider than the column is handled.
|
|
6
|
+
* - `"wrap"` (default): a normal `<td>`, content wraps.
|
|
7
|
+
* - `"truncate"`: one line, cut with an ellipsis instead of widening the column.
|
|
8
|
+
*/
|
|
9
|
+
overflow?: TableCellOverflow;
|
|
10
|
+
};
|
|
11
|
+
/** A `<td>` that takes all `<td>` props. Exposes `data-overflow`. */
|
|
12
|
+
declare const TableCell: ({ overflow, children, ...props }: TableCellProps) => import("react").JSX.Element;
|
|
13
|
+
export { TableCell as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/table/TableCell.tsx
|
|
5
|
+
/** A `<td>` that takes all `<td>` props. Exposes `data-overflow`. */
|
|
6
|
+
const TableCell = ({ overflow = "wrap", children, ...props }) => /* @__PURE__ */ jsx("td", {
|
|
7
|
+
"data-overflow": overflow,
|
|
8
|
+
...props,
|
|
9
|
+
children: overflow === "truncate" ? /* @__PURE__ */ jsx("div", {
|
|
10
|
+
className: "table w-full table-fixed",
|
|
11
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
12
|
+
className: "table-cell truncate",
|
|
13
|
+
children
|
|
14
|
+
})
|
|
15
|
+
}) : children
|
|
16
|
+
});
|
|
17
|
+
export { TableCell as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const Tdx: ({ className, children }: TdxProps) => import("react").JSX.Element;
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `<TableCell overflow="truncate">` instead.
|
|
4
|
+
*/
|
|
5
|
+
declare const Tdx: (props: ComponentProps<"td">) => import("react").JSX.Element;
|
|
7
6
|
export { Tdx as default };
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
2
|
+
import TableCell from "./TableCell.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
// src/components/table/Tdx.tsx
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children
|
|
12
|
-
})
|
|
13
|
-
})
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `<TableCell overflow="truncate">` instead.
|
|
7
|
+
*/
|
|
8
|
+
const Tdx = (props) => /* @__PURE__ */ jsx(TableCell, {
|
|
9
|
+
overflow: "truncate",
|
|
10
|
+
...props
|
|
14
11
|
});
|
|
15
12
|
export { Tdx as default };
|