/** * Copyright Aquera Inc 2026 * * This source code is licensed under the BSD-3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import NileElement from '../internal/nile-element'; import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit'; import '../nile-lite-tooltip/index'; /** A single slice of the distribution rendered by `nile-segmented-progress-bar`. */ export interface NileProgressSegment { /** Legend label, also used in the default tooltip text. */ label: string; /** Raw magnitude of this segment. */ value: number; /** Any CSS color; falls back to the palette rotation when omitted. */ color?: string; /** Overrides the default tooltip content for this segment. */ tooltip?: string; } /** Placement values forwarded to `nile-lite-tooltip`. */ export type NileSegmentTooltipPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'auto' | 'auto-start' | 'auto-end'; /** * Nile segmented progress bar component. * * @tag nile-segmented-progress-bar * * @summary A config-driven, responsive multi-segment progress / distribution bar * with an optional wrapping legend — a single rounded track split into colored * proportional segments (for example Success / Failure / Errors / Running / Other). * @status experimental * * @event nile-segment-click - Emitted when a segment or its legend entry is activated by click, * `Enter` or `Space`. The `detail` contains `{ segment, index, percentage }`. * * @csspart container - The component's base wrapper. * @csspart label - The optional heading above the bar. * @csspart bar - The bar/track element (also exposed as `track`). * @csspart track - The bar/track element (also exposed as `bar`). * @csspart segment - An individual colored segment inside the track. * @csspart legend - The wrapping legend row. * @csspart legend-item - A single legend entry (swatch + label + value). * @csspart legend-swatch - The small rounded square in the segment color. * @csspart legend-label - The legend entry's label text. * @csspart legend-value - The legend entry's bold value. * * @example * */ export declare class NileSegmentedProgressBar extends NileElement { static styles: CSSResultGroup; /** The segments to distribute across the bar. This is the component's config. */ segments: NileProgressSegment[]; /** Optional heading rendered above the bar. Nothing renders when empty. */ label: string; /** Renders the legend below the bar. */ showLegend: boolean; /** Wraps every segment in a `nile-lite-tooltip`. */ showTooltip: boolean; /** Renders the bold value alongside each legend label. */ showValues: boolean; /** The thickness of the bar. */ size: 'small' | 'medium' | 'large'; /** * Optional denominator. When omitted the denominator is the sum of the segment * values, so the segments always fill 100%. When larger than the sum, the * remainder renders as an unfilled track. */ total?: number; /** Rounds the bar's outer ends. */ rounded: boolean; /** * Minimum rendered width, in pixels, of a non-zero segment. Guarantees sub-1% * segments stay a discernible sliver. The largest segment absorbs whatever * overflow this introduces, so the row still totals exactly 100%. */ minSegmentWidth: number; /** Passed straight through to `nile-lite-tooltip`'s `placement`. */ tooltipPlacement: NileSegmentTooltipPlacement; /** Coerces a configured value into a usable, non-negative, finite number. */ private sanitizeValue; /** The sanitized magnitude of every configured segment, in config order. */ private get values(); /** The sum of every sanitized segment value. */ private get sum(); /** The denominator the percentages are computed against. */ private get denominator(); /** Each segment's share of the denominator, in config order. */ private get percentages(); /** * The index of the widest rendered segment. That segment is the one allowed to * shrink, so it absorbs the overflow introduced by `minSegmentWidth` on the * tiny ones and the row still adds up to exactly 100% of the track. */ private get largestIndex(); /** Formats a percentage to one decimal, trimming a trailing `.0`. */ private formatPercentage; /** The default tooltip / aria text for a segment. */ private describeSegment; /** The tooltip content for a segment, honouring a per-segment override. */ private tooltipFor; /** * A single sentence describing the whole distribution, used as the track's * accessible name so screen readers get the breakdown without tabbing it. */ private get accessibleSummary(); updated(changedProperties: PropertyValues): void; /** Logs invalid config the way `nile-progress-bar` reports out-of-range values. */ private validateConfig; private activate; /** * `Enter` and `Space` activate a segment or legend entry. The affordances are * `role="button"` elements rather than native buttons, so activation is wired * up explicitly and a key press never double-fires alongside a synthetic click. */ private handleKeyDown; private renderSegment; private renderLegendItem; render(): TemplateResult; } export default NileSegmentedProgressBar; declare global { interface HTMLElementTagNameMap { 'nile-segmented-progress-bar': NileSegmentedProgressBar; } }