@egose/shadcn-theme-ng 0.0.28 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/README.md +130 -13
  2. package/accordion/README.md +376 -34
  3. package/accordion/fesm2022/accordion.mjs +27 -39
  4. package/alert/README.md +343 -34
  5. package/alert/fesm2022/alert.mjs +47 -47
  6. package/alert-dialog/README.md +471 -5
  7. package/alert-dialog/fesm2022/alert-dialog.mjs +47 -47
  8. package/aspect-ratio/README.md +272 -5
  9. package/aspect-ratio/fesm2022/aspect-ratio.mjs +9 -9
  10. package/autocomplete/README.md +473 -34
  11. package/autocomplete/fesm2022/autocomplete.mjs +53 -71
  12. package/avatar/README.md +357 -5
  13. package/avatar/fesm2022/avatar.mjs +32 -32
  14. package/badge/README.md +289 -34
  15. package/badge/fesm2022/badge.mjs +57 -57
  16. package/basic-alert/README.md +324 -34
  17. package/basic-alert/fesm2022/basic-alert.mjs +6 -18
  18. package/breadcrumb/README.md +406 -5
  19. package/breadcrumb/fesm2022/breadcrumb.mjs +33 -39
  20. package/button/README.md +453 -34
  21. package/button/fesm2022/button.mjs +147 -219
  22. package/button/types/button.d.ts +7 -10
  23. package/button-group/README.md +318 -5
  24. package/button-group/fesm2022/button-group.mjs +20 -20
  25. package/calendar/README.md +328 -34
  26. package/calendar/fesm2022/calendar.mjs +29 -743
  27. package/card/README.md +331 -5
  28. package/card/fesm2022/card.mjs +33 -33
  29. package/carousel/README.md +333 -5
  30. package/carousel/fesm2022/carousel.mjs +39 -78
  31. package/checkbox/README.md +291 -34
  32. package/checkbox/fesm2022/checkbox.mjs +20 -58
  33. package/checkbox/types/checkbox.d.ts +5 -4
  34. package/collapsible/README.md +332 -5
  35. package/collapsible/fesm2022/collapsible.mjs +15 -15
  36. package/combobox/README.md +507 -5
  37. package/combobox/fesm2022/combobox.mjs +91 -224
  38. package/command/README.md +435 -5
  39. package/command/fesm2022/command.mjs +49 -109
  40. package/confirmation-dialog/README.md +272 -34
  41. package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +15 -40
  42. package/confirmation-dialog/types/confirmation-dialog.d.ts +8 -4
  43. package/context-menu/README.md +366 -5
  44. package/context-menu/fesm2022/context-menu.mjs +9 -9
  45. package/date-picker/README.md +436 -34
  46. package/date-picker/fesm2022/date-picker.mjs +64 -267
  47. package/date-picker/types/date-picker.d.ts +7 -3
  48. package/dialog/README.md +419 -34
  49. package/dialog/fesm2022/dialog.mjs +45 -71
  50. package/drawer/README.md +395 -5
  51. package/drawer/fesm2022/drawer.mjs +44 -54
  52. package/dropdown-menu/README.md +417 -5
  53. package/dropdown-menu/fesm2022/dropdown-menu.mjs +82 -70
  54. package/dropdown-menu/types/dropdown-menu.d.ts +4 -0
  55. package/empty/README.md +329 -5
  56. package/empty/fesm2022/empty.mjs +30 -30
  57. package/field/README.md +385 -5
  58. package/field/fesm2022/field.mjs +56 -72
  59. package/form-checkbox/README.md +283 -34
  60. package/form-checkbox/fesm2022/form-checkbox.mjs +25 -85
  61. package/form-checkbox/types/form-checkbox.d.ts +7 -1
  62. package/form-date-picker/README.md +293 -34
  63. package/form-date-picker/fesm2022/form-date-picker.mjs +31 -84
  64. package/form-date-picker/types/form-date-picker.d.ts +7 -1
  65. package/form-field/README.md +327 -34
  66. package/form-field/fesm2022/form-field.mjs +33 -19
  67. package/form-field/types/form-field.d.ts +28 -20
  68. package/form-field-simple/README.md +311 -34
  69. package/form-field-simple/fesm2022/form-field-simple.mjs +4 -4
  70. package/form-searchable-multiselect/README.md +332 -34
  71. package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +31 -91
  72. package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +7 -1
  73. package/form-select/README.md +321 -34
  74. package/form-select/fesm2022/form-select.mjs +32 -149
  75. package/form-select/types/form-select.d.ts +7 -1
  76. package/form-text-input/README.md +342 -34
  77. package/form-text-input/fesm2022/form-text-input.mjs +35 -149
  78. package/form-text-input/types/form-text-input.d.ts +9 -12
  79. package/form-textarea/README.md +318 -34
  80. package/form-textarea/fesm2022/form-textarea.mjs +34 -109
  81. package/form-textarea/types/form-textarea.d.ts +8 -1
  82. package/hover-card/README.md +256 -5
  83. package/hover-card/fesm2022/hover-card.mjs +19 -19
  84. package/icon/README.md +210 -34
  85. package/icon/fesm2022/icon.mjs +8 -8
  86. package/input/README.md +240 -34
  87. package/input/fesm2022/input.mjs +17 -12
  88. package/input/types/input.d.ts +2 -1
  89. package/input-group/README.md +335 -5
  90. package/input-group/fesm2022/input-group.mjs +34 -34
  91. package/input-otp/README.md +375 -5
  92. package/input-otp/fesm2022/input-otp.mjs +26 -26
  93. package/item/README.md +385 -5
  94. package/item/fesm2022/item.mjs +53 -53
  95. package/kbd/README.md +291 -5
  96. package/kbd/fesm2022/kbd.mjs +12 -12
  97. package/label/README.md +243 -34
  98. package/label/fesm2022/label.mjs +10 -10
  99. package/label/types/label.d.ts +1 -1
  100. package/layout-simple/README.md +174 -44
  101. package/layout-simple/fesm2022/layout-simple.mjs +508 -603
  102. package/layout-simple/types/layout-simple.d.ts +179 -128
  103. package/menu/README.md +418 -0
  104. package/menu/fesm2022/menu.mjs +455 -0
  105. package/menu/package.json +24 -0
  106. package/menu/types/menu.d.ts +137 -0
  107. package/menubar/README.md +343 -5
  108. package/menubar/fesm2022/menubar.mjs +13 -13
  109. package/native-select/README.md +323 -5
  110. package/native-select/fesm2022/native-select.mjs +19 -19
  111. package/navigation-menu/README.md +369 -5
  112. package/navigation-menu/fesm2022/navigation-menu.mjs +35 -47
  113. package/package.json +183 -154
  114. package/pagination/README.md +388 -5
  115. package/pagination/fesm2022/pagination.mjs +45 -331
  116. package/popover/README.md +302 -34
  117. package/popover/fesm2022/popover.mjs +30 -30
  118. package/progress/README.md +311 -5
  119. package/progress/fesm2022/progress.mjs +13 -13
  120. package/radio-group/README.md +335 -34
  121. package/radio-group/fesm2022/radio-group.mjs +26 -19
  122. package/radio-group/types/radio-group.d.ts +1 -1
  123. package/resizable/README.md +269 -5
  124. package/resizable/fesm2022/resizable.mjs +18 -26
  125. package/scroll-area/README.md +233 -5
  126. package/scroll-area/fesm2022/scroll-area.mjs +9 -9
  127. package/searchable-multiselect/README.md +294 -34
  128. package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +28 -117
  129. package/searchable-multiselect/types/searchable-multiselect.d.ts +8 -2
  130. package/select/README.md +408 -34
  131. package/select/fesm2022/select.mjs +71 -111
  132. package/select/types/select.d.ts +3 -1
  133. package/separator/README.md +193 -34
  134. package/separator/fesm2022/separator.mjs +9 -9
  135. package/separator/types/separator.d.ts +1 -1
  136. package/sheet/README.md +282 -34
  137. package/sheet/fesm2022/sheet.mjs +41 -53
  138. package/sidebar/README.md +457 -5
  139. package/sidebar/fesm2022/sidebar.mjs +125 -227
  140. package/skeleton/README.md +217 -5
  141. package/skeleton/fesm2022/skeleton.mjs +9 -9
  142. package/slider/README.md +273 -5
  143. package/slider/fesm2022/slider.mjs +10 -80
  144. package/sonner/README.md +317 -34
  145. package/sonner/fesm2022/sonner.mjs +13 -13
  146. package/spinner/README.md +255 -34
  147. package/spinner/fesm2022/spinner.mjs +11 -11
  148. package/switch/README.md +281 -34
  149. package/switch/fesm2022/switch.mjs +13 -15
  150. package/table/README.md +423 -5
  151. package/table/fesm2022/table.mjs +41 -41
  152. package/tabs/README.md +382 -34
  153. package/tabs/fesm2022/tabs.mjs +35 -111
  154. package/textarea/README.md +282 -5
  155. package/textarea/fesm2022/textarea.mjs +9 -9
  156. package/toggle/README.md +270 -5
  157. package/toggle/fesm2022/toggle.mjs +13 -13
  158. package/toggle-group/README.md +340 -5
  159. package/toggle-group/fesm2022/toggle-group.mjs +13 -13
  160. package/toggle-group/types/toggle-group.d.ts +13 -7
  161. package/tooltip/README.md +240 -34
  162. package/tooltip/fesm2022/tooltip.mjs +14 -14
  163. package/typography/README.md +271 -5
  164. package/typography/fesm2022/typography.mjs +53 -53
  165. package/typography/types/typography.d.ts +19 -19
  166. package/utils/README.md +274 -34
  167. package/utils/fesm2022/utils.mjs +68 -44
  168. package/accordion/fesm2022/accordion.mjs.map +0 -1
  169. package/alert/fesm2022/alert.mjs.map +0 -1
  170. package/alert-dialog/fesm2022/alert-dialog.mjs.map +0 -1
  171. package/aspect-ratio/fesm2022/aspect-ratio.mjs.map +0 -1
  172. package/autocomplete/fesm2022/autocomplete.mjs.map +0 -1
  173. package/avatar/fesm2022/avatar.mjs.map +0 -1
  174. package/badge/fesm2022/badge.mjs.map +0 -1
  175. package/basic-alert/fesm2022/basic-alert.mjs.map +0 -1
  176. package/breadcrumb/fesm2022/breadcrumb.mjs.map +0 -1
  177. package/button/fesm2022/button.mjs.map +0 -1
  178. package/button-group/fesm2022/button-group.mjs.map +0 -1
  179. package/calendar/fesm2022/calendar.mjs.map +0 -1
  180. package/card/fesm2022/card.mjs.map +0 -1
  181. package/carousel/fesm2022/carousel.mjs.map +0 -1
  182. package/checkbox/fesm2022/checkbox.mjs.map +0 -1
  183. package/collapsible/fesm2022/collapsible.mjs.map +0 -1
  184. package/combobox/fesm2022/combobox.mjs.map +0 -1
  185. package/command/fesm2022/command.mjs.map +0 -1
  186. package/confirmation-dialog/fesm2022/confirmation-dialog.mjs.map +0 -1
  187. package/context-menu/fesm2022/context-menu.mjs.map +0 -1
  188. package/date-picker/fesm2022/date-picker.mjs.map +0 -1
  189. package/dialog/fesm2022/dialog.mjs.map +0 -1
  190. package/drawer/fesm2022/drawer.mjs.map +0 -1
  191. package/dropdown-menu/fesm2022/dropdown-menu.mjs.map +0 -1
  192. package/empty/fesm2022/empty.mjs.map +0 -1
  193. package/field/fesm2022/field.mjs.map +0 -1
  194. package/form-checkbox/fesm2022/form-checkbox.mjs.map +0 -1
  195. package/form-date-picker/fesm2022/form-date-picker.mjs.map +0 -1
  196. package/form-field/fesm2022/form-field.mjs.map +0 -1
  197. package/form-field-simple/fesm2022/form-field-simple.mjs.map +0 -1
  198. package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs.map +0 -1
  199. package/form-select/fesm2022/form-select.mjs.map +0 -1
  200. package/form-text-input/fesm2022/form-text-input.mjs.map +0 -1
  201. package/form-textarea/fesm2022/form-textarea.mjs.map +0 -1
  202. package/hover-card/fesm2022/hover-card.mjs.map +0 -1
  203. package/icon/fesm2022/icon.mjs.map +0 -1
  204. package/input/fesm2022/input.mjs.map +0 -1
  205. package/input-group/fesm2022/input-group.mjs.map +0 -1
  206. package/input-otp/fesm2022/input-otp.mjs.map +0 -1
  207. package/item/fesm2022/item.mjs.map +0 -1
  208. package/kbd/fesm2022/kbd.mjs.map +0 -1
  209. package/label/fesm2022/label.mjs.map +0 -1
  210. package/layout-simple/fesm2022/layout-simple.mjs.map +0 -1
  211. package/menubar/fesm2022/menubar.mjs.map +0 -1
  212. package/native-select/fesm2022/native-select.mjs.map +0 -1
  213. package/navigation-menu/fesm2022/navigation-menu.mjs.map +0 -1
  214. package/pagination/fesm2022/pagination.mjs.map +0 -1
  215. package/popover/fesm2022/popover.mjs.map +0 -1
  216. package/progress/fesm2022/progress.mjs.map +0 -1
  217. package/radio-group/fesm2022/radio-group.mjs.map +0 -1
  218. package/resizable/fesm2022/resizable.mjs.map +0 -1
  219. package/scroll-area/fesm2022/scroll-area.mjs.map +0 -1
  220. package/searchable-multiselect/fesm2022/searchable-multiselect.mjs.map +0 -1
  221. package/select/fesm2022/select.mjs.map +0 -1
  222. package/separator/fesm2022/separator.mjs.map +0 -1
  223. package/sheet/fesm2022/sheet.mjs.map +0 -1
  224. package/sidebar/fesm2022/sidebar.mjs.map +0 -1
  225. package/skeleton/fesm2022/skeleton.mjs.map +0 -1
  226. package/slider/fesm2022/slider.mjs.map +0 -1
  227. package/sonner/fesm2022/sonner.mjs.map +0 -1
  228. package/spinner/fesm2022/spinner.mjs.map +0 -1
  229. package/switch/fesm2022/switch.mjs.map +0 -1
  230. package/table/fesm2022/table.mjs.map +0 -1
  231. package/tabs/fesm2022/tabs.mjs.map +0 -1
  232. package/textarea/fesm2022/textarea.mjs.map +0 -1
  233. package/toggle/fesm2022/toggle.mjs.map +0 -1
  234. package/toggle-group/fesm2022/toggle-group.mjs.map +0 -1
  235. package/tooltip/fesm2022/tooltip.mjs.map +0 -1
  236. package/typography/fesm2022/typography.mjs.map +0 -1
  237. package/utils/fesm2022/utils.mjs.map +0 -1
