@egose/shadcn-theme-ng 0.0.28 → 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 +130 -13
- package/accordion/README.md +376 -34
- package/accordion/fesm2022/accordion.mjs +27 -39
- package/alert/README.md +343 -34
- package/alert/fesm2022/alert.mjs +47 -47
- package/alert-dialog/README.md +471 -5
- package/alert-dialog/fesm2022/alert-dialog.mjs +47 -47
- package/aspect-ratio/README.md +272 -5
- package/aspect-ratio/fesm2022/aspect-ratio.mjs +9 -9
- package/autocomplete/README.md +473 -34
- package/autocomplete/fesm2022/autocomplete.mjs +53 -71
- package/avatar/README.md +357 -5
- package/avatar/fesm2022/avatar.mjs +32 -32
- package/badge/README.md +289 -34
- package/badge/fesm2022/badge.mjs +57 -57
- package/basic-alert/README.md +324 -34
- package/basic-alert/fesm2022/basic-alert.mjs +6 -18
- package/breadcrumb/README.md +406 -5
- package/breadcrumb/fesm2022/breadcrumb.mjs +33 -39
- package/button/README.md +453 -34
- package/button/fesm2022/button.mjs +147 -219
- package/button/types/button.d.ts +7 -10
- package/button-group/README.md +318 -5
- package/button-group/fesm2022/button-group.mjs +20 -20
- package/calendar/README.md +328 -34
- package/calendar/fesm2022/calendar.mjs +29 -743
- package/card/README.md +331 -5
- package/card/fesm2022/card.mjs +33 -33
- package/carousel/README.md +333 -5
- package/carousel/fesm2022/carousel.mjs +39 -78
- package/checkbox/README.md +291 -34
- package/checkbox/fesm2022/checkbox.mjs +20 -58
- package/checkbox/types/checkbox.d.ts +5 -4
- package/collapsible/README.md +332 -5
- package/collapsible/fesm2022/collapsible.mjs +15 -15
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +91 -224
- package/command/README.md +435 -5
- package/command/fesm2022/command.mjs +49 -109
- package/confirmation-dialog/README.md +272 -34
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +15 -40
- package/confirmation-dialog/types/confirmation-dialog.d.ts +8 -4
- package/context-menu/README.md +366 -5
- package/context-menu/fesm2022/context-menu.mjs +9 -9
- package/date-picker/README.md +436 -34
- package/date-picker/fesm2022/date-picker.mjs +64 -267
- package/date-picker/types/date-picker.d.ts +7 -3
- package/dialog/README.md +419 -34
- package/dialog/fesm2022/dialog.mjs +45 -71
- package/drawer/README.md +395 -5
- package/drawer/fesm2022/drawer.mjs +44 -54
- package/dropdown-menu/README.md +417 -5
- package/dropdown-menu/fesm2022/dropdown-menu.mjs +82 -70
- package/dropdown-menu/types/dropdown-menu.d.ts +4 -0
- package/empty/README.md +329 -5
- package/empty/fesm2022/empty.mjs +30 -30
- package/field/README.md +385 -5
- package/field/fesm2022/field.mjs +56 -72
- package/form-checkbox/README.md +283 -34
- package/form-checkbox/fesm2022/form-checkbox.mjs +25 -85
- package/form-checkbox/types/form-checkbox.d.ts +7 -1
- package/form-date-picker/README.md +293 -34
- package/form-date-picker/fesm2022/form-date-picker.mjs +31 -84
- package/form-date-picker/types/form-date-picker.d.ts +7 -1
- package/form-field/README.md +327 -34
- package/form-field/fesm2022/form-field.mjs +33 -19
- package/form-field/types/form-field.d.ts +28 -20
- package/form-field-simple/README.md +311 -34
- package/form-field-simple/fesm2022/form-field-simple.mjs +4 -4
- package/form-searchable-multiselect/README.md +332 -34
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +31 -91
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +7 -1
- package/form-select/README.md +321 -34
- package/form-select/fesm2022/form-select.mjs +32 -149
- package/form-select/types/form-select.d.ts +7 -1
- package/form-text-input/README.md +342 -34
- package/form-text-input/fesm2022/form-text-input.mjs +35 -149
- package/form-text-input/types/form-text-input.d.ts +9 -12
- package/form-textarea/README.md +318 -34
- package/form-textarea/fesm2022/form-textarea.mjs +34 -109
- package/form-textarea/types/form-textarea.d.ts +8 -1
- package/hover-card/README.md +256 -5
- package/hover-card/fesm2022/hover-card.mjs +19 -19
- package/icon/README.md +210 -34
- package/icon/fesm2022/icon.mjs +8 -8
- package/input/README.md +240 -34
- package/input/fesm2022/input.mjs +17 -12
- package/input/types/input.d.ts +2 -1
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +34 -34
- package/input-otp/README.md +375 -5
- package/input-otp/fesm2022/input-otp.mjs +26 -26
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +53 -53
- package/kbd/README.md +291 -5
- package/kbd/fesm2022/kbd.mjs +12 -12
- package/label/README.md +243 -34
- package/label/fesm2022/label.mjs +10 -10
- package/label/types/label.d.ts +1 -1
- package/layout-simple/README.md +174 -44
- package/layout-simple/fesm2022/layout-simple.mjs +508 -603
- package/layout-simple/types/layout-simple.d.ts +179 -128
- package/menu/README.md +418 -0
- package/menu/fesm2022/menu.mjs +455 -0
- package/menu/package.json +24 -0
- package/menu/types/menu.d.ts +137 -0
- package/menubar/README.md +343 -5
- package/menubar/fesm2022/menubar.mjs +13 -13
- package/native-select/README.md +323 -5
- package/native-select/fesm2022/native-select.mjs +19 -19
- package/navigation-menu/README.md +369 -5
- package/navigation-menu/fesm2022/navigation-menu.mjs +35 -47
- package/package.json +183 -154
- package/pagination/README.md +388 -5
- package/pagination/fesm2022/pagination.mjs +45 -331
- package/popover/README.md +302 -34
- package/popover/fesm2022/popover.mjs +30 -30
- package/progress/README.md +311 -5
- package/progress/fesm2022/progress.mjs +13 -13
- package/radio-group/README.md +335 -34
- package/radio-group/fesm2022/radio-group.mjs +26 -19
- package/radio-group/types/radio-group.d.ts +1 -1
- package/resizable/README.md +269 -5
- package/resizable/fesm2022/resizable.mjs +18 -26
- package/scroll-area/README.md +233 -5
- package/scroll-area/fesm2022/scroll-area.mjs +9 -9
- package/searchable-multiselect/README.md +294 -34
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +28 -117
- package/searchable-multiselect/types/searchable-multiselect.d.ts +8 -2
- package/select/README.md +408 -34
- package/select/fesm2022/select.mjs +71 -111
- package/select/types/select.d.ts +3 -1
- package/separator/README.md +193 -34
- package/separator/fesm2022/separator.mjs +9 -9
- package/separator/types/separator.d.ts +1 -1
- package/sheet/README.md +282 -34
- package/sheet/fesm2022/sheet.mjs +41 -53
- package/sidebar/README.md +457 -5
- package/sidebar/fesm2022/sidebar.mjs +125 -227
- package/skeleton/README.md +217 -5
- package/skeleton/fesm2022/skeleton.mjs +9 -9
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +10 -80
- package/sonner/README.md +317 -34
- package/sonner/fesm2022/sonner.mjs +13 -13
- package/spinner/README.md +255 -34
- package/spinner/fesm2022/spinner.mjs +11 -11
- package/switch/README.md +281 -34
- package/switch/fesm2022/switch.mjs +13 -15
- package/table/README.md +423 -5
- package/table/fesm2022/table.mjs +41 -41
- package/tabs/README.md +382 -34
- package/tabs/fesm2022/tabs.mjs +35 -111
- package/textarea/README.md +282 -5
- package/textarea/fesm2022/textarea.mjs +9 -9
- package/toggle/README.md +270 -5
- package/toggle/fesm2022/toggle.mjs +13 -13
- package/toggle-group/README.md +340 -5
- package/toggle-group/fesm2022/toggle-group.mjs +13 -13
- package/toggle-group/types/toggle-group.d.ts +13 -7
- package/tooltip/README.md +240 -34
- package/tooltip/fesm2022/tooltip.mjs +14 -14
- package/typography/README.md +271 -5
- package/typography/fesm2022/typography.mjs +53 -53
- package/typography/types/typography.d.ts +19 -19
- package/utils/README.md +274 -34
- package/utils/fesm2022/utils.mjs +68 -44
- package/accordion/fesm2022/accordion.mjs.map +0 -1
- package/alert/fesm2022/alert.mjs.map +0 -1
- package/alert-dialog/fesm2022/alert-dialog.mjs.map +0 -1
- package/aspect-ratio/fesm2022/aspect-ratio.mjs.map +0 -1
- package/autocomplete/fesm2022/autocomplete.mjs.map +0 -1
- package/avatar/fesm2022/avatar.mjs.map +0 -1
- package/badge/fesm2022/badge.mjs.map +0 -1
- package/basic-alert/fesm2022/basic-alert.mjs.map +0 -1
- package/breadcrumb/fesm2022/breadcrumb.mjs.map +0 -1
- package/button/fesm2022/button.mjs.map +0 -1
- package/button-group/fesm2022/button-group.mjs.map +0 -1
- package/calendar/fesm2022/calendar.mjs.map +0 -1
- package/card/fesm2022/card.mjs.map +0 -1
- package/carousel/fesm2022/carousel.mjs.map +0 -1
- package/checkbox/fesm2022/checkbox.mjs.map +0 -1
- package/collapsible/fesm2022/collapsible.mjs.map +0 -1
- package/combobox/fesm2022/combobox.mjs.map +0 -1
- package/command/fesm2022/command.mjs.map +0 -1
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs.map +0 -1
- package/context-menu/fesm2022/context-menu.mjs.map +0 -1
- package/date-picker/fesm2022/date-picker.mjs.map +0 -1
- package/dialog/fesm2022/dialog.mjs.map +0 -1
- package/drawer/fesm2022/drawer.mjs.map +0 -1
- package/dropdown-menu/fesm2022/dropdown-menu.mjs.map +0 -1
- package/empty/fesm2022/empty.mjs.map +0 -1
- package/field/fesm2022/field.mjs.map +0 -1
- package/form-checkbox/fesm2022/form-checkbox.mjs.map +0 -1
- package/form-date-picker/fesm2022/form-date-picker.mjs.map +0 -1
- package/form-field/fesm2022/form-field.mjs.map +0 -1
- package/form-field-simple/fesm2022/form-field-simple.mjs.map +0 -1
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs.map +0 -1
- package/form-select/fesm2022/form-select.mjs.map +0 -1
- package/form-text-input/fesm2022/form-text-input.mjs.map +0 -1
- package/form-textarea/fesm2022/form-textarea.mjs.map +0 -1
- package/hover-card/fesm2022/hover-card.mjs.map +0 -1
- package/icon/fesm2022/icon.mjs.map +0 -1
- package/input/fesm2022/input.mjs.map +0 -1
- package/input-group/fesm2022/input-group.mjs.map +0 -1
- package/input-otp/fesm2022/input-otp.mjs.map +0 -1
- package/item/fesm2022/item.mjs.map +0 -1
- package/kbd/fesm2022/kbd.mjs.map +0 -1
- package/label/fesm2022/label.mjs.map +0 -1
- package/layout-simple/fesm2022/layout-simple.mjs.map +0 -1
- package/menubar/fesm2022/menubar.mjs.map +0 -1
- package/native-select/fesm2022/native-select.mjs.map +0 -1
- package/navigation-menu/fesm2022/navigation-menu.mjs.map +0 -1
- package/pagination/fesm2022/pagination.mjs.map +0 -1
- package/popover/fesm2022/popover.mjs.map +0 -1
- package/progress/fesm2022/progress.mjs.map +0 -1
- package/radio-group/fesm2022/radio-group.mjs.map +0 -1
- package/resizable/fesm2022/resizable.mjs.map +0 -1
- package/scroll-area/fesm2022/scroll-area.mjs.map +0 -1
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs.map +0 -1
- package/select/fesm2022/select.mjs.map +0 -1
- package/separator/fesm2022/separator.mjs.map +0 -1
- package/sheet/fesm2022/sheet.mjs.map +0 -1
- package/sidebar/fesm2022/sidebar.mjs.map +0 -1
- package/skeleton/fesm2022/skeleton.mjs.map +0 -1
- package/slider/fesm2022/slider.mjs.map +0 -1
- package/sonner/fesm2022/sonner.mjs.map +0 -1
- package/spinner/fesm2022/spinner.mjs.map +0 -1
- package/switch/fesm2022/switch.mjs.map +0 -1
- package/table/fesm2022/table.mjs.map +0 -1
- package/tabs/fesm2022/tabs.mjs.map +0 -1
- package/textarea/fesm2022/textarea.mjs.map +0 -1
- package/toggle/fesm2022/toggle.mjs.map +0 -1
- package/toggle-group/fesm2022/toggle-group.mjs.map +0 -1
- package/tooltip/fesm2022/tooltip.mjs.map +0 -1
- package/typography/fesm2022/typography.mjs.map +0 -1
- package/utils/fesm2022/utils.mjs.map +0 -1
|
@@ -10,12 +10,12 @@ import { provideHlmIconConfig } from '@egose/shadcn-theme-ng/icon';
|
|
|
10
10
|
class HlmAccordion {
|
|
11
11
|
_brn = inject(BrnAccordion);
|
|
12
12
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
13
|
-
_computedClass = computed(() => hlm(
|
|
13
|
+
_computedClass = computed(() => hlm("flex", this._brn.orientation() === 'horizontal' ? "flex-row" : "flex-col", this.userClass()), /* @ts-ignore */
|
|
14
14
|
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
15
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
16
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
15
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordion, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
16
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmAccordion, isStandalone: true, selector: "[hlmAccordion], hlm-accordion", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, hostDirectives: [{ directive: i1.BrnAccordion, inputs: ["type", "type", "orientation", "orientation"] }], ngImport: i0 });
|
|
17
17
|
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordion, decorators: [{
|
|
19
19
|
type: Directive,
|
|
20
20
|
args: [{
|
|
21
21
|
selector: '[hlmAccordion], hlm-accordion',
|
|
@@ -29,30 +29,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
29
29
|
class HlmAccordionContent extends BrnAccordionContent {
|
|
30
30
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
31
31
|
_computedClass = computed(() => {
|
|
32
|
-
const gridRows = this.state() === 'open' ?
|
|
33
|
-
return hlm(
|
|
32
|
+
const gridRows = this.state() === 'open' ? "grid-rows-[1fr]" : "hidden";
|
|
33
|
+
return hlm("grid text-sm transition-all", gridRows, this.userClass());
|
|
34
34
|
}, /* @ts-ignore */
|
|
35
35
|
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
36
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
37
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
38
|
-
<div [attr.inert]="_inert()" style="overflow:hidden">
|
|
39
|
-
<div class="flex flex-col gap-4 text-balance pb-4 pt-0">
|
|
40
|
-
<ng-content />
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
36
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionContent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
37
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: HlmAccordionContent, isStandalone: true, selector: "hlm-accordion-content", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, usesInheritance: true, ngImport: i0, template: "\n <div [attr.inert]=\"_inert()\" style=\"tw:overflow:hidden\">\n <div class=\"flex flex-col gap-4 text-balance pb-4 pt-0\">\n <ng-content />\n </div>\n </div>\n ", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
44
38
|
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionContent, decorators: [{
|
|
46
40
|
type: Component,
|
|
47
41
|
args: [{
|
|
48
42
|
selector: 'hlm-accordion-content',
|
|
49
|
-
template:
|
|
50
|
-
<div [attr.inert]="_inert()" style="overflow:hidden">
|
|
51
|
-
<div class="flex flex-col gap-4 text-balance pb-4 pt-0">
|
|
52
|
-
<ng-content />
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
`,
|
|
43
|
+
template: "\n <div [attr.inert]=\"_inert()\" style=\"tw:overflow:hidden\">\n <div class=\"flex flex-col gap-4 text-balance pb-4 pt-0\">\n <ng-content />\n </div>\n </div>\n ",
|
|
56
44
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
57
45
|
encapsulation: ViewEncapsulation.None,
|
|
58
46
|
host: {
|
|
@@ -63,12 +51,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
63
51
|
|
|
64
52
|
class HlmAccordionIcon {
|
|
65
53
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
66
|
-
_computedClass = computed(() => hlm(
|
|
54
|
+
_computedClass = computed(() => hlm("text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200", this.userClass()), /* @ts-ignore */
|
|
67
55
|
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
68
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
69
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
57
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmAccordionIcon, isStandalone: true, selector: "ng-icon[egAccordionIcon], ng-icon[hlmAccIcon]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, providers: [provideIcons({ lucideChevronDown }), provideHlmIconConfig({ size: 'sm' })], ngImport: i0 });
|
|
70
58
|
}
|
|
71
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionIcon, decorators: [{
|
|
72
60
|
type: Directive,
|
|
73
61
|
args: [{
|
|
74
62
|
selector: 'ng-icon[egAccordionIcon], ng-icon[hlmAccIcon]',
|
|
@@ -81,12 +69,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
81
69
|
|
|
82
70
|
class HlmAccordionItem {
|
|
83
71
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
84
|
-
_computedClass = computed(() => hlm(
|
|
72
|
+
_computedClass = computed(() => hlm("border-border flex flex-1 flex-col border-b", this.userClass()), /* @ts-ignore */
|
|
85
73
|
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
86
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
87
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
74
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
75
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmAccordionItem, isStandalone: true, selector: "[hlmAccordionItem],brn-accordion-item[hlm],hlm-accordion-item", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, hostDirectives: [{ directive: i1.BrnAccordionItem, inputs: ["isOpened", "isOpened"] }], ngImport: i0 });
|
|
88
76
|
}
|
|
89
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionItem, decorators: [{
|
|
90
78
|
type: Directive,
|
|
91
79
|
args: [{
|
|
92
80
|
selector: '[hlmAccordionItem],brn-accordion-item[hlm],hlm-accordion-item',
|
|
@@ -104,12 +92,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
104
92
|
|
|
105
93
|
class HlmAccordionTrigger {
|
|
106
94
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
107
|
-
_computedClass = computed(() => hlm(
|
|
95
|
+
_computedClass = computed(() => hlm("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-none transition-all hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>[egAccIcon]]:rotate-180", this.userClass()), /* @ts-ignore */
|
|
108
96
|
...(ngDevMode ? [{ debugName: "_computedClass" }] : /* istanbul ignore next */ []));
|
|
109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
110
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
98
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmAccordionTrigger, isStandalone: true, selector: "[hlmAccordionTrigger]", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.--tw-ring-offset-shadow": "\"0 0 #000\"", "class": "_computedClass()" } }, hostDirectives: [{ directive: i1.BrnAccordionTrigger }], ngImport: i0 });
|
|
111
99
|
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionTrigger, decorators: [{
|
|
113
101
|
type: Directive,
|
|
114
102
|
args: [{
|
|
115
103
|
selector: '[hlmAccordionTrigger]',
|
|
@@ -132,8 +120,8 @@ const HlmAccordionImports = [
|
|
|
132
120
|
HlmAccordionContent,
|
|
133
121
|
];
|
|
134
122
|
class HlmAccordionModule {
|
|
135
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
136
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.
|
|
123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
124
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionModule, imports: [HlmAccordion,
|
|
137
125
|
HlmAccordionItem,
|
|
138
126
|
HlmAccordionTrigger,
|
|
139
127
|
HlmAccordionIcon,
|
|
@@ -142,9 +130,9 @@ class HlmAccordionModule {
|
|
|
142
130
|
HlmAccordionTrigger,
|
|
143
131
|
HlmAccordionIcon,
|
|
144
132
|
HlmAccordionContent] });
|
|
145
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.
|
|
133
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionModule });
|
|
146
134
|
}
|
|
147
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmAccordionModule, decorators: [{
|
|
148
136
|
type: NgModule,
|
|
149
137
|
args: [{
|
|
150
138
|
imports: [...HlmAccordionImports],
|
|
@@ -157,4 +145,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
157
145
|
*/
|
|
158
146
|
|
|
159
147
|
export { HlmAccordion, HlmAccordionContent, HlmAccordionIcon, HlmAccordionImports, HlmAccordionItem, HlmAccordionModule, HlmAccordionTrigger };
|
|
160
|
-
|
|
148
|
+
|
package/alert/README.md
CHANGED
|
@@ -1,64 +1,373 @@
|
|
|
1
|
-
# Alert
|
|
1
|
+
# Alert (`@egose/shadcn-theme-ng/alert`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A non-modal status banner in the shadcn/ui Alert style: an icon, a title, and a description
|
|
4
|
+
arranged in a bordered, tone-colored box. Use it for inline feedback (success confirmations,
|
|
5
|
+
warnings, informational hints) that stays visible in the page flow.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
This is a **pure styling layer — no brain primitive underneath**. `HlmAlert` and its pieces are
|
|
8
|
+
plain attribute directives that compute shadcn classes with `cva` + `hlm()` from
|
|
9
|
+
`@egose/shadcn-theme-ng/utils`. The host gets `role="alert"` automatically. `HlmAlertIcon` only
|
|
10
|
+
applies the `sm` icon-size config (`provideHlmIconConfig`); pair it with an `ng-icon`.
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
> **Ships as:** `@egose/shadcn-theme-ng/alert` and `@egose/shadcn-theme-ng-tw/alert`
|
|
13
|
+
> (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
|
|
14
|
+
> emitted Tailwind class strings differ. See the [package README](../../README.md) for install
|
|
15
|
+
> steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
8
18
|
|
|
9
19
|
```bash
|
|
10
|
-
|
|
20
|
+
# Plain Tailwind (no prefix)
|
|
21
|
+
npm install @egose/shadcn-theme-ng
|
|
22
|
+
|
|
23
|
+
# tw:-prefixed Tailwind variant
|
|
24
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
11
25
|
```
|
|
12
26
|
|
|
13
|
-
|
|
27
|
+
Peer dependencies (Angular, `@spartan-ng/brain`, `@ng-icons/*`, `rxjs`, …) are documented in the
|
|
28
|
+
[package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
|
|
29
|
+
`@egose/shadcn-theme-ng/utils` (`hlm()`) and `@egose/shadcn-theme-ng/icon`
|
|
30
|
+
(`provideHlmIconConfig`).
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
## Imports
|
|
33
|
+
|
|
34
|
+
All symbols are exported from the subpath root (`projects/alert/src/public-api.ts`):
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import {
|
|
38
|
+
HlmAlert,
|
|
39
|
+
HlmAlertTitle,
|
|
40
|
+
HlmAlertDescription,
|
|
41
|
+
HlmAlertIcon,
|
|
42
|
+
HlmAlertImports,
|
|
43
|
+
HlmAlertModule,
|
|
44
|
+
type AlertVariants,
|
|
45
|
+
type VariantType,
|
|
46
|
+
type AppearanceType,
|
|
47
|
+
} from '@egose/shadcn-theme-ng/alert';
|
|
48
|
+
// tw variant: replace with '@egose/shadcn-theme-ng-tw/alert'
|
|
17
49
|
```
|
|
18
50
|
|
|
19
|
-
|
|
51
|
+
Standalone component — spread the `*Imports` array:
|
|
20
52
|
|
|
21
|
-
|
|
53
|
+
```ts
|
|
54
|
+
import { Component } from '@angular/core';
|
|
55
|
+
import { HlmAlertImports } from '@egose/shadcn-theme-ng/alert';
|
|
22
56
|
|
|
23
|
-
|
|
24
|
-
|
|
57
|
+
@Component({
|
|
58
|
+
selector: 'app-demo',
|
|
59
|
+
standalone: true,
|
|
60
|
+
imports: [...HlmAlertImports],
|
|
61
|
+
template: `...`,
|
|
62
|
+
})
|
|
63
|
+
export class DemoComponent {}
|
|
25
64
|
```
|
|
26
65
|
|
|
27
|
-
|
|
66
|
+
NgModule-based consumer — import the module:
|
|
28
67
|
|
|
29
|
-
|
|
68
|
+
```ts
|
|
69
|
+
import { NgModule } from '@angular/core';
|
|
70
|
+
import { HlmAlertModule } from '@egose/shadcn-theme-ng/alert';
|
|
30
71
|
|
|
31
|
-
|
|
72
|
+
@NgModule({ imports: [HlmAlertModule] })
|
|
73
|
+
export class DemoModule {}
|
|
74
|
+
```
|
|
32
75
|
|
|
33
|
-
|
|
76
|
+
## Anatomy / Structure
|
|
34
77
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
78
|
+
```html
|
|
79
|
+
<div hlmAlert variant="info" appearance="solid">
|
|
80
|
+
<ng-icon hlm hlmAlertIcon name="lucideInfo" />
|
|
81
|
+
<h4 hlmAlertTitle>Heads up</h4>
|
|
82
|
+
<p hlmAlertDescription>Detail text goes here.</p>
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
38
85
|
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
86
|
+
Real selectors (from source):
|
|
43
87
|
|
|
44
|
-
|
|
88
|
+
| Class | Selector(s) | Kind |
|
|
89
|
+
| --------------------- | --------------------------------------- | --------- |
|
|
90
|
+
| `HlmAlert` | `[hlmAlert]` | Directive |
|
|
91
|
+
| `HlmAlertTitle` | `[hlmAlertTitle]` | Directive |
|
|
92
|
+
| `HlmAlertDescription` | `[hlmAlertDesc], [hlmAlertDescription]` | Directive |
|
|
93
|
+
| `HlmAlertIcon` | `[hlmAlertIcon]` | Directive |
|
|
45
94
|
|
|
46
|
-
|
|
95
|
+
When an `[hlmAlertIcon]` child is present, the host switches to a two-column grid
|
|
96
|
+
(`grid-cols-[calc(theme(spacing.1)*4)_1fr]`) with the title/description placed in column 2 —
|
|
97
|
+
no extra markup needed.
|
|
47
98
|
|
|
48
|
-
|
|
49
|
-
|
|
99
|
+
## API reference
|
|
100
|
+
|
|
101
|
+
### `HlmAlert` — `[hlmAlert]`
|
|
102
|
+
|
|
103
|
+
| Input | Type | Default | Description |
|
|
104
|
+
| ------------ | -------------------------------------- | ----------- | ---------------------------------------------------------------- |
|
|
105
|
+
| `variant` | `AlertVariants['variant']` (see below) | `'primary'` | Color tone. |
|
|
106
|
+
| `appearance` | `AlertVariants['appearance']` | `'solid'` | `'solid'` (saturated fill) or `'light'` (tinted `bg-*/20` fill). |
|
|
107
|
+
| `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
|
|
108
|
+
|
|
109
|
+
`variant` values: `primary` · `secondary` · `success` · `warning` · `danger` · `info` ·
|
|
110
|
+
`light` · `dark` · `accent` · `destructive` · `muted` · `link` · `ghost`.
|
|
111
|
+
|
|
112
|
+
`appearance` values: `solid` · `light`. Every `variant × light` pair has a dedicated
|
|
113
|
+
`compoundVariants` entry (e.g. `warning + light` → `bg-warning/20 text-warning`).
|
|
114
|
+
|
|
115
|
+
Exported helper types: `AlertVariants` (`VariantProps<typeof alertVariants>`), `VariantType`,
|
|
116
|
+
`AppearanceType`.
|
|
117
|
+
|
|
118
|
+
### `HlmAlertTitle` — `[hlmAlertTitle]`
|
|
119
|
+
|
|
120
|
+
| Input | Type | Default | Description |
|
|
121
|
+
| ------- | ------------ | ------- | --------------------------------- |
|
|
122
|
+
| `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
|
|
123
|
+
|
|
124
|
+
Renders semibold, tracking-tight, single-line-clamped title text in grid column 2.
|
|
125
|
+
|
|
126
|
+
### `HlmAlertDescription` — `[hlmAlertDesc], [hlmAlertDescription]`
|
|
127
|
+
|
|
128
|
+
| Input | Type | Default | Description |
|
|
129
|
+
| ------- | ------------ | ------- | --------------------------------- |
|
|
130
|
+
| `class` | `ClassValue` | `''` | Extra classes merged via `hlm()`. |
|
|
131
|
+
|
|
132
|
+
Small relaxed-leading body text in grid column 2. Both selector spellings are equivalent.
|
|
133
|
+
|
|
134
|
+
### `HlmAlertIcon` — `[hlmAlertIcon]`
|
|
135
|
+
|
|
136
|
+
Size-only directive: provides `provideHlmIconConfig({ size: 'sm' })` so the decorated `ng-icon`
|
|
137
|
+
renders small. It declares **no inputs** and adds no classes of its own — the parent `HlmAlert`
|
|
138
|
+
stylesheet sizes/positions it (`size-4`, `translate-y-0.5`, `text-current`).
|
|
139
|
+
|
|
140
|
+
## Examples
|
|
141
|
+
|
|
142
|
+
### 1. Basic alert with icon, title, and description
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import { Component } from '@angular/core';
|
|
146
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
147
|
+
import { lucideInfo } from '@ng-icons/lucide';
|
|
148
|
+
import { HlmAlertImports } from '@egose/shadcn-theme-ng/alert';
|
|
149
|
+
import { HlmIcon } from '@egose/shadcn-theme-ng/icon';
|
|
150
|
+
|
|
151
|
+
@Component({
|
|
152
|
+
selector: 'app-alert-basic',
|
|
153
|
+
standalone: true,
|
|
154
|
+
imports: [...HlmAlertImports, NgIcon, HlmIcon],
|
|
155
|
+
providers: [provideIcons({ lucideInfo })],
|
|
156
|
+
template: `
|
|
157
|
+
<div hlmAlert variant="info">
|
|
158
|
+
<ng-icon hlm hlmAlertIcon name="lucideInfo" />
|
|
159
|
+
<h4 hlmAlertTitle>Heads up</h4>
|
|
160
|
+
<p hlmAlertDescription>Your trial ends in 3 days. Upgrade to keep your data.</p>
|
|
161
|
+
</div>
|
|
162
|
+
`,
|
|
163
|
+
})
|
|
164
|
+
export class AlertBasicComponent {}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<app-alert-basic />
|
|
50
169
|
```
|
|
51
170
|
|
|
52
|
-
|
|
171
|
+
### 2. All variants (solid)
|
|
53
172
|
|
|
54
|
-
|
|
173
|
+
```ts
|
|
174
|
+
import { Component } from '@angular/core';
|
|
175
|
+
import { HlmAlertImports, type VariantType } from '@egose/shadcn-theme-ng/alert';
|
|
55
176
|
|
|
56
|
-
|
|
57
|
-
|
|
177
|
+
@Component({
|
|
178
|
+
selector: 'app-alert-variants',
|
|
179
|
+
standalone: true,
|
|
180
|
+
imports: [...HlmAlertImports],
|
|
181
|
+
template: `
|
|
182
|
+
@for (v of variants; track v) {
|
|
183
|
+
<div hlmAlert [variant]="v" class="tw:mb-3">
|
|
184
|
+
<h4 hlmAlertTitle class="tw:capitalize">{{ v }}</h4>
|
|
185
|
+
<p hlmAlertDescription>This is the {{ v }} tone in solid appearance.</p>
|
|
186
|
+
</div>
|
|
187
|
+
}
|
|
188
|
+
`,
|
|
189
|
+
})
|
|
190
|
+
export class AlertVariantsComponent {
|
|
191
|
+
readonly variants: VariantType[] = [
|
|
192
|
+
'primary',
|
|
193
|
+
'secondary',
|
|
194
|
+
'success',
|
|
195
|
+
'warning',
|
|
196
|
+
'danger',
|
|
197
|
+
'info',
|
|
198
|
+
'light',
|
|
199
|
+
'dark',
|
|
200
|
+
'accent',
|
|
201
|
+
'destructive',
|
|
202
|
+
'muted',
|
|
203
|
+
'link',
|
|
204
|
+
'ghost',
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 3. Light appearance + semantic states
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
import { Component } from '@angular/core';
|
|
213
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
214
|
+
import { lucideCircleCheck, lucideCircleAlert, lucideInfo } from '@ng-icons/lucide';
|
|
215
|
+
import { HlmAlertImports } from '@egose/shadcn-theme-ng/alert';
|
|
216
|
+
import { HlmIcon } from '@egose/shadcn-theme-ng/icon';
|
|
217
|
+
|
|
218
|
+
@Component({
|
|
219
|
+
selector: 'app-alert-states',
|
|
220
|
+
standalone: true,
|
|
221
|
+
imports: [...HlmAlertImports, NgIcon, HlmIcon],
|
|
222
|
+
providers: [provideIcons({ lucideCircleCheck, lucideCircleAlert, lucideInfo })],
|
|
223
|
+
template: `
|
|
224
|
+
<div hlmAlert variant="success" appearance="light" class="tw:mb-3">
|
|
225
|
+
<ng-icon hlm hlmAlertIcon name="lucideCircleCheck" />
|
|
226
|
+
<h4 hlmAlertTitle>Payment confirmed</h4>
|
|
227
|
+
<p hlmAlertDescription>Receipt #INV-2041 was emailed to you.</p>
|
|
228
|
+
</div>
|
|
229
|
+
<div hlmAlert variant="warning" appearance="light" class="tw:mb-3">
|
|
230
|
+
<ng-icon hlm hlmAlertIcon name="lucideCircleAlert" />
|
|
231
|
+
<h4 hlmAlertTitle>Storage almost full</h4>
|
|
232
|
+
<p hlmAlertDescription>You have used 9.2 of 10 GB.</p>
|
|
233
|
+
</div>
|
|
234
|
+
<div hlmAlert variant="destructive" appearance="light">
|
|
235
|
+
<ng-icon hlm hlmAlertIcon name="lucideCircleAlert" />
|
|
236
|
+
<h4 hlmAlertTitle>Deployment failed</h4>
|
|
237
|
+
<p hlmAlertDescription>Unit tests failed on step 4. See the logs.</p>
|
|
238
|
+
</div>
|
|
239
|
+
`,
|
|
240
|
+
})
|
|
241
|
+
export class AlertStatesComponent {}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 4. Conditional alert driven by a signal (form error pattern)
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
import { Component, computed, signal } from '@angular/core';
|
|
248
|
+
import { HlmAlertImports, type VariantType } from '@egose/shadcn-theme-ng/alert';
|
|
249
|
+
|
|
250
|
+
@Component({
|
|
251
|
+
selector: 'app-alert-conditional',
|
|
252
|
+
standalone: true,
|
|
253
|
+
imports: [...HlmAlertImports],
|
|
254
|
+
template: `
|
|
255
|
+
@if (tone(); as t) {
|
|
256
|
+
<div hlmAlert [variant]="t">
|
|
257
|
+
<h4 hlmAlertTitle>{{ title() }}</h4>
|
|
258
|
+
<p hlmAlertDescription>{{ message() }}</p>
|
|
259
|
+
</div>
|
|
260
|
+
}
|
|
261
|
+
<div class="tw:mt-3 tw:flex tw:gap-2">
|
|
262
|
+
<button (click)="show('success')">Succeed</button>
|
|
263
|
+
<button (click)="show('destructive')">Fail</button>
|
|
264
|
+
<button (click)="clear()">Clear</button>
|
|
265
|
+
</div>
|
|
266
|
+
`,
|
|
267
|
+
})
|
|
268
|
+
export class AlertConditionalComponent {
|
|
269
|
+
private readonly _tone = signal<VariantType | null>(null);
|
|
270
|
+
readonly tone = this._tone.asReadonly();
|
|
271
|
+
readonly title = computed(() => (this._tone() === 'success' ? 'Saved' : 'Something went wrong'));
|
|
272
|
+
readonly message = computed(() =>
|
|
273
|
+
this._tone() === 'success' ? 'Your changes were saved.' : 'Please fix the highlighted fields.',
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
show(t: VariantType) {
|
|
277
|
+
this._tone.set(t);
|
|
278
|
+
}
|
|
279
|
+
clear() {
|
|
280
|
+
this._tone.set(null);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
58
283
|
```
|
|
59
284
|
|
|
60
|
-
|
|
285
|
+
### 5. Title-only and description-only compositions
|
|
286
|
+
|
|
287
|
+
The title and description are independent directives — use either alone:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
import { Component } from '@angular/core';
|
|
291
|
+
import { HlmAlertImports } from '@egose/shadcn-theme-ng/alert';
|
|
292
|
+
|
|
293
|
+
@Component({
|
|
294
|
+
selector: 'app-alert-minimal',
|
|
295
|
+
standalone: true,
|
|
296
|
+
imports: [...HlmAlertImports],
|
|
297
|
+
template: `
|
|
298
|
+
<!-- title only -->
|
|
299
|
+
<div hlmAlert variant="muted" class="tw:mb-3">
|
|
300
|
+
<h4 hlmAlertTitle>Maintenance window: Sunday 02:00–04:00 UTC</h4>
|
|
301
|
+
</div>
|
|
302
|
+
<!-- description only, short spelling -->
|
|
303
|
+
<div hlmAlert variant="ghost">
|
|
304
|
+
<p hlmAlertDesc>Cookies help us improve. No action required.</p>
|
|
305
|
+
</div>
|
|
306
|
+
`,
|
|
307
|
+
})
|
|
308
|
+
export class AlertMinimalComponent {}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### 6. Dismissible alert + composition with a button
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
import { Component, signal } from '@angular/core';
|
|
315
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
316
|
+
import { lucideInfo, lucideX } from '@ng-icons/lucide';
|
|
317
|
+
import { HlmAlertImports } from '@egose/shadcn-theme-ng/alert';
|
|
318
|
+
import { HlmButtonImports } from '@egose/shadcn-theme-ng/button';
|
|
319
|
+
import { HlmIcon } from '@egose/shadcn-theme-ng/icon';
|
|
320
|
+
|
|
321
|
+
@Component({
|
|
322
|
+
selector: 'app-alert-dismissible',
|
|
323
|
+
standalone: true,
|
|
324
|
+
imports: [...HlmAlertImports, ...HlmButtonImports, NgIcon, HlmIcon],
|
|
325
|
+
providers: [provideIcons({ lucideInfo, lucideX })],
|
|
326
|
+
template: `
|
|
327
|
+
@if (visible()) {
|
|
328
|
+
<div hlmAlert variant="info" class="tw:relative tw:pr-12">
|
|
329
|
+
<ng-icon hlm hlmAlertIcon name="lucideInfo" />
|
|
330
|
+
<h4 hlmAlertTitle>New version available</h4>
|
|
331
|
+
<p hlmAlertDescription>Restart the app to apply v2.4.1.</p>
|
|
332
|
+
<button
|
|
333
|
+
hlmBtn
|
|
334
|
+
variant="ghost"
|
|
335
|
+
size="icon-sm"
|
|
336
|
+
class="tw:absolute tw:top-2 tw:right-2"
|
|
337
|
+
(click)="visible.set(false)"
|
|
338
|
+
aria-label="Dismiss"
|
|
339
|
+
>
|
|
340
|
+
<ng-icon hlm name="lucideX" size="sm" />
|
|
341
|
+
</button>
|
|
342
|
+
</div>
|
|
343
|
+
}
|
|
344
|
+
`,
|
|
345
|
+
})
|
|
346
|
+
export class AlertDismissibleComponent {
|
|
347
|
+
readonly visible = signal(true);
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Accessibility notes
|
|
352
|
+
|
|
353
|
+
- The host carries `role="alert"`, so assistive technology announces content injected dynamically
|
|
354
|
+
(e.g. after a failed save). For purely decorative/informational banners that should not
|
|
355
|
+
interrupt, prefer `variant="muted"` copy and consider whether a `role="status"` wrapper of your
|
|
356
|
+
own is more appropriate — the role is baked into the directive and cannot be switched off.
|
|
357
|
+
- Keep the title short and the description actionable; screen readers read both in DOM order
|
|
358
|
+
(icon → title → description).
|
|
359
|
+
- Do not put interactive controls other than a dismiss button inside an `role="alert"` region;
|
|
360
|
+
links and buttons inside the description are allowed but keep them minimal.
|
|
361
|
+
|
|
362
|
+
## Theming / CSS variables
|
|
363
|
+
|
|
364
|
+
Class-based theming via `cva` variants (`bg-*/text-*` tokens); no component-specific CSS variables.
|
|
365
|
+
Extend with `class` on any piece. The `link` and `ghost` variants are intentionally low-chrome for
|
|
366
|
+
embedding alerts in prose or cards.
|
|
61
367
|
|
|
62
|
-
##
|
|
368
|
+
## Related subpaths
|
|
63
369
|
|
|
64
|
-
|
|
370
|
+
- `@egose/shadcn-theme-ng/basic-alert` — ready-made `EgBasicAlert` (icon + title + description in one tag)
|
|
371
|
+
- `@egose/shadcn-theme-ng/badge` — inline status chips for compact labeling
|
|
372
|
+
- `@egose/shadcn-theme-ng/button` — dismiss/action buttons inside alerts
|
|
373
|
+
- `@egose/shadcn-theme-ng/icon` — `HlmIcon` sizing and `provideHlmIconConfig`
|