@rankingcoach/vanguard 1.5.1 → 1.7.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/dist/index-AMPMMidnightParser.js +1 -1
- package/dist/index-AMPMParser.js +1 -1
- package/dist/index-Accordion2.js +1 -1
- package/dist/index-Axios4.js +1 -1
- package/dist/index-AxiosError.js +1 -1
- package/dist/index-BenchmarkGauge.js +119 -0
- package/dist/index-BenchmarkGauge.module.scss.js +35 -0
- package/dist/index-BenchmarkGaugeMarker.js +58 -0
- package/dist/index-BenchmarkGaugeMarker.module.scss.js +19 -0
- package/dist/index-BenchmarkGaugePin.js +40 -0
- package/dist/index-BenchmarkGaugePin.module.scss.js +15 -0
- package/dist/index-Calendar.js +1 -1
- package/dist/index-CalendarPicker.js +1 -1
- package/dist/index-CanceledError.js +1 -1
- package/dist/index-Collapse2.js +1 -1
- package/dist/index-DateParser.js +1 -1
- package/dist/index-DateRange.js +1 -1
- package/dist/index-DateRange2.js +1 -1
- package/dist/index-DateRangePicker2.js +1 -1
- package/dist/index-DayOfYearParser.js +1 -1
- package/dist/index-DayPeriodParser.js +1 -1
- package/dist/index-ExtendedYearParser.js +1 -1
- package/dist/index-Fade.js +1 -1
- package/dist/index-FormControl2.js +1 -1
- package/dist/index-FractionOfSecondParser.js +1 -1
- package/dist/index-Grow.js +1 -1
- package/dist/index-Hour0To11Parser.js +1 -1
- package/dist/index-Hour0to23Parser.js +1 -1
- package/dist/index-Hour1To24Parser.js +1 -1
- package/dist/index-Hour1to12Parser.js +1 -1
- package/dist/index-ISODayParser.js +1 -1
- package/dist/index-ISOTimezoneParser.js +1 -1
- package/dist/index-ISOTimezoneWithZParser.js +1 -1
- package/dist/index-ISOWeekParser.js +1 -1
- package/dist/index-ISOWeekYearParser.js +1 -1
- package/dist/index-InputBase2.js +1 -1
- package/dist/index-InterceptorManager.js +1 -1
- package/dist/index-LocalDayParser.js +1 -1
- package/dist/index-LocalWeekParser.js +1 -1
- package/dist/index-LocalWeekYearParser.js +1 -1
- package/dist/index-LoginButton.js +1 -1
- package/dist/index-MinuteParser.js +1 -1
- package/dist/index-Month.js +1 -1
- package/dist/index-MonthParser.js +1 -1
- package/dist/index-MonthPicker.js +1 -1
- package/dist/index-PickersMonth.js +1 -1
- package/dist/index-PickersPopper.js +1 -1
- package/dist/index-PureDateInput.js +1 -1
- package/dist/index-QuarterParser.js +1 -1
- package/dist/index-SecondParser.js +1 -1
- package/dist/index-SelectInput2.js +2 -2
- package/dist/index-Slide.js +1 -1
- package/dist/index-SocialMediaLink.js +1 -1
- package/dist/index-StandAloneLocalDayParser.js +1 -1
- package/dist/index-StandAloneMonthParser.js +1 -1
- package/dist/index-StandAloneQuarterParser.js +1 -1
- package/dist/index-TimestampMillisecondsParser.js +1 -1
- package/dist/index-TimestampSecondsParser.js +1 -1
- package/dist/index-Tooltip.js +1 -1
- package/dist/index-YearParser.js +1 -1
- package/dist/index-YearPicker.js +1 -1
- package/dist/index-_virtual10.js +3 -5
- package/dist/index-_virtual11.js +5 -5
- package/dist/index-_virtual12.js +5 -2
- package/dist/index-_virtual18.js +2 -7
- package/dist/index-_virtual19.js +7 -2
- package/dist/index-_virtual9.js +2 -3
- package/dist/index-axios2.js +1 -1
- package/dist/index-buildURL.js +1 -1
- package/dist/index-cookies.js +1 -1
- package/dist/index-defaults.js +1 -1
- package/dist/index-dispatchRequest.js +1 -1
- package/dist/index-dist3.js +1 -1
- package/dist/index-es.js +1 -1
- package/dist/index-formDataToJSON.js +1 -1
- package/dist/index-http.store.js +1 -1
- package/dist/index-isAxiosError.js +1 -1
- package/dist/index-isURLSameOrigin.js +1 -1
- package/dist/index-mergeConfig.js +1 -1
- package/dist/index-normalizeHeaderName.js +1 -1
- package/dist/index-parseHeaders.js +1 -1
- package/dist/index-position_high.svg.js +4 -0
- package/dist/index-position_low.svg.js +4 -0
- package/dist/index-position_mid.svg.js +4 -0
- package/dist/index-toFormData.js +1 -1
- package/dist/index-toURLEncodedForm.js +1 -1
- package/dist/index-transformData.js +1 -1
- package/dist/index-use-benchmark-gauge-render-state.js +61 -0
- package/dist/index-use-dynamic-import.js +3 -0
- package/dist/index-useAutocomplete.js +1 -1
- package/dist/index-useControlled.js +2 -26
- package/dist/index-useControlled2.js +26 -2
- package/dist/index-useIsLandscape.js +1 -1
- package/dist/index-useSlider.js +1 -1
- package/dist/index-useViews.js +2 -2
- package/dist/index-utils10.js +179 -11
- package/dist/index-utils11.js +12 -100
- package/dist/index-utils12.js +102 -0
- package/dist/index-utils3.js +48 -19
- package/dist/index-utils4.js +18 -63
- package/dist/index-utils5.js +63 -15
- package/dist/index-utils6.js +15 -66
- package/dist/index-utils7.js +66 -11
- package/dist/index-utils8.js +12 -2
- package/dist/index-utils9.js +2 -180
- package/dist/index-video.es.js +2 -2
- package/dist/index-xhr.js +1 -1
- package/dist/index.js +290 -288
- package/dist/reputation/position_high.svg +5 -0
- package/dist/reputation/position_low.svg +12 -0
- package/dist/reputation/position_mid.svg +11 -0
- package/dist/types/core/BenchmarkGauge/BenchmarkGauge.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/BenchmarkGaugeMarker/BenchmarkGaugeMarker.d.ts +16 -0
- package/dist/types/core/BenchmarkGauge/BenchmarkGaugeMarker/BenchmarkGaugePin/BenchmarkGaugePin.d.ts +10 -0
- package/dist/types/core/BenchmarkGauge/hooks/use-benchmark-gauge-render-state.d.ts +19 -0
- package/dist/types/core/BenchmarkGauge/index.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/AuditSimulation.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ColorByRankCustomPalette.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ColorByRankDefault.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ColorByRankMixedPrecedence.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ColorByRankTwoMarkersEndpoints.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/EdgePins.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/FullTrackNoProgress.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/HorizontalDefault.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InsideEndLabelOnly.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InsideLabels.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InsideLabelsVertical.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InsideLabelsWithOverlap.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InsideLabelsWithProgress.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InsideStartLabelOnly.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/InvalidRangeGuard.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendHorizontal.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendNone.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendPartial.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendVertical.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendWithCoreGrowEffect.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendWithHighlightedIcons.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/LegendWithWrapperExtras.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ListingsSimulation.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/NoMarkers.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/OverlappingMarkers.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressAtMax.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressAtMin.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressHorizontal.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressInvalidId.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressVertical.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressVerticalAtMin.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressWideTextPin.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ProgressWideTextPinVertical.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/RankScenarioA.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/RankScenarioB.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/RankScenarioC.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/RankWithContent.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/ScoreSimulation.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/StaticColorRegression.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/VerticalDefault.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/WithContentAutoFlip.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/WithContentEnd.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/WithContentStart.story.d.ts +2 -0
- package/dist/types/core/BenchmarkGauge/stories/_BenchmarkGauge.default.d.ts +44 -0
- package/dist/types/core/BenchmarkGauge/types.d.ts +136 -0
- package/dist/types/core/BenchmarkGauge/utils.d.ts +61 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/vanguard-asset-analysis.json +1 -1
- package/dist/vanguard.css +1 -1
- package/dist-wordpress/vanguard.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M2.18164 23.9998C2.18164 36.0497 11.95 45.818 23.9998 45.818C36.0497 45.818 45.818 36.0497 45.818 23.9998C45.818 11.95 36.0497 2.18164 23.9998 2.18164C11.95 2.18164 2.18164 11.95 2.18164 23.9998Z" fill="#21C445"/>
|
|
3
|
+
<path d="M11.4551 33.2727H16.94C17.2787 33.2727 17.6128 33.1939 17.9158 33.0424L23.0248 30.4879C23.639 30.1807 24.362 30.1807 24.9763 30.4879L30.0853 33.0424C30.3883 33.1939 30.7223 33.2727 31.061 33.2727H36.546V33.8182C36.546 35.0232 35.5692 36 34.3642 36H13.6369C12.4319 36 11.4551 35.0232 11.4551 33.8182V33.2727Z" fill="#97E4A7"/>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6802 23.1562L11.7642 22.1205C11.914 21.8733 12.0003 21.5834 12.0003 21.2733C12.0003 20.3695 11.2676 19.6369 10.3639 19.6369C9.46016 19.6369 8.72754 20.3695 8.72754 21.2733C8.72754 22.1056 9.34901 22.7928 10.1533 22.8962L11.4548 30.0005H16.9398C17.2785 30.0005 17.6125 29.9217 17.9155 29.7702L23.0245 27.2157C23.6388 26.9086 24.3618 26.9086 24.976 27.2157L30.085 29.7702C30.388 29.9217 30.7221 30.0005 31.0608 30.0005H36.5457L37.8473 22.8962C38.6515 22.7928 39.273 22.1056 39.273 21.2733C39.273 20.3695 38.5404 19.6369 37.6366 19.6369C36.7329 19.6369 36.0003 20.3695 36.0003 21.2733C36.0003 21.5834 36.0865 21.8733 36.2364 22.1205L34.3203 23.1562C33.7105 23.4858 32.9518 23.1704 32.7554 22.5056L31.8524 19.4494C32.3728 19.1755 32.7275 18.6294 32.7275 18.0005C32.7275 17.0968 31.9949 16.3642 31.0912 16.3642C30.1874 16.3642 29.4548 17.0968 29.4548 18.0005C29.4548 18.4076 29.6034 18.7799 29.8494 19.0662L28.3849 20.2945C27.7899 20.7935 26.8788 20.5288 26.644 19.7886L24.9436 14.4287C25.3629 14.1324 25.6366 13.6439 25.6366 13.0914C25.6366 12.1877 24.904 11.4551 24.0003 11.4551C23.0965 11.4551 22.3639 12.1877 22.3639 13.0914C22.3639 13.6439 22.6377 14.1324 23.0569 14.4287L21.3565 19.7886C21.1217 20.5288 20.2106 20.7935 19.6157 20.2945L18.1512 19.0662C18.3971 18.7799 18.5457 18.4076 18.5457 18.0005C18.5457 17.0968 17.8131 16.3642 16.9094 16.3642C16.0056 16.3642 15.273 17.0968 15.273 18.0005C15.273 18.6294 15.6278 19.1755 16.1481 19.4494L15.2452 22.5056C15.0487 23.1704 14.2901 23.4858 13.6802 23.1562Z" fill="white"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M2.18164 23.9998C2.18164 36.0497 11.95 45.818 23.9998 45.818C36.0497 45.818 45.818 36.0497 45.818 23.9998C45.818 11.95 36.0497 2.18164 23.9998 2.18164C11.95 2.18164 2.18164 11.95 2.18164 23.9998Z" fill="#FF4747"/>
|
|
3
|
+
<circle cx="24.0003" cy="24.0003" r="13.6364" stroke="#FEEDEC" stroke-width="3.27273"/>
|
|
4
|
+
<path d="M30.546 37.6363H17.4551C17.4551 34.0213 20.3856 31.0908 24.0005 31.0908C27.6155 31.0908 30.546 34.0213 30.546 37.6363Z" fill="#FEEDEC"/>
|
|
5
|
+
<rect x="22.9092" y="9.27246" width="2.18182" height="5.45455" rx="1.09091" fill="#FEEDEC"/>
|
|
6
|
+
<path d="M20.9313 16.9218L21.0874 33.5556C21.1035 35.2687 22.654 36.5574 24.3411 36.2599C26.0283 35.9624 27.0445 34.2211 26.4737 32.6058L20.9313 16.9218Z" fill="white"/>
|
|
7
|
+
<rect x="34.4424" y="13.7881" width="2.18182" height="5.45455" rx="1.09091" transform="rotate(45 34.4424 13.7881)" fill="#FEEDEC"/>
|
|
8
|
+
<rect x="12.3125" y="15.3301" width="2.18182" height="5.45455" rx="1.09091" transform="rotate(-45 12.3125 15.3301)" fill="#FEEDEC"/>
|
|
9
|
+
<rect x="12.0166" y="15.3301" width="2.18182" height="5.45455" rx="1.09091" transform="rotate(-45 12.0166 15.3301)" fill="#FEEDEC"/>
|
|
10
|
+
<rect x="9.27344" y="26.0645" width="2.18182" height="5.45455" rx="1.09091" transform="rotate(-90 9.27344 26.0645)" fill="#FEEDEC"/>
|
|
11
|
+
<rect x="33.2734" y="26.0645" width="2.18182" height="5.45455" rx="1.09091" transform="rotate(-90 33.2734 26.0645)" fill="#FEEDEC"/>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M2.18164 23.9998C2.18164 36.0497 11.95 45.818 23.9998 45.818C36.0497 45.818 45.818 36.0497 45.818 23.9998C45.818 11.95 36.0497 2.18164 23.9998 2.18164C11.95 2.18164 2.18164 11.95 2.18164 23.9998Z" fill="#FFC247"/>
|
|
3
|
+
<circle cx="24.0003" cy="24.0003" r="13.6364" stroke="#FFE4AD" stroke-width="3.27273"/>
|
|
4
|
+
<path d="M30.546 37.6363H17.4551C17.4551 34.0213 20.3856 31.0908 24.0005 31.0908C27.6155 31.0908 30.546 34.0213 30.546 37.6363Z" fill="#FFE4AD"/>
|
|
5
|
+
<rect x="22.3643" y="10.9092" width="3.27273" height="5.45455" rx="1.63636" fill="#FFE4AD"/>
|
|
6
|
+
<path d="M27.0687 16.9218L26.9126 33.5556C26.8965 35.2687 25.346 36.5574 23.6589 36.2599C21.9717 35.9624 20.9555 34.2211 21.5263 32.6058L27.0687 16.9218Z" fill="white"/>
|
|
7
|
+
<rect x="33.3115" y="14.8789" width="3.27273" height="5.45455" rx="1.63636" transform="rotate(45 33.3115 14.8789)" fill="#FFE4AD"/>
|
|
8
|
+
<rect x="12.375" y="17.1924" width="3.27273" height="5.45455" rx="1.63636" transform="rotate(-45 12.375 17.1924)" fill="#FFE4AD"/>
|
|
9
|
+
<rect x="10.3643" y="27.7012" width="3.27273" height="5.45455" rx="1.63636" transform="rotate(-90 10.3643 27.7012)" fill="#FFE4AD"/>
|
|
10
|
+
<rect x="32.1816" y="27.7012" width="3.27273" height="5.45455" rx="1.63636" transform="rotate(-90 32.1816 27.7012)" fill="#FFE4AD"/>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BenchmarkGaugeMarkerType } from '../types';
|
|
2
|
+
interface BenchmarkGaugeMarkerProps {
|
|
3
|
+
marker: BenchmarkGaugeMarkerType;
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
orientation: 'horizontal' | 'vertical';
|
|
7
|
+
rankIndex: number;
|
|
8
|
+
rankCount: number;
|
|
9
|
+
isDimmed: boolean;
|
|
10
|
+
isHighlighted: boolean;
|
|
11
|
+
growHighlightedMarker?: boolean;
|
|
12
|
+
/** Resolved pin background color. Computed by the parent from marker.color, colorByRank, and the default fallback. */
|
|
13
|
+
resolvedColor: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const BenchmarkGaugeMarker: (props: BenchmarkGaugeMarkerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
package/dist/types/core/BenchmarkGauge/BenchmarkGaugeMarker/BenchmarkGaugePin/BenchmarkGaugePin.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BenchmarkGaugeMarkerType, MarkerRenderContext } from '../..';
|
|
2
|
+
interface BenchmarkGaugePinProps {
|
|
3
|
+
marker: BenchmarkGaugeMarkerType;
|
|
4
|
+
ctx: MarkerRenderContext;
|
|
5
|
+
resolvedColor: string;
|
|
6
|
+
isHighlighted: boolean;
|
|
7
|
+
growHighlightedMarker?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const BenchmarkGaugePin: (props: BenchmarkGaugePinProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { BenchmarkGaugeProps } from '../types';
|
|
3
|
+
export declare const useBenchmarkGaugeRenderState: (props: BenchmarkGaugeProps) => {
|
|
4
|
+
isVertical: boolean;
|
|
5
|
+
rankCount: number;
|
|
6
|
+
isProgressMode: boolean;
|
|
7
|
+
hoverHighlights: boolean;
|
|
8
|
+
dimsItems: boolean;
|
|
9
|
+
dimsMarkers: boolean;
|
|
10
|
+
rankMap: Map<string, number>;
|
|
11
|
+
trackBarStyle: CSSProperties;
|
|
12
|
+
ghostStyle: CSSProperties;
|
|
13
|
+
shouldUseTrackGradient: boolean;
|
|
14
|
+
fillStyle: CSSProperties;
|
|
15
|
+
effectiveStartLabel: import('react').ReactNode;
|
|
16
|
+
effectiveEndLabel: import('react').ReactNode;
|
|
17
|
+
hasLegend: boolean;
|
|
18
|
+
legendMarkers: import('..').BenchmarkGaugeMarkerType[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { BenchmarkGauge } from '../BenchmarkGauge';
|
|
3
|
+
import { BenchmarkGaugeMarkerType, MarkerRenderContext } from '../types';
|
|
4
|
+
export type Story = StoryObj<typeof BenchmarkGauge>;
|
|
5
|
+
export declare const testValues: {
|
|
6
|
+
readonly min: 0;
|
|
7
|
+
readonly max: 100;
|
|
8
|
+
readonly low: 20;
|
|
9
|
+
readonly mid: 50;
|
|
10
|
+
readonly high: 80;
|
|
11
|
+
readonly edgeMin: 0;
|
|
12
|
+
readonly edgeMax: 100;
|
|
13
|
+
readonly nearEdge: 88;
|
|
14
|
+
};
|
|
15
|
+
export declare const twoMarkers: BenchmarkGaugeMarkerType[];
|
|
16
|
+
export declare const threeMarkers: BenchmarkGaugeMarkerType[];
|
|
17
|
+
export declare const progressMarkers: BenchmarkGaugeMarkerType[];
|
|
18
|
+
export declare const defaultProps: {
|
|
19
|
+
readonly min: 0;
|
|
20
|
+
readonly max: 100;
|
|
21
|
+
readonly markers: BenchmarkGaugeMarkerType[];
|
|
22
|
+
readonly 'aria-label': "Benchmark gauge";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns all BenchmarkGaugeMarker elements from the canvas for play-function
|
|
26
|
+
* assertions. Horizontal markers carry an inline `left` style; vertical markers
|
|
27
|
+
* carry `bottom`. Only BenchmarkGaugeMarker sets these positional inline styles,
|
|
28
|
+
* making this a stable selector that does not depend on hashed CSS-module class names.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getMarkers(canvasElement: HTMLElement, orientation?: 'horizontal' | 'vertical'): Element[];
|
|
31
|
+
export declare const insideStartLabel: import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const insideEndLabel: import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare function PlainLegendContent({ label, value }: {
|
|
34
|
+
label: string;
|
|
35
|
+
value: number;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function StubCard({ ctx }: {
|
|
38
|
+
ctx: MarkerRenderContext;
|
|
39
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function TextPin({ label }: {
|
|
41
|
+
label: string;
|
|
42
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare function pinColor(rankIndex: number, rankCount: number): string;
|
|
44
|
+
export declare const RankedPin: Story['args']['markers'][number]['renderPin'];
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MarkerRenderContext {
|
|
3
|
+
/** The full marker data object. */
|
|
4
|
+
marker: BenchmarkGaugeMarkerType;
|
|
5
|
+
/** 0-based rank by value; 0 = lowest, `rankCount − 1` = highest. */
|
|
6
|
+
rankIndex: number;
|
|
7
|
+
/** Total number of markers. */
|
|
8
|
+
rankCount: number;
|
|
9
|
+
/** True when another marker's legend item is highlighted. */
|
|
10
|
+
isDimmed: boolean;
|
|
11
|
+
/** True when this marker's legend item is active (hovered or focused). */
|
|
12
|
+
isHighlighted: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Controls which legend interaction behaviors are active. All fields default to `true`. */
|
|
15
|
+
export interface BenchmarkGaugeLegendInteraction {
|
|
16
|
+
/**
|
|
17
|
+
* Whether hovering a legend item highlights it and its corresponding marker.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
hoverHighlights?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether non-highlighted legend items are visually dimmed.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
dimsItems?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether non-highlighted track markers are visually dimmed.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
dimsMarkers?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export type BenchmarkGaugeMarkerType = {
|
|
33
|
+
/** Stable unique key. Used for `progressMarkerId` matching and legend interaction. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Position on the scale. Values outside `[min, max]` are clamped. */
|
|
36
|
+
value: number;
|
|
37
|
+
/** Accessible label. Not rendered by the core — surface it in `renderPin`, `renderContent`, or `renderLegend`. */
|
|
38
|
+
label: string;
|
|
39
|
+
/** Background color of the default pin. Takes precedence over `colorByRank`. No effect when `renderPin` is provided. */
|
|
40
|
+
color?: string;
|
|
41
|
+
/** Background color of the legend item shell. Defaults to white. The highlight overlay renders on top of it. */
|
|
42
|
+
legendBackgroundColor?: string;
|
|
43
|
+
/** Custom pin renderer. Falls back to the default circle pin when omitted. */
|
|
44
|
+
renderPin?: (ctx: MarkerRenderContext) => React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Content rendered inside the default pin that animates in when the legend item is highlighted.
|
|
47
|
+
* No effect when `renderPin` is provided — use `isHighlighted` from the render context instead.
|
|
48
|
+
*/
|
|
49
|
+
renderHighlightedContent?: (ctx: MarkerRenderContext) => React.ReactNode;
|
|
50
|
+
/** Anchored content (e.g. a card) rendered beside the pin. Omit to render no connector or shell. */
|
|
51
|
+
renderContent?: (ctx: MarkerRenderContext) => React.ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Inner content of this marker's legend item. The core renders the shell (tab stop, interaction wiring, highlight/dim).
|
|
54
|
+
* Omit to exclude this marker from the legend. If no marker provides this, no legend renders.
|
|
55
|
+
*/
|
|
56
|
+
renderLegend?: (ctx: MarkerRenderContext) => React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Which side of the track the content anchors to.
|
|
59
|
+
* `'auto'` places content below/right and flips to above/left when the marker is near the track end.
|
|
60
|
+
* @default 'auto'
|
|
61
|
+
*/
|
|
62
|
+
contentSide?: 'start' | 'end' | 'auto';
|
|
63
|
+
};
|
|
64
|
+
interface BenchmarkGaugeBaseProps {
|
|
65
|
+
/** Lower bound of the scale. */
|
|
66
|
+
min: number;
|
|
67
|
+
/** Upper bound of the scale. Must be greater than `min`. */
|
|
68
|
+
max: number;
|
|
69
|
+
/** Markers to render on the scale. DOM and keyboard tab order follow the input array order. */
|
|
70
|
+
markers: BenchmarkGaugeMarkerType[];
|
|
71
|
+
/** @default 'horizontal' */
|
|
72
|
+
orientation?: 'horizontal' | 'vertical';
|
|
73
|
+
/** Full CSS gradient string. Overrides the default red-to-green track gradient. */
|
|
74
|
+
gradient?: string;
|
|
75
|
+
/**
|
|
76
|
+
* ID of the marker that acts as the progress fill endpoint.
|
|
77
|
+
* Enables a two-layer track: a ghost layer at full width and a fill layer clipped to this marker's position.
|
|
78
|
+
*/
|
|
79
|
+
progressMarkerId?: string;
|
|
80
|
+
/** Controls which legend interaction behaviors are active. */
|
|
81
|
+
legendInteraction?: BenchmarkGaugeLegendInteraction;
|
|
82
|
+
/**
|
|
83
|
+
* Grows the default pin when its legend item is highlighted.
|
|
84
|
+
* No effect when `renderPin` is provided — manage scaling inside `renderPin` instead.
|
|
85
|
+
*/
|
|
86
|
+
growHighlightedMarker?: boolean;
|
|
87
|
+
/** Sets `data-testid` on the root element. */
|
|
88
|
+
testId?: string;
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* `compactLabels`, `startLabel`, and `endLabel` are only valid when `showLabels: true`.
|
|
93
|
+
* Passing any of them without `showLabels: true` is a TypeScript error.
|
|
94
|
+
*/
|
|
95
|
+
type BenchmarkGaugeLabelProps = {
|
|
96
|
+
/** Labels disabled. `compactLabels`, `startLabel`, and `endLabel` are not accepted. */
|
|
97
|
+
showLabels?: false;
|
|
98
|
+
/** @internal Not valid when `showLabels` is absent or `false`. */
|
|
99
|
+
compactLabels?: never;
|
|
100
|
+
/** @internal Not valid when `showLabels` is absent or `false`. */
|
|
101
|
+
startLabel?: never;
|
|
102
|
+
/** @internal Not valid when `showLabels` is absent or `false`. */
|
|
103
|
+
endLabel?: never;
|
|
104
|
+
} | {
|
|
105
|
+
/** Enables track-end labels. Missing sides fall back to `String(min)` / `String(max)`. */
|
|
106
|
+
showLabels: true;
|
|
107
|
+
/** Switches auto-generated labels to compact notation (1000 → "1K"). No effect on custom `startLabel` / `endLabel`. */
|
|
108
|
+
compactLabels?: boolean;
|
|
109
|
+
/** Custom start label. Falls back to `String(min)` when omitted. */
|
|
110
|
+
startLabel?: React.ReactNode;
|
|
111
|
+
/** Custom end label. Falls back to `String(max)` when omitted. */
|
|
112
|
+
endLabel?: React.ReactNode;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* `rankColors` is only valid when `colorByRank: true`.
|
|
116
|
+
* Passing it without `colorByRank: true` is a TypeScript error.
|
|
117
|
+
*/
|
|
118
|
+
type BenchmarkGaugeRankColoring = {
|
|
119
|
+
/** Rank coloring disabled. `rankColors` is not accepted. */
|
|
120
|
+
colorByRank?: false;
|
|
121
|
+
/** @internal Not valid when `colorByRank` is absent or `false`. */
|
|
122
|
+
rankColors?: never;
|
|
123
|
+
} | {
|
|
124
|
+
/**
|
|
125
|
+
* Colors default pins by semantic rank (lowest → highest). No effect on markers with `renderPin`.
|
|
126
|
+
* The default palette is `['var(--e500)', 'var(--a2900)', 'var(--s400)']` (red → amber → green).
|
|
127
|
+
*/
|
|
128
|
+
colorByRank: true;
|
|
129
|
+
/**
|
|
130
|
+
* Custom palette ordered worst → best. Colors are distributed semantically: 2 markers on a 3-color palette
|
|
131
|
+
* resolve to the endpoints, not indices 0 and 1. Defaults to the built-in 3-stop palette.
|
|
132
|
+
*/
|
|
133
|
+
rankColors?: string[];
|
|
134
|
+
};
|
|
135
|
+
export type BenchmarkGaugeProps = BenchmarkGaugeBaseProps & BenchmarkGaugeLabelProps & BenchmarkGaugeRankColoring;
|
|
136
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** Maps a value to a percentage within [min, max], clamped to 0–100. Returns 0 when max ≤ min. */
|
|
3
|
+
export declare const valueToPercent: (value: number, min: number, max: number) => number;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the CSS `left`/`bottom` position for a marker pin at the given percentage.
|
|
6
|
+
* Offsets from track edges by `--benchmark-gauge-marker-inset` (default: 20px) so pins
|
|
7
|
+
* never sit flush against the rounded track ends.
|
|
8
|
+
*/
|
|
9
|
+
export declare const markerPosition: (percent: number) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the CSS `clip-path` inset (from the far end) that aligns the progress fill
|
|
12
|
+
* with the marker pin's position, accounting for the same inset used by `markerPosition`.
|
|
13
|
+
* At 100% returns `'0px'` so the fill covers the full track.
|
|
14
|
+
* Callers suppress the fill layer entirely at 0% — this function is not called in that case.
|
|
15
|
+
*/
|
|
16
|
+
export declare const fillClipInset: (percent: number) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Default semantic rank palette, ordered lowest → highest:
|
|
19
|
+
* `var(--e500)` (red) → `var(--a2900)` (amber) → `var(--s400)` (green).
|
|
20
|
+
* Pass `rankColors` to the component to override.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_RANK_COLORS: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the final pin background color for a marker.
|
|
25
|
+
*
|
|
26
|
+
* Precedence (highest to lowest):
|
|
27
|
+
* 1. `markerColor` — explicit per-marker color; always wins.
|
|
28
|
+
* 2. Rank-based palette color — when `colorByRank` is true. Colors are distributed
|
|
29
|
+
* semantically: 2 markers on a 3-color palette map to the endpoints, not indices 0 and 1.
|
|
30
|
+
* 3. `var(--n400)` — component default fallback.
|
|
31
|
+
*
|
|
32
|
+
* Edge cases: a single marker (rankCount = 1) safely maps to palette[0];
|
|
33
|
+
* an empty `rankColors` array falls through to the default.
|
|
34
|
+
*/
|
|
35
|
+
export declare const resolveMarkerColor: ({ markerColor, rankIndex, rankCount, colorByRank, rankColors, }: {
|
|
36
|
+
markerColor: string | undefined;
|
|
37
|
+
rankIndex: number;
|
|
38
|
+
rankCount: number;
|
|
39
|
+
colorByRank?: boolean;
|
|
40
|
+
rankColors?: string[];
|
|
41
|
+
}) => string;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the start and end labels to render at each track edge.
|
|
44
|
+
*
|
|
45
|
+
* - `showLabels: false` (or not set) — both sides return `undefined`.
|
|
46
|
+
* - `showLabels: true` — each side falls back to `String(min)` / `String(max)`.
|
|
47
|
+
* `compactLabels` switches auto-generated values to compact notation (1000 → "1K").
|
|
48
|
+
* - A custom `startLabel` / `endLabel` renders as-is and overrides the fallback.
|
|
49
|
+
* - Passing `null` for a side explicitly suppresses it even when `showLabels: true`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const resolveLabels: ({ showLabels, startLabel, endLabel, min, max, compactLabels, }: {
|
|
52
|
+
showLabels?: boolean;
|
|
53
|
+
startLabel?: React.ReactNode;
|
|
54
|
+
endLabel?: React.ReactNode;
|
|
55
|
+
min: number;
|
|
56
|
+
max: number;
|
|
57
|
+
compactLabels?: boolean;
|
|
58
|
+
}) => {
|
|
59
|
+
startLabel: React.ReactNode | undefined;
|
|
60
|
+
endLabel: React.ReactNode | undefined;
|
|
61
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ export type { AiGlowProps } from './core/AiGlow';
|
|
|
131
131
|
export { AiGlow } from './core/AiGlow';
|
|
132
132
|
export type { ArcGaugeProps } from './core/ArcGauge';
|
|
133
133
|
export { ArcGauge } from './core/ArcGauge';
|
|
134
|
+
export type { BenchmarkGaugeLegendInteraction, BenchmarkGaugeMarkerType, BenchmarkGaugeProps, MarkerRenderContext, } from './core/BenchmarkGauge';
|
|
135
|
+
export { BenchmarkGauge } from './core/BenchmarkGauge';
|
|
134
136
|
export type { ActionBarProps } from './core/ActionBar';
|
|
135
137
|
export type { ActionBarFooterButton, ActionBarFooterProps } from './core/ActionBar';
|
|
136
138
|
export { actionBarService } from './core/ActionBar';
|