@liquid-js/lyr-core 22.0.0-alpha.1 → 22.0.0-alpha.4

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.
Files changed (54) hide show
  1. package/components/accordion/accordion-item-body.component.html +7 -0
  2. package/components/accordion/accordion-item-body.component.scss +8 -1
  3. package/components/card/_card.component.theme.scss +7 -0
  4. package/components/card/flip-card/_flip-card.component.theme.scss +5 -0
  5. package/components/card/reveal-card/_reveal-card.component.theme.scss +5 -0
  6. package/components/file-drop/file-drop.component.scss +5 -1
  7. package/components/list/_list.component.theme.scss +6 -0
  8. package/components/menu/_menu.component.theme.scss +7 -1
  9. package/components/menu/menu-item.component.html +16 -14
  10. package/components/tag/_tag-list.scss +5 -0
  11. package/components/tree-grid/_tree-grid.component.theme.scss +7 -0
  12. package/fesm2022/liquid-js-lyr-core-accordion.mjs +87 -15
  13. package/fesm2022/liquid-js-lyr-core-accordion.mjs.map +1 -1
  14. package/fesm2022/liquid-js-lyr-core-base.mjs +38 -2
  15. package/fesm2022/liquid-js-lyr-core-base.mjs.map +1 -1
  16. package/fesm2022/liquid-js-lyr-core-chat.mjs +1 -1
  17. package/fesm2022/liquid-js-lyr-core-chat.mjs.map +1 -1
  18. package/fesm2022/liquid-js-lyr-core-context-menu.mjs +1 -0
  19. package/fesm2022/liquid-js-lyr-core-context-menu.mjs.map +1 -1
  20. package/fesm2022/liquid-js-lyr-core-dialog.mjs +13 -4
  21. package/fesm2022/liquid-js-lyr-core-dialog.mjs.map +1 -1
  22. package/fesm2022/liquid-js-lyr-core-file-drop.mjs +2 -2
  23. package/fesm2022/liquid-js-lyr-core-file-drop.mjs.map +1 -1
  24. package/fesm2022/liquid-js-lyr-core-form-field.mjs +1 -1
  25. package/fesm2022/liquid-js-lyr-core-form-field.mjs.map +1 -1
  26. package/fesm2022/liquid-js-lyr-core-menu.mjs +52 -4
  27. package/fesm2022/liquid-js-lyr-core-menu.mjs.map +1 -1
  28. package/fesm2022/liquid-js-lyr-core-tree-grid.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/schematics/ng-add/index.js +2 -2
  31. package/schematics/util/package.js +10 -1
  32. package/styles/core/_mixins.scss +10 -0
  33. package/styles/global/typography/_typography.scss +16 -0
  34. package/styles/prebuilt/components-custom-properties.css +1 -1
  35. package/styles/prebuilt/corporate-custom-properties.css +1 -1
  36. package/styles/prebuilt/corporate.css +1 -1
  37. package/styles/prebuilt/cosmic-custom-properties.css +1 -1
  38. package/styles/prebuilt/cosmic.css +1 -1
  39. package/styles/prebuilt/dark-custom-properties.css +1 -1
  40. package/styles/prebuilt/dark.css +1 -1
  41. package/styles/prebuilt/default-custom-properties.css +1 -1
  42. package/styles/prebuilt/default.css +1 -1
  43. package/styles/prebuilt/material-dark-custom-properties.css +1 -1
  44. package/styles/prebuilt/material-dark.css +1 -1
  45. package/styles/prebuilt/material-light-custom-properties.css +1 -1
  46. package/styles/prebuilt/material-light.css +1 -1
  47. package/styles/themes/_mapping.scss +8 -0
  48. package/types/liquid-js-lyr-core-accordion.d.ts +28 -3
  49. package/types/liquid-js-lyr-core-base.d.ts +5 -3
  50. package/types/liquid-js-lyr-core-button.d.ts +1 -1
  51. package/types/liquid-js-lyr-core-dialog.d.ts +11 -4
  52. package/types/liquid-js-lyr-core-menu.d.ts +44 -1
  53. package/types/liquid-js-lyr-core-select.d.ts +3 -3
  54. package/types/liquid-js-lyr-core-tree-grid.d.ts +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"liquid-js-lyr-core-dialog.mjs","names":[],"sources":["../../../packages/core/src/components/dialog/dialog-config.ts","../../../packages/core/src/components/dialog/dialog-ref.ts","../../../packages/core/src/components/dialog/dialog-container.ts","../../../packages/core/src/components/dialog/confirm-dialog.component.ts","../../../packages/core/src/components/dialog/dialog.service.ts","../../../packages/core/src/components/dialog/dialog.module.ts"],"sourcesContent":["import { InjectionToken, ViewContainerRef } from '@angular/core'\n\nimport { NbComponentContext, NbGlobalPosition } from '@liquid-js/lyr-core/cdk'\n\n/**\n * Where a dialog appears: `center`, `top` or `bottom` (centered horizontally), or a corner, named as for toasts,\n * e.g. `bottom-start` or `top-right`.\n */\nexport type NbDialogPosition = 'center' | 'top' | 'bottom' | `${NbGlobalPosition}`\n\nexport const NB_DIALOG_CONFIG = new InjectionToken<NbDialogConfig>('Default dialog options')\n\n/**\n * The options of `NbDialogService.open`, and the defaults given to `provideNbDialog`.\n */\nexport class NbDialogConfig<D = unknown> {\n /**\n * Shows a backdrop under the dialog, which makes it modal; `true` by default.\n */\n hasBackdrop = true\n\n /**\n * Class of the backdrop element.\n */\n backdropClass = 'overlay-backdrop'\n\n /**\n * Class of the overlay pane around the dialog.\n */\n dialogClass = ''\n\n /**\n * Closes the dialog with a click on the backdrop; `true` by default.\n */\n closeOnBackdropClick = true\n\n /**\n * Closes the dialog with Escape; `true` by default. Either way the dialog takes Escape from what's under it.\n */\n closeOnEsc = true\n\n /**\n * Lets the page scroll under the dialog; by default it can't.\n */\n hasScroll = false\n\n /**\n * Focuses the dialog's first focusable element once it opens, and returns the focus when it closes; `true` by\n * default. Otherwise the focus stays where it was.\n */\n autoFocus = true\n\n /**\n * Where the attached component should live in Angular's *logical* component tree.\n * This affects what is available for injection and the change detection order for the\n * component instantiated inside of the dialog. This does not affect where the dialog\n * content will be rendered.\n */\n viewContainerRef?: ViewContainerRef\n\n /**\n * Closes the dialog on router navigation, e.g. when the browser's back button is pressed; `true` by default.\n */\n closeOnNavigation = true\n\n /**\n * Where the dialog appears: `center` (default), `top`, `bottom`, or a corner such as `bottom-start`;\n * `start` and `end` follow the layout direction.\n */\n position: NbDialogPosition = 'center'\n\n /**\n * Space between the dialog and the viewport edges it's placed against, e.g. `1rem`.\n */\n positionOffset = ''\n\n /**\n * The dialog's ARIA role: `dialog`, or `alertdialog` for one that asks the user to confirm or acknowledge something.\n */\n role: 'dialog' | 'alertdialog' = 'dialog'\n\n /**\n * Id of the element that names the dialog, usually its title.\n */\n ariaLabelledBy?: string\n\n /**\n * Id of the element that describes the dialog, e.g. its message.\n */\n ariaDescribedBy?: string\n\n /**\n * Data for the content: a component's inputs, or what a template gets as `$implicit`.\n */\n context?: NbComponentContext<D>\n\n constructor(config: Partial<NbDialogConfig<D>>) {\n Object.assign(this, config)\n }\n}\n","import { ComponentRef } from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\n\nimport { disposeAfterBackdrop, NbOverlayRef } from '@liquid-js/lyr-core/cdk'\nimport { animateDialog } from './dialog-animation'\n\n/**\n * A dialog `NbDialogService.open` opened: `close` closes it with a result, which `onClose` emits, `componentRef` is\n * the rendered component, as with `NbWindowRef`, and `onBackdropClick` the clicks on its backdrop. The dialog's\n * component can inject it.\n */\nexport class NbDialogRef<T, R = unknown> {\n\n /**\n * The rendered component, for a dialog opened with a component (not a template).\n */\n componentRef?: ComponentRef<T>\n\n /**\n * Emits the clicks on the backdrop, whether or not they close the dialog.\n */\n readonly onBackdropClick: Observable<MouseEvent>\n protected onClose$ = new Subject<R | undefined>()\n /**\n * Emits the result the dialog closes with: `undefined` when it's closed without one, e.g. by its backdrop.\n */\n readonly onClose: Observable<R | undefined> = this.onClose$.asObservable()\n\n constructor(protected overlayRef: NbOverlayRef) {\n this.onBackdropClick = this.overlayRef.backdropClick()\n }\n\n protected closing = false\n\n /**\n * Closes the dialog: it fades out, then it's removed and `onClose` emits `res`. Closing it again meanwhile does\n * nothing.\n */\n close(res?: R) {\n if (this.closing) {\n return\n }\n this.closing = true\n // The backdrop fades out along with the pane, and the overlay goes once both have.\n this.overlayRef.detachBackdrop()\n void animateDialog(this.overlayRef.overlayElement, false).then(() => {\n this.overlayRef.detach()\n disposeAfterBackdrop(this.overlayRef)\n this.onClose$.next(res)\n this.onClose$.complete()\n })\n }\n}\n","import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n ElementRef,\n EmbeddedViewRef,\n inject,\n Injector,\n OnDestroy,\n OnInit,\n viewChild\n} from '@angular/core'\n\nimport { NbComponentPortal, NbPortalOutletDirective, NbTemplatePortal, NbFocusTrap, NbFocusTrapFactoryService } from '@liquid-js/lyr-core/cdk'\nimport { NbDialogConfig } from './dialog-config'\n\n/**\n * The element a dialog's content renders in: it carries the dialog's role and ARIA attributes, and traps and\n * restores the focus with `autoFocus`.\n */\n@Component({\n selector: 'nb-dialog-container',\n template: '<ng-template nbPortalOutlet />',\n // The overlay pane is capped to the viewport; dialogs taller or wider than it scroll instead of overflowing it.\n styles: ':host { display: block; max-width: 100%; max-height: 100%; overflow: auto; overscroll-behavior: contain; }',\n host: {\n // Without a backdrop the page stays usable, so the dialog isn't modal.\n '[attr.aria-modal]': 'config.hasBackdrop',\n '[attr.role]': 'config.role',\n '[attr.aria-labelledby]': 'config.ariaLabelledBy',\n '[attr.aria-describedby]': 'config.ariaDescribedBy'\n },\n // Hosted content may not use signals, so it's checked on every change detection.\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [NbPortalOutletDirective]\n})\nexport class NbDialogContainerComponent implements OnInit, OnDestroy {\n protected readonly config = inject(NbDialogConfig)\n protected readonly elementRef = inject(ElementRef)\n protected readonly focusTrapFactory = inject(NbFocusTrapFactoryService)\n protected readonly injector = inject(Injector)\n\n readonly portalOutlet = viewChild.required(NbPortalOutletDirective)\n\n protected focusTrap?: NbFocusTrap\n\n ngOnInit() {\n if (this.config.autoFocus) {\n const focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement)\n this.focusTrap = focusTrap\n focusTrap.blurPreviouslyFocusedElement()\n // The dialog's content is attached after the container starts, and renders with the next change detection, so\n // its first focusable element is there to take focus only once that has run.\n afterNextRender(() => focusTrap.focusInitialElement(), { injector: this.injector })\n }\n }\n\n ngOnDestroy() {\n if (this.config.autoFocus && this.focusTrap) {\n this.focusTrap.restoreFocus()\n }\n }\n\n attachComponentPortal<T>(portal: NbComponentPortal<T>): ComponentRef<T> {\n return this.portalOutlet().attachComponentPortal(portal)\n }\n\n attachTemplatePortal<C>(portal: NbTemplatePortal<C>): EmbeddedViewRef<C> {\n return this.portalOutlet().attachTemplatePortal(portal)\n }\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n Component,\n computed,\n DestroyRef,\n ErrorHandler,\n inject,\n InjectionToken,\n input,\n Provider,\n signal,\n TemplateRef\n} from '@angular/core'\nimport { isObservable, lastValueFrom, Observable } from 'rxjs'\n\nimport { NbButtonComponent } from '@liquid-js/lyr-core/button'\nimport { NbCardBodyComponent, NbCardComponent, NbCardFooterComponent, NbCardHeaderComponent } from '@liquid-js/lyr-core/card'\nimport { NbComponentOrCustomStatus, injectNbTexts, NbLocalize } from '@liquid-js/lyr-core/base'\nimport { NbEscapeStack } from '@liquid-js/lyr-core/cdk'\nimport { NbDialogRef } from './dialog-ref'\n\n/** @internal */\ndeclare const $localize: NbLocalize\n\nexport interface NbConfirmDialogOptions {\n /**\n * The question, e.g. \"Delete the invoice?\".\n */\n title: string\n /**\n * More about what confirming does: text, or a template for richer content.\n */\n message?: string | TemplateRef<void>\n /**\n * The confirm button's text, e.g. \"Delete\". Defaults to the `provideNbConfirmDialog` option, \"Confirm\" unless set.\n */\n confirmText?: string\n /**\n * The cancel button's text. Defaults to the `provideNbConfirmDialog` option, \"Cancel\" unless set.\n */\n cancelText?: string\n /**\n * The confirm button's status, e.g. `danger` for a destructive action. Defaults to the `provideNbConfirmDialog`\n * option, `primary` unless set.\n */\n status?: NbComponentOrCustomStatus\n /**\n * Runs when the user confirms. The dialog stays open until it completes, with the confirm button loading and the\n * dialog not dismissable; if it fails, the dialog stays open so the user can retry or cancel, and the error goes to\n * Angular's `ErrorHandler`.\n */\n action?: () => Promise<unknown> | Observable<unknown>\n}\n\nexport type NbConfirmDialogDefaults = Pick<NbConfirmDialogOptions, 'confirmText' | 'cancelText' | 'status'>\n\nexport const NB_CONFIRM_DIALOG_DEFAULTS = new InjectionToken<NbConfirmDialogDefaults>('Lyra Confirm Dialog Defaults', {\n providedIn: 'root',\n factory: () => ({ status: 'primary' })\n})\n\n/**\n * Sets the default status and button texts of `NbDialogService.confirm`; the texts are the `confirmDialog` texts of\n * `NbTextsService` otherwise.\n */\nexport function provideNbConfirmDialog(defaults: NbConfirmDialogDefaults): Provider {\n return {\n provide: NB_CONFIRM_DIALOG_DEFAULTS,\n useValue: { status: 'primary', ...defaults }\n }\n}\n\nlet lastConfirmDialogId = 0\n\n/**\n * The dialog `NbDialogService.confirm` opens.\n */\n@Component({\n selector: 'nb-confirm-dialog',\n template: `\n <nb-card appearance=\"floating\">\n <nb-card-header [id]=\"titleId\"><span dir=\"auto\">{{ options().title }}</span></nb-card-header>\n @if (options().message; as message) {\n <nb-card-body [id]=\"messageId\">\n @if (isTemplate(message)) {\n <ng-container *ngTemplateOutlet=\"message\" />\n } @else {\n <span dir=\"auto\">{{ message }}</span>\n }\n </nb-card-body>\n }\n <nb-card-footer class=\"actions\">\n <button nbButton outline type=\"button\" [disabled]=\"busy()\" (click)=\"cancel()\">{{ cancelText() }}</button>\n <button nbButton type=\"button\" [status]=\"status()\" [loading]=\"busy()\" (click)=\"confirm()\">\n {{ confirmText() }}\n </button>\n </nb-card-footer>\n </nb-card>\n `,\n styles: `\n :host {\n display: block;\n max-width: 32rem;\n }\n\n nb-card {\n margin: 0;\n }\n\n .actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 0.5rem;\n }\n `,\n imports: [\n NgTemplateOutlet,\n NbCardComponent,\n NbCardHeaderComponent,\n NbCardBodyComponent,\n NbCardFooterComponent,\n NbButtonComponent\n ]\n})\nexport class NbConfirmDialogComponent {\n protected readonly dialogRef = inject<NbDialogRef<NbConfirmDialogComponent>>(NbDialogRef)\n protected readonly defaults = inject(NB_CONFIRM_DIALOG_DEFAULTS)\n protected readonly texts = injectNbTexts('confirmDialog', () => ({\n confirm: $localize`:@@nb.confirmDialog.confirm:Confirm`,\n cancel: $localize`:@@nb.confirmDialog.cancel:Cancel`\n }))\n protected readonly errorHandler = inject(ErrorHandler)\n\n constructor() {\n // Escape cancels, unless the action is running; it's for this dialog only, not one it was opened from.\n const escape = inject(NbEscapeStack).add(() => this.cancel())\n inject(DestroyRef).onDestroy(() => escape.remove())\n }\n\n static nextIds() {\n const id = lastConfirmDialogId++\n return { titleId: `nb-confirm-dialog-title-${id}`, messageId: `nb-confirm-dialog-message-${id}` }\n }\n\n readonly options = input.required<NbConfirmDialogOptions>()\n\n titleId = ''\n messageId = ''\n\n /**\n * Whether the action is running.\n */\n readonly busy = signal(false)\n\n protected readonly confirmText = computed(\n () => this.options().confirmText ?? this.defaults.confirmText ?? this.texts().confirm\n )\n protected readonly cancelText = computed(\n () => this.options().cancelText ?? this.defaults.cancelText ?? this.texts().cancel\n )\n protected readonly status = computed(() => this.options().status ?? this.defaults.status ?? 'primary')\n\n async confirm() {\n const { action } = this.options()\n if (!action) {\n this.dialogRef.close(true)\n return\n }\n if (this.busy()) {\n return\n }\n this.busy.set(true)\n try {\n const result = action()\n await (isObservable(result) ? lastValueFrom(result, { defaultValue: undefined }) : result)\n this.dialogRef.close(true)\n } catch (error) {\n this.errorHandler.handleError(error)\n } finally {\n this.busy.set(false)\n }\n }\n\n cancel() {\n if (!this.busy()) {\n this.dialogRef.close(false)\n }\n }\n\n protected isTemplate(message: string | TemplateRef<void>): message is TemplateRef<void> {\n return message instanceof TemplateRef\n }\n}\n","import { Injector, TemplateRef, Type, inject, Service } from '@angular/core'\nimport { NavigationStart, Router } from '@angular/router'\nimport { filter, takeUntil } from 'rxjs/operators'\n\nimport { NbComponentPortal, NbOverlayRef, NbScrollStrategy, NbTemplatePortal, NbGlobalPositionStrategy, NbPositionBuilderService, NbEscapeStack, NbOverlayService, setComponentContext, NbGlobalPosition, NbPositionHelper } from '@liquid-js/lyr-core/cdk'\nimport { NB_DOCUMENT } from '@liquid-js/lyr-core/base'\nimport { NB_DIALOG_CONFIG, NbDialogConfig } from './dialog-config'\nimport { NbDialogRef } from './dialog-ref'\nimport { NbDialogContainerComponent } from './dialog-container'\nimport { NbConfirmDialogComponent, NbConfirmDialogOptions } from './confirm-dialog.component'\nimport { animateDialog } from './dialog-animation'\n\n/**\n * Opens dialogs: a component or a template over the page, centred by default, with a backdrop that makes it modal.\n *\n * @stacked-example(Showcase, dialog/dialog-showcase.component)\n *\n * `open` takes the component or template and an optional configuration, and returns an `NbDialogRef` to close the\n * dialog with and to get its result from.\n *\n * ### Installation\n *\n * Add `provideNbDialog()` to the application providers:\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideNbDialog(config)],\n * });\n * ```\n * In a lazy loaded route, add `provideNbDialog()` to the route's `providers` instead, so the route gets its own instance.\n *\n * With NgModules:\n *\n * Import `NbDialogModule.forRoot()` to your app module.\n * ```ts\n * @NgModule({\n * imports: [\n * // ...\n * NbDialogModule.forRoot(config),\n * ],\n * })\n * export class AppModule { }\n * ```\n *\n * If you are using it in a lazy loaded module than you have to install it with `NbDialogModule.forChild()`:\n * ```ts\n * @NgModule({\n * imports: [\n * // ...\n * NbDialogModule.forChild(config),\n * ],\n * })\n * export class LazyLoadedModule { }\n * ```\n *\n * ### Usage\n *\n * ```ts\n * const dialogRef = this.dialogService.open(MyDialogComponent, { ... });\n * ```\n *\n * `NbDialogRef` holds the rendered component, closes the dialog and emits its result. The dialog's component can\n * inject it:\n *\n * ```ts\n * this.dialogService.open(MyDialogComponent, { ... });\n *\n * // my-dialog.component.ts\n * constructor(protected dialogRef: NbDialogRef) {\n * }\n *\n * close() {\n * this.dialogRef.close();\n * }\n * ```\n *\n * A dialog can be a template instead of a component:\n * @stacked-example(Template ref, dialog/dialog-template.component)\n *\n * The dialog closes with a result, `dialogRef.close(result)`, which the opener gets from `onClose`:\n * @stacked-example(Result, dialog/dialog-result.component)\n *\n * ### Configuration\n *\n * `open` takes options, and `provideNbDialog` or `NbDialogModule.forRoot({ ... })` sets their defaults:\n *\n * `context` - data for the content: a component gets it as its inputs, a template as `$implicit`.\n *\n * ```ts\n * this.dialogService.open(template, { context: 'pass data in template' });\n * ```\n *\n * ```html\n * <ng-template let-some-additional-data>\n * {{ some-additional-data }}\n * <ng-template/>\n * ```\n *\n * `hasBackdrop` - shows a backdrop under the dialog, which makes it modal. Default is true.\n * @stacked-example(Backdrop, dialog/dialog-has-backdrop.component)\n *\n * `closeOnBackdropClick` - closes the dialog with a click on the backdrop. Default is true.\n * @stacked-example(Backdrop click, dialog/dialog-backdrop-click.component)\n *\n * `closeOnEsc` - closes the dialog with Escape. Default is true.\n * @stacked-example(Escape hit, dialog/dialog-esc.component)\n *\n * `closeOnNavigation` - closes the dialog on router navigation, e.g. when the browser's back button is pressed.\n * Default is true.\n *\n * `hasScroll` - lets the page scroll under the dialog. Default is false: the page can't scroll while a dialog is\n * open. Open the dialogs in a separate window and try to scroll.\n * @stacked-example(Scroll, dialog/dialog-scroll.component)\n *\n * `autoFocus` - focuses the dialog's first focusable element once it opens, or at least takes the focus off the\n * element that opened it, and returns the focus when it closes. Default is true. Without it the focus stays on the\n * opener, so Space opens the same dialog again: open the dialogs in a separate window, click the button without\n * focus and press Space a few times.\n * @stacked-example(Auto focus, dialog/dialog-auto-focus.component)\n *\n * `position` - where the dialog appears: `center` (default), `top`, `bottom`, or a corner such as `bottom-start` or\n * `top-right`, with `positionOffset` as the space to the viewport edges. A dialog without a backdrop in a corner\n * suits notices such as a cookie consent.\n * @stacked-example(Position, dialog/dialog-position.component)\n *\n * ### Confirm dialog\n *\n * `confirm` asks the user to confirm an action and resolves to whether they did. Pass `action` to run it from the\n * dialog: it stays open while the action runs, so a failed request can be retried, and closes once it succeeds.\n * @stacked-example(Confirm, dialog/dialog-confirm.component)\n *\n * Set the default button texts and status, e.g. to translate them, with `provideNbConfirmDialog`.\n * @styles\n *\n * overlay-backdrop-background-color:\n */\n@Service({ autoProvided: false })\nexport class NbDialogService {\n protected readonly document = inject(NB_DOCUMENT)\n protected readonly globalConfig = inject(NB_DIALOG_CONFIG)\n protected readonly positionBuilder = inject(NbPositionBuilderService)\n protected readonly overlay = inject(NbOverlayService)\n protected readonly injector = inject(Injector)\n protected readonly router = inject(Router, { optional: true })\n protected readonly positionHelper = inject(NbPositionHelper)\n protected readonly escapeStack = inject(NbEscapeStack)\n\n /**\n * Opens a dialog with the component or template. `R` is the type of the result the dialog closes with, which\n * `onClose` emits, e.g. `open<EditComponent, Customer>(EditComponent)`.\n */\n open<T, R = unknown>(content: Type<T> | TemplateRef<T>,\n userConfig: Partial<NbDialogConfig<Partial<T> | string>> = {}): NbDialogRef<T, R> {\n const config = new NbDialogConfig<Partial<T> | string>({ ...this.globalConfig, ...userConfig })\n const overlayRef = this.createOverlay(config)\n const dialogRef = new NbDialogRef<T, R>(overlayRef)\n // The dialog takes Escape while it's on top, before its content adds what it opens, e.g. a popover, above it. One\n // that doesn't close on Escape still keeps it from what's under it.\n const escape = this.escapeStack.add(() => {\n if (config.closeOnEsc) {\n dialogRef.close()\n }\n })\n dialogRef.onClose.subscribe(() => escape.remove())\n const container = this.createContainer(config, overlayRef)\n this.createContent(config, content, container, dialogRef)\n void animateDialog(overlayRef.overlayElement, true)\n\n this.registerCloseListeners(config, overlayRef, dialogRef)\n\n return dialogRef\n }\n\n /**\n * Asks the user to confirm an action; resolves to `true` once they confirm and `action`, if given, completes,\n * or to `false` when they cancel or the dialog closes otherwise.\n *\n * ```ts\n * const deleted = await this.dialogService.confirm({\n * title: 'Delete the invoice?',\n * message: \"It can't be restored.\",\n * confirmText: 'Delete',\n * status: 'danger',\n * action: () => this.invoices.delete(id),\n * });\n * ```\n */\n confirm(options: NbConfirmDialogOptions, userConfig: Partial<NbDialogConfig> = {}): Promise<boolean> {\n const ids = NbConfirmDialogComponent.nextIds()\n const dialogRef = this.open(NbConfirmDialogComponent, {\n // The dialog handles Escape itself, so it can ignore it while the action runs.\n closeOnEsc: false,\n closeOnBackdropClick: false,\n role: 'alertdialog',\n ariaLabelledBy: ids.titleId,\n ariaDescribedBy: options.message ? ids.messageId : undefined,\n ...userConfig,\n context: { options, ...ids }\n })\n return new Promise((resolve) => dialogRef.onClose.subscribe((confirmed) => resolve(confirmed === true)))\n }\n\n protected createOverlay(config: NbDialogConfig): NbOverlayRef {\n const positionStrategy = this.createPositionStrategy(config)\n const scrollStrategy = this.createScrollStrategy(config.hasScroll)\n\n return this.overlay.create({\n positionStrategy,\n scrollStrategy,\n hasBackdrop: config.hasBackdrop,\n backdropClass: config.backdropClass,\n panelClass: config.dialogClass\n })\n }\n\n protected createPositionStrategy(config?: NbDialogConfig): NbGlobalPositionStrategy {\n const strategy = this.positionBuilder.global()\n const position = config?.position ?? 'center'\n const offset = config?.positionOffset ?? ''\n switch (position) {\n case 'center':\n return strategy.centerVertically().centerHorizontally()\n case 'top':\n return strategy.top(offset).centerHorizontally()\n case 'bottom':\n return strategy.bottom(offset).centerHorizontally()\n }\n // A physical corner, with start and end resolved for the layout direction.\n const [vertical, horizontal] = this.positionHelper.toPhysicalPosition(position as NbGlobalPosition).split('-')\n const placed = vertical === 'top' ? strategy.top(offset) : strategy.bottom(offset)\n return horizontal === 'left' ? placed.left(offset) : placed.right(offset)\n }\n\n protected createScrollStrategy(hasScroll: boolean): NbScrollStrategy {\n if (hasScroll) {\n return this.overlay.scrollStrategies.noop()\n } else {\n return this.overlay.scrollStrategies.block()\n }\n }\n\n protected createContainer(config: NbDialogConfig, overlayRef: NbOverlayRef): NbDialogContainerComponent {\n const injector = Injector.create({\n parent: this.createInjector(config),\n providers: [{ provide: NbDialogConfig, useValue: config }]\n })\n const containerPortal = new NbComponentPortal(NbDialogContainerComponent, null, injector)\n const containerRef = overlayRef.attach(containerPortal)\n return containerRef.instance\n }\n\n protected createContent<T, R>(config: NbDialogConfig,\n content: Type<T> | TemplateRef<T>,\n container: NbDialogContainerComponent,\n dialogRef: NbDialogRef<T, R>) {\n if (content instanceof TemplateRef) {\n const portal = this.createTemplatePortal(config, content, dialogRef)\n container.attachTemplatePortal(portal)\n } else {\n const portal = this.createComponentPortal(config, content, dialogRef)\n const componentRef = container.attachComponentPortal(portal)\n dialogRef.componentRef = componentRef\n\n if (config.context) {\n setComponentContext(componentRef, config.context)\n }\n }\n }\n\n protected createTemplatePortal<T, R>(config: NbDialogConfig,\n content: TemplateRef<unknown>,\n dialogRef: NbDialogRef<T, R>): NbTemplatePortal {\n return new NbTemplatePortal(content, undefined, { $implicit: config.context, dialogRef })\n }\n\n /**\n * The portal's injector, under the `viewContainerRef`'s or the service's, provides the `NbDialogRef` the dialog's\n * component injects.\n */\n protected createComponentPortal<T, R>(config: NbDialogConfig,\n content: Type<T>,\n dialogRef: NbDialogRef<T, R>): NbComponentPortal<T> {\n const injector = this.createInjector(config)\n const portalInjector = Injector.create({\n parent: injector,\n providers: [{ provide: NbDialogRef, useValue: dialogRef }]\n })\n return new NbComponentPortal(content, config.viewContainerRef, portalInjector)\n }\n\n protected createInjector(config: NbDialogConfig): Injector {\n return config.viewContainerRef && config.viewContainerRef.injector || this.injector\n }\n\n protected registerCloseListeners<T, R>(config: NbDialogConfig,\n overlayRef: NbOverlayRef,\n dialogRef: NbDialogRef<T, R>) {\n if (config.closeOnBackdropClick) {\n overlayRef.backdropClick().subscribe(() => dialogRef.close())\n }\n\n if (config.closeOnNavigation && this.router) {\n this.router.events\n .pipe(\n filter((event) => event instanceof NavigationStart),\n takeUntil(dialogRef.onClose)\n )\n .subscribe(() => dialogRef.close())\n }\n }\n}\n","import { ModuleWithProviders, NgModule, EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'\n\nimport { NbOverlayModule } from '@liquid-js/lyr-core/cdk'\nimport { NbDialogService } from './dialog.service'\nimport { NbDialogContainerComponent } from './dialog-container'\nimport { NB_DIALOG_CONFIG, NbDialogConfig } from './dialog-config'\n\n/**\n * Provides the dialog service with default config, in place of `NbDialogModule.forRoot()`. In a lazy route's\n * providers it gives that route its own service, as `NbDialogModule.forChild()` does.\n */\nexport function provideNbDialog(dialogConfig: Partial<NbDialogConfig> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n NbDialogService,\n { provide: NB_DIALOG_CONFIG, useValue: dialogConfig }\n ])\n}\n\n@NgModule({\n imports: [NbOverlayModule, NbDialogContainerComponent]\n})\nexport class NbDialogModule {\n static forRoot(dialogConfig: Partial<NbDialogConfig> = {}): ModuleWithProviders<NbDialogModule> {\n return { ngModule: NbDialogModule, providers: [provideNbDialog(dialogConfig)] }\n }\n\n static forChild(dialogConfig: Partial<NbDialogConfig> = {}): ModuleWithProviders<NbDialogModule> {\n return { ngModule: NbDialogModule, providers: [provideNbDialog(dialogConfig)] }\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,mBAAmB,IAAI,eAA+B,wBAAwB;AAK3F,IAAa,iBAAb,MAA2B;CAiFvB,YAAY,QAAkC;EA7E9C,KAAA,cAAc;EAKd,KAAA,gBAAgB;EAKhB,KAAA,cAAc;EAKd,KAAA,uBAAuB;EAKvB,KAAA,aAAa;EAKb,KAAA,YAAY;EAMZ,KAAA,YAAY;EAaZ,KAAA,oBAAoB;EAMpB,KAAA,WAA6B;EAK7B,KAAA,iBAAiB;EAKjB,KAAA,OAAiC;EAkB7B,OAAO,OAAO,MAAM,MAAM;CAC9B;AACH;ACxFD,IAAa,cAAb,MAAwB;CAiBpB,YAAsB,YAAwB;EAAxB,KAAA,aAAA;EANZ,KAAA,WAAW,IAAI,QAAO;EAIvB,KAAA,UAAqC,KAAK,SAAS,aAAY;EAM9D,KAAA,UAAU;EAHhB,KAAK,kBAAkB,KAAK,WAAW,cAAa;CACxD;CAQA,MAAM,KAAO;EACT,IAAI,KAAK,SACL;EAEJ,KAAK,UAAU;EAEf,KAAK,WAAW,eAAc;EACzB,cAAc,KAAK,WAAW,gBAAgB,KAAK,CAAC,CAAC,WAAU;GAChE,KAAK,WAAW,OAAM;GACtB,qBAAqB,KAAK,UAAU;GACpC,KAAK,SAAS,KAAK,GAAG;GACtB,KAAK,SAAS,SAAQ;EAC1B,CAAC;CACL;AACH;ACfD,IAAa,6BAAb,MAAa,2BAA0B;CAhBvC,cAAA;EAiBuB,KAAA,SAAS,OAAO,cAAc;EAC9B,KAAA,aAAa,OAAO,U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CAAA,GAAE;CACtE,OAAO,yBAAyB,CAC5B,iBACA;EAAE,SAAS;EAAkB,UAAU;CAAY,CACtD,CAAA;AACL;AAKA,IAAa,iBAAb,MAAa,eAAc;CACvB,OAAO,QAAQ,eAAwC,CAAA,GAAE;EACrD,OAAO;GAAE,UAAU;GAAgB,WAAW,CAAC,gBAAgB,YAAY,CAAC;EAAC;CACjF;CAEA,OAAO,SAAS,eAAwC,CAAA,GAAE;EACtD,OAAO;GAAE,UAAU;GAAgB,WAAW,CAAC,gBAAgB,YAAY,CAAC;EAAC;CACjF;CAPS;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAc,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAd;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAc,SAAA,CAFb,iBAAiB,0BAA0B;EAAA,CAAA;CAAA;CAE5C;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAc,SAAA,CAFb,eAAe;EAAA,CAAA;CAAA;;AAEhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAH1B,MAAA;EAAS,MAAA,CAAA,EACN,SAAS,CAAC,iBAAiB,0BAA0B,EACxD,CAAA"}
