@magmonium/one 0.4.70 → 0.4.71

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.
@@ -5,8 +5,8 @@ import { t as ButtonComponent } from "./magmonium-one-button-CKHBcCoO.mjs";
5
5
  import { t as assetOptions } from "./magmonium-one-options-asset-BNd1hbLw.mjs";
6
6
  import "./magmonium-one-directives-DM6J1Hvs.mjs";
7
7
  import { t as BaseInputComponent } from "./magmonium-one-base-input-B92NOmxz.mjs";
8
- import { t as TextOutputComponent } from "./magmonium-one-text-output-M8sEPhFz.mjs";
9
- import { t as TextInputComponent } from "./magmonium-one-text-CuKE9S8T.mjs";
8
+ import { t as TextOutputComponent } from "./magmonium-one-text-output-E6pe3IOL.mjs";
9
+ import { t as TextInputComponent } from "./magmonium-one-text-BMdY3Ryk.mjs";
10
10
  import * as i0 from "@angular/core";
11
11
  import { ChangeDetectionStrategy, Component, Directive, ElementRef, computed, effect, inject, input, inputBinding, linkedSignal, model, output, outputBinding, signal, viewChild } from "@angular/core";
12
12
  var DropdownBoxComponent = class DropdownBoxComponent {
@@ -603,4 +603,4 @@ i0.ɵɵngDeclareClassMetadata({
603
603
  });
604
604
  export { DROPDOWN_IMPORTS as n, DROPDOWN_TEMPLATE as r, BaseDropdownComponent as t };
605
605
 
606
- //# sourceMappingURL=magmonium-one-base-dropdown-DMgBZ3oa.mjs.map
606
+ //# sourceMappingURL=magmonium-one-base-dropdown-9gvOPGo2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-base-dropdown-DMgBZ3oa.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/dropdown/dropdown-box.ts","../../../../libs/one/src/lib/shared/ui/input/ui/dropdown/base-dropdown.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { TranslatePipe } from '../../../../pipe/translate';\nimport { DropdownOption, DropdownValue } from '../../model/input';\n\n@Component({\n selector: 'm-dropdown-box',\n imports: [TranslatePipe],\n template: `\n <ul class=\"dropdown-box\" role=\"listbox\">\n @for (option of options(); track option.value; let i = $index) {\n @let selectedState = isSelected(option.value);\n <li\n class=\"dropdown-box__option\"\n [class.dropdown-box__option--selected]=\"selectedState\"\n [class.dropdown-box__option--disabled]=\"option.disabled\"\n [class.dropdown-box__option--active]=\"i === activeIndex()\"\n [style.--m-dropdown-option-depth]=\"option.depth\"\n role=\"option\"\n [attr.aria-selected]=\"selectedState\"\n [attr.data-value]=\"option.value\"\n (click)=\"selectOption(option)\"\n (keydown.enter)=\"selectOption(option)\"\n tabindex=\"0\"\n >\n <!-- A group header is a row, never a choice: no box to tick. -->\n @if (multiple() && !option.disabled) {\n <input\n type=\"checkbox\"\n class=\"dropdown-box__checkbox\"\n [checked]=\"selectedState\"\n tabindex=\"-1\"\n (click)=\"$event.preventDefault()\"\n />\n }\n @if (option.noTranslate) {\n {{ option.label }}\n } @else {\n {{ option.label | translate }}\n }\n </li>\n } @empty {\n <li class=\"dropdown-box__empty\">\n {{ 'no-results-found' | translate }}\n </li>\n }\n </ul>\n `,\n styleUrl: './dropdown-box.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DropdownBoxComponent {\n readonly options = input<DropdownOption<DropdownValue>[]>([]);\n /** The values ticked, as a list whichever Field drew the panel. */\n readonly selected = input<readonly DropdownValue[]>([]);\n readonly multiple = input<boolean>(false);\n readonly activeIndex = input<number>(-1);\n readonly action = output<DropdownOption<DropdownValue>>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n // Keep the keyboard-active option in view as ↑/↓ walk a scrolled list.\n constructor() {\n effect(() => {\n const index = this.activeIndex();\n if (index < 0) return;\n this.host.nativeElement\n .querySelectorAll('.dropdown-box__option')\n [index]?.scrollIntoView?.({ block: 'nearest' });\n });\n }\n\n protected readonly isSelected = (value: DropdownValue): boolean =>\n this.selected().includes(value);\n\n // Only emit a selection event for enabled options.\n protected readonly selectOption = (\n option: DropdownOption<DropdownValue>\n ): void => {\n if (option.disabled) return;\n this.action.emit(option);\n };\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n inputBinding,\n linkedSignal,\n model,\n outputBinding,\n Signal,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseInputComponent } from '../../lib/base-input';\nimport { Button } from '../../../button/type/button';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { TranslateService } from '../../../../services';\nimport { SelectorConfig, SelectorDirective } from '../../../../directives';\nimport { Direction } from '../../../../directives/selector/selector-type';\nimport { DropdownBoxComponent } from './dropdown-box';\nimport {\n DropdownInput,\n DropdownOption,\n DropdownValue,\n TextInput,\n} from '../../model/input';\nimport { TextInputComponent } from '../text/text';\nimport { assetOptions } from '../../lib/options-asset';\n\n/** The trigger both option Fields draw: a searchable text input and a chevron. */\nexport const DROPDOWN_TEMPLATE = `\n @if (config(); as dropdown) {\n @if (dropdown.label) {\n <m-label\n [for]=\"dropdown.name ?? ''\"\n [placeholder]=\"dropdown.label\"\n [params]=\"dropdown.params\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n }\n <div\n class=\"trigger-wrap\"\n #wrapper\n [mSelector]=\"selectorConfig()\"\n [disabled]=\"disabled() || readonly() || !!config()?.readonly\"\n (opened)=\"onOpened()\"\n (closed)=\"onClosed()\"\n (focusin)=\"isFocused.set(true)\"\n (focusout)=\"isFocused.set(false)\"\n >\n <m-text-input\n [config]=\"triggerInputConfig()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled()\"\n [invalid]=\"invalid()\"\n [hideErrors]=\"true\"\n [(touched)]=\"touched\"\n [focused]=\"focused()\"\n (valueChange)=\"onInput($event)\"\n (click)=\"preventToggleWhenOpen($event)\"\n (keydown.space)=\"$event.stopPropagation()\"\n (keydown.enter)=\"onEnter($event)\"\n (keydown.arrowdown)=\"onArrow($event, 1)\"\n (keydown.arrowup)=\"onArrow($event, -1)\"\n (keydown.tab)=\"$event.stopPropagation()\"\n />\n <m-button [disabled]=\"disabled()\" [config]=\"chevron()\" />\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n`;\n\nexport const DROPDOWN_IMPORTS = [\n LabelComponent,\n TextOutputComponent,\n TextInputComponent,\n ButtonComponent,\n SelectorDirective,\n];\n\n/**\n * Everything a Dropdown and a Multiselect share: the options, the search, the\n * keyboard walk and the panel. What differs is only what the Field holds — one\n * value or a list — so a subclass says which values are selected and what a\n * pick does to them.\n */\n@Directive()\nexport abstract class BaseDropdownComponent extends BaseInputComponent<DropdownInput> {\n public override config = input<Partial<DropdownInput> | undefined>();\n public override required = input<boolean>(false);\n public override disabled = input<boolean>(false);\n public override invalid = input<boolean>(false);\n public override touched = model<boolean>(false);\n public override focused = input<boolean>(false);\n public override errors = input<readonly WithOptionalFieldTree<ValidationError>[]>(\n []\n );\n public override showErrors = computed(() => this.touched() && this.invalid());\n\n readonly options = input<\n DropdownOption<DropdownValue>[] | Signal<DropdownOption<DropdownValue>[]>\n >();\n readonly dir = input<Direction>();\n readonly toggle = model(false);\n readonly searchTerm = signal('');\n readonly isFocused = signal(false);\n readonly chevron = computed(\n () =>\n <Button>{\n icon: this.toggle() ? 'chevron-up' : 'chevron-down',\n one: true,\n variant: 'ghost',\n // In-Field control, never the form's submit — without this the Button\n // reads as the submit control and greys out while the form is invalid.\n type: 'button',\n // Chevron tracks the trigger's border like the text input's own icon:\n // red while the Field shows errors, focus tint while focused, border at rest.\n color: this.showErrors()\n ? 'error'\n : this.isFocused()\n ? 'focus'\n : 'border',\n // The trigger input is the Field's tab stop; the chevron only repeats\n // what clicking that input already does, so Tab walks past it.\n tabindex: -1,\n }\n );\n\n /** The values the Field holds now, as a list whichever kind it is. */\n protected abstract readonly selectedValues: Signal<readonly DropdownValue[]>;\n /** Whether the panel ticks rows and stays open across picks. */\n protected abstract readonly multiple: boolean;\n /** What picking `option` does to the Field's value. */\n protected abstract selectOption(option: DropdownOption<DropdownValue>): void;\n\n protected readonly triggerInputConfig = computed(() => {\n const dropdown = this.config() as DropdownInput | undefined;\n return <Partial<TextInput>>{\n name: dropdown?.name,\n icon: dropdown?.icon,\n one: dropdown?.one,\n placeholder: this.placeholderText(),\n readonly: this.readonly() || !!dropdown?.readonly,\n };\n });\n\n protected readonly dropdownOptions = computed(\n (): DropdownOption<DropdownValue>[] => {\n const runtimeOptions = this.options();\n const source =\n runtimeOptions ?? (this.config() as DropdownInput | undefined)?.options;\n if (typeof source === 'function') return source();\n if (source?.length) return source;\n return this.assetOptions();\n }\n );\n\n private readonly translateService = inject(TranslateService);\n\n protected readonly assetOptions = assetOptions(\n () => (this.config() as DropdownInput | undefined)?.optionsAsset\n );\n\n /** An option's text: authored as it stands, a key translated. */\n private readonly optionLabel = (\n option?: DropdownOption<DropdownValue>\n ): string => {\n if (!option?.label) return '';\n return option.noTranslate\n ? option.label\n : this.translateService.translate(option.label);\n };\n\n protected readonly filteredOptions = computed(\n (): DropdownOption<DropdownValue>[] => {\n const search = this.searchTerm().toLowerCase();\n if (!search) return this.dropdownOptions();\n return this.dropdownOptions().filter((o) => {\n const label = this.optionLabel(o).toLowerCase();\n return (\n label.includes(search) ||\n String(o.value).toLowerCase().includes(search)\n );\n });\n }\n );\n\n /** The option ↑/↓ point at while the panel is open; -1 is none. Reset as the search narrows the list. */\n protected readonly activeIndex = linkedSignal<\n DropdownOption<DropdownValue>[],\n number\n >({\n source: this.filteredOptions,\n computation: (options) =>\n this.searchTerm() ? this.nextEnabled(options, -1, 1) : -1,\n });\n\n /** The enabled option `step` rows past `from`, wrapping; `from` itself when none. */\n private readonly nextEnabled = (\n options: DropdownOption<DropdownValue>[],\n from: number,\n step: 1 | -1\n ): number => {\n for (let i = 1; i <= options.length; i++) {\n const index =\n (((from + step * i) % options.length) + options.length) %\n options.length;\n if (!options[index].disabled) return index;\n }\n return from;\n };\n\n /** One pick reads as its option's label, several as a count. */\n private readonly selectionLabel = computed((): string => {\n const values = this.selectedValues();\n if (values.length === 0) return '';\n if (values.length === 1) {\n return this.optionLabel(\n this.dropdownOptions().find((o) => o.value === values[0])\n );\n }\n const translation = this.translateService.translate(\n `selected?count=${values.length}`\n );\n return translation.includes('selected')\n ? `${values.length} Selected`\n : translation;\n });\n\n protected readonly displayValue = computed((): string =>\n this.toggle() ? this.searchTerm() : this.selectionLabel()\n );\n\n protected readonly placeholderText = computed((): string => {\n if (this.toggle()) {\n const label = this.selectionLabel();\n if (label) return label;\n }\n const placeholder = (this.config() as DropdownInput | undefined)\n ?.placeholder;\n return placeholder ? this.translateService.translate(placeholder) : '';\n });\n\n private readonly wrapperRef =\n viewChild<ElementRef<HTMLDivElement>>('wrapper');\n\n protected readonly selectorConfig = computed<\n SelectorConfig<DropdownBoxComponent>\n >(() => ({\n component: DropdownBoxComponent,\n base: 'm-dropdown-input',\n matchTriggerWidth: true,\n toggle: true,\n dir: this.dir(),\n bindings: [\n inputBinding('options', this.filteredOptions),\n inputBinding('selected', this.selectedValues),\n inputBinding('multiple', () => this.multiple),\n inputBinding('activeIndex', this.activeIndex),\n outputBinding<DropdownOption<DropdownValue>>('action', (option) =>\n this.selectOption(option)\n ),\n ],\n }));\n\n /** Shuts the panel after a pick, the way a click on the trigger would. */\n protected readonly closePanel = (): void => {\n this.toggle.set(false);\n this.searchTerm.set('');\n setTimeout(() => this.wrapperRef()?.nativeElement.click(), 0);\n };\n\n protected readonly onOpened = (): void => {\n this.toggle.set(true);\n this.searchTerm.set('');\n const current = this.selectedValues()[0];\n this.activeIndex.set(\n this.filteredOptions().findIndex((o) => o.value === current)\n );\n };\n\n // Focus stays in the trigger input (it is the search box), so ↑/↓ move the\n // active option rather than DOM focus. Closed, ArrowDown bubbles on to\n // SelectorDirective, which opens the panel.\n protected readonly onArrow = (event: Event, step: 1 | -1): void => {\n if (!this.toggle()) return;\n event.preventDefault();\n this.activeIndex.update((index) =>\n this.nextEnabled(this.filteredOptions(), index, step)\n );\n };\n\n // Enter never reaches SelectorDirective (it would toggle the panel); open,\n // it picks the active option.\n protected readonly onEnter = (event: Event): void => {\n event.stopPropagation();\n if (!this.toggle()) return;\n event.preventDefault();\n const option = this.filteredOptions()[this.activeIndex()];\n if (option && !option.disabled) this.selectOption(option);\n };\n\n protected readonly onClosed = (): void => {\n this.toggle.set(false);\n this.searchTerm.set('');\n };\n\n protected readonly onInput = (value: string): void => {\n this.searchTerm.set(value);\n };\n\n protected readonly preventToggleWhenOpen = (event: Event): void => {\n if (this.toggle() || this.readonly() || this.config()?.readonly) {\n event.stopPropagation();\n }\n };\n}\n"],"mappings":";;;;;;;;;;;AA0DA,IAAa,uBAAb,MAAa,qBAAoB;CACtB,UAAU,MAAuC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEpD,WAAW,MAAgC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC9C,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,SAAS,OAAM;CAEP,OAAO,OAAgC,UAAU;CAGlE,cAAA;EACE,aAAY;GACV,MAAM,QAAQ,KAAK,YAAW;GAC9B,IAAI,QAAQ,GAAG;GACf,KAAK,KAAK,cACP,iBAAiB,uBAAuB,CAAC,CACzC,MAAM,EAAE,iBAAiB,EAAE,OAAO,UAAS,CAAE;EAClD,CAAC;CACH;CAEmB,cAAc,UAC/B,KAAK,SAAQ,CAAE,CAAC,SAAS,KAAK;CAGb,gBACjB,WACQ;EACR,I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,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,cAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"magmonium-one-base-dropdown-9gvOPGo2.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/dropdown/dropdown-box.ts","../../../../libs/one/src/lib/shared/ui/input/ui/dropdown/base-dropdown.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { TranslatePipe } from '../../../../pipe/translate';\nimport { DropdownOption, DropdownValue } from '../../model/input';\n\n@Component({\n selector: 'm-dropdown-box',\n imports: [TranslatePipe],\n template: `\n <ul class=\"dropdown-box\" role=\"listbox\">\n @for (option of options(); track option.value; let i = $index) {\n @let selectedState = isSelected(option.value);\n <li\n class=\"dropdown-box__option\"\n [class.dropdown-box__option--selected]=\"selectedState\"\n [class.dropdown-box__option--disabled]=\"option.disabled\"\n [class.dropdown-box__option--active]=\"i === activeIndex()\"\n [style.--m-dropdown-option-depth]=\"option.depth\"\n role=\"option\"\n [attr.aria-selected]=\"selectedState\"\n [attr.data-value]=\"option.value\"\n (click)=\"selectOption(option)\"\n (keydown.enter)=\"selectOption(option)\"\n tabindex=\"0\"\n >\n <!-- A group header is a row, never a choice: no box to tick. -->\n @if (multiple() && !option.disabled) {\n <input\n type=\"checkbox\"\n class=\"dropdown-box__checkbox\"\n [checked]=\"selectedState\"\n tabindex=\"-1\"\n (click)=\"$event.preventDefault()\"\n />\n }\n @if (option.noTranslate) {\n {{ option.label }}\n } @else {\n {{ option.label | translate }}\n }\n </li>\n } @empty {\n <li class=\"dropdown-box__empty\">\n {{ 'no-results-found' | translate }}\n </li>\n }\n </ul>\n `,\n styleUrl: './dropdown-box.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DropdownBoxComponent {\n readonly options = input<DropdownOption<DropdownValue>[]>([]);\n /** The values ticked, as a list whichever Field drew the panel. */\n readonly selected = input<readonly DropdownValue[]>([]);\n readonly multiple = input<boolean>(false);\n readonly activeIndex = input<number>(-1);\n readonly action = output<DropdownOption<DropdownValue>>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n // Keep the keyboard-active option in view as ↑/↓ walk a scrolled list.\n constructor() {\n effect(() => {\n const index = this.activeIndex();\n if (index < 0) return;\n this.host.nativeElement\n .querySelectorAll('.dropdown-box__option')\n [index]?.scrollIntoView?.({ block: 'nearest' });\n });\n }\n\n protected readonly isSelected = (value: DropdownValue): boolean =>\n this.selected().includes(value);\n\n // Only emit a selection event for enabled options.\n protected readonly selectOption = (\n option: DropdownOption<DropdownValue>\n ): void => {\n if (option.disabled) return;\n this.action.emit(option);\n };\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n inputBinding,\n linkedSignal,\n model,\n outputBinding,\n Signal,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseInputComponent } from '../../lib/base-input';\nimport { Button } from '../../../button/type/button';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { TranslateService } from '../../../../services';\nimport { SelectorConfig, SelectorDirective } from '../../../../directives';\nimport { Direction } from '../../../../directives/selector/selector-type';\nimport { DropdownBoxComponent } from './dropdown-box';\nimport {\n DropdownInput,\n DropdownOption,\n DropdownValue,\n TextInput,\n} from '../../model/input';\nimport { TextInputComponent } from '../text/text';\nimport { assetOptions } from '../../lib/options-asset';\n\n/** The trigger both option Fields draw: a searchable text input and a chevron. */\nexport const DROPDOWN_TEMPLATE = `\n @if (config(); as dropdown) {\n @if (dropdown.label) {\n <m-label\n [for]=\"dropdown.name ?? ''\"\n [placeholder]=\"dropdown.label\"\n [params]=\"dropdown.params\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n }\n <div\n class=\"trigger-wrap\"\n #wrapper\n [mSelector]=\"selectorConfig()\"\n [disabled]=\"disabled() || readonly() || !!config()?.readonly\"\n (opened)=\"onOpened()\"\n (closed)=\"onClosed()\"\n (focusin)=\"isFocused.set(true)\"\n (focusout)=\"isFocused.set(false)\"\n >\n <m-text-input\n [config]=\"triggerInputConfig()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled()\"\n [invalid]=\"invalid()\"\n [hideErrors]=\"true\"\n [(touched)]=\"touched\"\n [focused]=\"focused()\"\n (valueChange)=\"onInput($event)\"\n (click)=\"preventToggleWhenOpen($event)\"\n (keydown.space)=\"$event.stopPropagation()\"\n (keydown.enter)=\"onEnter($event)\"\n (keydown.arrowdown)=\"onArrow($event, 1)\"\n (keydown.arrowup)=\"onArrow($event, -1)\"\n (keydown.tab)=\"$event.stopPropagation()\"\n />\n <m-button [disabled]=\"disabled()\" [config]=\"chevron()\" />\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n`;\n\nexport const DROPDOWN_IMPORTS = [\n LabelComponent,\n TextOutputComponent,\n TextInputComponent,\n ButtonComponent,\n SelectorDirective,\n];\n\n/**\n * Everything a Dropdown and a Multiselect share: the options, the search, the\n * keyboard walk and the panel. What differs is only what the Field holds — one\n * value or a list — so a subclass says which values are selected and what a\n * pick does to them.\n */\n@Directive()\nexport abstract class BaseDropdownComponent extends BaseInputComponent<DropdownInput> {\n public override config = input<Partial<DropdownInput> | undefined>();\n public override required = input<boolean>(false);\n public override disabled = input<boolean>(false);\n public override invalid = input<boolean>(false);\n public override touched = model<boolean>(false);\n public override focused = input<boolean>(false);\n public override errors = input<readonly WithOptionalFieldTree<ValidationError>[]>(\n []\n );\n public override showErrors = computed(() => this.touched() && this.invalid());\n\n readonly options = input<\n DropdownOption<DropdownValue>[] | Signal<DropdownOption<DropdownValue>[]>\n >();\n readonly dir = input<Direction>();\n readonly toggle = model(false);\n readonly searchTerm = signal('');\n readonly isFocused = signal(false);\n readonly chevron = computed(\n () =>\n <Button>{\n icon: this.toggle() ? 'chevron-up' : 'chevron-down',\n one: true,\n variant: 'ghost',\n // In-Field control, never the form's submit — without this the Button\n // reads as the submit control and greys out while the form is invalid.\n type: 'button',\n // Chevron tracks the trigger's border like the text input's own icon:\n // red while the Field shows errors, focus tint while focused, border at rest.\n color: this.showErrors()\n ? 'error'\n : this.isFocused()\n ? 'focus'\n : 'border',\n // The trigger input is the Field's tab stop; the chevron only repeats\n // what clicking that input already does, so Tab walks past it.\n tabindex: -1,\n }\n );\n\n /** The values the Field holds now, as a list whichever kind it is. */\n protected abstract readonly selectedValues: Signal<readonly DropdownValue[]>;\n /** Whether the panel ticks rows and stays open across picks. */\n protected abstract readonly multiple: boolean;\n /** What picking `option` does to the Field's value. */\n protected abstract selectOption(option: DropdownOption<DropdownValue>): void;\n\n protected readonly triggerInputConfig = computed(() => {\n const dropdown = this.config() as DropdownInput | undefined;\n return <Partial<TextInput>>{\n name: dropdown?.name,\n icon: dropdown?.icon,\n one: dropdown?.one,\n placeholder: this.placeholderText(),\n readonly: this.readonly() || !!dropdown?.readonly,\n };\n });\n\n protected readonly dropdownOptions = computed(\n (): DropdownOption<DropdownValue>[] => {\n const runtimeOptions = this.options();\n const source =\n runtimeOptions ?? (this.config() as DropdownInput | undefined)?.options;\n if (typeof source === 'function') return source();\n if (source?.length) return source;\n return this.assetOptions();\n }\n );\n\n private readonly translateService = inject(TranslateService);\n\n protected readonly assetOptions = assetOptions(\n () => (this.config() as DropdownInput | undefined)?.optionsAsset\n );\n\n /** An option's text: authored as it stands, a key translated. */\n private readonly optionLabel = (\n option?: DropdownOption<DropdownValue>\n ): string => {\n if (!option?.label) return '';\n return option.noTranslate\n ? option.label\n : this.translateService.translate(option.label);\n };\n\n protected readonly filteredOptions = computed(\n (): DropdownOption<DropdownValue>[] => {\n const search = this.searchTerm().toLowerCase();\n if (!search) return this.dropdownOptions();\n return this.dropdownOptions().filter((o) => {\n const label = this.optionLabel(o).toLowerCase();\n return (\n label.includes(search) ||\n String(o.value).toLowerCase().includes(search)\n );\n });\n }\n );\n\n /** The option ↑/↓ point at while the panel is open; -1 is none. Reset as the search narrows the list. */\n protected readonly activeIndex = linkedSignal<\n DropdownOption<DropdownValue>[],\n number\n >({\n source: this.filteredOptions,\n computation: (options) =>\n this.searchTerm() ? this.nextEnabled(options, -1, 1) : -1,\n });\n\n /** The enabled option `step` rows past `from`, wrapping; `from` itself when none. */\n private readonly nextEnabled = (\n options: DropdownOption<DropdownValue>[],\n from: number,\n step: 1 | -1\n ): number => {\n for (let i = 1; i <= options.length; i++) {\n const index =\n (((from + step * i) % options.length) + options.length) %\n options.length;\n if (!options[index].disabled) return index;\n }\n return from;\n };\n\n /** One pick reads as its option's label, several as a count. */\n private readonly selectionLabel = computed((): string => {\n const values = this.selectedValues();\n if (values.length === 0) return '';\n if (values.length === 1) {\n return this.optionLabel(\n this.dropdownOptions().find((o) => o.value === values[0])\n );\n }\n const translation = this.translateService.translate(\n `selected?count=${values.length}`\n );\n return translation.includes('selected')\n ? `${values.length} Selected`\n : translation;\n });\n\n protected readonly displayValue = computed((): string =>\n this.toggle() ? this.searchTerm() : this.selectionLabel()\n );\n\n protected readonly placeholderText = computed((): string => {\n if (this.toggle()) {\n const label = this.selectionLabel();\n if (label) return label;\n }\n const placeholder = (this.config() as DropdownInput | undefined)\n ?.placeholder;\n return placeholder ? this.translateService.translate(placeholder) : '';\n });\n\n private readonly wrapperRef =\n viewChild<ElementRef<HTMLDivElement>>('wrapper');\n\n protected readonly selectorConfig = computed<\n SelectorConfig<DropdownBoxComponent>\n >(() => ({\n component: DropdownBoxComponent,\n base: 'm-dropdown-input',\n matchTriggerWidth: true,\n toggle: true,\n dir: this.dir(),\n bindings: [\n inputBinding('options', this.filteredOptions),\n inputBinding('selected', this.selectedValues),\n inputBinding('multiple', () => this.multiple),\n inputBinding('activeIndex', this.activeIndex),\n outputBinding<DropdownOption<DropdownValue>>('action', (option) =>\n this.selectOption(option)\n ),\n ],\n }));\n\n /** Shuts the panel after a pick, the way a click on the trigger would. */\n protected readonly closePanel = (): void => {\n this.toggle.set(false);\n this.searchTerm.set('');\n setTimeout(() => this.wrapperRef()?.nativeElement.click(), 0);\n };\n\n protected readonly onOpened = (): void => {\n this.toggle.set(true);\n this.searchTerm.set('');\n const current = this.selectedValues()[0];\n this.activeIndex.set(\n this.filteredOptions().findIndex((o) => o.value === current)\n );\n };\n\n // Focus stays in the trigger input (it is the search box), so ↑/↓ move the\n // active option rather than DOM focus. Closed, ArrowDown bubbles on to\n // SelectorDirective, which opens the panel.\n protected readonly onArrow = (event: Event, step: 1 | -1): void => {\n if (!this.toggle()) return;\n event.preventDefault();\n this.activeIndex.update((index) =>\n this.nextEnabled(this.filteredOptions(), index, step)\n );\n };\n\n // Enter never reaches SelectorDirective (it would toggle the panel); open,\n // it picks the active option.\n protected readonly onEnter = (event: Event): void => {\n event.stopPropagation();\n if (!this.toggle()) return;\n event.preventDefault();\n const option = this.filteredOptions()[this.activeIndex()];\n if (option && !option.disabled) this.selectOption(option);\n };\n\n protected readonly onClosed = (): void => {\n this.toggle.set(false);\n this.searchTerm.set('');\n };\n\n protected readonly onInput = (value: string): void => {\n this.searchTerm.set(value);\n };\n\n protected readonly preventToggleWhenOpen = (event: Event): void => {\n if (this.toggle() || this.readonly() || this.config()?.readonly) {\n event.stopPropagation();\n }\n };\n}\n"],"mappings":";;;;;;;;;;;AA0DA,IAAa,uBAAb,MAAa,qBAAoB;CACtB,UAAU,MAAuC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEpD,WAAW,MAAgC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC9C,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,SAAS,OAAM;CAEP,OAAO,OAAgC,UAAU;CAGlE,cAAA;EACE,aAAY;GACV,MAAM,QAAQ,KAAK,YAAW;GAC9B,IAAI,QAAQ,GAAG;GACf,KAAK,KAAK,cACP,iBAAiB,uBAAuB,CAAC,CACzC,MAAM,EAAE,iBAAiB,EAAE,OAAO,UAAS,CAAE;EAClD,CAAC;CACH;CAEmB,cAAc,UAC/B,KAAK,SAAQ,CAAE,CAAC,SAAS,KAAK;CAGb,gBACjB,WACQ;EACR,IAAI,OAAO,UAAU;EACrB,KAAK,OAAO,KAAK,MAAM;CACzB;CA9BW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAApB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAoB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,SA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AAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,cAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./magmonium-one-rolldown-runtime-DpJrqANO.mjs";
2
2
  import { t as LabelComponent } from "./magmonium-one-label-23DjRQdd.mjs";
3
3
  import { t as toAttrBool } from "./magmonium-one-attribute-value-CPh-lJPV.mjs";
4
- import { t as TextOutputComponent } from "./magmonium-one-text-output-M8sEPhFz.mjs";
4
+ import { t as TextOutputComponent } from "./magmonium-one-text-output-E6pe3IOL.mjs";
5
5
  import { t as BaseCheckboxInputComponent } from "./magmonium-one-base-checkbox-LdM6dqF_.mjs";
6
6
  import * as i0 from "@angular/core";
7
7
  import { ChangeDetectionStrategy, Component, InjectionToken, computed, input, model } from "@angular/core";
@@ -363,4 +363,4 @@ i0.ɵɵngDeclareClassMetadata({
363
363
  });
364
364
  export { checkbox_exports as n, PLACED_CHECKBOX as r, CheckboxInputComponent as t };
365
365
 
366
- //# sourceMappingURL=magmonium-one-checkbox-CmPgvVHJ.mjs.map
366
+ //# sourceMappingURL=magmonium-one-checkbox-CDoW9khf.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-checkbox-CmPgvVHJ.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/lib/placed-checkbox.token.ts","../../../../libs/one/src/lib/shared/ui/input/ui/checkbox/checkbox.ts"],"sourcesContent":["import { InjectionToken, Signal } from '@angular/core';\nimport { DropdownOption } from '../model/input';\n\n/**\n * An `m-checkbox` placed between a SectionFormItem's tags as one option of its\n * CheckboxGroup (libs/one ADR 0039). Provided by the checkbox itself so the\n * item can collect its children without importing the checkbox chunk it only\n * lazy-loads. `undefined` until the checkbox names a `value`.\n */\nexport type PlacedCheckbox = {\n readonly option: Signal<DropdownOption | undefined>;\n};\n\nexport const PLACED_CHECKBOX = new InjectionToken<PlacedCheckbox>(\n 'PLACED_CHECKBOX'\n);\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n ModelSignal,\n} from '@angular/core';\nimport { BaseCheckboxInputComponent } from './base-checkbox';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\nimport { DropdownOption, Input } from '../../model/input';\nimport {\n PLACED_CHECKBOX,\n PlacedCheckbox,\n} from '../../lib/placed-checkbox.token';\nimport { toAttrBool } from '../../../../functions/config/attribute-value';\n\n@Component({\n selector: 'm-checkbox',\n template: `\n @if (config(); as checkbox) {\n <div class=\"checkbox\">\n <input\n [checked]=\"checked()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [disabled]=\"disabled()\"\n (change)=\"onChange($event)\"\n type=\"checkbox\"\n [id]=\"checkbox.name\"\n />\n @if (labelText(); as text) {\n <m-label\n [for]=\"checkbox.name\"\n [placeholder]=\"text\"\n [params]=\"checkbox.params\"\n [noTranslate]=\"isNoTranslate()\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n }\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent],\n styleUrl: './checkbox.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: PLACED_CHECKBOX, useExisting: CheckboxInputComponent },\n ],\n})\nexport class CheckboxInputComponent\n extends BaseCheckboxInputComponent\n implements PlacedCheckbox\n{\n public override value = undefined;\n public override checked = model<boolean>(false) as ModelSignal<boolean>;\n public override config = input<Partial<Input> | undefined>();\n public override required = input<boolean>(false);\n public override disabled = input<boolean>(false);\n public override invalid = input<boolean>(false);\n public override touched = model<boolean>(false);\n public override focused = input<boolean>(false);\n public override errors = input<readonly WithOptionalFieldTree<ValidationError>[]>(\n []\n );\n public override showErrors = computed(() => this.touched() && this.invalid());\n\n // What a checkbox placed inside a CheckboxGroup's SectionFormItem says about\n // the option it stands for, written on its own tag (ADR 0010, ADR 0039).\n // `value` is the attribute because it is the option's value; the member is\n // named apart because FormCheckboxControl pins `value` itself to undefined —\n // a checkbox control's value is `checked`.\n /* eslint-disable @angular-eslint/no-input-rename */\n public readonly optionValue = input<string | undefined>(undefined, {\n alias: 'value',\n });\n /* eslint-enable @angular-eslint/no-input-rename */\n public readonly label = input<string | undefined>();\n public readonly noTranslate = input<boolean | string | undefined>();\n\n protected readonly labelText = computed(\n () => this.label() ?? this.config()?.label\n );\n protected readonly isNoTranslate = computed(\n () => toAttrBool(this.noTranslate()) === true\n );\n\n public readonly option = computed((): DropdownOption | undefined => {\n const value = this.optionValue();\n if (!value) return undefined;\n return {\n value,\n label: this.label() ?? value,\n disabled: this.disabled() || undefined,\n noTranslate: this.isNoTranslate() || undefined,\n };\n });\n\n protected onChange(event: Event): void {\n const target = event.target as HTMLInputElement;\n this.setValue(target?.checked ?? false);\n }\n}\n"],"mappings":";;;;;;;AAaA,MAAa,kBAAkB,IAAI,eACjC,iBAAiB;;ACgDnB,IAAa,yBAAb,MAAa,+BACH,2BAA0B;CAGlB,QAAQ;CACR,UAAU,MAAe,KAAK;CAC9B,SAAS,MAAmC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,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IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,SAAA;GAAA,SAAA;EAAA;EAAA,WAJtB,CACT;GAAE,SAAS;GAAiB,aAAa;EAAsB,CAChE;EAAA,iBAAA;EAAA,UAAA;EAAA,UAvCS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCT,UAAA;EAAA,QAAA,CAAA,oljBAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MACS;GAAc,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAmB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,gBAAA,SAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAOlC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAsB,YAAA,CAAA;EA3ClC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,UACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,SACQ,CAAC,gBAAgB,mBAAmB;GAAC,iBAE7B,wBAAwB;GAAM,WACpC,CACT;IAAE,SAAS;IAAiB,aAAW;GAAwB,CAChE;GAAA,QAAA,CAAA,oljBAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"magmonium-one-checkbox-CDoW9khf.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/lib/placed-checkbox.token.ts","../../../../libs/one/src/lib/shared/ui/input/ui/checkbox/checkbox.ts"],"sourcesContent":["import { InjectionToken, Signal } from '@angular/core';\nimport { DropdownOption } from '../model/input';\n\n/**\n * An `m-checkbox` placed between a SectionFormItem's tags as one option of its\n * CheckboxGroup (libs/one ADR 0039). Provided by the checkbox itself so the\n * item can collect its children without importing the checkbox chunk it only\n * lazy-loads. `undefined` until the checkbox names a `value`.\n */\nexport type PlacedCheckbox = {\n readonly option: Signal<DropdownOption | undefined>;\n};\n\nexport const PLACED_CHECKBOX = new InjectionToken<PlacedCheckbox>(\n 'PLACED_CHECKBOX'\n);\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n ModelSignal,\n} from '@angular/core';\nimport { BaseCheckboxInputComponent } from './base-checkbox';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\nimport { DropdownOption, Input } from '../../model/input';\nimport {\n PLACED_CHECKBOX,\n PlacedCheckbox,\n} from '../../lib/placed-checkbox.token';\nimport { toAttrBool } from '../../../../functions/config/attribute-value';\n\n@Component({\n selector: 'm-checkbox',\n template: `\n @if (config(); as checkbox) {\n <div class=\"checkbox\">\n <input\n [checked]=\"checked()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [disabled]=\"disabled()\"\n (change)=\"onChange($event)\"\n type=\"checkbox\"\n [id]=\"checkbox.name\"\n />\n @if (labelText(); as text) {\n <m-label\n [for]=\"checkbox.name\"\n [placeholder]=\"text\"\n [params]=\"checkbox.params\"\n [noTranslate]=\"isNoTranslate()\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n }\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent],\n styleUrl: './checkbox.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: PLACED_CHECKBOX, useExisting: CheckboxInputComponent },\n ],\n})\nexport class CheckboxInputComponent\n extends BaseCheckboxInputComponent\n implements PlacedCheckbox\n{\n public override value = undefined;\n public override checked = model<boolean>(false) as ModelSignal<boolean>;\n public override config = input<Partial<Input> | undefined>();\n public override required = input<boolean>(false);\n public override disabled = input<boolean>(false);\n public override invalid = input<boolean>(false);\n public override touched = model<boolean>(false);\n public override focused = input<boolean>(false);\n public override errors = input<readonly WithOptionalFieldTree<ValidationError>[]>(\n []\n );\n public override showErrors = computed(() => this.touched() && this.invalid());\n\n // What a checkbox placed inside a CheckboxGroup's SectionFormItem says about\n // the option it stands for, written on its own tag (ADR 0010, ADR 0039).\n // `value` is the attribute because it is the option's value; the member is\n // named apart because FormCheckboxControl pins `value` itself to undefined —\n // a checkbox control's value is `checked`.\n /* eslint-disable @angular-eslint/no-input-rename */\n public readonly optionValue = input<string | undefined>(undefined, {\n alias: 'value',\n });\n /* eslint-enable @angular-eslint/no-input-rename */\n public readonly label = input<string | undefined>();\n public readonly noTranslate = input<boolean | string | undefined>();\n\n protected readonly labelText = computed(\n () => this.label() ?? this.config()?.label\n );\n protected readonly isNoTranslate = computed(\n () => toAttrBool(this.noTranslate()) === true\n );\n\n public readonly option = computed((): DropdownOption | undefined => {\n const value = this.optionValue();\n if (!value) return undefined;\n return {\n value,\n label: this.label() ?? value,\n disabled: this.disabled() || undefined,\n noTranslate: this.isNoTranslate() || undefined,\n };\n });\n\n protected onChange(event: Event): void {\n const target = event.target as HTMLInputElement;\n this.setValue(target?.checked ?? false);\n }\n}\n"],"mappings":";;;;;;;AAaA,MAAa,kBAAkB,IAAI,eACjC,iBAAiB;;ACgDnB,IAAa,yBAAb,MAAa,+BACH,2BAA0B;CAGlB,QAAQ;CACR,UAAU,MAAe,KAAK;CAC9B,SAAS,MAAmC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,UAAU,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;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GAAiB,aAAa;EAAsB,CAChE;EAAA,iBAAA;EAAA,UAAA;EAAA,UAvCS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCT,UAAA;EAAA,QAAA,CAAA,oljBAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MACS;GAAc,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAmB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,gBAAA,SAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAOlC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAsB,YAAA,CAAA;EA3ClC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,UACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,SACQ,CAAC,gBAAgB,mBAAmB;GAAC,iBAE7B,wBAAwB;GAAM,WACpC,CACT;IAAE,SAAS;IAAiB,aAAW;GAAwB,CAChE;GAAA,QAAA,CAAA,oljBAAA;EAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { U as IS_DESIGN_MODE } from "./magmonium-one-size-converter-BqkALIWA.mjs";
2
2
  import { t as LabelComponent } from "./magmonium-one-label-23DjRQdd.mjs";
3
3
  import { t as BaseTextInputComponent } from "./magmonium-one-base-text-ChjG3GNw.mjs";
4
- import { t as TextOutputComponent } from "./magmonium-one-text-output-M8sEPhFz.mjs";
4
+ import { t as TextOutputComponent } from "./magmonium-one-text-output-E6pe3IOL.mjs";
5
5
  import * as i0 from "@angular/core";
6
6
  import { ChangeDetectionStrategy, Component, afterRenderEffect, computed, effect, inject, signal, untracked, viewChildren } from "@angular/core";
7
7
  import { CommonModule } from "@angular/common";
@@ -259,4 +259,4 @@ i0.ɵɵngDeclareClassMetadata({
259
259
  });
260
260
  export { OtpInputComponent };
261
261
 
262
- //# sourceMappingURL=magmonium-one-otp-BOOJnnc2.mjs.map
262
+ //# sourceMappingURL=magmonium-one-otp-CIGethTv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-otp-BOOJnnc2.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/otp.ts"],"sourcesContent":["import {\n afterRenderEffect,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n signal,\n untracked,\n viewChildren,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { CommonModule } from '@angular/common';\nimport { OtpInput } from '../../model/input';\nimport { IS_DESIGN_MODE } from '../../../../config/tokens';\n\n@Component({\n selector: 'm-otp-input',\n template: `\n @if (otpConfig(); as otp) {\n <m-label\n [for]=\"otp.name\"\n [placeholder]=\"otp.label\"\n [params]=\"otp.params\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n />\n <div class=\"otp-container\">\n @for (item of otpArray(); track $index) {\n <input\n [id]=\"$index === 0 ? (otp.name ?? '') : ''\"\n #otpInput\n type=\"text\"\n maxlength=\"1\"\n [class.error]=\"showErrors()\"\n [disabled]=\"isDisabled()\"\n [value]=\"otpValues()[$index] || ''\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (paste)=\"onPaste($event)\"\n />\n }\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n styleUrl: './otp.sass',\n imports: [LabelComponent, TextOutputComponent, CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class OtpInputComponent extends BaseTextInputComponent<OtpInput> {\n otpValues = signal<string[]>([]);\n otpInputs = viewChildren<ElementRef<HTMLInputElement>>('otpInput');\n protected readonly otpConfig = computed(() => this.config() as OtpInput);\n otpArray = computed(() => {\n const length = this.otpConfig()?.length || 6;\n return Array(length).fill(0);\n });\n\n // Inert on the Canvas — other inputs stay idle because they never autofocus;\n // OTP used to steal focus and look live while composing (DesignMode).\n private readonly isDesignMode = !!inject(IS_DESIGN_MODE, { optional: true });\n protected readonly isDisabled = computed(\n () => this.isDesignMode || this.disabled()\n );\n\n // BaseText answers `focused` by focusing its `#inputElement`, and an OTP has\n // none — it has a row of boxes. Without this the caret never lands on an OTP\n // field, so the form that opens on one (login's verification step) reads as\n // dead until the User clicks it.\n private hasAutofocused = false;\n\n constructor() {\n super();\n effect(() => {\n const length = this.otpConfig()?.length || 6;\n this.otpValues.set(Array(length).fill(''));\n });\n\n afterRenderEffect(() => {\n const inputs = this.otpInputs();\n if (!this.focused() || !inputs.length || this.hasAutofocused) return;\n this.hasAutofocused = true;\n untracked(() => this.focusInput(0));\n });\n }\n\n onInput = (event: Event, index: number): void => {\n if (this.isDisabled()) return;\n const input = event.target as HTMLInputElement;\n let value = input.value;\n\n value = value.replace(/[^a-zA-Z0-9]/g, '');\n\n if (value.length > 1) {\n value = value.slice(-1);\n }\n\n input.value = value.toUpperCase();\n\n const newValues = [...this.otpValues()];\n newValues[index] = value.toUpperCase();\n this.otpValues.set(newValues);\n\n const length = this.otpConfig()?.length || 6;\n if (value && index < length - 1) {\n this.focusInput(index + 1);\n }\n this.updateValue();\n };\n\n onKeyDown = (event: KeyboardEvent, index: number): void => {\n if (this.isDisabled()) return;\n const input = event.target as HTMLInputElement;\n const length = this.otpConfig()?.length || 6;\n\n const isAlphaNumeric = /^[a-zA-Z0-9]$/.test(event.key);\n const isControlKey = [\n 'Backspace',\n 'Delete',\n 'ArrowLeft',\n 'ArrowRight',\n 'Tab',\n ].includes(event.key);\n\n if (!isAlphaNumeric && !isControlKey) {\n event.preventDefault();\n return;\n }\n\n if (event.key === 'Backspace') {\n if (!input.value && index > 0) {\n this.focusInput(index - 1);\n }\n }\n if (event.key === 'ArrowLeft' && index > 0) {\n event.preventDefault();\n this.focusInput(index - 1);\n }\n if (event.key === 'ArrowRight' && index < length - 1) {\n event.preventDefault();\n this.focusInput(index + 1);\n }\n };\n\n onPaste = (event: ClipboardEvent): void => {\n if (this.isDisabled()) return;\n event.preventDefault();\n event.stopPropagation();\n\n const length = this.otpConfig()?.length || 6;\n const pastedData = event.clipboardData?.getData('text') || '';\n\n const alphanumeric = pastedData\n .replace(/[^a-zA-Z0-9]/g, '')\n .slice(0, length);\n\n if (alphanumeric.length > 0) {\n const newValues = Array(length).fill('');\n alphanumeric.split('').forEach((char, index) => {\n if (index < length) {\n newValues[index] = char.toUpperCase();\n }\n });\n\n this.otpValues.set(newValues);\n this.updateValue();\n\n const focusIndex = Math.min(alphanumeric.length, length - 1);\n setTimeout(() => this.focusInput(focusIndex), 0);\n }\n };\n\n private focusInput(index: number): void {\n if (this.isDisabled()) return;\n const inputs = this.otpInputs();\n if (inputs[index]) {\n inputs[index].nativeElement.focus();\n }\n }\n\n private updateValue(): void {\n const otpValue = this.otpValues().join('');\n this.setValue(otpValue);\n }\n}\n"],"mappings":";;;;;;;AA6DA,IAAa,oBAAb,MAAa,0BAA0B,uBAAgC;CACrE,YAAY,OAAiB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,YAAY,aAA2C,YAAW,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAC/C,YAAY,eAAe,KAAK,OAAM,GAAe,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACxE,WAAW,eAAc;EACvB,MAAM,SAAS,KAAK,UAAS,CAAE,EAAE,UAAU;EAC3C,OAAO,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC;CAC7B,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BA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AA,GAAA;EAAA,MAAA,CAAA,YAAU,EAAA,UAAA,KAAA,CAAA;CAAA,CAAA,EAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"magmonium-one-otp-CIGethTv.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/otp.ts"],"sourcesContent":["import {\n afterRenderEffect,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n signal,\n untracked,\n viewChildren,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { CommonModule } from '@angular/common';\nimport { OtpInput } from '../../model/input';\nimport { IS_DESIGN_MODE } from '../../../../config/tokens';\n\n@Component({\n selector: 'm-otp-input',\n template: `\n @if (otpConfig(); as otp) {\n <m-label\n [for]=\"otp.name\"\n [placeholder]=\"otp.label\"\n [params]=\"otp.params\"\n [required]=\"required()\"\n [disabled]=\"isDisabled()\"\n />\n <div class=\"otp-container\">\n @for (item of otpArray(); track $index) {\n <input\n [id]=\"$index === 0 ? (otp.name ?? '') : ''\"\n #otpInput\n type=\"text\"\n maxlength=\"1\"\n [class.error]=\"showErrors()\"\n [disabled]=\"isDisabled()\"\n [value]=\"otpValues()[$index] || ''\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (paste)=\"onPaste($event)\"\n />\n }\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n styleUrl: './otp.sass',\n imports: [LabelComponent, TextOutputComponent, CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class OtpInputComponent extends BaseTextInputComponent<OtpInput> {\n otpValues = signal<string[]>([]);\n otpInputs = viewChildren<ElementRef<HTMLInputElement>>('otpInput');\n protected readonly otpConfig = computed(() => this.config() as OtpInput);\n otpArray = computed(() => {\n const length = this.otpConfig()?.length || 6;\n return Array(length).fill(0);\n });\n\n // Inert on the Canvas — other inputs stay idle because they never autofocus;\n // OTP used to steal focus and look live while composing (DesignMode).\n private readonly isDesignMode = !!inject(IS_DESIGN_MODE, { optional: true });\n protected readonly isDisabled = computed(\n () => this.isDesignMode || this.disabled()\n );\n\n // BaseText answers `focused` by focusing its `#inputElement`, and an OTP has\n // none — it has a row of boxes. Without this the caret never lands on an OTP\n // field, so the form that opens on one (login's verification step) reads as\n // dead until the User clicks it.\n private hasAutofocused = false;\n\n constructor() {\n super();\n effect(() => {\n const length = this.otpConfig()?.length || 6;\n this.otpValues.set(Array(length).fill(''));\n });\n\n afterRenderEffect(() => {\n const inputs = this.otpInputs();\n if (!this.focused() || !inputs.length || this.hasAutofocused) return;\n this.hasAutofocused = true;\n untracked(() => this.focusInput(0));\n });\n }\n\n onInput = (event: Event, index: number): void => {\n if (this.isDisabled()) return;\n const input = event.target as HTMLInputElement;\n let value = input.value;\n\n value = value.replace(/[^a-zA-Z0-9]/g, '');\n\n if (value.length > 1) {\n value = value.slice(-1);\n }\n\n input.value = value.toUpperCase();\n\n const newValues = [...this.otpValues()];\n newValues[index] = value.toUpperCase();\n this.otpValues.set(newValues);\n\n const length = this.otpConfig()?.length || 6;\n if (value && index < length - 1) {\n this.focusInput(index + 1);\n }\n this.updateValue();\n };\n\n onKeyDown = (event: KeyboardEvent, index: number): void => {\n if (this.isDisabled()) return;\n const input = event.target as HTMLInputElement;\n const length = this.otpConfig()?.length || 6;\n\n const isAlphaNumeric = /^[a-zA-Z0-9]$/.test(event.key);\n const isControlKey = [\n 'Backspace',\n 'Delete',\n 'ArrowLeft',\n 'ArrowRight',\n 'Tab',\n ].includes(event.key);\n\n if (!isAlphaNumeric && !isControlKey) {\n event.preventDefault();\n return;\n }\n\n if (event.key === 'Backspace') {\n if (!input.value && index > 0) {\n this.focusInput(index - 1);\n }\n }\n if (event.key === 'ArrowLeft' && index > 0) {\n event.preventDefault();\n this.focusInput(index - 1);\n }\n if (event.key === 'ArrowRight' && index < length - 1) {\n event.preventDefault();\n this.focusInput(index + 1);\n }\n };\n\n onPaste = (event: ClipboardEvent): void => {\n if (this.isDisabled()) return;\n event.preventDefault();\n event.stopPropagation();\n\n const length = this.otpConfig()?.length || 6;\n const pastedData = event.clipboardData?.getData('text') || '';\n\n const alphanumeric = pastedData\n .replace(/[^a-zA-Z0-9]/g, '')\n .slice(0, length);\n\n if (alphanumeric.length > 0) {\n const newValues = Array(length).fill('');\n alphanumeric.split('').forEach((char, index) => {\n if (index < length) {\n newValues[index] = char.toUpperCase();\n }\n });\n\n this.otpValues.set(newValues);\n this.updateValue();\n\n const focusIndex = Math.min(alphanumeric.length, length - 1);\n setTimeout(() => this.focusInput(focusIndex), 0);\n }\n };\n\n private focusInput(index: number): void {\n if (this.isDisabled()) return;\n const inputs = this.otpInputs();\n if (inputs[index]) {\n inputs[index].nativeElement.focus();\n }\n }\n\n private updateValue(): void {\n const otpValue = this.otpValues().join('');\n this.setValue(otpValue);\n }\n}\n"],"mappings":";;;;;;;AA6DA,IAAa,oBAAb,MAAa,0BAA0B,uBAAgC;CACrE,YAAY,OAAiB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,YAAY,aAA2C,YAAW,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAC/C,YAAY,eAAe,KAAK,OAAM,GAAe,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACxE,WAAW,eAAc;EACvB,MAAM,SAAS,KAAK,UAAS,CAAE,EAAE,UAAU;EAC3C,OAAO,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC;CAC7B,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAIe,eAAe,CAAC,CAAC,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE;CACxD,aA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"}
@@ -2,7 +2,7 @@ import { c as TranslatePipe } from "./magmonium-one-size-converter-BqkALIWA.mjs"
2
2
  import { t as LabelComponent } from "./magmonium-one-label-23DjRQdd.mjs";
3
3
  import { t as ButtonComponent } from "./magmonium-one-button-CKHBcCoO.mjs";
4
4
  import { t as BaseTextInputComponent } from "./magmonium-one-base-text-ChjG3GNw.mjs";
5
- import { t as TextOutputComponent } from "./magmonium-one-text-output-M8sEPhFz.mjs";
5
+ import { t as TextOutputComponent } from "./magmonium-one-text-output-E6pe3IOL.mjs";
6
6
  import * as i0 from "@angular/core";
7
7
  import { ChangeDetectionStrategy, Component, computed, signal } from "@angular/core";
8
8
  var PasswordInputComponent = class PasswordInputComponent extends BaseTextInputComponent {
@@ -215,4 +215,4 @@ i0.ɵɵngDeclareClassMetadata({
215
215
  });
216
216
  export { PasswordInputComponent };
217
217
 
218
- //# sourceMappingURL=magmonium-one-password-CbivFrxS.mjs.map
218
+ //# sourceMappingURL=magmonium-one-password-kYLY972S.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-password-CbivFrxS.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/password.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n signal,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { TranslatePipe } from '../../../../pipe';\n\n@Component({\n selector: 'm-password-input',\n template: `\n @if (config(); as text) {\n <m-label\n [for]=\"text.name\"\n [placeholder]=\"text.label\"\n [params]=\"text.params\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n <div class=\"input-wrapper\">\n <input\n [id]=\"text.name ?? ''\"\n [attr.data-testid]=\"text.testid ?? (text.name ? text.name + '-input' : null)\"\n [value]=\"value()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [disabled]=\"disabled()\"\n [placeholder]=\"(text.placeholder ?? '') | translate: text.params\"\n (input)=\"onInput($event)\"\n (focus)=\"isFocused.set(true)\"\n (blur)=\"isFocused.set(false); touched.set(true)\"\n [type]=\"type()\"\n />\n <m-one-button\n type=\"button\"\n [disabled]=\"disabled()\"\n [name]=\"button()\"\n [color]=\"iconColor()\"\n (clicked)=\"toggleType()\"\n />\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent, ButtonComponent, TranslatePipe],\n styleUrl: './password.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PasswordInputComponent extends BaseTextInputComponent {\n isPassword = signal<boolean>(true);\n type = computed(() => (this.isPassword() ? 'password' : 'text'));\n button = computed(() => (!this.isPassword() ? 'eye' : 'eye_close'));\n\n protected toggleType() {\n this.isPassword.update((now) => !now);\n }\n\n protected onInput(event: Event): void {\n const target = event.target as HTMLInputElement;\n this.setValue(target?.value ?? '');\n }\n}\n"],"mappings":";;;;;;;AA4DA,IAAa,yBAAb,MAAa,+BAA+B,uBAAsB;CAChE,aAAa,OAAgB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,OAAO,eAAgB,KAAK,WAAU,IAAK,aAAa,QAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAChE,SAAS,eAAgB,CAAC,KAAK,WAAU,IAAK,QAAQ,aAAa,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEzD,aAAU;EAClB,KAAK,WAAW,QAAQ,QAAQ,CAAC,GAAG;CACtC;CAEU,QAAQ,OAAY;EAC5B,MAAM,SAAS,MAAM;EACrB,KAAK,SAAS,QAAQ,SAAS,EAAE;CACnC;CAZW,OAAA,OAAA,GAAA,mBAAA;EAAA,Y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AA"}
1
+ {"version":3,"file":"magmonium-one-password-kYLY972S.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/password.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n signal,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { TranslatePipe } from '../../../../pipe';\n\n@Component({\n selector: 'm-password-input',\n template: `\n @if (config(); as text) {\n <m-label\n [for]=\"text.name\"\n [placeholder]=\"text.label\"\n [params]=\"text.params\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n <div class=\"input-wrapper\">\n <input\n [id]=\"text.name ?? ''\"\n [attr.data-testid]=\"text.testid ?? (text.name ? text.name + '-input' : null)\"\n [value]=\"value()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [disabled]=\"disabled()\"\n [placeholder]=\"(text.placeholder ?? '') | translate: text.params\"\n (input)=\"onInput($event)\"\n (focus)=\"isFocused.set(true)\"\n (blur)=\"isFocused.set(false); touched.set(true)\"\n [type]=\"type()\"\n />\n <m-one-button\n type=\"button\"\n [disabled]=\"disabled()\"\n [name]=\"button()\"\n [color]=\"iconColor()\"\n (clicked)=\"toggleType()\"\n />\n </div>\n @if (showErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent, ButtonComponent, TranslatePipe],\n styleUrl: './password.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PasswordInputComponent extends BaseTextInputComponent {\n isPassword = signal<boolean>(true);\n type = computed(() => (this.isPassword() ? 'password' : 'text'));\n button = computed(() => (!this.isPassword() ? 'eye' : 'eye_close'));\n\n protected toggleType() {\n this.isPassword.update((now) => !now);\n }\n\n protected onInput(event: Event): void {\n const target = event.target as HTMLInputElement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QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,gBAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAa,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAIlE,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAsB,YAAA,CAAA;EAhDlC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAkB,UAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCT,SACQ;IAAC;IAAgB;IAAqB;IAAiB;GAAa;GAAC,iBAE7D,wBAAwB;GAAM,QAAA,CAAA,s8HAAA;EAAA,CAAA"}
@@ -4,7 +4,7 @@ import { t as LabelComponent } from "./magmonium-one-label-23DjRQdd.mjs";
4
4
  import { r as IconComponent } from "./magmonium-one-icon-CH-g8CUR.mjs";
5
5
  import { t as InputType } from "./magmonium-one-input-DqHPorA1.mjs";
6
6
  import { t as BaseTextInputComponent } from "./magmonium-one-base-text-ChjG3GNw.mjs";
7
- import { t as TextOutputComponent } from "./magmonium-one-text-output-M8sEPhFz.mjs";
7
+ import { t as TextOutputComponent } from "./magmonium-one-text-output-E6pe3IOL.mjs";
8
8
  import * as i0 from "@angular/core";
9
9
  import { ChangeDetectionStrategy, Component, computed, input, model } from "@angular/core";
10
10
  var text_exports = /* @__PURE__ */ __exportAll({ TextInputComponent: () => TextInputComponent });
@@ -407,4 +407,4 @@ i0.ɵɵngDeclareClassMetadata({
407
407
  });
408
408
  export { text_exports as n, TextInputComponent as t };
409
409
 
410
- //# sourceMappingURL=magmonium-one-text-CuKE9S8T.mjs.map
410
+ //# sourceMappingURL=magmonium-one-text-BMdY3Ryk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-text-CuKE9S8T.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/text.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { IconComponent } from '../../../icon';\nimport { TranslatePipe } from '../../../../pipe';\nimport { Input, InputType, NumberInput } from '../../model/input';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\n\n/**\n * What this one component draws: a line of text, or the same line typed\n * `number`. WrapperInputComponent has no case for a `number` Field, so it\n * lands here — and the figures a NumberInput carries have to be readable off\n * the config the template already holds.\n */\nexport type TextOrNumberInput = Omit<Input, 'type'> &\n Pick<NumberInput, 'min' | 'max' | 'step'> & {\n type: InputType.TEXT | InputType.NUMBER;\n };\n\n@Component({\n selector: 'm-text-input',\n template: `\n @if (config(); as text) {\n @if (text.label) {\n <m-label\n [for]=\"text.name ?? ''\"\n [placeholder]=\"text.label\"\n [params]=\"text.params\"\n [noTranslate]=\"text.noTranslate\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n }\n <div class=\"input-wrapper\">\n @if (text.icon) {\n <m-icon\n [name]=\"text.icon\"\n [color]=\"iconColor()\"\n [one]=\"text.one\"\n />\n }\n @if (text.prefix) {\n <span class=\"input-prefix\">{{ text.prefix }}</span>\n }\n <input\n [id]=\"text.name ?? ''\"\n [attr.data-testid]=\"text.testid ?? (text.name ? text.name + '-input' : null)\"\n [value]=\"value()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [class.has-icon]=\"!!text.icon\"\n [class.has-prefix]=\"!!text.prefix\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly() || config()?.readonly\"\n [placeholder]=\"text.placeholder ?? '' | translate: text.params\"\n (input)=\"onInput($event)\"\n (focus)=\"isFocused.set(true)\"\n (blur)=\"isFocused.set(false); touched.set(true)\"\n [type]=\"isNumber() ? 'number' : 'text'\"\n [attr.min]=\"isNumber() ? text.min ?? null : null\"\n [attr.max]=\"isNumber() ? text.max ?? null : null\"\n [attr.step]=\"isNumber() ? text.step ?? null : null\"\n />\n @if (config()?.status; as status) {\n <div class=\"input-indicator\" [class]=\"'input-indicator--' + status\">\n @if (status === 'checking') {\n <span class=\"spinner\"></span>\n } @else if (status === 'available') {\n <m-icon name=\"check\" color=\"success\" />\n }\n </div>\n }\n @if (text.suffix) {\n <span class=\"input-suffix\">{{ text.suffix }}</span>\n }\n </div>\n @if (showErrors() && !hideErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent, IconComponent, TranslatePipe],\n styleUrl: './text.sass',\n host: {\n '[class]': \"config()?.variant ? 'm-input--' + config()?.variant : ''\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TextInputComponent extends BaseTextInputComponent<TextOrNumberInput> {\n public override value = model<string>('');\n public override config = input<Partial<TextOrNumberInput> | undefined>();\n public override required = input<boolean>(false);\n public override disabled = input<boolean>(false);\n public override invalid = input<boolean>(false);\n public override touched = model<boolean>(false);\n public override focused = input<boolean>(false);\n public override errors = input<readonly WithOptionalFieldTree<ValidationError>[]>(\n []\n );\n public override showErrors = computed(() => this.touched() && this.invalid());\n readonly hideErrors = input<boolean>(false);\n\n // A `number` Field draws this same component (WrapperInputComponent has no\n // case of its own for it), so the type it declares decides the element it\n // draws. What *leaves* the field is coerced a level up, in the wrapper: an\n // `<input>` reads its value as text whatever its type, and every other\n // component on this base is a string field.\n protected readonly isNumber = computed(() => {\n const config = this.config();\n return !!config && config.type === InputType.NUMBER;\n });\n\n protected onInput(event: Event): void {\n const target = event.target as HTMLInputElement;\n this.setValue(target?.value ?? '');\n }\n}\n"],"mappings":";;;;;;;;;;AAqGA,I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AAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAmB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,gBAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAa,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,cAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAa,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAOhE,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EA3E9B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAc,UACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiET,SACQ;IAAC;IAAgB;IAAqB;IAAe;GAAa;GAAC,MAEtE,EACJ,WAAW,2DACZ;GAAA,iBACgB,wBAAwB;GAAM,QAAA,CAAA,k2MAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"magmonium-one-text-BMdY3Ryk.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/text/text.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n} from '@angular/core';\nimport { LabelComponent } from '../label';\nimport { TextOutputComponent } from '../../../text-output';\nimport { BaseTextInputComponent } from './base-text';\nimport { IconComponent } from '../../../icon';\nimport { TranslatePipe } from '../../../../pipe';\nimport { Input, InputType, NumberInput } from '../../model/input';\nimport { ValidationError, WithOptionalFieldTree } from '@angular/forms/signals';\n\n/**\n * What this one component draws: a line of text, or the same line typed\n * `number`. WrapperInputComponent has no case for a `number` Field, so it\n * lands here — and the figures a NumberInput carries have to be readable off\n * the config the template already holds.\n */\nexport type TextOrNumberInput = Omit<Input, 'type'> &\n Pick<NumberInput, 'min' | 'max' | 'step'> & {\n type: InputType.TEXT | InputType.NUMBER;\n };\n\n@Component({\n selector: 'm-text-input',\n template: `\n @if (config(); as text) {\n @if (text.label) {\n <m-label\n [for]=\"text.name ?? ''\"\n [placeholder]=\"text.label\"\n [params]=\"text.params\"\n [noTranslate]=\"text.noTranslate\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n />\n }\n <div class=\"input-wrapper\">\n @if (text.icon) {\n <m-icon\n [name]=\"text.icon\"\n [color]=\"iconColor()\"\n [one]=\"text.one\"\n />\n }\n @if (text.prefix) {\n <span class=\"input-prefix\">{{ text.prefix }}</span>\n }\n <input\n [id]=\"text.name ?? ''\"\n [attr.data-testid]=\"text.testid ?? (text.name ? text.name + '-input' : null)\"\n [value]=\"value()\"\n #inputElement\n [class.error]=\"showErrors()\"\n [class.has-icon]=\"!!text.icon\"\n [class.has-prefix]=\"!!text.prefix\"\n [disabled]=\"disabled()\"\n [readOnly]=\"readonly() || config()?.readonly\"\n [placeholder]=\"text.placeholder ?? '' | translate: text.params\"\n (input)=\"onInput($event)\"\n (focus)=\"isFocused.set(true)\"\n (blur)=\"isFocused.set(false); touched.set(true)\"\n [type]=\"isNumber() ? 'number' : 'text'\"\n [attr.min]=\"isNumber() ? text.min ?? null : null\"\n [attr.max]=\"isNumber() ? text.max ?? null : null\"\n [attr.step]=\"isNumber() ? text.step ?? null : null\"\n />\n @if (config()?.status; as status) {\n <div class=\"input-indicator\" [class]=\"'input-indicator--' + status\">\n @if (status === 'checking') {\n <span class=\"spinner\"></span>\n } @else if (status === 'available') {\n <m-icon name=\"check\" color=\"success\" />\n }\n </div>\n }\n @if (text.suffix) {\n <span class=\"input-suffix\">{{ text.suffix }}</span>\n }\n </div>\n @if (showErrors() && !hideErrors()) {\n @for (error of errors(); track $index) {\n <m-text-output\n variant=\"footer\"\n color=\"error\"\n [label]=\"error.message\"\n />\n }\n }\n }\n `,\n imports: [LabelComponent, TextOutputComponent, IconComponent, TranslatePipe],\n styleUrl: './text.sass',\n host: {\n '[class]': \"config()?.variant ? 'm-input--' + config()?.variant : ''\",\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TextInputComponent extends BaseTextInputComponent<TextOrNumberInput> {\n public override value = model<string>('');\n public override config = input<Partial<TextOrNumberInput> | undefined>();\n public override required = input<boolean>(false);\n public override disabled = input<boolean>(false);\n public override invalid = input<boolean>(false);\n public override touched = model<boolean>(false);\n public override focused = input<boolean>(false);\n public override errors = input<readonly WithOptionalFieldTree<ValidationError>[]>(\n []\n );\n public override showErrors = computed(() => this.touched() && this.invalid());\n readonly hideErrors = input<boolean>(false);\n\n // A `number` Field draws this same component (WrapperInputComponent has no\n // case of its own for it), so the type it declares decides the element it\n // draws. What *leaves* the field is coerced a level up, in the wrapper: an\n // `<input>` reads its value as text whatever its type, and every other\n // component on this base is a string field.\n protected readonly isNumber = computed(() => {\n const config = this.config();\n return !!config && config.type === InputType.NUMBER;\n });\n\n protected onInput(event: Event): void {\n const target = event.target as HTMLInputElement;\n this.setValue(target?.value ?? '');\n }\n}\n"],"mappings":";;;;;;;;;;AAqGA,IAAa,qBAAb,MAAa,2BAA2B,uBAAyC;CAC/D,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,SAAS,MAA+C,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,WAAW,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,UAAU,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CA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CAAA;;AAOhE,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EA3E9B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAc,UACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiET,SACQ;IAAC;IAAgB;IAAqB;IAAe;GAAa;GAAC,MAEtE,EACJ,WAAW,2DACZ;GAAA,iBACgB,wBAAwB;GAAM,QAAA,CAAA,k2MAAA;EAAA,CAAA"}
@@ -32,7 +32,7 @@ var TextOutputComponent = class TextOutputComponent extends ConfigComponent {
32
32
  const align = this.align();
33
33
  if (align !== void 0) overrides.align = align;
34
34
  const label = this.label();
35
- if (label !== void 0) overrides.label = label;
35
+ if (label !== void 0) overrides.label = String(label);
36
36
  const noTranslate = toAttrBool(this.noTranslate());
37
37
  if (noTranslate !== void 0) overrides.noTranslate = noTranslate;
38
38
  const variant = this.variant();
@@ -311,4 +311,4 @@ i0.ɵɵngDeclareClassMetadata({
311
311
  });
312
312
  export { TextOutputComponent as t };
313
313
 
314
- //# sourceMappingURL=magmonium-one-text-output-M8sEPhFz.mjs.map
314
+ //# sourceMappingURL=magmonium-one-text-output-E6pe3IOL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magmonium-one-text-output-E6pe3IOL.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/text-output/ui/text-output.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport { TranslateService } from '../../../services/translate';\nimport { ConfigComponent } from '../../../lib/components/config-component';\nimport { Config } from '../../../type/config/config-type';\nimport { LAYOUT_ASSET_FOLDER } from '../../../enum';\nimport { toAttrBool } from '../../../functions/config/attribute-value';\nimport { resolvePallet } from '../../../lib/theme/lib/color-utl';\n\nexport type TextOutputAlign = 'left' | 'right' | 'center';\n\n// Variants are roles, not styles: each one says what the text is doing on the\n// page, and the Section it sits in decides how big that role renders. Every\n// size below is therefore an `em` multiple of the inherited Section font-size\n// — a `lead` in a compact Section stays proportionally a lead — which is the\n// one rule the plain (undefined) variant keeps by inheriting outright.\n//\n// - `lead` opening paragraph that introduces the block under it\n// - `big` one-line statement — a number, a verdict, a headline that is\n// not a SectionHeader\n// - `bold` emphasis at body size, for the line that must be read first\n// - `footer` annotation under the thing it describes — a field's validation\n// message, a caption, a disclaimer; 0.75 of body, body colour\n// - `footnote` aside the reader may skip — source, legal line, small print;\n// 0.6 of body, body colour\n// - `link` text that goes somewhere on click — an affordance rather than\n// a size, so it is the one role that stays inline, takes focus,\n// and emits `clicked`\n// - `link-small` the same affordance for a link that trails the content it\n// belongs to rather than carrying a line of its own — a \"see\n// all\", an \"edit\" beside a field; body size like `link`\nexport type TextOutputVariant =\n | 'lead'\n | 'big'\n | 'bold'\n | 'footer'\n | 'footnote'\n | 'link'\n | 'link-small';\n\n// Weight tokens of the type scale. Applied after the variant, so it overrides\n// the weight a role implies (`lead` light, `big` semibold, `bold` bold).\nexport type TextOutputFontWeight =\n | 'light'\n | 'normal'\n | 'medium'\n | 'semibold'\n | 'bold';\n\nexport interface TextOutputConfig extends Config {\n label?: string;\n noTranslate?: boolean;\n align?: TextOutputAlign;\n variant?: TextOutputVariant;\n color?: string;\n fontWeight?: TextOutputFontWeight;\n}\n\n@Component({\n selector: 'm-text-output',\n imports: [],\n template: `\n <div\n class=\"m-text-output\"\n [style.color]=\"resolvedColorPallet().color\"\n [innerHTML]=\"html()\"\n ></div>\n `,\n styleUrl: './text-output.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'm-text-output-host',\n '[class.is-design-mode]': 'isDesignMode',\n '[class.align-left]': 'resolvedAlign() === \"left\"',\n '[class.align-right]': 'resolvedAlign() === \"right\"',\n '[class.align-center]': 'resolvedAlign() === \"center\"',\n '[class.variant-lead]': 'resolvedVariant() === \"lead\"',\n '[class.variant-big]': 'resolvedVariant() === \"big\"',\n '[class.variant-bold]': 'resolvedVariant() === \"bold\"',\n '[class.variant-footer]': 'resolvedVariant() === \"footer\"',\n '[class.variant-footnote]': 'resolvedVariant() === \"footnote\"',\n '[class.variant-link]': 'resolvedVariant() === \"link\"',\n '[class.variant-link-small]': 'resolvedVariant() === \"link-small\"',\n '[class.weight-light]': 'resolvedFontWeight() === \"light\"',\n '[class.weight-normal]': 'resolvedFontWeight() === \"normal\"',\n '[class.weight-medium]': 'resolvedFontWeight() === \"medium\"',\n '[class.weight-semibold]': 'resolvedFontWeight() === \"semibold\"',\n '[class.weight-bold]': 'resolvedFontWeight() === \"bold\"',\n '[class.has-color]': '!!(color() ?? config()?.color)',\n '[class.is-truncated]': '!!truncate()',\n // Only a link is reachable and announced as one. Every other variant is a\n // size, and a focus stop on plain text is a tab stop that does nothing.\n '[attr.role]': 'isLink() ? \"link\" : null',\n '[attr.tabindex]': 'isLink() ? 0 : null',\n '(click)': 'onClick()',\n '(keydown.enter)': 'onClick()',\n '[style.--m-text-output-color]': 'resolvedColorPallet().color',\n '[style.--m-text-output-color-contrast]': 'resolvedColorPallet().contrastColor',\n '[style.--m-text-output-color-opposite]': 'resolvedColorPallet().oppositeColor',\n },\n})\nexport class TextOutputComponent extends ConfigComponent<TextOutputConfig> {\n override subFolder = LAYOUT_ASSET_FOLDER.text_output;\n override config = model<Partial<TextOutputConfig>>();\n private readonly translateService = inject(TranslateService);\n\n readonly align = input<TextOutputAlign | undefined>(undefined);\n readonly variant = input<TextOutputVariant | undefined>(undefined);\n // A theme colour key (`error`, `warning`, `success`, …) or a raw CSS colour,\n // resolved the same way an Icon's or a Logo's is so a token follows the\n // active theme instead of freezing one theme's hex into a template.\n readonly color = input<string | undefined>(undefined);\n readonly fontWeight = input<TextOutputFontWeight | undefined>(undefined);\n // `label` is the text itself, so a one-off TextOutput needs no asset behind\n // it (ADR 0010). Numeric display values are stringified before entering the\n // text and translation pipeline.\n readonly label = input<string | number | undefined>(undefined);\n readonly noTranslate = input<boolean | string | undefined>(undefined);\n // Values for the message's `<name>` / `<$name>` placeholders. An input and\n // deliberately not a TextOutputConfig key: an asset is resolved by name and\n // shared across every Control that names it, and these differ per render\n // (ADR 0020). The query-string form (`min_length?len=6`) still works and\n // still loses to this on a shared placeholder, that being the precedence\n // TranslateService already had. Bind a named member — an object literal in a\n // template is refused by `no-inline-config` (ADR 0010).\n readonly params = input<Record<string, string> | undefined>(undefined);\n // One line, cut with an ellipsis at the box's edge rather than wrapping or\n // spilling into a neighbour. For text whose length says nothing about the\n // layout — a bound path drawn as `{store.a.b.c}` on the design Canvas.\n readonly truncate = input<boolean | undefined>(undefined);\n\n readonly resolvedAlign = computed<TextOutputAlign>(\n () => this.align() ?? this.config()?.align ?? 'left'\n );\n\n protected readonly resolvedVariant = computed<TextOutputVariant | undefined>(\n () => this.variant() ?? this.config()?.variant\n );\n\n protected readonly resolvedFontWeight = computed<\n TextOutputFontWeight | undefined\n >(() => this.fontWeight() ?? this.config()?.fontWeight);\n\n // Both link roles are the same affordance, so both take the focus stop, the\n // `role=\"link\"` and the `clicked` output; only their size differs.\n protected readonly isLink = computed(() => {\n const variant = this.resolvedVariant();\n return variant === 'link' || variant === 'link-small';\n });\n\n /**\n * Fired by a `link` variant and by nothing else. A text that is not a link\n * draws no affordance and takes no focus, so a click on it is a click on\n * prose — emitting there would be a control only a mouse could find.\n *\n * Where the link goes to a route instead, the caller attaches `routerLink`\n * and binds nothing here: one click means one thing.\n */\n readonly clicked = output<void>();\n\n protected onClick(): void {\n if (this.isLink()) this.clicked.emit();\n }\n\n protected readonly resolvedColorPallet = computed(() =>\n resolvePallet(\n this.color() ?? this.config()?.color ?? this.defaultColor,\n this.themeStore.color()\n )\n );\n\n protected override resolveComponentOverrides(): Partial<TextOutputConfig> {\n const overrides: Partial<TextOutputConfig> = {};\n const align = this.align();\n if (align !== undefined) overrides.align = align;\n const label = this.label();\n if (label !== undefined) overrides.label = String(label);\n const noTranslate = toAttrBool(this.noTranslate());\n if (noTranslate !== undefined) overrides.noTranslate = noTranslate;\n const variant = this.variant();\n if (variant !== undefined) overrides.variant = variant;\n const color = this.color();\n if (color !== undefined) overrides.color = color;\n const fontWeight = this.fontWeight();\n if (fontWeight !== undefined) overrides.fontWeight = fontWeight;\n return overrides;\n }\n\n protected readonly resolvedLabel = computed(() => this.config()?.label);\n protected readonly shouldTranslate = computed(\n () => !this.config()?.noTranslate\n );\n protected readonly html = computed(() => {\n const label = this.resolvedLabel();\n return this.shouldTranslate()\n ? this.translateService.translateToHtml(label, this.params())\n : this.translateService.toSafeHtml(label);\n });\n}\n"],"mappings":";;;;;AA4GA,IAAa,sBAAb,MAAa,4BAA4B,gBAAiC;CAC/D,YAAY,oBAAoB;CAChC,SAAS,MAAkC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACnC,mBAAmB,OAAO,gBAAgB;CAElD,QAAQ,MAAmC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACrD,UAAU,MAAqC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAIzD,QAAQ,MAA0B,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,aAAa,MAAwC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAI/D,QAAQ,MAAmC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACrD,cAAc,MAAoC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAQ5D,SAAS,MAA0C,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAI7D,WAAW,MAA2B,QAAU,GAA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B;IACxB,0BAA0B;IAC1B,4BAA4B;IAC5B,wBAAwB;IACxB,8BAA8B;IAC9B,wBAAwB;IACxB,yBAAyB;IACzB,yBAAyB;IACzB,2BAA2B;IAC3B,uBAAuB;IACvB,qBAAqB;IACrB,wBAAwB;IAGxB,eAAe;IACf,mBAAmB;IACnB,WAAW;IACX,mBAAmB;IACnB,iCAAiC;IACjC,0CAA0C;IAC1C,0CAA0C;GAC3C;GAAA,QAAA,CAAA,ogKAAA;EAAA,CAAA"}
@@ -11,20 +11,20 @@ import { a as isButtonName, c as formatBadgeCount, l as shouldShowBadge, n as SE
11
11
  import { t as MRefDirective } from "./magmonium-one-m-ref-DLIAzywu.mjs";
12
12
  import { i as OptionsSourceDirective, n as normalizeAssetOptions, r as presetDefaultOption, t as assetOptions } from "./magmonium-one-options-asset-BNd1hbLw.mjs";
13
13
  import { t as InputType } from "./magmonium-one-input-DqHPorA1.mjs";
14
- import { r as PLACED_CHECKBOX, t as CheckboxInputComponent } from "./magmonium-one-checkbox-CmPgvVHJ.mjs";
14
+ import { r as PLACED_CHECKBOX, t as CheckboxInputComponent } from "./magmonium-one-checkbox-CDoW9khf.mjs";
15
15
  import { a as ToolTipDirective, c as DragListItemDirective, d as MarginDirective, f as PaddingDirective, i as PositionDirective, l as DragListDirective, n as stringToColor, o as FileUploadDirective, p as SPACING_INWARD, r as HighlightDirective, s as AutosizeDirective, t as MHeroColorDirective, u as DraggableDirective } from "./magmonium-one-directives-DM6J1Hvs.mjs";
16
16
  import { t as HeaderComponent } from "./magmonium-one-header-CkW_6y7m.mjs";
17
17
  import { i as mergeUniqueWith, n as mergeUnique, r as mergeUniqueBy, t as ButtonGroupComponent } from "./magmonium-one-group-sz1ufuBT.mjs";
18
18
  import { n as ContextMenuBoxComponent, r as MenuComponent, t as ContextMenuComponent } from "./magmonium-one-menu-Nj_Aj1fs.mjs";
19
19
  import { t as BaseInputComponent } from "./magmonium-one-base-input-B92NOmxz.mjs";
20
20
  import { i as getScrollParent, n as activeElementWithin, r as classListSignal, t as BaseTextInputComponent } from "./magmonium-one-base-text-ChjG3GNw.mjs";
21
- import { t as TextOutputComponent } from "./magmonium-one-text-output-M8sEPhFz.mjs";
21
+ import { t as TextOutputComponent } from "./magmonium-one-text-output-E6pe3IOL.mjs";
22
22
  import { t as BaseCheckboxInputComponent } from "./magmonium-one-base-checkbox-LdM6dqF_.mjs";
23
23
  import { t as RadioInputComponent } from "./magmonium-one-radio-BjsRiF80.mjs";
24
- import { t as TextInputComponent } from "./magmonium-one-text-CuKE9S8T.mjs";
24
+ import { t as TextInputComponent } from "./magmonium-one-text-BMdY3Ryk.mjs";
25
25
  import { r as BaseArrayInputComponent, t as MultiRangeInputComponent } from "./magmonium-one-multi-range-DYIv7jB7.mjs";
26
26
  import { t as RangeInputComponent } from "./magmonium-one-range-M_HBccdt.mjs";
27
- import { n as DROPDOWN_IMPORTS, r as DROPDOWN_TEMPLATE, t as BaseDropdownComponent } from "./magmonium-one-base-dropdown-DMgBZ3oa.mjs";
27
+ import { n as DROPDOWN_IMPORTS, r as DROPDOWN_TEMPLATE, t as BaseDropdownComponent } from "./magmonium-one-base-dropdown-9gvOPGo2.mjs";
28
28
  import { o as isEditableImage, s as outputSize } from "./magmonium-one-image-frame-BTSaUSAi.mjs";
29
29
  import * as i0 from "@angular/core";
30
30
  import { ApplicationRef, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, DOCUMENT, DestroyRef, Directive, ElementRef, EventEmitter, HostAttributeToken, HostBinding, HostListener, Injectable, InjectionToken, Injector, Input, LOCALE_ID, Output, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation, afterEveryRender, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, contentChildren, createComponent, effect, forwardRef, inject, input, inputBinding, linkedSignal, makeEnvironmentProviders, model, numberAttribute, output, outputBinding, provideAppInitializer, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection, reflectComponentType, runInInjectionContext, signal, twoWayBinding, untracked, viewChild, viewChildren } from "@angular/core";
@@ -759,12 +759,12 @@ var SectionFormItemComponent = class SectionFormItemComponent extends ConfigComp
759
759
  break;
760
760
  }
761
761
  case InputType.PASSWORD: {
762
- const { PasswordInputComponent } = await import("./magmonium-one-password-CbivFrxS.mjs");
762
+ const { PasswordInputComponent } = await import("./magmonium-one-password-kYLY972S.mjs");
763
763
  this.createDynamicComponent(seq, PasswordInputComponent);
764
764
  break;
765
765
  }
766
766
  case InputType.OTP: {
767
- const { OtpInputComponent } = await import("./magmonium-one-otp-BOOJnnc2.mjs");
767
+ const { OtpInputComponent } = await import("./magmonium-one-otp-CIGethTv.mjs");
768
768
  this.createDynamicComponent(seq, OtpInputComponent);
769
769
  break;
770
770
  }
@@ -774,7 +774,7 @@ var SectionFormItemComponent = class SectionFormItemComponent extends ConfigComp
774
774
  break;
775
775
  }
776
776
  case InputType.CHECKBOX: {
777
- const { CheckboxInputComponent } = await import("./magmonium-one-checkbox-CmPgvVHJ.mjs").then((n) => n.n);
777
+ const { CheckboxInputComponent } = await import("./magmonium-one-checkbox-CDoW9khf.mjs").then((n) => n.n);
778
778
  this.createDynamicComponent(seq, CheckboxInputComponent, [], true);
779
779
  break;
780
780
  }
@@ -845,7 +845,7 @@ var SectionFormItemComponent = class SectionFormItemComponent extends ConfigComp
845
845
  break;
846
846
  }
847
847
  default: {
848
- const { TextInputComponent } = await import("./magmonium-one-text-CuKE9S8T.mjs").then((n) => n.n);
848
+ const { TextInputComponent } = await import("./magmonium-one-text-BMdY3Ryk.mjs").then((n) => n.n);
849
849
  this.createDynamicComponent(seq, TextInputComponent);
850
850
  break;
851
851
  }
@@ -23451,12 +23451,12 @@ var WrapperInputComponent = class WrapperInputComponent extends ConfigComponent
23451
23451
  break;
23452
23452
  }
