@egose/shadcn-theme-ng-tw 0.5.2 → 0.6.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 +12 -11
- package/data-table/README.md +164 -0
- package/data-table/fesm2022/data-table.mjs +1449 -0
- package/data-table/package.json +25 -0
- package/data-table/types/data-table.d.ts +483 -0
- package/dropdown-menu/README.md +2 -0
- package/form-checkbox/README.md +22 -22
- package/form-text-input/fesm2022/form-text-input.mjs +1 -1
- package/form-textarea/fesm2022/form-textarea.mjs +1 -1
- package/input/README.md +7 -12
- package/input/fesm2022/input.mjs +7 -4
- package/input/types/input.d.ts +3 -1
- package/layout-simple/fesm2022/layout-simple.mjs +1 -1
- package/package.json +6 -1
- package/phone-input/fesm2022/phone-input.mjs +1 -1
- package/stepper/README.md +75 -52
- package/stepper/fesm2022/stepper.mjs +35 -5
- package/stepper/types/stepper.d.ts +22 -14
- package/table/README.md +2 -0
- package/table/fesm2022/table.mjs +12 -8
- package/table/types/table.d.ts +7 -2
package/input/README.md
CHANGED
|
@@ -58,11 +58,12 @@ The directive matches `input[hlmInput]` usage in practice (selector `[hlmInput]`
|
|
|
58
58
|
|
|
59
59
|
### `[hlmInput]` — `HlmInput`
|
|
60
60
|
|
|
61
|
-
| Input | Type
|
|
62
|
-
| ----------------- |
|
|
63
|
-
| `ariaDescribedby` | `string \| null`
|
|
64
|
-
| `id` | (via `BrnInput`)
|
|
65
|
-
| `forceInvalid` | (via `BrnInput`)
|
|
61
|
+
| Input | Type | Default | Description |
|
|
62
|
+
| ----------------- | --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `ariaDescribedby` | `string \| null` | `null` | Bound to `aria-describedby`. Combine with `<hlm-error>`/`<hlm-hint>` ids (the form wrappers do this automatically). |
|
|
64
|
+
| `id` | (via `BrnInput`) | — | Forwarded to the `BrnInput` host directive. |
|
|
65
|
+
| `forceInvalid` | (via `BrnInput`) | — | Forwarded to the `BrnInput` host directive; forces the `data-matches-spartan-invalid` error styles. |
|
|
66
|
+
| `size` | `sm \| default \| lg` | `default` | Height density: `h-8` / `h-9` / `h-10`. |
|
|
66
67
|
|
|
67
68
|
No outputs. Visual states are attribute-driven: `data-matches-spartan-invalid=true` switches the border/ring to destructive; `disabled` applies `pointer-events-none`, `cursor-not-allowed`, `opacity-50`. Base geometry: `h-9`, `rounded-md`, `text-base` (`md:text-sm`), full width.
|
|
68
69
|
|
|
@@ -180,13 +181,7 @@ import { HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
|
|
|
180
181
|
template: `
|
|
181
182
|
<form [formGroup]="form">
|
|
182
183
|
<label for="handle">Handle</label>
|
|
183
|
-
<input
|
|
184
|
-
hlmInput
|
|
185
|
-
id="handle"
|
|
186
|
-
formControlName="handle"
|
|
187
|
-
placeholder="@jane"
|
|
188
|
-
[ariaDescribedby]="describedBy()"
|
|
189
|
-
/>
|
|
184
|
+
<input hlmInput id="handle" formControlName="handle" placeholder="@jane" [ariaDescribedby]="describedBy()" />
|
|
190
185
|
@if (showError()) {
|
|
191
186
|
<hlm-error id="handle-error">Use 3+ lowercase letters.</hlm-error>
|
|
192
187
|
} @else {
|
package/input/fesm2022/input.mjs
CHANGED
|
@@ -4,16 +4,19 @@ import * as i2 from '@spartan-ng/brain/field';
|
|
|
4
4
|
import { BrnFieldControlDescribedBy } from '@spartan-ng/brain/field';
|
|
5
5
|
import * as i1 from '@spartan-ng/brain/input';
|
|
6
6
|
import { BrnInput } from '@spartan-ng/brain/input';
|
|
7
|
-
import { classes } from '@egose/shadcn-theme-ng-tw/utils';
|
|
7
|
+
import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
8
8
|
|
|
9
9
|
class HlmInput {
|
|
10
10
|
ariaDescribedby = input(null, /* @ts-ignore */
|
|
11
11
|
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
12
|
+
/** Height density. Merged after the base height class, so it wins via `twMerge`. */
|
|
13
|
+
size = input('default', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
12
15
|
constructor() {
|
|
13
|
-
classes(() => 'tw:dark:bg-input/30 tw:border-input tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:data-[matches-spartan-invalid=true]:ring-destructive/20 tw:dark:data-[matches-spartan-invalid=true]:ring-destructive/40 tw:data-[matches-spartan-invalid=true]:border-destructive tw:dark:data-[matches-spartan-invalid=true]:border-destructive/50 tw:h-9 tw:rounded-md tw:border tw:bg-transparent tw:px-2.5 tw:py-1 tw:text-base tw:shadow-xs tw:transition-[color,box-shadow] tw:file:h-7 tw:file:text-sm tw:file:font-medium tw:focus-visible:ring-3 tw:data-[matches-spartan-invalid=true]:ring-3 tw:md:text-sm tw:file:text-foreground tw:placeholder:text-muted-foreground tw:w-full tw:min-w-0 tw:outline-none tw:file:inline-flex tw:file:border-0 tw:file:bg-transparent tw:disabled:pointer-events-none tw:disabled:cursor-not-allowed tw:disabled:opacity-50');
|
|
16
|
+
classes(() => hlm('tw:dark:bg-input/30 tw:border-input tw:focus-visible:border-ring tw:focus-visible:ring-ring/50 tw:data-[matches-spartan-invalid=true]:ring-destructive/20 tw:dark:data-[matches-spartan-invalid=true]:ring-destructive/40 tw:data-[matches-spartan-invalid=true]:border-destructive tw:dark:data-[matches-spartan-invalid=true]:border-destructive/50 tw:h-9 tw:rounded-md tw:border tw:bg-transparent tw:px-2.5 tw:py-1 tw:text-base tw:shadow-xs tw:transition-[color,box-shadow] tw:file:h-7 tw:file:text-sm tw:file:font-medium tw:focus-visible:ring-3 tw:data-[matches-spartan-invalid=true]:ring-3 tw:md:text-sm tw:file:text-foreground tw:placeholder:text-muted-foreground tw:w-full tw:min-w-0 tw:outline-none tw:file:inline-flex tw:file:border-0 tw:file:bg-transparent tw:disabled:pointer-events-none tw:disabled:cursor-not-allowed tw:disabled:opacity-50', this.size() === 'sm' ? 'tw:h-8' : this.size() === 'lg' ? 'tw:h-10' : ''));
|
|
14
17
|
}
|
|
15
18
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
16
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmInput, isStandalone: true, selector: "[hlmInput]", inputs: { ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input" }, properties: { "attr.aria-describedby": "ariaDescribedby()" } }, hostDirectives: [{ directive: i1.BrnInput, inputs: ["id", "id", "forceInvalid", "forceInvalid"] }, { directive: i2.BrnFieldControlDescribedBy }], ngImport: i0 });
|
|
19
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmInput, isStandalone: true, selector: "[hlmInput]", inputs: { ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input" }, properties: { "attr.aria-describedby": "ariaDescribedby()" } }, hostDirectives: [{ directive: i1.BrnInput, inputs: ["id", "id", "forceInvalid", "forceInvalid"] }, { directive: i2.BrnFieldControlDescribedBy }], ngImport: i0 });
|
|
17
20
|
}
|
|
18
21
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmInput, decorators: [{
|
|
19
22
|
type: Directive,
|
|
@@ -25,7 +28,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
25
28
|
'[attr.aria-describedby]': 'ariaDescribedby()',
|
|
26
29
|
},
|
|
27
30
|
}]
|
|
28
|
-
}], ctorParameters: () => [], propDecorators: { ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }] } });
|
|
31
|
+
}], ctorParameters: () => [], propDecorators: { ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
29
32
|
|
|
30
33
|
/*
|
|
31
34
|
* Public API Surface of input
|
package/input/types/input.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import * as i2 from '@spartan-ng/brain/field';
|
|
|
4
4
|
|
|
5
5
|
declare class HlmInput {
|
|
6
6
|
readonly ariaDescribedby: i0.InputSignal<string | null>;
|
|
7
|
+
/** Height density. Merged after the base height class, so it wins via `twMerge`. */
|
|
8
|
+
readonly size: i0.InputSignal<"sm" | "default" | "lg">;
|
|
7
9
|
constructor();
|
|
8
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<HlmInput, never>;
|
|
9
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmInput, "[hlmInput]", never, { "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnInput; inputs: { "id": "id"; "forceInvalid": "forceInvalid"; }; outputs: {}; }, { directive: typeof i2.BrnFieldControlDescribedBy; inputs: {}; outputs: {}; }]>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HlmInput, "[hlmInput]", never, { "ariaDescribedby": { "alias": "ariaDescribedby"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnInput; inputs: { "id": "id"; "forceInvalid": "forceInvalid"; }; outputs: {}; }, { directive: typeof i2.BrnFieldControlDescribedBy; inputs: {}; outputs: {}; }]>;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
declare const HlmInputImports: readonly [typeof HlmInput];
|
|
@@ -435,7 +435,7 @@ class EgLayoutSearch {
|
|
|
435
435
|
</div>
|
|
436
436
|
</hlm-popover-content>
|
|
437
437
|
</hlm-popover>
|
|
438
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: HlmPopoverTrigger, selector: "button[hlmPopoverTrigger],button[hlmPopoverTriggerFor]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
438
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: HlmPopover, selector: "[hlmPopover],hlm-popover" }, { kind: "directive", type: HlmPopoverTrigger, selector: "button[hlmPopoverTrigger],button[hlmPopoverTriggerFor]" }, { kind: "directive", type: HlmPopoverContent, selector: "[hlmPopoverContent],hlm-popover-content" }, { kind: "directive", type: HlmPopoverPortal, selector: "[hlmPopoverPortal]" }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby", "size"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
439
439
|
}
|
|
440
440
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgLayoutSearch, decorators: [{
|
|
441
441
|
type: Component,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egose/shadcn-theme-ng-tw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Angular shadcn UI theme",
|
|
5
5
|
"author": "Junmin Ahn",
|
|
6
6
|
"bundles": [
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@angular/router": ">=22.0.0 <23.0.0",
|
|
32
32
|
"@ng-icons/core": ">=35.0.1 <36.0.0",
|
|
33
33
|
"@spartan-ng/brain": ">=1.3.2 <2.0.0",
|
|
34
|
+
"@tanstack/angular-table": ">=9.1.2 <10.0.0",
|
|
34
35
|
"rxjs": ">=7.8.0 <8.0.0"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -126,6 +127,10 @@
|
|
|
126
127
|
"types": "./context-menu/types/context-menu.d.ts",
|
|
127
128
|
"default": "./context-menu/fesm2022/context-menu.mjs"
|
|
128
129
|
},
|
|
130
|
+
"./data-table": {
|
|
131
|
+
"types": "./data-table/types/data-table.d.ts",
|
|
132
|
+
"default": "./data-table/fesm2022/data-table.mjs"
|
|
133
|
+
},
|
|
129
134
|
"./date-picker": {
|
|
130
135
|
"types": "./date-picker/types/date-picker.d.ts",
|
|
131
136
|
"default": "./date-picker/fesm2022/date-picker.mjs"
|
|
@@ -143,7 +143,7 @@ class HlmPhoneInput {
|
|
|
143
143
|
(input)="_handleInput($event)"
|
|
144
144
|
(blur)="_handleBlur()"
|
|
145
145
|
/>
|
|
146
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
146
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
147
147
|
}
|
|
148
148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmPhoneInput, decorators: [{
|
|
149
149
|
type: Component,
|
package/stepper/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Stepper (`@egose/shadcn-theme-ng/stepper`)
|
|
2
2
|
|
|
3
|
-
Multi-step workflow navigation, ported from the spartan stepper blocks. This subpath ships seven pieces — `HlmStepper` (root), `HlmStep` (step), `HlmStepHeader` (clickable header with indicator), `HlmStepLabel` (rich label template), `HlmStepContent` (lazy body), `HlmStepperNext` / `HlmStepperPrevious` (navigation buttons) — plus `provideHlmStepperConfig` / `injectHlmStepperConfig` for global defaults. All are thin shadcn-styled components over Angular CDK's `@angular/cdk/stepper` primitives (`CdkStepper`, `CdkStep`, `CdkStepHeader`, `CdkStepLabel`).
|
|
3
|
+
Multi-step workflow navigation, ported from the spartan stepper blocks. This subpath ships seven pieces — `HlmStepper` (root), `HlmStep` (step), `HlmStepHeader` (clickable header with indicator), `HlmStepLabel` (rich label template), `HlmStepContent` (lazy body), `HlmStepperNext` / `HlmStepperPrevious` (navigation buttons) — plus `provideHlmStepperConfig` / `injectHlmStepperConfig` for global defaults. Headers automatically show the full label in a styled tooltip on hover/focus (overridable per step via `tooltip`). All are thin shadcn-styled components over Angular CDK's `@angular/cdk/stepper` primitives (`CdkStepper`, `CdkStep`, `CdkStepHeader`, `CdkStepLabel`).
|
|
4
4
|
|
|
5
5
|
> **Ships as:** `@egose/shadcn-theme-ng/stepper` and `@egose/shadcn-theme-ng-tw/stepper` (the `tw:`-prefixed Tailwind variant). See the [package README](../../README.md) for install steps, peer dependencies, Tailwind setup, and testing/release guidance. Do not publish this project directory independently.
|
|
6
6
|
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
HlmStepperPrevious,
|
|
34
34
|
injectHlmStepperConfig,
|
|
35
35
|
provideHlmStepperConfig,
|
|
36
|
+
type HlmStepTooltipPosition,
|
|
36
37
|
} from '@egose/shadcn-theme-ng/stepper';
|
|
37
38
|
// tw variant: swap to '@egose/shadcn-theme-ng-tw/stepper'
|
|
38
39
|
```
|
|
@@ -62,19 +63,19 @@ import { HlmStepperModule } from '@egose/shadcn-theme-ng/stepper';
|
|
|
62
63
|
export class FeatureModule {}
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
| Symbol
|
|
66
|
-
|
|
|
67
|
-
| `HlmStepper`
|
|
68
|
-
| `HlmStep`
|
|
69
|
-
| `HlmStepHeader`
|
|
70
|
-
| `HlmStepLabel`
|
|
71
|
-
| `HlmStepContent`
|
|
72
|
-
| `HlmStepperNext`
|
|
73
|
-
| `HlmStepperPrevious`
|
|
74
|
-
| `HlmStepperImports`
|
|
75
|
-
| `HlmStepperModule`
|
|
76
|
-
| `provideHlmStepperConfig
|
|
77
|
-
| `injectHlmStepperConfig`
|
|
66
|
+
| Symbol | Kind | Description |
|
|
67
|
+
| ------------------------- | ------------- | ------------------------------------------------------------------------- |
|
|
68
|
+
| `HlmStepper` | Component | Root: `<hlm-stepper>` — extends `CdkStepper`. |
|
|
69
|
+
| `HlmStep` | Component | Step: `<hlm-step label="…">` — extends `CdkStep`, adds `icon` input. |
|
|
70
|
+
| `HlmStepHeader` | Component | Header: `<hlm-step-header>` — extends `CdkStepHeader`, renders indicator. |
|
|
71
|
+
| `HlmStepLabel` | Directive | Rich label: `<ng-template hlmStepLabel>` — extends `CdkStepLabel`. |
|
|
72
|
+
| `HlmStepContent` | Directive | Lazy body: `<ng-template hlmStepContent>` — attached on first selection. |
|
|
73
|
+
| `HlmStepperNext` | Directive | Next button: `button[hlmStepperNext]` — extends `CdkStepperNext`. |
|
|
74
|
+
| `HlmStepperPrevious` | Directive | Back button: `button[hlmStepperPrevious]` — extends `CdkStepperPrevious`. |
|
|
75
|
+
| `HlmStepperImports` | `const` array | All seven, spread into `imports: [...]`. |
|
|
76
|
+
| `HlmStepperModule` | NgModule | Imports + re-exports all seven. |
|
|
77
|
+
| `provideHlmStepperConfig` | Function | Global defaults for animations + indicator mode. |
|
|
78
|
+
| `injectHlmStepperConfig` | Function | Reads the (optionally provided) global config. |
|
|
78
79
|
|
|
79
80
|
## Anatomy / Structure
|
|
80
81
|
|
|
@@ -122,47 +123,50 @@ Lazy body (attached only when the step is first selected):
|
|
|
122
123
|
|
|
123
124
|
### `HlmStepper` — selector `hlm-stepper` (component, extends `CdkStepper`)
|
|
124
125
|
|
|
125
|
-
| Input
|
|
126
|
-
|
|
|
127
|
-
| `orientation`
|
|
128
|
-
| `linear`
|
|
129
|
-
| `selectedIndex`
|
|
130
|
-
| `labelPosition`
|
|
131
|
-
| `headerPosition`
|
|
132
|
-
| `indicatorMode`
|
|
133
|
-
| `stepperAriaLabel`
|
|
134
|
-
| `stepperAriaLabelledby` | `string \| null`
|
|
135
|
-
| `animationsEnabled`
|
|
136
|
-
| `animationDuration`
|
|
126
|
+
| Input | Type | Default | Description |
|
|
127
|
+
| ----------------------- | ------------------------------- | ----------------------- | ---------------------------------------------------------------- |
|
|
128
|
+
| `orientation` | forwarded to `CdkStepper` | — | `'horizontal' \| 'vertical'`. |
|
|
129
|
+
| `linear` | forwarded to `CdkStepper` | — | Current step must be valid (via `stepControl`) before advancing. |
|
|
130
|
+
| `selectedIndex` | forwarded to `CdkStepper` | — | Controlled selected-step index. |
|
|
131
|
+
| `labelPosition` | `'end' \| 'bottom'` | `'end'` | Horizontal layout: label beside vs. below the indicator. |
|
|
132
|
+
| `headerPosition` | `'top' \| 'bottom'` | `'top'` | Horizontal layout: headers above vs. below the content panel. |
|
|
133
|
+
| `indicatorMode` | `'number' \| 'state' \| 'icon'` | from config (`'state'`) | Indicator rendering (see below). |
|
|
134
|
+
| `stepperAriaLabel` | `string \| null` | `'Progress'` | `aria-label` for the tablist (ignored when labelledby is set). |
|
|
135
|
+
| `stepperAriaLabelledby` | `string \| null` | `null` | `aria-labelledby` for the tablist. |
|
|
136
|
+
| `animationsEnabled` | `boolean` | from config (`true`) | Toggle step transitions per instance. |
|
|
137
|
+
| `animationDuration` | `number` (ms) | from config (`300`) | Transition duration per instance. |
|
|
137
138
|
|
|
138
139
|
`next()` is overridden to `markAllAsTouched()` + `updateValueAndValidity()` on the current `stepControl` first, so linear steppers surface validation errors before denying the transition.
|
|
139
140
|
|
|
140
141
|
### `HlmStep` — selector `hlm-step` (component, extends `CdkStep`)
|
|
141
142
|
|
|
142
|
-
| Input
|
|
143
|
-
|
|
|
144
|
-
| `label`
|
|
145
|
-
| `icon`
|
|
146
|
-
| `stepControl`
|
|
147
|
-
| `optional`
|
|
148
|
-
| `errorMessage
|
|
149
|
-
| `hasError`
|
|
143
|
+
| Input | Type | Default | Description |
|
|
144
|
+
| ----------------- | ---------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------ |
|
|
145
|
+
| `label` | forwarded to `CdkStep` | — | Step title (string, or rich template via `hlmStepLabel`). |
|
|
146
|
+
| `icon` | `string \| null` | `null` | Icon name rendered when `indicatorMode="icon"`. |
|
|
147
|
+
| `stepControl` | forwarded to `CdkStep` | — | Form group driving `linear` validation. |
|
|
148
|
+
| `optional` | forwarded to `CdkStep` | — | Shows an "Optional" caption in the header. |
|
|
149
|
+
| `errorMessage` | forwarded to `CdkStep` | — | Header error caption when the step state is `error`. |
|
|
150
|
+
| `hasError` | forwarded to `CdkStep` | — | Forces the error state (pair with `STEPPER_GLOBAL_OPTIONS` `showError`). |
|
|
151
|
+
| `tooltip` | `string \| TemplateRef<unknown> \| null` | `null` (falls back to the full string label) | Styled header tooltip override; rich templates allowed. |
|
|
152
|
+
| `tooltipPosition` | `'top' \| 'right' \| 'bottom' \| 'left'` | `'bottom'` | Tooltip side. |
|
|
153
|
+
| `tooltipDisabled` | `boolean` | `false` | Disables the header tooltip for this step. |
|
|
150
154
|
|
|
151
155
|
### `HlmStepHeader` — selector `hlm-step-header` (component, extends `CdkStepHeader`)
|
|
152
156
|
|
|
153
157
|
Usually rendered by `HlmStepper` itself; use directly only for custom layouts.
|
|
154
158
|
|
|
155
|
-
| Input
|
|
156
|
-
|
|
|
157
|
-
| `index`
|
|
158
|
-
| `state`
|
|
159
|
-
| `label`
|
|
160
|
-
| `selected` / `reached` / `active` | `boolean`
|
|
161
|
-
| `optional` / `disabled`
|
|
162
|
-
| `icon`
|
|
163
|
-
| `indicatorMode`
|
|
164
|
-
| `labelPosition`
|
|
165
|
-
| `errorMessage`
|
|
159
|
+
| Input | Type | Default | Description |
|
|
160
|
+
| --------------------------------- | -------------------------------- | ----------------------- | ------------------------------------------------------ |
|
|
161
|
+
| `index` | `number` | `0` | Step index (drives the number indicator). |
|
|
162
|
+
| `state` | `StepState` | `'number'` | CDK step state (`number`, `edit`, `done`, `error`, …). |
|
|
163
|
+
| `label` | `HlmStepLabel \| string \| null` | `null` | Resolved label content. |
|
|
164
|
+
| `selected` / `reached` / `active` | `boolean` | `false` | Visual state flags. |
|
|
165
|
+
| `optional` / `disabled` | `boolean` | `false` | Optional caption / disabled styling. |
|
|
166
|
+
| `icon` | `string \| null` | `null` | Icon name for `indicatorMode="icon"`. |
|
|
167
|
+
| `indicatorMode` | `'number' \| 'state' \| 'icon'` | from config (`'state'`) | Indicator rendering. |
|
|
168
|
+
| `labelPosition` | `'end' \| 'bottom'` | `'end'` | Label beside vs. below the indicator. |
|
|
169
|
+
| `errorMessage` | `string` | `''` | Error caption shown when `state === 'error'`. |
|
|
166
170
|
|
|
167
171
|
Indicator modes: `number` always renders `1, 2, 3`; `state` (default) renders a check icon for selected/reached steps and an alert icon for errors; `icon` renders the per-step `icon` name (provide icons via `@ng-icons/core` `provideIcons` in your app).
|
|
168
172
|
|
|
@@ -177,7 +181,9 @@ import { provideHlmStepperConfig } from '@egose/shadcn-theme-ng/stepper';
|
|
|
177
181
|
|
|
178
182
|
@Component({
|
|
179
183
|
// ...
|
|
180
|
-
providers: [
|
|
184
|
+
providers: [
|
|
185
|
+
provideHlmStepperConfig({ animationEnabled: true, animationDuration: 300, defaultIndicatorMode: 'state' }),
|
|
186
|
+
],
|
|
181
187
|
})
|
|
182
188
|
export class FeatureComponent {}
|
|
183
189
|
```
|
|
@@ -239,13 +245,14 @@ import { Component, computed, inject } from '@angular/core';
|
|
|
239
245
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
240
246
|
import { map } from 'rxjs/operators';
|
|
241
247
|
|
|
242
|
-
@Component({
|
|
248
|
+
@Component({
|
|
249
|
+
/* … */
|
|
250
|
+
})
|
|
243
251
|
export class DemoResponsive {
|
|
244
252
|
private readonly _breakpoints = inject(BreakpointObserver);
|
|
245
|
-
private readonly _isSmall = toSignal(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
);
|
|
253
|
+
private readonly _isSmall = toSignal(this._breakpoints.observe('(max-width: 767.98px)').pipe(map((s) => s.matches)), {
|
|
254
|
+
initialValue: false,
|
|
255
|
+
});
|
|
249
256
|
protected readonly orientation = computed(() => (this._isSmall() ? 'vertical' : 'horizontal'));
|
|
250
257
|
}
|
|
251
258
|
```
|
|
@@ -262,7 +269,9 @@ With `linear`, the current step must be valid before advancing — `HlmStepper.n
|
|
|
262
269
|
import { Component, inject } from '@angular/core';
|
|
263
270
|
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
264
271
|
|
|
265
|
-
@Component({
|
|
272
|
+
@Component({
|
|
273
|
+
/* …, imports: [ReactiveFormsModule, ...HlmStepperImports, ...HlmButtonImports] */
|
|
274
|
+
})
|
|
266
275
|
export class DemoLinear {
|
|
267
276
|
private readonly _fb = inject(FormBuilder);
|
|
268
277
|
protected readonly identity = this._fb.group({ name: ['', Validators.required] });
|
|
@@ -334,6 +343,20 @@ Or set global defaults with `provideHlmStepperConfig` and override per instance.
|
|
|
334
343
|
|
|
335
344
|
Per-step `icon` names resolve through `@ng-icons/core` — register them with `provideIcons` in your app.
|
|
336
345
|
|
|
346
|
+
### 9. Header tooltips
|
|
347
|
+
|
|
348
|
+
Headers carry the styled `HlmTooltip` automatically: hovering or focusing a header shows the step's full string label (useful when labels truncate). Override per step with `tooltip` (plain text or a `TemplateRef`), adjust the side with `tooltipPosition`, or opt out with `tooltipDisabled`:
|
|
349
|
+
|
|
350
|
+
```html
|
|
351
|
+
<hlm-stepper>
|
|
352
|
+
<hlm-step label="An especially long account setup label that truncates"><!-- falls back to the label --></hlm-step>
|
|
353
|
+
<hlm-step label="Profile" tooltip="Add a photo so teammates recognize you"><!-- … --></hlm-step>
|
|
354
|
+
<hlm-step label="Review" [tooltipDisabled]="true"><!-- … --></hlm-step>
|
|
355
|
+
</hlm-stepper>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Steps using `<ng-template hlmStepLabel>` have no string to fall back to — pass `tooltip` explicitly if they need one. Custom `HlmStepHeader` layouts can apply `hlmTooltip` directly.
|
|
359
|
+
|
|
337
360
|
## Accessibility notes
|
|
338
361
|
|
|
339
362
|
- Horizontal headers get `role="tab"` semantics inside a `role="tablist"` (labelled `Progress` by default — override with `stepperAriaLabel` / `stepperAriaLabelledby`); panels get `role="tabpanel"` wired via `aria-labelledby` / `aria-controls`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, TemplateRef, Directive, ViewContainerRef, DestroyRef, input, contentChild, effect, untracked, ChangeDetectionStrategy, Component, InjectionToken, numberAttribute,
|
|
2
|
+
import { inject, TemplateRef, Directive, ViewContainerRef, DestroyRef, input, booleanAttribute, contentChild, effect, untracked, ChangeDetectionStrategy, Component, InjectionToken, numberAttribute, computed, signal, NgModule } from '@angular/core';
|
|
3
3
|
import { TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
4
4
|
import * as i1 from '@angular/cdk/stepper';
|
|
5
5
|
import { CdkStepLabel, CdkStep, CdkStepHeader, CdkStepper, CdkStepperModule, CdkStepperNext, CdkStepperPrevious } from '@angular/cdk/stepper';
|
|
@@ -9,6 +9,7 @@ import { lucideCircleAlert, lucideCheck } from '@ng-icons/lucide';
|
|
|
9
9
|
import { buttonVariants } from '@egose/shadcn-theme-ng-tw/button';
|
|
10
10
|
import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
11
11
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
+
import { HlmTooltip } from '@egose/shadcn-theme-ng-tw/tooltip';
|
|
12
13
|
import { cva } from 'class-variance-authority';
|
|
13
14
|
import { tap } from 'rxjs/operators';
|
|
14
15
|
|
|
@@ -43,6 +44,12 @@ class HlmStep extends CdkStep {
|
|
|
43
44
|
_destroyRef = inject(DestroyRef);
|
|
44
45
|
icon = input(null, /* @ts-ignore */
|
|
45
46
|
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
47
|
+
/** Styled header tooltip override. Falls back to the full string label when unset. */
|
|
48
|
+
tooltip = input(null, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
50
|
+
tooltipPosition = input('bottom', /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "tooltipPosition" }] : /* istanbul ignore next */ []));
|
|
52
|
+
tooltipDisabled = input(false, { ...(ngDevMode ? { debugName: "tooltipDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
46
53
|
/** Content for step label given by `<ng-template hlmStepLabel>`. */
|
|
47
54
|
stepLabelContent = contentChild(HlmStepLabel, /* @ts-ignore */
|
|
48
55
|
...(ngDevMode ? [{ debugName: "stepLabelContent" }] : /* istanbul ignore next */ []));
|
|
@@ -69,7 +76,7 @@ class HlmStep extends CdkStep {
|
|
|
69
76
|
});
|
|
70
77
|
}
|
|
71
78
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStep, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmStep, isStandalone: true, selector: "hlm-step", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "hidden": "" } }, providers: [
|
|
79
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmStep, isStandalone: true, selector: "hlm-step", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "hidden": "" } }, providers: [
|
|
73
80
|
{
|
|
74
81
|
provide: CdkStep,
|
|
75
82
|
useExisting: HlmStep,
|
|
@@ -104,7 +111,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
104
111
|
</ng-template>
|
|
105
112
|
`,
|
|
106
113
|
}]
|
|
107
|
-
}], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], stepLabelContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HlmStepLabel), { isSignal: true }] }], _lazyContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HlmStepContent), { isSignal: true }] }] } });
|
|
114
|
+
}], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], stepLabelContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HlmStepLabel), { isSignal: true }] }], _lazyContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HlmStepContent), { isSignal: true }] }] } });
|
|
108
115
|
|
|
109
116
|
const defaultConfig = {
|
|
110
117
|
animationEnabled: true,
|
|
@@ -329,6 +336,23 @@ class HlmStepper extends CdkStepper {
|
|
|
329
336
|
stepIcon(step) {
|
|
330
337
|
return step instanceof HlmStep ? step.icon() : null;
|
|
331
338
|
}
|
|
339
|
+
_headerTooltip(step) {
|
|
340
|
+
const override = step instanceof HlmStep ? step.tooltip() : null;
|
|
341
|
+
if (override === null || override === undefined) {
|
|
342
|
+
return step.label || null;
|
|
343
|
+
}
|
|
344
|
+
// BrnTooltip types templates as TemplateRef<void>; any template renders the same at runtime.
|
|
345
|
+
return override;
|
|
346
|
+
}
|
|
347
|
+
_headerTooltipPosition(step) {
|
|
348
|
+
return step instanceof HlmStep ? step.tooltipPosition() : 'bottom';
|
|
349
|
+
}
|
|
350
|
+
_headerTooltipDisabled(step) {
|
|
351
|
+
if (step instanceof HlmStep && step.tooltipDisabled()) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
return !this._headerTooltip(step);
|
|
355
|
+
}
|
|
332
356
|
_enterAnimationClass() {
|
|
333
357
|
if (!this._hasSelectionChanged()) {
|
|
334
358
|
return '';
|
|
@@ -426,6 +450,9 @@ class HlmStepper extends CdkStepper {
|
|
|
426
450
|
[labelPosition]="orientation === 'horizontal' ? labelPosition() : 'end'"
|
|
427
451
|
[indicatorMode]="indicatorMode()"
|
|
428
452
|
[icon]="stepIcon(step)"
|
|
453
|
+
[hlmTooltip]="_headerTooltip(step)"
|
|
454
|
+
[position]="_headerTooltipPosition(step)"
|
|
455
|
+
[tooltipDisabled]="_headerTooltipDisabled(step)"
|
|
429
456
|
/>
|
|
430
457
|
</ng-template>
|
|
431
458
|
|
|
@@ -472,13 +499,13 @@ class HlmStepper extends CdkStepper {
|
|
|
472
499
|
}
|
|
473
500
|
</div>
|
|
474
501
|
</ng-template>
|
|
475
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CdkStepperModule }, { kind: "directive", type: i1.CdkStepHeader, selector: "[cdkStepHeader]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: HlmStepHeader, selector: "hlm-step-header", inputs: ["state", "label", "errorMessage", "index", "selected", "reached", "active", "optional", "disabled", "icon", "indicatorMode", "labelPosition"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
502
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CdkStepperModule }, { kind: "directive", type: i1.CdkStepHeader, selector: "[cdkStepHeader]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: HlmStepHeader, selector: "hlm-step-header", inputs: ["state", "label", "errorMessage", "index", "selected", "reached", "active", "optional", "disabled", "icon", "indicatorMode", "labelPosition"] }, { kind: "directive", type: HlmTooltip, selector: "[hlmTooltip]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
476
503
|
}
|
|
477
504
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepper, decorators: [{
|
|
478
505
|
type: Component,
|
|
479
506
|
args: [{
|
|
480
507
|
selector: 'hlm-stepper',
|
|
481
|
-
imports: [CdkStepperModule, NgTemplateOutlet, HlmStepHeader],
|
|
508
|
+
imports: [CdkStepperModule, NgTemplateOutlet, HlmStepHeader, HlmTooltip],
|
|
482
509
|
providers: [{ provide: CdkStepper, useExisting: HlmStepper }],
|
|
483
510
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
484
511
|
template: `
|
|
@@ -556,6 +583,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
556
583
|
[labelPosition]="orientation === 'horizontal' ? labelPosition() : 'end'"
|
|
557
584
|
[indicatorMode]="indicatorMode()"
|
|
558
585
|
[icon]="stepIcon(step)"
|
|
586
|
+
[hlmTooltip]="_headerTooltip(step)"
|
|
587
|
+
[position]="_headerTooltipPosition(step)"
|
|
588
|
+
[tooltipDisabled]="_headerTooltipDisabled(step)"
|
|
559
589
|
/>
|
|
560
590
|
</ng-template>
|
|
561
591
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ValueProvider, TemplateRef } from '@angular/core';
|
|
3
3
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
4
4
|
import { CdkStepLabel, CdkStep, CdkStepHeader, CdkStepper, CdkStepperNext, CdkStepperPrevious } from '@angular/cdk/stepper';
|
|
5
5
|
|
|
@@ -8,10 +8,26 @@ declare class HlmStepLabel extends CdkStepLabel {
|
|
|
8
8
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HlmStepLabel, "[hlmStepLabel]", never, {}, {}, never, never, true, never>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
type HlmStepperLabelPosition = 'end' | 'bottom';
|
|
12
|
+
type HlmStepperHeaderPosition = 'top' | 'bottom';
|
|
13
|
+
type HlmStepperIndicatorMode = 'number' | 'state' | 'icon';
|
|
14
|
+
type HlmStepTooltipPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
15
|
+
interface HlmStepperConfig {
|
|
16
|
+
animationEnabled: boolean;
|
|
17
|
+
animationDuration: number;
|
|
18
|
+
defaultIndicatorMode: HlmStepperIndicatorMode;
|
|
19
|
+
}
|
|
20
|
+
declare function provideHlmStepperConfig(config: Partial<HlmStepperConfig>): ValueProvider;
|
|
21
|
+
declare function injectHlmStepperConfig(): HlmStepperConfig;
|
|
22
|
+
|
|
11
23
|
declare class HlmStep extends CdkStep {
|
|
12
24
|
private readonly _viewContainerRef;
|
|
13
25
|
private readonly _destroyRef;
|
|
14
26
|
readonly icon: _angular_core.InputSignal<string | null>;
|
|
27
|
+
/** Styled header tooltip override. Falls back to the full string label when unset. */
|
|
28
|
+
readonly tooltip: _angular_core.InputSignal<string | TemplateRef<unknown> | null>;
|
|
29
|
+
readonly tooltipPosition: _angular_core.InputSignal<HlmStepTooltipPosition>;
|
|
30
|
+
readonly tooltipDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
15
31
|
/** Content for step label given by `<ng-template hlmStepLabel>`. */
|
|
16
32
|
readonly stepLabelContent: _angular_core.Signal<HlmStepLabel | undefined>;
|
|
17
33
|
/** Content that will be rendered lazily. */
|
|
@@ -20,7 +36,7 @@ declare class HlmStep extends CdkStep {
|
|
|
20
36
|
portal: TemplatePortal<unknown> | null;
|
|
21
37
|
constructor();
|
|
22
38
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStep, never>;
|
|
23
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmStep, "hlm-step", ["hlmStep"], { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, ["stepLabelContent", "_lazyContent"], ["*"], true, never>;
|
|
39
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmStep, "hlm-step", ["hlmStep"], { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "tooltip": { "alias": "tooltip"; "required": false; "isSignal": true; }; "tooltipPosition": { "alias": "tooltipPosition"; "required": false; "isSignal": true; }; "tooltipDisabled": { "alias": "tooltipDisabled"; "required": false; "isSignal": true; }; }, {}, ["stepLabelContent", "_lazyContent"], ["*"], true, never>;
|
|
24
40
|
}
|
|
25
41
|
|
|
26
42
|
/**
|
|
@@ -32,17 +48,6 @@ declare class HlmStepContent<C> {
|
|
|
32
48
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HlmStepContent<any>, "ng-template[hlmStepContent]", never, {}, {}, never, never, true, never>;
|
|
33
49
|
}
|
|
34
50
|
|
|
35
|
-
type HlmStepperLabelPosition = 'end' | 'bottom';
|
|
36
|
-
type HlmStepperHeaderPosition = 'top' | 'bottom';
|
|
37
|
-
type HlmStepperIndicatorMode = 'number' | 'state' | 'icon';
|
|
38
|
-
interface HlmStepperConfig {
|
|
39
|
-
animationEnabled: boolean;
|
|
40
|
-
animationDuration: number;
|
|
41
|
-
defaultIndicatorMode: HlmStepperIndicatorMode;
|
|
42
|
-
}
|
|
43
|
-
declare function provideHlmStepperConfig(config: Partial<HlmStepperConfig>): ValueProvider;
|
|
44
|
-
declare function injectHlmStepperConfig(): HlmStepperConfig;
|
|
45
|
-
|
|
46
51
|
declare class HlmStepHeader extends CdkStepHeader {
|
|
47
52
|
private readonly _config;
|
|
48
53
|
readonly state: _angular_core.InputSignal<string>;
|
|
@@ -84,6 +89,9 @@ declare class HlmStepper extends CdkStepper {
|
|
|
84
89
|
constructor();
|
|
85
90
|
next(): void;
|
|
86
91
|
protected stepIcon(step: CdkStep): string | null;
|
|
92
|
+
protected _headerTooltip(step: CdkStep): string | TemplateRef<void> | null;
|
|
93
|
+
protected _headerTooltipPosition(step: CdkStep): HlmStepTooltipPosition;
|
|
94
|
+
protected _headerTooltipDisabled(step: CdkStep): boolean;
|
|
87
95
|
protected _enterAnimationClass(): string;
|
|
88
96
|
protected _leaveAnimationClass(): string;
|
|
89
97
|
protected _gridContainerClass(expanded: boolean): string;
|
|
@@ -113,4 +121,4 @@ declare class HlmStepperModule {
|
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
export { HlmStep, HlmStepContent, HlmStepHeader, HlmStepLabel, HlmStepper, HlmStepperImports, HlmStepperModule, HlmStepperNext, HlmStepperPrevious, injectHlmStepperConfig, provideHlmStepperConfig };
|
|
116
|
-
export type { HlmStepperConfig, HlmStepperHeaderPosition, HlmStepperIndicatorMode, HlmStepperLabelPosition };
|
|
124
|
+
export type { HlmStepTooltipPosition, HlmStepperConfig, HlmStepperHeaderPosition, HlmStepperIndicatorMode, HlmStepperLabelPosition };
|
package/table/README.md
CHANGED
|
@@ -130,6 +130,8 @@ There are **no inputs, outputs, or methods** on any table directive. Each direct
|
|
|
130
130
|
|
|
131
131
|
User `class` attributes on the same element are preserved and merged (the `classes()` helper keeps base classes).
|
|
132
132
|
|
|
133
|
+
`HlmTh`/`HlmTd` take a `size` input (`HlmTableSize`: `sm` / `default` / `lg`) scaling density one step down/up: header height `h-8` / `h-10` / `h-12`, cell padding `p-1` / `p-2` / `p-3`.
|
|
134
|
+
|
|
133
135
|
## Examples
|
|
134
136
|
|
|
135
137
|
### 1. Basic invoice table
|
package/table/fesm2022/table.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, NgModule } from '@angular/core';
|
|
3
|
-
import { classes } from '@egose/shadcn-theme-ng-tw/utils';
|
|
2
|
+
import { Directive, input, NgModule } from '@angular/core';
|
|
3
|
+
import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
4
4
|
|
|
5
5
|
class HlmTableContainer {
|
|
6
6
|
constructor() {
|
|
@@ -110,11 +110,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
110
110
|
* within an HlmTable context.
|
|
111
111
|
*/
|
|
112
112
|
class HlmTh {
|
|
113
|
+
size = input('default', /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
113
115
|
constructor() {
|
|
114
|
-
classes(() => 'tw:text-foreground tw:h-10 tw:px-2 tw:text-start tw:align-middle tw:font-medium tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0');
|
|
116
|
+
classes(() => hlm('tw:text-foreground tw:h-10 tw:px-2 tw:text-start tw:align-middle tw:font-medium tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0', this.size() === 'sm' ? 'tw:h-8' : this.size() === 'lg' ? 'tw:h-12' : ''));
|
|
115
117
|
}
|
|
116
118
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTh, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
117
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
119
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmTh, isStandalone: true, selector: "th[hlmTh],th[hlmTableHead]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-head" } }, ngImport: i0 });
|
|
118
120
|
}
|
|
119
121
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTh, decorators: [{
|
|
120
122
|
type: Directive,
|
|
@@ -122,17 +124,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
122
124
|
selector: 'th[hlmTh],th[hlmTableHead]',
|
|
123
125
|
host: { 'data-slot': 'table-head' },
|
|
124
126
|
}]
|
|
125
|
-
}], ctorParameters: () => [] });
|
|
127
|
+
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
126
128
|
/**
|
|
127
129
|
* Directive to apply Shadcn-like styling to a <td> element
|
|
128
130
|
* within an HlmTable context.
|
|
129
131
|
*/
|
|
130
132
|
class HlmTd {
|
|
133
|
+
size = input('default', /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
131
135
|
constructor() {
|
|
132
|
-
classes(() => 'tw:p-2 tw:align-middle tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0');
|
|
136
|
+
classes(() => hlm('tw:p-2 tw:align-middle tw:whitespace-nowrap tw:[&:has([role=checkbox])]:pe-0', this.size() === 'sm' ? 'tw:p-1' : this.size() === 'lg' ? 'tw:p-3' : ''));
|
|
133
137
|
}
|
|
134
138
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTd, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
135
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
139
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmTd, isStandalone: true, selector: "td[hlmTd],td[hlmTableCell]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "table-cell" } }, ngImport: i0 });
|
|
136
140
|
}
|
|
137
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmTd, decorators: [{
|
|
138
142
|
type: Directive,
|
|
@@ -140,7 +144,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
140
144
|
selector: 'td[hlmTd],td[hlmTableCell]',
|
|
141
145
|
host: { 'data-slot': 'table-cell' },
|
|
142
146
|
}]
|
|
143
|
-
}], ctorParameters: () => [] });
|
|
147
|
+
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
144
148
|
/**
|
|
145
149
|
* Directive to apply Shadcn-like styling to a <caption> element
|
|
146
150
|
* within an HlmTable context.
|