@egose/shadcn-theme-ng-tw 0.1.0 → 0.3.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 (165) hide show
  1. package/README.md +2 -2
  2. package/accordion/README.md +405 -2
  3. package/alert/README.md +372 -2
  4. package/alert/fesm2022/alert.mjs +1 -1
  5. package/alert-dialog/README.md +471 -5
  6. package/aspect-ratio/README.md +272 -5
  7. package/autocomplete/README.md +502 -2
  8. package/autocomplete/fesm2022/autocomplete.mjs +1 -1
  9. package/avatar/README.md +357 -5
  10. package/badge/README.md +318 -2
  11. package/basic-alert/README.md +353 -2
  12. package/breadcrumb/README.md +406 -5
  13. package/button/README.md +482 -2
  14. package/button/fesm2022/button.mjs +85 -107
  15. package/button/types/button.d.ts +5 -8
  16. package/button-group/README.md +318 -5
  17. package/button-group/fesm2022/button-group.mjs +1 -1
  18. package/calendar/README.md +357 -2
  19. package/card/README.md +331 -5
  20. package/carousel/README.md +333 -5
  21. package/carousel/fesm2022/carousel.mjs +4 -1
  22. package/checkbox/README.md +320 -2
  23. package/checkbox/fesm2022/checkbox.mjs +6 -7
  24. package/checkbox/types/checkbox.d.ts +1 -1
  25. package/collapsible/README.md +332 -5
  26. package/combobox/README.md +507 -5
  27. package/combobox/fesm2022/combobox.mjs +5 -2
  28. package/command/README.md +435 -5
  29. package/confirmation-dialog/README.md +301 -2
  30. package/context-menu/README.md +366 -5
  31. package/date-picker/README.md +469 -2
  32. package/date-picker/fesm2022/date-picker.mjs +150 -32
  33. package/date-picker/types/date-picker.d.ts +102 -9
  34. package/dialog/README.md +448 -2
  35. package/drawer/README.md +395 -5
  36. package/dropdown-menu/README.md +417 -5
  37. package/empty/README.md +329 -5
  38. package/field/README.md +385 -5
  39. package/form-autocomplete/README.md +177 -0
  40. package/form-autocomplete/fesm2022/form-autocomplete.mjs +211 -0
  41. package/form-autocomplete/package.json +24 -0
  42. package/form-autocomplete/types/form-autocomplete.d.ts +61 -0
  43. package/form-checkbox/README.md +322 -2
  44. package/form-checkbox/fesm2022/form-checkbox.mjs +22 -9
  45. package/form-checkbox/types/form-checkbox.d.ts +23 -4
  46. package/form-combobox/README.md +202 -0
  47. package/form-combobox/fesm2022/form-combobox.mjs +273 -0
  48. package/form-combobox/package.json +24 -0
  49. package/form-combobox/types/form-combobox.d.ts +73 -0
  50. package/form-date-picker/README.md +348 -2
  51. package/form-date-picker/fesm2022/form-date-picker.mjs +60 -16
  52. package/form-date-picker/types/form-date-picker.d.ts +17 -1
  53. package/form-date-picker-multi/README.md +191 -0
  54. package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +239 -0
  55. package/form-date-picker-multi/package.json +24 -0
  56. package/form-date-picker-multi/types/form-date-picker-multi.d.ts +58 -0
  57. package/form-date-range-picker/README.md +253 -0
  58. package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +236 -0
  59. package/form-date-range-picker/package.json +24 -0
  60. package/form-date-range-picker/types/form-date-range-picker.d.ts +55 -0
  61. package/form-field/README.md +356 -2
  62. package/form-field-simple/README.md +340 -2
  63. package/form-input-otp/README.md +194 -0
  64. package/form-input-otp/fesm2022/form-input-otp.mjs +194 -0
  65. package/form-input-otp/package.json +24 -0
  66. package/form-input-otp/types/form-input-otp.d.ts +58 -0
  67. package/form-month-year-picker/README.md +188 -0
  68. package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +229 -0
  69. package/form-month-year-picker/package.json +24 -0
  70. package/form-month-year-picker/types/form-month-year-picker.d.ts +53 -0
  71. package/form-native-select/README.md +205 -0
  72. package/form-native-select/fesm2022/form-native-select.mjs +187 -0
  73. package/form-native-select/package.json +24 -0
  74. package/form-native-select/types/form-native-select.d.ts +57 -0
  75. package/form-phone-input/README.md +188 -0
  76. package/form-phone-input/fesm2022/form-phone-input.mjs +203 -0
  77. package/form-phone-input/package.json +24 -0
  78. package/form-phone-input/types/form-phone-input.d.ts +58 -0
  79. package/form-radio-group/README.md +198 -0
  80. package/form-radio-group/fesm2022/form-radio-group.mjs +211 -0
  81. package/form-radio-group/package.json +24 -0
  82. package/form-radio-group/types/form-radio-group.d.ts +63 -0
  83. package/form-searchable-multiselect/README.md +371 -2
  84. package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +19 -10
  85. package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +18 -1
  86. package/form-select/README.md +360 -2
  87. package/form-select/fesm2022/form-select.mjs +24 -15
  88. package/form-select/types/form-select.d.ts +18 -1
  89. package/form-slider/README.md +182 -0
  90. package/form-slider/fesm2022/form-slider.mjs +186 -0
  91. package/form-slider/package.json +24 -0
  92. package/form-slider/types/form-slider.d.ts +60 -0
  93. package/form-switch/README.md +173 -0
  94. package/form-switch/fesm2022/form-switch.mjs +178 -0
  95. package/form-switch/package.json +24 -0
  96. package/form-switch/types/form-switch.d.ts +50 -0
  97. package/form-text-input/README.md +381 -2
  98. package/form-text-input/fesm2022/form-text-input.mjs +19 -10
  99. package/form-text-input/types/form-text-input.d.ts +18 -1
  100. package/form-textarea/README.md +357 -2
  101. package/form-textarea/fesm2022/form-textarea.mjs +19 -10
  102. package/form-textarea/types/form-textarea.d.ts +18 -1
  103. package/form-toggle/README.md +186 -0
  104. package/form-toggle/fesm2022/form-toggle.mjs +241 -0
  105. package/form-toggle/package.json +24 -0
  106. package/form-toggle/types/form-toggle.d.ts +82 -0
  107. package/form-toggle-group/README.md +176 -0
  108. package/form-toggle-group/fesm2022/form-toggle-group.mjs +216 -0
  109. package/form-toggle-group/package.json +24 -0
  110. package/form-toggle-group/types/form-toggle-group.d.ts +65 -0
  111. package/hover-card/README.md +256 -5
  112. package/icon/README.md +239 -2
  113. package/input/README.md +269 -2
  114. package/input-group/README.md +335 -5
  115. package/input-group/fesm2022/input-group.mjs +23 -13
  116. package/input-group/types/input-group.d.ts +4 -1
  117. package/input-otp/README.md +375 -5
  118. package/item/README.md +385 -5
  119. package/item/fesm2022/item.mjs +3 -3
  120. package/kbd/README.md +291 -5
  121. package/label/README.md +272 -2
  122. package/layout-simple/README.md +193 -2
  123. package/layout-simple/fesm2022/layout-simple.mjs +877 -409
  124. package/layout-simple/types/layout-simple.d.ts +174 -137
  125. package/menu/README.md +417 -2
  126. package/menubar/README.md +343 -5
  127. package/native-select/README.md +323 -5
  128. package/native-select/fesm2022/native-select.mjs +18 -6
  129. package/native-select/types/native-select.d.ts +7 -2
  130. package/navigation-menu/README.md +369 -5
  131. package/package.json +57 -1
  132. package/pagination/README.md +388 -5
  133. package/phone-input/README.md +114 -0
  134. package/phone-input/fesm2022/phone-input.mjs +191 -0
  135. package/phone-input/package.json +24 -0
  136. package/phone-input/types/phone-input.d.ts +67 -0
  137. package/popover/README.md +331 -2
  138. package/progress/README.md +311 -5
  139. package/radio-group/README.md +364 -2
  140. package/radio-group/fesm2022/radio-group.mjs +5 -1
  141. package/resizable/README.md +269 -5
  142. package/scroll-area/README.md +233 -5
  143. package/searchable-multiselect/README.md +323 -2
  144. package/select/README.md +437 -2
  145. package/separator/README.md +222 -2
  146. package/sheet/README.md +311 -2
  147. package/sheet/fesm2022/sheet.mjs +1 -1
  148. package/sidebar/README.md +457 -5
  149. package/skeleton/README.md +217 -5
  150. package/slider/README.md +273 -5
  151. package/slider/fesm2022/slider.mjs +17 -13
  152. package/sonner/README.md +346 -2
  153. package/spinner/README.md +284 -2
  154. package/switch/README.md +310 -2
  155. package/switch/fesm2022/switch.mjs +7 -5
  156. package/switch/types/switch.d.ts +2 -1
  157. package/table/README.md +423 -5
  158. package/tabs/README.md +411 -2
  159. package/tabs/fesm2022/tabs.mjs +12 -2
  160. package/textarea/README.md +282 -5
  161. package/toggle/README.md +270 -5
  162. package/toggle-group/README.md +340 -5
  163. package/tooltip/README.md +269 -2
  164. package/typography/README.md +271 -5
  165. package/utils/README.md +303 -2
