@bizapps/design-system-testing 0.4.2 → 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 +205 -374
- package/dist/main.cjs +7627 -10
- package/dist/main.cjs.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.d.cts +1930 -5
- package/dist/main.d.ts +1930 -5
- package/dist/main.js +7351 -12
- package/dist/main.js.map +1 -1
- package/package.json +53 -32
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total.ai +13 -2789
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total.pdf +13 -2947
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total_AW.png +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total_CB.png +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total_CBT.png +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total_CC.png +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total_M.png +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total_NT.png +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction_Optimize/Entrega_Logo_Total_AW.webp +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction_Optimize/Entrega_Logo_Total_CB.webp +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction_Optimize/Entrega_Logo_Total_CBT.webp +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction_Optimize/Entrega_Logo_Total_CC.webp +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction_Optimize/Entrega_Logo_Total_M.webp +0 -0
- package/dist/assets/brand/Logo_Total_Civil_Construction_Optimize/Entrega_Logo_Total_NT.webp +0 -0
- package/dist/assets/brand/favicon.svg +0 -7
- package/dist/assets/fonts/Dax-Bold/Dax-Bold.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueBlack.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueBlackItalic.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueBold.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueBoldItalic.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueHeavy.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueHeavyItalic.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueItalic.ttf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueLight.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueLightItalic.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueMedium.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueMediumItalic.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueRoman.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueThin.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueThinItalic.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueUltraLight.otf +0 -0
- package/dist/assets/fonts/Helvetica-Neue/HelveticaNeueUltraLightItalic.otf +0 -0
- package/dist/assets/fonts/dax-regular/dax-regular.ttf +0 -0
- package/dist/main.css.map +0 -1
package/README.md
CHANGED
|
@@ -1,500 +1,331 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bizapps/design-system-testing
|
|
2
2
|
|
|
3
|
-
A React component library for
|
|
3
|
+
A React component library built for TCCE CRM applications. Provides reusable, consistent UI components built with React, TypeScript, and Tailwind CSS v4.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This is a **component library** designed to ensure visual and functional consistency across all TCCE CRM frontend applications. It includes:
|
|
8
|
-
|
|
9
|
-
- **50+ reusable components** (Button, Card, Dialog, Table, Forms, etc.)
|
|
10
|
-
- **Design tokens** (colors, typography, spacing, shadows)
|
|
11
|
-
- **Storybook documentation** for all components
|
|
12
|
-
- **TypeScript support** with full type definitions
|
|
5
|
+
---
|
|
13
6
|
|
|
14
7
|
## Table of Contents
|
|
15
8
|
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [Testing Components](#testing-components)
|
|
23
|
-
- [Publishing](#publishing)
|
|
9
|
+
- [Requirements](#requirements)
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Setup](#setup)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Available Components](#available-components)
|
|
14
|
+
- [Design Tokens](#design-tokens)
|
|
24
15
|
- [Contributing](#contributing)
|
|
16
|
+
- [Publishing a New Version](#publishing-a-new-version)
|
|
25
17
|
- [Troubleshooting](#troubleshooting)
|
|
26
18
|
|
|
27
19
|
---
|
|
28
20
|
|
|
29
|
-
##
|
|
21
|
+
## Requirements
|
|
30
22
|
|
|
31
|
-
|
|
32
|
-
|------|---------|-------|
|
|
33
|
-
| **Node.js** | v18+ | LTS recommended |
|
|
34
|
-
| **pnpm** | v8+ | Package manager |
|
|
35
|
-
| **Docker** | v20+ | Required for containerized development |
|
|
36
|
-
| **Git** | Any | Version control |
|
|
23
|
+
Your project must have the following installed before using this library:
|
|
37
24
|
|
|
38
|
-
|
|
25
|
+
| Package | Version |
|
|
26
|
+
| ------------------- | ------- |
|
|
27
|
+
| `react` | ^19 |
|
|
28
|
+
| `react-dom` | ^19 |
|
|
29
|
+
| `tailwindcss` | ^4 |
|
|
30
|
+
| `@tailwindcss/vite` | ^4 |
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
docker network create tcce-network
|
|
44
|
-
```
|
|
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.
|
|
45
33
|
|
|
46
|
-
|
|
34
|
+
---
|
|
47
35
|
|
|
48
|
-
|
|
36
|
+
## Installation
|
|
49
37
|
|
|
50
38
|
```bash
|
|
51
|
-
|
|
39
|
+
pnpm add @bizapps/design-system-testing
|
|
52
40
|
```
|
|
53
41
|
|
|
54
42
|
---
|
|
55
43
|
|
|
56
|
-
##
|
|
57
|
-
|
|
58
|
-
### Local Development
|
|
44
|
+
## Setup
|
|
59
45
|
|
|
60
|
-
|
|
61
|
-
# Clone the repository
|
|
62
|
-
git clone <repository-url>
|
|
63
|
-
cd tcce-design-system
|
|
46
|
+
### 1. Configure Vite
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
pnpm install
|
|
48
|
+
Add the Tailwind CSS plugin to your `vite.config.ts`:
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
|
|
50
|
+
```ts
|
|
51
|
+
import { defineConfig } from 'vite';
|
|
52
|
+
import react from '@vitejs/plugin-react';
|
|
53
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
export default defineConfig({
|
|
56
|
+
plugins: [react(), tailwindcss()],
|
|
57
|
+
});
|
|
73
58
|
```
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
- Storybook: http://localhost:6006
|
|
77
|
-
- Vite Dev: http://localhost:5173
|
|
60
|
+
### 2. Import the styles
|
|
78
61
|
|
|
79
|
-
|
|
62
|
+
In your main CSS file (e.g. `src/index.css`), add these two lines **in this order**:
|
|
80
63
|
|
|
81
|
-
```
|
|
82
|
-
|
|
64
|
+
```css
|
|
65
|
+
@import 'tailwindcss';
|
|
66
|
+
@import '@bizapps/design-system-testing/styles';
|
|
83
67
|
```
|
|
84
68
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
## Project Structure
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
tcce-design-system/
|
|
91
|
-
├── src/
|
|
92
|
-
│ ├── components/ # All UI components
|
|
93
|
-
│ │ ├── Badge/
|
|
94
|
-
│ │ ├── Button/
|
|
95
|
-
│ │ ├── Can/ # Authorization component
|
|
96
|
-
│ │ ├── Card/
|
|
97
|
-
│ │ ├── Divider/
|
|
98
|
-
│ │ ├── Icon/
|
|
99
|
-
│ │ ├── InfoLabel/
|
|
100
|
-
│ │ ├── Spinner/
|
|
101
|
-
│ │ ├── Stepper/
|
|
102
|
-
│ │ ├── Typography/
|
|
103
|
-
│ │ ├── Token/ # Design tokens showcase
|
|
104
|
-
│ │ ├── forms/ # Form components
|
|
105
|
-
│ │ │ ├── Checkbox/
|
|
106
|
-
│ │ │ ├── FormField/
|
|
107
|
-
│ │ │ ├── PinInput/
|
|
108
|
-
│ │ │ ├── RadioInput/
|
|
109
|
-
│ │ │ └── inputs/ # Input components
|
|
110
|
-
│ │ ├── layout/ # Layout components
|
|
111
|
-
│ │ ├── navigations/ # Navigation components
|
|
112
|
-
│ │ ├── notifications/ # Toast & notifications
|
|
113
|
-
│ │ ├── overlays/ # Dialog, Tooltip, etc.
|
|
114
|
-
│ │ └── Table/ # Data tables
|
|
115
|
-
│ ├── shared/
|
|
116
|
-
│ │ ├── hooks/ # Shared React hooks
|
|
117
|
-
│ │ ├── types/ # Global TypeScript types
|
|
118
|
-
│ │ └── utils/ # Utility functions
|
|
119
|
-
│ ├── globals.css # Global styles
|
|
120
|
-
│ ├── tokens.css # Design tokens CSS
|
|
121
|
-
│ └── main.ts # Library entry point
|
|
122
|
-
├── .storybook/ # Storybook configuration
|
|
123
|
-
├── public/ # Static assets (fonts, images)
|
|
124
|
-
├── dist/ # Build output (generated)
|
|
125
|
-
├── package.json
|
|
126
|
-
├── vite.config.ts
|
|
127
|
-
├── tsconfig.json
|
|
128
|
-
└── eslint.config.js
|
|
129
|
-
```
|
|
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.
|
|
130
70
|
|
|
131
|
-
###
|
|
71
|
+
### 3. Import the CSS in your entry point
|
|
132
72
|
|
|
133
|
-
|
|
73
|
+
Make sure your `src/main.tsx` imports the CSS file:
|
|
134
74
|
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
├── ComponentName.tsx # Main component
|
|
138
|
-
├── ComponentName.types.ts # TypeScript interfaces
|
|
139
|
-
├── ComponentName.styles.ts # Styled-components styles
|
|
140
|
-
├── ComponentName.stories.tsx # Storybook stories
|
|
141
|
-
├── index.ts # Barrel export
|
|
142
|
-
└── components/ # Sub-components (if needed)
|
|
75
|
+
```tsx
|
|
76
|
+
import './index.css';
|
|
143
77
|
```
|
|
144
78
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
## Development
|
|
79
|
+
That's it. No further configuration is needed.
|
|
148
80
|
|
|
149
|
-
|
|
81
|
+
---
|
|
150
82
|
|
|
151
|
-
|
|
152
|
-
|---------|-------------|
|
|
153
|
-
| `pnpm dev` | Start Vite development server |
|
|
154
|
-
| `pnpm storybook` | Start Storybook (recommended) |
|
|
155
|
-
| `pnpm build` | Build library for production |
|
|
156
|
-
| `pnpm build-storybook` | Build static Storybook |
|
|
157
|
-
| `pnpm preview` | Preview production build |
|
|
158
|
-
| `pnpm lint` | Run ESLint |
|
|
159
|
-
| `pnpm lint:fix` | Fix ESLint issues |
|
|
160
|
-
| `pnpm format` | Format with Prettier |
|
|
83
|
+
## Usage
|
|
161
84
|
|
|
162
|
-
|
|
85
|
+
Import components directly from the package:
|
|
163
86
|
|
|
164
|
-
|
|
87
|
+
```tsx
|
|
88
|
+
import { Button } from '@bizapps/design-system-testing';
|
|
165
89
|
|
|
166
|
-
|
|
167
|
-
|
|
90
|
+
function App() {
|
|
91
|
+
return (
|
|
92
|
+
<Button variant='primary' size='md'>
|
|
93
|
+
Click me
|
|
94
|
+
</Button>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
168
97
|
```
|
|
169
98
|
|
|
170
99
|
---
|
|
171
100
|
|
|
172
|
-
##
|
|
173
|
-
|
|
174
|
-
### Creating a New Component
|
|
101
|
+
## Available Components
|
|
175
102
|
|
|
176
|
-
|
|
103
|
+
### Button
|
|
177
104
|
|
|
178
|
-
```
|
|
179
|
-
|
|
105
|
+
```tsx
|
|
106
|
+
import { Button } from '@bizapps/design-system-testing';
|
|
180
107
|
```
|
|
181
108
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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>
|
|
190
142
|
```
|
|
191
143
|
|
|
192
|
-
|
|
193
|
-
// MyComponent.tsx
|
|
194
|
-
import type { MyComponentProps } from './MyComponent.types';
|
|
195
|
-
import { StyledMyComponent } from './MyComponent.styles';
|
|
196
|
-
|
|
197
|
-
export const MyComponent = ({ variant = 'primary', ...props }: MyComponentProps) => {
|
|
198
|
-
return <StyledMyComponent $variant={variant} {...props} />;
|
|
199
|
-
};
|
|
200
|
-
```
|
|
144
|
+
---
|
|
201
145
|
|
|
202
|
-
|
|
203
|
-
// MyComponent.styles.ts
|
|
204
|
-
import styled from 'styled-components';
|
|
146
|
+
## Design Tokens
|
|
205
147
|
|
|
206
|
-
|
|
207
|
-
/* Styles using Tailwind and styled-components */
|
|
208
|
-
`;
|
|
209
|
-
```
|
|
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.
|
|
210
149
|
|
|
211
|
-
|
|
212
|
-
// MyComponent.stories.tsx
|
|
213
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
214
|
-
import { MyComponent } from './MyComponent';
|
|
215
|
-
|
|
216
|
-
const meta = {
|
|
217
|
-
title: 'Controls/MyComponent',
|
|
218
|
-
component: MyComponent,
|
|
219
|
-
tags: ['autodocs'],
|
|
220
|
-
} satisfies Meta<typeof MyComponent>;
|
|
221
|
-
|
|
222
|
-
export default meta;
|
|
223
|
-
type Story = StoryObj<typeof meta>;
|
|
224
|
-
|
|
225
|
-
export const Primary: Story = {
|
|
226
|
-
args: {
|
|
227
|
-
variant: 'primary',
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
```
|
|
150
|
+
### Colors
|
|
231
151
|
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
152
|
+
```css
|
|
153
|
+
/* Brand */
|
|
154
|
+
--color-main-blue-primary: #22205f;
|
|
155
|
+
--color-main-orange-primary: #f66a24;
|
|
156
|
+
--color-main-grey: #605f60;
|
|
237
157
|
|
|
238
|
-
|
|
158
|
+
/* Semantic */
|
|
159
|
+
--color-main-positive-state: #01d42f; /* success */
|
|
160
|
+
--color-main-warning-state: #ea3a3d; /* error/danger */
|
|
161
|
+
--color-main-yellow-primary: #faca4a; /* warning */
|
|
239
162
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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 */
|
|
243
168
|
```
|
|
244
169
|
|
|
245
|
-
|
|
170
|
+
### Border Radius
|
|
246
171
|
|
|
247
|
-
```
|
|
248
|
-
|
|
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;
|
|
249
178
|
```
|
|
250
179
|
|
|
251
|
-
###
|
|
180
|
+
### Shadows
|
|
252
181
|
|
|
253
|
-
|
|
254
|
-
-
|
|
255
|
-
-
|
|
256
|
-
-
|
|
257
|
-
-
|
|
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
|
+
```
|
|
258
189
|
|
|
259
|
-
|
|
190
|
+
### Typography
|
|
260
191
|
|
|
261
|
-
|
|
192
|
+
The library includes the following fonts, loaded automatically:
|
|
262
193
|
|
|
263
|
-
|
|
194
|
+
- **Inter Variable** — primary UI font (`--font-sans`)
|
|
195
|
+
- **Dax** — brand heading font
|
|
196
|
+
- **Helvetica Neue** — secondary font
|
|
264
197
|
|
|
265
|
-
|
|
266
|
-
- **ESLint** - Code linting
|
|
267
|
-
- **Prettier** - Code formatting
|
|
268
|
-
- **TypeScript** - Type safety
|
|
198
|
+
### Using tokens in your CSS
|
|
269
199
|
|
|
270
|
-
|
|
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
|
+
}
|
|
271
206
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
207
|
+
.my-card:hover {
|
|
208
|
+
box-shadow: var(--shadow-hover-black-card);
|
|
209
|
+
}
|
|
210
|
+
```
|
|
275
211
|
|
|
276
|
-
|
|
277
|
-
pnpm lint:fix
|
|
212
|
+
### Using tokens in Tailwind classes
|
|
278
213
|
|
|
279
|
-
|
|
280
|
-
pnpm format
|
|
214
|
+
The tokens are also registered as Tailwind theme values, so you can use them as utility classes:
|
|
281
215
|
|
|
282
|
-
|
|
283
|
-
|
|
216
|
+
```tsx
|
|
217
|
+
<div className='bg-main-blue-primary text-main-white rounded-card shadow-black-card'>Hello</div>
|
|
284
218
|
```
|
|
285
219
|
|
|
286
|
-
|
|
220
|
+
---
|
|
287
221
|
|
|
288
|
-
|
|
222
|
+
## Contributing
|
|
223
|
+
|
|
224
|
+
### Local Development
|
|
289
225
|
|
|
290
226
|
```bash
|
|
291
|
-
|
|
292
|
-
|
|
227
|
+
# Clone the repo
|
|
228
|
+
git clone <repository-url>
|
|
229
|
+
cd tcce-design-system
|
|
293
230
|
|
|
294
|
-
|
|
231
|
+
# Install dependencies
|
|
232
|
+
pnpm install
|
|
295
233
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
- Prettier formatting required
|
|
234
|
+
# Start Storybook (recommended)
|
|
235
|
+
pnpm storybook
|
|
236
|
+
# → http://localhost:6006
|
|
300
237
|
|
|
301
|
-
|
|
238
|
+
# OR start Vite dev server
|
|
239
|
+
pnpm dev
|
|
240
|
+
# → http://localhost:5173
|
|
241
|
+
```
|
|
302
242
|
|
|
303
|
-
|
|
243
|
+
### Adding a New Component
|
|
304
244
|
|
|
305
|
-
|
|
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/`
|
|
306
249
|
|
|
307
|
-
|
|
250
|
+
### Code Quality
|
|
308
251
|
|
|
309
252
|
```bash
|
|
310
|
-
pnpm
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
-
|
|
314
|
-
- Use **Controls** panel to test props
|
|
315
|
-
- Use **Actions** panel to see event handlers
|
|
316
|
-
- Check **Accessibility** tab for a11y issues
|
|
317
|
-
|
|
318
|
-
### Component Story Format
|
|
319
|
-
|
|
320
|
-
Write stories following CSF (Component Story Format):
|
|
321
|
-
|
|
322
|
-
```typescript
|
|
323
|
-
// ComponentName.stories.tsx
|
|
324
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
325
|
-
import { ComponentName } from './ComponentName';
|
|
326
|
-
|
|
327
|
-
const meta = {
|
|
328
|
-
title: 'Category/ComponentName',
|
|
329
|
-
component: ComponentName,
|
|
330
|
-
parameters: {
|
|
331
|
-
layout: 'centered',
|
|
332
|
-
},
|
|
333
|
-
tags: ['autodocs'],
|
|
334
|
-
argTypes: {
|
|
335
|
-
variant: { control: 'select', options: ['primary', 'secondary'] },
|
|
336
|
-
},
|
|
337
|
-
} satisfies Meta<typeof ComponentName>;
|
|
338
|
-
|
|
339
|
-
export default meta;
|
|
340
|
-
type Story = StoryObj<typeof meta>;
|
|
341
|
-
|
|
342
|
-
export const Primary: Story = {
|
|
343
|
-
args: {
|
|
344
|
-
variant: 'primary',
|
|
345
|
-
label: 'Click me',
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
export const Secondary: Story = {
|
|
350
|
-
args: {
|
|
351
|
-
variant: 'secondary',
|
|
352
|
-
label: 'Cancel',
|
|
353
|
-
},
|
|
354
|
-
};
|
|
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
|
|
355
257
|
```
|
|
356
258
|
|
|
357
259
|
---
|
|
358
260
|
|
|
359
|
-
## Publishing
|
|
261
|
+
## Publishing a New Version
|
|
360
262
|
|
|
361
|
-
|
|
263
|
+
1. Make your changes and commit them:
|
|
362
264
|
|
|
363
265
|
```bash
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
# Check dist folder
|
|
368
|
-
ls dist/
|
|
266
|
+
git add -A
|
|
267
|
+
git commit -m "feat: description of changes"
|
|
369
268
|
```
|
|
370
269
|
|
|
371
|
-
|
|
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
|
|
372
274
|
|
|
373
|
-
|
|
374
|
-
# Login to npm
|
|
375
|
-
npm login
|
|
275
|
+
3. Build the library:
|
|
376
276
|
|
|
377
|
-
|
|
378
|
-
|
|
277
|
+
```bash
|
|
278
|
+
pnpm build
|
|
379
279
|
```
|
|
380
280
|
|
|
381
|
-
|
|
382
|
-
- `dist/tcce-design-system-components.js` (ESM)
|
|
383
|
-
- `dist/tcce-design-system-components.umd.cjs` (UMD)
|
|
384
|
-
- `dist/tcce-design-system-components.css`
|
|
385
|
-
- Type definitions via `vite-plugin-dts`
|
|
386
|
-
|
|
387
|
-
### Consuming in Other Projects
|
|
281
|
+
4. Publish to npm:
|
|
388
282
|
|
|
389
283
|
```bash
|
|
390
|
-
|
|
391
|
-
pnpm add tcce-design-system
|
|
392
|
-
|
|
393
|
-
# Or from local path
|
|
394
|
-
pnpm add ../tcce-design-system
|
|
284
|
+
npm publish --access public
|
|
395
285
|
```
|
|
396
286
|
|
|
397
|
-
|
|
398
|
-
// Usage
|
|
399
|
-
import { Button, Card } from 'tcce-design-system';
|
|
400
|
-
import 'tcce-design-system/dist/tcce-design-system-components.css';
|
|
401
|
-
```
|
|
287
|
+
> Use `npm publish` (not `pnpm publish`) to avoid branch and git-state validation errors from pnpm.
|
|
402
288
|
|
|
403
289
|
---
|
|
404
290
|
|
|
405
|
-
##
|
|
406
|
-
|
|
407
|
-
### Workflow
|
|
408
|
-
|
|
409
|
-
1. **Create a branch:**
|
|
410
|
-
```bash
|
|
411
|
-
git checkout -b feature/component-name
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
2. **Make changes:**
|
|
415
|
-
- Follow component patterns
|
|
416
|
-
- Add Storybook stories
|
|
417
|
-
- Update types
|
|
418
|
-
|
|
419
|
-
3. **Run quality checks:**
|
|
420
|
-
```bash
|
|
421
|
-
pnpm lint:fix
|
|
422
|
-
pnpm format
|
|
423
|
-
pnpm build
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
4. **Commit and push:**
|
|
427
|
-
```bash
|
|
428
|
-
git add .
|
|
429
|
-
git commit -m "feat: add new component"
|
|
430
|
-
git push origin feature/component-name
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
5. **Create Pull Request**
|
|
434
|
-
|
|
435
|
-
### Coding Standards
|
|
291
|
+
## Troubleshooting
|
|
436
292
|
|
|
437
|
-
|
|
438
|
-
- Use **styled-components** for styling
|
|
439
|
-
- Use **Tailwind CSS** utilities via `@apply`
|
|
440
|
-
- Follow existing component patterns
|
|
441
|
-
- Write **stories** for all components
|
|
442
|
-
- Use **transient props** (`$prop`) in styled-components
|
|
443
|
-
- **No comments** unless absolutely necessary
|
|
293
|
+
### Styles not applying
|
|
444
294
|
|
|
445
|
-
|
|
295
|
+
Make sure the import order in your CSS file is correct — `tailwindcss` must come first:
|
|
446
296
|
|
|
447
|
-
|
|
297
|
+
```css
|
|
298
|
+
@import 'tailwindcss'; /* ✅ first */
|
|
299
|
+
@import '@bizapps/design-system-testing/styles'; /* ✅ second */
|
|
300
|
+
```
|
|
448
301
|
|
|
449
|
-
|
|
450
|
-
- **MINOR**: New features (backward compatible)
|
|
451
|
-
- **PATCH**: Bug fixes
|
|
302
|
+
### `Cannot resolve './tokens.css'` or similar errors
|
|
452
303
|
|
|
453
|
-
|
|
304
|
+
This means you're using an older version of the package (0.4.0 or 0.4.1). Update to the latest version:
|
|
454
305
|
|
|
455
|
-
|
|
306
|
+
```bash
|
|
307
|
+
pnpm add @bizapps/design-system-testing@latest
|
|
308
|
+
```
|
|
456
309
|
|
|
457
|
-
|
|
310
|
+
### `Scope not found` on publish
|
|
458
311
|
|
|
459
|
-
|
|
312
|
+
The npm scope `@bizapps` belongs to the `bizapps` npm user account. Make sure you're logged in as that user:
|
|
460
313
|
|
|
461
|
-
**Port already in use:**
|
|
462
314
|
```bash
|
|
463
|
-
#
|
|
464
|
-
|
|
465
|
-
kill -9 <PID>
|
|
315
|
+
npm whoami # should return: bizapps
|
|
316
|
+
npm login # if not logged in
|
|
466
317
|
```
|
|
467
318
|
|
|
468
|
-
|
|
469
|
-
```bash
|
|
470
|
-
rm -rf node_modules
|
|
471
|
-
pnpm install
|
|
472
|
-
```
|
|
319
|
+
### pnpm `minimumReleaseAge` policy error
|
|
473
320
|
|
|
474
|
-
|
|
475
|
-
```bash
|
|
476
|
-
docker build --no-cache -t tcce-design-system .
|
|
477
|
-
```
|
|
321
|
+
If pnpm blocks installation of a recently published version, run:
|
|
478
322
|
|
|
479
|
-
**TypeScript errors:**
|
|
480
323
|
```bash
|
|
481
|
-
|
|
482
|
-
npx tsc --noEmit
|
|
324
|
+
pnpm config set minimum-release-age 0 --location project
|
|
483
325
|
```
|
|
484
326
|
|
|
485
|
-
### Getting Help
|
|
486
|
-
|
|
487
|
-
- Check Storybook docs: http://localhost:6006
|
|
488
|
-
- Review existing component patterns
|
|
489
|
-
- Contact: bizapps@tcce.biz
|
|
490
|
-
|
|
491
327
|
---
|
|
492
328
|
|
|
493
329
|
## License
|
|
494
330
|
|
|
495
|
-
MIT
|
|
496
|
-
|
|
497
|
-
## Team
|
|
498
|
-
|
|
499
|
-
- **Author:** BizAppsTotal <bizapps@tcce.biz>
|
|
500
|
-
- **Version:** 0.3.24
|
|
331
|
+
MIT — BizAppsTotal <bizapps@tcce.biz>
|