@4sh/ui-kit 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +8 -0
- package/README.md +8 -0
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +69 -22
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +13 -4
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +12 -4
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +19 -8
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +30 -9
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +8 -3
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +10 -4
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms.mjs +46 -2
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
- package/mcp/data/component-api.json +14 -0
- package/mcp/data/text-search-docs.json +29 -9
- package/mcp/package.json +1 -1
- package/package.json +1 -1
- package/styles/utils/_mixins.scss +11 -0
- package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +16 -3
- package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +2 -0
- package/types/4sh-ui-kit-forms-ui-input-number.d.ts +4 -1
- package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +5 -1
- package/types/4sh-ui-kit-forms-ui-input.d.ts +2 -0
- package/types/4sh-ui-kit-forms-ui-textarea.d.ts +2 -0
- package/types/4sh-ui-kit-forms.d.ts +25 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4sh-ui-kit-forms-ui-input-otp.mjs","sources":["../../../projects/ui-kit/forms/ui-input-otp/src/lib/ui-input-otp.ts","../../../projects/ui-kit/forms/ui-input-otp/src/lib/ui-input-otp.html","../../../projects/ui-kit/forms/ui-input-otp/src/public-api.ts","../../../projects/ui-kit/forms/ui-input-otp/src/4sh-ui-kit-forms-ui-input-otp.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n Component,\n computed,\n contentChild,\n effect,\n ElementRef,\n forwardRef,\n inject,\n input,\n isDevMode,\n numberAttribute,\n output,\n signal,\n TemplateRef,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFieldControl } from '@4sh/ui-kit/forms';\nimport { warnMissingAccessibleName } from '@4sh/ui-kit/forms';\n\n/** Size of the OTP cells. `default` is the base. */\nexport type InputOtpSize = 'small' | 'default' | 'large';\n\n/** DOM event handlers handed to a custom `#input` cell template. */\nexport interface InputOtpCellEvents {\n /** Wire on `(input)`. */\n input: (event: Event) => void;\n /** Wire on `(keydown)`. */\n keydown: (event: KeyboardEvent) => void;\n /** Wire on `(focus)`. */\n focus: (event: FocusEvent) => void;\n /** Wire on `(blur)`. */\n blur: (event: FocusEvent) => void;\n /** Wire on `(paste)`. */\n paste: (event: ClipboardEvent) => void;\n}\n\n/** Context handed to the `#input` template (one per cell). */\nexport interface InputOtpCellContext {\n /** Current value of this cell (default `$implicit`). */\n $implicit: string;\n /** Same as `$implicit`, named for readability. */\n value: string;\n /** Zero-based index of the cell. */\n index: number;\n /** Event handlers to bind on the custom control (keeps the OTP behaviour). */\n events: InputOtpCellEvents;\n /** Roving tabindex for this cell (`0` for the active one, `-1` otherwise). */\n tabindex: number;\n}\n\n/**\n * ui-input-otp — headless one-time-password field: a row of single-character\n * cells backing a single string value.\n *\n * Each cell is a real native `<input maxlength=\"1\">`; the group carries\n * `role=\"group\"` and a **roving tabindex** so `Tab` enters/leaves the field as a\n * whole while `←`/`→` move between cells (`Backspace` clears and steps\n * back). Typing auto-advances, and pasting a code distributes it across the\n * cells. Interactive states (hover/focus/disabled) are pure CSS driven by the\n * `form.*` design tokens.\n *\n * - `mask` hides the characters (`type=\"password\"`).\n * - `integerOnly` restricts input to digits (`inputmode=\"numeric\"`).\n * - a `#input` template replaces the default cell with your own control (it\n * receives the value, index, roving tabindex and the event handlers to bind).\n *\n * Works standalone, with `[(ngModel)]`, reactive forms, or signal forms\n * (`[formField]`, Angular 22) — it is a `ControlValueAccessor` (interop handled by\n * `BaseControlValueAccessor`).\n *\n * @example\n * ```html\n * <ui-input-otp [(ngModel)]=\"code\" [length]=\"6\" [integerOnly]=\"true\" ariaLabel=\"Code de vérification\" />\n * ```\n */\n@Component({\n selector: 'ui-input-otp',\n imports: [NgTemplateOutlet],\n templateUrl: './ui-input-otp.html',\n styleUrl: './ui-input-otp.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputOtp), multi: true },\n ],\n host: {\n class: 'ui-input-otp',\n role: 'group',\n '[class._small]': \"size() === 'small'\",\n '[class._large]': \"size() === 'large'\",\n '[class._disabled]': 'isDisabled()',\n '[class._readonly]': 'readonly()',\n '[class._invalid]': 'isInvalid()',\n '[attr.aria-label]': 'ariaLabel() || null',\n '[attr.aria-labelledby]': 'ariaLabelledBy() || null',\n '[attr.aria-invalid]': \"isInvalid() ? 'true' : null\",\n '[attr.aria-disabled]': \"isDisabled() ? 'true' : null\",\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class UiInputOtp extends BaseFieldControl<string> {\n /** Number of cells (characters) to enter. */\n length = input(4, { transform: numberAttribute });\n /** Hide the characters (renders `type=\"password\"`). */\n mask = input(false, { transform: booleanAttribute });\n /** Restrict input to integers (`inputmode=\"numeric\"`, non-digits rejected). */\n integerOnly = input(false, { transform: booleanAttribute });\n /** Cell size. */\n size = input<InputOtpSize>('default');\n /** Accessible-name prefix of each cell (\"<prefix> N\"). Falls back to `ariaLabel`. */\n charAriaLabel = input<string>('Caractère');\n /** Focus the first cell on init. */\n autofocus = input(false, { transform: booleanAttribute });\n\n /** Emitted with the joined value on every change. */\n valueChange = output<string>();\n /** Emitted with the value once every cell is filled. */\n completed = output<string>();\n\n /** Custom cell template (`<ng-template #input let-value let-i=\"index\" let-events=\"events\">`). */\n protected readonly inputTemplate = contentChild<TemplateRef<InputOtpCellContext>>('input');\n\n /** @ignore */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** @ignore Per-cell characters (source of truth for the view). */\n private readonly tokens = signal<string[]>([]);\n /** @ignore Cell that owns the group's single tab stop (roving tabindex). */\n private readonly focusedIndex = signal(0);\n\n constructor() {\n super();\n\n // Optional autofocus on the first cell after the view exists.\n afterNextRender(() => {\n if (this.autofocus() && !this.isDisabled()) this.focusCell(0);\n });\n\n // A11y safeguard (dev only): the group needs an accessible name.\n if (isDevMode()) {\n effect(() => {\n if (!this.ariaLabel() && !this.ariaLabelledBy()) {\n warnMissingAccessibleName(\n 'ui-input-otp',\n 'Group has no accessible name: provide `ariaLabel` (or `ariaLabelledBy`).',\n );\n }\n });\n }\n }\n\n /** @ignore Native input type (masked → password). */\n protected readonly inputType = computed(() => (this.mask() ? 'password' : 'text'));\n /** @ignore Hint for the on-screen keyboard. */\n protected readonly inputMode = computed(() => (this.integerOnly() ? 'numeric' : 'text'));\n\n /** @ignore Render-ready list of cells (index + current value). */\n protected readonly cells = computed(() => {\n const tokens = this.tokens();\n return Array.from({ length: Math.max(0, this.length()) }, (_, index) => ({\n index,\n id: `${this.uid}-${index}`,\n value: tokens[index] ?? '',\n }));\n });\n\n override writeValue(value: string | number | null): void {\n this.tokens.set(this.toTokens(value));\n }\n\n /** @ignore */\n protected override uidPrefix(): string {\n return 'ui-input-otp';\n }\n\n /** Move focus to the first cell. */\n focus(options?: FocusOptions): void {\n this.focusCell(0, options);\n }\n\n /** @ignore Roving tabindex for a given cell (one `0`, the rest `-1`). */\n protected tabindexFor(index: number): number {\n const active = Math.min(this.focusedIndex(), this.length() - 1);\n return index === Math.max(0, active) ? 0 : -1;\n }\n\n /** @ignore Value shown in a cell. */\n protected cellValue(index: number): string {\n return this.tokens()[index] ?? '';\n }\n\n /** @ignore Handlers exposed to a custom `#input` template. */\n protected cellEvents(index: number): InputOtpCellEvents {\n return {\n input: (event: Event) => this.onInput(event, index),\n keydown: (event: KeyboardEvent) => this.onKeydown(event, index),\n focus: (event: FocusEvent) => this.onFocus(event, index),\n blur: () => {\n /* touched is emitted on group focusout */\n },\n paste: (event: ClipboardEvent) => this.onPaste(event, index),\n };\n }\n\n /** @ignore Cell input: single source of the per-cell value (view → form). */\n protected onInput(event: Event, index: number): void {\n if (this.readonly()) return;\n const target = event.target as HTMLInputElement;\n const raw = this.sanitize(target.value);\n\n // Multi-char (autofill / paste into a cell) → distribute across cells.\n if (raw.length > 1) {\n this.setFromIndex(index, raw);\n return;\n }\n\n const tokens = [...this.tokens()];\n tokens[index] = raw;\n target.value = raw; // reflect the sanitised value\n this.commit(tokens);\n\n const inputType = (event as InputEvent).inputType;\n if (raw) this.focusCell(index + 1);\n else if (inputType === 'deleteContentBackward') this.focusCell(index - 1);\n }\n\n /** @ignore Keyboard navigation + input guards. */\n protected onKeydown(event: KeyboardEvent, index: number): void {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const target = event.target as HTMLInputElement;\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this.focusCell(index - 1);\n return;\n case 'ArrowRight':\n event.preventDefault();\n this.focusCell(index + 1);\n return;\n case 'Home':\n event.preventDefault();\n this.focusCell(0);\n return;\n case 'End':\n event.preventDefault();\n this.focusCell(this.length() - 1);\n return;\n case 'ArrowUp':\n case 'ArrowDown':\n event.preventDefault();\n return;\n case 'Backspace':\n // Empty cell → clear + step back (a filled cell clears via native input).\n if (!target.value && !this.readonly()) {\n event.preventDefault();\n const tokens = [...this.tokens()];\n if (tokens[index - 1] !== undefined) tokens[index - 1] = '';\n this.commit(tokens);\n this.focusCell(index - 1);\n }\n return;\n default: {\n if (event.key.length !== 1) return; // let control keys through\n // Reject non-digits when integer-only.\n if (this.integerOnly() && !/^\\d$/.test(event.key)) event.preventDefault();\n }\n }\n }\n\n /** @ignore Select the cell content on focus + track the roving index. */\n protected onFocus(event: FocusEvent, index: number): void {\n this.focusedIndex.set(index);\n (event.target as HTMLInputElement).select?.();\n }\n\n /** @ignore Distribute a pasted code across the cells from `index`. */\n protected onPaste(event: ClipboardEvent, index: number): void {\n if (this.isDisabled() || this.readonly()) return;\n event.preventDefault();\n const pasted = this.sanitize(event.clipboardData?.getData('text') ?? '');\n if (pasted) this.setFromIndex(index, pasted);\n }\n\n /** @ignore Mark touched when focus leaves the whole group. */\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (!next || !this.host.nativeElement.contains(next)) this.emitTouch();\n }\n\n /** @ignore Write `chars` into the cells starting at `from`, then commit + focus. */\n private setFromIndex(from: number, chars: string): void {\n const tokens = [...this.tokens()];\n const max = this.length();\n let i = from;\n for (const ch of chars) {\n if (i >= max) break;\n tokens[i++] = ch;\n }\n this.commit(tokens);\n this.focusCell(Math.min(i, max - 1));\n }\n\n /** @ignore Persist the tokens, emit the joined value (+ `completed` when full). */\n private commit(tokens: string[]): void {\n const trimmed = tokens.slice(0, this.length());\n this.tokens.set(trimmed);\n const value = trimmed.join('');\n this.emitChange(value);\n this.valueChange.emit(value);\n if (value.length === this.length() && trimmed.every((c) => c !== '')) {\n this.completed.emit(value);\n }\n }\n\n /** @ignore Focus (and select) the cell at `index`, if it exists. */\n private focusCell(index: number, options?: FocusOptions): void {\n if (index < 0 || index >= this.length()) return;\n this.focusedIndex.set(index);\n const el = this.host.nativeElement.querySelectorAll<HTMLInputElement>('input')[index];\n if (el) {\n el.focus(options);\n el.select();\n }\n }\n\n /** @ignore Split a form value into an array of single characters (bounded). */\n private toTokens(value: string | number | null | undefined): string[] {\n if (value === null || value === undefined || value === '') return [];\n return String(value).split('').slice(0, this.length());\n }\n\n /** @ignore Drop non-digits when integer-only, otherwise pass through. */\n private sanitize(value: string): string {\n return this.integerOnly() ? value.replace(/\\D/g, '') : value;\n }\n}\n","@for (cell of cells(); track cell.index) {\n @if (inputTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.value,\n value: cell.value,\n index: cell.index,\n events: cellEvents(cell.index),\n tabindex: tabindexFor(cell.index),\n }\"\n />\n } @else {\n <input\n class=\"ui-input-otp-cell\"\n [id]=\"cell.id\"\n [type]=\"inputType()\"\n [value]=\"cell.value\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n [attr.inputmode]=\"inputMode()\"\n [attr.name]=\"name() ? name() + '-' + cell.index : null\"\n [attr.tabindex]=\"tabindexFor(cell.index)\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"(ariaLabel() || charAriaLabel()) + ' ' + (cell.index + 1)\"\n [attr.aria-invalid]=\"isInvalid() ? 'true' : null\"\n (input)=\"onInput($event, cell.index)\"\n (keydown)=\"onKeydown($event, cell.index)\"\n (focus)=\"onFocus($event, cell.index)\"\n (paste)=\"onPaste($event, cell.index)\"\n />\n }\n}\n","/*\n * Public API Surface of ui-kit/ui-input-otp\n */\n\nexport * from './lib/ui-input-otp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAqDA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AAwBG,MAAO,UAAW,SAAQ,gBAAwB,CAAA;AA6BtD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;QA5BT,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,CAAC,8EAAI,SAAS,EAAE,eAAe,EAAA,CAA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":"4sh-ui-kit-forms-ui-input-otp.mjs","sources":["../../../projects/ui-kit/forms/ui-input-otp/src/lib/ui-input-otp.ts","../../../projects/ui-kit/forms/ui-input-otp/src/lib/ui-input-otp.html","../../../projects/ui-kit/forms/ui-input-otp/src/public-api.ts","../../../projects/ui-kit/forms/ui-input-otp/src/4sh-ui-kit-forms-ui-input-otp.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n Component,\n computed,\n contentChild,\n effect,\n ElementRef,\n forwardRef,\n inject,\n input,\n isDevMode,\n numberAttribute,\n output,\n signal,\n TemplateRef,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFieldControl, hasFocus, UiBrowserFill } from '@4sh/ui-kit/forms';\nimport { warnMissingAccessibleName } from '@4sh/ui-kit/forms';\n\n/** Size of the OTP cells. `default` is the base. */\nexport type InputOtpSize = 'small' | 'default' | 'large';\n\n/** DOM event handlers handed to a custom `#input` cell template. */\nexport interface InputOtpCellEvents {\n /** Wire on `(input)`. */\n input: (event: Event) => void;\n /** Wire on `(keydown)`. */\n keydown: (event: KeyboardEvent) => void;\n /** Wire on `(focus)`. */\n focus: (event: FocusEvent) => void;\n /** Wire on `(blur)`. */\n blur: (event: FocusEvent) => void;\n /** Wire on `(paste)`. */\n paste: (event: ClipboardEvent) => void;\n /** Wire on `(browserFill)` of a cell marked `uiBrowserFill`. */\n browserFill: (event: Event) => void;\n}\n\n/** Context handed to the `#input` template (one per cell). */\nexport interface InputOtpCellContext {\n /** Current value of this cell (default `$implicit`). */\n $implicit: string;\n /** Same as `$implicit`, named for readability. */\n value: string;\n /** Zero-based index of the cell. */\n index: number;\n /** Event handlers to bind on the custom control (keeps the OTP behaviour). */\n events: InputOtpCellEvents;\n /** Roving tabindex for this cell (`0` for the active one, `-1` otherwise). */\n tabindex: number;\n}\n\n/**\n * ui-input-otp — headless one-time-password field: a row of single-character\n * cells backing a single string value.\n *\n * Each cell is a real native `<input maxlength=\"1\">`; the group carries\n * `role=\"group\"` and a **roving tabindex** so `Tab` enters/leaves the field as a\n * whole while `←`/`→` move between cells (`Backspace` clears and steps\n * back). Typing auto-advances, and pasting a code distributes it across the\n * cells. Interactive states (hover/focus/disabled) are pure CSS driven by the\n * `form.*` design tokens.\n *\n * - `mask` hides the characters (`type=\"password\"`).\n * - `integerOnly` restricts input to digits (`inputmode=\"numeric\"`).\n * - a `#input` template replaces the default cell with your own control (it\n * receives the value, index, roving tabindex and the event handlers to bind).\n *\n * Works standalone, with `[(ngModel)]`, reactive forms, or signal forms\n * (`[formField]`, Angular 22) — it is a `ControlValueAccessor` (interop handled by\n * `BaseControlValueAccessor`).\n *\n * @example\n * ```html\n * <ui-input-otp [(ngModel)]=\"code\" [length]=\"6\" [integerOnly]=\"true\" ariaLabel=\"Code de vérification\" />\n * ```\n */\n@Component({\n selector: 'ui-input-otp',\n imports: [NgTemplateOutlet, UiBrowserFill],\n templateUrl: './ui-input-otp.html',\n styleUrl: './ui-input-otp.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputOtp), multi: true },\n ],\n host: {\n class: 'ui-input-otp',\n role: 'group',\n '[class._small]': \"size() === 'small'\",\n '[class._large]': \"size() === 'large'\",\n '[class._disabled]': 'isDisabled()',\n '[class._readonly]': 'readonly()',\n '[class._invalid]': 'isInvalid()',\n '[attr.aria-label]': 'ariaLabel() || null',\n '[attr.aria-labelledby]': 'ariaLabelledBy() || null',\n '[attr.aria-invalid]': \"isInvalid() ? 'true' : null\",\n '[attr.aria-disabled]': \"isDisabled() ? 'true' : null\",\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class UiInputOtp extends BaseFieldControl<string> {\n /** Number of cells (characters) to enter. */\n length = input(4, { transform: numberAttribute });\n /** Hide the characters (renders `type=\"password\"`). */\n mask = input(false, { transform: booleanAttribute });\n /** Restrict input to integers (`inputmode=\"numeric\"`, non-digits rejected). */\n integerOnly = input(false, { transform: booleanAttribute });\n /** Cell size. */\n size = input<InputOtpSize>('default');\n /** Accessible-name prefix of each cell (\"<prefix> N\"). Falls back to `ariaLabel`. */\n charAriaLabel = input<string>('Caractère');\n /** Focus the first cell on init. */\n autofocus = input(false, { transform: booleanAttribute });\n\n /** Emitted with the joined value on every change. */\n valueChange = output<string>();\n /** Emitted with the value once every cell is filled. */\n completed = output<string>();\n\n /** Custom cell template (`<ng-template #input let-value let-i=\"index\" let-events=\"events\">`). */\n protected readonly inputTemplate = contentChild<TemplateRef<InputOtpCellContext>>('input');\n\n /** @ignore */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** @ignore Per-cell characters (source of truth for the view). */\n private readonly tokens = signal<string[]>([]);\n /** @ignore Cell that owns the group's single tab stop (roving tabindex). */\n private readonly focusedIndex = signal(0);\n\n constructor() {\n super();\n\n // Optional autofocus on the first cell after the view exists.\n afterNextRender(() => {\n if (this.autofocus() && !this.isDisabled()) this.focusCell(0);\n });\n\n // A11y safeguard (dev only): the group needs an accessible name.\n if (isDevMode()) {\n effect(() => {\n if (!this.ariaLabel() && !this.ariaLabelledBy()) {\n warnMissingAccessibleName(\n 'ui-input-otp',\n 'Group has no accessible name: provide `ariaLabel` (or `ariaLabelledBy`).',\n );\n }\n });\n }\n }\n\n /** @ignore Native input type (masked → password). */\n protected readonly inputType = computed(() => (this.mask() ? 'password' : 'text'));\n /** @ignore Hint for the on-screen keyboard. */\n protected readonly inputMode = computed(() => (this.integerOnly() ? 'numeric' : 'text'));\n\n /** @ignore Render-ready list of cells (index + current value). */\n protected readonly cells = computed(() => {\n const tokens = this.tokens();\n return Array.from({ length: Math.max(0, this.length()) }, (_, index) => ({\n index,\n id: `${this.uid}-${index}`,\n value: tokens[index] ?? '',\n }));\n });\n\n override writeValue(value: string | number | null): void {\n this.tokens.set(this.toTokens(value));\n }\n\n /** @ignore */\n protected override uidPrefix(): string {\n return 'ui-input-otp';\n }\n\n /** Move focus to the first cell. */\n focus(options?: FocusOptions): void {\n this.focusCell(0, options);\n }\n\n /** @ignore Roving tabindex for a given cell (one `0`, the rest `-1`). */\n protected tabindexFor(index: number): number {\n const active = Math.min(this.focusedIndex(), this.length() - 1);\n return index === Math.max(0, active) ? 0 : -1;\n }\n\n /** @ignore Value shown in a cell. */\n protected cellValue(index: number): string {\n return this.tokens()[index] ?? '';\n }\n\n /** @ignore Handlers exposed to a custom `#input` template. */\n protected cellEvents(index: number): InputOtpCellEvents {\n return {\n input: (event: Event) => this.onInput(event, index),\n keydown: (event: KeyboardEvent) => this.onKeydown(event, index),\n focus: (event: FocusEvent) => this.onFocus(event, index),\n blur: () => {\n /* touched is emitted on group focusout */\n },\n paste: (event: ClipboardEvent) => this.onPaste(event, index),\n browserFill: (event: Event) => this.onBrowserFill(event, index),\n };\n }\n\n /** @ignore Cell input: single source of the per-cell value (view → form). */\n protected onInput(event: Event, index: number): void {\n if (this.readonly()) return;\n const target = event.target as HTMLInputElement;\n const raw = this.sanitize(target.value);\n // A value written by the browser into a cell without focus must not pull the focus in.\n const typed = hasFocus(target);\n\n // Multi-char (autofill / paste into a cell) → distribute across cells.\n if (raw.length > 1) {\n target.value = raw.charAt(0);\n this.setFromIndex(index, raw, typed);\n return;\n }\n\n const tokens = [...this.tokens()];\n tokens[index] = raw;\n target.value = raw; // reflect the sanitised value\n this.commit(tokens);\n if (!typed) return;\n\n const inputType = (event as InputEvent).inputType;\n if (raw) this.focusCell(index + 1);\n else if (inputType === 'deleteContentBackward') this.focusCell(index - 1);\n }\n\n /** @ignore Value written by the browser into a cell without an `input` event. */\n protected onBrowserFill(event: Event, index: number): void {\n if ((event.target as HTMLInputElement).value !== this.cellValue(index)) {\n this.onInput(event, index);\n }\n }\n\n /** @ignore Keyboard navigation + input guards. */\n protected onKeydown(event: KeyboardEvent, index: number): void {\n // Chrome's autofill dispatches a bare `Event`, without `key`.\n if (!(event instanceof KeyboardEvent)) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const target = event.target as HTMLInputElement;\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this.focusCell(index - 1);\n return;\n case 'ArrowRight':\n event.preventDefault();\n this.focusCell(index + 1);\n return;\n case 'Home':\n event.preventDefault();\n this.focusCell(0);\n return;\n case 'End':\n event.preventDefault();\n this.focusCell(this.length() - 1);\n return;\n case 'ArrowUp':\n case 'ArrowDown':\n event.preventDefault();\n return;\n case 'Backspace':\n // Empty cell → clear + step back (a filled cell clears via native input).\n if (!target.value && !this.readonly()) {\n event.preventDefault();\n const tokens = [...this.tokens()];\n if (tokens[index - 1] !== undefined) tokens[index - 1] = '';\n this.commit(tokens);\n this.focusCell(index - 1);\n }\n return;\n default: {\n if (event.key.length !== 1) return; // let control keys through\n // Reject non-digits when integer-only.\n if (this.integerOnly() && !/^\\d$/.test(event.key)) event.preventDefault();\n }\n }\n }\n\n /** @ignore Select the cell content on focus + track the roving index. */\n protected onFocus(event: FocusEvent, index: number): void {\n const cell = event.target as HTMLInputElement;\n // Chrome's autofill sends a focus event to a cell it fills without focusing it,\n // and `select()` would pull the focus in.\n if (!hasFocus(cell)) return;\n this.focusedIndex.set(index);\n cell.select?.();\n }\n\n /** @ignore Distribute a pasted code across the cells from `index`. */\n protected onPaste(event: ClipboardEvent, index: number): void {\n if (this.isDisabled() || this.readonly()) return;\n event.preventDefault();\n const pasted = this.sanitize(event.clipboardData?.getData('text') ?? '');\n if (pasted) this.setFromIndex(index, pasted);\n }\n\n /** @ignore Mark touched when focus leaves the whole group. */\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (!next || !this.host.nativeElement.contains(next)) this.emitTouch();\n }\n\n /** @ignore Write `chars` into the cells starting at `from`, then commit (+ focus). */\n private setFromIndex(from: number, chars: string, moveFocus = true): void {\n const tokens = [...this.tokens()];\n const max = this.length();\n let i = from;\n for (const ch of chars) {\n if (i >= max) break;\n tokens[i++] = ch;\n }\n this.commit(tokens);\n if (moveFocus) this.focusCell(Math.min(i, max - 1));\n }\n\n /** @ignore Persist the tokens, emit the joined value (+ `completed` when full). */\n private commit(tokens: string[]): void {\n const trimmed = tokens.slice(0, this.length());\n this.tokens.set(trimmed);\n const value = trimmed.join('');\n this.emitChange(value);\n this.valueChange.emit(value);\n if (value.length === this.length() && trimmed.every((c) => c !== '')) {\n this.completed.emit(value);\n }\n }\n\n /** @ignore Focus (and select) the cell at `index`, if it exists. */\n private focusCell(index: number, options?: FocusOptions): void {\n if (index < 0 || index >= this.length()) return;\n this.focusedIndex.set(index);\n const el = this.host.nativeElement.querySelectorAll<HTMLInputElement>('input')[index];\n if (el) {\n el.focus(options);\n el.select();\n }\n }\n\n /** @ignore Split a form value into an array of single characters (bounded). */\n private toTokens(value: string | number | null | undefined): string[] {\n if (value === null || value === undefined || value === '') return [];\n return String(value).split('').slice(0, this.length());\n }\n\n /** @ignore Drop non-digits when integer-only, otherwise pass through. */\n private sanitize(value: string): string {\n return this.integerOnly() ? value.replace(/\\D/g, '') : value;\n }\n}\n","@for (cell of cells(); track cell.index) {\n @if (inputTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.value,\n value: cell.value,\n index: cell.index,\n events: cellEvents(cell.index),\n tabindex: tabindexFor(cell.index),\n }\"\n />\n } @else {\n <input\n uiBrowserFill\n class=\"ui-input-otp-cell\"\n [id]=\"cell.id\"\n [type]=\"inputType()\"\n [value]=\"cell.value\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n [attr.inputmode]=\"inputMode()\"\n [attr.name]=\"name() ? name() + '-' + cell.index : null\"\n [attr.tabindex]=\"tabindexFor(cell.index)\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [attr.aria-label]=\"(ariaLabel() || charAriaLabel()) + ' ' + (cell.index + 1)\"\n [attr.aria-invalid]=\"isInvalid() ? 'true' : null\"\n (input)=\"onInput($event, cell.index)\"\n (browserFill)=\"onBrowserFill($event, cell.index)\"\n (keydown)=\"onKeydown($event, cell.index)\"\n (focus)=\"onFocus($event, cell.index)\"\n (paste)=\"onPaste($event, cell.index)\"\n />\n }\n}\n","/*\n * Public API Surface of ui-kit/ui-input-otp\n */\n\nexport * from './lib/ui-input-otp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AAwBG,MAAO,UAAW,SAAQ,gBAAwB,CAAA;AA6BtD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;QA5BT,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,CAAC,8EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;QAEjD,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,KAAK,4EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAEpD,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,KAAK,mFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAE3D,IAAA,CAAA,IAAI,GAAG,KAAK,CAAe,SAAS;iFAAC;;QAErC,IAAA,CAAA,aAAa,GAAG,KAAK,CAAS,WAAW;0FAAC;;QAE1C,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAGzD,IAAA,CAAA,WAAW,GAAG,MAAM,EAAU;;QAE9B,IAAA,CAAA,SAAS,GAAG,MAAM,EAAU;;QAGT,IAAA,CAAA,aAAa,GAAG,YAAY,CAAmC,OAAO;0FAAC;;AAGzE,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;QAElD,IAAA,CAAA,MAAM,GAAG,MAAM,CAAW,EAAE;mFAAC;;QAE7B,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,CAAC;yFAAC;;AAwBtB,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,IAA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AA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3H3F;;AAEG;;ACFH;;AAEG;;"}
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, contentChild, output, viewChild, computed, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
-
import { BaseFormField } from '@4sh/ui-kit/forms';
|
|
5
|
+
import { BaseFormField, UiBrowserFill } from '@4sh/ui-kit/forms';
|
|
6
6
|
import { UiField } from '@4sh/ui-kit/forms/ui-field';
|
|
7
7
|
import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
|
|
8
8
|
|
|
@@ -170,17 +170,22 @@ class UiInput extends BaseFormField {
|
|
|
170
170
|
this.emitChange(value);
|
|
171
171
|
this.valueChange.emit(value);
|
|
172
172
|
}
|
|
173
|
+
/** @ignore Value written by the browser without an `input` event. */
|
|
174
|
+
onBrowserFill() {
|
|
175
|
+
if (this.inputEl().nativeElement.value !== this.renderedValue())
|
|
176
|
+
this.onInput();
|
|
177
|
+
}
|
|
173
178
|
/** @ignore */
|
|
174
179
|
onBlur(event) {
|
|
175
180
|
this.emitTouch();
|
|
176
181
|
this.inputBlur.emit(event);
|
|
177
182
|
}
|
|
178
183
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInput, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
179
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiInput, isStandalone: true, selector: "ui-input", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, ariaHasPopup: { classPropertyName: "ariaHasPopup", publicName: "ariaHasPopup", isSignal: true, isRequired: false, transformFunction: null }, ariaExpanded: { classPropertyName: "ariaExpanded", publicName: "ariaExpanded", isSignal: true, isRequired: false, transformFunction: null }, ariaControls: { classPropertyName: "ariaControls", publicName: "ariaControls", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, iconLeft: { classPropertyName: "iconLeft", publicName: "iconLeft", isSignal: true, isRequired: false, transformFunction: null }, iconRight: { classPropertyName: "iconRight", publicName: "iconRight", isSignal: true, isRequired: false, transformFunction: null }, iconRightAriaLabel: { classPropertyName: "iconRightAriaLabel", publicName: "iconRightAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, iconLeftTemplate: { classPropertyName: "iconLeftTemplate", publicName: "iconLeftTemplate", isSignal: true, isRequired: false, transformFunction: null }, iconRightTemplate: { classPropertyName: "iconRightTemplate", publicName: "iconRightTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", iconRightClick: "iconRightClick", inputFocus: "inputFocus", inputBlur: "inputBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInput), multi: true }], queries: [{ propertyName: "iconLeftTemplateContent", first: true, predicate: ["iconLeft"], descendants: true, isSignal: true }, { propertyName: "iconRightTemplateContent", first: true, predicate: ["iconRight"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft() || !!resolvedIconLeftTemplate()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (resolvedIconLeftTemplate(); as tpl) {\n <span uiFieldPrefix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"leftIconContext()\" />\n </span>\n } @else if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n class=\"ui-input-native\"\n [class._small]=\"size() === 'small'\"\n [type]=\"type()\"\n [id]=\"resolvedId()\"\n [value]=\"renderedValue()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.autocomplete]=\"autocomplete() || null\"\n [attr.maxlength]=\"maxlength()\"\n [attr.role]=\"nativeRole()\"\n [attr.aria-haspopup]=\"ariaHasPopup() || null\"\n [attr.aria-expanded]=\"ariaExpanded() ?? null\"\n [attr.aria-controls]=\"ariaControls() || null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"resolvedAriaDescribedBy()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (focus)=\"inputFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (unit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-unit\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (iconRight() || resolvedIconRightTemplate()) {\n @if (hasRightAction()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-input-action\"\n [attr.aria-label]=\"iconRightAriaLabel()\"\n [disabled]=\"isDisabled()\"\n (click)=\"iconRightClick.emit($event)\"\n >\n @if (resolvedIconRightTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n } @else {\n <ui-icon [name]=\"iconRight()!\" [size]=\"iconSize()\" />\n }\n </button>\n } @else if (resolvedIconRightTemplate(); as tpl) {\n <span uiFieldSuffix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n </span>\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"iconRight()!\"\n [size]=\"iconSize()\"\n />\n }\n }\n</ui-field>\n", styles: [".ui-input-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-native._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{font-family:var(--ui-input-font-family, var(--fontfamily-base));font-size:var(--ui-input-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-unit._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-action{display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1;flex-shrink:0;padding:0;border:none;background:none;color:var(--ui-form-field-action-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-action:hover:not(:disabled){color:var(--ui-form-field-action-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-action-surface-hover, var(--form-high-surface-hover))}.ui-input-action:focus-visible{outline:none;color:var(--ui-form-field-action-color-focus, var(--form-high-content-focused));background-color:var(--ui-form-field-action-surface-focus, var(--form-high-surface-focused))}.ui-input-action:disabled{cursor:not-allowed;color:var(--ui-form-field-action-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
184
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiInput, isStandalone: true, selector: "ui-input", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, ariaHasPopup: { classPropertyName: "ariaHasPopup", publicName: "ariaHasPopup", isSignal: true, isRequired: false, transformFunction: null }, ariaExpanded: { classPropertyName: "ariaExpanded", publicName: "ariaExpanded", isSignal: true, isRequired: false, transformFunction: null }, ariaControls: { classPropertyName: "ariaControls", publicName: "ariaControls", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, iconLeft: { classPropertyName: "iconLeft", publicName: "iconLeft", isSignal: true, isRequired: false, transformFunction: null }, iconRight: { classPropertyName: "iconRight", publicName: "iconRight", isSignal: true, isRequired: false, transformFunction: null }, iconRightAriaLabel: { classPropertyName: "iconRightAriaLabel", publicName: "iconRightAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, iconLeftTemplate: { classPropertyName: "iconLeftTemplate", publicName: "iconLeftTemplate", isSignal: true, isRequired: false, transformFunction: null }, iconRightTemplate: { classPropertyName: "iconRightTemplate", publicName: "iconRightTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", iconRightClick: "iconRightClick", inputFocus: "inputFocus", inputBlur: "inputBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInput), multi: true }], queries: [{ propertyName: "iconLeftTemplateContent", first: true, predicate: ["iconLeft"], descendants: true, isSignal: true }, { propertyName: "iconRightTemplateContent", first: true, predicate: ["iconRight"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft() || !!resolvedIconLeftTemplate()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (resolvedIconLeftTemplate(); as tpl) {\n <span uiFieldPrefix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"leftIconContext()\" />\n </span>\n } @else if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-native\"\n [class._small]=\"size() === 'small'\"\n [type]=\"type()\"\n [id]=\"resolvedId()\"\n [value]=\"renderedValue()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.autocomplete]=\"autocomplete() || null\"\n [attr.maxlength]=\"maxlength()\"\n [attr.role]=\"nativeRole()\"\n [attr.aria-haspopup]=\"ariaHasPopup() || null\"\n [attr.aria-expanded]=\"ariaExpanded() ?? null\"\n [attr.aria-controls]=\"ariaControls() || null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"resolvedAriaDescribedBy()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"inputFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (unit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-unit\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (iconRight() || resolvedIconRightTemplate()) {\n @if (hasRightAction()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-input-action\"\n [attr.aria-label]=\"iconRightAriaLabel()\"\n [disabled]=\"isDisabled()\"\n (click)=\"iconRightClick.emit($event)\"\n >\n @if (resolvedIconRightTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n } @else {\n <ui-icon [name]=\"iconRight()!\" [size]=\"iconSize()\" />\n }\n </button>\n } @else if (resolvedIconRightTemplate(); as tpl) {\n <span uiFieldSuffix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n </span>\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"iconRight()!\"\n [size]=\"iconSize()\"\n />\n }\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-native._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{font-family:var(--ui-input-font-family, var(--fontfamily-base));font-size:var(--ui-input-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-unit._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-action{display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1;flex-shrink:0;padding:0;border:none;background:none;color:var(--ui-form-field-action-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-action:hover:not(:disabled){color:var(--ui-form-field-action-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-action-surface-hover, var(--form-high-surface-hover))}.ui-input-action:focus-visible{outline:none;color:var(--ui-form-field-action-color-focus, var(--form-high-content-focused));background-color:var(--ui-form-field-action-surface-focus, var(--form-high-surface-focused))}.ui-input-action:disabled{cursor:not-allowed;color:var(--ui-form-field-action-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: UiBrowserFill, selector: "[uiBrowserFill]", outputs: ["browserFill"] }] }); }
|
|
180
185
|
}
|
|
181
186
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiInput, decorators: [{
|
|
182
187
|
type: Component,
|
|
183
|
-
args: [{ selector: 'ui-input', imports: [UiField, UiIcon, NgTemplateOutlet], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInput), multi: true }], template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft() || !!resolvedIconLeftTemplate()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (resolvedIconLeftTemplate(); as tpl) {\n <span uiFieldPrefix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"leftIconContext()\" />\n </span>\n } @else if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n class=\"ui-input-native\"\n [class._small]=\"size() === 'small'\"\n [type]=\"type()\"\n [id]=\"resolvedId()\"\n [value]=\"renderedValue()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.autocomplete]=\"autocomplete() || null\"\n [attr.maxlength]=\"maxlength()\"\n [attr.role]=\"nativeRole()\"\n [attr.aria-haspopup]=\"ariaHasPopup() || null\"\n [attr.aria-expanded]=\"ariaExpanded() ?? null\"\n [attr.aria-controls]=\"ariaControls() || null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"resolvedAriaDescribedBy()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (focus)=\"inputFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (unit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-unit\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (iconRight() || resolvedIconRightTemplate()) {\n @if (hasRightAction()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-input-action\"\n [attr.aria-label]=\"iconRightAriaLabel()\"\n [disabled]=\"isDisabled()\"\n (click)=\"iconRightClick.emit($event)\"\n >\n @if (resolvedIconRightTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n } @else {\n <ui-icon [name]=\"iconRight()!\" [size]=\"iconSize()\" />\n }\n </button>\n } @else if (resolvedIconRightTemplate(); as tpl) {\n <span uiFieldSuffix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n </span>\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"iconRight()!\"\n [size]=\"iconSize()\"\n />\n }\n }\n</ui-field>\n", styles: [".ui-input-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-native._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{font-family:var(--ui-input-font-family, var(--fontfamily-base));font-size:var(--ui-input-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-unit._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-action{display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1;flex-shrink:0;padding:0;border:none;background:none;color:var(--ui-form-field-action-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-action:hover:not(:disabled){color:var(--ui-form-field-action-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-action-surface-hover, var(--form-high-surface-hover))}.ui-input-action:focus-visible{outline:none;color:var(--ui-form-field-action-color-focus, var(--form-high-content-focused));background-color:var(--ui-form-field-action-surface-focus, var(--form-high-surface-focused))}.ui-input-action:disabled{cursor:not-allowed;color:var(--ui-form-field-action-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
188
|
+
args: [{ selector: 'ui-input', imports: [UiField, UiIcon, NgTemplateOutlet, UiBrowserFill], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInput), multi: true }], template: "<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft() || !!resolvedIconLeftTemplate()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (resolvedIconLeftTemplate(); as tpl) {\n <span uiFieldPrefix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"leftIconContext()\" />\n </span>\n } @else if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-native\"\n [class._small]=\"size() === 'small'\"\n [type]=\"type()\"\n [id]=\"resolvedId()\"\n [value]=\"renderedValue()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.autocomplete]=\"autocomplete() || null\"\n [attr.maxlength]=\"maxlength()\"\n [attr.role]=\"nativeRole()\"\n [attr.aria-haspopup]=\"ariaHasPopup() || null\"\n [attr.aria-expanded]=\"ariaExpanded() ?? null\"\n [attr.aria-controls]=\"ariaControls() || null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"resolvedAriaDescribedBy()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"inputFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (unit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-unit\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (iconRight() || resolvedIconRightTemplate()) {\n @if (hasRightAction()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-input-action\"\n [attr.aria-label]=\"iconRightAriaLabel()\"\n [disabled]=\"isDisabled()\"\n (click)=\"iconRightClick.emit($event)\"\n >\n @if (resolvedIconRightTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n } @else {\n <ui-icon [name]=\"iconRight()!\" [size]=\"iconSize()\" />\n }\n </button>\n } @else if (resolvedIconRightTemplate(); as tpl) {\n <span uiFieldSuffix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n </span>\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"iconRight()!\"\n [size]=\"iconSize()\"\n />\n }\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-input-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-input-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-input-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-input-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-input-native._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-icon{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-icon:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-icon._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{flex-shrink:0;color:var(--ui-form-field-affix-color, var(--form-low-content-default))}.ui-input-unit:first-child{margin-inline-start:var(--_field-inset-inline-start, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit:last-child{margin-inline-end:var(--_field-inset-inline-end, var(--ui-form-field-padding-x, var(--units-md)))}.ui-input-unit._disabled{color:var(--ui-form-field-affix-color-disabled, var(--form-high-content-disabled))}.ui-input-unit{font-family:var(--ui-input-font-family, var(--fontfamily-base));font-size:var(--ui-input-unit-font-size, var(--size-typography-text-default));white-space:nowrap;-webkit-user-select:none;user-select:none}.ui-input-unit._small{font-size:var(--ui-input-font-size-small, var(--size-typography-text-md))}.ui-input-action{display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1;flex-shrink:0;padding:0;border:none;background:none;color:var(--ui-form-field-action-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-input-action:hover:not(:disabled){color:var(--ui-form-field-action-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-action-surface-hover, var(--form-high-surface-hover))}.ui-input-action:focus-visible{outline:none;color:var(--ui-form-field-action-color-focus, var(--form-high-content-focused));background-color:var(--ui-form-field-action-surface-focus, var(--form-high-surface-focused))}.ui-input-action:disabled{cursor:not-allowed;color:var(--ui-form-field-action-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
184
189
|
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], ariaHasPopup: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaHasPopup", required: false }] }], ariaExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaExpanded", required: false }] }], ariaControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaControls", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], unit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unit", required: false }] }], iconLeft: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconLeft", required: false }] }], iconRight: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconRight", required: false }] }], iconRightAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconRightAriaLabel", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], iconLeftTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconLeftTemplate", required: false }] }], iconRightTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconRightTemplate", required: false }] }], iconLeftTemplateContent: [{ type: i0.ContentChild, args: ['iconLeft', { isSignal: true }] }], iconRightTemplateContent: [{ type: i0.ContentChild, args: ['iconRight', { isSignal: true }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], iconRightClick: [{ type: i0.Output, args: ["iconRightClick"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputEl: [{ type: i0.ViewChild, args: ['inputEl', { isSignal: true }] }] } });
|
|
185
190
|
|
|
186
191
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4sh-ui-kit-forms-ui-input.mjs","sources":["../../../projects/ui-kit/forms/ui-input/src/lib/ui-input.ts","../../../projects/ui-kit/forms/ui-input/src/lib/ui-input.html","../../../projects/ui-kit/forms/ui-input/src/public-api.ts","../../../projects/ui-kit/forms/ui-input/src/4sh-ui-kit-forms-ui-input.ts"],"sourcesContent":["import {\n Component,\n computed,\n contentChild,\n ElementRef,\n forwardRef,\n input,\n output,\n TemplateRef,\n viewChild,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon, UiIconSize } from '@4sh/ui-kit/base/ui-icon';\n\n/** Supported text types (numeric has its dedicated `ui-input-number` component). */\nexport type InputType = 'text' | 'password' | 'email' | 'tel' | 'url' | 'search';\n\n/** Context handed to the `#iconLeft` / `#iconRight` templates. */\nexport interface UiInputIconContext {\n /** Icon name configured on that side (`iconLeft` / `iconRight`), if any. */\n $implicit: string | undefined;\n /** Icon size matching the field size. */\n size: UiIconSize;\n /** Whether the field is disabled. */\n disabled: boolean;\n}\n\n/**\n * ui-input — headless composed text field, built on the `ui-field` shell\n * (label + box + helper) + a native `<input>`.\n *\n * Covers all text types (text/email/tel/url/search/**password**). Password\n * reveal, search clearing, etc. are handled via the **right action zone**\n * (`iconRightAriaLabel` + `iconRightClick`).\n *\n * Both icon zones accept a `<ng-template #iconLeft>` / `#iconRight` to replace the\n * rendered markup (another icon family, an inline SVG, a brand logo). To retarget\n * the family of every icon at once — this field's and the ones its neighbours\n * render internally — use the `uiIconFamily` directive instead.\n *\n * Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).\n * For numbers → `ui-input-number`, for masks → `ui-input-mask`.\n */\n@Component({\n selector: 'ui-input',\n imports: [UiField, UiIcon, NgTemplateOutlet],\n templateUrl: './ui-input.html',\n styleUrl: './ui-input.scss',\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInput), multi: true }],\n})\nexport class UiInput extends BaseFormField<string> {\n /** Native input type. */\n type = input<InputType>('text');\n /**\n * Display-only value (bypasses the CVA model). For composite hosts\n * (e.g. `ui-datepicker`) that own the visible text and read it back via\n * `valueChange` — leave unset when using `[(ngModel)]`/reactive forms.\n */\n value = input<string>();\n /** `aria-haspopup` forwarded to the native input (popup trigger hosts). */\n ariaHasPopup = input<'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'>();\n /**\n * `aria-expanded` forwarded to the native input (popup trigger hosts).\n * Setting it also promotes the input to `role=\"combobox\"`: `aria-expanded`\n * is not allowed on the implicit `textbox` role, so screen readers would\n * silently drop the popup state without it.\n */\n ariaExpanded = input<boolean>();\n /** `aria-controls` forwarded to the native input (popup trigger hosts). */\n ariaControls = input<string>();\n /** Native placeholder. */\n placeholder = input<string>();\n /**\n * id of an external element describing this control further (e.g. a composite host's own\n * format hint), chained onto `aria-describedby` alongside the helper/error message rather than\n * replacing it — a plain `[attr.aria-describedby]` override on the host would clobber whichever\n * of the two lands last.\n */\n ariaDescribedBy = input<string>();\n /** Suffix unit (e.g. \"%\", \"@domain\"). Shown when provided. */\n unit = input<string>();\n /** Left FontAwesome icon name (decorative). */\n iconLeft = input<string>();\n /** Right FontAwesome icon name. */\n iconRight = input<string>();\n /**\n * Accessible name of the right icon. **When provided, the right icon becomes a\n * clickable action zone** (square, full-height button) that emits `iconRightClick`.\n */\n iconRightAriaLabel = input<string>();\n /** Native autocomplete. */\n autocomplete = input<string>();\n /** Native maxlength. */\n maxlength = input<number>();\n\n /** Left-icon template, provided programmatically (composite hosts like `ui-datepicker`). */\n iconLeftTemplate = input<TemplateRef<UiInputIconContext>>();\n /** Right-icon template, provided programmatically (composite hosts like `ui-datepicker`). */\n iconRightTemplate = input<TemplateRef<UiInputIconContext>>();\n\n /** Custom left icon: `<ng-template #iconLeft let-name let-size=\"size\">`. */\n private readonly iconLeftTemplateContent =\n contentChild<TemplateRef<UiInputIconContext>>('iconLeft');\n /** Custom right icon: `<ng-template #iconRight let-name let-size=\"size\">`. */\n private readonly iconRightTemplateContent =\n contentChild<TemplateRef<UiInputIconContext>>('iconRight');\n\n /** Emitted on each input with the new value. */\n valueChange = output<string>();\n /** Emitted on click of the right action zone (active when `iconRightAriaLabel` is set). */\n iconRightClick = output<MouseEvent>();\n /** Emitted when the input receives focus. */\n inputFocus = output<FocusEvent>();\n /** Emitted when the input loses focus. */\n inputBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly inputEl = viewChild.required<ElementRef<HTMLInputElement>>('inputEl');\n\n /** @ignore Icon size aligned with the field size. */\n protected readonly iconSize = computed<UiIconSize>(() => (this.size() === 'small' ? 'sm' : 'md'));\n /** @ignore Text rendered in the input: display-only `value` wins over the model. */\n protected readonly renderedValue = computed(() => this.value() ?? this.displayValue());\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.renderedValue() !== '');\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n /** @ignore Input wins over the projected `#iconLeft` template. */\n protected readonly resolvedIconLeftTemplate = computed(\n () => this.iconLeftTemplate() ?? this.iconLeftTemplateContent(),\n );\n /** @ignore Input wins over the projected `#iconRight` template. */\n protected readonly resolvedIconRightTemplate = computed(\n () => this.iconRightTemplate() ?? this.iconRightTemplateContent(),\n );\n /** @ignore */\n protected readonly leftIconContext = computed<UiInputIconContext>(() => ({\n $implicit: this.iconLeft(),\n size: this.iconSize(),\n disabled: this.isDisabled(),\n }));\n /** @ignore */\n protected readonly rightIconContext = computed<UiInputIconContext>(() => ({\n $implicit: this.iconRight(),\n size: this.iconSize(),\n disabled: this.isDisabled(),\n }));\n /** @ignore The right icon is an action zone (has an accessible name). */\n protected readonly hasRightAction = computed(\n () => (!!this.iconRight() || !!this.resolvedIconRightTemplate()) && !!this.iconRightAriaLabel(),\n );\n /** @ignore Full `aria-describedby`: the helper/error message id (only when a message is\n * actually rendered) plus the externally supplied `ariaDescribedBy`, space-joined — `null`\n * when neither applies (native attribute is then omitted, not left dangling). */\n protected readonly resolvedAriaDescribedBy = computed(() => {\n const ids = [this.displayMessage() ? this.messageId() : null, this.ariaDescribedBy() || null];\n const joined = ids.filter((id): id is string => !!id).join(' ');\n return joined || null;\n });\n /** @ignore ARIA 1.2: only `combobox` (not the implicit `textbox`) accepts\n * `aria-expanded`. Stays null for plain text fields so their announcement\n * (\"edit text\") is untouched. */\n protected readonly nativeRole = computed(() => (this.ariaExpanded() === undefined ? null : 'combobox'));\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this.inputEl().nativeElement.focus(options);\n }\n\n /** Native `<input>` element — composite hosts that own `value` (e.g. `ui-datepicker`)\n * need direct DOM access to control the caret while reformatting text as typed. */\n nativeInputElement(): HTMLInputElement {\n return this.inputEl().nativeElement;\n }\n\n /** @ignore Input: single source of the value (view → form). */\n protected onInput(): void {\n const value = this.inputEl().nativeElement.value;\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.inputBlur.emit(event);\n }\n}\n","<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft() || !!resolvedIconLeftTemplate()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (resolvedIconLeftTemplate(); as tpl) {\n <span uiFieldPrefix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"leftIconContext()\" />\n </span>\n } @else if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n class=\"ui-input-native\"\n [class._small]=\"size() === 'small'\"\n [type]=\"type()\"\n [id]=\"resolvedId()\"\n [value]=\"renderedValue()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.autocomplete]=\"autocomplete() || null\"\n [attr.maxlength]=\"maxlength()\"\n [attr.role]=\"nativeRole()\"\n [attr.aria-haspopup]=\"ariaHasPopup() || null\"\n [attr.aria-expanded]=\"ariaExpanded() ?? null\"\n [attr.aria-controls]=\"ariaControls() || null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"resolvedAriaDescribedBy()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (focus)=\"inputFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (unit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-unit\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (iconRight() || resolvedIconRightTemplate()) {\n @if (hasRightAction()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-input-action\"\n [attr.aria-label]=\"iconRightAriaLabel()\"\n [disabled]=\"isDisabled()\"\n (click)=\"iconRightClick.emit($event)\"\n >\n @if (resolvedIconRightTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n } @else {\n <ui-icon [name]=\"iconRight()!\" [size]=\"iconSize()\" />\n }\n </button>\n } @else if (resolvedIconRightTemplate(); as tpl) {\n <span uiFieldSuffix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n </span>\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"iconRight()!\"\n [size]=\"iconSize()\"\n />\n }\n }\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-input\n */\n\nexport * from './lib/ui-input';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AA8BA;;;;;;;;;;;;;;;AAeG;AAQG,MAAO,OAAQ,SAAQ,aAAqB,CAAA;AAPlD,IAAA,WAAA,GAAA;;;QASE,IAAA,CAAA,IAAI,GAAG,KAAK,CAAY,MAAM;iFAAC;AAC/B;;;;AAIG;AACH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EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAYiB,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AExHvF;;AAEG;;ACFH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"4sh-ui-kit-forms-ui-input.mjs","sources":["../../../projects/ui-kit/forms/ui-input/src/lib/ui-input.ts","../../../projects/ui-kit/forms/ui-input/src/lib/ui-input.html","../../../projects/ui-kit/forms/ui-input/src/public-api.ts","../../../projects/ui-kit/forms/ui-input/src/4sh-ui-kit-forms-ui-input.ts"],"sourcesContent":["import {\n Component,\n computed,\n contentChild,\n ElementRef,\n forwardRef,\n input,\n output,\n TemplateRef,\n viewChild,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField, UiBrowserFill } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon, UiIconSize } from '@4sh/ui-kit/base/ui-icon';\n\n/** Supported text types (numeric has its dedicated `ui-input-number` component). */\nexport type InputType = 'text' | 'password' | 'email' | 'tel' | 'url' | 'search';\n\n/** Context handed to the `#iconLeft` / `#iconRight` templates. */\nexport interface UiInputIconContext {\n /** Icon name configured on that side (`iconLeft` / `iconRight`), if any. */\n $implicit: string | undefined;\n /** Icon size matching the field size. */\n size: UiIconSize;\n /** Whether the field is disabled. */\n disabled: boolean;\n}\n\n/**\n * ui-input — headless composed text field, built on the `ui-field` shell\n * (label + box + helper) + a native `<input>`.\n *\n * Covers all text types (text/email/tel/url/search/**password**). Password\n * reveal, search clearing, etc. are handled via the **right action zone**\n * (`iconRightAriaLabel` + `iconRightClick`).\n *\n * Both icon zones accept a `<ng-template #iconLeft>` / `#iconRight` to replace the\n * rendered markup (another icon family, an inline SVG, a brand logo). To retarget\n * the family of every icon at once — this field's and the ones its neighbours\n * render internally — use the `uiIconFamily` directive instead.\n *\n * Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).\n * For numbers → `ui-input-number`, for masks → `ui-input-mask`.\n */\n@Component({\n selector: 'ui-input',\n imports: [UiField, UiIcon, NgTemplateOutlet, UiBrowserFill],\n templateUrl: './ui-input.html',\n styleUrl: './ui-input.scss',\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInput), multi: true }],\n})\nexport class UiInput extends BaseFormField<string> {\n /** Native input type. */\n type = input<InputType>('text');\n /**\n * Display-only value (bypasses the CVA model). For composite hosts\n * (e.g. `ui-datepicker`) that own the visible text and read it back via\n * `valueChange` — leave unset when using `[(ngModel)]`/reactive forms.\n */\n value = input<string>();\n /** `aria-haspopup` forwarded to the native input (popup trigger hosts). */\n ariaHasPopup = input<'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'>();\n /**\n * `aria-expanded` forwarded to the native input (popup trigger hosts).\n * Setting it also promotes the input to `role=\"combobox\"`: `aria-expanded`\n * is not allowed on the implicit `textbox` role, so screen readers would\n * silently drop the popup state without it.\n */\n ariaExpanded = input<boolean>();\n /** `aria-controls` forwarded to the native input (popup trigger hosts). */\n ariaControls = input<string>();\n /** Native placeholder. */\n placeholder = input<string>();\n /**\n * id of an external element describing this control further (e.g. a composite host's own\n * format hint), chained onto `aria-describedby` alongside the helper/error message rather than\n * replacing it — a plain `[attr.aria-describedby]` override on the host would clobber whichever\n * of the two lands last.\n */\n ariaDescribedBy = input<string>();\n /** Suffix unit (e.g. \"%\", \"@domain\"). Shown when provided. */\n unit = input<string>();\n /** Left FontAwesome icon name (decorative). */\n iconLeft = input<string>();\n /** Right FontAwesome icon name. */\n iconRight = input<string>();\n /**\n * Accessible name of the right icon. **When provided, the right icon becomes a\n * clickable action zone** (square, full-height button) that emits `iconRightClick`.\n */\n iconRightAriaLabel = input<string>();\n /** Native autocomplete. */\n autocomplete = input<string>();\n /** Native maxlength. */\n maxlength = input<number>();\n\n /** Left-icon template, provided programmatically (composite hosts like `ui-datepicker`). */\n iconLeftTemplate = input<TemplateRef<UiInputIconContext>>();\n /** Right-icon template, provided programmatically (composite hosts like `ui-datepicker`). */\n iconRightTemplate = input<TemplateRef<UiInputIconContext>>();\n\n /** Custom left icon: `<ng-template #iconLeft let-name let-size=\"size\">`. */\n private readonly iconLeftTemplateContent =\n contentChild<TemplateRef<UiInputIconContext>>('iconLeft');\n /** Custom right icon: `<ng-template #iconRight let-name let-size=\"size\">`. */\n private readonly iconRightTemplateContent =\n contentChild<TemplateRef<UiInputIconContext>>('iconRight');\n\n /** Emitted on each input with the new value. */\n valueChange = output<string>();\n /** Emitted on click of the right action zone (active when `iconRightAriaLabel` is set). */\n iconRightClick = output<MouseEvent>();\n /** Emitted when the input receives focus. */\n inputFocus = output<FocusEvent>();\n /** Emitted when the input loses focus. */\n inputBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly inputEl = viewChild.required<ElementRef<HTMLInputElement>>('inputEl');\n\n /** @ignore Icon size aligned with the field size. */\n protected readonly iconSize = computed<UiIconSize>(() => (this.size() === 'small' ? 'sm' : 'md'));\n /** @ignore Text rendered in the input: display-only `value` wins over the model. */\n protected readonly renderedValue = computed(() => this.value() ?? this.displayValue());\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.renderedValue() !== '');\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n /** @ignore Input wins over the projected `#iconLeft` template. */\n protected readonly resolvedIconLeftTemplate = computed(\n () => this.iconLeftTemplate() ?? this.iconLeftTemplateContent(),\n );\n /** @ignore Input wins over the projected `#iconRight` template. */\n protected readonly resolvedIconRightTemplate = computed(\n () => this.iconRightTemplate() ?? this.iconRightTemplateContent(),\n );\n /** @ignore */\n protected readonly leftIconContext = computed<UiInputIconContext>(() => ({\n $implicit: this.iconLeft(),\n size: this.iconSize(),\n disabled: this.isDisabled(),\n }));\n /** @ignore */\n protected readonly rightIconContext = computed<UiInputIconContext>(() => ({\n $implicit: this.iconRight(),\n size: this.iconSize(),\n disabled: this.isDisabled(),\n }));\n /** @ignore The right icon is an action zone (has an accessible name). */\n protected readonly hasRightAction = computed(\n () => (!!this.iconRight() || !!this.resolvedIconRightTemplate()) && !!this.iconRightAriaLabel(),\n );\n /** @ignore Full `aria-describedby`: the helper/error message id (only when a message is\n * actually rendered) plus the externally supplied `ariaDescribedBy`, space-joined — `null`\n * when neither applies (native attribute is then omitted, not left dangling). */\n protected readonly resolvedAriaDescribedBy = computed(() => {\n const ids = [this.displayMessage() ? this.messageId() : null, this.ariaDescribedBy() || null];\n const joined = ids.filter((id): id is string => !!id).join(' ');\n return joined || null;\n });\n /** @ignore ARIA 1.2: only `combobox` (not the implicit `textbox`) accepts\n * `aria-expanded`. Stays null for plain text fields so their announcement\n * (\"edit text\") is untouched. */\n protected readonly nativeRole = computed(() => (this.ariaExpanded() === undefined ? null : 'combobox'));\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this.inputEl().nativeElement.focus(options);\n }\n\n /** Native `<input>` element — composite hosts that own `value` (e.g. `ui-datepicker`)\n * need direct DOM access to control the caret while reformatting text as typed. */\n nativeInputElement(): HTMLInputElement {\n return this.inputEl().nativeElement;\n }\n\n /** @ignore Input: single source of the value (view → form). */\n protected onInput(): void {\n const value = this.inputEl().nativeElement.value;\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n }\n\n /** @ignore Value written by the browser without an `input` event. */\n protected onBrowserFill(): void {\n if (this.inputEl().nativeElement.value !== this.renderedValue()) this.onInput();\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.inputBlur.emit(event);\n }\n}\n","<ui-field\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [hasPrefix]=\"!!iconLeft() || !!resolvedIconLeftTemplate()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n @if (resolvedIconLeftTemplate(); as tpl) {\n <span uiFieldPrefix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"leftIconContext()\" />\n </span>\n } @else if (iconLeft(); as name) {\n <ui-icon\n uiFieldPrefix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"name\"\n [size]=\"iconSize()\"\n />\n }\n\n <input\n #inputEl\n uiBrowserFill\n class=\"ui-input-native\"\n [class._small]=\"size() === 'small'\"\n [type]=\"type()\"\n [id]=\"resolvedId()\"\n [value]=\"renderedValue()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.autocomplete]=\"autocomplete() || null\"\n [attr.maxlength]=\"maxlength()\"\n [attr.role]=\"nativeRole()\"\n [attr.aria-haspopup]=\"ariaHasPopup() || null\"\n [attr.aria-expanded]=\"ariaExpanded() ?? null\"\n [attr.aria-controls]=\"ariaControls() || null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"resolvedAriaDescribedBy()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"inputFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n />\n\n @if (unit(); as u) {\n <span\n uiFieldSuffix\n class=\"ui-input-unit\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n >{{ u }}</span\n >\n }\n\n @if (iconRight() || resolvedIconRightTemplate()) {\n @if (hasRightAction()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-input-action\"\n [attr.aria-label]=\"iconRightAriaLabel()\"\n [disabled]=\"isDisabled()\"\n (click)=\"iconRightClick.emit($event)\"\n >\n @if (resolvedIconRightTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n } @else {\n <ui-icon [name]=\"iconRight()!\" [size]=\"iconSize()\" />\n }\n </button>\n } @else if (resolvedIconRightTemplate(); as tpl) {\n <span uiFieldSuffix class=\"ui-input-icon\" [class._disabled]=\"isDisabled()\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"rightIconContext()\" />\n </span>\n } @else {\n <ui-icon\n uiFieldSuffix\n class=\"ui-input-icon\"\n [class._disabled]=\"isDisabled()\"\n [name]=\"iconRight()!\"\n [size]=\"iconSize()\"\n />\n }\n }\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-input\n */\n\nexport * from './lib/ui-input';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AA8BA;;;;;;;;;;;;;;;AAeG;AAQG,MAAO,OAAQ,SAAQ,aAAqB,CAAA;AAPlD,IAAA,WAAA,GAAA;;;QASE,IAAA,CAAA,IAAI,GAAG,KAAK,CAAY,MAAM;iFAAC;AAC/B;;;;AAIG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK;6FAAU;;AAEvB,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK;oGAAmD;AACvE;;;;;AAKG;AACH,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK;oGAAW;;AAE/B,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK;oGAAU;;AAE9B,QAAA,IAAA,CAAA,WAAW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,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAYiB,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AExHvF;;AAEG;;ACFH;;AAEG;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, booleanAttribute, output, viewChild, computed, effect, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
import { BaseFormField } from '@4sh/ui-kit/forms';
|
|
4
|
+
import { BaseFormField, UiBrowserFill } from '@4sh/ui-kit/forms';
|
|
5
5
|
import { UiField } from '@4sh/ui-kit/forms/ui-field';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -95,6 +95,12 @@ class UiTextarea extends BaseFormField {
|
|
|
95
95
|
if (this.autoResize())
|
|
96
96
|
this.resizeToContent();
|
|
97
97
|
}
|
|
98
|
+
/** @ignore Value written by the browser without an `input` event. */
|
|
99
|
+
onBrowserFill() {
|
|
100
|
+
const el = this.textareaEl()?.nativeElement;
|
|
101
|
+
if (el && el.value !== this.displayValue())
|
|
102
|
+
this.onInput();
|
|
103
|
+
}
|
|
98
104
|
/** @ignore */
|
|
99
105
|
onBlur(event) {
|
|
100
106
|
this.emitTouch();
|
|
@@ -111,13 +117,13 @@ class UiTextarea extends BaseFormField {
|
|
|
111
117
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
112
118
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiTextarea, isStandalone: true, selector: "ui-textarea", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, autoResize: { classPropertyName: "autoResize", publicName: "autoResize", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null }, showCount: { classPropertyName: "showCount", publicName: "showCount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", textareaFocus: "textareaFocus", textareaBlur: "textareaBlur" }, providers: [
|
|
113
119
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiTextarea), multi: true },
|
|
114
|
-
], viewQueries: [{ propertyName: "textareaEl", first: true, predicate: ["textareaEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n", styles: [".ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }] }); }
|
|
120
|
+
], viewQueries: [{ propertyName: "textareaEl", first: true, predicate: ["textareaEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "directive", type: UiBrowserFill, selector: "[uiBrowserFill]", outputs: ["browserFill"] }] }); }
|
|
115
121
|
}
|
|
116
122
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiTextarea, decorators: [{
|
|
117
123
|
type: Component,
|
|
118
|
-
args: [{ selector: 'ui-textarea', imports: [UiField], providers: [
|
|
124
|
+
args: [{ selector: 'ui-textarea', imports: [UiField, UiBrowserFill], providers: [
|
|
119
125
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiTextarea), multi: true },
|
|
120
|
-
], template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n", styles: [".ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
126
|
+
], template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
121
127
|
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], autoResize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoResize", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }], showCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCount", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], textareaFocus: [{ type: i0.Output, args: ["textareaFocus"] }], textareaBlur: [{ type: i0.Output, args: ["textareaBlur"] }], textareaEl: [{ type: i0.ViewChild, args: ['textareaEl', { isSignal: true }] }] } });
|
|
122
128
|
|
|
123
129
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4sh-ui-kit-forms-ui-textarea.mjs","sources":["../../../projects/ui-kit/forms/ui-textarea/src/lib/ui-textarea.ts","../../../projects/ui-kit/forms/ui-textarea/src/lib/ui-textarea.html","../../../projects/ui-kit/forms/ui-textarea/src/public-api.ts","../../../projects/ui-kit/forms/ui-textarea/src/4sh-ui-kit-forms-ui-textarea.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n effect,\n ElementRef,\n forwardRef,\n input,\n output,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\n\n/** Which axes the user can manually resize (ignored when `autoResize` is on). */\nexport type TextareaResize = 'none' | 'vertical' | 'horizontal' | 'both';\n\n/**\n * ui-textarea — headless multiline text field, built on the `ui-field` shell\n * (label + box + helper) in **multiline** mode + a native `<textarea>`.\n *\n * The native `<textarea>` provides the resize grip (`resize: vertical`, the\n * Figma \"resizer\" affordance). `autoResize` grows the box with the content and\n * disables the manual grip.\n *\n * Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).\n */\n@Component({\n selector: 'ui-textarea',\n imports: [UiField],\n templateUrl: './ui-textarea.html',\n styleUrl: './ui-textarea.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiTextarea), multi: true },\n ],\n})\nexport class UiTextarea extends BaseFormField<string> {\n /** Native placeholder. */\n placeholder = input<string>();\n /** Initial number of visible text rows. */\n rows = input<number>(3);\n /** Native maxlength (caps the character count). */\n maxlength = input<number>();\n /** Grows the box height with the content (disables the manual resize grip). */\n autoResize = input(false, { transform: booleanAttribute });\n /** Manual resize axis (`vertical` by default; ignored when `autoResize`). */\n resize = input<TextareaResize>('vertical');\n /** Shows a character counter under the field (`count` or `count / maxlength`). */\n showCount = input(false, { transform: booleanAttribute });\n\n /** Emitted on each input with the new value. */\n valueChange = output<string>();\n /** Emitted when the textarea receives focus. */\n textareaFocus = output<FocusEvent>();\n /** Emitted when the textarea loses focus. */\n textareaBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly textareaEl = viewChild<ElementRef<HTMLTextAreaElement>>('textareaEl');\n\n /** @ignore Effective resize axis (`none` while auto-resizing). */\n protected readonly effectiveResize = computed<TextareaResize>(() =>\n this.autoResize() ? 'none' : this.resize(),\n );\n /** @ignore Current character count. */\n protected readonly charCount = computed(() => (this.modelValue() ?? '').length);\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.charCount() > 0);\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n /** @ignore Over the maxlength (only reachable programmatically). */\n protected readonly overLimit = computed(() => {\n const max = this.maxlength();\n return max != null && this.charCount() > max;\n });\n /** @ignore id of the character counter (for `aria-describedby`). */\n protected readonly countId = computed(() => `${this.resolvedId()}-count`);\n /** @ignore `aria-describedby` combines the message and the counter, whichever are shown. */\n protected readonly describedByIds = computed(() => {\n const ids = [\n this.displayMessage() ? this.messageId() : null,\n this.showCount() ? this.countId() : null,\n ].filter(Boolean);\n return ids.length ? ids.join(' ') : null;\n });\n\n constructor() {\n super();\n // Keep the height in sync when the value changes programmatically (forms).\n effect(() => {\n this.modelValue();\n if (this.autoResize()) this.resizeToContent();\n });\n }\n\n /** Focuses the textarea. */\n focus(options?: FocusOptions): void {\n this.textareaEl()?.nativeElement.focus(options);\n }\n\n /** @ignore Input: single source of the value (view → form). */\n protected onInput(): void {\n const el = this.textareaEl()?.nativeElement;\n if (!el) return;\n const value = el.value;\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n if (this.autoResize()) this.resizeToContent();\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.textareaBlur.emit(event);\n }\n\n /** @ignore Recomputes the height to fit the content. */\n private resizeToContent(): void {\n const el = this.textareaEl()?.nativeElement;\n if (!el) return;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n }\n}\n","<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-textarea\n */\n\nexport * from './lib/ui-textarea';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAkBA;;;;;;;;;AASG;AAUG,MAAO,UAAW,SAAQ,aAAqB,CAAA;AAoDnD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;AAnDT,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAU;;QAE7B,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,CAAC;iFAAC;;AAEvB,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK;iGAAU;;QAE3B,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,KAAK,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAE1D,IAAA,CAAA,MAAM,GAAG,KAAK,CAAiB,UAAU;mFAAC;;QAE1C,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;QAGzD,IAAA,CAAA,WAAW,GAAG,MAAM,EAAU;;QAE9B,IAAA,CAAA,aAAa,GAAG,MAAM,EAAc;;QAEpC,IAAA,CAAA,YAAY,GAAG,MAAM,EAAc;;QAGlB,IAAA,CAAA,UAAU,GAAG,SAAS,CAAkC,YAAY;uFAAC;;QAGnE,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAiB,MAC5D,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;4FAC3C;;AAEkB,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,CA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A,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECnCH,gsDA0DA,04FD5BY,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,KAAA,EAAA,UAAA,EAAA,MAAA,EAAA,OAAA,EAAA,YAAA,EAAA,QAAA,EAAA,UAAA,EAAA,UAAA,EAAA,WAAA,EAAA,YAAA,EAAA,SAAA,EAAA,WAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,WAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAON,UAAU,EAAA,UAAA,EAAA,CAAA;kBATtB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EAAA,OAAA,EACd,CAAC,OAAO,CAAC,EAAA,SAAA,EAGP;AACT,wBAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;AACvF,qBAAA,EAAA,QAAA,EAAA,gsDAAA,EAAA,MAAA,EAAA,CAAA,k1FAAA,CAAA,EAAA;21BAwBwE,YAAY,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3DvF;;AAEG;;ACFH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"4sh-ui-kit-forms-ui-textarea.mjs","sources":["../../../projects/ui-kit/forms/ui-textarea/src/lib/ui-textarea.ts","../../../projects/ui-kit/forms/ui-textarea/src/lib/ui-textarea.html","../../../projects/ui-kit/forms/ui-textarea/src/public-api.ts","../../../projects/ui-kit/forms/ui-textarea/src/4sh-ui-kit-forms-ui-textarea.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n effect,\n ElementRef,\n forwardRef,\n input,\n output,\n viewChild,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField, UiBrowserFill } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\n\n/** Which axes the user can manually resize (ignored when `autoResize` is on). */\nexport type TextareaResize = 'none' | 'vertical' | 'horizontal' | 'both';\n\n/**\n * ui-textarea — headless multiline text field, built on the `ui-field` shell\n * (label + box + helper) in **multiline** mode + a native `<textarea>`.\n *\n * The native `<textarea>` provides the resize grip (`resize: vertical`, the\n * Figma \"resizer\" affordance). `autoResize` grows the box with the content and\n * disables the manual grip.\n *\n * Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).\n */\n@Component({\n selector: 'ui-textarea',\n imports: [UiField, UiBrowserFill],\n templateUrl: './ui-textarea.html',\n styleUrl: './ui-textarea.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiTextarea), multi: true },\n ],\n})\nexport class UiTextarea extends BaseFormField<string> {\n /** Native placeholder. */\n placeholder = input<string>();\n /** Initial number of visible text rows. */\n rows = input<number>(3);\n /** Native maxlength (caps the character count). */\n maxlength = input<number>();\n /** Grows the box height with the content (disables the manual resize grip). */\n autoResize = input(false, { transform: booleanAttribute });\n /** Manual resize axis (`vertical` by default; ignored when `autoResize`). */\n resize = input<TextareaResize>('vertical');\n /** Shows a character counter under the field (`count` or `count / maxlength`). */\n showCount = input(false, { transform: booleanAttribute });\n\n /** Emitted on each input with the new value. */\n valueChange = output<string>();\n /** Emitted when the textarea receives focus. */\n textareaFocus = output<FocusEvent>();\n /** Emitted when the textarea loses focus. */\n textareaBlur = output<FocusEvent>();\n\n /** @ignore */\n private readonly textareaEl = viewChild<ElementRef<HTMLTextAreaElement>>('textareaEl');\n\n /** @ignore Effective resize axis (`none` while auto-resizing). */\n protected readonly effectiveResize = computed<TextareaResize>(() =>\n this.autoResize() ? 'none' : this.resize(),\n );\n /** @ignore Current character count. */\n protected readonly charCount = computed(() => (this.modelValue() ?? '').length);\n /** @ignore Keeps a floating label raised once focus leaves. */\n protected readonly isFilled = computed(() => this.charCount() > 0);\n /** @ignore At rest the floating label already holds that spot. */\n protected readonly effectivePlaceholder = computed(() =>\n this.hasFloatLabel() ? '' : (this.placeholder() ?? ''),\n );\n /** @ignore Over the maxlength (only reachable programmatically). */\n protected readonly overLimit = computed(() => {\n const max = this.maxlength();\n return max != null && this.charCount() > max;\n });\n /** @ignore id of the character counter (for `aria-describedby`). */\n protected readonly countId = computed(() => `${this.resolvedId()}-count`);\n /** @ignore `aria-describedby` combines the message and the counter, whichever are shown. */\n protected readonly describedByIds = computed(() => {\n const ids = [\n this.displayMessage() ? this.messageId() : null,\n this.showCount() ? this.countId() : null,\n ].filter(Boolean);\n return ids.length ? ids.join(' ') : null;\n });\n\n constructor() {\n super();\n // Keep the height in sync when the value changes programmatically (forms).\n effect(() => {\n this.modelValue();\n if (this.autoResize()) this.resizeToContent();\n });\n }\n\n /** Focuses the textarea. */\n focus(options?: FocusOptions): void {\n this.textareaEl()?.nativeElement.focus(options);\n }\n\n /** @ignore Input: single source of the value (view → form). */\n protected onInput(): void {\n const el = this.textareaEl()?.nativeElement;\n if (!el) return;\n const value = el.value;\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n if (this.autoResize()) this.resizeToContent();\n }\n\n /** @ignore Value written by the browser without an `input` event. */\n protected onBrowserFill(): void {\n const el = this.textareaEl()?.nativeElement;\n if (el && el.value !== this.displayValue()) this.onInput();\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.textareaBlur.emit(event);\n }\n\n /** @ignore Recomputes the height to fit the content. */\n private resizeToContent(): void {\n const el = this.textareaEl()?.nativeElement;\n if (!el) return;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n }\n}\n","<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n","/*\n * Public API Surface of ui-kit/ui-textarea\n */\n\nexport * from './lib/ui-textarea';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAkBA;;;;;;;;;AASG;AAUG,MAAO,UAAW,SAAQ,aAAqB,CAAA;AAoDnD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;AAnDT,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGA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A,EAAA,QAAA,EAAA,UAAA,EAAA,UAAA,EAAA,WAAA,EAAA,YAAA,EAAA,SAAA,EAAA,WAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,WAAA,EAAA,WAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,aAAa,EAAA,QAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAOrB,UAAU,EAAA,UAAA,EAAA,CAAA;kBATtB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,WACd,CAAC,OAAO,EAAE,aAAa,CAAC,EAAA,SAAA,EAGtB;AACT,wBAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;AACvF,qBAAA,EAAA,QAAA,EAAA,0vDAAA,EAAA,MAAA,EAAA,CAAA,07FAAA,CAAA,EAAA;21BAwBwE,YAAY,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3DvF;;AAEG;;ACFH;;AAEG;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injector, DestroyRef, signal, computed, afterNextRender, effect, input, booleanAttribute, Directive, isDevMode } from '@angular/core';
|
|
2
|
+
import { inject, Injector, DestroyRef, signal, computed, afterNextRender, effect, input, booleanAttribute, Directive, isDevMode, output } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { NgControl, PristineChangeEvent, TouchedChangeEvent, StatusChangeEvent } from '@angular/forms';
|
|
5
5
|
|
|
@@ -633,6 +633,50 @@ function warnMissingAccessibleName(componentTag, message) {
|
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
+
/** Keyframes run by the `browser-fill` SCSS mixin while the browser autofills the field. */
|
|
637
|
+
const AUTOFILL_ANIMATION = 'ui-browser-fill';
|
|
638
|
+
/**
|
|
639
|
+
* Reports the events through which the browser may write a value into a native
|
|
640
|
+
* `<input>`/`<textarea>` without an `input` event:
|
|
641
|
+
*
|
|
642
|
+
* - its autofill: the `:-webkit-autofill` animation declared by the
|
|
643
|
+
* `utils.browser-fill` mixin, which the host stylesheet must include;
|
|
644
|
+
* - a `change`.
|
|
645
|
+
*
|
|
646
|
+
* Either may follow an edit the host already handled through `input`: the
|
|
647
|
+
* host syncs only when the native value differs from the one it renders, so
|
|
648
|
+
* nothing is emitted twice. An `input` sent by the browser to a field without
|
|
649
|
+
* focus already reaches the host's own `(input)` handler: `hasFocus()` tells
|
|
650
|
+
* it apart from a keystroke.
|
|
651
|
+
*/
|
|
652
|
+
class UiBrowserFill {
|
|
653
|
+
constructor() {
|
|
654
|
+
/** Emitted with the change/animation event that may reveal a fill. */
|
|
655
|
+
this.browserFill = output();
|
|
656
|
+
}
|
|
657
|
+
onAnimationStart(event) {
|
|
658
|
+
if (event.animationName.endsWith(AUTOFILL_ANIMATION))
|
|
659
|
+
this.browserFill.emit(event);
|
|
660
|
+
}
|
|
661
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiBrowserFill, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
662
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: UiBrowserFill, isStandalone: true, selector: "[uiBrowserFill]", outputs: { browserFill: "browserFill" }, host: { listeners: { "change": "browserFill.emit($event)", "animationstart": "onAnimationStart($event)" }, classAttribute: "ui-browser-fill" }, ngImport: i0 }); }
|
|
663
|
+
}
|
|
664
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiBrowserFill, decorators: [{
|
|
665
|
+
type: Directive,
|
|
666
|
+
args: [{
|
|
667
|
+
selector: '[uiBrowserFill]',
|
|
668
|
+
host: {
|
|
669
|
+
class: 'ui-browser-fill',
|
|
670
|
+
'(change)': 'browserFill.emit($event)',
|
|
671
|
+
'(animationstart)': 'onAnimationStart($event)',
|
|
672
|
+
},
|
|
673
|
+
}]
|
|
674
|
+
}], propDecorators: { browserFill: [{ type: i0.Output, args: ["browserFill"] }] } });
|
|
675
|
+
/** Whether `element` holds the focus (works inside a shadow root). */
|
|
676
|
+
function hasFocus(element) {
|
|
677
|
+
return element.getRootNode().activeElement === element;
|
|
678
|
+
}
|
|
679
|
+
|
|
636
680
|
/*
|
|
637
681
|
* Public API Surface of ui-kit/forms
|
|
638
682
|
*
|
|
@@ -647,5 +691,5 @@ function warnMissingAccessibleName(componentTag, message) {
|
|
|
647
691
|
* Generated bundle index. Do not edit.
|
|
648
692
|
*/
|
|
649
693
|
|
|
650
|
-
export { BaseControlValueAccessor, BaseFieldControl, BaseFormField, MASK_TOKENS, acceptsMaskChar, addDays, addMonths, applyMaskTemplate, autoFormatSegments, buildMaskSlots, caretForMask, createOptionResolver, dropdownOverlayPositions, extractMaskData, finalizeParsed, firstOfMonth, formatLabel, isSameDay, normalizeDateInput, parseIsoDate, parseIsoDateTime, parseIsoTime, parseMaskRanges, startOfDay, toIsoDate, toIsoDateTime, toIsoTime, warnMissingAccessibleName };
|
|
694
|
+
export { BaseControlValueAccessor, BaseFieldControl, BaseFormField, MASK_TOKENS, UiBrowserFill, acceptsMaskChar, addDays, addMonths, applyMaskTemplate, autoFormatSegments, buildMaskSlots, caretForMask, createOptionResolver, dropdownOverlayPositions, extractMaskData, finalizeParsed, firstOfMonth, formatLabel, hasFocus, isSameDay, normalizeDateInput, parseIsoDate, parseIsoDateTime, parseIsoTime, parseMaskRanges, startOfDay, toIsoDate, toIsoDateTime, toIsoTime, warnMissingAccessibleName };
|
|
651
695
|
//# sourceMappingURL=4sh-ui-kit-forms.mjs.map
|