1
+ {"version":3,"file":"liquid-js-lyr-core-dialog.mjs","names":[],"sources":["../../../packages/core/src/components/dialog/dialog-config.ts","../../../packages/core/src/components/dialog/dialog-ref.ts","../../../packages/core/src/components/dialog/dialog-container.ts","../../../packages/core/src/components/dialog/confirm-dialog.component.ts","../../../packages/core/src/components/dialog/dialog.service.ts","../../../packages/core/src/components/dialog/dialog.module.ts"],"sourcesContent":["import { InjectionToken, ViewContainerRef } from '@angular/core'\n\nimport { NbComponentContext, NbGlobalPosition } from '@liquid-js/lyr-core/cdk'\n\n/**\n * Where a dialog appears: `center`, `top` or `bottom` (centered horizontally), or a corner, named as for toasts,\n * e.g. `bottom-start` or `top-right`.\n */\nexport type NbDialogPosition = 'center' | 'top' | 'bottom' | `${NbGlobalPosition}`\n\nexport const NB_DIALOG_CONFIG = new InjectionToken<NbDialogConfig>('Default dialog options')\n\n/**\n * The options of `NbDialogService.open`, and the defaults given to `provideNbDialog`.\n */\nexport class NbDialogConfig<D = unknown> {\n /**\n * Shows a backdrop under the dialog, which makes it modal; `true` by default.\n */\n hasBackdrop = true\n\n /**\n * Class of the backdrop element.\n */\n backdropClass = 'overlay-backdrop'\n\n /**\n * Class of the overlay pane around the dialog.\n */\n dialogClass = ''\n\n /**\n * Closes the dialog with a click on the backdrop; `true` by default.\n */\n closeOnBackdropClick = true\n\n /**\n * Closes the dialog with Escape; `true` by default. Either way the dialog takes Escape from what's under it.\n */\n closeOnEsc = true\n\n /**\n * Lets the page scroll under the dialog; by default it can't.\n */\n hasScroll = false\n\n /**\n * Focuses the dialog's first focusable element once it opens, and returns the focus when it closes; `true` by\n * default. Otherwise the focus stays where it was.\n */\n autoFocus = true\n\n /**\n * Where the attached component should live in Angular's *logical* component tree.\n * This affects what is available for injection and the change detection order for the\n * component instantiated inside of the dialog. This does not affect where the dialog\n * content will be rendered.\n */\n viewContainerRef?: ViewContainerRef\n\n /**\n * Closes the dialog when a navigation leaves its page, e.g. with the browser's back button; `false` by default.\n * A navigation that only changes the query or fragment, as apps do to keep state in the URL, leaves it open.\n */\n closeOnNavigation = false\n\n /**\n * Where the dialog appears: `center` (default), `top`, `bottom`, or a corner such as `bottom-start`;\n * `start` and `end` follow the layout direction.\n */\n position: NbDialogPosition = 'center'\n\n /**\n * Space between the dialog and the viewport edges it's placed against, e.g. `1rem`.\n */\n positionOffset = ''\n\n /**\n * The dialog's ARIA role: `dialog`, or `alertdialog` for one that asks the user to confirm or acknowledge something.\n */\n role: 'dialog' | 'alertdialog' = 'dialog'\n\n /**\n * Id of the element that names the dialog, usually its title.\n */\n ariaLabelledBy?: string\n\n /**\n * Id of the element that describes the dialog, e.g. its message.\n */\n ariaDescribedBy?: string\n\n /**\n * Data for the content: a component's inputs, or what a template gets as `$implicit`.\n */\n context?: NbComponentContext<D>\n\n constructor(config: Partial<NbDialogConfig<D>>) {\n Object.assign(this, config)\n }\n}\n","import { ComponentRef } from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\n\nimport { disposeAfterBackdrop, NbOverlayRef } from '@liquid-js/lyr-core/cdk'\nimport { animateDialog } from './dialog-animation'\n\n/**\n * A dialog `NbDialogService.open` opened: `close` closes it with a result, which `onClose` emits, `componentRef` is\n * the rendered component, as with `NbWindowRef`, and `onBackdropClick` the clicks on its backdrop. The dialog's\n * component can inject it.\n */\nexport class NbDialogRef<T, R = unknown> {\n\n /**\n * The rendered component, for a dialog opened with a component (not a template).\n */\n componentRef?: ComponentRef<T>\n\n /**\n * Emits the clicks on the backdrop, whether or not they close the dialog.\n */\n readonly onBackdropClick: Observable<MouseEvent>\n protected onClose$ = new Subject<R | undefined>()\n /**\n * Emits the result the dialog closes with: `undefined` when it's closed without one, e.g. by its backdrop.\n */\n readonly onClose: Observable<R | undefined> = this.onClose$.asObservable()\n\n constructor(protected overlayRef: NbOverlayRef) {\n this.onBackdropClick = this.overlayRef.backdropClick()\n }\n\n protected closing = false\n\n /**\n * Closes the dialog: it fades out, then it's removed and `onClose` emits `res`. Closing it again meanwhile does\n * nothing.\n */\n close(res?: R) {\n if (this.closing) {\n return\n }\n this.closing = true\n // The backdrop fades out along with the pane, and the overlay goes once both have.\n this.overlayRef.detachBackdrop()\n void animateDialog(this.overlayRef.overlayElement, false).then(() => {\n this.overlayRef.detach()\n disposeAfterBackdrop(this.overlayRef)\n this.onClose$.next(res)\n this.onClose$.complete()\n })\n }\n}\n","import {\n afterNextRender,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentRef,\n ElementRef,\n EmbeddedViewRef,\n inject,\n Injector,\n OnDestroy,\n OnInit,\n viewChild\n} from '@angular/core'\n\nimport { NbComponentPortal, NbPortalOutletDirective, NbTemplatePortal, NbFocusTrap, NbFocusTrapFactoryService } from '@liquid-js/lyr-core/cdk'\nimport { NbDialogConfig } from './dialog-config'\n\n/**\n * The element a dialog's content renders in: it carries the dialog's role and ARIA attributes, and traps and\n * restores the focus with `autoFocus`.\n */\n@Component({\n selector: 'nb-dialog-container',\n template: '<ng-template nbPortalOutlet />',\n // The overlay pane is capped to the viewport; dialogs taller or wider than it scroll instead of overflowing it.\n styles: ':host { display: block; max-width: 100%; max-height: 100%; overflow: auto; overscroll-behavior: contain; }',\n host: {\n // Without a backdrop the page stays usable, so the dialog isn't modal.\n '[attr.aria-modal]': 'config.hasBackdrop',\n '[attr.role]': 'config.role',\n '[attr.aria-labelledby]': 'config.ariaLabelledBy',\n '[attr.aria-describedby]': 'config.ariaDescribedBy'\n },\n // Hosted content may not use signals, so it's checked on every change detection.\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [NbPortalOutletDirective]\n})\nexport class NbDialogContainerComponent implements OnInit, OnDestroy {\n protected readonly config = inject(NbDialogConfig)\n protected readonly elementRef = inject(ElementRef)\n protected readonly focusTrapFactory = inject(NbFocusTrapFactoryService)\n protected readonly injector = inject(Injector)\n protected readonly changeDetectorRef = inject(ChangeDetectorRef)\n\n readonly portalOutlet = viewChild.required(NbPortalOutletDirective)\n\n protected focusTrap?: NbFocusTrap\n\n ngOnInit() {\n if (this.config.autoFocus) {\n const focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement)\n this.focusTrap = focusTrap\n focusTrap.blurPreviouslyFocusedElement()\n // The dialog's content is attached after the container starts, and renders with the next change detection, so\n // its first focusable element is there to take focus only once that has run.\n afterNextRender(() => focusTrap.focusInitialElement(), { injector: this.injector })\n }\n }\n\n ngOnDestroy() {\n if (this.config.autoFocus && this.focusTrap) {\n this.focusTrap.restoreFocus()\n }\n }\n\n attachComponentPortal<T>(portal: NbComponentPortal<T>): ComponentRef<T> {\n return this.portalOutlet().attachComponentPortal(portal)\n }\n\n attachTemplatePortal<C>(portal: NbTemplatePortal<C>): EmbeddedViewRef<C> {\n return this.portalOutlet().attachTemplatePortal(portal)\n }\n\n /**\n * Renders the dialog and its attached content now.\n */\n detectChanges() {\n this.changeDetectorRef.detectChanges()\n }\n}\n","import { NgTemplateOutlet } from '@angular/common'\nimport {\n Component,\n computed,\n DestroyRef,\n ErrorHandler,\n inject,\n InjectionToken,\n input,\n Provider,\n signal,\n TemplateRef\n} from '@angular/core'\nimport { isObservable, lastValueFrom, Observable } from 'rxjs'\n\nimport { NbButtonComponent } from '@liquid-js/lyr-core/button'\nimport { NbCardBodyComponent, NbCardComponent, NbCardFooterComponent, NbCardHeaderComponent } from '@liquid-js/lyr-core/card'\nimport { NbComponentOrCustomStatus, injectNbTexts, NbLocalize } from '@liquid-js/lyr-core/base'\nimport { NbEscapeStack } from '@liquid-js/lyr-core/cdk'\nimport { NbDialogRef } from './dialog-ref'\n\n/** @internal */\ndeclare const $localize: NbLocalize\n\nexport interface NbConfirmDialogOptions {\n /**\n * The question, e.g. \"Delete the invoice?\".\n */\n title: string\n /**\n * More about what confirming does: text, or a template for richer content.\n */\n message?: string | TemplateRef<void>\n /**\n * The confirm button's text, e.g. \"Delete\". Defaults to the `provideNbConfirmDialog` option, \"Confirm\" unless set.\n */\n confirmText?: string\n /**\n * The cancel button's text. Defaults to the `provideNbConfirmDialog` option, \"Cancel\" unless set.\n */\n cancelText?: string\n /**\n * The confirm button's status, e.g. `danger` for a destructive action. Defaults to the `provideNbConfirmDialog`\n * option, `primary` unless set.\n */\n status?: NbComponentOrCustomStatus\n /**\n * Runs when the user confirms. The dialog stays open until it completes, with the confirm button loading and the\n * dialog not dismissable; if it fails, the dialog stays open so the user can retry or cancel, and the error goes to\n * Angular's `ErrorHandler`.\n */\n action?: () => Promise<unknown> | Observable<unknown>\n}\n\nexport type NbConfirmDialogDefaults = Pick<NbConfirmDialogOptions, 'confirmText' | 'cancelText' | 'status'>\n\nexport const NB_CONFIRM_DIALOG_DEFAULTS = new InjectionToken<NbConfirmDialogDefaults>('Lyra Confirm Dialog Defaults', {\n providedIn: 'root',\n factory: () => ({ status: 'primary' })\n})\n\n/**\n * Sets the default status and button texts of `NbDialogService.confirm`; the texts are the `confirmDialog` texts of\n * `NbTextsService` otherwise.\n */\nexport function provideNbConfirmDialog(defaults: NbConfirmDialogDefaults): Provider {\n return {\n provide: NB_CONFIRM_DIALOG_DEFAULTS,\n useValue: { status: 'primary', ...defaults }\n }\n}\n\nlet lastConfirmDialogId = 0\n\n/**\n * The dialog `NbDialogService.confirm` opens.\n */\n@Component({\n selector: 'nb-confirm-dialog',\n template: `\n <nb-card appearance=\"floating\">\n <nb-card-header [id]=\"titleId\"><span dir=\"auto\">{{ options().title }}</span></nb-card-header>\n @if (options().message; as message) {\n <nb-card-body [id]=\"messageId\">\n @if (isTemplate(message)) {\n <ng-container *ngTemplateOutlet=\"message\" />\n } @else {\n <span dir=\"auto\">{{ message }}</span>\n }\n </nb-card-body>\n }\n <nb-card-footer class=\"actions\">\n <button nbButton outline type=\"button\" [disabled]=\"busy()\" (click)=\"cancel()\">{{ cancelText() }}</button>\n <button nbButton type=\"button\" [status]=\"status()\" [loading]=\"busy()\" (click)=\"confirm()\">\n {{ confirmText() }}\n </button>\n </nb-card-footer>\n </nb-card>\n `,\n styles: `\n :host {\n display: block;\n max-width: 32rem;\n }\n\n nb-card {\n margin: 0;\n }\n\n .actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 0.5rem;\n }\n `,\n imports: [\n NgTemplateOutlet,\n NbCardComponent,\n NbCardHeaderComponent,\n NbCardBodyComponent,\n NbCardFooterComponent,\n NbButtonComponent\n ]\n})\nexport class NbConfirmDialogComponent {\n protected readonly dialogRef = inject<NbDialogRef<NbConfirmDialogComponent>>(NbDialogRef)\n protected readonly defaults = inject(NB_CONFIRM_DIALOG_DEFAULTS)\n protected readonly texts = injectNbTexts('confirmDialog', () => ({\n confirm: $localize`:@@nb.confirmDialog.confirm:Confirm`,\n cancel: $localize`:@@nb.confirmDialog.cancel:Cancel`\n }))\n protected readonly errorHandler = inject(ErrorHandler)\n\n constructor() {\n // Escape cancels, unless the action is running; it's for this dialog only, not one it was opened from.\n const escape = inject(NbEscapeStack).add(() => this.cancel())\n inject(DestroyRef).onDestroy(() => escape.remove())\n }\n\n static nextIds() {\n const id = lastConfirmDialogId++\n return { titleId: `nb-confirm-dialog-title-${id}`, messageId: `nb-confirm-dialog-message-${id}` }\n }\n\n readonly options = input.required<NbConfirmDialogOptions>()\n\n titleId = ''\n messageId = ''\n\n /**\n * Whether the action is running.\n */\n readonly busy = signal(false)\n\n protected readonly confirmText = computed(\n () => this.options().confirmText ?? this.defaults.confirmText ?? this.texts().confirm\n )\n protected readonly cancelText = computed(\n () => this.options().cancelText ?? this.defaults.cancelText ?? this.texts().cancel\n )\n protected readonly status = computed(() => this.options().status ?? this.defaults.status ?? 'primary')\n\n async confirm() {\n const { action } = this.options()\n if (!action) {\n this.dialogRef.close(true)\n return\n }\n if (this.busy()) {\n return\n }\n this.busy.set(true)\n try {\n const result = action()\n await (isObservable(result) ? lastValueFrom(result, { defaultValue: undefined }) : result)\n this.dialogRef.close(true)\n } catch (error) {\n this.errorHandler.handleError(error)\n } finally {\n this.busy.set(false)\n }\n }\n\n cancel() {\n if (!this.busy()) {\n this.dialogRef.close(false)\n }\n }\n\n protected isTemplate(message: string | TemplateRef<void>): message is TemplateRef<void> {\n return message instanceof TemplateRef\n }\n}\n","import { Injector, TemplateRef, Type, inject, Service } from '@angular/core'\nimport { NavigationStart, Router, UrlTree } from '@angular/router'\nimport { filter, takeUntil } from 'rxjs/operators'\n\nimport { NbComponentPortal, NbOverlayRef, NbScrollStrategy, NbTemplatePortal, NbGlobalPositionStrategy, NbPositionBuilderService, NbEscapeStack, NbOverlayService, setComponentContext, NbGlobalPosition, NbPositionHelper } from '@liquid-js/lyr-core/cdk'\nimport { NB_DOCUMENT } from '@liquid-js/lyr-core/base'\nimport { NB_DIALOG_CONFIG, NbDialogConfig } from './dialog-config'\nimport { NbDialogRef } from './dialog-ref'\nimport { NbDialogContainerComponent } from './dialog-container'\nimport { NbConfirmDialogComponent, NbConfirmDialogOptions } from './confirm-dialog.component'\nimport { animateDialog } from './dialog-animation'\n\n/**\n * Opens dialogs: a component or a template over the page, centred by default, with a backdrop that makes it modal.\n *\n * @stacked-example(Showcase, dialog/dialog-showcase.component)\n *\n * `open` takes the component or template and an optional configuration, and returns an `NbDialogRef` to close the\n * dialog with and to get its result from.\n *\n * ### Installation\n *\n * Add `provideNbDialog()` to the application providers:\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideNbDialog(config)],\n * });\n * ```\n * In a lazy loaded route, add `provideNbDialog()` to the route's `providers` instead, so the route gets its own instance.\n *\n * With NgModules:\n *\n * Import `NbDialogModule.forRoot()` to your app module.\n * ```ts\n * @NgModule({\n * imports: [\n * // ...\n * NbDialogModule.forRoot(config),\n * ],\n * })\n * export class AppModule { }\n * ```\n *\n * If you are using it in a lazy loaded module than you have to install it with `NbDialogModule.forChild()`:\n * ```ts\n * @NgModule({\n * imports: [\n * // ...\n * NbDialogModule.forChild(config),\n * ],\n * })\n * export class LazyLoadedModule { }\n * ```\n *\n * ### Usage\n *\n * ```ts\n * const dialogRef = this.dialogService.open(MyDialogComponent, { ... });\n * ```\n *\n * `NbDialogRef` holds the rendered component, closes the dialog and emits its result. The dialog's component can\n * inject it:\n *\n * ```ts\n * this.dialogService.open(MyDialogComponent, { ... });\n *\n * // my-dialog.component.ts\n * constructor(protected dialogRef: NbDialogRef) {\n * }\n *\n * close() {\n * this.dialogRef.close();\n * }\n * ```\n *\n * A dialog can be a template instead of a component:\n * @stacked-example(Template ref, dialog/dialog-template.component)\n *\n * The dialog closes with a result, `dialogRef.close(result)`, which the opener gets from `onClose`:\n * @stacked-example(Result, dialog/dialog-result.component)\n *\n * ### Configuration\n *\n * `open` takes options, and `provideNbDialog` or `NbDialogModule.forRoot({ ... })` sets their defaults:\n *\n * `context` - data for the content: a component gets it as its inputs, a template as `$implicit`.\n *\n * ```ts\n * this.dialogService.open(template, { context: 'pass data in template' });\n * ```\n *\n * ```html\n * <ng-template let-some-additional-data>\n * {{ some-additional-data }}\n * <ng-template/>\n * ```\n *\n * `hasBackdrop` - shows a backdrop under the dialog, which makes it modal. Default is true.\n * @stacked-example(Backdrop, dialog/dialog-has-backdrop.component)\n *\n * `closeOnBackdropClick` - closes the dialog with a click on the backdrop. Default is true.\n * @stacked-example(Backdrop click, dialog/dialog-backdrop-click.component)\n *\n * `closeOnEsc` - closes the dialog with Escape. Default is true.\n * @stacked-example(Escape hit, dialog/dialog-esc.component)\n *\n * `closeOnNavigation` - closes the dialog when a navigation leaves its page, e.g. with the browser's back button. A\n * navigation that only changes the query or fragment, as apps do to keep state in the URL, leaves it open. Default is\n * false.\n *\n * `hasScroll` - lets the page scroll under the dialog. Default is false: the page can't scroll while a dialog is\n * open. Open the dialogs in a separate window and try to scroll.\n * @stacked-example(Scroll, dialog/dialog-scroll.component)\n *\n * `autoFocus` - focuses the dialog's first focusable element once it opens, or at least takes the focus off the\n * element that opened it, and returns the focus when it closes. Default is true. Without it the focus stays on the\n * opener, so Space opens the same dialog again: open the dialogs in a separate window, click the button without\n * focus and press Space a few times.\n * @stacked-example(Auto focus, dialog/dialog-auto-focus.component)\n *\n * `position` - where the dialog appears: `center` (default), `top`, `bottom`, or a corner such as `bottom-start` or\n * `top-right`, with `positionOffset` as the space to the viewport edges. A dialog without a backdrop in a corner\n * suits notices such as a cookie consent.\n * @stacked-example(Position, dialog/dialog-position.component)\n *\n * ### Confirm dialog\n *\n * `confirm` asks the user to confirm an action and resolves to whether they did. Pass `action` to run it from the\n * dialog: it stays open while the action runs, so a failed request can be retried, and closes once it succeeds.\n * @stacked-example(Confirm, dialog/dialog-confirm.component)\n *\n * Set the default button texts and status, e.g. to translate them, with `provideNbConfirmDialog`.\n * @styles\n *\n * overlay-backdrop-background-color:\n */\n@Service({ autoProvided: false })\nexport class NbDialogService {\n protected readonly document = inject(NB_DOCUMENT)\n protected readonly globalConfig = inject(NB_DIALOG_CONFIG)\n protected readonly positionBuilder = inject(NbPositionBuilderService)\n protected readonly overlay = inject(NbOverlayService)\n protected readonly injector = inject(Injector)\n protected readonly router = inject(Router, { optional: true })\n protected readonly positionHelper = inject(NbPositionHelper)\n protected readonly escapeStack = inject(NbEscapeStack)\n\n /**\n * Opens a dialog with the component or template. `R` is the type of the result the dialog closes with, which\n * `onClose` emits, e.g. `open<EditComponent, Customer>(EditComponent)`.\n */\n open<T, R = unknown>(content: Type<T> | TemplateRef<T>,\n userConfig: Partial<NbDialogConfig<Partial<T> | string>> = {}): NbDialogRef<T, R> {\n const config = new NbDialogConfig<Partial<T> | string>({ ...this.globalConfig, ...userConfig })\n const overlayRef = this.createOverlay(config)\n const dialogRef = new NbDialogRef<T, R>(overlayRef)\n // The dialog takes Escape while it's on top, before its content adds what it opens, e.g. a popover, above it. One\n // that doesn't close on Escape still keeps it from what's under it.\n const escape = this.escapeStack.add(() => {\n if (config.closeOnEsc) {\n dialogRef.close()\n }\n })\n dialogRef.onClose.subscribe(() => escape.remove())\n const container = this.createContainer(config, overlayRef)\n this.createContent(config, content, container, dialogRef)\n // Rendered before the browser paints, rather than with the next change detection, which can come a frame later.\n container.detectChanges()\n void animateDialog(overlayRef.overlayElement, true)\n\n this.registerCloseListeners(config, overlayRef, dialogRef)\n\n return dialogRef\n }\n\n /**\n * Asks the user to confirm an action; resolves to `true` once they confirm and `action`, if given, completes,\n * or to `false` when they cancel or the dialog closes otherwise.\n *\n * ```ts\n * const deleted = await this.dialogService.confirm({\n * title: 'Delete the invoice?',\n * message: \"It can't be restored.\",\n * confirmText: 'Delete',\n * status: 'danger',\n * action: () => this.invoices.delete(id),\n * });\n * ```\n */\n confirm(options: NbConfirmDialogOptions, userConfig: Partial<NbDialogConfig> = {}): Promise<boolean> {\n const ids = NbConfirmDialogComponent.nextIds()\n const dialogRef = this.open(NbConfirmDialogComponent, {\n // The dialog handles Escape itself, so it can ignore it while the action runs.\n closeOnEsc: false,\n closeOnBackdropClick: false,\n role: 'alertdialog',\n ariaLabelledBy: ids.titleId,\n ariaDescribedBy: options.message ? ids.messageId : undefined,\n ...userConfig,\n context: { options, ...ids }\n })\n return new Promise((resolve) => dialogRef.onClose.subscribe((confirmed) => resolve(confirmed === true)))\n }\n\n protected createOverlay(config: NbDialogConfig): NbOverlayRef {\n const positionStrategy = this.createPositionStrategy(config)\n const scrollStrategy = this.createScrollStrategy(config.hasScroll)\n\n return this.overlay.create({\n positionStrategy,\n scrollStrategy,\n hasBackdrop: config.hasBackdrop,\n backdropClass: config.backdropClass,\n panelClass: config.dialogClass\n })\n }\n\n protected createPositionStrategy(config?: NbDialogConfig): NbGlobalPositionStrategy {\n const strategy = this.positionBuilder.global()\n const position = config?.position ?? 'center'\n const offset = config?.positionOffset ?? ''\n switch (position) {\n case 'center':\n return strategy.centerVertically().centerHorizontally()\n case 'top':\n return strategy.top(offset).centerHorizontally()\n case 'bottom':\n return strategy.bottom(offset).centerHorizontally()\n }\n // A physical corner, with start and end resolved for the layout direction.\n const [vertical, horizontal] = this.positionHelper.toPhysicalPosition(position as NbGlobalPosition).split('-')\n const placed = vertical === 'top' ? strategy.top(offset) : strategy.bottom(offset)\n return horizontal === 'left' ? placed.left(offset) : placed.right(offset)\n }\n\n protected createScrollStrategy(hasScroll: boolean): NbScrollStrategy {\n if (hasScroll) {\n return this.overlay.scrollStrategies.noop()\n } else {\n return this.overlay.scrollStrategies.block()\n }\n }\n\n protected createContainer(config: NbDialogConfig, overlayRef: NbOverlayRef): NbDialogContainerComponent {\n const injector = Injector.create({\n parent: this.createInjector(config),\n providers: [{ provide: NbDialogConfig, useValue: config }]\n })\n const containerPortal = new NbComponentPortal(NbDialogContainerComponent, null, injector)\n const containerRef = overlayRef.attach(containerPortal)\n return containerRef.instance\n }\n\n protected createContent<T, R>(config: NbDialogConfig,\n content: Type<T> | TemplateRef<T>,\n container: NbDialogContainerComponent,\n dialogRef: NbDialogRef<T, R>) {\n if (content instanceof TemplateRef) {\n const portal = this.createTemplatePortal(config, content, dialogRef)\n container.attachTemplatePortal(portal)\n } else {\n const portal = this.createComponentPortal(config, content, dialogRef)\n const componentRef = container.attachComponentPortal(portal)\n dialogRef.componentRef = componentRef\n\n if (config.context) {\n setComponentContext(componentRef, config.context)\n }\n }\n }\n\n protected createTemplatePortal<T, R>(config: NbDialogConfig,\n content: TemplateRef<unknown>,\n dialogRef: NbDialogRef<T, R>): NbTemplatePortal {\n return new NbTemplatePortal(content, undefined, { $implicit: config.context, dialogRef })\n }\n\n /**\n * The portal's injector, under the `viewContainerRef`'s or the service's, provides the `NbDialogRef` the dialog's\n * component injects.\n */\n protected createComponentPortal<T, R>(config: NbDialogConfig,\n content: Type<T>,\n dialogRef: NbDialogRef<T, R>): NbComponentPortal<T> {\n const injector = this.createInjector(config)\n const portalInjector = Injector.create({\n parent: injector,\n providers: [{ provide: NbDialogRef, useValue: dialogRef }]\n })\n return new NbComponentPortal(content, config.viewContainerRef, portalInjector)\n }\n\n protected createInjector(config: NbDialogConfig): Injector {\n return config.viewContainerRef && config.viewContainerRef.injector || this.injector\n }\n\n protected registerCloseListeners<T, R>(config: NbDialogConfig,\n overlayRef: NbOverlayRef,\n dialogRef: NbDialogRef<T, R>) {\n if (config.closeOnBackdropClick) {\n overlayRef.backdropClick().subscribe(() => dialogRef.close())\n }\n\n const router = this.router\n if (config.closeOnNavigation && router) {\n // The page a URL shows, without the query and fragment that apps change to keep state in the URL.\n const page = (url: string) => router.serializeUrl(new UrlTree(router.parseUrl(url).root))\n router.events\n .pipe(\n filter((event) => event instanceof NavigationStart && page(event.url) !== page(router.url)),\n takeUntil(dialogRef.onClose)\n )\n .subscribe(() => dialogRef.close())\n }\n }\n}\n","import { ModuleWithProviders, NgModule, EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'\n\nimport { NbOverlayModule } from '@liquid-js/lyr-core/cdk'\nimport { NbDialogService } from './dialog.service'\nimport { NbDialogContainerComponent } from './dialog-container'\nimport { NB_DIALOG_CONFIG, NbDialogConfig } from './dialog-config'\n\n/**\n * Provides the dialog service with default config, in place of `NbDialogModule.forRoot()`. In a lazy route's\n * providers it gives that route its own service, as `NbDialogModule.forChild()` does.\n */\nexport function provideNbDialog(dialogConfig: Partial<NbDialogConfig> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n NbDialogService,\n { provide: NB_DIALOG_CONFIG, useValue: dialogConfig }\n ])\n}\n\n@NgModule({\n imports: [NbOverlayModule, NbDialogContainerComponent]\n})\nexport class NbDialogModule {\n static forRoot(dialogConfig: Partial<NbDialogConfig> = {}): ModuleWithProviders<NbDialogModule> {\n return { ngModule: NbDialogModule, providers: [provideNbDialog(dialogConfig)] }\n }\n\n static forChild(dialogConfig: Partial<NbDialogConfig> = {}): ModuleWithProviders<NbDialogModule> {\n return { ngModule: NbDialogModule, providers: [provideNbDialog(dialogConfig)] }\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,mBAAmB,IAAI,eAA+B,wBAAwB;AAK3F,IAAa,iBAAb,MAA2B;CAkFvB,YAAY,QAAkC;EA9E9C,KAAA,cAAc;EAKd,KAAA,gBAAgB;EAKhB,KAAA,cAAc;EAKd,KAAA,uBAAuB;EAKvB,KAAA,aAAa;EAKb,KAAA,YAAY;EAMZ,KAAA,YAAY;EAcZ,KAAA,oBAAoB;EAMpB,KAAA,WAA6B;EAK7B,KAAA,iBAAiB;EAKjB,KAAA,OAAiC;EAkB7B,OAAO,OAAO,MAAM,MAAM;CAC9B;AACH;ACzFD,IAAa,cAAb,MAAwB;CAiBpB,YAAsB,YAAwB;EAAxB,KAAA,aAAA;EANZ,KAAA,WAAW,IAAI,QAAO;EAIvB,KAAA,UAAqC,KAAK,SAAS,aAAY;EAM9D,KAAA,UAAU;EAHhB,KAAK,kBAAkB,KAAK,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AA;GAAA,MAAA;GAAc,SAAA,CAFb,iBAAiB,0BAA0B;EAAA,CAAA;CAAA;CAE5C;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAc,SAAA,CAFb,eAAe;EAAA,CAAA;CAAA;;AAEhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAH1B,MAAA;EAAS,MAAA,CAAA,EACN,SAAS,CAAC,iBAAiB,0BAA0B,EACxD,CAAA"}
@@ -423,7 +423,7 @@ var NbFileDropComponent = class NbFileDropComponent {
423
423
  }],
