mn-angular-lib 1.0.141 → 1.0.143

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.
@@ -11568,6 +11568,106 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
11568
11568
  }]
11569
11569
  }] });
11570
11570
 
11571
+ /**
11572
+ * Styling for {@link MnBreadcrumbs}, expressed as tailwind-variants slots so the
11573
+ * template can pull one class string per role. Theme tokens only, so the trail
11574
+ * reads correctly in both light and dark. Links and the Back control are native
11575
+ * `<button>`/`<a>` elements reset to look like plain text with a hover accent.
11576
+ */
11577
+ const mnBreadcrumbsVariants = tv({
11578
+ slots: {
11579
+ root: 'flex items-center',
11580
+ list: 'flex flex-wrap items-center',
11581
+ link: 'inline-flex items-center bg-transparent border-0 p-0 rounded-md cursor-pointer ' +
11582
+ 'text-base-content/60 hover:text-primary transition-colors ' +
11583
+ 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
11584
+ current: 'inline-flex items-center font-semibold text-base-content',
11585
+ separator: 'inline-flex shrink-0 text-base-content/40',
11586
+ back: 'inline-flex items-center gap-1 bg-transparent border-0 p-0 rounded-md cursor-pointer ' +
11587
+ 'text-base-content/70 hover:text-primary transition-colors ' +
11588
+ 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
11589
+ },
11590
+ variants: {
11591
+ size: {
11592
+ // Text size lives on the root so every crumb, separator and the Back
11593
+ // control inherit it; only the inter-crumb gap changes per slot.
11594
+ sm: { root: 'text-xs', list: 'gap-1' },
11595
+ md: { root: 'text-sm', list: 'gap-1.5' },
11596
+ },
11597
+ },
11598
+ defaultVariants: {
11599
+ size: 'md',
11600
+ },
11601
+ });
11602
+
11603
+ /**
11604
+ * A flexible breadcrumb trail.
11605
+ *
11606
+ * Given crumbs it renders a linkable trail (`root › … › current`) where the last
11607
+ * crumb is the current page and is never a link. Given no crumbs it degrades to
11608
+ * a single "Back" control — the two are mutually exclusive. "Flexible" here is
11609
+ * input-driven, not viewport-driven: there is deliberately no responsive
11610
+ * collapse, no scroll machinery — it is a list of links plus a fallback.
11611
+ *
11612
+ * Navigation stays router- and history-agnostic where possible: a crumb (or the
11613
+ * Back control) with an `href` renders a plain `<a>` and navigates natively;
11614
+ * otherwise clicks emit outputs for the app to handle. Only the Back fallback
11615
+ * with no `href` reaches for `history.back()`.
11616
+ */
11617
+ class MnBreadcrumbs {
11618
+ /** Trail crumbs and Back-fallback configuration. */
11619
+ data = { items: [] };
11620
+ /** Emits the crumb that was clicked (non-current crumbs only). */
11621
+ crumbClick = new EventEmitter();
11622
+ /** Emits when the fallback "Back" control is activated. */
11623
+ back = new EventEmitter();
11624
+ /** Default translation key / literal for the Back control's label. */
11625
+ static DEFAULT_BACK_LABEL = 'back';
11626
+ /** Resolved tailwind-variants slot functions for the current size. */
11627
+ get styles() {
11628
+ return mnBreadcrumbsVariants({ size: this.data.size });
11629
+ }
11630
+ /** Whether a linkable trail should render (vs the Back fallback). */
11631
+ get hasTrail() {
11632
+ return (this.data.items?.length ?? 0) > 0;
11633
+ }
11634
+ /** Label for the Back control — the configured key/literal, or the default. */
11635
+ get backLabel() {
11636
+ return this.data.backLabel ?? MnBreadcrumbs.DEFAULT_BACK_LABEL;
11637
+ }
11638
+ /** The last crumb is the current page and is rendered as plain text. */
11639
+ isCurrent(index) {
11640
+ return index === this.data.items.length - 1;
11641
+ }
11642
+ /** Runs a crumb's own callback and notifies listeners of the click. */
11643
+ onCrumb(item) {
11644
+ item.onClick?.();
11645
+ this.crumbClick.emit(item);
11646
+ }
11647
+ /**
11648
+ * Fallback Back action. Always emits `back` for listeners; when no `backHref`
11649
+ * anchor is carrying the navigation, steps back through browser history.
11650
+ */
11651
+ onBack() {
11652
+ this.back.emit();
11653
+ if (!this.data.backHref) {
11654
+ window.history.back();
11655
+ }
11656
+ }
11657
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnBreadcrumbs, deps: [], target: i0.ɵɵFactoryTarget.Component });
11658
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnBreadcrumbs, isStandalone: true, selector: "mn-breadcrumbs", inputs: { data: "data" }, outputs: { crumbClick: "crumbClick", back: "back" }, ngImport: i0, template: "<nav aria-label=\"Breadcrumb\" [class]=\"styles.root()\">\n @if (hasTrail) {\n <ol [class]=\"styles.list()\">\n @for (item of data.items; track $index; let first = $first) {\n @if (!first) {\n <li aria-hidden=\"true\" [class]=\"styles.separator()\">\n <svg [size]=\"14\" lucideChevronRight></svg>\n </li>\n }\n <li class=\"inline-flex items-center\">\n @if (isCurrent($index)) {\n <span aria-current=\"page\" [class]=\"styles.current()\">{{ item.label | mnTranslate }}</span>\n } @else if (item.href) {\n <a [attr.href]=\"item.href\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</a>\n } @else {\n <button type=\"button\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</button>\n }\n </li>\n }\n </ol>\n } @else if (data.backHref) {\n <a [attr.href]=\"data.backHref\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" lucideChevronLeft></svg>\n {{ backLabel | mnTranslate }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" lucideChevronLeft></svg>\n {{ backLabel | mnTranslate }}\n </button>\n }\n</nav>\n", dependencies: [{ kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
11659
+ }
11660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnBreadcrumbs, decorators: [{
11661
+ type: Component,
11662
+ args: [{ selector: 'mn-breadcrumbs', standalone: true, imports: [MnTranslatePipe, LucideChevronLeft, LucideChevronRight], template: "<nav aria-label=\"Breadcrumb\" [class]=\"styles.root()\">\n @if (hasTrail) {\n <ol [class]=\"styles.list()\">\n @for (item of data.items; track $index; let first = $first) {\n @if (!first) {\n <li aria-hidden=\"true\" [class]=\"styles.separator()\">\n <svg [size]=\"14\" lucideChevronRight></svg>\n </li>\n }\n <li class=\"inline-flex items-center\">\n @if (isCurrent($index)) {\n <span aria-current=\"page\" [class]=\"styles.current()\">{{ item.label | mnTranslate }}</span>\n } @else if (item.href) {\n <a [attr.href]=\"item.href\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</a>\n } @else {\n <button type=\"button\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</button>\n }\n </li>\n }\n </ol>\n } @else if (data.backHref) {\n <a [attr.href]=\"data.backHref\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" lucideChevronLeft></svg>\n {{ backLabel | mnTranslate }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" lucideChevronLeft></svg>\n {{ backLabel | mnTranslate }}\n </button>\n }\n</nav>\n" }]
11663
+ }], propDecorators: { data: [{
11664
+ type: Input
11665
+ }], crumbClick: [{
11666
+ type: Output
11667
+ }], back: [{
11668
+ type: Output
11669
+ }] } });
11670
+
11571
11671
  /**
11572
11672
  * Injection token for the base URL used by all CRUD service requests.
11573
11673
  *
@@ -12069,5 +12169,5 @@ function enableMnPreviewMode(configService, langService, allowedOrigins) {
12069
12169
  * Generated bundle index. Do not edit.
12070
12170
  */
12071
12171
 
12072
- export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_HAPTICS, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MODAL_ACTION_ICONS, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MODAL_ACTION_ICON_SIZE, MODAL_ACTION_ICON_SIZE_SM, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnBottomSheet, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDateSelectorBar, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnRichTextEditor, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultFilterPredicate, defaultIconForStyle, defaultTextAdapter, emptyFilterValue, enableMnPreviewMode, isFilterValueActive, isTranslatable, matchesColumnFilter, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig, resolveFilterableValue };
12172
+ export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_HAPTICS, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MODAL_ACTION_ICONS, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MODAL_ACTION_ICON_SIZE, MODAL_ACTION_ICON_SIZE_SM, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnBottomSheet, MnBreadcrumbs, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDateSelectorBar, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnRichTextEditor, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultFilterPredicate, defaultIconForStyle, defaultTextAdapter, emptyFilterValue, enableMnPreviewMode, isFilterValueActive, isTranslatable, matchesColumnFilter, mnAlertVariants, mnBadgeVariants, mnBreadcrumbsVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig, resolveFilterableValue };
12073
12173
  //# sourceMappingURL=mn-angular-lib.mjs.map