@waaelg/dga-design-system 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +23 -23
  2. package/dist/DGA-logo-icon.svg +55 -0
  3. package/dist/arrow_left.svg +3 -0
  4. package/dist/arrow_left_black.svg +3 -0
  5. package/dist/arrow_right.svg +3 -0
  6. package/dist/arrow_right_black.svg +3 -0
  7. package/dist/chevron.svg +0 -0
  8. package/dist/index.js +253 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/link-icon.svg +19 -0
  11. package/dist/marker.svg +1 -0
  12. package/dist/saudiFlag.svg +13 -0
  13. package/dist/square-lock-password.svg +20 -0
  14. package/dist/style.css +1 -0
  15. package/dist/vite.svg +1 -0
  16. package/package.json +24 -7
  17. package/docs/README.md +0 -76
  18. package/docs/changelog.md +0 -54
  19. package/docs/components/accordion.md +0 -114
  20. package/docs/components/alert.md +0 -130
  21. package/docs/components/avatar.md +0 -74
  22. package/docs/components/breadcrumb.md +0 -56
  23. package/docs/components/button.md +0 -163
  24. package/docs/components/card.md +0 -78
  25. package/docs/components/chart.md +0 -97
  26. package/docs/components/code-snippet.md +0 -110
  27. package/docs/components/divider.md +0 -54
  28. package/docs/components/forms.md +0 -123
  29. package/docs/components/link.md +0 -52
  30. package/docs/components/navbar.md +0 -93
  31. package/docs/components/table.md +0 -69
  32. package/docs/components/tag.md +0 -76
  33. package/docs/components/verify-bar.md +0 -79
  34. package/docs/foundations/colors-cheatsheet.md +0 -593
  35. package/docs/foundations/colors-swatches.md +0 -441
  36. package/docs/foundations/colors.md +0 -1284
  37. package/docs/foundations/grid.md +0 -1406
  38. package/docs/foundations/radius.md +0 -1166
  39. package/docs/foundations/spacing.md +0 -134
  40. package/docs/foundations/typography.md +0 -111
  41. package/docs/foundations/width-height.md +0 -305
  42. package/docs/getting-started/installation.md +0 -158
  43. package/docs/getting-started/javascript-api.md +0 -204
  44. package/docs/getting-started/rtl-arabic.md +0 -89
  45. package/docs/getting-started/web-components.md +0 -134
