@itamarshdev/reactwind 1.1.0 → 1.2.0

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
@@ -1,15 +1,15 @@
1
- # 🚀 ReactWind
1
+ # ReactWind
2
2
 
3
- [![Version](https://img.shields.io/npm/v/reactwind)](https://www.npmjs.com/package/reactwind)
4
- [![License](https://img.shields.io/npm/l/reactwind)](https://github.com/reactwind/reactwind/blob/main/LICENSE)
5
- [![Demo](https://img.shields.io/badge/storybook-demo-FF4785?logo=storybook)](https://itamarsharify.github.io/reactwind/storybook/index.html)
6
- [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
3
+ [![Version](https://img.shields.io/npm/v/@itamarshdev/reactwind)](https://www.npmjs.com/package/@itamarshdev/reactwind)
4
+ [![License](https://img.shields.io/npm/l/@itamarshdev/reactwind)](https://github.com/ItamarShDev/reactwind/blob/main/LICENSE)
5
+ [![Demo](https://img.shields.io/badge/storybook-demo-FF4785?logo=storybook)](https://ItamarShDev.github.io/reactwind/storybook/)
6
+ [![semantic-release](https://img.shields.io/badge/semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
7
7
 
8
8
  **ReactWind** is a JSX runtime wrapper that brings the power of Tailwind CSS shorthands and array-based classNames directly to your React components. No more template literal spaghetti or complex utility merges.
9
9
 
10
10
  ---
11
11
 
12
- ## 📦 Installation
12
+ ## Installation
13
13
 
14
14
  ```bash
15
15
  npm install @itamarshdev/reactwind
@@ -20,20 +20,20 @@ yarn add @itamarshdev/reactwind
20
20
  ```
21
21
 
22
22
 
23
- ## Features
23
+ ## Features
24
24
 
25
- - 🎯 **Prop-based Styling**: Use Tailwind utilities as props: `<div flex bg="blue-500" p={4} />`.
26
- - 🧬 **Array ClassNames**: Pass classes as clean arrays: `classNames={['text-center', isActive && 'font-bold']}`.
27
- - 💨 **Zero Runtime (Concept)**: Designed for minimal overhead. Most transformations happen at the JSX level.
28
- - 📘 **TypeScript First**: Automatic types for nearly all Tailwind utilities.
29
- - 🔌 **Framework Agnostic**: Works with Vite, Next.js, and any stack supporting custom JSX runtimes.
25
+ - **Prop-based Styling**: Use Tailwind utilities as props: `<div flex bg="blue-500" p={4} />`.
26
+ - **Array ClassNames**: Pass classes as clean arrays: `classNames={['text-center', isActive && 'font-bold']}`.
27
+ - **Zero Runtime (Concept)**: Designed for minimal overhead. Most transformations happen at the JSX level.
28
+ - **TypeScript First**: Automatic types for nearly all Tailwind utilities.
29
+ - **Framework Agnostic**: Works with Vite, Next.js, and any stack supporting custom JSX runtimes.
30
30
 
31
31
  ---
32
32
 
33
33
 
34
- ## 🛠 Setup
34
+ ## Setup
35
35
 
36
- Configure your build tool to use `reactwind` as your JSX import source.
36
+ Configure your build tool to use `@itamarshdev/reactwind` as your JSX import source.
37
37
 
38
38
  ### Vite
39
39
 
@@ -41,7 +41,7 @@ Configure your build tool to use `reactwind` as your JSX import source.
41
41
  // vite.config.ts
42
42
  export default defineConfig({
43
43
  esbuild: {
44
- jsxImportSource: 'reactwind',
44
+ jsxImportSource: '@itamarshdev/reactwind',
45
45
  },
46
46
  });
47
47
  ```
@@ -53,14 +53,14 @@ export default defineConfig({
53
53
  {
54
54
  "compilerOptions": {
55
55
  "jsx": "react-jsx",
56
- "jsxImportSource": "reactwind"
56
+ "jsxImportSource": "@itamarshdev/reactwind"
57
57
  }
58
58
  }
59
59
  ```
60
60
 
61
61
  ---
62
62
 
63
- ## 📖 Usage Examples
63
+ ## Usage Examples
64
64
 
65
65
  ### 1. Shorthand Props & Booleans
66
66
 
@@ -132,7 +132,7 @@ export default defineConfig({
132
132
 
133
133
  ---
134
134
 
135
- ## 🎯 Goals
135
+ ## Goals
136
136
 
137
137
  ReactWind aims to improve the developer experience of styling with Tailwind CSS by:
138
138
  1. **Removing syntactic noise**: Replacing long `className` strings with structured props.
@@ -141,10 +141,10 @@ ReactWind aims to improve the developer experience of styling with Tailwind CSS
141
141
 
142
142
  ---
143
143
 
144
- ## 🤝 Contributing
144
+ ## Contributing
145
145
 
146
146
  Contributions are welcome! Please feel free to submit a Pull Request.
147
147
 
148
- ## 📄 License
148
+ ## License
149
149
 
150
- MIT © [reactwind](https://github.com/reactwind/reactwind)
150
+ MIT © [ItamarShDev](https://github.com/ItamarShDev/reactwind)
@@ -260,6 +260,10 @@ var withClassNames = (props) => {
260
260
  if (!props) {
261
261
  return props;
262
262
  }
263
+ if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
264
+ const { sx, ...restProps } = props;
265
+ return withClassNames({ ...restProps, ...sx });
266
+ }
263
267
  const hasClassNames = "classNames" in props;
264
268
  const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
265
269
  const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
package/dist/index.cjs CHANGED
@@ -286,6 +286,10 @@ var withClassNames = (props) => {
286
286
  if (!props) {
287
287
  return props;
288
288
  }
289
+ if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
290
+ const { sx, ...restProps } = props;
291
+ return withClassNames({ ...restProps, ...sx });
292
+ }
289
293
  const hasClassNames = "classNames" in props;
290
294
  const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
291
295
  const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
package/dist/index.d.cts CHANGED
@@ -49,13 +49,17 @@ interface LayoutProps {
49
49
  shrink?: boolean;
50
50
  }
51
51
 
52
+ type SxProp = Partial<ValueProps & LayoutProps>;
53
+
52
54
  declare module "react" {
53
55
  interface HTMLAttributes<T> extends LayoutProps, ValueProps {
54
56
  classNames?: (TailwindClass | string)[];
57
+ sx?: SxProp;
55
58
  }
56
59
  interface SVGAttributes<T> extends LayoutProps, ValueProps {
57
60
  classNames?: (TailwindClass | string)[];
61
+ sx?: SxProp;
58
62
  }
59
63
  }
60
64
 
61
- export type { LayoutProps, ValueProps };
65
+ export type { LayoutProps, SxProp, ValueProps };
package/dist/index.d.ts CHANGED
@@ -49,13 +49,17 @@ interface LayoutProps {
49
49
  shrink?: boolean;
50
50
  }
51
51
 
52
+ type SxProp = Partial<ValueProps & LayoutProps>;
53
+
52
54
  declare module "react" {
53
55
  interface HTMLAttributes<T> extends LayoutProps, ValueProps {
54
56
  classNames?: (TailwindClass | string)[];
57
+ sx?: SxProp;
55
58
  }
56
59
  interface SVGAttributes<T> extends LayoutProps, ValueProps {
57
60
  classNames?: (TailwindClass | string)[];
61
+ sx?: SxProp;
58
62
  }
59
63
  }
60
64
 
61
- export type { LayoutProps, ValueProps };
65
+ export type { LayoutProps, SxProp, ValueProps };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withClassNames
3
- } from "./chunk-KAWYX6WW.js";
3
+ } from "./chunk-6MX4RX23.js";
4
4
  export {
5
5
  withClassNames
6
6
  };
@@ -288,6 +288,10 @@ var withClassNames = (props) => {
288
288
  if (!props) {
289
289
  return props;
290
290
  }
291
+ if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
292
+ const { sx, ...restProps } = props;
293
+ return withClassNames({ ...restProps, ...sx });
294
+ }
291
295
  const hasClassNames = "classNames" in props;
292
296
  const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
293
297
  const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
@@ -1,4 +1,4 @@
1
- import './types-Bb5v_nmy.cjs';
1
+ import './types-I6XgQvJp.cjs';
2
2
  import React from 'react';
3
3
  export { Fragment } from 'react/jsx-dev-runtime';
4
4
  export { JSX } from 'react/jsx-runtime';
@@ -1,4 +1,4 @@
1
- import './types-CBbQP9uE.js';
1
+ import './types-DuRT-DEW.js';
2
2
  import React from 'react';
3
3
  export { Fragment } from 'react/jsx-dev-runtime';
4
4
  export { JSX } from 'react/jsx-runtime';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withClassNames
3
- } from "./chunk-KAWYX6WW.js";
3
+ } from "./chunk-6MX4RX23.js";
4
4
 
5
5
  // src/jsx-dev-runtime.ts
6
6
  import { Fragment, jsxDEV as reactJsxDEV } from "react/jsx-dev-runtime";
@@ -289,6 +289,10 @@ var withClassNames = (props) => {
289
289
  if (!props) {
290
290
  return props;
291
291
  }
292
+ if ("sx" in props && typeof props.sx === "object" && props.sx !== null) {
293
+ const { sx, ...restProps } = props;
294
+ return withClassNames({ ...restProps, ...sx });
295
+ }
292
296
  const hasClassNames = "classNames" in props;
293
297
  const hasLayoutProps = LAYOUT_PROPS.some((k) => k in props);
294
298
  const hasValueProps = Object.keys(VALUE_PROPS_MAP).some((k) => k in props);
@@ -1,4 +1,4 @@
1
- import './types-Bb5v_nmy.cjs';
1
+ import './types-I6XgQvJp.cjs';
2
2
  import React from 'react';
3
3
  export { Fragment, JSX } from 'react/jsx-runtime';
4
4
  import './tailwind.types-BSQudz76.cjs';
@@ -1,4 +1,4 @@
1
- import './types-CBbQP9uE.js';
1
+ import './types-DuRT-DEW.js';
2
2
  import React from 'react';
3
3
  export { Fragment, JSX } from 'react/jsx-runtime';
4
4
  import './tailwind.types-BSQudz76.js';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withClassNames
3
- } from "./chunk-KAWYX6WW.js";
3
+ } from "./chunk-6MX4RX23.js";
4
4
 
5
5
  // src/jsx-runtime.ts
6
6
  import { Fragment, jsx as reactJsx, jsxs as reactJsxs } from "react/jsx-runtime";
@@ -233,13 +233,16 @@ interface ModifierProps {
233
233
  dark?: ModifierValue;
234
234
  print?: ModifierValue;
235
235
  }
236
+ type SxProp = Partial<ValueProps & LayoutProps & ModifierProps>;
236
237
  declare module "react" {
237
238
  interface HTMLAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
238
239
  classNames?: (TailwindClass | string)[];
240
+ sx?: SxProp;
239
241
  [key: string]: any;
240
242
  }
241
243
  interface SVGAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
242
244
  classNames?: (TailwindClass | string)[];
245
+ sx?: SxProp;
243
246
  [key: string]: any;
244
247
  }
245
248
  }
@@ -233,13 +233,16 @@ interface ModifierProps {
233
233
  dark?: ModifierValue;
234
234
  print?: ModifierValue;
235
235
  }
236
+ type SxProp = Partial<ValueProps & LayoutProps & ModifierProps>;
236
237
  declare module "react" {
237
238
  interface HTMLAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
238
239
  classNames?: (TailwindClass | string)[];
240
+ sx?: SxProp;
239
241
  [key: string]: any;
240
242
  }
241
243
  interface SVGAttributes<T> extends LayoutProps, ValueProps, ModifierProps {
242
244
  classNames?: (TailwindClass | string)[];
245
+ sx?: SxProp;
243
246
  [key: string]: any;
244
247
  }
245
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itamarshdev/reactwind",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "JSX runtime wrapper that adds a classNames prop to React elements.",
5
5
  "keywords": [
6
6
  "react",