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

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
@@ -27,28 +27,24 @@ npm install @omer-x/tailwind-ui-kit
27
27
  Peer dependencies:
28
28
 
29
29
  ```sh
30
- npm install react@19 react-dom@19 tailwindcss@4 @base-ui/react@1
30
+ npm install react@19 react-dom@19 tailwindcss@4 @base-ui/react@1 zod@4
31
31
  ```
32
32
 
33
- `BaseForm` needs [`@omer-x/next-form-actions`](https://github.com/omermecitoglu/next-form-actions) v2 for its action and result types, and `BaseFormField` needs [`zod`](https://zod.dev) for its `schema` prop.
33
+ `BaseForm` needs [`@omer-x/next-form-actions`](https://github.com/omermecitoglu/next-form-actions) v2 for its action and result types, and `BaseFormField` needs [`zod`](https://zod.dev) v4 for its `schema` prop.
34
34
 
35
35
  ## Setup
36
36
 
37
- ### 1. Let Tailwind scan the package
38
-
39
37
  Tailwind v4 does not scan `node_modules`, so the classes used inside the components won't be generated unless you add an `@source` line to your global CSS. The path is relative to the CSS file:
40
38
 
41
39
  ```css
42
40
  /* src/app/globals.css */
43
41
  @import "tailwindcss";
44
- @source "../../node_modules/@omer-x/tailwind-ui-kit";
42
+ @source "../../node_modules/@omer-x/tailwind-ui-kit/dist";
45
43
  ```
46
44
 
47
- Some components use the `dark:` variant (e.g. the backdrop of `BaseDialog.Popup`). They follow whatever `dark` variant your app defines.
48
-
49
- ### 2. Your bundler must support CSS modules
45
+ That's the only setup. The kit ships no CSS files: everything, including the ripple animation, is Tailwind utilities.
50
46
 
51
- The ripple effect imports a CSS module from `node_modules`. Next.js and Vite handle this out of the box.
47
+ Some components use the `dark:` variant (e.g. the backdrop of `BaseDialog.Popup`). They follow whatever `dark` variant your app defines.
52
48
 
53
49
  ## Theming: wrap once, use everywhere
54
50
 
@@ -297,6 +293,25 @@ Error texts come from `BaseForm`'s `formatMessage`. Render functions get `FieldS
297
293
  />
298
294
  ```
299
295
 
296
+ **One schema for the server and the client.** Define one Zod object schema per form. Use it to validate in the server action, and pass its fields to `BaseFormField`. The browser checks then always match the server rules:
297
+
298
+ ```ts
299
+ // src/schemas/user.ts
300
+ import { z } from "zod";
301
+
302
+ export const UserSchema = z.object({
303
+ username: z.string().min(3).max(20),
304
+ email: z.email(),
305
+ });
306
+ ```
307
+
308
+ ```tsx
309
+ <BaseFormField name="username" label="Username" schema={UserSchema.shape.username} control={<Input />} />
310
+ <BaseFormField name="email" label="Email" schema={UserSchema.shape.email} control={<Input type="email" />} />
311
+ ```
312
+
313
+ The browser can check only the rules that map to HTML attributes (`required`, `minLength`, `maxLength`, `min`, `max`, …). Refinements, transforms, cross-field rules and async checks such as "username taken" only run on the server, and come back as `fieldErrors`. Users can also bypass browser checks, so **the server action must always validate the full schema**. The client constraints only give earlier feedback.
314
+
300
315
  ### `@omer-x/tailwind-ui-kit/dialog`
301
316
 
302
317
  #### `BaseDialog`
@@ -459,6 +474,44 @@ A `<td>` whose content is cut to a single line with an ellipsis instead of widen
459
474
  </tr>
460
475
  ```
461
476
 
477
+ ### `@omer-x/tailwind-ui-kit/elements`
478
+
479
+ 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.
480
+
481
+ ```tsx
482
+ import { JustDiv } from "@omer-x/tailwind-ui-kit/elements";
483
+
484
+ <JustDiv className="p-4" render={<section />}>…</JustDiv>
485
+ ```
486
+
487
+ ### `@omer-x/tailwind-ui-kit/hooks`
488
+
489
+ #### `useRipples`
490
+
491
+ The ripple effect of `BaseButton`, for your own clickable elements. Returns `[handleClick, ripples]`: call `handleClick` from `onClick` and render `ripples` inside the element.
492
+
493
+ - The element needs `relative` (the ripples are positioned absolutely and clipped to its rounded corners).
494
+ - Ripples use `bg-current`, so they follow the text color. They start from the center on keyboard clicks and are hidden when the user prefers reduced motion.
495
+ - It imports a CSS module (see [Setup](#2-your-bundler-must-support-css-modules)).
496
+
497
+ ```tsx
498
+ import { useRipples } from "@omer-x/tailwind-ui-kit/hooks";
499
+
500
+ const Chip = ({ children, onClick, ...props }: ComponentProps<"button">) => {
501
+ const [handleRipple, ripples] = useRipples();
502
+ return (
503
+ <button
504
+ {...props}
505
+ className="relative rounded-full px-3 py-1"
506
+ onClick={event => { handleRipple(event); onClick?.(event); }}
507
+ >
508
+ {children}
509
+ {ripples}
510
+ </button>
511
+ );
512
+ };
513
+ ```
514
+
462
515
  ### `@omer-x/tailwind-ui-kit/utils`
463
516
 
464
517
  Helpers for building your own components on the kit, so you never import Base UI.
@@ -0,0 +1,6 @@
1
+ import JustAnchor from "./JustAnchor.js";
2
+ import JustButton from "./JustButton.js";
3
+ import JustDiv from "./JustDiv.js";
4
+ import JustInput from "./JustInput.js";
5
+ import JustSpan from "./JustSpan.js";
6
+ export { JustAnchor, JustButton, JustDiv, JustInput, JustSpan };
@@ -0,0 +1,6 @@
1
+ import JustAnchor from "./JustAnchor.js";
2
+ import JustButton from "./JustButton.js";
3
+ import JustDiv from "./JustDiv.js";
4
+ import JustInput from "./JustInput.js";
5
+ import JustSpan from "./JustSpan.js";
6
+ export { JustAnchor, JustButton, JustDiv, JustInput, JustSpan };
@@ -0,0 +1,2 @@
1
+ import { useRipples } from "./useRipples.js";
2
+ export { useRipples };
@@ -0,0 +1 @@
1
+ export { useRipples } from "./useRipples.js";
@@ -1,6 +1,4 @@
1
- import { cn } from "cn";
2
1
  import { useEffect, useRef, useState } from "react";
3
- import styles from "../styles/ripple.module.css";
4
2
  import { jsx } from "react/jsx-runtime";
5
3
  // src/hooks/useRipples.tsx
6
4
  const RIPPLE_DURATION = 600;
@@ -36,7 +34,7 @@ function useRipples() {
36
34
  return [handleClick, /* @__PURE__ */ jsx("div", {
37
35
  className: "absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit] motion-reduce:hidden",
38
36
  children: ripples.map((ripple) => /* @__PURE__ */ jsx("span", {
39
- className: cn(styles.animation, "absolute rounded-full bg-current opacity-10"),
37
+ className: "absolute rounded-full bg-current scale-400 opacity-0 transition-[scale,opacity] duration-600 ease-linear starting:scale-0 starting:opacity-10",
40
38
  style: {
41
39
  left: ripple.x,
42
40
  top: ripple.y,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/tailwind-ui-kit",
3
- "version": "1.0.0-alpha.24",
3
+ "version": "1.0.0-alpha.25",
4
4
  "description": "Tailwind CSS-based React component library for building user interfaces",
5
5
  "keywords": [
6
6
  "tailwind",
@@ -57,6 +57,14 @@
57
57
  "types": "./dist/components/page/index.d.ts",
58
58
  "import": "./dist/components/page/index.js"
59
59
  },
60
+ "./elements": {
61
+ "types": "./dist/components/elements/index.d.ts",
62
+ "import": "./dist/components/elements/index.js"
63
+ },
64
+ "./hooks": {
65
+ "types": "./dist/hooks/index.d.ts",
66
+ "import": "./dist/hooks/index.js"
67
+ },
60
68
  "./utils": {
61
69
  "types": "./dist/utils/index.d.ts",
62
70
  "import": "./dist/utils/index.js"
@@ -81,7 +89,8 @@
81
89
  "@omer-x/next-form-actions": "^2.0.0-alpha.1",
82
90
  "react": "^19",
83
91
  "react-dom": "^19",
84
- "tailwindcss": "^4"
92
+ "tailwindcss": "^4",
93
+ "zod": "^4"
85
94
  },
86
95
  "devDependencies": {
87
96
  "@omer-x/eslint-config": "^2.3.3",
@@ -104,6 +113,7 @@
104
113
  "tsdown": "^0.23.7",
105
114
  "typescript": "^6.0.3",
106
115
  "vite": "^8.4.0",
107
- "vitest": "^5.1.2"
116
+ "vitest": "^5.1.2",
117
+ "zod": "^4.6.7"
108
118
  }
109
119
  }
@@ -1,11 +0,0 @@
1
- @keyframes ripple {
2
- to {
3
- transform: scale(4);
4
- opacity: 0;
5
- }
6
- }
7
-
8
- .animation {
9
- animation: ripple 600ms linear;
10
- transform: scale(0);
11
- }