@@ -1,163 +0,0 @@
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)
@@ -1,78 +0,0 @@
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)
@@ -1,97 +0,0 @@
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)
@@ -1,110 +0,0 @@
1
- # Code Snippet
2
-
3
- Inline and multi-line code blocks with copy button.
4
-
5
- **Source:** `src/styles/components/code-snippet.scss`, `src/scripts/codeSnippet.js`, `src/scripts/dga-code-snippet.js`
6
- **Demo:** `index.html`
7
- **JavaScript:** Optional — web component or `DGACodeSnippet` class
8
-
9
- ---
10
-
11
- ## Option 1: Web component (recommended)
12
-
13
- ### Inline
14
-
15
- ```html
16
- <dga-code-snippet code="npm install @waaelg/dga-design-on-sass"></dga-code-snippet>
17
- ```
18
-
19
- Or with text content:
20
-
21
- ```html
22
- <dga-code-snippet>npm install @waaelg/dga-design-on-sass</dga-code-snippet>
23
- ```
24
-
25
- ### Multiline
26
-
27
- ```html
28
- <dga-code-snippet multiline code="const app = createApp(App)
29
- app.mount('#app')"></dga-code-snippet>
30
- ```
31
-
32
- ### Attributes
33
-
34
- | Attribute | Description |
35
- |-----------|-------------|
36
- | `code` | Code text to display and copy |
37
- | `multiline` | Present = multi-line block layout |
38
-
39
- Copy fires `dga-code-copy` on success. No `new DGACodeSnippet()` required.
40
-
41
- > Tabbed multi-line snippets (Java / Python tabs) are **legacy markup only** — implement tab switching in your app.
42
-
43
- ---
44
-
45
- ## Option 2: Legacy markup + DGACodeSnippet
46
-
47
- ### Inline snippet
48
-
49
- ```html
50
- <div class="dga-code-snippet-inline">
51
- <div class="dga-code-snippet-inline__content">npm install @waaelg/dga-design-on-sass</div>
52
- <button type="button" class="dga-code-snippet-inline__copy"
53
- aria-label="Copy code" data-copied="false">
54
- <!-- copy icon SVG -->
55
- </button>
56
- </div>
57
- ```
58
-
59
- ```js
60
- import { DGACodeSnippet } from '@waaelg/dga-design-on-sass'
61
- new DGACodeSnippet()
62
- ```
63
-
64
- ### Multi-line snippet (with tabs)
65
-
66
- ```html
67
- <div class="dga-code-snippet-multiline">
68
- <div class="dga-code-snippet-multiline__tabs" dir="ltr">
69
- <button type="button" class="dga-code-snippet-multiline__tab" data-active="true">Java</button>
70
- <button type="button" class="dga-code-snippet-multiline__tab">Python</button>
71
- </div>
72
-
73
- <div class="dga-code-snippet-multiline__body">
74
- <ol class="dga-code-snippet-multiline__lines">
75
- <li></li><li></li><li></li>
76
- </ol>
77
- <pre class="dga-code-snippet-multiline__code"><code>// Your code here</code></pre>
78
- <button type="button" class="dga-code-snippet-multiline__copy"
79
- aria-label="Copy code" data-copied="false"></button>
80
- </div>
81
-
82
- <div class="dga-code-snippet-multiline__footer" dir="ltr">Show More</div>
83
- </div>
84
- ```
85
-
86
- Tab switching is not wired in JS by default — implement in your app or extend `DGACodeSnippet`.
87
-
88
- ---
89
-
90
- ## Copy behavior
91
-
92
- - Web component: built-in copy on button click
93
- - Legacy: `DGACodeSnippet` listens for clicks on `.dga-code-snippet-inline__copy` and `.dga-code-snippet-multiline__copy`
94
- - Sets `data-copied="true"` briefly after successful copy
95
-
96
- ---
97
-
98
- ## Styling notes
99
-
100
- - Inline content uses `direction: ltr` for code
101
- - Monospace font stack built in
102
- - Copy button shows success state (green) when `data-copied="true"`
103
-
104
- ---
105
-
106
- ## Related
107
-
108
- - [Web Components](../getting-started/web-components.md)
109
- - [JavaScript API](../getting-started/javascript-api.md)
110
- - [Installation](../getting-started/installation.md)
@@ -1,54 +0,0 @@
1
- # Divider
2
-
3
- Horizontal or vertical separator lines.
4
-
5
- **Source:** `src/styles/components/divider.scss`
6
- **Demo:** `index.html`
7
- **JavaScript required:** No
8
-
9
- ---
10
-
11
- ## Horizontal divider
12
-
13
- ```html
14
- <div class="dga-divider" data-variant="primary" data-direction="h"></div>
15
- ```
16
-
17
- Default is horizontal if `data-direction` is omitted (height 1px, width 192px max 90%).
18
-
19
- ---
20
-
21
- ## Vertical divider
22
-
23
- ```html
24
- <div class="dga-divider" data-variant="primary" data-direction="v"></div>
25
- ```
26
-
27
- Width 1px, height 192px max 90%. Use between inline items (e.g. tags).
28
-
29
- ---
30
-
31
- ## Variants
32
-
33
- | `data-variant` | Color |
34
- |----------------|-------|
35
- | `secondary` | Gray (`$dga-gray-300`) |
36
- | `primary` | Saudi green (`$dga-sa-600`) |
37
-
38
- ---
39
-
40
- ## Example with tags
41
-
42
- ```html
43
- <div class="dga-d-flex dga-gap-2 dga-align-items-center">
44
- <span class="dga-tag">Tag 1</span>
45
- <div class="dga-divider" data-variant="primary" data-direction="v"></div>
46
- <span class="dga-tag">Tag 2</span>
47
- </div>
48
- ```
49
-
50
- ---
51
-
52
- ## Related
53
-
54
- - [Tag](./tag.md)
@@ -1,123 +0,0 @@
1
- # Forms
2
-
3
- Input, select, textarea, and label components.
4
-
5
- **Source:** `src/styles/components/input.scss`, `select.scss`, `textarea.scss`, `label.scss`
6
- **Demo:** `index.html`
7
- **JavaScript required:** No
8
-
9
- ---
10
-
11
- ## Label
12
-
13
- ```html
14
- <label for="field-id" class="dga-label">حقل نص عادي</label>
15
- ```
16
-
17
- Always pair `for` with the control `id`.
18
-
19
- ---
20
-
21
- ## Text input
22
-
23
- ```html
24
- <label for="dga-input" class="dga-label">حقل نص عادي</label>
25
- <input type="text" id="dga-input" class="dga-input" />
26
- ```
27
-
28
- ### Error state
29
-
30
- ```html
31
- <input type="text" class="dga-input dga-input-error" aria-invalid="true" />
32
- ```
33
-
34
- | Class | Purpose |
35
- |-------|---------|
36
- | `dga-input` | Base input (40px height, full width) |
37
- | `dga-input-error` | Red border and error underline |
38
-
39
- ---
40
-
41
- ## Select
42
-
43
- ```html
44
- <label for="dga-select" class="dga-label">قائمة منسدلة</label>
45
- <select id="dga-select" class="dga-select">
46
- <option>خيار 1</option>
47
- <option>خيار 2</option>
48
- </select>
49
- ```
50
-
51
- ### Error state
52
-
53
- ```html
54
- <select class="dga-select error" aria-invalid="true">...</select>
55
- ```
56
-
57
- > Note: select uses class `error`, not `dga-select-error`.
58
-
59
- ---
60
-
61
- ## Textarea
62
-
63
- ```html
64
- <label for="dga-textarea" class="dga-label">رسالة</label>
65
- <textarea id="dga-textarea" class="dga-textarea"></textarea>
66
- ```
67
-
68
- ### Error state
69
-
70
- ```html
71
- <textarea class="dga-textarea dga-textarea-error" aria-invalid="true"></textarea>
72
- ```
73
-
74
- Min height: 96px. Resizable by default.
75
-
76
- ---
77
-
78
- ## Full form example
79
-
80
- ```html
81
- <div class="dga-d-flex dga-flex-col dga-gap-3">
82
- <div>
83
- <label for="name" class="dga-label">الاسم</label>
84
- <input type="text" id="name" class="dga-input" />
85
- </div>
86
- <div>
87
- <label for="role" class="dga-label">الدور</label>
88
- <select id="role" class="dga-select">
89
- <option>مواطن</option>
90
- <option>موظف</option>
91
- </select>
92
- </div>
93
- <div>
94
- <label for="message" class="dga-label">الرسالة</label>
95
- <textarea id="message" class="dga-textarea"></textarea>
96
- </div>
97
- </div>
98
- ```
99
-
100
- ---
101
-
102
- ## States
103
-
104
- All form controls support:
105
-
106
- - **Hover** — darker border
107
- - **Focus** — bottom accent line + shadow
108
- - **Active** — partial underline + gray background
109
- - **Error** — red border (see classes above)
110
-
111
- ---
112
-
113
- ## Accessibility
114
-
115
- - Always use `<label class="dga-label">` with matching `for` / `id`
116
- - Set `aria-invalid="true"` on error fields
117
- - Add error message text linked with `aria-describedby`
118
-
119
- ---
120
-
121
- ## Related
122
-
123
- - [Label](./forms.md#label) · [Button](./button.md)
@@ -1,52 +0,0 @@
1
- # Link
2
-
3
- Styled anchor links for inline navigation.
4
-
5
- **Source:** `src/styles/components/link.scss`
6
- **Demo:** `index.html`
7
- **JavaScript required:** No
8
-
9
- ---
10
-
11
- ## Basic link
12
-
13
- ```html
14
- <a href="#" class="dga-link">Link</a>
15
- ```
16
-
17
- Saudi green color (`$dga-sa-600`), underline on hover.
18
-
19
- ---
20
-
21
- ## Variants
22
-
23
- | Attribute | Effect |
24
- |-----------|--------|
25
- | (default) | No underline until hover |
26
- | `data-variant="inline"` | Always underlined |
27
-
28
- ```html
29
- <a href="#" class="dga-link" data-variant="inline">Inline link</a>
30
- ```
31
-
32
- ---
33
-
34
- ## States
35
-
36
- - **Hover** — lighter green + underline
37
- - **Active** — darker green + underline
38
- - **Focus** — bottom border accent
39
-
40
- ---
41
-
42
- ## Accessibility
43
-
44
- - Use descriptive link text (not "click here")
45
- - External links: add `rel="noopener"` and indicate opens in new tab if needed
46
-
47
- ---
48
-
49
- ## Related
50
-
51
- - [Breadcrumb](./breadcrumb.md)
52
- - [Button](./button.md) — for actions use `<button>`, not links