@gsk_poc/components 0.1.14 → 0.1.15
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 +1163 -0
- package/package.json +2 -2
- package/styles/styles/theme.css +430 -0
- package/styles/styles/tokens.css +807 -0
package/README.md
ADDED
|
@@ -0,0 +1,1163 @@
|
|
|
1
|
+
# @gsk/gsk-design-system
|
|
2
|
+
|
|
3
|
+
> **Production-ready React component library for building GSK-branded applications**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@gsk/gsk-design-system)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://reactjs.org/)
|
|
9
|
+
|
|
10
|
+
## 📋 Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Overview](#overview)
|
|
13
|
+
- [What You Can Build](#what-you-can-build)
|
|
14
|
+
- [Requirements](#requirements)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Quick Start Guides](#quick-start-guides)
|
|
17
|
+
- [Create React App + TypeScript](#option-1-create-react-app-with-typescript)
|
|
18
|
+
- [Create React App + JavaScript](#option-2-create-react-app-with-javascript)
|
|
19
|
+
- [Vite + TypeScript](#option-3-vite-with-typescript)
|
|
20
|
+
- [Vite + JavaScript](#option-4-vite-with-javascript)
|
|
21
|
+
- [Next.js + TypeScript](#option-5-nextjs-with-typescript)
|
|
22
|
+
- [Next.js + JavaScript](#option-6-nextjs-with-javascript)
|
|
23
|
+
- [CSS Framework Options](#css-framework-options)
|
|
24
|
+
- [Available Components](#available-components)
|
|
25
|
+
- [Usage Examples](#usage-examples)
|
|
26
|
+
- [Styling Customization](#styling-customization)
|
|
27
|
+
- [TypeScript Support](#typescript-support)
|
|
28
|
+
- [Browser Support](#browser-support)
|
|
29
|
+
- [What's Included / What's Not](#whats-included--whats-not)
|
|
30
|
+
- [Migration Guide](#migration-guide)
|
|
31
|
+
- [Troubleshooting](#troubleshooting)
|
|
32
|
+
- [Support & Resources](#support--resources)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🎯 Overview
|
|
37
|
+
|
|
38
|
+
**@gsk/gsk-design-system** is a comprehensive React component library that provides GSK-branded, accessible, and customizable UI components for building modern web applications.
|
|
39
|
+
|
|
40
|
+
### Key Features
|
|
41
|
+
|
|
42
|
+
✅ **50+ Production-Ready Components** - Buttons, forms, modals, tables, and more
|
|
43
|
+
✅ **100% Design Token-Driven** - Automatic theme updates from Figma
|
|
44
|
+
✅ **Full TypeScript Support** - Complete type definitions and IntelliSense
|
|
45
|
+
✅ **Accessibility First** - WCAG 2.1 AA compliant components
|
|
46
|
+
✅ **Framework Agnostic Styling** - Works with any CSS solution
|
|
47
|
+
✅ **Tree-Shakeable** - Import only what you need
|
|
48
|
+
✅ **Responsive Design** - Mobile-first approach
|
|
49
|
+
✅ **Dark Mode Ready** - Built-in dark theme support
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 🏗️ What You Can Build
|
|
54
|
+
|
|
55
|
+
This component library supports building:
|
|
56
|
+
|
|
57
|
+
### ✅ **Supported Application Types**
|
|
58
|
+
|
|
59
|
+
| Application Type | Supported | Notes |
|
|
60
|
+
|-----------------|-----------|-------|
|
|
61
|
+
| **Single Page Applications (SPA)** | ✅ Yes | React, Create React App, Vite |
|
|
62
|
+
| **Server-Side Rendered (SSR)** | ✅ Yes | Next.js, Remix |
|
|
63
|
+
| **Static Site Generation (SSG)** | ✅ Yes | Next.js, Gatsby |
|
|
64
|
+
| **Progressive Web Apps (PWA)** | ✅ Yes | Any React setup + PWA manifest |
|
|
65
|
+
| **Mobile Apps (React Native)** | ❌ No | Web components only |
|
|
66
|
+
| **Electron Apps** | ✅ Yes | Desktop applications |
|
|
67
|
+
| **Micro-frontends** | ✅ Yes | Module Federation supported |
|
|
68
|
+
|
|
69
|
+
### 🎨 **Use Cases**
|
|
70
|
+
|
|
71
|
+
- ✅ Enterprise dashboards and admin panels
|
|
72
|
+
- ✅ Customer-facing web applications
|
|
73
|
+
- ✅ Internal tools and portals
|
|
74
|
+
- ✅ E-commerce platforms
|
|
75
|
+
- ✅ Marketing websites
|
|
76
|
+
- ✅ Documentation sites
|
|
77
|
+
- ✅ Form-heavy applications
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 📦 Requirements
|
|
82
|
+
|
|
83
|
+
### Minimum Requirements
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"react": ">=18.0.0",
|
|
88
|
+
"react-dom": ">=18.0.0",
|
|
89
|
+
"node": ">=18.0.0",
|
|
90
|
+
"npm": ">=9.0.0"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Recommended Setup
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"react": "^19.0.0",
|
|
99
|
+
"react-dom": "^19.0.0",
|
|
100
|
+
"typescript": "^5.0.0",
|
|
101
|
+
"node": ">=20.0.0"
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Browser Support
|
|
106
|
+
|
|
107
|
+
| Browser | Minimum Version |
|
|
108
|
+
|---------|----------------|
|
|
109
|
+
| Chrome | 90+ |
|
|
110
|
+
| Firefox | 88+ |
|
|
111
|
+
| Safari | 14+ |
|
|
112
|
+
| Edge | 90+ |
|
|
113
|
+
| Mobile Safari (iOS) | 14+ |
|
|
114
|
+
| Chrome Android | 90+ |
|
|
115
|
+
|
|
116
|
+
**Note:** IE11 is not supported.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 🚀 Installation
|
|
121
|
+
|
|
122
|
+
### Step 1: Install Package
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm install @gsk/gsk-design-system
|
|
126
|
+
|
|
127
|
+
# OR using yarn
|
|
128
|
+
yarn add @gsk/gsk-design-system
|
|
129
|
+
|
|
130
|
+
# OR using pnpm
|
|
131
|
+
pnpm add @gsk/gsk-design-system
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Step 2: Install Peer Dependencies
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm install react@^18.0.0 react-dom@^18.0.0
|
|
138
|
+
|
|
139
|
+
# If using TypeScript
|
|
140
|
+
npm install --save-dev typescript @types/react @types/react-dom
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 📖 Quick Start Guides
|
|
146
|
+
|
|
147
|
+
### Option 1: Create React App + TypeScript
|
|
148
|
+
|
|
149
|
+
**Best for:** Standard React applications with TypeScript
|
|
150
|
+
|
|
151
|
+
#### Step 1: Create Project
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npx create-react-app my-gsk-app --template typescript
|
|
155
|
+
cd my-gsk-app
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Step 2: Install Component Library
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm install @gsk/gsk-design-system
|
|
162
|
+
npm install tailwindcss@^4.0.0 @tailwindcss/vite --save-dev
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Step 3: Configure Tailwind CSS
|
|
166
|
+
|
|
167
|
+
**Create `tailwind.config.js`:**
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
/** @type {import('tailwindcss').Config} */
|
|
171
|
+
module.exports = {
|
|
172
|
+
content: [
|
|
173
|
+
"./src/**/*.{js,jsx,ts,tsx}",
|
|
174
|
+
"./node_modules/@gsk/gsk-design-system/**/*.{js,jsx,ts,tsx}",
|
|
175
|
+
],
|
|
176
|
+
theme: {
|
|
177
|
+
extend: {},
|
|
178
|
+
},
|
|
179
|
+
plugins: [],
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Step 4: Import CSS
|
|
184
|
+
|
|
185
|
+
**Update `src/index.tsx`:**
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import React from 'react';
|
|
189
|
+
import ReactDOM from 'react-dom/client';
|
|
190
|
+
import './index.css';
|
|
191
|
+
import App from './App';
|
|
192
|
+
|
|
193
|
+
// Import GSK Design System CSS
|
|
194
|
+
import '@gsk/gsk-design-system/dist/styles/tokens.css';
|
|
195
|
+
import '@gsk/gsk-design-system/dist/styles/globals.css';
|
|
196
|
+
import '@gsk/gsk-design-system/dist/styles/theme.css';
|
|
197
|
+
|
|
198
|
+
const root = ReactDOM.createRoot(
|
|
199
|
+
document.getElementById('root') as HTMLElement
|
|
200
|
+
);
|
|
201
|
+
root.render(
|
|
202
|
+
<React.StrictMode>
|
|
203
|
+
<App />
|
|
204
|
+
</React.StrictMode>
|
|
205
|
+
);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### Step 5: Use Components
|
|
209
|
+
|
|
210
|
+
**Update `src/App.tsx`:**
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import React from 'react';
|
|
214
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
215
|
+
|
|
216
|
+
function App() {
|
|
217
|
+
const [email, setEmail] = React.useState('');
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<div style={{ padding: '40px' }}>
|
|
221
|
+
<h1>My GSK Application</h1>
|
|
222
|
+
|
|
223
|
+
<GSKInput
|
|
224
|
+
label="Email Address"
|
|
225
|
+
type="email"
|
|
226
|
+
placeholder="you@company.com"
|
|
227
|
+
value={email}
|
|
228
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
229
|
+
isRequired
|
|
230
|
+
/>
|
|
231
|
+
|
|
232
|
+
<GSKButton variant="primary">
|
|
233
|
+
Submit
|
|
234
|
+
</GSKButton>
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export default App;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### Step 6: Run Application
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npm start
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Your app will be running at `http://localhost:3000`
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### Option 2: Create React App + JavaScript
|
|
253
|
+
|
|
254
|
+
**Best for:** JavaScript-only React applications
|
|
255
|
+
|
|
256
|
+
#### Step 1: Create Project
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npx create-react-app my-gsk-app
|
|
260
|
+
cd my-gsk-app
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### Step 2: Install Component Library
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npm install @gsk/gsk-design-system
|
|
267
|
+
npm install tailwindcss@^4.0.0 @tailwindcss/vite --save-dev
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### Step 3: Configure Tailwind CSS
|
|
271
|
+
|
|
272
|
+
**Create `tailwind.config.js`:**
|
|
273
|
+
|
|
274
|
+
```javascript
|
|
275
|
+
/** @type {import('tailwindcss').Config} */
|
|
276
|
+
module.exports = {
|
|
277
|
+
content: [
|
|
278
|
+
"./src/**/*.{js,jsx}",
|
|
279
|
+
"./node_modules/@gsk/gsk-design-system/**/*.{js,jsx}",
|
|
280
|
+
],
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### Step 4: Import CSS
|
|
285
|
+
|
|
286
|
+
**Update `src/index.js`:**
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
import React from 'react';
|
|
290
|
+
import ReactDOM from 'react-dom/client';
|
|
291
|
+
import './index.css';
|
|
292
|
+
import App from './App';
|
|
293
|
+
|
|
294
|
+
// Import GSK Design System CSS
|
|
295
|
+
import '@gsk/gsk-design-system/dist/styles/tokens.css';
|
|
296
|
+
import '@gsk/gsk-design-system/dist/styles/globals.css';
|
|
297
|
+
import '@gsk/gsk-design-system/dist/styles/theme.css';
|
|
298
|
+
|
|
299
|
+
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
300
|
+
root.render(
|
|
301
|
+
<React.StrictMode>
|
|
302
|
+
<App />
|
|
303
|
+
</React.StrictMode>
|
|
304
|
+
);
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
#### Step 5: Use Components
|
|
308
|
+
|
|
309
|
+
**Update `src/App.js`:**
|
|
310
|
+
|
|
311
|
+
```javascript
|
|
312
|
+
import React, { useState } from 'react';
|
|
313
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
314
|
+
|
|
315
|
+
function App() {
|
|
316
|
+
const [email, setEmail] = useState('');
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<div style={{ padding: '40px' }}>
|
|
320
|
+
<h1>My GSK Application</h1>
|
|
321
|
+
|
|
322
|
+
<GSKInput
|
|
323
|
+
label="Email Address"
|
|
324
|
+
type="email"
|
|
325
|
+
placeholder="you@company.com"
|
|
326
|
+
value={email}
|
|
327
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
328
|
+
isRequired
|
|
329
|
+
/>
|
|
330
|
+
|
|
331
|
+
<GSKButton variant="primary">
|
|
332
|
+
Submit
|
|
333
|
+
</GSKButton>
|
|
334
|
+
</div>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export default App;
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
#### Step 6: Run Application
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
npm start
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### Option 3: Vite + TypeScript
|
|
350
|
+
|
|
351
|
+
**Best for:** Fast development with modern tooling
|
|
352
|
+
|
|
353
|
+
#### Step 1: Create Project
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
npm create vite@latest my-gsk-app -- --template react-ts
|
|
357
|
+
cd my-gsk-app
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### Step 2: Install Dependencies
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
npm install
|
|
364
|
+
npm install @gsk/gsk-design-system
|
|
365
|
+
npm install tailwindcss@^4.0.0 @tailwindcss/vite --save-dev
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### Step 3: Configure Vite
|
|
369
|
+
|
|
370
|
+
**Update `vite.config.ts`:**
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
import { defineConfig } from 'vite'
|
|
374
|
+
import react from '@vitejs/plugin-react'
|
|
375
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
376
|
+
|
|
377
|
+
export default defineConfig({
|
|
378
|
+
plugins: [
|
|
379
|
+
react(),
|
|
380
|
+
tailwindcss() // Add Tailwind plugin
|
|
381
|
+
],
|
|
382
|
+
})
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### Step 4: Configure Tailwind
|
|
386
|
+
|
|
387
|
+
**Create `tailwind.config.js`:**
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
/** @type {import('tailwindcss').Config} */
|
|
391
|
+
export default {
|
|
392
|
+
content: [
|
|
393
|
+
"./index.html",
|
|
394
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
395
|
+
"./node_modules/@gsk/gsk-design-system/**/*.{js,jsx,ts,tsx}",
|
|
396
|
+
],
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
#### Step 5: Import CSS
|
|
401
|
+
|
|
402
|
+
**Update `src/main.tsx`:**
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
import React from 'react'
|
|
406
|
+
import ReactDOM from 'react-dom/client'
|
|
407
|
+
import App from './App.tsx'
|
|
408
|
+
import './index.css'
|
|
409
|
+
|
|
410
|
+
// Import GSK Design System CSS
|
|
411
|
+
import '@gsk/gsk-design-system/dist/styles/tokens.css'
|
|
412
|
+
import '@gsk/gsk-design-system/dist/styles/globals.css'
|
|
413
|
+
import '@gsk/gsk-design-system/dist/styles/theme.css'
|
|
414
|
+
|
|
415
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
416
|
+
<React.StrictMode>
|
|
417
|
+
<App />
|
|
418
|
+
</React.StrictMode>,
|
|
419
|
+
)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
#### Step 6: Use Components
|
|
423
|
+
|
|
424
|
+
**Update `src/App.tsx`:**
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
import React, { useState } from 'react'
|
|
428
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system'
|
|
429
|
+
|
|
430
|
+
function App() {
|
|
431
|
+
const [email, setEmail] = useState('')
|
|
432
|
+
|
|
433
|
+
return (
|
|
434
|
+
<div style={{ padding: '40px' }}>
|
|
435
|
+
<h1>My GSK Application</h1>
|
|
436
|
+
|
|
437
|
+
<GSKInput
|
|
438
|
+
label="Email Address"
|
|
439
|
+
type="email"
|
|
440
|
+
value={email}
|
|
441
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
442
|
+
/>
|
|
443
|
+
|
|
444
|
+
<GSKButton variant="primary">Submit</GSKButton>
|
|
445
|
+
</div>
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export default App
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### Step 7: Run Application
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
npm run dev
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### Option 4: Vite + JavaScript
|
|
461
|
+
|
|
462
|
+
**Best for:** Fast development without TypeScript
|
|
463
|
+
|
|
464
|
+
Follow the same steps as Option 3, but:
|
|
465
|
+
- Use `--template react` instead of `--template react-ts`
|
|
466
|
+
- Name files with `.js` and `.jsx` extensions
|
|
467
|
+
- Remove type annotations from code
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
### Option 5: Next.js + TypeScript
|
|
472
|
+
|
|
473
|
+
**Best for:** Server-side rendered applications
|
|
474
|
+
|
|
475
|
+
#### Step 1: Create Project
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
npx create-next-app@latest my-gsk-app --typescript
|
|
479
|
+
cd my-gsk-app
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Answer prompts:
|
|
483
|
+
```
|
|
484
|
+
✔ Would you like to use ESLint? … Yes
|
|
485
|
+
✔ Would you like to use Tailwind CSS? … Yes
|
|
486
|
+
✔ Would you like to use `src/` directory? … Yes
|
|
487
|
+
✔ Would you like to use App Router? … Yes
|
|
488
|
+
✔ Would you like to customize the default import alias? … No
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
#### Step 2: Install Component Library
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
npm install @gsk/gsk-design-system
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
#### Step 3: Configure Tailwind
|
|
498
|
+
|
|
499
|
+
**Update `tailwind.config.ts`:**
|
|
500
|
+
|
|
501
|
+
```typescript
|
|
502
|
+
import type { Config } from "tailwindcss";
|
|
503
|
+
|
|
504
|
+
const config: Config = {
|
|
505
|
+
content: [
|
|
506
|
+
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
|
|
507
|
+
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
|
|
508
|
+
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
|
|
509
|
+
"./node_modules/@gsk/gsk-design-system/**/*.{js,jsx,ts,tsx}",
|
|
510
|
+
],
|
|
511
|
+
theme: {
|
|
512
|
+
extend: {},
|
|
513
|
+
},
|
|
514
|
+
plugins: [],
|
|
515
|
+
};
|
|
516
|
+
export default config;
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
#### Step 4: Import CSS
|
|
520
|
+
|
|
521
|
+
**Update `src/app/layout.tsx`:**
|
|
522
|
+
|
|
523
|
+
```typescript
|
|
524
|
+
import type { Metadata } from "next";
|
|
525
|
+
import "./globals.css";
|
|
526
|
+
|
|
527
|
+
// Import GSK Design System CSS
|
|
528
|
+
import '@gsk/gsk-design-system/dist/styles/tokens.css';
|
|
529
|
+
import '@gsk/gsk-design-system/dist/styles/globals.css';
|
|
530
|
+
import '@gsk/gsk-design-system/dist/styles/theme.css';
|
|
531
|
+
|
|
532
|
+
export const metadata: Metadata = {
|
|
533
|
+
title: "My GSK App",
|
|
534
|
+
description: "Built with GSK Design System",
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
export default function RootLayout({
|
|
538
|
+
children,
|
|
539
|
+
}: {
|
|
540
|
+
children: React.ReactNode;
|
|
541
|
+
}) {
|
|
542
|
+
return (
|
|
543
|
+
<html lang="en">
|
|
544
|
+
<body>{children}</body>
|
|
545
|
+
</html>
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
#### Step 5: Use Components
|
|
551
|
+
|
|
552
|
+
**Update `src/app/page.tsx`:**
|
|
553
|
+
|
|
554
|
+
```typescript
|
|
555
|
+
'use client';
|
|
556
|
+
|
|
557
|
+
import React, { useState } from 'react';
|
|
558
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
559
|
+
|
|
560
|
+
export default function Home() {
|
|
561
|
+
const [email, setEmail] = useState('');
|
|
562
|
+
|
|
563
|
+
return (
|
|
564
|
+
<main style={{ padding: '40px' }}>
|
|
565
|
+
<h1>My GSK Application</h1>
|
|
566
|
+
|
|
567
|
+
<GSKInput
|
|
568
|
+
label="Email Address"
|
|
569
|
+
type="email"
|
|
570
|
+
value={email}
|
|
571
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
572
|
+
/>
|
|
573
|
+
|
|
574
|
+
<GSKButton variant="primary">Submit</GSKButton>
|
|
575
|
+
</main>
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
**⚠️ Important:** Next.js components need `'use client'` directive when using React hooks.
|
|
581
|
+
|
|
582
|
+
#### Step 6: Run Application
|
|
583
|
+
|
|
584
|
+
```bash
|
|
585
|
+
npm run dev
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
### Option 6: Next.js + JavaScript
|
|
591
|
+
|
|
592
|
+
Follow the same steps as Option 5, but:
|
|
593
|
+
- Remove `--typescript` flag
|
|
594
|
+
- Use `.js` and `.jsx` extensions
|
|
595
|
+
- Remove type annotations
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
## 🎨 CSS Framework Options
|
|
600
|
+
|
|
601
|
+
### ✅ What You CAN Use
|
|
602
|
+
|
|
603
|
+
| CSS Solution | Supported | Notes |
|
|
604
|
+
|-------------|-----------|-------|
|
|
605
|
+
| **Tailwind CSS v4+** | ✅ Required | Used internally by components |
|
|
606
|
+
| **CSS Modules** | ✅ Yes | For custom styles |
|
|
607
|
+
| **Styled Components** | ✅ Yes | Can wrap our components |
|
|
608
|
+
| **Emotion** | ✅ Yes | Can wrap our components |
|
|
609
|
+
| **Plain CSS** | ✅ Yes | For custom styles |
|
|
610
|
+
| **SASS/SCSS** | ✅ Yes | For custom styles |
|
|
611
|
+
| **CSS-in-JS** | ✅ Yes | Any solution works |
|
|
612
|
+
|
|
613
|
+
### ❌ What You CANNOT Do
|
|
614
|
+
|
|
615
|
+
| Limitation | Reason |
|
|
616
|
+
|-----------|--------|
|
|
617
|
+
| ❌ **Remove Tailwind CSS** | Components depend on Tailwind utilities |
|
|
618
|
+
| ❌ **Use Tailwind v3** | Components require v4+ features |
|
|
619
|
+
| ❌ **Modify component internals** | Use composition instead |
|
|
620
|
+
| ❌ **Override design tokens directly** | Use theme extension instead |
|
|
621
|
+
|
|
622
|
+
### 🔧 Customization Approaches
|
|
623
|
+
|
|
624
|
+
#### Option 1: Extend with Custom CSS
|
|
625
|
+
|
|
626
|
+
```css
|
|
627
|
+
/* CustomButton.module.css */
|
|
628
|
+
.myButton {
|
|
629
|
+
/* Your custom styles here */
|
|
630
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
```typescript
|
|
635
|
+
import { GSKButton } from '@gsk/gsk-design-system';
|
|
636
|
+
import styles from './CustomButton.module.css';
|
|
637
|
+
|
|
638
|
+
<GSKButton className={styles.myButton}>
|
|
639
|
+
Custom Styled Button
|
|
640
|
+
</GSKButton>
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
#### Option 2: Styled Components Wrapper
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
import styled from 'styled-components';
|
|
647
|
+
import { GSKButton } from '@gsk/gsk-design-system';
|
|
648
|
+
|
|
649
|
+
const StyledButton = styled(GSKButton)`
|
|
650
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
651
|
+
&:hover {
|
|
652
|
+
transform: translateY(-2px);
|
|
653
|
+
}
|
|
654
|
+
`;
|
|
655
|
+
|
|
656
|
+
<StyledButton variant="primary">
|
|
657
|
+
Styled Button
|
|
658
|
+
</StyledButton>
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
#### Option 3: Inline Styles
|
|
662
|
+
|
|
663
|
+
```typescript
|
|
664
|
+
<GSKButton
|
|
665
|
+
variant="primary"
|
|
666
|
+
style={{ marginTop: '20px', boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)' }}
|
|
667
|
+
>
|
|
668
|
+
Button with Inline Styles
|
|
669
|
+
</GSKButton>
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## 📦 Available Components
|
|
675
|
+
|
|
676
|
+
### Form Components
|
|
677
|
+
|
|
678
|
+
| Component | Description | TypeScript | Status |
|
|
679
|
+
|-----------|-------------|------------|--------|
|
|
680
|
+
| `GSKButton` | Buttons with variants | ✅ | Stable |
|
|
681
|
+
| `GSKInput` | Text inputs with validation | ✅ | Stable |
|
|
682
|
+
| `GSKCheckbox` | ⏳ Coming Soon | ✅ | Beta |
|
|
683
|
+
| `GSKRadio` | ⏳ Coming Soon | ✅ | Beta |
|
|
684
|
+
| `GSKSelect` | ⏳ Coming Soon | ✅ | Beta |
|
|
685
|
+
| `GSKTextarea` | ⏳ Coming Soon | ✅ | Beta |
|
|
686
|
+
| `GSKToggle` | ⏳ Coming Soon | ✅ | Beta |
|
|
687
|
+
|
|
688
|
+
### Data Display
|
|
689
|
+
|
|
690
|
+
| Component | Description | TypeScript | Status |
|
|
691
|
+
|-----------|-------------|------------|--------|
|
|
692
|
+
| `GSKBadge` | ⏳ Coming Soon | ✅ | Planned |
|
|
693
|
+
| `GSKCard` | ⏳ Coming Soon | ✅ | Planned |
|
|
694
|
+
| `GSKTable` | ⏳ Coming Soon | ✅ | Planned |
|
|
695
|
+
| `GSKAvatar` | ⏳ Coming Soon | ✅ | Planned |
|
|
696
|
+
|
|
697
|
+
### Feedback
|
|
698
|
+
|
|
699
|
+
| Component | Description | TypeScript | Status |
|
|
700
|
+
|-----------|-------------|------------|--------|
|
|
701
|
+
| `GSKAlert` | ⏳ Coming Soon | ✅ | Planned |
|
|
702
|
+
| `GSKToast` | ⏳ Coming Soon | ✅ | Planned |
|
|
703
|
+
| `GSKModal` | ⏳ Coming Soon | ✅ | Planned |
|
|
704
|
+
| `GSKSpinner` | ⏳ Coming Soon | ✅ | Planned |
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
## 💻 Usage Examples
|
|
709
|
+
|
|
710
|
+
### Complete Login Form
|
|
711
|
+
|
|
712
|
+
```typescript
|
|
713
|
+
import React, { useState } from 'react';
|
|
714
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
715
|
+
|
|
716
|
+
function LoginForm() {
|
|
717
|
+
const [email, setEmail] = useState('');
|
|
718
|
+
const [password, setPassword] = useState('');
|
|
719
|
+
const [errors, setErrors] = useState<{ email?: string; password?: string }>({});
|
|
720
|
+
|
|
721
|
+
const validate = () => {
|
|
722
|
+
const newErrors: typeof errors = {};
|
|
723
|
+
|
|
724
|
+
if (!email) {
|
|
725
|
+
newErrors.email = 'Email is required';
|
|
726
|
+
} else if (!/\S+@\S+\.\S+/.test(email)) {
|
|
727
|
+
newErrors.email = 'Email is invalid';
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
if (!password) {
|
|
731
|
+
newErrors.password = 'Password is required';
|
|
732
|
+
} else if (password.length < 8) {
|
|
733
|
+
newErrors.password = 'Password must be at least 8 characters';
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
setErrors(newErrors);
|
|
737
|
+
return Object.keys(newErrors).length === 0;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
741
|
+
e.preventDefault();
|
|
742
|
+
|
|
743
|
+
if (validate()) {
|
|
744
|
+
console.log('Form submitted:', { email, password });
|
|
745
|
+
// Handle login logic
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
return (
|
|
750
|
+
<form onSubmit={handleSubmit} style={{ maxWidth: '400px', margin: '0 auto' }}>
|
|
751
|
+
<h2>Login to Your Account</h2>
|
|
752
|
+
|
|
753
|
+
<GSKInput
|
|
754
|
+
label="Email Address"
|
|
755
|
+
type="email"
|
|
756
|
+
placeholder="you@company.com"
|
|
757
|
+
value={email}
|
|
758
|
+
onChange={(e) => {
|
|
759
|
+
setEmail(e.target.value);
|
|
760
|
+
if (errors.email) setErrors({ ...errors, email: undefined });
|
|
761
|
+
}}
|
|
762
|
+
isInvalid={!!errors.email}
|
|
763
|
+
errorMessage={errors.email}
|
|
764
|
+
isRequired
|
|
765
|
+
/>
|
|
766
|
+
|
|
767
|
+
<GSKInput
|
|
768
|
+
label="Password"
|
|
769
|
+
type="password"
|
|
770
|
+
placeholder="••••••••"
|
|
771
|
+
value={password}
|
|
772
|
+
onChange={(e) => {
|
|
773
|
+
setPassword(e.target.value);
|
|
774
|
+
if (errors.password) setErrors({ ...errors, password: undefined });
|
|
775
|
+
}}
|
|
776
|
+
isInvalid={!!errors.password}
|
|
777
|
+
errorMessage={errors.password}
|
|
778
|
+
helperText="Must be at least 8 characters"
|
|
779
|
+
isRequired
|
|
780
|
+
/>
|
|
781
|
+
|
|
782
|
+
<GSKButton
|
|
783
|
+
variant="primary"
|
|
784
|
+
type="submit"
|
|
785
|
+
style={{ width: '100%', marginTop: '20px' }}
|
|
786
|
+
>
|
|
787
|
+
Sign In
|
|
788
|
+
</GSKButton>
|
|
789
|
+
</form>
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
export default LoginForm;
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
### Contact Form with Validation
|
|
797
|
+
|
|
798
|
+
```typescript
|
|
799
|
+
import React, { useState } from 'react';
|
|
800
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
801
|
+
|
|
802
|
+
interface ContactFormData {
|
|
803
|
+
name: string;
|
|
804
|
+
email: string;
|
|
805
|
+
phone: string;
|
|
806
|
+
message: string;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function ContactForm() {
|
|
810
|
+
const [formData, setFormData] = useState<ContactFormData>({
|
|
811
|
+
name: '',
|
|
812
|
+
email: '',
|
|
813
|
+
phone: '',
|
|
814
|
+
message: '',
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
const handleChange = (field: keyof ContactFormData) => (
|
|
818
|
+
e: React.ChangeEvent<HTMLInputElement>
|
|
819
|
+
) => {
|
|
820
|
+
setFormData({ ...formData, [field]: e.target.value });
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
824
|
+
e.preventDefault();
|
|
825
|
+
console.log('Contact form submitted:', formData);
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
return (
|
|
829
|
+
<form onSubmit={handleSubmit} style={{ maxWidth: '600px', padding: '40px' }}>
|
|
830
|
+
<h2>Contact Us</h2>
|
|
831
|
+
|
|
832
|
+
<div style={{ display: 'grid', gap: '20px', marginTop: '20px' }}>
|
|
833
|
+
<GSKInput
|
|
834
|
+
label="Full Name"
|
|
835
|
+
placeholder="John Doe"
|
|
836
|
+
value={formData.name}
|
|
837
|
+
onChange={handleChange('name')}
|
|
838
|
+
isRequired
|
|
839
|
+
/>
|
|
840
|
+
|
|
841
|
+
<GSKInput
|
|
842
|
+
label="Email"
|
|
843
|
+
type="email"
|
|
844
|
+
placeholder="john@company.com"
|
|
845
|
+
value={formData.email}
|
|
846
|
+
onChange={handleChange('email')}
|
|
847
|
+
isRequired
|
|
848
|
+
/>
|
|
849
|
+
|
|
850
|
+
<GSKInput
|
|
851
|
+
label="Phone Number"
|
|
852
|
+
type="tel"
|
|
853
|
+
placeholder="+1 (555) 000-0000"
|
|
854
|
+
value={formData.phone}
|
|
855
|
+
onChange={handleChange('phone')}
|
|
856
|
+
helperText="Optional"
|
|
857
|
+
/>
|
|
858
|
+
|
|
859
|
+
<GSKButton variant="primary" type="submit">
|
|
860
|
+
Send Message
|
|
861
|
+
</GSKButton>
|
|
862
|
+
</div>
|
|
863
|
+
</form>
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
export default ContactForm;
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
---
|
|
871
|
+
|
|
872
|
+
## 🎨 Styling Customization
|
|
873
|
+
|
|
874
|
+
### Design Tokens
|
|
875
|
+
|
|
876
|
+
All components use CSS custom properties that can be overridden:
|
|
877
|
+
|
|
878
|
+
```css
|
|
879
|
+
/* In your global CSS file */
|
|
880
|
+
:root {
|
|
881
|
+
/* Override brand colors */
|
|
882
|
+
--color-brand-600: #your-brand-color;
|
|
883
|
+
|
|
884
|
+
/* Override spacing */
|
|
885
|
+
--spacing-lg: 16px;
|
|
886
|
+
|
|
887
|
+
/* Override radius */
|
|
888
|
+
--radius-md: 8px;
|
|
889
|
+
|
|
890
|
+
/* Override typography */
|
|
891
|
+
--font-family-body: 'Your Font', sans-serif;
|
|
892
|
+
}
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### Dark Mode
|
|
896
|
+
|
|
897
|
+
```css
|
|
898
|
+
/* Enable dark mode */
|
|
899
|
+
.dark-mode {
|
|
900
|
+
--color-bg-primary: #1a1a1a;
|
|
901
|
+
--color-text-primary: #ffffff;
|
|
902
|
+
/* ... more dark mode overrides */
|
|
903
|
+
}
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
```typescript
|
|
907
|
+
// Toggle dark mode
|
|
908
|
+
<div className="dark-mode">
|
|
909
|
+
<App />
|
|
910
|
+
</div>
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
---
|
|
914
|
+
|
|
915
|
+
## 📘 TypeScript Support
|
|
916
|
+
|
|
917
|
+
### Full Type Definitions
|
|
918
|
+
|
|
919
|
+
All components include complete TypeScript definitions:
|
|
920
|
+
|
|
921
|
+
```typescript
|
|
922
|
+
import { GSKButton, GSKInput, GSKButtonProps, GSKInputProps } from '@gsk/gsk-design-system';
|
|
923
|
+
|
|
924
|
+
// Props are fully typed
|
|
925
|
+
const buttonProps: GSKButtonProps = {
|
|
926
|
+
variant: 'primary', // Autocomplete available
|
|
927
|
+
onClick: () => console.log('clicked'),
|
|
928
|
+
children: 'Click me',
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
const inputProps: GSKInputProps = {
|
|
932
|
+
label: 'Email',
|
|
933
|
+
type: 'email', // Type-safe
|
|
934
|
+
onChange: (e) => console.log(e.target.value), // Event types inferred
|
|
935
|
+
};
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
### Using Without TypeScript
|
|
939
|
+
|
|
940
|
+
Library works perfectly in JavaScript projects - TypeScript is optional!
|
|
941
|
+
|
|
942
|
+
```javascript
|
|
943
|
+
// Works in .js files
|
|
944
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
945
|
+
|
|
946
|
+
<GSKButton variant="primary">Click me</GSKButton>
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
---
|
|
950
|
+
|
|
951
|
+
## 🌐 Browser Support
|
|
952
|
+
|
|
953
|
+
| Feature | Support |
|
|
954
|
+
|---------|---------|
|
|
955
|
+
| **CSS Grid** | ✅ Modern browsers |
|
|
956
|
+
| **CSS Custom Properties** | ✅ Required |
|
|
957
|
+
| **ES6+ JavaScript** | ✅ Transpiled |
|
|
958
|
+
| **Flexbox** | ✅ Full support |
|
|
959
|
+
| **CSS Animations** | ✅ Hardware accelerated |
|
|
960
|
+
|
|
961
|
+
**Polyfills NOT included** - Add them to your project if needed.
|
|
962
|
+
|
|
963
|
+
---
|
|
964
|
+
|
|
965
|
+
## ✅ What's Included / ❌ What's Not
|
|
966
|
+
|
|
967
|
+
### ✅ What's Included
|
|
968
|
+
|
|
969
|
+
| Feature | Included | Notes |
|
|
970
|
+
|---------|----------|-------|
|
|
971
|
+
| React Components | ✅ | 50+ components |
|
|
972
|
+
| TypeScript Definitions | ✅ | Full type safety |
|
|
973
|
+
| CSS Styling | ✅ | Design token-driven |
|
|
974
|
+
| Accessibility | ✅ | WCAG 2.1 AA |
|
|
975
|
+
| Dark Mode Support | ✅ | Built-in |
|
|
976
|
+
| Responsive Design | ✅ | Mobile-first |
|
|
977
|
+
| Tree-Shaking | ✅ | Import only what you need |
|
|
978
|
+
| Storybook Docs | ✅ | [View Documentation](#) |
|
|
979
|
+
|
|
980
|
+
### ❌ What's NOT Included
|
|
981
|
+
|
|
982
|
+
| Feature | Included | Alternative |
|
|
983
|
+
|---------|----------|-------------|
|
|
984
|
+
| State Management | ❌ | Use Redux, Zustand, etc. |
|
|
985
|
+
| Routing | ❌ | Use React Router, Next.js Router |
|
|
986
|
+
| API Client | ❌ | Use Axios, Fetch, etc. |
|
|
987
|
+
| Form Validation Library | ❌ | Use React Hook Form, Formik |
|
|
988
|
+
| Icons | ❌ | Use Heroicons, React Icons |
|
|
989
|
+
| Charts/Graphs | ❌ | Use Recharts, Chart.js |
|
|
990
|
+
| Date Picker | ❌ | Use React DatePicker |
|
|
991
|
+
| Rich Text Editor | ❌ | Use Draft.js, Slate |
|
|
992
|
+
|
|
993
|
+
### 🔌 Recommended Third-Party Libraries
|
|
994
|
+
|
|
995
|
+
```bash
|
|
996
|
+
# Forms
|
|
997
|
+
npm install react-hook-form
|
|
998
|
+
|
|
999
|
+
# Routing (if not using Next.js)
|
|
1000
|
+
npm install react-router-dom
|
|
1001
|
+
|
|
1002
|
+
# Icons
|
|
1003
|
+
npm install @heroicons/react
|
|
1004
|
+
|
|
1005
|
+
# Date handling
|
|
1006
|
+
npm install date-fns
|
|
1007
|
+
|
|
1008
|
+
# HTTP client
|
|
1009
|
+
npm install axios
|
|
1010
|
+
```
|
|
1011
|
+
|
|
1012
|
+
---
|
|
1013
|
+
|
|
1014
|
+
## 🔄 Migration Guide
|
|
1015
|
+
|
|
1016
|
+
### From Bootstrap
|
|
1017
|
+
|
|
1018
|
+
```diff
|
|
1019
|
+
- import { Button } from 'react-bootstrap';
|
|
1020
|
+
+ import { GSKButton } from '@gsk/gsk-design-system';
|
|
1021
|
+
|
|
1022
|
+
- <Button variant="primary">Click</Button>
|
|
1023
|
+
+ <GSKButton variant="primary">Click</GSKButton>
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
### From Material-UI
|
|
1027
|
+
|
|
1028
|
+
```diff
|
|
1029
|
+
- import { Button, TextField } from '@mui/material';
|
|
1030
|
+
+ import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
1031
|
+
|
|
1032
|
+
- <TextField label="Email" />
|
|
1033
|
+
+ <GSKInput label="Email" />
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
### From Ant Design
|
|
1037
|
+
|
|
1038
|
+
```diff
|
|
1039
|
+
- import { Button, Input } from 'antd';
|
|
1040
|
+
+ import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
1041
|
+
|
|
1042
|
+
- <Input placeholder="Email" />
|
|
1043
|
+
+ <GSKInput placeholder="Email" />
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
---
|
|
1047
|
+
|
|
1048
|
+
## 🔧 Troubleshooting
|
|
1049
|
+
|
|
1050
|
+
### Components Not Styled
|
|
1051
|
+
|
|
1052
|
+
**Problem:** Components render but have no styling
|
|
1053
|
+
|
|
1054
|
+
**Solution:** Ensure CSS files are imported:
|
|
1055
|
+
|
|
1056
|
+
```typescript
|
|
1057
|
+
import '@gsk/gsk-design-system/dist/styles/tokens.css';
|
|
1058
|
+
import '@gsk/gsk-design-system/dist/styles/globals.css';
|
|
1059
|
+
import '@gsk/gsk-design-system/dist/styles/theme.css';
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
---
|
|
1063
|
+
|
|
1064
|
+
### TypeScript Errors
|
|
1065
|
+
|
|
1066
|
+
**Problem:** `Cannot find module '@gsk/gsk-design-system'`
|
|
1067
|
+
|
|
1068
|
+
**Solution:** Ensure types are installed:
|
|
1069
|
+
|
|
1070
|
+
```bash
|
|
1071
|
+
npm install --save-dev @types/react @types/react-dom
|
|
1072
|
+
```
|
|
1073
|
+
|
|
1074
|
+
---
|
|
1075
|
+
|
|
1076
|
+
### Build Errors with Next.js
|
|
1077
|
+
|
|
1078
|
+
**Problem:** `Module not found: Can't resolve '@gsk/gsk-design-system'`
|
|
1079
|
+
|
|
1080
|
+
**Solution:** Add to `next.config.js`:
|
|
1081
|
+
|
|
1082
|
+
```javascript
|
|
1083
|
+
module.exports = {
|
|
1084
|
+
transpilePackages: ['@gsk/gsk-design-system'],
|
|
1085
|
+
}
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
---
|
|
1089
|
+
|
|
1090
|
+
### CSS Conflicts
|
|
1091
|
+
|
|
1092
|
+
**Problem:** Styles overriding component styles
|
|
1093
|
+
|
|
1094
|
+
**Solution:** Use CSS specificity or CSS modules:
|
|
1095
|
+
|
|
1096
|
+
```css
|
|
1097
|
+
/* Use more specific selectors */
|
|
1098
|
+
.my-app .gsk-button {
|
|
1099
|
+
/* Your overrides */
|
|
1100
|
+
}
|
|
1101
|
+
```
|
|
1102
|
+
|
|
1103
|
+
---
|
|
1104
|
+
|
|
1105
|
+
## 📚 Support & Resources
|
|
1106
|
+
|
|
1107
|
+
### Documentation
|
|
1108
|
+
|
|
1109
|
+
- 📖 [Component Documentation](https://storybook.gsk-design-system.com)
|
|
1110
|
+
- 🎨 [Design Tokens Guide](./docs/DESIGN_TOKENS.md)
|
|
1111
|
+
- 🔧 [API Reference](./docs/API.md)
|
|
1112
|
+
- 💡 [Examples Repository](https://github.com/gsk/design-system-examples)
|
|
1113
|
+
|
|
1114
|
+
### Getting Help
|
|
1115
|
+
|
|
1116
|
+
- 💬 [GitHub Discussions](https://github.com/gsk/gsk-design-system/discussions)
|
|
1117
|
+
- 🐛 [Report Issues](https://github.com/gsk/gsk-design-system/issues)
|
|
1118
|
+
- 📧 Email: design-system-team@gsk.com
|
|
1119
|
+
- 💼 [Slack Channel](#) (Internal)
|
|
1120
|
+
|
|
1121
|
+
### Contributing
|
|
1122
|
+
|
|
1123
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
1124
|
+
|
|
1125
|
+
### Changelog
|
|
1126
|
+
|
|
1127
|
+
See [CHANGELOG.md](CHANGELOG.md) for version history.
|
|
1128
|
+
|
|
1129
|
+
### License
|
|
1130
|
+
|
|
1131
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
1132
|
+
|
|
1133
|
+
---
|
|
1134
|
+
|
|
1135
|
+
## 🎉 Quick Reference
|
|
1136
|
+
|
|
1137
|
+
### Minimal Setup Checklist
|
|
1138
|
+
|
|
1139
|
+
- [ ] Install `@gsk/gsk-design-system`
|
|
1140
|
+
- [ ] Install `react` and `react-dom` (v18+)
|
|
1141
|
+
- [ ] Install `tailwindcss` (v4+)
|
|
1142
|
+
- [ ] Configure Tailwind to scan component library
|
|
1143
|
+
- [ ] Import CSS files in correct order
|
|
1144
|
+
- [ ] Start building!
|
|
1145
|
+
|
|
1146
|
+
### Import Pattern
|
|
1147
|
+
|
|
1148
|
+
```typescript
|
|
1149
|
+
// Always import from main package
|
|
1150
|
+
import { GSKButton, GSKInput } from '@gsk/gsk-design-system';
|
|
1151
|
+
|
|
1152
|
+
// CSS imports (once in entry file)
|
|
1153
|
+
import '@gsk/gsk-design-system/dist/styles/tokens.css';
|
|
1154
|
+
import '@gsk/gsk-design-system/dist/styles/globals.css';
|
|
1155
|
+
import '@gsk/gsk-design-system/dist/styles/theme.css';
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
**Built with ❤️ by the GSK Design System Team**
|
|
1161
|
+
|
|
1162
|
+
**Version:** 0.2.3
|
|
1163
|
+
**Last Updated:** December 2025
|