424
424
  ngImport: i0,
425
425
  template: "<input #nativeInput\n type=\"file\"\n class=\"native-input visually-hidden\"\n tabindex=\"0\"\n [id]=\"id()\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"validation?.ariaInvalid()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-labelledby]=\"validation?.labelledBy()\"\n [attr.aria-required]=\"validation?.ariaRequired()\"\n (cancel)=\"onTouched()\"\n (change)=\"onSelected()\" />\n\n@if (files().length) {\n@if (preview(); as preview) {\n<ng-container *ngTemplateOutlet=\"preview.template; context: previewContext()\" />\n} @else {\n<ul class=\"file-list\"\n [id]=\"listId()\">\n @for (file of files(); track file) {\n <li class=\"file\">\n <span class=\"file-info\">\n <!-- A name aligns by its own direction, so a long one is cut at its end. -->\n <span class=\"file-name\"\n dir=\"auto\">{{ fileName(file) }}</span>\n @if (formatSize(file); as size) {\n <span class=\"file-size\">{{ size }}</span>\n }\n </span>\n <button type=\"button\"\n class=\"file-remove\"\n tabindex=\"0\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"texts().remove(fileName(file))\"\n (click)=\"remove(file); nativeInput.focus()\">\n <nb-icon icon=\"close-outline\"\n pack=\"essentials\" />\n </button>\n </li>\n }\n</ul>\n}\n}\n\n@if (!files().length || multiple()) {\n<div class=\"prompt\"\n [id]=\"promptId()\">\n <nb-icon icon=\"cloud-upload-outline\"\n pack=\"essentials\" />\n {{ resolvedPrompt() }}\n</div>\n}\n\n<span class=\"visually-hidden\"\n aria-live=\"polite\">{{ announcement() }}</span>\n\n<div class=\"drop-overlay\"\n aria-hidden=\"true\">{{ texts().dropHere }}</div>\n",
