@molecule/app-ui-angular 1.0.5 → 1.1.1
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 +11742 -1145
- package/dist/components/accordion.component.d.ts +114 -0
- package/dist/components/accordion.component.d.ts.map +1 -0
- package/dist/components/accordion.component.js +286 -0
- package/dist/components/accordion.component.js.map +1 -0
- package/dist/components/alert.component.d.ts +81 -37
- package/dist/components/alert.component.d.ts.map +1 -1
- package/dist/components/alert.component.js +232 -146
- package/dist/components/alert.component.js.map +1 -1
- package/dist/components/auth-guard.component.d.ts +94 -0
- package/dist/components/auth-guard.component.d.ts.map +1 -0
- package/dist/components/auth-guard.component.js +212 -0
- package/dist/components/auth-guard.component.js.map +1 -0
- package/dist/components/avatar.component.d.ts +97 -0
- package/dist/components/avatar.component.d.ts.map +1 -0
- package/dist/components/avatar.component.js +216 -0
- package/dist/components/avatar.component.js.map +1 -0
- package/dist/components/badge.component.d.ts +27 -12
- package/dist/components/badge.component.d.ts.map +1 -1
- package/dist/components/badge.component.js +47 -47
- package/dist/components/badge.component.js.map +1 -1
- package/dist/components/button.component.d.ts +96 -14
- package/dist/components/button.component.d.ts.map +1 -1
- package/dist/components/button.component.js +232 -87
- package/dist/components/button.component.js.map +1 -1
- package/dist/components/card.component.d.ts +135 -0
- package/dist/components/card.component.d.ts.map +1 -0
- package/dist/components/card.component.js +291 -0
- package/dist/components/card.component.js.map +1 -0
- package/dist/components/checkbox.component.d.ts +102 -29
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.component.js +222 -113
- package/dist/components/checkbox.component.js.map +1 -1
- package/dist/components/confirm-button.component.d.ts +130 -0
- package/dist/components/confirm-button.component.d.ts.map +1 -0
- package/dist/components/confirm-button.component.js +322 -0
- package/dist/components/confirm-button.component.js.map +1 -0
- package/dist/components/confirm-dialog.component.d.ts +60 -0
- package/dist/components/confirm-dialog.component.d.ts.map +1 -0
- package/dist/components/confirm-dialog.component.js +152 -0
- package/dist/components/confirm-dialog.component.js.map +1 -0
- package/dist/components/dropdown.component.d.ts +313 -0
- package/dist/components/dropdown.component.d.ts.map +1 -0
- package/dist/components/dropdown.component.js +919 -0
- package/dist/components/dropdown.component.js.map +1 -0
- package/dist/components/empty-state.component.d.ts +73 -0
- package/dist/components/empty-state.component.d.ts.map +1 -0
- package/dist/components/empty-state.component.js +180 -0
- package/dist/components/empty-state.component.js.map +1 -0
- package/dist/components/floating-input.component.d.ts +86 -0
- package/dist/components/floating-input.component.d.ts.map +1 -0
- package/dist/components/floating-input.component.js +167 -0
- package/dist/components/floating-input.component.js.map +1 -0
- package/dist/components/form-field.component.d.ts +111 -0
- package/dist/components/form-field.component.d.ts.map +1 -0
- package/dist/components/form-field.component.js +300 -0
- package/dist/components/form-field.component.js.map +1 -0
- package/dist/components/form.component.d.ts +77 -0
- package/dist/components/form.component.d.ts.map +1 -0
- package/dist/components/form.component.js +222 -0
- package/dist/components/form.component.js.map +1 -0
- package/dist/components/icon.component.d.ts +85 -0
- package/dist/components/icon.component.d.ts.map +1 -0
- package/dist/components/icon.component.js +187 -0
- package/dist/components/icon.component.js.map +1 -0
- package/dist/components/index.d.ts +49 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +49 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/input.component.d.ts +157 -54
- package/dist/components/input.component.d.ts.map +1 -1
- package/dist/components/input.component.js +437 -222
- package/dist/components/input.component.js.map +1 -1
- package/dist/components/label.component.d.ts +29 -0
- package/dist/components/label.component.d.ts.map +1 -0
- package/dist/components/label.component.js +60 -0
- package/dist/components/label.component.js.map +1 -0
- package/dist/components/language-picker.component.d.ts +124 -0
- package/dist/components/language-picker.component.d.ts.map +1 -0
- package/dist/components/language-picker.component.js +305 -0
- package/dist/components/language-picker.component.js.map +1 -0
- package/dist/components/layout.component.d.ts +167 -0
- package/dist/components/layout.component.d.ts.map +1 -0
- package/dist/components/layout.component.js +364 -0
- package/dist/components/layout.component.js.map +1 -0
- package/dist/components/load-error-banner.component.d.ts +103 -0
- package/dist/components/load-error-banner.component.d.ts.map +1 -0
- package/dist/components/load-error-banner.component.js +263 -0
- package/dist/components/load-error-banner.component.js.map +1 -0
- package/dist/components/modal.component.d.ts +125 -95
- package/dist/components/modal.component.d.ts.map +1 -1
- package/dist/components/modal.component.js +458 -271
- package/dist/components/modal.component.js.map +1 -1
- package/dist/components/molecule/alert.component.d.ts +77 -0
- package/dist/components/molecule/alert.component.d.ts.map +1 -0
- package/dist/components/molecule/alert.component.js +229 -0
- package/dist/components/molecule/alert.component.js.map +1 -0
- package/dist/components/molecule/badge.component.d.ts +27 -0
- package/dist/components/molecule/badge.component.d.ts.map +1 -0
- package/dist/components/molecule/badge.component.js +79 -0
- package/dist/components/molecule/badge.component.js.map +1 -0
- package/dist/components/molecule/button.component.d.ts +38 -0
- package/dist/components/molecule/button.component.d.ts.map +1 -0
- package/dist/components/molecule/button.component.js +137 -0
- package/dist/components/molecule/button.component.js.map +1 -0
- package/dist/components/molecule/checkbox.component.d.ts +53 -0
- package/dist/components/molecule/checkbox.component.d.ts.map +1 -0
- package/dist/components/molecule/checkbox.component.js +166 -0
- package/dist/components/molecule/checkbox.component.js.map +1 -0
- package/dist/components/molecule/index.d.ts +18 -0
- package/dist/components/molecule/index.d.ts.map +1 -0
- package/dist/components/molecule/index.js +18 -0
- package/dist/components/molecule/index.js.map +1 -0
- package/dist/components/molecule/input.component.d.ts +93 -0
- package/dist/components/molecule/input.component.d.ts.map +1 -0
- package/dist/components/molecule/input.component.js +314 -0
- package/dist/components/molecule/input.component.js.map +1 -0
- package/dist/components/molecule/modal.component.d.ts +148 -0
- package/dist/components/molecule/modal.component.d.ts.map +1 -0
- package/dist/components/molecule/modal.component.js +382 -0
- package/dist/components/molecule/modal.component.js.map +1 -0
- package/dist/components/molecule/radio-group.component.d.ts +63 -0
- package/dist/components/molecule/radio-group.component.d.ts.map +1 -0
- package/dist/components/molecule/radio-group.component.js +208 -0
- package/dist/components/molecule/radio-group.component.js.map +1 -0
- package/dist/components/molecule/select.component.d.ts +72 -0
- package/dist/components/molecule/select.component.d.ts.map +1 -0
- package/dist/components/molecule/select.component.js +274 -0
- package/dist/components/molecule/select.component.js.map +1 -0
- package/dist/components/molecule/spinner.component.d.ts +42 -0
- package/dist/components/molecule/spinner.component.d.ts.map +1 -0
- package/dist/components/molecule/spinner.component.js +122 -0
- package/dist/components/molecule/spinner.component.js.map +1 -0
- package/dist/components/molecule/switch.component.d.ts +54 -0
- package/dist/components/molecule/switch.component.d.ts.map +1 -0
- package/dist/components/molecule/switch.component.js +148 -0
- package/dist/components/molecule/switch.component.js.map +1 -0
- package/dist/components/molecule/toast.component.d.ts +98 -0
- package/dist/components/molecule/toast.component.d.ts.map +1 -0
- package/dist/components/molecule/toast.component.js +305 -0
- package/dist/components/molecule/toast.component.js.map +1 -0
- package/dist/components/molecule/tooltip.component.d.ts +77 -0
- package/dist/components/molecule/tooltip.component.d.ts.map +1 -0
- package/dist/components/molecule/tooltip.component.js +316 -0
- package/dist/components/molecule/tooltip.component.js.map +1 -0
- package/dist/components/optimistic-toggle-button.component.d.ts +125 -0
- package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -0
- package/dist/components/optimistic-toggle-button.component.js +296 -0
- package/dist/components/optimistic-toggle-button.component.js.map +1 -0
- package/dist/components/page-header.component.d.ts +77 -0
- package/dist/components/page-header.component.d.ts.map +1 -0
- package/dist/components/page-header.component.js +225 -0
- package/dist/components/page-header.component.js.map +1 -0
- package/dist/components/page-shell.component.d.ts +101 -0
- package/dist/components/page-shell.component.d.ts.map +1 -0
- package/dist/components/page-shell.component.js +221 -0
- package/dist/components/page-shell.component.js.map +1 -0
- package/dist/components/pagination.component.d.ts +137 -0
- package/dist/components/pagination.component.d.ts.map +1 -0
- package/dist/components/pagination.component.js +419 -0
- package/dist/components/pagination.component.js.map +1 -0
- package/dist/components/panel-close.component.d.ts +43 -0
- package/dist/components/panel-close.component.d.ts.map +1 -0
- package/dist/components/panel-close.component.js +75 -0
- package/dist/components/panel-close.component.js.map +1 -0
- package/dist/components/progress.component.d.ts +84 -0
- package/dist/components/progress.component.d.ts.map +1 -0
- package/dist/components/progress.component.js +219 -0
- package/dist/components/progress.component.js.map +1 -0
- package/dist/components/prompt-dialog.component.d.ts +121 -0
- package/dist/components/prompt-dialog.component.d.ts.map +1 -0
- package/dist/components/prompt-dialog.component.js +332 -0
- package/dist/components/prompt-dialog.component.js.map +1 -0
- package/dist/components/radio-group.component.d.ts +66 -34
- package/dist/components/radio-group.component.d.ts.map +1 -1
- package/dist/components/radio-group.component.js +146 -125
- package/dist/components/radio-group.component.js.map +1 -1
- package/dist/components/responsive-app-shell.component.d.ts +408 -0
- package/dist/components/responsive-app-shell.component.d.ts.map +1 -0
- package/dist/components/responsive-app-shell.component.js +1144 -0
- package/dist/components/responsive-app-shell.component.js.map +1 -0
- package/dist/components/select.component.d.ts +135 -38
- package/dist/components/select.component.d.ts.map +1 -1
- package/dist/components/select.component.js +373 -181
- package/dist/components/select.component.js.map +1 -1
- package/dist/components/separator.component.d.ts +39 -0
- package/dist/components/separator.component.d.ts.map +1 -0
- package/dist/components/separator.component.js +73 -0
- package/dist/components/separator.component.js.map +1 -0
- package/dist/components/sidebar-user-card.component.d.ts +106 -0
- package/dist/components/sidebar-user-card.component.d.ts.map +1 -0
- package/dist/components/sidebar-user-card.component.js +277 -0
- package/dist/components/sidebar-user-card.component.js.map +1 -0
- package/dist/components/skeleton.component.d.ts +100 -0
- package/dist/components/skeleton.component.d.ts.map +1 -0
- package/dist/components/skeleton.component.js +214 -0
- package/dist/components/skeleton.component.js.map +1 -0
- package/dist/components/spinner.component.d.ts +36 -19
- package/dist/components/spinner.component.d.ts.map +1 -1
- package/dist/components/spinner.component.js +69 -71
- package/dist/components/spinner.component.js.map +1 -1
- package/dist/components/switch.component.d.ts +72 -29
- package/dist/components/switch.component.d.ts.map +1 -1
- package/dist/components/switch.component.js +163 -91
- package/dist/components/switch.component.js.map +1 -1
- package/dist/components/table.component.d.ts +193 -0
- package/dist/components/table.component.d.ts.map +1 -0
- package/dist/components/table.component.js +550 -0
- package/dist/components/table.component.js.map +1 -0
- package/dist/components/tabs.component.d.ts +140 -0
- package/dist/components/tabs.component.d.ts.map +1 -0
- package/dist/components/tabs.component.js +390 -0
- package/dist/components/tabs.component.js.map +1 -0
- package/dist/components/template-outlet.directive.d.ts +50 -0
- package/dist/components/template-outlet.directive.d.ts.map +1 -0
- package/dist/components/template-outlet.directive.js +81 -0
- package/dist/components/template-outlet.directive.js.map +1 -0
- package/dist/components/textarea.component.d.ts +151 -0
- package/dist/components/textarea.component.d.ts.map +1 -0
- package/dist/components/textarea.component.js +340 -0
- package/dist/components/textarea.component.js.map +1 -0
- package/dist/components/theme-toggle.component.d.ts +58 -0
- package/dist/components/theme-toggle.component.d.ts.map +1 -0
- package/dist/components/theme-toggle.component.js +124 -0
- package/dist/components/theme-toggle.component.js.map +1 -0
- package/dist/components/toast.component.d.ts +237 -49
- package/dist/components/toast.component.d.ts.map +1 -1
- package/dist/components/toast.component.js +636 -201
- package/dist/components/toast.component.js.map +1 -1
- package/dist/components/tooltip.component.d.ts +95 -45
- package/dist/components/tooltip.component.d.ts.map +1 -1
- package/dist/components/tooltip.component.js +372 -221
- package/dist/components/tooltip.component.js.map +1 -1
- package/dist/components/user-menu-popover.component.d.ts +283 -0
- package/dist/components/user-menu-popover.component.d.ts.map +1 -0
- package/dist/components/user-menu-popover.component.js +646 -0
- package/dist/components/user-menu-popover.component.js.map +1 -0
- package/dist/components/user-menu.component.d.ts +95 -0
- package/dist/components/user-menu.component.d.ts.map +1 -0
- package/dist/components/user-menu.component.js +218 -0
- package/dist/components/user-menu.component.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-is-desktop.d.ts +22 -0
- package/dist/hooks/use-is-desktop.d.ts.map +1 -0
- package/dist/hooks/use-is-desktop.js +37 -0
- package/dist/hooks/use-is-desktop.js.map +1 -0
- package/dist/index.d.ts +32 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utilities/dom-context.d.ts +42 -0
- package/dist/utilities/dom-context.d.ts.map +1 -0
- package/dist/utilities/dom-context.js +66 -0
- package/dist/utilities/dom-context.js.map +1 -0
- package/dist/utilities/focus.d.ts +32 -0
- package/dist/utilities/focus.d.ts.map +1 -0
- package/dist/utilities/focus.js +47 -0
- package/dist/utilities/focus.js.map +1 -0
- package/dist/utilities/form-field-context.d.ts +34 -0
- package/dist/utilities/form-field-context.d.ts.map +1 -0
- package/dist/utilities/form-field-context.js +28 -0
- package/dist/utilities/form-field-context.js.map +1 -0
- package/dist/utilities/form-submit-error.d.ts +17 -0
- package/dist/utilities/form-submit-error.d.ts.map +1 -0
- package/dist/utilities/form-submit-error.js +42 -0
- package/dist/utilities/form-submit-error.js.map +1 -0
- package/dist/utilities/icon-markup.d.ts +17 -0
- package/dist/utilities/icon-markup.d.ts.map +1 -0
- package/dist/utilities/icon-markup.js +46 -0
- package/dist/utilities/icon-markup.js.map +1 -0
- package/dist/utilities/ids.d.ts +15 -0
- package/dist/utilities/ids.d.ts.map +1 -0
- package/dist/utilities/ids.js +19 -0
- package/dist/utilities/ids.js.map +1 -0
- package/dist/utilities/index.d.ts +11 -0
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +11 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/initials.d.ts +13 -0
- package/dist/utilities/initials.d.ts.map +1 -0
- package/dist/utilities/initials.js +23 -0
- package/dist/utilities/initials.js.map +1 -0
- package/dist/utilities/node-value.d.ts +31 -0
- package/dist/utilities/node-value.d.ts.map +1 -0
- package/dist/utilities/node-value.js +37 -0
- package/dist/utilities/node-value.js.map +1 -0
- package/dist/utilities/optimistic-value.d.ts +81 -0
- package/dist/utilities/optimistic-value.d.ts.map +1 -0
- package/dist/utilities/optimistic-value.js +154 -0
- package/dist/utilities/optimistic-value.js.map +1 -0
- package/dist/utilities/render-icon.d.ts +77 -7
- package/dist/utilities/render-icon.d.ts.map +1 -1
- package/dist/utilities/render-icon.js +123 -33
- package/dist/utilities/render-icon.js.map +1 -1
- package/dist/utilities/rest-attrs.d.ts +21 -0
- package/dist/utilities/rest-attrs.d.ts.map +1 -0
- package/dist/utilities/rest-attrs.js +37 -0
- package/dist/utilities/rest-attrs.js.map +1 -0
- package/dist/utilities/style.d.ts +23 -0
- package/dist/utilities/style.d.ts.map +1 -0
- package/dist/utilities/style.js +86 -0
- package/dist/utilities/style.js.map +1 -0
- package/package.json +10 -5
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import { asTemplate, nodeText } from '../utilities/node-value.js';
|
|
4
|
+
import { type ResolvedIcon } from '../utilities/render-icon.js';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/** One accordion item (React's `AccordionItem`). */
|
|
7
|
+
export interface AccordionItemData {
|
|
8
|
+
/** The item's value (identity for expansion state). */
|
|
9
|
+
value: string;
|
|
10
|
+
/** The header (text, or a TemplateRef from a node value). */
|
|
11
|
+
header?: unknown;
|
|
12
|
+
/** The body (text, or a TemplateRef from a node value). */
|
|
13
|
+
content?: unknown;
|
|
14
|
+
/** Whether the item's trigger is disabled. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Accordion component.
|
|
19
|
+
*
|
|
20
|
+
* The host is the `div.accordionRoot` React renders. Items carry their
|
|
21
|
+
* header/content as text or TemplateRef node values; expansion state is
|
|
22
|
+
* internal unless the `value` input controls it (React's controlled /
|
|
23
|
+
* uncontrolled pair), and ids are generated per item value so replacing the
|
|
24
|
+
* `items` array keeps them stable (React's `useId` per item component).
|
|
25
|
+
*/
|
|
26
|
+
export declare class Accordion {
|
|
27
|
+
/** The items to render. */
|
|
28
|
+
items?: AccordionItemData[];
|
|
29
|
+
/** Controlled expanded value(s). */
|
|
30
|
+
value?: string | string[];
|
|
31
|
+
/** Uncontrolled initial expanded value(s). */
|
|
32
|
+
defaultValue?: string | string[];
|
|
33
|
+
/** Whether several items may stay expanded. */
|
|
34
|
+
multiple?: boolean;
|
|
35
|
+
/** Whether the last expanded item may collapse. */
|
|
36
|
+
collapsible?: boolean;
|
|
37
|
+
/** Extra classes joined onto the root classes. */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** Inline style object (React camelCase). */
|
|
40
|
+
style?: Record<string, unknown>;
|
|
41
|
+
/** `data-testid` for the root. */
|
|
42
|
+
testId?: string;
|
|
43
|
+
/** Template helpers (templates see only class members). */
|
|
44
|
+
readonly asTemplate: typeof asTemplate;
|
|
45
|
+
/** Renders a plain-string node value. */
|
|
46
|
+
readonly nodeText: typeof nodeText;
|
|
47
|
+
/** Fires the new expansion state (single value, or array in multiple mode). */
|
|
48
|
+
readonly change: EventEmitter<string | string[]>;
|
|
49
|
+
private internalExpanded;
|
|
50
|
+
private readonly idMap;
|
|
51
|
+
private idCount;
|
|
52
|
+
/**
|
|
53
|
+
* The current class map.
|
|
54
|
+
* @returns The UIClassMap.
|
|
55
|
+
*/
|
|
56
|
+
cm(): UIClassMap;
|
|
57
|
+
/**
|
|
58
|
+
* Computes the root class list.
|
|
59
|
+
* @returns The class string.
|
|
60
|
+
*/
|
|
61
|
+
classes(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Serializes the inline style.
|
|
64
|
+
* @returns The style attribute text.
|
|
65
|
+
*/
|
|
66
|
+
hostStyle(): string | null;
|
|
67
|
+
/**
|
|
68
|
+
* The chevron glyph every trigger renders.
|
|
69
|
+
* @returns The resolved icon.
|
|
70
|
+
*/
|
|
71
|
+
chevron(): ResolvedIcon;
|
|
72
|
+
/**
|
|
73
|
+
* Normalizes a value prop to the expanded list (React's `normalizeValue`).
|
|
74
|
+
*
|
|
75
|
+
* @param v - The single value, array, or undefined.
|
|
76
|
+
* @returns The expanded values.
|
|
77
|
+
*/
|
|
78
|
+
private normalize;
|
|
79
|
+
/**
|
|
80
|
+
* The expanded items: the controlled `value` when given, else the internal
|
|
81
|
+
* state (seeded from `defaultValue` at first use).
|
|
82
|
+
* @returns The expanded values.
|
|
83
|
+
*/
|
|
84
|
+
expandedItems(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Whether one item is expanded.
|
|
87
|
+
*
|
|
88
|
+
* @param value - The item value.
|
|
89
|
+
* @returns True when expanded.
|
|
90
|
+
*/
|
|
91
|
+
isOpen(value: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The stable per-item ids (React generates them per item component; keying
|
|
94
|
+
* by item value keeps them stable across an `items` replacement).
|
|
95
|
+
*
|
|
96
|
+
* @param value - The item value.
|
|
97
|
+
* @returns The trigger and content ids.
|
|
98
|
+
*/
|
|
99
|
+
ids(value: string): {
|
|
100
|
+
trigger: string;
|
|
101
|
+
content: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* React's `toggleItem`: collapse guards `collapsible`, expand replaces or
|
|
105
|
+
* appends per `multiple`, internal state updates only when uncontrolled,
|
|
106
|
+
* and `onChange` receives the new state (single value or array).
|
|
107
|
+
*
|
|
108
|
+
* @param itemValue - The toggled item's value.
|
|
109
|
+
*/
|
|
110
|
+
toggle(itemValue: string): void;
|
|
111
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Accordion, never>;
|
|
112
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Accordion, "div[mol-accordion]", never, { "items": { "alias": "items"; "required": false; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "collapsible": { "alias": "collapsible"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=accordion.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.component.d.ts","sourceRoot":"","sources":["../../src/components/accordion.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,YAAY,EAAU,MAAM,eAAe,CAAA;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAc,KAAK,YAAY,EAAe,MAAM,6BAA6B,CAAA;;AAGxF,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,qBAyDa,SAAS;IACpB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC3B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAChC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,oBAAa;IAChC,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,kBAAW;IAE5B,+EAA+E;IACrE,QAAQ,CAAC,MAAM,kCAAwC;IAEjE,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0D;IAChF,OAAO,CAAC,OAAO,CAAI;IAEnB;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B;;;OAGG;IACH,OAAO,IAAI,YAAY;IAIvB;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAKjB;;;;OAIG;IACH,aAAa,IAAI,MAAM,EAAE;IAMzB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI9B;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAUxD;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;yCAtHpB,SAAS;2CAAT,SAAS;CAmIrB"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accordion component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, EventEmitter, Output } from '@angular/core';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import { asTemplate, nodeText } from '../utilities/node-value.js';
|
|
10
|
+
import { MolIconSvg, resolveIcon } from '../utilities/render-icon.js';
|
|
11
|
+
import { styleText } from '../utilities/style.js';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
const _c0 = () => [];
|
|
14
|
+
const _c1 = () => ({ variant: "default" });
|
|
15
|
+
const _forTrack0 = ($index, $item) => $item.value;
|
|
16
|
+
function Accordion_For_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
17
|
+
i0.ɵɵelementContainer(0, 2);
|
|
18
|
+
} if (rf & 2) {
|
|
19
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
20
|
+
} }
|
|
21
|
+
function Accordion_For_1_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
22
|
+
i0.ɵɵtext(0);
|
|
23
|
+
} if (rf & 2) {
|
|
24
|
+
const item_r2 = i0.ɵɵnextContext().$implicit;
|
|
25
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
26
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r2.nodeText(item_r2.header), " ");
|
|
27
|
+
} }
|
|
28
|
+
function Accordion_For_1_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
29
|
+
i0.ɵɵelementContainer(0, 2);
|
|
30
|
+
} if (rf & 2) {
|
|
31
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
32
|
+
} }
|
|
33
|
+
function Accordion_For_1_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
34
|
+
i0.ɵɵtext(0);
|
|
35
|
+
} if (rf & 2) {
|
|
36
|
+
const item_r2 = i0.ɵɵnextContext().$implicit;
|
|
37
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
38
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r2.nodeText(item_r2.content), " ");
|
|
39
|
+
} }
|
|
40
|
+
function Accordion_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
42
|
+
i0.ɵɵelementStart(0, "div")(1, "button", 1);
|
|
43
|
+
i0.ɵɵlistener("click", function Accordion_For_1_Template_button_click_1_listener() { const item_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.toggle(item_r2.value)); });
|
|
44
|
+
i0.ɵɵconditionalCreate(2, Accordion_For_1_Conditional_2_Template, 1, 1, "ng-container", 2)(3, Accordion_For_1_Conditional_3_Template, 1, 1);
|
|
45
|
+
i0.ɵɵnamespaceSVG();
|
|
46
|
+
i0.ɵɵelement(4, "svg", 3);
|
|
47
|
+
i0.ɵɵelementEnd();
|
|
48
|
+
i0.ɵɵnamespaceHTML();
|
|
49
|
+
i0.ɵɵelementStart(5, "div", 4)(6, "div");
|
|
50
|
+
i0.ɵɵconditionalCreate(7, Accordion_For_1_Conditional_7_Template, 1, 1, "ng-container", 2)(8, Accordion_For_1_Conditional_8_Template, 1, 1);
|
|
51
|
+
i0.ɵɵelementEnd()()();
|
|
52
|
+
} if (rf & 2) {
|
|
53
|
+
let tmp_18_0;
|
|
54
|
+
let tmp_26_0;
|
|
55
|
+
const item_r2 = ctx.$implicit;
|
|
56
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
57
|
+
i0.ɵɵclassMap(ctx_r2.cm().accordionItem);
|
|
58
|
+
i0.ɵɵattribute("data-state", ctx_r2.isOpen(item_r2.value) ? "open" : "closed");
|
|
59
|
+
i0.ɵɵadvance();
|
|
60
|
+
i0.ɵɵclassMap(ctx_r2.cm().cn(ctx_r2.cm().accordion(i0.ɵɵpureFunction0(22, _c1)), ctx_r2.cm().accordionTriggerBase));
|
|
61
|
+
i0.ɵɵproperty("disabled", item_r2.disabled);
|
|
62
|
+
i0.ɵɵattribute("id", ctx_r2.ids(item_r2.value).trigger)("aria-expanded", ctx_r2.isOpen(item_r2.value) ? "true" : "false")("aria-controls", ctx_r2.ids(item_r2.value).content)("data-state", ctx_r2.isOpen(item_r2.value) ? "open" : "closed");
|
|
63
|
+
i0.ɵɵadvance();
|
|
64
|
+
i0.ɵɵconditional((tmp_18_0 = ctx_r2.asTemplate(item_r2.header)) ? 2 : 3, tmp_18_0);
|
|
65
|
+
i0.ɵɵadvance(2);
|
|
66
|
+
i0.ɵɵproperty("data", ctx_r2.chevron());
|
|
67
|
+
i0.ɵɵadvance();
|
|
68
|
+
i0.ɵɵclassMap(ctx_r2.cm().accordionContent);
|
|
69
|
+
i0.ɵɵstyleProp("display", ctx_r2.isOpen(item_r2.value) ? "block" : "none");
|
|
70
|
+
i0.ɵɵattribute("id", ctx_r2.ids(item_r2.value).content)("aria-labelledby", ctx_r2.ids(item_r2.value).trigger)("data-state", ctx_r2.isOpen(item_r2.value) ? "open" : "closed");
|
|
71
|
+
i0.ɵɵadvance();
|
|
72
|
+
i0.ɵɵclassMap(ctx_r2.cm().accordionContentInner);
|
|
73
|
+
i0.ɵɵadvance();
|
|
74
|
+
i0.ɵɵconditional((tmp_26_0 = ctx_r2.asTemplate(item_r2.content)) ? 7 : 8, tmp_26_0);
|
|
75
|
+
} }
|
|
76
|
+
/**
|
|
77
|
+
* Accordion component.
|
|
78
|
+
*
|
|
79
|
+
* The host is the `div.accordionRoot` React renders. Items carry their
|
|
80
|
+
* header/content as text or TemplateRef node values; expansion state is
|
|
81
|
+
* internal unless the `value` input controls it (React's controlled /
|
|
82
|
+
* uncontrolled pair), and ids are generated per item value so replacing the
|
|
83
|
+
* `items` array keeps them stable (React's `useId` per item component).
|
|
84
|
+
*/
|
|
85
|
+
export class Accordion {
|
|
86
|
+
/** The items to render. */
|
|
87
|
+
items;
|
|
88
|
+
/** Controlled expanded value(s). */
|
|
89
|
+
value;
|
|
90
|
+
/** Uncontrolled initial expanded value(s). */
|
|
91
|
+
defaultValue;
|
|
92
|
+
/** Whether several items may stay expanded. */
|
|
93
|
+
multiple;
|
|
94
|
+
/** Whether the last expanded item may collapse. */
|
|
95
|
+
collapsible;
|
|
96
|
+
/** Extra classes joined onto the root classes. */
|
|
97
|
+
className;
|
|
98
|
+
/** Inline style object (React camelCase). */
|
|
99
|
+
style;
|
|
100
|
+
/** `data-testid` for the root. */
|
|
101
|
+
testId;
|
|
102
|
+
/** Template helpers (templates see only class members). */
|
|
103
|
+
asTemplate = asTemplate;
|
|
104
|
+
/** Renders a plain-string node value. */
|
|
105
|
+
nodeText = nodeText;
|
|
106
|
+
/** Fires the new expansion state (single value, or array in multiple mode). */
|
|
107
|
+
change = new EventEmitter();
|
|
108
|
+
internalExpanded = null;
|
|
109
|
+
idMap = new Map();
|
|
110
|
+
idCount = 0;
|
|
111
|
+
/**
|
|
112
|
+
* The current class map.
|
|
113
|
+
* @returns The UIClassMap.
|
|
114
|
+
*/
|
|
115
|
+
cm() {
|
|
116
|
+
return getClassMap();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Computes the root class list.
|
|
120
|
+
* @returns The class string.
|
|
121
|
+
*/
|
|
122
|
+
classes() {
|
|
123
|
+
return this.cm().cn(this.cm().accordionRoot, this.className);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Serializes the inline style.
|
|
127
|
+
* @returns The style attribute text.
|
|
128
|
+
*/
|
|
129
|
+
hostStyle() {
|
|
130
|
+
return styleText(this.style);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The chevron glyph every trigger renders.
|
|
134
|
+
* @returns The resolved icon.
|
|
135
|
+
*/
|
|
136
|
+
chevron() {
|
|
137
|
+
return resolveIcon('chevron-down', this.cm().accordionChevron);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Normalizes a value prop to the expanded list (React's `normalizeValue`).
|
|
141
|
+
*
|
|
142
|
+
* @param v - The single value, array, or undefined.
|
|
143
|
+
* @returns The expanded values.
|
|
144
|
+
*/
|
|
145
|
+
normalize(v) {
|
|
146
|
+
if (v === undefined)
|
|
147
|
+
return [];
|
|
148
|
+
return Array.isArray(v) ? v : [v];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The expanded items: the controlled `value` when given, else the internal
|
|
152
|
+
* state (seeded from `defaultValue` at first use).
|
|
153
|
+
* @returns The expanded values.
|
|
154
|
+
*/
|
|
155
|
+
expandedItems() {
|
|
156
|
+
if (this.value !== undefined)
|
|
157
|
+
return this.normalize(this.value);
|
|
158
|
+
if (this.internalExpanded === null)
|
|
159
|
+
this.internalExpanded = this.normalize(this.defaultValue);
|
|
160
|
+
return this.internalExpanded;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Whether one item is expanded.
|
|
164
|
+
*
|
|
165
|
+
* @param value - The item value.
|
|
166
|
+
* @returns True when expanded.
|
|
167
|
+
*/
|
|
168
|
+
isOpen(value) {
|
|
169
|
+
return this.expandedItems().includes(value);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The stable per-item ids (React generates them per item component; keying
|
|
173
|
+
* by item value keeps them stable across an `items` replacement).
|
|
174
|
+
*
|
|
175
|
+
* @param value - The item value.
|
|
176
|
+
* @returns The trigger and content ids.
|
|
177
|
+
*/
|
|
178
|
+
ids(value) {
|
|
179
|
+
let ids = this.idMap.get(value);
|
|
180
|
+
if (!ids) {
|
|
181
|
+
ids = { trigger: `t${this.idCount}`, content: `c${this.idCount}` };
|
|
182
|
+
this.idCount++;
|
|
183
|
+
this.idMap.set(value, ids);
|
|
184
|
+
}
|
|
185
|
+
return ids;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* React's `toggleItem`: collapse guards `collapsible`, expand replaces or
|
|
189
|
+
* appends per `multiple`, internal state updates only when uncontrolled,
|
|
190
|
+
* and `onChange` receives the new state (single value or array).
|
|
191
|
+
*
|
|
192
|
+
* @param itemValue - The toggled item's value.
|
|
193
|
+
*/
|
|
194
|
+
toggle(itemValue) {
|
|
195
|
+
const current = this.expandedItems();
|
|
196
|
+
let next;
|
|
197
|
+
if (current.includes(itemValue)) {
|
|
198
|
+
if (this.collapsible === false && current.length === 1)
|
|
199
|
+
return;
|
|
200
|
+
next = current.filter((v) => v !== itemValue);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
next = this.multiple ? [...current, itemValue] : [itemValue];
|
|
204
|
+
}
|
|
205
|
+
if (this.value === undefined)
|
|
206
|
+
this.internalExpanded = next;
|
|
207
|
+
if (this.multiple)
|
|
208
|
+
this.change.emit(next);
|
|
209
|
+
else
|
|
210
|
+
this.change.emit(next[0] ?? '');
|
|
211
|
+
}
|
|
212
|
+
static ɵfac = function Accordion_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Accordion)(); };
|
|
213
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Accordion, selectors: [["div", "mol-accordion", ""]], hostVars: 5, hostBindings: function Accordion_HostBindings(rf, ctx) { if (rf & 2) {
|
|
214
|
+
i0.ɵɵattribute("data-testid", ctx.testId);
|
|
215
|
+
i0.ɵɵstyleMap(ctx.hostStyle());
|
|
216
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
217
|
+
} }, inputs: { items: "items", value: "value", defaultValue: "defaultValue", multiple: "multiple", collapsible: "collapsible", className: "className", style: "style", testId: "testId" }, outputs: { change: "change" }, decls: 2, vars: 1, consts: [[3, "class"], ["type", "button", 3, "click", "disabled"], [3, "ngTemplateOutlet"], ["mol-icon", "", 3, "data"], ["role", "region"]], template: function Accordion_Template(rf, ctx) { if (rf & 1) {
|
|
218
|
+
i0.ɵɵrepeaterCreate(0, Accordion_For_1_Template, 9, 23, "div", 0, _forTrack0);
|
|
219
|
+
} if (rf & 2) {
|
|
220
|
+
i0.ɵɵrepeater(ctx.items ?? i0.ɵɵpureFunction0(0, _c0));
|
|
221
|
+
} }, dependencies: [MolIconSvg, NgTemplateOutlet], encapsulation: 2 });
|
|
222
|
+
}
|
|
223
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Accordion, [{
|
|
224
|
+
type: Component,
|
|
225
|
+
args: [{
|
|
226
|
+
selector: 'div[mol-accordion]',
|
|
227
|
+
standalone: true,
|
|
228
|
+
imports: [MolIconSvg, NgTemplateOutlet],
|
|
229
|
+
inputs: [
|
|
230
|
+
'items',
|
|
231
|
+
'value',
|
|
232
|
+
'defaultValue',
|
|
233
|
+
'multiple',
|
|
234
|
+
'collapsible',
|
|
235
|
+
'className',
|
|
236
|
+
'style',
|
|
237
|
+
'testId',
|
|
238
|
+
],
|
|
239
|
+
host: {
|
|
240
|
+
'[class]': 'classes()',
|
|
241
|
+
'[style]': 'hostStyle()',
|
|
242
|
+
'[attr.data-testid]': 'testId',
|
|
243
|
+
},
|
|
244
|
+
template: `@for (item of items ?? []; track item.value) {
|
|
245
|
+
<div [class]="cm().accordionItem" [attr.data-state]="isOpen(item.value) ? 'open' : 'closed'">
|
|
246
|
+
<button
|
|
247
|
+
type="button"
|
|
248
|
+
[attr.id]="ids(item.value).trigger"
|
|
249
|
+
[class]="cm().cn(cm().accordion({ variant: 'default' }), cm().accordionTriggerBase)"
|
|
250
|
+
(click)="toggle(item.value)"
|
|
251
|
+
[attr.aria-expanded]="isOpen(item.value) ? 'true' : 'false'"
|
|
252
|
+
[attr.aria-controls]="ids(item.value).content"
|
|
253
|
+
[attr.data-state]="isOpen(item.value) ? 'open' : 'closed'"
|
|
254
|
+
[disabled]="item.disabled"
|
|
255
|
+
>
|
|
256
|
+
@if (asTemplate(item.header); as tpl) {
|
|
257
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
258
|
+
} @else {
|
|
259
|
+
{{ nodeText(item.header) }}
|
|
260
|
+
}
|
|
261
|
+
<svg mol-icon [data]="chevron()" />
|
|
262
|
+
</button>
|
|
263
|
+
<div
|
|
264
|
+
[attr.id]="ids(item.value).content"
|
|
265
|
+
role="region"
|
|
266
|
+
[attr.aria-labelledby]="ids(item.value).trigger"
|
|
267
|
+
[attr.data-state]="isOpen(item.value) ? 'open' : 'closed'"
|
|
268
|
+
[class]="cm().accordionContent"
|
|
269
|
+
[style.display]="isOpen(item.value) ? 'block' : 'none'"
|
|
270
|
+
>
|
|
271
|
+
<div [class]="cm().accordionContentInner">
|
|
272
|
+
@if (asTemplate(item.content); as tpl) {
|
|
273
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
274
|
+
} @else {
|
|
275
|
+
{{ nodeText(item.content) }}
|
|
276
|
+
}
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
}`,
|
|
281
|
+
}]
|
|
282
|
+
}], null, { change: [{
|
|
283
|
+
type: Output
|
|
284
|
+
}] }); })();
|
|
285
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Accordion, { className: "Accordion", filePath: "components/accordion.component.ts", lineNumber: 95 }); })();
|
|
286
|
+
//# sourceMappingURL=accordion.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.component.js","sourceRoot":"","sources":["../../src/components/accordion.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAqB,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;;;;;;IAuDvC,2BAAyC;;IAA3B,sCAAwB;;;IAEtC,YACF;;;;IADE,gEACF;;;IAaI,2BAAyC;;IAA3B,sCAAwB;;;IAEtC,YACF;;;;IADE,iEACF;;;;IA9BJ,AADF,2BAA6F,gBAU1F;IALC,+LAAS,4BAAkB,KAAC;IAQ1B,AAFF,0FAAuC,iDAE9B;;IAGT,yBAAmC;IACrC,iBAAS;;IASP,AARF,8BAOC,UAC2C;IAGtC,AAFF,0FAAwC,iDAE/B;IAKf,AADE,AADE,iBAAM,EACF,EACF;;;;;;IAlCD,wCAA4B;;IAI7B,cAAoF;IAApF,m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;;IAoCR;aACH;;kBAyBE,MAAM;;kFAxBI,SAAS"}
|
|
@@ -1,71 +1,115 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Alert component (React parity).
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { EventEmitter } from '@angular/core';
|
|
6
|
+
import { type AfterViewInit, type DoCheck, ElementRef, EventEmitter } from '@angular/core';
|
|
7
7
|
import type { ColorVariant, UIClassMap } from '@molecule/app-ui';
|
|
8
|
+
import type { ResolvedIcon } from '../utilities/render-icon.js';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Alert component.
|
|
12
|
+
*
|
|
13
|
+
* `role` follows `live` (assertive `alert` by default, polite `status` for a
|
|
14
|
+
* banner that is part of the page's normal content).
|
|
15
|
+
*
|
|
16
|
+
* React renders `{(icon || defaultIcon) && <span className={alertIconWrapper}>…}`:
|
|
17
|
+
* the icon wrapper span exists only when a custom icon is given or the status
|
|
18
|
+
* has a default glyph, and its content is the custom icon XOR the default
|
|
19
|
+
* glyph. Here the span and the default glyph both always exist in the
|
|
20
|
+
* template (projection capture points) and are detached from the DOM when
|
|
21
|
+
* React would not render them ({@link SlotWrapper}); the decision is made at
|
|
22
|
+
* view init, when view queries resolve.
|
|
11
23
|
*/
|
|
12
|
-
export declare class
|
|
24
|
+
export declare class Alert implements AfterViewInit, DoCheck {
|
|
25
|
+
/** Alert title. */
|
|
13
26
|
title?: string;
|
|
27
|
+
/** Status color. */
|
|
14
28
|
status: ColorVariant;
|
|
29
|
+
/** Visual variant. */
|
|
15
30
|
variant?: 'solid' | 'subtle' | 'outline' | 'left-accent';
|
|
16
|
-
|
|
31
|
+
/** Whether the alert announces assertively (default true). */
|
|
32
|
+
live: boolean;
|
|
33
|
+
/** Whether a dismiss button renders. */
|
|
34
|
+
dismissible?: boolean;
|
|
35
|
+
/** Accessible label for the dismiss button. */
|
|
17
36
|
dismissLabel?: string;
|
|
37
|
+
/** Extra classes. */
|
|
18
38
|
className?: string;
|
|
19
|
-
style
|
|
39
|
+
/** Inline style object (React camelCase). */
|
|
40
|
+
style?: Record<string, unknown>;
|
|
41
|
+
/** `data-testid`. */
|
|
20
42
|
testId?: string;
|
|
21
|
-
dismiss
|
|
43
|
+
/** Fires the raw click event when the dismiss button is pressed. */
|
|
44
|
+
readonly dismiss: EventEmitter<MouseEvent>;
|
|
45
|
+
/** The icon wrapper span (projection capture point). */
|
|
46
|
+
iconSlot?: ElementRef<HTMLSpanElement>;
|
|
47
|
+
/** The default status glyph (detached when a custom icon is projected). */
|
|
48
|
+
defaultGlyph?: ElementRef<SVGSVGElement>;
|
|
49
|
+
private hasCustomIcon;
|
|
50
|
+
/**
|
|
51
|
+
* Reactive translation, read in the injection context. Its `t` reads the
|
|
52
|
+
* locale, so the view re-renders the text on a locale switch (the static `t`
|
|
53
|
+
* does not).
|
|
54
|
+
*/
|
|
55
|
+
private readonly i18n;
|
|
56
|
+
private readonly sync;
|
|
57
|
+
/**
|
|
58
|
+
* The current class map.
|
|
59
|
+
* @returns The UIClassMap.
|
|
60
|
+
*/
|
|
61
|
+
cm(): UIClassMap;
|
|
62
|
+
/**
|
|
63
|
+
* The class-map variant for the status.
|
|
64
|
+
* @returns The mapped variant.
|
|
65
|
+
*/
|
|
66
|
+
get alertVariant(): 'default' | 'info' | 'success' | 'warning' | 'error';
|
|
22
67
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
68
|
+
* The default status glyph (none for the `default` variant, matching
|
|
69
|
+
* React's `statusIconMap` gap).
|
|
70
|
+
* @returns The resolved icon, or null when the variant has no glyph.
|
|
25
71
|
*/
|
|
26
|
-
|
|
72
|
+
defaultIcon(): ResolvedIcon | null;
|
|
27
73
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
74
|
+
* A non-null glyph to bind (an empty resolved icon when the variant has
|
|
75
|
+
* none; that svg is detached from the DOM anyway).
|
|
76
|
+
* @returns The resolved icon data.
|
|
30
77
|
*/
|
|
31
|
-
|
|
78
|
+
resolvedDefaultIcon(): ResolvedIcon;
|
|
32
79
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @returns The
|
|
80
|
+
* The dismiss button's X glyph.
|
|
81
|
+
* @returns The resolved icon.
|
|
35
82
|
*/
|
|
36
|
-
|
|
83
|
+
closeIcon(): ResolvedIcon;
|
|
37
84
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @returns The
|
|
85
|
+
* The dismiss button's accessible label.
|
|
86
|
+
* @returns The label text.
|
|
40
87
|
*/
|
|
41
|
-
|
|
88
|
+
dismissText(): string;
|
|
42
89
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @returns The
|
|
90
|
+
* Computes the alert class list.
|
|
91
|
+
* @returns The class string.
|
|
45
92
|
*/
|
|
46
|
-
|
|
93
|
+
classes(): string;
|
|
47
94
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @returns
|
|
95
|
+
* Serializes the inline style.
|
|
96
|
+
* @returns The style attribute text.
|
|
50
97
|
*/
|
|
51
|
-
|
|
52
|
-
private statusIconMap;
|
|
98
|
+
hostStyle(): string | null;
|
|
53
99
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
100
|
+
* Decides icon presence at view init (view queries resolve only then) and
|
|
101
|
+
* applies React's conditions.
|
|
56
102
|
*/
|
|
57
|
-
|
|
103
|
+
ngAfterViewInit(): void;
|
|
58
104
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @returns The SVG string for the dismiss button icon.
|
|
105
|
+
* Re-reconciles on later passes.
|
|
61
106
|
*/
|
|
62
|
-
|
|
107
|
+
ngDoCheck(): void;
|
|
63
108
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @returns The alert container class name string.
|
|
109
|
+
* Applies React's `{(icon || defaultIcon) && <span>{icon || defaultIcon}</span>}`.
|
|
66
110
|
*/
|
|
67
|
-
|
|
68
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
69
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
111
|
+
private syncIcon;
|
|
112
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Alert, never>;
|
|
113
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Alert, "div[mol-alert]", never, { "title": { "alias": "title"; "required": false; }; "status": { "alias": "status"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "live": { "alias": "live"; "required": false; }; "dismissible": { "alias": "dismissible"; "required": false; }; "dismissLabel": { "alias": "dismissLabel"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, { "dismiss": "dismiss"; }, never, ["[slot=icon]", "*"], true, never>;
|
|
70
114
|
}
|
|
71
115
|
//# sourceMappingURL=alert.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.component.d.ts","sourceRoot":"","sources":["../../src/components/alert.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"alert.component.d.ts","sourceRoot":"","sources":["../../src/components/alert.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EACZ,UAAU,EACV,YAAY,EAKb,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;;AAuB/D;;;;;;;;;;;;;GAaG;AACH,qBA2Ca,KAAM,YAAW,aAAa,EAAE,OAAO;IAClD,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAS;IAC7B,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAA;IACxD,8DAA8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