{"version":3,"file":"forty-cdk-input.mjs","sources":["../../../projects/forty-cdk/input/src/input.ts","../../../projects/forty-cdk/input/src/textarea.ts","../../../projects/forty-cdk/input/src/input-host-directive.ts","../../../projects/forty-cdk/input/src/textarea-host-directive.ts","../../../projects/forty-cdk/input/src/forty-cdk-input.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { TextValueControlBase } from 'forty-cdk/core';\n\n/**\n * Headless text `<input>` implementing Angular's `FormValueControl<string>`\n * from `@angular/forms/signals`, so it auto-wires with `[formField]` and\n * auto-associates inside a `[forField]` (label / description / error) with no\n * extra markup.\n *\n * Apply on a native `<input>`. The element keeps its own `type`\n * (`text` / `email` / `password` / …), caret, IME composition, and native form\n * submission — the directive only bridges the value to a signal and reflects\n * validation state. For a multi-line control use `[forTextarea]`.\n *\n * The host gets `data-empty` (while the value is `''`), `data-disabled`, and\n * `data-readonly` for CSS hooks.\n *\n * @example\n * ```html\n * <input forInput [(value)]=\"email\" type=\"email\" />\n *\n * <!-- With Signal Forms + Field (auto-wired): -->\n * <div forField>\n *   <label forLabel>Full name</label>\n *   <input forInput [formField]=\"profile.name\" />\n * </div>\n * ```\n */\n@Directive({\n  selector: '[forInput]',\n  exportAs: 'forInput',\n  host: {\n    '[attr.aria-readonly]': 'readonly() ? \"true\" : null',\n    '[attr.aria-required]': 'required() ? \"true\" : null',\n    '[attr.aria-invalid]': 'invalid() ? \"true\" : null',\n    '[attr.aria-busy]': 'pending() ? \"true\" : null',\n    '[attr.readonly]': 'readonly() ? \"\" : null',\n    '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n    '[attr.data-readonly]': 'readonly() ? \"\" : null',\n    '[attr.name]': 'name() || null',\n    '[attr.data-empty]': 'value() === \"\" ? \"\" : null',\n    '(input)': 'onInput($event)',\n    '(compositionstart)': 'onCompositionStart()',\n    '(compositionend)': 'onCompositionEnd()',\n    '(blur)': 'onBlur()',\n  },\n})\nexport class ForInput extends TextValueControlBase implements FormValueControl<string> {}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n  booleanAttribute,\n  computed,\n  Directive,\n  effect,\n  ElementRef,\n  inject,\n  input,\n  PLATFORM_ID,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { injectElementSize, TextValueControlBase } from 'forty-cdk/core';\n\n/**\n * Headless multi-line text `<textarea>` implementing Angular's\n * `FormValueControl<string>` from `@angular/forms/signals`, so it auto-wires\n * with `[formField]` and auto-associates inside a `[forField]` (label /\n * description / error) with no extra markup.\n *\n * Apply on a native `<textarea>`. The element keeps its own caret, wrapping,\n * IME composition, and native form submission — the directive only bridges the\n * value to a signal and reflects validation state. The string-valued sibling\n * of `[forInput]`.\n *\n * The host gets `data-empty` (while the value is `''`), `data-disabled`, and\n * `data-readonly` for CSS hooks.\n *\n * With `[autosize]` the host grows and shrinks its height to fit the content on\n * every edit, programmatic value change, and width reflow, and reflects\n * `data-autosize` for styling (pair it with `resize: none; overflow: hidden;`).\n * Autosize is a DOM side effect gated to the browser, so it is inert under SSR.\n *\n * @example\n * ```html\n * <textarea forTextarea [(value)]=\"bio\" placeholder=\"About you\"></textarea>\n *\n * <!-- Grow to content: -->\n * <textarea forTextarea autosize [(value)]=\"bio\"></textarea>\n *\n * <!-- With Signal Forms + Field (auto-wired): -->\n * <div forField>\n *   <label forLabel>Bio</label>\n *   <textarea forTextarea [formField]=\"profile.bio\"></textarea>\n * </div>\n * ```\n */\n@Directive({\n  selector: '[forTextarea]',\n  exportAs: 'forTextarea',\n  host: {\n    '[attr.aria-readonly]': 'readonly() ? \"true\" : null',\n    '[attr.aria-required]': 'required() ? \"true\" : null',\n    '[attr.aria-invalid]': 'invalid() ? \"true\" : null',\n    '[attr.aria-busy]': 'pending() ? \"true\" : null',\n    '[attr.readonly]': 'readonly() ? \"\" : null',\n    '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n    '[attr.data-readonly]': 'readonly() ? \"\" : null',\n    '[attr.data-autosize]': 'autosize() ? \"\" : null',\n    '[attr.name]': 'name() || null',\n    '[attr.data-empty]': 'value() === \"\" ? \"\" : null',\n    '(input)': 'onInput($event)',\n    '(compositionstart)': 'onCompositionStart()',\n    '(compositionend)': 'onCompositionEnd()',\n    '(blur)': 'onBlur()',\n  },\n})\nexport class ForTextarea extends TextValueControlBase implements FormValueControl<string> {\n  /**\n   * Opt into height auto-sizing. When `true` the textarea's height tracks its\n   * content: it grows as the value gets taller and shrinks back as it gets\n   * shorter, recomputed on every edit, on programmatic `value` writes, and on\n   * width reflow. Defaults to `false`, leaving the element's height to CSS.\n   */\n  readonly autosize = input(false, { transform: booleanAttribute });\n\n  readonly #element = inject<ElementRef<HTMLTextAreaElement>>(ElementRef);\n  readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n  readonly #box = injectElementSize(\n    computed(() => (this.autosize() && this.#isBrowser ? this.#element.nativeElement : null)),\n  );\n\n  constructor() {\n    super();\n\n    effect(() => {\n      const el = this.#element.nativeElement;\n      this.value();\n      this.#box();\n      if (!this.autosize() || !this.#isBrowser) {\n        el.style.height = '';\n        return;\n      }\n      this.#resizeToContent(el);\n    });\n  }\n\n  #resizeToContent(el: HTMLTextAreaElement): void {\n    const view = el.ownerDocument.defaultView;\n    if (!view) {\n      return;\n    }\n    const style = view.getComputedStyle(el);\n    el.style.height = 'auto';\n    const content = el.scrollHeight;\n    if (style.boxSizing === 'border-box') {\n      const borderY = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);\n      el.style.height = `${content + borderY}px`;\n    } else {\n      const paddingY = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);\n      el.style.height = `${content - paddingY}px`;\n    }\n  }\n}\n","/**\n * Exact public names of every `ForInput` input, its models included. Spread it into the\n * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the\n * primitive's full surface — the Signal Forms members `[formField]` binds among them —\n * without hand-maintaining the list. Always spread into an inline object literal as shown\n * below: the literal is what keeps the entry statically analyzable for consumers compiling\n * against the published package. An anti-drift spec fails when this list no longer matches\n * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported\n * wrapping patterns.\n *\n * @example\n * ```ts\n * @Component({\n *   selector: 'input[myInput]',\n *   template: '',\n *   hostDirectives: [\n *     {\n *       directive: ForInput,\n *       inputs: [...FOR_INPUT_HOST_DIRECTIVE_INPUTS],\n *       outputs: [...FOR_INPUT_HOST_DIRECTIVE_OUTPUTS],\n *     },\n *   ],\n * })\n * export class MyInput {}\n * ```\n */\nexport const FOR_INPUT_HOST_DIRECTIVE_INPUTS = [\n  'value',\n  'dirty',\n  'disabled',\n  'errors',\n  'invalid',\n  'name',\n  'pending',\n  'readonly',\n  'required',\n  'touched',\n] as const;\n\n/**\n * Exact public names of every `ForInput` output, the Signal Forms `touch` output\n * included. Spread it into the `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_INPUT_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_INPUT_HOST_DIRECTIVE_OUTPUTS = ['valueChange', 'touchedChange', 'touch'] as const;\n","/**\n * Exact public names of every `ForTextarea` input, its models included. Spread it into the\n * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the\n * primitive's full surface — the Signal Forms members `[formField]` binds among them —\n * without hand-maintaining the list. Always spread into an inline object literal as shown\n * below: the literal is what keeps the entry statically analyzable for consumers compiling\n * against the published package. An anti-drift spec fails when this list no longer matches\n * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported\n * wrapping patterns.\n *\n * @example\n * ```ts\n * @Component({\n *   selector: 'textarea[myTextarea]',\n *   template: '',\n *   hostDirectives: [\n *     {\n *       directive: ForTextarea,\n *       inputs: [...FOR_TEXTAREA_HOST_DIRECTIVE_INPUTS],\n *       outputs: [...FOR_TEXTAREA_HOST_DIRECTIVE_OUTPUTS],\n *     },\n *   ],\n * })\n * export class MyTextarea {}\n * ```\n */\nexport const FOR_TEXTAREA_HOST_DIRECTIVE_INPUTS = [\n  'value',\n  'autosize',\n  'dirty',\n  'disabled',\n  'errors',\n  'invalid',\n  'name',\n  'pending',\n  'readonly',\n  'required',\n  'touched',\n] as const;\n\n/**\n * Exact public names of every `ForTextarea` output, the Signal Forms `touch` output\n * included. Spread it into the `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_TEXTAREA_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_TEXTAREA_HOST_DIRECTIVE_OUTPUTS = [\n  'valueChange',\n  'touchedChange',\n  'touch',\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AAoBG,MAAO,QAAS,SAAQ,oBAAoB,CAAA;uGAArC,QAAQ,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAR,QAAQ,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,YAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,iBAAA,EAAA,kBAAA,EAAA,sBAAA,EAAA,gBAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,EAAA,UAAA,EAAA,EAAA,oBAAA,EAAA,8BAAA,EAAA,oBAAA,EAAA,8BAAA,EAAA,mBAAA,EAAA,6BAAA,EAAA,gBAAA,EAAA,6BAAA,EAAA,eAAA,EAAA,0BAAA,EAAA,oBAAA,EAAA,mCAAA,EAAA,oBAAA,EAAA,0BAAA,EAAA,WAAA,EAAA,gBAAA,EAAA,iBAAA,EAAA,gCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAnBpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAA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