{"version":3,"file":"fundamental-ngx-core-text.mjs","sources":["../../../../libs/core/text/text.component.ts","../../../../libs/core/text/text.component.html","../../../../libs/core/text/text.module.ts","../../../../libs/core/text/fundamental-ngx-core-text.ts"],"sourcesContent":["import {\n    ChangeDetectionStrategy,\n    Component,\n    ViewEncapsulation,\n    booleanAttribute,\n    computed,\n    input,\n    model,\n    signal\n} from '@angular/core';\nimport { LineClampDirective, LineClampTargetDirective } from '@fundamental-ngx/cdk/utils';\nimport { LinkComponent } from '@fundamental-ngx/core/link';\nimport { FdTranslatePipe } from '@fundamental-ngx/i18n';\n\n/**\n * Type of hyphenation to apply to text using CSS hyphens property.\n * - `'none'` - Disables hyphenation\n * - `'manual'` - Only breaks at explicit hyphenation points\n * - `'auto'` - Browser automatically hyphenates\n * - `null` - No hyphenation applied\n */\nexport type HyphenationType = 'none' | 'manual' | 'auto' | null;\n\n/**\n * Text component for displaying text content with optional line clamping, hyphenation, and expand/collapse functionality.\n */\n@Component({\n    selector: 'fd-text',\n    templateUrl: './text.component.html',\n    styleUrl: './text.component.scss',\n    encapsulation: ViewEncapsulation.None,\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    imports: [LineClampDirective, LineClampTargetDirective, LinkComponent, FdTranslatePipe]\n})\nexport class TextComponent {\n    /**\n     * The text content to render.\n     * @default ''\n     */\n    readonly text = input<string>('');\n\n    /**\n     * Maximum number of visible lines before text is clamped. Set to `null` to disable.\n     * @default null\n     */\n    readonly maxLines = input<number | null>(null);\n\n    /**\n     * Preserves whitespace and line breaks using CSS `white-space: pre-wrap`.\n     * @default false\n     */\n    readonly whitespaces = input(false);\n\n    /**\n     * Controls hyphenation behavior using CSS `hyphens` property.\n     * @default null\n     */\n    readonly hyphenation = input<HyphenationType>(null);\n\n    /**\n     * Displays \"more\"/\"less\" links to expand/collapse text. Requires `maxLines` to be set.\n     * @default false\n     */\n    readonly expandable = input(false);\n\n    /**\n     * Controls collapsed/expanded state. Two-way bindable via `[(isCollapsed)]`.\n     * @default true\n     */\n    readonly isCollapsed = model(true);\n\n    /** @hidden */\n    readonly subline = input(false, { transform: booleanAttribute });\n\n    /**\n     * Computed signal that checks if maxLines is set to a valid positive number.\n     * @hidden\n     */\n    protected readonly _hasValidMaxLines = computed(() => (this.maxLines() ?? 0) > 0);\n\n    /**\n     * Computed signal determining if text should display in collapsed state.\n     * @hidden\n     */\n    protected readonly _isCollapsed = computed(() => this.isCollapsed() && this._hasValidMaxLines());\n\n    /**\n     * Computed signal determining if expand/collapse functionality is enabled.\n     * @hidden\n     */\n    protected readonly _expandable = computed(() => this.expandable() && this._hasValidMaxLines());\n\n    /**\n     * Tracks whether text content exceeds maximum lines.\n     * @hidden\n     */\n    protected readonly _hasMore = signal(false);\n\n    /**\n     * Toggles collapsed/expanded state and notifies parent components.\n     * @hidden\n     */\n    protected toggleTextView(): void {\n        this.isCollapsed.update((collapsed) => !collapsed);\n    }\n\n    /**\n     * Updates `_hasMore` signal based on actual line count from line clamp directive.\n     * Signal update automatically triggers change detection.\n     * @hidden\n     */\n    protected checkLineCount(count: number): void {\n        const max = this.maxLines();\n        this._hasMore.set(!!max && count > max);\n    }\n}\n","<p\n    class=\"fd-text\"\n    [class.fd-text__subline]=\"subline()\"\n    [class.fd-text--pre-wrap]=\"whitespaces()\"\n    [style.hyphens]=\"hyphenation()\"\n>\n    <span\n        fdkLineClamp\n        class=\"fd-text__lineclamp\"\n        #lineClamp=\"fdLineClamp\"\n        [fdLineclampState]=\"_isCollapsed()\"\n        [fdLineClampLines]=\"maxLines()\"\n        (lineCountUpdate)=\"checkLineCount($event)\"\n    >\n        <span fdkLineClampTarget [fdLineClampTargetText]=\"text()\" (update)=\"lineClamp.refreshTarget($event)\"></span>\n    </span>\n    @if (_expandable() && _hasMore()) {\n        <a\n            fd-link\n            tabindex=\"0\"\n            class=\"fd-text__link--more\"\n            (keydown.enter)=\"toggleTextView()\"\n            (click)=\"toggleTextView()\"\n        >\n            {{ (isCollapsed() ? ('coreText.moreLabel' | fdTranslate) : ('coreText.lessLabel' | fdTranslate))() }}\n        </a>\n    }\n</p>\n","import { NgModule } from '@angular/core';\nimport { TextComponent } from './text.component';\n\n/**\n * @deprecated Use the standalone `TextComponent` directly instead. Import `TextComponent` in your component's imports array.\n * This module will be removed in a future version.\n */\n@NgModule({\n    imports: [TextComponent],\n    exports: [TextComponent]\n})\nexport class TextModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAuBA;;AAEG;MASU,aAAa,CAAA;AAR1B,IAAA,WAAA,GAAA;AASI;;;AAGG;AACM,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,gDAAC;AAEjC;;;AAGG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAgB,IAAI,oDAAC;AAE9C;;;AAGG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,KAAK,uDAAC;AAEnC;;;AAGG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAkB,IAAI,uDAAC;AAEnD;;;AAGG;AACM,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,KAAK,sDAAC;AAElC;;;AAGG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,IAAI,uDAAC;;QAGzB,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,KAAK,oDAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAEhE;;;AAGG;AACgB,QAAA,IAAA,CAAA,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,6DAAC;AAEjF;;;AAGG;AACgB,QAAA,IAAA,CAAA,YAAY,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,iBAAiB,EAAE,wDAAC;AAEhG;;;AAGG;AACgB,QAAA,IAAA,CAAA,WAAW,GAAG,QAAQ,CAAC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