@jakeseanp/socrates-ui 0.3.1 → 0.3.2
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 +121 -0
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @jakeseanp/socrates-ui
|
|
2
|
+
|
|
3
|
+
Socrates component library for React applications.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- React 18 or newer.
|
|
8
|
+
- React DOM 18 or newer.
|
|
9
|
+
- Tailwind CSS v4 for the primary CSS-first setup.
|
|
10
|
+
|
|
11
|
+
Tailwind v3 is supported through the compatibility stylesheet and preset, but new consuming apps should use the Tailwind v4 setup below.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm add @jakeseanp/socrates-ui
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Tailwind v4 Setup
|
|
20
|
+
|
|
21
|
+
Import Socrates from your app's global CSS file. In a Next.js App Router project, this is usually `app/globals.css` or `src/app/globals.css`.
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
@import "tailwindcss";
|
|
25
|
+
|
|
26
|
+
@import "@jakeseanp/socrates-ui/theme.css";
|
|
27
|
+
@import "@jakeseanp/socrates-ui/base.css";
|
|
28
|
+
|
|
29
|
+
@source "../node_modules/@jakeseanp/socrates-ui/dist";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If your global CSS file lives in `src/app/globals.css`, adjust the source path:
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
@source "../../node_modules/@jakeseanp/socrates-ui/dist";
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Do not import `@jakeseanp/socrates-ui/styles.css` in Tailwind v4 apps. That file is the precompiled compatibility stylesheet for Tailwind v3-style consumption.
|
|
39
|
+
|
|
40
|
+
## Theme Overrides
|
|
41
|
+
|
|
42
|
+
Socrates components use semantic Tailwind classes such as `bg-primary`, `text-primary-foreground`, `border-border`, and `ring-ring`.
|
|
43
|
+
|
|
44
|
+
In Tailwind v4, those classes are created by `theme.css` and resolve through runtime CSS variables from `base.css`. Override variables after the Socrates imports:
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
@import "tailwindcss";
|
|
48
|
+
|
|
49
|
+
@import "@jakeseanp/socrates-ui/theme.css";
|
|
50
|
+
@import "@jakeseanp/socrates-ui/base.css";
|
|
51
|
+
|
|
52
|
+
@source "../node_modules/@jakeseanp/socrates-ui/dist";
|
|
53
|
+
|
|
54
|
+
:root {
|
|
55
|
+
--primary: oklch(0.78 0.18 145);
|
|
56
|
+
--primary-foreground: oklch(0.98 0.02 145);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Theme values should be valid `oklch(...)` color values. For interactive components, set both the surface token and its foreground token so contrast remains intentional.
|
|
61
|
+
|
|
62
|
+
Common tokens:
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
:root {
|
|
66
|
+
--background: oklch(1 0 0);
|
|
67
|
+
--foreground: oklch(0.145 0 0);
|
|
68
|
+
--primary: oklch(0.78 0.18 145);
|
|
69
|
+
--primary-foreground: oklch(0.98 0.02 145);
|
|
70
|
+
--secondary: oklch(0.967 0.001 286.375);
|
|
71
|
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
72
|
+
--accent: oklch(0.97 0 0);
|
|
73
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
74
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
75
|
+
--destructive-foreground: oklch(0.985 0 0);
|
|
76
|
+
--border: oklch(0.922 0 0);
|
|
77
|
+
--input: oklch(0.922 0 0);
|
|
78
|
+
--ring: oklch(0.708 0 0);
|
|
79
|
+
--radius: 0.625rem;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Dark mode is class-based. Override dark tokens under `.dark`:
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
.dark {
|
|
87
|
+
--background: oklch(0.145 0 0);
|
|
88
|
+
--foreground: oklch(0.985 0 0);
|
|
89
|
+
--primary: oklch(0.68 0.16 145);
|
|
90
|
+
--primary-foreground: oklch(0.145 0 0);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Importing Components
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { Button } from "@jakeseanp/socrates-ui";
|
|
98
|
+
|
|
99
|
+
export function Example() {
|
|
100
|
+
return <Button>Button</Button>;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Tailwind v3 Compatibility
|
|
105
|
+
|
|
106
|
+
Tailwind v3 apps can import the precompiled stylesheet and use the published preset:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import "@jakeseanp/socrates-ui/styles.css";
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
// tailwind.config.cjs
|
|
114
|
+
module.exports = {
|
|
115
|
+
presets: [require("@jakeseanp/socrates-ui/tailwind-preset")],
|
|
116
|
+
content: [
|
|
117
|
+
"./src/**/*.{ts,tsx}",
|
|
118
|
+
"./node_modules/@jakeseanp/socrates-ui/dist/**/*.{js,cjs}",
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jakeseanp/socrates-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Socrates component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"dist",
|
|
22
22
|
"theme.css",
|
|
23
23
|
"base.css",
|
|
24
|
+
"README.md",
|
|
24
25
|
"tailwind-preset.cjs"
|
|
25
26
|
],
|
|
26
27
|
"sideEffects": [
|