@bizapps/ui 1.0.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 ADDED
@@ -0,0 +1,331 @@
1
+ # @bizapps/design-system-testing
2
+
3
+ A React component library built for TCCE CRM applications. Provides reusable, consistent UI components built with React, TypeScript, and Tailwind CSS v4.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [Requirements](#requirements)
10
+ - [Installation](#installation)
11
+ - [Setup](#setup)
12
+ - [Usage](#usage)
13
+ - [Available Components](#available-components)
14
+ - [Design Tokens](#design-tokens)
15
+ - [Contributing](#contributing)
16
+ - [Publishing a New Version](#publishing-a-new-version)
17
+ - [Troubleshooting](#troubleshooting)
18
+
19
+ ---
20
+
21
+ ## Requirements
22
+
23
+ Your project must have the following installed before using this library:
24
+
25
+ | Package | Version |
26
+ | ------------------- | ------- |
27
+ | `react` | ^19 |
28
+ | `react-dom` | ^19 |
29
+ | `tailwindcss` | ^4 |
30
+ | `@tailwindcss/vite` | ^4 |
31
+
32
+ > **Note:** `shadcn`, `tw-animate-css`, and font packages are already bundled inside the library's CSS. You do **not** need to install them separately.
33
+
34
+ ---
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pnpm add @bizapps/design-system-testing
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Setup
45
+
46
+ ### 1. Configure Vite
47
+
48
+ Add the Tailwind CSS plugin to your `vite.config.ts`:
49
+
50
+ ```ts
51
+ import { defineConfig } from 'vite';
52
+ import react from '@vitejs/plugin-react';
53
+ import tailwindcss from '@tailwindcss/vite';
54
+
55
+ export default defineConfig({
56
+ plugins: [react(), tailwindcss()],
57
+ });
58
+ ```
59
+
60
+ ### 2. Import the styles
61
+
62
+ In your main CSS file (e.g. `src/index.css`), add these two lines **in this order**:
63
+
64
+ ```css
65
+ @import 'tailwindcss';
66
+ @import '@bizapps/design-system-testing/styles';
67
+ ```
68
+
69
+ > **Important:** `tailwindcss` must come **before** the library styles so that Tailwind's base layer is available when the library's theme tokens are applied.
70
+
71
+ ### 3. Import the CSS in your entry point
72
+
73
+ Make sure your `src/main.tsx` imports the CSS file:
74
+
75
+ ```tsx
76
+ import './index.css';
77
+ ```
78
+
79
+ That's it. No further configuration is needed.
80
+
81
+ ---
82
+
83
+ ## Usage
84
+
85
+ Import components directly from the package:
86
+
87
+ ```tsx
88
+ import { Button } from '@bizapps/design-system-testing';
89
+
90
+ function App() {
91
+ return (
92
+ <Button variant='primary' size='md'>
93
+ Click me
94
+ </Button>
95
+ );
96
+ }
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Available Components
102
+
103
+ ### Button
104
+
105
+ ```tsx
106
+ import { Button } from '@bizapps/design-system-testing';
107
+ ```
108
+
109
+ #### Props
110
+
111
+ | Prop | Type | Default | Description |
112
+ | ----------- | -------------------------------------------------------------- | ----------- | ----------------------------------------- |
113
+ | `variant` | `'primary' \| 'secondary' \| 'cancel' \| 'outline' \| 'ghost'` | `'primary'` | Visual style of the button |
114
+ | `size` | `'sm' \| 'md' \| 'lg' \| 'icon-sm'` | `'md'` | Size of the button |
115
+ | `isLoading` | `boolean` | `false` | Shows a loading state |
116
+ | `disabled` | `boolean` | `false` | Disables the button |
117
+ | `asChild` | `boolean` | `false` | Renders as child element (via Radix Slot) |
118
+
119
+ #### Examples
120
+
121
+ ```tsx
122
+ // Variants
123
+ <Button variant="primary">Primary</Button>
124
+ <Button variant="secondary">Secondary</Button>
125
+ <Button variant="cancel">Cancel</Button>
126
+ <Button variant="outline">Outline</Button>
127
+ <Button variant="ghost">Ghost</Button>
128
+
129
+ // Sizes
130
+ <Button size="sm">Small</Button>
131
+ <Button size="md">Medium</Button>
132
+ <Button size="lg">Large</Button>
133
+
134
+ // States
135
+ <Button disabled>Disabled</Button>
136
+ <Button isLoading>Loading...</Button>
137
+
138
+ // As a link (using asChild)
139
+ <Button asChild variant="primary">
140
+ <a href="/dashboard">Go to Dashboard</a>
141
+ </Button>
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Design Tokens
147
+
148
+ The library exposes a full set of CSS custom properties (design tokens) that you can use directly in your project's styles. These are injected globally when you import the library styles.
149
+
150
+ ### Colors
151
+
152
+ ```css
153
+ /* Brand */
154
+ --color-main-blue-primary: #22205f;
155
+ --color-main-orange-primary: #f66a24;
156
+ --color-main-grey: #605f60;
157
+
158
+ /* Semantic */
159
+ --color-main-positive-state: #01d42f; /* success */
160
+ --color-main-warning-state: #ea3a3d; /* error/danger */
161
+ --color-main-yellow-primary: #faca4a; /* warning */
162
+
163
+ /* Scales: dark, light, blue, red, orange, yellow, green, purple */
164
+ /* Each scale goes from 100 (lightest) to 1000 (darkest) */
165
+ --color-blue-100 through --color-blue-1000
166
+ --color-green-100 through --color-green-1000
167
+ /* ...etc */
168
+ ```
169
+
170
+ ### Border Radius
171
+
172
+ ```css
173
+ --border-radius-button: 1.875rem;
174
+ --border-radius-secondary-button: 0.625rem;
175
+ --border-radius-card: 1.25rem;
176
+ --border-radius-article: 0.875rem;
177
+ --border-radius-outline: 0.5rem;
178
+ ```
179
+
180
+ ### Shadows
181
+
182
+ ```css
183
+ --shadow-black-card
184
+ --shadow-hover-black-card
185
+ --shadow-black-button
186
+ --shadow-hover-black-button
187
+ --shadow-hover-orange-button
188
+ ```
189
+
190
+ ### Typography
191
+
192
+ The library includes the following fonts, loaded automatically:
193
+
194
+ - **Inter Variable** — primary UI font (`--font-sans`)
195
+ - **Dax** — brand heading font
196
+ - **Helvetica Neue** — secondary font
197
+
198
+ ### Using tokens in your CSS
199
+
200
+ ```css
201
+ .my-card {
202
+ background: var(--color-main-white);
203
+ border-radius: var(--border-radius-card);
204
+ box-shadow: var(--shadow-black-card);
205
+ }
206
+
207
+ .my-card:hover {
208
+ box-shadow: var(--shadow-hover-black-card);
209
+ }
210
+ ```
211
+
212
+ ### Using tokens in Tailwind classes
213
+
214
+ The tokens are also registered as Tailwind theme values, so you can use them as utility classes:
215
+
216
+ ```tsx
217
+ <div className='bg-main-blue-primary text-main-white rounded-card shadow-black-card'>Hello</div>
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Contributing
223
+
224
+ ### Local Development
225
+
226
+ ```bash
227
+ # Clone the repo
228
+ git clone <repository-url>
229
+ cd tcce-design-system
230
+
231
+ # Install dependencies
232
+ pnpm install
233
+
234
+ # Start Storybook (recommended)
235
+ pnpm storybook
236
+ # → http://localhost:6006
237
+
238
+ # OR start Vite dev server
239
+ pnpm dev
240
+ # → http://localhost:5173
241
+ ```
242
+
243
+ ### Adding a New Component
244
+
245
+ 1. Create the component folder under `src/components/ui/ComponentName/`
246
+ 2. Build the component following the existing `Button` pattern
247
+ 3. Export it from `src/main.ts`
248
+ 4. Add a Storybook story under `src/stories/`
249
+
250
+ ### Code Quality
251
+
252
+ ```bash
253
+ pnpm lint # check for lint errors
254
+ pnpm lint:fix # auto-fix lint errors
255
+ pnpm format # format with Prettier
256
+ pnpm type-check # TypeScript check without building
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Publishing a New Version
262
+
263
+ 1. Make your changes and commit them:
264
+
265
+ ```bash
266
+ git add -A
267
+ git commit -m "feat: description of changes"
268
+ ```
269
+
270
+ 2. Update the version in `package.json` following [semver](https://semver.org/):
271
+ - `patch` (0.4.x) → bug fixes
272
+ - `minor` (0.x.0) → new components or features
273
+ - `major` (x.0.0) → breaking changes
274
+
275
+ 3. Build the library:
276
+
277
+ ```bash
278
+ pnpm build
279
+ ```
280
+
281
+ 4. Publish to npm:
282
+
283
+ ```bash
284
+ npm publish --access public
285
+ ```
286
+
287
+ > Use `npm publish` (not `pnpm publish`) to avoid branch and git-state validation errors from pnpm.
288
+
289
+ ---
290
+
291
+ ## Troubleshooting
292
+
293
+ ### Styles not applying
294
+
295
+ Make sure the import order in your CSS file is correct — `tailwindcss` must come first:
296
+
297
+ ```css
298
+ @import 'tailwindcss'; /* ✅ first */
299
+ @import '@bizapps/design-system-testing/styles'; /* ✅ second */
300
+ ```
301
+
302
+ ### `Cannot resolve './tokens.css'` or similar errors
303
+
304
+ This means you're using an older version of the package (0.4.0 or 0.4.1). Update to the latest version:
305
+
306
+ ```bash
307
+ pnpm add @bizapps/design-system-testing@latest
308
+ ```
309
+
310
+ ### `Scope not found` on publish
311
+
312
+ The npm scope `@bizapps` belongs to the `bizapps` npm user account. Make sure you're logged in as that user:
313
+
314
+ ```bash
315
+ npm whoami # should return: bizapps
316
+ npm login # if not logged in
317
+ ```
318
+
319
+ ### pnpm `minimumReleaseAge` policy error
320
+
321
+ If pnpm blocks installation of a recently published version, run:
322
+
323
+ ```bash
324
+ pnpm config set minimum-release-age 0 --location project
325
+ ```
326
+
327
+ ---
328
+
329
+ ## License
330
+
331
+ MIT — BizAppsTotal &lt;bizapps@tcce.biz&gt;