package/badge/README.md CHANGED
@@ -1,64 +1,319 @@
1
- # Badge
1
+ # Badge (`@egose/shadcn-theme-ng/badge`)
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.2.0.
3
+ A compact status/count chip in the shadcn/ui Badge style: a small pill for labels like "New",
4
+ "Beta", unread counts, or role tags. Use it inline in headings, list rows, tabs, and buttons where
5
+ a full [Alert](https://ui.shadcn.com/docs/components/alert) would be too heavy.
4
6
 
5
- ## Code scaffolding
7
+ This is a **standalone component with no brain primitive and no `*Imports`/`*Module` wrapper** —
8
+ import `HlmBadge` itself. Variants come from a `cva` table (`badgeVariants`), merged with
9
+ `hlm()`; the `outline` / `outline-filled` appearances add per-tone border/hover classes computed
10
+ by private helpers. An imperative `setClass()` escape hatch appends extra classes.
6
11
 
7
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
12
+ > **Ships as:** `@egose/shadcn-theme-ng/badge` and `@egose/shadcn-theme-ng-tw/badge`
13
+ > (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
14
+ > emitted Tailwind class strings differ. See the [package README](../../README.md) for install
15
+ > steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
16
+
17
+ ## Installation
8
18
 
9
19
  ```bash
10
- ng generate component component-name
20
+ # Plain Tailwind (no prefix)
21
+ npm install @egose/shadcn-theme-ng
22
+
23
+ # tw:-prefixed Tailwind variant
24
+ npm install @egose/shadcn-theme-ng-tw
11
25
  ```
12
26
 
13
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
27
+ Peer dependencies (Angular, `@spartan-ng/brain`, `@ng-icons/*`, `rxjs`, …) are documented in the
28
+ [package README](../../README.md#peer-dependencies). Runtime styling helper:
29
+ `@egose/shadcn-theme-ng/utils` (`hlm()`).
14
30
 
15
- ```bash
16
- ng generate --help
31
+ ## Imports
32
+
33
+ `HlmBadge` is exported from the subpath root (`projects/badge/src/public-api.ts`). Note there is
34
+ **no** `HlmBadgeImports` array and **no** `HlmBadgeModule` — import the component directly:
35
+
36
+ ```ts
37
+ import {
38
+ HlmBadge,
39
+ badgeVariants,
40
+ type BadgeVariants,
41
+ type BadgeVariantType,
42
+ type BadgeSizeType,
43
+ type BadgeAppearanceType,
44
+ } from '@egose/shadcn-theme-ng/badge';
45
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/badge'
17
46
  ```
18
47
 
19
- ## Building
48
+ Standalone component usage:
20
49
 
21
- To build the library, run:
50
+ ```ts
51
+ import { Component } from '@angular/core';
52
+ import { HlmBadge } from '@egose/shadcn-theme-ng/badge';
22
53
 
23
- ```bash
24
- ng build badge
54
+ @Component({
55
+ selector: 'app-demo',
56
+ standalone: true,
57
+ imports: [HlmBadge],
58
+ template: `<span hlmBadge>New</span>`,
59
+ })
60
+ export class DemoComponent {}
25
61
  ```
26
62
 
27
- This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
63
+ NgModule-based consumer — list the component in the module imports (it is standalone):
28
64
 
29
- ### Publishing the Library
65
+ ```ts
66
+ import { NgModule } from '@angular/core';
67
+ import { HlmBadge } from '@egose/shadcn-theme-ng/badge';
30
68
 
31
- Once the project is built, you can publish your library by following these steps:
69
+ @NgModule({ imports: [HlmBadge] })
70
+ export class DemoModule {}
71
+ ```
32
72
 
33
- 1. Navigate to the `dist` directory:
73
+ ## Anatomy / Structure
34
74
 
35
- ```bash
36
- cd dist/badge
37
- ```
75
+ ```html
76
+ <span hlmBadge variant="success" size="default" appearance="solid">Active</span>
77
+ <a hlmBadge variant="link" href="/changelog">v2.4.1</a>
78
+ ```
38
79
 
39
- 2. Run the `npm publish` command to publish your library to the npm registry:
40
- ```bash
41
- npm publish
42
- ```
80
+ Real selector (from source):
43
81
 
44
- ## Running unit tests
82
+ | Class | Selector(s) | Kind |
83
+ | ---------- | ----------------------------- | --------- |
84
+ | `HlmBadge` | `span[hlmBadge], a[hlmBadge]` | Component |
45
85
 
46
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
86
+ Only `<span>` and `<a>` hosts match — the component projects its content (`<ng-content>`) and
87
+ computes its host class from `variant` + `size` + `appearance` + `userClass`.
47
88
 
48
- ```bash
49
- ng test
89
+ ## API reference
90
+
91
+ ### `HlmBadge` — `span[hlmBadge], a[hlmBadge]`
92
+
93
+ | Input | Type | Default | Description |
94
+ | ------------ | --------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
95
+ | `variant` | `BadgeVariantType` | `'primary'` | Color tone (13 values, see below). |
96
+ | `size` | `BadgeSizeType` | `'default'` | `sm` (`h-5 px-2 text-xs`), `default` (`h-6 px-3 text-sm`), `lg` (`h-7 px-4 text-base`). |
97
+ | `appearance` | `BadgeAppearanceType` | `'solid'` | `solid` (filled), `outline` (white bg + tone border/text), `outline-filled` (outline + fills with the tone on hover). |
98
+ | `userClass` | `ClassValue` | `''` | Extra classes merged into the `cva` call. **Note:** unlike most `hlm*` pieces this input has **no `class` alias** — bind `[userClass]`, not `[class]`. |
99
+
100
+ | Method | Signature | Description |
101
+ | ---------- | --------------------------------- | -------------------------------------------------------------------------------- |
102
+ | `setClass` | `setClass(classes: string): void` | Imperatively appends extra classes (stored in a private signal and merged last). |
103
+
104
+ `variant` values: `primary` · `secondary` · `success` · `warning` · `danger` · `info` ·
105
+ `light` · `dark` · `accent` · `destructive` · `muted` · `link` · `ghost`.
106
+
107
+ Exported helpers: `badgeVariants` (the `cva` table — reuse it for custom badge-like hosts),
108
+ `BadgeVariants`, `BadgeVariantType`, `BadgeSizeType`, `BadgeAppearanceType`.
109
+
110
+ ## Examples
111
+
112
+ ### 1. Basic badge
113
+
114
+ ```ts
115
+ import { Component } from '@angular/core';
116
+ import { HlmBadge } from '@egose/shadcn-theme-ng/badge';
117
+
118
+ @Component({
119
+ selector: 'app-badge-basic',
120
+ standalone: true,
121
+ imports: [HlmBadge],
122
+ template: `<span hlmBadge>New</span>`,
123
+ })
124
+ export class BadgeBasicComponent {}
50
125
  ```
51
126
 
52
- ## Running end-to-end tests
127
+ ```html
128
+ <app-badge-basic />
129
+ ```
53
130
 
54
- For end-to-end (e2e) testing, run:
131
+ ### 2. All variants × solid
55
132
 
56
- ```bash
57
- ng e2e
133
+ ```ts
134
+ import { Component } from '@angular/core';
135
+ import { HlmBadge, type BadgeVariantType } from '@egose/shadcn-theme-ng/badge';
136
+
137
+ @Component({
138
+ selector: 'app-badge-variants',
139
+ standalone: true,
140
+ imports: [HlmBadge],
141
+ template: `
142
+ <div class="tw:flex tw:flex-wrap tw:gap-2">
143
+ @for (v of variants; track v) {
144
+ <span hlmBadge [variant]="v">{{ v }}</span>
145
+ }
146
+ </div>
147
+ `,
148
+ })
149
+ export class BadgeVariantsComponent {
150
+ readonly variants: BadgeVariantType[] = [
151
+ 'primary',
152
+ 'secondary',
153
+ 'success',
154
+ 'warning',
155
+ 'danger',
156
+ 'info',
157
+ 'light',
158
+ 'dark',
159
+ 'accent',
160
+ 'destructive',
161
+ 'muted',
162
+ 'link',
163
+ 'ghost',
164
+ ];
165
+ }
58
166
  ```
59
167
 
60
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
168
+ ### 3. Sizes and outline appearances
169
+
170
+ ```ts
171
+ import { Component } from '@angular/core';
172
+ import { HlmBadge } from '@egose/shadcn-theme-ng/badge';
173
+
174
+ @Component({
175
+ selector: 'app-badge-sizes',
176
+ standalone: true,
177
+ imports: [HlmBadge],
178
+ template: `
179
+ <div class="tw:flex tw:items-center tw:gap-2">
180
+ <span hlmBadge size="sm">small</span>
181
+ <span hlmBadge size="default">default</span>
182
+ <span hlmBadge size="lg">large</span>
183
+ </div>
184
+ <div class="tw:mt-3 tw:flex tw:items-center tw:gap-2">
185
+ <span hlmBadge variant="success" appearance="outline">outline</span>
186
+ <span hlmBadge variant="destructive" appearance="outline-filled">outline-filled (hover me)</span>
187
+ </div>
188
+ `,
189
+ })
190
+ export class BadgeSizesComponent {}
191
+ ```
192
+
193
+ ### 4. Link badge + count badge composed with other components
194
+
195
+ `a[hlmBadge]` is a real link host; badges also sit naturally inside buttons and headings:
196
+
197
+ ```ts
198
+ import { Component, signal } from '@angular/core';
199
+ import { HlmBadge } from '@egose/shadcn-theme-ng/badge';
200
+ import { HlmButtonImports } from '@egose/shadcn-theme-ng/button';
201
+
202
+ @Component({
203
+ selector: 'app-badge-composed',
204
+ standalone: true,
205
+ imports: [HlmBadge, ...HlmButtonImports],
206
+ template: `
207
+ <h2 class="tw:flex tw:items-center tw:gap-2 tw:text-lg tw:font-semibold">
208
+ Inbox <span hlmBadge variant="secondary" size="sm">{{ unread() }}</span>
209
+ </h2>
210
+ <p class="tw:mt-2">
211
+ <a hlmBadge variant="link" href="/changelog">v2.4.1 — see what's new</a>
212
+ </p>
213
+ <button hlmButton variant="outline" size="sm" class="tw:mt-3" (click)="unread.set(0)">
214
+ Mark all read <span hlmBadge variant="muted" size="sm">{{ unread() }}</span>
215
+ </button>
216
+ `,
217
+ })
218
+ export class BadgeComposedComponent {
219
+ readonly unread = signal(7);
220
+ }
221
+ ```
222
+
223
+ ### 5. Status mapping from domain state (signal-driven)
224
+
225
+ ```ts
226
+ import { Component, computed, signal } from '@angular/core';
227
+ import { HlmBadge, type BadgeVariantType } from '@egose/shadcn-theme-ng/badge';
228
+
229
+ type OrderState = 'pending' | 'shipped' | 'delivered' | 'cancelled';
230
+
231
+ const tone: Record<OrderState, BadgeVariantType> = {
232
+ pending: 'warning',
233
+ shipped: 'info',
234
+ delivered: 'success',
235
+ cancelled: 'destructive',
236
+ };
237
+
238
+ @Component({
239
+ selector: 'app-badge-status',
240
+ standalone: true,
241
+ imports: [HlmBadge],
242
+ template: `
243
+ <ul class="tw:flex tw:flex-col tw:gap-2">
244
+ @for (o of orders(); track o.id) {
245
+ <li class="tw:flex tw:items-center tw:gap-2 tw:text-sm">
246
+ Order #{{ o.id }}
247
+ <span hlmBadge [variant]="toneFor(o.state)" [userClass]="'tw:capitalize'">
248
+ {{ o.state }}
249
+ </span>
250
+ </li>
251
+ }
252
+ </ul>
253
+ `,
254
+ })
255
+ export class BadgeStatusComponent {
256
+ readonly orders = signal<{ id: number; state: OrderState }[]>([
257
+ { id: 101, state: 'pending' },
258
+ { id: 102, state: 'shipped' },
259
+ { id: 103, state: 'delivered' },
260
+ { id: 104, state: 'cancelled' },
261
+ ]);
262
+ toneFor = (s: OrderState) => tone[s];
263
+ }
264
+ ```
265
+
266
+ ### 6. Advanced: `badgeVariants()` for custom hosts + imperative `setClass`
267
+
268
+ Reuse the exported `cva` table for elements that cannot host the directive, and use `setClass`
269
+ for runtime class injection (e.g. from a directive or test harness):
270
+
271
+ ```ts
272
+ import { Component, viewChild } from '@angular/core';
273
+ import { HlmBadge, badgeVariants } from '@egose/shadcn-theme-ng/badge';
274
+
275
+ @Component({
276
+ selector: 'app-badge-advanced',
277
+ standalone: true,
278
+ imports: [HlmBadge],
279
+ template: `
280
+ <!-- custom host styled identically without the directive -->
281
+ <mark [class]="markClass">review</mark>
282
+ <!-- imperative escape hatch -->
283
+ <span hlmBadge #imp variant="info">runtime-tinted</span>
284
+ <button (click)="tint()">Tint via setClass()</button>
285
+ `,
286
+ })
287
+ export class BadgeAdvancedComponent {
288
+ readonly markClass = badgeVariants({ variant: 'warning', size: 'sm' });
289
+ private readonly badge = viewChild<HlmBadge>('imp');
290
+
291
+ tint() {
292
+ this.badge()?.setClass('tw:tracking-widest tw:uppercase');
293
+ }
294
+ }
295
+ ```
296
+
297
+ ## Accessibility notes
298
+
299
+ - Badges are visual labels, not live regions: dynamic counts ("7 unread") should live next to
300
+ properly labelled content (e.g. an `aria-label="Inbox, 7 unread"` heading) rather than relying
301
+ on the badge text alone.
302
+ - Never convey state by color only — the examples above pair each tone with explicit text
303
+ ("delivered", "cancelled"). The `light`/`ghost` tones are low-contrast by design; reserve them
304
+ for large/bold text or decorative contexts.
305
+ - `a[hlmBadge]` must have a real `href` (or be replaced by a `<button>`); do not use a link badge
306
+ as a click-handler span — keyboard users lose focusability.
307
+
308
+ ## Theming / CSS variables
309
+
310
+ Class-based `cva` theming over shadcn tokens (`bg-*/text-*`); no component-specific CSS variables.
311
+ Extend per-instance with `[userClass]` (note: no `class` alias on this component) or reuse
312
+ `badgeVariants()` for custom hosts.
61
313
 
62
- ## Additional Resources
314
+ ## Related subpaths
63
315
 
64
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
316
+ - `@egose/shadcn-theme-ng/alert` — full banner alerts for non-inline feedback
317
+ - `@egose/shadcn-theme-ng/basic-alert` — ready-made icon + title + description alert
318
+ - `@egose/shadcn-theme-ng/button` — action buttons badges decorate
319
+ - `@egose/shadcn-theme-ng/avatar` — identity visuals that pair with role/status badges
@@ -4,41 +4,41 @@ import { cva } from 'class-variance-authority';
4
4
  import { hlm } from '@egose/shadcn-theme-ng/utils';
5
5
 
6
6
  const badgeVariants = cva([
7
- 'inline-flex',
8
- 'items-center',
9
- 'rounded-sm',
10
- 'font-medium',
11
- 'whitespace-nowrap',
12
- 'transition-colors',
13
- 'focus-visible:outline-none',
14
- 'focus-visible:ring-1',
15
- 'focus-visible:ring-ring',
7
+ "inline-flex",
8
+ "items-center",
9
+ "rounded-sm",
10
+ "font-medium",
11
+ "whitespace-nowrap",
12
+ "transition-colors",
13
+ "focus-visible:outline-none",
14
+ "focus-visible:ring-1",
15
+ "focus-visible:ring-ring",
16
16
  ], {
17
17
  variants: {
18
18
  variant: {
19
- primary: 'bg-primary text-primary-foreground hover:bg-primary/90',
20
- secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/90',
21
- success: 'bg-success text-success-foreground hover:bg-success/90',
22
- warning: 'bg-warning text-warning-foreground hover:bg-warning/90',
23
- danger: 'bg-danger text-danger-foreground hover:bg-danger/90',
24
- info: 'bg-info text-info-foreground hover:bg-info/90',
25
- light: 'bg-light text-light-foreground hover:bg-light/90',
26
- dark: 'bg-dark text-dark-foreground hover:bg-dark/90',
27
- accent: 'bg-accent text-accent-foreground hover:bg-accent/90',
28
- destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
29
- muted: 'bg-muted text-muted-foreground hover:bg-muted/90',
30
- link: 'text-primary underline-offset-4 hover:underline',
31
- ghost: 'hover:bg-light hover:text-light-foreground',
19
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90",
20
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/90",
21
+ success: "bg-success text-success-foreground hover:bg-success/90",
22
+ warning: "bg-warning text-warning-foreground hover:bg-warning/90",
23
+ danger: "bg-danger text-danger-foreground hover:bg-danger/90",
24
+ info: "bg-info text-info-foreground hover:bg-info/90",
25
+ light: "bg-light text-light-foreground hover:bg-light/90",
26
+ dark: "bg-dark text-dark-foreground hover:bg-dark/90",
27
+ accent: "bg-accent text-accent-foreground hover:bg-accent/90",
28
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
29
+ muted: "bg-muted text-muted-foreground hover:bg-muted/90",
30
+ link: "text-primary underline-offset-4 hover:underline",
31
+ ghost: "hover:bg-light hover:text-light-foreground",
32
32
  },
33
33
  size: {
34
- sm: 'h-5 px-2 text-xs',
35
- default: 'h-6 px-3 text-sm',
36
- lg: 'h-7 px-4 text-base',
34
+ sm: "h-5 px-2 text-xs",
35
+ default: "h-6 px-3 text-sm",
36
+ lg: "h-7 px-4 text-base",
37
37
  },
38
38
  appearance: {
39
39
  solid: '',
40
- outline: 'bg-white border',
41
- 'outline-filled': 'bg-white border',
40
+ outline: "bg-white border",
41
+ 'outline-filled': "bg-white border",
42
42
  },
43
43
  },
44
44
  defaultVariants: {
@@ -81,44 +81,44 @@ class HlmBadge {
81
81
  /** Helper functions */
82
82
  getOutlineClasses(variant) {
83
83
  const colors = {
84
- primary: 'border-primary text-primary hover:bg-primary/10',
85
- secondary: 'border-secondary text-secondary hover:bg-secondary/10',
86
- success: 'border-success text-success hover:bg-success/10',
87
- warning: 'border-warning text-warning hover:bg-warning/10',
88
- danger: 'border-danger text-danger hover:bg-danger/10',
89
- info: 'border-info text-info hover:bg-info/10',
90
- light: 'border-light text-light-foreground hover:bg-light/10',
91
- dark: 'border-dark text-dark hover:bg-dark/10',
92
- accent: 'border-accent text-accent hover:bg-accent/10',
93
- destructive: 'border-destructive text-destructive hover:bg-destructive/10',
94
- muted: 'border-muted text-muted-foreground hover:bg-muted/10',
95
- link: 'text-primary',
96
- ghost: 'text-light-foreground',
84
+ primary: "border-primary text-primary hover:bg-primary/10",
85
+ secondary: "border-secondary text-secondary hover:bg-secondary/10",
86
+ success: "border-success text-success hover:bg-success/10",
87
+ warning: "border-warning text-warning hover:bg-warning/10",
88
+ danger: "border-danger text-danger hover:bg-danger/10",
89
+ info: "border-info text-info hover:bg-info/10",
90
+ light: "border-light text-light-foreground hover:bg-light/10",
91
+ dark: "border-dark text-dark hover:bg-dark/10",
92
+ accent: "border-accent text-accent hover:bg-accent/10",
93
+ destructive: "border-destructive text-destructive hover:bg-destructive/10",
94
+ muted: "border-muted text-muted-foreground hover:bg-muted/10",
95
+ link: "text-primary",
96
+ ghost: "text-light-foreground",
97
97
  };
98
98
  return colors[variant];
99
99
  }
100
100
  getOutlineFilledClasses(variant) {
101
101
  const colors = {
102
- primary: 'hover:bg-primary hover:text-primary-foreground',
103
- secondary: 'hover:bg-secondary hover:text-secondary-foreground',
104
- success: 'hover:bg-success hover:text-success-foreground',
105
- warning: 'hover:bg-warning hover:text-warning-foreground',
106
- danger: 'hover:bg-danger hover:text-danger-foreground',
107
- info: 'hover:bg-info hover:text-info-foreground',
108
- light: 'hover:bg-light hover:text-light-foreground',
109
- dark: 'hover:bg-dark hover:text-dark-foreground',
110
- accent: 'hover:bg-accent hover:text-accent-foreground',
111
- destructive: 'hover:bg-destructive hover:text-destructive-foreground',
112
- muted: 'hover:bg-muted hover:text-muted-foreground',
113
- link: 'hover:underline',
114
- ghost: 'hover:bg-light',
102
+ primary: "hover:bg-primary hover:text-primary-foreground",
103
+ secondary: "hover:bg-secondary hover:text-secondary-foreground",
104
+ success: "hover:bg-success hover:text-success-foreground",
105
+ warning: "hover:bg-warning hover:text-warning-foreground",
106
+ danger: "hover:bg-danger hover:text-danger-foreground",
107
+ info: "hover:bg-info hover:text-info-foreground",
108
+ light: "hover:bg-light hover:text-light-foreground",
109
+ dark: "hover:bg-dark hover:text-dark-foreground",
110
+ accent: "hover:bg-accent hover:text-accent-foreground",
111
+ destructive: "hover:bg-destructive hover:text-destructive-foreground",
112
+ muted: "hover:bg-muted hover:text-muted-foreground",
113
+ link: "hover:underline",
114
+ ghost: "hover:bg-light",
115
115
  };
116
116
  return colors[variant];
117
117
  }
118
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: HlmBadge, deps: [], target: i0.ɵɵFactoryTarget.Component });
119
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.7", type: HlmBadge, isStandalone: true, selector: "span[hlmBadge], a[hlmBadge]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "userClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
118
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmBadge, deps: [], target: i0.ɵɵFactoryTarget.Component });
119
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: HlmBadge, isStandalone: true, selector: "span[hlmBadge], a[hlmBadge]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "userClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
120
120
  }
121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: HlmBadge, decorators: [{
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmBadge, decorators: [{
122
122
  type: Component,
123
123
  args: [{
124
124
  selector: 'span[hlmBadge], a[hlmBadge]',
@@ -140,4 +140,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
140
140
  */
141
141
 
142
142
  export { HlmBadge, badgeVariants };
143
- //# sourceMappingURL=badge.mjs.map
143
+