@frame-kit/ui-ng 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +683 -0
- package/DEVELOPMENT_GUIDE.md +1102 -0
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/THEMING.md +130 -0
- package/core/headline/README.md +121 -0
- package/core/icon/README.md +173 -0
- package/core/image/README.md +210 -0
- package/core/link/README.md +297 -0
- package/core/separator/README.md +145 -0
- package/core/text/README.md +240 -0
- package/directives/infinite-scroll/README.md +102 -0
- package/directives/spotlight/README.md +154 -0
- package/directives/tooltip/README.md +147 -0
- package/docs/endpoint-link/README.md +142 -0
- package/docs/method-badge/README.md +154 -0
- package/fesm2022/frame-kit-ui-ng-core-headline.mjs +122 -0
- package/fesm2022/frame-kit-ui-ng-core-headline.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-core-icon.mjs +189 -0
- package/fesm2022/frame-kit-ui-ng-core-icon.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-core-image.mjs +123 -0
- package/fesm2022/frame-kit-ui-ng-core-image.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-core-link.mjs +369 -0
- package/fesm2022/frame-kit-ui-ng-core-link.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-core-separator.mjs +59 -0
- package/fesm2022/frame-kit-ui-ng-core-separator.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-core-text.mjs +204 -0
- package/fesm2022/frame-kit-ui-ng-core-text.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-directives-infinite-scroll.mjs +74 -0
- package/fesm2022/frame-kit-ui-ng-directives-infinite-scroll.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-directives-spotlight.mjs +76 -0
- package/fesm2022/frame-kit-ui-ng-directives-spotlight.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-directives-tooltip.mjs +425 -0
- package/fesm2022/frame-kit-ui-ng-directives-tooltip.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-docs-endpoint-link.mjs +63 -0
- package/fesm2022/frame-kit-ui-ng-docs-endpoint-link.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-docs-method-badge.mjs +43 -0
- package/fesm2022/frame-kit-ui-ng-docs-method-badge.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-forms.mjs +3632 -0
- package/fesm2022/frame-kit-ui-ng-forms.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-layouts-app-shell.mjs +239 -0
- package/fesm2022/frame-kit-ui-ng-layouts-app-shell.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-layouts-content-split.mjs +132 -0
- package/fesm2022/frame-kit-ui-ng-layouts-content-split.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-services-overlay-orchestrator.mjs +133 -0
- package/fesm2022/frame-kit-ui-ng-services-overlay-orchestrator.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-services-spotlight.mjs +60 -0
- package/fesm2022/frame-kit-ui-ng-services-spotlight.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-services-toast.mjs +166 -0
- package/fesm2022/frame-kit-ui-ng-services-toast.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-accordion.mjs +214 -0
- package/fesm2022/frame-kit-ui-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-alert.mjs +82 -0
- package/fesm2022/frame-kit-ui-ng-ui-alert.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-avatar-stack.mjs +76 -0
- package/fesm2022/frame-kit-ui-ng-ui-avatar-stack.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-avatar.mjs +81 -0
- package/fesm2022/frame-kit-ui-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-badge.mjs +81 -0
- package/fesm2022/frame-kit-ui-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-breadcrumb.mjs +68 -0
- package/fesm2022/frame-kit-ui-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-button.mjs +108 -0
- package/fesm2022/frame-kit-ui-ng-ui-button.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-callout.mjs +58 -0
- package/fesm2022/frame-kit-ui-ng-ui-callout.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-card.mjs +70 -0
- package/fesm2022/frame-kit-ui-ng-ui-card.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-copyable-field.mjs +113 -0
- package/fesm2022/frame-kit-ui-ng-ui-copyable-field.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-data-table.mjs +1288 -0
- package/fesm2022/frame-kit-ui-ng-ui-data-table.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-dialog.mjs +456 -0
- package/fesm2022/frame-kit-ui-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-drawer.mjs +398 -0
- package/fesm2022/frame-kit-ui-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-dropdown-menu.mjs +398 -0
- package/fesm2022/frame-kit-ui-ng-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-editable-field.mjs +125 -0
- package/fesm2022/frame-kit-ui-ng-ui-editable-field.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-icon-badge.mjs +113 -0
- package/fesm2022/frame-kit-ui-ng-ui-icon-badge.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-icon-list.mjs +111 -0
- package/fesm2022/frame-kit-ui-ng-ui-icon-list.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-inline-edit.mjs +103 -0
- package/fesm2022/frame-kit-ui-ng-ui-inline-edit.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-list-editor.mjs +135 -0
- package/fesm2022/frame-kit-ui-ng-ui-list-editor.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-loader.mjs +81 -0
- package/fesm2022/frame-kit-ui-ng-ui-loader.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-menu-item.mjs +79 -0
- package/fesm2022/frame-kit-ui-ng-ui-menu-item.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-nav-brand.mjs +40 -0
- package/fesm2022/frame-kit-ui-ng-ui-nav-brand.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-nav-group.mjs +110 -0
- package/fesm2022/frame-kit-ui-ng-ui-nav-group.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-nav-separator.mjs +91 -0
- package/fesm2022/frame-kit-ui-ng-ui-nav-separator.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-node-tree-breadcrumb.mjs +86 -0
- package/fesm2022/frame-kit-ui-ng-ui-node-tree-breadcrumb.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-node-tree.mjs +443 -0
- package/fesm2022/frame-kit-ui-ng-ui-node-tree.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-note.mjs +56 -0
- package/fesm2022/frame-kit-ui-ng-ui-note.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-numbered-list.mjs +105 -0
- package/fesm2022/frame-kit-ui-ng-ui-numbered-list.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-pagination.mjs +110 -0
- package/fesm2022/frame-kit-ui-ng-ui-pagination.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-progress-bar.mjs +129 -0
- package/fesm2022/frame-kit-ui-ng-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-sidenav-link.mjs +42 -0
- package/fesm2022/frame-kit-ui-ng-ui-sidenav-link.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-tabs.mjs +894 -0
- package/fesm2022/frame-kit-ui-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-timeline.mjs +81 -0
- package/fesm2022/frame-kit-ui-ng-ui-timeline.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-toast.mjs +179 -0
- package/fesm2022/frame-kit-ui-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-user-menu.mjs +143 -0
- package/fesm2022/frame-kit-ui-ng-ui-user-menu.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng-ui-wizard-dialog.mjs +191 -0
- package/fesm2022/frame-kit-ui-ng-ui-wizard-dialog.mjs.map +1 -0
- package/fesm2022/frame-kit-ui-ng.mjs +58 -0
- package/fesm2022/frame-kit-ui-ng.mjs.map +1 -0
- package/layouts/app-shell/README.md +357 -0
- package/layouts/content-split/README.md +180 -0
- package/package.json +253 -0
- package/services/overlay-orchestrator/README.md +184 -0
- package/services/spotlight/README.md +61 -0
- package/services/toast/README.md +118 -0
- package/types/frame-kit-ui-ng-core-headline.d.ts +38 -0
- package/types/frame-kit-ui-ng-core-icon.d.ts +74 -0
- package/types/frame-kit-ui-ng-core-image.d.ts +93 -0
- package/types/frame-kit-ui-ng-core-link.d.ts +251 -0
- package/types/frame-kit-ui-ng-core-separator.d.ts +28 -0
- package/types/frame-kit-ui-ng-core-text.d.ts +186 -0
- package/types/frame-kit-ui-ng-directives-infinite-scroll.d.ts +42 -0
- package/types/frame-kit-ui-ng-directives-spotlight.d.ts +51 -0
- package/types/frame-kit-ui-ng-directives-tooltip.d.ts +70 -0
- package/types/frame-kit-ui-ng-docs-endpoint-link.d.ts +43 -0
- package/types/frame-kit-ui-ng-docs-method-badge.d.ts +30 -0
- package/types/frame-kit-ui-ng-forms.d.ts +1674 -0
- package/types/frame-kit-ui-ng-layouts-app-shell.d.ts +75 -0
- package/types/frame-kit-ui-ng-layouts-content-split.d.ts +43 -0
- package/types/frame-kit-ui-ng-services-overlay-orchestrator.d.ts +96 -0
- package/types/frame-kit-ui-ng-services-spotlight.d.ts +32 -0
- package/types/frame-kit-ui-ng-services-toast.d.ts +100 -0
- package/types/frame-kit-ui-ng-ui-accordion.d.ts +86 -0
- package/types/frame-kit-ui-ng-ui-alert.d.ts +34 -0
- package/types/frame-kit-ui-ng-ui-avatar-stack.d.ts +38 -0
- package/types/frame-kit-ui-ng-ui-avatar.d.ts +36 -0
- package/types/frame-kit-ui-ng-ui-badge.d.ts +33 -0
- package/types/frame-kit-ui-ng-ui-breadcrumb.d.ts +45 -0
- package/types/frame-kit-ui-ng-ui-button.d.ts +48 -0
- package/types/frame-kit-ui-ng-ui-callout.d.ts +26 -0
- package/types/frame-kit-ui-ng-ui-card.d.ts +30 -0
- package/types/frame-kit-ui-ng-ui-copyable-field.d.ts +62 -0
- package/types/frame-kit-ui-ng-ui-data-table.d.ts +482 -0
- package/types/frame-kit-ui-ng-ui-dialog.d.ts +166 -0
- package/types/frame-kit-ui-ng-ui-drawer.d.ts +130 -0
- package/types/frame-kit-ui-ng-ui-dropdown-menu.d.ts +77 -0
- package/types/frame-kit-ui-ng-ui-editable-field.d.ts +65 -0
- package/types/frame-kit-ui-ng-ui-icon-badge.d.ts +45 -0
- package/types/frame-kit-ui-ng-ui-icon-list.d.ts +67 -0
- package/types/frame-kit-ui-ng-ui-inline-edit.d.ts +44 -0
- package/types/frame-kit-ui-ng-ui-list-editor.d.ts +56 -0
- package/types/frame-kit-ui-ng-ui-loader.d.ts +32 -0
- package/types/frame-kit-ui-ng-ui-menu-item.d.ts +27 -0
- package/types/frame-kit-ui-ng-ui-nav-brand.d.ts +25 -0
- package/types/frame-kit-ui-ng-ui-nav-group.d.ts +60 -0
- package/types/frame-kit-ui-ng-ui-nav-separator.d.ts +33 -0
- package/types/frame-kit-ui-ng-ui-node-tree-breadcrumb.d.ts +35 -0
- package/types/frame-kit-ui-ng-ui-node-tree.d.ts +135 -0
- package/types/frame-kit-ui-ng-ui-note.d.ts +22 -0
- package/types/frame-kit-ui-ng-ui-numbered-list.d.ts +52 -0
- package/types/frame-kit-ui-ng-ui-pagination.d.ts +49 -0
- package/types/frame-kit-ui-ng-ui-progress-bar.d.ts +50 -0
- package/types/frame-kit-ui-ng-ui-sidenav-link.d.ts +24 -0
- package/types/frame-kit-ui-ng-ui-tabs.d.ts +266 -0
- package/types/frame-kit-ui-ng-ui-timeline.d.ts +42 -0
- package/types/frame-kit-ui-ng-ui-toast.d.ts +56 -0
- package/types/frame-kit-ui-ng-ui-user-menu.d.ts +87 -0
- package/types/frame-kit-ui-ng-ui-wizard-dialog.d.ts +116 -0
- package/types/frame-kit-ui-ng.d.ts +53 -0
- package/ui/accordion/README.md +261 -0
- package/ui/alert/README.md +211 -0
- package/ui/avatar/README.md +167 -0
- package/ui/avatar-stack/README.md +164 -0
- package/ui/badge/README.md +162 -0
- package/ui/breadcrumb/README.md +240 -0
- package/ui/button/README.md +184 -0
- package/ui/callout/README.md +159 -0
- package/ui/card/README.md +174 -0
- package/ui/copyable-field/README.md +235 -0
- package/ui/data-table/README.md +408 -0
- package/ui/dialog/README.md +222 -0
- package/ui/drawer/README.md +274 -0
- package/ui/dropdown-menu/README.md +336 -0
- package/ui/editable-field/README.md +171 -0
- package/ui/icon-badge/README.md +131 -0
- package/ui/icon-list/README.md +205 -0
- package/ui/inline-edit/README.md +135 -0
- package/ui/list-editor/README.md +162 -0
- package/ui/loader/README.md +160 -0
- package/ui/menu-item/README.md +204 -0
- package/ui/nav-brand/README.md +111 -0
- package/ui/nav-group/README.md +145 -0
- package/ui/nav-separator/README.md +44 -0
- package/ui/node-tree/README.md +278 -0
- package/ui/node-tree-breadcrumb/README.md +164 -0
- package/ui/note/README.md +146 -0
- package/ui/numbered-list/README.md +187 -0
- package/ui/pagination/README.md +174 -0
- package/ui/progress-bar/README.md +223 -0
- package/ui/sidenav-link/README.md +214 -0
- package/ui/tabs/README.md +204 -0
- package/ui/timeline/README.md +285 -0
- package/ui/toast/README.md +243 -0
- package/ui/user-menu/README.md +260 -0
- package/ui/wizard-dialog/README.md +283 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { moveItemInArray, CdkDropList, CdkDrag, CdkDragHandle, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { model, input, output, signal, computed, HostBinding, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { FormsModule } from '@angular/forms';
|
|
6
|
+
import { IconComponent } from '@frame-kit/ui-ng/core/icon';
|
|
7
|
+
import { ButtonComponent, FkButtonIconStartDirective } from '@frame-kit/ui-ng/ui/button';
|
|
8
|
+
|
|
9
|
+
class ListEditorComponent {
|
|
10
|
+
// ===== INPUTS =====
|
|
11
|
+
/** The current list of string items; two-way bindable via `[(items)]`. */
|
|
12
|
+
items = model([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
13
|
+
/** Placeholder text for the new-item input field. */
|
|
14
|
+
placeholder = input('Add an item...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
15
|
+
/** Message displayed when the list is empty. */
|
|
16
|
+
emptyMessage = input('No items added yet.', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
17
|
+
/** Label for the add button. */
|
|
18
|
+
addLabel = input('Add', ...(ngDevMode ? [{ debugName: "addLabel" }] : /* istanbul ignore next */ []));
|
|
19
|
+
/** When true, items can be reordered via drag-and-drop. */
|
|
20
|
+
orderable = input(true, ...(ngDevMode ? [{ debugName: "orderable" }] : /* istanbul ignore next */ []));
|
|
21
|
+
/** When true, shows a numeric position indicator next to each item. */
|
|
22
|
+
showOrder = input(true, ...(ngDevMode ? [{ debugName: "showOrder" }] : /* istanbul ignore next */ []));
|
|
23
|
+
/** Size variant controlling the spacing and font of the component. */
|
|
24
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
25
|
+
/** Items that cannot be removed by the user (matched case-insensitively). */
|
|
26
|
+
lockedItems = input([], ...(ngDevMode ? [{ debugName: "lockedItems" }] : /* istanbul ignore next */ []));
|
|
27
|
+
// ===== BASE PROPS =====
|
|
28
|
+
className = input('', ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
|
|
29
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
30
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
31
|
+
// ===== OUTPUTS =====
|
|
32
|
+
/** Fires whenever the items array changes, emitting the full updated array. */
|
|
33
|
+
itemsChange = output();
|
|
34
|
+
/** Fires when a new item is successfully added, emitting the added value. */
|
|
35
|
+
itemAdded = output();
|
|
36
|
+
/** Fires when an item is removed, emitting the removed value and its former index. */
|
|
37
|
+
itemRemoved = output();
|
|
38
|
+
// ===== LOCAL STATE =====
|
|
39
|
+
newItemValue = signal('', ...(ngDevMode ? [{ debugName: "newItemValue" }] : /* istanbul ignore next */ []));
|
|
40
|
+
// ===== COMPUTED =====
|
|
41
|
+
canAdd = computed(() => {
|
|
42
|
+
const value = this.newItemValue().trim();
|
|
43
|
+
if (!value) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const existing = this.items().map((n) => n.trim().toLowerCase());
|
|
47
|
+
return !existing.includes(value.toLowerCase());
|
|
48
|
+
}, ...(ngDevMode ? [{ debugName: "canAdd" }] : /* istanbul ignore next */ []));
|
|
49
|
+
hasDuplicates = computed(() => {
|
|
50
|
+
const names = this.items().map((n) => n.trim().toLowerCase());
|
|
51
|
+
return new Set(names).size !== names.length;
|
|
52
|
+
}, ...(ngDevMode ? [{ debugName: "hasDuplicates" }] : /* istanbul ignore next */ []));
|
|
53
|
+
hasEmptyItems = computed(() => {
|
|
54
|
+
return this.items().some((n) => n.trim() === '');
|
|
55
|
+
}, ...(ngDevMode ? [{ debugName: "hasEmptyItems" }] : /* istanbul ignore next */ []));
|
|
56
|
+
classes = computed(() => [
|
|
57
|
+
'fk-list-editor',
|
|
58
|
+
`fk-list-editor--${this.size()}`,
|
|
59
|
+
this.disabled() ? 'fk-list-editor--disabled' : '',
|
|
60
|
+
this.className(),
|
|
61
|
+
]
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.join(' '), ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
64
|
+
get hostClass() {
|
|
65
|
+
return this.classes();
|
|
66
|
+
}
|
|
67
|
+
// ===== ACTIONS =====
|
|
68
|
+
/** Adds the current input value as a new item if it is non-empty and not a duplicate. */
|
|
69
|
+
addItem() {
|
|
70
|
+
const value = this.newItemValue().trim();
|
|
71
|
+
if (!value || !this.canAdd() || this.disabled()) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.items.update((prev) => [...prev, value]);
|
|
75
|
+
this.newItemValue.set('');
|
|
76
|
+
this.itemsChange.emit(this.items());
|
|
77
|
+
this.itemAdded.emit(value);
|
|
78
|
+
}
|
|
79
|
+
/** Removes the item at the given index unless it is locked or the component is disabled. */
|
|
80
|
+
removeItem(index) {
|
|
81
|
+
const item = this.items()[index];
|
|
82
|
+
if (this.disabled() || this.isLocked(item)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.items.update((prev) => prev.filter((_, i) => i !== index));
|
|
86
|
+
this.itemsChange.emit(this.items());
|
|
87
|
+
this.itemRemoved.emit({ item, index });
|
|
88
|
+
}
|
|
89
|
+
/** Updates the item at the given index with a new value and emits the changed array. */
|
|
90
|
+
updateItem(index, value) {
|
|
91
|
+
this.items.update((prev) => prev.map((item, i) => (i === index ? value : item)));
|
|
92
|
+
this.itemsChange.emit(this.items());
|
|
93
|
+
}
|
|
94
|
+
onDrop(event) {
|
|
95
|
+
const updated = [...this.items()];
|
|
96
|
+
moveItemInArray(updated, event.previousIndex, event.currentIndex);
|
|
97
|
+
this.items.set(updated);
|
|
98
|
+
this.itemsChange.emit(this.items());
|
|
99
|
+
}
|
|
100
|
+
/** Returns true if the given item matches any entry in `lockedItems`. */
|
|
101
|
+
isLocked(item) {
|
|
102
|
+
return this.lockedItems().includes(item.trim().toLowerCase());
|
|
103
|
+
}
|
|
104
|
+
onKeydown(event) {
|
|
105
|
+
if (event.key === 'Enter') {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
this.addItem();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ListEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
111
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: ListEditorComponent, isStandalone: true, selector: "fk-list-editor", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, addLabel: { classPropertyName: "addLabel", publicName: "addLabel", isSignal: true, isRequired: false, transformFunction: null }, orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, showOrder: { classPropertyName: "showOrder", publicName: "showOrder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, lockedItems: { classPropertyName: "lockedItems", publicName: "lockedItems", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { items: "itemsChange", itemsChange: "itemsChange", itemAdded: "itemAdded", itemRemoved: "itemRemoved" }, host: { properties: { "class": "this.hostClass" } }, ngImport: i0, template: "<div\n cdkDropList\n [cdkDropListDisabled]=\"disabled() || !orderable()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n class=\"fk-list-editor__list\"\n [attr.aria-label]=\"ariaLabel()\"\n>\n @for (item of items(); track $index) {\n <div\n cdkDrag\n [cdkDragDisabled]=\"disabled() || !orderable()\"\n class=\"fk-list-editor__item\"\n >\n @if (orderable()) {\n <span class=\"fk-list-editor__handle\" cdkDragHandle>\n <fk-icon name=\"dots-outline\" size=\"sm\" color=\"muted\" />\n </span>\n }\n\n @if (showOrder()) {\n <span class=\"fk-list-editor__order\">{{ $index + 1 }}</span>\n }\n\n <input\n class=\"fk-list-editor__input\"\n type=\"text\"\n [value]=\"item\"\n [disabled]=\"disabled() || isLocked(item)\"\n (input)=\"updateItem($index, $any($event.target).value)\"\n />\n\n <button\n class=\"fk-list-editor__remove\"\n type=\"button\"\n [disabled]=\"disabled() || isLocked(item)\"\n [title]=\"isLocked(item) ? 'This item cannot be removed' : 'Remove item'\"\n (click)=\"removeItem($index)\"\n >\n <fk-icon name=\"circle-xmark-outline\" size=\"sm\" />\n </button>\n\n <div *cdkDragPlaceholder class=\"fk-list-editor__placeholder\"></div>\n </div>\n }\n</div>\n\n@if (items().length === 0 && emptyMessage()) {\n <p class=\"fk-list-editor__empty\">{{ emptyMessage() }}</p>\n}\n\n<div class=\"fk-list-editor__add\">\n <div class=\"fk-list-editor__add-input\">\n <input\n class=\"fk-list-editor__input\"\n type=\"text\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [ngModel]=\"newItemValue()\"\n (ngModelChange)=\"newItemValue.set($event)\"\n (keydown)=\"onKeydown($event)\"\n />\n\n @if (newItemValue() && !disabled()) {\n <button\n class=\"fk-list-editor__add-clear\"\n type=\"button\"\n aria-label=\"Clear input\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"newItemValue.set('')\"\n >\n <fk-icon name=\"circle-xmark-outline\" size=\"sm\" />\n </button>\n }\n </div>\n\n <fk-button\n variant=\"outline\"\n size=\"sm\"\n [disabled]=\"!canAdd() || disabled()\"\n (click)=\"addItem()\"\n >\n <fk-icon name=\"add\" fkButtonIconStart />\n {{ addLabel() }}\n </fk-button>\n</div>\n\n@if (hasDuplicates()) {\n <p class=\"fk-list-editor__error\">Item names must be unique.</p>\n}\n", styles: [":host{display:block}.fk-list-editor__list{display:flex;flex-direction:column;gap:var(--fk-list-editor-row-gap, var(--fk-rhythm-2, .5rem))}.fk-list-editor__item{display:flex;align-items:center;gap:var(--fk-list-editor-row-gap, var(--fk-rhythm-2, .5rem));padding:var(--fk-list-editor-item-padding, var(--fk-rhythm-2, .5rem) var(--fk-rhythm-3, .75rem));background:var(--fk-list-editor-item-bg, var(--fk-color-surface, #ffffff));border:1px solid var(--fk-list-editor-item-border-color, var(--fk-color-border, #d9e2ee));border-radius:var(--fk-list-editor-item-radius, var(--fk-radius-md, .5rem));transition:box-shadow .15s ease}.fk-list-editor__item:hover{box-shadow:var(--fk-list-editor-item-hover-shadow, 0 1px 3px rgba(0, 0, 0, .06))}.fk-list-editor__handle{display:flex;cursor:grab;padding:var(--fk-list-editor-handle-padding, var(--fk-rhythm-1, .25rem))}.fk-list-editor__handle:active{cursor:grabbing}.fk-list-editor__order{display:flex;align-items:center;justify-content:center;width:var(--fk-list-editor-order-size, 1.5rem);height:var(--fk-list-editor-order-size, 1.5rem);border-radius:var(--fk-list-editor-order-radius, 50%);background:var(--fk-list-editor-order-bg, var(--fk-color-primary-light, #e0f2fe));color:var(--fk-list-editor-order-color, var(--fk-color-primary, #0a84ff));font-size:var(--fk-list-editor-order-font-size, .75rem);font-weight:var(--fk-list-editor-order-font-weight, var(--fk-font-weight-semibold, 600));flex-shrink:0}.fk-list-editor__input{flex:1;min-width:0;padding:var(--fk-list-editor-input-padding, var(--fk-rhythm-2, .5rem) var(--fk-rhythm-3, .75rem));border:1px solid var(--fk-list-editor-input-border-color, var(--fk-color-border, #d9e2ee));border-radius:var(--fk-list-editor-input-radius, var(--fk-radius-md, .5rem));font-size:var(--fk-list-editor-input-font-size, .875rem);color:var(--fk-list-editor-input-color, var(--fk-color-text, #1f2d3d));background:var(--fk-list-editor-input-bg, var(--fk-color-surface, #ffffff));outline:none;transition:border-color .15s ease}.fk-list-editor__input:focus{border-color:var(--fk-list-editor-input-focus-border-color, var(--fk-color-primary, #0a84ff))}.fk-list-editor__input:disabled{opacity:var(--fk-list-editor-disabled-opacity, var(--fk-input-disabled-opacity, .5));cursor:not-allowed}.fk-list-editor__remove{display:flex;align-items:center;padding:var(--fk-list-editor-remove-padding, var(--fk-rhythm-1, .25rem));border:none;background:transparent;cursor:pointer;color:var(--fk-list-editor-remove-color, var(--fk-color-muted, #8a98a8));transition:color .15s ease}.fk-list-editor__remove:hover:not(:disabled){color:var(--fk-list-editor-remove-hover-color, var(--fk-color-danger, #e02424))}.fk-list-editor__remove:focus-visible{outline:none;box-shadow:var(--fk-list-editor-focus-ring, var(--fk-focus-ring, 0 0 0 3px rgba(10, 132, 255, .18)))}.fk-list-editor__remove:disabled{opacity:.35;cursor:not-allowed}.fk-list-editor__placeholder{height:var(--fk-list-editor-placeholder-height, 3rem);border:2px dashed var(--fk-list-editor-placeholder-border-color, var(--fk-color-border, #d9e2ee));border-radius:var(--fk-list-editor-item-radius, var(--fk-radius-md, .5rem));background:var(--fk-list-editor-placeholder-bg, var(--fk-color-surface-muted, #f7f9fb))}.fk-list-editor__empty{padding:var(--fk-list-editor-empty-padding, var(--fk-rhythm-4, 1rem));text-align:var(--fk-list-editor-empty-text-align, left);color:var(--fk-list-editor-empty-color, var(--fk-color-muted, #8a98a8));font-size:var(--fk-list-editor-empty-font-size, var(--fk-typography-small-font-size, .875rem))}.fk-list-editor__add{display:flex;align-items:center;gap:var(--fk-list-editor-row-gap, var(--fk-rhythm-2, .5rem));margin-top:var(--fk-list-editor-add-gap, var(--fk-rhythm-3, .75rem))}.fk-list-editor__add-input{position:relative;display:flex;flex:1;min-width:0}.fk-list-editor__add-input .fk-list-editor__input{padding-right:var(--fk-list-editor-add-clear-reserve, var(--fk-rhythm-7, 1.75rem))}.fk-list-editor__add-clear{position:absolute;top:50%;right:var(--fk-list-editor-add-clear-offset, var(--fk-rhythm-2, .5rem));transform:translateY(-50%);display:flex;align-items:center;justify-content:center;padding:var(--fk-list-editor-add-clear-padding, .125rem);border:0;background:transparent;border-radius:var(--fk-list-editor-add-clear-radius, var(--fk-radius-sm, .25rem));color:var(--fk-list-editor-remove-color, var(--fk-color-muted, #8a98a8));cursor:pointer;transition:color .15s ease}.fk-list-editor__add-clear:hover{color:var(--fk-list-editor-remove-hover-color, var(--fk-color-danger, #e02424))}.fk-list-editor__add-clear:focus-visible{outline:none;box-shadow:var(--fk-list-editor-focus-ring, var(--fk-focus-ring, 0 0 0 3px rgba(10, 132, 255, .18)))}.fk-list-editor__error{margin-top:var(--fk-list-editor-error-gap, var(--fk-rhythm-2, .5rem));color:var(--fk-list-editor-error-color, var(--fk-color-danger, #e02424));font-size:var(--fk-list-editor-error-font-size, var(--fk-typography-small-font-size, .875rem))}:host.fk-list-editor--sm .fk-list-editor__input{font-size:var(--fk-list-editor-input-font-size-sm, .8125rem);padding:var(--fk-list-editor-input-padding-sm, var(--fk-rhythm-1, .25rem) var(--fk-rhythm-2, .5rem))}:host.fk-list-editor--sm .fk-list-editor__item{padding:var(--fk-list-editor-item-padding-sm, var(--fk-rhythm-1, .25rem) var(--fk-rhythm-2, .5rem))}:host.fk-list-editor--disabled{opacity:var(--fk-list-editor-disabled-opacity, var(--fk-input-disabled-opacity, .5));pointer-events:none}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.fk-list-editor__list.cdk-drop-list-dragging .fk-list-editor__item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview.fk-list-editor__item{box-shadow:var(--fk-list-editor-drag-shadow, 0 4px 12px rgba(0, 0, 0, .12));border-color:var(--fk-list-editor-drag-border-color, var(--fk-color-primary, #0a84ff))}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }, { kind: "component", type: ButtonComponent, selector: "fk-button", inputs: ["variant", "size", "loading", "disabled", "type", "fullWidth", "id", "className", "ariaLabel", "ariaDescribedBy"] }, { kind: "component", type: IconComponent, selector: "fk-icon", inputs: ["name", "size", "color", "className", "id", "ariaLabel", "ariaHidden"] }, { kind: "directive", type: FkButtonIconStartDirective, selector: "[fkButtonIconStart]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
112
|
+
}
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ListEditorComponent, decorators: [{
|
|
114
|
+
type: Component,
|
|
115
|
+
args: [{ selector: 'fk-list-editor', standalone: true, imports: [
|
|
116
|
+
FormsModule,
|
|
117
|
+
CdkDropList,
|
|
118
|
+
CdkDrag,
|
|
119
|
+
CdkDragHandle,
|
|
120
|
+
CdkDragPlaceholder,
|
|
121
|
+
ButtonComponent,
|
|
122
|
+
IconComponent,
|
|
123
|
+
FkButtonIconStartDirective,
|
|
124
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n cdkDropList\n [cdkDropListDisabled]=\"disabled() || !orderable()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n class=\"fk-list-editor__list\"\n [attr.aria-label]=\"ariaLabel()\"\n>\n @for (item of items(); track $index) {\n <div\n cdkDrag\n [cdkDragDisabled]=\"disabled() || !orderable()\"\n class=\"fk-list-editor__item\"\n >\n @if (orderable()) {\n <span class=\"fk-list-editor__handle\" cdkDragHandle>\n <fk-icon name=\"dots-outline\" size=\"sm\" color=\"muted\" />\n </span>\n }\n\n @if (showOrder()) {\n <span class=\"fk-list-editor__order\">{{ $index + 1 }}</span>\n }\n\n <input\n class=\"fk-list-editor__input\"\n type=\"text\"\n [value]=\"item\"\n [disabled]=\"disabled() || isLocked(item)\"\n (input)=\"updateItem($index, $any($event.target).value)\"\n />\n\n <button\n class=\"fk-list-editor__remove\"\n type=\"button\"\n [disabled]=\"disabled() || isLocked(item)\"\n [title]=\"isLocked(item) ? 'This item cannot be removed' : 'Remove item'\"\n (click)=\"removeItem($index)\"\n >\n <fk-icon name=\"circle-xmark-outline\" size=\"sm\" />\n </button>\n\n <div *cdkDragPlaceholder class=\"fk-list-editor__placeholder\"></div>\n </div>\n }\n</div>\n\n@if (items().length === 0 && emptyMessage()) {\n <p class=\"fk-list-editor__empty\">{{ emptyMessage() }}</p>\n}\n\n<div class=\"fk-list-editor__add\">\n <div class=\"fk-list-editor__add-input\">\n <input\n class=\"fk-list-editor__input\"\n type=\"text\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [ngModel]=\"newItemValue()\"\n (ngModelChange)=\"newItemValue.set($event)\"\n (keydown)=\"onKeydown($event)\"\n />\n\n @if (newItemValue() && !disabled()) {\n <button\n class=\"fk-list-editor__add-clear\"\n type=\"button\"\n aria-label=\"Clear input\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"newItemValue.set('')\"\n >\n <fk-icon name=\"circle-xmark-outline\" size=\"sm\" />\n </button>\n }\n </div>\n\n <fk-button\n variant=\"outline\"\n size=\"sm\"\n [disabled]=\"!canAdd() || disabled()\"\n (click)=\"addItem()\"\n >\n <fk-icon name=\"add\" fkButtonIconStart />\n {{ addLabel() }}\n </fk-button>\n</div>\n\n@if (hasDuplicates()) {\n <p class=\"fk-list-editor__error\">Item names must be unique.</p>\n}\n", styles: [":host{display:block}.fk-list-editor__list{display:flex;flex-direction:column;gap:var(--fk-list-editor-row-gap, var(--fk-rhythm-2, .5rem))}.fk-list-editor__item{display:flex;align-items:center;gap:var(--fk-list-editor-row-gap, var(--fk-rhythm-2, .5rem));padding:var(--fk-list-editor-item-padding, var(--fk-rhythm-2, .5rem) var(--fk-rhythm-3, .75rem));background:var(--fk-list-editor-item-bg, var(--fk-color-surface, #ffffff));border:1px solid var(--fk-list-editor-item-border-color, var(--fk-color-border, #d9e2ee));border-radius:var(--fk-list-editor-item-radius, var(--fk-radius-md, .5rem));transition:box-shadow .15s ease}.fk-list-editor__item:hover{box-shadow:var(--fk-list-editor-item-hover-shadow, 0 1px 3px rgba(0, 0, 0, .06))}.fk-list-editor__handle{display:flex;cursor:grab;padding:var(--fk-list-editor-handle-padding, var(--fk-rhythm-1, .25rem))}.fk-list-editor__handle:active{cursor:grabbing}.fk-list-editor__order{display:flex;align-items:center;justify-content:center;width:var(--fk-list-editor-order-size, 1.5rem);height:var(--fk-list-editor-order-size, 1.5rem);border-radius:var(--fk-list-editor-order-radius, 50%);background:var(--fk-list-editor-order-bg, var(--fk-color-primary-light, #e0f2fe));color:var(--fk-list-editor-order-color, var(--fk-color-primary, #0a84ff));font-size:var(--fk-list-editor-order-font-size, .75rem);font-weight:var(--fk-list-editor-order-font-weight, var(--fk-font-weight-semibold, 600));flex-shrink:0}.fk-list-editor__input{flex:1;min-width:0;padding:var(--fk-list-editor-input-padding, var(--fk-rhythm-2, .5rem) var(--fk-rhythm-3, .75rem));border:1px solid var(--fk-list-editor-input-border-color, var(--fk-color-border, #d9e2ee));border-radius:var(--fk-list-editor-input-radius, var(--fk-radius-md, .5rem));font-size:var(--fk-list-editor-input-font-size, .875rem);color:var(--fk-list-editor-input-color, var(--fk-color-text, #1f2d3d));background:var(--fk-list-editor-input-bg, var(--fk-color-surface, #ffffff));outline:none;transition:border-color .15s ease}.fk-list-editor__input:focus{border-color:var(--fk-list-editor-input-focus-border-color, var(--fk-color-primary, #0a84ff))}.fk-list-editor__input:disabled{opacity:var(--fk-list-editor-disabled-opacity, var(--fk-input-disabled-opacity, .5));cursor:not-allowed}.fk-list-editor__remove{display:flex;align-items:center;padding:var(--fk-list-editor-remove-padding, var(--fk-rhythm-1, .25rem));border:none;background:transparent;cursor:pointer;color:var(--fk-list-editor-remove-color, var(--fk-color-muted, #8a98a8));transition:color .15s ease}.fk-list-editor__remove:hover:not(:disabled){color:var(--fk-list-editor-remove-hover-color, var(--fk-color-danger, #e02424))}.fk-list-editor__remove:focus-visible{outline:none;box-shadow:var(--fk-list-editor-focus-ring, var(--fk-focus-ring, 0 0 0 3px rgba(10, 132, 255, .18)))}.fk-list-editor__remove:disabled{opacity:.35;cursor:not-allowed}.fk-list-editor__placeholder{height:var(--fk-list-editor-placeholder-height, 3rem);border:2px dashed var(--fk-list-editor-placeholder-border-color, var(--fk-color-border, #d9e2ee));border-radius:var(--fk-list-editor-item-radius, var(--fk-radius-md, .5rem));background:var(--fk-list-editor-placeholder-bg, var(--fk-color-surface-muted, #f7f9fb))}.fk-list-editor__empty{padding:var(--fk-list-editor-empty-padding, var(--fk-rhythm-4, 1rem));text-align:var(--fk-list-editor-empty-text-align, left);color:var(--fk-list-editor-empty-color, var(--fk-color-muted, #8a98a8));font-size:var(--fk-list-editor-empty-font-size, var(--fk-typography-small-font-size, .875rem))}.fk-list-editor__add{display:flex;align-items:center;gap:var(--fk-list-editor-row-gap, var(--fk-rhythm-2, .5rem));margin-top:var(--fk-list-editor-add-gap, var(--fk-rhythm-3, .75rem))}.fk-list-editor__add-input{position:relative;display:flex;flex:1;min-width:0}.fk-list-editor__add-input .fk-list-editor__input{padding-right:var(--fk-list-editor-add-clear-reserve, var(--fk-rhythm-7, 1.75rem))}.fk-list-editor__add-clear{position:absolute;top:50%;right:var(--fk-list-editor-add-clear-offset, var(--fk-rhythm-2, .5rem));transform:translateY(-50%);display:flex;align-items:center;justify-content:center;padding:var(--fk-list-editor-add-clear-padding, .125rem);border:0;background:transparent;border-radius:var(--fk-list-editor-add-clear-radius, var(--fk-radius-sm, .25rem));color:var(--fk-list-editor-remove-color, var(--fk-color-muted, #8a98a8));cursor:pointer;transition:color .15s ease}.fk-list-editor__add-clear:hover{color:var(--fk-list-editor-remove-hover-color, var(--fk-color-danger, #e02424))}.fk-list-editor__add-clear:focus-visible{outline:none;box-shadow:var(--fk-list-editor-focus-ring, var(--fk-focus-ring, 0 0 0 3px rgba(10, 132, 255, .18)))}.fk-list-editor__error{margin-top:var(--fk-list-editor-error-gap, var(--fk-rhythm-2, .5rem));color:var(--fk-list-editor-error-color, var(--fk-color-danger, #e02424));font-size:var(--fk-list-editor-error-font-size, var(--fk-typography-small-font-size, .875rem))}:host.fk-list-editor--sm .fk-list-editor__input{font-size:var(--fk-list-editor-input-font-size-sm, .8125rem);padding:var(--fk-list-editor-input-padding-sm, var(--fk-rhythm-1, .25rem) var(--fk-rhythm-2, .5rem))}:host.fk-list-editor--sm .fk-list-editor__item{padding:var(--fk-list-editor-item-padding-sm, var(--fk-rhythm-1, .25rem) var(--fk-rhythm-2, .5rem))}:host.fk-list-editor--disabled{opacity:var(--fk-list-editor-disabled-opacity, var(--fk-input-disabled-opacity, .5));pointer-events:none}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.fk-list-editor__list.cdk-drop-list-dragging .fk-list-editor__item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview.fk-list-editor__item{box-shadow:var(--fk-list-editor-drag-shadow, 0 4px 12px rgba(0, 0, 0, .12));border-color:var(--fk-list-editor-drag-border-color, var(--fk-color-primary, #0a84ff))}\n"] }]
|
|
125
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }, { type: i0.Output, args: ["itemsChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], addLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "addLabel", required: false }] }], orderable: [{ type: i0.Input, args: [{ isSignal: true, alias: "orderable", required: false }] }], showOrder: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOrder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], lockedItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "lockedItems", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], itemsChange: [{ type: i0.Output, args: ["itemsChange"] }], itemAdded: [{ type: i0.Output, args: ["itemAdded"] }], itemRemoved: [{ type: i0.Output, args: ["itemRemoved"] }], hostClass: [{
|
|
126
|
+
type: HostBinding,
|
|
127
|
+
args: ['class']
|
|
128
|
+
}] } });
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Generated bundle index. Do not edit.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
export { ListEditorComponent };
|
|
135
|
+
//# sourceMappingURL=frame-kit-ui-ng-ui-list-editor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-kit-ui-ng-ui-list-editor.mjs","sources":["../../../../packages/ui-ng/ui/list-editor/list-editor.component.ts","../../../../packages/ui-ng/ui/list-editor/list-editor.component.html","../../../../packages/ui-ng/ui/list-editor/frame-kit-ui-ng-ui-list-editor.ts"],"sourcesContent":["import {\n CdkDrag,\n CdkDragDrop,\n CdkDragHandle,\n CdkDragPlaceholder,\n CdkDropList,\n moveItemInArray,\n} from '@angular/cdk/drag-drop';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n HostBinding,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { IconComponent } from '@frame-kit/ui-ng/core/icon';\nimport { ButtonComponent } from '@frame-kit/ui-ng/ui/button';\nimport { FkButtonIconStartDirective } from '@frame-kit/ui-ng/ui/button';\nimport type { ListEditorSize } from './list-editor.types';\n\n@Component({\n selector: 'fk-list-editor',\n standalone: true,\n imports: [\n FormsModule,\n CdkDropList,\n CdkDrag,\n CdkDragHandle,\n CdkDragPlaceholder,\n ButtonComponent,\n IconComponent,\n FkButtonIconStartDirective,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './list-editor.component.html',\n styleUrl: './list-editor.component.scss',\n})\nexport class ListEditorComponent {\n // ===== INPUTS =====\n /** The current list of string items; two-way bindable via `[(items)]`. */\n readonly items = model<string[]>([]);\n /** Placeholder text for the new-item input field. */\n readonly placeholder = input('Add an item...');\n /** Message displayed when the list is empty. */\n readonly emptyMessage = input('No items added yet.');\n /** Label for the add button. */\n readonly addLabel = input('Add');\n /** When true, items can be reordered via drag-and-drop. */\n readonly orderable = input(true);\n /** When true, shows a numeric position indicator next to each item. */\n readonly showOrder = input(true);\n /** Size variant controlling the spacing and font of the component. */\n readonly size = input<ListEditorSize>('md');\n /** Items that cannot be removed by the user (matched case-insensitively). */\n readonly lockedItems = input<string[]>([]);\n\n // ===== BASE PROPS =====\n readonly className = input<string>('');\n readonly disabled = input(false);\n readonly ariaLabel = input<string | null>(null);\n\n // ===== OUTPUTS =====\n /** Fires whenever the items array changes, emitting the full updated array. */\n readonly itemsChange = output<string[]>();\n /** Fires when a new item is successfully added, emitting the added value. */\n readonly itemAdded = output<string>();\n /** Fires when an item is removed, emitting the removed value and its former index. */\n readonly itemRemoved = output<{ item: string; index: number }>();\n\n // ===== LOCAL STATE =====\n readonly newItemValue = signal('');\n\n // ===== COMPUTED =====\n readonly canAdd = computed(() => {\n const value = this.newItemValue().trim();\n\n if (!value) {\n return false;\n }\n\n const existing = this.items().map((n) => n.trim().toLowerCase());\n\n return !existing.includes(value.toLowerCase());\n });\n\n readonly hasDuplicates = computed(() => {\n const names = this.items().map((n) => n.trim().toLowerCase());\n\n return new Set(names).size !== names.length;\n });\n\n readonly hasEmptyItems = computed(() => {\n return this.items().some((n) => n.trim() === '');\n });\n\n readonly classes = computed(() =>\n [\n 'fk-list-editor',\n `fk-list-editor--${this.size()}`,\n this.disabled() ? 'fk-list-editor--disabled' : '',\n this.className(),\n ]\n .filter(Boolean)\n .join(' '),\n );\n\n @HostBinding('class')\n get hostClass() {\n return this.classes();\n }\n\n // ===== ACTIONS =====\n\n /** Adds the current input value as a new item if it is non-empty and not a duplicate. */\n addItem(): void {\n const value = this.newItemValue().trim();\n\n if (!value || !this.canAdd() || this.disabled()) {\n return;\n }\n\n this.items.update((prev) => [...prev, value]);\n this.newItemValue.set('');\n this.itemsChange.emit(this.items());\n this.itemAdded.emit(value);\n }\n\n /** Removes the item at the given index unless it is locked or the component is disabled. */\n removeItem(index: number): void {\n const item = this.items()[index];\n\n if (this.disabled() || this.isLocked(item)) {\n return;\n }\n\n this.items.update((prev) => prev.filter((_, i) => i !== index));\n this.itemsChange.emit(this.items());\n this.itemRemoved.emit({ item, index });\n }\n\n /** Updates the item at the given index with a new value and emits the changed array. */\n updateItem(index: number, value: string): void {\n this.items.update((prev) =>\n prev.map((item, i) => (i === index ? value : item)),\n );\n this.itemsChange.emit(this.items());\n }\n\n onDrop(event: CdkDragDrop<string[]>): void {\n const updated = [...this.items()];\n\n moveItemInArray(updated, event.previousIndex, event.currentIndex);\n this.items.set(updated);\n this.itemsChange.emit(this.items());\n }\n\n /** Returns true if the given item matches any entry in `lockedItems`. */\n isLocked(item: string): boolean {\n return this.lockedItems().includes(item.trim().toLowerCase());\n }\n\n onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.addItem();\n }\n }\n}\n","<div\n cdkDropList\n [cdkDropListDisabled]=\"disabled() || !orderable()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n class=\"fk-list-editor__list\"\n [attr.aria-label]=\"ariaLabel()\"\n>\n @for (item of items(); track $index) {\n <div\n cdkDrag\n [cdkDragDisabled]=\"disabled() || !orderable()\"\n class=\"fk-list-editor__item\"\n >\n @if (orderable()) {\n <span class=\"fk-list-editor__handle\" cdkDragHandle>\n <fk-icon name=\"dots-outline\" size=\"sm\" color=\"muted\" />\n </span>\n }\n\n @if (showOrder()) {\n <span class=\"fk-list-editor__order\">{{ $index + 1 }}</span>\n }\n\n <input\n class=\"fk-list-editor__input\"\n type=\"text\"\n [value]=\"item\"\n [disabled]=\"disabled() || isLocked(item)\"\n (input)=\"updateItem($index, $any($event.target).value)\"\n />\n\n <button\n class=\"fk-list-editor__remove\"\n type=\"button\"\n [disabled]=\"disabled() || isLocked(item)\"\n [title]=\"isLocked(item) ? 'This item cannot be removed' : 'Remove item'\"\n (click)=\"removeItem($index)\"\n >\n <fk-icon name=\"circle-xmark-outline\" size=\"sm\" />\n </button>\n\n <div *cdkDragPlaceholder class=\"fk-list-editor__placeholder\"></div>\n </div>\n }\n</div>\n\n@if (items().length === 0 && emptyMessage()) {\n <p class=\"fk-list-editor__empty\">{{ emptyMessage() }}</p>\n}\n\n<div class=\"fk-list-editor__add\">\n <div class=\"fk-list-editor__add-input\">\n <input\n class=\"fk-list-editor__input\"\n type=\"text\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [ngModel]=\"newItemValue()\"\n (ngModelChange)=\"newItemValue.set($event)\"\n (keydown)=\"onKeydown($event)\"\n />\n\n @if (newItemValue() && !disabled()) {\n <button\n class=\"fk-list-editor__add-clear\"\n type=\"button\"\n aria-label=\"Clear input\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"newItemValue.set('')\"\n >\n <fk-icon name=\"circle-xmark-outline\" size=\"sm\" />\n </button>\n }\n </div>\n\n <fk-button\n variant=\"outline\"\n size=\"sm\"\n [disabled]=\"!canAdd() || disabled()\"\n (click)=\"addItem()\"\n >\n <fk-icon name=\"add\" fkButtonIconStart />\n {{ addLabel() }}\n </fk-button>\n</div>\n\n@if (hasDuplicates()) {\n <p class=\"fk-list-editor__error\">Item names must be unique.</p>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MA0Ca,mBAAmB,CAAA;;;AAGrB,IAAA,KAAK,GAAG,KAAK,CAAW,EAAE,4EAAC;;AAE3B,IAAA,WAAW,GAAG,KAAK,CAAC,gBAAgB,kFAAC;;AAErC,IAAA,YAAY,GAAG,KAAK,CAAC,qBAAqB,mFAAC;;AAE3C,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,+EA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A,EACgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,y9EAAA,EAAA,MAAA,EAAA,CAAA,4uLAAA,CAAA,EAAA;;sBAyE9C,WAAW;uBAAC,OAAO;;;AE/GtB;;AAEG;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, input, computed, HostBinding, ContentChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class FkLoaderIconDirective {
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FkLoaderIconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: FkLoaderIconDirective, isStandalone: true, selector: "[fkLoaderIcon]", ngImport: i0 });
|
|
7
|
+
}
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FkLoaderIconDirective, decorators: [{
|
|
9
|
+
type: Directive,
|
|
10
|
+
args: [{
|
|
11
|
+
selector: '[fkLoaderIcon]',
|
|
12
|
+
standalone: true,
|
|
13
|
+
}]
|
|
14
|
+
}] });
|
|
15
|
+
class LoaderComponent {
|
|
16
|
+
customIcon;
|
|
17
|
+
hasCustomIcon = false;
|
|
18
|
+
// ===== INPUTS =====
|
|
19
|
+
/** Size of the spinning loader indicator. */
|
|
20
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
21
|
+
/** Color of the spinner; "inherit" adopts the nearest ancestor's color. */
|
|
22
|
+
color = input('inherit', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
23
|
+
// ===== BASE PROPS =====
|
|
24
|
+
className = input('', ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
|
|
25
|
+
id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
26
|
+
ariaLabel = input('Loading', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
27
|
+
// ===== COMPUTED =====
|
|
28
|
+
classes = computed(() => {
|
|
29
|
+
return [
|
|
30
|
+
'fk-loader',
|
|
31
|
+
`fk-loader--${this.size()}`,
|
|
32
|
+
this.color() !== 'inherit' ? `fk-loader--${this.color()}` : '',
|
|
33
|
+
this.className(),
|
|
34
|
+
]
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join(' ');
|
|
37
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
38
|
+
get hostClass() {
|
|
39
|
+
return this.classes();
|
|
40
|
+
}
|
|
41
|
+
get hostRole() {
|
|
42
|
+
return 'status';
|
|
43
|
+
}
|
|
44
|
+
get hostAriaLabel() {
|
|
45
|
+
return this.ariaLabel();
|
|
46
|
+
}
|
|
47
|
+
get hostId() {
|
|
48
|
+
return this.id();
|
|
49
|
+
}
|
|
50
|
+
ngAfterContentInit() {
|
|
51
|
+
this.hasCustomIcon = !!this.customIcon;
|
|
52
|
+
}
|
|
53
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: LoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
54
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: LoaderComponent, isStandalone: true, selector: "fk-loader", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.hostClass", "attr.role": "this.hostRole", "attr.aria-label": "this.hostAriaLabel", "attr.id": "this.hostId" } }, queries: [{ propertyName: "customIcon", first: true, predicate: FkLoaderIconDirective, descendants: true }], ngImport: i0, template: "<span class=\"fk-loader__spinner\">\n <ng-content select=\"[fkLoaderIcon]\" />\n\n @if (!hasCustomIcon) {\n <svg\n class=\"fk-loader__default-svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n >\n <path\n d=\"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83\"\n opacity=\"0.3\"\n />\n <path d=\"M12 2v4\" stroke-width=\"3\" />\n </svg>\n }\n</span>\n", styles: [":host{display:inline-flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.fk-loader__spinner{display:inline-flex;align-items:center;justify-content:center;animation:fk-loader-spin var(--fk-loader-animation-duration, .8s) linear infinite}.fk-loader__spinner svg{width:1em;height:1em;display:block}.fk-loader__default-svg{width:1em;height:1em;display:block}@keyframes fk-loader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host.fk-loader--xs{font-size:var(--fk-loader-size-xs, var(--fk-font-size-xs, .75rem))}:host.fk-loader--sm{font-size:var(--fk-loader-size-sm, var(--fk-font-size-sm, 1rem))}:host.fk-loader--md{font-size:var(--fk-loader-size-md, var(--fk-font-size-md, 1.25rem))}:host.fk-loader--lg{font-size:var(--fk-loader-size-lg, var(--fk-font-size-lg, 1.5rem))}:host.fk-loader--xl{font-size:var(--fk-loader-size-xl, var(--fk-font-size-xl, 2rem))}:host.fk-loader--default{color:var(--fk-icon-color-default, var(--fk-color-text, #1f2d3d))}:host.fk-loader--muted{color:var(--fk-icon-color-muted, var(--fk-color-muted, #8a98a8))}:host.fk-loader--primary{color:var(--fk-icon-color-primary, var(--fk-color-primary, #0a84ff))}:host.fk-loader--danger{color:var(--fk-icon-color-danger, var(--fk-color-danger, #e02424))}:host.fk-loader--success{color:var(--fk-icon-color-success, var(--fk-color-success, #10b981))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
55
|
+
}
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
57
|
+
type: Component,
|
|
58
|
+
args: [{ selector: 'fk-loader', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"fk-loader__spinner\">\n <ng-content select=\"[fkLoaderIcon]\" />\n\n @if (!hasCustomIcon) {\n <svg\n class=\"fk-loader__default-svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n >\n <path\n d=\"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83\"\n opacity=\"0.3\"\n />\n <path d=\"M12 2v4\" stroke-width=\"3\" />\n </svg>\n }\n</span>\n", styles: [":host{display:inline-flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.fk-loader__spinner{display:inline-flex;align-items:center;justify-content:center;animation:fk-loader-spin var(--fk-loader-animation-duration, .8s) linear infinite}.fk-loader__spinner svg{width:1em;height:1em;display:block}.fk-loader__default-svg{width:1em;height:1em;display:block}@keyframes fk-loader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host.fk-loader--xs{font-size:var(--fk-loader-size-xs, var(--fk-font-size-xs, .75rem))}:host.fk-loader--sm{font-size:var(--fk-loader-size-sm, var(--fk-font-size-sm, 1rem))}:host.fk-loader--md{font-size:var(--fk-loader-size-md, var(--fk-font-size-md, 1.25rem))}:host.fk-loader--lg{font-size:var(--fk-loader-size-lg, var(--fk-font-size-lg, 1.5rem))}:host.fk-loader--xl{font-size:var(--fk-loader-size-xl, var(--fk-font-size-xl, 2rem))}:host.fk-loader--default{color:var(--fk-icon-color-default, var(--fk-color-text, #1f2d3d))}:host.fk-loader--muted{color:var(--fk-icon-color-muted, var(--fk-color-muted, #8a98a8))}:host.fk-loader--primary{color:var(--fk-icon-color-primary, var(--fk-color-primary, #0a84ff))}:host.fk-loader--danger{color:var(--fk-icon-color-danger, var(--fk-color-danger, #e02424))}:host.fk-loader--success{color:var(--fk-icon-color-success, var(--fk-color-success, #10b981))}\n"] }]
|
|
59
|
+
}], propDecorators: { customIcon: [{
|
|
60
|
+
type: ContentChild,
|
|
61
|
+
args: [FkLoaderIconDirective]
|
|
62
|
+
}], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], hostClass: [{
|
|
63
|
+
type: HostBinding,
|
|
64
|
+
args: ['class']
|
|
65
|
+
}], hostRole: [{
|
|
66
|
+
type: HostBinding,
|
|
67
|
+
args: ['attr.role']
|
|
68
|
+
}], hostAriaLabel: [{
|
|
69
|
+
type: HostBinding,
|
|
70
|
+
args: ['attr.aria-label']
|
|
71
|
+
}], hostId: [{
|
|
72
|
+
type: HostBinding,
|
|
73
|
+
args: ['attr.id']
|
|
74
|
+
}] } });
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Generated bundle index. Do not edit.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
export { FkLoaderIconDirective, LoaderComponent };
|
|
81
|
+
//# sourceMappingURL=frame-kit-ui-ng-ui-loader.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-kit-ui-ng-ui-loader.mjs","sources":["../../../../packages/ui-ng/ui/loader/loader.component.ts","../../../../packages/ui-ng/ui/loader/loader.component.html","../../../../packages/ui-ng/ui/loader/frame-kit-ui-ng-ui-loader.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n ContentChild,\n Directive,\n HostBinding,\n input,\n} from '@angular/core';\n\nimport type { LoaderColor, LoaderSize } from './loader.types';\n\n@Directive({\n selector: '[fkLoaderIcon]',\n standalone: true,\n})\nexport class FkLoaderIconDirective {}\n\n@Component({\n selector: 'fk-loader',\n standalone: true,\n imports: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './loader.component.html',\n styleUrl: './loader.component.scss',\n})\nexport class LoaderComponent implements AfterContentInit {\n @ContentChild(FkLoaderIconDirective)\n private customIcon?: FkLoaderIconDirective;\n\n hasCustomIcon = false;\n\n // ===== INPUTS =====\n /** Size of the spinning loader indicator. */\n readonly size = input<LoaderSize>('md');\n /** Color of the spinner; \"inherit\" adopts the nearest ancestor's color. */\n readonly color = input<LoaderColor>('inherit');\n\n // ===== BASE PROPS =====\n readonly className = input<string>('');\n readonly id = input<string | null>(null);\n readonly ariaLabel = input<string>('Loading');\n\n // ===== COMPUTED =====\n\n readonly classes = computed(() => {\n return [\n 'fk-loader',\n `fk-loader--${this.size()}`,\n this.color() !== 'inherit' ? `fk-loader--${this.color()}` : '',\n this.className(),\n ]\n .filter(Boolean)\n .join(' ');\n });\n\n @HostBinding('class')\n get hostClass() {\n return this.classes();\n }\n\n @HostBinding('attr.role')\n get hostRole(): string {\n return 'status';\n }\n\n @HostBinding('attr.aria-label')\n get hostAriaLabel(): string {\n return this.ariaLabel();\n }\n\n @HostBinding('attr.id')\n get hostId(): string | null {\n return this.id();\n }\n\n ngAfterContentInit(): void {\n this.hasCustomIcon = !!this.customIcon;\n }\n}\n","<span class=\"fk-loader__spinner\">\n <ng-content select=\"[fkLoaderIcon]\" />\n\n @if (!hasCustomIcon) {\n <svg\n class=\"fk-loader__default-svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n >\n <path\n d=\"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83\"\n opacity=\"0.3\"\n />\n <path d=\"M12 2v4\" stroke-width=\"3\" />\n </svg>\n }\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAiBa,qBAAqB,CAAA;uGAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;MAWY,eAAe,CAAA;AAElB,IAAA,UAAU;IAElB,aAAa,GAAG,KAAK;;;AAIZ,IAAA,IAAI,GAAG,KAAK,CAAa,IAAI,2EAAC;;AAE9B,IAAA,KAAK,GAAG,KAAK,CAAc,SAAS,4EAAC;;AAGrC,IAAA,SAAS,GAAG,KAAK,CAAS,EAAE,gFAAC;AAC7B,IAAA,EAAE,GAAG,KAAK,CAAgB,IAAI,yEAAC;AAC/B,IAAA,SAAS,GAAG,KAAK,CAAS,SAAS,gFAAC;;AAIpC,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAK;QAC/B,OAAO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0 +1,79 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, inject, ElementRef, computed, HostBinding, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { IconComponent } from '@frame-kit/ui-ng/core/icon';
|
|
4
|
+
|
|
5
|
+
class MenuItemComponent {
|
|
6
|
+
// ===== INPUTS =====
|
|
7
|
+
/** Optional icon name rendered to the leading side of the label. */
|
|
8
|
+
icon = input(null, ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
9
|
+
/** When true, applies destructive (danger) color styling to the item. */
|
|
10
|
+
danger = input(false, ...(ngDevMode ? [{ debugName: "danger" }] : /* istanbul ignore next */ []));
|
|
11
|
+
/** When true, prevents interaction and applies disabled styling. */
|
|
12
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
13
|
+
// ===== OUTPUTS =====
|
|
14
|
+
/** Fires when the user activates the item via click or keyboard. */
|
|
15
|
+
itemClick = output();
|
|
16
|
+
// ===== REFS =====
|
|
17
|
+
elRef = inject(ElementRef);
|
|
18
|
+
// ===== COMPUTED =====
|
|
19
|
+
classes = computed(() => {
|
|
20
|
+
return [
|
|
21
|
+
'fk-menu-item',
|
|
22
|
+
this.danger() ? 'fk-menu-item--danger' : '',
|
|
23
|
+
this.disabled() ? 'fk-menu-item--disabled' : '',
|
|
24
|
+
]
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join(' ');
|
|
27
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
28
|
+
get hostClass() {
|
|
29
|
+
return this.classes();
|
|
30
|
+
}
|
|
31
|
+
// ===== ACTIONS =====
|
|
32
|
+
onClick() {
|
|
33
|
+
if (this.disabled()) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.itemClick.emit();
|
|
37
|
+
this.elRef.nativeElement.dispatchEvent(new CustomEvent('fkmenuitemselect', { bubbles: true }));
|
|
38
|
+
}
|
|
39
|
+
onKeydown(event) {
|
|
40
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
this.onClick();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
46
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: MenuItemComponent, isStandalone: true, selector: "fk-menu-item", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, danger: { classPropertyName: "danger", publicName: "danger", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick" }, host: { attributes: { "role": "menuitem" }, listeners: { "click": "onClick()", "keydown": "onKeydown($event)" }, properties: { "attr.tabindex": "disabled() ? null : -1", "attr.aria-disabled": "disabled() ? \"true\" : null", "class": "this.hostClass" } }, ngImport: i0, template: "@if (icon()) {\n <fk-icon [name]=\"icon()!\" size=\"sm\" />\n}\n<span class=\"fk-menu-item__label\">\n <ng-content />\n</span>\n", styles: [":host{box-sizing:border-box;display:flex;align-items:center;gap:var(--fk-menu-item-gap, var(--fk-rhythm-2, .5rem));width:100%;padding:var(--fk-menu-item-padding, var(--fk-rhythm-2, .5rem) var(--fk-rhythm-3, .75rem));border-radius:var(--fk-menu-item-radius, var(--fk-radius-md, .375rem));background:transparent;font-family:var(--fk-menu-item-font-family, var(--fk-font-family-base, sans-serif));font-size:var(--fk-menu-item-font-size, .875rem);color:var(--fk-menu-item-color, var(--fk-color-text, #1f2d3d));text-align:left;cursor:pointer;transition:background-color var(--fk-menu-item-transition-duration, var(--fk-motion-duration-fast, .12s)) var(--fk-menu-item-transition-easing, var(--fk-motion-easing-default, ease));outline:none;border:none}:host:hover:not(.fk-menu-item--disabled){background-color:var(--fk-menu-item-bg-hover, var(--fk-color-surface-muted, #f7f9fb))}:host:focus-visible{box-shadow:var(--fk-menu-item-focus-ring, var(--fk-focus-ring, 0 0 0 3px rgba(10, 132, 255, .18)))}:host.fk-menu-item--danger{color:var(--fk-menu-item-danger-color, var(--fk-color-danger, #e02424))}:host.fk-menu-item--danger:hover:not(.fk-menu-item--disabled){background-color:var(--fk-menu-item-danger-bg-hover, var(--fk-color-danger-surface, #fef2f2))}.fk-menu-item--disabled{opacity:var(--fk-menu-item-opacity-disabled, .5);cursor:not-allowed}.fk-menu-item__label{flex:1;white-space:nowrap}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "fk-icon", inputs: ["name", "size", "color", "className", "id", "ariaLabel", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
47
|
+
}
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MenuItemComponent, decorators: [{
|
|
49
|
+
type: Component,
|
|
50
|
+
args: [{ selector: 'fk-menu-item', standalone: true, imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
51
|
+
role: 'menuitem',
|
|
52
|
+
'[attr.tabindex]': 'disabled() ? null : -1',
|
|
53
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
54
|
+
'(click)': 'onClick()',
|
|
55
|
+
'(keydown)': 'onKeydown($event)',
|
|
56
|
+
}, template: "@if (icon()) {\n <fk-icon [name]=\"icon()!\" size=\"sm\" />\n}\n<span class=\"fk-menu-item__label\">\n <ng-content />\n</span>\n", styles: [":host{box-sizing:border-box;display:flex;align-items:center;gap:var(--fk-menu-item-gap, var(--fk-rhythm-2, .5rem));width:100%;padding:var(--fk-menu-item-padding, var(--fk-rhythm-2, .5rem) var(--fk-rhythm-3, .75rem));border-radius:var(--fk-menu-item-radius, var(--fk-radius-md, .375rem));background:transparent;font-family:var(--fk-menu-item-font-family, var(--fk-font-family-base, sans-serif));font-size:var(--fk-menu-item-font-size, .875rem);color:var(--fk-menu-item-color, var(--fk-color-text, #1f2d3d));text-align:left;cursor:pointer;transition:background-color var(--fk-menu-item-transition-duration, var(--fk-motion-duration-fast, .12s)) var(--fk-menu-item-transition-easing, var(--fk-motion-easing-default, ease));outline:none;border:none}:host:hover:not(.fk-menu-item--disabled){background-color:var(--fk-menu-item-bg-hover, var(--fk-color-surface-muted, #f7f9fb))}:host:focus-visible{box-shadow:var(--fk-menu-item-focus-ring, var(--fk-focus-ring, 0 0 0 3px rgba(10, 132, 255, .18)))}:host.fk-menu-item--danger{color:var(--fk-menu-item-danger-color, var(--fk-color-danger, #e02424))}:host.fk-menu-item--danger:hover:not(.fk-menu-item--disabled){background-color:var(--fk-menu-item-danger-bg-hover, var(--fk-color-danger-surface, #fef2f2))}.fk-menu-item--disabled{opacity:var(--fk-menu-item-opacity-disabled, .5);cursor:not-allowed}.fk-menu-item__label{flex:1;white-space:nowrap}\n"] }]
|
|
57
|
+
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], danger: [{ type: i0.Input, args: [{ isSignal: true, alias: "danger", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], hostClass: [{
|
|
58
|
+
type: HostBinding,
|
|
59
|
+
args: ['class']
|
|
60
|
+
}] } });
|
|
61
|
+
|
|
62
|
+
class MenuSeparatorComponent {
|
|
63
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MenuSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
64
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: MenuSeparatorComponent, isStandalone: true, selector: "fk-menu-separator", host: { attributes: { "role": "separator" }, classAttribute: "fk-menu-separator" }, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;height:1px;margin:var(--fk-rhythm-1, .25rem) 0;background-color:var(--fk-menu-separator-color, var(--fk-color-border, #d9e2ee))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
65
|
+
}
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MenuSeparatorComponent, decorators: [{
|
|
67
|
+
type: Component,
|
|
68
|
+
args: [{ selector: 'fk-menu-separator', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: '', host: {
|
|
69
|
+
role: 'separator',
|
|
70
|
+
class: 'fk-menu-separator',
|
|
71
|
+
}, styles: [":host{display:block;height:1px;margin:var(--fk-rhythm-1, .25rem) 0;background-color:var(--fk-menu-separator-color, var(--fk-color-border, #d9e2ee))}\n"] }]
|
|
72
|
+
}] });
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Generated bundle index. Do not edit.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
export { MenuItemComponent, MenuSeparatorComponent };
|
|
79
|
+
//# sourceMappingURL=frame-kit-ui-ng-ui-menu-item.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-kit-ui-ng-ui-menu-item.mjs","sources":["../../../../packages/ui-ng/ui/menu-item/menu-item.component.ts","../../../../packages/ui-ng/ui/menu-item/menu-item.component.html","../../../../packages/ui-ng/ui/menu-item/menu-separator.component.ts","../../../../packages/ui-ng/ui/menu-item/frame-kit-ui-ng-ui-menu-item.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n HostBinding,\n inject,\n input,\n output,\n} from '@angular/core';\n\nimport { IconComponent } from '@frame-kit/ui-ng/core/icon';\n\n@Component({\n selector: 'fk-menu-item',\n standalone: true,\n imports: [IconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './menu-item.component.html',\n styleUrl: './menu-item.component.scss',\n host: {\n role: 'menuitem',\n '[attr.tabindex]': 'disabled() ? null : -1',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeydown($event)',\n },\n})\nexport class MenuItemComponent {\n // ===== INPUTS =====\n /** Optional icon name rendered to the leading side of the label. */\n readonly icon = input<string | null>(null);\n /** When true, applies destructive (danger) color styling to the item. */\n readonly danger = input<boolean>(false);\n /** When true, prevents interaction and applies disabled styling. */\n readonly disabled = input<boolean>(false);\n\n // ===== OUTPUTS =====\n /** Fires when the user activates the item via click or keyboard. */\n readonly itemClick = output<void>();\n\n // ===== REFS =====\n readonly elRef = inject(ElementRef);\n\n // ===== COMPUTED =====\n readonly classes = computed(() => {\n return [\n 'fk-menu-item',\n this.danger() ? 'fk-menu-item--danger' : '',\n this.disabled() ? 'fk-menu-item--disabled' : '',\n ]\n .filter(Boolean)\n .join(' ');\n });\n\n @HostBinding('class')\n get hostClass() {\n return this.classes();\n }\n\n // ===== ACTIONS =====\n\n onClick(): void {\n if (this.disabled()) {\n return;\n }\n\n this.itemClick.emit();\n this.elRef.nativeElement.dispatchEvent(\n new CustomEvent('fkmenuitemselect', { bubbles: true }),\n );\n }\n\n onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.onClick();\n }\n }\n}\n","@if (icon()) {\n <fk-icon [name]=\"icon()!\" size=\"sm\" />\n}\n<span class=\"fk-menu-item__label\">\n <ng-content />\n</span>\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'fk-menu-separator',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: '',\n styleUrl: './menu-separator.component.scss',\n host: {\n role: 'separator',\n class: 'fk-menu-separator',\n },\n})\nexport class MenuSeparatorComponent {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MA4Ba,i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ACP,CAAC,aAAa,CAAC,EAAA,eAAA,EACP,uBAAuB,CAAC,MAAM,EAAA,IAAA,EAGzC;AACJ,wBAAA,IAAI,EAAE,UAAU;AAChB,wBAAA,iBAAiB,EAAE,wBAAwB;AAC3C,wBAAA,sBAAsB,EAAE,4BAA4B;AACpD,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,WAAW,EAAE,mBAAmB;AACjC,qBAAA,EAAA,QAAA,EAAA,oIAAA,EAAA,MAAA,EAAA,CAAA,62CAAA,CAAA,EAAA;;sBA6BA,WAAW;uBAAC,OAAO;;;ME1CT,sBAAsB,CAAA;uGAAtB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAtB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,iKAPvB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,wJAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAOD,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAXlC,SAAS;+BACE,mBAAmB,EAAA,UAAA,EACjB,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,EAAE,EAAA,IAAA,EAEN;AACJ,wBAAA,IAAI,EAAE,WAAW;AACjB,wBAAA,KAAK,EAAE,mBAAmB;AAC3B,qBAAA,EAAA,MAAA,EAAA,CAAA,wJAAA,CAAA,EAAA;;;ACXH;;AAEG;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, HostBinding, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/router';
|
|
4
|
+
import { RouterModule } from '@angular/router';
|
|
5
|
+
|
|
6
|
+
class NavBrandComponent {
|
|
7
|
+
// ===== REQUIRED =====
|
|
8
|
+
/** Brand or application name rendered as the nav logo text. */
|
|
9
|
+
brandText = input.required(...(ngDevMode ? [{ debugName: "brandText" }] : /* istanbul ignore next */ []));
|
|
10
|
+
// ===== OPTIONAL =====
|
|
11
|
+
/** Router path the brand link navigates to when clicked. */
|
|
12
|
+
href = input('/', ...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
13
|
+
// ===== BASE PROPS =====
|
|
14
|
+
id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
15
|
+
className = input('', ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
|
|
16
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
17
|
+
// ===== COMPUTED =====
|
|
18
|
+
classes = computed(() => {
|
|
19
|
+
return ['fk-nav-brand', this.className()].filter(Boolean).join(' ');
|
|
20
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
21
|
+
get hostClass() {
|
|
22
|
+
return this.classes();
|
|
23
|
+
}
|
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NavBrandComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
25
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: NavBrandComponent, isStandalone: true, selector: "fk-nav-brand", inputs: { brandText: { classPropertyName: "brandText", publicName: "brandText", isSignal: true, isRequired: true, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.hostClass" } }, ngImport: i0, template: "<a\n class=\"fk-nav-brand__link\"\n [routerLink]=\"href()\"\n [attr.id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n>\n <span class=\"fk-nav-brand__logo\">\n <ng-content select=\"[navLogo]\"></ng-content>\n </span>\n <span class=\"fk-nav-brand__text\">{{ brandText() }}</span>\n</a>\n", styles: [":host{display:inline-block}.fk-nav-brand__link{display:inline-flex;align-items:center;gap:var(--fk-nav-brand-gap, .5rem);text-decoration:none;color:var(--fk-nav-brand-color, inherit)}.fk-nav-brand__link:hover{color:var(--fk-nav-brand-color-hover, inherit)}.fk-nav-brand__text{font-size:var(--fk-nav-brand-font-size, 1.125rem);font-weight:var(--fk-nav-brand-font-weight, 600);line-height:var(--fk-nav-brand-line-height, 1);white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NavBrandComponent, decorators: [{
|
|
28
|
+
type: Component,
|
|
29
|
+
args: [{ selector: 'fk-nav-brand', standalone: true, imports: [RouterModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<a\n class=\"fk-nav-brand__link\"\n [routerLink]=\"href()\"\n [attr.id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n>\n <span class=\"fk-nav-brand__logo\">\n <ng-content select=\"[navLogo]\"></ng-content>\n </span>\n <span class=\"fk-nav-brand__text\">{{ brandText() }}</span>\n</a>\n", styles: [":host{display:inline-block}.fk-nav-brand__link{display:inline-flex;align-items:center;gap:var(--fk-nav-brand-gap, .5rem);text-decoration:none;color:var(--fk-nav-brand-color, inherit)}.fk-nav-brand__link:hover{color:var(--fk-nav-brand-color-hover, inherit)}.fk-nav-brand__text{font-size:var(--fk-nav-brand-font-size, 1.125rem);font-weight:var(--fk-nav-brand-font-weight, 600);line-height:var(--fk-nav-brand-line-height, 1);white-space:nowrap}\n"] }]
|
|
30
|
+
}], propDecorators: { brandText: [{ type: i0.Input, args: [{ isSignal: true, alias: "brandText", required: true }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], hostClass: [{
|
|
31
|
+
type: HostBinding,
|
|
32
|
+
args: ['class']
|
|
33
|
+
}] } });
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Generated bundle index. Do not edit.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
export { NavBrandComponent };
|
|
40
|
+
//# sourceMappingURL=frame-kit-ui-ng-ui-nav-brand.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-kit-ui-ng-ui-nav-brand.mjs","sources":["../../../../packages/ui-ng/ui/nav-brand/nav-brand.component.ts","../../../../packages/ui-ng/ui/nav-brand/nav-brand.component.html","../../../../packages/ui-ng/ui/nav-brand/frame-kit-ui-ng-ui-nav-brand.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n HostBinding,\n input,\n} from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n selector: 'fk-nav-brand',\n standalone: true,\n imports: [RouterModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nav-brand.component.html',\n styleUrl: './nav-brand.component.scss',\n})\nexport class NavBrandComponent {\n // ===== REQUIRED =====\n /** Brand or application name rendered as the nav logo text. */\n readonly brandText = input.required<string>();\n\n // ===== OPTIONAL =====\n /** Router path the brand link navigates to when clicked. */\n readonly href = input<string>('/');\n\n // ===== BASE PROPS =====\n readonly id = input<string | null>(null);\n readonly className = input<string>('');\n readonly ariaLabel = input<string | null>(null);\n\n // ===== COMPUTED =====\n readonly classes = computed(() => {\n return ['fk-nav-brand', this.className()].filter(Boolean).join(' ');\n });\n\n @HostBinding('class')\n get hostClass() {\n return this.classes();\n }\n}\n","<a\n class=\"fk-nav-brand__link\"\n [routerLink]=\"href()\"\n [attr.id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n>\n <span class=\"fk-nav-brand__logo\">\n <ng-content select=\"[navLogo]\"></ng-content>\n </span>\n <span class=\"fk-nav-brand__text\">{{ brandText() }}</span>\n</a>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAiBa,iBAAiB,CAAA;;;AAGnB,IAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,+EAAU;;;AAIpC,IAAA,IAAI,GAAG,KAAK,CAAS,GAAG,2EAAC;;AAGzB,IAAA,EAAE,GAAG,KAAK,CAAgB,IAAI,yEAAC;AAC/B,IAAA,SAAS,GAAG,KAAK,CAAS,EAAE,gFAAC;AAC7B,IAAA,SAAS,GAAG,KAAK,CAAgB,IAAI,gFAAC;;AAGtC,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAK;AAC/B,QAAA,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACrE,IAAA,CAAC,8EAAC;AAEF,IAAA,IACI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,OAAO,EAAE;IACvB;uGAtBW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,C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