@wallarm-org/design-system 0.73.0 → 0.74.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/Attribute/AttributeValue.js +1 -1
- package/dist/components/ButtonBase/classes.d.ts +1 -1
- package/dist/components/ButtonBase/classes.js +12 -1
- package/dist/components/InlineEdit/InlineEditControl.js +11 -4
- package/dist/components/InlineEdit/InlineEditInput.js +1 -1
- package/dist/components/InlineEdit/InlineEditNumber.js +1 -1
- package/dist/components/InlineEdit/InlineEditPreviewValue.js +1 -1
- package/dist/components/InlineEdit/InlineEditSelect.js +1 -0
- package/dist/components/InlineEdit/InlineEditTextarea.js +1 -1
- package/dist/components/InlineEdit/InlineEditTime.js +1 -1
- package/dist/components/InlineEdit/classes.js +3 -3
- package/dist/components/Input/classes.d.ts +1 -1
- package/dist/components/Input/classes.js +3 -2
- package/dist/components/InputGroup/InputGroup.d.ts +1 -1
- package/dist/components/InputGroup/InputGroup.js +2 -1
- package/dist/components/NumberInput/classes.d.ts +4 -4
- package/dist/components/NumberInput/classes.js +8 -4
- package/dist/components/Select/SelectButton.d.ts +1 -1
- package/dist/components/Select/SelectButton.js +2 -1
- package/dist/components/Select/SelectInput/SelectInput.d.ts +1 -1
- package/dist/components/Select/SelectInput/SelectInput.js +2 -1
- package/dist/components/Select/SelectInput/SelectInputItemRenderer.d.ts +2 -2
- package/dist/components/Select/SelectInput/SelectInputItemRenderer.js +2 -1
- package/dist/components/Select/SelectInput/SelectInputOverflowRenderer.d.ts +1 -1
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStack.d.ts +50 -0
- package/dist/components/SimpleCharts/{HorizontalBar/HorizontalBar.figma.js → HorizontalBarStack/HorizontalBarStack.figma.js} +16 -8
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStack.js +239 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStackSkeleton.d.ts +14 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/HorizontalBarStackSkeleton.js +56 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/classes.d.ts +19 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/classes.js +49 -0
- package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/constants.d.ts +2 -2
- package/dist/components/SimpleCharts/HorizontalBarStack/constants.js +16 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/index.d.ts +2 -0
- package/dist/components/SimpleCharts/HorizontalBarStack/index.js +2 -0
- package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/lib/resolveSegments.d.ts +2 -2
- package/dist/components/SimpleCharts/{HorizontalBar → HorizontalBarStack}/lib/resolveSegments.js +2 -2
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopover.d.ts +4 -0
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopover.js +3 -7
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverDot.d.ts +7 -13
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverDot.js +3 -16
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverRow.d.ts +5 -1
- package/dist/components/SimpleCharts/LineChart/LineChartHoverPopoverRow.js +9 -28
- package/dist/components/SimpleCharts/LineChart/classes.d.ts +0 -6
- package/dist/components/SimpleCharts/LineChart/classes.js +1 -7
- package/dist/components/SimpleCharts/Metric/Metric.d.ts +14 -0
- package/dist/components/SimpleCharts/Metric/Metric.figma.d.ts +1 -0
- package/dist/components/SimpleCharts/Metric/Metric.figma.js +49 -0
- package/dist/components/SimpleCharts/Metric/Metric.js +17 -0
- package/dist/components/SimpleCharts/Metric/MetricCaption.d.ts +6 -0
- package/dist/components/SimpleCharts/Metric/MetricCaption.js +16 -0
- package/dist/components/SimpleCharts/Metric/MetricDelta.d.ts +10 -0
- package/dist/components/SimpleCharts/Metric/MetricDelta.js +12 -0
- package/dist/components/SimpleCharts/Metric/MetricHeader.d.ts +9 -0
- package/dist/components/SimpleCharts/Metric/MetricHeader.js +16 -0
- package/dist/components/SimpleCharts/Metric/MetricSkeleton.d.ts +12 -0
- package/dist/components/SimpleCharts/Metric/MetricSkeleton.js +31 -0
- package/dist/components/SimpleCharts/Metric/MetricTotal.d.ts +12 -0
- package/dist/components/SimpleCharts/Metric/MetricTotal.js +36 -0
- package/dist/components/SimpleCharts/Metric/MetricValue.d.ts +9 -0
- package/dist/components/SimpleCharts/Metric/MetricValue.js +18 -0
- package/dist/components/SimpleCharts/Metric/classes.d.ts +8 -0
- package/dist/components/SimpleCharts/Metric/classes.js +9 -0
- package/dist/components/SimpleCharts/Metric/index.d.ts +7 -0
- package/dist/components/SimpleCharts/Metric/index.js +7 -0
- package/dist/components/SimpleCharts/index.d.ts +2 -1
- package/dist/components/SimpleCharts/index.js +2 -1
- package/dist/components/SimpleCharts/internal/ChartDelta.d.ts +22 -0
- package/dist/components/SimpleCharts/internal/ChartDelta.js +31 -0
- package/dist/components/SimpleCharts/internal/ChartHoverCard.d.ts +26 -0
- package/dist/components/SimpleCharts/internal/ChartHoverCard.js +57 -0
- package/dist/components/SimpleCharts/internal/index.d.ts +2 -0
- package/dist/components/SimpleCharts/internal/index.js +2 -0
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/Slider/classes.d.ts +2 -3
- package/dist/components/TemporalCore/props.d.ts +1 -1
- package/dist/components/Textarea/classes.d.ts +2 -2
- package/dist/components/Textarea/classes.js +4 -2
- package/dist/components/Textarea/useAutoResize.d.ts +1 -0
- package/dist/components/Textarea/useAutoResize.js +5 -4
- package/dist/metadata/components.json +2425 -465
- package/package.json +1 -1
- package/dist/components/SimpleCharts/HorizontalBar/HorizontalBar.d.ts +0 -30
- package/dist/components/SimpleCharts/HorizontalBar/HorizontalBar.js +0 -132
- package/dist/components/SimpleCharts/HorizontalBar/classes.d.ts +0 -11
- package/dist/components/SimpleCharts/HorizontalBar/classes.js +0 -12
- package/dist/components/SimpleCharts/HorizontalBar/constants.js +0 -16
- package/dist/components/SimpleCharts/HorizontalBar/index.d.ts +0 -1
- package/dist/components/SimpleCharts/HorizontalBar/index.js +0 -1
- /package/dist/components/SimpleCharts/{HorizontalBar/HorizontalBar.figma.d.ts → HorizontalBarStack/HorizontalBarStack.figma.d.ts} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import code_connect from "@figma/code-connect";
|
|
3
|
+
import { Chart } from "../Chart/Chart.js";
|
|
4
|
+
import { ChartHeader } from "../Chart/ChartHeader.js";
|
|
5
|
+
import { ChartTitle } from "../Chart/ChartTitle.js";
|
|
6
|
+
import { Metric } from "./Metric.js";
|
|
7
|
+
import { MetricCaption } from "./MetricCaption.js";
|
|
8
|
+
import { MetricDelta } from "./MetricDelta.js";
|
|
9
|
+
import { MetricHeader } from "./MetricHeader.js";
|
|
10
|
+
import { MetricTotal } from "./MetricTotal.js";
|
|
11
|
+
import { MetricValue } from "./MetricValue.js";
|
|
12
|
+
const figmaNodeUrl = 'https://www.figma.com/design/VKb5gW46uSGw0rqrhZsbXT/WADS-Components?node-id=11437-11939';
|
|
13
|
+
code_connect.connect(Metric, figmaNodeUrl, {
|
|
14
|
+
props: {
|
|
15
|
+
title: code_connect.string('Title')
|
|
16
|
+
},
|
|
17
|
+
example: ({ title })=>/*#__PURE__*/ jsxs(Chart, {
|
|
18
|
+
children: [
|
|
19
|
+
/*#__PURE__*/ jsx(ChartHeader, {
|
|
20
|
+
children: /*#__PURE__*/ jsx(ChartTitle, {
|
|
21
|
+
children: title
|
|
22
|
+
})
|
|
23
|
+
}),
|
|
24
|
+
/*#__PURE__*/ jsxs(Metric, {
|
|
25
|
+
children: [
|
|
26
|
+
/*#__PURE__*/ jsxs(MetricHeader, {
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ jsx(MetricValue, {
|
|
29
|
+
children: "91"
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx(MetricTotal, {
|
|
32
|
+
connector: "of",
|
|
33
|
+
children: "120"
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ jsx(MetricDelta, {
|
|
36
|
+
value: 10,
|
|
37
|
+
trend: "up",
|
|
38
|
+
sentiment: "negative"
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ jsx(MetricCaption, {
|
|
43
|
+
children: "blocked today"
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { TestIdProvider } from "../../../utils/testId.js";
|
|
4
|
+
import { metricRootClasses } from "./classes.js";
|
|
5
|
+
const Metric = ({ className, children, ref, 'data-testid': testId, ...props })=>/*#__PURE__*/ jsx(TestIdProvider, {
|
|
6
|
+
value: testId,
|
|
7
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
8
|
+
...props,
|
|
9
|
+
ref: ref,
|
|
10
|
+
"data-slot": "metric",
|
|
11
|
+
"data-testid": testId,
|
|
12
|
+
className: cn(metricRootClasses, className),
|
|
13
|
+
children: children
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
Metric.displayName = 'Metric';
|
|
17
|
+
export { Metric };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
export interface MetricCaptionProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
ref?: Ref<HTMLSpanElement>;
|
|
4
|
+
}
|
|
5
|
+
/** The muted secondary subline rendered under the header. */
|
|
6
|
+
export declare const MetricCaption: FC<MetricCaptionProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
4
|
+
import { metricCaptionClasses } from "./classes.js";
|
|
5
|
+
const MetricCaption = ({ className, ref, ...props })=>{
|
|
6
|
+
const testId = useTestId('caption');
|
|
7
|
+
return /*#__PURE__*/ jsx("span", {
|
|
8
|
+
...props,
|
|
9
|
+
ref: ref,
|
|
10
|
+
"data-slot": "metric-caption",
|
|
11
|
+
"data-testid": testId,
|
|
12
|
+
className: cn(metricCaptionClasses, className)
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
MetricCaption.displayName = 'MetricCaption';
|
|
16
|
+
export { MetricCaption };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { type ChartDeltaProps } from '../internal/ChartDelta';
|
|
3
|
+
export type MetricDeltaProps = Pick<ChartDeltaProps, 'value' | 'trend' | 'sentiment'>;
|
|
4
|
+
/**
|
|
5
|
+
* The trend chip brick — a thin wrapper over the shared `ChartDelta` so it earns a
|
|
6
|
+
* `--delta` slot id while `ChartDelta` stays the single source of colour/arrow logic.
|
|
7
|
+
* `sentiment` sets the colour (positive → green, negative → red, neutral → slate),
|
|
8
|
+
* `trend` sets the arrow — independent axes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MetricDelta: FC<MetricDeltaProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
3
|
+
import { ChartDelta } from "../internal/ChartDelta.js";
|
|
4
|
+
const MetricDelta = (props)=>{
|
|
5
|
+
const testId = useTestId('delta');
|
|
6
|
+
return /*#__PURE__*/ jsx(ChartDelta, {
|
|
7
|
+
...props,
|
|
8
|
+
"data-testid": testId
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
MetricDelta.displayName = 'MetricDelta';
|
|
12
|
+
export { MetricDelta };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
export interface MetricHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
ref?: Ref<HTMLDivElement>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The baseline row holding `MetricValue` + optional `MetricTotal` + optional `MetricDelta`.
|
|
7
|
+
* Exported as its own brick so `HorizontalBarStack` can reuse the exact same header.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MetricHeader: FC<MetricHeaderProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
4
|
+
import { metricHeaderClasses } from "./classes.js";
|
|
5
|
+
const MetricHeader = ({ className, ref, ...props })=>{
|
|
6
|
+
const testId = useTestId('header');
|
|
7
|
+
return /*#__PURE__*/ jsx("div", {
|
|
8
|
+
...props,
|
|
9
|
+
ref: ref,
|
|
10
|
+
"data-slot": "metric-header",
|
|
11
|
+
"data-testid": testId,
|
|
12
|
+
className: cn(metricHeaderClasses, className)
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
MetricHeader.displayName = 'MetricHeader';
|
|
16
|
+
export { MetricHeader };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../../utils/testId';
|
|
3
|
+
export interface MetricSkeletonProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Loading placeholder for `Metric`, matching `BarListSkeleton` / `PieChartSkeleton`.
|
|
8
|
+
* A value-sized block plus a thin caption line, sized to the loaded layout so the
|
|
9
|
+
* card doesn't jump when data arrives. Compose inside the `Chart` card in place
|
|
10
|
+
* of `Metric`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MetricSkeleton: FC<MetricSkeletonProps>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { Skeleton } from "../../Skeleton/index.js";
|
|
4
|
+
import { metricRootClasses, metricSkeletonLineClasses } from "./classes.js";
|
|
5
|
+
const MetricSkeleton = ({ className, ref, 'data-testid': testId, ...props })=>/*#__PURE__*/ jsxs("div", {
|
|
6
|
+
...props,
|
|
7
|
+
ref: ref,
|
|
8
|
+
"data-slot": "metric-skeleton",
|
|
9
|
+
"data-testid": testId,
|
|
10
|
+
"aria-busy": "true",
|
|
11
|
+
"aria-live": "polite",
|
|
12
|
+
className: cn(metricRootClasses, className),
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ jsx(Skeleton, {
|
|
15
|
+
width: "72px",
|
|
16
|
+
height: "36px",
|
|
17
|
+
rounded: 6
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsx("div", {
|
|
20
|
+
"data-slot": "metric-skeleton-line",
|
|
21
|
+
className: metricSkeletonLineClasses,
|
|
22
|
+
children: /*#__PURE__*/ jsx(Skeleton, {
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: "8px",
|
|
25
|
+
rounded: 6
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
MetricSkeleton.displayName = 'MetricSkeleton';
|
|
31
|
+
export { MetricSkeleton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
export type MetricTotalConnector = 'slash' | 'of' | 'total';
|
|
3
|
+
export interface MetricTotalProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
ref?: Ref<HTMLSpanElement>;
|
|
5
|
+
/** How the denominator reads: `/120` (`slash`) · `of 120` (`of`) · `120 total` (`total`). */
|
|
6
|
+
connector?: MetricTotalConnector;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The denominator after the value. A numeric child is formatted with
|
|
10
|
+
* `toLocaleString('en-US')`. The number is primary text; the connector word is muted.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MetricTotal: FC<MetricTotalProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
4
|
+
import { metricTotalClasses, metricTotalValueClasses, metricTotalWordClasses } from "./classes.js";
|
|
5
|
+
const MetricTotal = ({ connector = 'slash', className, children, ref, ...props })=>{
|
|
6
|
+
const testId = useTestId('total');
|
|
7
|
+
const num = 'number' == typeof children ? children.toLocaleString('en-US') : children;
|
|
8
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
9
|
+
...props,
|
|
10
|
+
ref: ref,
|
|
11
|
+
"data-slot": "metric-total",
|
|
12
|
+
"data-testid": testId,
|
|
13
|
+
className: cn(metricTotalClasses, className),
|
|
14
|
+
children: [
|
|
15
|
+
'of' === connector && /*#__PURE__*/ jsx("span", {
|
|
16
|
+
className: metricTotalWordClasses,
|
|
17
|
+
children: "of"
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsx("span", {
|
|
20
|
+
className: metricTotalValueClasses,
|
|
21
|
+
children: 'slash' === connector ? /*#__PURE__*/ jsxs(Fragment, {
|
|
22
|
+
children: [
|
|
23
|
+
"/",
|
|
24
|
+
num
|
|
25
|
+
]
|
|
26
|
+
}) : num
|
|
27
|
+
}),
|
|
28
|
+
'total' === connector && /*#__PURE__*/ jsx("span", {
|
|
29
|
+
className: metricTotalWordClasses,
|
|
30
|
+
children: "total"
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
MetricTotal.displayName = 'MetricTotal';
|
|
36
|
+
export { MetricTotal };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
export interface MetricValueProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
ref?: Ref<HTMLSpanElement>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The headline number. A numeric child is formatted with `toLocaleString('en-US')`;
|
|
7
|
+
* any other node renders as-is.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MetricValue: FC<MetricValueProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
4
|
+
import { metricValueClasses } from "./classes.js";
|
|
5
|
+
const MetricValue = ({ className, children, ref, ...props })=>{
|
|
6
|
+
const testId = useTestId('value');
|
|
7
|
+
const content = 'number' == typeof children ? children.toLocaleString('en-US') : children;
|
|
8
|
+
return /*#__PURE__*/ jsx("span", {
|
|
9
|
+
...props,
|
|
10
|
+
ref: ref,
|
|
11
|
+
"data-slot": "metric-value",
|
|
12
|
+
"data-testid": testId,
|
|
13
|
+
className: cn(metricValueClasses, className),
|
|
14
|
+
children: content
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
MetricValue.displayName = 'MetricValue';
|
|
18
|
+
export { MetricValue };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const metricRootClasses = "flex flex-col items-start px-16 py-8 w-full";
|
|
2
|
+
export declare const metricHeaderClasses = "flex items-baseline gap-8";
|
|
3
|
+
export declare const metricValueClasses = "font-sans-display text-3xl font-medium leading-3xl text-text-primary";
|
|
4
|
+
export declare const metricTotalClasses = "-ml-2 flex items-baseline gap-6";
|
|
5
|
+
export declare const metricTotalValueClasses = "font-sans-display text-lg font-medium text-text-primary";
|
|
6
|
+
export declare const metricTotalWordClasses = "text-xs font-normal text-text-secondary";
|
|
7
|
+
export declare const metricCaptionClasses = "text-xs text-text-secondary";
|
|
8
|
+
export declare const metricSkeletonLineClasses = "w-full py-4";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const metricRootClasses = 'flex flex-col items-start px-16 py-8 w-full';
|
|
2
|
+
const metricHeaderClasses = 'flex items-baseline gap-8';
|
|
3
|
+
const metricValueClasses = 'font-sans-display text-3xl font-medium leading-3xl text-text-primary';
|
|
4
|
+
const metricTotalClasses = '-ml-2 flex items-baseline gap-6';
|
|
5
|
+
const metricTotalValueClasses = 'font-sans-display text-lg font-medium text-text-primary';
|
|
6
|
+
const metricTotalWordClasses = 'text-xs font-normal text-text-secondary';
|
|
7
|
+
const metricCaptionClasses = 'text-xs text-text-secondary';
|
|
8
|
+
const metricSkeletonLineClasses = 'w-full py-4';
|
|
9
|
+
export { metricCaptionClasses, metricHeaderClasses, metricRootClasses, metricSkeletonLineClasses, metricTotalClasses, metricTotalValueClasses, metricTotalWordClasses, metricValueClasses };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Metric, type MetricProps } from './Metric';
|
|
2
|
+
export { MetricCaption, type MetricCaptionProps } from './MetricCaption';
|
|
3
|
+
export { MetricDelta, type MetricDeltaProps } from './MetricDelta';
|
|
4
|
+
export { MetricHeader, type MetricHeaderProps } from './MetricHeader';
|
|
5
|
+
export { MetricSkeleton, type MetricSkeletonProps } from './MetricSkeleton';
|
|
6
|
+
export { MetricTotal, type MetricTotalConnector, type MetricTotalProps } from './MetricTotal';
|
|
7
|
+
export { MetricValue, type MetricValueProps } from './MetricValue';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Metric } from "./Metric.js";
|
|
2
|
+
export { MetricCaption } from "./MetricCaption.js";
|
|
3
|
+
export { MetricDelta } from "./MetricDelta.js";
|
|
4
|
+
export { MetricHeader } from "./MetricHeader.js";
|
|
5
|
+
export { MetricSkeleton } from "./MetricSkeleton.js";
|
|
6
|
+
export { MetricTotal } from "./MetricTotal.js";
|
|
7
|
+
export { MetricValue } from "./MetricValue.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { BarList, BarListBar, type BarListBarProps, BarListItem, type BarListItemProps, BarListLabel, type BarListLabelProps, BarListPercent, type BarListPercentProps, type BarListProps, BarListSkeleton, type BarListSkeletonProps, BarListValue, type BarListValueProps, } from './BarList';
|
|
2
2
|
export { Chart, ChartActions, type ChartActionsProps, ChartEmpty, type ChartEmptyProps, ChartHeader, type ChartHeaderProps, type ChartProps, ChartTitle, type ChartTitleProps, } from './Chart';
|
|
3
|
-
export {
|
|
3
|
+
export { HorizontalBarStack, type HorizontalBarStackDatum, type HorizontalBarStackProps, HorizontalBarStackSkeleton, type HorizontalBarStackSkeletonProps, } from './HorizontalBarStack';
|
|
4
4
|
export { type ChartTimeFormatters, useChartTimeFormatters } from './hooks';
|
|
5
5
|
export { LineChart, LineChartBody, type LineChartBodyProps, type LineChartDatum, LineChartEmpty, type LineChartEmptyProps, LineChartGrid, type LineChartGridProps, LineChartHoverPopover, LineChartHoverPopoverDot, type LineChartHoverPopoverDotProps, type LineChartHoverPopoverProps, LineChartHoverPopoverRow, type LineChartHoverPopoverRowProps, LineChartHoverPopoverTimestamp, type LineChartHoverPopoverTimestampProps, LineChartLegend, LineChartLegendItem, type LineChartLegendItemProps, type LineChartLegendOrientation, type LineChartLegendProps, LineChartLine, type LineChartLineProps, type LineChartProps, type LineChartSeries, LineChartTooltip, type LineChartTooltipProps, type LineChartTooltipRenderArgs, LineChartXAxis, type LineChartXAxisProps, LineChartYAxis, type LineChartYAxisProps, LineChartZoomBrush, type LineChartZoomBrushProps, LineChartZoomPopover, LineChartZoomPopoverConfirm, type LineChartZoomPopoverConfirmProps, type LineChartZoomPopoverProps, LineChartZoomPopoverRange, type LineChartZoomPopoverRangeProps, type LineChartZoomRange, } from './LineChart';
|
|
6
6
|
export { type ChartHourCycle, type ChartTimeFormatterOptions, type ChartTimeOrder, formatChartDate, formatChartDateTime, formatChartHour, formatChartTimezone, withTimezoneChip, } from './lib';
|
|
7
|
+
export { Metric, MetricCaption, type MetricCaptionProps, MetricDelta, type MetricDeltaProps, MetricHeader, type MetricHeaderProps, type MetricProps, MetricSkeleton, type MetricSkeletonProps, MetricTotal, type MetricTotalConnector, type MetricTotalProps, MetricValue, type MetricValueProps, } from './Metric';
|
|
7
8
|
export { LegendDot, type LegendDotProps, PieChart, PieChartCenter, PieChartCenterLabel, type PieChartCenterLabelPluralRules, type PieChartCenterLabelProps, type PieChartCenterProps, PieChartCenterValue, type PieChartCenterValueProps, type PieChartDatum, PieChartDonut, type PieChartDonutProps, PieChartLegend, PieChartLegendItem, type PieChartLegendItemProps, PieChartLegendPercent, type PieChartLegendPercentProps, type PieChartLegendPercentVariant, type PieChartLegendProps, PieChartLegendValue, type PieChartLegendValueProps, type PieChartProps, PieChartSkeleton, type PieChartSkeletonProps, } from './PieChart';
|
|
8
9
|
export type { ChartColor } from './types';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { BarList, BarListBar, BarListItem, BarListLabel, BarListPercent, BarListSkeleton, BarListValue } from "./BarList/index.js";
|
|
2
2
|
export { Chart, ChartActions, ChartEmpty, ChartHeader, ChartTitle } from "./Chart/index.js";
|
|
3
|
-
export {
|
|
3
|
+
export { HorizontalBarStack, HorizontalBarStackSkeleton } from "./HorizontalBarStack/index.js";
|
|
4
4
|
export { useChartTimeFormatters } from "./hooks/index.js";
|
|
5
5
|
export { LineChart, LineChartBody, LineChartEmpty, LineChartGrid, LineChartHoverPopover, LineChartHoverPopoverDot, LineChartHoverPopoverRow, LineChartHoverPopoverTimestamp, LineChartLegend, LineChartLegendItem, LineChartLine, LineChartTooltip, LineChartXAxis, LineChartYAxis, LineChartZoomBrush, LineChartZoomPopover, LineChartZoomPopoverConfirm, LineChartZoomPopoverRange } from "./LineChart/index.js";
|
|
6
6
|
export { formatChartDate, formatChartDateTime, formatChartHour, formatChartTimezone, withTimezoneChip } from "./lib/index.js";
|
|
7
|
+
export { Metric, MetricCaption, MetricDelta, MetricHeader, MetricSkeleton, MetricTotal, MetricValue } from "./Metric/index.js";
|
|
7
8
|
export { LegendDot, PieChart, PieChartCenter, PieChartCenterLabel, PieChartCenterValue, PieChartDonut, PieChartLegend, PieChartLegendItem, PieChartLegendPercent, PieChartLegendValue, PieChartSkeleton } from "./PieChart/index.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
export type ChartDeltaSentiment = 'positive' | 'negative' | 'neutral';
|
|
3
|
+
export type ChartDeltaTrend = 'up' | 'down';
|
|
4
|
+
export interface ChartDeltaProps {
|
|
5
|
+
/** Magnitude shown in the chip; rendered as `Math.abs(value).toLocaleString('en-US')`. */
|
|
6
|
+
value: number;
|
|
7
|
+
/** Arrow direction. Defaults to the sign of `value` (`>= 0` → up). */
|
|
8
|
+
trend?: ChartDeltaTrend;
|
|
9
|
+
/**
|
|
10
|
+
* Colour = meaning, and it is independent of the arrow: `positive` → green,
|
|
11
|
+
* `negative` → red, `neutral` → slate. Defaults to `neutral`. An increase
|
|
12
|
+
* can therefore read as negative (red ↑) and a decrease as positive (green ↓).
|
|
13
|
+
*/
|
|
14
|
+
sentiment?: ChartDeltaSentiment;
|
|
15
|
+
'data-testid'?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The shared trend chip used by `Metric` and `HorizontalBarStack`. A 2-axis
|
|
19
|
+
* matrix mirroring the Figma `delta` component: `sentiment` drives the colour,
|
|
20
|
+
* `trend` drives the arrow — the two are independent.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ChartDelta: FC<ChartDeltaProps>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDown, ArrowUp } from "../../../icons/index.js";
|
|
3
|
+
import { Badge } from "../../Badge/index.js";
|
|
4
|
+
const SENTIMENT_COLOR = {
|
|
5
|
+
positive: 'green',
|
|
6
|
+
negative: 'red',
|
|
7
|
+
neutral: 'slate'
|
|
8
|
+
};
|
|
9
|
+
const formatNumber = (n)=>n.toLocaleString('en-US');
|
|
10
|
+
const ChartDelta = ({ value, trend, sentiment = 'neutral', 'data-testid': testId })=>{
|
|
11
|
+
const direction = trend ?? (value >= 0 ? 'up' : 'down');
|
|
12
|
+
const abs = Math.abs(value);
|
|
13
|
+
return /*#__PURE__*/ jsxs(Badge, {
|
|
14
|
+
type: "secondary",
|
|
15
|
+
color: SENTIMENT_COLOR[sentiment],
|
|
16
|
+
size: "medium",
|
|
17
|
+
"data-testid": testId,
|
|
18
|
+
role: "img",
|
|
19
|
+
"aria-label": `${direction} ${formatNumber(abs)}`,
|
|
20
|
+
children: [
|
|
21
|
+
'up' === direction ? /*#__PURE__*/ jsx(ArrowUp, {
|
|
22
|
+
"aria-hidden": true
|
|
23
|
+
}) : /*#__PURE__*/ jsx(ArrowDown, {
|
|
24
|
+
"aria-hidden": true
|
|
25
|
+
}),
|
|
26
|
+
formatNumber(abs)
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
ChartDelta.displayName = 'ChartDelta';
|
|
31
|
+
export { ChartDelta };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { ChartColor } from '../types';
|
|
3
|
+
export interface ChartHoverCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChartHoverCard: FC<ChartHoverCardProps>;
|
|
7
|
+
export interface ChartHoverCardDotProps extends HTMLAttributes<HTMLSpanElement> {
|
|
8
|
+
ref?: Ref<HTMLSpanElement>;
|
|
9
|
+
/** Palette token or CSS colour. Omitted → no inline fill (lets a `className` bg win). */
|
|
10
|
+
color?: ChartColor | (string & {});
|
|
11
|
+
}
|
|
12
|
+
export declare const ChartHoverCardDot: FC<ChartHoverCardDotProps>;
|
|
13
|
+
export interface ChartHoverCardRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
ref?: Ref<HTMLDivElement>;
|
|
15
|
+
/** Dot colour — palette token or CSS colour. */
|
|
16
|
+
color?: ChartColor | (string & {});
|
|
17
|
+
/** Extra dot class (e.g. a `bg-*` escape hatch that wins over `color`). */
|
|
18
|
+
dotClassName?: string;
|
|
19
|
+
/** Series label. Ignored when `children` is provided. */
|
|
20
|
+
label?: ReactNode;
|
|
21
|
+
/** Value at the hovered point. A number is locale-formatted; `null`/`undefined` → em dash. */
|
|
22
|
+
value?: number | string | null;
|
|
23
|
+
/** Override the default (locale) value formatting. */
|
|
24
|
+
formatValue?: (value: number | string | null | undefined) => ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export declare const ChartHoverCardRow: FC<ChartHoverCardRowProps>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { resolveChartColor } from "../lib/chartPalette.js";
|
|
4
|
+
const chartHoverCardClasses = "bg-bg-surface-2 border border-border-primary-light rounded-12 shadow-md px-12 py-8 min-w-160 flex flex-col gap-4 pointer-events-none";
|
|
5
|
+
const chartHoverCardRowClasses = "relative h-16 w-full pl-12 flex items-center gap-8 text-xs font-mono text-text-primary";
|
|
6
|
+
const chartHoverCardRowDotClasses = 'absolute left-0 top-4';
|
|
7
|
+
const chartHoverCardRowLabelClasses = 'truncate min-w-0 font-normal';
|
|
8
|
+
const chartHoverCardRowValueClasses = 'ml-auto shrink-0 font-medium';
|
|
9
|
+
const chartHoverCardDotClasses = 'inline-block size-8 rounded-2';
|
|
10
|
+
const ChartHoverCard = ({ className, children, ref, ...props })=>/*#__PURE__*/ jsx("div", {
|
|
11
|
+
...props,
|
|
12
|
+
ref: ref,
|
|
13
|
+
"data-slot": "chart-hover-card",
|
|
14
|
+
className: cn(chartHoverCardClasses, className),
|
|
15
|
+
children: children
|
|
16
|
+
});
|
|
17
|
+
ChartHoverCard.displayName = 'ChartHoverCard';
|
|
18
|
+
const ChartHoverCardDot = ({ color, className, style, ref, ...props })=>/*#__PURE__*/ jsx("span", {
|
|
19
|
+
...props,
|
|
20
|
+
ref: ref,
|
|
21
|
+
"data-slot": "chart-hover-card-dot",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: cn(chartHoverCardDotClasses, className),
|
|
24
|
+
style: {
|
|
25
|
+
...style,
|
|
26
|
+
backgroundColor: style?.backgroundColor ?? (null != color ? resolveChartColor(color) : void 0)
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
ChartHoverCardDot.displayName = 'ChartHoverCardDot';
|
|
30
|
+
const defaultFormatValue = (value)=>{
|
|
31
|
+
if (null == value) return '—';
|
|
32
|
+
return 'number' == typeof value ? value.toLocaleString('en-US') : value;
|
|
33
|
+
};
|
|
34
|
+
const ChartHoverCardRow = ({ color, dotClassName, label, value, formatValue = defaultFormatValue, className, children, ref, ...props })=>/*#__PURE__*/ jsx("div", {
|
|
35
|
+
...props,
|
|
36
|
+
ref: ref,
|
|
37
|
+
"data-slot": "chart-hover-card-row",
|
|
38
|
+
className: cn(chartHoverCardRowClasses, className),
|
|
39
|
+
children: children ?? /*#__PURE__*/ jsxs(Fragment, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ jsx(ChartHoverCardDot, {
|
|
42
|
+
color: color,
|
|
43
|
+
className: cn(chartHoverCardRowDotClasses, dotClassName)
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ jsx("span", {
|
|
46
|
+
className: chartHoverCardRowLabelClasses,
|
|
47
|
+
children: label
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ jsx("span", {
|
|
50
|
+
className: chartHoverCardRowValueClasses,
|
|
51
|
+
children: formatValue(value)
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
ChartHoverCardRow.displayName = 'ChartHoverCardRow';
|
|
57
|
+
export { ChartHoverCard, ChartHoverCardDot, ChartHoverCardRow };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ChartDelta, type ChartDeltaProps, type ChartDeltaSentiment, type ChartDeltaTrend, } from './ChartDelta';
|
|
2
|
+
export { ChartHoverCard, ChartHoverCardDot, type ChartHoverCardDotProps, type ChartHoverCardProps, ChartHoverCardRow, type ChartHoverCardRowProps, } from './ChartHoverCard';
|
|
@@ -28,7 +28,7 @@ export interface SliderProps extends SliderRootConfig, TestableProps {
|
|
|
28
28
|
*
|
|
29
29
|
* It reads `Field` context like `Input`/`Textarea`, so wrapping it in `<Field>` wires
|
|
30
30
|
* label / invalid / disabled. When an exact figure matters, pair with `NumberInput`;
|
|
31
|
-
* for 2–7 fixed options use `SegmentedControl`.
|
|
31
|
+
* for 2–7 fixed options use `SegmentedControl`.
|
|
32
32
|
*/
|
|
33
33
|
export declare const Slider: FC<SliderProps>;
|
|
34
34
|
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Root layout for the Slider control.
|
|
3
3
|
*
|
|
4
|
-
* Single fixed size for v1 — no `sm`/`md` axis
|
|
5
|
-
* `docs/slider-handoff-requirements.md` §4). State styling
|
|
4
|
+
* Single fixed size for v1 — no `sm`/`md` axis. State styling
|
|
6
5
|
* (hover / focus / dragging / invalid) is driven by Ark `data-*` attributes on
|
|
7
6
|
* the individual parts and lands in Phase 2; only the root-level disabled
|
|
8
|
-
* treatment (the whole control at 50% opacity
|
|
7
|
+
* treatment (the whole control at 50% opacity) lives here.
|
|
9
8
|
*/
|
|
10
9
|
export declare const sliderVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
10
|
/**
|
|
@@ -3,7 +3,7 @@ import type { TestableProps } from '../../utils/testId';
|
|
|
3
3
|
/**
|
|
4
4
|
* Visual size of a temporal input. Mirrors InputGroup sizes.
|
|
5
5
|
*/
|
|
6
|
-
export type TemporalInputSize = 'default' | 'medium' | 'small';
|
|
6
|
+
export type TemporalInputSize = 'default' | 'medium' | 'small' | 'inline-edit';
|
|
7
7
|
/**
|
|
8
8
|
* Props shared by every temporal input root wrapper — DateInput, TimeInput,
|
|
9
9
|
* DateRangeInput. Extends `HTMLAttributes<HTMLDivElement>` so consumers can
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const textareaPaddingVariants: (props?: ({
|
|
2
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
2
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
3
3
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
4
|
export declare const textareaHeightVariants: (props?: ({
|
|
5
|
-
size?: "small" | "medium" | "default" | null | undefined;
|
|
5
|
+
size?: "small" | "medium" | "default" | "inline-edit" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -4,7 +4,8 @@ const textareaPaddingVariants = cva('', {
|
|
|
4
4
|
size: {
|
|
5
5
|
small: 'py-0',
|
|
6
6
|
medium: 'py-6',
|
|
7
|
-
default: 'py-8'
|
|
7
|
+
default: 'py-8',
|
|
8
|
+
'inline-edit': 'py-4'
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
});
|
|
@@ -13,7 +14,8 @@ const textareaHeightVariants = cva('min-h-[64px]', {
|
|
|
13
14
|
size: {
|
|
14
15
|
small: 'min-h-[64px]',
|
|
15
16
|
medium: 'min-h-[72px]',
|
|
16
|
-
default: 'min-h-[76px]'
|
|
17
|
+
default: 'min-h-[76px]',
|
|
18
|
+
'inline-edit': 'min-h-[64px]'
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function adjustTextareaHeight(textarea: HTMLTextAreaElement, minRows: number, maxRows: number): void;
|
|
1
2
|
export declare function useAutoResize(enabled: boolean, minRows: number, maxRows: number, value?: string | number | readonly string[]): {
|
|
2
3
|
ref: import("react").RefObject<HTMLTextAreaElement | null>;
|
|
3
4
|
adjustHeight: () => void;
|
|
@@ -3,10 +3,11 @@ function adjustTextareaHeight(textarea, minRows, maxRows) {
|
|
|
3
3
|
const style = window.getComputedStyle(textarea);
|
|
4
4
|
const lineHeight = Number.parseInt(style.lineHeight, 10) || 20;
|
|
5
5
|
const paddingY = (Number.parseInt(style.paddingTop, 10) || 0) + (Number.parseInt(style.paddingBottom, 10) || 0);
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const borderY = (Number.parseInt(style.borderTopWidth, 10) || 0) + (Number.parseInt(style.borderBottomWidth, 10) || 0);
|
|
7
|
+
const minHeight = lineHeight * minRows + paddingY + borderY;
|
|
8
|
+
const maxHeight = lineHeight * maxRows + paddingY + borderY;
|
|
8
9
|
textarea.style.height = '0';
|
|
9
|
-
const scrollHeight = textarea.scrollHeight;
|
|
10
|
+
const scrollHeight = textarea.scrollHeight + borderY;
|
|
10
11
|
textarea.style.height = `${Math.min(Math.max(scrollHeight, minHeight), maxHeight)}px`;
|
|
11
12
|
textarea.style.overflowY = scrollHeight > maxHeight ? 'auto' : 'hidden';
|
|
12
13
|
}
|
|
@@ -31,4 +32,4 @@ function useAutoResize(enabled, minRows, maxRows, value) {
|
|
|
31
32
|
adjustHeight
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
export { useAutoResize };
|
|
35
|
+
export { adjustTextareaHeight, useAutoResize };
|