426
- styles: [":host{position:relative;display:flex;flex-direction:column;align-items:stretch;justify-content:center;cursor:pointer}:host.disabled{cursor:default}.prompt{display:flex;flex-direction:column;align-items:center;text-align:center}.file-list,.file{color:inherit;font:inherit}.file-list{list-style:none;margin:0;padding:0}.file{display:flex;align-items:center;gap:.5rem}.file-info{display:flex;flex:1;flex-direction:column;min-width:0}.file-name,.file-size{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.drop-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;opacity:0;pointer-events:none;transition:opacity .15s ease-out}:host(.drag-over) .drop-overlay{opacity:1}:host(.drag-over)>:not(.drop-overlay){visibility:hidden}@media(prefers-reduced-motion:reduce){.drop-overlay{transition:none}}.file-remove{display:flex;flex-shrink:0;margin-block:-.15em;margin-inline:0 .15em;padding:.15em;border:0;background:none;color:inherit;cursor:pointer;outline:none}.file-remove nb-icon{font-size:1.5em}.file-remove:disabled{cursor:default}\n"],
426
+ styles: [":host{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}:host.disabled{cursor:default}.prompt{align-self:stretch;display:flex;flex-direction:column;align-items:center;text-align:center}.file-list,.file{color:inherit;font:inherit}.file-list{align-self:stretch;list-style:none;margin:0;padding:0}.file{display:flex;align-items:center;gap:.5rem}.file-info{display:flex;flex:1;flex-direction:column;min-width:0}.file-name,.file-size{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.drop-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;opacity:0;pointer-events:none;transition:opacity .15s ease-out}:host(.drag-over) .drop-overlay{opacity:1}:host(.drag-over)>:not(.drop-overlay){visibility:hidden}@media(prefers-reduced-motion:reduce){.drop-overlay{transition:none}}.file-remove{display:flex;flex-shrink:0;margin-block:-.15em;margin-inline:0 .15em;padding:.15em;border:0;background:none;color:inherit;cursor:pointer;outline:none}.file-remove nb-icon{font-size:1.5em}.file-remove:disabled{cursor:default}\n"],
427
427
  dependencies: [{
428
428
  kind: "directive",
429
429
  type: NgTemplateOutlet,
@@ -481,7 +481,7 @@ i0.ɵɵngDeclareClassMetadata({
481
481
  "(focusout)": "onFocusOut($event)"
482
482
  },
483
483
  template: "<input #nativeInput\n type=\"file\"\n class=\"native-input visually-hidden\"\n tabindex=\"0\"\n [id]=\"id()\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"validation?.ariaInvalid()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-labelledby]=\"validation?.labelledBy()\"\n [attr.aria-required]=\"validation?.ariaRequired()\"\n (cancel)=\"onTouched()\"\n (change)=\"onSelected()\" />\n\n@if (files().length) {\n@if (preview(); as preview) {\n<ng-container *ngTemplateOutlet=\"preview.template; context: previewContext()\" />\n} @else {\n<ul class=\"file-list\"\n [id]=\"listId()\">\n @for (file of files(); track file) {\n <li class=\"file\">\n <span class=\"file-info\">\n <!-- A name aligns by its own direction, so a long one is cut at its end. -->\n <span class=\"file-name\"\n dir=\"auto\">{{ fileName(file) }}</span>\n @if (formatSize(file); as size) {\n <span class=\"file-size\">{{ size }}</span>\n }\n </span>\n <button type=\"button\"\n class=\"file-remove\"\n tabindex=\"0\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"texts().remove(fileName(file))\"\n (click)=\"remove(file); nativeInput.focus()\">\n <nb-icon icon=\"close-outline\"\n pack=\"essentials\" />\n </button>\n </li>\n }\n</ul>\n}\n}\n\n@if (!files().length || multiple()) {\n<div class=\"prompt\"\n [id]=\"promptId()\">\n <nb-icon icon=\"cloud-upload-outline\"\n pack=\"essentials\" />\n {{ resolvedPrompt() }}\n</div>\n}\n\n<span class=\"visually-hidden\"\n aria-live=\"polite\">{{ announcement() }}</span>\n\n<div class=\"drop-overlay\"\n aria-hidden=\"true\">{{ texts().dropHere }}</div>\n",
484
- styles: [":host{position:relative;display:flex;flex-direction:column;align-items:stretch;justify-content:center;cursor:pointer}:host.disabled{cursor:default}.prompt{display:flex;flex-direction:column;align-items:center;text-align:center}.file-list,.file{color:inherit;font:inherit}.file-list{list-style:none;margin:0;padding:0}.file{display:flex;align-items:center;gap:.5rem}.file-info{display:flex;flex:1;flex-direction:column;min-width:0}.file-name,.file-size{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.drop-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;opacity:0;pointer-events:none;transition:opacity .15s ease-out}:host(.drag-over) .drop-overlay{opacity:1}:host(.drag-over)>:not(.drop-overlay){visibility:hidden}@media(prefers-reduced-motion:reduce){.drop-overlay{transition:none}}.file-remove{display:flex;flex-shrink:0;margin-block:-.15em;margin-inline:0 .15em;padding:.15em;border:0;background:none;color:inherit;cursor:pointer;outline:none}.file-remove nb-icon{font-size:1.5em}.file-remove:disabled{cursor:default}\n"]
484
+ styles: [":host{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}:host.disabled{cursor:default}.prompt{align-self:stretch;display:flex;flex-direction:column;align-items:center;text-align:center}.file-list,.file{color:inherit;font:inherit}.file-list{align-self:stretch;list-style:none;margin:0;padding:0}.file{display:flex;align-items:center;gap:.5rem}.file-info{display:flex;flex:1;flex-direction:column;min-width:0}.file-name,.file-size{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.drop-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;opacity:0;pointer-events:none;transition:opacity .15s ease-out}:host(.drag-over) .drop-overlay{opacity:1}:host(.drag-over)>:not(.drop-overlay){visibility:hidden}@media(prefers-reduced-motion:reduce){.drop-overlay{transition:none}}.file-remove{display:flex;flex-shrink:0;margin-block:-.15em;margin-inline:0 .15em;padding:.15em;border:0;background:none;color:inherit;cursor:pointer;outline:none}.file-remove nb-icon{font-size:1.5em}.file-remove:disabled{cursor:default}\n"]
485
485
  }]
