{"version":3,"file":"eui-components-eui-progress-circle.mjs","sources":["../../eui-progress-circle/eui-progress-circle.component.ts","../../eui-progress-circle/eui-progress-circle.component.html","../../eui-progress-circle/index.ts","../../eui-progress-circle/eui-components-eui-progress-circle.ts"],"sourcesContent":["import {\n    AfterContentChecked,\n    AfterContentInit,\n    ChangeDetectorRef,\n    Component,\n    ElementRef,\n    Input,\n    OnChanges,\n    SimpleChanges,\n    ViewChild,\n    ViewEncapsulation,\n    ChangeDetectionStrategy,\n    HostBinding,\n    booleanAttribute,\n    input,\n    InputSignal,\n    inject,\n} from '@angular/core';\nimport { BaseStatesDirective } from '@eui/components/shared';\nimport { EUI_ICON } from '@eui/components/eui-icon';\n\n/**\n * @description\n * Utility function to transform a value into a number in the range of 0-100.\n * @param value\n */\nconst transformNumberInRange = (value: string | number): number => {\n    const num = Number(value);\n    return isNaN(num) ? 0 : Math.max(0, Math.min(num, 100));\n}\n\ntype ColorType = 'info' | 'success' | 'warning' | 'danger';\n/**\n * @description\n * Utility function to transform a value into a color type 'info', 'success', 'warning', 'danger'\n * @param value\n */\nconst colorTypeTransform = (value: string | ColorType): ColorType => {\n    const types = ['info', 'success', 'warning', 'danger'];\n    return types.includes(value) ? value as ColorType : 'info';\n}\n\n/**\n * @description\n * Circular progress indicator component that displays progress as a ring with customizable colors and labels.\n * Supports automatic color transitions based on value thresholds and custom label positioning.\n * Provides icon display option for visual enhancement and flexible sizing variants.\n *\n * @usageNotes\n * ### Basic usage\n * ```html\n * <eui-progress-circle [value]=\"65\"></eui-progress-circle>\n * ```\n *\n * ### With custom label\n * ```html\n * <eui-progress-circle [value]=\"80\" valueLabel=\"4 of 5 tasks\"></eui-progress-circle>\n * ```\n *\n * ### With icon\n * ```html\n * <eui-progress-circle [value]=\"100\" icon=\"check\" fillColor=\"success\"></eui-progress-circle>\n * ```\n *\n * ### Custom color thresholds\n * ```html\n * <eui-progress-circle [value]=\"45\" colorSteps=\"25 75\"></eui-progress-circle>\n * ```\n *\n * ### Accessibility\n * - Provide meaningful aria-label to describe the progress context\n * - Color states should not be the only indicator of status\n * - Ensure sufficient contrast between progress ring and background\n *\n * ### Notes\n * - Default color steps: 0-33% success, 34-66% warning, 67-100% danger\n * - Use `isDefaultColorSteps=\"false\"` to disable automatic color transitions\n * - Bottom label positioning available via `hasBottomLabel` for longer text\n */\n@Component({\n    templateUrl: './eui-progress-circle.component.html',\n    selector: 'eui-progress-circle',\n    styleUrl: './eui-progress-circle.scss',\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    encapsulation: ViewEncapsulation.None,\n    imports: [\n        ...EUI_ICON,\n    ],\n    hostDirectives: [\n        {\n            directive: BaseStatesDirective,\n            inputs: [\n                'euiSizeS',\n                'euiSizeM',\n                'euiSizeL',\n                'euiSizeVariant',\n            ],\n        },\n    ],\n})\nexport class EuiProgressCircleComponent implements AfterContentInit, OnChanges, AfterContentChecked {\n    /** CSS classes applied to the host element */\n    @HostBinding('class')\n    get cssClasses(): string {\n        return [\n            this.baseStatesDirective.getCssClasses('eui-progress-circle'),\n            this.isLongLabel || this.hasBottomLabel() ? 'eui-progress-circle-content--with-bottom-label' : '',\n        ]\n            .join(' ')\n            .trim();\n    }\n\n    /**\n     * Accessibility label for the progress circle\n     * @default 'progress circle'\n     */\n    @HostBinding('attr.aria-label')\n    @Input() ariaLabel = 'progress circle';\n\n    /**\n     * Whether to use default color steps based on value thresholds\n     * @default true\n     */\n    isDefaultColorSteps = input(true, { transform: booleanAttribute });\n\n    /**\n     * Whether to display the label at the bottom of the circle\n     * @default false\n     */\n    hasBottomLabel = input(false, { transform: booleanAttribute });\n\n    /**\n     * Current progress value (0-100)\n     * @default 0\n     */\n    value = input(0, { transform: transformNumberInRange });\n\n    /**\n     * Label to display when value is 0\n     * @default 'N/A'\n     */\n    emptyLabel: InputSignal<string> = input('N/A');\n\n    /**\n     * Custom label to display instead of percentage\n     */\n    valueLabel: InputSignal<string> = input();\n\n    /**\n     * Custom color step thresholds (space or comma separated values)\n     * @example '33 66' or '33,66'\n     */\n    colorSteps: InputSignal<string> = input();\n\n    /**\n     * Override color type ('info', 'success', 'warning', 'danger')\n     */\n    colorType: InputSignal<string> = input(null, { transform: colorTypeTransform });\n\n    /**\n     * Tab index for accessibility\n     * @default '0'\n     */\n    @Input() tabindex = '0';\n\n    /**\n     * Svg icon option\n     */\n    icon: InputSignal<string> = input();\n\n    /**\n     * Svg icon fill color option\n     * @default 'neutral' (black)\n     */\n    fillColor: InputSignal<string> = input();\n\n    /**\n     * Svg icon size option\n     * @default 'm'\n     */\n    size: InputSignal<'2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl' | '4xl'> = input('m');\n\n    /**\n     * CSS class for the current color state\n     *\n     * @default ''\n     */\n    public stateColorNumberClass = '';\n\n    /**\n     * Currently displayed label value\n     *\n     * @default ''\n     */\n    public labelValue = '';\n\n    /**\n     * Percentage value as string\n     * @deprecated This will be removed in next version of eui as it's unused\n     *\n     * @default ''\n     */\n    public percentValue = '';\n\n    /** Rounded value for display */\n    public roundedValue: number;\n\n    /**\n     * Whether the label exceeds a width threshold\n     *\n     * @default false\n     */\n    public isLongLabel = false;\n\n    /**\n     * Current width of the label element\n     *\n     * @default 0\n     */\n    public offsetWidth = 0;\n\n    /** Reference to the label value element */\n    @ViewChild('labelValueEl') labelValueEl: ElementRef<HTMLSpanElement>;\n    protected baseStatesDirective = inject(BaseStatesDirective);\n    private cd = inject(ChangeDetectorRef);\n\n    /**\n     * Initializes color steps and labels after content is initialized\n     */\n    ngAfterContentInit(): void {\n        this.setColorSteps();\n        this.setLabels();\n    }\n\n    /**\n     * Checks and updates label width after content changes\n     */\n    ngAfterContentChecked(): void {\n        if (this.labelValueEl) {\n            this.offsetWidth = this.labelValueEl.nativeElement.offsetWidth;\n            if (this.offsetWidth > 65) {\n                this.isLongLabel = true;\n            }\n        }\n    }\n\n    /**\n     * Handles changes to input properties\n     * @param c - SimpleChanges object containing changed properties\n     */\n    ngOnChanges(c: SimpleChanges): void {\n        if (c.value) {\n            this.setColorSteps();\n            this.setLabels();\n        }\n        this.cd.detectChanges();\n    }\n\n    /**\n     * Sets the color state based on value and thresholds\n     * @deprecated avoid using this method. It will become private in the future.\n     */\n    setColorSteps(): void {\n        const prefix = 'eui-progress-circle-content--';\n        this.roundedValue = Math.round(this.value());\n\n        const steps = this.colorSteps()\n            ? this.colorSteps().split(/[ ,]+/g).map(s => Number.parseInt(s, 10))\n            : [33, 66];\n\n        if (this.colorType()) {\n            this.stateColorNumberClass = prefix + this.colorType();\n        } else if (this.isDefaultColorSteps()) {\n            const val = this.value();\n            if (val <= steps[0]) {\n                this.stateColorNumberClass = prefix + 'success';\n            } else if (val <= steps[1]) {\n                this.stateColorNumberClass = prefix + 'warning';\n            } else {\n                this.stateColorNumberClass = prefix + 'danger';\n            }\n        }\n    }\n\n    /**\n     * Sets the display label based on current value and configuration\n     * @deprecated avoid using this method. It will become private in the future.\n     */\n    setLabels(): void {\n        if (this.value() === 0) {\n            this.labelValue = this.hasBottomLabel() ? this.valueLabel() : this.emptyLabel();\n        } else {\n            this.labelValue = this.valueLabel() || this.value() + '%';\n        }\n    }\n}\n","<div\n    class=\"eui-progress-circle-content p{{ roundedValue }} {{ stateColorNumberClass }}\"\n    [class.eui-progress-circle-content--over50]=\"roundedValue > 50\">\n    @if ( !isLongLabel && !hasBottomLabel() ) {\n        <span class=\"eui-progress-circle-content__label\">\n            <span #labelValueEl>{{ labelValue }}</span>\n        </span>\n    }\n    <div class=\"eui-progress-circle-content__left-half-clipper\">\n        <div class=\"eui-progress-circle-content__first50-bar\"></div>\n        <div class=\"eui-progress-circle-content__value-bar\"></div>\n    </div>\n</div>\n@if ( isLongLabel || hasBottomLabel() ) {\n    <div class=\"eui-progress-circle-content__bottom-label\">\n        <span class=\"label\">{{ labelValue }}</span>\n    </div>\n}\n@if ( icon() ) {\n    <eui-icon-svg [icon]=\"icon()\" [fillColor]=\"fillColor()\" [size]=\"size()\" class=\"eui-progress-circle-content__icon-label\" />\n}\n","import { EuiProgressCircleComponent } from './eui-progress-circle.component';\n\nexport * from './eui-progress-circle.component';\n\nexport const EUI_PROGRESS_CIRCLE = [\n    EuiProgressCircleComponent,\n] as const;\n\n// export { EuiProgressCircleComponent as EuiProgressCircle } from './eui-progress-circle.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAqBA;;;;AAIG;AACH,MAAM,sBAAsB,GAAG,CAAC,KAAsB,KAAY;AAC9D,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC;IACzB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC3D,CAAC;AAGD;;;;AAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,KAAyB,KAAe;IAChE,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;AACtD,IAAA,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAkB,GAAG,MAAM;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;MAsBU,0BAA0B,CAAA;AArBvC,IAAA,WAAA,GAAA;AAiCI;;;AAGG;QAEM,IAAA,CAAA,SAAS,GAAG,iBAAiB;AAEtC;;;AAGG;QACH,IAAA,CAAA,mBAAmB,GAAG,KAAK,CAAC,IAAI,2FAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAElE;;;AAGG;QACH,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,KAAK,sFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAE9D;;;AAGG;QACH,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,CAAC,6EAAI,SAAS,EAAE,sBAAsB,EAAA,CAAG;AAEvD;;;AAGG;AACH,Q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