ngx-com 0.0.3 → 0.0.5
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/fesm2022/ngx-com-components-avatar.mjs +772 -0
- package/fesm2022/ngx-com-components-avatar.mjs.map +1 -0
- package/fesm2022/ngx-com-components-calendar.mjs +33 -130
- package/fesm2022/ngx-com-components-calendar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-confirm.mjs +562 -0
- package/fesm2022/ngx-com-components-confirm.mjs.map +1 -0
- package/fesm2022/ngx-com-components-dropdown.mjs +119 -25
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-com-components-empty-state.mjs +382 -0
- package/fesm2022/ngx-com-components-empty-state.mjs.map +1 -0
- package/fesm2022/ngx-com-components-form-field.mjs +16 -15
- package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
- package/fesm2022/ngx-com-components-item.mjs +578 -0
- package/fesm2022/ngx-com-components-item.mjs.map +1 -0
- package/fesm2022/ngx-com-components-paginator.mjs +823 -0
- package/fesm2022/ngx-com-components-paginator.mjs.map +1 -0
- package/fesm2022/ngx-com-components-segmented-control.mjs +538 -0
- package/fesm2022/ngx-com-components-segmented-control.mjs.map +1 -0
- package/fesm2022/ngx-com-components-spinner.mjs +189 -0
- package/fesm2022/ngx-com-components-spinner.mjs.map +1 -0
- package/fesm2022/ngx-com-components-tooltip.mjs +625 -0
- package/fesm2022/ngx-com-components-tooltip.mjs.map +1 -0
- package/package.json +33 -1
- package/types/ngx-com-components-avatar.d.ts +409 -0
- package/types/ngx-com-components-calendar.d.ts +5 -0
- package/types/ngx-com-components-confirm.d.ts +160 -0
- package/types/ngx-com-components-dropdown.d.ts +52 -28
- package/types/ngx-com-components-empty-state.d.ts +269 -0
- package/types/ngx-com-components-item.d.ts +336 -0
- package/types/ngx-com-components-paginator.d.ts +265 -0
- package/types/ngx-com-components-segmented-control.d.ts +274 -0
- package/types/ngx-com-components-spinner.d.ts +120 -0
- package/types/ngx-com-components-tooltip.d.ts +200 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { TemplateRef, InputSignal, InputSignalWithTransform, Signal } from '@angular/core';
|
|
3
|
+
import { AvatarSize, AvatarColor } from 'ngx-com/components/avatar';
|
|
4
|
+
import { IconSize } from 'ngx-com/components/icon';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Marker directive for projecting custom leading content into a com-item.
|
|
9
|
+
*
|
|
10
|
+
* When this directive is present, it completely replaces the default
|
|
11
|
+
* leading visual (which would otherwise be a com-avatar with an icon).
|
|
12
|
+
* Use this for custom avatars (with images or initials), bare icons,
|
|
13
|
+
* custom images, or any other leading visual.
|
|
14
|
+
*
|
|
15
|
+
* @example Custom avatar with image
|
|
16
|
+
* ```html
|
|
17
|
+
* <com-item title="Jane Doe" description="jane@example.com">
|
|
18
|
+
* <ng-template comItemLeading>
|
|
19
|
+
* <com-avatar src="/photos/jane.jpg" name="Jane Doe" size="sm" />
|
|
20
|
+
* </ng-template>
|
|
21
|
+
* </com-item>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Avatar stack
|
|
25
|
+
* ```html
|
|
26
|
+
* <com-item title="3 collaborators">
|
|
27
|
+
* <ng-template comItemLeading>
|
|
28
|
+
* <div class="flex -space-x-2">
|
|
29
|
+
* <com-avatar name="A" size="xs" variant="outline" />
|
|
30
|
+
* <com-avatar name="B" size="xs" variant="outline" />
|
|
31
|
+
* </div>
|
|
32
|
+
* </ng-template>
|
|
33
|
+
* </com-item>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare class ComItemLeading {
|
|
37
|
+
readonly templateRef: TemplateRef<void>;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComItemLeading, never>;
|
|
39
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComItemLeading, "ng-template[comItemLeading]", never, {}, {}, never, never, true, never>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Marker directive for projecting custom title content into a com-item.
|
|
43
|
+
*
|
|
44
|
+
* When this directive is present, it replaces the `title` input with
|
|
45
|
+
* rich projected content. Use this when the title needs formatting,
|
|
46
|
+
* links, or other custom markup.
|
|
47
|
+
*
|
|
48
|
+
* @example Title with link
|
|
49
|
+
* ```html
|
|
50
|
+
* <com-item icon="link">
|
|
51
|
+
* <ng-template comItemTitle>
|
|
52
|
+
* <a href="/docs/api" class="hover:underline">API Documentation</a>
|
|
53
|
+
* </ng-template>
|
|
54
|
+
* </com-item>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare class ComItemTitle {
|
|
58
|
+
readonly templateRef: TemplateRef<void>;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComItemTitle, never>;
|
|
60
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComItemTitle, "ng-template[comItemTitle]", never, {}, {}, never, never, true, never>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Marker directive for projecting inline suffix content after the title.
|
|
64
|
+
*
|
|
65
|
+
* Content appears on the same line as the title, immediately after it.
|
|
66
|
+
* Use this for badges, tags, status indicators, or other inline metadata.
|
|
67
|
+
*
|
|
68
|
+
* @example Badge suffix
|
|
69
|
+
* ```html
|
|
70
|
+
* <com-item title="My BP datasource" description="View and manage configuration">
|
|
71
|
+
* <ng-template comItemSuffix>
|
|
72
|
+
* <span class="inline-flex items-center gap-1 rounded-pill border border-primary/30 bg-primary-subtle px-2 py-0.5 text-xs font-medium text-primary">
|
|
73
|
+
* Bluetooth
|
|
74
|
+
* </span>
|
|
75
|
+
* </ng-template>
|
|
76
|
+
* </com-item>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare class ComItemSuffix {
|
|
80
|
+
readonly templateRef: TemplateRef<void>;
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComItemSuffix, never>;
|
|
82
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComItemSuffix, "ng-template[comItemSuffix]", never, {}, {}, never, never, true, never>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Marker directive for projecting custom description content into a com-item.
|
|
86
|
+
*
|
|
87
|
+
* When this directive is present, it replaces the `description` input
|
|
88
|
+
* with rich projected content. Use this when the description needs
|
|
89
|
+
* formatting, code snippets, or other custom markup.
|
|
90
|
+
*
|
|
91
|
+
* @example Description with code
|
|
92
|
+
* ```html
|
|
93
|
+
* <com-item title="API Key" icon="key">
|
|
94
|
+
* <ng-template comItemDescription>
|
|
95
|
+
* <code class="text-xs font-mono text-muted-foreground">sk-abc...xyz</code>
|
|
96
|
+
* <span class="text-xs text-muted-foreground"> · Created 3 days ago</span>
|
|
97
|
+
* </ng-template>
|
|
98
|
+
* </com-item>
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare class ComItemDescription {
|
|
102
|
+
readonly templateRef: TemplateRef<void>;
|
|
103
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComItemDescription, never>;
|
|
104
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComItemDescription, "ng-template[comItemDescription]", never, {}, {}, never, never, true, never>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Marker directive for projecting trailing content into a com-item.
|
|
108
|
+
*
|
|
109
|
+
* Content appears at the far right edge of the item. Use this for
|
|
110
|
+
* action buttons, navigation chevrons, toggles, timestamps, or
|
|
111
|
+
* any other trailing content.
|
|
112
|
+
*
|
|
113
|
+
* @example Trailing chevron
|
|
114
|
+
* ```html
|
|
115
|
+
* <com-item title="Settings" icon="settings" [interactive]="true">
|
|
116
|
+
* <ng-template comItemTrailing>
|
|
117
|
+
* <com-icon name="chevron-right" size="sm" color="muted" />
|
|
118
|
+
* </ng-template>
|
|
119
|
+
* </com-item>
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @example Trailing action button
|
|
123
|
+
* ```html
|
|
124
|
+
* <com-item title="API Key" icon="key">
|
|
125
|
+
* <ng-template comItemTrailing>
|
|
126
|
+
* <button class="text-sm text-primary hover:text-primary-hover">Revoke</button>
|
|
127
|
+
* </ng-template>
|
|
128
|
+
* </com-item>
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
declare class ComItemTrailing {
|
|
132
|
+
readonly templateRef: TemplateRef<void>;
|
|
133
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComItemTrailing, never>;
|
|
134
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComItemTrailing, "ng-template[comItemTrailing]", never, {}, {}, never, never, true, never>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Item size variants. */
|
|
138
|
+
type ItemSize = 'sm' | 'md' | 'lg';
|
|
139
|
+
/** Item density variants. */
|
|
140
|
+
type ItemDensity = 'compact' | 'default' | 'comfortable';
|
|
141
|
+
/**
|
|
142
|
+
* CVA variants for the item container (host element).
|
|
143
|
+
*
|
|
144
|
+
* @tokens `--color-primary-subtle`, `--color-muted`, `--color-ring`
|
|
145
|
+
*/
|
|
146
|
+
declare const itemVariants: (props?: {
|
|
147
|
+
size?: ItemSize;
|
|
148
|
+
density?: ItemDensity;
|
|
149
|
+
interactive?: boolean;
|
|
150
|
+
active?: boolean;
|
|
151
|
+
disabled?: boolean;
|
|
152
|
+
}) => string;
|
|
153
|
+
/** Title classes keyed by item size. */
|
|
154
|
+
declare const ITEM_TITLE_CLASSES: Record<ItemSize, string>;
|
|
155
|
+
/** Description classes keyed by item size. */
|
|
156
|
+
declare const ITEM_DESCRIPTION_CLASSES: Record<ItemSize, string>;
|
|
157
|
+
/** Avatar size mapping keyed by item size. */
|
|
158
|
+
declare const ITEM_AVATAR_SIZES: Record<ItemSize, AvatarSize>;
|
|
159
|
+
/** Icon size mapping keyed by item size (for icon inside avatar). */
|
|
160
|
+
declare const ITEM_ICON_SIZES: Record<ItemSize, IconSize>;
|
|
161
|
+
type ItemVariants = VariantProps<typeof itemVariants>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Item component — a universal compound display element that shows a leading
|
|
165
|
+
* visual alongside a title, an optional description, and optional trailing content.
|
|
166
|
+
*
|
|
167
|
+
* Works in all these contexts:
|
|
168
|
+
* - List rows (device lists, settings menus, search results)
|
|
169
|
+
* - Page/section headers
|
|
170
|
+
* - Dropdown menu items
|
|
171
|
+
* - Table cells
|
|
172
|
+
* - Card headers
|
|
173
|
+
* - Nav items
|
|
174
|
+
*
|
|
175
|
+
* **Anatomy:**
|
|
176
|
+
* ```
|
|
177
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
178
|
+
* │ ┌───────┐ │
|
|
179
|
+
* │ │com- │ Title text · [inline suffix] [TRAILING] │
|
|
180
|
+
* │ │avatar │ Description text (secondary) │
|
|
181
|
+
* │ └───────┘ │
|
|
182
|
+
* └─────────────────────────────────────────────────────────┘
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* Five content zones:
|
|
186
|
+
* 1. **Leading visual** — optional. Default: `com-avatar` with `shape="rounded"` + `variant="soft"`.
|
|
187
|
+
* Override via `comItemLeading` directive.
|
|
188
|
+
* 2. **Title** — primary text. Required (via input or projection).
|
|
189
|
+
* 3. **Inline suffix** — same line as title, after it. For badges, tags, status dots.
|
|
190
|
+
* 4. **Description** — secondary text below title. Optional.
|
|
191
|
+
* 5. **Trailing** — far-right aligned. Actions, chevrons, timestamps.
|
|
192
|
+
*
|
|
193
|
+
* @tokens `--color-primary-subtle`, `--color-muted`, `--color-muted-foreground`,
|
|
194
|
+
* `--color-foreground`, `--color-ring`
|
|
195
|
+
*
|
|
196
|
+
* @example Simplest — text only, no icon
|
|
197
|
+
* ```html
|
|
198
|
+
* <com-item title="Select all" />
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example Icon + title + description (most common)
|
|
202
|
+
* ```html
|
|
203
|
+
* <com-item
|
|
204
|
+
* title="Dexcom G7"
|
|
205
|
+
* description="109123c2d2194bffe519b03ceb51730d5064f9de46c54c4e..."
|
|
206
|
+
* icon="smartphone"
|
|
207
|
+
* />
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* @example Icon with different color
|
|
211
|
+
* ```html
|
|
212
|
+
* <com-item title="Warning detected" icon="alert-triangle" iconColor="warn" />
|
|
213
|
+
* <com-item title="Active" icon="check-circle" iconColor="accent" />
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* @example Page header with badge suffix (size lg)
|
|
217
|
+
* ```html
|
|
218
|
+
* <com-item
|
|
219
|
+
* title="My BP datasource"
|
|
220
|
+
* description="View and manage datasource configuration"
|
|
221
|
+
* size="lg"
|
|
222
|
+
* >
|
|
223
|
+
* <ng-template comItemSuffix>
|
|
224
|
+
* <span class="inline-flex items-center gap-1 rounded-pill border border-primary/30 bg-primary-subtle px-2 py-0.5 text-xs font-medium text-primary">
|
|
225
|
+
* <com-icon name="bluetooth" size="xs" /> Bluetooth
|
|
226
|
+
* </span>
|
|
227
|
+
* </ng-template>
|
|
228
|
+
* </com-item>
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @example Custom leading — user avatar with image
|
|
232
|
+
* ```html
|
|
233
|
+
* <com-item title="Jane Doe" description="jane@example.com">
|
|
234
|
+
* <ng-template comItemLeading>
|
|
235
|
+
* <com-avatar src="/photos/jane.jpg" name="Jane Doe" size="sm" />
|
|
236
|
+
* </ng-template>
|
|
237
|
+
* </com-item>
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* @example Interactive list item with trailing chevron
|
|
241
|
+
* ```html
|
|
242
|
+
* <com-item
|
|
243
|
+
* title="Bluetooth Settings"
|
|
244
|
+
* description="Manage paired devices"
|
|
245
|
+
* icon="bluetooth"
|
|
246
|
+
* [interactive]="true"
|
|
247
|
+
* (click)="openSettings()"
|
|
248
|
+
* >
|
|
249
|
+
* <ng-template comItemTrailing>
|
|
250
|
+
* <com-icon name="chevron-right" size="sm" color="muted" />
|
|
251
|
+
* </ng-template>
|
|
252
|
+
* </com-item>
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @example Compact density — dropdown menu
|
|
256
|
+
* ```html
|
|
257
|
+
* @for (option of options; track option.value) {
|
|
258
|
+
* <com-item
|
|
259
|
+
* [title]="option.label"
|
|
260
|
+
* [icon]="option.icon"
|
|
261
|
+
* density="compact"
|
|
262
|
+
* [interactive]="true"
|
|
263
|
+
* [active]="option.value === selected()"
|
|
264
|
+
* (click)="select(option)"
|
|
265
|
+
* />
|
|
266
|
+
* }
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
* @example Rich description via projection
|
|
270
|
+
* ```html
|
|
271
|
+
* <com-item title="API Key" icon="key">
|
|
272
|
+
* <ng-template comItemDescription>
|
|
273
|
+
* <code class="text-xs font-mono text-muted-foreground">sk-abc...xyz</code>
|
|
274
|
+
* <span class="text-xs text-muted-foreground"> · Created 3 days ago</span>
|
|
275
|
+
* </ng-template>
|
|
276
|
+
* <ng-template comItemTrailing>
|
|
277
|
+
* <button class="text-sm text-primary hover:text-primary-hover">Revoke</button>
|
|
278
|
+
* </ng-template>
|
|
279
|
+
* </com-item>
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* @example Disabled
|
|
283
|
+
* ```html
|
|
284
|
+
* <com-item
|
|
285
|
+
* title="Enterprise Features"
|
|
286
|
+
* description="Available on Enterprise plan"
|
|
287
|
+
* icon="crown"
|
|
288
|
+
* [disabled]="true"
|
|
289
|
+
* />
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
declare class ComItem {
|
|
293
|
+
/** Primary text. Required unless using comItemTitle directive. */
|
|
294
|
+
readonly title: InputSignal<string | undefined>;
|
|
295
|
+
/** Secondary text below the title. */
|
|
296
|
+
readonly description: InputSignal<string | undefined>;
|
|
297
|
+
/** Lucide icon name — renders inside a com-avatar container. */
|
|
298
|
+
readonly icon: InputSignal<string | undefined>;
|
|
299
|
+
/** Color variant passed to the leading com-avatar. */
|
|
300
|
+
readonly iconColor: InputSignal<AvatarColor>;
|
|
301
|
+
/** Size variant affecting typography and spacing. */
|
|
302
|
+
readonly size: InputSignal<ItemSize>;
|
|
303
|
+
/** Density variant affecting vertical padding. */
|
|
304
|
+
readonly density: InputSignal<ItemDensity>;
|
|
305
|
+
/** Enables hover/active/focus states. */
|
|
306
|
+
readonly interactive: InputSignalWithTransform<boolean, unknown>;
|
|
307
|
+
/** Shows selected/active highlight. */
|
|
308
|
+
readonly active: InputSignalWithTransform<boolean, unknown>;
|
|
309
|
+
/** Dims and disables pointer events. */
|
|
310
|
+
readonly disabled: InputSignalWithTransform<boolean, unknown>;
|
|
311
|
+
/** Truncates title and description text. */
|
|
312
|
+
readonly truncate: InputSignalWithTransform<boolean, unknown>;
|
|
313
|
+
protected readonly leadingDirective: Signal<ComItemLeading | undefined>;
|
|
314
|
+
protected readonly titleDirective: Signal<ComItemTitle | undefined>;
|
|
315
|
+
protected readonly suffixDirective: Signal<ComItemSuffix | undefined>;
|
|
316
|
+
protected readonly descriptionDirective: Signal<ComItemDescription | undefined>;
|
|
317
|
+
protected readonly trailingDirective: Signal<ComItemTrailing | undefined>;
|
|
318
|
+
/** Resolved icon color (handles 'auto' → 'primary' for items since there's no name). */
|
|
319
|
+
protected readonly resolvedIconColor: Signal<AvatarColor>;
|
|
320
|
+
/** Avatar size mapped from item size. */
|
|
321
|
+
protected readonly avatarSize: Signal<AvatarSize>;
|
|
322
|
+
/** Icon size mapped from item size. */
|
|
323
|
+
protected readonly iconSize: Signal<IconSize>;
|
|
324
|
+
/** Title typography classes based on size. */
|
|
325
|
+
protected readonly titleClasses: Signal<string>;
|
|
326
|
+
/** Description typography classes based on size. */
|
|
327
|
+
protected readonly descriptionClasses: Signal<string>;
|
|
328
|
+
/** Host element classes from CVA. */
|
|
329
|
+
protected readonly hostClasses: Signal<string>;
|
|
330
|
+
protected onKeyboardActivate(event: Event): void;
|
|
331
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComItem, never>;
|
|
332
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComItem, "com-item", ["comItem"], { "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "iconColor": { "alias": "iconColor"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "interactive": { "alias": "interactive"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "truncate": { "alias": "truncate"; "required": false; "isSignal": true; }; }, {}, ["leadingDirective", "titleDirective", "suffixDirective", "descriptionDirective", "trailingDirective"], never, true, never>;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export { ComItem, ComItemDescription, ComItemLeading, ComItemSuffix, ComItemTitle, ComItemTrailing, ITEM_AVATAR_SIZES, ITEM_DESCRIPTION_CLASSES, ITEM_ICON_SIZES, ITEM_TITLE_CLASSES, itemVariants };
|
|
336
|
+
export type { ItemDensity, ItemSize, ItemVariants };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InputSignal, InputSignalWithTransform, OutputEmitterRef, Signal } from '@angular/core';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Event emitted when the paginator changes page index or page size.
|
|
7
|
+
*/
|
|
8
|
+
interface PageEvent {
|
|
9
|
+
/** The current zero-based page index. */
|
|
10
|
+
pageIndex: number;
|
|
11
|
+
/** The previous zero-based page index. */
|
|
12
|
+
previousPageIndex: number;
|
|
13
|
+
/** The current page size. */
|
|
14
|
+
pageSize: number;
|
|
15
|
+
/** The total number of items being paged. */
|
|
16
|
+
length: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Function signature for custom range label formatting.
|
|
20
|
+
* Used for i18n and custom label display.
|
|
21
|
+
*
|
|
22
|
+
* @param page Current page index (zero-based)
|
|
23
|
+
* @param pageSize Number of items per page
|
|
24
|
+
* @param length Total number of items
|
|
25
|
+
* @returns Formatted string to display (e.g., "1 – 10 of 100")
|
|
26
|
+
*/
|
|
27
|
+
type RangeLabelFn = (page: number, pageSize: number, length: number) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Default range label function.
|
|
30
|
+
* Produces output like "1 – 10 of 100" or "0 of 0" when empty.
|
|
31
|
+
*/
|
|
32
|
+
declare function defaultRangeLabel(page: number, pageSize: number, length: number): string;
|
|
33
|
+
|
|
34
|
+
type PaginatorSize = 'sm' | 'md';
|
|
35
|
+
type PaginatorLayout = 'compact' | 'spread';
|
|
36
|
+
/**
|
|
37
|
+
* CVA variants for the paginator container.
|
|
38
|
+
* Controls overall layout and spacing.
|
|
39
|
+
*/
|
|
40
|
+
declare const paginatorContainerVariants: (props?: {
|
|
41
|
+
size?: PaginatorSize;
|
|
42
|
+
layout?: PaginatorLayout;
|
|
43
|
+
}) => string;
|
|
44
|
+
/**
|
|
45
|
+
* CVA variants for paginator navigation buttons.
|
|
46
|
+
* Controls button sizing, borders, and interactive states.
|
|
47
|
+
*/
|
|
48
|
+
declare const paginatorButtonVariants: (props?: {
|
|
49
|
+
size?: PaginatorSize;
|
|
50
|
+
}) => string;
|
|
51
|
+
/**
|
|
52
|
+
* CVA variants for the range label text.
|
|
53
|
+
* Controls typography and color.
|
|
54
|
+
*/
|
|
55
|
+
declare const paginatorRangeLabelVariants: (props?: {
|
|
56
|
+
size?: PaginatorSize;
|
|
57
|
+
}) => string;
|
|
58
|
+
/**
|
|
59
|
+
* CVA variants for the page size select element.
|
|
60
|
+
* Controls sizing and styling of the native select.
|
|
61
|
+
*/
|
|
62
|
+
declare const paginatorSelectVariants: (props?: {
|
|
63
|
+
size?: PaginatorSize;
|
|
64
|
+
}) => string;
|
|
65
|
+
/**
|
|
66
|
+
* CVA variants for numbered page buttons.
|
|
67
|
+
* Controls button sizing, active state, and interactive states.
|
|
68
|
+
*/
|
|
69
|
+
declare const paginatorPageButtonVariants: (props?: {
|
|
70
|
+
size?: PaginatorSize;
|
|
71
|
+
active?: boolean;
|
|
72
|
+
}) => string;
|
|
73
|
+
/**
|
|
74
|
+
* CVA variants for the ellipsis indicator.
|
|
75
|
+
* Controls sizing and styling of the "..." text.
|
|
76
|
+
*/
|
|
77
|
+
declare const paginatorEllipsisVariants: (props?: {
|
|
78
|
+
size?: PaginatorSize;
|
|
79
|
+
}) => string;
|
|
80
|
+
type PaginatorContainerVariants = VariantProps<typeof paginatorContainerVariants>;
|
|
81
|
+
type PaginatorButtonVariants = VariantProps<typeof paginatorButtonVariants>;
|
|
82
|
+
type PaginatorRangeLabelVariants = VariantProps<typeof paginatorRangeLabelVariants>;
|
|
83
|
+
type PaginatorSelectVariants = VariantProps<typeof paginatorSelectVariants>;
|
|
84
|
+
type PaginatorPageButtonVariants = VariantProps<typeof paginatorPageButtonVariants>;
|
|
85
|
+
type PaginatorEllipsisVariants = VariantProps<typeof paginatorEllipsisVariants>;
|
|
86
|
+
|
|
87
|
+
/** Represents a page number or ellipsis marker in the page range. */
|
|
88
|
+
type PageRangeItem = number | 'ellipsis';
|
|
89
|
+
/**
|
|
90
|
+
* Paginator component — provides navigation for paginated content.
|
|
91
|
+
*
|
|
92
|
+
* Displays navigation controls, optional page size selector, and range label
|
|
93
|
+
* showing current position within the data set. Supports numbered page buttons
|
|
94
|
+
* when `showPageNumbers` is enabled.
|
|
95
|
+
*
|
|
96
|
+
* @tokens `--color-foreground`, `--color-muted-foreground`,
|
|
97
|
+
* `--color-border`, `--color-muted`,
|
|
98
|
+
* `--color-disabled`, `--color-disabled-foreground`,
|
|
99
|
+
* `--color-ring`, `--color-primary`, `--color-primary-foreground`
|
|
100
|
+
*
|
|
101
|
+
* @example Basic usage
|
|
102
|
+
* ```html
|
|
103
|
+
* <com-paginator
|
|
104
|
+
* [length]="100"
|
|
105
|
+
* [pageSize]="10"
|
|
106
|
+
* [pageIndex]="0"
|
|
107
|
+
* (page)="onPageChange($event)"
|
|
108
|
+
* />
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example With page size options
|
|
112
|
+
* ```html
|
|
113
|
+
* <com-paginator
|
|
114
|
+
* [length]="100"
|
|
115
|
+
* [pageSize]="10"
|
|
116
|
+
* [pageIndex]="0"
|
|
117
|
+
* [pageSizeOptions]="[5, 10, 25, 50]"
|
|
118
|
+
* (page)="onPageChange($event)"
|
|
119
|
+
* />
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @example With first/last buttons
|
|
123
|
+
* ```html
|
|
124
|
+
* <com-paginator
|
|
125
|
+
* [length]="100"
|
|
126
|
+
* [pageSize]="10"
|
|
127
|
+
* [pageIndex]="0"
|
|
128
|
+
* [showFirstLastButtons]="true"
|
|
129
|
+
* (page)="onPageChange($event)"
|
|
130
|
+
* />
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @example With numbered page buttons
|
|
134
|
+
* ```html
|
|
135
|
+
* <com-paginator
|
|
136
|
+
* [length]="97"
|
|
137
|
+
* [pageSize]="10"
|
|
138
|
+
* [showPageNumbers]="true"
|
|
139
|
+
* (page)="onPageChange($event)"
|
|
140
|
+
* />
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @example Spread layout (summary left, controls right)
|
|
144
|
+
* ```html
|
|
145
|
+
* <com-paginator
|
|
146
|
+
* [length]="97"
|
|
147
|
+
* [pageSize]="10"
|
|
148
|
+
* [showPageNumbers]="true"
|
|
149
|
+
* layout="spread"
|
|
150
|
+
* (page)="onPageChange($event)"
|
|
151
|
+
* />
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @example Small size
|
|
155
|
+
* ```html
|
|
156
|
+
* <com-paginator
|
|
157
|
+
* [length]="50"
|
|
158
|
+
* [pageSize]="10"
|
|
159
|
+
* size="sm"
|
|
160
|
+
* (page)="onPageChange($event)"
|
|
161
|
+
* />
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example Custom range label (i18n)
|
|
165
|
+
* ```html
|
|
166
|
+
* <com-paginator
|
|
167
|
+
* [length]="100"
|
|
168
|
+
* [pageSize]="10"
|
|
169
|
+
* [rangeLabel]="customLabel"
|
|
170
|
+
* (page)="onPageChange($event)"
|
|
171
|
+
* />
|
|
172
|
+
* ```
|
|
173
|
+
* ```ts
|
|
174
|
+
* customLabel = (page, pageSize, length) => `Seite ${page + 1} von ${Math.ceil(length / pageSize)}`;
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
declare class ComPaginator {
|
|
178
|
+
/** Page number buttons for keyboard navigation. */
|
|
179
|
+
private readonly pageButtons;
|
|
180
|
+
/** Total number of items being paged. */
|
|
181
|
+
readonly length: InputSignal<number>;
|
|
182
|
+
/** Number of items to display per page. */
|
|
183
|
+
readonly pageSize: InputSignal<number>;
|
|
184
|
+
/** Current zero-based page index. */
|
|
185
|
+
readonly pageIndex: InputSignal<number>;
|
|
186
|
+
/** Available page size options. Hides selector if empty. */
|
|
187
|
+
readonly pageSizeOptions: InputSignal<number[]>;
|
|
188
|
+
/** Whether to show first/last navigation buttons. */
|
|
189
|
+
readonly showFirstLastButtons: InputSignalWithTransform<boolean, unknown>;
|
|
190
|
+
/** Whether to show numbered page buttons. */
|
|
191
|
+
readonly showPageNumbers: InputSignalWithTransform<boolean, unknown>;
|
|
192
|
+
/** Whether all controls are disabled. */
|
|
193
|
+
readonly disabled: InputSignalWithTransform<boolean, unknown>;
|
|
194
|
+
/** Whether to hide the page size selector. */
|
|
195
|
+
readonly hidePageSize: InputSignalWithTransform<boolean, unknown>;
|
|
196
|
+
/** Size variant. */
|
|
197
|
+
readonly size: InputSignal<PaginatorSize>;
|
|
198
|
+
/** Layout variant. Only applies when showPageNumbers is true. */
|
|
199
|
+
readonly layout: InputSignal<PaginatorLayout>;
|
|
200
|
+
/** Number of pages to show on each side of the current page. */
|
|
201
|
+
readonly siblingCount: InputSignal<number>;
|
|
202
|
+
/** Number of pages to always show at the start and end. */
|
|
203
|
+
readonly boundaryCount: InputSignal<number>;
|
|
204
|
+
/** Accessible label for the nav element. */
|
|
205
|
+
readonly ariaLabel: InputSignal<string>;
|
|
206
|
+
/** Custom function for range label formatting. */
|
|
207
|
+
readonly rangeLabel: InputSignal<RangeLabelFn>;
|
|
208
|
+
/** Emits when page index or page size changes. */
|
|
209
|
+
readonly page: OutputEmitterRef<PageEvent>;
|
|
210
|
+
/** Total number of pages. */
|
|
211
|
+
protected readonly numberOfPages: Signal<number>;
|
|
212
|
+
/** Whether there is a previous page. */
|
|
213
|
+
protected readonly hasPreviousPage: Signal<boolean>;
|
|
214
|
+
/** Whether there is a next page. */
|
|
215
|
+
protected readonly hasNextPage: Signal<boolean>;
|
|
216
|
+
/** The formatted range label text. */
|
|
217
|
+
protected readonly rangeLabelText: Signal<string>;
|
|
218
|
+
/** Icon size based on component size. */
|
|
219
|
+
protected readonly iconSize: Signal<'xs' | 'sm'>;
|
|
220
|
+
/** Unique ID for page size label. */
|
|
221
|
+
protected readonly pageSizeLabelId: Signal<string>;
|
|
222
|
+
/** Classes for the container. */
|
|
223
|
+
protected readonly containerClasses: Signal<string>;
|
|
224
|
+
/** Classes for navigation buttons. */
|
|
225
|
+
protected readonly buttonClasses: Signal<string>;
|
|
226
|
+
/** Classes for the range label. */
|
|
227
|
+
protected readonly rangeLabelClasses: Signal<string>;
|
|
228
|
+
/** Classes for the page size select. */
|
|
229
|
+
protected readonly selectClasses: Signal<string>;
|
|
230
|
+
/** Classes for the ellipsis indicator. */
|
|
231
|
+
protected readonly ellipsisClasses: Signal<string>;
|
|
232
|
+
/** Cached classes for active page button. */
|
|
233
|
+
protected readonly activePageButtonClasses: Signal<string>;
|
|
234
|
+
/** Cached classes for inactive page button. */
|
|
235
|
+
protected readonly inactivePageButtonClasses: Signal<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Computed page range for numbered pagination.
|
|
238
|
+
* Returns array like [0, 'ellipsis', 3, 4, 5, 'ellipsis', 9] (zero-indexed).
|
|
239
|
+
*/
|
|
240
|
+
protected readonly pageRange: Signal<PageRangeItem[]>;
|
|
241
|
+
/** Navigate to the first page. */
|
|
242
|
+
firstPage(): void;
|
|
243
|
+
/** Navigate to the previous page. */
|
|
244
|
+
previousPage(): void;
|
|
245
|
+
/** Navigate to the next page. */
|
|
246
|
+
nextPage(): void;
|
|
247
|
+
/** Navigate to the last page. */
|
|
248
|
+
lastPage(): void;
|
|
249
|
+
/** Navigate to a specific page by index (zero-based). */
|
|
250
|
+
goToPage(pageIndex: number): void;
|
|
251
|
+
/** Handle page size selection change. */
|
|
252
|
+
protected onPageSizeChange(event: Event): void;
|
|
253
|
+
/** Handle keyboard navigation within page buttons (roving tabindex). */
|
|
254
|
+
protected onPageButtonsKeydown(event: KeyboardEvent): void;
|
|
255
|
+
/** Track function for page items. */
|
|
256
|
+
protected trackPageItem(index: number, item: PageRangeItem): string;
|
|
257
|
+
private emitPageEvent;
|
|
258
|
+
/** Generate a range of numbers from start to end (inclusive). */
|
|
259
|
+
private range;
|
|
260
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComPaginator, never>;
|
|
261
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComPaginator, "com-paginator", ["comPaginator"], { "length": { "alias": "length"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageIndex": { "alias": "pageIndex"; "required": false; "isSignal": true; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; "showFirstLastButtons": { "alias": "showFirstLastButtons"; "required": false; "isSignal": true; }; "showPageNumbers": { "alias": "showPageNumbers"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "hidePageSize": { "alias": "hidePageSize"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "siblingCount": { "alias": "siblingCount"; "required": false; "isSignal": true; }; "boundaryCount": { "alias": "boundaryCount"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "rangeLabel": { "alias": "rangeLabel"; "required": false; "isSignal": true; }; }, { "page": "page"; }, never, never, true, never>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export { ComPaginator, defaultRangeLabel, paginatorButtonVariants, paginatorContainerVariants, paginatorEllipsisVariants, paginatorPageButtonVariants, paginatorRangeLabelVariants, paginatorSelectVariants };
|
|
265
|
+
export type { PageEvent, PageRangeItem, PaginatorButtonVariants, PaginatorContainerVariants, PaginatorEllipsisVariants, PaginatorLayout, PaginatorPageButtonVariants, PaginatorRangeLabelVariants, PaginatorSelectVariants, PaginatorSize, RangeLabelFn };
|