23453
23453
  case InputType.PASSWORD: {
23454
- const { PasswordInputComponent } = await import("./magmonium-one-password-CbivFrxS.mjs");
23454
+ const { PasswordInputComponent } = await import("./magmonium-one-password-kYLY972S.mjs");
23455
23455
  this.createDynamicComponent(seq, PasswordInputComponent);
23456
23456
  break;
23457
23457
  }
23458
23458
  case InputType.OTP: {
23459
- const { OtpInputComponent } = await import("./magmonium-one-otp-BOOJnnc2.mjs");
23459
+ const { OtpInputComponent } = await import("./magmonium-one-otp-CIGethTv.mjs");
23460
23460
  this.createDynamicComponent(seq, OtpInputComponent);
23461
23461
  break;
23462
23462
  }
@@ -23466,7 +23466,7 @@ var WrapperInputComponent = class WrapperInputComponent extends ConfigComponent
23466
23466
  break;
23467
23467
  }
23468
23468
  case InputType.CHECKBOX: {
23469
- const { CheckboxInputComponent } = await import("./magmonium-one-checkbox-CmPgvVHJ.mjs").then((n) => n.n);
23469
+ const { CheckboxInputComponent } = await import("./magmonium-one-checkbox-CDoW9khf.mjs").then((n) => n.n);
23470
23470
  this.createDynamicComponent(seq, CheckboxInputComponent, [], true);
23471
23471
  break;
23472
23472
  }
