@schemavaults/ui 0.88.1 → 0.90.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/components/ui/index.d.ts +4 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/scroll-to-top/index.d.ts +3 -0
- package/dist/components/ui/scroll-to-top/index.js +3 -0
- package/dist/components/ui/scroll-to-top/index.js.map +1 -0
- package/dist/components/ui/scroll-to-top/scroll-to-top.d.ts +69 -0
- package/dist/components/ui/scroll-to-top/scroll-to-top.js +129 -0
- package/dist/components/ui/scroll-to-top/scroll-to-top.js.map +1 -0
- package/dist/components/ui/segmented-bar/index.d.ts +2 -0
- package/dist/components/ui/segmented-bar/index.js +2 -0
- package/dist/components/ui/segmented-bar/index.js.map +1 -0
- package/dist/components/ui/segmented-bar/segmented-bar.d.ts +121 -0
- package/dist/components/ui/segmented-bar/segmented-bar.js +154 -0
- package/dist/components/ui/segmented-bar/segmented-bar.js.map +1 -0
- package/package.json +1 -1
|
@@ -128,6 +128,8 @@ export * from "./gauge";
|
|
|
128
128
|
export type * from "./gauge";
|
|
129
129
|
export * from "./meter";
|
|
130
130
|
export type * from "./meter";
|
|
131
|
+
export * from "./segmented-bar";
|
|
132
|
+
export type * from "./segmented-bar";
|
|
131
133
|
export * from "./breadcrumb";
|
|
132
134
|
export type * from "./breadcrumb";
|
|
133
135
|
export * from "./pagination";
|
|
@@ -200,6 +202,8 @@ export * from "./countdown";
|
|
|
200
202
|
export type * from "./countdown";
|
|
201
203
|
export * from "./floating-action-button";
|
|
202
204
|
export type * from "./floating-action-button";
|
|
205
|
+
export * from "./scroll-to-top";
|
|
206
|
+
export type * from "./scroll-to-top";
|
|
203
207
|
export * from "./notification-bell";
|
|
204
208
|
export type * from "./notification-bell";
|
|
205
209
|
export * from "./calendar";
|
|
@@ -63,6 +63,7 @@ export * from "./circular-progress";
|
|
|
63
63
|
export * from "./scroll-progress";
|
|
64
64
|
export * from "./gauge";
|
|
65
65
|
export * from "./meter";
|
|
66
|
+
export * from "./segmented-bar";
|
|
66
67
|
export * from "./breadcrumb";
|
|
67
68
|
export * from "./pagination";
|
|
68
69
|
export * from "./kbd";
|
|
@@ -99,6 +100,7 @@ export * from "./tree-view";
|
|
|
99
100
|
export * from "./carousel";
|
|
100
101
|
export * from "./countdown";
|
|
101
102
|
export * from "./floating-action-button";
|
|
103
|
+
export * from "./scroll-to-top";
|
|
102
104
|
export * from "./notification-bell";
|
|
103
105
|
export * from "./calendar";
|
|
104
106
|
export * from "./date-picker";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAGzB,cAAc,uBAAuB,CAAC;AAGtC,cAAc,aAAa,CAAC;AAG5B,cAAc,eAAe,CAAC;AAG9B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,aAAa,CAAC;AAG5B,cAAc,kCAAkC,CAAC;AAGjD,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAExB,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,QAAQ,CAAC;AAGvB,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,WAAW,CAAC;AAG1B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAG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,CAAC;AAG5B,cAAc,0BAA0B,CAAC;AAGzC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,eAAe,CAAC;AAG9B,cAAc,QAAQ,CAAC;AAGvB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/scroll-to-top/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type ReactElement, type ReactNode, type Ref, type RefObject } from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const scrollToTopVariantIds: ["primary", "secondary", "outline", "ghost", "brand"];
|
|
4
|
+
export type ScrollToTopVariantId = (typeof scrollToTopVariantIds)[number];
|
|
5
|
+
export declare const scrollToTopSizeIds: ["sm", "default", "lg"];
|
|
6
|
+
export type ScrollToTopSizeId = (typeof scrollToTopSizeIds)[number];
|
|
7
|
+
export declare const scrollToTopPositionIds: ["bottom-right", "bottom-left", "bottom-center", "static"];
|
|
8
|
+
export type ScrollToTopPositionId = (typeof scrollToTopPositionIds)[number];
|
|
9
|
+
declare const scrollToTopVariants: (props?: ({
|
|
10
|
+
variant?: "primary" | "outline" | "ghost" | "secondary" | "brand" | null | undefined;
|
|
11
|
+
size?: "sm" | "default" | "lg" | null | undefined;
|
|
12
|
+
position?: "static" | "bottom-right" | "bottom-left" | "bottom-center" | null | undefined;
|
|
13
|
+
extended?: boolean | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
export interface ScrollToTopProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, VariantProps<typeof scrollToTopVariants> {
|
|
16
|
+
ref?: Ref<HTMLButtonElement>;
|
|
17
|
+
/**
|
|
18
|
+
* Pixel scroll offset at which the button becomes visible. Defaults to
|
|
19
|
+
* `320` — roughly a viewport of scroll on a laptop.
|
|
20
|
+
*/
|
|
21
|
+
threshold?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Ref to a scroll container to observe and scroll. When omitted, the
|
|
24
|
+
* component tracks and scrolls `window`. Useful for embedded scroll
|
|
25
|
+
* areas such as dialogs, sheets, and split panes.
|
|
26
|
+
*/
|
|
27
|
+
containerRef?: RefObject<HTMLElement | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Custom icon rendered inside the button. Defaults to lucide's `ArrowUp`.
|
|
30
|
+
*/
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Optional visible label. When provided, the button switches to its
|
|
34
|
+
* extended (pill) layout unless `extended` is explicitly overridden.
|
|
35
|
+
*/
|
|
36
|
+
label?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Accessible label. Falls back to `label` (if string) or "Scroll to top".
|
|
39
|
+
*/
|
|
40
|
+
"aria-label"?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Scroll behaviour used when the button is clicked. Defaults to `"smooth"`
|
|
43
|
+
* and is automatically downgraded to `"auto"` when the user has
|
|
44
|
+
* `prefers-reduced-motion: reduce`.
|
|
45
|
+
*/
|
|
46
|
+
behavior?: ScrollBehavior;
|
|
47
|
+
/**
|
|
48
|
+
* When `true`, the button is always rendered regardless of scroll position.
|
|
49
|
+
* Useful for testing/showcasing in Storybook.
|
|
50
|
+
*/
|
|
51
|
+
alwaysVisible?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Called after the scroll-to-top action is invoked.
|
|
54
|
+
*/
|
|
55
|
+
onScrolledToTop?: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A floating "back to top" button that appears once the user scrolls past a
|
|
59
|
+
* configurable threshold and smoothly scrolls the page (or an embedded
|
|
60
|
+
* container) back to the top when clicked.
|
|
61
|
+
*
|
|
62
|
+
* Respects `prefers-reduced-motion` by falling back to an instant scroll.
|
|
63
|
+
*/
|
|
64
|
+
declare function ScrollToTop({ className, variant, size, position, extended, threshold, containerRef, icon, label, behavior, alwaysVisible, onScrolledToTop, onClick, type, ref, ...props }: ScrollToTopProps): ReactElement | null;
|
|
65
|
+
declare namespace ScrollToTop {
|
|
66
|
+
var displayName: string;
|
|
67
|
+
}
|
|
68
|
+
export { ScrollToTop, scrollToTopVariants };
|
|
69
|
+
export default ScrollToTop;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useState, } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { ArrowUp } from "lucide-react";
|
|
6
|
+
import { cn } from "../../../lib/utils";
|
|
7
|
+
export const scrollToTopVariantIds = [
|
|
8
|
+
"primary",
|
|
9
|
+
"secondary",
|
|
10
|
+
"outline",
|
|
11
|
+
"ghost",
|
|
12
|
+
"brand",
|
|
13
|
+
];
|
|
14
|
+
export const scrollToTopSizeIds = [
|
|
15
|
+
"sm",
|
|
16
|
+
"default",
|
|
17
|
+
"lg",
|
|
18
|
+
];
|
|
19
|
+
export const scrollToTopPositionIds = [
|
|
20
|
+
"bottom-right",
|
|
21
|
+
"bottom-left",
|
|
22
|
+
"bottom-center",
|
|
23
|
+
"static",
|
|
24
|
+
];
|
|
25
|
+
const scrollToTopVariants = cva("group/scroll-to-top inline-flex items-center justify-center gap-2 rounded-full font-medium shadow-lg ring-offset-background transition-[background-color,border-color,color,box-shadow,opacity,transform] hover:shadow-xl active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none z-40", {
|
|
26
|
+
variants: {
|
|
27
|
+
variant: {
|
|
28
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90 shadow-primary/25",
|
|
29
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-secondary/25",
|
|
30
|
+
outline: "border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
31
|
+
ghost: "bg-background/70 text-foreground backdrop-blur-md border border-border/50 hover:bg-accent hover:text-accent-foreground",
|
|
32
|
+
brand: "bg-schemavaults-brand-blue text-primary-foreground hover:bg-schemavaults-brand-blue/90 shadow-schemavaults-brand-blue/30",
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
sm: "h-10 w-10 text-sm [&_svg]:size-4",
|
|
36
|
+
default: "h-12 w-12 text-base [&_svg]:size-5",
|
|
37
|
+
lg: "h-14 w-14 text-base [&_svg]:size-6",
|
|
38
|
+
},
|
|
39
|
+
position: {
|
|
40
|
+
"bottom-right": "fixed bottom-6 right-6",
|
|
41
|
+
"bottom-left": "fixed bottom-6 left-6",
|
|
42
|
+
"bottom-center": "fixed bottom-6 left-1/2 -translate-x-1/2",
|
|
43
|
+
static: "",
|
|
44
|
+
},
|
|
45
|
+
extended: {
|
|
46
|
+
true: "w-auto px-5",
|
|
47
|
+
false: "",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
compoundVariants: [
|
|
51
|
+
{ extended: true, size: "sm", class: "h-10" },
|
|
52
|
+
{ extended: true, size: "default", class: "h-12" },
|
|
53
|
+
{ extended: true, size: "lg", class: "h-14" },
|
|
54
|
+
],
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
variant: "primary",
|
|
57
|
+
size: "default",
|
|
58
|
+
position: "bottom-right",
|
|
59
|
+
extended: false,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
function readScrollTop(container) {
|
|
63
|
+
if (container)
|
|
64
|
+
return container.scrollTop;
|
|
65
|
+
if (typeof window === "undefined")
|
|
66
|
+
return 0;
|
|
67
|
+
return window.scrollY ?? window.pageYOffset ?? 0;
|
|
68
|
+
}
|
|
69
|
+
function prefersReducedMotion() {
|
|
70
|
+
if (typeof window === "undefined" || !window.matchMedia)
|
|
71
|
+
return false;
|
|
72
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A floating "back to top" button that appears once the user scrolls past a
|
|
76
|
+
* configurable threshold and smoothly scrolls the page (or an embedded
|
|
77
|
+
* container) back to the top when clicked.
|
|
78
|
+
*
|
|
79
|
+
* Respects `prefers-reduced-motion` by falling back to an instant scroll.
|
|
80
|
+
*/
|
|
81
|
+
function ScrollToTop({ className, variant, size, position, extended, threshold = 320, containerRef, icon, label, behavior = "smooth", alwaysVisible = false, onScrolledToTop, onClick, type = "button", ref, ...props }) {
|
|
82
|
+
const [visible, setVisible] = useState(alwaysVisible);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (alwaysVisible) {
|
|
85
|
+
setVisible(true);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const container = containerRef?.current ?? null;
|
|
89
|
+
const target = container ?? (typeof window !== "undefined" ? window : null);
|
|
90
|
+
if (!target)
|
|
91
|
+
return;
|
|
92
|
+
function update() {
|
|
93
|
+
setVisible(readScrollTop(container) > threshold);
|
|
94
|
+
}
|
|
95
|
+
update();
|
|
96
|
+
target.addEventListener("scroll", update, { passive: true });
|
|
97
|
+
return () => {
|
|
98
|
+
target.removeEventListener("scroll", update);
|
|
99
|
+
};
|
|
100
|
+
}, [alwaysVisible, containerRef, threshold]);
|
|
101
|
+
const handleClick = useCallback((event) => {
|
|
102
|
+
onClick?.(event);
|
|
103
|
+
if (event.defaultPrevented)
|
|
104
|
+
return;
|
|
105
|
+
const resolvedBehavior = prefersReducedMotion()
|
|
106
|
+
? "auto"
|
|
107
|
+
: behavior;
|
|
108
|
+
const container = containerRef?.current ?? null;
|
|
109
|
+
if (container) {
|
|
110
|
+
container.scrollTo({ top: 0, left: 0, behavior: resolvedBehavior });
|
|
111
|
+
}
|
|
112
|
+
else if (typeof window !== "undefined") {
|
|
113
|
+
window.scrollTo({ top: 0, left: 0, behavior: resolvedBehavior });
|
|
114
|
+
}
|
|
115
|
+
onScrolledToTop?.();
|
|
116
|
+
}, [behavior, containerRef, onClick, onScrolledToTop]);
|
|
117
|
+
const isExtended = extended ?? Boolean(label);
|
|
118
|
+
const accessibleLabel = props["aria-label"] ??
|
|
119
|
+
(typeof label === "string" ? label : "Scroll to top");
|
|
120
|
+
const resolvedIcon = icon ?? _jsx(ArrowUp, { "aria-hidden": "true" });
|
|
121
|
+
if (!visible && position !== "static") {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return (_jsxs("button", { ref: ref, type: type, "data-slot": "scroll-to-top", "data-visible": visible ? "true" : "false", "data-extended": isExtended || undefined, "aria-label": accessibleLabel, onClick: handleClick, className: cn(scrollToTopVariants({ variant, size, position, extended: isExtended }), !visible && "pointer-events-none opacity-0", visible && "opacity-100", className), ...props, children: [_jsx("span", { "aria-hidden": "true", "data-slot": "scroll-to-top-icon", className: "inline-flex shrink-0 items-center justify-center transition-transform group-hover/scroll-to-top:-translate-y-0.5", children: resolvedIcon }), isExtended && label != null ? (_jsx("span", { "data-slot": "scroll-to-top-label", className: "truncate", children: label })) : null] }));
|
|
125
|
+
}
|
|
126
|
+
ScrollToTop.displayName = "ScrollToTop";
|
|
127
|
+
export { ScrollToTop, scrollToTopVariants };
|
|
128
|
+
export default ScrollToTop;
|
|
129
|
+
//# sourceMappingURL=scroll-to-top.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-to-top.js","sourceRoot":"","sources":["../../../../src/components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WAAW,EAAE,mBAAmB,EAAE,CAAC;AAE5C,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/segmented-bar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,IAAI,OAAO,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import type { HTMLAttributes, KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
export declare const segmentedBarSizeIds: ["sm", "default", "lg", "xl"];
|
|
4
|
+
export type SegmentedBarSizeId = (typeof segmentedBarSizeIds)[number];
|
|
5
|
+
export declare const segmentedBarShapeIds: ["rounded", "pill", "square"];
|
|
6
|
+
export type SegmentedBarShapeId = (typeof segmentedBarShapeIds)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Preset colours available for segments. Mirrors the palette used by
|
|
9
|
+
* `PieChart` so a `SegmentedBar` and a `PieChart` visualising the same data
|
|
10
|
+
* agree on which slice is which.
|
|
11
|
+
*/
|
|
12
|
+
export declare const segmentedBarSegmentColorIds: ["default", "primary", "positive", "warning", "destructive", "muted"];
|
|
13
|
+
export type SegmentedBarSegmentColorId = (typeof segmentedBarSegmentColorIds)[number];
|
|
14
|
+
export declare const segmentedBarTrackVariants: (props?: ({
|
|
15
|
+
size?: "sm" | "default" | "lg" | "xl" | null | undefined;
|
|
16
|
+
shape?: "square" | "rounded" | "pill" | null | undefined;
|
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
|
+
export interface SegmentedBarSegment {
|
|
19
|
+
/** Stable identifier for the segment. Used as React key and click payload. */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Human-readable label used in the legend and as the segment's `aria-label`. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** Non-negative numeric size. Non-positive values are skipped. */
|
|
24
|
+
value: number;
|
|
25
|
+
/** Preset colour token from the shared palette. Ignored if `fill` is set. */
|
|
26
|
+
color?: SegmentedBarSegmentColorId;
|
|
27
|
+
/**
|
|
28
|
+
* Override the background with a raw CSS colour (e.g. `"#ff0080"` or
|
|
29
|
+
* `"hsl(var(--chart-1))"`). Takes precedence over `color`.
|
|
30
|
+
*/
|
|
31
|
+
fill?: string;
|
|
32
|
+
/** Extra classes applied to this segment element. */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Fired when the segment is clicked or activated via keyboard. */
|
|
35
|
+
onClick?: (segment: SegmentedBarSegment, event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Args for a custom legend renderer. `total` reflects the effective total
|
|
39
|
+
* (i.e. the `total` prop when supplied, otherwise the sum of segment values).
|
|
40
|
+
*/
|
|
41
|
+
export interface SegmentedBarLegendRenderArgs {
|
|
42
|
+
segments: ReadonlyArray<SegmentedBarSegment>;
|
|
43
|
+
total: number;
|
|
44
|
+
/** Sum of `value` across `segments` (may be less than `total`). */
|
|
45
|
+
segmentsTotal: number;
|
|
46
|
+
/** `total - segmentsTotal`, clamped to 0. */
|
|
47
|
+
remainder: number;
|
|
48
|
+
}
|
|
49
|
+
export interface SegmentedBarProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "onClick">, VariantProps<typeof segmentedBarTrackVariants> {
|
|
50
|
+
/** Segments to render, left to right. */
|
|
51
|
+
segments: ReadonlyArray<SegmentedBarSegment>;
|
|
52
|
+
/** Accessible label describing what the bar represents. */
|
|
53
|
+
label: string;
|
|
54
|
+
/**
|
|
55
|
+
* Total the segments should be measured against. Defaults to the sum of
|
|
56
|
+
* segment values. When `total` exceeds the sum, the remainder shows as an
|
|
57
|
+
* unfilled tail — useful for quotas (`used + reserved` of a `capacity`).
|
|
58
|
+
*/
|
|
59
|
+
total?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to render the built-in legend below the bar. Defaults to `false`.
|
|
62
|
+
* Ignored when `renderLegend` is provided.
|
|
63
|
+
*/
|
|
64
|
+
showLegend?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Show the value alongside each label in the default legend. Defaults to
|
|
67
|
+
* `true`.
|
|
68
|
+
*/
|
|
69
|
+
showLegendValues?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Show the percentage share alongside each value in the default legend.
|
|
72
|
+
* Defaults to `false`.
|
|
73
|
+
*/
|
|
74
|
+
showLegendPercentages?: boolean;
|
|
75
|
+
/** Unit appended to values in the default legend (e.g. `"GB"`, `"$"`). */
|
|
76
|
+
unit?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Format a segment value shown in the default legend. Return a string or
|
|
79
|
+
* React node. Defaults to `value + unit`.
|
|
80
|
+
*/
|
|
81
|
+
formatValue?: (value: number, segment: SegmentedBarSegment) => ReactNode;
|
|
82
|
+
/**
|
|
83
|
+
* Custom legend renderer. Overrides the default legend entirely and
|
|
84
|
+
* bypasses `showLegend`.
|
|
85
|
+
*/
|
|
86
|
+
renderLegend?: (args: SegmentedBarLegendRenderArgs) => ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Render a thin divider between adjacent segments. Defaults to `true`.
|
|
89
|
+
* Only visible when segments have distinct colours.
|
|
90
|
+
*/
|
|
91
|
+
showDividers?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* When true (default), animates segment widths in on mount using
|
|
94
|
+
* framer-motion. Set to `false` for a static bar.
|
|
95
|
+
*/
|
|
96
|
+
animate?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Header label rendered above the bar. If omitted, the bar has no visible
|
|
99
|
+
* header (the `label` prop is still announced via `aria-label`).
|
|
100
|
+
*/
|
|
101
|
+
headerLabel?: ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Value rendered at the end of the header row (e.g. `"84 / 100 GB"`).
|
|
104
|
+
* Only shown when a header label is present.
|
|
105
|
+
*/
|
|
106
|
+
headerValue?: ReactNode;
|
|
107
|
+
/** Extra classes for the header row. */
|
|
108
|
+
headerClassName?: string;
|
|
109
|
+
/** Extra classes for the legend wrapper. */
|
|
110
|
+
legendClassName?: string;
|
|
111
|
+
/** Extra classes applied to the bar track element. */
|
|
112
|
+
trackClassName?: string;
|
|
113
|
+
/** Fallback handler invoked for segments without their own `onClick`. */
|
|
114
|
+
onSegmentClick?: (segment: SegmentedBarSegment, event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
115
|
+
ref?: Ref<HTMLDivElement>;
|
|
116
|
+
}
|
|
117
|
+
declare function SegmentedBar({ segments, label, total, size, shape, showLegend, showLegendValues, showLegendPercentages, unit, formatValue, renderLegend, showDividers, animate, headerLabel, headerValue, className, headerClassName, legendClassName, trackClassName, onSegmentClick, ref, ...props }: SegmentedBarProps): ReactElement;
|
|
118
|
+
declare namespace SegmentedBar {
|
|
119
|
+
var displayName: string;
|
|
120
|
+
}
|
|
121
|
+
export { SegmentedBar };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { m } from "../../../framer-motion";
|
|
6
|
+
import { cn } from "../../../lib/utils";
|
|
7
|
+
export const segmentedBarSizeIds = [
|
|
8
|
+
"sm",
|
|
9
|
+
"default",
|
|
10
|
+
"lg",
|
|
11
|
+
"xl",
|
|
12
|
+
];
|
|
13
|
+
export const segmentedBarShapeIds = [
|
|
14
|
+
"rounded",
|
|
15
|
+
"pill",
|
|
16
|
+
"square",
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Preset colours available for segments. Mirrors the palette used by
|
|
20
|
+
* `PieChart` so a `SegmentedBar` and a `PieChart` visualising the same data
|
|
21
|
+
* agree on which slice is which.
|
|
22
|
+
*/
|
|
23
|
+
export const segmentedBarSegmentColorIds = [
|
|
24
|
+
"default",
|
|
25
|
+
"primary",
|
|
26
|
+
"positive",
|
|
27
|
+
"warning",
|
|
28
|
+
"destructive",
|
|
29
|
+
"muted",
|
|
30
|
+
];
|
|
31
|
+
const SEGMENT_BG_CLASSES = {
|
|
32
|
+
default: "bg-schemavaults-brand-blue",
|
|
33
|
+
primary: "bg-primary",
|
|
34
|
+
positive: "bg-emerald-500 dark:bg-emerald-400",
|
|
35
|
+
warning: "bg-warning",
|
|
36
|
+
destructive: "bg-destructive",
|
|
37
|
+
muted: "bg-muted-foreground/60",
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Fallback colour rotation when a segment doesn't specify its own colour.
|
|
41
|
+
* Index is the segment position in the input array, modulo palette length.
|
|
42
|
+
*/
|
|
43
|
+
const DEFAULT_COLOR_ROTATION = [
|
|
44
|
+
"default",
|
|
45
|
+
"positive",
|
|
46
|
+
"warning",
|
|
47
|
+
"destructive",
|
|
48
|
+
"primary",
|
|
49
|
+
"muted",
|
|
50
|
+
];
|
|
51
|
+
export const segmentedBarTrackVariants = cva("relative isolate flex w-full overflow-hidden bg-secondary", {
|
|
52
|
+
variants: {
|
|
53
|
+
size: {
|
|
54
|
+
sm: "h-1.5",
|
|
55
|
+
default: "h-2.5",
|
|
56
|
+
lg: "h-4",
|
|
57
|
+
xl: "h-6",
|
|
58
|
+
},
|
|
59
|
+
shape: {
|
|
60
|
+
rounded: "rounded-md",
|
|
61
|
+
pill: "rounded-full",
|
|
62
|
+
square: "rounded-none",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
defaultVariants: {
|
|
66
|
+
size: "default",
|
|
67
|
+
shape: "pill",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
function resolveBackground(segment, index) {
|
|
71
|
+
if (segment.fill) {
|
|
72
|
+
return { bgClass: undefined, style: { backgroundColor: segment.fill } };
|
|
73
|
+
}
|
|
74
|
+
const preset = segment.color ??
|
|
75
|
+
DEFAULT_COLOR_ROTATION[index % DEFAULT_COLOR_ROTATION.length];
|
|
76
|
+
return { bgClass: SEGMENT_BG_CLASSES[preset], style: undefined };
|
|
77
|
+
}
|
|
78
|
+
function SegmentedBar({ segments, label, total, size, shape, showLegend = false, showLegendValues = true, showLegendPercentages = false, unit, formatValue, renderLegend, showDividers = true, animate = true, headerLabel, headerValue, className, headerClassName, legendClassName, trackClassName, onSegmentClick, ref, ...props }) {
|
|
79
|
+
const validSegments = segments.filter((s) => Number.isFinite(s.value) && s.value > 0);
|
|
80
|
+
const segmentsTotal = validSegments.reduce((acc, s) => acc + s.value, 0);
|
|
81
|
+
const effectiveTotal = total ?? segmentsTotal;
|
|
82
|
+
const safeTotal = effectiveTotal > 0 ? effectiveTotal : 1;
|
|
83
|
+
const remainder = Math.max(0, effectiveTotal - segmentsTotal);
|
|
84
|
+
const filledPercentage = Math.min(100, (segmentsTotal / safeTotal) * 100);
|
|
85
|
+
const resolvedSegments = validSegments.map((segment, index) => ({
|
|
86
|
+
segment,
|
|
87
|
+
index,
|
|
88
|
+
percentage: (segment.value / safeTotal) * 100,
|
|
89
|
+
...resolveBackground(segment, index),
|
|
90
|
+
}));
|
|
91
|
+
const titleId = useId();
|
|
92
|
+
const showHeader = headerLabel !== undefined || headerValue !== undefined;
|
|
93
|
+
function handleSegmentClick(segment, event) {
|
|
94
|
+
if (segment.onClick) {
|
|
95
|
+
segment.onClick(segment, event);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (onSegmentClick) {
|
|
99
|
+
onSegmentClick(segment, event);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const defaultFormatValue = (v, _s) => (_jsxs(_Fragment, { children: [v, unit ? _jsx("span", { className: "ml-0.5 text-muted-foreground", children: unit }) : null] }));
|
|
103
|
+
return (_jsxs("div", { ref: ref, "data-slot": "segmented-bar", className: cn("flex w-full flex-col gap-1.5", className), ...props, children: [showHeader && (_jsxs("div", { className: cn("flex items-baseline justify-between gap-2 text-sm", headerClassName), children: [headerLabel !== undefined && (_jsx("span", { id: titleId, className: "font-medium text-muted-foreground", "data-slot": "segmented-bar-header-label", children: headerLabel })), headerValue !== undefined && (_jsx("span", { className: "font-medium tabular-nums text-foreground", "data-slot": "segmented-bar-header-value", children: headerValue }))] })), _jsx("div", { role: "progressbar", "aria-label": label, "aria-labelledby": headerLabel !== undefined ? titleId : undefined, "aria-valuenow": Math.round(filledPercentage), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuetext": `${segmentsTotal} of ${effectiveTotal}`, "data-slot": "segmented-bar-track", className: cn(segmentedBarTrackVariants({ size, shape }), trackClassName), children: resolvedSegments.map((r, i) => {
|
|
104
|
+
const isInteractive = r.segment.onClick !== undefined || onSegmentClick !== undefined;
|
|
105
|
+
const showDivider = showDividers && (i > 0 || (remainder > 0 && i === 0 && false));
|
|
106
|
+
const commonClass = cn("h-full min-w-0 first:rounded-l-[inherit]", remainder <= 0 && "last:rounded-r-[inherit]", r.bgClass, showDivider &&
|
|
107
|
+
"border-l border-background/50 dark:border-background/70", isInteractive &&
|
|
108
|
+
"cursor-pointer transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background", r.segment.className);
|
|
109
|
+
const initialWidth = "0%";
|
|
110
|
+
const animatedWidth = `${r.percentage}%`;
|
|
111
|
+
const commonProps = {
|
|
112
|
+
"data-slot": "segmented-bar-segment",
|
|
113
|
+
"data-segment-id": r.segment.id,
|
|
114
|
+
"aria-label": r.segment.label,
|
|
115
|
+
title: r.segment.label,
|
|
116
|
+
style: r.style,
|
|
117
|
+
className: commonClass,
|
|
118
|
+
};
|
|
119
|
+
if (isInteractive) {
|
|
120
|
+
return (_jsx(m.button, { type: "button", onClick: (e) => handleSegmentClick(r.segment, e), onKeyDown: (e) => {
|
|
121
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
handleSegmentClick(r.segment, e);
|
|
124
|
+
}
|
|
125
|
+
}, initial: animate ? { width: initialWidth } : false, animate: { width: animatedWidth }, transition: { duration: 0.4, ease: "easeOut" }, ...commonProps }, r.segment.id));
|
|
126
|
+
}
|
|
127
|
+
return (_jsx(m.div, { initial: animate ? { width: initialWidth } : false, animate: { width: animatedWidth }, transition: { duration: 0.4, ease: "easeOut" }, ...commonProps }, r.segment.id));
|
|
128
|
+
}) }), renderLegend
|
|
129
|
+
? renderLegend({
|
|
130
|
+
segments: validSegments,
|
|
131
|
+
total: effectiveTotal,
|
|
132
|
+
segmentsTotal,
|
|
133
|
+
remainder,
|
|
134
|
+
})
|
|
135
|
+
: showLegend && (_jsxs("ul", { "data-slot": "segmented-bar-legend", className: cn("flex flex-wrap items-center gap-x-4 gap-y-1 text-xs", legendClassName), children: [resolvedSegments.map((r) => {
|
|
136
|
+
const pct = safeTotal > 0 ? (r.segment.value / safeTotal) * 100 : 0;
|
|
137
|
+
return (_jsxs("li", { "data-slot": "segmented-bar-legend-item", className: "inline-flex items-center gap-1.5", children: [_jsx("span", { "aria-hidden": "true", className: cn("inline-block size-2.5 shrink-0 rounded-[3px]", r.bgClass), style: r.style }), _jsx("span", { className: "font-medium text-foreground", children: r.segment.label }), showLegendValues && (_jsx("span", { className: "tabular-nums text-muted-foreground", children: formatValue
|
|
138
|
+
? formatValue(r.segment.value, r.segment)
|
|
139
|
+
: defaultFormatValue(r.segment.value, r.segment) })), showLegendPercentages && (_jsxs("span", { className: "tabular-nums text-muted-foreground", children: ["(", pct.toFixed(pct < 10 ? 1 : 0), "%)"] }))] }, r.segment.id));
|
|
140
|
+
}), remainder > 0 && (_jsxs("li", { "data-slot": "segmented-bar-legend-remainder", className: "inline-flex items-center gap-1.5", children: [_jsx("span", { "aria-hidden": "true", className: "inline-block size-2.5 shrink-0 rounded-[3px] bg-secondary" }), _jsx("span", { className: "font-medium text-muted-foreground", children: "Remaining" }), showLegendValues && (_jsx("span", { className: "tabular-nums text-muted-foreground", children: formatValue
|
|
141
|
+
? formatValue(remainder, {
|
|
142
|
+
id: "__remainder__",
|
|
143
|
+
label: "Remaining",
|
|
144
|
+
value: remainder,
|
|
145
|
+
})
|
|
146
|
+
: defaultFormatValue(remainder, {
|
|
147
|
+
id: "__remainder__",
|
|
148
|
+
label: "Remaining",
|
|
149
|
+
value: remainder,
|
|
150
|
+
}) }))] }))] }))] }));
|
|
151
|
+
}
|
|
152
|
+
SegmentedBar.displayName = "SegmentedBar";
|
|
153
|
+
export { SegmentedBar };
|
|
154
|
+
//# sourceMappingURL=segmented-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-bar.js","sourceRoot":"","sources":["../../../../src/components/ui/segmented-bar/segmented-bar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AASlE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI;IACJ,SAAS;IACT,IAAI;IACJ,IAAI;CACuB,CAAC;AAG9B,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS;IACT,MAAM;IACN,QAAQ;CACmB,CAAC;AAG9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,aAAa;IACb,OAAO;CACoB,CAAC;AAI9B,MAAM,kBAAkB,GAA+C;IACrE,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,oCAAoC;IAC9C,OAAO,EAAE,YAAY;IACrB,WA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