@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,114 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
Expandable sections for FAQs and grouped content.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/accordion.scss`, `src/scripts/accordion.js`, `src/scripts/dga-accordion.js`
|
|
6
|
+
**Demo:** `index.html`
|
|
7
|
+
**JavaScript:** Optional — web component or `DGAAccordion` class
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Option 1: Web component (recommended)
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<dga-accordion>
|
|
15
|
+
<dga-accordion-item title="What is an accordion?">
|
|
16
|
+
An accordion lets users expand and collapse sections of content.
|
|
17
|
+
</dga-accordion-item>
|
|
18
|
+
<dga-accordion-item title="How do I use it?" size="lg" open>
|
|
19
|
+
Import the package once — no manual JS init required.
|
|
20
|
+
</dga-accordion-item>
|
|
21
|
+
</dga-accordion>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### `dga-accordion-item` attributes
|
|
25
|
+
|
|
26
|
+
| Attribute | Default | Description |
|
|
27
|
+
|-----------|---------|-------------|
|
|
28
|
+
| `title` | — | Header label |
|
|
29
|
+
| `size` | `md` | `sm`, `md`, or `lg` |
|
|
30
|
+
| `open` | — | Present = expanded on load |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Option 2: Legacy markup + DGAAccordion
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="dga-acc" id="myAccordion">
|
|
38
|
+
<div class="dga-acc-item">
|
|
39
|
+
<button class="dga-acc-header" aria-expanded="false">
|
|
40
|
+
<span>What is an accordion?</span>
|
|
41
|
+
</button>
|
|
42
|
+
<div class="dga-acc-content">
|
|
43
|
+
<div class="dga-acc-body">
|
|
44
|
+
An accordion lets users expand and collapse sections of content.
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
import { DGAAccordion } from '@waaelg/dga-design-on-sass'
|
|
53
|
+
new DGAAccordion(document.getElementById('myAccordion'))
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## HTML structure (legacy)
|
|
59
|
+
|
|
60
|
+
| Element | Class |
|
|
61
|
+
|---------|-------|
|
|
62
|
+
| Root | `dga-acc` |
|
|
63
|
+
| Item | `dga-acc-item` |
|
|
64
|
+
| Header (button) | `dga-acc-header` |
|
|
65
|
+
| Content wrapper | `dga-acc-content` |
|
|
66
|
+
| Body | `dga-acc-body` |
|
|
67
|
+
|
|
68
|
+
Open state: `dga-acc-item--active` on the item (added by JS).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Header sizes
|
|
73
|
+
|
|
74
|
+
| Attribute | Height |
|
|
75
|
+
|-----------|--------|
|
|
76
|
+
| `data-size="sm"` | 40px |
|
|
77
|
+
| `data-size="md"` | 48px (default) |
|
|
78
|
+
| `data-size="lg"` | 56px |
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<button class="dga-acc-header" data-size="lg" aria-expanded="false">Large header</button>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Web component: `size="lg"` on `<dga-accordion-item>`.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Behavior
|
|
89
|
+
|
|
90
|
+
- Click header to toggle
|
|
91
|
+
- Keyboard: Enter / Space on focused header
|
|
92
|
+
- Sets `aria-expanded` on the header
|
|
93
|
+
- Multiple panels can be open at once
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## RTL
|
|
98
|
+
|
|
99
|
+
Chevron icon flips automatically in RTL. Optional: `dir="rtl"` on header.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Accessibility
|
|
104
|
+
|
|
105
|
+
- Use `<button>` for headers, not `<div>`
|
|
106
|
+
- Set `aria-expanded="true"` / `"false"`
|
|
107
|
+
- Web component handles this automatically
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Related
|
|
112
|
+
|
|
113
|
+
- [Web Components](../getting-started/web-components.md)
|
|
114
|
+
- [JavaScript API](../getting-started/javascript-api.md)
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
Feedback messages for success, warning, error, info, and neutral states.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/alert.scss`, `src/scripts/alert.js`, `src/scripts/dga-alert.js`
|
|
6
|
+
**Demo:** `alerts.html`
|
|
7
|
+
**JavaScript:** Optional — web component or `DGAAlert` class
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Option 1: Web component (recommended)
|
|
12
|
+
|
|
13
|
+
Import the package once — registers `<dga-alert>` automatically:
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<dga-alert variant="success-color" title="Success" dismissible>
|
|
17
|
+
When successful actions need direct feedback, show it here.
|
|
18
|
+
</dga-alert>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Attributes
|
|
22
|
+
|
|
23
|
+
| Attribute | Default | Description |
|
|
24
|
+
|-----------|---------|-------------|
|
|
25
|
+
| `variant` | `info-color` | Alert theme (see variants below) |
|
|
26
|
+
| `title` | — | Optional heading |
|
|
27
|
+
| `dismissible` | — | Present = show close button |
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<dga-alert variant="info-white">
|
|
31
|
+
Informational message without dismiss.
|
|
32
|
+
</dga-alert>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Dismiss fires `dga-alert-dismiss` on the element. No `new DGAAlert()` required.
|
|
36
|
+
|
|
37
|
+
Works in plain HTML, ASP.NET `.cshtml`, and SPA frameworks — see [Web Components](../getting-started/web-components.md).
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Option 2: Legacy markup + DGAAlert
|
|
42
|
+
|
|
43
|
+
Alerts are **HTML + CSS**. Initialize `DGAAlert` once to handle close buttons.
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<div class="dga-alert" data-variant="success-color">
|
|
47
|
+
<span class="dga-alert-icon" aria-hidden="true"></span>
|
|
48
|
+
<div class="dga-alert-content">
|
|
49
|
+
<h4 class="dga-alert-title">نجاح</h4>
|
|
50
|
+
<div class="dga-alert-body">تمت العملية بنجاح!</div>
|
|
51
|
+
</div>
|
|
52
|
+
<button class="dga-alert-close" type="button" data-alert-close aria-label="إغلاق">×</button>
|
|
53
|
+
</div>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import { DGAAlert } from '@waaelg/dga-design-on-sass'
|
|
58
|
+
new DGAAlert()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## HTML structure (legacy)
|
|
64
|
+
|
|
65
|
+
| Element | Class | Required |
|
|
66
|
+
|---------|-------|----------|
|
|
67
|
+
| Root | `dga-alert` | Yes |
|
|
68
|
+
| Icon | `dga-alert-icon` | Recommended |
|
|
69
|
+
| Content wrapper | `dga-alert-content` | Yes |
|
|
70
|
+
| Title | `dga-alert-title` | Optional |
|
|
71
|
+
| Body | `dga-alert-body` | Yes |
|
|
72
|
+
| Close button | `dga-alert-close` + `data-alert-close` | Optional |
|
|
73
|
+
|
|
74
|
+
Set variant on the root: `data-variant="success-color"` (legacy) or `variant="success-color"` (web component).
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Variants
|
|
79
|
+
|
|
80
|
+
Two themes: **color** (filled accent) and **white** (light background).
|
|
81
|
+
|
|
82
|
+
| Value | Status |
|
|
83
|
+
|-------|--------|
|
|
84
|
+
| `success-color` | Success (color theme) |
|
|
85
|
+
| `success-white` | Success (white theme) |
|
|
86
|
+
| `warning-color` | Warning (color) |
|
|
87
|
+
| `warning-white` | Warning (white) |
|
|
88
|
+
| `destructive-color` | Error / destructive (color) |
|
|
89
|
+
| `destructive-white` | Error / destructive (white) |
|
|
90
|
+
| `info-color` | Info (color) |
|
|
91
|
+
| `info-white` | Info (white) |
|
|
92
|
+
| `neutral-color` | Neutral (color) |
|
|
93
|
+
| `neutral-white` | Neutral (white) |
|
|
94
|
+
|
|
95
|
+
Use **color** variants on light pages; **white** variants on dense or colored backgrounds.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## JavaScript (legacy)
|
|
100
|
+
|
|
101
|
+
### Vanilla
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
import '@waaelg/dga-design-on-sass/style.css'
|
|
105
|
+
import { DGAAlert } from '@waaelg/dga-design-on-sass'
|
|
106
|
+
|
|
107
|
+
const alert = new DGAAlert()
|
|
108
|
+
// alert.destroy() when removing listener
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Listens for clicks on `[data-alert-close]` and hides the parent `.dga-alert`.
|
|
112
|
+
|
|
113
|
+
For new projects, prefer `<dga-alert>` instead — see [Web Components](../getting-started/web-components.md).
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Accessibility
|
|
118
|
+
|
|
119
|
+
- Close button: `aria-label` (e.g. "Dismiss alert" / "إغلاق")
|
|
120
|
+
- Icon: `aria-hidden="true"` (decorative)
|
|
121
|
+
- Use clear title + body text
|
|
122
|
+
- Do not rely on color alone — title conveys status
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Related
|
|
127
|
+
|
|
128
|
+
- [Web Components](../getting-started/web-components.md)
|
|
129
|
+
- [JavaScript API](../getting-started/javascript-api.md)
|
|
130
|
+
- [Colors](../foundations/colors.md)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
User profile images in circular or square shapes.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/avatar.scss`
|
|
6
|
+
**Demo:** _not in index.html yet_
|
|
7
|
+
**JavaScript required:** No
|
|
8
|
+
|
|
9
|
+
> **Note:** Avatar is included in the build as of the next release. Rebuild with `npm run build` after pulling latest source.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## HTML
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<div class="dga-avatar" data-size="md">
|
|
17
|
+
<img src="user.jpg" alt="User name" />
|
|
18
|
+
</div>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Sizes
|
|
24
|
+
|
|
25
|
+
| `data-size` | Dimensions |
|
|
26
|
+
|-------------|------------|
|
|
27
|
+
| `xs` | 24px |
|
|
28
|
+
| `sm` | 32px |
|
|
29
|
+
| `md` | 40px |
|
|
30
|
+
| `lg` | 48px |
|
|
31
|
+
| `xl` | 64px |
|
|
32
|
+
| `2xl` | 80px |
|
|
33
|
+
| `3xl` | 120px |
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<div class="dga-avatar" data-size="lg">
|
|
37
|
+
<img src="avatar.png" alt="" />
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Shape
|
|
44
|
+
|
|
45
|
+
| Attribute | Shape |
|
|
46
|
+
|-----------|-------|
|
|
47
|
+
| (default) / `data-square="false"` | Circle |
|
|
48
|
+
| `data-square="true"` | Rounded square (4px radius) |
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<div class="dga-avatar" data-size="md" data-square="true">
|
|
52
|
+
<img src="logo.png" alt="Organization" />
|
|
53
|
+
</div>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Styling
|
|
59
|
+
|
|
60
|
+
- White 2px border
|
|
61
|
+
- `object-fit: cover` on images
|
|
62
|
+
- `overflow: hidden`
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Enable in build
|
|
67
|
+
|
|
68
|
+
Avatar is imported in `src/styles/main.scss`. Run `npm run build` to include styles in `dist/style.css`.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Related
|
|
73
|
+
|
|
74
|
+
- [Card](./card.md)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Breadcrumb
|
|
2
|
+
|
|
3
|
+
Navigation trail showing the current page hierarchy.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/breadcrumb.scss`
|
|
6
|
+
**Demo:** `index.html`
|
|
7
|
+
**JavaScript required:** No
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## HTML
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<div class="dga-breadcrumb">
|
|
15
|
+
<a class="dga-breadcrumb-item" href="/">Home</a>
|
|
16
|
+
<a class="dga-breadcrumb-item" href="/about">About</a>
|
|
17
|
+
<a class="dga-breadcrumb-item" href="/vision" data-current="true">Our vision</a>
|
|
18
|
+
</div>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Classes
|
|
24
|
+
|
|
25
|
+
| Class | Purpose |
|
|
26
|
+
|-------|---------|
|
|
27
|
+
| `dga-breadcrumb` | Flex container |
|
|
28
|
+
| `dga-breadcrumb-item` | Each crumb link |
|
|
29
|
+
| `data-current="true"` | Current (last) item — muted color |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## RTL
|
|
34
|
+
|
|
35
|
+
Separator chevron flips automatically when `dir="rtl"` is on a parent:
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<div class="dga-breadcrumb" dir="rtl">
|
|
39
|
+
<a class="dga-breadcrumb-item" href="#">الرئيسية</a>
|
|
40
|
+
<a class="dga-breadcrumb-item" data-current="true">رؤيتنا</a>
|
|
41
|
+
</div>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Accessibility
|
|
47
|
+
|
|
48
|
+
- Use `<nav aria-label="Breadcrumb">` wrapper in production
|
|
49
|
+
- Current page: `aria-current="page"` on the last link
|
|
50
|
+
- Ensure links are keyboard focusable
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Related
|
|
55
|
+
|
|
56
|
+
- [Link](./link.md)
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
Primary action component for the DGA design system.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/button.scss`
|
|
6
|
+
**Demo:** `index.html` (Buttons section)
|
|
7
|
+
**JavaScript required:** No
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Buttons use the base class `dga-btn` plus a variant and optional size modifier.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<button class="dga-btn dga-btn-primary dga-btn-md">الاجراء الرئيسي</button>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Base class
|
|
22
|
+
|
|
23
|
+
| Class | Required |
|
|
24
|
+
|-------|----------|
|
|
25
|
+
| `dga-btn` | Yes |
|
|
26
|
+
|
|
27
|
+
Always use a `<button>` element (or `<a>` styled as button for navigation).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Variants
|
|
32
|
+
|
|
33
|
+
| Class | Use case |
|
|
34
|
+
|-------|----------|
|
|
35
|
+
| `dga-btn-primary` | Main action (Saudi green) |
|
|
36
|
+
| `dga-btn-primary-outline` | Secondary emphasis, outline |
|
|
37
|
+
| `dga-btn-neutral` | Dark neutral action |
|
|
38
|
+
| `dga-btn-secondary-solid` | Secondary filled |
|
|
39
|
+
| `dga-btn-secondary-outline` | Secondary outline |
|
|
40
|
+
| `dga-btn-subtle` | Low emphasis |
|
|
41
|
+
| `dga-btn-transparent` | Minimal, on colored backgrounds |
|
|
42
|
+
| `dga-btn-ghost` | Ghost style (green text) |
|
|
43
|
+
| `dga-btn-destructive` | Delete / dangerous actions |
|
|
44
|
+
| `dga-btn-destructive-outline` | Destructive outline |
|
|
45
|
+
| `dga-btn-success` | Success action |
|
|
46
|
+
| `dga-btn-warning` | Warning action |
|
|
47
|
+
| `dga-btn-info` | Info action |
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<button class="dga-btn dga-btn-primary">Primary</button>
|
|
51
|
+
<button class="dga-btn dga-btn-secondary-outline">Secondary outline</button>
|
|
52
|
+
<button class="dga-btn dga-btn-destructive">Delete</button>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Sizes
|
|
58
|
+
|
|
59
|
+
| Class | Height | Font size |
|
|
60
|
+
|-------|--------|-----------|
|
|
61
|
+
| `dga-btn-sm` | 24px | 12px |
|
|
62
|
+
| `dga-btn-md` | 32px | 14px (default) |
|
|
63
|
+
| `dga-btn-lg` | 40px | 16px |
|
|
64
|
+
|
|
65
|
+
If no size class is set, **medium** (`md`) applies.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<button class="dga-btn dga-btn-primary dga-btn-sm">Small</button>
|
|
69
|
+
<button class="dga-btn dga-btn-primary dga-btn-lg">Large</button>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Icons
|
|
75
|
+
|
|
76
|
+
| Class | Purpose |
|
|
77
|
+
|-------|---------|
|
|
78
|
+
| `dga-btn__icon` | Icon inside button |
|
|
79
|
+
| `dga-btn-icon-only` | Icon-only button (square) |
|
|
80
|
+
| `dga-btn-icon-left` | Icon on left (LTR) |
|
|
81
|
+
| `dga-btn-icon-right` | Icon on right (LTR) |
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<!-- Text + icon -->
|
|
85
|
+
<button class="dga-btn dga-btn-primary dga-btn-md">
|
|
86
|
+
الاجراء الرئيسي
|
|
87
|
+
<img class="dga-btn__icon" src="arrow.svg" alt="" />
|
|
88
|
+
</button>
|
|
89
|
+
|
|
90
|
+
<!-- Icon only -->
|
|
91
|
+
<button class="dga-btn dga-btn-primary dga-btn-md dga-btn-icon-only" aria-label="Next">
|
|
92
|
+
<img class="dga-btn__icon" src="arrow.svg" alt="" />
|
|
93
|
+
</button>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Always provide `aria-label` on icon-only buttons.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Modifiers
|
|
101
|
+
|
|
102
|
+
| Class | Effect |
|
|
103
|
+
|-------|--------|
|
|
104
|
+
| `dga-btn-block` | Full width |
|
|
105
|
+
| `dga-btn-pill` | Pill border radius |
|
|
106
|
+
| `dga-btn-disabled` | Disabled style |
|
|
107
|
+
| `disabled` attribute | Native disabled state |
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<button class="dga-btn dga-btn-primary dga-btn-block" disabled>Full width</button>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Button groups
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<div class="dga-btn-group">
|
|
119
|
+
<button class="dga-btn dga-btn-secondary-outline">Left</button>
|
|
120
|
+
<button class="dga-btn dga-btn-secondary-outline">Right</button>
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Full example
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<div class="dga-d-flex dga-flex-col dga-gap-3 dga-align-items-start">
|
|
130
|
+
<button class="dga-btn dga-btn-primary dga-btn-md">
|
|
131
|
+
الاجراء الرئيسي
|
|
132
|
+
<img class="dga-btn__icon" src="arrow_left.svg" alt="" />
|
|
133
|
+
</button>
|
|
134
|
+
<button class="dga-btn dga-btn-neutral dga-btn-md">Neutral</button>
|
|
135
|
+
<button class="dga-btn dga-btn-subtle dga-btn-md">اجراء دقيق</button>
|
|
136
|
+
</div>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Accessibility
|
|
142
|
+
|
|
143
|
+
- Use `<button type="button">` for actions, `type="submit"` for forms.
|
|
144
|
+
- Icon-only buttons need `aria-label`.
|
|
145
|
+
- Disabled buttons: `disabled` attribute or `dga-btn-disabled`.
|
|
146
|
+
- Focus styles are built in (`:focus-visible`).
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Do / Don't
|
|
151
|
+
|
|
152
|
+
| Do | Don't |
|
|
153
|
+
|----|-------|
|
|
154
|
+
| `dga-btn dga-btn-primary dga-btn-md` | `dga-btn-large` (invalid — use `dga-btn-lg`) |
|
|
155
|
+
| `<button class="dga-btn">` | `<div class="dga-btn">` |
|
|
156
|
+
| `aria-label` on icon-only | Icon-only without label |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Related
|
|
161
|
+
|
|
162
|
+
- [Colors](../foundations/colors.md)
|
|
163
|
+
- [Spacing](../foundations/spacing.md)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
Container for grouped content with optional icon and footer.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/card.scss`
|
|
6
|
+
**Demo:** `index.html`
|
|
7
|
+
**JavaScript required:** No
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Basic card
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<div class="dga-card">
|
|
15
|
+
<div class="dga-card-icon">
|
|
16
|
+
<img src="icon.svg" alt="" />
|
|
17
|
+
</div>
|
|
18
|
+
<div class="dga-card-content">
|
|
19
|
+
<h3 class="dga-card-title">عنوان</h3>
|
|
20
|
+
<div class="dga-card-body">
|
|
21
|
+
<p>نص المحتوى الخاص بالكارد</p>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Structure
|
|
30
|
+
|
|
31
|
+
| Element | Class | Required |
|
|
32
|
+
|---------|-------|----------|
|
|
33
|
+
| Root | `dga-card` | Yes |
|
|
34
|
+
| Icon area | `dga-card-icon` | Optional |
|
|
35
|
+
| Content | `dga-card-content` | Yes |
|
|
36
|
+
| Title | `dga-card-title` | Optional |
|
|
37
|
+
| Body | `dga-card-body` | Optional |
|
|
38
|
+
| Footer | `dga-card-footer` | Optional |
|
|
39
|
+
|
|
40
|
+
Footer inner classes: `.footer-text`, `.footer-actions`
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Variants
|
|
45
|
+
|
|
46
|
+
Set `data-variant` on the root:
|
|
47
|
+
|
|
48
|
+
| Value | Style |
|
|
49
|
+
|-------|-------|
|
|
50
|
+
| `default` | Shadow (`dga-shadow-md`) — default when omitted |
|
|
51
|
+
| `stroke` | Border, no shadow |
|
|
52
|
+
| `noshadow` | No shadow, no border |
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<div class="dga-card" data-variant="stroke">
|
|
56
|
+
<div class="dga-card-content">
|
|
57
|
+
<div class="dga-card-title">عنوان</div>
|
|
58
|
+
<div class="dga-card-body">محتوى</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## With utility spacing
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<div class="dga-card dga-p-4" data-variant="stroke">
|
|
69
|
+
...
|
|
70
|
+
</div>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Related
|
|
76
|
+
|
|
77
|
+
- [Spacing](../foundations/spacing.md)
|
|
78
|
+
- [Border radius](../foundations/radius.md)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Pie Chart
|
|
2
|
+
|
|
3
|
+
CSS conic-gradient pie / donut chart with labels.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/styles/components/chart--pie.scss`, `src/scripts/chart.js`, `src/scripts/dga-pie-chart.js`
|
|
6
|
+
**Demo:** `index.html`
|
|
7
|
+
**JavaScript:** Optional — web component or `DGAChart` class
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Option 1: Web component (recommended)
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<dga-pie-chart
|
|
15
|
+
data='[
|
|
16
|
+
{"label":"البند الأول","from":"0%","to":"40%","color":"var(--dga-primary-100)"},
|
|
17
|
+
{"label":"البند الثاني","from":"40%","to":"70%","color":"var(--dga-gray-200)"},
|
|
18
|
+
{"label":"البند الثالث","from":"70%","to":"90%","color":"var(--dga-primary-700)"},
|
|
19
|
+
{"label":"البند الرابع","from":"90%","to":"100%","color":"var(--dga-primary-700)"}
|
|
20
|
+
]'>
|
|
21
|
+
</dga-pie-chart>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Donut
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<dga-pie-chart hole data='[...]'></dga-pie-chart>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Attributes
|
|
31
|
+
|
|
32
|
+
| Attribute | Default | Description |
|
|
33
|
+
|-----------|---------|-------------|
|
|
34
|
+
| `data` | `[]` | JSON array of segments (see data shape) |
|
|
35
|
+
| `hole` | `false` | Present = donut (white center) |
|
|
36
|
+
|
|
37
|
+
No `new DGAChart()` required. Update the `data` attribute to re-render.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Option 2: Legacy markup + DGAChart
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<!-- Full pie -->
|
|
45
|
+
<div id="chart1" class="dga-pie-chart" data-hole="false"></div>
|
|
46
|
+
|
|
47
|
+
<!-- Donut -->
|
|
48
|
+
<div id="chart2" class="dga-pie-chart" data-hole="true"></div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
import { DGAChart } from '@waaelg/dga-design-on-sass'
|
|
53
|
+
|
|
54
|
+
const data = [
|
|
55
|
+
{ label: 'البند الأول', from: '0%', to: '40%', color: 'var(--dga-primary-100)' },
|
|
56
|
+
{ label: 'البند الثاني', from: '40%', to: '70%', color: 'var(--dga-gray-200)' },
|
|
57
|
+
{ label: 'البند الثالث', from: '70%', to: '90%', color: 'var(--dga-primary-700)' },
|
|
58
|
+
{ label: 'البند الرابع', from: '90%', to: '100%', color: 'var(--dga-primary-700)' },
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
new DGAChart(document.getElementById('chart1'), data)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
| Attribute | Effect |
|
|
65
|
+
|-----------|--------|
|
|
66
|
+
| `data-hole="false"` | Solid pie |
|
|
67
|
+
| `data-hole="true"` | Donut (white center) |
|
|
68
|
+
|
|
69
|
+
Default size: 150×150px, centered with `margin: 0 auto`.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Data shape
|
|
74
|
+
|
|
75
|
+
| Field | Description |
|
|
76
|
+
|-------|-------------|
|
|
77
|
+
| `label` | Legend text |
|
|
78
|
+
| `from` | Segment start (e.g. `0%`) |
|
|
79
|
+
| `to` | Segment end (e.g. `40%`) |
|
|
80
|
+
| `color` | Hex (`#2d7a5a`), CSS var (`var(--dga-primary-100)`), or token name (`primary-100`) |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Generated markup
|
|
85
|
+
|
|
86
|
+
JS adds:
|
|
87
|
+
|
|
88
|
+
- `background: conic-gradient(...)` on the chart element
|
|
89
|
+
- `.dga-pie-chart__labels` with `.dga-pie-chart__label` and `.dga-pie-chart__circle` swatches
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Related
|
|
94
|
+
|
|
95
|
+
- [Web Components](../getting-started/web-components.md)
|
|
96
|
+
- [JavaScript API](../getting-started/javascript-api.md)
|
|
97
|
+
- [Colors](../foundations/colors.md)
|