@egose/shadcn-theme-ng-tw 0.1.0 → 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.
- package/README.md +1 -1
- package/accordion/README.md +405 -2
- package/alert/README.md +372 -2
- package/alert-dialog/README.md +471 -5
- package/aspect-ratio/README.md +272 -5
- package/autocomplete/README.md +502 -2
- package/avatar/README.md +357 -5
- package/badge/README.md +318 -2
- package/basic-alert/README.md +353 -2
- package/breadcrumb/README.md +406 -5
- package/button/README.md +482 -2
- package/button/fesm2022/button.mjs +85 -107
- package/button/types/button.d.ts +5 -8
- package/button-group/README.md +318 -5
- package/button-group/fesm2022/button-group.mjs +1 -1
- package/calendar/README.md +357 -2
- package/card/README.md +331 -5
- package/carousel/README.md +333 -5
- package/carousel/fesm2022/carousel.mjs +4 -1
- package/checkbox/README.md +320 -2
- package/collapsible/README.md +332 -5
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +4 -1
- package/command/README.md +435 -5
- package/confirmation-dialog/README.md +301 -2
- package/context-menu/README.md +366 -5
- package/date-picker/README.md +465 -2
- package/date-picker/fesm2022/date-picker.mjs +2 -2
- package/dialog/README.md +448 -2
- package/drawer/README.md +395 -5
- package/dropdown-menu/README.md +417 -5
- package/empty/README.md +329 -5
- package/field/README.md +385 -5
- package/form-checkbox/README.md +312 -2
- package/form-date-picker/README.md +322 -2
- package/form-field/README.md +356 -2
- package/form-field-simple/README.md +340 -2
- package/form-searchable-multiselect/README.md +361 -2
- package/form-select/README.md +350 -2
- package/form-text-input/README.md +371 -2
- package/form-textarea/README.md +347 -2
- package/hover-card/README.md +256 -5
- package/icon/README.md +239 -2
- package/input/README.md +269 -2
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +3 -3
- package/input-otp/README.md +375 -5
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +3 -3
- package/kbd/README.md +291 -5
- package/label/README.md +272 -2
- package/layout-simple/README.md +193 -2
- package/layout-simple/fesm2022/layout-simple.mjs +877 -409
- package/layout-simple/types/layout-simple.d.ts +174 -137
- package/menu/README.md +417 -2
- package/menubar/README.md +343 -5
- package/native-select/README.md +323 -5
- package/navigation-menu/README.md +369 -5
- package/package.json +1 -1
- package/pagination/README.md +388 -5
- package/popover/README.md +331 -2
- package/progress/README.md +311 -5
- package/radio-group/README.md +364 -2
- package/radio-group/fesm2022/radio-group.mjs +5 -1
- package/resizable/README.md +269 -5
- package/scroll-area/README.md +233 -5
- package/searchable-multiselect/README.md +323 -2
- package/select/README.md +437 -2
- package/separator/README.md +222 -2
- package/sheet/README.md +311 -2
- package/sidebar/README.md +457 -5
- package/skeleton/README.md +217 -5
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +17 -13
- package/sonner/README.md +346 -2
- package/spinner/README.md +284 -2
- package/switch/README.md +310 -2
- package/table/README.md +423 -5
- package/tabs/README.md +411 -2
- package/tabs/fesm2022/tabs.mjs +12 -2
- package/textarea/README.md +282 -5
- package/toggle/README.md +270 -5
- package/toggle-group/README.md +340 -5
- package/tooltip/README.md +269 -2
- package/typography/README.md +271 -5
- package/utils/README.md +303 -2
package/item/README.md
CHANGED
|
@@ -1,11 +1,391 @@
|
|
|
1
|
-
# Item
|
|
1
|
+
# Item (`@egose/shadcn-theme-ng/item`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`Item` is a set of composable row primitives for stacked list content — settings rows, task lists, notification feeds, dropdown-menu content — the shadcn/ui _Item_ equivalent. The `hlmItem` container lays out media, content (title + description), and actions in one wrapping flex row; `hlmItemGroup` stacks rows; header/footer, separator, and cva `variant`/`size` props cover the rest. All styling-only directives except the separator (spartan-ng `BrnSeparator`).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **Ships as:** `@egose/shadcn-theme-ng/item` (plain Tailwind) and `@egose/shadcn-theme-ng-tw/item` (`tw:`-prefixed variant). See the [package README](../../README.md) for installation, peer dependencies, and the Tailwind-variant contract. Do not publish this project directory independently.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
# Plain Tailwind (no prefix)
|
|
11
|
+
npm install @egose/shadcn-theme-ng
|
|
12
|
+
|
|
13
|
+
# Or the tw:-prefixed variant
|
|
14
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Peer dependencies (Angular, CDK, `@spartan-ng/brain`, `rxjs`) are documented in the [package README](../../README.md#peer-dependencies).
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { HlmItemImports } from '@egose/shadcn-theme-ng/item';
|
|
21
|
+
// tw variant:
|
|
22
|
+
// import { HlmItemImports } from '@egose/shadcn-theme-ng-tw/item';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Imports
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// Standalone component — spread the imports array:
|
|
29
|
+
import { HlmItemImports } from '@egose/shadcn-theme-ng/item';
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
standalone: true,
|
|
33
|
+
imports: [HlmItemImports],
|
|
34
|
+
template: `
|
|
35
|
+
<div hlmItemGroup>
|
|
36
|
+
<div hlmItem>
|
|
37
|
+
<div hlmItemMedia variant="icon">…</div>
|
|
38
|
+
<div hlmItemContent>
|
|
39
|
+
<p hlmItemTitle>Title</p>
|
|
40
|
+
<p hlmItemDescription>Description</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div hlmItemActions>…</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class MyComp {}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// NgModule-based — import the module:
|
|
52
|
+
import { HlmItemModule } from '@egose/shadcn-theme-ng/item';
|
|
53
|
+
|
|
54
|
+
@NgModule({ imports: [HlmItemModule] })
|
|
55
|
+
export class MyModule {}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Exported from `src/public-api.ts`: `HlmItem`, `HlmItemActions`, `HlmItemContent`, `HlmItemDescription`, `HlmItemFooter`, `HlmItemGroup`, `HlmItemHeader`, `HlmItemMedia`, `HlmItemSeparator`, `HlmItemTitle`, the `ItemVariants` / `ItemMediaVariants` types, `HlmItemConfig` / `provideHlmItemConfig` / `injectHlmItemConfig` / `provideHlmItemMediaConfig` / `injectHlmItemMediaConfig` (from `hlm-item-token`), plus `HlmItemImports` and `HlmItemModule`.
|
|
59
|
+
|
|
60
|
+
## Anatomy / Structure
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<div hlmItemGroup>
|
|
64
|
+
<article hlmItem variant="outline" size="default">
|
|
65
|
+
<div hlmItemMedia variant="icon"><!-- icon or avatar --></div>
|
|
66
|
+
|
|
67
|
+
<div hlmItemContent>
|
|
68
|
+
<div hlmItemHeader>
|
|
69
|
+
<p hlmItemTitle>Row title</p>
|
|
70
|
+
<!-- trailing meta -->
|
|
71
|
+
</div>
|
|
72
|
+
<p hlmItemDescription>Secondary line, clamps to 2 lines.</p>
|
|
73
|
+
<div hlmItemFooter>
|
|
74
|
+
<span>Footer meta</span>
|
|
75
|
+
<div hlmItemActions>
|
|
76
|
+
<button hlmBtn size="sm">Open</button>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</article>
|
|
81
|
+
|
|
82
|
+
<div hlmItemSeparator></div>
|
|
83
|
+
|
|
84
|
+
<article hlmItem size="sm">…</article>
|
|
85
|
+
</div>
|
|
11
86
|
```
|
|
87
|
+
|
|
88
|
+
Real selectors (each works as attribute or element): `[hlmItem]`/`hlm-item`, `[hlmItemGroup]`/`hlm-item-group`, `[hlmItemMedia]`/`hlm-item-media`, `[hlmItemContent]`/`hlm-item-content`, `[hlmItemTitle]`/`hlm-item-title`, `[hlmItemDescription]`/`hlm-item-description`, `[hlmItemHeader]`/`hlm-item-header`, `[hlmItemFooter]`/`hlm-item-footer`, `[hlmItemActions]`/`hlm-item-actions`, `[hlmItemSeparator]`/`hlm-item-separator` (hostDirectives: `BrnSeparator` with `orientation` input).
|
|
89
|
+
|
|
90
|
+
## API reference
|
|
91
|
+
|
|
92
|
+
### `[hlmItem]` — `HlmItem`
|
|
93
|
+
|
|
94
|
+
| Input | Type | Default | Description |
|
|
95
|
+
| --------- | ----------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `variant` | `'default' \| 'outline' \| 'muted'` | `'default'` | `default` = transparent border; `outline` = bordered; `muted` = muted fill (reflected as `data-variant`). |
|
|
97
|
+
| `size` | `'default' \| 'sm' \| 'xs'` | `'default'` | Density: `default` (gap-3.5, px-4, py-3.5) → `sm` → `xs` (reflected as `data-size`). `xs` also zeroes padding inside dropdown-menu content. |
|
|
98
|
+
|
|
99
|
+
`ItemVariants` is the cva `VariantProps` type. Defaults come from `injectHlmItemConfig()` — override globally with `provideHlmItemConfig({ variant: 'outline' })`.
|
|
100
|
+
|
|
101
|
+
### `[hlmItemMedia]` — `HlmItemMedia`
|
|
102
|
+
|
|
103
|
+
| Input | Type | Default | Description |
|
|
104
|
+
| --------- | -------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `variant` | `'default' \| 'icon' \| 'image'` | `'default'` | `icon` = icon sizing hook; `image` = fixed `size-10` rounded cover frame (shrinks with item `size`). |
|
|
106
|
+
|
|
107
|
+
Default from `injectHlmItemMediaConfig()`; override with `provideHlmItemMediaConfig({ variant: 'icon' })`.
|
|
108
|
+
|
|
109
|
+
### Layout pieces (no inputs/outputs)
|
|
110
|
+
|
|
111
|
+
| Directive | `data-slot` | Role |
|
|
112
|
+
| -------------------- | ------------------ | ----------------------------------------------------------------- |
|
|
113
|
+
| `HlmItemGroup` | `item-group` | Vertical stack (`flex-col`, gap adapts to child `size`). |
|
|
114
|
+
| `HlmItemContent` | `item-content` | Flex-1 column filling the space between media and actions. |
|
|
115
|
+
| `HlmItemTitle` | `item-title` | Medium semibold single-line title (`line-clamp-1`). |
|
|
116
|
+
| `HlmItemDescription` | `item-description` | Muted two-line secondary text (`line-clamp-2`, links underlined). |
|
|
117
|
+
| `HlmItemHeader` | `item-header` | Full-width top row inside content (`justify-between`). |
|
|
118
|
+
| `HlmItemFooter` | `item-footer` | Full-width bottom row inside content (`justify-between`). |
|
|
119
|
+
| `HlmItemActions` | `item-actions` | Right-aligned control cluster. |
|
|
120
|
+
|
|
121
|
+
### `[hlmItemSeparator]` — `HlmItemSeparator`
|
|
122
|
+
|
|
123
|
+
`hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation'] }]` + `hlmSeparatorClass` with `tw:my-2`. Accepts `orientation` (`horizontal` default) from the brain separator.
|
|
124
|
+
|
|
125
|
+
## Examples
|
|
126
|
+
|
|
127
|
+
### 1. Basic stacked list with all variants
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { Component } from '@angular/core';
|
|
131
|
+
import { HlmItemImports } from '@egose/shadcn-theme-ng/item';
|
|
132
|
+
|
|
133
|
+
@Component({
|
|
134
|
+
standalone: true,
|
|
135
|
+
imports: [HlmItemImports],
|
|
136
|
+
template: `
|
|
137
|
+
<div hlmItemGroup>
|
|
138
|
+
<div hlmItem>
|
|
139
|
+
<div hlmItemContent>
|
|
140
|
+
<p hlmItemTitle>Default row</p>
|
|
141
|
+
<p hlmItemDescription>Transparent border, default density.</p>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
<div hlmItem variant="outline">
|
|
145
|
+
<div hlmItemContent>
|
|
146
|
+
<p hlmItemTitle>Outlined row</p>
|
|
147
|
+
<p hlmItemDescription>Bordered card look.</p>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div hlmItem variant="muted">
|
|
151
|
+
<div hlmItemContent>
|
|
152
|
+
<p hlmItemTitle>Muted row</p>
|
|
153
|
+
<p hlmItemDescription>Soft filled background.</p>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
`,
|
|
158
|
+
})
|
|
159
|
+
export class VariantsExample {}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 2. Sizes: default / sm / xs
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { Component } from '@angular/core';
|
|
166
|
+
import { HlmItemImports } from '@egose/shadcn-theme-ng/item';
|
|
167
|
+
|
|
168
|
+
@Component({
|
|
169
|
+
standalone: true,
|
|
170
|
+
imports: [HlmItemImports],
|
|
171
|
+
template: `
|
|
172
|
+
<div hlmItemGroup>
|
|
173
|
+
<div hlmItem>
|
|
174
|
+
<div hlmItemContent>
|
|
175
|
+
<p hlmItemTitle>Default density</p>
|
|
176
|
+
<p hlmItemDescription>Roomy padding for primary lists.</p>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<div hlmItem size="sm">
|
|
180
|
+
<div hlmItemContent>
|
|
181
|
+
<p hlmItemTitle>Compact</p>
|
|
182
|
+
<p hlmItemDescription>Sidebars and secondary lists.</p>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
<div hlmItem size="xs">
|
|
186
|
+
<div hlmItemContent>
|
|
187
|
+
<p hlmItemTitle>Dense</p>
|
|
188
|
+
<p hlmItemDescription>Dropdowns and menus.</p>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
`,
|
|
193
|
+
})
|
|
194
|
+
export class SizesExample {}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 3. Media variants: icon, image, avatar
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import { Component } from '@angular/core';
|
|
201
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
202
|
+
import { lucideFolder, lucideBell } from '@ng-icons/lucide';
|
|
203
|
+
import { HlmIcon } from '@egose/shadcn-theme-ng/icon';
|
|
204
|
+
import { HlmItemImports } from '@egose/shadcn-theme-ng/item';
|
|
205
|
+
import { HlmAvatarImports } from '@egose/shadcn-theme-ng/avatar';
|
|
206
|
+
|
|
207
|
+
@Component({
|
|
208
|
+
standalone: true,
|
|
209
|
+
imports: [NgIcon, HlmIcon, HlmItemImports, HlmAvatarImports],
|
|
210
|
+
providers: [provideIcons({ lucideFolder, lucideBell })],
|
|
211
|
+
template: `
|
|
212
|
+
<div hlmItemGroup>
|
|
213
|
+
<div hlmItem variant="outline">
|
|
214
|
+
<div hlmItemMedia variant="icon"><ng-icon hlm name="lucideFolder" size="sm" /></div>
|
|
215
|
+
<div hlmItemContent>
|
|
216
|
+
<p hlmItemTitle>Design assets</p>
|
|
217
|
+
<p hlmItemDescription>128 files · updated yesterday</p>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
<div hlmItem variant="outline">
|
|
221
|
+
<div hlmItemMedia variant="image">
|
|
222
|
+
<img src="https://picsum.photos/80" alt="Project thumbnail" />
|
|
223
|
+
</div>
|
|
224
|
+
<div hlmItemContent>
|
|
225
|
+
<p hlmItemTitle>Launch photos</p>
|
|
226
|
+
<p hlmItemDescription>Cover image crops to a rounded frame.</p>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
<div hlmItem variant="outline">
|
|
230
|
+
<div hlmItemMedia>
|
|
231
|
+
<hlm-avatar size="sm">
|
|
232
|
+
<span hlmAvatarFallback>JA</span>
|
|
233
|
+
</hlm-avatar>
|
|
234
|
+
</div>
|
|
235
|
+
<div hlmItemContent>
|
|
236
|
+
<p hlmItemTitle>Jane mentioned you</p>
|
|
237
|
+
<p hlmItemDescription>Any element works as default media.</p>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
`,
|
|
242
|
+
})
|
|
243
|
+
export class MediaExample {}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 4. Task row: header + footer + actions + separator
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
import { Component, signal } from '@angular/core';
|
|
250
|
+
import { HlmItemImports } from '@egose/shadcn-theme-ng/item';
|
|
251
|
+
import { HlmButton } from '@egose/shadcn-theme-ng/button';
|
|
252
|
+
|
|
253
|
+
@Component({
|
|
254
|
+
standalone: true,
|
|
255
|
+
imports: [HlmItemImports, HlmButton],
|
|
256
|
+
template: `
|
|
257
|
+
<div hlmItemGroup>
|
|
258
|
+
@for (task of tasks(); track task.title; let last = $last) {
|
|
259
|
+
<article hlmItem variant="outline">
|
|
260
|
+
<div hlmItemMedia class="tw:h-11 tw:w-11 tw:rounded-2xl tw:bg-slate-900 tw:text-sm tw:text-white">
|
|
261
|
+
{{ task.initials }}
|
|
262
|
+
</div>
|
|
263
|
+
<div hlmItemContent>
|
|
264
|
+
<div hlmItemHeader>
|
|
265
|
+
<p hlmItemTitle>{{ task.title }}</p>
|
|
266
|
+
<span class="tw:text-xs tw:text-slate-500">{{ task.status }}</span>
|
|
267
|
+
</div>
|
|
268
|
+
<p hlmItemDescription>{{ task.description }}</p>
|
|
269
|
+
<div hlmItemFooter>
|
|
270
|
+
<span class="tw:text-sm tw:text-slate-500">Updated {{ task.updated }}</span>
|
|
271
|
+
<div hlmItemActions>
|
|
272
|
+
<button hlmBtn size="sm" variant="secondary" type="button">Review</button>
|
|
273
|
+
<button hlmBtn size="sm" type="button">Open</button>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</article>
|
|
278
|
+
@if (!last) {
|
|
279
|
+
<div hlmItemSeparator></div>
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
</div>
|
|
283
|
+
`,
|
|
284
|
+
})
|
|
285
|
+
export class TaskListExample {
|
|
286
|
+
readonly tasks = signal([
|
|
287
|
+
{
|
|
288
|
+
initials: 'DS',
|
|
289
|
+
title: 'Redesign onboarding',
|
|
290
|
+
status: 'In review',
|
|
291
|
+
description: 'Five new steps with progress tracking.',
|
|
292
|
+
updated: '2h ago',
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
initials: 'PL',
|
|
296
|
+
title: 'Fix checkout total',
|
|
297
|
+
status: 'Todo',
|
|
298
|
+
description: 'Tax rounding drifts by one cent.',
|
|
299
|
+
updated: '1d ago',
|
|
300
|
+
},
|
|
301
|
+
]);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### 5. Link rows (whole-row anchor) + global config
|
|
306
|
+
|
|
307
|
+
Rows containing an `<a>` get a hover background automatically (`[a]:hover:bg-muted`). Set app-wide defaults with `provideHlmItemConfig`:
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
import { Component } from '@angular/core';
|
|
311
|
+
import { HlmItemImports, provideHlmItemConfig } from '@egose/shadcn-theme-ng/item';
|
|
312
|
+
|
|
313
|
+
@Component({
|
|
314
|
+
standalone: true,
|
|
315
|
+
imports: [HlmItemImports],
|
|
316
|
+
providers: [provideHlmItemConfig({ variant: 'outline', size: 'sm' })],
|
|
317
|
+
template: `
|
|
318
|
+
<div hlmItemGroup>
|
|
319
|
+
<a hlmItem href="/docs/getting-started">
|
|
320
|
+
<div hlmItemContent>
|
|
321
|
+
<p hlmItemTitle>Getting started</p>
|
|
322
|
+
<p hlmItemDescription>Install and render your first component.</p>
|
|
323
|
+
</div>
|
|
324
|
+
</a>
|
|
325
|
+
<a hlmItem href="/docs/theming">
|
|
326
|
+
<div hlmItemContent>
|
|
327
|
+
<p hlmItemTitle>Theming</p>
|
|
328
|
+
<p hlmItemDescription>CSS variables and dark mode.</p>
|
|
329
|
+
</div>
|
|
330
|
+
</a>
|
|
331
|
+
</div>
|
|
332
|
+
`,
|
|
333
|
+
})
|
|
334
|
+
export class LinksExample {}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### 6. NgModule usage + `orientation` on the separator
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
import { NgModule, Component } from '@angular/core';
|
|
341
|
+
import { HlmItemModule } from '@egose/shadcn-theme-ng/item';
|
|
342
|
+
|
|
343
|
+
@Component({
|
|
344
|
+
selector: 'app-settings-list',
|
|
345
|
+
template: `
|
|
346
|
+
<div hlmItemGroup>
|
|
347
|
+
<div hlmItem variant="outline" size="sm">
|
|
348
|
+
<div hlmItemContent>
|
|
349
|
+
<div hlmItemHeader>
|
|
350
|
+
<p hlmItemTitle>Email notifications</p>
|
|
351
|
+
<span class="tw:text-xs">On</span>
|
|
352
|
+
</div>
|
|
353
|
+
<p hlmItemDescription>Product updates and security alerts.</p>
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
<div hlmItemSeparator orientation="horizontal"></div>
|
|
357
|
+
<div hlmItem variant="outline" size="sm">
|
|
358
|
+
<div hlmItemContent>
|
|
359
|
+
<div hlmItemHeader>
|
|
360
|
+
<p hlmItemTitle>Weekly digest</p>
|
|
361
|
+
<span class="tw:text-xs">Off</span>
|
|
362
|
+
</div>
|
|
363
|
+
<p hlmItemDescription>A Monday summary of workspace activity.</p>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
`,
|
|
368
|
+
})
|
|
369
|
+
export class SettingsListComponent {}
|
|
370
|
+
|
|
371
|
+
@NgModule({ declarations: [SettingsListComponent], imports: [HlmItemModule] })
|
|
372
|
+
export class SettingsListModule {}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## Accessibility notes
|
|
376
|
+
|
|
377
|
+
- Use semantic hosts: `<article>` for feed/task rows, `<li>` inside `<ul>` for plain lists, `<a href>` when the whole row navigates (hover affordance is built in).
|
|
378
|
+
- `hlmItemTitle` renders a `<p>` — if the title should head a section, swap in a real heading (`<h3 hlmItemTitle>`) since the directive is attribute-matched and keeps its classes.
|
|
379
|
+
- Keep action buttons labeled (`Open`, `Review`) — icon-only actions need `aria-label`.
|
|
380
|
+
- The separator is a brain `BrnSeparator` (presentational); it adds no keyboard stops. Status text (`In review`, counts) should be plain text, not color-only.
|
|
381
|
+
|
|
382
|
+
## Theming / CSS variables
|
|
383
|
+
|
|
384
|
+
No component-specific CSS variables; surfaces come from the shared tokens (`--border`, `--muted`, `--radius`). App-wide `variant`/`size` defaults via `provideHlmItemConfig` / `provideHlmItemMediaConfig`; per-row tweaks via inputs or `class`.
|
|
385
|
+
|
|
386
|
+
## Related subpaths
|
|
387
|
+
|
|
388
|
+
- `@egose/shadcn-theme-ng/separator` — `hlmSeparatorClass` behind the item separator.
|
|
389
|
+
- `@egose/shadcn-theme-ng/avatar` — typical `hlmItemMedia` content.
|
|
390
|
+
- `@egose/shadcn-theme-ng/button` — row actions.
|
|
391
|
+
- `@egose/shadcn-theme-ng/badge` — status pills inside header/footer rows.
|
package/item/fesm2022/item.mjs
CHANGED
|
@@ -28,7 +28,7 @@ function injectHlmItemMediaConfig() {
|
|
|
28
28
|
return inject(HlmItemMediaConfigToken, { optional: true }) ?? defaultMediaConfig;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const itemVariants = cva('tw:[a]:hover:bg-muted tw:rounded-md tw:border tw:text-sm tw:group/item tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:flex tw:w-full tw:flex-wrap tw:items-center tw:transition-colors tw:duration-100 tw:outline-none tw:focus-visible:ring-[3px] tw:[a]:transition-colors', {
|
|
31
|
+
const itemVariants = cva('tw:[a]:hover:bg-muted tw:rounded-md tw:border tw:text-sm tw:group/item tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:flex tw:w-full tw:min-w-0 tw:max-w-full tw:flex-wrap tw:items-center tw:transition-colors tw:duration-100 tw:outline-none tw:focus-visible:ring-[3px] tw:[a]:transition-colors', {
|
|
32
32
|
variants: {
|
|
33
33
|
variant: {
|
|
34
34
|
default: 'tw:border-transparent',
|
|
@@ -72,7 +72,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
72
72
|
|
|
73
73
|
class HlmItemActions {
|
|
74
74
|
constructor() {
|
|
75
|
-
classes(() => 'tw:gap-2 tw:flex tw:items-center');
|
|
75
|
+
classes(() => 'tw:gap-2 tw:flex tw:min-w-0 tw:max-w-full tw:flex-wrap tw:items-center');
|
|
76
76
|
}
|
|
77
77
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmItemActions, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
78
78
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmItemActions, isStandalone: true, selector: "[hlmItemActions],hlm-item-actions", host: { attributes: { "data-slot": "item-actions" } }, ngImport: i0 });
|
|
@@ -117,7 +117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
117
117
|
|
|
118
118
|
class HlmItemFooter {
|
|
119
119
|
constructor() {
|
|
120
|
-
classes(() => 'tw:gap-2 tw:flex tw:basis-full tw:items-center tw:justify-between');
|
|
120
|
+
classes(() => 'tw:gap-2 tw:flex tw:basis-full tw:min-w-0 tw:flex-wrap tw:items-center tw:justify-between');
|
|
121
121
|
}
|
|
122
122
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmItemFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
123
123
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmItemFooter, isStandalone: true, selector: "[hlmItemFooter],hlm-item-footer", host: { attributes: { "data-slot": "item-footer" } }, ngImport: i0 });
|