@omer-x/tailwind-ui-kit 1.0.0-alpha.26 → 1.0.0-alpha.28
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 |
|
|
@@ -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]:`.
|
|
@@ -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,
|
|
@@ -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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omer-x/tailwind-ui-kit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.28",
|
|
4
4
|
"description": "Tailwind CSS-based React component library for building user interfaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tailwind",
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"type": "module",
|
|
29
|
-
"
|
|
30
|
-
"types": "./dist/index.d.ts",
|
|
29
|
+
"types": "./typescript-badge.d.ts",
|
|
31
30
|
"files": [
|
|
32
31
|
"dist/",
|
|
33
|
-
"MIGRATION.md"
|
|
32
|
+
"MIGRATION.md",
|
|
33
|
+
"typescript-badge.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"exports": {
|
|
36
|
+
"./package.json": "./package.json",
|
|
36
37
|
"./layout": {
|
|
37
38
|
"types": "./dist/components/layout/index.d.ts",
|
|
38
39
|
"import": "./dist/components/layout/index.js"
|