@bizapps/design-system-testing 0.4.1 → 0.4.3
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 +210 -374
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total.ai +2795 -7
- package/dist/assets/brand/Logo_Total_Civil_Construction/Entrega_Logo_Total.pdf +2950 -10
- 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 +7 -0
- 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.cjs +2 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.css +1 -215
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/package.json +3 -17
- package/dist/main.css.map +0 -1
package/README.md
CHANGED
|
@@ -1,500 +1,336 @@
|
|
|
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: [
|
|
57
|
+
react(),
|
|
58
|
+
tailwindcss(),
|
|
59
|
+
],
|
|
60
|
+
})
|
|
73
61
|
```
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
- Storybook: http://localhost:6006
|
|
77
|
-
- Vite Dev: http://localhost:5173
|
|
63
|
+
### 2. Import the styles
|
|
78
64
|
|
|
79
|
-
|
|
65
|
+
In your main CSS file (e.g. `src/index.css`), add these two lines **in this order**:
|
|
80
66
|
|
|
81
|
-
```
|
|
82
|
-
|
|
67
|
+
```css
|
|
68
|
+
@import "tailwindcss";
|
|
69
|
+
@import "@bizapps/design-system-testing/styles";
|
|
83
70
|
```
|
|
84
71
|
|
|
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
|
-
```
|
|
72
|
+
> **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
73
|
|
|
131
|
-
###
|
|
74
|
+
### 3. Import the CSS in your entry point
|
|
132
75
|
|
|
133
|
-
|
|
76
|
+
Make sure your `src/main.tsx` imports the CSS file:
|
|
134
77
|
|
|
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)
|
|
78
|
+
```tsx
|
|
79
|
+
import './index.css'
|
|
143
80
|
```
|
|
144
81
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
## Development
|
|
82
|
+
That's it. No further configuration is needed.
|
|
148
83
|
|
|
149
|
-
|
|
84
|
+
---
|
|
150
85
|
|
|
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 |
|
|
86
|
+
## Usage
|
|
161
87
|
|
|
162
|
-
|
|
88
|
+
Import components directly from the package:
|
|
163
89
|
|
|
164
|
-
|
|
90
|
+
```tsx
|
|
91
|
+
import { Button } from '@bizapps/design-system-testing'
|
|
165
92
|
|
|
166
|
-
|
|
167
|
-
|
|
93
|
+
function App() {
|
|
94
|
+
return (
|
|
95
|
+
<Button variant="primary" size="md">
|
|
96
|
+
Click me
|
|
97
|
+
</Button>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
168
100
|
```
|
|
169
101
|
|
|
170
102
|
---
|
|
171
103
|
|
|
172
|
-
##
|
|
173
|
-
|
|
174
|
-
### Creating a New Component
|
|
104
|
+
## Available Components
|
|
175
105
|
|
|
176
|
-
|
|
106
|
+
### Button
|
|
177
107
|
|
|
178
|
-
```
|
|
179
|
-
|
|
108
|
+
```tsx
|
|
109
|
+
import { Button } from '@bizapps/design-system-testing'
|
|
180
110
|
```
|
|
181
111
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
112
|
+
#### Props
|
|
113
|
+
|
|
114
|
+
| Prop | Type | Default | Description |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| `variant` | `'primary' \| 'secondary' \| 'cancel' \| 'outline' \| 'ghost'` | `'primary'` | Visual style of the button |
|
|
117
|
+
| `size` | `'sm' \| 'md' \| 'lg' \| 'icon-sm'` | `'md'` | Size of the button |
|
|
118
|
+
| `isLoading` | `boolean` | `false` | Shows a loading state |
|
|
119
|
+
| `disabled` | `boolean` | `false` | Disables the button |
|
|
120
|
+
| `asChild` | `boolean` | `false` | Renders as child element (via Radix Slot) |
|
|
121
|
+
|
|
122
|
+
#### Examples
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
// Variants
|
|
126
|
+
<Button variant="primary">Primary</Button>
|
|
127
|
+
<Button variant="secondary">Secondary</Button>
|
|
128
|
+
<Button variant="cancel">Cancel</Button>
|
|
129
|
+
<Button variant="outline">Outline</Button>
|
|
130
|
+
<Button variant="ghost">Ghost</Button>
|
|
131
|
+
|
|
132
|
+
// Sizes
|
|
133
|
+
<Button size="sm">Small</Button>
|
|
134
|
+
<Button size="md">Medium</Button>
|
|
135
|
+
<Button size="lg">Large</Button>
|
|
136
|
+
|
|
137
|
+
// States
|
|
138
|
+
<Button disabled>Disabled</Button>
|
|
139
|
+
<Button isLoading>Loading...</Button>
|
|
140
|
+
|
|
141
|
+
// As a link (using asChild)
|
|
142
|
+
<Button asChild variant="primary">
|
|
143
|
+
<a href="/dashboard">Go to Dashboard</a>
|
|
144
|
+
</Button>
|
|
190
145
|
```
|
|
191
146
|
|
|
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
|
-
```
|
|
147
|
+
---
|
|
201
148
|
|
|
202
|
-
|
|
203
|
-
// MyComponent.styles.ts
|
|
204
|
-
import styled from 'styled-components';
|
|
149
|
+
## Design Tokens
|
|
205
150
|
|
|
206
|
-
|
|
207
|
-
/* Styles using Tailwind and styled-components */
|
|
208
|
-
`;
|
|
209
|
-
```
|
|
151
|
+
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
152
|
|
|
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
|
-
```
|
|
153
|
+
### Colors
|
|
231
154
|
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
155
|
+
```css
|
|
156
|
+
/* Brand */
|
|
157
|
+
--color-main-blue-primary: #22205f;
|
|
158
|
+
--color-main-orange-primary: #f66a24;
|
|
159
|
+
--color-main-grey: #605f60;
|
|
237
160
|
|
|
238
|
-
|
|
161
|
+
/* Semantic */
|
|
162
|
+
--color-main-positive-state: #01d42f; /* success */
|
|
163
|
+
--color-main-warning-state: #ea3a3d; /* error/danger */
|
|
164
|
+
--color-main-yellow-primary: #faca4a; /* warning */
|
|
239
165
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
166
|
+
/* Scales: dark, light, blue, red, orange, yellow, green, purple */
|
|
167
|
+
/* Each scale goes from 100 (lightest) to 1000 (darkest) */
|
|
168
|
+
--color-blue-100 through --color-blue-1000
|
|
169
|
+
--color-green-100 through --color-green-1000
|
|
170
|
+
/* ...etc */
|
|
243
171
|
```
|
|
244
172
|
|
|
245
|
-
|
|
173
|
+
### Border Radius
|
|
246
174
|
|
|
247
|
-
```
|
|
248
|
-
|
|
175
|
+
```css
|
|
176
|
+
--border-radius-button: 1.875rem;
|
|
177
|
+
--border-radius-secondary-button: 0.625rem;
|
|
178
|
+
--border-radius-card: 1.25rem;
|
|
179
|
+
--border-radius-article: 0.875rem;
|
|
180
|
+
--border-radius-outline: 0.5rem;
|
|
249
181
|
```
|
|
250
182
|
|
|
251
|
-
###
|
|
183
|
+
### Shadows
|
|
252
184
|
|
|
253
|
-
|
|
254
|
-
-
|
|
255
|
-
-
|
|
256
|
-
-
|
|
257
|
-
-
|
|
185
|
+
```css
|
|
186
|
+
--shadow-black-card
|
|
187
|
+
--shadow-hover-black-card
|
|
188
|
+
--shadow-black-button
|
|
189
|
+
--shadow-hover-black-button
|
|
190
|
+
--shadow-hover-orange-button
|
|
191
|
+
```
|
|
258
192
|
|
|
259
|
-
|
|
193
|
+
### Typography
|
|
260
194
|
|
|
261
|
-
|
|
195
|
+
The library includes the following fonts, loaded automatically:
|
|
262
196
|
|
|
263
|
-
|
|
197
|
+
- **Inter Variable** — primary UI font (`--font-sans`)
|
|
198
|
+
- **Dax** — brand heading font
|
|
199
|
+
- **Helvetica Neue** — secondary font
|
|
264
200
|
|
|
265
|
-
|
|
266
|
-
- **ESLint** - Code linting
|
|
267
|
-
- **Prettier** - Code formatting
|
|
268
|
-
- **TypeScript** - Type safety
|
|
201
|
+
### Using tokens in your CSS
|
|
269
202
|
|
|
270
|
-
|
|
203
|
+
```css
|
|
204
|
+
.my-card {
|
|
205
|
+
background: var(--color-main-white);
|
|
206
|
+
border-radius: var(--border-radius-card);
|
|
207
|
+
box-shadow: var(--shadow-black-card);
|
|
208
|
+
}
|
|
271
209
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
210
|
+
.my-card:hover {
|
|
211
|
+
box-shadow: var(--shadow-hover-black-card);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
275
214
|
|
|
276
|
-
|
|
277
|
-
pnpm lint:fix
|
|
215
|
+
### Using tokens in Tailwind classes
|
|
278
216
|
|
|
279
|
-
|
|
280
|
-
pnpm format
|
|
217
|
+
The tokens are also registered as Tailwind theme values, so you can use them as utility classes:
|
|
281
218
|
|
|
282
|
-
|
|
283
|
-
|
|
219
|
+
```tsx
|
|
220
|
+
<div className="bg-main-blue-primary text-main-white rounded-card shadow-black-card">
|
|
221
|
+
Hello
|
|
222
|
+
</div>
|
|
284
223
|
```
|
|
285
224
|
|
|
286
|
-
|
|
225
|
+
---
|
|
287
226
|
|
|
288
|
-
|
|
227
|
+
## Contributing
|
|
228
|
+
|
|
229
|
+
### Local Development
|
|
289
230
|
|
|
290
231
|
```bash
|
|
291
|
-
|
|
292
|
-
|
|
232
|
+
# Clone the repo
|
|
233
|
+
git clone <repository-url>
|
|
234
|
+
cd tcce-design-system
|
|
293
235
|
|
|
294
|
-
|
|
236
|
+
# Install dependencies
|
|
237
|
+
pnpm install
|
|
295
238
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
- Prettier formatting required
|
|
239
|
+
# Start Storybook (recommended)
|
|
240
|
+
pnpm storybook
|
|
241
|
+
# → http://localhost:6006
|
|
300
242
|
|
|
301
|
-
|
|
243
|
+
# OR start Vite dev server
|
|
244
|
+
pnpm dev
|
|
245
|
+
# → http://localhost:5173
|
|
246
|
+
```
|
|
302
247
|
|
|
303
|
-
|
|
248
|
+
### Adding a New Component
|
|
304
249
|
|
|
305
|
-
|
|
250
|
+
1. Create the component folder under `src/components/ui/ComponentName/`
|
|
251
|
+
2. Build the component following the existing `Button` pattern
|
|
252
|
+
3. Export it from `src/main.ts`
|
|
253
|
+
4. Add a Storybook story under `src/stories/`
|
|
306
254
|
|
|
307
|
-
|
|
255
|
+
### Code Quality
|
|
308
256
|
|
|
309
257
|
```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
|
-
};
|
|
258
|
+
pnpm lint # check for lint errors
|
|
259
|
+
pnpm lint:fix # auto-fix lint errors
|
|
260
|
+
pnpm format # format with Prettier
|
|
261
|
+
pnpm type-check # TypeScript check without building
|
|
355
262
|
```
|
|
356
263
|
|
|
357
264
|
---
|
|
358
265
|
|
|
359
|
-
## Publishing
|
|
266
|
+
## Publishing a New Version
|
|
360
267
|
|
|
361
|
-
|
|
268
|
+
1. Make your changes and commit them:
|
|
362
269
|
|
|
363
270
|
```bash
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
# Check dist folder
|
|
368
|
-
ls dist/
|
|
271
|
+
git add -A
|
|
272
|
+
git commit -m "feat: description of changes"
|
|
369
273
|
```
|
|
370
274
|
|
|
371
|
-
|
|
275
|
+
2. Update the version in `package.json` following [semver](https://semver.org/):
|
|
276
|
+
- `patch` (0.4.x) → bug fixes
|
|
277
|
+
- `minor` (0.x.0) → new components or features
|
|
278
|
+
- `major` (x.0.0) → breaking changes
|
|
372
279
|
|
|
373
|
-
|
|
374
|
-
# Login to npm
|
|
375
|
-
npm login
|
|
280
|
+
3. Build the library:
|
|
376
281
|
|
|
377
|
-
|
|
378
|
-
|
|
282
|
+
```bash
|
|
283
|
+
pnpm build
|
|
379
284
|
```
|
|
380
285
|
|
|
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
|
|
286
|
+
4. Publish to npm:
|
|
388
287
|
|
|
389
288
|
```bash
|
|
390
|
-
|
|
391
|
-
pnpm add tcce-design-system
|
|
392
|
-
|
|
393
|
-
# Or from local path
|
|
394
|
-
pnpm add ../tcce-design-system
|
|
289
|
+
npm publish --access public
|
|
395
290
|
```
|
|
396
291
|
|
|
397
|
-
|
|
398
|
-
// Usage
|
|
399
|
-
import { Button, Card } from 'tcce-design-system';
|
|
400
|
-
import 'tcce-design-system/dist/tcce-design-system-components.css';
|
|
401
|
-
```
|
|
292
|
+
> Use `npm publish` (not `pnpm publish`) to avoid branch and git-state validation errors from pnpm.
|
|
402
293
|
|
|
403
294
|
---
|
|
404
295
|
|
|
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
|
|
296
|
+
## Troubleshooting
|
|
436
297
|
|
|
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
|
|
298
|
+
### Styles not applying
|
|
444
299
|
|
|
445
|
-
|
|
300
|
+
Make sure the import order in your CSS file is correct — `tailwindcss` must come first:
|
|
446
301
|
|
|
447
|
-
|
|
302
|
+
```css
|
|
303
|
+
@import "tailwindcss"; /* ✅ first */
|
|
304
|
+
@import "@bizapps/design-system-testing/styles"; /* ✅ second */
|
|
305
|
+
```
|
|
448
306
|
|
|
449
|
-
|
|
450
|
-
- **MINOR**: New features (backward compatible)
|
|
451
|
-
- **PATCH**: Bug fixes
|
|
307
|
+
### `Cannot resolve './tokens.css'` or similar errors
|
|
452
308
|
|
|
453
|
-
|
|
309
|
+
This means you're using an older version of the package (0.4.0 or 0.4.1). Update to the latest version:
|
|
454
310
|
|
|
455
|
-
|
|
311
|
+
```bash
|
|
312
|
+
pnpm add @bizapps/design-system-testing@latest
|
|
313
|
+
```
|
|
456
314
|
|
|
457
|
-
|
|
315
|
+
### `Scope not found` on publish
|
|
458
316
|
|
|
459
|
-
|
|
317
|
+
The npm scope `@bizapps` belongs to the `bizapps` npm user account. Make sure you're logged in as that user:
|
|
460
318
|
|
|
461
|
-
**Port already in use:**
|
|
462
319
|
```bash
|
|
463
|
-
#
|
|
464
|
-
|
|
465
|
-
kill -9 <PID>
|
|
320
|
+
npm whoami # should return: bizapps
|
|
321
|
+
npm login # if not logged in
|
|
466
322
|
```
|
|
467
323
|
|
|
468
|
-
|
|
469
|
-
```bash
|
|
470
|
-
rm -rf node_modules
|
|
471
|
-
pnpm install
|
|
472
|
-
```
|
|
324
|
+
### pnpm `minimumReleaseAge` policy error
|
|
473
325
|
|
|
474
|
-
|
|
475
|
-
```bash
|
|
476
|
-
docker build --no-cache -t tcce-design-system .
|
|
477
|
-
```
|
|
326
|
+
If pnpm blocks installation of a recently published version, run:
|
|
478
327
|
|
|
479
|
-
**TypeScript errors:**
|
|
480
328
|
```bash
|
|
481
|
-
|
|
482
|
-
npx tsc --noEmit
|
|
329
|
+
pnpm config set minimum-release-age 0 --location project
|
|
483
330
|
```
|
|
484
331
|
|
|
485
|
-
### Getting Help
|
|
486
|
-
|
|
487
|
-
- Check Storybook docs: http://localhost:6006
|
|
488
|
-
- Review existing component patterns
|
|
489
|
-
- Contact: bizapps@tcce.biz
|
|
490
|
-
|
|
491
332
|
---
|
|
492
333
|
|
|
493
334
|
## License
|
|
494
335
|
|
|
495
|
-
MIT
|
|
496
|
-
|
|
497
|
-
## Team
|
|
498
|
-
|
|
499
|
-
- **Author:** BizAppsTotal <bizapps@tcce.biz>
|
|
500
|
-
- **Version:** 0.3.24
|
|
336
|
+
MIT — BizAppsTotal <bizapps@tcce.biz>
|