@@ -23537,7 +23537,7 @@ var WrapperInputComponent = class WrapperInputComponent extends ConfigComponent
23537
23537
  break;
23538
23538
  }
23539
23539
  default: {
23540
- const { TextInputComponent } = await import("./magmonium-one-text-CuKE9S8T.mjs").then((n) => n.n);
23540
+ const { TextInputComponent } = await import("./magmonium-one-text-BMdY3Ryk.mjs").then((n) => n.n);
23541
23541
  this.createDynamicComponent(seq, TextInputComponent);
23542
23542
  break;
23543
23543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmonium/one",
3
- "version": "0.4.70",
3
+ "version": "0.4.71",
4
4
  "description": "Magmonium One — Angular design-system primitives for mm Apps",
5
5
  "author": "magmonium",
6
6
  "license": "MIT",
@@ -7982,7 +7982,7 @@ export declare class TextOutputComponent extends ConfigComponent<TextOutputConfi
7982
7982
  readonly variant: import("@angular/core").InputSignal<TextOutputVariant | undefined>;
7983
7983
  readonly color: import("@angular/core").InputSignal<string | undefined>;
7984
7984
  readonly fontWeight: import("@angular/core").InputSignal<TextOutputFontWeight | undefined>;
7985
- readonly label: import("@angular/core").InputSignal<string | undefined>;
7985
+ readonly label: import("@angular/core").InputSignal<string | number | undefined>;
7986
7986
  readonly noTranslate: import("@angular/core").InputSignal<string | boolean | undefined>;
7987
7987
  readonly params: import("@angular/core").InputSignal<Record<string, string> | undefined>;
7988
7988
  readonly truncate: import("@angular/core").InputSignal<boolean | undefined>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"magmonium-one-text-output-M8sEPhFz.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/text-output/ui/text-output.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport { TranslateService } from '../../../services/translate';\nimport { ConfigComponent } from '../../../lib/components/config-component';\nimport { Config } from '../../../type/config/config-type';\nimport { LAYOUT_ASSET_FOLDER } from '../../../enum';\nimport { toAttrBool } from '../../../functions/config/attribute-value';\nimport { resolvePallet } from '../../../lib/theme/lib/color-utl';\n\nexport type TextOutputAlign = 'left' | 'right' | 'center';\n\n// Variants are roles, not styles: each one says what the text is doing on the\n// page, and the Section it sits in decides how big that role renders. Every\n// size below is therefore an `em` multiple of the inherited Section font-size\n// — a `lead` in a compact Section stays proportionally a lead — which is the\n// one rule the plain (undefined) variant keeps by inheriting outright.\n//\n// - `lead` opening paragraph that introduces the block under it\n// - `big` one-line statement — a number, a verdict, a headline that is\n// not a SectionHeader\n// - `bold` emphasis at body size, for the line that must be read first\n// - `footer` annotation under the thing it describes — a field's validation\n// message, a caption, a disclaimer; 0.75 of body, body colour\n// - `footnote` aside the reader may skip — source, legal line, small print;\n// 0.6 of body, body colour\n// - `link` text that goes somewhere on click — an affordance rather than\n// a size, so it is the one role that stays inline, takes focus,\n// and emits `clicked`\n// - `link-small` the same affordance for a link that trails the content it\n// belongs to rather than carrying a line of its own — a \"see\n// all\", an \"edit\" beside a field; body size like `link`\nexport type TextOutputVariant =\n | 'lead'\n | 'big'\n | 'bold'\n | 'footer'\n | 'footnote'\n | 'link'\n | 'link-small';\n\n// Weight tokens of the type scale. Applied after the variant, so it overrides\n// the weight a role implies (`lead` light, `big` semibold, `bold` bold).\nexport type TextOutputFontWeight =\n | 'light'\n | 'normal'\n | 'medium'\n | 'semibold'\n | 'bold';\n\nexport interface TextOutputConfig extends Config {\n label?: string;\n noTranslate?: boolean;\n align?: TextOutputAlign;\n variant?: TextOutputVariant;\n color?: string;\n fontWeight?: TextOutputFontWeight;\n}\n\n@Component({\n selector: 'm-text-output',\n imports: [],\n template: `\n <div\n class=\"m-text-output\"\n [style.color]=\"resolvedColorPallet().color\"\n [innerHTML]=\"html()\"\n ></div>\n `,\n styleUrl: './text-output.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'm-text-output-host',\n '[class.is-design-mode]': 'isDesignMode',\n '[class.align-left]': 'resolvedAlign() === \"left\"',\n '[class.align-right]': 'resolvedAlign() === \"right\"',\n '[class.align-center]': 'resolvedAlign() === \"center\"',\n '[class.variant-lead]': 'resolvedVariant() === \"lead\"',\n '[class.variant-big]': 'resolvedVariant() === \"big\"',\n '[class.variant-bold]': 'resolvedVariant() === \"bold\"',\n '[class.variant-footer]': 'resolvedVariant() === \"footer\"',\n '[class.variant-footnote]': 'resolvedVariant() === \"footnote\"',\n '[class.variant-link]': 'resolvedVariant() === \"link\"',\n '[class.variant-link-small]': 'resolvedVariant() === \"link-small\"',\n '[class.weight-light]': 'resolvedFontWeight() === \"light\"',\n '[class.weight-normal]': 'resolvedFontWeight() === \"normal\"',\n '[class.weight-medium]': 'resolvedFontWeight() === \"medium\"',\n '[class.weight-semibold]': 'resolvedFontWeight() === \"semibold\"',\n '[class.weight-bold]': 'resolvedFontWeight() === \"bold\"',\n '[class.has-color]': '!!(color() ?? config()?.color)',\n '[class.is-truncated]': '!!truncate()',\n // Only a link is reachable and announced as one. Every other variant is a\n // size, and a focus stop on plain text is a tab stop that does nothing.\n '[attr.role]': 'isLink() ? \"link\" : null',\n '[attr.tabindex]': 'isLink() ? 0 : null',\n '(click)': 'onClick()',\n '(keydown.enter)': 'onClick()',\n '[style.--m-text-output-color]': 'resolvedColorPallet().color',\n '[style.--m-text-output-color-contrast]': 'resolvedColorPallet().contrastColor',\n '[style.--m-text-output-color-opposite]': 'resolvedColorPallet().oppositeColor',\n },\n})\nexport class TextOutputComponent extends ConfigComponent<TextOutputConfig> {\n override subFolder = LAYOUT_ASSET_FOLDER.text_output;\n override config = model<Partial<TextOutputConfig>>();\n private readonly translateService = inject(TranslateService);\n\n readonly align = input<TextOutputAlign | undefined>(undefined);\n readonly variant = input<TextOutputVariant | undefined>(undefined);\n // A theme colour key (`error`, `warning`, `success`, …) or a raw CSS colour,\n // resolved the same way an Icon's or a Logo's is so a token follows the\n // active theme instead of freezing one theme's hex into a template.\n readonly color = input<string | undefined>(undefined);\n readonly fontWeight = input<TextOutputFontWeight | undefined>(undefined);\n // `label` is the text itself, so a one-off TextOutput needs no asset behind\n // it (ADR 0010). MiniMark is a single string whatever it renders to, which\n // is what lets it ride on the tag at all.\n readonly label = input<string | undefined>(undefined);\n readonly noTranslate = input<boolean | string | undefined>(undefined);\n // Values for the message's `<name>` / `<$name>` placeholders. An input and\n // deliberately not a TextOutputConfig key: an asset is resolved by name and\n // shared across every Control that names it, and these differ per render\n // (ADR 0020). The query-string form (`min_length?len=6`) still works and\n // still loses to this on a shared placeholder, that being the precedence\n // TranslateService already had. Bind a named member — an object literal in a\n // template is refused by `no-inline-config` (ADR 0010).\n readonly params = input<Record<string, string> | undefined>(undefined);\n // One line, cut with an ellipsis at the box's edge rather than wrapping or\n // spilling into a neighbour. For text whose length says nothing about the\n // layout — a bound path drawn as `{store.a.b.c}` on the design Canvas.\n readonly truncate = input<boolean | undefined>(undefined);\n\n readonly resolvedAlign = computed<TextOutputAlign>(\n () => this.align() ?? this.config()?.align ?? 'left'\n );\n\n protected readonly resolvedVariant = computed<TextOutputVariant | undefined>(\n () => this.variant() ?? this.config()?.variant\n );\n\n protected readonly resolvedFontWeight = computed<\n TextOutputFontWeight | undefined\n >(() => this.fontWeight() ?? this.config()?.fontWeight);\n\n // Both link roles are the same affordance, so both take the focus stop, the\n // `role=\"link\"` and the `clicked` output; only their size differs.\n protected readonly isLink = computed(() => {\n const variant = this.resolvedVariant();\n return variant === 'link' || variant === 'link-small';\n });\n\n /**\n * Fired by a `link` variant and by nothing else. A text that is not a link\n * draws no affordance and takes no focus, so a click on it is a click on\n * prose — emitting there would be a control only a mouse could find.\n *\n * Where the link goes to a route instead, the caller attaches `routerLink`\n * and binds nothing here: one click means one thing.\n */\n readonly clicked = output<void>();\n\n protected onClick(): void {\n if (this.isLink()) this.clicked.emit();\n }\n\n protected readonly resolvedColorPallet = computed(() =>\n resolvePallet(\n this.color() ?? this.config()?.color ?? this.defaultColor,\n this.themeStore.color()\n )\n );\n\n protected override resolveComponentOverrides(): Partial<TextOutputConfig> {\n const overrides: Partial<TextOutputConfig> = {};\n const align = this.align();\n if (align !== undefined) overrides.align = align;\n const label = this.label();\n if (label !== undefined) overrides.label = label;\n const noTranslate = toAttrBool(this.noTranslate());\n if (noTranslate !== undefined) overrides.noTranslate = noTranslate;\n const variant = this.variant();\n if (variant !== undefined) overrides.variant = variant;\n const color = this.color();\n if (color !== undefined) overrides.color = color;\n const fontWeight = this.fontWeight();\n if (fontWeight !== undefined) overrides.fontWeight = fontWeight;\n return overrides;\n }\n\n protected readonly resolvedLabel = computed(() => this.config()?.label);\n protected readonly shouldTranslate = computed(\n () => !this.config()?.noTranslate\n );\n protected readonly html = computed(() => {\n const label = this.resolvedLabel();\n return this.shouldTranslate()\n ? this.translateService.translateToHtml(label, this.params())\n : this.translateService.toSafeHtml(label);\n });\n}\n"],"mappings":";;;;;AA4GA,IAAa,sBAAb,MAAa,4BAA4B,gBAAiC;CAC/D,YAAY,oBAAoB;CAChC,SAAS,MAAkC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACnC,mBAAmB,OAAO,gBAAgB;C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