486
486
  }],
487
487
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"liquid-js-lyr-core-file-drop.mjs","names":["convertToBoolProperty","enableTransitionsAfterRender","sameControlValue"],"sources":["../../../packages/core/src/components/file-drop/file-drop.component.ts","../../../packages/core/src/components/file-drop/file-drop.component.html","../../../packages/core/src/components/file-drop/file-drop.module.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common'\nimport {\n Component,\n computed,\n contentChild,\n DestroyRef,\n Directive,\n ElementRef,\n forwardRef,\n inject,\n input,\n linkedSignal,\n LOCALE_ID,\n output,\n signal,\n TemplateRef,\n untracked,\n viewChild\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { injectNbDefaults, NbStatusService, NbComponentShape, NbComponentSize, NbComponentOrCustomStatus, ɵconvertToBoolProperty as convertToBoolProperty, NbBooleanInput, ɵenableTransitionsAfterRender as enableTransitionsAfterRender, injectNbTexts, NbLocalize, nbFormatList, ɵsameControlValue as sameControlValue } from '@liquid-js/lyr-core/base'\nimport { NbIconComponent } from '@liquid-js/lyr-core/icon'\nimport { NbValidationDirective } from '@liquid-js/lyr-core/validation'\n\n/** @internal */\ndeclare const $localize: NbLocalize\n\n/**\n * Why a file was not added: its type isn't accepted, it's larger than `maxSize`, or it's over `maxFiles`\n * (or a second file for a single-file drop).\n */\nexport type NbFileRejectionReason = 'type' | 'size' | 'count'\n\nexport interface NbFileRejection {\n file: File\n reason: NbFileRejectionReason\n}\n\n/**\n * What a `nbFileDropPreview` template gets.\n */\nexport interface NbFileDropPreviewContext<T = unknown> {\n /**\n * The files in the value: the `File`s the user added, and any other items the value was set to,\n * such as the URL of a file that is already uploaded.\n */\n $implicit: T[]\n /**\n * Removes a file from the value.\n */\n remove: (file: T) => void\n /**\n * A URL to show the file at, e.g. as an image: an object URL for a `File` (revoked when it's removed),\n * the item itself when it's a string, otherwise `undefined`.\n */\n url: (file: T) => string | undefined\n}\n\n/**\n * Shows the files of a `nb-file-drop` in place of its default list, e.g. as image previews.\n *\n * ```html\n * <ng-template nbFileDropPreview let-files let-remove=\"remove\" let-url=\"url\">\n * @for (file of files; track file) {\n * <img [src]=\"url(file)\" alt=\"\" />\n * }\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[nbFileDropPreview]'\n})\nexport class NbFileDropPreviewDirective {\n readonly template = inject<TemplateRef<NbFileDropPreviewContext>>(TemplateRef)\n\n static ngTemplateContextGuard(_dir: NbFileDropPreviewDirective, _ctx: unknown): _ctx is NbFileDropPreviewContext {\n return true\n }\n}\n\nlet lastFileDropId = 0\n\n/**\n * A form control for choosing files by dropping them, pasting them, or picking them in the browser's file dialog.\n *\n * ```html\n * <nb-file-drop formControlName=\"attachment\" accept=\"image/*,.pdf\" />\n * ```\n *\n * @stacked-example(Showcase, file-drop/file-drop-showcase.component)\n *\n * Drop zones come in the same sizes as other fields, which scale their width, spacing, text and buttons:\n * @stacked-example(Sizes, file-drop/file-drop-sizes.component)\n *\n * The value is a `File` (or `null`), or with `multiple` an array of them. Files that don't match `accept`, are larger\n * than `maxSize`, or are over `maxFiles` aren't added; `rejected` tells which and why.\n * @stacked-example(Multiple files and limits, file-drop/file-drop-multiple.component)\n *\n * Show the files your way with a `nbFileDropPreview` template; its `url` gives a URL to show a file at. The value\n * can also hold items that aren't `File`s, such as the URL of an image already uploaded, which the template shows too.\n * @stacked-example(Image preview, file-drop/file-drop-preview.component)\n *\n * The drop zone is operated with the keyboard through a native file input, which also takes the `id` for a label.\n * Add `nbValidation` to show its validation state.\n * @styles\n *\n * file-drop-border-style:\n * file-drop-border-width:\n * file-drop-tiny-padding:\n * file-drop-tiny-min-height:\n * file-drop-tiny-gap:\n * file-drop-tiny-icon-size:\n * file-drop-small-padding:\n * file-drop-small-min-height:\n * file-drop-small-gap:\n * file-drop-small-icon-size:\n * file-drop-medium-padding:\n * file-drop-medium-min-height:\n * file-drop-medium-gap:\n * file-drop-medium-icon-size:\n * file-drop-large-padding:\n * file-drop-large-min-height:\n * file-drop-large-gap:\n * file-drop-large-icon-size:\n * file-drop-giant-padding:\n * file-drop-giant-min-height:\n * file-drop-giant-gap:\n * file-drop-giant-icon-size:\n * file-drop-drag-background-color:\n * file-drop-drag-border-color:\n * file-drop-drag-text-color:\n * file-drop-remove-highlight-color:\n * file-drop-remove-hover-background-color:\n * file-drop-remove-focus-background-color:\n * file-drop-remove-active-background-color:\n * file-drop-remove-outline-width:\n * file-drop-remove-outline-color:\n * file-drop-remove-border-radius:\n */\n@Component({\n selector: 'nb-file-drop',\n templateUrl: './file-drop.component.html',\n styleUrls: ['./file-drop.component.scss'],\n imports: [NgTemplateOutlet, NbIconComponent],\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NbFileDropComponent), multi: true }],\n host: {\n // The id goes to the native input, which labels point at; the host keeps none, so it isn't duplicated.\n '[attr.id]': 'null',\n '[class]': 'hostClasses()',\n '[class.full-width]': 'fullWidth()',\n // With the default list, the remove buttons sit at the end edge, as a form field's suffix button does.\n '[class.has-file-list]': 'files().length > 0 && !preview()',\n '[class.disabled]': 'isDisabled()',\n '[class.focused]': 'focused()',\n '[class.drag-over]': 'dragOver()',\n '(click)': 'onClick($event)',\n '(dragenter)': 'onDragEnter($event)',\n '(dragover)': 'onDragOver($event)',\n '(dragleave)': 'onDragLeave()',\n '(drop)': 'onDrop($event)',\n '(paste)': 'onPaste($event)',\n // The whole field shows focus, wherever in it the focus is, as a select does.\n '(focusin)': 'focused.set(true)',\n '(focusout)': 'onFocusOut($event)'\n }\n})\nexport class NbFileDropComponent implements ControlValueAccessor {\n // The app's defaults for this type, which the inputs below start from.\n protected readonly nbDefaults = injectNbDefaults('fileDrop')\n\n protected readonly hostElement = inject<ElementRef<HTMLElement>>(ElementRef)\n protected readonly statusService = inject(NbStatusService)\n protected readonly locale = inject(LOCALE_ID)\n protected readonly texts = injectNbTexts('fileDrop', () => ({\n prompt: $localize`:@@nb.fileDrop.prompt:Drop a file here or click to choose one`,\n promptMultiple: $localize`:@@nb.fileDrop.promptMultiple:Drop files here or click to choose them`,\n dropHere: $localize`:@@nb.fileDrop.dropHere:Drop to add`,\n remove: (name) => $localize`:@@nb.fileDrop.remove:Remove ${name}:name:`,\n added: (names) => $localize`:@@nb.fileDrop.added:Added ${names}:names:`,\n notAdded: (names) => $localize`:@@nb.fileDrop.notAdded:Couldn't add ${names}:names:`\n }))\n protected readonly validation = inject(NbValidationDirective, { self: true, optional: true })\n protected readonly sizeFormat = new Intl.NumberFormat(inject(LOCALE_ID), { maximumFractionDigits: 1 })\n\n /**\n * Id of the native file input, for a `<label for>`.\n */\n readonly id = input(`nb-file-drop-${lastFileDropId++}`)\n\n /**\n * File types to accept, as for a native file input: MIME types (`image/png`), wildcards (`image/*`) and\n * extensions (`.pdf`), separated by commas. Accepts every file when empty.\n */\n readonly accept = input('')\n\n /**\n * Whether the value is a list of files the user adds to, instead of one file the user replaces.\n */\n readonly multiple = input<boolean, NbBooleanInput>(false, { transform: convertToBoolProperty })\n\n /**\n * The largest file to accept, in bytes.\n */\n readonly maxSize = input<number>()\n\n /**\n * With `multiple`, the most files the value can hold.\n */\n readonly maxFiles = input<number>()\n\n /**\n * Scales the drop zone as other fields: `tiny`, `small`, `medium` (default), `large`, `giant`.\n */\n readonly sizeInput = input<NbComponentSize | undefined>(undefined, { alias: 'size' })\n /** The size in use: the input's, the app's default, or 'medium'. */\n readonly size = linkedSignal<NbComponentSize>(() => this.sizeInput() ?? this.nbDefaults().size ?? 'medium')\n\n /**\n * Status of the drop zone: `basic` (default), `primary`, `success`, `info`, `warning`, `danger`, `control` or a\n * custom one. With `nbValidation`, its error or success status takes over.\n */\n readonly status = input<NbComponentOrCustomStatus>('basic')\n\n /**\n * Shape of the drop zone: `rectangle`, `semi-round` or `round`. Unset, it follows the app's default, or\n * `rectangle`.\n */\n readonly shapeInput = input<NbComponentShape | undefined>(undefined, { alias: 'shape' })\n /** The shape in use: the input's, the app's default, or 'rectangle'. */\n readonly shape = linkedSignal<NbComponentShape>(() => this.shapeInput() ?? this.nbDefaults().shape ?? 'rectangle')\n\n /**\n * If set, the drop zone fills its container, as other fields do with `fullWidth`.\n */\n readonly fullWidth = input<boolean, NbBooleanInput>(false, { transform: convertToBoolProperty })\n\n /**\n * Disables the drop zone; a form control's disabled state does too.\n */\n readonly disabled = input<boolean, NbBooleanInput>(false, { transform: convertToBoolProperty })\n\n /**\n * What to drop, e.g. \"Drop your logo here\". Defaults to the `fileDrop` texts of `NbTextsService`.\n */\n readonly prompt = input<string>()\n\n /**\n * Files the user tried to add that weren't added, and why.\n */\n readonly rejected = output<NbFileRejection[]>()\n\n protected readonly preview = contentChild(NbFileDropPreviewDirective)\n protected readonly nativeInput = viewChild.required<ElementRef<HTMLInputElement>>('nativeInput')\n\n /**\n * The files in the value.\n */\n readonly files = signal(new Array<unknown>())\n\n protected readonly focused = signal(false)\n protected readonly announcement = signal('')\n protected readonly dragOver = signal(false)\n /** Whether it's disabled: the `disabled` input, or the form's disabled state, whichever changed last. */\n readonly isDisabled = linkedSignal(() => this.disabled())\n\n // With `nbValidation`, the status it gives while the control shows errors or success.\n protected readonly resolvedStatus = computed(() => this.validation?.status() ?? this.status())\n\n protected readonly hostClasses = computed(() => [\n `size-${this.size()}`,\n this.statusService.getStatusClass(this.resolvedStatus()),\n `shape-${this.shape()}`\n ])\n\n protected readonly resolvedPrompt = computed(\n () => this.prompt() ?? (this.multiple() ? this.texts().promptMultiple : this.texts().prompt)\n )\n protected readonly promptId = computed(() => `${this.id()}-prompt`)\n protected readonly listId = computed(() => `${this.id()}-files`)\n // The prompt says what the input does when there is no label, and the list which files it has; errors from\n // `nbValidation` come after them.\n protected readonly describedBy = computed(() =>\n [this.promptId(), this.files().length && !this.preview() ? this.listId() : '', this.validation?.describedBy()]\n .filter(Boolean)\n .join(' ')\n )\n\n protected readonly previewContext = computed<NbFileDropPreviewContext>(() => ({\n $implicit: this.files(),\n remove: (file) => this.remove(file),\n url: (file) => this.url(file)\n }))\n\n // Dragging over child elements fires dragleave on the parent, so count entries to know when the drag really left.\n protected dragDepth = 0\n protected readonly objectUrls = new Map<File, string>()\n protected onChange: (value: unknown) => void = () => undefined\n protected onTouched = () => {}\n\n constructor() {\n this.validation?.delegateAria()\n enableTransitionsAfterRender(this.hostElement.nativeElement)\n inject(DestroyRef).onDestroy(() => this.objectUrls.forEach((url) => URL.revokeObjectURL(url)))\n }\n\n /**\n * Adds files as if the user dropped them: only the accepted ones, replacing the file of a single-file drop.\n */\n addFiles(candidates: File[]) {\n if (this.isDisabled() || !candidates.length) {\n return\n }\n const rejections = new Array<NbFileRejection>()\n const accepted = new Array<File>()\n const room = this.multiple() ? (this.maxFiles() ?? Infinity) - this.files().length : 1\n for (const file of candidates) {\n const reason = this.rejectionReason(file)\n if (reason) {\n rejections.push({ file, reason })\n } else if (accepted.length >= room) {\n rejections.push({ file, reason: 'count' })\n } else {\n accepted.push(file)\n }\n }\n if (accepted.length) {\n if (this.multiple()) {\n this.setFiles([...this.files(), ...accepted])\n } else {\n this.setFiles(accepted)\n }\n }\n if (rejections.length) {\n this.rejected.emit(rejections)\n }\n // The native input is cleared after each choice, so screen readers would otherwise not hear what happened.\n const names = (files: File[]) => files.map((file) => file.name)\n this.announcement.set(\n [\n accepted.length ? this.texts().added(nbFormatList(this.locale, names(accepted))) : '',\n rejections.length\n ? this.texts().notAdded(nbFormatList(this.locale, names(rejections.map(({ file }) => file))))\n : ''\n ]\n .filter(Boolean)\n .join('. ')\n )\n }\n\n /**\n * Removes a file from the value, unless the drop zone is disabled.\n */\n remove(file: unknown) {\n if (!this.isDisabled()) {\n this.setFiles(this.files().filter((existing) => existing !== file))\n }\n }\n\n /**\n * Opens the browser's file dialog.\n */\n open() {\n if (!this.isDisabled()) {\n // Focused, as a click on a field focuses it, so leaving it touches the control, as does cancelling the dialog.\n const field = this.nativeInput().nativeElement\n field.focus({ preventScroll: true })\n field.click()\n }\n }\n\n // Untracked, as forms write values from wherever the app sets them, e.g. an effect that mustn't come to depend\n // on the control.\n writeValue(value: unknown) {\n untracked(() => {\n const files = value == null ? [] : Array.isArray(value) ? [...value] : [value]\n if (!sameControlValue(this.files(), files)) {\n this.files.set(files)\n }\n this.revokeUnused()\n })\n }\n\n registerOnChange(fn: (value: unknown) => void) {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void) {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean) {\n this.isDisabled.set(isDisabled)\n }\n\n protected setFiles(files: unknown[]) {\n this.files.set(files)\n this.revokeUnused()\n this.onChange(this.multiple() ? files : (files[0] ?? null))\n this.onTouched()\n }\n\n protected url(file: unknown): string | undefined {\n if (typeof file === 'string') {\n return file\n }\n if (!(file instanceof File)) {\n return undefined\n }\n let url = this.objectUrls.get(file)\n if (!url) {\n url = URL.createObjectURL(file)\n this.objectUrls.set(file, url)\n }\n return url\n }\n\n protected revokeUnused() {\n const files = this.files()\n for (const [file, url] of this.objectUrls) {\n if (!files.includes(file)) {\n URL.revokeObjectURL(url)\n this.objectUrls.delete(file)\n }\n }\n }\n\n protected rejectionReason(file: File): NbFileRejectionReason | undefined {\n const maxSize = this.maxSize()\n if (!this.isAccepted(file)) {\n return 'type'\n }\n if (maxSize !== undefined && file.size > maxSize) {\n return 'size'\n }\n return undefined\n }\n\n // The same rules as the native accept attribute: a file is accepted when it matches any of the entries.\n protected isAccepted(file: File): boolean {\n const entries = this.accept()\n .split(',')\n .map((entry) => entry.trim().toLowerCase())\n .filter(Boolean)\n if (!entries.length) {\n return true\n }\n const name = file.name.toLowerCase()\n const type = file.type.toLowerCase()\n return entries.some((entry) => {\n if (entry.startsWith('.')) {\n return name.endsWith(entry)\n }\n if (entry.endsWith('/*')) {\n return type.startsWith(entry.slice(0, -1))\n }\n return type === entry\n })\n }\n\n protected formatSize(file: unknown): string {\n if (!(file instanceof File)) {\n return ''\n }\n const units = ['B', 'KB', 'MB', 'GB']\n let size = file.size\n let unit = 0\n while (size >= 1024 && unit < units.length - 1) {\n size /= 1024\n unit++\n }\n return `${this.sizeFormat.format(size)} ${units[unit]}`\n }\n\n protected fileName(file: unknown): string {\n if (file instanceof File) {\n return file.name\n }\n return typeof file === 'string' ? (file.split('/').pop() ?? file) : String(file)\n }\n\n protected onClick(event: MouseEvent) {\n // Buttons and links in the files, such as remove, do their own thing; the input opens the dialog itself.\n const target = event.target as Element\n if (target.closest('button, a, input') === null) {\n this.open()\n }\n }\n\n protected onFocusOut(event: FocusEvent) {\n // Moving between the input and the remove buttons stays inside the field.\n if (!this.hostElement.nativeElement.contains(event.relatedTarget as Node | null)) {\n this.focused.set(false)\n this.onTouched()\n }\n }\n\n protected onSelected() {\n const nativeInput = this.nativeInput().nativeElement\n this.addFiles(Array.from(nativeInput.files ?? []))\n // Clear it, so choosing the same file again still reports a change.\n nativeInput.value = ''\n }\n\n protected onDragEnter(event: DragEvent) {\n if (this.hasFiles(event)) {\n event.preventDefault()\n this.dragDepth++\n this.dragOver.set(true)\n }\n }\n\n protected onDragOver(event: DragEvent) {\n if (this.hasFiles(event) && event.dataTransfer) {\n event.preventDefault()\n event.dataTransfer.dropEffect = this.isDisabled() ? 'none' : 'copy'\n }\n }\n\n protected onDragLeave() {\n this.dragDepth = Math.max(0, this.dragDepth - 1)\n if (!this.dragDepth) {\n this.dragOver.set(false)\n }\n }\n\n protected onDrop(event: DragEvent) {\n if (!this.hasFiles(event)) {\n return\n }\n event.preventDefault()\n this.dragDepth = 0\n this.dragOver.set(false)\n this.addFiles(Array.from(event.dataTransfer?.files ?? []))\n }\n\n protected onPaste(event: ClipboardEvent) {\n const files = Array.from(event.clipboardData?.files ?? [])\n if (files.length) {\n event.preventDefault()\n this.addFiles(files)\n }\n }\n\n protected hasFiles(event: DragEvent): boolean {\n return !!event.dataTransfer?.types.includes('Files')\n }\n}\n","<input #nativeInput\n type=\"file\"\n class=\"native-input visually-hidden\"\n tabindex=\"0\"\n [id]=\"id()\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"validation?.ariaInvalid()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-labelledby]=\"validation?.labelledBy()\"\n [attr.aria-required]=\"validation?.ariaRequired()\"\n (cancel)=\"onTouched()\"\n (change)=\"onSelected()\" />\n\n@if (files().length) {\n@if (preview(); as preview) {\n<ng-container *ngTemplateOutlet=\"preview.template; context: previewContext()\" />\n} @else {\n<ul class=\"file-list\"\n [id]=\"listId()\">\n @for (file of files(); track file) {\n <li class=\"file\">\n <span class=\"file-info\">\n <!-- A name aligns by its own direction, so a long one is cut at its end. -->\n <span class=\"file-name\"\n dir=\"auto\">{{ fileName(file) }}</span>\n @if (formatSize(file); as size) {\n <span class=\"file-size\">{{ size }}</span>\n }\n </span>\n <button type=\"button\"\n class=\"file-remove\"\n tabindex=\"0\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"texts().remove(fileName(file))\"\n (click)=\"remove(file); nativeInput.focus()\">\n <nb-icon icon=\"close-outline\"\n pack=\"essentials\" />\n </button>\n </li>\n }\n</ul>\n}\n}\n\n@if (!files().length || multiple()) {\n<div class=\"prompt\"\n [id]=\"promptId()\">\n <nb-icon icon=\"cloud-upload-outline\"\n pack=\"essentials\" />\n {{ resolvedPrompt() }}\n</div>\n}\n\n<span class=\"visually-hidden\"\n aria-live=\"polite\">{{ announcement() }}</span>\n\n<div class=\"drop-overlay\"\n aria-hidden=\"true\">{{ texts().dropHere }}</div>\n","import { NgModule } from '@angular/core'\n\nimport { NbFileDropComponent, NbFileDropPreviewDirective } from './file-drop.component'\n\nconst COMPONENTS = [NbFileDropComponent, NbFileDropPreviewDirective]\n\n@NgModule({\n imports: [...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gB;CAAhB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAhB;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,SAAA,CANT,qBAAqB,0BAA0B;GAAA,SAAA,CAA/C,qBAAqB,0BAA0B;EAAA,CAAA;CAAA;CAMtD;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,SAAA,CANT,mBAAmB;EAAA,CAAA;CAAA;;AAM1B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAJ5B,MAAA;EAAS,MAAA,CAAA;GACN,SAAS,CAAC,GAAG,UAAU;GACvB,SAAS,CAAC,GAAG,UAAU;EAC1B,CAAA"}
1
+ {"version":3,"file":"liquid-js-lyr-core-file-drop.mjs","names":["convertToBoolProperty","enableTransitionsAfterRender","sameControlValue"],"sources":["../../../packages/core/src/components/file-drop/file-drop.component.ts","../../../packages/core/src/components/file-drop/file-drop.component.html","../../../packages/core/src/components/file-drop/file-drop.module.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common'\nimport {\n Component,\n computed,\n contentChild,\n DestroyRef,\n Directive,\n ElementRef,\n forwardRef,\n inject,\n input,\n linkedSignal,\n LOCALE_ID,\n output,\n signal,\n TemplateRef,\n untracked,\n viewChild\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\nimport { injectNbDefaults, NbStatusService, NbComponentShape, NbComponentSize, NbComponentOrCustomStatus, ɵconvertToBoolProperty as convertToBoolProperty, NbBooleanInput, ɵenableTransitionsAfterRender as enableTransitionsAfterRender, injectNbTexts, NbLocalize, nbFormatList, ɵsameControlValue as sameControlValue } from '@liquid-js/lyr-core/base'\nimport { NbIconComponent } from '@liquid-js/lyr-core/icon'\nimport { NbValidationDirective } from '@liquid-js/lyr-core/validation'\n\n/** @internal */\ndeclare const $localize: NbLocalize\n\n/**\n * Why a file was not added: its type isn't accepted, it's larger than `maxSize`, or it's over `maxFiles`\n * (or a second file for a single-file drop).\n */\nexport type NbFileRejectionReason = 'type' | 'size' | 'count'\n\nexport interface NbFileRejection {\n file: File\n reason: NbFileRejectionReason\n}\n\n/**\n * What a `nbFileDropPreview` template gets.\n */\nexport interface NbFileDropPreviewContext<T = unknown> {\n /**\n * The files in the value: the `File`s the user added, and any other items the value was set to,\n * such as the URL of a file that is already uploaded.\n */\n $implicit: T[]\n /**\n * Removes a file from the value.\n */\n remove: (file: T) => void\n /**\n * A URL to show the file at, e.g. as an image: an object URL for a `File` (revoked when it's removed),\n * the item itself when it's a string, otherwise `undefined`.\n */\n url: (file: T) => string | undefined\n}\n\n/**\n * Shows the files of a `nb-file-drop` in place of its default list, e.g. as image previews.\n *\n * ```html\n * <ng-template nbFileDropPreview let-files let-remove=\"remove\" let-url=\"url\">\n * @for (file of files; track file) {\n * <img [src]=\"url(file)\" alt=\"\" />\n * }\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[nbFileDropPreview]'\n})\nexport class NbFileDropPreviewDirective {\n readonly template = inject<TemplateRef<NbFileDropPreviewContext>>(TemplateRef)\n\n static ngTemplateContextGuard(_dir: NbFileDropPreviewDirective, _ctx: unknown): _ctx is NbFileDropPreviewContext {\n return true\n }\n}\n\nlet lastFileDropId = 0\n\n/**\n * A form control for choosing files by dropping them, pasting them, or picking them in the browser's file dialog.\n *\n * ```html\n * <nb-file-drop formControlName=\"attachment\" accept=\"image/*,.pdf\" />\n * ```\n *\n * @stacked-example(Showcase, file-drop/file-drop-showcase.component)\n *\n * Drop zones come in the same sizes as other fields, which scale their width, spacing, text and buttons:\n * @stacked-example(Sizes, file-drop/file-drop-sizes.component)\n *\n * The value is a `File` (or `null`), or with `multiple` an array of them. Files that don't match `accept`, are larger\n * than `maxSize`, or are over `maxFiles` aren't added; `rejected` tells which and why.\n * @stacked-example(Multiple files and limits, file-drop/file-drop-multiple.component)\n *\n * Show the files your way with a `nbFileDropPreview` template; its `url` gives a URL to show a file at. The value\n * can also hold items that aren't `File`s, such as the URL of an image already uploaded, which the template shows too.\n * @stacked-example(Image preview, file-drop/file-drop-preview.component)\n *\n * The drop zone is operated with the keyboard through a native file input, which also takes the `id` for a label.\n * Add `nbValidation` to show its validation state.\n * @styles\n *\n * file-drop-border-style:\n * file-drop-border-width:\n * file-drop-tiny-padding:\n * file-drop-tiny-min-height:\n * file-drop-tiny-gap:\n * file-drop-tiny-icon-size:\n * file-drop-small-padding:\n * file-drop-small-min-height:\n * file-drop-small-gap:\n * file-drop-small-icon-size:\n * file-drop-medium-padding:\n * file-drop-medium-min-height:\n * file-drop-medium-gap:\n * file-drop-medium-icon-size:\n * file-drop-large-padding:\n * file-drop-large-min-height:\n * file-drop-large-gap:\n * file-drop-large-icon-size:\n * file-drop-giant-padding:\n * file-drop-giant-min-height:\n * file-drop-giant-gap:\n * file-drop-giant-icon-size:\n * file-drop-drag-background-color:\n * file-drop-drag-border-color:\n * file-drop-drag-text-color:\n * file-drop-remove-highlight-color:\n * file-drop-remove-hover-background-color:\n * file-drop-remove-focus-background-color:\n * file-drop-remove-active-background-color:\n * file-drop-remove-outline-width:\n * file-drop-remove-outline-color:\n * file-drop-remove-border-radius:\n */\n@Component({\n selector: 'nb-file-drop',\n templateUrl: './file-drop.component.html',\n styleUrls: ['./file-drop.component.scss'],\n imports: [NgTemplateOutlet, NbIconComponent],\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NbFileDropComponent), multi: true }],\n host: {\n // The id goes to the native input, which labels point at; the host keeps none, so it isn't duplicated.\n '[attr.id]': 'null',\n '[class]': 'hostClasses()',\n '[class.full-width]': 'fullWidth()',\n // With the default list, the remove buttons sit at the end edge, as a form field's suffix button does.\n '[class.has-file-list]': 'files().length > 0 && !preview()',\n '[class.disabled]': 'isDisabled()',\n '[class.focused]': 'focused()',\n '[class.drag-over]': 'dragOver()',\n '(click)': 'onClick($event)',\n '(dragenter)': 'onDragEnter($event)',\n '(dragover)': 'onDragOver($event)',\n '(dragleave)': 'onDragLeave()',\n '(drop)': 'onDrop($event)',\n '(paste)': 'onPaste($event)',\n // The whole field shows focus, wherever in it the focus is, as a select does.\n '(focusin)': 'focused.set(true)',\n '(focusout)': 'onFocusOut($event)'\n }\n})\nexport class NbFileDropComponent implements ControlValueAccessor {\n // The app's defaults for this type, which the inputs below start from.\n protected readonly nbDefaults = injectNbDefaults('fileDrop')\n\n protected readonly hostElement = inject<ElementRef<HTMLElement>>(ElementRef)\n protected readonly statusService = inject(NbStatusService)\n protected readonly locale = inject(LOCALE_ID)\n protected readonly texts = injectNbTexts('fileDrop', () => ({\n prompt: $localize`:@@nb.fileDrop.prompt:Drop a file here or click to choose one`,\n promptMultiple: $localize`:@@nb.fileDrop.promptMultiple:Drop files here or click to choose them`,\n dropHere: $localize`:@@nb.fileDrop.dropHere:Drop to add`,\n remove: (name) => $localize`:@@nb.fileDrop.remove:Remove ${name}:name:`,\n added: (names) => $localize`:@@nb.fileDrop.added:Added ${names}:names:`,\n notAdded: (names) => $localize`:@@nb.fileDrop.notAdded:Couldn't add ${names}:names:`\n }))\n protected readonly validation = inject(NbValidationDirective, { self: true, optional: true })\n protected readonly sizeFormat = new Intl.NumberFormat(inject(LOCALE_ID), { maximumFractionDigits: 1 })\n\n /**\n * Id of the native file input, for a `<label for>`.\n */\n readonly id = input(`nb-file-drop-${lastFileDropId++}`)\n\n /**\n * File types to accept, as for a native file input: MIME types (`image/png`), wildcards (`image/*`) and\n * extensions (`.pdf`), separated by commas. Accepts every file when empty.\n */\n readonly accept = input('')\n\n /**\n * Whether the value is a list of files the user adds to, instead of one file the user replaces.\n */\n readonly multiple = input<boolean, NbBooleanInput>(false, { transform: convertToBoolProperty })\n\n /**\n * The largest file to accept, in bytes.\n */\n readonly maxSize = input<number>()\n\n /**\n * With `multiple`, the most files the value can hold.\n */\n readonly maxFiles = input<number>()\n\n /**\n * Scales the drop zone as other fields: `tiny`, `small`, `medium` (default), `large`, `giant`.\n */\n readonly sizeInput = input<NbComponentSize | undefined>(undefined, { alias: 'size' })\n /** The size in use: the input's, the app's default, or 'medium'. */\n readonly size = linkedSignal<NbComponentSize>(() => this.sizeInput() ?? this.nbDefaults().size ?? 'medium')\n\n /**\n * Status of the drop zone: `basic` (default), `primary`, `success`, `info`, `warning`, `danger`, `control` or a\n * custom one. With `nbValidation`, its error or success status takes over.\n */\n readonly status = input<NbComponentOrCustomStatus>('basic')\n\n /**\n * Shape of the drop zone: `rectangle`, `semi-round` or `round`. Unset, it follows the app's default, or\n * `rectangle`.\n */\n readonly shapeInput = input<NbComponentShape | undefined>(undefined, { alias: 'shape' })\n /** The shape in use: the input's, the app's default, or 'rectangle'. */\n readonly shape = linkedSignal<NbComponentShape>(() => this.shapeInput() ?? this.nbDefaults().shape ?? 'rectangle')\n\n /**\n * If set, the drop zone fills its container, as other fields do with `fullWidth`.\n */\n readonly fullWidth = input<boolean, NbBooleanInput>(false, { transform: convertToBoolProperty })\n\n /**\n * Disables the drop zone; a form control's disabled state does too.\n */\n readonly disabled = input<boolean, NbBooleanInput>(false, { transform: convertToBoolProperty })\n\n /**\n * What to drop, e.g. \"Drop your logo here\". Defaults to the `fileDrop` texts of `NbTextsService`.\n */\n readonly prompt = input<string>()\n\n /**\n * Files the user tried to add that weren't added, and why.\n */\n readonly rejected = output<NbFileRejection[]>()\n\n protected readonly preview = contentChild(NbFileDropPreviewDirective)\n protected readonly nativeInput = viewChild.required<ElementRef<HTMLInputElement>>('nativeInput')\n\n /**\n * The files in the value.\n */\n readonly files = signal(new Array<unknown>())\n\n protected readonly focused = signal(false)\n protected readonly announcement = signal('')\n protected readonly dragOver = signal(false)\n /** Whether it's disabled: the `disabled` input, or the form's disabled state, whichever changed last. */\n readonly isDisabled = linkedSignal(() => this.disabled())\n\n // With `nbValidation`, the status it gives while the control shows errors or success.\n protected readonly resolvedStatus = computed(() => this.validation?.status() ?? this.status())\n\n protected readonly hostClasses = computed(() => [\n `size-${this.size()}`,\n this.statusService.getStatusClass(this.resolvedStatus()),\n `shape-${this.shape()}`\n ])\n\n protected readonly resolvedPrompt = computed(\n () => this.prompt() ?? (this.multiple() ? this.texts().promptMultiple : this.texts().prompt)\n )\n protected readonly promptId = computed(() => `${this.id()}-prompt`)\n protected readonly listId = computed(() => `${this.id()}-files`)\n // The prompt says what the input does when there is no label, and the list which files it has; errors from\n // `nbValidation` come after them.\n protected readonly describedBy = computed(() =>\n [this.promptId(), this.files().length && !this.preview() ? this.listId() : '', this.validation?.describedBy()]\n .filter(Boolean)\n .join(' ')\n )\n\n protected readonly previewContext = computed<NbFileDropPreviewContext>(() => ({\n $implicit: this.files(),\n remove: (file) => this.remove(file),\n url: (file) => this.url(file)\n }))\n\n // Dragging over child elements fires dragleave on the parent, so count entries to know when the drag really left.\n protected dragDepth = 0\n protected readonly objectUrls = new Map<File, string>()\n protected onChange: (value: unknown) => void = () => undefined\n protected onTouched = () => {}\n\n constructor() {\n this.validation?.delegateAria()\n enableTransitionsAfterRender(this.hostElement.nativeElement)\n inject(DestroyRef).onDestroy(() => this.objectUrls.forEach((url) => URL.revokeObjectURL(url)))\n }\n\n /**\n * Adds files as if the user dropped them: only the accepted ones, replacing the file of a single-file drop.\n */\n addFiles(candidates: File[]) {\n if (this.isDisabled() || !candidates.length) {\n return\n }\n const rejections = new Array<NbFileRejection>()\n const accepted = new Array<File>()\n const room = this.multiple() ? (this.maxFiles() ?? Infinity) - this.files().length : 1\n for (const file of candidates) {\n const reason = this.rejectionReason(file)\n if (reason) {\n rejections.push({ file, reason })\n } else if (accepted.length >= room) {\n rejections.push({ file, reason: 'count' })\n } else {\n accepted.push(file)\n }\n }\n if (accepted.length) {\n if (this.multiple()) {\n this.setFiles([...this.files(), ...accepted])\n } else {\n this.setFiles(accepted)\n }\n }\n if (rejections.length) {\n this.rejected.emit(rejections)\n }\n // The native input is cleared after each choice, so screen readers would otherwise not hear what happened.\n const names = (files: File[]) => files.map((file) => file.name)\n this.announcement.set(\n [\n accepted.length ? this.texts().added(nbFormatList(this.locale, names(accepted))) : '',\n rejections.length\n ? this.texts().notAdded(nbFormatList(this.locale, names(rejections.map(({ file }) => file))))\n : ''\n ]\n .filter(Boolean)\n .join('. ')\n )\n }\n\n /**\n * Removes a file from the value, unless the drop zone is disabled.\n */\n remove(file: unknown) {\n if (!this.isDisabled()) {\n this.setFiles(this.files().filter((existing) => existing !== file))\n }\n }\n\n /**\n * Opens the browser's file dialog.\n */\n open() {\n if (!this.isDisabled()) {\n // Focused, as a click on a field focuses it, so leaving it touches the control, as does cancelling the dialog.\n const field = this.nativeInput().nativeElement\n field.focus({ preventScroll: true })\n field.click()\n }\n }\n\n // Untracked, as forms write values from wherever the app sets them, e.g. an effect that mustn't come to depend\n // on the control.\n writeValue(value: unknown) {\n untracked(() => {\n const files = value == null ? [] : Array.isArray(value) ? [...value] : [value]\n if (!sameControlValue(this.files(), files)) {\n this.files.set(files)\n }\n this.revokeUnused()\n })\n }\n\n registerOnChange(fn: (value: unknown) => void) {\n this.onChange = fn\n }\n\n registerOnTouched(fn: () => void) {\n this.onTouched = fn\n }\n\n setDisabledState(isDisabled: boolean) {\n this.isDisabled.set(isDisabled)\n }\n\n protected setFiles(files: unknown[]) {\n this.files.set(files)\n this.revokeUnused()\n this.onChange(this.multiple() ? files : (files[0] ?? null))\n this.onTouched()\n }\n\n protected url(file: unknown): string | undefined {\n if (typeof file === 'string') {\n return file\n }\n if (!(file instanceof File)) {\n return undefined\n }\n let url = this.objectUrls.get(file)\n if (!url) {\n url = URL.createObjectURL(file)\n this.objectUrls.set(file, url)\n }\n return url\n }\n\n protected revokeUnused() {\n const files = this.files()\n for (const [file, url] of this.objectUrls) {\n if (!files.includes(file)) {\n URL.revokeObjectURL(url)\n this.objectUrls.delete(file)\n }\n }\n }\n\n protected rejectionReason(file: File): NbFileRejectionReason | undefined {\n const maxSize = this.maxSize()\n if (!this.isAccepted(file)) {\n return 'type'\n }\n if (maxSize !== undefined && file.size > maxSize) {\n return 'size'\n }\n return undefined\n }\n\n // The same rules as the native accept attribute: a file is accepted when it matches any of the entries.\n protected isAccepted(file: File): boolean {\n const entries = this.accept()\n .split(',')\n .map((entry) => entry.trim().toLowerCase())\n .filter(Boolean)\n if (!entries.length) {\n return true\n }\n const name = file.name.toLowerCase()\n const type = file.type.toLowerCase()\n return entries.some((entry) => {\n if (entry.startsWith('.')) {\n return name.endsWith(entry)\n }\n if (entry.endsWith('/*')) {\n return type.startsWith(entry.slice(0, -1))\n }\n return type === entry\n })\n }\n\n protected formatSize(file: unknown): string {\n if (!(file instanceof File)) {\n return ''\n }\n const units = ['B', 'KB', 'MB', 'GB']\n let size = file.size\n let unit = 0\n while (size >= 1024 && unit < units.length - 1) {\n size /= 1024\n unit++\n }\n return `${this.sizeFormat.format(size)} ${units[unit]}`\n }\n\n protected fileName(file: unknown): string {\n if (file instanceof File) {\n return file.name\n }\n return typeof file === 'string' ? (file.split('/').pop() ?? file) : String(file)\n }\n\n protected onClick(event: MouseEvent) {\n // Buttons and links in the files, such as remove, do their own thing; the input opens the dialog itself.\n const target = event.target as Element\n if (target.closest('button, a, input') === null) {\n this.open()\n }\n }\n\n protected onFocusOut(event: FocusEvent) {\n // Moving between the input and the remove buttons stays inside the field.\n if (!this.hostElement.nativeElement.contains(event.relatedTarget as Node | null)) {\n this.focused.set(false)\n this.onTouched()\n }\n }\n\n protected onSelected() {\n const nativeInput = this.nativeInput().nativeElement\n this.addFiles(Array.from(nativeInput.files ?? []))\n // Clear it, so choosing the same file again still reports a change.\n nativeInput.value = ''\n }\n\n protected onDragEnter(event: DragEvent) {\n if (this.hasFiles(event)) {\n event.preventDefault()\n this.dragDepth++\n this.dragOver.set(true)\n }\n }\n\n protected onDragOver(event: DragEvent) {\n if (this.hasFiles(event) && event.dataTransfer) {\n event.preventDefault()\n event.dataTransfer.dropEffect = this.isDisabled() ? 'none' : 'copy'\n }\n }\n\n protected onDragLeave() {\n this.dragDepth = Math.max(0, this.dragDepth - 1)\n if (!this.dragDepth) {\n this.dragOver.set(false)\n }\n }\n\n protected onDrop(event: DragEvent) {\n if (!this.hasFiles(event)) {\n return\n }\n event.preventDefault()\n this.dragDepth = 0\n this.dragOver.set(false)\n this.addFiles(Array.from(event.dataTransfer?.files ?? []))\n }\n\n protected onPaste(event: ClipboardEvent) {\n const files = Array.from(event.clipboardData?.files ?? [])\n if (files.length) {\n event.preventDefault()\n this.addFiles(files)\n }\n }\n\n protected hasFiles(event: DragEvent): boolean {\n return !!event.dataTransfer?.types.includes('Files')\n }\n}\n","<input #nativeInput\n type=\"file\"\n class=\"native-input visually-hidden\"\n tabindex=\"0\"\n [id]=\"id()\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-invalid]=\"validation?.ariaInvalid()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-labelledby]=\"validation?.labelledBy()\"\n [attr.aria-required]=\"validation?.ariaRequired()\"\n (cancel)=\"onTouched()\"\n (change)=\"onSelected()\" />\n\n@if (files().length) {\n@if (preview(); as preview) {\n<ng-container *ngTemplateOutlet=\"preview.template; context: previewContext()\" />\n} @else {\n<ul class=\"file-list\"\n [id]=\"listId()\">\n @for (file of files(); track file) {\n <li class=\"file\">\n <span class=\"file-info\">\n <!-- A name aligns by its own direction, so a long one is cut at its end. -->\n <span class=\"file-name\"\n dir=\"auto\">{{ fileName(file) }}</span>\n @if (formatSize(file); as size) {\n <span class=\"file-size\">{{ size }}</span>\n }\n </span>\n <button type=\"button\"\n class=\"file-remove\"\n tabindex=\"0\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"texts().remove(fileName(file))\"\n (click)=\"remove(file); nativeInput.focus()\">\n <nb-icon icon=\"close-outline\"\n pack=\"essentials\" />\n </button>\n </li>\n }\n</ul>\n}\n}\n\n@if (!files().length || multiple()) {\n<div class=\"prompt\"\n [id]=\"promptId()\">\n <nb-icon icon=\"cloud-upload-outline\"\n pack=\"essentials\" />\n {{ resolvedPrompt() }}\n</div>\n}\n\n<span class=\"visually-hidden\"\n aria-live=\"polite\">{{ announcement() }}</span>\n\n<div class=\"drop-overlay\"\n aria-hidden=\"true\">{{ texts().dropHere }}</div>\n","import { NgModule } from '@angular/core'\n\nimport { NbFileDropComponent, NbFileDropPreviewDirective } from './file-drop.component'\n\nconst COMPONENTS = [NbFileDropComponent, NbFileDropPreviewDirective]\n\n@NgModule({\n imports: [...COMPONENTS],\n exports: [...COMPONENTS]\n})\nexport class NbFileDropModule {}\n"],"mappings":";;;;;;;AAyEA,IAAa,6BAAb,MAAa,2BAA0B;CAHvC,cAAA;EAIa,KAAA,WAAW,OAA8C,WAAW;CAKhF;CAHG,OAAO,uBAAuB,MAAkC,MAAa;EACzE,OAAO;CACX;CALS;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA0B,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAA1B;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAA0B,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAA1B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA0B,YAAA,CAAA;EAHtC,MAAA;EAAU,MAAA,CAAA,EACP,UAAU,iCACb,CAAA;;;AASD,IAAI,iBAAiB;AAsFrB,IAAa,sBAAb,MAAa,oBAAmB;CAqI5B,cAAA;EAnImB,KAAA,aAAa,iBAAiB,UAAU;EAExC,KAAA,cAAc,OAAgC,UAAU;EACxD,KAAA,gBAAgB,OAAO,eAAe;EACt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,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,0BAA0B,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACc,eAAa,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AEzPnG,MAAM,aAAa,CAAC,qBAAqB,0BAA0B;AAMnE,IAAa,mBAAb,MAAa,iBAAgB;CAAhB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAhB;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,SAAA,CANT,qBAAqB,0BAA0B;GAAA,SAAA,CAA/C,qBAAqB,0BAA0B;EAAA,CAAA;CAAA;CAMtD;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,SAAA,CANT,mBAAmB;EAAA,CAAA;CAAA;;AAM1B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAJ5B,MAAA;EAAS,MAAA,CAAA;GACN,SAAS,CAAC,GAAG,UAAU;GACvB,SAAS,CAAC,GAAG,UAAU;EAC1B,CAAA"}
@@ -198,7 +198,7 @@ var NbFormFieldComponent = class NbFormFieldComponent {
198
198
  onCleanup(() => {
199
199
  this.resizeObserver?.unobserve(element);
200
200
  this.addonProperties.delete(element);
201
- host.style.removeProperty(property);
201
+ if (!host.contains(element)) host.style.removeProperty(property);
202
202
  });
203
203
  });
