@edsis/ui 0.0.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 +40 -0
- package/accordion/README.md +195 -0
- package/alert/README.md +177 -0
- package/alert-dialog/README.md +239 -0
- package/aspect-ratio/README.md +112 -0
- package/avatar/README.md +176 -0
- package/badge/README.md +133 -0
- package/breadcrumb/README.md +216 -0
- package/button/README.md +139 -0
- package/button-group/README.md +204 -0
- package/calendar/README.md +132 -0
- package/card/README.md +220 -0
- package/carousel/README.md +276 -0
- package/chart/README.md +249 -0
- package/checkbox/README.md +149 -0
- package/collapsible/README.md +191 -0
- package/combobox/README.md +198 -0
- package/command/README.md +275 -0
- package/composer/README.md +235 -0
- package/context-menu/README.md +267 -0
- package/date-picker/README.md +177 -0
- package/dialog/README.md +237 -0
- package/drawer/README.md +145 -0
- package/dropdown-menu/README.md +311 -0
- package/editor/README.md +136 -0
- package/empty/README.md +183 -0
- package/fesm2022/edsis-ui-accordion.mjs +174 -0
- package/fesm2022/edsis-ui-accordion.mjs.map +1 -0
- package/fesm2022/edsis-ui-alert-dialog.mjs +242 -0
- package/fesm2022/edsis-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/edsis-ui-alert.mjs +90 -0
- package/fesm2022/edsis-ui-alert.mjs.map +1 -0
- package/fesm2022/edsis-ui-aspect-ratio.mjs +33 -0
- package/fesm2022/edsis-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/edsis-ui-avatar.mjs +123 -0
- package/fesm2022/edsis-ui-avatar.mjs.map +1 -0
- package/fesm2022/edsis-ui-badge.mjs +47 -0
- package/fesm2022/edsis-ui-badge.mjs.map +1 -0
- package/fesm2022/edsis-ui-breadcrumb.mjs +186 -0
- package/fesm2022/edsis-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/edsis-ui-button-group.mjs +95 -0
- package/fesm2022/edsis-ui-button-group.mjs.map +1 -0
- package/fesm2022/edsis-ui-button.mjs +64 -0
- package/fesm2022/edsis-ui-button.mjs.map +1 -0
- package/fesm2022/edsis-ui-calendar.mjs +78 -0
- package/fesm2022/edsis-ui-calendar.mjs.map +1 -0
- package/fesm2022/edsis-ui-card.mjs +137 -0
- package/fesm2022/edsis-ui-card.mjs.map +1 -0
- package/fesm2022/edsis-ui-carousel.mjs +310 -0
- package/fesm2022/edsis-ui-carousel.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-area.mjs +6 -0
- package/fesm2022/edsis-ui-chart-area.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-bar.mjs +6 -0
- package/fesm2022/edsis-ui-chart-bar.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-line.mjs +6 -0
- package/fesm2022/edsis-ui-chart-line.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-pie.mjs +6 -0
- package/fesm2022/edsis-ui-chart-pie.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-radar.mjs +6 -0
- package/fesm2022/edsis-ui-chart-radar.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-radial.mjs +6 -0
- package/fesm2022/edsis-ui-chart-radial.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-scatter.mjs +6 -0
- package/fesm2022/edsis-ui-chart-scatter.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart.mjs +3714 -0
- package/fesm2022/edsis-ui-chart.mjs.map +1 -0
- package/fesm2022/edsis-ui-checkbox.mjs +104 -0
- package/fesm2022/edsis-ui-checkbox.mjs.map +1 -0
- package/fesm2022/edsis-ui-collapsible.mjs +116 -0
- package/fesm2022/edsis-ui-collapsible.mjs.map +1 -0
- package/fesm2022/edsis-ui-combobox.mjs +263 -0
- package/fesm2022/edsis-ui-combobox.mjs.map +1 -0
- package/fesm2022/edsis-ui-command.mjs +268 -0
- package/fesm2022/edsis-ui-command.mjs.map +1 -0
- package/fesm2022/edsis-ui-composer.mjs +329 -0
- package/fesm2022/edsis-ui-composer.mjs.map +1 -0
- package/fesm2022/edsis-ui-context-menu.mjs +100 -0
- package/fesm2022/edsis-ui-context-menu.mjs.map +1 -0
- package/fesm2022/edsis-ui-date-picker.mjs +155 -0
- package/fesm2022/edsis-ui-date-picker.mjs.map +1 -0
- package/fesm2022/edsis-ui-dialog.mjs +262 -0
- package/fesm2022/edsis-ui-dialog.mjs.map +1 -0
- package/fesm2022/edsis-ui-drawer.mjs +6 -0
- package/fesm2022/edsis-ui-drawer.mjs.map +1 -0
- package/fesm2022/edsis-ui-dropdown-menu.mjs +466 -0
- package/fesm2022/edsis-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/edsis-ui-editor.mjs +692 -0
- package/fesm2022/edsis-ui-editor.mjs.map +1 -0
- package/fesm2022/edsis-ui-empty.mjs +132 -0
- package/fesm2022/edsis-ui-empty.mjs.map +1 -0
- package/fesm2022/edsis-ui-form.mjs +334 -0
- package/fesm2022/edsis-ui-form.mjs.map +1 -0
- package/fesm2022/edsis-ui-hover-card.mjs +284 -0
- package/fesm2022/edsis-ui-hover-card.mjs.map +1 -0
- package/fesm2022/edsis-ui-input-group.mjs +164 -0
- package/fesm2022/edsis-ui-input-group.mjs.map +1 -0
- package/fesm2022/edsis-ui-input-otp.mjs +485 -0
- package/fesm2022/edsis-ui-input-otp.mjs.map +1 -0
- package/fesm2022/edsis-ui-input.mjs +43 -0
- package/fesm2022/edsis-ui-input.mjs.map +1 -0
- package/fesm2022/edsis-ui-item.mjs +241 -0
- package/fesm2022/edsis-ui-item.mjs.map +1 -0
- package/fesm2022/edsis-ui-kanban.mjs +289 -0
- package/fesm2022/edsis-ui-kanban.mjs.map +1 -0
- package/fesm2022/edsis-ui-kbd.mjs +51 -0
- package/fesm2022/edsis-ui-kbd.mjs.map +1 -0
- package/fesm2022/edsis-ui-label.mjs +30 -0
- package/fesm2022/edsis-ui-label.mjs.map +1 -0
- package/fesm2022/edsis-ui-menubar.mjs +302 -0
- package/fesm2022/edsis-ui-menubar.mjs.map +1 -0
- package/fesm2022/edsis-ui-native-select.mjs +61 -0
- package/fesm2022/edsis-ui-native-select.mjs.map +1 -0
- package/fesm2022/edsis-ui-navigation-menu.mjs +399 -0
- package/fesm2022/edsis-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/edsis-ui-pagination.mjs +216 -0
- package/fesm2022/edsis-ui-pagination.mjs.map +1 -0
- package/fesm2022/edsis-ui-pillbox.mjs +777 -0
- package/fesm2022/edsis-ui-pillbox.mjs.map +1 -0
- package/fesm2022/edsis-ui-popover.mjs +163 -0
- package/fesm2022/edsis-ui-popover.mjs.map +1 -0
- package/fesm2022/edsis-ui-progress.mjs +53 -0
- package/fesm2022/edsis-ui-progress.mjs.map +1 -0
- package/fesm2022/edsis-ui-radio.mjs +111 -0
- package/fesm2022/edsis-ui-radio.mjs.map +1 -0
- package/fesm2022/edsis-ui-resizable.mjs +454 -0
- package/fesm2022/edsis-ui-resizable.mjs.map +1 -0
- package/fesm2022/edsis-ui-scroll-area.mjs +48 -0
- package/fesm2022/edsis-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/edsis-ui-select.mjs +164 -0
- package/fesm2022/edsis-ui-select.mjs.map +1 -0
- package/fesm2022/edsis-ui-separator.mjs +33 -0
- package/fesm2022/edsis-ui-separator.mjs.map +1 -0
- package/fesm2022/edsis-ui-sheet.mjs +264 -0
- package/fesm2022/edsis-ui-sheet.mjs.map +1 -0
- package/fesm2022/edsis-ui-skeleton.mjs +29 -0
- package/fesm2022/edsis-ui-skeleton.mjs.map +1 -0
- package/fesm2022/edsis-ui-slider.mjs +405 -0
- package/fesm2022/edsis-ui-slider.mjs.map +1 -0
- package/fesm2022/edsis-ui-spinner.mjs +58 -0
- package/fesm2022/edsis-ui-spinner.mjs.map +1 -0
- package/fesm2022/edsis-ui-switch.mjs +107 -0
- package/fesm2022/edsis-ui-switch.mjs.map +1 -0
- package/fesm2022/edsis-ui-table.mjs +139 -0
- package/fesm2022/edsis-ui-table.mjs.map +1 -0
- package/fesm2022/edsis-ui-tabs.mjs +252 -0
- package/fesm2022/edsis-ui-tabs.mjs.map +1 -0
- package/fesm2022/edsis-ui-textarea.mjs +37 -0
- package/fesm2022/edsis-ui-textarea.mjs.map +1 -0
- package/fesm2022/edsis-ui-timeline.mjs +213 -0
- package/fesm2022/edsis-ui-timeline.mjs.map +1 -0
- package/fesm2022/edsis-ui-toast.mjs +71 -0
- package/fesm2022/edsis-ui-toast.mjs.map +1 -0
- package/fesm2022/edsis-ui-toggle-group.mjs +269 -0
- package/fesm2022/edsis-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/edsis-ui-toggle.mjs +76 -0
- package/fesm2022/edsis-ui-toggle.mjs.map +1 -0
- package/fesm2022/edsis-ui-tooltip.mjs +339 -0
- package/fesm2022/edsis-ui-tooltip.mjs.map +1 -0
- package/fesm2022/edsis-ui-utils.mjs +13 -0
- package/fesm2022/edsis-ui-utils.mjs.map +1 -0
- package/fesm2022/edsis-ui.mjs +11 -0
- package/fesm2022/edsis-ui.mjs.map +1 -0
- package/form/README.md +210 -0
- package/hover-card/README.md +146 -0
- package/input/README.md +159 -0
- package/input-group/README.md +234 -0
- package/input-otp/README.md +273 -0
- package/item/README.md +247 -0
- package/kanban/README.md +81 -0
- package/kbd/README.md +139 -0
- package/label/README.md +136 -0
- package/menubar/README.md +269 -0
- package/native-select/README.md +176 -0
- package/navigation-menu/README.md +160 -0
- package/package.json +310 -0
- package/pagination/README.md +144 -0
- package/pillbox/README.md +67 -0
- package/popover/README.md +43 -0
- package/progress/README.md +160 -0
- package/radio/README.md +209 -0
- package/resizable/README.md +164 -0
- package/scroll-area/README.md +143 -0
- package/select/README.md +174 -0
- package/separator/README.md +170 -0
- package/sheet/README.md +183 -0
- package/skeleton/README.md +158 -0
- package/slider/README.md +207 -0
- package/spinner/README.md +160 -0
- package/switch/README.md +166 -0
- package/table/README.md +291 -0
- package/tabs/README.md +214 -0
- package/textarea/README.md +154 -0
- package/timeline/README.md +94 -0
- package/toast/README.md +321 -0
- package/toggle/README.md +131 -0
- package/toggle-group/README.md +206 -0
- package/tooltip/README.md +211 -0
- package/types/edsis-ui-accordion.d.ts +51 -0
- package/types/edsis-ui-alert-dialog.d.ts +93 -0
- package/types/edsis-ui-alert.d.ts +37 -0
- package/types/edsis-ui-aspect-ratio.d.ts +12 -0
- package/types/edsis-ui-avatar.d.ts +51 -0
- package/types/edsis-ui-badge.d.ts +19 -0
- package/types/edsis-ui-breadcrumb.d.ts +46 -0
- package/types/edsis-ui-button-group.d.ts +26 -0
- package/types/edsis-ui-button.d.ts +22 -0
- package/types/edsis-ui-calendar.d.ts +33 -0
- package/types/edsis-ui-card.d.ts +60 -0
- package/types/edsis-ui-carousel.d.ts +86 -0
- package/types/edsis-ui-chart-area.d.ts +1 -0
- package/types/edsis-ui-chart-bar.d.ts +1 -0
- package/types/edsis-ui-chart-line.d.ts +1 -0
- package/types/edsis-ui-chart-pie.d.ts +1 -0
- package/types/edsis-ui-chart-radar.d.ts +1 -0
- package/types/edsis-ui-chart-radial.d.ts +1 -0
- package/types/edsis-ui-chart-scatter.d.ts +1 -0
- package/types/edsis-ui-chart.d.ts +1094 -0
- package/types/edsis-ui-checkbox.d.ts +35 -0
- package/types/edsis-ui-collapsible.d.ts +42 -0
- package/types/edsis-ui-combobox.d.ts +51 -0
- package/types/edsis-ui-command.d.ts +99 -0
- package/types/edsis-ui-composer.d.ts +90 -0
- package/types/edsis-ui-context-menu.d.ts +35 -0
- package/types/edsis-ui-date-picker.d.ts +41 -0
- package/types/edsis-ui-dialog.d.ts +87 -0
- package/types/edsis-ui-drawer.d.ts +1 -0
- package/types/edsis-ui-dropdown-menu.d.ts +136 -0
- package/types/edsis-ui-editor.d.ts +123 -0
- package/types/edsis-ui-empty.d.ts +50 -0
- package/types/edsis-ui-form.d.ts +141 -0
- package/types/edsis-ui-hover-card.d.ts +74 -0
- package/types/edsis-ui-input-group.d.ts +51 -0
- package/types/edsis-ui-input-otp.d.ts +136 -0
- package/types/edsis-ui-input.d.ts +16 -0
- package/types/edsis-ui-item.d.ts +88 -0
- package/types/edsis-ui-kanban.d.ts +70 -0
- package/types/edsis-ui-kbd.d.ts +16 -0
- package/types/edsis-ui-label.d.ts +11 -0
- package/types/edsis-ui-menubar.d.ts +67 -0
- package/types/edsis-ui-native-select.d.ts +26 -0
- package/types/edsis-ui-navigation-menu.d.ts +96 -0
- package/types/edsis-ui-pagination.d.ts +34 -0
- package/types/edsis-ui-pillbox.d.ts +157 -0
- package/types/edsis-ui-popover.d.ts +43 -0
- package/types/edsis-ui-progress.d.ts +17 -0
- package/types/edsis-ui-radio.d.ts +40 -0
- package/types/edsis-ui-resizable.d.ts +99 -0
- package/types/edsis-ui-scroll-area.d.ts +19 -0
- package/types/edsis-ui-select.d.ts +57 -0
- package/types/edsis-ui-separator.d.ts +14 -0
- package/types/edsis-ui-sheet.d.ts +76 -0
- package/types/edsis-ui-skeleton.d.ts +10 -0
- package/types/edsis-ui-slider.d.ts +74 -0
- package/types/edsis-ui-spinner.d.ts +13 -0
- package/types/edsis-ui-switch.d.ts +40 -0
- package/types/edsis-ui-table.d.ts +52 -0
- package/types/edsis-ui-tabs.d.ts +92 -0
- package/types/edsis-ui-textarea.d.ts +12 -0
- package/types/edsis-ui-timeline.d.ts +63 -0
- package/types/edsis-ui-toast.d.ts +38 -0
- package/types/edsis-ui-toggle-group.d.ts +89 -0
- package/types/edsis-ui-toggle.d.ts +25 -0
- package/types/edsis-ui-tooltip.d.ts +89 -0
- package/types/edsis-ui-utils.d.ts +5 -0
- package/types/edsis-ui.d.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @edsis/ui
|
|
2
|
+
|
|
3
|
+
Angular library ini berada di `library/ui` dan dipublikasikan dengan nama paket `@edsis/ui`.
|
|
4
|
+
|
|
5
|
+
Library ini menggunakan pola secondary entry point per folder. Import yang disarankan adalah langsung ke subpath yang dibutuhkan, misalnya `@edsis/ui/button` atau `@edsis/ui/chart/bar`.
|
|
6
|
+
|
|
7
|
+
## Build
|
|
8
|
+
|
|
9
|
+
Jalankan build library dengan perintah berikut:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bunx ng build ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Artefak build akan ditulis ke `dist/ui`.
|
|
16
|
+
|
|
17
|
+
## Penggunaan Lokal
|
|
18
|
+
|
|
19
|
+
Untuk import dari workspace ini, gunakan path berikut:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
@edsis/ui
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Untuk komponen atau utilitas spesifik, gunakan subpath secondary entry point:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
@edsis/ui/button
|
|
29
|
+
@edsis/ui/chart/bar
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Unit Test
|
|
33
|
+
|
|
34
|
+
Jalankan unit test library dengan perintah berikut:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
bunx ng test ui --watch=false
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Runner test di workspace ini menggunakan Vitest melalui Angular build tooling.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
Displays a vertically stacked set of interactive headings that reveal one or more content panels.
|
|
4
|
+
|
|
5
|
+
Use Accordion for FAQ blocks, settings groups, and progressive disclosure where content should stay in the same page flow.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
AccordionComponent,
|
|
12
|
+
AccordionContentComponent,
|
|
13
|
+
AccordionItemComponent,
|
|
14
|
+
AccordionTriggerComponent,
|
|
15
|
+
} from '@edsis/ui/accordion';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Composition
|
|
19
|
+
|
|
20
|
+
The Angular structure mirrors the shadcn and Radix composition while using Angular selectors and a native button trigger.
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
ui-accordion
|
|
24
|
+
├── ui-accordion-item
|
|
25
|
+
│ ├── button[ui-accordion-trigger]
|
|
26
|
+
│ └── ui-accordion-content
|
|
27
|
+
└── ui-accordion-item
|
|
28
|
+
├── button[ui-accordion-trigger]
|
|
29
|
+
└── ui-accordion-content
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Basic usage
|
|
33
|
+
|
|
34
|
+
Use `ui-accordion` as the root, wrap each section in `ui-accordion-item`, place the clickable heading on a native button with `ui-accordion-trigger`, and project body copy into `ui-accordion-content`.
|
|
35
|
+
|
|
36
|
+
Bind `[(value)]` when the parent should control the open state or seed a default open item.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<ui-accordion [(value)]="openItem" type="single" class="w-full max-w-xl">
|
|
40
|
+
<ui-accordion-item value="item-1">
|
|
41
|
+
<button ui-accordion-trigger>Is it accessible?</button>
|
|
42
|
+
<ui-accordion-content>
|
|
43
|
+
Yes. The trigger and content follow the expected accordion ARIA wiring.
|
|
44
|
+
</ui-accordion-content>
|
|
45
|
+
</ui-accordion-item>
|
|
46
|
+
</ui-accordion>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Common patterns
|
|
50
|
+
|
|
51
|
+
### Single-open FAQ
|
|
52
|
+
|
|
53
|
+
Use `type="single"` when only one item should stay open at a time.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const basicOpen = signal<string | string[] | null>('item-1');
|
|
57
|
+
|
|
58
|
+
<ui-accordion [(value)]="basicOpen" type="single" class="max-w-lg">
|
|
59
|
+
<ui-accordion-item value="item-1">...</ui-accordion-item>
|
|
60
|
+
<ui-accordion-item value="item-2">...</ui-accordion-item>
|
|
61
|
+
<ui-accordion-item value="item-3">...</ui-accordion-item>
|
|
62
|
+
</ui-accordion>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Multiple open sections
|
|
66
|
+
|
|
67
|
+
Use `type="multiple"` when more than one panel should stay open. The bound value becomes a `string[]`.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const multipleOpen = signal<string[] | null>(['notifications']);
|
|
71
|
+
|
|
72
|
+
<ui-accordion [(value)]="multipleOpen" type="multiple" class="max-w-lg">
|
|
73
|
+
<ui-accordion-item value="notifications">...</ui-accordion-item>
|
|
74
|
+
<ui-accordion-item value="privacy">...</ui-accordion-item>
|
|
75
|
+
<ui-accordion-item value="billing">...</ui-accordion-item>
|
|
76
|
+
</ui-accordion>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Disabled items
|
|
80
|
+
|
|
81
|
+
Disable an individual item with `[disabled]="true"` on `ui-accordion-item`.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const disabledOpen = signal<string | string[] | null>('history');
|
|
85
|
+
|
|
86
|
+
<ui-accordion [(value)]="disabledOpen" type="single" class="w-full">
|
|
87
|
+
<ui-accordion-item value="history">...</ui-accordion-item>
|
|
88
|
+
<ui-accordion-item value="premium" [disabled]="true">...</ui-accordion-item>
|
|
89
|
+
<ui-accordion-item value="email">...</ui-accordion-item>
|
|
90
|
+
</ui-accordion>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Bordered list
|
|
94
|
+
|
|
95
|
+
Add borders on the root and the items when the accordion should read like a boxed settings list.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const borderOpen = signal<string | string[] | null>('billing');
|
|
99
|
+
|
|
100
|
+
<ui-accordion [(value)]="borderOpen" type="single" class="max-w-lg rounded-lg border">
|
|
101
|
+
<ui-accordion-item value="billing" class="border-b px-4 last:border-b-0">...</ui-accordion-item>
|
|
102
|
+
<ui-accordion-item value="security" class="border-b px-4 last:border-b-0">...</ui-accordion-item>
|
|
103
|
+
<ui-accordion-item value="integrations" class="border-b px-4 last:border-b-0">...</ui-accordion-item>
|
|
104
|
+
</ui-accordion>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Inside a card
|
|
108
|
+
|
|
109
|
+
Accordion works well inside `ui-card` when the disclosure belongs to a larger billing or account surface.
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
const cardOpen = signal<string | string[] | null>('plans');
|
|
113
|
+
|
|
114
|
+
<ui-card class="w-full max-w-sm">
|
|
115
|
+
<ui-card-header>
|
|
116
|
+
<ui-card-title>Subscription and billing</ui-card-title>
|
|
117
|
+
<ui-card-description>Common questions about plans, payments, and cancellations.</ui-card-description>
|
|
118
|
+
</ui-card-header>
|
|
119
|
+
<ui-card-content>
|
|
120
|
+
<ui-accordion [(value)]="cardOpen" type="single">
|
|
121
|
+
<ui-accordion-item value="plans">...</ui-accordion-item>
|
|
122
|
+
<ui-accordion-item value="billing">...</ui-accordion-item>
|
|
123
|
+
<ui-accordion-item value="cancel">...</ui-accordion-item>
|
|
124
|
+
</ui-accordion>
|
|
125
|
+
</ui-card-content>
|
|
126
|
+
</ui-card>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### RTL
|
|
130
|
+
|
|
131
|
+
For right-to-left interfaces, set `dir="rtl"` on a wrapping container or manage direction globally in the app shell. The Accordion structure itself does not change.
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<section dir="rtl" lang="ar" class="max-w-md text-right">
|
|
135
|
+
<ui-accordion [(value)]="rtlOpen" type="single">
|
|
136
|
+
<ui-accordion-item value="item-1">...</ui-accordion-item>
|
|
137
|
+
<ui-accordion-item value="item-2">...</ui-accordion-item>
|
|
138
|
+
<ui-accordion-item value="item-3">...</ui-accordion-item>
|
|
139
|
+
</ui-accordion>
|
|
140
|
+
</section>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## API reference
|
|
144
|
+
|
|
145
|
+
### `AccordionComponent`
|
|
146
|
+
|
|
147
|
+
| Input | Type | Default |
|
|
148
|
+
| --------------- | ---------------------------- | ---------- |
|
|
149
|
+
| `type` | `'single' \| 'multiple'` | `'single'` |
|
|
150
|
+
| `collapsible` | `boolean` | `true` |
|
|
151
|
+
| `value` (model) | `string \| string[] \| null` | `null` |
|
|
152
|
+
| `class` | `string` | `''` |
|
|
153
|
+
|
|
154
|
+
### `AccordionItemComponent`
|
|
155
|
+
|
|
156
|
+
| Input | Type | Default |
|
|
157
|
+
| ---------- | --------- | ------- |
|
|
158
|
+
| `value` | `string` | — |
|
|
159
|
+
| `disabled` | `boolean` | `false` |
|
|
160
|
+
| `class` | `string` | `''` |
|
|
161
|
+
|
|
162
|
+
### Parts
|
|
163
|
+
|
|
164
|
+
- `button[ui-accordion-trigger]` renders the interactive heading and manages `aria-controls` plus `aria-expanded`.
|
|
165
|
+
- `ui-accordion-content` renders the panel region and links back to the trigger with `aria-labelledby`.
|
|
166
|
+
- Lower-level primitive behavior is based on the Radix Accordion pattern: <https://www.radix-ui.com/primitives/docs/components/accordion#api-reference>.
|
|
167
|
+
|
|
168
|
+
## Styling and theming
|
|
169
|
+
|
|
170
|
+
Pass `class` to the root or item parts to tune width, spacing, borders, and embedded-card layouts.
|
|
171
|
+
|
|
172
|
+
The component follows the shared library theme tokens, so standard utility classes such as `border`, `rounded-lg`, `bg-card`, `text-foreground`, and spacing utilities work as expected.
|
|
173
|
+
|
|
174
|
+
## Accessibility
|
|
175
|
+
|
|
176
|
+
- Trigger has `aria-expanded` and `aria-controls` pointing at the content id.
|
|
177
|
+
- Content has `role="region"` and `aria-labelledby` pointing back at the trigger id.
|
|
178
|
+
- `disabled` items remain visible but non-interactive and are marked with `aria-disabled`.
|
|
179
|
+
- Keep trigger text descriptive and avoid placing nested interactive controls inside the trigger button.
|
|
180
|
+
|
|
181
|
+
## Keyboard interactions
|
|
182
|
+
|
|
183
|
+
- Native button activation covers Enter and Space.
|
|
184
|
+
- Tab order follows the DOM order of the triggers and content.
|
|
185
|
+
|
|
186
|
+
## Angular notes
|
|
187
|
+
|
|
188
|
+
- The component uses Angular signal-based `model()` binding for `value`.
|
|
189
|
+
- For `type="single"`, the value is a `string | null`.
|
|
190
|
+
- For `type="multiple"`, the value is a `string[] | null`.
|
|
191
|
+
- Seed the initial open state with a signal rather than a separate `defaultValue` prop.
|
|
192
|
+
|
|
193
|
+
## Source parity
|
|
194
|
+
|
|
195
|
+
This Angular implementation follows the shadcn Accordion concepts while translating the examples to Angular selectors, standalone imports, and signal-friendly bindings.
|
package/alert/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
Displays a callout for user attention.
|
|
4
|
+
|
|
5
|
+
Use Alert for inline status callouts, destructive warnings, upgrade prompts, and other situations where the message should stay anchored in the current page flow.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { AlertActionComponent, AlertComponent, AlertDescriptionComponent, AlertTitleComponent } from '@edsis/ui/alert';
|
|
11
|
+
import { ButtonComponent } from '@edsis/ui/button';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Composition
|
|
15
|
+
|
|
16
|
+
The Angular structure mirrors the shadcn composition while leaving icon choice to the consuming app.
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
ui-alert
|
|
20
|
+
├── svg (optional icon)
|
|
21
|
+
├── ui-alert-title
|
|
22
|
+
├── ui-alert-description
|
|
23
|
+
└── ui-alert-action (optional)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<ui-alert class="max-w-md">
|
|
30
|
+
<svg aria-hidden="true" class="size-4"><!-- icon --></svg>
|
|
31
|
+
<ui-alert-title>Heads up!</ui-alert-title>
|
|
32
|
+
<ui-alert-description> You can add components and dependencies to your app using the CLI. </ui-alert-description>
|
|
33
|
+
</ui-alert>
|
|
34
|
+
|
|
35
|
+
<ui-alert class="max-w-md">
|
|
36
|
+
<ui-alert-title>Dark mode is now available</ui-alert-title>
|
|
37
|
+
<ui-alert-description> Enable it under your profile settings to get started. </ui-alert-description>
|
|
38
|
+
<ui-alert-action>
|
|
39
|
+
<button ui-button variant="outline" size="sm">Enable</button>
|
|
40
|
+
</ui-alert-action>
|
|
41
|
+
</ui-alert>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Common patterns
|
|
45
|
+
|
|
46
|
+
### Basic
|
|
47
|
+
|
|
48
|
+
Use an optional icon plus title and description for successful or informative states.
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<ui-alert class="max-w-md">
|
|
52
|
+
<svg aria-hidden="true" class="size-4"><!-- success icon --></svg>
|
|
53
|
+
<ui-alert-title>Account updated successfully</ui-alert-title>
|
|
54
|
+
<ui-alert-description>
|
|
55
|
+
Your profile information has been saved. Changes will be reflected immediately.
|
|
56
|
+
</ui-alert-description>
|
|
57
|
+
</ui-alert>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Destructive
|
|
61
|
+
|
|
62
|
+
Apply `variant="destructive"` for failures, expired sessions, and other high-priority issues.
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<ui-alert variant="destructive" class="max-w-md">
|
|
66
|
+
<svg aria-hidden="true" class="size-4"><!-- warning icon --></svg>
|
|
67
|
+
<ui-alert-title>Payment failed</ui-alert-title>
|
|
68
|
+
<ui-alert-description>
|
|
69
|
+
Your payment could not be processed. Please check your payment method and try again.
|
|
70
|
+
</ui-alert-description>
|
|
71
|
+
</ui-alert>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Action
|
|
75
|
+
|
|
76
|
+
Wrap a trailing control in `ui-alert-action`. The wrapper aligns the control at the end of the message and anchors it to the top-right on wider layouts.
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<ui-alert class="max-w-md">
|
|
80
|
+
<ui-alert-title>Dark mode is now available</ui-alert-title>
|
|
81
|
+
<ui-alert-description> Enable it under your profile settings to get started. </ui-alert-description>
|
|
82
|
+
<ui-alert-action>
|
|
83
|
+
<button ui-button variant="default" size="sm">Enable</button>
|
|
84
|
+
</ui-alert-action>
|
|
85
|
+
</ui-alert>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Custom colors
|
|
89
|
+
|
|
90
|
+
Pass custom classes to the root when the alert should adopt a contextual palette.
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<ui-alert class="max-w-md border-amber-300 bg-amber-50 text-amber-950 [&>svg]:text-amber-700">
|
|
94
|
+
<svg aria-hidden="true" class="size-4"><!-- warning icon --></svg>
|
|
95
|
+
<ui-alert-title>Your subscription will expire in 3 days.</ui-alert-title>
|
|
96
|
+
<ui-alert-description>
|
|
97
|
+
Renew now to avoid service interruption or upgrade to a paid plan to continue using the service.
|
|
98
|
+
</ui-alert-description>
|
|
99
|
+
</ui-alert>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### RTL
|
|
103
|
+
|
|
104
|
+
For right-to-left interfaces, place the alert inside a container with `dir="rtl"` or manage direction globally in the app shell.
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<section dir="rtl" lang="ar" class="max-w-md text-right">
|
|
108
|
+
<ui-alert>
|
|
109
|
+
<svg aria-hidden="true" class="size-4"><!-- icon --></svg>
|
|
110
|
+
<ui-alert-title>تم الدفع بنجاح</ui-alert-title>
|
|
111
|
+
<ui-alert-description>
|
|
112
|
+
تمت معالجة دفعتك البالغة 29.99 دولارًا. تم إرسال إيصال إلى عنوان بريدك الإلكتروني.
|
|
113
|
+
</ui-alert-description>
|
|
114
|
+
</ui-alert>
|
|
115
|
+
</section>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## API reference
|
|
119
|
+
|
|
120
|
+
### `AlertComponent`
|
|
121
|
+
|
|
122
|
+
| Input | Type | Default |
|
|
123
|
+
| --------- | ---------------------------- | ----------- |
|
|
124
|
+
| `variant` | `'default' \| 'destructive'` | `'default'` |
|
|
125
|
+
| `class` | `string` | `''` |
|
|
126
|
+
|
|
127
|
+
### `AlertTitleComponent`
|
|
128
|
+
|
|
129
|
+
| Input | Type | Default |
|
|
130
|
+
| ------- | -------- | ------- |
|
|
131
|
+
| `class` | `string` | `''` |
|
|
132
|
+
|
|
133
|
+
### `AlertDescriptionComponent`
|
|
134
|
+
|
|
135
|
+
| Input | Type | Default |
|
|
136
|
+
| ------- | -------- | ------- |
|
|
137
|
+
| `class` | `string` | `''` |
|
|
138
|
+
|
|
139
|
+
### `AlertActionComponent`
|
|
140
|
+
|
|
141
|
+
| Input | Type | Default |
|
|
142
|
+
| ------- | -------- | ------- |
|
|
143
|
+
| `class` | `string` | `''` |
|
|
144
|
+
|
|
145
|
+
### Parts
|
|
146
|
+
|
|
147
|
+
- `ui-alert-title` renders the heading of the callout.
|
|
148
|
+
- `ui-alert-description` renders the supporting copy.
|
|
149
|
+
- `ui-alert-action` is an optional layout wrapper for a trailing button or link.
|
|
150
|
+
|
|
151
|
+
Re-export: `alertVariants` and `AlertVariant`.
|
|
152
|
+
|
|
153
|
+
## Styling and theming
|
|
154
|
+
|
|
155
|
+
Tokens consumed: `--border`, `--background`, `--foreground`, `--destructive`.
|
|
156
|
+
Leading SVG children are auto-positioned via descendant selectors so an icon slots in cleanly without extra wrapper markup.
|
|
157
|
+
|
|
158
|
+
Pass `class` to the root when you need wider layouts, custom color treatments, or embedded card styling. Pass `class` to the title, description, or action parts when a specific example needs spacing or typography overrides.
|
|
159
|
+
|
|
160
|
+
## Accessibility
|
|
161
|
+
|
|
162
|
+
The root has `role="alert"` so assistive technologies announce the message when
|
|
163
|
+
it appears. For polite, non-interrupting messages, prefer a toast or another live-region pattern instead.
|
|
164
|
+
|
|
165
|
+
When you include a call-to-action, keep the control a native `<button ui-button>` or `<a ui-button>` so standard keyboard and assistive-technology behavior remains intact.
|
|
166
|
+
|
|
167
|
+
## Keyboard interactions
|
|
168
|
+
|
|
169
|
+
The alert itself does not handle keyboard input. Any nested actions inherit native keyboard behavior from the projected button or link.
|
|
170
|
+
|
|
171
|
+
## Angular notes
|
|
172
|
+
|
|
173
|
+
The Angular version keeps the same shadcn parts while translating them to standalone imports, `input()` bindings, and utility-first host classes. Icons are application-level concerns, so bring your own icon component or inline SVG instead of expecting an icon export from the alert primitive.
|
|
174
|
+
|
|
175
|
+
## Source parity
|
|
176
|
+
|
|
177
|
+
This implementation follows the shadcn Alert structure and examples while adapting the API to Angular selectors, standalone imports, and the local button primitive for action content.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Alert Dialog
|
|
2
|
+
|
|
3
|
+
Displays a modal confirmation surface for important or destructive actions where the user is expected to respond before continuing.
|
|
4
|
+
|
|
5
|
+
Use Alert Dialog for delete confirmations, permission prompts, and share or access decisions that should not dismiss accidentally on backdrop click.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
AlertDialogActionComponent,
|
|
12
|
+
AlertDialogCancelComponent,
|
|
13
|
+
AlertDialogComponent,
|
|
14
|
+
AlertDialogContentComponent,
|
|
15
|
+
AlertDialogDescriptionComponent,
|
|
16
|
+
AlertDialogFooterComponent,
|
|
17
|
+
AlertDialogHeaderComponent,
|
|
18
|
+
AlertDialogMediaComponent,
|
|
19
|
+
AlertDialogTitleComponent,
|
|
20
|
+
} from '@edsis/ui/alert-dialog';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Composition
|
|
24
|
+
|
|
25
|
+
The Angular composition keeps the shadcn structure for content and actions, with one intentional mapping difference: shadcn `AlertDialogTrigger` becomes any external control that toggles the `open` signal.
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
button[ui-button] (external trigger; sets the open signal)
|
|
29
|
+
ui-alert-dialog
|
|
30
|
+
└── ui-alert-dialog-content
|
|
31
|
+
├── ui-alert-dialog-header
|
|
32
|
+
│ ├── ui-alert-dialog-media (optional)
|
|
33
|
+
│ ├── ui-alert-dialog-title
|
|
34
|
+
│ └── ui-alert-dialog-description
|
|
35
|
+
└── ui-alert-dialog-footer
|
|
36
|
+
├── button[ui-alert-dialog-cancel]
|
|
37
|
+
└── button[ui-alert-dialog-action]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Basic usage
|
|
41
|
+
|
|
42
|
+
Use an external trigger to set the `open` model, then declare the alert content inside `ui-alert-dialog`.
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<button type="button" ui-button variant="outline" (click)="confirmOpen.set(true)">Show Dialog</button>
|
|
46
|
+
|
|
47
|
+
<ui-alert-dialog [(open)]="confirmOpen" aria-labelledby="alert-title" aria-describedby="alert-description">
|
|
48
|
+
<ui-alert-dialog-content>
|
|
49
|
+
<ui-alert-dialog-header>
|
|
50
|
+
<ui-alert-dialog-title id="alert-title">Are you absolutely sure?</ui-alert-dialog-title>
|
|
51
|
+
<ui-alert-dialog-description id="alert-description">
|
|
52
|
+
This action cannot be undone. This will permanently delete your account from our servers.
|
|
53
|
+
</ui-alert-dialog-description>
|
|
54
|
+
</ui-alert-dialog-header>
|
|
55
|
+
|
|
56
|
+
<ui-alert-dialog-footer>
|
|
57
|
+
<button type="button" ui-alert-dialog-cancel>Cancel</button>
|
|
58
|
+
<button type="button" ui-alert-dialog-action>Continue</button>
|
|
59
|
+
</ui-alert-dialog-footer>
|
|
60
|
+
</ui-alert-dialog-content>
|
|
61
|
+
</ui-alert-dialog>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Common patterns
|
|
65
|
+
|
|
66
|
+
### Small confirmation
|
|
67
|
+
|
|
68
|
+
Set `size="sm"` on `ui-alert-dialog-content` for shorter mobile-friendly confirmations.
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<ui-alert-dialog [(open)]="smallOpen">
|
|
72
|
+
<ui-alert-dialog-content size="sm">
|
|
73
|
+
<ui-alert-dialog-header>
|
|
74
|
+
<ui-alert-dialog-title>Allow accessory to connect?</ui-alert-dialog-title>
|
|
75
|
+
<ui-alert-dialog-description>
|
|
76
|
+
Do you want to allow the USB accessory to connect to this device?
|
|
77
|
+
</ui-alert-dialog-description>
|
|
78
|
+
</ui-alert-dialog-header>
|
|
79
|
+
|
|
80
|
+
<ui-alert-dialog-footer>
|
|
81
|
+
<button type="button" ui-alert-dialog-cancel>Don't allow</button>
|
|
82
|
+
<button type="button" ui-alert-dialog-action>Allow</button>
|
|
83
|
+
</ui-alert-dialog-footer>
|
|
84
|
+
</ui-alert-dialog-content>
|
|
85
|
+
</ui-alert-dialog>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Media
|
|
89
|
+
|
|
90
|
+
Use `ui-alert-dialog-media` to add an icon or other leading visual treatment above the title on mobile and beside it on larger screens.
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<ui-alert-dialog [(open)]="shareOpen">
|
|
94
|
+
<ui-alert-dialog-content>
|
|
95
|
+
<ui-alert-dialog-header>
|
|
96
|
+
<ui-alert-dialog-media>
|
|
97
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
|
98
|
+
<path d="M12 5v14" />
|
|
99
|
+
<path d="M5 12h14" />
|
|
100
|
+
<circle cx="12" cy="12" r="8" />
|
|
101
|
+
</svg>
|
|
102
|
+
</ui-alert-dialog-media>
|
|
103
|
+
<ui-alert-dialog-title>Share this project?</ui-alert-dialog-title>
|
|
104
|
+
<ui-alert-dialog-description>
|
|
105
|
+
Anyone with the link will be able to view and edit this project.
|
|
106
|
+
</ui-alert-dialog-description>
|
|
107
|
+
</ui-alert-dialog-header>
|
|
108
|
+
|
|
109
|
+
<ui-alert-dialog-footer>
|
|
110
|
+
<button type="button" ui-alert-dialog-cancel>Cancel</button>
|
|
111
|
+
<button type="button" ui-alert-dialog-action>Share</button>
|
|
112
|
+
</ui-alert-dialog-footer>
|
|
113
|
+
</ui-alert-dialog-content>
|
|
114
|
+
</ui-alert-dialog>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Destructive action
|
|
118
|
+
|
|
119
|
+
Pass `variant="destructive"` to `ui-alert-dialog-action` when the primary action is destructive.
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<ui-alert-dialog [(open)]="deleteOpen">
|
|
123
|
+
<ui-alert-dialog-content size="sm">
|
|
124
|
+
<ui-alert-dialog-header>
|
|
125
|
+
<ui-alert-dialog-media class="border-destructive/20 bg-destructive/10 text-destructive">
|
|
126
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
|
127
|
+
<path d="M3 6h18" />
|
|
128
|
+
<path d="M8 6V4h8v2" />
|
|
129
|
+
<path d="M8 10v6" />
|
|
130
|
+
<path d="M12 10v6" />
|
|
131
|
+
<path d="M16 10v6" />
|
|
132
|
+
<path d="M5 6l1 13h12l1-13" />
|
|
133
|
+
</svg>
|
|
134
|
+
</ui-alert-dialog-media>
|
|
135
|
+
<ui-alert-dialog-title>Delete chat?</ui-alert-dialog-title>
|
|
136
|
+
<ui-alert-dialog-description>
|
|
137
|
+
This permanently deletes the conversation and removes saved memories linked to it.
|
|
138
|
+
</ui-alert-dialog-description>
|
|
139
|
+
</ui-alert-dialog-header>
|
|
140
|
+
|
|
141
|
+
<ui-alert-dialog-footer>
|
|
142
|
+
<button type="button" ui-alert-dialog-cancel>Cancel</button>
|
|
143
|
+
<button type="button" ui-alert-dialog-action variant="destructive">Delete</button>
|
|
144
|
+
</ui-alert-dialog-footer>
|
|
145
|
+
</ui-alert-dialog-content>
|
|
146
|
+
</ui-alert-dialog>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### RTL
|
|
150
|
+
|
|
151
|
+
Wrap the trigger and dialog in a `dir="rtl"` container or manage direction globally in the app shell.
|
|
152
|
+
|
|
153
|
+
```html
|
|
154
|
+
<div dir="rtl" lang="ar" class="text-right">
|
|
155
|
+
<button type="button" ui-button variant="outline" (click)="rtlOpen.set(true)">إظهار الحوار</button>
|
|
156
|
+
|
|
157
|
+
<ui-alert-dialog [(open)]="rtlOpen" aria-labelledby="rtl-title" aria-describedby="rtl-description">
|
|
158
|
+
<ui-alert-dialog-content size="sm">
|
|
159
|
+
<ui-alert-dialog-header>
|
|
160
|
+
<ui-alert-dialog-title id="rtl-title">هل أنت متأكد تمامًا؟</ui-alert-dialog-title>
|
|
161
|
+
<ui-alert-dialog-description id="rtl-description">
|
|
162
|
+
لا يمكن التراجع عن هذا الإجراء. سيؤدي هذا إلى حذف حسابك نهائيًا من خوادمنا.
|
|
163
|
+
</ui-alert-dialog-description>
|
|
164
|
+
</ui-alert-dialog-header>
|
|
165
|
+
<ui-alert-dialog-footer>
|
|
166
|
+
<button type="button" ui-alert-dialog-cancel>إلغاء</button>
|
|
167
|
+
<button type="button" ui-alert-dialog-action>متابعة</button>
|
|
168
|
+
</ui-alert-dialog-footer>
|
|
169
|
+
</ui-alert-dialog-content>
|
|
170
|
+
</ui-alert-dialog>
|
|
171
|
+
</div>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## API reference
|
|
175
|
+
|
|
176
|
+
### `AlertDialogComponent`
|
|
177
|
+
|
|
178
|
+
| Input | Type | Default |
|
|
179
|
+
| ---------------------- | --------- | --------- | ------ |
|
|
180
|
+
| `open` (model) | `boolean` | `false` |
|
|
181
|
+
| `closeOnEscape` | `boolean` | `true` |
|
|
182
|
+
| `closeOnBackdropClick` | `boolean` | `false` |
|
|
183
|
+
| `showCloseButton` | `boolean` | `false` |
|
|
184
|
+
| `closeButtonLabel` | `string` | `'Close'` |
|
|
185
|
+
| `aria-labelledby` | `string | null` | `null` |
|
|
186
|
+
| `aria-describedby` | `string | null` | `null` |
|
|
187
|
+
| `class` | `string` | `''` |
|
|
188
|
+
|
|
189
|
+
Output: `openedChange: boolean`. Method: `close()`.
|
|
190
|
+
|
|
191
|
+
### `AlertDialogContentComponent`
|
|
192
|
+
|
|
193
|
+
| Input | Type | Default |
|
|
194
|
+
| ------- | ---------- | ------- | ----------- |
|
|
195
|
+
| `size` | `'default' | 'sm'` | `'default'` |
|
|
196
|
+
| `class` | `string` | `''` |
|
|
197
|
+
|
|
198
|
+
### Parts
|
|
199
|
+
|
|
200
|
+
| Part | Purpose |
|
|
201
|
+
| -------------------------------- | ------------------------------------------------------------------ |
|
|
202
|
+
| `ui-alert-dialog-header` | Title, optional media, and supporting copy wrapper |
|
|
203
|
+
| `ui-alert-dialog-title` | Primary label announced when the dialog opens |
|
|
204
|
+
| `ui-alert-dialog-description` | Supporting copy announced after the title |
|
|
205
|
+
| `ui-alert-dialog-media` | Optional icon or visual cue for the decision |
|
|
206
|
+
| `ui-alert-dialog-footer` | Action row |
|
|
207
|
+
| `button[ui-alert-dialog-cancel]` | Secondary action with outline styling that closes the dialog |
|
|
208
|
+
| `button[ui-alert-dialog-action]` | Primary action that closes the dialog and supports button variants |
|
|
209
|
+
|
|
210
|
+
Lower-level behavior is based on the Radix Alert Dialog pattern: <https://www.radix-ui.com/primitives/docs/components/alert-dialog#api-reference>.
|
|
211
|
+
|
|
212
|
+
## Styling and theming
|
|
213
|
+
|
|
214
|
+
The surface reuses the shared dialog overlay and theme tokens, while the action parts reuse the same `buttonVariants` definitions as `ui-button`.
|
|
215
|
+
|
|
216
|
+
Pass `class` to `ui-alert-dialog` when you need custom max width or spacing, `size="sm"` to `ui-alert-dialog-content` for compact confirmations, and `class` to `ui-alert-dialog-media` when a specific tone such as destructive emphasis is needed.
|
|
217
|
+
|
|
218
|
+
## Accessibility
|
|
219
|
+
|
|
220
|
+
- The surface renders with `role="dialog"` and `aria-modal="true"`.
|
|
221
|
+
- Focus is trapped while the alert dialog is open and restored to the previously active element when it closes.
|
|
222
|
+
- Backdrop click is disabled by default so confirmations do not dismiss accidentally.
|
|
223
|
+
- Keep `ui-alert-dialog-title` and `ui-alert-dialog-description` short and descriptive so assistive technologies announce useful context immediately.
|
|
224
|
+
|
|
225
|
+
## Keyboard interactions
|
|
226
|
+
|
|
227
|
+
- `Tab` and `Shift+Tab` stay inside the modal while it is open.
|
|
228
|
+
- `Escape` closes the alert dialog unless `closeOnEscape` is disabled.
|
|
229
|
+
- Native button activation handles `Enter` and `Space` for cancel and action buttons.
|
|
230
|
+
|
|
231
|
+
## Angular notes
|
|
232
|
+
|
|
233
|
+
- This implementation intentionally maps shadcn `AlertDialogTrigger` to any external trigger that owns the `open` signal.
|
|
234
|
+
- `button[ui-alert-dialog-cancel]` and `button[ui-alert-dialog-action]` close the nearest ancestor alert dialog automatically by default.
|
|
235
|
+
- Use `(click)` on the action button for side effects such as deleting or sharing, and keep `closeOnClick` enabled unless the flow needs to wait for an async result.
|
|
236
|
+
|
|
237
|
+
## Source parity
|
|
238
|
+
|
|
239
|
+
This Angular implementation keeps the shadcn information architecture, examples, and `size="sm"` content behavior while translating trigger ownership to Angular signals and dedicated attribute components for the footer actions.
|