@omer-x/tailwind-ui-kit 1.0.0-alpha.25 → 1.0.0-alpha.27

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 CHANGED
@@ -134,6 +134,7 @@ A Base UI [`Switch`](https://base-ui.com/react/components/switch) with its label
134
134
  | Prop | Type | Default | Description |
135
135
  |------|------|---------|-------------|
136
136
  | `label` | `ReactNode` | | Text next to the switch (required) |
137
+ | `labelClassName` | `string` | | Classes for the `<label>` around the switch and its text (default `flex items-center gap-2 text-sm font-normal`) |
137
138
  | `renderThumb` | `RenderProp<"span", SwitchState>` | | Style the thumb |
138
139
  | `value` | `string` | `"true"` | Submitted when checked |
139
140
  | `uncheckedValue` | `string` | `"false"` | Submitted when unchecked |
@@ -408,7 +409,7 @@ A `DialogHandle<Payload>` has `open(triggerId?)`, `openWithPayload(payload)`, `c
408
409
 
409
410
  #### `Container`
410
411
 
411
- Tailwind's `container`, centered with horizontal padding (`container mx-auto px-3`). Accepts `className` and `children`.
412
+ Tailwind's `container`, centered with horizontal padding (`container mx-auto px-3`). Accepts all `<div>` props.
412
413
 
413
414
  ### `@omer-x/tailwind-ui-kit/page`
414
415
 
@@ -427,6 +428,8 @@ Pagination inside a `<nav>`. It shows previous/next arrows, the first and last p
427
428
  | `renderEllipsis` | render prop | Renders an ellipsis (a `<span aria-hidden>`) |
428
429
  | `aria-label` | `string` | The navigation's label. Default `"Pagination"` |
429
430
  | `previousLabel` / `nextLabel` | `string` | The arrows' accessible names. Default `"Previous page"` / `"Next page"` |
431
+ | `previousContent` / `nextContent` | `ReactNode` | The arrows' content, e.g. icons. Default `«` / `»` |
432
+ | `className` | `string` | Classes for the `<nav>`. Default `flex gap-3` |
430
433
  | …rest | `<nav>` props | |
431
434
 
432
435
  Style the current page with `aria-[current=page]:`.
@@ -464,16 +467,25 @@ const items = usePagination({ totalItems, itemsPerPage, currentPage, siblings: 1
464
467
 
465
468
  ### `@omer-x/tailwind-ui-kit/table`
466
469
 
467
- #### `Tdx`
470
+ #### `TableCell`
468
471
 
469
- A `<td>` whose content is cut to a single line with an ellipsis instead of widening the column. Accepts `className` and `children`.
472
+ A `<td>` that accepts all `<td>` props (`colSpan`, `rowSpan`, `title`, event handlers, …).
473
+
474
+ | Prop | Type | Description |
475
+ |------|------|-------------|
476
+ | `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
477
 
471
478
  ```tsx
472
479
  <tr>
473
- <Tdx className="max-w-48">{longDescription}</Tdx>
480
+ <TableCell overflow="truncate" className="max-w-48">{product.description}</TableCell>
481
+ <TableCell overflow={expanded ? "wrap" : "truncate"}>{product.notes}</TableCell>
474
482
  </tr>
475
483
  ```
476
484
 
485
+ #### `Tdx` (deprecated)
486
+
487
+ Use `<TableCell overflow="truncate">` instead. `Tdx` is kept as an alias for it and accepts the same `<td>` props.
488
+
477
489
  ### `@omer-x/tailwind-ui-kit/elements`
478
490
 
479
491
  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.
@@ -9,6 +9,8 @@ export type SwitchState = {
9
9
  type BaseSwitchProps = Omit<ComponentProps<"span">, "onChange" | "defaultChecked" | "defaultValue"> & {
10
10
  label: ReactNode;
11
11
  render?: RenderProp<"span", SwitchState>;
12
+ /** Classes for the `<label>` around the switch and its text. */
13
+ labelClassName?: string;
12
14
  renderThumb?: RenderProp<"span", SwitchState>;
13
15
  name?: string;
14
16
  /** Submitted when checked. */
@@ -29,5 +31,5 @@ type BaseSwitchProps = Omit<ComponentProps<"span">, "onChange" | "defaultChecked
29
31
  /** Set to `true` when `render` renders a `<button>`. */
30
32
  nativeButton?: boolean;
31
33
  };
32
- declare const BaseSwitch: ({ label, renderThumb, onCheckedChange, value, uncheckedValue, className, ...otherProps }: BaseSwitchProps) => import("react").JSX.Element;
34
+ declare const BaseSwitch: ({ label, labelClassName, renderThumb, onCheckedChange, value, uncheckedValue, className, ...otherProps }: BaseSwitchProps) => import("react").JSX.Element;
33
35
  export { BaseSwitch as default };
@@ -4,8 +4,8 @@ import { cn } from "cn";
4
4
  import "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/components/form/BaseSwitch.tsx
7
- const BaseSwitch = ({ label, renderThumb, onCheckedChange, value = "true", uncheckedValue = "false", className, ...otherProps }) => /* @__PURE__ */ jsxs("label", {
8
- className: "flex items-center gap-2 text-sm font-normal",
7
+ const BaseSwitch = ({ label, labelClassName, renderThumb, onCheckedChange, value = "true", uncheckedValue = "false", className, ...otherProps }) => /* @__PURE__ */ jsxs("label", {
8
+ className: cn("flex items-center gap-2 text-sm font-normal", labelClassName),
9
9
  children: [/* @__PURE__ */ jsx(Switch.Root, {
10
10
  ...otherProps,
11
11
  value,
@@ -1,7 +1,4 @@
1
- import { ComponentProps, ReactNode } from "react";
2
- type ContainerProps = ComponentProps<"div"> & {
3
- className?: string;
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, children }) => /* @__PURE__ */ jsx("div", {
6
+ const Container = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
7
7
  className: cn("container mx-auto px-3", className),
8
- children
8
+ ...props
9
9
  });
10
10
  export { Container as default };
@@ -14,8 +14,14 @@ type PaginationProps = Omit<ComponentProps<"nav">, "children"> & PaginationOptio
14
14
  renderButton?: ComponentProps<typeof JustButton>["render"];
15
15
  /** Renders an ellipsis (a `<span>`) */
16
16
  renderEllipsis?: ComponentProps<typeof JustSpan>["render"];
17
+ /** The previous arrow's accessible name. */
17
18
  previousLabel?: string;
19
+ /** The next arrow's accessible name. */
18
20
  nextLabel?: string;
21
+ /** The previous arrow's content, e.g. an icon. Default `«` */
22
+ previousContent?: ReactNode;
23
+ /** The next arrow's content, e.g. an icon. Default `»` */
24
+ nextContent?: ReactNode;
19
25
  };
20
- declare const Pagination: ({ totalItems, itemsPerPage, currentPage, siblings, renderLink, renderButton, renderEllipsis, previousLabel, nextLabel, className, ...otherProps }: PaginationProps) => import("react").JSX.Element;
26
+ declare const Pagination: ({ totalItems, itemsPerPage, currentPage, siblings, renderLink, renderButton, renderEllipsis, previousLabel, nextLabel, previousContent, nextContent, className, ...otherProps }: PaginationProps) => import("react").JSX.Element;
21
27
  export { Pagination as default };
@@ -6,7 +6,7 @@ import JustSpan from "../elements/JustSpan.js";
6
6
  import usePagination from "./usePagination.js";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  // src/components/page/Pagination.tsx
9
- const PaginationItemView = ({ item, renderLink, renderButton, renderEllipsis, previousLabel, nextLabel }) => {
9
+ const PaginationItemView = ({ item, renderLink, renderButton, renderEllipsis, previousLabel, nextLabel, previousContent, nextContent }) => {
10
10
  switch (item.type) {
11
11
  case "ellipsis": return /* @__PURE__ */ jsx(JustSpan, {
12
12
  render: renderEllipsis,
@@ -20,7 +20,7 @@ const PaginationItemView = ({ item, renderLink, renderButton, renderEllipsis, pr
20
20
  case "previous":
21
21
  case "next": {
22
22
  const label = item.type === "previous" ? previousLabel : nextLabel;
23
- const children = item.type === "previous" ? "«" : "»";
23
+ const children = item.type === "previous" ? previousContent : nextContent;
24
24
  if (item.disabled) return /* @__PURE__ */ jsx(JustButton, {
25
25
  render: renderButton,
26
26
  type: "button",
@@ -42,7 +42,7 @@ const itemKey = (item, index) => {
42
42
  default: return item.type;
43
43
  }
44
44
  };
45
- const Pagination = ({ totalItems, itemsPerPage, currentPage, siblings, renderLink, renderButton, renderEllipsis, previousLabel = "Previous page", nextLabel = "Next page", className, ...otherProps }) => {
45
+ const Pagination = ({ totalItems, itemsPerPage, currentPage, siblings, renderLink, renderButton, renderEllipsis, previousLabel = "Previous page", nextLabel = "Next page", previousContent = "«", nextContent = "»", className, ...otherProps }) => {
46
46
  const items = usePagination({
47
47
  totalItems,
48
48
  itemsPerPage,
@@ -59,7 +59,9 @@ const Pagination = ({ totalItems, itemsPerPage, currentPage, siblings, renderLin
59
59
  renderButton,
60
60
  renderEllipsis,
61
61
  previousLabel,
62
- nextLabel
62
+ nextLabel,
63
+ previousContent,
64
+ nextContent
63
65
  }, itemKey(item, index)))
64
66
  });
65
67
  };
@@ -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 { ReactNode } from "react";
2
- type TdxProps = {
3
- className?: string;
4
- children?: ReactNode;
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 "react";
2
+ import TableCell from "./TableCell.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  // src/components/table/Tdx.tsx
5
- const Tdx = ({ className, children }) => /* @__PURE__ */ jsx("td", {
6
- className,
7
- children: /* @__PURE__ */ jsx("div", {
8
- className: "table w-full table-fixed",
9
- children: /* @__PURE__ */ jsx("span", {
10
- className: "table-cell truncate",
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 };
@@ -1,2 +1,3 @@
1
+ import TableCell, { TableCellOverflow } from "./TableCell.js";
1
2
  import Tdx from "./Tdx.js";
2
- export { Tdx };
3
+ export { TableCell, type TableCellOverflow, Tdx };
@@ -1 +1,3 @@
1
- export { default as Tdx } from "./Tdx.js";
1
+ import TableCell from "./TableCell.js";
2
+ import Tdx from "./Tdx.js";
3
+ export { TableCell, Tdx };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/tailwind-ui-kit",
3
- "version": "1.0.0-alpha.25",
3
+ "version": "1.0.0-alpha.27",
4
4
  "description": "Tailwind CSS-based React component library for building user interfaces",
5
5
  "keywords": [
6
6
  "tailwind",