@@ -1,11 +1,278 @@
1
- # AspectRatio
1
+ # Aspect Ratio (`@egose/shadcn-theme-ng/aspect-ratio`)
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli).
3
+ A layout helper in the shadcn/ui Aspect Ratio style: it forces a box to keep a fixed
4
+ width-to-height proportion (16:9 video embeds, square thumbnails, 4:3 cards) regardless of the
5
+ viewport. Content placed inside simply fills the ratio-locked frame.
4
6
 
5
- ## Building
7
+ This is a **standalone utility directive with no brain primitive**. `HlmAspectRatio` writes the
8
+ numeric ratio to a `--ratio` CSS custom property and applies the `aspect-(--ratio)` Tailwind class;
9
+ it accepts plain numbers, coercible values, or `"W/H"` strings such as `"16/9"`.
6
10
 
7
- To build the library, run:
11
+ > **Ships as:** `@egose/shadcn-theme-ng/aspect-ratio` and `@egose/shadcn-theme-ng-tw/aspect-ratio`
12
+ > (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
13
+ > emitted Tailwind class strings differ. See the [package README](../../README.md) for install
14
+ > steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
15
+
16
+ ## Installation
8
17
 
9
18
  ```bash
10
- ng build aspect-ratio
19
+ # Plain Tailwind (no prefix)
20
+ npm install @egose/shadcn-theme-ng
21
+
22
+ # tw:-prefixed Tailwind variant
23
+ npm install @egose/shadcn-theme-ng-tw
24
+ ```
25
+
26
+ Peer dependencies (Angular core/common) are documented in the
27
+ [package README](../../README.md#peer-dependencies). Runtime styling helper:
28
+ `@egose/shadcn-theme-ng/utils` (`classes()`).
29
+
30
+ ## Imports
31
+
32
+ All symbols are exported from the subpath root (`projects/aspect-ratio/src/public-api.ts`):
33
+
34
+ ```ts
35
+ import { HlmAspectRatio, HlmAspectRatioImports, HlmAspectRatioModule } from '@egose/shadcn-theme-ng/aspect-ratio';
36
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/aspect-ratio'
37
+ ```
38
+
39
+ Standalone component — spread the `*Imports` array (single entry):
40
+
41
+ ```ts
42
+ import { Component } from '@angular/core';
43
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
44
+
45
+ @Component({
46
+ selector: 'app-demo',
47
+ standalone: true,
48
+ imports: [...HlmAspectRatioImports],
49
+ template: `...`,
50
+ })
51
+ export class DemoComponent {}
52
+ ```
53
+
54
+ NgModule-based consumer — import the module:
55
+
56
+ ```ts
57
+ import { NgModule } from '@angular/core';
58
+ import { HlmAspectRatioModule } from '@egose/shadcn-theme-ng/aspect-ratio';
59
+
60
+ @NgModule({ imports: [HlmAspectRatioModule] })
61
+ export class DemoModule {}
11
62
  ```
63
+
64
+ You can also import `HlmAspectRatio` itself directly — it is a standalone directive.
65
+
66
+ ## Anatomy / Structure
67
+
68
+ ```html
69
+ <div [hlmAspectRatio]="16 / 9">
70
+ <img src="hero.jpg" alt="Hero" class="tw:h-full tw:w-full tw:object-cover tw:rounded-md" />
71
+ </div>
72
+ ```
73
+
74
+ Real selector (from source):
75
+
76
+ | Class | Selector | Kind |
77
+ | ---------------- | ------------------ | --------- |
78
+ | `HlmAspectRatio` | `[hlmAspectRatio]` | Directive |
79
+
80
+ The host gets `data-slot="aspect-ratio"`, `[style.--ratio]` bound to the coerced value, and the
81
+ `tw:relative tw:aspect-(--ratio)` classes. Anything projected inside lays out against that frame.
82
+
83
+ ## API reference
84
+
85
+ ### `HlmAspectRatio` — `[hlmAspectRatio]`
86
+
87
+ | Input | Type | Default | Description |
88
+ | --------------------------------------- | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
89
+ | `hlmAspectRatio` (aliased as `ratio()`) | `number \| NumberInput` | `1` | Width ÷ height. Accepts numbers (`1.777`), numeric strings (`"1.5"`), or `"W/H"` strings (`"16/9"`, `"4/3"`, `"1/1"`). Values that coerce to `≤ 0` (or `NaN`) fall back to `1`. |
90
+
91
+ Coercion details (read from source): `"W/H"` strings are split on `/`, each side parsed with
92
+ `parseInt`, then divided; the result passes through `coerceNumberProperty` from
93
+ `@angular/cdk/coercion`. So `[hlmAspectRatio]="'16/9'"` ⇒ `16 / 9 ≈ 1.778`.
94
+
95
+ No outputs, no methods — purely presentational.
96
+
97
+ ## Examples
98
+
99
+ ### 1. Basic 16:9 embed
100
+
101
+ ```ts
102
+ import { Component } from '@angular/core';
103
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
104
+
105
+ @Component({
106
+ selector: 'app-ratio-basic',
107
+ standalone: true,
108
+ imports: [...HlmAspectRatioImports],
109
+ template: `
110
+ <div [hlmAspectRatio]="16 / 9" class="tw:overflow-hidden tw:rounded-md tw:bg-muted">
111
+ <img src="https://picsum.photos/800/450" alt="Landscape" class="tw:h-full tw:w-full tw:object-cover" />
112
+ </div>
113
+ `,
114
+ })
115
+ export class RatioBasicComponent {}
116
+ ```
117
+
118
+ ```html
119
+ <app-ratio-basic />
120
+ ```
121
+
122
+ ### 2. String ratios: square, portrait, cinematic
123
+
124
+ ```ts
125
+ import { Component } from '@angular/core';
126
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
127
+
128
+ @Component({
129
+ selector: 'app-ratio-strings',
130
+ standalone: true,
131
+ imports: [...HlmAspectRatioImports],
132
+ template: `
133
+ <div class="tw:grid tw:grid-cols-3 tw:gap-4">
134
+ <div hlmAspectRatio="1/1" class="tw:overflow-hidden tw:rounded-md tw:bg-muted">
135
+ <img src="https://picsum.photos/400/400" alt="Square" class="tw:h-full tw:w-full tw:object-cover" />
136
+ </div>
137
+ <div hlmAspectRatio="3/4" class="tw:overflow-hidden tw:rounded-md tw:bg-muted">
138
+ <img src="https://picsum.photos/300/400" alt="Portrait" class="tw:h-full tw:w-full tw:object-cover" />
139
+ </div>
140
+ <div hlmAspectRatio="21/9" class="tw:overflow-hidden tw:rounded-md tw:bg-muted">
141
+ <img src="https://picsum.photos/630/270" alt="Cinematic" class="tw:h-full tw:w-full tw:object-cover" />
142
+ </div>
143
+ </div>
144
+ `,
145
+ })
146
+ export class RatioStringsComponent {}
147
+ ```
148
+
149
+ ### 3. Video / iframe embed
150
+
151
+ ```ts
152
+ import { Component } from '@angular/core';
153
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
154
+
155
+ @Component({
156
+ selector: 'app-ratio-video',
157
+ standalone: true,
158
+ imports: [...HlmAspectRatioImports],
159
+ template: `
160
+ <div [hlmAspectRatio]="16 / 9" class="tw:overflow-hidden tw:rounded-lg tw:border">
161
+ <iframe
162
+ class="tw:absolute tw:inset-0 tw:h-full tw:w-full"
163
+ src="https://www.youtube.com/embed/dQw4w9WgXcQ"
164
+ title="Product tour"
165
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
166
+ allowfullscreen
167
+ ></iframe>
168
+ </div>
169
+ `,
170
+ })
171
+ export class RatioVideoComponent {}
172
+ ```
173
+
174
+ (The host is `relative`, so absolute-positioned media pins to the frame.)
175
+
176
+ ### 4. Dynamic ratio from a signal (user-selectable)
177
+
178
+ ```ts
179
+ import { Component, signal } from '@angular/core';
180
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
181
+
182
+ @Component({
183
+ selector: 'app-ratio-dynamic',
184
+ standalone: true,
185
+ imports: [...HlmAspectRatioImports],
186
+ template: `
187
+ <div class="tw:mb-3 tw:flex tw:gap-2">
188
+ @for (preset of presets; track preset.label) {
189
+ <button (click)="ratio.set(preset.value)" [disabled]="ratio() === preset.value">
190
+ {{ preset.label }}
191
+ </button>
192
+ }
193
+ </div>
194
+ <div [hlmAspectRatio]="ratio()" class="tw:overflow-hidden tw:rounded-md tw:bg-muted">
195
+ <img src="https://picsum.photos/800/600" alt="Preview" class="tw:h-full tw:w-full tw:object-cover" />
196
+ </div>
197
+ `,
198
+ })
199
+ export class RatioDynamicComponent {
200
+ readonly presets = [
201
+ { label: 'Square', value: 1 },
202
+ { label: '16:9', value: 16 / 9 },
203
+ { label: '4:3', value: 4 / 3 },
204
+ ];
205
+ readonly ratio = signal<number>(16 / 9);
206
+ }
207
+ ```
208
+
209
+ ### 5. Card media header with overlay content
210
+
211
+ ```ts
212
+ import { Component } from '@angular/core';
213
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
214
+ import { HlmBadge } from '@egose/shadcn-theme-ng/badge';
215
+
216
+ @Component({
217
+ selector: 'app-ratio-card',
218
+ standalone: true,
219
+ imports: [...HlmAspectRatioImports, HlmBadge],
220
+ template: `
221
+ <article class="tw:overflow-hidden tw:rounded-lg tw:border">
222
+ <div hlmAspectRatio="16/9" class="tw:bg-muted">
223
+ <img src="https://picsum.photos/640/360" alt="Post cover" class="tw:h-full tw:w-full tw:object-cover" />
224
+ <span hlmBadge class="tw:absolute tw:top-2 tw:left-2">New</span>
225
+ </div>
226
+ <div class="tw:p-4">
227
+ <h3 class="tw:font-semibold">Ratio-locked covers</h3>
228
+ <p class="tw:text-sm tw:text-muted-foreground">Every card image lines up, whatever the source size.</p>
229
+ </div>
230
+ </article>
231
+ `,
232
+ })
233
+ export class RatioCardComponent {}
234
+ ```
235
+
236
+ ### 6. Invalid values fall back to square
237
+
238
+ ```ts
239
+ import { Component } from '@angular/core';
240
+ import { HlmAspectRatioImports } from '@egose/shadcn-theme-ng/aspect-ratio';
241
+
242
+ @Component({
243
+ selector: 'app-ratio-fallback',
244
+ standalone: true,
245
+ imports: [...HlmAspectRatioImports],
246
+ template: `
247
+ <!-- 0, negatives, and NaN coerce to ratio 1 (square) instead of breaking layout -->
248
+ <div [hlmAspectRatio]="userValue" class="tw:bg-muted tw:rounded-md">
249
+ <p class="tw:p-4 tw:text-sm">ratio input: {{ userValue }} → renders square</p>
250
+ </div>
251
+ `,
252
+ })
253
+ export class RatioFallbackComponent {
254
+ userValue = 0; // try -2, Number.NaN, or a valid number
255
+ }
256
+ ```
257
+
258
+ ## Accessibility notes
259
+
260
+ - The directive adds no semantics (`data-slot` only) — the _content_ carries meaning. Always give
261
+ images real `alt` text and iframes a `title`.
262
+ - Do not use aspect-ratio boxes as click targets by themselves; put a real `<button>` or `<a>`
263
+ inside or around them so keyboard users get a focusable control.
264
+ - Avoid extreme ratios for text content (e.g. `21/9` with paragraphs) — zoomed text can overflow
265
+ the locked frame. Prefer images/video, or allow the frame to grow with `min-h` utilities.
266
+
267
+ ## Theming / CSS variables
268
+
269
+ The directive sets one custom property on its host: `--ratio` (unitless number). The frame size
270
+ comes from the `aspect-(--ratio)` utility reading that property. You can read or override
271
+ `--ratio` in your own CSS if you need derived sizing (e.g. `height: calc(100vw / var(--ratio))`).
272
+
273
+ ## Related subpaths
274
+
275
+ - `@egose/shadcn-theme-ng/avatar` — fixed-size ratio-locked identity images
276
+ - `@egose/shadcn-theme-ng/card` — cards whose media headers use ratio frames
277
+ - `@egose/shadcn-theme-ng/carousel` — slides with consistent media proportions
278
+ - `@egose/shadcn-theme-ng/skeleton` — ratio-shaped loading placeholders