@acontplus/ng-components 3.2.1 → 5.0.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 +122 -21
- package/fesm2022/acontplus-ng-components.mjs +1112 -720
- package/fesm2022/acontplus-ng-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/alert/_m3-alert.scss +57 -54
- package/src/lib/components/alert/alert.scss +87 -36
- package/src/lib/components/badge/_m3-badge.scss +6 -1
- package/src/lib/components/badge/badge.scss +18 -6
- package/src/lib/components/card/card.scss +189 -176
- package/src/lib/components/grid/grid.scss +61 -0
- package/src/lib/components/kpi-card/_m3-kpi-card.scss +44 -59
- package/src/lib/components/kpi-card/kpi-card.scss +250 -573
- package/types/acontplus-ng-components.d.ts +452 -379
- package/src/lib/components/cards/dynamic-card/dynamic-card.scss +0 -0
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ pnpm add @acontplus/ng-components
|
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
|
-
- **UI Components**:
|
|
17
|
+
- **UI Components**: Cards, KPI cards, dialogs, icons, input chips, buttons, spinners, dynamic/tabulator tables, theme toggle, search select
|
|
18
18
|
- **Directives**: Text transformation (to-upper-case)
|
|
19
19
|
- **Pipes**: Data transformation (get-total, status-display)
|
|
20
20
|
- **Services**: Dialog management, overlay, theme management (dark/light mode), autocomplete
|
|
@@ -75,33 +75,89 @@ bounds, and the `ngx-datex` behavior options. `MATERIAL_LIGHT_THEME`,
|
|
|
75
75
|
|
|
76
76
|
### Cards
|
|
77
77
|
|
|
78
|
-
####
|
|
78
|
+
#### AcpCard
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Material Design 3 card built on `mat-card`. Props can be passed in three ways,
|
|
81
|
+
from lowest to highest priority: injected defaults, plain inputs, and slot
|
|
82
|
+
templates for rich content.
|
|
81
83
|
|
|
82
84
|
```typescript
|
|
83
|
-
import {
|
|
85
|
+
import { ACP_CARD_SLOTS, AcpCard, provideAcpCardDefaults } from '@acontplus/ng-components';
|
|
86
|
+
|
|
87
|
+
// app.config.ts (optional, application-wide defaults)
|
|
88
|
+
providers: [provideAcpCardDefaults({ appearance: 'outlined', rounded: 12 })];
|
|
84
89
|
|
|
85
90
|
@Component({
|
|
86
91
|
template: `
|
|
87
|
-
<acp-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
(
|
|
95
|
-
(secondaryButtonClicked)="onLearnMore()"
|
|
92
|
+
<acp-card
|
|
93
|
+
title="Order #1024"
|
|
94
|
+
subtitle="Pending"
|
|
95
|
+
color="surface-container"
|
|
96
|
+
imageRatio="16:9"
|
|
97
|
+
actionsAlign="end"
|
|
98
|
+
clickable
|
|
99
|
+
(clicked)="open()"
|
|
96
100
|
>
|
|
101
|
+
<ng-template acpCardMedia><img src="cover.jpg" alt="" /></ng-template>
|
|
97
102
|
<p>Card content goes here</p>
|
|
98
|
-
|
|
103
|
+
<ng-template acpCardActions><acp-button text="Pay" /></ng-template>
|
|
104
|
+
</acp-card>
|
|
99
105
|
`,
|
|
100
|
-
imports: [
|
|
106
|
+
imports: [AcpCard, ACP_CARD_SLOTS],
|
|
101
107
|
})
|
|
102
|
-
export class
|
|
108
|
+
export class OrderComponent {}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- Inputs: `title`, `subtitle`, `appearance` (`elevated` | `outlined` | `filled`),
|
|
112
|
+
`color`, `elevation` (0-5), `rounded` (`true` | `false` | px), `padding`
|
|
113
|
+
(`none` | `small` | `medium` | `large`), `hoverable`, `clickable`, `disabled`,
|
|
114
|
+
`loading`, `imageRatio`, `actionsAlign`, `fullHeight`, `fullWidth`,
|
|
115
|
+
`ariaLabel` and `passThrough` (per-section `class`/`style`).
|
|
116
|
+
- Output: `clicked`, emitted on click, Enter or Space when `clickable`. Clicks on
|
|
117
|
+
actions or nested buttons/links are ignored.
|
|
118
|
+
- Slots: `acpCardHeader`, `acpCardMedia`, `acpCardAvatar`, `acpCardTitle`,
|
|
119
|
+
`acpCardSubtitle`, `acpCardActions` and `acpCardFooter`. Slot templates win
|
|
120
|
+
over `title`/`subtitle`. Legacy `#title`-style template refs still work.
|
|
121
|
+
- Styling hooks: `--acp-card-shape`, `--acp-card-elevation`, `--acp-card-padding`,
|
|
122
|
+
`--acp-card-container-color`, `--acp-card-on-color`, `--acp-card-subtitle-color`
|
|
123
|
+
and `--acp-card-outline-color`.
|
|
124
|
+
- Removed in this major: `backgroundColor` (use `color`), `hover` (use
|
|
125
|
+
`hoverable`), `outlined` (use `appearance="outlined"`), the appearances
|
|
126
|
+
`default`, `interactive` and `compact`, and the unused `AcpCardBadge` and
|
|
127
|
+
`AcpCardBackgroundColor` types. `DynamicCard` (`acp-dynamic-card`) was removed;
|
|
128
|
+
use `AcpCard`.
|
|
129
|
+
|
|
130
|
+
#### AcpKpiCard
|
|
131
|
+
|
|
132
|
+
Metric card for dashboards. Numeric values and changes are formatted with
|
|
133
|
+
`Intl.NumberFormat` using the app `LOCALE_ID` (or `locale`).
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<acp-kpi-card
|
|
137
|
+
title="Expenses"
|
|
138
|
+
icon="payments"
|
|
139
|
+
[value]="45900"
|
|
140
|
+
[valueFormat]="{ style: 'currency', currency: 'USD', maximumFractionDigits: 0 }"
|
|
141
|
+
[percentage]="-4.1"
|
|
142
|
+
lowerIsBetter
|
|
143
|
+
trendLabel="vs last month"
|
|
144
|
+
variant="outlined"
|
|
145
|
+
/>
|
|
103
146
|
```
|
|
104
147
|
|
|
148
|
+
- `trend` is inferred from the sign of `percentage` when unset. The delta badge
|
|
149
|
+
color comes from the trend sentiment, not from the card `color`; set
|
|
150
|
+
`lowerIsBetter` for costs, churn or error rates.
|
|
151
|
+
- Other inputs: `subtitle`, `prefix`, `suffix`, `description`, `footer`,
|
|
152
|
+
`variant`, `color` (including `surface` and `custom`), `size`, `align`
|
|
153
|
+
(`start` | `center` | `end`), `showTrendIcon`, `icon`,
|
|
154
|
+
`svgIcon`, `avatar`, `avatarInitials`, `progress`, `progressColor`, `loading`,
|
|
155
|
+
`disabled`, `clickable`, `selected`, `routerLink`, `ariaLabel`,
|
|
156
|
+
`menuAriaLabel` and `tooltip`. Output: `clicked` (click, Enter or Space).
|
|
157
|
+
- Templates: `#icon`, `#avatar`, `#footer` and `#actions` (rendered in a menu).
|
|
158
|
+
- Styling hooks: `--acp-kpi-card-custom-bg`, `--acp-kpi-card-custom-fg` and
|
|
159
|
+
`--acp-kpi-card-custom-accent`, plus the `kpi-card-*` theme tokens.
|
|
160
|
+
|
|
105
161
|
### Buttons
|
|
106
162
|
|
|
107
163
|
> **The legacy `Button` component is deprecated.** New code should import and
|
|
@@ -248,6 +304,25 @@ Enhanced dialog components with wrapper functionality for consistent dialog mana
|
|
|
248
304
|
import { DialogWrapper } from '@acontplus/ng-components';
|
|
249
305
|
```
|
|
250
306
|
|
|
307
|
+
### AcpAlert
|
|
308
|
+
|
|
309
|
+
Inline message with a `type` (`default`, `info`, `success`, `warning`, `danger`), a `variant`
|
|
310
|
+
(`soft`, `outlined`, `filled`), an optional `heading`, a per-type icon and an actions slot.
|
|
311
|
+
`dismissible` adds a close button that hides the alert and emits `closed`; call `open()` to show
|
|
312
|
+
it again. Warnings and errors use `role="alert"`; the rest use `role="status"`.
|
|
313
|
+
|
|
314
|
+
```html
|
|
315
|
+
<acp-alert type="warning" heading="Certificado por vencer" dismissible>
|
|
316
|
+
Renueva tu firma electrónica antes del 20/11/2026.
|
|
317
|
+
<div acpAlertActions>
|
|
318
|
+
<button matButton="filled">Renovar ahora</button>
|
|
319
|
+
</div>
|
|
320
|
+
</acp-alert>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Inputs: `type`, `variant`, `heading`, `icon` (Material icon name), `showIcon`, `dismissible`,
|
|
324
|
+
`closeLabel` (default `Cerrar`), `elevation`.
|
|
325
|
+
|
|
251
326
|
### Input Chip
|
|
252
327
|
|
|
253
328
|
Chip input components integrated with Angular Material for tag/chip selection.
|
|
@@ -281,7 +356,9 @@ The DataGrid is the primary table component, built with modern Angular 22+ patte
|
|
|
281
356
|
- **Modern APIs**: Uses `input()` and `output()` functions
|
|
282
357
|
- **Row Selection**: Single/multiple selection with formatter support
|
|
283
358
|
- **Row Highlighting**: Visual highlighting with `highlightedRowIndex`
|
|
284
|
-
- **Keyboard Navigation**:
|
|
359
|
+
- **Keyboard Navigation**: On by default. Arrows, Home/End, PageUp/PageDown, Enter (row click),
|
|
360
|
+
Space (toggle selection) and Ctrl+A (select all). Add `[acpGridNavigationFor]="grid"` to a
|
|
361
|
+
search input to drive the rows while the focus stays in the input
|
|
285
362
|
- **Column Pinning**: Sticky left/right columns
|
|
286
363
|
- **Infinite Scroll**: Load more data on scroll
|
|
287
364
|
- **Server-side Support**: `pageOnFront`/`sortOnFront` toggles for backend pagination
|
|
@@ -438,14 +515,38 @@ export class HeaderComponent {}
|
|
|
438
515
|
| `darkModeLabel` | `string` | `'Switch to dark mode'` | Accessible label when in light mode |
|
|
439
516
|
| `testId` | `string` | `''` | data-testid attribute for testing |
|
|
440
517
|
|
|
441
|
-
###
|
|
518
|
+
### AcpSearchSelect
|
|
442
519
|
|
|
443
|
-
|
|
520
|
+
Searchable select built on `mat-autocomplete`. Accepts flat lists or one-level
|
|
521
|
+
groups (items with a `children` array), ignores accents when searching and works
|
|
522
|
+
with `ngModel`, reactive forms (including the `required` error state) and `[(value)]`.
|
|
444
523
|
|
|
445
|
-
```
|
|
446
|
-
|
|
524
|
+
```html
|
|
525
|
+
<acp-search-select [items]="cities" [(ngModel)]="cityId" [emptyValue]="0" label="Ciudad" />
|
|
526
|
+
|
|
527
|
+
<!-- Server-side search: debounce in the consumer and pass the results back -->
|
|
528
|
+
<acp-search-select
|
|
529
|
+
[items]="customers()"
|
|
530
|
+
[localFilter]="false"
|
|
531
|
+
[loading]="loading()"
|
|
532
|
+
(searchChange)="search($event)"
|
|
533
|
+
label="Cliente"
|
|
534
|
+
/>
|
|
447
535
|
```
|
|
448
536
|
|
|
537
|
+
- Defaults match the backend lookup shape `{ id, value, children? }`:
|
|
538
|
+
`bindValue="id"`, `bindLabel="value"`, `groupLabel="value"`. Each accessor
|
|
539
|
+
also accepts a function, e.g. `[bindLabel]="labelOf"`.
|
|
540
|
+
- Inputs: `items`, `bindLabel`, `bindValue`, `children`, `groupLabel`,
|
|
541
|
+
`compareWith` (matches `1` and `'1'` by default), `filterFn`, `localFilter`,
|
|
542
|
+
`emptyValue`, `label`, `placeholder`, `hint`, `errorText`, `noResultsText`,
|
|
543
|
+
`clearLabel`, `appearance`, `required`, `disabled`, `clearable` and `loading`.
|
|
544
|
+
- Outputs: `optionSelected` (`{ value, item, group }`), `cleared` and
|
|
545
|
+
`searchChange`.
|
|
546
|
+
- Custom option content: `<ng-template #option let-item let-group="group">`.
|
|
547
|
+
- Typed text that is not selected is discarded when the panel closes, so the
|
|
548
|
+
field always shows the current value.
|
|
549
|
+
|
|
449
550
|
## Directives
|
|
450
551
|
|
|
451
552
|
### ToUpperCase
|