@epam/ai-dial-ui-kit 0.16.0-dev.46 → 0.16.0-dev.48
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/README.md +5 -0
- package/dist/{DateCellRenderer-Bx79kGGv.cjs → DateCellRenderer-B2BORgHD.cjs} +1 -1
- package/dist/components/New/Analytics/Bar/Bar.js +104 -0
- package/dist/components/New/Analytics/BarGroup/BarGroup.js +143 -0
- package/dist/components/New/Analytics/Card/Card.js +99 -0
- package/dist/components/New/Analytics/Histogram/Histogram.js +212 -0
- package/dist/components/New/LabelledText/LabelledText.js +43 -0
- package/dist/components-manifest.json +423 -8
- package/dist/constants/public-class-names.js +10 -0
- package/dist/dial-ui-kit.cjs +3 -3
- package/dist/dial-ui-kit.js +233 -223
- package/dist/grid.cjs +1 -1
- package/dist/src/components/New/Analytics/Bar/Bar.d.ts +86 -0
- package/dist/src/components/New/Analytics/BarGroup/BarGroup.d.ts +103 -0
- package/dist/src/components/New/Analytics/Card/Card.d.ts +91 -0
- package/dist/src/components/New/Analytics/Histogram/Histogram.d.ts +59 -0
- package/dist/src/components/New/LabelledText/LabelledText.d.ts +48 -0
- package/dist/src/constants/public-class-names.d.ts +10 -0
- package/dist/src/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AnalyticsBarColorStop } from '../../../../models/analytics';
|
|
3
|
+
export interface AnalyticsBarProps {
|
|
4
|
+
/**
|
|
5
|
+
* Current value used to size and color the bar. Pass `null` when there is no
|
|
6
|
+
* data (em dash, no progress bar). Omit it when `error` is set.
|
|
7
|
+
*/
|
|
8
|
+
value?: number | null;
|
|
9
|
+
/** Upper bound of the scale. Defaults to `1`. */
|
|
10
|
+
maxValue?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Renders the error state: the bar fills with the error color and an error tag
|
|
13
|
+
* replaces the value label.
|
|
14
|
+
*/
|
|
15
|
+
error?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Renders the loading state: a loader replaces the value label and the bar shows
|
|
18
|
+
* an empty track while the value is being fetched.
|
|
19
|
+
*/
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
/** Optional label rendered above the bar, on the left. */
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Text rendered above the bar, on the right. Defaults to `value`, or an em dash
|
|
25
|
+
* (`—`) when `value` is `null`. Pass a formatted node (e.g. `"85%"`) to override.
|
|
26
|
+
*/
|
|
27
|
+
valueLabel?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Ordered list of color bands keyed by ratio (value / maxValue).
|
|
30
|
+
* Defaults to {@link DEFAULT_ANALYTICS_BAR_COLOR_MAP}.
|
|
31
|
+
*/
|
|
32
|
+
colorMap?: AnalyticsBarColorStop[];
|
|
33
|
+
/** Additional CSS classes for the outer container. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Additional CSS classes for the title label. */
|
|
36
|
+
titleClassName?: string;
|
|
37
|
+
/** Additional CSS classes for the value label. */
|
|
38
|
+
valueClassName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Renders the bar on a single row: the title takes the left half and the bar
|
|
41
|
+
* with its value takes the right half. Defaults to the stacked layout.
|
|
42
|
+
*/
|
|
43
|
+
inline?: boolean;
|
|
44
|
+
/** Accessible label for the bar. Falls back to the `title` when it is a string. */
|
|
45
|
+
ariaLabel?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A compact analytics meter: a horizontal bar whose fill width and color reflect a
|
|
49
|
+
* value relative to `maxValue`, with an optional title on the left and value on the right.
|
|
50
|
+
* aliases: MetricBar|Meter|ScoreBar
|
|
51
|
+
* Design system 2.0
|
|
52
|
+
*
|
|
53
|
+
* The fill color is resolved from `colorMap` based on the normalized ratio
|
|
54
|
+
* (`value / maxValue`), so the bar shifts hue as the value grows. An empty bar
|
|
55
|
+
* (value `0`) shows only the `bg-layer-1` track. A missing value (`null`) shows
|
|
56
|
+
* an em dash and no progress bar.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <AnalyticsBar title="Relevance" value={0.82} valueLabel="82%" />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <AnalyticsBar
|
|
66
|
+
* title="Score"
|
|
67
|
+
* value={640}
|
|
68
|
+
* maxValue={1000}
|
|
69
|
+
* colorMap={customColorMap}
|
|
70
|
+
* />
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param [value] - Current value used to size and color the bar. Pass `null` for no data (em dash, no bar). Omit when `error` is set.
|
|
74
|
+
* @param [maxValue=1] - Upper bound of the scale.
|
|
75
|
+
* @param [error] - Renders the error state (error-colored bar + error tag).
|
|
76
|
+
* @param [isLoading] - Renders the loading state (loader + empty track).
|
|
77
|
+
* @param [title] - Optional label rendered above the bar, on the left.
|
|
78
|
+
* @param [valueLabel] - Text rendered above the bar, on the right. Defaults to `value` or `—` when null.
|
|
79
|
+
* @param [colorMap=DEFAULT_ANALYTICS_BAR_COLOR_MAP] - Color bands keyed by ratio.
|
|
80
|
+
* @param [className] - Additional CSS classes for the outer container.
|
|
81
|
+
* @param [titleClassName] - Additional CSS classes for the title label.
|
|
82
|
+
* @param [valueClassName] - Additional CSS classes for the value label.
|
|
83
|
+
* @param [inline] - Renders the title and bar on a single row (50% / 50%).
|
|
84
|
+
* @param [ariaLabel] - Accessible label for the bar.
|
|
85
|
+
*/
|
|
86
|
+
export declare const AnalyticsBar: FC<AnalyticsBarProps>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AnalyticsBarColorStop } from '../../../../models/analytics';
|
|
3
|
+
export interface AnalyticsBarGroupProps {
|
|
4
|
+
/** Title passed to the accordion header. */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Tooltip shown when hovering the accordion header title. */
|
|
7
|
+
titleTooltip?: ReactNode;
|
|
8
|
+
/** Description passed to the accordion header. Defaults to the number of entries. */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Map of metric name to numeric value. Each entry renders one bar.
|
|
12
|
+
* Pass `null` for a key when there is no data (em dash, no progress bar).
|
|
13
|
+
*/
|
|
14
|
+
data: Record<string, number | null>;
|
|
15
|
+
/**
|
|
16
|
+
* When provided, enables compare mode: keys are the union of `data` and
|
|
17
|
+
* `compareData`. Each entry renders two bars and, when both sides are numeric,
|
|
18
|
+
* a delta badge (`compareData[key] - data[key]`, three decimal places). A
|
|
19
|
+
* missing key (or explicit `null`) on either side shows an em dash with no
|
|
20
|
+
* progress bar and no delta. A rounded delta of `0` is omitted.
|
|
21
|
+
*/
|
|
22
|
+
compareData?: Record<string, number | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Labels shown next to each of the two bars in compare mode.
|
|
25
|
+
* The first label is for `data`, the second for `compareData`.
|
|
26
|
+
* Has no effect when `compareData` is not set.
|
|
27
|
+
*/
|
|
28
|
+
compareLabels?: [ReactNode, ReactNode];
|
|
29
|
+
/** Upper bound passed to every bar. Defaults to the bar's own default (`1`). */
|
|
30
|
+
maxValue?: number;
|
|
31
|
+
/** Color map passed to every bar. */
|
|
32
|
+
colorMap?: AnalyticsBarColorStop[];
|
|
33
|
+
/** Whether the accordion is expanded initially. Defaults to `true`. */
|
|
34
|
+
defaultExpanded?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Renders the group permanently expanded: the content is always visible and
|
|
37
|
+
* the accordion header has no toggle or chevron icon.
|
|
38
|
+
*/
|
|
39
|
+
nonCollapsible?: boolean;
|
|
40
|
+
/** Renders a loader in place of the bars while the data is being fetched. */
|
|
41
|
+
isLoading?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Invoked with the entry key and value when a bar is clicked. When set, each
|
|
44
|
+
* bar becomes an interactive button. In compare mode the whole entry (label,
|
|
45
|
+
* delta, both bars) is the click target.
|
|
46
|
+
*/
|
|
47
|
+
onBarClick?: (key: string, value: number | null) => void;
|
|
48
|
+
/** Renders every bar on a single row (50% title, 50% bar + value). */
|
|
49
|
+
inline?: boolean;
|
|
50
|
+
/** Additional CSS classes for each bar's title label. */
|
|
51
|
+
barTitleClassName?: string;
|
|
52
|
+
/** Additional CSS classes for each bar's value label. */
|
|
53
|
+
barValueClassName?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Additional CSS classes for each bar's outer container (e.g. for custom hover
|
|
56
|
+
* effects). In compare mode these classes apply to the shared container around
|
|
57
|
+
* both bars (one continuous block), and the entry wrapper is a Tailwind
|
|
58
|
+
* `group` — use `group-hover:` (not `hover:`) for pair hover. When `onBarClick`
|
|
59
|
+
* is set, that container also gets a default accent fill on group hover and
|
|
60
|
+
* `:focus-visible`.
|
|
61
|
+
*/
|
|
62
|
+
barClassName?: string;
|
|
63
|
+
/** Map of bar key to tooltip content. When provided, hovering each bar shows its description. */
|
|
64
|
+
barDescriptions?: Record<string, ReactNode>;
|
|
65
|
+
/** Additional CSS classes for the accordion container. */
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A collapsible group of analytics bars built from a key/value map. Wraps
|
|
70
|
+
* {@link Accordion}: the `title` is shown in the header, the number of entries
|
|
71
|
+
* is shown as the header description, and each entry renders a {@link AnalyticsBar}
|
|
72
|
+
* with the key as its title and the value as its value.
|
|
73
|
+
* aliases: MetricBarGroup|BarList|NumericResults
|
|
74
|
+
* Design system 2.0
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <AnalyticsBarGroup
|
|
79
|
+
* title="Relevance"
|
|
80
|
+
* data={{ accuracy: 0.82, recall: 0.64, precision: 0.91 }}
|
|
81
|
+
* />
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @param title - Title passed to the accordion header.
|
|
85
|
+
* @param [titleTooltip] - Tooltip shown when hovering the accordion header title.
|
|
86
|
+
* @param [description] - Description passed to the accordion header. Defaults to the number of entries.
|
|
87
|
+
* @param data - Map of metric name to numeric value (or `null` when missing). Each entry renders one bar.
|
|
88
|
+
* @param [compareData] - Enables compare mode: union of keys, delta badge (`compareData − data`) when both sides are numeric and the rounded delta is non-zero, em dash (no bar) when a side is missing.
|
|
89
|
+
* @param [compareLabels] - Labels for the two bars in compare mode: first for `data`, second for `compareData`.
|
|
90
|
+
* @param [maxValue] - Upper bound passed to every bar.
|
|
91
|
+
* @param [colorMap] - Color map passed to every bar.
|
|
92
|
+
* @param [defaultExpanded=true] - Whether the accordion is expanded initially.
|
|
93
|
+
* @param [nonCollapsible] - Renders the group permanently expanded without a toggle or chevron.
|
|
94
|
+
* @param [isLoading] - Renders a loader in place of the bars while the data is being fetched.
|
|
95
|
+
* @param [onBarClick] - Invoked with the entry key and value when a bar (or, in compare mode, the whole entry) is clicked.
|
|
96
|
+
* @param [inline] - Renders every bar on a single row (50% title, 50% bar + value).
|
|
97
|
+
* @param [barTitleClassName] - Additional CSS classes for each bar's title label.
|
|
98
|
+
* @param [barValueClassName] - Additional CSS classes for each bar's value label.
|
|
99
|
+
* @param [barClassName] - Additional CSS classes for each bar's outer container. In compare mode they apply to the shared pair container (one continuous block); the entry is a Tailwind `group` — use `group-hover:` for pair hover; when `onBarClick` is set that container also gets a default accent fill on hover and `:focus-visible`.
|
|
100
|
+
* @param [barDescriptions] - Map of bar key to tooltip content. Hovering each bar shows its description.
|
|
101
|
+
* @param [className] - Additional CSS classes for the accordion container.
|
|
102
|
+
*/
|
|
103
|
+
export declare const AnalyticsBarGroup: FC<AnalyticsBarGroupProps>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AnalyticsCardCompareItem } from '../../../../models/analytics';
|
|
3
|
+
import { AnalyticsCardVariant } from '../../../../types/analytics';
|
|
4
|
+
export interface AnalyticsCardProps {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
value?: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
variant?: AnalyticsCardVariant;
|
|
9
|
+
/** Renders an error tag in place of the value when the value is unavailable. */
|
|
10
|
+
error?: boolean;
|
|
11
|
+
/** Renders a loader in place of the value while the value is being fetched. */
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
/** Additional CSS classes for the outer container. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* When provided, shows a delta badge next to the title.
|
|
17
|
+
* Values ≥ 0 use `bg-success text-success`; negative values use error styles.
|
|
18
|
+
* Positive values are prefixed with `+`.
|
|
19
|
+
*/
|
|
20
|
+
delta?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Overrides the automatic sign-based style of the delta badge.
|
|
23
|
+
* Use when a positive delta is semantically bad (e.g. response time went up)
|
|
24
|
+
* or a negative delta is semantically good (e.g. error rate went down).
|
|
25
|
+
* When omitted, `delta ≥ 0` → success, `delta < 0` → error.
|
|
26
|
+
*/
|
|
27
|
+
deltaPositive?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Suffix appended to the formatted delta with no space (e.g. `"s"` → `+9s`,
|
|
30
|
+
* `-19s`). Any string is valid (`s`, `ms`, `%`).
|
|
31
|
+
*/
|
|
32
|
+
deltaUnit?: string;
|
|
33
|
+
/**
|
|
34
|
+
* When provided, enables compare mode: the value area is split 50/50 with a
|
|
35
|
+
* vertical divider and each side shows its own sub-title and value.
|
|
36
|
+
* `value` is ignored when `compareValues` is set.
|
|
37
|
+
*/
|
|
38
|
+
compareValues?: [AnalyticsCardCompareItem, AnalyticsCardCompareItem];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A simple analytics summary card that displays a single metric as a title,
|
|
42
|
+
* a prominent value, and an optional description.
|
|
43
|
+
* aliases: MetricCard|StatCard|KpiCard
|
|
44
|
+
* Design system 2.0
|
|
45
|
+
*
|
|
46
|
+
* Two visual variants are available via the {@link AnalyticsCardVariant} enum:
|
|
47
|
+
* - `Default` — `bg-layer-3`, large `dial-display2-text` value, supports a description.
|
|
48
|
+
* - `Compact` — denser `bg-layer-2` card with a `dial-body-semi-text` value and no
|
|
49
|
+
* description (the `description` prop is ignored in this variant).
|
|
50
|
+
*
|
|
51
|
+
* **Compare mode** — pass `compareValues` to split the value area 50/50 between two
|
|
52
|
+
* metrics, each with its own sub-title. Long sub-titles truncate to a single line and
|
|
53
|
+
* show the full text in a tooltip. Pair with `delta` to show a change badge next
|
|
54
|
+
* to the card title, and `deltaUnit` for a suffix such as `"s"`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <AnalyticsCard
|
|
59
|
+
* title="Total requests"
|
|
60
|
+
* value="12,480"
|
|
61
|
+
* description="+12% vs last week"
|
|
62
|
+
* />
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <AnalyticsCard
|
|
68
|
+
* title="Response time"
|
|
69
|
+
* delta={9}
|
|
70
|
+
* deltaUnit="s"
|
|
71
|
+
* deltaPositive={false}
|
|
72
|
+
* compareValues={[
|
|
73
|
+
* { title: 'This week', value: '248ms' },
|
|
74
|
+
* { title: 'Last week', value: '220ms' },
|
|
75
|
+
* ]}
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @param title - Short label describing the metric, rendered above the value.
|
|
80
|
+
* @param [value] - The primary metric value. Ignored when `compareValues` is set.
|
|
81
|
+
* @param [description] - Optional supporting text. Ignored when `variant` is `Compact`.
|
|
82
|
+
* @param [variant=AnalyticsCardVariant.Default] - Visual style of the card.
|
|
83
|
+
* @param [error] - Renders an error tag in place of the value.
|
|
84
|
+
* @param [isLoading] - Renders a loader in place of the value.
|
|
85
|
+
* @param [className] - Additional CSS classes for the card container.
|
|
86
|
+
* @param [delta] - Numeric change shown as a badge next to the title. ≥0 = success, <0 = error.
|
|
87
|
+
* @param [deltaPositive] - Overrides sign-based badge colour. Use for lower-is-better metrics.
|
|
88
|
+
* @param [deltaUnit] - Suffix appended to the formatted delta (e.g. `"s"` → `+9s`).
|
|
89
|
+
* @param [compareValues] - Enables compare mode with two side-by-side metrics.
|
|
90
|
+
*/
|
|
91
|
+
export declare const AnalyticsCard: FC<AnalyticsCardProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AnalyticsBarColorStop } from '../../../../models/analytics';
|
|
3
|
+
export interface AnalyticsHistogramProps {
|
|
4
|
+
/** Title rendered above the histogram. */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Values to distribute across the columns. */
|
|
7
|
+
values: number[];
|
|
8
|
+
/**
|
|
9
|
+
* Ordered color bands defining the columns (and their colors), keyed by value.
|
|
10
|
+
* Defaults to {@link DEFAULT_ANALYTICS_BAR_COLOR_MAP}.
|
|
11
|
+
*/
|
|
12
|
+
colorMap?: AnalyticsBarColorStop[];
|
|
13
|
+
/** Noun used in the hover tooltip: `"{n} out of {k} {valueTitle}"`. */
|
|
14
|
+
valueTitle?: string;
|
|
15
|
+
/** When `true`, renders each column's count inside its bar. */
|
|
16
|
+
showCount?: boolean;
|
|
17
|
+
/** Renders a loader in place of the histogram while the data is being fetched. */
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
/** Additional CSS classes for the outer container. */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Second set of values to overlay in compare mode. Primary bars are striped; compare bars are solid. */
|
|
22
|
+
compareValues?: number[];
|
|
23
|
+
/** Label for the primary values set, shown on the first tooltip line in compare mode. */
|
|
24
|
+
valueSetLabel?: string;
|
|
25
|
+
/** Label for the compare values set, shown on the first tooltip line in compare mode. */
|
|
26
|
+
compareValueSetLabel?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A histogram that distributes `values` across the bands of a color map and draws a
|
|
30
|
+
* column per band. Each column's height is relative to the Y-axis max (an even
|
|
31
|
+
* ceiling of the dataset size — the "out of N" in the tooltip). Empty columns
|
|
32
|
+
* are outlined, populated columns are filled with their band color. A left
|
|
33
|
+
* Y-axis (count) and horizontal grid lines provide scale; interval labels run
|
|
34
|
+
* along the bottom. Hovering a column reveals a tooltip with its share of the
|
|
35
|
+
* total.
|
|
36
|
+
* aliases: Distribution|ColumnChart|FrequencyChart
|
|
37
|
+
* Design system 2.0
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <AnalyticsHistogram
|
|
42
|
+
* title="Score distribution"
|
|
43
|
+
* values={[0.1, 0.15, 0.4, 0.42, 0.43, 0.9, 1]}
|
|
44
|
+
* valueTitle="responses"
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param title - Title rendered above the histogram.
|
|
49
|
+
* @param values - Values to distribute across the columns.
|
|
50
|
+
* @param [colorMap=DEFAULT_ANALYTICS_BAR_COLOR_MAP] - Color bands defining the columns.
|
|
51
|
+
* @param [valueTitle='values'] - Noun used in the hover tooltip.
|
|
52
|
+
* @param [showCount] - When `true`, renders each column's count inside its bar.
|
|
53
|
+
* @param [isLoading] - Renders a loader in place of the histogram while the data is being fetched.
|
|
54
|
+
* @param [className] - Additional CSS classes for the outer container.
|
|
55
|
+
* @param [compareValues] - Second set of values; enables compare mode (primary striped, compare solid).
|
|
56
|
+
* @param [valueSetLabel] - Label for the primary values set (compare mode tooltip).
|
|
57
|
+
* @param [compareValueSetLabel] - Label for the compare values set (compare mode tooltip).
|
|
58
|
+
*/
|
|
59
|
+
export declare const AnalyticsHistogram: FC<AnalyticsHistogramProps>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface LabelledTextProps {
|
|
3
|
+
/** Small caption above the value, naming it. */
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** The value. Truncates with an ellipsis, revealing the full text in a tooltip only when clipped. */
|
|
6
|
+
text?: ReactNode;
|
|
7
|
+
/** Tooltip content shown instead of `text` while it is clipped. */
|
|
8
|
+
tooltip?: ReactNode;
|
|
9
|
+
/** Custom value content, rendered instead of `text`. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** Element after the value, e.g. a copy button. */
|
|
12
|
+
postfix?: ReactNode;
|
|
13
|
+
/** Additional CSS classes for the root element. */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A read-only label/value pair: a small caption above a value.
|
|
18
|
+
* aliases: LabelValue|DisplayText|ReadOnlyField|KeyValue
|
|
19
|
+
* Design system 2.0
|
|
20
|
+
*
|
|
21
|
+
* The caption is the kit's `Label`, so it matches the other 2.0 fields. There is
|
|
22
|
+
* no control to point its `htmlFor` at: it sits beside the value and reads in
|
|
23
|
+
* DOM order. It is not a form field: use `Label` with an input for editable
|
|
24
|
+
* values.
|
|
25
|
+
*
|
|
26
|
+
* Without `children` the value is a single line capped at 200px that truncates;
|
|
27
|
+
* the tooltip appears only while the text is actually clipped. With `children`
|
|
28
|
+
* the value takes the content's own width.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <LabelledText label="Endpoint" text="https://example.com/v1/chat" />
|
|
33
|
+
*
|
|
34
|
+
* <LabelledText
|
|
35
|
+
* label="Key"
|
|
36
|
+
* text="sk-0000"
|
|
37
|
+
* postfix={<IconButton icon={<IconCopy />} ariaLabel="Copy key" />}
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param label - Caption above the value.
|
|
42
|
+
* @param [text] - The value, truncated with an ellipsis when it does not fit.
|
|
43
|
+
* @param [tooltip] - Tooltip content used instead of `text` while it is clipped.
|
|
44
|
+
* @param [children] - Custom value content, rendered instead of `text`.
|
|
45
|
+
* @param [postfix] - Element after the value.
|
|
46
|
+
* @param [className] - Additional CSS classes for the root element.
|
|
47
|
+
*/
|
|
48
|
+
export declare const LabelledText: FC<LabelledTextProps>;
|
|
@@ -32,6 +32,16 @@ export declare const DIAL_KIT_CLASS: {
|
|
|
32
32
|
readonly errorText: "dial-kit-error-text";
|
|
33
33
|
/** The `Label` root, which wraps the `label` element and its info button. */
|
|
34
34
|
readonly label: "dial-kit-label";
|
|
35
|
+
/** The root of a `LabelledText`, wrapping its caption and value. */
|
|
36
|
+
readonly labelledText: "dial-kit-labelled-text";
|
|
37
|
+
/** The root of an `AnalyticsCard`: the box holding its title, value and description. */
|
|
38
|
+
readonly analyticsCard: "dial-kit-analytics-card";
|
|
39
|
+
/** The root of an `AnalyticsBar`: the title row and track, stacked or inline. */
|
|
40
|
+
readonly analyticsBar: "dial-kit-analytics-bar";
|
|
41
|
+
/** The root of an `AnalyticsBarGroup`: its accordion, header and bars. */
|
|
42
|
+
readonly analyticsBarGroup: "dial-kit-analytics-bar-group";
|
|
43
|
+
/** The root of an `AnalyticsHistogram`: its title, axis and columns. */
|
|
44
|
+
readonly analyticsHistogram: "dial-kit-analytics-histogram";
|
|
35
45
|
/** The `article` element of a `CardShell`. */
|
|
36
46
|
readonly cardShell: "dial-kit-card-shell";
|
|
37
47
|
/** The `aside` element of a `CollapsibleSidebar`. */
|
package/dist/src/index.d.ts
CHANGED
|
@@ -124,7 +124,17 @@ export type { MultiSelectTagsProps } from './components/New/Select/MultiSelectTa
|
|
|
124
124
|
export { InfoButton } from './components/New/InfoButton/InfoButton';
|
|
125
125
|
export type { InfoButtonProps } from './components/New/InfoButton/InfoButton';
|
|
126
126
|
export type { LabelProps } from './components/New/Label/Label';
|
|
127
|
+
export { AnalyticsCard } from './components/New/Analytics/Card/Card';
|
|
128
|
+
export type { AnalyticsCardProps } from './components/New/Analytics/Card/Card';
|
|
129
|
+
export { AnalyticsBar } from './components/New/Analytics/Bar/Bar';
|
|
130
|
+
export type { AnalyticsBarProps } from './components/New/Analytics/Bar/Bar';
|
|
131
|
+
export { AnalyticsBarGroup } from './components/New/Analytics/BarGroup/BarGroup';
|
|
132
|
+
export type { AnalyticsBarGroupProps } from './components/New/Analytics/BarGroup/BarGroup';
|
|
133
|
+
export { AnalyticsHistogram } from './components/New/Analytics/Histogram/Histogram';
|
|
134
|
+
export type { AnalyticsHistogramProps } from './components/New/Analytics/Histogram/Histogram';
|
|
127
135
|
export { Label } from './components/New/Label/Label';
|
|
136
|
+
export type { LabelledTextProps } from './components/New/LabelledText/LabelledText';
|
|
137
|
+
export { LabelledText } from './components/New/LabelledText/LabelledText';
|
|
128
138
|
export { Textarea, TextareaResize } from './components/New/Textarea/Textarea';
|
|
129
139
|
export { Input } from './components/New/Input/Input';
|
|
130
140
|
export type { InputProps } from './components/New/Input/Input';
|