@neural-ui/native 0.1.0-beta.10 → 0.1.0-beta.11
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 +1 -1
- package/dist/data-view/data-view.d.ts +5 -1
- package/dist/data-view/data-view.js +68 -19
- package/dist/data-view/data-view.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/section-list/index.d.ts +1 -0
- package/dist/section-list/index.js +2 -0
- package/dist/section-list/index.js.map +1 -0
- package/dist/section-list/section-list.d.ts +41 -0
- package/dist/section-list/section-list.js +161 -0
- package/dist/section-list/section-list.js.map +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Neural Native brings the Neural visual language to [Angular Native](https://ng-native.com): 64 mobile component entries, Angular signals, typed APIs, shared themes and modular imports.
|
|
6
6
|
|
|
7
|
-
**Public beta: `0.1.0-beta.
|
|
7
|
+
**Public beta: `0.1.0-beta.11`.** APIs and framework compatibility may change before 1.0. Pin the version in your application lockfile and check compatibility before updating Angular Native.
|
|
8
8
|
|
|
9
9
|
## Documentation
|
|
10
10
|
|
|
@@ -7,8 +7,12 @@ export declare class NeuDataViewComponent {
|
|
|
7
7
|
readonly items: import("@angular/core").InputSignal<readonly NeuOption[]>;
|
|
8
8
|
/** Explicit template takes precedence over a projected neuDataViewItem. */
|
|
9
9
|
readonly itemTemplate: import("@angular/core").InputSignal<TemplateRef<NeuDataViewItemContext> | undefined>;
|
|
10
|
+
/** A positive viewport height enables internally scrolling, measured rows. */
|
|
11
|
+
readonly virtualHeight: import("@angular/core").InputSignal<number | undefined>;
|
|
10
12
|
private readonly itemContent;
|
|
11
13
|
protected readonly resolvedItemTemplate: import("@angular/core").Signal<TemplateRef<NeuDataViewItemContext> | undefined>;
|
|
14
|
+
protected readonly viewportHeight: import("@angular/core").Signal<number | undefined>;
|
|
15
|
+
protected readonly itemKey: (item: NeuOption) => string;
|
|
12
16
|
readonly query: import("@angular/core").ModelSignal<string>;
|
|
13
17
|
readonly descending: import("@angular/core").ModelSignal<boolean>;
|
|
14
18
|
readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
@@ -29,5 +33,5 @@ export declare class NeuDataViewComponent {
|
|
|
29
33
|
protected readonly displayed: import("@angular/core").Signal<NeuOption[]>;
|
|
30
34
|
protected choose(item: NeuOption): void;
|
|
31
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<NeuDataViewComponent, never>;
|
|
32
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NeuDataViewComponent, "neu-data-view", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "descending": { "alias": "descending"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "searchLabel": { "alias": "searchLabel"; "required": false; "isSignal": true; }; "sortLabel": { "alias": "sortLabel"; "required": false; "isSignal": true; }; "refreshLabel": { "alias": "refreshLabel"; "required": false; "isSignal": true; }; "emptyLabel": { "alias": "emptyLabel"; "required": false; "isSignal": true; }; }, { "query": "queryChange"; "descending": "descendingChange"; "selected": "selected"; "refresh": "refresh"; }, ["itemContent"], never, true, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NeuDataViewComponent, "neu-data-view", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; "virtualHeight": { "alias": "virtualHeight"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "descending": { "alias": "descending"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "searchLabel": { "alias": "searchLabel"; "required": false; "isSignal": true; }; "sortLabel": { "alias": "sortLabel"; "required": false; "isSignal": true; }; "refreshLabel": { "alias": "refreshLabel"; "required": false; "isSignal": true; }; "emptyLabel": { "alias": "emptyLabel"; "required": false; "isSignal": true; }; }, { "query": "queryChange"; "descending": "descendingChange"; "selected": "selected"; "refresh": "refresh"; }, ["itemContent"], never, true, never>;
|
|
33
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { booleanAttribute, Component, contentChild, input, model, output, computed, inject, } from '@angular/core';
|
|
2
2
|
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
-
import { View, Text } from '@ng-native/components';
|
|
3
|
+
import { View, Text, VirtualList, VirtualListRow } from '@ng-native/components';
|
|
4
4
|
import { NeuNativePressable as Pressable } from '../foundation/native-pressable.js';
|
|
5
5
|
import { AnimatedStyle } from '@ng-native/components/animations';
|
|
6
6
|
import { NeuDataViewRowMotionDirective } from './data-view-row.js';
|
|
@@ -20,10 +20,19 @@ export class NeuDataViewComponent {
|
|
|
20
20
|
/** Explicit template takes precedence over a projected neuDataViewItem. */
|
|
21
21
|
itemTemplate = input(/* @ts-ignore */
|
|
22
22
|
...(ngDevMode ? [undefined, { debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
23
|
+
/** A positive viewport height enables internally scrolling, measured rows. */
|
|
24
|
+
virtualHeight = input(/* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [undefined, { debugName: "virtualHeight" }] : /* istanbul ignore next */ []));
|
|
23
26
|
itemContent = contentChild(NeuDataViewItemDirective, /* @ts-ignore */
|
|
24
27
|
...(ngDevMode ? [{ debugName: "itemContent" }] : /* istanbul ignore next */ []));
|
|
25
28
|
resolvedItemTemplate = computed(() => this.itemTemplate() ?? this.itemContent()?.templateRef, /* @ts-ignore */
|
|
26
29
|
...(ngDevMode ? [{ debugName: "resolvedItemTemplate" }] : /* istanbul ignore next */ []));
|
|
30
|
+
viewportHeight = computed(() => {
|
|
31
|
+
const height = this.virtualHeight();
|
|
32
|
+
return height !== undefined && Number.isFinite(height) && height > 0 ? height : undefined;
|
|
33
|
+
}, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
|
|
35
|
+
itemKey = (item) => item.id;
|
|
27
36
|
query = model('', /* @ts-ignore */
|
|
28
37
|
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
29
38
|
descending = model(false, /* @ts-ignore */
|
|
@@ -67,7 +76,14 @@ export class NeuDataViewComponent {
|
|
|
67
76
|
this.selected.emit(item.id);
|
|
68
77
|
}
|
|
69
78
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NeuDataViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
70
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.2", type: NeuDataViewComponent, isStandalone: true, selector: "neu-data-view", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, descending: { classPropertyName: "descending", publicName: "descending", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, searchLabel: { classPropertyName: "searchLabel", publicName: "searchLabel", isSignal: true, isRequired: false, transformFunction: null }, sortLabel: { classPropertyName: "sortLabel", publicName: "sortLabel", isSignal: true, isRequired: false, transformFunction: null }, refreshLabel: { classPropertyName: "refreshLabel", publicName: "refreshLabel", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { query: "queryChange", descending: "descendingChange", selected: "selected", refresh: "refresh" }, queries: [{ propertyName: "itemContent", first: true, predicate: NeuDataViewItemDirective, descendants: true, isSignal: true }], ngImport: i0, template: `<
|
|
79
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.2", type: NeuDataViewComponent, isStandalone: true, selector: "neu-data-view", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, virtualHeight: { classPropertyName: "virtualHeight", publicName: "virtualHeight", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, descending: { classPropertyName: "descending", publicName: "descending", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, searchLabel: { classPropertyName: "searchLabel", publicName: "searchLabel", isSignal: true, isRequired: false, transformFunction: null }, sortLabel: { classPropertyName: "sortLabel", publicName: "sortLabel", isSignal: true, isRequired: false, transformFunction: null }, refreshLabel: { classPropertyName: "refreshLabel", publicName: "refreshLabel", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { query: "queryChange", descending: "descendingChange", selected: "selected", refresh: "refresh" }, queries: [{ propertyName: "itemContent", first: true, predicate: NeuDataViewItemDirective, descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #rowContents let-item let-index="index">
|
|
80
|
+
@if (resolvedItemTemplate(); as template) {
|
|
81
|
+
<ng-container [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ $implicit: item, index }" />
|
|
82
|
+
} @else {
|
|
83
|
+
<text class="title">{{ item.label }}</text><text class="muted">{{ item.description }}</text>
|
|
84
|
+
}
|
|
85
|
+
</ng-template>
|
|
86
|
+
<view class="stack"
|
|
71
87
|
><view class="data-toolbar"
|
|
72
88
|
><neu-icon-button
|
|
73
89
|
[label]="sortLabel()"
|
|
@@ -97,22 +113,34 @@ export class NeuDataViewComponent {
|
|
|
97
113
|
<neu-skeleton />
|
|
98
114
|
} @else if (error()) {
|
|
99
115
|
<neu-alert [message]="error()" />
|
|
116
|
+
} @else if (!displayed().length) {
|
|
117
|
+
<neu-empty-state [title]="emptyLabel()" />
|
|
118
|
+
} @else if (viewportHeight(); as height) {
|
|
119
|
+
<virtual-list #list [items]="displayed()" [keyExtractor]="itemKey"
|
|
120
|
+
[style.height]="height" [rowGap]="12" keyboardShouldPersistTaps="handled">
|
|
121
|
+
@for (row of list.window(); track row.slot) {
|
|
122
|
+
<view [virtualListRow]="row" [accessibilityElementsHidden]="!!row.parked"
|
|
123
|
+
[importantForAccessibility]="row.parked ? 'no-hide-descendants' : 'auto'">
|
|
124
|
+
@for (item of [row.item]; track item.id) {
|
|
125
|
+
<pressable class="data-item" [class.surface]="!resolvedItemTemplate()" [class.outline]="!resolvedItemTemplate()"
|
|
126
|
+
accessibilityRole="button" [accessibilityLabel]="item.label" [accessible]="!row.parked"
|
|
127
|
+
[disabled]="!!row.parked || !!item.disabled" (press)="!row.parked && choose(item)">
|
|
128
|
+
<ng-container [ngTemplateOutlet]="rowContents" [ngTemplateOutletContext]="{ $implicit: item, index: row.index }" />
|
|
129
|
+
</pressable>
|
|
130
|
+
}
|
|
131
|
+
</view>
|
|
132
|
+
}
|
|
133
|
+
</virtual-list>
|
|
100
134
|
} @else {
|
|
101
135
|
@for (item of displayed(); track item.id) {
|
|
102
136
|
<pressable class="data-item" [neuDataRowIndex]="$index" #rowMotion="neuDataRowMotion"
|
|
103
137
|
[animatedStyle]="rowMotion.animated" [class.surface]="!resolvedItemTemplate()" [class.outline]="!resolvedItemTemplate()"
|
|
104
138
|
accessibilityRole="button" [accessibilityLabel]="item.label" [disabled]="!!item.disabled" (press)="choose(item)">
|
|
105
|
-
|
|
106
|
-
<ng-container [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ $implicit: item, index: $index }" />
|
|
107
|
-
} @else {
|
|
108
|
-
<text class="title">{{ item.label }}</text><text class="muted">{{ item.description }}</text>
|
|
109
|
-
}
|
|
139
|
+
<ng-container [ngTemplateOutlet]="rowContents" [ngTemplateOutletContext]="{ $implicit: item, index: $index }" />
|
|
110
140
|
</pressable>
|
|
111
|
-
} @empty {
|
|
112
|
-
<neu-empty-state [title]="emptyLabel()" />
|
|
113
141
|
}
|
|
114
142
|
}
|
|
115
|
-
</view>`, isInline: true, styles: [".neu-unavailable > * {\n /* Fade presentation children without changing the accessible action's own alpha. */\n opacity: 0.45;\n}\n.stack {\n gap: 12px;\n}\n.row {\n flex-direction: row;\n align-items: center;\n gap: 10px;\n}\n.wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex: 1;\n}\n.surface {\n padding: 16px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-surface-radius, 16px);\n gap: 12px;\n}\n.outline {\n border-width: 1px;\n border-color: var(--neu-surface-border, #e1e6ed);\n}\n.title {\n color: var(--neu-text, #172033);\n font-size: var(--neu-heading-size, 18px);\n line-height: 24px;\n font-weight: 600;\n flex-shrink: 1;\n}\n.label {\n color: var(--neu-text, #172033);\n font-size: 16px;\n flex-shrink: 1;\n}\n.muted {\n color: var(--neu-muted, #596477);\n font-size: var(--neu-label-size, 14px);\n line-height: 20px;\n flex-shrink: 1;\n}\n.error {\n color: var(--neu-danger-ink, #b3261e);\n font-size: 14px;\n}\n.action {\n min-height: 48px;\n min-width: 48px;\n padding: 12px;\n justify-content: center;\n align-items: center;\n border-radius: 12px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.selected-text {\n color: var(--neu-on-accent, #ffffff);\n font-size: 16px;\n}\n.control {\n min-height: 48px;\n padding: 12px;\n font-size: 16px;\n color: var(--neu-text, #172033);\n border-width: 1px;\n border-color: var(--neu-border, #a5afbf);\n border-radius: var(--neu-control-radius, 10px);\n background-color: var(--neu-surface, #ffffff);\n}\n.track {\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.fill {\n height: 8px;\n background-color: var(--neu-accent, #3155d9);\n}\n.dot {\n width: 20px;\n height: 20px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n border-radius: 10px;\n}\n.dot-selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.avatar {\n width: 48px;\n height: 48px;\n border-radius: 24px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-tonal, #e9edfc);\n overflow: hidden;\n}\n.avatar-image {\n width: 48px;\n height: 48px;\n}\n.backdrop {\n flex: 1;\n background-color: rgba(0, 0, 0, 0.4);\n justify-content: center;\n padding: 16px;\n}\n.bottom {\n justify-content: flex-end;\n}\n.modal-layout {\n flex: 1;\n justify-content: center;\n}\n.modal-scroll {\n flex-grow: 0;\n flex-shrink: 1;\n}\n.scroll-content {\n padding-right: 12px;\n}\n.sheet {\n padding: 20px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-dialog-radius, 24px);\n gap: 16px;\n max-height: 90%;\n}\n.full {\n flex: 1;\n}\n.sheet-background {\n background-color: var(--neu-surface, #ffffff);\n}\n.page-sheet {\n max-height: 100%;\n border-radius: 0;\n}\n.thumb {\n width: 72px;\n height: 72px;\n border-radius: 12px;\n}\n.hero {\n height: 240px;\n width: 100%;\n}\n.divider {\n height: 1px;\n background-color: var(--neu-divider, #e7ebf0);\n}\n.skeleton {\n background-color: var(--neu-border, #a5afbf);\n border-radius: 8px;\n}\n.pill {\n padding: 4px 10px;\n border-radius: 16px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.calendar-grid {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0;\n}\n.calendar-day {\n width: 14.2857%;\n min-width: 0;\n min-height: 48px;\n padding: 4px;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n}\n.speed-dial {\n align-items: flex-end;\n}\n.fab {\n width: 56px;\n height: 56px;\n border-radius: 28px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-accent, #3155d9);\n}\n.fab-label {\n color: var(--neu-on-accent, #ffffff);\n font-size: 28px;\n}\n.slider-track {\n width: 100%;\n height: 24px;\n position: relative;\n}\n.slider-rail {\n position: absolute;\n top: 8px;\n}\n.slider-thumb {\n width: 24px;\n height: 24px;\n border-radius: 12px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n background-color: var(--neu-on-accent, #ffffff);\n position: absolute;\n top: 0;\n}\n", ".data-item { min-width: 0; } .data-toolbar { flex-direction: row; justify-content: flex-end; gap: 4px; }"], dependencies: [{ kind: "directive", type: NeuNativeTextSyncDirective, selector: "text-input[neuSyncText]", exportAs: ["neuSyncText"] }, { kind: "directive", type: View, selector: "view" }, { kind: "directive", type: Text, selector: "text", inputs: ["numberOfLines", "ellipsizeMode", "selectable", "selectionColor", "allowFontScaling", "maxFontSizeMultiplier", "dynamicTypeRamp", "adjustsFontSizeToFit", "minimumFontScale", "lineBreakStrategyIOS", "textBreakStrategy", "dataDetectorType", "android_hyphenationFrequency", "pressable", "suppressHighlighting"], exportAs: ["text"] }, { kind: "directive", type: TextInput, selector: "text-input", inputs: ["neuralValue", "neuralRemeasure"], outputs: ["neuralValueChange"] }, { kind: "directive", type: Pressable, selector: "pressable", inputs: ["haptic"], exportAs: ["pressable"] }, { kind: "directive", type: NeuDataViewRowMotionDirective, selector: "pressable[neuDataRowIndex]", inputs: ["neuDataRowIndex"], exportAs: ["neuDataRowMotion"] }, { kind: "directive", type: AnimatedStyle, selector: "[animatedStyle]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NeuIconButtonComponent, selector: "neu-icon-button", inputs: ["haptic", "label", "svg", "variant", "tone", "disabled", "loading"], outputs: ["pressed"] }, { kind: "component", type: NeuSkeletonComponent, selector: "neu-skeleton", inputs: ["label", "lines", "variant", "width", "height", "borderRadius", "gap", "lastLineWidth", "animation"] }, { kind: "component", type: NeuAlertComponent, selector: "neu-alert", inputs: ["title", "tone", "variant", "showIcon", "svg", "message", "visible", "closable", "closeLabel"], outputs: ["visibleChange", "closed"] }, { kind: "component", type: NeuEmptyStateComponent, selector: "neu-empty-state", inputs: ["title", "description", "actionLabel"], outputs: ["action"] }] });
|
|
143
|
+
</view>`, isInline: true, styles: [".neu-unavailable > * {\n /* Fade presentation children without changing the accessible action's own alpha. */\n opacity: 0.45;\n}\n.stack {\n gap: 12px;\n}\n.row {\n flex-direction: row;\n align-items: center;\n gap: 10px;\n}\n.wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex: 1;\n}\n.surface {\n padding: 16px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-surface-radius, 16px);\n gap: 12px;\n}\n.outline {\n border-width: 1px;\n border-color: var(--neu-surface-border, #e1e6ed);\n}\n.title {\n color: var(--neu-text, #172033);\n font-size: var(--neu-heading-size, 18px);\n line-height: 24px;\n font-weight: 600;\n flex-shrink: 1;\n}\n.label {\n color: var(--neu-text, #172033);\n font-size: 16px;\n flex-shrink: 1;\n}\n.muted {\n color: var(--neu-muted, #596477);\n font-size: var(--neu-label-size, 14px);\n line-height: 20px;\n flex-shrink: 1;\n}\n.error {\n color: var(--neu-danger-ink, #b3261e);\n font-size: 14px;\n}\n.action {\n min-height: 48px;\n min-width: 48px;\n padding: 12px;\n justify-content: center;\n align-items: center;\n border-radius: 12px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.selected-text {\n color: var(--neu-on-accent, #ffffff);\n font-size: 16px;\n}\n.control {\n min-height: 48px;\n padding: 12px;\n font-size: 16px;\n color: var(--neu-text, #172033);\n border-width: 1px;\n border-color: var(--neu-border, #a5afbf);\n border-radius: var(--neu-control-radius, 10px);\n background-color: var(--neu-surface, #ffffff);\n}\n.track {\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.fill {\n height: 8px;\n background-color: var(--neu-accent, #3155d9);\n}\n.dot {\n width: 20px;\n height: 20px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n border-radius: 10px;\n}\n.dot-selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.avatar {\n width: 48px;\n height: 48px;\n border-radius: 24px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-tonal, #e9edfc);\n overflow: hidden;\n}\n.avatar-image {\n width: 48px;\n height: 48px;\n}\n.backdrop {\n flex: 1;\n background-color: rgba(0, 0, 0, 0.4);\n justify-content: center;\n padding: 16px;\n}\n.bottom {\n justify-content: flex-end;\n}\n.modal-layout {\n flex: 1;\n justify-content: center;\n}\n.modal-scroll {\n flex-grow: 0;\n flex-shrink: 1;\n}\n.scroll-content {\n padding-right: 12px;\n}\n.sheet {\n padding: 20px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-dialog-radius, 24px);\n gap: 16px;\n max-height: 90%;\n}\n.full {\n flex: 1;\n}\n.sheet-background {\n background-color: var(--neu-surface, #ffffff);\n}\n.page-sheet {\n max-height: 100%;\n border-radius: 0;\n}\n.thumb {\n width: 72px;\n height: 72px;\n border-radius: 12px;\n}\n.hero {\n height: 240px;\n width: 100%;\n}\n.divider {\n height: 1px;\n background-color: var(--neu-divider, #e7ebf0);\n}\n.skeleton {\n background-color: var(--neu-border, #a5afbf);\n border-radius: 8px;\n}\n.pill {\n padding: 4px 10px;\n border-radius: 16px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.calendar-grid {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0;\n}\n.calendar-day {\n width: 14.2857%;\n min-width: 0;\n min-height: 48px;\n padding: 4px;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n}\n.speed-dial {\n align-items: flex-end;\n}\n.fab {\n width: 56px;\n height: 56px;\n border-radius: 28px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-accent, #3155d9);\n}\n.fab-label {\n color: var(--neu-on-accent, #ffffff);\n font-size: 28px;\n}\n.slider-track {\n width: 100%;\n height: 24px;\n position: relative;\n}\n.slider-rail {\n position: absolute;\n top: 8px;\n}\n.slider-thumb {\n width: 24px;\n height: 24px;\n border-radius: 12px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n background-color: var(--neu-on-accent, #ffffff);\n position: absolute;\n top: 0;\n}\n", ".data-item { min-width: 0; } .data-toolbar { flex-direction: row; justify-content: flex-end; gap: 4px; }"], dependencies: [{ kind: "directive", type: NeuNativeTextSyncDirective, selector: "text-input[neuSyncText]", exportAs: ["neuSyncText"] }, { kind: "directive", type: View, selector: "view" }, { kind: "directive", type: Text, selector: "text", inputs: ["numberOfLines", "ellipsizeMode", "selectable", "selectionColor", "allowFontScaling", "maxFontSizeMultiplier", "dynamicTypeRamp", "adjustsFontSizeToFit", "minimumFontScale", "lineBreakStrategyIOS", "textBreakStrategy", "dataDetectorType", "android_hyphenationFrequency", "pressable", "suppressHighlighting"], exportAs: ["text"] }, { kind: "directive", type: TextInput, selector: "text-input", inputs: ["neuralValue", "neuralRemeasure"], outputs: ["neuralValueChange"] }, { kind: "directive", type: Pressable, selector: "pressable", inputs: ["haptic"], exportAs: ["pressable"] }, { kind: "component", type: VirtualList, selector: "virtual-list", inputs: ["items", "itemHeight", "estimatedItemHeight", "contentPadding", "rowGap", "keyExtractor", "itemType", "maintainVisibleContentPosition", "overscan", "windowSize", "velocityLead", "endReachedThreshold", "horizontal", "inverted", "stickyIndices", "stickyHeader", "keyboardShouldPersistTaps", "itemVisiblePercentThreshold"], outputs: ["endReached", "viewableItemsChanged"], exportAs: ["virtualList"] }, { kind: "directive", type: VirtualListRow, selector: "[virtualListRow]", inputs: ["virtualListRow"] }, { kind: "directive", type: NeuDataViewRowMotionDirective, selector: "pressable[neuDataRowIndex]", inputs: ["neuDataRowIndex"], exportAs: ["neuDataRowMotion"] }, { kind: "directive", type: AnimatedStyle, selector: "[animatedStyle]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NeuIconButtonComponent, selector: "neu-icon-button", inputs: ["haptic", "label", "svg", "variant", "tone", "disabled", "loading"], outputs: ["pressed"] }, { kind: "component", type: NeuSkeletonComponent, selector: "neu-skeleton", inputs: ["label", "lines", "variant", "width", "height", "borderRadius", "gap", "lastLineWidth", "animation"] }, { kind: "component", type: NeuAlertComponent, selector: "neu-alert", inputs: ["title", "tone", "variant", "showIcon", "svg", "message", "visible", "closable", "closeLabel"], outputs: ["visibleChange", "closed"] }, { kind: "component", type: NeuEmptyStateComponent, selector: "neu-empty-state", inputs: ["title", "description", "actionLabel"], outputs: ["action"] }] });
|
|
116
144
|
}
|
|
117
145
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NeuDataViewComponent, decorators: [{
|
|
118
146
|
type: Component,
|
|
@@ -121,6 +149,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImpor
|
|
|
121
149
|
Text,
|
|
122
150
|
TextInput,
|
|
123
151
|
Pressable,
|
|
152
|
+
VirtualList,
|
|
153
|
+
VirtualListRow,
|
|
124
154
|
NeuDataViewRowMotionDirective,
|
|
125
155
|
AnimatedStyle,
|
|
126
156
|
NgTemplateOutlet,
|
|
@@ -128,7 +158,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImpor
|
|
|
128
158
|
NeuSkeletonComponent,
|
|
129
159
|
NeuAlertComponent,
|
|
130
160
|
NeuEmptyStateComponent,
|
|
131
|
-
], template: `<
|
|
161
|
+
], template: `<ng-template #rowContents let-item let-index="index">
|
|
162
|
+
@if (resolvedItemTemplate(); as template) {
|
|
163
|
+
<ng-container [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ $implicit: item, index }" />
|
|
164
|
+
} @else {
|
|
165
|
+
<text class="title">{{ item.label }}</text><text class="muted">{{ item.description }}</text>
|
|
166
|
+
}
|
|
167
|
+
</ng-template>
|
|
168
|
+
<view class="stack"
|
|
132
169
|
><view class="data-toolbar"
|
|
133
170
|
><neu-icon-button
|
|
134
171
|
[label]="sortLabel()"
|
|
@@ -158,21 +195,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImpor
|
|
|
158
195
|
<neu-skeleton />
|
|
159
196
|
} @else if (error()) {
|
|
160
197
|
<neu-alert [message]="error()" />
|
|
198
|
+
} @else if (!displayed().length) {
|
|
199
|
+
<neu-empty-state [title]="emptyLabel()" />
|
|
200
|
+
} @else if (viewportHeight(); as height) {
|
|
201
|
+
<virtual-list #list [items]="displayed()" [keyExtractor]="itemKey"
|
|
202
|
+
[style.height]="height" [rowGap]="12" keyboardShouldPersistTaps="handled">
|
|
203
|
+
@for (row of list.window(); track row.slot) {
|
|
204
|
+
<view [virtualListRow]="row" [accessibilityElementsHidden]="!!row.parked"
|
|
205
|
+
[importantForAccessibility]="row.parked ? 'no-hide-descendants' : 'auto'">
|
|
206
|
+
@for (item of [row.item]; track item.id) {
|
|
207
|
+
<pressable class="data-item" [class.surface]="!resolvedItemTemplate()" [class.outline]="!resolvedItemTemplate()"
|
|
208
|
+
accessibilityRole="button" [accessibilityLabel]="item.label" [accessible]="!row.parked"
|
|
209
|
+
[disabled]="!!row.parked || !!item.disabled" (press)="!row.parked && choose(item)">
|
|
210
|
+
<ng-container [ngTemplateOutlet]="rowContents" [ngTemplateOutletContext]="{ $implicit: item, index: row.index }" />
|
|
211
|
+
</pressable>
|
|
212
|
+
}
|
|
213
|
+
</view>
|
|
214
|
+
}
|
|
215
|
+
</virtual-list>
|
|
161
216
|
} @else {
|
|
162
217
|
@for (item of displayed(); track item.id) {
|
|
163
218
|
<pressable class="data-item" [neuDataRowIndex]="$index" #rowMotion="neuDataRowMotion"
|
|
164
219
|
[animatedStyle]="rowMotion.animated" [class.surface]="!resolvedItemTemplate()" [class.outline]="!resolvedItemTemplate()"
|
|
165
220
|
accessibilityRole="button" [accessibilityLabel]="item.label" [disabled]="!!item.disabled" (press)="choose(item)">
|
|
166
|
-
|
|
167
|
-
<ng-container [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ $implicit: item, index: $index }" />
|
|
168
|
-
} @else {
|
|
169
|
-
<text class="title">{{ item.label }}</text><text class="muted">{{ item.description }}</text>
|
|
170
|
-
}
|
|
221
|
+
<ng-container [ngTemplateOutlet]="rowContents" [ngTemplateOutletContext]="{ $implicit: item, index: $index }" />
|
|
171
222
|
</pressable>
|
|
172
|
-
} @empty {
|
|
173
|
-
<neu-empty-state [title]="emptyLabel()" />
|
|
174
223
|
}
|
|
175
224
|
}
|
|
176
225
|
</view>`, styles: [".neu-unavailable > * {\n /* Fade presentation children without changing the accessible action's own alpha. */\n opacity: 0.45;\n}\n.stack {\n gap: 12px;\n}\n.row {\n flex-direction: row;\n align-items: center;\n gap: 10px;\n}\n.wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex: 1;\n}\n.surface {\n padding: 16px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-surface-radius, 16px);\n gap: 12px;\n}\n.outline {\n border-width: 1px;\n border-color: var(--neu-surface-border, #e1e6ed);\n}\n.title {\n color: var(--neu-text, #172033);\n font-size: var(--neu-heading-size, 18px);\n line-height: 24px;\n font-weight: 600;\n flex-shrink: 1;\n}\n.label {\n color: var(--neu-text, #172033);\n font-size: 16px;\n flex-shrink: 1;\n}\n.muted {\n color: var(--neu-muted, #596477);\n font-size: var(--neu-label-size, 14px);\n line-height: 20px;\n flex-shrink: 1;\n}\n.error {\n color: var(--neu-danger-ink, #b3261e);\n font-size: 14px;\n}\n.action {\n min-height: 48px;\n min-width: 48px;\n padding: 12px;\n justify-content: center;\n align-items: center;\n border-radius: 12px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.selected-text {\n color: var(--neu-on-accent, #ffffff);\n font-size: 16px;\n}\n.control {\n min-height: 48px;\n padding: 12px;\n font-size: 16px;\n color: var(--neu-text, #172033);\n border-width: 1px;\n border-color: var(--neu-border, #a5afbf);\n border-radius: var(--neu-control-radius, 10px);\n background-color: var(--neu-surface, #ffffff);\n}\n.track {\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.fill {\n height: 8px;\n background-color: var(--neu-accent, #3155d9);\n}\n.dot {\n width: 20px;\n height: 20px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n border-radius: 10px;\n}\n.dot-selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.avatar {\n width: 48px;\n height: 48px;\n border-radius: 24px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-tonal, #e9edfc);\n overflow: hidden;\n}\n.avatar-image {\n width: 48px;\n height: 48px;\n}\n.backdrop {\n flex: 1;\n background-color: rgba(0, 0, 0, 0.4);\n justify-content: center;\n padding: 16px;\n}\n.bottom {\n justify-content: flex-end;\n}\n.modal-layout {\n flex: 1;\n justify-content: center;\n}\n.modal-scroll {\n flex-grow: 0;\n flex-shrink: 1;\n}\n.scroll-content {\n padding-right: 12px;\n}\n.sheet {\n padding: 20px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-dialog-radius, 24px);\n gap: 16px;\n max-height: 90%;\n}\n.full {\n flex: 1;\n}\n.sheet-background {\n background-color: var(--neu-surface, #ffffff);\n}\n.page-sheet {\n max-height: 100%;\n border-radius: 0;\n}\n.thumb {\n width: 72px;\n height: 72px;\n border-radius: 12px;\n}\n.hero {\n height: 240px;\n width: 100%;\n}\n.divider {\n height: 1px;\n background-color: var(--neu-divider, #e7ebf0);\n}\n.skeleton {\n background-color: var(--neu-border, #a5afbf);\n border-radius: 8px;\n}\n.pill {\n padding: 4px 10px;\n border-radius: 16px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.calendar-grid {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0;\n}\n.calendar-day {\n width: 14.2857%;\n min-width: 0;\n min-height: 48px;\n padding: 4px;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n}\n.speed-dial {\n align-items: flex-end;\n}\n.fab {\n width: 56px;\n height: 56px;\n border-radius: 28px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-accent, #3155d9);\n}\n.fab-label {\n color: var(--neu-on-accent, #ffffff);\n font-size: 28px;\n}\n.slider-track {\n width: 100%;\n height: 24px;\n position: relative;\n}\n.slider-rail {\n position: absolute;\n top: 8px;\n}\n.slider-thumb {\n width: 24px;\n height: 24px;\n border-radius: 12px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n background-color: var(--neu-on-accent, #ffffff);\n position: absolute;\n top: 0;\n}\n", ".data-item { min-width: 0; } .data-toolbar { flex-direction: row; justify-content: flex-end; gap: 4px; }"] }]
|
|
177
|
-
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], itemContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => NeuDataViewItemDirective), { isSignal: true }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }, { type: i0.Output, args: ["queryChange"] }], descending: [{ type: i0.Input, args: [{ isSignal: true, alias: "descending", required: false }] }, { type: i0.Output, args: ["descendingChange"] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], searchLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchLabel", required: false }] }], sortLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortLabel", required: false }] }], refreshLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshLabel", required: false }] }], emptyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyLabel", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], refresh: [{ type: i0.Output, args: ["refresh"] }] } });
|
|
226
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], virtualHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualHeight", required: false }] }], itemContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => NeuDataViewItemDirective), { isSignal: true }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }, { type: i0.Output, args: ["queryChange"] }], descending: [{ type: i0.Input, args: [{ isSignal: true, alias: "descending", required: false }] }, { type: i0.Output, args: ["descendingChange"] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], searchLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchLabel", required: false }] }], sortLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortLabel", required: false }] }], refreshLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshLabel", required: false }] }], emptyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyLabel", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], refresh: [{ type: i0.Output, args: ["refresh"] }] } });
|
|
178
227
|
//# sourceMappingURL=data-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-view.js","sourceRoot":"","sources":["../../src/data-view/data-view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,KAAK,EACL,MAAM,EACN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6BAA6B;wBAC7B,aAAa;wBACb,gBAAgB;wBAChB,sBAAsB;wBACtB,oBAAoB;wBACpB,iBAAiB;wBACjB,sBAAsB;qBACvB,YACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6CF;kSAQoC,wBAAwB","sourcesContent":["import {\n booleanAttribute,\n Component,\n contentChild,\n input,\n model,\n output,\n computed,\n inject,\n TemplateRef,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { View, Text } from '@ng-native/components';\nimport { NeuNativePressable as Pressable } from '../foundation/native-pressable.js';\nimport { AnimatedStyle } from '@ng-native/components/animations';\nimport { NeuDataViewRowMotionDirective } from './data-view-row.js';\nimport { NeuNativeTextInput as TextInput } from '../foundation/native-text-input.js';\nimport { NeuOption, uniqueOptions } from '../foundation/mobile.js';\nimport { NeuIconButtonComponent } from '../icon-button/icon-button.js';\nimport { NeuSkeletonComponent } from '../skeleton/skeleton.js';\nimport { NeuAlertComponent } from '../alert/alert.js';\nimport { NeuEmptyStateComponent } from '../empty-state/empty-state.js';\nimport { NEU_LIGHT_TOKENS, NEU_THEME } from '../foundation/index.js';\n\nimport { NeuNativeTextSyncDirective } from '../foundation/native-text-sync.js';\n\nimport { NeuDataViewItemDirective, type NeuDataViewItemContext } from './data-view-templates.js';\nexport type { NeuDataViewItemContext } from './data-view-templates.js';\n\n@Component({\n selector: 'neu-data-view',\n imports: [NeuNativeTextSyncDirective,\n View,\n Text,\n TextInput,\n Pressable,\n NeuDataViewRowMotionDirective,\n AnimatedStyle,\n NgTemplateOutlet,\n NeuIconButtonComponent,\n NeuSkeletonComponent,\n NeuAlertComponent,\n NeuEmptyStateComponent,\n ],\n template: `<view class=\"stack\"\n ><view class=\"data-toolbar\"\n ><neu-icon-button\n [label]=\"sortLabel()\"\n [svg]=\"sortIcon\"\n tone=\"neutral\"\n variant=\"text\"\n (pressed)=\"descending.update(invert)\" /><neu-icon-button\n [label]=\"refreshLabel()\"\n [svg]=\"refreshIcon\"\n tone=\"neutral\"\n variant=\"text\"\n [disabled]=\"loading()\"\n (pressed)=\"refresh.emit()\"\n /></view>\n <text-input\n neuSyncText\n #textSync=\"neuSyncText\"\n (changeText)=\"textSync.synchronize()\"\n class=\"control\"\n [neuralValue]=\"query()\"\n (neuralValueChange)=\"query.set($event)\"\n [accessibilityLabel]=\"searchLabel()\"\n [placeholder]=\"searchLabel()\"\n [placeholderTextColor]=\"mutedColor()\"\n />\n @if (loading()) {\n <neu-skeleton />\n } @else if (error()) {\n <neu-alert [message]=\"error()\" />\n } @else {\n @for (item of displayed(); track item.id) {\n <pressable class=\"data-item\" [neuDataRowIndex]=\"$index\" #rowMotion=\"neuDataRowMotion\"\n [animatedStyle]=\"rowMotion.animated\" [class.surface]=\"!resolvedItemTemplate()\" [class.outline]=\"!resolvedItemTemplate()\"\n accessibilityRole=\"button\" [accessibilityLabel]=\"item.label\" [disabled]=\"!!item.disabled\" (press)=\"choose(item)\">\n @if (resolvedItemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item, index: $index }\" />\n } @else {\n <text class=\"title\">{{ item.label }}</text><text class=\"muted\">{{ item.description }}</text>\n }\n </pressable>\n } @empty {\n <neu-empty-state [title]=\"emptyLabel()\" />\n }\n }\n </view>`,\n styleUrl: '../foundation/mobile.css',\n styles: '.data-item { min-width: 0; } .data-toolbar { flex-direction: row; justify-content: flex-end; gap: 4px; }',\n})\nexport class NeuDataViewComponent {\n readonly items = input<readonly NeuOption[]>([]);\n /** Explicit template takes precedence over a projected neuDataViewItem. */\n readonly itemTemplate = input<TemplateRef<NeuDataViewItemContext>>();\n private readonly itemContent = contentChild(NeuDataViewItemDirective);\n protected readonly resolvedItemTemplate = computed(() => this.itemTemplate() ?? this.itemContent()?.templateRef);\n readonly query = model('');\n readonly descending = model(false);\n readonly loading = input(false, { transform: booleanAttribute });\n readonly error = input('');\n readonly searchLabel = input('Search items');\n readonly sortLabel = input('Reverse order');\n readonly refreshLabel = input('Refresh');\n readonly emptyLabel = input('No items');\n readonly selected = output<string>();\n readonly refresh = output<void>();\n protected readonly sortIcon = '<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m7 4-3 3m3-3 3 3M7 4v16m10 0-3-3m3 3 3-3M17 4v16\"/></svg>';\n protected readonly refreshIcon = '<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 15.4-6.4L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.4 6.4L3 16M3 21v-5h5\"/></svg>';\n private readonly theme = inject(NEU_THEME, { optional: true });\n protected readonly mutedColor = computed(\n () => (this.theme?.() ?? NEU_LIGHT_TOKENS).muted,\n );\n protected readonly invert = (x: boolean) => !x;\n private readonly searchable = computed(() =>\n uniqueOptions(this.items()).map((item) => ({\n item,\n text: (item.label + ' ' + (item.description ?? '')).toLocaleLowerCase(),\n })),\n );\n private readonly sorted = computed(() => {\n const direction = this.descending() ? -1 : 1;\n return [...this.searchable()].sort(\n (a, b) => a.item.label.localeCompare(b.item.label) * direction,\n );\n });\n protected readonly displayed = computed(() => {\n const q = this.query().trim().toLocaleLowerCase();\n return this.sorted().filter((row) => row.text.includes(q)).map((row) => row.item);\n });\n protected choose(item: NeuOption): void {\n if (!item.disabled && !this.loading()) this.selected.emit(item.id);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"data-view.js","sourceRoot":"","sources":["../../src/data-view/data-view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgEF,4wIA/EE,0BAA0B,+FAClC,IAAI,iDACJ,IAAI,mYACJ,SAAS,mIACT,SAAS,mGACT,WAAW,+cACX,cAAc,yFACd,6BAA6B,oIAC7B,aAAa,4DACb,gBAAgB,oJAChB,sBAAsB,gKACtB,oBAAoB,wKACpB,iBAAiB,qMACjB,sBAAsB;;2FAsEb,oBAAoB;kBArFhC,SAAS;+BACE,eAAe,WAChB,CAAC,0BAA0B;wBAClC,IAAI;wBACJ,IAAI;wBACJ,SAAS;wBACT,SAAS;wBACT,WAAW;wBACX,cAAc;wBACd,6BAA6B;wBAC7B,aAAa;wBACb,gBAAgB;wBAChB,sBAAsB;wBACtB,oBAAoB;wBACpB,iBAAiB;wBACjB,sBAAsB;qBACvB,YACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgEF;4YAUoC,wBAAwB","sourcesContent":["import {\n booleanAttribute,\n Component,\n contentChild,\n input,\n model,\n output,\n computed,\n inject,\n TemplateRef,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { View, Text, VirtualList, VirtualListRow } from '@ng-native/components';\nimport { NeuNativePressable as Pressable } from '../foundation/native-pressable.js';\nimport { AnimatedStyle } from '@ng-native/components/animations';\nimport { NeuDataViewRowMotionDirective } from './data-view-row.js';\nimport { NeuNativeTextInput as TextInput } from '../foundation/native-text-input.js';\nimport { NeuOption, uniqueOptions } from '../foundation/mobile.js';\nimport { NeuIconButtonComponent } from '../icon-button/icon-button.js';\nimport { NeuSkeletonComponent } from '../skeleton/skeleton.js';\nimport { NeuAlertComponent } from '../alert/alert.js';\nimport { NeuEmptyStateComponent } from '../empty-state/empty-state.js';\nimport { NEU_LIGHT_TOKENS, NEU_THEME } from '../foundation/index.js';\n\nimport { NeuNativeTextSyncDirective } from '../foundation/native-text-sync.js';\n\nimport { NeuDataViewItemDirective, type NeuDataViewItemContext } from './data-view-templates.js';\nexport type { NeuDataViewItemContext } from './data-view-templates.js';\n\n@Component({\n selector: 'neu-data-view',\n imports: [NeuNativeTextSyncDirective,\n View,\n Text,\n TextInput,\n Pressable,\n VirtualList,\n VirtualListRow,\n NeuDataViewRowMotionDirective,\n AnimatedStyle,\n NgTemplateOutlet,\n NeuIconButtonComponent,\n NeuSkeletonComponent,\n NeuAlertComponent,\n NeuEmptyStateComponent,\n ],\n template: `<ng-template #rowContents let-item let-index=\"index\">\n @if (resolvedItemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item, index }\" />\n } @else {\n <text class=\"title\">{{ item.label }}</text><text class=\"muted\">{{ item.description }}</text>\n }\n </ng-template>\n <view class=\"stack\"\n ><view class=\"data-toolbar\"\n ><neu-icon-button\n [label]=\"sortLabel()\"\n [svg]=\"sortIcon\"\n tone=\"neutral\"\n variant=\"text\"\n (pressed)=\"descending.update(invert)\" /><neu-icon-button\n [label]=\"refreshLabel()\"\n [svg]=\"refreshIcon\"\n tone=\"neutral\"\n variant=\"text\"\n [disabled]=\"loading()\"\n (pressed)=\"refresh.emit()\"\n /></view>\n <text-input\n neuSyncText\n #textSync=\"neuSyncText\"\n (changeText)=\"textSync.synchronize()\"\n class=\"control\"\n [neuralValue]=\"query()\"\n (neuralValueChange)=\"query.set($event)\"\n [accessibilityLabel]=\"searchLabel()\"\n [placeholder]=\"searchLabel()\"\n [placeholderTextColor]=\"mutedColor()\"\n />\n @if (loading()) {\n <neu-skeleton />\n } @else if (error()) {\n <neu-alert [message]=\"error()\" />\n } @else if (!displayed().length) {\n <neu-empty-state [title]=\"emptyLabel()\" />\n } @else if (viewportHeight(); as height) {\n <virtual-list #list [items]=\"displayed()\" [keyExtractor]=\"itemKey\"\n [style.height]=\"height\" [rowGap]=\"12\" keyboardShouldPersistTaps=\"handled\">\n @for (row of list.window(); track row.slot) {\n <view [virtualListRow]=\"row\" [accessibilityElementsHidden]=\"!!row.parked\"\n [importantForAccessibility]=\"row.parked ? 'no-hide-descendants' : 'auto'\">\n @for (item of [row.item]; track item.id) {\n <pressable class=\"data-item\" [class.surface]=\"!resolvedItemTemplate()\" [class.outline]=\"!resolvedItemTemplate()\"\n accessibilityRole=\"button\" [accessibilityLabel]=\"item.label\" [accessible]=\"!row.parked\"\n [disabled]=\"!!row.parked || !!item.disabled\" (press)=\"!row.parked && choose(item)\">\n <ng-container [ngTemplateOutlet]=\"rowContents\" [ngTemplateOutletContext]=\"{ $implicit: item, index: row.index }\" />\n </pressable>\n }\n </view>\n }\n </virtual-list>\n } @else {\n @for (item of displayed(); track item.id) {\n <pressable class=\"data-item\" [neuDataRowIndex]=\"$index\" #rowMotion=\"neuDataRowMotion\"\n [animatedStyle]=\"rowMotion.animated\" [class.surface]=\"!resolvedItemTemplate()\" [class.outline]=\"!resolvedItemTemplate()\"\n accessibilityRole=\"button\" [accessibilityLabel]=\"item.label\" [disabled]=\"!!item.disabled\" (press)=\"choose(item)\">\n <ng-container [ngTemplateOutlet]=\"rowContents\" [ngTemplateOutletContext]=\"{ $implicit: item, index: $index }\" />\n </pressable>\n }\n }\n </view>`,\n styleUrl: '../foundation/mobile.css',\n styles: '.data-item { min-width: 0; } .data-toolbar { flex-direction: row; justify-content: flex-end; gap: 4px; }',\n})\nexport class NeuDataViewComponent {\n readonly items = input<readonly NeuOption[]>([]);\n /** Explicit template takes precedence over a projected neuDataViewItem. */\n readonly itemTemplate = input<TemplateRef<NeuDataViewItemContext>>();\n /** A positive viewport height enables internally scrolling, measured rows. */\n readonly virtualHeight = input<number>();\n private readonly itemContent = contentChild(NeuDataViewItemDirective);\n protected readonly resolvedItemTemplate = computed(() => this.itemTemplate() ?? this.itemContent()?.templateRef);\n protected readonly viewportHeight = computed(() => {\n const height = this.virtualHeight();\n return height !== undefined && Number.isFinite(height) && height > 0 ? height : undefined;\n });\n protected readonly itemKey = (item: NeuOption) => item.id;\n readonly query = model('');\n readonly descending = model(false);\n readonly loading = input(false, { transform: booleanAttribute });\n readonly error = input('');\n readonly searchLabel = input('Search items');\n readonly sortLabel = input('Reverse order');\n readonly refreshLabel = input('Refresh');\n readonly emptyLabel = input('No items');\n readonly selected = output<string>();\n readonly refresh = output<void>();\n protected readonly sortIcon = '<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m7 4-3 3m3-3 3 3M7 4v16m10 0-3-3m3 3 3-3M17 4v16\"/></svg>';\n protected readonly refreshIcon = '<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 15.4-6.4L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.4 6.4L3 16M3 21v-5h5\"/></svg>';\n private readonly theme = inject(NEU_THEME, { optional: true });\n protected readonly mutedColor = computed(\n () => (this.theme?.() ?? NEU_LIGHT_TOKENS).muted,\n );\n protected readonly invert = (x: boolean) => !x;\n private readonly searchable = computed(() =>\n uniqueOptions(this.items()).map((item) => ({\n item,\n text: (item.label + ' ' + (item.description ?? '')).toLocaleLowerCase(),\n })),\n );\n private readonly sorted = computed(() => {\n const direction = this.descending() ? -1 : 1;\n return [...this.searchable()].sort(\n (a, b) => a.item.label.localeCompare(b.item.label) * direction,\n );\n });\n protected readonly displayed = computed(() => {\n const q = this.query().trim().toLocaleLowerCase();\n return this.sorted().filter((row) => row.text.includes(q)).map((row) => row.item);\n });\n protected choose(item: NeuOption): void {\n if (!item.disabled && !this.loading()) this.selected.emit(item.id);\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export * from './cascade-select/index.js';
|
|
|
61
61
|
export * from './pick-list/index.js';
|
|
62
62
|
export * from './notification-center/index.js';
|
|
63
63
|
export * from './virtual-list/index.js';
|
|
64
|
+
export * from './section-list/index.js';
|
|
64
65
|
export * from './carousel/index.js';
|
|
65
66
|
export * from './image-viewer/index.js';
|
|
66
67
|
export * from './gallery/index.js';
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ export * from './cascade-select/index.js';
|
|
|
60
60
|
export * from './pick-list/index.js';
|
|
61
61
|
export * from './notification-center/index.js';
|
|
62
62
|
export * from './virtual-list/index.js';
|
|
63
|
+
export * from './section-list/index.js';
|
|
63
64
|
export * from './carousel/index.js';
|
|
64
65
|
export * from './image-viewer/index.js';
|
|
65
66
|
export * from './gallery/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './button/index.js';\nexport * from './icon-button/index.js';\nexport * from './input/index.js';\nexport * from './textarea/index.js';\nexport * from './checkbox/index.js';\nexport * from './switch/index.js';\nexport * from './card/index.js';\nexport * from './badge/index.js';\nexport * from './spinner/index.js';\nexport * from './divider/index.js';\nexport * from './theme/index.js';\nexport * from './foundation/index.js';\nexport * from './accordion/index.js';\nexport * from './alert/index.js';\nexport * from './avatar/index.js';\nexport * from './avatar-group/index.js';\nexport * from './button-group/index.js';\nexport * from './chip/index.js';\nexport * from './empty-state/index.js';\nexport * from './form-field/index.js';\nexport * from './input-mask/index.js';\nexport * from './input-otp/index.js';\nexport * from './input-tags/index.js';\nexport * from './meter-group/index.js';\nexport * from './number-input/index.js';\nexport * from './panel/index.js';\nexport * from './password/index.js';\nexport * from './progress-bar/index.js';\nexport * from './radio/index.js';\nexport * from './rating/index.js';\nexport * from './skeleton/index.js';\nexport * from './stats-card/index.js';\nexport * from './timeline/index.js';\nexport * from './toast/index.js';\nexport * from './toggle-button-group/index.js';\nexport * from './toolbar/index.js';\nexport type {NeuOption,NeuTreeNode,NeuImageItem} from './foundation/mobile.js';\nexport * from './modal/index.js';\nexport * from './bottom-sheet/index.js';\nexport * from './confirm-dialog/index.js';\nexport * from './listbox/index.js';\nexport * from './select/index.js';\nexport * from './autocomplete/index.js';\nexport * from './menu/index.js';\nexport * from './context-menu/index.js';\nexport * from './popover/index.js';\nexport * from './sidebar/index.js';\nexport * from './nav/index.js';\nexport * from './filter-bar/index.js';\nexport * from './inline-editor/index.js';\nexport * from './speed-dial/index.js';\nexport * from './calendar/index.js';\nexport * from './date-input/index.js';\nexport * from './slider/index.js';\nexport * from './stepper/index.js';\nexport * from './tabs/index.js';\nexport * from './data-view/index.js';\nexport * from './tree/index.js';\nexport * from './tree-select/index.js';\nexport * from './cascade-select/index.js';\nexport * from './pick-list/index.js';\nexport * from './notification-center/index.js';\nexport * from './virtual-list/index.js';\nexport * from './carousel/index.js';\nexport * from './image-viewer/index.js';\nexport * from './gallery/index.js';\nexport * from './uploader/index.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC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AAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './button/index.js';\nexport * from './icon-button/index.js';\nexport * from './input/index.js';\nexport * from './textarea/index.js';\nexport * from './checkbox/index.js';\nexport * from './switch/index.js';\nexport * from './card/index.js';\nexport * from './badge/index.js';\nexport * from './spinner/index.js';\nexport * from './divider/index.js';\nexport * from './theme/index.js';\nexport * from './foundation/index.js';\nexport * from './accordion/index.js';\nexport * from './alert/index.js';\nexport * from './avatar/index.js';\nexport * from './avatar-group/index.js';\nexport * from './button-group/index.js';\nexport * from './chip/index.js';\nexport * from './empty-state/index.js';\nexport * from './form-field/index.js';\nexport * from './input-mask/index.js';\nexport * from './input-otp/index.js';\nexport * from './input-tags/index.js';\nexport * from './meter-group/index.js';\nexport * from './number-input/index.js';\nexport * from './panel/index.js';\nexport * from './password/index.js';\nexport * from './progress-bar/index.js';\nexport * from './radio/index.js';\nexport * from './rating/index.js';\nexport * from './skeleton/index.js';\nexport * from './stats-card/index.js';\nexport * from './timeline/index.js';\nexport * from './toast/index.js';\nexport * from './toggle-button-group/index.js';\nexport * from './toolbar/index.js';\nexport type {NeuOption,NeuTreeNode,NeuImageItem} from './foundation/mobile.js';\nexport * from './modal/index.js';\nexport * from './bottom-sheet/index.js';\nexport * from './confirm-dialog/index.js';\nexport * from './listbox/index.js';\nexport * from './select/index.js';\nexport * from './autocomplete/index.js';\nexport * from './menu/index.js';\nexport * from './context-menu/index.js';\nexport * from './popover/index.js';\nexport * from './sidebar/index.js';\nexport * from './nav/index.js';\nexport * from './filter-bar/index.js';\nexport * from './inline-editor/index.js';\nexport * from './speed-dial/index.js';\nexport * from './calendar/index.js';\nexport * from './date-input/index.js';\nexport * from './slider/index.js';\nexport * from './stepper/index.js';\nexport * from './tabs/index.js';\nexport * from './data-view/index.js';\nexport * from './tree/index.js';\nexport * from './tree-select/index.js';\nexport * from './cascade-select/index.js';\nexport * from './pick-list/index.js';\nexport * from './notification-center/index.js';\nexport * from './virtual-list/index.js';\nexport * from './section-list/index.js';\nexport * from './carousel/index.js';\nexport * from './image-viewer/index.js';\nexport * from './gallery/index.js';\nexport * from './uploader/index.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NeuSectionListComponent, type NeuSectionListSection, type NeuSectionListSelection, } from './section-list.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/section-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,GAGxB,MAAM,mBAAmB,CAAC","sourcesContent":["export {\n NeuSectionListComponent,\n type NeuSectionListSection,\n type NeuSectionListSelection,\n} from './section-list.js';\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type NeuOption } from '../foundation/mobile.js';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export interface NeuSectionListSection {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly title: string;
|
|
6
|
+
readonly data: readonly NeuOption[];
|
|
7
|
+
}
|
|
8
|
+
export interface NeuSectionListSelection {
|
|
9
|
+
readonly sectionKey: string;
|
|
10
|
+
readonly itemId: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class NeuSectionListComponent {
|
|
13
|
+
readonly sections: import("@angular/core").InputSignal<readonly NeuSectionListSection[]>;
|
|
14
|
+
/** Height of the scroll viewport, in native layout units. */
|
|
15
|
+
readonly height: import("@angular/core").InputSignal<number>;
|
|
16
|
+
/** Optional fixed row and header heights. Defaults respond to system font scale. */
|
|
17
|
+
readonly itemHeight: import("@angular/core").InputSignal<number | undefined>;
|
|
18
|
+
readonly headerHeight: import("@angular/core").InputSignal<number | undefined>;
|
|
19
|
+
readonly stickyHeaders: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
20
|
+
readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
21
|
+
readonly error: import("@angular/core").InputSignal<string>;
|
|
22
|
+
readonly emptyLabel: import("@angular/core").InputSignal<string>;
|
|
23
|
+
readonly refreshEnabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
24
|
+
readonly refreshing: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
25
|
+
readonly refreshLabel: import("@angular/core").InputSignal<string>;
|
|
26
|
+
readonly selected: import("@angular/core").OutputEmitterRef<NeuSectionListSelection>;
|
|
27
|
+
readonly refresh: import("@angular/core").OutputEmitterRef<void>;
|
|
28
|
+
private readonly accessibility;
|
|
29
|
+
private readonly fontScale;
|
|
30
|
+
protected readonly viewportHeight: import("@angular/core").Signal<number>;
|
|
31
|
+
protected readonly nonemptySections: import("@angular/core").Signal<NeuSectionListSection[]>;
|
|
32
|
+
protected readonly resolvedItemHeight: import("@angular/core").Signal<number>;
|
|
33
|
+
protected readonly resolvedHeaderHeight: import("@angular/core").Signal<number>;
|
|
34
|
+
protected sectionFromSlot(section: unknown): NeuSectionListSection;
|
|
35
|
+
protected itemFromSlot(item: unknown): NeuOption;
|
|
36
|
+
protected select(section: NeuSectionListSection, item: NeuOption): void;
|
|
37
|
+
protected requestRefresh(): void;
|
|
38
|
+
private positiveSize;
|
|
39
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NeuSectionListComponent, never>;
|
|
40
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NeuSectionListComponent, "neu-section-list", never, { "sections": { "alias": "sections"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "headerHeight": { "alias": "headerHeight"; "required": false; "isSignal": true; }; "stickyHeaders": { "alias": "stickyHeaders"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "emptyLabel": { "alias": "emptyLabel"; "required": false; "isSignal": true; }; "refreshEnabled": { "alias": "refreshEnabled"; "required": false; "isSignal": true; }; "refreshing": { "alias": "refreshing"; "required": false; "isSignal": true; }; "refreshLabel": { "alias": "refreshLabel"; "required": false; "isSignal": true; }; }, { "selected": "selected"; "refresh": "refresh"; }, never, never, true, never>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { booleanAttribute, Component, computed, inject, input, output } from '@angular/core';
|
|
2
|
+
import { Accessibility } from '@ng-native/device';
|
|
3
|
+
import { RefreshControl, SectionHeader, SectionItem, SectionList, Text, View } from '@ng-native/components';
|
|
4
|
+
import { NeuAlertComponent } from '../alert/alert.js';
|
|
5
|
+
import { NeuButtonComponent } from '../button/button.js';
|
|
6
|
+
import { NeuEmptyStateComponent } from '../empty-state/empty-state.js';
|
|
7
|
+
import { NeuNativePressable as Pressable } from '../foundation/native-pressable.js';
|
|
8
|
+
import { NeuSkeletonComponent } from '../skeleton/skeleton.js';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export class NeuSectionListComponent {
|
|
11
|
+
sections = input([], /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "sections" }] : /* istanbul ignore next */ []));
|
|
13
|
+
/** Height of the scroll viewport, in native layout units. */
|
|
14
|
+
height = input(400, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
16
|
+
/** Optional fixed row and header heights. Defaults respond to system font scale. */
|
|
17
|
+
itemHeight = input(/* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [undefined, { debugName: "itemHeight" }] : /* istanbul ignore next */ []));
|
|
19
|
+
headerHeight = input(/* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [undefined, { debugName: "headerHeight" }] : /* istanbul ignore next */ []));
|
|
21
|
+
stickyHeaders = input(true, { ...(ngDevMode ? { debugName: "stickyHeaders" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
22
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
23
|
+
error = input('', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
25
|
+
emptyLabel = input('No items', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
27
|
+
refreshEnabled = input(false, { ...(ngDevMode ? { debugName: "refreshEnabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
28
|
+
refreshing = input(false, { ...(ngDevMode ? { debugName: "refreshing" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
29
|
+
refreshLabel = input('Refresh', /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "refreshLabel" }] : /* istanbul ignore next */ []));
|
|
31
|
+
selected = output();
|
|
32
|
+
refresh = output();
|
|
33
|
+
accessibility = inject(Accessibility);
|
|
34
|
+
fontScale = computed(() => Math.max(1, this.accessibility.fontScale()), /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "fontScale" }] : /* istanbul ignore next */ []));
|
|
36
|
+
viewportHeight = computed(() => this.positiveSize(this.height(), 400), /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
|
|
38
|
+
nonemptySections = computed(() => this.sections().filter(section => section.data.length > 0), /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "nonemptySections" }] : /* istanbul ignore next */ []));
|
|
40
|
+
resolvedItemHeight = computed(() => this.positiveSize(this.itemHeight(), 24 + 44 * this.fontScale()), /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "resolvedItemHeight" }] : /* istanbul ignore next */ []));
|
|
42
|
+
resolvedHeaderHeight = computed(() => this.positiveSize(this.headerHeight(), 12 + 24 * this.fontScale()), /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "resolvedHeaderHeight" }] : /* istanbul ignore next */ []));
|
|
44
|
+
// Angular Native's projected templates have independent generics. These slots
|
|
45
|
+
// receive only the sections and items supplied to the typed list above.
|
|
46
|
+
sectionFromSlot(section) {
|
|
47
|
+
return section;
|
|
48
|
+
}
|
|
49
|
+
itemFromSlot(item) {
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
select(section, item) {
|
|
53
|
+
if (!item.disabled)
|
|
54
|
+
this.selected.emit({ sectionKey: section.key, itemId: item.id });
|
|
55
|
+
}
|
|
56
|
+
requestRefresh() {
|
|
57
|
+
if (this.refreshEnabled() && !this.refreshing() && !this.loading())
|
|
58
|
+
this.refresh.emit();
|
|
59
|
+
}
|
|
60
|
+
positiveSize(size, fallback) {
|
|
61
|
+
return size !== undefined && Number.isFinite(size) && size > 0 ? size : fallback;
|
|
62
|
+
}
|
|
63
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NeuSectionListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
64
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.2", type: NeuSectionListComponent, isStandalone: true, selector: "neu-section-list", inputs: { sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, itemHeight: { classPropertyName: "itemHeight", publicName: "itemHeight", isSignal: true, isRequired: false, transformFunction: null }, headerHeight: { classPropertyName: "headerHeight", publicName: "headerHeight", isSignal: true, isRequired: false, transformFunction: null }, stickyHeaders: { classPropertyName: "stickyHeaders", publicName: "stickyHeaders", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null }, refreshEnabled: { classPropertyName: "refreshEnabled", publicName: "refreshEnabled", isSignal: true, isRequired: false, transformFunction: null }, refreshing: { classPropertyName: "refreshing", publicName: "refreshing", isSignal: true, isRequired: false, transformFunction: null }, refreshLabel: { classPropertyName: "refreshLabel", publicName: "refreshLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected", refresh: "refresh" }, ngImport: i0, template: `<view class="stack">
|
|
65
|
+
@if (refreshEnabled()) {
|
|
66
|
+
<view class="section-actions">
|
|
67
|
+
<neu-button [label]="refreshLabel()" variant="text" [loading]="refreshing()"
|
|
68
|
+
[disabled]="loading()" (pressed)="requestRefresh()" />
|
|
69
|
+
</view>
|
|
70
|
+
}
|
|
71
|
+
@if (loading()) {
|
|
72
|
+
<neu-skeleton />
|
|
73
|
+
} @else if (error()) {
|
|
74
|
+
<neu-alert [message]="error()" />
|
|
75
|
+
} @else {
|
|
76
|
+
<view [style.height]="viewportHeight()">
|
|
77
|
+
<section-list class="section-list" [sections]="nonemptySections()"
|
|
78
|
+
[itemHeight]="resolvedItemHeight()" [sectionHeaderHeight]="resolvedHeaderHeight()"
|
|
79
|
+
[stickySectionHeadersEnabled]="stickyHeaders()" keyboardShouldPersistTaps="handled">
|
|
80
|
+
@if (refreshEnabled()) {
|
|
81
|
+
<refresh-control [refreshing]="refreshing()" (refresh)="requestRefresh()" />
|
|
82
|
+
}
|
|
83
|
+
@if (!nonemptySections().length) {
|
|
84
|
+
<view listHeader><neu-empty-state [title]="emptyLabel()" /></view>
|
|
85
|
+
}
|
|
86
|
+
<ng-template sectionHeader let-section>
|
|
87
|
+
<view class="section-heading">
|
|
88
|
+
<text class="label" accessibilityRole="header" [numberOfLines]="1">{{ sectionFromSlot(section).title }}</text>
|
|
89
|
+
</view>
|
|
90
|
+
</ng-template>
|
|
91
|
+
<ng-template sectionItem let-item let-section="section">
|
|
92
|
+
@for (group of [sectionFromSlot(section)]; track group.key) {
|
|
93
|
+
@for (entry of [itemFromSlot(item)]; track entry.id) {
|
|
94
|
+
<pressable class="section-item" accessibilityRole="button"
|
|
95
|
+
[accessibilityLabel]="entry.description ? entry.label + ', ' + entry.description : entry.label"
|
|
96
|
+
[accessibilityState]="{ disabled: !!entry.disabled }" [disabled]="!!entry.disabled" (press)="select(group, entry)">
|
|
97
|
+
<text class="label" [numberOfLines]="1">{{ entry.label }}</text>
|
|
98
|
+
@if (entry.description) {
|
|
99
|
+
<text class="muted" [numberOfLines]="1">{{ entry.description }}</text>
|
|
100
|
+
}
|
|
101
|
+
</pressable>
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</ng-template>
|
|
105
|
+
</section-list>
|
|
106
|
+
</view>
|
|
107
|
+
}
|
|
108
|
+
</view>`, isInline: true, styles: [".neu-unavailable > * {\n /* Fade presentation children without changing the accessible action's own alpha. */\n opacity: 0.45;\n}\n.stack {\n gap: 12px;\n}\n.row {\n flex-direction: row;\n align-items: center;\n gap: 10px;\n}\n.wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex: 1;\n}\n.surface {\n padding: 16px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-surface-radius, 16px);\n gap: 12px;\n}\n.outline {\n border-width: 1px;\n border-color: var(--neu-surface-border, #e1e6ed);\n}\n.title {\n color: var(--neu-text, #172033);\n font-size: var(--neu-heading-size, 18px);\n line-height: 24px;\n font-weight: 600;\n flex-shrink: 1;\n}\n.label {\n color: var(--neu-text, #172033);\n font-size: 16px;\n flex-shrink: 1;\n}\n.muted {\n color: var(--neu-muted, #596477);\n font-size: var(--neu-label-size, 14px);\n line-height: 20px;\n flex-shrink: 1;\n}\n.error {\n color: var(--neu-danger-ink, #b3261e);\n font-size: 14px;\n}\n.action {\n min-height: 48px;\n min-width: 48px;\n padding: 12px;\n justify-content: center;\n align-items: center;\n border-radius: 12px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.selected-text {\n color: var(--neu-on-accent, #ffffff);\n font-size: 16px;\n}\n.control {\n min-height: 48px;\n padding: 12px;\n font-size: 16px;\n color: var(--neu-text, #172033);\n border-width: 1px;\n border-color: var(--neu-border, #a5afbf);\n border-radius: var(--neu-control-radius, 10px);\n background-color: var(--neu-surface, #ffffff);\n}\n.track {\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.fill {\n height: 8px;\n background-color: var(--neu-accent, #3155d9);\n}\n.dot {\n width: 20px;\n height: 20px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n border-radius: 10px;\n}\n.dot-selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.avatar {\n width: 48px;\n height: 48px;\n border-radius: 24px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-tonal, #e9edfc);\n overflow: hidden;\n}\n.avatar-image {\n width: 48px;\n height: 48px;\n}\n.backdrop {\n flex: 1;\n background-color: rgba(0, 0, 0, 0.4);\n justify-content: center;\n padding: 16px;\n}\n.bottom {\n justify-content: flex-end;\n}\n.modal-layout {\n flex: 1;\n justify-content: center;\n}\n.modal-scroll {\n flex-grow: 0;\n flex-shrink: 1;\n}\n.scroll-content {\n padding-right: 12px;\n}\n.sheet {\n padding: 20px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-dialog-radius, 24px);\n gap: 16px;\n max-height: 90%;\n}\n.full {\n flex: 1;\n}\n.sheet-background {\n background-color: var(--neu-surface, #ffffff);\n}\n.page-sheet {\n max-height: 100%;\n border-radius: 0;\n}\n.thumb {\n width: 72px;\n height: 72px;\n border-radius: 12px;\n}\n.hero {\n height: 240px;\n width: 100%;\n}\n.divider {\n height: 1px;\n background-color: var(--neu-divider, #e7ebf0);\n}\n.skeleton {\n background-color: var(--neu-border, #a5afbf);\n border-radius: 8px;\n}\n.pill {\n padding: 4px 10px;\n border-radius: 16px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.calendar-grid {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0;\n}\n.calendar-day {\n width: 14.2857%;\n min-width: 0;\n min-height: 48px;\n padding: 4px;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n}\n.speed-dial {\n align-items: flex-end;\n}\n.fab {\n width: 56px;\n height: 56px;\n border-radius: 28px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-accent, #3155d9);\n}\n.fab-label {\n color: var(--neu-on-accent, #ffffff);\n font-size: 28px;\n}\n.slider-track {\n width: 100%;\n height: 24px;\n position: relative;\n}\n.slider-rail {\n position: absolute;\n top: 8px;\n}\n.slider-thumb {\n width: 24px;\n height: 24px;\n border-radius: 12px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n background-color: var(--neu-on-accent, #ffffff);\n position: absolute;\n top: 0;\n}\n", ".section-actions {\n align-items: flex-end;\n}\n.section-list {\n flex: 1;\n min-height: 0;\n}\n.section-heading,\n.section-item {\n flex: 1;\n justify-content: center;\n padding-left: 12px;\n padding-right: 12px;\n}\n.section-heading {\n background-color: var(--neu-surface, #ffffff);\n border-bottom-width: 1px;\n border-bottom-color: var(--neu-surface-border, #e1e6ed);\n}\n.section-item {\n gap: 2px;\n background-color: var(--neu-surface, #ffffff);\n border-bottom-width: 1px;\n border-bottom-color: var(--neu-surface-border, #e1e6ed);\n}\n"], dependencies: [{ kind: "directive", type: View, selector: "view" }, { kind: "directive", type: Text, selector: "text", inputs: ["numberOfLines", "ellipsizeMode", "selectable", "selectionColor", "allowFontScaling", "maxFontSizeMultiplier", "dynamicTypeRamp", "adjustsFontSizeToFit", "minimumFontScale", "lineBreakStrategyIOS", "textBreakStrategy", "dataDetectorType", "android_hyphenationFrequency", "pressable", "suppressHighlighting"], exportAs: ["text"] }, { kind: "directive", type: Pressable, selector: "pressable", inputs: ["haptic"], exportAs: ["pressable"] }, { kind: "component", type: SectionList, selector: "section-list", inputs: ["sections", "itemHeight", "sectionHeaderHeight", "sectionFooterHeight", "stickySectionHeadersEnabled", "overscan", "windowSize", "velocityLead", "endReachedThreshold", "contentPadding", "keyboardShouldPersistTaps"], outputs: ["endReached"], exportAs: ["sectionList"] }, { kind: "directive", type: SectionHeader, selector: "ng-template[sectionHeader]" }, { kind: "directive", type: SectionItem, selector: "ng-template[sectionItem]" }, { kind: "directive", type: RefreshControl, selector: "refresh-control", inputs: ["refreshing", "progressViewOffset", "tintColor", "title", "titleColor", "colors", "enabled", "progressBackgroundColor", "size"], outputs: ["refreshingChange"] }, { kind: "component", type: NeuButtonComponent, selector: "neu-button", inputs: ["haptic", "label", "accessibilityLabel", "variant", "tone", "size", "fullWidth", "disabled", "loading"], outputs: ["pressed"] }, { kind: "component", type: NeuSkeletonComponent, selector: "neu-skeleton", inputs: ["label", "lines", "variant", "width", "height", "borderRadius", "gap", "lastLineWidth", "animation"] }, { kind: "component", type: NeuAlertComponent, selector: "neu-alert", inputs: ["title", "tone", "variant", "showIcon", "svg", "message", "visible", "closable", "closeLabel"], outputs: ["visibleChange", "closed"] }, { kind: "component", type: NeuEmptyStateComponent, selector: "neu-empty-state", inputs: ["title", "description", "actionLabel"], outputs: ["action"] }] });
|
|
109
|
+
}
|
|
110
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NeuSectionListComponent, decorators: [{
|
|
111
|
+
type: Component,
|
|
112
|
+
args: [{ selector: 'neu-section-list', imports: [
|
|
113
|
+
View, Text, Pressable, SectionList, SectionHeader, SectionItem, RefreshControl,
|
|
114
|
+
NeuButtonComponent, NeuSkeletonComponent, NeuAlertComponent, NeuEmptyStateComponent,
|
|
115
|
+
], template: `<view class="stack">
|
|
116
|
+
@if (refreshEnabled()) {
|
|
117
|
+
<view class="section-actions">
|
|
118
|
+
<neu-button [label]="refreshLabel()" variant="text" [loading]="refreshing()"
|
|
119
|
+
[disabled]="loading()" (pressed)="requestRefresh()" />
|
|
120
|
+
</view>
|
|
121
|
+
}
|
|
122
|
+
@if (loading()) {
|
|
123
|
+
<neu-skeleton />
|
|
124
|
+
} @else if (error()) {
|
|
125
|
+
<neu-alert [message]="error()" />
|
|
126
|
+
} @else {
|
|
127
|
+
<view [style.height]="viewportHeight()">
|
|
128
|
+
<section-list class="section-list" [sections]="nonemptySections()"
|
|
129
|
+
[itemHeight]="resolvedItemHeight()" [sectionHeaderHeight]="resolvedHeaderHeight()"
|
|
130
|
+
[stickySectionHeadersEnabled]="stickyHeaders()" keyboardShouldPersistTaps="handled">
|
|
131
|
+
@if (refreshEnabled()) {
|
|
132
|
+
<refresh-control [refreshing]="refreshing()" (refresh)="requestRefresh()" />
|
|
133
|
+
}
|
|
134
|
+
@if (!nonemptySections().length) {
|
|
135
|
+
<view listHeader><neu-empty-state [title]="emptyLabel()" /></view>
|
|
136
|
+
}
|
|
137
|
+
<ng-template sectionHeader let-section>
|
|
138
|
+
<view class="section-heading">
|
|
139
|
+
<text class="label" accessibilityRole="header" [numberOfLines]="1">{{ sectionFromSlot(section).title }}</text>
|
|
140
|
+
</view>
|
|
141
|
+
</ng-template>
|
|
142
|
+
<ng-template sectionItem let-item let-section="section">
|
|
143
|
+
@for (group of [sectionFromSlot(section)]; track group.key) {
|
|
144
|
+
@for (entry of [itemFromSlot(item)]; track entry.id) {
|
|
145
|
+
<pressable class="section-item" accessibilityRole="button"
|
|
146
|
+
[accessibilityLabel]="entry.description ? entry.label + ', ' + entry.description : entry.label"
|
|
147
|
+
[accessibilityState]="{ disabled: !!entry.disabled }" [disabled]="!!entry.disabled" (press)="select(group, entry)">
|
|
148
|
+
<text class="label" [numberOfLines]="1">{{ entry.label }}</text>
|
|
149
|
+
@if (entry.description) {
|
|
150
|
+
<text class="muted" [numberOfLines]="1">{{ entry.description }}</text>
|
|
151
|
+
}
|
|
152
|
+
</pressable>
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</ng-template>
|
|
156
|
+
</section-list>
|
|
157
|
+
</view>
|
|
158
|
+
}
|
|
159
|
+
</view>`, styles: [".neu-unavailable > * {\n /* Fade presentation children without changing the accessible action's own alpha. */\n opacity: 0.45;\n}\n.stack {\n gap: 12px;\n}\n.row {\n flex-direction: row;\n align-items: center;\n gap: 10px;\n}\n.wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex: 1;\n}\n.surface {\n padding: 16px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-surface-radius, 16px);\n gap: 12px;\n}\n.outline {\n border-width: 1px;\n border-color: var(--neu-surface-border, #e1e6ed);\n}\n.title {\n color: var(--neu-text, #172033);\n font-size: var(--neu-heading-size, 18px);\n line-height: 24px;\n font-weight: 600;\n flex-shrink: 1;\n}\n.label {\n color: var(--neu-text, #172033);\n font-size: 16px;\n flex-shrink: 1;\n}\n.muted {\n color: var(--neu-muted, #596477);\n font-size: var(--neu-label-size, 14px);\n line-height: 20px;\n flex-shrink: 1;\n}\n.error {\n color: var(--neu-danger-ink, #b3261e);\n font-size: 14px;\n}\n.action {\n min-height: 48px;\n min-width: 48px;\n padding: 12px;\n justify-content: center;\n align-items: center;\n border-radius: 12px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.selected-text {\n color: var(--neu-on-accent, #ffffff);\n font-size: 16px;\n}\n.control {\n min-height: 48px;\n padding: 12px;\n font-size: 16px;\n color: var(--neu-text, #172033);\n border-width: 1px;\n border-color: var(--neu-border, #a5afbf);\n border-radius: var(--neu-control-radius, 10px);\n background-color: var(--neu-surface, #ffffff);\n}\n.track {\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.fill {\n height: 8px;\n background-color: var(--neu-accent, #3155d9);\n}\n.dot {\n width: 20px;\n height: 20px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n border-radius: 10px;\n}\n.dot-selected {\n background-color: var(--neu-accent, #3155d9);\n}\n.avatar {\n width: 48px;\n height: 48px;\n border-radius: 24px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-tonal, #e9edfc);\n overflow: hidden;\n}\n.avatar-image {\n width: 48px;\n height: 48px;\n}\n.backdrop {\n flex: 1;\n background-color: rgba(0, 0, 0, 0.4);\n justify-content: center;\n padding: 16px;\n}\n.bottom {\n justify-content: flex-end;\n}\n.modal-layout {\n flex: 1;\n justify-content: center;\n}\n.modal-scroll {\n flex-grow: 0;\n flex-shrink: 1;\n}\n.scroll-content {\n padding-right: 12px;\n}\n.sheet {\n padding: 20px;\n background-color: var(--neu-surface, #ffffff);\n border-radius: var(--neu-dialog-radius, 24px);\n gap: 16px;\n max-height: 90%;\n}\n.full {\n flex: 1;\n}\n.sheet-background {\n background-color: var(--neu-surface, #ffffff);\n}\n.page-sheet {\n max-height: 100%;\n border-radius: 0;\n}\n.thumb {\n width: 72px;\n height: 72px;\n border-radius: 12px;\n}\n.hero {\n height: 240px;\n width: 100%;\n}\n.divider {\n height: 1px;\n background-color: var(--neu-divider, #e7ebf0);\n}\n.skeleton {\n background-color: var(--neu-border, #a5afbf);\n border-radius: 8px;\n}\n.pill {\n padding: 4px 10px;\n border-radius: 16px;\n background-color: var(--neu-tonal, #e9edfc);\n}\n.calendar-grid {\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0;\n}\n.calendar-day {\n width: 14.2857%;\n min-width: 0;\n min-height: 48px;\n padding: 4px;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n}\n.speed-dial {\n align-items: flex-end;\n}\n.fab {\n width: 56px;\n height: 56px;\n border-radius: 28px;\n align-items: center;\n justify-content: center;\n background-color: var(--neu-accent, #3155d9);\n}\n.fab-label {\n color: var(--neu-on-accent, #ffffff);\n font-size: 28px;\n}\n.slider-track {\n width: 100%;\n height: 24px;\n position: relative;\n}\n.slider-rail {\n position: absolute;\n top: 8px;\n}\n.slider-thumb {\n width: 24px;\n height: 24px;\n border-radius: 12px;\n border-width: 2px;\n border-color: var(--neu-accent, #3155d9);\n background-color: var(--neu-on-accent, #ffffff);\n position: absolute;\n top: 0;\n}\n", ".section-actions {\n align-items: flex-end;\n}\n.section-list {\n flex: 1;\n min-height: 0;\n}\n.section-heading,\n.section-item {\n flex: 1;\n justify-content: center;\n padding-left: 12px;\n padding-right: 12px;\n}\n.section-heading {\n background-color: var(--neu-surface, #ffffff);\n border-bottom-width: 1px;\n border-bottom-color: var(--neu-surface-border, #e1e6ed);\n}\n.section-item {\n gap: 2px;\n background-color: var(--neu-surface, #ffffff);\n border-bottom-width: 1px;\n border-bottom-color: var(--neu-surface-border, #e1e6ed);\n}\n"] }]
|
|
160
|
+
}], propDecorators: { sections: [{ type: i0.Input, args: [{ isSignal: true, alias: "sections", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], itemHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemHeight", required: false }] }], headerHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerHeight", required: false }] }], stickyHeaders: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyHeaders", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], emptyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyLabel", required: false }] }], refreshEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshEnabled", required: false }] }], refreshing: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshing", required: false }] }], refreshLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshLabel", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], refresh: [{ type: i0.Output, args: ["refresh"] }] } });
|
|
161
|
+
//# sourceMappingURL=section-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-list.js","sourceRoot":"","sources":["../../src/section-list/section-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,kBAAkB,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;;AAkE/D,MAAM,OAAO,uBAAuB;IACzB,QAAQ,GAAG,KAAK,CAAmC,EAAE;iFAAC,CAAC;IAChE,6DAA6D;IACpD,MAAM,GAAG,KAAK,CAAC,GAAG;+EAAC,CAAC;IAC7B,oFAAoF;IAC3E,UAAU,GAAG,KAAK;8FAAU,CAAC;IAC7B,YAAY,GAAG,KAAK;gGAAU,CAAC;IAC/B,aAAa,GAAG,KAAK,CAAC,IAAI,qFAAI,SAAS,EAAE,gBAAgB,GAAG,CAAC;IAC7D,OAAO,GAAG,KAAK,CAAC,KAAK,+EAAI,SAAS,EAAE,gBAAgB,GAAG,CAAC;IACxD,KAAK,GAAG,KAAK,CAAC,EAAE;8EAAC,CAAC;IAClB,UAAU,GAAG,KAAK,CAA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ribute, Component, computed, inject, input, output } from '@angular/core';\nimport { Accessibility } from '@ng-native/device';\nimport { RefreshControl, SectionHeader, SectionItem, SectionList, Text, View } from '@ng-native/components';\nimport { NeuAlertComponent } from '../alert/alert.js';\nimport { NeuButtonComponent } from '../button/button.js';\nimport { NeuEmptyStateComponent } from '../empty-state/empty-state.js';\nimport { type NeuOption } from '../foundation/mobile.js';\nimport { NeuNativePressable as Pressable } from '../foundation/native-pressable.js';\nimport { NeuSkeletonComponent } from '../skeleton/skeleton.js';\n\nexport interface NeuSectionListSection {\n readonly key: string;\n readonly title: string;\n readonly data: readonly NeuOption[];\n}\n\nexport interface NeuSectionListSelection {\n readonly sectionKey: string;\n readonly itemId: string;\n}\n\n@Component({\n selector: 'neu-section-list',\n imports: [\n View, Text, Pressable, SectionList, SectionHeader, SectionItem, RefreshControl,\n NeuButtonComponent, NeuSkeletonComponent, NeuAlertComponent, NeuEmptyStateComponent,\n ],\n template: `<view class=\"stack\">\n @if (refreshEnabled()) {\n <view class=\"section-actions\">\n <neu-button [label]=\"refreshLabel()\" variant=\"text\" [loading]=\"refreshing()\"\n [disabled]=\"loading()\" (pressed)=\"requestRefresh()\" />\n </view>\n }\n @if (loading()) {\n <neu-skeleton />\n } @else if (error()) {\n <neu-alert [message]=\"error()\" />\n } @else {\n <view [style.height]=\"viewportHeight()\">\n <section-list class=\"section-list\" [sections]=\"nonemptySections()\"\n [itemHeight]=\"resolvedItemHeight()\" [sectionHeaderHeight]=\"resolvedHeaderHeight()\"\n [stickySectionHeadersEnabled]=\"stickyHeaders()\" keyboardShouldPersistTaps=\"handled\">\n @if (refreshEnabled()) {\n <refresh-control [refreshing]=\"refreshing()\" (refresh)=\"requestRefresh()\" />\n }\n @if (!nonemptySections().length) {\n <view listHeader><neu-empty-state [title]=\"emptyLabel()\" /></view>\n }\n <ng-template sectionHeader let-section>\n <view class=\"section-heading\">\n <text class=\"label\" accessibilityRole=\"header\" [numberOfLines]=\"1\">{{ sectionFromSlot(section).title }}</text>\n </view>\n </ng-template>\n <ng-template sectionItem let-item let-section=\"section\">\n @for (group of [sectionFromSlot(section)]; track group.key) {\n @for (entry of [itemFromSlot(item)]; track entry.id) {\n <pressable class=\"section-item\" accessibilityRole=\"button\"\n [accessibilityLabel]=\"entry.description ? entry.label + ', ' + entry.description : entry.label\"\n [accessibilityState]=\"{ disabled: !!entry.disabled }\" [disabled]=\"!!entry.disabled\" (press)=\"select(group, entry)\">\n <text class=\"label\" [numberOfLines]=\"1\">{{ entry.label }}</text>\n @if (entry.description) {\n <text class=\"muted\" [numberOfLines]=\"1\">{{ entry.description }}</text>\n }\n </pressable>\n }\n }\n </ng-template>\n </section-list>\n </view>\n }\n </view>`,\n styleUrls: ['../foundation/mobile.css', './section-list.css'],\n})\nexport class NeuSectionListComponent {\n readonly sections = input<readonly NeuSectionListSection[]>([]);\n /** Height of the scroll viewport, in native layout units. */\n readonly height = input(400);\n /** Optional fixed row and header heights. Defaults respond to system font scale. */\n readonly itemHeight = input<number>();\n readonly headerHeight = input<number>();\n readonly stickyHeaders = input(true, { transform: booleanAttribute });\n readonly loading = input(false, { transform: booleanAttribute });\n readonly error = input('');\n readonly emptyLabel = input('No items');\n readonly refreshEnabled = input(false, { transform: booleanAttribute });\n readonly refreshing = input(false, { transform: booleanAttribute });\n readonly refreshLabel = input('Refresh');\n\n readonly selected = output<NeuSectionListSelection>();\n readonly refresh = output<void>();\n\n private readonly accessibility = inject(Accessibility);\n private readonly fontScale = computed(() => Math.max(1, this.accessibility.fontScale()));\n protected readonly viewportHeight = computed(() => this.positiveSize(this.height(), 400));\n protected readonly nonemptySections = computed(() => this.sections().filter(section => section.data.length > 0));\n protected readonly resolvedItemHeight = computed(() => this.positiveSize(this.itemHeight(), 24 + 44 * this.fontScale()));\n protected readonly resolvedHeaderHeight = computed(() => this.positiveSize(this.headerHeight(), 12 + 24 * this.fontScale()));\n\n // Angular Native's projected templates have independent generics. These slots\n // receive only the sections and items supplied to the typed list above.\n protected sectionFromSlot(section: unknown): NeuSectionListSection {\n return section as NeuSectionListSection;\n }\n\n protected itemFromSlot(item: unknown): NeuOption {\n return item as NeuOption;\n }\n\n protected select(section: NeuSectionListSection, item: NeuOption): void {\n if (!item.disabled) this.selected.emit({ sectionKey: section.key, itemId: item.id });\n }\n\n protected requestRefresh(): void {\n if (this.refreshEnabled() && !this.refreshing() && !this.loading()) this.refresh.emit();\n }\n\n private positiveSize(size: number | undefined, fallback: number): number {\n return size !== undefined && Number.isFinite(size) && size > 0 ? size : fallback;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neural-ui/native",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Signals-first native Angular components for iOS and Android.",
|
|
@@ -266,6 +266,10 @@
|
|
|
266
266
|
"types": "./dist/virtual-list/index.d.ts",
|
|
267
267
|
"default": "./dist/virtual-list/index.js"
|
|
268
268
|
},
|
|
269
|
+
"./section-list": {
|
|
270
|
+
"types": "./dist/section-list/index.d.ts",
|
|
271
|
+
"default": "./dist/section-list/index.js"
|
|
272
|
+
},
|
|
269
273
|
"./carousel": {
|
|
270
274
|
"types": "./dist/carousel/index.d.ts",
|
|
271
275
|
"default": "./dist/carousel/index.js"
|