@salty-css/react 0.0.1-alpha.124 → 0.0.1-alpha.125

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.
Files changed (2) hide show
  1. package/README.md +42 -9
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -14,19 +14,46 @@ Is there anything saltier than CSS in frontend web development? Salty CSS is bui
14
14
 
15
15
  ## Get started
16
16
 
17
- - Initialize: `npx salty-css init [directory]`
17
+ Fastest way to get started with any framework is `npx salty-css init [directory]` command
18
+
19
+ - Next.js → [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
20
+ - React + Vite → [React + Vite guide](#react--vite) + [React example code](#code-examples)
21
+ - React + Webpack → Guide coming soon
22
+ ## Useful commands
18
23
  - Create component: `npx salty-css generate [filePath]`
19
24
  - Build: `npx salty-css build [directory]`
25
+ - Update Salty CSS packages: `npx salty-css up`
20
26
 
21
- ### Initialize
27
+ ## Salty CSS styled function
22
28
 
23
- Fastest way to get started with any framework is [npx salty-css init [directory]](#initialize-salty-css-for-a-project) command
29
+ ```ts
30
+ // components/wrapper.css.ts
31
+ import { styled } from '@salty-css/react/styled';
24
32
 
25
- - Next.js [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
26
- - React + Vite → [React + Vite guide](#react--vite) + [React example code](#code-examples)
27
- - React + Webpack Guide coming soon
33
+ // Define a component with styled function. First argument is the component name or existing component to extend and second argument is the object containing the styles and other options
34
+ export const Component = styled('div', {
35
+ className: 'wrapper', // Define custom class name that will be included for this component
36
+ element: 'section', // Define the html element that will be rendered for this component, overrides the first 'div' argument
37
+ base: {
38
+ // 👉 Add your CSS-in-JS base styles here! 👈
39
+ },
40
+ variants: {
41
+ // Define conditional styles that will be applied to the component based on the variant prop values
42
+ },
43
+ compoundVariants: [
44
+ // Define conditional styles that will be applied to the component based on the combination of variant prop values
45
+ ],
46
+ defaultVariants: {
47
+ // Set default variant prop values
48
+ },
49
+ defaultProps: {
50
+ // Add additional default props for the component (eg, id and other html element attributes)
51
+ },
52
+ passProps: true, // Pass variant props to the rendered element / parent component (default: false)
53
+ });
54
+ ```
28
55
 
29
- ### Salty CSS CLI
56
+ ## Salty CSS CLI
30
57
 
31
58
  In your existing repository you can use `npx salty-css [command]` to initialize a project, generate components, update related packages and build required files.
32
59
 
@@ -34,13 +61,17 @@ In your existing repository you can use `npx salty-css [command]` to initialize
34
61
  - Generate component → `npx salty-css update [version]` - Update @salty-css packages in your repository. Default version is "latest". Additional options like `--dir`, `--tag`, `--name` and `--className` are also supported.
35
62
  - Build files → `npx salty-css build [directory]` - Compile Salty CSS related files in your project. This should not be needed if you are using tools like Next.js or Vite
36
63
 
64
+
65
+
66
+ ## Usage
67
+
37
68
  ### Next.js
38
69
 
39
70
  ![salty-next](https://github.com/user-attachments/assets/2cf6a93f-cdd5-4f5f-ab2e-3bc8bcfb83e8)
40
71
 
41
72
  Salty CSS provides Next.js App & Pages router support with full React Server Components support.
42
73
 
43
- #### Add Salty CSS to Next.js
74
+ ### Add Salty CSS to Next.js
44
75
 
45
76
  1. In your existing Next.js repository you can run `npx salty-css init` to automatically configure Salty CSS.
46
77
  2. Create your first Salty CSS component with `npx salty-css generate [filePath]` (e.g. src/custom-wrapper)
@@ -69,7 +100,7 @@ And note: steps 2 & 3 are just to show how get new components up and running, st
69
100
 
70
101
  ![salty-vite-react](https://github.com/user-attachments/assets/12ec5b6a-0dcc-48fa-afc1-d337fc8f800c)
71
102
 
72
- #### Add Salty CSS to your React + Vite app
103
+ ### Add Salty CSS to your React + Vite app
73
104
 
74
105
  1. In your existing Vite repository you can run `npx salty-css init` to automatically configure Salty CSS.
75
106
  2. Create your first Salty CSS component with `npx salty-css generate [filePath]` (e.g. src/custom-wrapper)
@@ -87,6 +118,8 @@ And note: steps 2 & 3 are just to show how get new components up and running, st
87
118
 
88
119
  [Check out react example code](#code-examples)
89
120
 
121
+ ----
122
+
90
123
  ### Create components
91
124
 
92
125
  1. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.124",
3
+ "version": "0.0.1-alpha.125",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@salty-css/core": "^0.0.1-alpha.124",
49
+ "@salty-css/core": "^0.0.1-alpha.125",
50
50
  "clsx": ">=2.x",
51
51
  "react": ">=19.x || >=18.3.x"
52
52
  }