@waaelg/dga-design-system 0.4.2
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 +480 -0
- package/docs/README.md +76 -0
- package/docs/changelog.md +54 -0
- package/docs/components/accordion.md +114 -0
- package/docs/components/alert.md +130 -0
- package/docs/components/avatar.md +74 -0
- package/docs/components/breadcrumb.md +56 -0
- package/docs/components/button.md +163 -0
- package/docs/components/card.md +78 -0
- package/docs/components/chart.md +97 -0
- package/docs/components/code-snippet.md +110 -0
- package/docs/components/divider.md +54 -0
- package/docs/components/forms.md +123 -0
- package/docs/components/link.md +52 -0
- package/docs/components/navbar.md +93 -0
- package/docs/components/table.md +69 -0
- package/docs/components/tag.md +76 -0
- package/docs/components/verify-bar.md +79 -0
- package/docs/foundations/colors-cheatsheet.md +593 -0
- package/docs/foundations/colors-swatches.md +441 -0
- package/docs/foundations/colors.md +1284 -0
- package/docs/foundations/grid.md +1406 -0
- package/docs/foundations/radius.md +1166 -0
- package/docs/foundations/spacing.md +134 -0
- package/docs/foundations/typography.md +111 -0
- package/docs/foundations/width-height.md +305 -0
- package/docs/getting-started/installation.md +158 -0
- package/docs/getting-started/javascript-api.md +204 -0
- package/docs/getting-started/rtl-arabic.md +89 -0
- package/docs/getting-started/web-components.md +134 -0
- package/package.json +41 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Spacing
|
|
2
|
+
|
|
3
|
+
Padding, margin, and gap utilities. Base unit: **4px** (`1` = 4px).
|
|
4
|
+
|
|
5
|
+
**Source:**
|
|
6
|
+
- `src/styles/utilities/padding.scss`
|
|
7
|
+
- `src/styles/utilities/margin.scss`
|
|
8
|
+
- Grid gap utilities in `src/styles/utilities/grid.scss`
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Numeric scale
|
|
13
|
+
|
|
14
|
+
| Class key | Value |
|
|
15
|
+
|-----------|-------|
|
|
16
|
+
| `0` | 0 |
|
|
17
|
+
| `1` | 4px |
|
|
18
|
+
| `2` | 8px |
|
|
19
|
+
| `3` | 12px |
|
|
20
|
+
| `4` | 16px |
|
|
21
|
+
| `6` | 24px |
|
|
22
|
+
| `8` | 32px |
|
|
23
|
+
| `12` | 48px |
|
|
24
|
+
| `16` | 64px |
|
|
25
|
+
| `24` | 96px |
|
|
26
|
+
|
|
27
|
+
Full scale: `0`, `px`, `0_5`, `1` … `480` (see `src/styles/variables/spacing.scss`).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Padding
|
|
32
|
+
|
|
33
|
+
| Pattern | Example | CSS |
|
|
34
|
+
|---------|---------|-----|
|
|
35
|
+
| All sides | `dga-p-4` | `padding: 16px` |
|
|
36
|
+
| Top | `dga-pt-4` | `padding-top` |
|
|
37
|
+
| Bottom | `dga-pb-4` | `padding-bottom` |
|
|
38
|
+
| Left | `dga-pl-4` | `padding-left` |
|
|
39
|
+
| Right | `dga-pr-4` | `padding-right` |
|
|
40
|
+
| Horizontal | `dga-px-4` | left + right |
|
|
41
|
+
| Vertical | `dga-py-4` | top + bottom |
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<div class="dga-p-4 dga-px-6">Padded box</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Margin
|
|
50
|
+
|
|
51
|
+
Same pattern with `m` prefix:
|
|
52
|
+
|
|
53
|
+
| Pattern | Example |
|
|
54
|
+
|---------|---------|
|
|
55
|
+
| All sides | `dga-m-4` |
|
|
56
|
+
| Top | `dga-mt-4` |
|
|
57
|
+
| Bottom | `dga-mb-4` |
|
|
58
|
+
| Horizontal | `dga-mx-4` |
|
|
59
|
+
| Vertical | `dga-my-4` |
|
|
60
|
+
| Auto center | `dga-mx-auto` |
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<section class="dga-my-8 dga-mb-4">Section</section>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Named spacing
|
|
69
|
+
|
|
70
|
+
Semantic names from the DGA scale:
|
|
71
|
+
|
|
72
|
+
| Name | Size |
|
|
73
|
+
|------|------|
|
|
74
|
+
| `xxs` | 2px |
|
|
75
|
+
| `xs` | 4px |
|
|
76
|
+
| `sm` | 6px |
|
|
77
|
+
| `md` | 8px |
|
|
78
|
+
| `lg` | 12px |
|
|
79
|
+
| `xl` | 16px |
|
|
80
|
+
| `2xl` | 20px |
|
|
81
|
+
| `3xl` | 24px |
|
|
82
|
+
| `4xl` | 32px |
|
|
83
|
+
| … | up to `11xl` (160px) |
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<div class="dga-p-lg dga-mb-xl">Named spacing</div>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Gap (flex & grid)
|
|
92
|
+
|
|
93
|
+
Prefer gap over margin for spacing between flex children:
|
|
94
|
+
|
|
95
|
+
| Class | Description |
|
|
96
|
+
|-------|-------------|
|
|
97
|
+
| `dga-gap-4` | 16px all directions |
|
|
98
|
+
| `dga-gap-x-4` | Horizontal gap |
|
|
99
|
+
| `dga-gap-y-4` | Vertical gap |
|
|
100
|
+
| `dga-gap-md` | Named gap (8px) |
|
|
101
|
+
| `dga-gap-lg` | Named gap (12px) |
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div class="dga-d-flex dga-flex-col dga-gap-3">
|
|
105
|
+
<button class="dga-btn dga-btn-primary">زر 1</button>
|
|
106
|
+
<button class="dga-btn dga-btn-neutral">زر 2</button>
|
|
107
|
+
</div>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
See [Grid — Spacing & Gaps](./grid.md#spacing--gaps).
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Examples
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<!-- Card padding -->
|
|
118
|
+
<div class="dga-card dga-p-4">
|
|
119
|
+
<h3 class="dga-mb-2">Title</h3>
|
|
120
|
+
<p class="dga-mb-0">Content</p>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<!-- Section spacing -->
|
|
124
|
+
<div class="dga-container dga-py-8">
|
|
125
|
+
<div class="dga-row dga-gap-4">...</div>
|
|
126
|
+
</div>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Related
|
|
132
|
+
|
|
133
|
+
- [Grid](./grid.md)
|
|
134
|
+
- [Width & Height](./width-height.md)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Typography
|
|
2
|
+
|
|
3
|
+
Font utilities for the DGA design system. Default font: **IBM Plex Sans Arabic**.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/utilities/typography.scss`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Display sizes
|
|
10
|
+
|
|
11
|
+
For headings and hero text. Responsive sizes apply below 768px and 375px.
|
|
12
|
+
|
|
13
|
+
| Class | Desktop size | Line height |
|
|
14
|
+
|-------|--------------|-------------|
|
|
15
|
+
| `dga-display-2xl` | 72px | 90px |
|
|
16
|
+
| `dga-display-xl` | 60px | 72px |
|
|
17
|
+
| `dga-display-lg` | 48px | 60px |
|
|
18
|
+
| `dga-display-md` | 36px | 44px |
|
|
19
|
+
| `dga-display-sm` | 30px | 38px |
|
|
20
|
+
| `dga-display-xs` | 24px | 32px |
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<h1 class="dga-display-md dga-fw-bold">عنوان الصفحة</h1>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Text sizes
|
|
29
|
+
|
|
30
|
+
| Class | Size | Line height |
|
|
31
|
+
|-------|------|-------------|
|
|
32
|
+
| `dga-text-xl` | 20px | 30px |
|
|
33
|
+
| `dga-text-lg` | 18px | 28px |
|
|
34
|
+
| `dga-text-md` | 16px | 24px |
|
|
35
|
+
| `dga-text-sm` | 14px | 20px |
|
|
36
|
+
| `dga-text-xs` | 12px | 18px |
|
|
37
|
+
| `dga-text-2xs` | 10px | 14px |
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<p class="dga-text-md">نص أساسي</p>
|
|
41
|
+
<p class="dga-text-sm dga-text-gray-600">نص ثانوي</p>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Font weight
|
|
47
|
+
|
|
48
|
+
| Class | Weight |
|
|
49
|
+
|-------|--------|
|
|
50
|
+
| `dga-fw-regular` | 400 |
|
|
51
|
+
| `dga-fw-medium` | 500 |
|
|
52
|
+
| `dga-fw-semibold` | 600 |
|
|
53
|
+
| `dga-fw-bold` | 700 |
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<h2 class="dga-text-xl dga-fw-bold">عنوان فرعي</h2>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Text alignment
|
|
62
|
+
|
|
63
|
+
| Class | Effect |
|
|
64
|
+
|-------|--------|
|
|
65
|
+
| `dga-text-start` | Logical start (right in RTL) |
|
|
66
|
+
| `dga-text-end` | Logical end (left in RTL) |
|
|
67
|
+
| `dga-text-center` | Center |
|
|
68
|
+
| `dga-text-left` | Physical left |
|
|
69
|
+
| `dga-text-right` | Physical right |
|
|
70
|
+
|
|
71
|
+
**Responsive:** `dga-text-md-center`, `dga-text-sm-start`, etc.
|
|
72
|
+
|
|
73
|
+
Prefer `start` / `end` for RTL. See [RTL & Arabic](../getting-started/rtl-arabic.md).
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Text colors
|
|
78
|
+
|
|
79
|
+
Combine with color utilities:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<p class="dga-text-primary-500">نص بلون العلامة</p>
|
|
83
|
+
<p class="dga-text-gray-700">نص محايد</p>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
See [Colors](./colors.md).
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Common patterns
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<!-- Page title -->
|
|
94
|
+
<h1 class="dga-display-md dga-fw-bold dga-text-gray-950">لوحة التحكم</h1>
|
|
95
|
+
|
|
96
|
+
<!-- Section heading -->
|
|
97
|
+
<h2 class="dga-text-xl dga-fw-semibold">الإعدادات</h2>
|
|
98
|
+
|
|
99
|
+
<!-- Body -->
|
|
100
|
+
<p class="dga-text-md dga-text-gray-700">وصف القسم هنا.</p>
|
|
101
|
+
|
|
102
|
+
<!-- Caption -->
|
|
103
|
+
<span class="dga-text-xs dga-text-gray-500">آخر تحديث: اليوم</span>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Related
|
|
109
|
+
|
|
110
|
+
- [Colors](./colors.md)
|
|
111
|
+
- [RTL & Arabic](../getting-started/rtl-arabic.md)
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Width & Height
|
|
2
|
+
|
|
3
|
+
Fixed, percentage, and viewport sizing utilities (`dga-w-*`, `dga-h-*`).
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/utilities/width.scss`, `src/styles/utilities/height.scss`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick start (npm)
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import '@waaelg/dga-design-on-sass/style.css'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<div class="dga-w-full dga-h-screen dga-d-flex dga-flex-column">
|
|
17
|
+
<header class="dga-h-16">Header</header>
|
|
18
|
+
<main class="dga-flex-1 dga-min-h-0">Content</main>
|
|
19
|
+
</div>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Common classes: `dga-w-full`, `dga-w-50`, `dga-h-full`, `dga-h-screen`, `dga-min-h-screen`, `dga-max-w-lg`.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Table of Contents
|
|
27
|
+
|
|
28
|
+
1. [Overview](#overview)
|
|
29
|
+
2. [Quick Reference](#quick-reference)
|
|
30
|
+
3. [Width Utilities](#width-utilities)
|
|
31
|
+
4. [Height Utilities](#height-utilities)
|
|
32
|
+
5. [Named Sizes](#named-sizes)
|
|
33
|
+
6. [Spacing Scale](#spacing-scale)
|
|
34
|
+
7. [Percentage & Fractions](#percentage--fractions)
|
|
35
|
+
8. [Max & Min Variants](#max--min-variants)
|
|
36
|
+
9. [Examples](#examples)
|
|
37
|
+
10. [SCSS Source (Contributors)](#scss-source-contributors)
|
|
38
|
+
11. [Troubleshooting](#troubleshooting)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Overview
|
|
43
|
+
|
|
44
|
+
Width and height utilities follow the same naming pattern:
|
|
45
|
+
|
|
46
|
+
| Pattern | Width | Height |
|
|
47
|
+
|---------|-------|--------|
|
|
48
|
+
| Fixed / named | `dga-w-{size}` | `dga-h-{size}` |
|
|
49
|
+
| Max | `dga-max-w-{size}` | `dga-max-h-{size}` |
|
|
50
|
+
| Min | `dga-min-w-{size}` | `dga-min-h-{size}` |
|
|
51
|
+
|
|
52
|
+
**Source files:**
|
|
53
|
+
|
|
54
|
+
- `src/styles/utilities/width.scss`
|
|
55
|
+
- `src/styles/utilities/height.scss`
|
|
56
|
+
- `src/styles/variables/spacing.scss` — shared size tokens (`$dga-widths`, `$dga-heights`)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Quick Reference
|
|
61
|
+
|
|
62
|
+
| Goal | Class |
|
|
63
|
+
|------|-------|
|
|
64
|
+
| Full width of parent | `dga-w-full` or `dga-w-100` |
|
|
65
|
+
| Full height of parent | `dga-h-full` or `dga-h-100` |
|
|
66
|
+
| Full viewport width | `dga-w-screen` |
|
|
67
|
+
| Full viewport height | `dga-h-screen` or `dga-min-h-screen` |
|
|
68
|
+
| Half width / height | `dga-w-1-2` / `dga-h-1-2` |
|
|
69
|
+
| Auto size | `dga-w-auto` / `dga-h-auto` |
|
|
70
|
+
| 16px height (spacing scale) | `dga-h-4` |
|
|
71
|
+
| 640px height (named `lg`) | `dga-h-lg` |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Width Utilities
|
|
76
|
+
|
|
77
|
+
### Utility values
|
|
78
|
+
|
|
79
|
+
| Class | CSS |
|
|
80
|
+
|-------|-----|
|
|
81
|
+
| `dga-w-auto` | `width: auto` |
|
|
82
|
+
| `dga-w-full` | `width: 100%` |
|
|
83
|
+
| `dga-w-screen` | `width: 100vw` |
|
|
84
|
+
| `dga-w-min` | `width: min-content` |
|
|
85
|
+
| `dga-w-max` | `width: max-content` |
|
|
86
|
+
| `dga-w-fit` | `width: fit-content` |
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<div class="dga-w-full">Spans parent width</div>
|
|
90
|
+
<div class="dga-w-screen">Spans viewport width</div>
|
|
91
|
+
<div class="dga-w-fit">Shrinks to content</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Height Utilities
|
|
97
|
+
|
|
98
|
+
### Utility values
|
|
99
|
+
|
|
100
|
+
| Class | CSS |
|
|
101
|
+
|-------|-----|
|
|
102
|
+
| `dga-h-auto` | `height: auto` |
|
|
103
|
+
| `dga-h-full` | `height: 100%` |
|
|
104
|
+
| `dga-h-screen` | `height: 100vh` |
|
|
105
|
+
| `dga-h-min` | `height: min-content` |
|
|
106
|
+
| `dga-h-max` | `height: max-content` |
|
|
107
|
+
| `dga-h-fit` | `height: fit-content` |
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<!-- Fill parent height (parent must have a defined height) -->
|
|
111
|
+
<div class="dga-h-full">Full height</div>
|
|
112
|
+
|
|
113
|
+
<!-- Full viewport height -->
|
|
114
|
+
<section class="dga-min-h-screen">Hero section</section>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
> **Note:** `dga-w-screen` uses `100vw` while `dga-h-screen` uses `100vh`.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Named Sizes
|
|
122
|
+
|
|
123
|
+
Both width and height share the same named breakpoint scale:
|
|
124
|
+
|
|
125
|
+
| Class suffix | Size |
|
|
126
|
+
|--------------|------|
|
|
127
|
+
| `xxs` | 320px |
|
|
128
|
+
| `xs` | 384px |
|
|
129
|
+
| `sm` | 480px |
|
|
130
|
+
| `md` | 560px |
|
|
131
|
+
| `lg` | 640px |
|
|
132
|
+
| `xl` | 768px |
|
|
133
|
+
| `2xl` | 1024px |
|
|
134
|
+
| `3xl` | 1280px |
|
|
135
|
+
| `4xl` | 1440px |
|
|
136
|
+
| `5xl` | 1600px |
|
|
137
|
+
| `6xl` | 1920px |
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<div class="dga-w-md dga-h-lg">560px wide, 640px tall</div>
|
|
141
|
+
<img class="dga-w-sm dga-h-sm" src="thumb.jpg" alt="">
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Spacing Scale
|
|
147
|
+
|
|
148
|
+
Use numeric keys from the 4px spacing scale (`1` = 4px, `4` = 16px, `8` = 32px, etc.):
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<div class="dga-w-16">64px wide</div>
|
|
152
|
+
<div class="dga-h-10">40px tall</div>
|
|
153
|
+
<div class="dga-w-96">384px wide</div>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Common spacing keys: `0`, `px`, `0_5`, `1`, `2`, `3`, `4`, `5`, `6`, `8`, `10`, `12`, `16`, `20`, `24`, `32`, `48`, `64`, `96`, `120`, … `480`.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Percentage & Fractions
|
|
161
|
+
|
|
162
|
+
| Class | Value |
|
|
163
|
+
|-------|-------|
|
|
164
|
+
| `dga-w-0` / `dga-h-0` | 0% |
|
|
165
|
+
| `dga-w-25` / `dga-h-25` | 25% |
|
|
166
|
+
| `dga-w-50` / `dga-h-50` | 50% |
|
|
167
|
+
| `dga-w-75` / `dga-h-75` | 75% |
|
|
168
|
+
| `dga-w-100` / `dga-h-100` | 100% |
|
|
169
|
+
| `dga-w-1-2` / `dga-h-1-2` | 50% |
|
|
170
|
+
| `dga-w-1-3` / `dga-h-1-3` | 33.333% |
|
|
171
|
+
| `dga-w-2-3` / `dga-h-2-3` | 66.667% |
|
|
172
|
+
| `dga-w-1-4` / `dga-h-1-4` | 25% |
|
|
173
|
+
| `dga-w-3-4` / `dga-h-3-4` | 75% |
|
|
174
|
+
| `dga-w-1-12` … `dga-w-12-12` | 12-column fractions |
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<div class="dga-row">
|
|
178
|
+
<div class="dga-h-1-2 dga-w-1-2">Half width and height</div>
|
|
179
|
+
</div>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Max & Min Variants
|
|
185
|
+
|
|
186
|
+
Same value sets apply to `max-*` and `min-*` prefixes:
|
|
187
|
+
|
|
188
|
+
```html
|
|
189
|
+
<!-- Cap width, allow content to shrink -->
|
|
190
|
+
<div class="dga-max-w-3xl dga-w-full">Responsive capped content</div>
|
|
191
|
+
|
|
192
|
+
<!-- At least viewport tall -->
|
|
193
|
+
<main class="dga-min-h-screen">Page body</main>
|
|
194
|
+
|
|
195
|
+
<!-- Fixed max height with scroll -->
|
|
196
|
+
<div class="dga-max-h-lg dga-overflow-auto">Scrollable panel</div>
|
|
197
|
+
|
|
198
|
+
<!-- Prevent shrinking below content -->
|
|
199
|
+
<div class="dga-min-w-min">Won't clip text</div>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Examples
|
|
205
|
+
|
|
206
|
+
### Full-height page layout
|
|
207
|
+
|
|
208
|
+
```html
|
|
209
|
+
<body class="dga-d-flex dga-flex-col dga-min-h-screen">
|
|
210
|
+
<header>Header</header>
|
|
211
|
+
<main class="dga-flex-grow-1">Content</main>
|
|
212
|
+
<footer>Footer</footer>
|
|
213
|
+
</body>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Centered hero (no inline height)
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<section class="dga-d-flex dga-align-items-center dga-justify-content-center dga-min-h-screen">
|
|
220
|
+
<div class="dga-container">
|
|
221
|
+
<h1>Welcome</h1>
|
|
222
|
+
<p>Your tagline here</p>
|
|
223
|
+
</div>
|
|
224
|
+
</section>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Card with fixed image area
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<div class="dga-card">
|
|
231
|
+
<div class="dga-w-full dga-h-48 dga-bg-gray-100"></div>
|
|
232
|
+
<div class="dga-p-4">
|
|
233
|
+
<h3>Card title</h3>
|
|
234
|
+
<p>Card body</p>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Sidebar + content
|
|
240
|
+
|
|
241
|
+
```html
|
|
242
|
+
<div class="dga-d-flex dga-min-h-screen">
|
|
243
|
+
<aside class="dga-w-64 dga-h-full">Sidebar</aside>
|
|
244
|
+
<main class="dga-flex-grow-1 dga-w-full">Main</main>
|
|
245
|
+
</div>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## SCSS Source (Contributors)
|
|
251
|
+
|
|
252
|
+
```scss
|
|
253
|
+
@import 'utilities/width';
|
|
254
|
+
@import 'utilities/height';
|
|
255
|
+
|
|
256
|
+
@include generate-all-width-utilities();
|
|
257
|
+
@include generate-all-height-utilities();
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Height tokens reuse the width scale with one override:
|
|
261
|
+
|
|
262
|
+
```scss
|
|
263
|
+
$dga-heights: map.merge(
|
|
264
|
+
$dga-widths,
|
|
265
|
+
(
|
|
266
|
+
"screen": 100vh,
|
|
267
|
+
)
|
|
268
|
+
);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Troubleshooting
|
|
274
|
+
|
|
275
|
+
### `dga-h-full` has no effect
|
|
276
|
+
|
|
277
|
+
**Cause:** Parent has no explicit height.
|
|
278
|
+
|
|
279
|
+
**Fix:** Set height on the parent chain, or use `dga-min-h-screen` / `dga-h-screen` on a top-level wrapper.
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
<!-- Parent needs height -->
|
|
283
|
+
<div class="dga-min-h-screen">
|
|
284
|
+
<div class="dga-h-full">Now fills parent</div>
|
|
285
|
+
</div>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### `dga-h-screen` causes scrollbars
|
|
289
|
+
|
|
290
|
+
**Cause:** `100vh` includes space under mobile browser chrome, or padding/margin adds overflow.
|
|
291
|
+
|
|
292
|
+
**Fix:** Use `dga-min-h-screen` instead of `dga-h-screen`, or combine with flex layout.
|
|
293
|
+
|
|
294
|
+
### Width works but height utility missing
|
|
295
|
+
|
|
296
|
+
**Cause:** Older published package before height utilities were added.
|
|
297
|
+
|
|
298
|
+
**Fix:** Update `@waaelg/dga-design-on-sass` to the latest version and rebuild.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Related Documentation
|
|
303
|
+
|
|
304
|
+
- [Grid & Flex](./grid.md) — layout, flexbox, containers
|
|
305
|
+
- [README](../README.md) — npm install and usage
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
## npm
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @waaelg/dga-design-on-sass
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Package exports
|
|
10
|
+
|
|
11
|
+
| Import | Purpose |
|
|
12
|
+
|--------|---------|
|
|
13
|
+
| `@waaelg/dga-design-on-sass/style.css` | All compiled styles |
|
|
14
|
+
| `@waaelg/dga-design-on-sass` | JavaScript classes + `<dga-*>` web components |
|
|
15
|
+
|
|
16
|
+
Importing the main entry registers web components automatically. See [Web Components](./web-components.md).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Plain HTML & server-rendered pages
|
|
21
|
+
|
|
22
|
+
Works with static HTML, **ASP.NET Core `.cshtml`**, PHP, etc. Load CSS + JS once, then use `<dga-*>` tags in markup.
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<!DOCTYPE html>
|
|
26
|
+
<html lang="ar" dir="rtl">
|
|
27
|
+
<head>
|
|
28
|
+
<link rel="stylesheet" href="./node_modules/@waaelg/dga-design-on-sass/dist/style.css" />
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<dga-alert variant="success-color" title="نجاح" dismissible>
|
|
32
|
+
تمت العملية بنجاح
|
|
33
|
+
</dga-alert>
|
|
34
|
+
|
|
35
|
+
<script type="module">
|
|
36
|
+
import './node_modules/@waaelg/dga-design-on-sass/dist/index.js'
|
|
37
|
+
</script>
|
|
38
|
+
</body>
|
|
39
|
+
</html>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See [Web Components](./web-components.md) for ASP.NET layout setup and more examples.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ASP.NET Core (Razor)
|
|
47
|
+
|
|
48
|
+
In `_Layout.cshtml`, reference the built files from `wwwroot`:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<link rel="stylesheet" href="~/lib/dga/style.css" />
|
|
52
|
+
<script type="module" src="~/lib/dga/index.js"></script>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
In any view:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<dga-verify-bar domain=".gov.sa"></dga-verify-bar>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Vite / Vue
|
|
64
|
+
|
|
65
|
+
**`main.js`** — import CSS and register web components:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import { createApp } from 'vue'
|
|
69
|
+
import '@waaelg/dga-design-on-sass/style.css'
|
|
70
|
+
import '@waaelg/dga-design-on-sass'
|
|
71
|
+
import App from './App.vue'
|
|
72
|
+
|
|
73
|
+
createApp(App).mount('#app')
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**`App.vue`** — use `<dga-alert>` etc. (no `new DGAAlert()` needed):
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<template>
|
|
80
|
+
<dga-alert variant="success-color" title="نجاح" dismissible>
|
|
81
|
+
تمت العملية بنجاح
|
|
82
|
+
</dga-alert>
|
|
83
|
+
</template>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**`vite.config.js`** — avoid stale dependency cache:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
export default defineConfig({
|
|
90
|
+
optimizeDeps: {
|
|
91
|
+
exclude: ['@waaelg/dga-design-on-sass'],
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## React
|
|
99
|
+
|
|
100
|
+
```jsx
|
|
101
|
+
// main.jsx
|
|
102
|
+
import '@waaelg/dga-design-on-sass/style.css'
|
|
103
|
+
import '@waaelg/dga-design-on-sass'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```jsx
|
|
107
|
+
export function App() {
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
<dga-alert variant="success-color" title="Success" dismissible>
|
|
111
|
+
Operation completed.
|
|
112
|
+
</dga-alert>
|
|
113
|
+
<button className="dga-btn dga-btn-primary">زر</button>
|
|
114
|
+
</>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For legacy HTML markup, use `useEffect` with `new DGAAlert()` instead. See [Web Components](./web-components.md).
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Next.js
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
// app/layout.tsx
|
|
127
|
+
import '@waaelg/dga-design-on-sass/style.css'
|
|
128
|
+
|
|
129
|
+
export default function RootLayout({ children }) {
|
|
130
|
+
return (
|
|
131
|
+
<html lang="ar" dir="rtl">
|
|
132
|
+
<body>{children}</body>
|
|
133
|
+
</html>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## What gets published
|
|
141
|
+
|
|
142
|
+
Only `dist/` is on npm:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
dist/index.js → JS components
|
|
146
|
+
dist/style.css → compiled CSS
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
SCSS source is not included. Clone the [GitHub repo](https://github.com/waaelg/personal_fe_dga-sass) to customize variables.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Related
|
|
154
|
+
|
|
155
|
+
- [Web Components](./web-components.md)
|
|
156
|
+
- [JavaScript API](./javascript-api.md)
|
|
157
|
+
- [RTL & Arabic](./rtl-arabic.md)
|
|
158
|
+
- [Components index](../README.md#components)
|