204
204
  }
@@ -1 +1 @@
1
- {"version":3,"file":"liquid-js-lyr-core-form-field.mjs","names":["enableTransitionsAfterRender"],"sources":["../../../packages/core/src/components/form-field/prefix.directive.ts","../../../packages/core/src/components/form-field/suffix.directive.ts","../../../packages/core/src/components/form-field/form-field-control.ts","../../../packages/core/src/components/form-field/form-field.component.ts","../../../packages/core/src/components/form-field/form-field.component.html","../../../packages/core/src/components/form-field/form-field.module.ts"],"sourcesContent":["import { Directive } from '@angular/core'\n\n/**\n * Marks content of an `nb-form-field` to show before its control, e.g. an icon.\n */\n@Directive({ selector: '[nbPrefix]' })\nexport class NbPrefixDirective {\n}\n","import { Directive } from '@angular/core'\n\n/**\n * Marks content of an `nb-form-field` to show after its control, e.g. a button that shows a password.\n */\n@Directive({ selector: '[nbSuffix]' })\nexport class NbSuffixDirective {\n}\n","import { Signal, Service } from '@angular/core'\nimport { NbComponentOrCustomStatus, NbComponentSize } from '@liquid-js/lyr-core/base'\n\n/**\n * Provided by a control that an `nb-form-field` can hold, such as `nbInput` or `nb-select`, with the state the field\n * renders its size and addons by: `{ provide: NbFormFieldControl, useExisting: MyControl }`.\n */\n@Service({ autoProvided: false })\nexport abstract class NbFormFieldControl {\n /**\n * The control's state, which the form field renders its size and addons with.\n */\n abstract readonly controlState: Signal<NbFormControlState>\n}\n\n/**\n * Provided next to `NbFormFieldControl` by a control that doesn't take a prefix or a suffix, e.g. `nb-select`, whose\n * arrow is at its end.\n */\n@Service({ autoProvided: false })\nexport class NbFormFieldControlConfig {\n supportsPrefix = true\n supportsSuffix = true\n}\n\nexport interface NbFormControlState {\n status: NbComponentOrCustomStatus\n size: NbComponentSize\n fullWidth: boolean\n focused: boolean\n disabled: boolean\n}\n","import {\n AfterContentChecked,\n afterRenderEffect,\n Component,\n computed,\n contentChild,\n contentChildren,\n DestroyRef,\n ElementRef,\n inject,\n NgZone,\n Signal,\n viewChild\n} from '@angular/core'\n\nimport { ɵenableTransitionsAfterRender as enableTransitionsAfterRender } from '@liquid-js/lyr-core/base'\nimport { NbPrefixDirective } from './prefix.directive'\nimport { NbSuffixDirective } from './suffix.directive'\nimport { NbFormFieldControl, NbFormControlState, NbFormFieldControlConfig } from './form-field-control'\n\nexport type NbFormControlAddon = 'prefix' | 'suffix'\n\nfunction throwFormControlElementNotFound() {\n throw new Error('NbFormFieldComponent must contain [nbInput]')\n}\n\n/**\n * Shows content before and after a control, such as `nbInput`: an icon, a button or text marked `nbPrefix` or\n * `nbSuffix`.\n *\n * Addons are at least `form-field-addon-{size}-width` wide, and grow to fit their content, e.g. a unit or a URL\n * scheme; the control's padding follows their width.\n *\n * @styles\n *\n * form-field-addon-basic-text-color:\n * form-field-addon-basic-highlight-text-color:\n * form-field-addon-primary-text-color:\n * form-field-addon-primary-highlight-text-color:\n * form-field-addon-success-text-color:\n * form-field-addon-success-highlight-text-color:\n * form-field-addon-info-text-color:\n * form-field-addon-info-highlight-text-color:\n * form-field-addon-warning-text-color:\n * form-field-addon-warning-highlight-text-color:\n * form-field-addon-danger-text-color:\n * form-field-addon-danger-highlight-text-color:\n * form-field-addon-control-text-color:\n * form-field-addon-control-highlight-text-color:\n * form-field-addon-disabled-text-color:\n * form-field-addon-tiny-height:\n * form-field-addon-tiny-width:\n * form-field-tiny-width:\n * form-field-small-width:\n * form-field-medium-width:\n * form-field-large-width:\n * form-field-giant-width:\n * form-field-tiny-max-width:\n * form-field-small-max-width:\n * form-field-medium-max-width:\n * form-field-large-max-width:\n * form-field-giant-max-width:\n * form-field-addon-tiny-icon-size:\n * form-field-addon-tiny-font-size:\n * form-field-addon-tiny-line-height:\n * form-field-addon-tiny-font-weight:\n * form-field-addon-small-height:\n * form-field-addon-small-width:\n * form-field-addon-small-icon-size:\n * form-field-addon-small-font-size:\n * form-field-addon-small-line-height:\n * form-field-addon-small-font-weight:\n * form-field-addon-medium-height:\n * form-field-addon-medium-width:\n * form-field-addon-medium-icon-size:\n * form-field-addon-medium-font-size:\n * form-field-addon-medium-line-height:\n * form-field-addon-medium-font-weight:\n * form-field-addon-large-height:\n * form-field-addon-large-width:\n * form-field-addon-large-icon-size:\n * form-field-addon-large-font-size:\n * form-field-addon-large-line-height:\n * form-field-addon-large-font-weight:\n * form-field-addon-giant-height:\n * form-field-addon-giant-width:\n * form-field-addon-giant-icon-size:\n * form-field-addon-giant-font-size:\n * form-field-addon-giant-line-height:\n * form-field-addon-giant-font-weight:\n **/\n@Component({\n selector: 'nb-form-field',\n styleUrls: ['./form-field.component.scss'],\n templateUrl: './form-field.component.html',\n host: {\n '[class]': 'formFieldClasses()'\n }\n})\nexport class NbFormFieldComponent implements AfterContentChecked {\n protected readonly elementRef = inject(ElementRef)\n\n readonly prefix = contentChildren(NbPrefixDirective, { descendants: true })\n readonly suffix = contentChildren(NbSuffixDirective, { descendants: true })\n\n readonly formControl = contentChild(NbFormFieldControl)\n readonly formControlConfig = contentChild(NbFormFieldControlConfig)\n\n protected readonly formControlState = computed(() => this.formControl()?.controlState(), {\n equal: (oldState, state) => this.isStatesEqual(oldState, state)\n })\n\n protected readonly formFieldClasses = computed(() => {\n const state = this.formControlState()\n if (!state) {\n return []\n }\n return [`nb-form-field-size-${state.size}`, ...(state.fullWidth ? [] : ['nb-form-field-limited-width'])]\n })\n\n readonly shouldShowPrefix = computed(() => this.getFormControlConfig().supportsPrefix && !!this.prefix().length)\n readonly shouldShowSuffix = computed(() => this.getFormControlConfig().supportsSuffix && !!this.suffix().length)\n\n readonly prefixClasses = computed(() => this.getAddonClasses('prefix', this.formControlState()))\n readonly suffixClasses = computed(() => this.getAddonClasses('suffix', this.formControlState()))\n\n protected readonly prefixElement = viewChild<ElementRef<HTMLElement>>('prefixAddon')\n protected readonly suffixElement = viewChild<ElementRef<HTMLElement>>('suffixAddon')\n protected readonly zone = inject(NgZone)\n protected resizeObserver?: ResizeObserver\n protected readonly addonProperties = new Map<Element, string>()\n\n constructor() {\n enableTransitionsAfterRender(this.elementRef.nativeElement)\n this.observeAddonWidth(this.prefixElement, '--nb-form-field-prefix-width')\n this.observeAddonWidth(this.suffixElement, '--nb-form-field-suffix-width')\n inject(DestroyRef).onDestroy(() => this.resizeObserver?.disconnect())\n }\n\n ngAfterContentChecked() {\n if (!this.formControl()) {\n throwFormControlElementNotFound()\n }\n }\n\n protected getAddonClasses(addon: NbFormControlAddon, state?: NbFormControlState): string[] {\n if (!state) {\n return []\n }\n const classes = [\n 'nb-form-field-addon',\n `nb-form-field-${addon}-${state.size}`\n ]\n\n if (state.disabled) {\n classes.push('nb-form-field-addon-disabled')\n } else if (state.focused) {\n classes.push(`nb-form-field-addon-${state.status}-highlight`)\n } else {\n classes.push(`nb-form-field-addon-${state.status}`)\n }\n\n return classes\n }\n\n // The control is padded by the addon's width, which the theme uses as a fallback until it's measured.\n protected observeAddonWidth(addon: Signal<ElementRef<HTMLElement> | undefined>, property: string) {\n afterRenderEffect((onCleanup) => {\n const element = addon()?.nativeElement\n if (!element || typeof ResizeObserver === 'undefined') {\n return\n }\n const host: HTMLElement = this.elementRef.nativeElement\n this.zone.runOutsideAngular(() => {\n this.resizeObserver ??= new ResizeObserver((entries) => {\n for (const entry of entries) {\n const name = this.addonProperties.get(entry.target)\n if (name) {\n host.style.setProperty(name, `${entry.borderBoxSize[0].inlineSize}px`)\n }\n }\n })\n this.addonProperties.set(element, property)\n this.resizeObserver.observe(element)\n })\n onCleanup(() => {\n this.resizeObserver?.unobserve(element)\n this.addonProperties.delete(element)\n host.style.removeProperty(property)\n })\n })\n }\n\n protected getFormControlConfig(): NbFormFieldControlConfig {\n return this.formControlConfig() || new NbFormFieldControlConfig()\n }\n\n protected isStatesEqual(oldState?: NbFormControlState, state?: NbFormControlState): boolean {\n return oldState?.status === state?.status &&\n oldState?.disabled === state?.disabled &&\n oldState?.focused === state?.focused &&\n oldState?.fullWidth === state?.fullWidth &&\n oldState?.size === state?.size\n }\n}\n","@if (shouldShowPrefix()) {\n<div #prefixAddon\n [class]=\"prefixClasses()\">\n <ng-content select=\"[nbPrefix]\" />\n</div>\n}\n\n<div class=\"nb-form-control-container\"\n [class.nb-form-field-control-with-prefix]=\"shouldShowPrefix()\"\n [class.nb-form-field-control-with-suffix]=\"shouldShowSuffix()\">\n <ng-content />\n</div>\n\n@if (shouldShowSuffix()) {\n<div #suffixAddon\n [class]=\"suffixClasses()\">\n <ng-content select=\"[nbSuffix]\" />\n</div>\n}\n","import { NgModule } from '@angular/core'\n\nimport { NbFormFieldComponent } from './form-field.component'\nimport { NbPrefixDirective } from './prefix.directive'\nimport { NbSuffixDirective } from './suffix.directive'\n\nconst COMPONENTS = [\n NbFormFieldComponent,\n NbPrefixDirective,\n NbSuffixDirective\n]\n\n@NgModule({\n imports: [...COMPONENTS],\n exports: [...COMPONENTS]\n})\nexport class NbFormFieldModule {\n}\n"],"mappings":";;;AAMA,IAAa,oBAAb,MAAa,kBAAiB;CAAjB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAiB,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAjB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAD7B,MAAA;EAAU,MAAA,CAAA,EAAE,UAAU,aAAY,CAAE;;;ACCrC,IAAa,oBAAb,MAAa,kBAAiB;CAAjB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAA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;GAAA,MAAA,CACb,eAAa,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AEzHvF,MAAM,aAAa;CACf;CACA;CACA;AACH;AAMD,IAAa,oBAAb,MAAa,kBAAiB;CAAjB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjB;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiB,SAAA;IAT1B;IACA;IACA;GAAiB;GAAA,SAAA;IAFjB;IACA;IACA;GAAiB;EAAA,CAAA;CAAA;CAOR;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAiB,CAAA;CAAA;;AAAjB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAJ7B,MAAA;EAAS,MAAA,CAAA;GACN,SAAS,CAAC,GAAG,UAAU;GACvB,SAAS,CAAC,GAAG,UAAU;EAC1B,CAAA"}
1
+ {"version":3,"file":"liquid-js-lyr-core-form-field.mjs","names":["enableTransitionsAfterRender"],"sources":["../../../packages/core/src/components/form-field/prefix.directive.ts","../../../packages/core/src/components/form-field/suffix.directive.ts","../../../packages/core/src/components/form-field/form-field-control.ts","../../../packages/core/src/components/form-field/form-field.component.ts","../../../packages/core/src/components/form-field/form-field.component.html","../../../packages/core/src/components/form-field/form-field.module.ts"],"sourcesContent":["import { Directive } from '@angular/core'\n\n/**\n * Marks content of an `nb-form-field` to show before its control, e.g. an icon.\n */\n@Directive({ selector: '[nbPrefix]' })\nexport class NbPrefixDirective {\n}\n","import { Directive } from '@angular/core'\n\n/**\n * Marks content of an `nb-form-field` to show after its control, e.g. a button that shows a password.\n */\n@Directive({ selector: '[nbSuffix]' })\nexport class NbSuffixDirective {\n}\n","import { Signal, Service } from '@angular/core'\nimport { NbComponentOrCustomStatus, NbComponentSize } from '@liquid-js/lyr-core/base'\n\n/**\n * Provided by a control that an `nb-form-field` can hold, such as `nbInput` or `nb-select`, with the state the field\n * renders its size and addons by: `{ provide: NbFormFieldControl, useExisting: MyControl }`.\n */\n@Service({ autoProvided: false })\nexport abstract class NbFormFieldControl {\n /**\n * The control's state, which the form field renders its size and addons with.\n */\n abstract readonly controlState: Signal<NbFormControlState>\n}\n\n/**\n * Provided next to `NbFormFieldControl` by a control that doesn't take a prefix or a suffix, e.g. `nb-select`, whose\n * arrow is at its end.\n */\n@Service({ autoProvided: false })\nexport class NbFormFieldControlConfig {\n supportsPrefix = true\n supportsSuffix = true\n}\n\nexport interface NbFormControlState {\n status: NbComponentOrCustomStatus\n size: NbComponentSize\n fullWidth: boolean\n focused: boolean\n disabled: boolean\n}\n","import {\n AfterContentChecked,\n afterRenderEffect,\n Component,\n computed,\n contentChild,\n contentChildren,\n DestroyRef,\n ElementRef,\n inject,\n NgZone,\n Signal,\n viewChild\n} from '@angular/core'\n\nimport { ɵenableTransitionsAfterRender as enableTransitionsAfterRender } from '@liquid-js/lyr-core/base'\nimport { NbPrefixDirective } from './prefix.directive'\nimport { NbSuffixDirective } from './suffix.directive'\nimport { NbFormFieldControl, NbFormControlState, NbFormFieldControlConfig } from './form-field-control'\n\nexport type NbFormControlAddon = 'prefix' | 'suffix'\n\nfunction throwFormControlElementNotFound() {\n throw new Error('NbFormFieldComponent must contain [nbInput]')\n}\n\n/**\n * Shows content before and after a control, such as `nbInput`: an icon, a button or text marked `nbPrefix` or\n * `nbSuffix`.\n *\n * Addons are at least `form-field-addon-{size}-width` wide, and grow to fit their content, e.g. a unit or a URL\n * scheme; the control's padding follows their width.\n *\n * @styles\n *\n * form-field-addon-basic-text-color:\n * form-field-addon-basic-highlight-text-color:\n * form-field-addon-primary-text-color:\n * form-field-addon-primary-highlight-text-color:\n * form-field-addon-success-text-color:\n * form-field-addon-success-highlight-text-color:\n * form-field-addon-info-text-color:\n * form-field-addon-info-highlight-text-color:\n * form-field-addon-warning-text-color:\n * form-field-addon-warning-highlight-text-color:\n * form-field-addon-danger-text-color:\n * form-field-addon-danger-highlight-text-color:\n * form-field-addon-control-text-color:\n * form-field-addon-control-highlight-text-color:\n * form-field-addon-disabled-text-color:\n * form-field-addon-tiny-height:\n * form-field-addon-tiny-width:\n * form-field-tiny-width:\n * form-field-small-width:\n * form-field-medium-width:\n * form-field-large-width:\n * form-field-giant-width:\n * form-field-tiny-max-width:\n * form-field-small-max-width:\n * form-field-medium-max-width:\n * form-field-large-max-width:\n * form-field-giant-max-width:\n * form-field-addon-tiny-icon-size:\n * form-field-addon-tiny-font-size:\n * form-field-addon-tiny-line-height:\n * form-field-addon-tiny-font-weight:\n * form-field-addon-small-height:\n * form-field-addon-small-width:\n * form-field-addon-small-icon-size:\n * form-field-addon-small-font-size:\n * form-field-addon-small-line-height:\n * form-field-addon-small-font-weight:\n * form-field-addon-medium-height:\n * form-field-addon-medium-width:\n * form-field-addon-medium-icon-size:\n * form-field-addon-medium-font-size:\n * form-field-addon-medium-line-height:\n * form-field-addon-medium-font-weight:\n * form-field-addon-large-height:\n * form-field-addon-large-width:\n * form-field-addon-large-icon-size:\n * form-field-addon-large-font-size:\n * form-field-addon-large-line-height:\n * form-field-addon-large-font-weight:\n * form-field-addon-giant-height:\n * form-field-addon-giant-width:\n * form-field-addon-giant-icon-size:\n * form-field-addon-giant-font-size:\n * form-field-addon-giant-line-height:\n * form-field-addon-giant-font-weight:\n **/\n@Component({\n selector: 'nb-form-field',\n styleUrls: ['./form-field.component.scss'],\n templateUrl: './form-field.component.html',\n host: {\n '[class]': 'formFieldClasses()'\n }\n})\nexport class NbFormFieldComponent implements AfterContentChecked {\n protected readonly elementRef = inject(ElementRef)\n\n readonly prefix = contentChildren(NbPrefixDirective, { descendants: true })\n readonly suffix = contentChildren(NbSuffixDirective, { descendants: true })\n\n readonly formControl = contentChild(NbFormFieldControl)\n readonly formControlConfig = contentChild(NbFormFieldControlConfig)\n\n protected readonly formControlState = computed(() => this.formControl()?.controlState(), {\n equal: (oldState, state) => this.isStatesEqual(oldState, state)\n })\n\n protected readonly formFieldClasses = computed(() => {\n const state = this.formControlState()\n if (!state) {\n return []\n }\n return [`nb-form-field-size-${state.size}`, ...(state.fullWidth ? [] : ['nb-form-field-limited-width'])]\n })\n\n readonly shouldShowPrefix = computed(() => this.getFormControlConfig().supportsPrefix && !!this.prefix().length)\n readonly shouldShowSuffix = computed(() => this.getFormControlConfig().supportsSuffix && !!this.suffix().length)\n\n readonly prefixClasses = computed(() => this.getAddonClasses('prefix', this.formControlState()))\n readonly suffixClasses = computed(() => this.getAddonClasses('suffix', this.formControlState()))\n\n protected readonly prefixElement = viewChild<ElementRef<HTMLElement>>('prefixAddon')\n protected readonly suffixElement = viewChild<ElementRef<HTMLElement>>('suffixAddon')\n protected readonly zone = inject(NgZone)\n protected resizeObserver?: ResizeObserver\n protected readonly addonProperties = new Map<Element, string>()\n\n constructor() {\n enableTransitionsAfterRender(this.elementRef.nativeElement)\n this.observeAddonWidth(this.prefixElement, '--nb-form-field-prefix-width')\n this.observeAddonWidth(this.suffixElement, '--nb-form-field-suffix-width')\n inject(DestroyRef).onDestroy(() => this.resizeObserver?.disconnect())\n }\n\n ngAfterContentChecked() {\n if (!this.formControl()) {\n throwFormControlElementNotFound()\n }\n }\n\n protected getAddonClasses(addon: NbFormControlAddon, state?: NbFormControlState): string[] {\n if (!state) {\n return []\n }\n const classes = [\n 'nb-form-field-addon',\n `nb-form-field-${addon}-${state.size}`\n ]\n\n if (state.disabled) {\n classes.push('nb-form-field-addon-disabled')\n } else if (state.focused) {\n classes.push(`nb-form-field-addon-${state.status}-highlight`)\n } else {\n classes.push(`nb-form-field-addon-${state.status}`)\n }\n\n return classes\n }\n\n // The control is padded by the addon's width, which the theme uses as a fallback until it's measured.\n protected observeAddonWidth(addon: Signal<ElementRef<HTMLElement> | undefined>, property: string) {\n afterRenderEffect((onCleanup) => {\n const element = addon()?.nativeElement\n if (!element || typeof ResizeObserver === 'undefined') {\n return\n }\n const host: HTMLElement = this.elementRef.nativeElement\n this.zone.runOutsideAngular(() => {\n this.resizeObserver ??= new ResizeObserver((entries) => {\n for (const entry of entries) {\n const name = this.addonProperties.get(entry.target)\n if (name) {\n host.style.setProperty(name, `${entry.borderBoxSize[0].inlineSize}px`)\n }\n }\n })\n this.addonProperties.set(element, property)\n this.resizeObserver.observe(element)\n })\n onCleanup(() => {\n this.resizeObserver?.unobserve(element)\n this.addonProperties.delete(element)\n // Kept while the addon is still in the field, as when the field leaves with an animation, so the control\n // keeps its padding until it's gone.\n if (!host.contains(element)) {\n host.style.removeProperty(property)\n }\n })\n })\n }\n\n protected getFormControlConfig(): NbFormFieldControlConfig {\n return this.formControlConfig() || new NbFormFieldControlConfig()\n }\n\n protected isStatesEqual(oldState?: NbFormControlState, state?: NbFormControlState): boolean {\n return oldState?.status === state?.status &&\n oldState?.disabled === state?.disabled &&\n oldState?.focused === state?.focused &&\n oldState?.fullWidth === state?.fullWidth &&\n oldState?.size === state?.size\n }\n}\n","@if (shouldShowPrefix()) {\n<div #prefixAddon\n [class]=\"prefixClasses()\">\n <ng-content select=\"[nbPrefix]\" />\n</div>\n}\n\n<div class=\"nb-form-control-container\"\n [class.nb-form-field-control-with-prefix]=\"shouldShowPrefix()\"\n [class.nb-form-field-control-with-suffix]=\"shouldShowSuffix()\">\n <ng-content />\n</div>\n\n@if (shouldShowSuffix()) {\n<div #suffixAddon\n [class]=\"suffixClasses()\">\n <ng-content select=\"[nbSuffix]\" />\n</div>\n}\n","import { NgModule } from '@angular/core'\n\nimport { NbFormFieldComponent } from './form-field.component'\nimport { NbPrefixDirective } from './prefix.directive'\nimport { NbSuffixDirective } from './suffix.directive'\n\nconst COMPONENTS = [\n NbFormFieldComponent,\n NbPrefixDirective,\n NbSuffixDirective\n]\n\n@NgModule({\n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