@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/kbd/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Kbd
|
|
2
|
+
|
|
3
|
+
Keyboard key primitive for shortcuts, inline command hints, and compact keycap groups.
|
|
4
|
+
|
|
5
|
+
Use Kbd when the UI needs to display the key or shortcut that triggers an action, not to capture keyboard input itself.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { KbdComponent, KbdGroupComponent } from '@edsis/ui/kbd';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Composition
|
|
14
|
+
|
|
15
|
+
The Angular structure mirrors shadcn's `Kbd` and `KbdGroup` composition while keeping the host choice flexible.
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
kbd[ui-kbd] or ui-kbd
|
|
19
|
+
ui-kbd-group or [ui-kbd-group]
|
|
20
|
+
├── kbd[ui-kbd] or ui-kbd
|
|
21
|
+
└── kbd[ui-kbd] or ui-kbd
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Basic usage
|
|
25
|
+
|
|
26
|
+
Prefer a native `<kbd>` host when you want built-in keyboard-input semantics in the DOM.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<p class="inline-flex items-center gap-2 text-sm text-muted-foreground">
|
|
30
|
+
Press <kbd ui-kbd>Ctrl</kbd> <kbd ui-kbd>K</kbd> to open search.
|
|
31
|
+
</p>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Common patterns
|
|
35
|
+
|
|
36
|
+
### Key groups
|
|
37
|
+
|
|
38
|
+
Use `ui-kbd-group` when several keycaps should read as one shortcut cluster or one family of related commands.
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<ui-kbd-group>
|
|
42
|
+
<kbd ui-kbd>Ctrl + B</kbd>
|
|
43
|
+
<kbd ui-kbd>Ctrl + K</kbd>
|
|
44
|
+
</ui-kbd-group>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Button companion
|
|
48
|
+
|
|
49
|
+
Use Kbd inside the button label when the shortcut is part of the visible affordance.
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<button ui-button type="button" variant="outline">
|
|
53
|
+
Accept
|
|
54
|
+
<kbd ui-kbd class="translate-x-0.5">⏎</kbd>
|
|
55
|
+
</button>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Input group shortcut hint
|
|
59
|
+
|
|
60
|
+
Pair Kbd with the existing input-group primitives for launcher shortcuts and command-palette patterns.
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<ui-input-group class="max-w-sm">
|
|
64
|
+
<input ui-input-group-input placeholder="Search..." />
|
|
65
|
+
<ui-input-group-addon>
|
|
66
|
+
<span aria-hidden="true">⌕</span>
|
|
67
|
+
</ui-input-group-addon>
|
|
68
|
+
<ui-input-group-addon align="inline-end">
|
|
69
|
+
<ui-kbd-group>
|
|
70
|
+
<kbd ui-kbd>⌘</kbd>
|
|
71
|
+
<kbd ui-kbd>K</kbd>
|
|
72
|
+
</ui-kbd-group>
|
|
73
|
+
</ui-input-group-addon>
|
|
74
|
+
</ui-input-group>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Tooltip mapping
|
|
78
|
+
|
|
79
|
+
The local tooltip primitive is a thin string-based wrapper around `matTooltip`, so rich tooltip content with embedded Kbd chips maps to plain tooltip text plus optional visible shortcut chips in adjacent markup.
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<button ui-button type="button" variant="outline" [uiTooltip]="'Save changes (S)'">Save</button>
|
|
83
|
+
<button ui-button type="button" variant="outline" [uiTooltip]="'Print document (Ctrl + P)'">Print</button>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### RTL
|
|
87
|
+
|
|
88
|
+
Set `dir="rtl"` on an ancestor container when the shortcut rows live in a right-to-left layout.
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<div dir="rtl" lang="ar" class="flex flex-col items-center gap-4">
|
|
92
|
+
<ui-kbd-group>
|
|
93
|
+
<kbd ui-kbd>⌘</kbd>
|
|
94
|
+
<kbd ui-kbd>⇧</kbd>
|
|
95
|
+
<kbd ui-kbd>⌥</kbd>
|
|
96
|
+
<kbd ui-kbd>⌃</kbd>
|
|
97
|
+
</ui-kbd-group>
|
|
98
|
+
|
|
99
|
+
<ui-kbd-group>
|
|
100
|
+
<kbd ui-kbd>Ctrl</kbd>
|
|
101
|
+
<span aria-hidden="true">+</span>
|
|
102
|
+
<kbd ui-kbd>B</kbd>
|
|
103
|
+
</ui-kbd-group>
|
|
104
|
+
</div>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## API reference
|
|
108
|
+
|
|
109
|
+
| Primitive | Input | Type | Default | Notes |
|
|
110
|
+
| ------------------- | ------- | -------- | ------- | --------------------------------------------- |
|
|
111
|
+
| `KbdComponent` | `class` | `string` | `''` | Extra Tailwind classes merged onto the keycap |
|
|
112
|
+
| `KbdGroupComponent` | `class` | `string` | `''` | Extra Tailwind classes merged onto the group |
|
|
113
|
+
|
|
114
|
+
## Styling and theming
|
|
115
|
+
|
|
116
|
+
`ui-kbd` uses `border-border`, `bg-background`, `text-foreground`, and the shared `rounded-md` radius token so it stays aligned with buttons, inputs, and tooltip surfaces.
|
|
117
|
+
|
|
118
|
+
The default typography is mono, compact, and non-selectable to match shadcn's keycap treatment without introducing a separate icon or badge variant system.
|
|
119
|
+
|
|
120
|
+
## Accessibility
|
|
121
|
+
|
|
122
|
+
- Prefer `<kbd ui-kbd>` when you want native keyboard-input semantics in the markup.
|
|
123
|
+
- Keep decorative separators such as `+` or `/` `aria-hidden` when the surrounding sentence already communicates the shortcut clearly.
|
|
124
|
+
- Kbd is presentational. The actionable control still needs the accessible name, tooltip text, and focus behavior.
|
|
125
|
+
|
|
126
|
+
## Keyboard interactions
|
|
127
|
+
|
|
128
|
+
Kbd and KbdGroup do not add keyboard behavior. Buttons, links, inputs, tooltip triggers, and menu items composed with them keep their native keyboard model.
|
|
129
|
+
|
|
130
|
+
## Angular notes
|
|
131
|
+
|
|
132
|
+
- There is no React-style `data-icon="inline-end"` API. Use the normal `class` input for spacing or alignment adjustments.
|
|
133
|
+
- Import neighboring primitives such as Button, Input Group, or Tooltip separately. The Kbd entrypoint stays intentionally focused.
|
|
134
|
+
|
|
135
|
+
## Source parity
|
|
136
|
+
|
|
137
|
+
This Angular slice covers the shadcn Kbd preview, grouped keycaps, button companion usage, input-group shortcut hints, RTL examples, and API/accessibility guidance.
|
|
138
|
+
|
|
139
|
+
The upstream tooltip example uses rich tooltip content with embedded keycaps. In this repo that maps to the existing string-based tooltip directive, so the shortcut lives in the tooltip message instead of projected tooltip markup.
|
package/label/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
Renders accessible labels for native form controls and provides the wrapper-label pattern for checkbox, radio, and switch rows where the entire copy block should toggle the control.
|
|
4
|
+
|
|
5
|
+
Use `ui-label` when a lightweight visible label is enough. For richer form-field layouts with descriptions, grouped sections, and generated id wiring, use the `form` entrypoint and `label[ui-form-label]` instead.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { LabelComponent } from '@edsis/ui/label';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Composition
|
|
14
|
+
|
|
15
|
+
The label primitive supports three common structures:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
ui-label[for] + native control[id]
|
|
19
|
+
label[ui-label] + native control[id]
|
|
20
|
+
label[ui-label]
|
|
21
|
+
├── ui-checkbox | ui-radio | ui-switch
|
|
22
|
+
└── descriptive copy
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For full form-field composition, map the shadcn `Field` guidance to `ui-form-field`, `label[ui-form-label]`, and `[uiFormControl]` from `@edsis/ui/form`.
|
|
26
|
+
|
|
27
|
+
## Basic usage
|
|
28
|
+
|
|
29
|
+
Use `for` when the target control exposes a stable native `id`, such as an input or textarea.
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<div class="grid gap-2">
|
|
33
|
+
<ui-label for="email">Email address</ui-label>
|
|
34
|
+
<input ui-input id="email" type="email" placeholder="you@example.com" />
|
|
35
|
+
</div>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You can also decorate a native label host when that fits the surrounding markup more naturally.
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<label ui-label for="email">Email address</label>
|
|
42
|
+
<input ui-input id="email" type="email" placeholder="you@example.com" />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Common patterns
|
|
46
|
+
|
|
47
|
+
### Checkbox, radio, and switch rows
|
|
48
|
+
|
|
49
|
+
When the entire row should toggle the control, wrap the control and copy in `label[ui-label]`. This is the closest Angular equivalent to the upstream shadcn checkbox-plus-label preview.
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<label ui-label class="inline-flex max-w-md items-start gap-3 rounded-xl border border-border p-4">
|
|
53
|
+
<ui-checkbox class="mt-0.5" />
|
|
54
|
+
<span class="grid gap-1 leading-none">
|
|
55
|
+
<span>Email me product updates</span>
|
|
56
|
+
<span class="text-sm font-normal leading-5 text-muted-foreground">
|
|
57
|
+
Wrap checkbox, radio, and switch rows in label[ui-label] when the whole row should toggle the control.
|
|
58
|
+
</span>
|
|
59
|
+
</span>
|
|
60
|
+
</label>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Label in Field
|
|
64
|
+
|
|
65
|
+
The shadcn docs route richer field composition to `Field`. In this library, use the `form` entrypoint instead.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<ui-form-field class="max-w-md">
|
|
69
|
+
<label ui-form-label>Email address</label>
|
|
70
|
+
<input ui-input uiFormControl type="email" placeholder="you@example.com" />
|
|
71
|
+
<p ui-form-description>We will only use this address for account updates.</p>
|
|
72
|
+
</ui-form-field>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`label[ui-form-label]` automatically targets the generated control id from `[uiFormControl]`, so helper text and invalid state remain synchronized without manual `for` wiring.
|
|
76
|
+
|
|
77
|
+
### RTL
|
|
78
|
+
|
|
79
|
+
The label primitive is direction-agnostic. Apply `dir="rtl"` on a wrapper and reverse the row layout when the label and control should read from right to left.
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<div dir="rtl" lang="ar" class="max-w-md text-right">
|
|
83
|
+
<label ui-label class="flex flex-row-reverse items-start gap-3">
|
|
84
|
+
<ui-checkbox class="mt-0.5" />
|
|
85
|
+
<span class="grid gap-1 leading-none">
|
|
86
|
+
<span>قبول الشروط والأحكام</span>
|
|
87
|
+
<span class="text-sm font-normal leading-5 text-muted-foreground">
|
|
88
|
+
يظل نمط التسمية نفسه، فقط ضع الصف داخل حاوية تدعم الاتجاه من اليمين إلى اليسار.
|
|
89
|
+
</span>
|
|
90
|
+
</span>
|
|
91
|
+
</label>
|
|
92
|
+
</div>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## API reference
|
|
96
|
+
|
|
97
|
+
### `LabelComponent`
|
|
98
|
+
|
|
99
|
+
| Input | Type | Default |
|
|
100
|
+
| ------- | ---------------- | ------- |
|
|
101
|
+
| `for` | `string \| null` | `null` |
|
|
102
|
+
| `class` | `string` | `''` |
|
|
103
|
+
|
|
104
|
+
Selectors: `ui-label`, `label[ui-label]`
|
|
105
|
+
|
|
106
|
+
Related mapping: for shadcn `FieldLabel`, use `label[ui-form-label]` from `@edsis/ui/form`.
|
|
107
|
+
|
|
108
|
+
## Styling and theming
|
|
109
|
+
|
|
110
|
+
Base classes: `text-sm font-medium leading-none text-foreground`.
|
|
111
|
+
|
|
112
|
+
- Pass `class` to tune spacing, layout, or typography for a specific label row.
|
|
113
|
+
- `peer-disabled:cursor-not-allowed peer-disabled:opacity-70` dims the label when a peer-marked control is disabled.
|
|
114
|
+
- Standard library theme tokens such as `text-foreground`, `text-muted-foreground`, `border-border`, and spacing utilities compose cleanly with the label host.
|
|
115
|
+
|
|
116
|
+
## Accessibility
|
|
117
|
+
|
|
118
|
+
- Set `for` only when the target control exposes a real native id.
|
|
119
|
+
- Wrap checkbox, radio, and switch rows in `label[ui-label]` instead of relying on `for` to reach an internal input element.
|
|
120
|
+
- Inside `ui-form-field`, prefer `label[ui-form-label]` so helper text and invalid state stay synchronized with `[uiFormControl]`.
|
|
121
|
+
- Keep label text specific so screen readers and voice-control software announce useful control names.
|
|
122
|
+
|
|
123
|
+
## Keyboard interactions
|
|
124
|
+
|
|
125
|
+
- Labels themselves are not the main keyboard target; focus moves to the associated control in normal tab order.
|
|
126
|
+
- Once the control has focus, keyboard behavior belongs to that control, such as `Space` toggling a checkbox.
|
|
127
|
+
|
|
128
|
+
## Angular notes
|
|
129
|
+
|
|
130
|
+
- Use `ui-label` or `label[ui-label]` for lightweight labeling only.
|
|
131
|
+
- Use the `form` entrypoint when the surface also needs descriptions, errors, grouped sections, or generated `for` wiring.
|
|
132
|
+
- The checkbox, radio, and switch families work best with wrapper labels because those controls own their internal focusable element.
|
|
133
|
+
|
|
134
|
+
## Source parity
|
|
135
|
+
|
|
136
|
+
This Angular slice keeps the shadcn Label guidance around installation, usage, field composition, RTL behavior, and API shape while mapping the upstream `Field` recommendation to the local `form` entrypoint and expressing checkbox-like examples with a wrapper-label pattern that fits the existing Angular primitives.
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Menubar
|
|
2
|
+
|
|
3
|
+
Persistent desktop-style command strip with horizontal roving focus for top-level triggers and explicit projected menu content.
|
|
4
|
+
|
|
5
|
+
This Angular implementation follows the shadcn Menubar information architecture while intentionally reusing the existing dropdown-menu content primitives for rows, checkbox items, radio groups, labels, shortcuts, and nested submenu triggers.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
MenubarComponent,
|
|
12
|
+
MenubarContentDirective,
|
|
13
|
+
MenubarMenuComponent,
|
|
14
|
+
MenubarTriggerDirective,
|
|
15
|
+
} from '@edsis/ui/menubar';
|
|
16
|
+
import {
|
|
17
|
+
MenuCheckboxItemComponent,
|
|
18
|
+
MenuContentDirective,
|
|
19
|
+
MenuGroupComponent,
|
|
20
|
+
MenuItemComponent,
|
|
21
|
+
MenuLabelComponent,
|
|
22
|
+
MenuRadioGroupComponent,
|
|
23
|
+
MenuRadioItemComponent,
|
|
24
|
+
MenuSeparatorComponent,
|
|
25
|
+
MenuShortcutComponent,
|
|
26
|
+
MenuSurfaceComponent,
|
|
27
|
+
MenuTriggerDirective,
|
|
28
|
+
} from '@edsis/ui/dropdown-menu';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Structure
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
ui-menubar
|
|
35
|
+
├── ui-menubar-menu
|
|
36
|
+
│ ├── button[uiMenubarTrigger]
|
|
37
|
+
│ └── ng-template[uiMenubarContent]
|
|
38
|
+
│ └── ui-menu-surface
|
|
39
|
+
│ ├── ui-menu-group
|
|
40
|
+
│ │ ├── button[ui-menu-item]
|
|
41
|
+
│ │ └── button[ui-menu-item][uiMenuTrigger]
|
|
42
|
+
│ │ └── ng-template[uiMenuContent]
|
|
43
|
+
│ │ └── ui-menu-surface
|
|
44
|
+
│ ├── ui-menu-separator
|
|
45
|
+
│ ├── button[ui-menu-checkbox-item]
|
|
46
|
+
│ └── ui-menu-radio-group
|
|
47
|
+
│ └── button[ui-menu-radio-item]
|
|
48
|
+
└── ui-menubar-menu
|
|
49
|
+
├── button[uiMenubarTrigger]
|
|
50
|
+
└── ng-template[uiMenubarContent]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Basic usage
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<ui-menubar>
|
|
57
|
+
<ui-menubar-menu>
|
|
58
|
+
<button type="button" [uiMenubarTrigger]="fileMenu">File</button>
|
|
59
|
+
<ng-template uiMenubarContent #fileMenu="uiMenubarContent">
|
|
60
|
+
<ui-menu-surface class="w-56">
|
|
61
|
+
<ui-menu-group>
|
|
62
|
+
<button ui-menu-item type="button">
|
|
63
|
+
New Tab
|
|
64
|
+
<span ui-menu-shortcut>⌘T</span>
|
|
65
|
+
</button>
|
|
66
|
+
<button ui-menu-item type="button" [uiMenuTrigger]="shareMenu" side="right" align="start">
|
|
67
|
+
Share
|
|
68
|
+
<span class="ml-auto text-xs text-muted-foreground">›</span>
|
|
69
|
+
</button>
|
|
70
|
+
</ui-menu-group>
|
|
71
|
+
</ui-menu-surface>
|
|
72
|
+
</ng-template>
|
|
73
|
+
</ui-menubar-menu>
|
|
74
|
+
</ui-menubar>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Common patterns
|
|
78
|
+
|
|
79
|
+
### Basic command strip
|
|
80
|
+
|
|
81
|
+
Use one `ui-menubar-menu` per top-level trigger. The root owns horizontal roving focus, so only one trigger participates in tab order at a time.
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<ui-menubar>
|
|
85
|
+
<ui-menubar-menu>
|
|
86
|
+
<button type="button" [uiMenubarTrigger]="basicFileMenu">File</button>
|
|
87
|
+
<ng-template uiMenubarContent #basicFileMenu="uiMenubarContent">
|
|
88
|
+
<ui-menu-surface class="w-48">
|
|
89
|
+
<button ui-menu-item type="button">New Tab</button>
|
|
90
|
+
<button ui-menu-item type="button">Open Recent</button>
|
|
91
|
+
<button ui-menu-item type="button" [disabled]="true">Import from iCloud</button>
|
|
92
|
+
</ui-menu-surface>
|
|
93
|
+
</ng-template>
|
|
94
|
+
</ui-menubar-menu>
|
|
95
|
+
</ui-menubar>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Checkbox and radio rows
|
|
99
|
+
|
|
100
|
+
The top-level strip stays on `menubar`, while toggleable content rows remain on the dropdown-menu primitives that already own those semantics.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
const showSidebar = signal(true);
|
|
104
|
+
const editorTheme = signal<'light' | 'dark' | 'system'>('system');
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<ui-menubar>
|
|
109
|
+
<ui-menubar-menu>
|
|
110
|
+
<button type="button" [uiMenubarTrigger]="viewMenu">View</button>
|
|
111
|
+
<ng-template uiMenubarContent #viewMenu="uiMenubarContent">
|
|
112
|
+
<ui-menu-surface class="w-56">
|
|
113
|
+
<ui-menu-group>
|
|
114
|
+
<button ui-menu-checkbox-item type="button" [(checked)]="showSidebar">Sidebar</button>
|
|
115
|
+
</ui-menu-group>
|
|
116
|
+
<ui-menu-separator />
|
|
117
|
+
<ui-menu-label [inset]="true">Theme</ui-menu-label>
|
|
118
|
+
<ui-menu-radio-group [(value)]="editorTheme">
|
|
119
|
+
<button ui-menu-radio-item type="button" value="light">Light</button>
|
|
120
|
+
<button ui-menu-radio-item type="button" value="dark">Dark</button>
|
|
121
|
+
<button ui-menu-radio-item type="button" value="system">System</button>
|
|
122
|
+
</ui-menu-radio-group>
|
|
123
|
+
</ui-menu-surface>
|
|
124
|
+
</ng-template>
|
|
125
|
+
</ui-menubar-menu>
|
|
126
|
+
</ui-menubar>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Submenus
|
|
130
|
+
|
|
131
|
+
Map shadcn `MenubarSub` to `[uiMenuTrigger]` on a `button[ui-menu-item]`. This keeps overlay ownership explicit and lets the shared menu trigger keep submenu keyboard behavior in one place.
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<ng-template uiMenuContent #findMenu="uiMenuContent">
|
|
135
|
+
<ui-menu-surface class="w-44">
|
|
136
|
+
<button ui-menu-item type="button">Search the web</button>
|
|
137
|
+
<button ui-menu-item type="button">Find...</button>
|
|
138
|
+
<button ui-menu-item type="button">Find Next</button>
|
|
139
|
+
</ui-menu-surface>
|
|
140
|
+
</ng-template>
|
|
141
|
+
|
|
142
|
+
<ui-menubar>
|
|
143
|
+
<ui-menubar-menu>
|
|
144
|
+
<button type="button" [uiMenubarTrigger]="editMenu">Edit</button>
|
|
145
|
+
<ng-template uiMenubarContent #editMenu="uiMenubarContent">
|
|
146
|
+
<ui-menu-surface class="w-56">
|
|
147
|
+
<button ui-menu-item type="button" [uiMenuTrigger]="findMenu" side="right" align="start">
|
|
148
|
+
Find
|
|
149
|
+
<span class="ml-auto text-xs text-muted-foreground">›</span>
|
|
150
|
+
</button>
|
|
151
|
+
</ui-menu-surface>
|
|
152
|
+
</ng-template>
|
|
153
|
+
</ui-menubar-menu>
|
|
154
|
+
</ui-menubar>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Icons and shortcuts
|
|
158
|
+
|
|
159
|
+
Project inline icons and shortcut hints directly into the row content.
|
|
160
|
+
|
|
161
|
+
```html
|
|
162
|
+
<ui-menu-surface class="w-56">
|
|
163
|
+
<button ui-menu-item type="button">
|
|
164
|
+
<ui-nav-icon name="description" [size]="16" class="text-muted-foreground" />
|
|
165
|
+
New File
|
|
166
|
+
<span ui-menu-shortcut>⌘N</span>
|
|
167
|
+
</button>
|
|
168
|
+
<button ui-menu-item type="button" variant="destructive">
|
|
169
|
+
<ui-nav-icon name="delete" [size]="16" class="text-current" />
|
|
170
|
+
Delete
|
|
171
|
+
</button>
|
|
172
|
+
</ui-menu-surface>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### RTL
|
|
176
|
+
|
|
177
|
+
The root menubar respects computed direction for left and right movement. Apply `dir="rtl"` directly to the projected menu surface when the content itself should render right-to-left.
|
|
178
|
+
|
|
179
|
+
```html
|
|
180
|
+
<section dir="rtl" lang="ar" class="text-right">
|
|
181
|
+
<ui-menubar>
|
|
182
|
+
<ui-menubar-menu>
|
|
183
|
+
<button type="button" [uiMenubarTrigger]="rtlFileMenu">ملف</button>
|
|
184
|
+
<ng-template uiMenubarContent #rtlFileMenu="uiMenubarContent">
|
|
185
|
+
<ui-menu-surface dir="rtl" lang="ar" class="w-56 text-right">
|
|
186
|
+
<button ui-menu-item type="button">تبويب جديد <span ui-menu-shortcut>⌘T</span></button>
|
|
187
|
+
<button ui-menu-item type="button">نافذة جديدة <span ui-menu-shortcut>⌘N</span></button>
|
|
188
|
+
</ui-menu-surface>
|
|
189
|
+
</ng-template>
|
|
190
|
+
</ui-menubar-menu>
|
|
191
|
+
</ui-menubar>
|
|
192
|
+
</section>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## API Reference
|
|
196
|
+
|
|
197
|
+
### `MenubarComponent`
|
|
198
|
+
|
|
199
|
+
| Input | Type | Default |
|
|
200
|
+
| ------- | --------- | ------- |
|
|
201
|
+
| `class` | `string` | `''` |
|
|
202
|
+
| `loop` | `boolean` | `true` |
|
|
203
|
+
|
|
204
|
+
Role: `menubar`.
|
|
205
|
+
|
|
206
|
+
### `MenubarMenuComponent`
|
|
207
|
+
|
|
208
|
+
Structural wrapper for one top-level trigger plus its `uiMenubarContent` template.
|
|
209
|
+
|
|
210
|
+
### `MenubarTriggerDirective`
|
|
211
|
+
|
|
212
|
+
| Input | Type | Default |
|
|
213
|
+
| ------------------ | ------------------------------ | --------- |
|
|
214
|
+
| `uiMenubarTrigger` | `MenubarContentDirective` | required |
|
|
215
|
+
| `align` | `'start' \| 'center' \| 'end'` | `'start'` |
|
|
216
|
+
| `disabled` | `boolean` | `false` |
|
|
217
|
+
|
|
218
|
+
Output: `openedChange: boolean`.
|
|
219
|
+
|
|
220
|
+
Methods: `open()`, `close()`, `toggle()`, `focus()`.
|
|
221
|
+
|
|
222
|
+
### `MenubarContentDirective`
|
|
223
|
+
|
|
224
|
+
Projected overlay template for a top-level menubar trigger.
|
|
225
|
+
|
|
226
|
+
### Dropdown-menu parts reused in content
|
|
227
|
+
|
|
228
|
+
Import these from `@edsis/ui/dropdown-menu`:
|
|
229
|
+
|
|
230
|
+
- `MenuSurfaceComponent`
|
|
231
|
+
- `MenuItemComponent`
|
|
232
|
+
- `MenuCheckboxItemComponent`
|
|
233
|
+
- `MenuRadioGroupComponent`
|
|
234
|
+
- `MenuRadioItemComponent`
|
|
235
|
+
- `MenuLabelComponent`
|
|
236
|
+
- `MenuSeparatorComponent`
|
|
237
|
+
- `MenuShortcutComponent`
|
|
238
|
+
- `MenuTriggerDirective`
|
|
239
|
+
- `MenuContentDirective`
|
|
240
|
+
|
|
241
|
+
## Styling and theming
|
|
242
|
+
|
|
243
|
+
- Pass `class` to `ui-menubar` when the root needs width, border, or layout changes.
|
|
244
|
+
- Style content surfaces on `ui-menu-surface`, not on the root menubar strip.
|
|
245
|
+
- Use shared theme tokens such as `border-border`, `bg-background`, `bg-accent`, and `text-muted-foreground` for visual consistency.
|
|
246
|
+
|
|
247
|
+
## Accessibility
|
|
248
|
+
|
|
249
|
+
- Top-level triggers expose `role="menuitem"`, `aria-haspopup="menu"`, and `aria-expanded`.
|
|
250
|
+
- The root menubar keeps one active tab stop, matching desktop menubar behavior.
|
|
251
|
+
- Projected content rows keep the accessible menu, checkbox, and radio roles from dropdown-menu.
|
|
252
|
+
- Disabled rows stay visible, announce their disabled state, and are skipped by roving focus.
|
|
253
|
+
|
|
254
|
+
## Keyboard interactions
|
|
255
|
+
|
|
256
|
+
- `ArrowLeft` and `ArrowRight` move across top-level triggers.
|
|
257
|
+
- `Home` and `End` jump to the first and last top-level trigger.
|
|
258
|
+
- `ArrowDown` opens the active menu and focuses its first enabled item.
|
|
259
|
+
- `ArrowRight` opens right-side submenu rows built with `[uiMenuTrigger] side="right"`.
|
|
260
|
+
|
|
261
|
+
## Angular Notes
|
|
262
|
+
|
|
263
|
+
- Menubar is intentionally split across two entrypoints: `menubar` for the persistent strip, `dropdown-menu` for the shared content rows.
|
|
264
|
+
- This avoids duplicating the same menu item semantics in two packages while still exposing a dedicated shadcn-style top-level component.
|
|
265
|
+
- Use native buttons for triggers so keyboard activation and disabled behavior stay predictable.
|
|
266
|
+
|
|
267
|
+
## Source parity
|
|
268
|
+
|
|
269
|
+
This slice keeps the shadcn Menubar command patterns, examples, keyboard expectations, and RTL guidance while making Angular overlay ownership explicit through `uiMenubarContent` and the existing dropdown-menu primitives.
|