@facter/ds-core 1.1.0 → 1.1.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 CHANGED
@@ -1,28 +1,205 @@
1
1
  # @facter/ds-core
2
2
 
3
- Core components for Facter Design System.
3
+ Core UI components for Facter Design System built with React, TypeScript, and Tailwind CSS.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
+ npm install @facter/ds-core
9
+ # or
8
10
  pnpm add @facter/ds-core
9
11
  ```
10
12
 
11
- ## Usage
13
+ ### Peer Dependencies
14
+
15
+ ```bash
16
+ npm install react react-dom framer-motion
17
+ ```
18
+
19
+ ### Optional (for icons)
20
+
21
+ ```bash
22
+ npm install lucide-react
23
+ # or
24
+ npm install react-icons
25
+ ```
26
+
27
+ ## Setup
28
+
29
+ ### 1. Configure Tailwind CSS
30
+
31
+ Add the design system to your `tailwind.config.js`:
32
+
33
+ ```js
34
+ module.exports = {
35
+ content: [
36
+ './src/**/*.{js,ts,jsx,tsx}',
37
+ './node_modules/@facter/ds-core/dist/**/*.{js,mjs}',
38
+ ],
39
+ theme: {
40
+ extend: {
41
+ colors: {
42
+ border: 'hsl(var(--border))',
43
+ background: 'hsl(var(--background))',
44
+ foreground: 'hsl(var(--foreground))',
45
+ primary: {
46
+ DEFAULT: 'hsl(var(--primary))',
47
+ foreground: 'hsl(var(--primary-foreground))',
48
+ },
49
+ // ... add more as needed
50
+ },
51
+ },
52
+ },
53
+ }
54
+ ```
55
+
56
+ ### 2. Configure CSS Variables
57
+
58
+ Create or update your `globals.css`:
59
+
60
+ ```css
61
+ @tailwind base;
62
+ @tailwind components;
63
+ @tailwind utilities;
64
+
65
+ @layer base {
66
+ :root {
67
+ --background: 0 0% 100%;
68
+ --foreground: 0 0% 3.9%;
69
+ --border: 0 0% 89.8%;
70
+ --primary: 24 100% 50%;
71
+ --primary-foreground: 0 0% 98%;
72
+ --muted: 0 0% 96.1%;
73
+ --muted-foreground: 0 0% 45.1%;
74
+ }
75
+
76
+ /* Optional: Custom font */
77
+ * {
78
+ font-family: 'Your Custom Font', sans-serif;
79
+ }
80
+ }
81
+ ```
82
+
83
+ **See `theme.example.css` for complete theme configuration.**
84
+
85
+ ### 3. Import Global Styles
86
+
87
+ In your app entry point:
88
+
89
+ ```tsx
90
+ import './globals.css'
91
+ ```
92
+
93
+ ## Components
94
+
95
+ ### Button
96
+
97
+ 5 variants, 4 sizes, icon support.
12
98
 
13
99
  ```tsx
14
100
  import { Button } from '@facter/ds-core'
15
101
 
102
+ <Button variant="default" size="md">Click me</Button>
103
+ <Button variant="destructive" size="lg">Delete</Button>
104
+ ```
105
+
106
+ ### Input
107
+
108
+ Floating label, icon support, password toggle.
109
+
110
+ ```tsx
111
+ import { Input } from '@facter/ds-core'
112
+ import { Mail, Lock } from 'lucide-react'
113
+
114
+ <Input label="Email" icon={Mail} type="email" />
115
+ <Input label="Password" icon={Lock} type="password" required />
116
+ ```
117
+
118
+ **Icon Support:** Works with any icon library (lucide-react, react-icons, heroicons, custom SVG).
119
+
120
+ ### Badge
121
+
122
+ 7 color variants.
123
+
124
+ ```tsx
125
+ import { Badge } from '@facter/ds-core'
126
+
127
+ <Badge variant="success">Active</Badge>
128
+ <Badge variant="error">Failed</Badge>
129
+ ```
130
+
131
+ ### Loader
132
+
133
+ 5 animated variants with Provider, Hook, and helper function.
134
+
135
+ ```tsx
136
+ import { LoaderProvider, useLoader, Loader } from '@facter/ds-core'
137
+
138
+ // Option 1: With Provider + Hook
16
139
  function App() {
17
- return <Button variant="default">Click me</Button>
140
+ return (
141
+ <LoaderProvider>
142
+ <MyComponent />
143
+ </LoaderProvider>
144
+ )
145
+ }
146
+
147
+ function MyComponent() {
148
+ const loader = useLoader()
149
+
150
+ const handleClick = async () => {
151
+ loader.show({ variant: 'pulse', message: 'Processing...' })
152
+ await fetchData()
153
+ loader.hide()
154
+ }
155
+
156
+ return <button onClick={handleClick}>Load</button>
18
157
  }
158
+
159
+ // Option 2: Direct component
160
+ <Loader variant="spinner" show={true} message="Loading..." />
19
161
  ```
20
162
 
21
- ## Components
163
+ ## Customization
164
+
165
+ ### Theme Colors
166
+
167
+ Each project can define its own brand colors in CSS variables:
168
+
169
+ ```css
170
+ :root {
171
+ --primary: 24 100% 50%; /* Orange for Facter */
172
+ /* or */
173
+ --primary: 220 91% 50%; /* Blue for another project */
174
+ }
175
+ ```
176
+
177
+ ### Custom Fonts
178
+
179
+ ```css
180
+ @layer base {
181
+ * {
182
+ font-family: 'Neue Haas Grotesk Display Pro', sans-serif;
183
+ }
184
+ }
185
+ ```
186
+
187
+ Or in `tailwind.config.js`:
188
+
189
+ ```js
190
+ theme: {
191
+ extend: {
192
+ fontFamily: {
193
+ sans: ['Neue Haas Grotesk Display Pro', 'sans-serif'],
194
+ },
195
+ },
196
+ }
197
+ ```
198
+
199
+ ## Documentation
22
200
 
23
- - Button
24
- - (More to come...)
201
+ Full documentation and interactive examples available in Storybook.
25
202
 
26
- ## Utils
203
+ ## License
27
204
 
28
- - `cn()` - Merge Tailwind classes
205
+ MIT