@alpic-ai/ui 1.170.0 → 1.172.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/area-chart.d.mts +3 -3
- package/dist/components/avatar.d.mts +1 -1
- package/dist/components/badge.d.mts +1 -1
- package/dist/components/bar-chart.d.mts +2 -2
- package/dist/components/bar-chart.mjs +1 -1
- package/dist/components/bar-list.d.mts +2 -2
- package/dist/components/button.d.mts +1 -1
- package/dist/components/chart-card.d.mts +2 -2
- package/dist/components/chart-legend.d.mts +3 -3
- package/dist/components/chart-primitives.d.mts +9 -10
- package/dist/components/chart-tooltip.d.mts +3 -3
- package/dist/components/donut-chart.d.mts +2 -2
- package/dist/components/editable.d.mts +101 -0
- package/dist/components/editable.mjs +509 -0
- package/dist/components/form.d.mts +10 -8
- package/dist/components/form.mjs +18 -8
- package/dist/components/heatmap-chart.d.mts +2 -2
- package/dist/components/input.d.mts +3 -1
- package/dist/components/input.mjs +5 -3
- package/dist/components/line-chart.d.mts +2 -2
- package/dist/components/select-trigger-variants.d.mts +2 -3
- package/dist/components/shimmer-text.d.mts +2 -3
- package/dist/components/skeleton.d.mts +1 -1
- package/dist/components/spinner.d.mts +2 -2
- package/dist/components/stat.d.mts +3 -3
- package/dist/components/typography.d.mts +5 -6
- package/dist/components/visually-hidden-input.d.mts +12 -0
- package/dist/components/visually-hidden-input.mjs +109 -0
- package/dist/hooks/use-as-ref.d.mts +5 -0
- package/dist/hooks/use-as-ref.mjs +12 -0
- package/dist/hooks/use-chart-theme.d.mts +3 -4
- package/dist/hooks/use-copy-to-clipboard.d.mts +2 -3
- package/dist/hooks/use-isomorphic-layout-effect.d.mts +5 -0
- package/dist/hooks/use-isomorphic-layout-effect.mjs +5 -0
- package/dist/hooks/use-lazy-ref.d.mts +6 -0
- package/dist/hooks/use-lazy-ref.mjs +9 -0
- package/dist/hooks/use-mobile.d.mts +2 -3
- package/dist/lib/chart-palette.d.mts +13 -14
- package/dist/lib/chart.d.mts +3 -4
- package/dist/lib/cn.d.mts +2 -3
- package/dist/lib/compose-refs.mjs +23 -0
- package/package.json +9 -13
- package/src/components/bar-chart.tsx +1 -1
- package/src/components/editable.tsx +871 -0
- package/src/components/form.tsx +16 -6
- package/src/components/input.tsx +8 -0
- package/src/components/visually-hidden-input.tsx +148 -0
- package/src/hooks/use-as-ref.ts +15 -0
- package/src/hooks/use-isomorphic-layout-effect.ts +5 -0
- package/src/hooks/use-lazy-ref.ts +13 -0
- package/src/lib/compose-refs.ts +38 -0
- package/src/stories/input.stories.tsx +3 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartPaletteName } from "../lib/chart-palette.mjs";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
//#region src/components/heatmap-chart.d.ts
|
|
4
|
-
interface HeatmapChartProps {
|
|
4
|
+
export interface HeatmapChartProps {
|
|
5
5
|
data: ReadonlyArray<Record<string, string | number | null | undefined>>;
|
|
6
6
|
xKey: string;
|
|
7
7
|
yKey: string;
|
|
@@ -29,4 +29,4 @@ interface HeatmapChartProps {
|
|
|
29
29
|
}
|
|
30
30
|
declare function HeatmapChart({ data, xKey, yKey, dataKey, variant, palette, xLabels, yLabels, showAllXLabels, highlightPeak, loading, valueFormatter, xTickFormatter, yTickFormatter, tooltipMetrics, tooltipTitleKey, colorScale, showLegend, ariaLabel, className }: HeatmapChartProps): React$1.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { HeatmapChart
|
|
32
|
+
export { HeatmapChart };
|
|
@@ -9,7 +9,9 @@ interface InputProps extends Omit<React$1.ComponentProps<"input">, "size"> {
|
|
|
9
9
|
leadingText?: string;
|
|
10
10
|
leadingIcon?: React$1.ReactNode;
|
|
11
11
|
size?: "sm" | "md";
|
|
12
|
+
sensitive?: boolean;
|
|
13
|
+
show?: boolean;
|
|
12
14
|
}
|
|
13
|
-
declare function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size, ...props }: InputProps): React$1.JSX.Element;
|
|
15
|
+
declare function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size, sensitive, show, ...props }: InputProps): React$1.JSX.Element;
|
|
14
16
|
//#endregion
|
|
15
17
|
export { Input, type InputProps };
|
|
@@ -22,7 +22,7 @@ const inputSizeStyles = {
|
|
|
22
22
|
leadingIcon: "pl-2.5 [&_svg]:size-5"
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size = "md", ...props }) {
|
|
25
|
+
function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size = "md", sensitive = false, show = false, ...props }) {
|
|
26
26
|
const generatedId = React$1.useId();
|
|
27
27
|
const fieldId = id ?? generatedId;
|
|
28
28
|
const hasAddons = leadingText || leadingIcon;
|
|
@@ -39,11 +39,13 @@ function Input({ className, id, label, required, hint, error, tooltip, leadingTe
|
|
|
39
39
|
"disabled:bg-disabled disabled:text-disabled-foreground",
|
|
40
40
|
"aria-invalid:border-border-error",
|
|
41
41
|
error && "border-border-error"
|
|
42
|
-
], hasAddons && "flex-1 min-h-0", className),
|
|
42
|
+
], hasAddons && "flex-1 min-h-0", sensitive && !show && "[-webkit-text-security:disc]", className),
|
|
43
43
|
required,
|
|
44
44
|
"aria-invalid": error ? true : void 0,
|
|
45
45
|
"aria-describedby": fieldId && (hint || error) ? `${fieldId}-description` : void 0,
|
|
46
|
-
...props
|
|
46
|
+
...props,
|
|
47
|
+
autoComplete: sensitive ? "off" : props.autoComplete,
|
|
48
|
+
spellCheck: sensitive ? false : props.spellCheck
|
|
47
49
|
});
|
|
48
50
|
const wrappedInput = hasAddons ? /* @__PURE__ */ jsxs("div", {
|
|
49
51
|
className: cn("flex items-center w-full overflow-hidden", sizes.wrapper, "bg-background border border-border rounded-md", "transition-colors", "has-[input:focus-visible]:border-ring has-[input:focus-visible]:border-2", "has-[input:disabled]:bg-disabled has-[input:disabled]:text-disabled-foreground has-[input:disabled]:cursor-not-allowed", error && "border-border-error"),
|
|
@@ -8,7 +8,7 @@ declare const CURVE_TYPE: {
|
|
|
8
8
|
readonly linear: "linear";
|
|
9
9
|
readonly step: "stepAfter";
|
|
10
10
|
};
|
|
11
|
-
interface LineChartProps {
|
|
11
|
+
export interface LineChartProps {
|
|
12
12
|
data: ReadonlyArray<Record<string, string | number | null | undefined>>;
|
|
13
13
|
index: string;
|
|
14
14
|
series: ChartSeries[];
|
|
@@ -36,4 +36,4 @@ interface LineChartProps {
|
|
|
36
36
|
}
|
|
37
37
|
declare function LineChart({ data, index, series, curve, legend, legendAlign, valueFlags, dots, height, yAxisWidth, palette, referenceLine, markers, lastValueLabel, loading, hiddenSeries, onLegendItemClick, valueFormatter, labelFormatter, className }: LineChartProps): React$1.JSX.Element;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { LineChart
|
|
39
|
+
export { LineChart };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//#region src/components/select-trigger-variants.d.ts
|
|
2
2
|
/** Shared by Select and Combobox so their trigger buttons stay visually in sync. */
|
|
3
|
-
declare const selectTriggerVariants: (props?: ({
|
|
3
|
+
export declare const selectTriggerVariants: (props?: ({
|
|
4
4
|
size?: "sm" | "md" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { selectTriggerVariants };
|
|
6
|
+
//#endregion
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
//#region src/components/shimmer-text.d.ts
|
|
3
|
-
declare function ShimmerText({ children, className }: {
|
|
3
|
+
export declare function ShimmerText({ children, className }: {
|
|
4
4
|
children: string | number;
|
|
5
5
|
className?: string;
|
|
6
6
|
}): React.JSX.Element;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { ShimmerText };
|
|
7
|
+
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
2
|
//#region src/components/skeleton.d.ts
|
|
3
3
|
declare const skeletonVariants: (props?: ({
|
|
4
|
-
shape?: "
|
|
4
|
+
shape?: "rectangle" | "circle" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
interface SkeletonProps extends React.ComponentProps<"div">, VariantProps<typeof skeletonVariants> {}
|
|
7
7
|
declare function Skeleton({ className, shape, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
2
|
//#region src/components/spinner.d.ts
|
|
3
3
|
declare const spinnerVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
5
|
-
size?: "sm" | "
|
|
4
|
+
variant?: "primary" | "secondary" | null | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
interface SpinnerProps extends Omit<React.ComponentProps<"svg">, "children">, VariantProps<typeof spinnerVariants> {}
|
|
8
8
|
declare function Spinner({ className, variant, size, ...props }: SpinnerProps): import("react").JSX.Element;
|
|
@@ -3,14 +3,14 @@ import * as React$1 from "react";
|
|
|
3
3
|
declare const statDeltaVariants: (props?: ({
|
|
4
4
|
sentiment?: "positive" | "negative" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
-
interface StatDelta {
|
|
6
|
+
export interface StatDelta {
|
|
7
7
|
value: number;
|
|
8
8
|
direction: "up" | "down";
|
|
9
9
|
invert?: boolean;
|
|
10
10
|
label?: React$1.ReactNode;
|
|
11
11
|
indicator?: "arrow" | "sign";
|
|
12
12
|
}
|
|
13
|
-
interface StatProps extends Omit<React$1.HTMLAttributes<HTMLElement>, "onClick"> {
|
|
13
|
+
export interface StatProps extends Omit<React$1.HTMLAttributes<HTMLElement>, "onClick"> {
|
|
14
14
|
value: React$1.ReactNode;
|
|
15
15
|
unit?: string;
|
|
16
16
|
delta?: StatDelta | null;
|
|
@@ -26,4 +26,4 @@ declare function StatSparkline({ sparkline, semantic, className }: Pick<StatProp
|
|
|
26
26
|
className?: string;
|
|
27
27
|
}): React$1.JSX.Element | null;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { Stat,
|
|
29
|
+
export { Stat, StatSparkline, statDeltaVariants };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
//#region src/components/typography.d.ts
|
|
3
|
-
declare function H1({ children, className }: {
|
|
3
|
+
export declare function H1({ children, className }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
className?: string;
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
|
-
declare function H2({ children, className }: {
|
|
7
|
+
export declare function H2({ children, className }: {
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
}): import("react").JSX.Element;
|
|
11
|
-
declare function H3({ children, className }: {
|
|
11
|
+
export declare function H3({ children, className }: {
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
className?: string;
|
|
14
14
|
}): import("react").JSX.Element;
|
|
15
|
-
declare function H4({ children, className }: {
|
|
15
|
+
export declare function H4({ children, className }: {
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
className?: string;
|
|
18
18
|
}): import("react").JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { H1, H2, H3, H4 };
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/visually-hidden-input.d.ts
|
|
3
|
+
type InputValue = string[] | string;
|
|
4
|
+
interface VisuallyHiddenInputProps<T = InputValue> extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "value" | "checked" | "onReset"> {
|
|
5
|
+
value?: T;
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
control: HTMLElement | null;
|
|
8
|
+
bubbles?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function VisuallyHiddenInput<T = InputValue>(props: VisuallyHiddenInputProps<T>): React$1.JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { VisuallyHiddenInput };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
//#region src/components/visually-hidden-input.tsx
|
|
5
|
+
function VisuallyHiddenInput(props) {
|
|
6
|
+
const { control, value, checked, bubbles = true, type = "hidden", style, ...inputProps } = props;
|
|
7
|
+
const isCheckInput = React$1.useMemo(() => type === "checkbox" || type === "radio" || type === "switch", [type]);
|
|
8
|
+
const inputRef = React$1.useRef(null);
|
|
9
|
+
const prevValueRef = React$1.useRef({
|
|
10
|
+
value: isCheckInput ? checked : value,
|
|
11
|
+
previous: isCheckInput ? checked : value
|
|
12
|
+
});
|
|
13
|
+
const prevValue = React$1.useMemo(() => {
|
|
14
|
+
const currentValue = isCheckInput ? checked : value;
|
|
15
|
+
if (prevValueRef.current.value !== currentValue) {
|
|
16
|
+
prevValueRef.current.previous = prevValueRef.current.value;
|
|
17
|
+
prevValueRef.current.value = currentValue;
|
|
18
|
+
}
|
|
19
|
+
return prevValueRef.current.previous;
|
|
20
|
+
}, [
|
|
21
|
+
isCheckInput,
|
|
22
|
+
value,
|
|
23
|
+
checked
|
|
24
|
+
]);
|
|
25
|
+
const [controlSize, setControlSize] = React$1.useState({});
|
|
26
|
+
React$1.useLayoutEffect(() => {
|
|
27
|
+
if (!control) {
|
|
28
|
+
setControlSize({});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
setControlSize({
|
|
32
|
+
width: control.offsetWidth,
|
|
33
|
+
height: control.offsetHeight
|
|
34
|
+
});
|
|
35
|
+
if (typeof window === "undefined") return;
|
|
36
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
37
|
+
if (!Array.isArray(entries) || !entries.length) return;
|
|
38
|
+
const entry = entries[0];
|
|
39
|
+
if (!entry) return;
|
|
40
|
+
let width;
|
|
41
|
+
let height;
|
|
42
|
+
if ("borderBoxSize" in entry) {
|
|
43
|
+
const borderSizeEntry = entry.borderBoxSize;
|
|
44
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
45
|
+
width = borderSize.inlineSize;
|
|
46
|
+
height = borderSize.blockSize;
|
|
47
|
+
} else {
|
|
48
|
+
width = control.offsetWidth;
|
|
49
|
+
height = control.offsetHeight;
|
|
50
|
+
}
|
|
51
|
+
setControlSize({
|
|
52
|
+
width,
|
|
53
|
+
height
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
resizeObserver.observe(control, { box: "border-box" });
|
|
57
|
+
return () => {
|
|
58
|
+
resizeObserver.disconnect();
|
|
59
|
+
};
|
|
60
|
+
}, [control]);
|
|
61
|
+
React$1.useEffect(() => {
|
|
62
|
+
const input = inputRef.current;
|
|
63
|
+
if (!input) return;
|
|
64
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
65
|
+
const propertyKey = isCheckInput ? "checked" : "value";
|
|
66
|
+
const eventType = isCheckInput ? "click" : "input";
|
|
67
|
+
const currentValue = isCheckInput ? checked : value;
|
|
68
|
+
const serializedCurrentValue = isCheckInput ? checked : typeof value === "object" && value !== null ? JSON.stringify(value) : value;
|
|
69
|
+
const setter = Object.getOwnPropertyDescriptor(inputProto, propertyKey)?.set;
|
|
70
|
+
if (prevValue !== currentValue && setter) {
|
|
71
|
+
const event = new Event(eventType, { bubbles });
|
|
72
|
+
setter.call(input, serializedCurrentValue);
|
|
73
|
+
input.dispatchEvent(event);
|
|
74
|
+
}
|
|
75
|
+
}, [
|
|
76
|
+
prevValue,
|
|
77
|
+
value,
|
|
78
|
+
checked,
|
|
79
|
+
bubbles,
|
|
80
|
+
isCheckInput
|
|
81
|
+
]);
|
|
82
|
+
const composedStyle = React$1.useMemo(() => {
|
|
83
|
+
return {
|
|
84
|
+
...style,
|
|
85
|
+
...controlSize.width !== void 0 && controlSize.height !== void 0 ? controlSize : {},
|
|
86
|
+
border: 0,
|
|
87
|
+
clip: "rect(0 0 0 0)",
|
|
88
|
+
clipPath: "inset(50%)",
|
|
89
|
+
height: "1px",
|
|
90
|
+
margin: "-1px",
|
|
91
|
+
overflow: "hidden",
|
|
92
|
+
padding: 0,
|
|
93
|
+
position: "absolute",
|
|
94
|
+
whiteSpace: "nowrap",
|
|
95
|
+
width: "1px"
|
|
96
|
+
};
|
|
97
|
+
}, [style, controlSize]);
|
|
98
|
+
return /* @__PURE__ */ jsx("input", {
|
|
99
|
+
type,
|
|
100
|
+
...inputProps,
|
|
101
|
+
ref: inputRef,
|
|
102
|
+
"aria-hidden": isCheckInput,
|
|
103
|
+
tabIndex: -1,
|
|
104
|
+
defaultChecked: isCheckInput ? checked : void 0,
|
|
105
|
+
style: composedStyle
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { VisuallyHiddenInput };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.mjs";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/hooks/use-as-ref.ts
|
|
4
|
+
function useAsRef(props) {
|
|
5
|
+
const ref = React$1.useRef(props);
|
|
6
|
+
useIsomorphicLayoutEffect(() => {
|
|
7
|
+
ref.current = props;
|
|
8
|
+
});
|
|
9
|
+
return ref;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useAsRef };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/hooks/use-chart-theme.d.ts
|
|
2
|
-
interface ChartTheme {
|
|
2
|
+
export interface ChartTheme {
|
|
3
3
|
foreground: string;
|
|
4
4
|
mutedForeground: string;
|
|
5
5
|
axisForeground: string;
|
|
@@ -13,6 +13,5 @@ interface ChartTheme {
|
|
|
13
13
|
fontMono: string;
|
|
14
14
|
isDark: boolean;
|
|
15
15
|
}
|
|
16
|
-
declare function useChartTheme(): ChartTheme;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { ChartTheme, useChartTheme };
|
|
16
|
+
export declare function useChartTheme(): ChartTheme;
|
|
17
|
+
//#endregion
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
//#region src/hooks/use-copy-to-clipboard.d.ts
|
|
2
|
-
declare function useCopyToClipboard({ resetDelay }?: {
|
|
2
|
+
export declare function useCopyToClipboard({ resetDelay }?: {
|
|
3
3
|
resetDelay?: number;
|
|
4
4
|
}): {
|
|
5
5
|
copy: (text: string) => void;
|
|
6
6
|
isCopied: boolean;
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { useCopyToClipboard };
|
|
8
|
+
//#endregion
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
//#region src/lib/chart-palette.d.ts
|
|
2
|
-
declare const MAGENTA_PALETTE: readonly ["#da1b6a", "#ec82b0", "#9a67d7", "#668fdf", "#47bde0", "#75ddd8", "#cd8c4d", "#3eb0a1"];
|
|
3
|
-
declare const CYAN_PALETTE: readonly ["#2eb2c5", "#50d0c0", "#4f90e0", "#8d74e0", "#bc73e0", "#ec82b0", "#da1b6a", "#c08dd3"];
|
|
4
|
-
type ChartPaletteName = "magenta" | "cyan";
|
|
5
|
-
declare const CHART_PALETTES: Record<ChartPaletteName, readonly string[]>;
|
|
6
|
-
declare const heatRampMagenta: (empty: string) => string[];
|
|
7
|
-
declare const heatRampMint: (empty: string) => string[];
|
|
8
|
-
declare const HEAT_EMPTY: {
|
|
2
|
+
export declare const MAGENTA_PALETTE: readonly ["#da1b6a", "#ec82b0", "#9a67d7", "#668fdf", "#47bde0", "#75ddd8", "#cd8c4d", "#3eb0a1"];
|
|
3
|
+
export declare const CYAN_PALETTE: readonly ["#2eb2c5", "#50d0c0", "#4f90e0", "#8d74e0", "#bc73e0", "#ec82b0", "#da1b6a", "#c08dd3"];
|
|
4
|
+
export type ChartPaletteName = "magenta" | "cyan";
|
|
5
|
+
export declare const CHART_PALETTES: Record<ChartPaletteName, readonly string[]>;
|
|
6
|
+
export declare const heatRampMagenta: (empty: string) => string[];
|
|
7
|
+
export declare const heatRampMint: (empty: string) => string[];
|
|
8
|
+
export declare const HEAT_EMPTY: {
|
|
9
9
|
readonly light: "#eef3f3";
|
|
10
10
|
readonly dark: "#102222";
|
|
11
11
|
};
|
|
12
|
-
declare const heatRamp: (palette: ChartPaletteName, empty: string, isDark?: boolean) => string[];
|
|
13
|
-
declare const luminance: (hex: string) => number;
|
|
14
|
-
declare const paletteColor: (palette: readonly string[], index: number) => string;
|
|
15
|
-
declare const rampColor: (palette: ChartPaletteName, fraction: number) => string;
|
|
12
|
+
export declare const heatRamp: (palette: ChartPaletteName, empty: string, isDark?: boolean) => string[];
|
|
13
|
+
export declare const luminance: (hex: string) => number;
|
|
14
|
+
export declare const paletteColor: (palette: readonly string[], index: number) => string;
|
|
15
|
+
export declare const rampColor: (palette: ChartPaletteName, fraction: number) => string;
|
|
16
16
|
/** Interpolates continuously across the ramp so a 0..1 value reads as a smooth gradient rather than five discrete bands. */
|
|
17
|
-
declare const heatColor: (stops: readonly string[], fraction: number) => string;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { CHART_PALETTES, CYAN_PALETTE, ChartPaletteName, HEAT_EMPTY, MAGENTA_PALETTE, heatColor, heatRamp, heatRampMagenta, heatRampMint, luminance, paletteColor, rampColor };
|
|
17
|
+
export declare const heatColor: (stops: readonly string[], fraction: number) => string;
|
|
18
|
+
//#endregion
|
package/dist/lib/chart.d.mts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
//#region src/lib/chart.d.ts
|
|
3
3
|
/** One plotted series; the same shape drives area, line and bar charts. */
|
|
4
|
-
interface ChartSeries {
|
|
4
|
+
export interface ChartSeries {
|
|
5
5
|
key: string;
|
|
6
6
|
name?: string;
|
|
7
7
|
color?: string;
|
|
8
8
|
semantic?: "error" | "warning" | "success";
|
|
9
9
|
dashed?: boolean;
|
|
10
10
|
}
|
|
11
|
-
interface ResolvedSeries extends ChartSeries {
|
|
11
|
+
export interface ResolvedSeries extends ChartSeries {
|
|
12
12
|
name: string;
|
|
13
13
|
color: string;
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { ChartSeries, ResolvedSeries };
|
|
15
|
+
//#endregion
|
package/dist/lib/cn.d.mts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/lib/compose-refs.ts
|
|
3
|
+
function setRef(ref, value) {
|
|
4
|
+
if (typeof ref === "function") return ref(value);
|
|
5
|
+
if (ref !== null && ref !== void 0) ref.current = value;
|
|
6
|
+
}
|
|
7
|
+
function composeRefs(...refs) {
|
|
8
|
+
return (node) => {
|
|
9
|
+
const cleanups = refs.map((ref) => setRef(ref, node));
|
|
10
|
+
if (!cleanups.some((cleanup) => typeof cleanup === "function")) return;
|
|
11
|
+
return () => {
|
|
12
|
+
cleanups.forEach((cleanup, index) => {
|
|
13
|
+
if (typeof cleanup === "function") cleanup();
|
|
14
|
+
else setRef(refs[index], null);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function useComposedRefs(...refs) {
|
|
20
|
+
return React$1.useCallback(composeRefs(...refs), refs);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { composeRefs, useComposedRefs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpic-ai/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.172.0",
|
|
4
4
|
"description": "Alpic design system — shared UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,13 +12,9 @@
|
|
|
12
12
|
"types": "./dist/hooks/*.d.mts",
|
|
13
13
|
"default": "./dist/hooks/*.mjs"
|
|
14
14
|
},
|
|
15
|
-
"./lib
|
|
16
|
-
"types": "./dist/lib
|
|
17
|
-
"default": "./dist/lib
|
|
18
|
-
},
|
|
19
|
-
"./lib/chart-palette": {
|
|
20
|
-
"types": "./dist/lib/chart-palette.d.mts",
|
|
21
|
-
"default": "./dist/lib/chart-palette.mjs"
|
|
15
|
+
"./lib/*": {
|
|
16
|
+
"types": "./dist/lib/*.d.mts",
|
|
17
|
+
"default": "./dist/lib/*.mjs"
|
|
22
18
|
},
|
|
23
19
|
"./theme": "./src/styles/tokens.css"
|
|
24
20
|
},
|
|
@@ -63,13 +59,13 @@
|
|
|
63
59
|
"@ladle/react": "^5.1.1",
|
|
64
60
|
"@tailwindcss/postcss": "^4.3.3",
|
|
65
61
|
"@types/react": "19.2.18",
|
|
66
|
-
"@types/react-dom": "19.2.
|
|
67
|
-
"lucide-react": "^1.
|
|
68
|
-
"react-hook-form": "^7.
|
|
62
|
+
"@types/react-dom": "19.2.7",
|
|
63
|
+
"lucide-react": "^1.41.0",
|
|
64
|
+
"react-hook-form": "^7.87.0",
|
|
69
65
|
"shx": "^0.4.0",
|
|
70
|
-
"sonner": "^2.0.
|
|
66
|
+
"sonner": "^2.0.8",
|
|
71
67
|
"tailwindcss": "^4.3.3",
|
|
72
|
-
"tsdown": "^0.
|
|
68
|
+
"tsdown": "^0.23.0",
|
|
73
69
|
"tw-animate-css": "^1.4.0",
|
|
74
70
|
"typescript": "^6.0.3"
|
|
75
71
|
},
|
|
@@ -166,7 +166,7 @@ function BarChart({
|
|
|
166
166
|
className,
|
|
167
167
|
)}
|
|
168
168
|
>
|
|
169
|
-
<div className="w-full" style={{ height }}>
|
|
169
|
+
<div className={cn("w-full", bare && !loading && !isEmpty && "border-border border-b")} style={{ height }}>
|
|
170
170
|
{loading ? (
|
|
171
171
|
<Skeleton className="h-full w-full rounded-lg" />
|
|
172
172
|
) : isEmpty ? (
|