@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.
@@ -0,0 +1,110 @@
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)
@@ -0,0 +1,54 @@
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)
@@ -0,0 +1,123 @@
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)
@@ -0,0 +1,52 @@
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
@@ -0,0 +1,93 @@
1
+ # Navbar
2
+
3
+ Responsive navigation with dropdown menus and mobile toggle.
4
+
5
+ **Source:** `src/styles/components/navbar.scss`
6
+ **Demo:** `index.html` (header)
7
+ **JavaScript required:** Yes — `DGAMenuDropDown`
8
+
9
+ ---
10
+
11
+ ## HTML structure
12
+
13
+ ```html
14
+ <nav class="dga-navbar dga-px-3" role="navigation" aria-label="Main navigation">
15
+ <a class="dga-navbar-brand" href="#">
16
+ <img src="logo.svg" alt="Site name" />
17
+ </a>
18
+
19
+ <ul class="dga-menu">
20
+ <li>
21
+ <a class="dga-menu-item" href="#">Link</a>
22
+ </li>
23
+ <li>
24
+ <a class="dga-menu-item dga-has-dropdown" href="#" role="button"
25
+ aria-expanded="false" aria-haspopup="true">
26
+ الرئيسية
27
+ </a>
28
+ <div class="dga-dropdown">
29
+ <div class="dga-dropdown-content">
30
+ <ul>
31
+ <li><a href="#">Link</a></li>
32
+ <li><a href="#">Link</a></li>
33
+ </ul>
34
+ </div>
35
+ </div>
36
+ </li>
37
+ </ul>
38
+
39
+ <button class="dga-navbar-toggler" aria-label="Open menu" aria-expanded="false"></button>
40
+ </nav>
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Classes
46
+
47
+ | Class | Purpose |
48
+ |-------|---------|
49
+ | `dga-navbar` | Root nav container (72px height) |
50
+ | `dga-navbar-brand` | Logo / brand link |
51
+ | `dga-menu` | Horizontal menu list |
52
+ | `dga-menu-item` | Nav link |
53
+ | `dga-has-dropdown` | Item with dropdown chevron |
54
+ | `dga-menu-item-with-icon` | Item with trailing icon |
55
+ | `dga-menu-icon` | Icon inside menu item |
56
+ | `dga-dropdown` | Dropdown panel |
57
+ | `dga-dropdown-content` | Dropdown inner content |
58
+ | `dga-dropdwon-title` | Section title in dropdown (note spelling in source) |
59
+ | `dga-navbar-toggler` | Mobile menu button |
60
+
61
+ ---
62
+
63
+ ## JavaScript
64
+
65
+ ```js
66
+ import { DGAMenuDropDown, DGAVerifyBar } from '@waaelg/dga-design-on-sass'
67
+
68
+ const menu = new DGAMenuDropDown({
69
+ navbar: document.querySelector('.dga-navbar'),
70
+ })
71
+
72
+ // Optional: coordinate with verify bar
73
+ const verifyBar = new DGAVerifyBar()
74
+ verifyBar.menu = menu
75
+ menu.verifyBar = verifyBar
76
+ ```
77
+
78
+ Handles desktop dropdowns, mobile slide-out menu, keyboard, and resize.
79
+
80
+ ---
81
+
82
+ ## Accessibility
83
+
84
+ - `role="navigation"` and `aria-label` on `<nav>`
85
+ - Dropdown triggers: `role="button"`, `aria-expanded`, `aria-haspopup`
86
+ - Toggler: `aria-label`, update `aria-expanded` when open
87
+
88
+ ---
89
+
90
+ ## Related
91
+
92
+ - [Verify bar](./verify-bar.md)
93
+ - [JavaScript API](../getting-started/javascript-api.md)
@@ -0,0 +1,69 @@
1
+ # Table
2
+
3
+ Data tables with optional contained and striped styles.
4
+
5
+ **Source:** `src/styles/components/table.scss`
6
+ **Demo:** `index.html`
7
+ **JavaScript required:** No
8
+
9
+ ---
10
+
11
+ ## Basic table
12
+
13
+ ```html
14
+ <table class="dga-table" data-contained="true" data-striped="true">
15
+ <thead>
16
+ <tr>
17
+ <th>الاسم</th>
18
+ <th>العمر</th>
19
+ <th>المدينة</th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <tr>
24
+ <td>أحمد</td>
25
+ <td>30</td>
26
+ <td>الرياض</td>
27
+ </tr>
28
+ <tr>
29
+ <td>سارة</td>
30
+ <td>25</td>
31
+ <td>جدة</td>
32
+ </tr>
33
+ </tbody>
34
+ </table>
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Data attributes
40
+
41
+ | Attribute | Effect |
42
+ |-----------|--------|
43
+ | `data-contained="true"` | Rounded border wrapper, internal dividers |
44
+ | `data-striped="true"` | Alternating row background |
45
+
46
+ Both can be combined.
47
+
48
+ ---
49
+
50
+ ## Styling details
51
+
52
+ - Header: gray background, 48px height, 12px font
53
+ - Body rows: 64px height, 14px font
54
+ - Row hover: light gray highlight
55
+ - Text alignment: `text-align: start` (RTL-aware)
56
+
57
+ ---
58
+
59
+ ## Accessibility
60
+
61
+ - Use `<thead>`, `<tbody>`, `<th>`, `<td>` semantically
62
+ - Add `<caption>` for table description when helpful
63
+ - For sortable tables, add ARIA sort attributes in your app logic
64
+
65
+ ---
66
+
67
+ ## Related
68
+
69
+ - [Grid](../foundations/grid.md)
@@ -0,0 +1,76 @@
1
+ # Tag
2
+
3
+ Compact labels for status, categories, and metadata.
4
+
5
+ **Source:** `src/styles/components/tag.scss`
6
+ **Demo:** `index.html`
7
+ **JavaScript required:** No
8
+
9
+ ---
10
+
11
+ ## Basic tag
12
+
13
+ ```html
14
+ <span class="dga-tag">تاق افتراضي</span>
15
+ ```
16
+
17
+ Use `<span class="dga-tag">` — includes a default info icon on the left (LTR) or right (RTL).
18
+
19
+ ---
20
+
21
+ ## Variants
22
+
23
+ | `data-variant` | Color |
24
+ |----------------|-------|
25
+ | (default) | Gray |
26
+ | `success` | Green |
27
+ | `info` | Blue |
28
+ | `warning` | Orange |
29
+
30
+ ```html
31
+ <span class="dga-tag" data-variant="success">تاق نجاح</span>
32
+ <span class="dga-tag" data-variant="info">تاق معلومة</span>
33
+ <span class="dga-tag" data-variant="warning">تاق تحذير</span>
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Modifiers
39
+
40
+ | Attribute | Effect |
41
+ |-----------|--------|
42
+ | `data-outline="true"` | Outlined border |
43
+ | `data-rounded="true"` | Pill shape |
44
+ | `data-icononly="true"` | Circle icon only (no text) |
45
+
46
+ ```html
47
+ <span class="dga-tag" data-outline="true">تاق بحدود</span>
48
+ <span class="dga-tag" data-outline="true" data-rounded="true">تاق مدور بحدود</span>
49
+ <span class="dga-tag" data-variant="warning" data-rounded="true" data-icononly="true"></span>
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Combined example
55
+
56
+ ```html
57
+ <div class="dga-d-flex dga-flex-wrap dga-gap-2 dga-align-items-center">
58
+ <span class="dga-tag" data-outline="true">تاق بحدود</span>
59
+ <span class="dga-tag">تاق افتراضي</span>
60
+ <span class="dga-tag" data-variant="success">تاق نجاح</span>
61
+ <div class="dga-divider" data-variant="primary" data-direction="v"></div>
62
+ <span class="dga-tag" data-variant="info" data-rounded="true">تاق معلومة</span>
63
+ </div>
64
+ ```
65
+
66
+ ---
67
+
68
+ ## RTL
69
+
70
+ Icon position flips with `[dir="rtl"]` on parent or `dir="rtl"` on the tag.
71
+
72
+ ---
73
+
74
+ ## Related
75
+
76
+ - [Divider](./divider.md)
@@ -0,0 +1,79 @@
1
+ # Verify Bar
2
+
3
+ Saudi government official site verification banner.
4
+
5
+ **Source:** `src/styles/components/verifyBar.scss`, `src/scripts/verifyBar.js`, `src/scripts/dga-verify-bar.js`
6
+ **Demo:** `verify-bar.html`, `index.html`
7
+ **JavaScript:** Optional — web component or `DGAVerifyBar` class
8
+
9
+ ---
10
+
11
+ ## Option 1: Web component (recommended)
12
+
13
+ Import the package once — registers `<dga-verify-bar>` automatically:
14
+
15
+ ```html
16
+ <dga-verify-bar></dga-verify-bar>
17
+ ```
18
+
19
+ ### Custom attributes
20
+
21
+ ```html
22
+ <dga-verify-bar
23
+ domain=".edu.sa"
24
+ registration-number="20250105758"
25
+ registration-link="https://raqmi.dga.gov.sa/platforms/platforms/9ebc5e60-9081-4653-bfb9-08dd2a2f8633/platform-license">
26
+ </dga-verify-bar>
27
+ ```
28
+
29
+ | Attribute | Default | Description |
30
+ |-----------|---------|-------------|
31
+ | `domain` | `.edu.sa` | Official domain suffix shown in copy |
32
+ | `registration-number` | `20250105758` | DGA registration number |
33
+ | `registration-link` | DGA Raqmi URL | Link to platform license |
34
+
35
+ No manual JS init required when using the web component.
36
+
37
+ ---
38
+
39
+ ## Option 2: Legacy markup + DGAVerifyBar
40
+
41
+ Requires fixed element IDs:
42
+
43
+ - `#dga-verify-bar`
44
+ - `#dga-verifyBtn`
45
+ - `#dga-verify-bar_content`
46
+
47
+ ```js
48
+ import { DGAVerifyBar, DGAMenuDropDown } from '@waaelg/dga-design-on-sass'
49
+
50
+ const verifyBar = new DGAVerifyBar()
51
+ const menu = new DGAMenuDropDown()
52
+ verifyBar.menu = menu
53
+ menu.verifyBar = verifyBar
54
+ ```
55
+
56
+ Use this when integrating with the legacy HTML structure in `index.html`.
57
+
58
+ ---
59
+
60
+ ## Styling
61
+
62
+ - Background: `dga-bg-gray-100`
63
+ - Toggle button: `dga-btn dga-btn-subtle dga-text-primary-500`
64
+ - Expandable panel with domain and HTTPS verification info
65
+ - Arabic copy by default
66
+
67
+ ---
68
+
69
+ ## Assets
70
+
71
+ The web component references SVG assets (`saudiFlag.svg`, `link-icon.svg`, etc.). Serve them from your app `public` folder or configure paths in your build.
72
+
73
+ ---
74
+
75
+ ## Related
76
+
77
+ - [Navbar](./navbar.md) — coordinate open/close with mobile menu
78
+ - [JavaScript API](../getting-started/javascript-api.md)
79
+ - [RTL & Arabic](../getting-started/rtl-arabic.md)