@waaelg/dga-design-system 0.5.1 → 0.5.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 +511 -492
- package/dist/style.css +1 -1
- package/package.json +58 -58
package/README.md
CHANGED
|
@@ -1,492 +1,511 @@
|
|
|
1
|
-
# @waaelg/dga-design-system
|
|
2
|
-
|
|
3
|
-
Saudi **DGA (Digital Government Authority)** design system — compiled CSS utilities, components, and optional JavaScript for interactive behavior.
|
|
4
|
-
|
|
5
|
-
- Responsive 12-column grid
|
|
6
|
-
- Typography, spacing, colors, radius, and **width/height** utilities
|
|
7
|
-
- UI components (buttons, alerts, accordion, navbar, cards, forms, and more)
|
|
8
|
-
- Optional JS helpers for interactive components
|
|
9
|
-
- Built-in **IBM Plex Sans Arabic** font
|
|
10
|
-
- RTL-friendly markup patterns
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install @waaelg/dga-design-system
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
The published package includes compiled assets from the `dist` folder:
|
|
21
|
-
|
|
22
|
-
| Import path | Description |
|
|
23
|
-
|-------------|-------------|
|
|
24
|
-
| `@waaelg/dga-design-system/style.css` | All compiled styles |
|
|
25
|
-
| `@waaelg/dga-design-system` | JavaScript component classes |
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Quick start
|
|
30
|
-
|
|
31
|
-
### 1. Import the stylesheet
|
|
32
|
-
|
|
33
|
-
```js
|
|
34
|
-
import '@waaelg/dga-design-system/style.css';
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### 2. Use `dga-*` classes in your HTML
|
|
38
|
-
|
|
39
|
-
```html
|
|
40
|
-
<html lang="ar" dir="rtl">
|
|
41
|
-
<body class="dga-bg-gray-25">
|
|
42
|
-
<div class="dga-container">
|
|
43
|
-
<div class="dga-row">
|
|
44
|
-
<div class="dga-col-12 dga-col-md-6">
|
|
45
|
-
<button class="dga-btn dga-btn-primary">زر أساسي</button>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</body>
|
|
50
|
-
</html>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 3. Initialize JavaScript (only when needed)
|
|
54
|
-
|
|
55
|
-
Static components work with CSS alone. For **legacy HTML markup**, interactive components need a one-time JS setup. **Web components** (`<dga-*>`) handle behavior automatically.
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
import '@waaelg/dga-design-system/style.css';
|
|
59
|
-
import '@waaelg/dga-design-system'; // registers <dga-*> elements
|
|
60
|
-
|
|
61
|
-
// Legacy only:
|
|
62
|
-
import { DGAAlert } from '@waaelg/dga-design-system';
|
|
63
|
-
new DGAAlert();
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**Web component (no init):**
|
|
67
|
-
|
|
68
|
-
```html
|
|
69
|
-
<dga-alert variant="success-color" title="Success" dismissible>
|
|
70
|
-
Operation completed successfully.
|
|
71
|
-
</dga-alert>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Usage by project type
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
import { useEffect } from 'react';
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
### Plain HTML
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
</
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
<
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
</div>
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
```js
|
|
291
|
-
new
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<div
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
<
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
</
|
|
362
|
-
|
|
363
|
-
<dga-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
1
|
+
# @waaelg/dga-design-system
|
|
2
|
+
|
|
3
|
+
Saudi **DGA (Digital Government Authority)** design system — compiled CSS utilities, components, and optional JavaScript for interactive behavior.
|
|
4
|
+
|
|
5
|
+
- Responsive 12-column grid
|
|
6
|
+
- Typography, spacing, colors, radius, and **width/height** utilities
|
|
7
|
+
- UI components (buttons, alerts, accordion, navbar, cards, forms, and more)
|
|
8
|
+
- Optional JS helpers for interactive components
|
|
9
|
+
- Built-in **IBM Plex Sans Arabic** font
|
|
10
|
+
- RTL-friendly markup patterns
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @waaelg/dga-design-system
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The published package includes compiled assets from the `dist` folder:
|
|
21
|
+
|
|
22
|
+
| Import path | Description |
|
|
23
|
+
|-------------|-------------|
|
|
24
|
+
| `@waaelg/dga-design-system/style.css` | All compiled styles |
|
|
25
|
+
| `@waaelg/dga-design-system` | JavaScript component classes |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quick start
|
|
30
|
+
|
|
31
|
+
### 1. Import the stylesheet
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import '@waaelg/dga-design-system/style.css';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Use `dga-*` classes in your HTML
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<html lang="ar" dir="rtl">
|
|
41
|
+
<body class="dga-bg-gray-25">
|
|
42
|
+
<div class="dga-container">
|
|
43
|
+
<div class="dga-row">
|
|
44
|
+
<div class="dga-col-12 dga-col-md-6">
|
|
45
|
+
<button class="dga-btn dga-btn-primary">زر أساسي</button>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Initialize JavaScript (only when needed)
|
|
54
|
+
|
|
55
|
+
Static components work with CSS alone. For **legacy HTML markup**, interactive components need a one-time JS setup. **Web components** (`<dga-*>`) handle behavior automatically.
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import '@waaelg/dga-design-system/style.css';
|
|
59
|
+
import '@waaelg/dga-design-system'; // registers <dga-*> elements
|
|
60
|
+
|
|
61
|
+
// Legacy only:
|
|
62
|
+
import { DGAAlert } from '@waaelg/dga-design-system';
|
|
63
|
+
new DGAAlert();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Web component (no init):**
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<dga-alert variant="success-color" title="Success" dismissible>
|
|
70
|
+
Operation completed successfully.
|
|
71
|
+
</dga-alert>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Usage by project type
|
|
77
|
+
|
|
78
|
+
Every setup comes down to the **same two imports** — the stylesheet, plus the package entry, which registers the `<dga-*>` web components automatically:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
import '@waaelg/dga-design-system/style.css';
|
|
82
|
+
import '@waaelg/dga-design-system';
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
After that, drop `<dga-*>` elements anywhere in your markup — they handle their own behavior, no initialization needed. The legacy `DGA*` classes stay available for hand-wired markup; see [JavaScript components](#javascript-components).
|
|
86
|
+
|
|
87
|
+
| Environment | Where the two imports go |
|
|
88
|
+
|-------------|--------------------------|
|
|
89
|
+
| Vite · Vue · React · Svelte | Your entry file (`main.js`, `main.ts`, `main.tsx`) |
|
|
90
|
+
| Next.js (App Router) | CSS in `app/layout.tsx`; register components from a `'use client'` file |
|
|
91
|
+
| Plain HTML · PHP · Razor | `<link>` + `<script type="module">` in the page |
|
|
92
|
+
| No build step | Load from a [CDN](#cdn-no-build-step) |
|
|
93
|
+
|
|
94
|
+
### Bundler apps (Vite, Vue, React, Svelte)
|
|
95
|
+
|
|
96
|
+
Add both imports once in your entry file, then use web components in any template:
|
|
97
|
+
|
|
98
|
+
```jsx
|
|
99
|
+
// main.tsx
|
|
100
|
+
import '@waaelg/dga-design-system/style.css';
|
|
101
|
+
import '@waaelg/dga-design-system';
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
export function App() {
|
|
106
|
+
return (
|
|
107
|
+
<div className="dga-container">
|
|
108
|
+
<dga-alert variant="success-color" title="نجاح" dismissible>
|
|
109
|
+
تمت العملية بنجاح
|
|
110
|
+
</dga-alert>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> **Vite tip:** if an import looks stale after upgrading, add `optimizeDeps: { exclude: ['@waaelg/dga-design-system'] }` to `vite.config.js`.
|
|
117
|
+
|
|
118
|
+
### Next.js (App Router)
|
|
119
|
+
|
|
120
|
+
Import the stylesheet in `app/layout.tsx` (a server component):
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import '@waaelg/dga-design-system/style.css';
|
|
124
|
+
|
|
125
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
126
|
+
return (
|
|
127
|
+
<html lang="ar" dir="rtl">
|
|
128
|
+
<body>{children}</body>
|
|
129
|
+
</html>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Web components need the browser, so register them from a client component:
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
'use client';
|
|
138
|
+
import { useEffect } from 'react';
|
|
139
|
+
|
|
140
|
+
export function DGAClient() {
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
import('@waaelg/dga-design-system'); // registers <dga-*> elements
|
|
143
|
+
}, []);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Render `<DGAClient />` once in your layout, then use `<dga-*>` tags in any page.
|
|
149
|
+
|
|
150
|
+
### Plain HTML / server-rendered (PHP, Razor, …)
|
|
151
|
+
|
|
152
|
+
Load the CSS and JS once, then use `<dga-*>` tags in markup. The JS is ESM-only, so the script tag **must** be `type="module"`:
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<!DOCTYPE html>
|
|
156
|
+
<html lang="ar" dir="rtl">
|
|
157
|
+
<head>
|
|
158
|
+
<meta charset="UTF-8" />
|
|
159
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
160
|
+
<link rel="stylesheet" href="/assets/dga/style.css" />
|
|
161
|
+
</head>
|
|
162
|
+
<body>
|
|
163
|
+
<dga-alert variant="success-color" title="نجاح" dismissible>
|
|
164
|
+
تمت العملية بنجاح
|
|
165
|
+
</dga-alert>
|
|
166
|
+
|
|
167
|
+
<script type="module" src="/assets/dga/index.js"></script>
|
|
168
|
+
</body>
|
|
169
|
+
</html>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Copy `dist/style.css` and `dist/index.js` into your served assets folder (`public/`, `wwwroot/`, …), or skip the copy entirely and [load from a CDN](#cdn-no-build-step).
|
|
173
|
+
|
|
174
|
+
### CDN (no build step)
|
|
175
|
+
|
|
176
|
+
Load the package straight from **jsDelivr** or **unpkg** — no install, no bundler. The CSS works with a plain `<link>`; the JS is ESM-only, so its `<script>` **must** be `type="module"`.
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<link
|
|
180
|
+
rel="stylesheet"
|
|
181
|
+
href="https://cdn.jsdelivr.net/npm/@waaelg/dga-design-system@0.5.3/dist/style.css"
|
|
182
|
+
/>
|
|
183
|
+
|
|
184
|
+
<script type="module">
|
|
185
|
+
import 'https://cdn.jsdelivr.net/npm/@waaelg/dga-design-system@0.5.3/dist/index.js';
|
|
186
|
+
</script>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Same files are on unpkg (`https://unpkg.com/@waaelg/dga-design-system@0.5.3/dist/…`). Pin a version for reproducible builds, or use `@latest` to always fetch the newest release. See the [installation docs](./docs/getting-started/installation.md#cdn-no-build-step) for a full example.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## CSS-only usage
|
|
194
|
+
|
|
195
|
+
Most of the design system works without JavaScript. Apply utility and component classes directly.
|
|
196
|
+
|
|
197
|
+
### Grid layout
|
|
198
|
+
|
|
199
|
+
```html
|
|
200
|
+
<div class="dga-container">
|
|
201
|
+
<div class="dga-row">
|
|
202
|
+
<div class="dga-col-12 dga-col-md-6 dga-col-lg-4">Column 1</div>
|
|
203
|
+
<div class="dga-col-12 dga-col-md-6 dga-col-lg-4">Column 2</div>
|
|
204
|
+
<div class="dga-col-12 dga-col-md-6 dga-col-lg-4">Column 3</div>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Common utility prefixes
|
|
210
|
+
|
|
211
|
+
| Prefix | Examples |
|
|
212
|
+
|--------|----------|
|
|
213
|
+
| Layout | `dga-container`, `dga-row`, `dga-col-*`, `dga-d-flex`, `dga-gap-*` |
|
|
214
|
+
| Width | `dga-w-full`, `dga-w-50`, `dga-max-w-lg`, `dga-w-screen` |
|
|
215
|
+
| Height | `dga-h-full`, `dga-h-100`, `dga-min-h-screen`, `dga-h-4` |
|
|
216
|
+
| Spacing | `dga-p-*`, `dga-m-*`, `dga-py-*`, `dga-px-*` |
|
|
217
|
+
| Colors | `dga-bg-primary-500`, `dga-text-gray-700` |
|
|
218
|
+
| Typography | `dga-text-sm`, `dga-text-xl`, `dga-fw-bold`, `dga-display-md` |
|
|
219
|
+
| Radius | `dga-rounded-md`, `dga-rounded-lg` |
|
|
220
|
+
| Effects | `dga-shadow-xs`…`dga-shadow-3xl`, `dga-backdrop-blur-md` |
|
|
221
|
+
| Flex direction | `dga-flex-col` / `dga-flex-column`, `dga-flex-row` |
|
|
222
|
+
|
|
223
|
+
### Included CSS components
|
|
224
|
+
|
|
225
|
+
These work with markup and classes only (no JS required):
|
|
226
|
+
|
|
227
|
+
- Buttons — `dga-btn`, `dga-btn-primary`, `dga-btn-neutral`, `dga-btn-subtle`, sizes `dga-btn-sm` / `dga-btn-md` / `dga-btn-lg`
|
|
228
|
+
- Cards — `dga-card`
|
|
229
|
+
- Forms — `dga-input`, `dga-select`, `dga-textarea`, `dga-label`
|
|
230
|
+
- Links & tags — `dga-link`, `dga-tag`
|
|
231
|
+
- Tables — `dga-table`
|
|
232
|
+
- Breadcrumb, divider, avatar
|
|
233
|
+
|
|
234
|
+
For the full documentation index, see **[docs/README.md](./docs/README.md)**.
|
|
235
|
+
|
|
236
|
+
Quick links:
|
|
237
|
+
- [Documentation index](./docs/README.md)
|
|
238
|
+
- [Installation](./docs/getting-started/installation.md)
|
|
239
|
+
- [JavaScript API](./docs/getting-started/javascript-api.md)
|
|
240
|
+
- [Web Components](./docs/getting-started/web-components.md)
|
|
241
|
+
- [Components](./docs/README.md#components)
|
|
242
|
+
- [Grid](./docs/foundations/grid.md) · [Colors](./docs/foundations/colors.md)
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## JavaScript components
|
|
247
|
+
|
|
248
|
+
Import from the main package entry:
|
|
249
|
+
|
|
250
|
+
```js
|
|
251
|
+
import {
|
|
252
|
+
DGAAccordion,
|
|
253
|
+
DGAAlert,
|
|
254
|
+
DGAChart,
|
|
255
|
+
DGACodeSnippet,
|
|
256
|
+
DGAMenuDropDown,
|
|
257
|
+
DGAVerifyBar,
|
|
258
|
+
} from '@waaelg/dga-design-system';
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Importing the package also registers **web components** — prefer these in Vue/React:
|
|
262
|
+
|
|
263
|
+
| Web component | Legacy class |
|
|
264
|
+
|---------------|--------------|
|
|
265
|
+
| `<dga-alert>` | `DGAAlert` |
|
|
266
|
+
| `<dga-accordion>` + `<dga-accordion-item>` | `DGAAccordion` |
|
|
267
|
+
| `<dga-code-snippet>` | `DGACodeSnippet` |
|
|
268
|
+
| `<dga-pie-chart>` | `DGAChart` |
|
|
269
|
+
| `<dga-verify-bar>` | `DGAVerifyBar` |
|
|
270
|
+
|
|
271
|
+
See [Web Components](./docs/getting-started/web-components.md) for framework setup.
|
|
272
|
+
|
|
273
|
+
### DGAAccordion (legacy)
|
|
274
|
+
|
|
275
|
+
Expands and collapses accordion panels. Supports click and keyboard (Enter / Space).
|
|
276
|
+
|
|
277
|
+
```html
|
|
278
|
+
<div class="dga-acc" id="myAccordion">
|
|
279
|
+
<div class="dga-acc-item">
|
|
280
|
+
<button class="dga-acc-header" aria-expanded="false">
|
|
281
|
+
<span>Section title</span>
|
|
282
|
+
</button>
|
|
283
|
+
<div class="dga-acc-content">
|
|
284
|
+
<div class="dga-acc-body">Content goes here.</div>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```js
|
|
291
|
+
new DGAAccordion(document.getElementById('myAccordion'));
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### DGAAlert (legacy)
|
|
295
|
+
|
|
296
|
+
Handles dismiss buttons on alerts. Requires `[data-alert-close]` on the close button.
|
|
297
|
+
|
|
298
|
+
```html
|
|
299
|
+
<div class="dga-alert" data-variant="success-color">
|
|
300
|
+
<span class="dga-alert-icon" aria-hidden="true"></span>
|
|
301
|
+
<div class="dga-alert-content">
|
|
302
|
+
<h4 class="dga-alert-title">Success</h4>
|
|
303
|
+
<div class="dga-alert-body">Operation completed successfully.</div>
|
|
304
|
+
</div>
|
|
305
|
+
<button class="dga-alert-close" type="button" data-alert-close aria-label="Dismiss alert">×</button>
|
|
306
|
+
</div>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
new DGAAlert(); // listens on document by default
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Variants:** `success-color`, `warning-color`, `destructive-color`, `info-color`, `neutral-color`, `success-white`, `warning-white`, `destructive-white`, `info-white`, `neutral-white`
|
|
314
|
+
|
|
315
|
+
### DGAChart (legacy)
|
|
316
|
+
|
|
317
|
+
Renders a pie chart using a `conic-gradient` background.
|
|
318
|
+
|
|
319
|
+
```html
|
|
320
|
+
<div id="myChart" class="dga-pie-chart" data-hole="false"></div>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
```js
|
|
324
|
+
new DGAChart(document.getElementById('myChart'), [
|
|
325
|
+
{ label: 'Item 1', from: '0%', to: '40%', color: 'var(--dga-primary-100)' },
|
|
326
|
+
{ label: 'Item 2', from: '40%', to: '100%', color: 'var(--dga-gray-200)' },
|
|
327
|
+
]);
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Set `data-hole="true"` on the element for a donut-style chart.
|
|
331
|
+
|
|
332
|
+
### DGACodeSnippet (legacy)
|
|
333
|
+
|
|
334
|
+
Enables copy-to-clipboard on code snippet blocks.
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
new DGACodeSnippet(); // listens on document by default
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Copy buttons must use `.dga-code-snippet-inline__copy` or `.dga-code-snippet-multiline__copy`.
|
|
341
|
+
|
|
342
|
+
### DGAMenuDropDown
|
|
343
|
+
|
|
344
|
+
Powers the responsive navbar with dropdown menus.
|
|
345
|
+
|
|
346
|
+
```html
|
|
347
|
+
<nav class="dga-navbar" role="navigation">
|
|
348
|
+
<a class="dga-navbar-brand" href="#">Brand</a>
|
|
349
|
+
<ul class="dga-menu">
|
|
350
|
+
<li>
|
|
351
|
+
<a class="dga-menu-item dga-has-dropdown" href="#" role="button" aria-expanded="false" aria-haspopup="true">
|
|
352
|
+
Menu
|
|
353
|
+
</a>
|
|
354
|
+
<div class="dga-dropdown">
|
|
355
|
+
<div class="dga-dropdown-content">
|
|
356
|
+
<ul>
|
|
357
|
+
<li><a href="#">Link</a></li>
|
|
358
|
+
</ul>
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
</li>
|
|
362
|
+
</ul>
|
|
363
|
+
<button class="dga-navbar-toggler" aria-label="Toggle menu"></button>
|
|
364
|
+
</nav>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
```js
|
|
368
|
+
const menu = new DGAMenuDropDown({
|
|
369
|
+
navbar: document.querySelector('.dga-navbar'),
|
|
370
|
+
});
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Web components
|
|
374
|
+
|
|
375
|
+
```html
|
|
376
|
+
<dga-alert variant="success-color" title="Success" dismissible>Message</dga-alert>
|
|
377
|
+
|
|
378
|
+
<dga-accordion>
|
|
379
|
+
<dga-accordion-item title="Question">Answer</dga-accordion-item>
|
|
380
|
+
</dga-accordion>
|
|
381
|
+
|
|
382
|
+
<dga-code-snippet code="npm install @waaelg/dga-design-system"></dga-code-snippet>
|
|
383
|
+
|
|
384
|
+
<dga-pie-chart data='[{"label":"A","from":"0%","to":"100%","color":"primary-100"}]'></dga-pie-chart>
|
|
385
|
+
|
|
386
|
+
<dga-verify-bar domain=".edu.sa"></dga-verify-bar>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### DGAVerifyBar (legacy)
|
|
390
|
+
|
|
391
|
+
Controls the Saudi government verification bar (legacy markup with fixed element IDs).
|
|
392
|
+
|
|
393
|
+
Expected IDs: `dga-verify-bar`, `dga-verifyBtn`, `dga-verify-bar_content`.
|
|
394
|
+
|
|
395
|
+
```js
|
|
396
|
+
const verifyBar = new DGAVerifyBar();
|
|
397
|
+
const menu = new DGAMenuDropDown();
|
|
398
|
+
|
|
399
|
+
// Optional: coordinate verify bar and navbar
|
|
400
|
+
verifyBar.menu = menu;
|
|
401
|
+
menu.verifyBar = verifyBar;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
| `<dga-verify-bar>` attribute | Default | Description |
|
|
405
|
+
|------------------------------|---------|-------------|
|
|
406
|
+
| `domain` | `.edu.sa` | Official domain suffix shown in the verify panel |
|
|
407
|
+
| `registration-number` | `20250105758` | DGA registration number |
|
|
408
|
+
| `registration-link` | DGA Raqmi URL | Link to the platform license page |
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## RTL and Arabic
|
|
413
|
+
|
|
414
|
+
The design system targets Arabic government websites. Set `dir="rtl"` and `lang="ar"` on the `<html>` element for correct layout direction. The default font is **IBM Plex Sans Arabic**, loaded automatically with the stylesheet.
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## What's included in the npm package
|
|
419
|
+
|
|
420
|
+
Only compiled files are published:
|
|
421
|
+
|
|
422
|
+
```
|
|
423
|
+
node_modules/@waaelg/dga-design-system/
|
|
424
|
+
├── dist/
|
|
425
|
+
│ ├── index.js # JavaScript components
|
|
426
|
+
│ ├── index.js.map
|
|
427
|
+
│ └── style.css # Compiled CSS
|
|
428
|
+
└── package.json
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
SCSS source files are **not** included in the npm package. To customize variables or mixins, clone the [repository](https://github.com/waaelg/dga-design-system) and build locally.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Local development (contributors)
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
git clone https://github.com/waaelg/dga-design-system.git
|
|
439
|
+
cd dga-design-system
|
|
440
|
+
npm install
|
|
441
|
+
npm run docs:dev # documentation at http://localhost:5173
|
|
442
|
+
npm run build # outputs dist/index.js and dist/style.css
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Documentation site (VitePress):
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
npm run docs:dev # local docs
|
|
449
|
+
npm run docs:build # production build
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Documentation:
|
|
453
|
+
|
|
454
|
+
| File | Contents |
|
|
455
|
+
|------|----------|
|
|
456
|
+
| `docs/foundations/grid.md` | Grid, flexbox, layout |
|
|
457
|
+
| `docs/foundations/width-height.md` | Width & height utilities |
|
|
458
|
+
| `docs/foundations/colors.md` | Color tokens and utilities |
|
|
459
|
+
| `docs/foundations/radius.md` | Border radius utilities |
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Troubleshooting
|
|
464
|
+
|
|
465
|
+
**Styles not applied**
|
|
466
|
+
- Confirm `import '@waaelg/dga-design-system/style.css'` runs before your app renders.
|
|
467
|
+
- In plain HTML, verify the `<link>` path points to `dist/style.css`.
|
|
468
|
+
|
|
469
|
+
**Interactive component not working**
|
|
470
|
+
- Check that the required HTML structure and classes match the examples above.
|
|
471
|
+
- Ensure the matching JS class is instantiated after the DOM is ready.
|
|
472
|
+
- For alerts and code snippets, `new DGAAlert()` / `new DGACodeSnippet()` must run once.
|
|
473
|
+
|
|
474
|
+
**Navbar dropdown or verify bar issues**
|
|
475
|
+
- `DGAMenuDropDown` requires a `.dga-navbar` element with `.dga-menu` and `.dga-navbar-toggler`.
|
|
476
|
+
- `DGAVerifyBar` requires the legacy ID-based markup (`#dga-verify-bar`, etc.), or use `<dga-verify-bar>` instead.
|
|
477
|
+
|
|
478
|
+
**Vite: `does not provide an export named 'DGAAlert'`**
|
|
479
|
+
- Stale Vite pre-bundle in `node_modules/.vite/deps/`. Clear it and restart:
|
|
480
|
+
```bash
|
|
481
|
+
rm -rf node_modules/.vite
|
|
482
|
+
npm run dev
|
|
483
|
+
```
|
|
484
|
+
- Or add to `vite.config.js`:
|
|
485
|
+
```js
|
|
486
|
+
export default defineConfig({
|
|
487
|
+
optimizeDeps: {
|
|
488
|
+
exclude: ['@waaelg/dga-design-system'],
|
|
489
|
+
},
|
|
490
|
+
})
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## Skills for AI coding tools
|
|
496
|
+
|
|
497
|
+
This repo has three parts: the **package** (`src/`, compiled to `dist/`), the **docs site** (`docs/`, VitePress), and **`skills/`** — Claude Skills that teach an AI coding assistant the actual class names, component patterns, and JS API documented above, grounded in `docs/` rather than guessed.
|
|
498
|
+
|
|
499
|
+
| Skill | Covers |
|
|
500
|
+
|-------|--------|
|
|
501
|
+
| [`dga-vue-component`](skills/dga-vue-component/SKILL.md) | Generating Vue 3 SFCs styled with DGA |
|
|
502
|
+
| [`dga-web-components`](skills/dga-web-components/SKILL.md) | `<dga-*>` elements and the JS class API outside Vue (plain HTML, Razor, PHP) |
|
|
503
|
+
| [`dga-foundations`](skills/dga-foundations/SKILL.md) | Color/spacing/typography/radius/grid utility reference |
|
|
504
|
+
|
|
505
|
+
If you clone this repo with **Claude Code**, these are picked up automatically via the `.claude/skills` symlink — no setup needed. Any other AI tool can be pointed directly at the `skills/<name>/SKILL.md` files.
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## License
|
|
510
|
+
|
|
511
|
+
MIT — Wael Alghamdi
|